Trunk reorganization 2.
git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/branches/xmlbeans_v1_branch@111285 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/v1/CHANGES.txt b/v1/CHANGES.txt
new file mode 100644
index 0000000..1bc660a
--- /dev/null
+++ b/v1/CHANGES.txt
@@ -0,0 +1,12 @@
+Changes since v1.0.2:
+
+- interface extension (Cezar Andrei)
+- pre/post extension (Cezar Andrei)
+- interface extension tests (Yana Kadiyska)
+- pre/post extension tests (Yana Kadiyska)
+- build xbean_xpath.jar by default (Cezar Andrei)
+- fixed an NPE in the Validator (Cezar Andrei)
+- perf improvement when using List.toArray() by passing in
+ an array of right size (Kevin Krouse)
+- fixed memory leak in CursorData (Cid Dennis/Kevin Krouse)
+- add option to pass in "##local" to -allowmdef (Ray Birklid/Radu Preotiuc)
diff --git a/v1/LICENSE.txt b/v1/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/v1/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/v1/NOTICE.txt b/v1/NOTICE.txt
new file mode 100644
index 0000000..439eb83
--- /dev/null
+++ b/v1/NOTICE.txt
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/v1/README.txt b/v1/README.txt
new file mode 100644
index 0000000..92fc2f3
--- /dev/null
+++ b/v1/README.txt
@@ -0,0 +1,93 @@
+XMLBeans v1.0.3
+
+Welcome to XmlBeans!
+
+
+If you've come here to learn more about XmlBeans, here are a few
+starting points:
+
+
+
+
+(1) Docs
+
+If you "ant docs" then you can get javadocs built for a bunch
+of our stuff. In particular, look at the org.apache.xmlbeans package,
+starting with XmlObject and XmlCursor.
+
+Not a lot is doc'ed yet, so you may want to check out the samples
+to learn more - we really need a little tutorial.
+
+In the mean time, if you've got more questions, please post your questions
+to xmlbeans-user@xml.apache.org (you need to subscribe prior to posting,
+by sending a blank mail to xmlbeans-user-subscribe@xml.apache.org).
+
+
+
+(2) Build
+
+The default target, aka "ant default", builds everything you need
+to test and run.
+
+
+Other targets:
+ ant build: builds the public interface jars so other dependencies can compile
+ ant deploy: builds xbean.jar too
+ ant drt: builds drt tests too
+ ant bootstrap: builds xbean.jar, then builds it again using itself.
+
+
+Interface JARs:
+
+xmlpublic.jar - the XBeans public interfaces, for use by our users.
+wlxbean.jar - interfaces specific to the IDE/runtime, not for use by others.
+
+
+Implementation JARs:
+
+xbean.jar - the whole xbean.jar - everything you need to run. When this
+ is on your classpath, you don't need xmlpublic.jar or wlxbean.jar
+
+
+Testing JARs:
+
+drt.jar - our DRT
+enumtest.jar, easypo.jar, nameworld.jar, xstypes.jar - sample XBean JARs.
+
+
+Other JARs:
+
+oldxbean.jar - a fully built previous-version of xbean.jar, used for
+ bootstrapping, since xbeans are used in building xbean.jar itself.
+
+
+
+
+
+(3) Running
+
+There are a few ways you can run. There is some pretty plain-jane
+JUnit testing code checked into xbean\test\src\drt that you can
+use to see how to exercise our functionality. (The tests in that
+directory are our Developer Regression Tests.)
+
+You can run the drt using xbean\bin\drt[.sh|.cmd].
+
+Another tool that you can use is "scomp", the XBean schema
+compiler. The scomp script is at xbean\bin\scomp[.sh|.cmd].
+
+To run scomp, just point it at an XSD file or a directory full
+of XSD files, and it will produce an output .jar with all your
+types.
+
+Since scomp jars up its results, it can be hard to see what it
+is doing. But if you use the "-src mydir" option with scomp,
+you can specify a directory into which it will dump .java source
+code files that correspond to the java types it is generating.
+
+Finally, there is a utility called "dumpxsb". If you unjar
+a built xbean jar, you'll notice a bunch of .xsb files scattered
+about. Each one of these files represents a schema type, attribute,
+or element definition, and you can use "dumpxsb" to see the
+contents.
+
diff --git a/v1/bin/dumpxsb b/v1/bin/dumpxsb
new file mode 100755
index 0000000..e024da5
--- /dev/null
+++ b/v1/bin/dumpxsb
@@ -0,0 +1,19 @@
+#!/bin/sh
+#XSB file dumper
+#Prints the contents of an xsb file in human-readmble form
+
+cp=
+
+if [ -e $XMLBEANS_HOME/build/ar/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar;
+elif [ -e $XMLBEANS_HOME/lib/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/lib/xbean.jar;
+fi
+
+case "`uname`" in
+ CYGWIN*)
+ cp=`cygpath -w -p $cp`
+ ;;
+esac
+
+java -classpath $cp org.apache.xmlbeans.impl.tool.XsbDumper $*
diff --git a/v1/bin/dumpxsb.cmd b/v1/bin/dumpxsb.cmd
new file mode 100644
index 0000000..749fe1a
--- /dev/null
+++ b/v1/bin/dumpxsb.cmd
@@ -0,0 +1,19 @@
+@rem XSB file dumper
+@rem
+@rem Prints the contents of an xsb file in human-readable form
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.XsbDumper %*
+
+:done
diff --git a/v1/bin/jaxbc.cmd b/v1/bin/jaxbc.cmd
new file mode 100644
index 0000000..a9d2079
--- /dev/null
+++ b/v1/bin/jaxbc.cmd
@@ -0,0 +1,16 @@
+@rem Schema compiler
+@rem
+@rem Builds jaxb types from xsd files.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar
+set cp=%cp%;%XMLBEANS_HOME%\external\lib\jaxb-1.0\jaxb-api.jar
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.SchemaCompiler -jaxb %*
+
+:done
diff --git a/v1/bin/random.cmd b/v1/bin/random.cmd
new file mode 100644
index 0000000..0727d26
--- /dev/null
+++ b/v1/bin/random.cmd
@@ -0,0 +1,16 @@
+@echo off
+
+@rem DRT
+@rem
+@rem Invokes Random test
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar
+set cp=%cp%;%XMLBEANS_HOME%\build\private\lib\random.jar
+set cp=%cp%;%XMLBEANS_HOME%\build\private\lib\easypo.jar
+
+rem java -ea -Dtreeasserts=true -Dxbean.rootdir=%XMLBEANS_HOME% -classpath %cp% Random -noquery %*
+ java -ea -Dtreeasserts=false -Dxbean.rootdir=%XMLBEANS_HOME% -classpath %cp% Random -noquery %*
diff --git a/v1/bin/scomp b/v1/bin/scomp
new file mode 100755
index 0000000..27cbeee
--- /dev/null
+++ b/v1/bin/scomp
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#Schema compiler
+#Builds XBean types from xsd files.
+
+cp=
+
+if [ -e $XMLBEANS_HOME/build/ar/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar;
+elif [ -e $XMLBEANS_HOME/lib/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/lib/xbean.jar;
+fi
+
+case "`uname`" in
+ CYGWIN*)
+ cp=`cygpath -w -p $cp`
+ ;;
+esac
+
+java -classpath $cp org.apache.xmlbeans.impl.tool.SchemaCompiler $*
diff --git a/v1/bin/scomp.cmd b/v1/bin/scomp.cmd
new file mode 100644
index 0000000..63fb056
--- /dev/null
+++ b/v1/bin/scomp.cmd
@@ -0,0 +1,20 @@
+@rem Schema compiler
+@rem
+@rem Builds XBean types from xsd files.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.SchemaCompiler %*
+
+:done
diff --git a/v1/bin/scopy.cmd b/v1/bin/scopy.cmd
new file mode 100644
index 0000000..3529a62
--- /dev/null
+++ b/v1/bin/scopy.cmd
@@ -0,0 +1,20 @@
+@rem Schema compiler
+@rem
+@rem Builds XBean types from xsd files.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.SchemaCopy %*
+
+:done
diff --git a/v1/bin/sdownload.cmd b/v1/bin/sdownload.cmd
new file mode 100644
index 0000000..1bb3e2b
--- /dev/null
+++ b/v1/bin/sdownload.cmd
@@ -0,0 +1,20 @@
+@rem Schema downloader
+@rem
+@rem Tool to download schemas.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.SchemaResourceManager %*
+
+:done
diff --git a/v1/bin/sfactor.cmd b/v1/bin/sfactor.cmd
new file mode 100644
index 0000000..0334e32
--- /dev/null
+++ b/v1/bin/sfactor.cmd
@@ -0,0 +1,20 @@
+@rem Schema Factoring tool
+@rem
+@rem Factores redundant definitions out of a set of schemas and uses imports instead.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.FactorImports %*
+
+:done
diff --git a/v1/bin/validate b/v1/bin/validate
new file mode 100755
index 0000000..9589dc9
--- /dev/null
+++ b/v1/bin/validate
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Instance Validator
+#
+# Validates an instance against a schema.
+
+CP=
+
+if [ -e $XMLBEANS_HOME/build/ar/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar;
+elif [ -e $XMLBEANS_HOME/lib/xbean.jar ]; then
+ cp=$cp:$XMLBEANS_HOME/lib/xbean.jar;
+fi
+
+case "`uname`" in
+ CYGWIN*)
+ CP=`cygpath -w -p $CP`
+ ;;
+esac
+
+java -classpath $CP org.apache.xmlbeans.impl.tool.InstanceValidator $*
diff --git a/v1/bin/validate.cmd b/v1/bin/validate.cmd
new file mode 100644
index 0000000..b03dd41
--- /dev/null
+++ b/v1/bin/validate.cmd
@@ -0,0 +1,20 @@
+@rem Instance Validator
+@rem
+@rem Validates an instance against a schema.
+
+@echo off
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.InstanceValidator %*
+
+:done
diff --git a/v1/bin/xpretty.cmd b/v1/bin/xpretty.cmd
new file mode 100644
index 0000000..01fe13b
--- /dev/null
+++ b/v1/bin/xpretty.cmd
@@ -0,0 +1,16 @@
+@echo off
+
+@rem Invokes pretty printer
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.PrettyPrinter %*
diff --git a/v1/bin/xsdtree.cmd b/v1/bin/xsdtree.cmd
new file mode 100644
index 0000000..426202c
--- /dev/null
+++ b/v1/bin/xsdtree.cmd
@@ -0,0 +1,16 @@
+@echo off
+
+@rem Invokes type hierarchy printer
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.TypeHierarchyPrinter %*
diff --git a/v1/bin/xstc.cmd b/v1/bin/xstc.cmd
new file mode 100644
index 0000000..33b8e7b
--- /dev/null
+++ b/v1/bin/xstc.cmd
@@ -0,0 +1,16 @@
+@echo off
+
+@rem Invokes XSTC
+
+setlocal
+if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
+
+set cp=
+
+if EXIST %XMLBEANS_HOME%\build\ar\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\build\ar\xbean.jar.
+) else if EXIST %XMLBEANS_HOME%\lib\xbean.jar. (
+ set cp=%cp%;%XMLBEANS_HOME%\lib\xbean.jar.
+)
+
+java -classpath %cp% org.apache.xmlbeans.impl.tool.XSTCTester %*
diff --git a/v1/build.xml b/v1/build.xml
new file mode 100644
index 0000000..0a8733e
--- /dev/null
+++ b/v1/build.xml
@@ -0,0 +1,1118 @@
+<!-- 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. -->
+<project name="Xbean" default="default" basedir=".">
+
+ <property name="build.compiler" value="javac1.4"/>
+ <property name="product.version" value="1.0.3"/>
+
+ <target name="usage">
+ <echo message="The following ant targets are defined:"/>
+ <echo message="usage - this help text"/>
+ <echo message="build - builds our public interface jars so others can compile"/>
+ <echo message="deploy - builds our implementation jar (xbean.jar)"/>
+ <echo message="clean - cleans out the xbeans directories"/>
+ <echo message="builddrt - builds, but does not run, the xbean drt"/>
+ <echo message="drt - runs the xbean drt"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="build"/>
+ </target>
+
+ <target name="deploy" depends="sources, xbean, drt.jar, random.jar" />
+
+ <target name="sources" depends="dirs">
+ <zip destfile="build/ar/xbeansrc.zip" basedir="." excludes="build/**"/>
+ </target>
+
+ <target name="xbean" depends="xbean.jar">
+ <copy file="build/lib/xbean.jar" tofile="build/ar/xbean.jar"/>
+ </target>
+
+ <target name="dirs">
+ <mkdir dir="build"/>
+ <mkdir dir="build/classes"/>
+ <mkdir dir="build/lib"/>
+ <mkdir dir="build/ar"/>
+ <mkdir dir="build/src"/>
+ <mkdir dir="build/private"/>
+ <mkdir dir="build/private/classes"/>
+ <mkdir dir="build/private/lib"/>
+ </target>
+
+ <target name="drt" >
+ <echo message="Running random tester"/>
+ <java classname="Random" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="build/ar/xbean.jar"/>
+ <pathelement location="build/private/lib/easypo.jar"/>
+ <pathelement location="build/private/lib/random.jar"/>
+ </classpath>
+ <jvmarg value="-ea"/>
+ <arg line="-seed 0 -i 20 -noquery"/>
+ </java>
+
+ <mkdir dir="build/test/output"/>
+ <echo message="Running xbean product drt tests"/>
+ <echo message="JUnit output being sent to build/test/output/drt-product.txt"/>
+ <junit fork="yes" printsummary="yes" haltonfailure="yes" showoutput="yes">
+ <jvmarg value="-ea"/>
+ <sysproperty key="xbean.rootdir" value="${basedir}"/>
+ <sysproperty key="treeasserts" value="true"/>
+ <classpath>
+ <pathelement location="external/lib/junit.jar"/>
+ <pathelement location="build/ar/xbean.jar"/>
+ <pathelement location="build/private/lib/drt.jar"/>
+ <pathelement location="build/private/lib/easypo.jar"/>
+ <pathelement location="build/private/lib/schemas.jar"/>
+ <pathelement location="build/private/lib/xstypes.jar"/>
+ <pathelement location="build/private/lib/enumtest.jar"/>
+ <pathelement location="build/private/lib/numerals.jar"/>
+ <pathelement location="build/lib/xbean_xpath.jar"/>
+ <pathelement location="build/lib/jaxen.jar"/>
+ </classpath>
+ <formatter type="plain"/>
+ <test name="drtcases.SmokeTests" outfile="build/test/output/drt-product" />
+ </junit>
+
+ <antcall target="extensionsTest" />
+ </target>
+
+ <!-- extensions test -->
+ <fileset id="extension.jars" dir="build/private/lib">
+ <include name="extensions.jar"/>
+ <include name="fixedAttrBean.jar"/>
+ <include name="averageCase.jar"/>
+ <include name="multInterfaces.jar"/>
+ <include name="readOnlyBean.jar"/>
+ <include name="ValueRestriction.jar"/>
+ </fileset>
+
+ <target name="extensionsTest" depends="extensions.compile">
+ <echo message="JUnit output being sent to build/test/output/drt-extensions.txt"/>
+ <junit fork="yes" printsummary="yes" haltonfailure="yes" showoutput="yes">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="external/lib/junit.jar"/>
+ <fileset refid="extension.jars"/>
+ <pathelement location="build/test/extensionsuse"/>
+ </classpath>
+ <formatter type="plain"/>
+ <test name="drtcases.ExtensionsTest" outfile="build/test/output/drt-extensions"/>
+ </junit>
+ </target>
+
+ <!--The extensions use the bean types, compile first-->
+ <target name="simpleBeans.check">
+ <uptodate property="simpleBeans.notRequired" targetfile="build/private/lib/fixedAttrBean.jar">
+ <srcfiles dir="test/src/extensions" includes="**/*"/>
+ <srcfiles dir="test/src/extensionsuse" includes="**/*"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="build.simpleBeans" unless="simpleBeans.notRequired" depends="simpleBeans.check">
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/fixedAttrBean.jar test/src/extensions/fixedAttrBean/po.xsd"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/averageCase.jar test/src/extensions/averageCase/po.xsd"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/multInterfaces.jar test/src/extensions/multInterfaces/po.xsd"/>
+ </java>
+
+ <!-- **Pre/Post Handlers -->
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/readOnlyBean.jar test/src/extensions/prePostFeature/readOnlyBean/po.xsd"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/ValueRestriction.jar test/src/extensions/prePostFeature/ValueRestriction/company.xsd"/>
+ </java>
+ </target>
+
+ <target name="extensions.compile" depends="build.simpleBeans, simpleBeans.check" unless="simpleBeans.notRequired">
+ <mkdir dir="build/test/extensions"/>
+ <javac srcdir="test/src/extensions" destdir="build/test/extensions" debug="on">
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <fileset refid="extension.jars"/>
+ </classpath>
+ </javac>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/extensions.jar test/src/extensions/myPackage"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/fixedAttrBean.jar test/src/extensions/fixedAttrBean"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/averageCase.jar test/src/extensions/averageCase"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/multInterfaces.jar test/src/extensions/multInterfaces"/>
+ </java>
+ <!--Pre Post Feature -->
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/readOnlyBean.jar test/src/extensions/prePostFeature/readOnlyBean"/>
+ </java>
+
+ <java classname="${schema_compiler}" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="build/test/extensions"/>
+ </classpath>
+ <arg line="-out build/private/lib/ValueRestriction.jar test/src/extensions/prePostFeature/ValueRestriction"/>
+ </java>
+
+
+ <mkdir dir="build/test/extensionsuse"/>
+ <javac srcdir="test/src/extensionsuse" destdir="build/test/extensionsuse" debug="on">
+ <classpath>
+ <pathelement location="build/ar/xbean.jar" />
+ <pathelement location="external/lib/junit.jar"/>
+ <fileset refid="extension.jars"/>
+ <pathelement location="build/test/extensionsuse"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <!-- builddrt target -->
+ <target name="builddrt" depends="drt.jar, random.jar, eric"/>
+
+ <target name="eric" depends="erictest.jar"/>
+
+ <target name="default" depends="deploy, builddrt"/>
+
+ <target name="redeploy" depends="clean, deploy"/>
+
+ <!-- oldxbean.jar target =========================================== -->
+
+ <target name="oldxbean.jar">
+ <copy file="external/lib/oldxbean.jar" tofile="build/private/lib/oldxbean.jar"/>
+ </target>
+
+ <!-- bootstrap target ============================================== -->
+
+ <target name="bootstrap" depends="xbean">
+
+ <!-- after xbean.jar is built, move it out of the way and clean the project -->
+ <tempfile property="bootstrap.jarfile" prefix="oldxbean" suffix=".jar"/>
+ <move file="build/ar/xbean.jar" tofile="${bootstrap.jarfile}"/>
+ <antcall target="clean" inheritAll="false"/>
+
+ <!-- then move it back into place as oldxbean.jar and do another build -->
+ <move file="${bootstrap.jarfile}" tofile="build/private/lib/oldxbean.jar"/>
+ <antcall target="xbean" inheritAll="false"/>
+
+ <!-- compare the contents of the first jar to the contents of the second jar -->
+ <antcall target="zipcompare.classes" inheritAll="false"/>
+ <java classname="zipcompare.ZipCompare"
+ classpath="build/private/classes/zipcompare"
+ fork="true"
+ failonerror="true">
+ <arg line="build/ar/xbean.jar build/private/lib/oldxbean.jar"/>
+ </java>
+
+ <!-- when everything succeeds, copy oldxbean.jar to external/lib -->
+ <echo message="==================================="/>
+ <echo message="Results match! Bootstrap succeeded."/>
+ <echo message="==================================="/>
+ <echo message="Attempting to copy oldxbean.jar"/>
+ <echo message="If the copy fails, you must check out oldxbean.jar"/>
+ <echo message="overwriting old external/lib/oldxbean.jar"/>
+ <copy file="build/private/lib/oldxbean.jar" tofile="external/lib/oldxbean.jar"/>
+ </target>
+
+ <target name="quickbootstrap">
+ <echo message="=========================================================="/>
+ <echo message="Bootstrapping currently built xbean.jar without verifying."/>
+ <echo message="=========================================================="/>
+ <copy file="build/ar/xbean.jar" tofile="external/lib/oldxbean.jar"/>
+ </target>
+
+ <!-- zipcompare (for checking bootstrap) ============================ -->
+
+ <target name="zipcompare.classes">
+ <mkdir dir="build/private/classes/zipcompare"/>
+ <javac srcdir="src/zipcompare"
+ destdir="build/private/classes/zipcompare"
+ debug="on"/>
+ </target>
+
+ <!-- test target ================================================== -->
+
+ <path id="test.compile.path">
+ <pathelement location="external/lib/junit.jar"/>
+ <pathelement location="build/ar/xbean.jar"/>
+ <pathelement location="build/private/lib/easypo.jar"/>
+ <pathelement location="build/private/lib/ericschema.jar"/>
+ <pathelement location="build/private/lib/schemas.jar"/>
+ <pathelement location="build/private/lib/enumtest.jar"/>
+ <pathelement location="build/private/lib/xstypes.jar"/>
+ <pathelement location="build/lib/xbean_xpath.jar"/>
+ <pathelement location="build/private/lib/numerals.jar"/>
+ <pathelement location="build/lib/jaxen.jar"/>
+ <pathelement location="build/classes/xmlinputstream"/>
+ </path>
+
+ <path id="test.run.path">
+ <pathelement location="build/ar/xbean.jar"/>
+ <pathelement location="external/lib/junit.jar"/>
+ </path>
+
+ <!-- builddrt target ============================================== -->
+
+ <target name="drt.classes" depends="dirs, easypo.jar, schemas.jar,
+ xstypes.jar, enumtest.jar, xbean_xpath.jar, numerals.jar">
+ <mkdir dir="build/private/classes/drt"/>
+ <javac
+ srcdir="test/src/drt"
+ destdir="build/private/classes/drt"
+ classpathref="test.compile.path"
+ source="1.4"
+ debug="on"/>
+ </target>
+
+ <target name="drt.jar" depends="drt.classes">
+ <jar jarfile="build/private/lib/drt.jar" basedir="build/private/classes/drt"/>
+ </target>
+
+ <!-- stsschema (for testing) target ================================ -->
+
+ <path id="scomp.run.path">
+ <pathelement location="build/lib/xbean.jar"/>
+ </path>
+
+ <target name="stsschema.check">
+ <uptodate property="stsschema.notRequired" targetfile="build/private/lib/stsschema.jar">
+ <srcfiles dir="test/src/stsschema" includes="**/*.xsd"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="stsschema.jar" depends="stsschema.check, dirs, xbean" unless="stsschema.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/stsschema.jar test/src/stsschema"/>
+ </java>
+ </target>
+
+ <!-- soaptest target ============================================ -->
+
+ <target name="soaptest.classes" depends="dirs, stsschema.jar">
+ <mkdir dir="build/private/classes/soaptest"/>
+ <javac srcdir="test/src/soaptest" destdir="build/private/classes/soaptest" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="external/lib/jdom.jar"/>
+ <pathelement location="external/lib/junit.jar"/>
+ <pathelement location="build/ar/xbean.jar"/>
+ <pathelement location="build/private/lib/stsschema.jar"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <target name="soaptest.jar" depends="soaptest.classes">
+ <jar jarfile="build/private/lib/soaptest.jar" basedir="build/private/classes/soaptest"/>
+ </target>
+
+ <!-- erictest target ============================================= -->
+
+ <target name="erictest.classes" depends="dirs, xbean, ericschema.jar">
+ <mkdir dir="build/private/classes/erictest"/>
+ <javac
+ srcdir="test/src/erictest"
+ destdir="build/private/classes/erictest"
+ classpathref="test.compile.path"
+ source="1.4"
+ debug="on"/>
+ </target>
+
+ <target name="erictest.jar" depends="erictest.classes">
+ <jar jarfile="build/private/lib/erictest.jar" basedir="build/private/classes/erictest"/>
+ </target>
+
+ <!-- random target ============================================= -->
+
+ <target name="random.classes" depends="dirs, xbean, easypo.jar">
+ <mkdir dir="build/private/classes/random"/>
+ <javac
+ srcdir="test/src/random"
+ destdir="build/private/classes/random"
+ classpathref="test.compile.path"
+ source="1.4"
+ debug="on"/>
+ </target>
+
+ <target name="random.jar" depends="random.classes">
+ <jar jarfile="build/private/lib/random.jar" basedir="build/private/classes/random"/>
+ </target>
+
+ <!-- teststore target ============================================= -->
+
+ <target name="teststore.classes" depends="dirs">
+ <mkdir dir="build/private/classes/teststore"/>
+ <javac srcdir="test/src/teststore" destdir="build/private/classes/teststore" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/private/classes/simpletypes"/>
+ <pathelement location="build/private/classes/xmlcomp"/>
+ <pathelement location="build/private/classes/typestore"/>
+ <pathelement location="build/private/classes/xmlpublic"/>
+ <pathelement location="build/private/classes/typeimpl"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <target name="teststore.jar" depends="teststore.classes">
+ <jar jarfile="build/private/lib/teststore.jar" basedir="build/private/classes/teststore"/>
+ </target>
+
+ <!-- simpletypes (for testing) target ============================= -->
+
+ <target name="simpletypes.check">
+ <uptodate property="simpletypes.notRequired" targetfile="build/private/lib/simpletypes.jar">
+ <srcfiles dir="test/cases/schema/simple" includes="**/*.xsd"/>
+ <srcfiles dir="build/private/lib" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="simpletypes.jar" depends="simpletypes.check, dirs" unless="simpletype.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-name schema.test.simple -out build/private/lib/simpletypes.jar test/cases/schema/simple"/>
+ </java>
+ </target>
+
+ <!-- easypo (for testing) target ================================== -->
+
+ <target name="easypo.check">
+ <uptodate property="easypo.notRequired" targetfile="build/private/lib/easypo.jar">
+ <srcfiles dir="test/src/easypo" includes="**/*"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="easypo.jar" depends="easypo.check, dirs, xbean" unless="easypo.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/easypo.jar test/src/easypo"/>
+ </java>
+ </target>
+
+ <!-- numerals (for testing) target ================================== -->
+ <target name="numerals.check">
+ <uptodate property="numerals.notRequired" targetfile="build/private/lib/numerals.jar">
+ <srcfiles dir="test/src/numerals" includes="**/*"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+ <target name="numerals.jar" depends="numerals.check, dirs, xbean" unless="numerals.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/numerals.jar test/src/numerals"/>
+ </java>
+ </target>
+
+ <!-- schemas (for testing) target ================================ -->
+
+ <target name="schemas.check">
+ <uptodate property="schemas.notRequired" targetfile="build/private/lib/schemas.jar">
+ <srcfiles dir="test/src/schemas" includes="**/*.xsd"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="schemas.jar" depends="schemas.check, dirs, xbean" unless="schemas.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/schemas.jar test/src/schemas"/>
+ </java>
+ </target>
+
+ <!-- ericschema (for testing) target ================================ -->
+
+ <target name="ericschema.check">
+ <uptodate property="ericschema.notRequired" targetfile="build/private/lib/ericschema.jar">
+ <srcfiles dir="test/src/ericschema" includes="**/*.xsd"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="ericschema.jar" depends="ericschema.check, dirs, xbean" unless="ericschema.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-src build/private/src -out build/private/lib/ericschema.jar test/src/ericschema"/>
+ </java>
+ </target>
+
+ <!-- enumtest (for testing) target ================================= -->
+
+ <target name="enumtest.check">
+ <uptodate property="enumtest.notRequired" targetfile="build/private/lib/enumtest.jar">
+ <srcfiles dir="test/src/enumtest" includes="**/*.xsd"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="enumtest.jar" depends="enumtest.check, dirs, xbean" unless="enumtest.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/enumtest.jar test/src/enumtest"/>
+ </java>
+ </target>
+
+ <!-- xstypes (for testing) target ================================= -->
+
+ <target name="xstypes.check">
+ <uptodate property="xstypes.notRequired" targetfile="build/private/lib/xstypes.jar">
+ <srcfiles dir="test/cases/schema/simple" includes="**/*.xsd"/>
+ <srcfiles dir="build/ar" includes="xbean.jar"/>
+ </uptodate>
+ </target>
+
+ <target name="xstypes.jar" depends="xstypes.check, dirs, xbean" unless="xstypes.notRequired">
+ <java classname="${schema_compiler}" classpathref="scomp.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="-out build/private/lib/xstypes.jar test/src/xstypes"/>
+ </java>
+ </target>
+
+ <!-- javadocs ====================================================== -->
+
+ <!-- All docs to build/docs, including guide and javadocs. -->
+
+ <target name="docs" depends="xbean">
+ <property name="docs.dir" value="build/docs"/>
+ <delete dir="${docs.dir}"/>
+ <mkdir dir="${docs.dir}"/>
+ <javadoc packagenames="*" sourcepath="src/xmlpublic" classpath="${javadoc.path}" destdir="${docs.dir}/reference" windowtitle="XMLBeans Documentation" source="1.4" stylesheetfile="docs/stylesheet.css">
+ <link href="http://xml.apache.org/xmlbeans/docs/reference/index.html"/>
+ <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+ <link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
+ <link href="http://xml.apache.org/xerces-j/apiDocs/"/>
+ <classpath>
+ <pathelement location="build/ar/xbean.jar"/>
+ </classpath>
+ </javadoc>
+ <copy file="docs/xmlbeans.css" tofile="${docs.dir}/xmlbeans.css" />
+ <copy todir="${docs.dir}/guide">
+ <fileset dir="docs/guide"/>
+ </copy>
+ <copy todir="${docs.dir}/images">
+ <fileset dir="docs/images"/>
+ </copy>
+ </target>
+
+ <!-- stream conformance tests ======================================= -->
+
+ <target name="streamtest.classes" depends="dirs">
+ <mkdir dir="build/private/classes/streamtest"/>
+ <javac
+ srcdir="test/src/streamtest"
+ destdir="build/private/classes/streamtest"
+ classpathref="test.compile.path"
+ source="1.4"
+ debug="on"/>
+ </target>
+
+ <target name="streamtest.jar" depends="streamtest.classes">
+ <jar jarfile="build/private/lib/streamtest.jar" basedir="build/private/classes/streamtest"/>
+ </target>
+
+ <path id="run.streamconf.path">
+ <path refid="test.run.path"/>
+ <pathelement location="build/private/classes/streamtest/"/>
+ </path>
+
+ <target name="streamconf" depends="streamtest.jar">
+ <java classname="streamtest.XmlStreamConformance"
+ classpathref="run.streamconf.path"
+ fork="true">
+ <jvmarg value="-ea"/>
+ <!--arg line="test/cases/streamconf/small.xml" /-->
+ <arg line="test/cases/streamconf/dtd.xml" />
+ </java>
+ </target>
+
+
+ <target name="dist" depends="dist-src, dist-bin">
+ </target>
+
+ <target name="dist-bin" depends="xbean, docs">
+ <delete dir="build/private/xmlbeans-${product.version}"/>
+ <delete file="build/private/xmlbeans-${product.version}.zip"/>
+ <delete file="build/private/xmlbeans-${product.version}.tgz"/>
+
+ <mkdir dir="build/private/xmlbeans-${product.version}"/>
+ <copy todir="build/private/xmlbeans-${product.version}">
+ <fileset dir="xkit"/>
+ <fileset dir="." includes="bin/**" />
+ <fileset file="CHANGES.txt" />
+ </copy>
+ <copy todir="build/private/xmlbeans-${product.version}/schemas/s4s">
+ <fileset dir="src/xsdschema/schema" includes="XMLSchema.xsd,w3c-schema-license.html"/>
+ <fileset dir="src/xmlschema/schema" includes="XML.xsd,w3c-xml-license.html"/>
+ </copy>
+ <copy todir="build/private/xmlbeans-${product.version}/schemas">
+ <fileset dir="test/src" includes="easypo/*.xsd, easypo/*.xsdconfig"/>
+ </copy>
+
+ <mkdir dir="build/private/xmlbeans-${product.version}/lib"/>
+ <copy todir="build/private/xmlbeans-${product.version}/lib" file="build/ar/xbean.jar"/>
+ <copy todir="build/private/xmlbeans-${product.version}/lib" file="external/lib/jaxen-1.1-beta-2.jar"/>
+ <copy todir="build/private/xmlbeans-${product.version}/lib" file="build/lib/xbean_xpath.jar"/>
+
+ <mkdir dir="build/private/xmlbeans-${product.version}/src/schema"/>
+ <copy todir="build/private/xmlbeans-${product.version}/src/schema">
+ <fileset dir="src/toolschema"/>
+ </copy>
+
+ <mkdir dir="build/private/xmlbeans-${product.version}/docs"/>
+ <copy todir="build/private/xmlbeans-${product.version}/docs">
+ <fileset dir="build/docs"/>
+ </copy>
+
+ <chmod dir="build/private/xmlbeans-${product.version}/bin" perm="ugo+rx" includes="**" />
+
+ <zip destfile="build/private/xmlbeans-${product.version}.zip"
+ basedir="build/private"
+ includes="xmlbeans-${product.version}/**"
+ excludes="xmlbeans-${product.version}/bin/dumpxsb,
+ xmlbeans-${product.version}/bin/scomp,
+ xmlbeans-${product.version}/bin/validate">
+ <zipfileset dir="." includes="src/license/LICENSE.txt" fullpath="xmlbeans-${product.version}/LICENSE.txt"/>
+ <zipfileset dir="." includes="src/license/NOTICE.txt" fullpath="xmlbeans-${product.version}/NOTICE.txt"/>
+ <zipfileset dir="build/private/xmlbeans-${product.version}/bin" includes="dumpxsb, scomp, validate" prefix="xmlbeans-${product.version}/bin" filemode="755"/>
+ </zip>
+ <tar destfile="build/private/xmlbeans-${product.version}.tgz"
+ basedir="build/private"
+ includes="xmlbeans-${product.version}/**"
+ excludes="xmlbeans-${product.version}/bin/dumpxsb,
+ xmlbeans-${product.version}/bin/scomp,
+ xmlbeans-${product.version}/bin/validate"
+ compression="gzip">
+ <tarfileset dir="." includes="src/license/LICENSE.txt" fullpath="xmlbeans-${product.version}/LICENSE.txt"/>
+ <tarfileset dir="." includes="src/license/NOTICE.txt" fullpath="xmlbeans-${product.version}/NOTICE.txt"/>
+ <tarfileset dir="build/private/xmlbeans-${product.version}/bin" includes="dumpxsb, scomp, validate" prefix="xmlbeans-${product.version}/bin" mode="755"/>
+ </tar>
+ </target>
+
+ <target name="dist-src" depends="clean, dirs">
+ <delete file="build/private/xmlbeans-${product.version}-src.zip"/>
+ <delete file="build/private/xmlbeans-${product.version}-src.tgz"/>
+
+ <zip destfile="build/private/xmlbeans-${product.version}-src.zip">
+ <zipfileset
+ dir="."
+ includes="**"
+ excludes="build/**, test/src/teststore/**, test/src/easypouse/**, test/src/nameworlduse/**,
+ test/src/stsschema/**, test/src/unmarshal/**, test/cases/schema/**, external/lib/junit.jar, bin/dumpxsb, bin/scomp, bin/validate"
+ prefix="xmlbeans-${product.version}" />
+ <zipfileset dir="." includes="src/license/LICENSE.txt" fullpath="xmlbeans-${product.version}/LICENSE.txt"/>
+ <zipfileset dir="." includes="src/license/NOTICE.txt" fullpath="xmlbeans-${product.version}/NOTICE.txt"/>
+ <zipfileset dir="bin" includes="dumpxsb, scomp, validate" prefix="xmlbeans-${product.version}/bin" filemode="755"/>
+ </zip>
+ <tar destfile="build/private/xmlbeans-${product.version}-src.tgz"
+ compression="gzip">
+ <tarfileset
+ dir="."
+ includes="**"
+ excludes="build/**, test/src/teststore/**, test/src/easypouse/**, test/src/nameworlduse/**,
+ test/src/stsschema/**, test/src/unmarshal/**, test/cases/schema/**, external/lib/junit.jar, bin/dumpxsb, bin/scomp, bin/validate"
+ prefix="xmlbeans-${product.version}"/>
+ <tarfileset dir="." includes="src/license/LICENSE.txt" fullpath="xmlbeans-${product.version}/LICENSE.txt"/>
+ <tarfileset dir="." includes="src/license/NOTICE.txt" fullpath="xmlbeans-${product.version}/NOTICE.txt"/>
+ <tarfileset dir="bin" includes="dumpxsb, scomp, validate" prefix="xmlbeans-${product.version}/bin" mode="755"/>
+ </tar>
+ </target>
+
+ <!-- previously in xbean.xml -->
+
+ <target name="xbean.jar"
+ depends="dirs, xmlpublic.classes, typestore.classes,
+ common.classes, typeimpl.classes, xmlcomp.classes,
+ xmlstore.classes,
+ oldxbean.jar, xsdschema.classes,
+ xmlinputstream.classes, xbean_xpath.jar">
+ <jar jarfile="build/lib/xbean.jar" index="true">
+ <fileset dir="build/classes/xmlpublic"/>
+ <fileset dir="build/classes/typestore"/>
+ <fileset dir="build/classes/common"/>
+ <fileset dir="build/classes/typeimpl"/>
+ <fileset dir="build/classes/xmlcomp"/>
+ <fileset dir="build/classes/configschema"/>
+ <fileset dir="build/classes/toolschema"/>
+ <fileset dir="build/classes/xsdschema"/>
+ <fileset dir="build/classes/xmlschema"/>
+ <fileset dir="build/classes/xmlstore"/>
+ <fileset dir="build/classes/xmlinputstream"/>
+ <fileset dir="build/classes/repackage"/>
+ <fileset dir="src/license"/>
+ </jar>
+ </target>
+
+ <!-- build XMLInputStream interface ============================================= -->
+
+ <target name="xmlinputstream.classes" depends="dirs">
+ <mkdir dir="build/classes/xmlinputstream"/>
+ <javac srcdir="src/xmlinputstream"
+ destdir="build/classes/xmlinputstream"
+ debug="on"/>
+ </target>
+
+ <!-- xmlpublic target ============================================== -->
+
+ <target name="xmlpublic.classes" depends="dirs, xmlinputstream.classes">
+ <mkdir dir="build/classes/xmlpublic"/>
+ <javac srcdir="src/xmlpublic" destdir="build/classes/xmlpublic" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/classes/xmlinputstream"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <target name="xmlpublic.jar" depends="dirs, xmlinputstream.classes, xmlpublic.classes, xmlschema.classes, xsdschema.classes">
+ <jar jarfile="build/lib/xmlpublic.jar" index="true">
+ <fileset dir="build/classes/xmlpublic"/>
+ <fileset dir="build/classes/xmlschema"/>
+ <fileset dir="build/classes/xsdschema"/>
+ </jar>
+ </target>
+
+ <!-- typestore target ============================================== -->
+
+ <target name="typestore.classes" depends="dirs, xmlpublic.classes, common.classes, xmlinputstream.classes">
+ <mkdir dir="build/classes/typestore"/>
+ <javac srcdir="src/typestore" destdir="build/classes/typestore" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/classes/xmlinputstream"/>
+ <pathelement location="build/classes/xmlpublic"/>
+ <pathelement location="build/classes/common"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <!-- common target ============================================= -->
+
+ <target name="common.classes" depends="dirs, xmlpublic.jar, xmlinputstream.classes">
+ <mkdir dir="build/classes/common"/>
+ <javac srcdir="src/common" destdir="build/classes/common" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/classes/xmlinputstream"/>
+ <pathelement location="build/lib/xmlpublic.jar"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <!-- typeimpl target ============================================== -->
+
+ <target name="typeimpl.classes" depends="dirs, repackage.classes, xmlpublic.classes, typestore.classes, xsdschema.classes, configschema.classes, toolschema.classes">
+ <mkdir dir="build/classes/typeimpl"/>
+ <javac destdir="build/classes/typeimpl" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/classes/xmlinputstream"/>
+ <pathelement location="build/classes/common"/>
+ <pathelement location="build/classes/repackage"/>
+ <pathelement location="build/classes/typestore"/>
+ <pathelement location="build/classes/xmlpublic"/>
+ <pathelement location="build/classes/xmlconfig"/>
+ <pathelement location="build/classes/configschema"/>
+ <pathelement location="build/classes/xsdschema"/>
+ </classpath>
+
+ <src path="src/typeimpl"/>
+ <src path="build/src/xmlschema"/>
+ <src path="build/src/xsdschema"/>
+ <src path="build/src/configschema"/>
+ <src path="build/src/toolschema"/>
+ <src path="src/xmlconfig"/>
+ </javac>
+
+ <!-- Need properties files for regex -->
+ <copy
+ todir="build/classes/typeimpl">
+ <fileset dir="src/typeimpl">
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- xmlcomp target =============================================== -->
+
+ <target name="xmlcomp.classes" depends="dirs, repackage.classes, typeimpl.classes, xmlpublic.classes, typestore.classes">
+ <mkdir dir="build/classes/xmlcomp"/>
+ <javac srcdir="src/xmlcomp" destdir="build/classes/xmlcomp" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/classes/xmlinputstream"/>
+ <pathelement location="build/classes/xmlpublic"/>
+ <pathelement location="build/classes/common"/>
+ <pathelement location="build/classes/repackage"/>
+ <pathelement location="build/classes/typeimpl"/>
+ <pathelement location="build/classes/xmlconfig"/>
+ <pathelement location="build/classes/configschema"/>
+ <pathelement location="build/classes/toolschema"/>
+ <pathelement location="build/classes/xsdschema"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <!-- xmlstore target ============================================== -->
+
+ <target name="xmlstore.classes"
+ depends="dirs, common.classes, typestore.classes, xmlpublic.classes">
+ <mkdir dir="build/classes/xmlstore"/>
+ <javac srcdir="src/xmlstore" destdir="build/classes/xmlstore" source="1.4" debug="on">
+ <classpath id="xmlstore.compile.path">
+ <pathelement location="build/classes/xmlinputstream"/>
+ <pathelement location="build/classes/typestore"/>
+ <pathelement location="build/classes/xmlpublic"/>
+ <pathelement location="build/classes/common"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <!-- bootstrap schema target support ================================ -->
+
+
+ <!-- xsdschema target =============================================== -->
+
+ <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+ <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+ <path id="bootstrap.run.path">
+ <pathelement location="build/private/lib/oldxbean.jar"/>
+ </path>
+
+ <path id="bootstrap.compile.path">
+ <pathelement location="build/classes/xmlpublic"/>
+ </path>
+
+ <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
+
+ <path id="xsdschema.compile.path">
+ <pathelement location="build/classes/xmlschema"/>
+ <pathelement location="build/classes/xmlpublic"/>
+ </path>
+
+ <property name="xsdschema.compile.path" refid="xsdschema.compile.path"/>
+
+ <target name="xsdschema.check">
+ <condition property="xsdschema.notRequired">
+ <uptodate property="xsdschema.notRequired" targetfile="build/classes/xsdschema/schema/system/sXMLSCHEMA/index.xsb">
+ <srcfiles dir="src/xsdschema" includes="**/*.xsd"/>
+ </uptodate>
+ </condition>
+ </target>
+
+ <target name="xsdschema.classes" depends="xsdschema.check, xmlschema.classes, xmlpublic.classes, oldxbean.jar" unless="xsdschema.notRequired">
+ <delete dir="build/classes/xsdschema"/>
+ <delete dir="build/src/xsdschema"/>
+ <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="${repackage_arg} -name sXMLSCHEMA -cp ${xsdschema.compile.path} -srconly -d build/classes/xsdschema -src build/src/xsdschema src/xsdschema/schema"/>
+ </java>
+ </target>
+
+ <!-- xmlschema target ============================================= -->
+
+ <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+ <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+ <target name="xmlschema.check">
+ <condition property="xmlschema.notRequired">
+ <uptodate property="xmlschema.notRequired" targetfile="build/classes/xmlschema/schema/system/sXMLLANG/index.xsb">
+ <srcfiles dir="src/xmlschema" includes="**/*.xsd"/>
+ </uptodate>
+ </condition>
+ </target>
+
+ <target name="xmlschema.classes" depends="xmlschema.check, xmlpublic.classes, oldxbean.jar" unless="xmlschema.notRequired">
+ <delete dir="build/classes/xmlschema"/>
+ <delete dir="build/src/xmlschema"/>
+ <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="${repackage_arg} -name sXMLLANG -d build/classes/xmlschema -src build/src/xmlschema -srconly src/xmlschema/schema"/>
+ </java>
+ </target>
+
+ <!-- xmlconfig target =============================================== -->
+
+ <target name="xmlconfig.classes" depends="dirs, xmlpublic.jar, configschema.classes">
+ <mkdir dir="build/classes/xmlconfig"/>
+ <javac srcdir="src/xmlconfig" destdir="build/classes/xmlconfig" source="1.4" debug="on">
+ <classpath>
+ <pathelement location="build/lib/xmlpublic.jar"/>
+ <pathelement location="build/classes/configschema"/>
+ </classpath>
+ </javac>
+
+ </target>
+
+ <!-- configschema target ============================================= -->
+
+ <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+ <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+ <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
+
+ <target name="configschema.check">
+ <uptodate property="configschema.notRequired" targetfile="build/classes/configschema/schema/system/sXMLCONFIG/index.xsb">
+ <srcfiles dir="src/configschema" includes="**/*.xsd"/>
+ </uptodate>
+ </target>
+
+ <target name="configschema.classes" depends="configschema.check, xmlpublic.classes, oldxbean.jar" unless="configschema.notRequired">
+ <delete dir="build/classes/configschema"/>
+ <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="${repackage_arg} -name sXMLCONFIG -srconly -src build/src/configschema -d build/classes/configschema src/configschema/schema"/>
+ </java>
+ </target>
+
+ <!-- toolschema target ============================================= -->
+
+ <!-- Note that this is a tricky target because it bootstraps xbeans on itself. -->
+ <!-- The basic strategy is to rely on the oldxbeans.jar checked into external/lib -->
+
+ <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
+
+ <target name="toolschema.check">
+ <uptodate property="toolschema.notRequired" targetfile="build/classes/toolschema/schema/system/sXMLTOOLS/index.xsb">
+ <srcfiles dir="src/toolschema" includes="**/*.xsd"/>
+ </uptodate>
+ </target>
+
+ <target name="toolschema.classes" depends="toolschema.check, xmlpublic.classes, oldxbean.jar" unless="toolschema.notRequired">
+ <delete dir="build/classes/toolschema"/>
+ <mkdir dir="build/src/toolschema"/>
+ <java classname="${bootstrap_schema_compiler}" classpathref="bootstrap.run.path" fork="true" failonerror="true">
+ <jvmarg value="-ea"/>
+ <arg line="${repackage_arg} -name sXMLTOOLS -srconly -src build/src/toolschema -d build/classes/toolschema src/toolschema"/>
+ </java>
+ </target>
+
+
+ <!-- =========================== -->
+ <!-- ===== Repackaging ====== -->
+ <!-- =========================== -->
+
+ <target name="edit_build_script">
+ <echo message="editing repackage build file: ${token} -->${replacement}"/>
+
+ <java classname="repackage.EditBuildScript" failonerror="true">
+ <arg value="${basedir}/build/repackage/build.xml"/>
+ <arg value="${token}"/>
+ <arg value="${replacement}"/>
+ <classpath>
+ <pathelement location="build/classes/repackage"/>
+ </classpath>
+ </java>
+ </target>
+
+ <property name="repackage_arg" value=""/>
+ <property name="schema_compiler" value="org.apache.xmlbeans.impl.tool.SchemaCompiler"/>
+ <property name="bootstrap_schema_compiler" value="org.apache.xmlbeans.impl.tool.SchemaCompiler"/>
+
+ <!--
+ Params to repackage are:
+
+ repackage_spec:
+
+ Of the form from_pkg_1:to_pkg_1;from_pkg_2:to_pkg_2 which specifies which packages
+ are to be converted which which which other packages. Right now, there are two.
+ org.apache.xmlbeans and apache.xmlbeans.impl, the public and implementation
+ packages.
+
+ new_schema_compiler
+
+ The name of the class which will new the new schema compiler. Will replace
+ ${schema_compiler} during the bootstrap process.
+ -->
+
+ <target name="repackage" depends="repackage.classes">
+
+ <echo message="Re-packaging XMlBeans"/>
+
+ <property
+ name="new_repackage_arg"
+ value="-repackage ${repackage_spec}"/>
+
+ <java classname="repackage.Repackage" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="build/classes/repackage"/>
+ </classpath>
+ <arg line="${new_repackage_arg}"/>
+ </java>
+
+ <antcall target="edit_build_script">
+ <param name="token" value="repackage_arg"/>
+ <param name="replacement" value="${new_repackage_arg}"/>
+ </antcall>
+
+ <antcall target="edit_build_script">
+ <param name="token" value="schema_compiler"/>
+ <param name="replacement" value="${new_schema_compiler}"/>
+ </antcall>
+
+ <ant dir="build/repackage" target="xbean" inheritAll="false"/>
+
+ <antcall target="edit_build_script">
+ <param name="token" value="bootstrap_schema_compiler"/>
+ <param name="replacement" value="${new_schema_compiler}"/>
+ </antcall>
+
+ <ant dir="build/repackage" target="bootstrap" inheritAll="false"/>
+
+ </target>
+
+ <target name="repackage.classes">
+ <mkdir dir="build/classes/repackage"/>
+ <javac srcdir="src/repackage" destdir="build/classes/repackage" source="1.4" debug="on"/>
+ </target>
+
+ <target name="check.jaxen.jar">
+ <condition property="jaxen.jar.exists">
+ <available file="build/lib/jaxen.jar"/>
+ </condition>
+ </target>
+
+ <target name="jaxen.jar" depends="check.jaxen.jar, dirs" unless="jaxen.jar.exists">
+ <!--get dest="build/lib/jaxen.jar"
+ src="http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-2.jar"
+ verbose="true" usetimestamp="true" ignoreerrors="true"/ -->
+ <copy file="external/lib/jaxen-1.1-beta-2.jar" tofile="build/lib/jaxen.jar" />
+ </target>
+
+ <!-- xpath target ============================================= -->
+
+ <target name="xpath.classes" depends="dirs, xmlpublic.jar, jaxen.jar, xmlstore.classes">
+ <mkdir dir="build/private/classes/xpath"/>
+ <javac
+ srcdir="src/xpath"
+ destdir="build/private/classes/xpath"
+ classpathref="xpath.compile.path"
+ source="1.4"
+ debug="on">
+ <classpath id="xpath.compile.path">
+ <pathelement location="build/lib/xmlpublic.jar"/>
+ <pathelement location="build/lib/jaxen.jar"/>
+ <pathelement location="build/classes/xmlstore"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="xbean_xpath.jar" depends="xpath.classes">
+ <jar jarfile="build/lib/xbean_xpath.jar" basedir="build/private/classes/xpath"/>
+ </target>
+
+ <!-- test xpath target ============================================= -->
+
+ <target name="test_xpath.classes" depends="dirs, xmlpublic.jar, jaxen.jar, xbean_xpath.jar">
+ <mkdir dir="build/private/classes/testxpath"/>
+ <javac
+ srcdir="test/src/xpath"
+ destdir="build/private/classes/testxpath"
+ classpathref="testxpath.compile.path"
+ source="1.4"
+ debug="on">
+ <classpath id="testxpath.compile.path">
+ <pathelement location="build/lib/xmlpublic.jar"/>
+ <pathelement location="build/lib/jaxen.jar"/>
+ <pathelement location="build/lib/xbean_xpath.jar"/>
+ <pathelement location="build/classes/xmlinputstream"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="run_test_xpath" depends="test_xpath.classes, xbean">
+ <java classname="org.apache.xmlbeans.impl.xpath.jaxen.XBeansDemo" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="build/lib/xbean.jar"/>
+ <pathelement location="build/lib/jaxen.jar"/>
+ <pathelement location="build/lib/xbean_xpath.jar"/>
+ <pathelement location="build/private/classes/testxpath"/>
+ </classpath>
+ <jvmarg value="-da"/>
+ <arg line='test/cases/xpath/much_ado.xml "PLAY/ACT/SCENE/SPEECH/SPEAKER"'/>
+ </java>
+ </target>
+
+
+</project>
diff --git a/v1/docs/guide/antXmlbean.html b/v1/docs/guide/antXmlbean.html
new file mode 100644
index 0000000..4787f02
--- /dev/null
+++ b/v1/docs/guide/antXmlbean.html
@@ -0,0 +1,314 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+<!-- 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. -->
+<html><!-- InstanceBegin template="file:///C|/p4/main/help/ide/en/Templates/Command.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>xmlbean Ant Task</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+<!-- InstanceBeginEditable name="metatags" -->
+<meta name="component" content="">
+<!-- In the description metatag, please provide a BRIEF description of the topic contents. -->
+<meta name="description" content="">
+<!-- In the component metatag, please list keywords that will help a user search for this topic. -->
+<meta name="keywords" content="">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<!-- InstanceBeginEditable name="body" -->
+<div id=topictitle>
+ <H1 class=Title>xmlbean Ant Task</h1>
+</div>
+<div id=topictext>
+ <p>Compiles a set of XSD and/or WSDL files into XMLBeans. This is useful for
+ building an XMLBean JAR from XSD and WSDL files. If desired, the task can
+ also generate the source code that makes up the XMLBean type system specified
+ by the schema files.</p>
+ <p class="notepara"><b>Note:</b> This task depends on an external library not
+ included in the Ant distribution called xbean.jar. It can be found in
+ the XMLBeans developer kit at <a
+ href="http://xmlbeans.apache.org/" target="_blank">http://xmlbeans.apache.org/</a>.
+ The build script will need to include a taskdef for xmlbean, which could look
+ like this:</p>
+</div>
+<blockquote>
+ <div class="notepara">
+ <pre class="notepara"><taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="path/to/xbean.jar"/></pre>
+ </div>
+</blockquote>
+<div>
+<p>It is possible to refine the set of files that are being processed. This
+ can be done with the <span class="langinline">includes</span>, <span class="langinline">includesfile</span>,
+ <span class="langinline">excludes</span>, <span class="langinline">excludesfile</span>
+ and <span class="langinline">defaultexcludes</span> attributes. With the <span class="langinline">includes</span>
+ or <span class="langinline">includesfile</span> attribute you specify the
+ files you want to have included by using patterns. The <span class="langinline">exclude</span>
+ or <span class="langinline">excludesfile</span> attributes are used to specify
+ the files you want to have excluded. This is also done with patterns. And
+ finally with the <span class="langinline">defaultexcludes</span> attribute,
+ you can specify whether you want to use default exclusions or not. See the
+ section on <a
+ href="http://ant.apache.org/manual/dirtasks.html#directorybasedtasks" target="_blank">directory
+ based tasks</a> in the <a href="http://ant.apache.org/manual/" target="_blank">Ant
+ documentation</a>, on how the inclusion/exclusion of files works, and how
+ to write patterns.</p>
+ <p>This task forms an implicit <a
+ href="http://ant.apache.org/manual/CoreTypes/fileset.html" target="_blank">FileSet</a>
+ and supports all attributes of <code><fileset></code> (<code>dir</code>
+ becomes <code>basedir</code>) as well as the nested <code><include></code>,
+ <code><exclude></code> and <code><patternset></code> elements.</p>
+ <h3>Parameters</h3>
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tbody>
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">schema</td>
+ <td valign="top">A file that points to either an individual schema file
+ or a directory of files. Not a path reference. If multiple
+ schema files need to be built together, use a nested fileset instead
+ of setting schema.</td>
+ <td align="center" valign="top">Yes, unless a fileset element is nested.</td>
+ </tr>
+ <tr>
+ <td valign="top">destfile</td>
+ <td valign="top">Define the name of the jar file created. For instance,
+ "myXMLBean.jar" will output the results of this task into a jar with
+ the same name.</td>
+ <td align="center" valign="top">No, default is "xmltypes.jar".</td>
+ </tr>
+ <tr>
+ <td valign="top">download</td>
+ <td valign="top">Set to true to permit the compiler to download URLs for
+ imports and includes. Defaults to false, meaning all imports and
+ includes must be copied locally.<br> </td>
+ <td align="center" valign="top">No, default is false.</td>
+ </tr>
+ <tr>
+ <td valign="top">failonerror</td>
+ <td valign="top"> Determines whether or not the ant target will continue
+ if the XMLBean creation encounters a build error.<br> </td>
+ <td align="center" valign="top">No, default is true.</td>
+ </tr>
+ <tr>
+ <td valign="top">verbose<br> </td>
+ <td valign="top">Controls the amount of build message output.<br> </td>
+ <td valign="top" align="center">No, default is true.</td>
+ </tr>
+ <tr>
+ <td valign="top">typesystemname<br> </td>
+ <td valign="top">The name of the package that the TypeSystemHolder class
+ should be generated in. Normally this should be left unspecified.
+ None of the XMLBeans are generated in this package. Use .xsdconfig files
+ to modify XMLBean package or class names.<br> </td>
+ <td valign="top" align="center">No<br> </td>
+ </tr>
+ <tr>
+ <td valign="top">classgendir<br> </td>
+ <td valign="top">Set a location to generate CLASS files into.<br> </td>
+ <td valign="top" align="center">No<br> </td>
+ </tr>
+ <tr>
+ <td valign="top">srconly<br> </td>
+ <td valign="top">A value of true means that only source will be generated.<br>
+ </td>
+ <td valign="top" align="center">No, default is false.</td>
+ </tr>
+ <tr>
+ <td valign="top">srcgendir<br> </td>
+ <td valign="top">Set a location to generate JAVA files into.<br> </td>
+ <td valign="top" align="center">No<br> </td>
+ </tr>
+ <tr>
+ <td valign="top">classpath</td>
+ <td valign="top">The classpath to use if schemas in the fileset import
+ definitions that are supplied by other compiled XMLBeans JAR files,
+ or if JAVA files are in the schema fileset. Also supports a nested classpath.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">classpathref</td>
+ <td valign="top">Adds a classpath, given as <a
+ href="http://ant.apache.org/manual/using.html#references" target="_blank">reference</a>
+ to a path defined elsewhere.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includes</td>
+ <td valign="top">Comma- or space-separated list of patterns of files that
+ must be included. All files are included when omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includesfile</td>
+ <td valign="top">The name of a file. Each line of this file is taken to
+ be an include pattern.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">excludes</td>
+ <td valign="top">Comma- or space-separated list of patterns of files that
+ must be excluded. No files (except default excludes) are excluded when
+ omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">excludesfile</td>
+ <td valign="top">The name of a file. Each line of this file is taken to
+ be an exclude pattern.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">defaultexcludes</td>
+ <td valign="top">Indicates whether default excludes should be used or
+ not ("yes"/"no"). Default excludes are used when omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">debug</td>
+ <td valign="top">Indicates whether source should be compiled with debug
+ information; defaults to <code>off</code>. If set to <code>off</code>,
+ <code>-g:none</code> will be passed on the command line for compilers
+ that support it (for other compilers, no command line argument will
+ be used). If set to <code>true</code>, the value of the <code>debuglevel</code>
+ attribute determines the command line argument.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">debuglevel</td>
+ <td valign="top">Keyword list to be appended to the <code>-g</code> command-line
+ switch. This will be ignored by all implementations except <code>modern</code>
+ and <code>classic(ver >= 1.2)</code>. Legal values are <code>none</code>
+ or a comma-separated list of the following keywords: <code>lines</code>,
+ <code>vars</code>, and <code>source</code>. If <code>debuglevel</code>
+ is not specified, by default, nothing will be appended to <code>-g</code>.
+ If <code>debug</code> is not turned on, this attribute will be ignored.
+ </td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">optimize</td>
+ <td valign="top">Indicates whether source should be compiled with optimization;
+ defaults to <code>off</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includeAntRuntime</td>
+ <td valign="top">Whether to include the Ant run-time libraries in the
+ classpath; defaults to <code>yes</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includeJavaRuntime</td>
+ <td valign="top">Whether to include the default run-time libraries from
+ the executing VM in the classpath; defaults to <code>no</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">fork</td>
+ <td valign="top">Whether to execute <code>javac</code> using the JDK compiler
+ externally; defaults to <code>yes</code>.</td>
+ <td align="center" valign="top">No, default is true</td>
+ </tr>
+ <tr>
+ <td valign="top">executable</td>
+ <td valign="top">Complete path to the <code>javac</code> executable to
+ use in case of <code>fork="yes"</code>. Defaults to the compiler
+ of the Java version that is currently running Ant. Ignored if <code>fork="no"</code></td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">memoryInitialSize</td>
+ <td valign="top">The initial size of the memory for the underlying VM,
+ if <code>javac</code> is run externally; ignored otherwise. Defaults
+ to the standard VM memory setting. (Examples: <code>83886080</code>,
+ <code>81920k</code>, or <code>80m</code>)</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">memoryMaximumSize</td>
+ <td valign="top">The maximum size of the memory for the underlying VM,
+ if <code>javac</code> is run externally; ignored otherwise. Defaults
+ to the standard VM memory setting. (Examples: <code>83886080</code>,
+ <code>81920k</code>, or <code>80m</code>)</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">compiler</td>
+ <td valign="top">The compiler implementation to use. If this attribute
+ is not set, the value of the <code>build.compiler</code> property, if
+ set, will be used. Otherwise, the default compiler for the current VM
+ will be used.
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">ignoreDuplicatesInNamespaces</td>
+ <td valign="top">Comma separated list of one or more namespaces
+ in which duplicate definitions are to be ignored.
+ </td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ </tbody>
+ </table>
+ <h3>Example</h3>
+</div>
+<div id=topictext> Be sure to define the task in your script, like this:</div>
+<div>
+ <pre><taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="path/to/xbean.jar"</pre>
+ <p>The following builds all the schemas in the schemas directory and creates
+ a jar called "Schemas.jar".</p>
+</div>
+<div>
+ <pre>
+<xmlbean schema="schemas" destfile="Schemas.jar"/></pre>
+ The following compiles the schema "ourSchema.xsd" into the default
+ jar "xmltypes.jar". If any imports and includes are defined
+ by remote URLs, they are downloaded during the build.
+ <div>
+ <pre><xmlbean schema="schemas/ourSchema.xsd" download="true"/></pre>
+ </div>
+ <div>
+ <h4>Using a fileset</h4>
+ </div>
+ <div>
+ <pre><xmlbean classgendir="${build.dir}" classpath="${class.path}"<br> failonerror="true"><br> <fileset basedir="src" excludes="**/*.xsd"/><br> <fileset basedir="schemas" includes="**/*.*"/><br></xmlbean></pre>
+ </div>
+ <div> Gathers all the files in the src directory except XSD files, along with
+ every file in the schemas directory, and compiles them. The fileset can include
+ schema files that refer to previously compiled schema components. The
+ fileset can also contain JAVA files. The classpath parameter defines
+ the classpath necessary to resolve compiled schema and java references.<br>
+ <br>
+ The built classes will go into ${build.dir}.</div>
+ <div>
+ <p class=relatedtopics>Related Topics</p>
+ <p>None.</p>
+ </div>
+</div>
+<!-- InstanceEndEditable -->
+</body>
+<!-- InstanceEnd --></html>
diff --git a/v1/docs/guide/conGettingStartedwithXMLBeans.html b/v1/docs/guide/conGettingStartedwithXMLBeans.html
new file mode 100644
index 0000000..4f5cca8
--- /dev/null
+++ b/v1/docs/guide/conGettingStartedwithXMLBeans.html
@@ -0,0 +1,531 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Getting Started with XMLBeans</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="author" content="your name">
+<meta name="description" content="A description of the topic contents.">
+<meta name="keywords" content="keywords to help in searches">
+<meta name="date last modified" content="10/25/02">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> Getting Started with XMLBeans</h1>
+<div id="topictext">
+ <p>XMLBeans provides intuitive ways to handle XML that make it easier for you
+ to access and manipulate XML data and documents in Java. </p>
+ <p>Characteristics of XMLBeans approach to XML:</p>
+</div>
+<ul>
+ <li>
+ <div>It provides a familiar Java object-based view of XML data without losing
+ access to the original, native XML structure.</div>
+ </li>
+ <li>
+ <div>The XML's integrity as a document is not lost with XMLBeans. XML-oriented
+ APIs commonly take the XML apart in order to bind to its parts. With XMLBeans,
+ the entire XML instance document is handled as a whole. The XML data is
+ stored in memory as XML. This means that the document order is preserved
+ as well as the original element content with whitespace.</div>
+ </li>
+ <li>
+ <div>With types generated from schema, access to XML instances is through
+ JavaBean-like accessors, with get and set methods.</div>
+ </li>
+ <li>
+ <div>It is designed with XML schema in mind from the beginning — XMLBeans
+ supports all XML schema definitions.</div>
+ </li>
+ <li>Access to XML is fast.</li>
+</ul>
+<div>
+ <p>The starting point for XMLBeans is XML schema. A schema (contained in an
+ XSD file) is an XML document that defines a set of rules to which other XML
+ documents must conform. The XML Schema specification provides a rich data
+ model that allows you to express sophisticated structure and constraints on
+ your data. For example, an XML schema can enforce control over how data is
+ ordered in a document, or constraints on particular values (for example, a
+ birth date that must be later than 1900). Unfortunately, the ability to enforce
+ rules like this is typically not available in Java without writing custom
+ code. XMLBeans honors schema constraints.</p>
+ <p class="notepara"><strong>Note:</strong> Where an XML schema defines rules
+ for an XML document, an XML <em>instance</em> is an XML document that conforms
+ to the schema.</p>
+ <p>You compile a schema (XSD) file to generate a set of Java interfaces that
+ mirror the schema. With these types, you process XML instance documents that
+ conform to the schema. You bind an XML instance document to these types; changes
+ made through the Java interface change the underlying XML representation.</p>
+ <p>Previous options for handling XML include using XML programming interfaces
+ (such as DOM or SAX) or an XML marshalling/binding tool (such as JAXB). Because
+ it lacks strong schema-oriented typing, navigation in a DOM-oriented model
+ is more tedious and requires an understanding of the complete object model.
+ JAXB provides support for the XML schema specification, but handles only a
+ subset of it; XMLBeans supports all of it. Also, by storing the data in memory
+ as XML, XMLBeans is able to reduce the overhead of marshalling and demarshalling.</p>
+ <h1>Accessing XML Using Its Schema</h1>
+ <p>To get a glimpse of the kinds of things you can do with XMLBeans, take a
+ look at an example using XML for a purchase order. The purchase order XML
+ contains data exchanged by two parties, such as two companies. Both parties
+ need to be able to rely on a consistent message shape, and a schema specifies
+ the common ground. </p>
+ <p>Here's what a purchase order XML instance might look like.</p>
+ <pre>
+<po:purchase-order xmlns:po="http://openuri.org/easypo">
+ <po:customer>
+ <po:name>Gladys Kravitz</po:name>
+ <po:address>Anytown, PA</po:address>
+ </po:customer>
+ <po:date>2003-01-07T14:16:00-05:00</po:date>
+ <po:line-item>
+ <po:description>Burnham's Celestial Handbook, Vol 1</po:description>
+ <po:per-unit-ounces>5</po:per-unit-ounces>
+ <po:price>21.79</po:price>
+ <po:quantity>2</po:quantity>
+ </po:line-item>
+ <po:line-item>
+ <po:description>Burnham's Celestial Handbook, Vol 2</po:description>
+ <po:per-unit-ounces>5</po:per-unit-ounces>
+ <po:price>19.89</po:price>
+ <po:quantity>2</po:quantity>
+ </po:line-item>
+<po:shipper>
+ <po:name>ZipShip</po:name>
+ <po:per-ounce-rate>0.74</po:per-ounce-rate>
+ </po:shipper>
+</po:purchase-order></pre>
+ <p>This XML includes a root element, <span class="langinline">purchase-order</span>,
+ that has three kinds of child elements: <span class="langinline">customer</span>,
+ <span class="langinline">date</span>, <span class="langinline">line-item</span>,
+ and <span class="langinline">shipper</span>. An intuitive, object-based view
+ of this XML would provide an object representing the <span class="langinline">purchase-order</span>
+ element, and it would have methods for getting the date and for getting subordinate
+ objects for <span class="langinline">customer</span>, <span class="langinline">line-item</span>,
+ and <span class="langinline">shipper</span> elements. Each of the last three
+ would have its own methods for getting the data inside them as well.</p>
+ <h2>Looking at the Schema</h2>
+ <p>The following XML is the the schema for the preceding purchase order XML.
+ It defines the XML's "shape" — what its elements are, what
+ order they appear in, which are children of which, and so on.</p>
+</div>
+<div>
+ <pre>
+<xs:schema targetNamespace="http://openuri.org/easypo"
+ xmlns:po="http://openuri.org/easypo"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xs:element name="purchase-order">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="customer" type="po:customer"/>
+ <xs:element name="date" type="xs:dateTime"/>
+ <xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="shipper" type="po:shipper" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="customer">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="address" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="line-item">
+ <xs:sequence>
+ <xs:element name="description" type="xs:string"/>
+ <xs:element name="per-unit-ounces" type="xs:decimal"/>
+ <xs:element name="price" type="xs:double"/>
+ <xs:element name="quantity" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="shipper">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="per-ounce-rate" type="xs:decimal"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema></pre>
+ <div>
+ <p>This schema describes the purchase order XML instance by defining the following:</p>
+ </div>
+ <ul>
+ <li>
+ <div>Definitions for three complex types — customer, line-item, and
+ shipper. These are the types used for the children of the purchase-order
+ element. In schema, a complex type is one that defines an element that
+ may have child elements and attributes. The sequence element nested in
+ the complex type lists its child elements.</div>
+ <p>These are also <em>global</em> types. They are global because they are
+ at the top level of the schema (in other words, just beneath the <span class="langinline">schema</span>
+ root element). This means that they may be referenced from anywhere else
+ in the schema.</p>
+ </li>
+ </ul>
+</div>
+<div>
+ <ul>
+ <li>Use of simple types within the complex types. The name, address, and description
+ elements (among others) are typed as simple types. As it happens, these
+ are also <em>built-in</em> types. A built-in type (here, one with the "xs"
+ prefix) is part of the schema specification. (The specification defines
+ 46 built-in types.)</li>
+ <li>A global element called purchase-order. This element definition includes
+ a nested complex type definition that specifies the child elements for a
+ purchase-order element. Notice that the complex type includes references
+ to the other complex types defined in this schema.</li>
+ </ul>
+ <div></div>
+ <p>In other words, the schema defines types for the child elements and describes
+ their position as subordinate to the root element, <span class="langinline">purchase-order</span>.</p>
+ <p>When you use the XMLBean compiler with an XSD file such as this one, you
+ generate a JAR file containing the interfaces generated from the schema.</p>
+ <h2>Writing Java Code That Uses the Interfaces</h2>
+ <p>With the XMLBeans interfaces in your application, you can write code that
+ uses the new types to handle XML based on the schema. Here's an example that
+ extracts information about each of the ordered items in the purchase order
+ XML, counts the items, and calculates a total of their prices. In particular,
+ look at the use of types generated from the schema and imported as part of
+ the <span class="langinline">org.openuri.easypo</span> package. </p>
+ <p>The <span class="langinline">printItems</span> method receives a <span class="langinline">File</span>
+ object containing the purchase order XML file.</p>
+ <pre>
+package docs.xmlbeans;
+
+import java.io.File;
+import org.apache.xmlbeans.*;
+import org.openuri.easypo.PurchaseOrderDocument;
+import org.openuri.easypo.PurchaseOrder;
+import org.openuri.easypo.LineItem;
+
+public class POHandler
+{
+ public static void printItems(File po) throws Exception
+ {
+ /*
+ * All XMLBeans schema types provide a nested Factory class you can
+ * use to bind XML to the type, or to create new instances of the type.
+ * Note that a "Document" type such as this one is an XMLBeans
+ * construct for representing a global element. It provides a way
+ * for you to get and set the contents of the entire element.
+ *
+ * Also, note that the parse method will only succeed if the
+ * XML you're parsing appears to conform to the schema.
+ */
+ PurchaseOrderDocument poDoc =
+ PurchaseOrderDocument.Factory.parse(po);
+
+ /*
+ * The PurchaseOrder type represents the purchase-order element's
+ * complex type.
+ */
+ PurchaseOrder po = poDoc.getPurchaseOrder();
+
+ /*
+ * When an element may occur more than once as a child element,
+ * the schema compiler will generate methods that refer to an
+ * array of that element. The line-item element is defined with
+ * a maxOccurs attribute value of "unbounded", meaning that
+ * it may occur as many times in an instance document as needed.
+ * So there are methods such as getLineItemArray and setLineItemArray.
+ */
+ LineItem[] lineitems = po.getLineItemArray();
+ System.out.println("Purchase order has " + lineitems.length + " line items.");
+
+ double totalAmount = 0.0;
+ int numberOfItems = 0;
+
+ /*
+ * Loop through the line-item elements, using generated accessors to
+ * get values for child elements such a description, quantity, and
+ * price.
+ */
+ for (int j = 0; j < lineitems.length; j++)
+ {
+ System.out.println(" Line item: " + j);
+ System.out.println(
+ " Description: " + lineitems[j].getDescription());
+ System.out.println(" Quantity: " + lineitems[j].getQuantity());
+ System.out.println(" Price: " + lineitems[j].getPrice());
+ numberOfItems += lineitems[j].getQuantity();
+ totalAmount += lineitems[j].getPrice() * lineitems[j].getQuantity();
+ }
+ System.out.println("Total items: " + numberOfItems);
+ System.out.println("Total amount: " + totalAmount);
+ }
+}
+</pre>
+ <p>Notice that types generated from the schema reflect what's in the XML:</p>
+</div>
+<ul>
+ <li>
+ <div>A <span class="langinline">PurchaseOrderDocument</span> represents the
+ global root element.</div>
+ </li>
+ <li>
+ <div>A <span class="langinline">getPurchaseOrder</span> method returns a <span class="langinline">PurchaseOrderDocument.PurchaseOrder</span>
+ type that contains child elements, including <span class="langinline">line-item</span>.
+ A <span class="langinline">getLineItemArray</span> method returns a <span class="langinline">LineItem</span>
+ array containing the <span class="langinline">line-item</span> elements.</div>
+ </li>
+ <li>Other methods, such as <span class="langinline">getQuantity</span>, <span class="langinline">getPrice</span>,
+ and so on, follow naturally from what the schema describes, returning corresponding
+ children of the <span class="langinline">line-item</span> element.</li>
+ <li>The name of the package containing these types is derived from the schema's
+ target namespace.</li>
+</ul>
+<div>
+ <p>Capitalization and punctuation for generated type names follow Java convention.
+ Also, while this example parses the XML from a file, other <span class="langinline">parse</span>
+ methods support a Java <span class="langinline">InputStream</span> object,
+ a <span class="langinline">Reader</span> object, and so on.</p>
+ <p>The preceding Java code prints the following to the console:</p>
+</div>
+<div>
+ <pre>
+Purchase order has 3 line items.
+ Line item 0
+ Description: Burnham's Celestial Handbook, Vol 1
+ Quantity: 2
+ Price: 21.79
+ Line item 1
+ Description: Burnham's Celestial Handbook, Vol 2
+ Quantity: 2
+ Price: 19.89
+Total items: 4
+Total amount: 41.68</pre>
+ <h2>Creating New XML Instances from Schema</h2>
+ <p>As you've seen XMLBeans provides a "factory" class you can use
+ to create new instances. The following example creates a new <span class="langinline">purchase-order</span>
+ element and adds a <span class="langinline">customer</span> child element.
+ It then inserts <span class="langinline">name</span> and <span class="langinline">address</span>
+ child elements, creating the elements and setting their values with a single
+ call to their <span class="langinline">set</span> methods.</p>
+ <pre>
+public PurchaseOrderDocument createPO()
+{
+ PurchaseOrderDocument newPODoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrder newPO = newPODoc.addNewPurchaseOrder();
+ Customer newCustomer = newPO.addNewCustomer();
+ newCustomer.setName("Doris Kravitz");
+ newCustomer.setAddress("Bellflower, CA");
+ return newPODoc;
+}
+</pre>
+ <p>The following is the XML that results. Note that XMLBeans assigns the correct
+ namespace based on the schema, using an "ns1" (or, "namespace
+ 1") prefix. For practical purposes, the prefix itself doesn't really
+ matter — it's the namespace URI (http://openuri.org/easypo) that defines
+ the namespace. The prefix is merely a marker that represents it.</p>
+ <pre><ns1:purchase-order xmlns:ns1="http://openuri.org/easypo">
+ <ns1:customer>
+ <ns1:name>Doris Kravitz</ns1:name>
+ <ns1:address>Bellflower, CA</ns1:address>
+ </ns1:customer>
+</ns1:purchase-order>
+</pre>
+ <p>Note that all types (including those generated from schema) inherit from
+ <span class="langinline">XmlObject</span>, and so provide a <span class="langinline">Factory</span>
+ class. For an overview of the type system in which <span class="langinline">XmlObject</span>
+ fits, see <a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans Support
+ for Built-In Schema Types</a>. For reference information, see <a href="../reference/org/apache/xmlbeans/XmlObject.html">XmlObject
+ Interface</a>.</p>
+ <h1>XMLBeans Hierarchy</h1>
+ <p>The generated types you saw used in the preceding example are actually part
+ of a hierarchy of XMLBeans types. This hierarchy is one of the ways in which
+ XMLBeans presents an intuitive view of schema. At the top of the hierarchy
+ is <span class="langinline">XmlObject</span>, the base interface for XMLBeans
+ types. Beneath this level, there are two main type categories: generated types
+ that represent user-derived schema types, and included types that represent
+ built-in schema types.</p>
+ This topic has already introduced generated types. For more information, see
+ <a href="conJavaTypesGeneratedFromUserDerived.html">Java Types Generated from
+ User-Derived Schema Types.</a>
+ <h2>Built-In Type Support</h2>
+ <p>In addition to types generated from a given schema, XMLBeans provides 46
+ Java types that mirror the 46 built-in types defined by the XML schema specification.
+ Where schema defines <span class="langinline">xs:string</span>, <span class="langinline">xs:decimal</span>,
+ and <span class="langinline">xs:int</span>, for example, XMLBeans provides
+ <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlString.html">XmlString</a></span>,
+ <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlDecimal.html">XmlDecimal</a></span>,
+ and <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlInt.html">XmlInt</a></span>.
+ Each of these also inherits from <span class="langinline">XmlObject</span>,
+ which corresponds to the built-in schema type <span class="langinline">xs:anyType</span>.</p>
+ <p>XMLBeans provides a way for you to handle XML data as these built-in types.
+ Where your schema includes an element whose type is, for example, <span class="langinline">xs:int</span>,
+ XMLBeans will provide a generated method designed to return an <span class="langinline">XmlInt</span>.
+ In addition, as you saw in the preceding example, for most types there will
+ also be a method that returns a natural Java type such as <span class="langinline">int</span>.
+ The following two lines of code return the <span class="langinline">quantity</span>
+ element's value, but return it as different types.</p>
+ <pre>
+// Methods that return simple types begin with an "x".
+XmlInt xmlQuantity = lineitems[j].xgetQuantity();
+// Methods that return a natural Java type are unadorned.
+int javaQuantity = lineitems[j].getQuantity();
+</pre>
+ <p>In a sense both get methods navigate to the <span class="langinline">quantity</span>
+ element; the <span class="langinline">getQuantity</span> method goes a step
+ further and converts the elements value to the most appropriate natural Java
+ type before returning it. (XMLBeans also provides a means for validating the
+ XML as you work with it.)</p>
+ <p>If you know a bit about XML schema, XMLBeans types should seem fairly intuitive.
+ If you don't, you'll learn a lot by experimenting with XMLBeans using your
+ own schemas and XML instances based on them. </p>
+ <p>For more information on the methods of types generated from schema, see <a href="conMethodsForGeneratedJavaTypes.html">Methods
+ for Types Generated From Schema</a>. For more about the how XMLBeans represents
+ built-in schema types, see <a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans
+ Support for Built-In Schema Types</a>.</p>
+ <h1>Using XQuery Expressions</h1>
+ <p>With XMLBeans you can use XQuery to query XML for specific pieces of data.
+ XQuery is sometimes referred to as "SQL for XML" because it provides
+ a mechanism to access data directly from XML documents, much as SQL provides
+ a mechanism for accessing data in traditional databases.</p>
+ <p>XQuery borrows some of its syntax from XPath, a syntax for specifying nested
+ data in XML. The following example returns all of the <span class="langinline">line-item</span>
+ elements whose <span class="langinline">price</span> child elements have values
+ less than or equal to 20.00:</p>
+ <pre>
+PurchaseOrderDocument doc = PurchaseOrderDocument.Factory.parse(po);
+
+/*
+ * The XQuery expression is the following two strings combined. They're
+ * declared separately here for convenience. The first string declares
+ * the namespace prefix that's used in the query expression; the second
+ * declares the expression itself.
+ */
+String nsText = "declare namespace po = 'http://openuri.org/easypo'";
+String pathText = "$this/po:purchase-order/po:line-item[po:price <= 20.00]";
+String queryText = nsText + pathText;
+
+XmlCursor itemCursor = doc.newCursor().execQuery(queryText);
+System.out.println(itemCursor.xmlText());
+</pre>
+ <p>This code creates a new cursor at the start of the document. From there,
+ it uses the <span class="langinline">XmlCursor</span> interface's <span class="langinline">execQuery</span>
+ method to execute the query expression. In this example, the method's parameter
+ is an XQuery expression that simply says, "From my current location,
+ navigate through the <span class="langinline">purchase-order</span> element
+ and retrieve those <span class="langinline">line-item</span> elements whose
+ value is less than or equal to 20.00." The <span class="langinline">$this</span>
+ variable means "the current position."</p>
+ <p>For more information about XQuery, see <a href="http://www.w3.org/TR/xquery/" target="_blank">XQuery
+ 1.0: An XML Query Language</a> at the W3C web site.</p>
+ <h2>Using XML Cursors</h2>
+ <p>In the preceding example you may have noticed the <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlCursor.html">XmlCursor</a></span>
+ interface. In addition to providing a way to execute XQuery expression, an
+ XML cursors offers a fine-grained model for manipulating data. The XML cursor
+ API, analogous to the DOM's object API, is simply a way to point at a particular
+ piece of data. So, just like a cursor helps navigate through a word processing
+ document, the XML cursor defines a location in XML where you can perform actions
+ on the selected XML.</p>
+ <p>Cursors are ideal for moving through an XML document when there's no schema
+ available. Once you've got the cursor at the location you're interested in,
+ you can perform a variety of operations with it. For example, you can set
+ and get values, insert and remove fragments of XML, copy fragments of XML
+ to other parts of the document, and make other fine-grained changes to the
+ XML document.</p>
+ <p>The following example uses an XML cursor to navigate to the <span class="langinline">customer</span>
+ element's <span class="langinline">name</span> child element.</p>
+ <pre>
+PurchaseOrderDocument doc =
+ PurchaseOrderDocument.Factory.parse(po);
+
+XmlCursor cursor = doc.newCursor();
+cursor.toFirstContentToken();
+cursor.toFirstChildElement();
+cursor.toFirstChildElement();
+System.out.println(cursor.getText());
+
+cursor.dispose();
+</pre>
+ <p>What's happening here? As with the earlier example, the code loads the XML
+ from a <span class="langinline">File</span> object. After loading the document,
+ the code creates a cursor at its beginning. Moving the cursor a few times
+ takes it to the nested <span class="langinline">name </span> element. Once
+ there, the getText method retrieves the element's value.</p>
+ <p>This is just an introduction to XML cursors. For more information about using
+ cursors, see <a href="conNavigatingXMLwithCursors.html">Navigating XML with
+ Cursors</a>.</p>
+ <h2>Where to Go Next</h2>
+</div>
+<ul>
+ <li>
+ <div>XMLBeans provides intuitive ways to handle XML, particularly if you're
+ starting with schema. If you're accessing XML that's based on a schema,
+ you'll probably find it most efficient to access the XML through generated
+ types specific to the schema. To do this, you begin by compiling the schema
+ to generate interfaces. For more information on using XMLBeans types generated
+ by compiling schema, see <a href="conJavaTypesGeneratedFromUserDerived.html">Java
+ Types Generated From User-Derived Schema Types</a> and <a href="conMethodsForGeneratedJavaTypes.html">Methods
+ for Types Generated From Schema</a>.</div>
+ </li>
+ <li>
+ <div>You might be interested in reading more about the type system on which
+ XMLBeans is based, particularly if you're using types generated from schema.
+ XMLBeans provides a hierarchical system of types that mirror what you find
+ in the XML schema specification itself. If you're working with schema, you
+ might find it helps to understand how these types work. For more information,
+ see <a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans Support
+ for Built-In Schema Types</a> and <a href="conIntroToTheSchemaTypeSystem.html">Introduction
+ to Schema Type Signatures</a>.</div>
+ </li>
+ <li>
+ <div>XMLBeans provides access to XML through XQuery, which borrows path syntax
+ from XPath. With XQuery, you can specify specific fragments of XML data
+ with or without schema. To learn more about using XQuery and XPath in XMLBeans,
+ see <a href="conSelectingXMLwithXQueryPathXPath.html">Selecting XML with
+ XQuery and XPath</a>.</div>
+ </li>
+ <li>You can use the <span class="langinline">XmlCursor</span> interface for
+ fine-grained navigation and manipulation of XML. For more information, see
+ <a href="conNavigatingXMLwithCursors.html">Navigating XML with Cursors</a>.</li>
+</ul>
+<div>
+ <p class="notepara"><strong>Note:</strong> The xbean.jar file that contains
+ the XMLBeans library is fully functional as a standalone library.</p>
+ <h1>Related Topics</h1>
+ <p><a href="../../samples/navXMLBeansSamples.html">XMLBeans Samples</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conIntroToTheSchemaTypeSystem.html b/v1/docs/guide/conIntroToTheSchemaTypeSystem.html
new file mode 100644
index 0000000..bd0f206
--- /dev/null
+++ b/v1/docs/guide/conIntroToTheSchemaTypeSystem.html
@@ -0,0 +1,229 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Introduction to Schema Type Signatures</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta content="your name" name="author">
+<meta content="A description of the topic contents." name="description">
+<meta content="keywords to help in searches" name="keywords">
+<meta content="10/25/02" name="date last modified">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> Introduction to Schema Type Signatures</h1>
+<div id="topictext">
+ <p>When you compile schema, the API generated from your schema is integrated
+ with the XMLBeans type system that represents the underlying XML schema. All
+ together, these types make up the <em>schema type system</em> to which your
+ code has access. When handling XML based on the schema, you typically call
+ methods of the API generated when you compiled the schema. However, for the
+ cases when you want to get information about the schema itself, you use the
+ schema type system API.</p>
+ <p>In the XMLBeans API, you have access to the system itself through <a href="../reference/org/apache/xmlbeans/SchemaTypeSystem.html"><span class="langinline">SchemaTypeSystem</span></a>
+ and related classes. These make up a kind of "meta-API," or a view
+ on the schema. You can use the schema type system API to discover the type
+ system at run time. See the reference topic on that interface for an overview
+ of the schema type system.</p>
+ <h2>Schema Type "Signatures"</h2>
+ <p>A schema is made up of schema components. Schema components are the pieces
+ of a schema, such as a type definition, an element declaration, attribute
+ declaration, and so on. To mirror these in the schema type system, a <a href="../reference/org/apache/xmlbeans/SchemaComponent.html"><span class="langinline">SchemaComponent</span></a>
+ instance represents a component in the underlying schema; separate components
+ have corresponding types. For example you would have a <span class="langinline"><a href="../reference/org/apache/xmlbeans/SchemaType.html">SchemaType</a></span>
+ object for a <span class="langinline">CustomerType</span> your schema defined,
+ or a <a href="../reference/org/apache/xmlbeans/SchemaGlobalElement.html"><span class="langinline">SchemaGlobalElement</span></a>
+ object for a global <span class="langinline">PurchaseOrder</span> element.
+ You would also have a <span class="langinline">SchemaType</span> for built-in
+ schema types, such as <span class="langinline">xs:string</span> or <span class="langinline">xs:datetime</span>.
+ XMLBean provides a "signature" to describe each type. You can retrieve
+ this signature by calling the SchemaType class's <span class="langinline">toString</span>
+ method.</p>
+ <p>The <span class="langinline">toString</span> method returns XMLBeans' version
+ of a unique signature for a schema type. This string is useful for debugging
+ because it describes a given type even when the type doesn't have a name.
+ </p>
+ <p class="notepara"><strong>Note:</strong> It's important to remember that this
+ signature is an XMLBeans convention, rather than a standard from the schema
+ working group. The working group has not yet standardized a signature for
+ XML schema types. As a result the signature you'll see from XMLBeans is subject
+ to change — whatever the schema working group comes up with in the end
+ (if anything) is probably what will be used by this API. In other words, don't
+ write a program to decode the signature.</p>
+ <p>You can use the following description to understand how a signature is constructed.</p>
+</div>
+<ul>
+ <li>
+ <div><strong>Global types.</strong> If the type has a name, it's a global
+ type. The following form is used:</div>
+ <div>
+ <div>
+ <pre>T=<localname>@<targetNamespace></pre>
+ </div>
+ </div>
+ <p>The "T" is for "type," of course. "localname"
+ is a convention used by qnames (qualified names), which include a local
+ name and the namespace URI (if any). So an example might be:</p>
+ <pre>T=customer@openuri.org</pre>
+ </li>
+ <li><strong>Document types and global attribute types.</strong> These correspond
+ to a special anonymous type containing one global element or attribute. These
+ special types are generated by XMLBeans to represent global types declared
+ with the <element> or <attribute> tag in schema. Because such
+ types are types, but are declared as elements or attributes, they require
+ special treatment. The following signature form is used:
+ <div>
+ <pre>
+D=<document-element-name>@<targetNamespace>
+R=<attribute-type-name>@<targetNamespace>
+</pre>
+ <div></div>
+ </div>
+ <div>
+ <div>Note that these are also the signatures of a type returned by a FooDocument.type
+ or FooAttribute.type method call.</div>
+ </div>
+ </li>
+ <li><strong>Anonymous types.</strong> If the type is anonymous, it is defined
+ as an element or attribute, or within a further anonymous type. In this case,
+ the signature is built by establishing the local context (in order words,
+ what is the anonymous type nested in?). From the local context, the larger
+ context is built recursively. In other words, the signature is built by giving
+ not only the anonymous type itself, but also by describing its context.
+ <p> The following rules are used for building a signature for an anonymous
+ type. </p>
+ <ul>
+ <li> It might be an anonymous type defined inside a local element or attribute,
+ which in turn is defined within something else:
+ <p>If the element is <span class="langinline" style="langinline">form="qualified"</span>
+ (the usual default):</p>
+ </li>
+ </ul>
+ </li>
+ <blockquote>
+ <div>
+ <pre>E=<eltname>|<signature of the type within which the elt is defined></pre>
+ </div>
+ <div>If the element is <span class="langinline" style="langinline">form="unqualified"</span>:</div>
+ <div>
+ <pre>U=<eltname>|<signature of the type within which the elt is defined></pre>
+ </div>
+ <div>If the attribute is <span class="langinline" style="langline">form="unqualified"</span>
+ (the usual default):</div>
+ <div>
+ <pre>A=<attrname>|<signature of the type within the attr is defined></pre>
+ </div>
+ <div>if the attribute is <span class="langinline" style="langinline">form="qualified"</span>:</div>
+ <div>
+ <pre>Q=<attrname>|<signature of the type within the attr is defined></pre>
+ </div>
+ </blockquote>
+ <ul>
+ <li>It might be an anonymous type defined a simple restriction, union, or
+ list definition:</li>
+ </ul>
+ <blockquote>
+ <div>
+ <pre>M=#|<signature of the containing union type></pre>
+ <p>(The # is a number indicating which union member it is, by source order
+ — such as 0,1,2, etc.)</p>
+ <pre>B=|<signature of the containing base type for a restriction></pre>
+ <pre>I=|<signature of the containing list type></pre>
+ </div>
+ </blockquote>
+ <ul>
+ <li>
+ <div> In the future if anonymous types are allowed in some other context,
+ there may be more codes.</div>
+ </li>
+ </ul>
+</ul>
+<h2>An Example</h2>
+<p>So, for example, if you have a type that describes the list items within an
+ attribute of an instance that looks like this:</p>
+<blockquote>
+ <div>
+ <pre> <root mylist="432 999 143 123"/></pre>
+ </div>
+</blockquote>
+<div> The schema, if done with lots of nested types, could look something like
+ this:</div>
+<blockquote>
+ <div>
+ <pre>
+<schema targetNamespace="myNamespace" elementFormDefault="qualified">
+ <element name="root">
+ <complexType>
+ <attribute name="mylist">
+ <simpleType>
+ <list>
+ <simpleType> <!--This is the type that the signature is for -->
+ <restriction base="xs:nonNegativeInteger">
+ <totalDigits value="3"/>..
+</pre>
+ </div>
+</blockquote>
+<div> The signature for the simpleType indicated in the example would be:</div>
+<blockquote>
+ <pre>I=|A=mylist|E=root|D=root@myNamespace</pre>
+</blockquote>
+<div>
+ <p>You could read this as: </p>
+</div>
+<blockquote>
+ <div>"The type of the list item | within the type of the mylist attribute's
+ type | within the type of the root element | within the document type for
+ <root> documents | in the myNamespace namespace".</div>
+</blockquote>
+<div>
+ <p>Note that the signature structure mirrors the Java class structure generated
+ by XMLBeans when compiling the schema. In other words, if you were to compile
+ a schema that included the preceding snippet, you would be able to access
+ an instance of the schema with Java code like the following:</p>
+ <pre>SchemaType sType = RootDocument.Root.MyList.Item.type;</pre>
+</div>
+<p class="relatedtopics">Related Topics</p>
+<p><a href="conGettingStartedwithXMLBeans.html">Getting Started with XMLBeans</a></p>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conJavaTypesGeneratedFromUserDerived.html b/v1/docs/guide/conJavaTypesGeneratedFromUserDerived.html
new file mode 100644
index 0000000..40d2274
--- /dev/null
+++ b/v1/docs/guide/conJavaTypesGeneratedFromUserDerived.html
@@ -0,0 +1,471 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Java Types Generated from Schema</title>
+<!-- InstanceEndEditable -->
+
+<!--(Meta)==========================================================-->
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="component" content="">
+<!-- In the description metatag, please provide a BRIEF description of the topic contents. -->
+<meta name="description" content="">
+<!-- In the component metatag, please list keywords that will help a user search for this topic. -->
+<meta name="keywords" content="">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+
+<!--(Meta)==========================================================-->
+
+
+
+<meta name="author" content="your name">
+<meta name="description" content="A description of the topic contents.">
+<meta name="keywords" content="keywords to help in searches">
+<meta name="date last modified" content="10/25/02">
+<!--(Links)=========================================================-->
+<!--(Body)==========================================================--><!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> Java Types Generated from User-Derived Schema Types</h1>
+<div id="topictext">
+ <p>When you compile XML schema, the resulting API is made up of two categories
+ of types: built-in types that mirror those in the schema specification and
+ others that are generated from user-derived schema types. This topic provides
+ an overview of the Java types generated for user-derived types, describing
+ the methods the Java types provide. For more information about built-in types,
+ see <a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans Support for
+ Built-In Schema Types</a>. For specific information about the methods exposed
+ by generated types, see <a href="conMethodsForGeneratedJavaTypes.html">Methods
+ for Generated Java Types</a>.</p>
+ <p>In general, an API generated from schema is an intuitive means to access
+ XML instances based on the schema. You'll probably find that for most uses
+ it's unnecessary to know the rules for generating it in order to use it. However,
+ for those cases when it's unclear what's going on behind the scenes (or if
+ you're just curious), this topic describes the rules.</p>
+ <p class="notepara"><strong>Note:</strong> The XMLBeans API also provides a
+ way for you to get information <em>about </em>the type system itself —
+ in other words, about the API and the underlying schema. For more information,
+ see <a href="conIntroToTheSchemaTypeSystem.html">Introduction to Schema Type
+ Signatures</a>.</p>
+ <p>Each of the types generated when you compile a schema is designed specifically
+ for access to XML instances conforming to that part of the schema. Start by
+ taking a look at a simple XML and schema example. The following schema describes
+ an XML document to contain a stock price quote.</p>
+ <pre><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="price-quote">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="stock-symbol" type="xs:string"/>
+ <xs:element name="stock-price" type="xs:float"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+</pre>
+ <p>The following is an example of XML that conforms to this schema.</p>
+ <pre><price-quote>
+ <stock-symbol>BEAS</stock-symbol>
+ <stock-price>59.21</stock-price>
+</price-quote></pre>
+ <p>When you compile this schema, you get two generated XMLBeans interfaces:
+ <span class="langinline"> PriceQuoteDocument</span> and <span class="langinline">PriceQuoteDocument.PriceQuote</span>.</p>
+ <p>From the schema point of view, the generated <span class="langinline">PriceQuote</span>
+ interface represents the <em>complex type</em> you see inside the schema's
+ <span class="langinline">price-quote</span> element declaration. Looking at
+ the XML instance, you can see that this complex type translates into a sequence
+ of two elements, <span class="langinline">stock-symbol</span> and <span class="langinline">stock-price</span>.
+ So it's not surprising that the <span class="langinline">PriceQuote</span>
+ interface exposes methods such as <span class="langinline">getStockPrice</span>
+ and <span class="langinline">setStockPrice</span> to set the value <span class="langinline">stock-price</span>
+ element.</p>
+ <p>The <span class="langinline">PriceQuoteDocument</span> interface, on the
+ other hand, represents the <span class="langinline">price-quote</span> <em>document</em>
+ that contains the root <span class="langinline">price-quote</span> element.
+ XMLBeans creates a special "document" type for global element types.
+ A document type provides a way for you to get and set the value of the underlying
+ type, here represented by <span class="langinline">PriceQuote</span>. The
+ <span class="langinline">price-quote</span> element is considered a <em>global</em>
+ element because it can be referenced from anywhere else in the schema. For
+ global elements, the XMLBeans schema compiler generates an interface whose
+ name ends with "Document." This is because an XML schema has no
+ way of defining a "root" element; any global element can be the
+ root.</p>
+ <p>The following bit of Java code illustrates how you might use these interfaces
+ to get the stock price contained in the XML.</p>
+ <pre>
+public static float getStockPrice(java.io.File orderXML) throws Exception
+{
+ PriceQuoteDocument docXML = PriceQuoteDocument.Factory.parse(orderXML);
+ PriceQuote quoteXML = docXML.getPriceQuote();
+ float stockPrice = quoteXML.getStockPrice();
+ return stockPrice;
+}
+</pre>
+ <p>This code loads the XML from a <span class="langinline">File</span> object,
+ converting the <span class="langinline">parse</span> method's return value
+ to a <span class="langinline">PriceQuoteDocument</span> instance. It then
+ uses this instance to get an instance of <span class="langinline">PriceQuote</span>.
+ With <span class="langinline">PriceQuote</span>, the code extracts the stock
+ price. </p>
+</div>
+<div>
+ <div id="topictext">
+ <p>The XML schema specification provides a rich set of rules through which
+ you can derive new types. When you generate interfaces from your schema,
+ XMLBeans uses the schema's rules to determine how to generate interfaces.
+ The following describes some of the guidelines by which this is done.</p>
+ <h2>Names for Interfaces</h2>
+ <p>Interfaces are generated for schema types (both simple and complex). Anonymous
+ schema types result in inner interfaces inside the type interface in which
+ they are defined. Their name comes from the element or attribute in which
+ they is defined.</p>
+ <p>Names for schema types become Java-friendly names when the schema is compiled.
+ In other words, names such as "price-quote" become "PriceQuote." In addition,
+ a schema's XML namespace URIs become package names for XMLBean types generated
+ from the schema. The way this name translation is done is described by section
+ C of the Java API for XML Binding (JAXB) specification at <a href="http://java.sun.com/xml/downloads/jaxb.html" target="_blank">
+ http://java.sun.com/xml/jaxb.html.</a> </p>
+ <p>Here are a few examples:</p>
+ <table>
+ <tr>
+ <td><strong>Schema Target Namespace</strong></td>
+ <td width="155"><strong>XML Localname</strong></td>
+ <td><strong>Fully-Qualified XMLBean Type Name</strong></td>
+ </tr>
+ <tr>
+ <td>http://www.mycompany.com/2002/buyer</td>
+ <td width="155">purchase-order-4</td>
+ <td>com.mycompany.x2002.buyer.PurchaseOrder4</td>
+ </tr>
+ <tr>
+ <td>http://myco.com/sample.html</td>
+ <td width="155">SampleDocument</td>
+ <td>com.myco.sample.SampleDocument</td>
+ </tr>
+ <tr>
+ <td>http://openuri.org/test_case_1</td>
+ <td width="155">test_type</td>
+ <td>org.openuri.testCase1.TestType</td>
+ </tr>
+ </table>
+ <p>When there are name collisions, the generated types will have names with
+ numerals appended — for example, "TestType2".</p>
+ <h2>Global Elements and Attributes</h2>
+ <p>In schema, global element and attribute definitions are those that are
+ declared at the top level of the schema (that is, immediately within the
+ <span class="langinline">schema</span> root element). Because they are global,
+ they may be referenced from inside the schema by name. The <span class="langinline">creditReport</span>
+ (not the <span class="langinline">creditReportType</span> complex type)
+ element defined in the following schema is an example.</p>
+ <pre>
+<xs:schema targetNamespace="http://openuri.org/samples/creditReport"
+ xmlns:cr="http://openuri.org/samples/creditReport"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+ <xs:complexType name="creditReportType">
+ <xs:sequence>
+ <xs:element name="bankReport" type="xs:string"/>
+ <xs:element name="taxReport" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="creditReport" type="cr:creditReportType"/>
+</xs:schema></pre>
+ <p>XMLBeans generates a separate interface for each of these. Also, global
+ element and attribute types are somewhat unique in that the schema compiler
+ will create special types to hold the globally defined element or attribute.
+ The names of these types will be appended with "Document" (for
+ elements) or "Attribute" (for attributes). You can retrieve the
+ element or attribute itself (or create a new one) by calling the accessor
+ methods that the special types provide. The following example would create
+ a new instance of the creditReport element.</p>
+ <pre>
+// Create an instance of the special document type.
+CreditReportDocument reportDoc = CreditReportDocument.Factory.newInstance();
+/*
+ * Use the document type to add a new creditReport element to the XML instance.
+ * Note that the type returned by the addNewCreditReport method is the
+ * creditReportType complex type defined for it in schema.
+ */
+CreditReportType report = reportDoc.addNewCreditReport();
+</pre>
+ <h2>Global User-Derived Types</h2>
+ <p>A <em>user-derived</em> type is one defined with a <span class="langinline">complexType</span>
+ or <span class="langinline">simpleType</span> element in schema. User-derived
+ types at the top level of a schema are global. XMLBeans generates an interface
+ for each of these, as it does with global elements and attributes. These
+ interfaces include methods through which you can get and set the type's
+ values, including any nested derived types it may contain. The following
+ schema snippet defines a user-derived complex type called <span class="langinline">itemType</span>,
+ along with a <span class="langinline">priceType</span> that uses it as the
+ type for an <span class="langinline">item</span> child element.</p>
+ <pre>
+<xs:complexType name="itemType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="amount" type="xs:int"/>
+ <xs:element name="price" type="xs:double"/>
+ </xs:sequence>
+</xs:complexType>
+<xs:complexType name="priceType">
+ <xs:sequence>
+ <xs:element name="item" type="ps:itemType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+<xs:element name="price" type="ps:priceType"/>
+</pre>
+ <p>By default, the generated Java type for <span class="langinline">itemType</span>
+ would be an interface called <span class="langinline">ItemType</span>. With
+ this type, you would be able to get and set the values of its <span class="langinline">name</span>,
+ <span class="langinline">amount</span>, and <span class="langinline">price</span>
+ child elements. However, a user-derived type (as opposed to an element or
+ attribute) is always intended for use as the type to which an element or
+ attribute is bound. In other words, it's contained by an element or attribute.
+ While you can create a new instance of a user-derived type, the new instance's
+ underlying XML is a fragment. As the generated API would make clear, the
+ <span class="langinline">itemType</span> becomes the return type of a get
+ method, or the parameter of a set method.</p>
+ <pre>
+// Create a new price document.
+PriceDocument priceDoc = PriceDocument.Factory.newInstance();
+PriceType price = priceDoc.getPrice();
+
+/*
+ * Create a new instance of ItemType and set the values of its
+ * child elements.
+ */
+ItemType item = ItemType.Factory.newInstance();
+item.setName("bicycle");
+item.setAmount(12);
+item.setPrice(560.00);
+
+/*
+ * Use the new ItemType instance to set the value of the
+ * price element's first item child element. Notice that the set method
+ * here is an "Array" method. This is because the item element
+ * is defined with a maxOccurs="unbounded" attribute. It can occur
+ * many times as a child of price.
+ */
+price.setItemArray(0, item);
+</pre>
+ <h2>Nested Elements and Derived Types</h2>
+ <p>When your schema includes named types that are declared locally—within
+ the declaration of another element or type—the schema type's generated Java
+ interface will be an inner interface within the type it's nested in.</p>
+ <p>For example, the following schema snippet defines <span class="langinline">name</span>
+ and <span class="langinline">gender</span> elements nested within a <span class="langinline">person</span>
+ complex type. In particular, note that the gender element is defined as
+ deriving from the xs:NMTOKEN built-in type.</p>
+ <pre>
+<xs:complexType name="person">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="gender">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="male"/>
+ <xs:enumeration value="female"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+</xs:complexType>
+</pre>
+ <p>The generated interfaces for person and gender would be organized in source
+ something like the following. Of course, you wouldn't see the source, but
+ you can see here that the Gender interface is nested with Person. Also,
+ notice that it extends XmlNMTOKEN, mirroring the schema.</p>
+ <pre>public interface Person extends XmlObject
+{
+ public interface Gender extends XmlNMTOKEN
+ {
+ // Methods omitted for this example
+ }
+ // Methods omitted for this example
+}
+</pre>
+ <p>You could create a new instance of the <span class="langinline">Gender</span>
+ type in this way (there are also various alternatives to this):</p>
+ <pre>
+// Create a new Person instance.
+Person person = Person.Factory.newInstance();
+/*
+ * Set the gender element's value using the
+ * enumeration generated from the schema.
+ */
+person.setGender(Gender.FEMALE);</pre>
+ <h2>User-Derived Simple Types</h2>
+ <p>In addition to the 46 built-in simple types in XML schema, a schema can
+ include its own custom simple types using <span class="langinline">xs:simpleType</span>
+ declarations. These user-derived simple types are always based on the built-in
+ XML schema types. The built-in types can be modified by <em>restricting</em>
+ them, taking <em>unions</em> of them, or making space-separated <em>lists</em>
+ of them. Each XML simple type is translated into a Java type that provides
+ access to the underlying data.</p>
+ <h3>Unions</h3>
+ <p>In schema, you can use <span class="langinline">xs:union</span> to specify
+ a simple type that is allowed to contain values of a number of other simple
+ types. XMLBeans generates a type for a union, just as it generates a type
+ for any other schema type. At run time, you can discover the underlying
+ type of an instance of a union type by calling the <span class="langinline">XmlObject</span>
+ interface's <span class="langinline">instanceType</span> method. Once you
+ have determined the type, you can cast an instance of a union type to the
+ actual underlying instance type.</p>
+ <pre>
+<xs:simpleType name="intOrString">
+ <xs:union memberTypes="xs:int xs:string">
+</xs:simpleType>
+</pre>
+ <p>Given the preceding schema snippet, you could set the intOrString value
+ to, say, 6 or "six". The union of <span class="langinline">xs:int</span>
+ and <span class="langinline">xs:string</span> makes both allowable.</p>
+ <pre>
+// Create a new instance of the type.
+IntOrString intOrString = IntOrString.Factory.newInstance();
+intOrString.set("5");
+// This code prints "XmlInt" to the console.
+System.out.println(intOrString.instanceType().getShortJavaName());
+</pre>
+ <h3>Restrictions</h3>
+ <p>XML schema restrictions on simple XMLBeans types are enforced. So, for
+ example, it is illegal to set a number outside its restricted range. </p>
+ <h4>Numeric Type Restrictions</h4>
+ <p>In schema, you can restrict numeric types to allow, for example, only a
+ particular range of values. For such a restriction, XMLBeans tailors the
+ resulting natural Java alternative. For example, suppose you have the following
+ element defined in schema:</p>
+ <pre>
+<xs:element name="number">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="1000000"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+</pre>
+ <p>The type is restricted from <span class="langinline">xs:integer</span>,
+ but because the number's range is limited to between 1 and 1000000, it will
+ fit into a Java <span class="langinline">int</span>. A <span class="langinline">long</span>
+ or <span class="langinline">java.math.BigInteger</span> would be too big
+ for the need. In other words, the <span class="langinline">getNumber</span>
+ method generated for this type will return an <span class="langinline">int</span>,
+ rather than a <span class="langinline">BigInteger</span> or a <span class="langinline">long</span>.</p>
+ <p>By the same token, an long can be compiled to an int if the totalDigits
+ attribute is <=9, or the min and max attribute values are within 32-bit
+ 2s complement range.</p>
+ <p>The single primitive XML type xs:decimal can be restricted in several ways
+ that influence the resulting natural Java type. For example, it can be:</p>
+ </div>
+</div>
+<ul>
+ <li>
+ <div>
+ <div>Compiled to a <span class="langinline">BigInteger</span> if its <span class="langinline">fractionDigit</span>
+ attribute is set to 0. </div>
+ </div>
+ </li>
+ <li>
+ <div>
+ <div>Compiled to a <span class="langinline">long</span> if its totalDigits
+ attribute is <=18, or the min and max are within 64-bit 2s complement
+ range.</div>
+ </div>
+ </li>
+</ul>
+<div>
+ <div>
+ <h3>Enumerations</h3>
+ <p>In schema, you can derive a new type by restricting a built-in type so
+ that only a finite set of values are allowable. Where schema does this by
+ restricting <span class="langinline">xs:string</span>, XMLBeans generates
+ a special <span class="langinline">Enum</span> type. With an <span class="langinline">Enum</span>,
+ you can select the enumerated value either by its <span class="langinline">String</span>
+ value or by a numeric index. The index's value is determined based on the
+ <span class="langinline">String</span> value's order in the schema. Having
+ an index can be useful in Java switch statements.</p>
+ <p>For example, suppose you had a document containing price elements whose
+ type was the priceType defined in the following schema snippet:</p>
+ <pre><xs:complexType name="priceType">
+ <xs:sequence>
+ <xs:element name="item" type="ps:itemType" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="threshold">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Below10Dollars"/>
+ <xs:enumeration value="Between10And20Dollars"/>
+ <xs:enumeration value="Above20Dollars"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+</xs:complexType></pre>
+ <p>Using types generated from the schema, you would be able to write the following
+ Java code to "switch" on the threshold attribute's enumeration:</p>
+ <pre>
+/*
+ * Use the intValue method provided by the Enum type to determine the threshold
+ * attribute's current enumeration value.
+ */
+switch(priceElements[i].getThreshold().intValue())
+{
+ // Use the Threshold type's enumeration values to test for an attribute value.
+ case PriceType.Threshold.INT_BELOW_10_DOLLARS:
+ zeroBuffer.append(item.getTitle() + "\n");
+ break;
+ case PriceType.Threshold.INT_BETWEEN_10_AND_20_DOLLARS:
+ tenBuffer.append(item.getTitle() + "\n");
+ break;
+ case PriceType.Threshold.INT_ABOVE_20_DOLLARS:
+ twentyBuffer.append(item.getTitle() + "\n");
+ break;
+ default:
+ System.out.println("Yo! Something unexpected happened!");
+ break;
+}</pre>
+ </div>
+ <p class="relatedtopics">Related Topics</p>
+ <p><a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans Support for
+ Built-In Schema Types</a></p>
+</div>
+ <!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conMethodsForGeneratedJavaTypes.html b/v1/docs/guide/conMethodsForGeneratedJavaTypes.html
new file mode 100644
index 0000000..9763cf9
--- /dev/null
+++ b/v1/docs/guide/conMethodsForGeneratedJavaTypes.html
@@ -0,0 +1,275 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Methods for Types Generated From Schema</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="component" content="">
+<!-- In the description metatag, please provide a BRIEF description of the topic contents. -->
+<meta name="description" content="">
+<!-- In the component metatag, please list keywords that will help a user search for this topic. -->
+<meta name="keywords" content="">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<div id=topictitle>
+ <p class=Title>Methods for Types Generated From Schema</p>
+</div>
+<div id=topictext>
+ <p>As you may have seen in <a href="conGettingStartedwithXMLBeans.html">Getting
+ Started with XMLBeans</a>, you use the types generated from schema to access
+ XML instances based on the schema. If you're familiar with the JavaBeans technology,
+ the conventions used in the generated API will be recognizable. </p>
+ <p>In general, elements and attributes are treated as "properties"
+ in the JavaBeans sense. In other words, as you would with JavaBeans properties,
+ you manipulate parts of the XML through accessor methods such as getCustomer()
+ (where you have a "customer" element), setId(String) (where you
+ have an "id" attribute), and so on. However, because schema structures
+ can be somewhat complex, XMLBeans provides several other method styles for
+ handling those structures in XML instances.</p>
+ <div>
+ <h2>Prototypes for Methods in Generated Interfaces</h2>
+ <p>Several methods are generated for each element or attribute within the
+ complex type. This topic lists each method that could be generated for a
+ given element or attribute. </p>
+ <p>Note that whether or not a given method is generated is based on how the
+ element or attribute is defined in schema. For example, a customer element
+ definition with a <span class="langinline">maxOccurs</span> attribute value
+ of 1 will result in a getCustomer method, but not a getCustomerArray method
+ — after all, only one customer element is possible in an instance
+ document.</p>
+ <p>Note, too, that there may be two sets of parallel methods: one whose prototype
+ starts with an "x". An "x" method such as xgetName or
+ xsetName would be generated for elements or attribute whose type is a simple
+ type. A simple type may be one of the 44 built-in simple types or may be
+ a restriction in schema of one of those built-in types. Of course, an attribute
+ will always be of a simple type. For built-in simple types, an "x"
+ method will get or set one of the types provided with XMLBeans, such as
+ <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlString.html">XmlString</a></span>,
+ <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlInteger.html">XmlInteger</a></span>,
+ <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlGDay.html">XmlGDay</a></span>,
+ and so on. For derived types, the "x" method will get or set a
+ generated type.</p>
+ <h3>Single Occurrence Methods</h3>
+ <p>Methods generated for elements or attributes that allow a single occurrence.
+ An element is singular if it was declared with maxOccurs="1".
+ An attribute is singular if it was not declared with use="prohibited".</p>
+ <pre>
+Type getFoo()
+void setFoo(Type newValue)
+</pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets the value of Foo. Generated when Foo is an attribute,
+ or is an element that can occur only once as a child.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType xgetFoo()
+void xsetFoo(XmlType newValue)</pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets the value of Foo as an XMLBean simple type. These methods
+ are generated if Foo's type is defined in schema as a simpleType.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>boolean isNilFoo()
+void setNilFoo()</pre>
+ </div>
+ <blockquote>
+ <div>Determines or specifies whether the Foo element is nil (in other words,
+ "null" in schema terms), meaning it can be empty. A nil element
+ looks something like this:</div>
+ <div>
+ <pre><foo/></pre>
+ </div>
+ <div>These methods are only generated when an element type is declared as
+ nillable in schema — it has a nillable="true" attribute.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType addNewFoo()</pre>
+ </div>
+ <blockquote>
+ <div>Adds a new Foo as an XMLBean simple to the document, or returns Foo's
+ value if one exists already.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>boolean isSetFoo()
+void unSetFoo()</pre>
+ </div>
+ <blockquote>
+ <div>Determines whether the Foo element or attribute exists in the document;
+ removes Foo. These methods are generated for elements and attributes that
+ are optional. In schema, and optional element has an <span class="langinline">minOccurs</span>
+ attribute set to "0"; an optional attribute has a <span class="langinline">use</span>
+ attribute set to "optional".</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <h3>Multiple Occurrence Methods</h3>
+ <p>Methods generated for elements that allow multiple occurrences. </p>
+ <p>An element may occur multiple times if it has a <span class="langinline">maxOccurs</span>
+ attribute set to "unbounded" or greater than 1. Attributes can't
+ occur multiple times.</p>
+ <pre>Type[] getFooArray()
+void setFooArray(Type[] newValue) </pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets all of the Foo elements. </div>
+ <div>
+ <pre>
+// Get an array of the all of the purchase-order elements item children.
+Item[] items = myPO.getItemArray();
+</pre>
+ </div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>Type getFooArray(int index)
+void setFooArray(Type newValue, int index)</pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets the Foo child element at the specified index.</div>
+ <div>
+ <pre>// Sets the value of the third item child element.
+myPO.setItem(newItem, 2);</pre>
+ </div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>int sizeOfFooArray()</pre>
+ </div>
+ <blockquote>
+ <div>Returns the number of Foo child elements.</div>
+ <div>
+ <pre>// Returns the number of item child elements.
+int itemCount = myPO.sizeOfItemArray();</pre>
+ </div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>void removeFoo(int index)</pre>
+ </div>
+ <blockquote>
+ <div>Removes the Foo child element at the specified index.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType[] xgetFooArray()
+void xsetFooArray(XmlType[] arrayOfNewValues)</pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets all of the Foo elements as XMLBeans simple types. Generated
+ only when the Foo element is defined as a simple type.</div>
+ <div>
+ <pre>/*
+ * Returns values of all the phone child elements of an employee element,
+ * where the phone element has been defined as xs:string.
+ */
+XmlString[] empPhones = currentEmployee.xGetPhoneArray();
+</pre>
+ </div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType xgetFooArray(int index)
+void xsetFooArray(int index, XmlType newValue)</pre>
+ </div>
+ <blockquote>
+ <div>Returns or sets the Foo element at the specified index, using an XMLBeans
+ simple type value. Generated for an element defined as a simple type in
+ schema.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>void insertFoo(int index, FooType newValue)</pre>
+ </div>
+ <blockquote>
+ <div>Inserts the specified Foo child element at the specified index.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>void addFoo(FooType newValue)</pre>
+ </div>
+ <blockquote>
+ <div>Adds the specified Foo to the end of the list of Foo child elements.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType insertNewFoo(int index)</pre>
+ </div>
+ <blockquote>
+ <div>Inserts a new Foo at the specified index, returning an XMLBeans simple
+ type representing the new element; returns the existing Foo if there's already
+ one at index.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>XmlType addNewFoo()</pre>
+ </div>
+ <blockquote>
+ <div>Adds a new Foo element to the end of the list of Foo child elements,
+ returning an XMLBeans simple type representing the newly added element.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ <pre>boolean isNilFooArray(int index)
+void setNilFooArray(int index)</pre>
+ </div>
+ <blockquote>
+ <div>Determines or specifies whether the Foo element at the specified index
+ is nil.</div>
+ </blockquote>
+ <div>
+ <hr size="1">
+ </div>
+ <div id="topictext"></div>
+ <p class=relatedtopics>Related Topics</p>
+ <p><a href="conJavaTypesGeneratedFromUserDerived.html">Java Types Generated
+ from User-Derived Schema Types</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conNavigatingXMLwithCursors.html b/v1/docs/guide/conNavigatingXMLwithCursors.html
new file mode 100644
index 0000000..404e8ae
--- /dev/null
+++ b/v1/docs/guide/conNavigatingXMLwithCursors.html
@@ -0,0 +1,222 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Navigating XML with Cursors</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta content="your name" name="author">
+<meta content="A description of the topic contents." name="description">
+<meta content="keywords to help in searches" name="keywords">
+<meta content="10/25/02" name="date last modified">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> Navigating XML with Cursors </h1>
+<div id="topictext">
+ <p>XML cursors are a way to navigate through an XML instance document. Once
+ you load an XML document, you can create a cursor to represent a specific
+ place in the XML. Because you can use a cursor with or without a schema corresponding
+ to the XML, cursors are an ideal way to handle XML without a schema.</p>
+ <p>With an XML cursor, you can:</p>
+</div>
+<UL>
+ <li>
+ <div><a href="conUnderstandingXMLTokens.html">Use the token model</a> to move
+ through XML in small increments, or in a manner similar to using a DOM-based
+ model.</div>
+ <LI>
+ <DIV>Get and set values within the XML.</DIV>
+ <LI>
+ <DIV><a href="#adding_elements_attributes">Change the structure</a> of an
+ XML document by inserting, removing, and moving elements and attributes.</DIV>
+ <LI>
+ <DIV><a href="conSelectingXMLwithXQueryPathXPath.html">Execute XQuery expressions</a>
+ against the XML represented by the cursor.</DIV>
+ <LI>
+ <DIV><a href="conUsingBookmarksToAnnotateXML.html">Insert bookmarks</a> to
+ mark locations in XML.</DIV>
+</UL>
+<P>When you're finished using a cursor, your code should call its <span class="langinline">dispose</span>
+ method.</P>
+<h2>Creating and Moving a Cursor</h2>
+<P>With an XML instance document bound to <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlObject.html">XmlObject</a></span>
+ (or a type inheriting from it), you create a new cursor by calling the <span class="langinline">newCursor</span>
+ method. The <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlCursor.html">XmlCursor</a></span>
+ interface represents a cursor. From a cursor standpoint, an XML document is
+ a collection of <EM>tokens</EM> that represent the kinds of things that can
+ appear in XML. These include attributes, the start and end of elements,
+ comments, and so on. Each piece of information in XML is represented by
+ a <em>token type</em>.</P>
+<P class="notepara"><strong>Note:</strong> For a more complete description of
+ XML tokens, see <a href="conUnderstandingXMLTokens.html">Understanding XML Tokens</a>.</P>
+<P>For example, the following code loads the XML instance described above
+ from a <span class="langinline">File</span> object, then creates a new cursor.
+ The <span class="langinline">toFirstChild</span> takes the cursor to the start
+ tag of the <span class="langinline">batchWidgetOrder</span> document element.
+ The code then prints the type for the token at the cursor's location, along
+ with the XML the cursor represents—in other words, <span class="filepath">Token
+ type: START /</span> and the <span class="filepath">batchWidgetOrderElement</span>
+ and its contents.</P>
+<pre>public static void insertCursor(File orderFile) throws Exception
+{
+ BatchWidgetOrderDocument xmlDoc = BatchWidgetOrderDocument.Factory.parse(orderFile);
+ XmlCursor orderCursor = xmlDoc.newCursor();
+ orderCursor.toFirstChild();
+ System.out.println("Token type: " + orderCursor.currentTokenType() +
+ " / " + orderCursor.xmlText());
+}
+</pre>
+<p class="notepara"><STRONG>Note</STRONG>: The <span class="langinline">XmlCursor</span>
+ interface provides many methods you can use to put a cursor where you want it.
+ For a list of those methods, see <a href="../reference/org/apache/xmlbeans/XmlCursor.html">XmlCursor
+ Interface</a>.</p>
+<h2><a name="adding_elements_attributes" id="adding_elements_attributes"></a>Adding
+ Elements and Attributes</h2>
+<p>The <span class="langinline">XmlCursor</span> interface provides several methods
+ you can use to add elements and attributes to XML. </p>
+<p>One way to add new XML is with the <span class="langinline">beginElement</span>
+ method. This method is designed to insert a new element at the cursor's location,
+ and do it so the cursor ends up between the new element's START and END tokens.
+ From this position, you can insert attributes (they're automatically placed
+ in the start tag, where they belong) and insert a value. Here's an example:</p>
+<pre>
+// Create a new chunk of XML.
+XmlObject newXml = XmlObject.Factory.newInstance();
+/*
+ * Insert a new cursor and move it to the first START token (where the
+ * XML actually begins.
+ */
+XmlCursor cursor = newXml.newCursor();
+cursor.toNextToken();
+// Begin a new item element whose namespace URI is "http://openuri.org".
+cursor.beginElement("item", "http://openuri.org/");
+// Insert an ID attribute on the item element, along with an attribute value.
+cursor.insertAttributeWithValue("id", "4056404");
+// Insert "bicycle" as an element value.
+cursor.insertChars("bicycle");
+cursor.dispose();
+</pre>
+<p>This example results in something like the following:</p>
+<pre><ns1:item id="4056404" xmlns:ns1="http://openuri.org/">bicycle</ns1:item>
+</pre>
+<h2> Using Stored Cursor Locations with push() and pop()</h2>
+<div id="topictext">
+ <p>When you want to move a cursor around, but want to keep track of a former
+ location, you can use the <span class="langinline">XmlCursor</span> interface's
+ <span class="langinline">push</span> and <span class="langinline">pop</span>
+ methods. The <span class="langinline">push</span> method pushes the cursor's
+ current location onto a stack of locations maintained for that particular
+ cursor; the <span class="langinline">pop</span> method removes the location
+ from the top of the stack and moves the cursor to that location.</p>
+ <p>For example, consider the following <employee> element, used in the
+ example below.</p>
+ <pre>
+<employee>
+ <name>Gladys Kravitz</name>
+ <address location="home">
+ <street>1313 Mockingbird Lane</street>
+ <city>Seattle</city>
+ <state>WA</state>
+ <zip>98115</zip>
+ </address>
+ <address location="work">
+ <street>2011 152nd Avenue NE</street>
+ <city>Redmond</city>
+ <state>WA</state>
+ <zip>98052</zip>
+ </address>
+ <phone location="work">(425) 555-6897</phone>
+ <phone location="home">(206) 555-6594</phone>
+ <phone location="mobile">(206) 555-7894</phone>
+</employee>
+</pre>
+ <p>The following Java code illustrates how you can use <span class="langinline">push</span>
+ and <span class="langinline">pop</span> to put the cursor back to a saved
+ location after a bit of traveling.</p>
+ <pre>
+/**
+ * Pass to the trySelectPath method an XmlObject instance that contains
+ * the XML above.
+ */
+public void trySelectPath(XmlObject xml)
+{
+ /*
+ * Inserts the cursor at the STARTDOC token (the very beginning,
+ * before any elements).
+ */
+ XmlCursor cursor = xml.newCursor();
+ // Moves the cursor to just before <employee>
+ cursor.toFirstChild();
+ // Pushes the cursor's current location onto the stack.
+ cursor.push();
+ // Moves the cursor to just before the "work" <phone> element.
+ cursor.toChild(2);
+ // Moves the cursor to just before the "home" <phone> element.
+ cursor.toNextSibling();
+ // Moves the cursor back to just before <employee>
+ cursor.pop();
+}
+</pre>
+ <p>Of course, you can call <span class="langinline">push</span> and <span class="langinline">pop</span>
+ multiple times. Each new call to the <span class="langinline">push</span>
+ method pushes the current location onto the stack. As you call the <span class="langinline">pop</span>
+ method, you're always getting what's on top of the stack. So if you called
+ <span class="langinline">push</span> three times before calling <span class="langinline">pop</span>
+ — 1, 2, 3 — calling <span class="langinline">pop</span> three
+ times would get those locations in reverse order — 3, 2, 1.</p>
+ <p>The <span class="langinline">push</span> and <span class="langinline">pop</span>
+ methods can be handy as an alternative to creating new cursors that are designed
+ simply to mark a particular location while you move another cursor around.
+ The resources required to maintain a location stack through <span class="langinline">push</span>
+ and <span class="langinline">pop</span> are far less than those needed by
+ cursors. </p>
+ <H1>Disposing of a Cursor</H1>
+ <p>When you're through with a cursor, your code should call its <span class="langinline">dispose</span>
+ method to indicate that it's no longer needed.</p>
+ <p class="relatedtopics">Related Topics</p>
+ <p><a href="conUnderstandingXMLTokens.html">Understanding XML Tokens</a></p>
+ <p><a href="conGettingStartedwithXMLBeans.html">Getting Started with XMLBeans</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conSelectingXMLwithXQueryPathXPath.html b/v1/docs/guide/conSelectingXMLwithXQueryPathXPath.html
new file mode 100644
index 0000000..a84a3c7
--- /dev/null
+++ b/v1/docs/guide/conSelectingXMLwithXQueryPathXPath.html
@@ -0,0 +1,270 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Selecting XML with XQuery and XPath</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta content="your name" name="author">
+<meta content="A description of the topic contents." name="description">
+<meta content="keywords to help in searches" name="keywords">
+<meta content="10/25/02" name="date last modified">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> Selecting XML with XQuery and XPath</h1>
+<div id="topictext">
+ <p>You can use XQuery and XPath to retrieve specific pieces of XML as you might
+ retrieve data from a database. XQuery and XPath provide a syntax for specifying
+ which elements and attributes you're interested in. The XMLBeans API provides
+ two methods for executing XQuery and XPath expressions, and two differing
+ ways to use them. The methods are <span class="langinline">selectPath</span>
+ and <span class="langinline">execQuery</span>, and you can call them from
+ <a href="../reference/org/apache/xmlbeans/XmlObject.html"><span class="langinline">XmlObject</span></a>
+ (or an object inheriting from it) or <a href="../reference/org/apache/xmlbeans/XmlCursor.html"><span class="langinline">XmlCursor</span></a>.
+ The results for the methods differ somewhat. </p>
+ <h2>Using the selectPath Method</h2>
+</div>
+<div>
+ <p>The <span class="langinline">selectPath</span> method is the most efficient
+ way to execute XPath expressions. The <span class="langinline">selectPath</span>
+ method is optimized for XPath. When you use XPath with the <span class="langinline">selectPath</span>
+ method, the value returned is an array of values from the <em>current document</em>.
+ In contrast, when you use <span class="langinline">execQuery</span>, the value
+ returned is a <em>new document</em>.</p>
+ <h3>Calling from XmlObject</h3>
+ <p>When called from <span class="langinline">XmlObject</span> (or a type that
+ inherits from it), this method returns an array of objects. If the expression
+ is executed against types generated from schema, then the type for the returned
+ array is one of the Java types corresponding to the schema. </p>
+ <p>For example, imagine you have the following XML containing employee information.
+ You've compiled the schema describing this XML and the types generated from
+ schema are available to your code.</p>
+<pre>
+<xq:employees xmlns:xq="http://openuri.org/selectPath">
+ <xq:employee>
+ <xq:name>Fred Jones</xq:name>
+ <xq:address location="home">
+ <xq:street>900 Aurora Ave.</xq:street>
+ <xq:city>Seattle</xq:city>
+ <xq:state>WA</xq:state>
+ <xq:zip>98115</xq:zip>
+ </xq:address>
+ <xq:address location="work">
+ <xq:street>2011 152nd Avenue NE</xq:street>
+ <xq:city>Redmond</xq:city>
+ <xq:state>WA</xq:state>
+ <xq:zip>98052</xq:zip>
+ </xq:address>
+ <xq:phone location="work">(425)555-5665</xq:phone>
+ <xq:phone location="home">(206)555-5555</xq:phone>
+ <xq:phone location="mobile">(206)555-4321</xq:phone>
+ </xq:employee>
+</xq:employees>
+</pre>
+ If you wanted to find the phone numbers whose area code was 206, you could capture
+ the XPath expression in this way:
+ <pre>
+String queryExpression =
+ "declare namespace xq='http://openuri.org/selectPath'" +
+ "$this/xq:employees/xq:employee/xq:phone[contains(., '(206)')]"
+</pre>
+ <p>Notice in the query expression that the variable <span class="langinline">$this</span>
+ represents the current context node (the <span class="langinline">XmlObject</span>
+ that you are querying from). In this example you are querying from the document
+ level <span class="langinline">XmlObject</span>.</p>
+ <p>You could then print the results with code such as the following:</p>
+ <pre>
+/*
+ * Retrieve the matching phone elements and assign the results to the corresponding
+ * generated type.
+ */
+PhoneType[] phones = (PhoneType[])empDoc.selectPath(queryExpression);
+/*
+ * Loop through the results, printing the value of the phone element.
+ */
+for (int i = 0; i < phones.length; i++)
+{
+ System.out.println(phones[i].stringValue());
+} </pre>
+
+ <h3>Calling from XmlCursor</h3>
+ <p>When called from an <span class="langinline">XmlCursor</span> instance, the
+ <span class="langinline">selectPath</span> method retrieves a list of selections,
+ or locations in the XML. The selections are remembered by the cursor instance.
+ You can use methods such as <span class="langinline">toNextSelection</span>
+ to navigate among them.</p>
+ <div>
+ <p>The <span class="langinline">selectPath</span> method takes an XPath expression.
+ If the expression returns any results, each of those results is added as
+ a selection to the cursor's list of selections. You can move through these
+ selections in the way you might use <span class="langinline">java.util.Iterator</span>
+ methods to move through a collection.</p>
+ <p> For example, for a path such as <span class="langinline">$this/employees/employee</span>,
+ the results would include a selection for each employee element found by
+ the expression. Note that the variable <span class="langinline">$this</span>
+ is always bound to the current context node, which in this example is the
+ document. After calling the <span class="langinline">selectPath</span> method,
+ you would use various "selection"-related methods to work with
+ the results. These methods include:</p>
+ </div>
+ <ul>
+ <li>
+ <div><span class="langinline">getSelectionCount() </span>to retrieve the
+ number of selections resulting from the query.</div>
+ </li>
+ <li>
+ <div> <span class="langinline">toNextSelection()</span> to move the cursor
+ to the next selection in the list (such as to the one pointing at the
+ next employee element found).</div>
+ </li>
+ <li>
+ <div> <span class="langinline">toSelection(int)</span> to move the cursor
+ to the selection at the specified index (such as to the third employee
+ element in the selection).</div>
+ </li>
+ <li>
+ <div> <span class="langinline">hasNextSelection()</span> to find out if
+ there are more selections after the cursor's current position.</div>
+ </li>
+ <li>
+ <div><span class="langinline"> clearSelections()</span> clears the selections
+ from the current cursor. This doesn't modify the document (in other words,
+ it doesn't delete the selected XML); it merely clears the selection list
+ so that the cursor is no longer keeping track of those positions.</div>
+ </li>
+ </ul>
+ <div>
+ <p>The following example shows how you might use <span class="langinline">selectPath</span>,
+ in combination with the <span class="langinline">push</span> and <span class="langinline">pop</span>
+ methods, to maneuver through XML, retrieving specific values. </p>
+ <pre>
+public void printZipsAndWorkPhones(XmlObject xml)
+{
+ // Declare the namespace that will be used.
+ String xqNamespace =
+ "declare namespace xq='http://openuri.org/selectPath'";
+
+ // Insert a cursor and move it to the first element.
+ XmlCursor cursor = xml.newCursor();
+ cursor.toFirstChild();
+ /*
+ * Save the cursor's current location by pushing it
+ * onto a stack of saved locations.
+ */
+ cursor.push();
+ // Query for zip elements.
+ cursor.selectPath(xqNamespace + "$this//xq:zip");
+ /*
+ * Loop through the list of selections, getting the value of
+ * each element.
+ */
+ while (cursor.toNextSelection())
+ {
+ System.out.println(cursor.getTextValue());
+ }
+ // Pop the saved location off the stack.
+ cursor.pop();
+ // Query again from the top, this time for work phone numbers.
+ cursor.selectPath(xqNamespace + "$this//xq:phone[@location='work']");
+ /*
+ * Move the cursor to the first selection, them print that element's
+ * value.
+ */
+ cursor.toNextSelection();
+ System.out.println(cursor.getTextValue());
+ // Dispose of the cursor.
+ cursor.dispose();
+}
+</pre>
+ <p>Using selections is somewhat like tracking the locations of multiple cursors
+ with a single cursor. This becomes especially clear when you remove the
+ XML associated with a selection. When you do so the selection itself remains
+ at the location where the removed XML was, but now the selection's location
+ is immediately before the XML that was after the XML you removed. In other
+ words, removing XML created a kind of vacuum that was filled by the XML
+ after it, which shifted up into the space — up into position immediately
+ after the selection location. This is exactly the same as if the selection
+ had been another cursor.</p>
+ <p>Finally, when using selections keep in mind that the list of selections
+ is in a sense "live". The cursor you're working with is keeping
+ track of the selections in the list. In other words, be sure to call the
+ <span class="langinline">clearSelections</span> method when you're finished
+ with the selections, just as you should call the <span class="langinline">XmlCursor.dispose()</span>
+ method when you're finished using the cursor.</p>
+ </div>
+ <h2>Using the execQuery Method</h2>
+ <p>Use the <span class="langinline">execQuery</span> method to execute XQuery
+ expressions that are more sophisticated than paths. These expressions include
+ more sophisticated loops and FLWR (For, Let, Where, and Results) expressions.
+ </p>
+ <p class="notepara"><strong>Note:</strong> Be sure to see the simpleExpressions
+ sample in the SamplesApp application for a sampling of XQuery expressions
+ in use.</p>
+ <h3>Calling from XmlObject</h3>
+ <p>Unlike <span class="langinline">selectPath</span>, calling <span class="langinline">execQuery</span>
+ from an <span class="langinline">XmlObject</span> instance will return an
+ <span class="langinline">XmlObject</span> array. If the <span class="langinline">XmlObject</span>
+ instances resulting from the XQuery match a recognized XMLBeans type (the
+ namespace and top level element name match up with an XMLBeans type) then
+ the <span class="langinline">XmlObject</span> will be typed; otherwise the
+ <span class="langinline">XmlObject</span> will be untyped.</p>
+ <h3>Calling from XmlCursor</h3>
+</div>
+
+<div>
+ <p>Calling <span class="langinline">execQuery</span> from an <span class="langinline">XmlCursor</span>
+ instance returns a new <span class="langinline">XmlCursor</span> instance.
+ The cursor returned is positioned at the beginning of a new xml document representing
+ the query results, and you can use it to move through the results, cursor-style
+ (for more information, see <a href="conNavigatingXMLwithCursors.html">Navigating
+ XML with Cursors</a>). If the document resulting from the query execution
+ represents a recognized XMLBeans type (the namespace and top level element
+ name match up with an XMLBeans type) then the document resulting from the
+ xquery will have that Java type; otherwise the resulting document will be
+ untyped.</p>
+ <h2>Related Topics</h2>
+</div>
+<p><a href="conGettingStartedwithXMLBeans.html">Getting Started with XMLBeans</a></p>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conUnderstandingXMLTokens.html b/v1/docs/guide/conUnderstandingXMLTokens.html
new file mode 100644
index 0000000..6d72c07
--- /dev/null
+++ b/v1/docs/guide/conUnderstandingXMLTokens.html
@@ -0,0 +1,189 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Understanding XML Tokens</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="component" content="">
+<!-- In the description metatag, please provide a BRIEF description of the topic contents. -->
+<meta name="description" content="">
+<!-- In the component metatag, please list keywords that will help a user search for this topic. -->
+<meta name="keywords" content="">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<div id=topictitle>
+ <p class=Title>Understanding XML Tokens</p>
+</div>
+<div id=topictext>
+ <p>An XML cursor (an instance of the <a href="../reference/org/apache/xmlbeans/XmlCursor.html"><span class="langinline">XmlCursor</span></a>
+ interface) moves from token to token as your code moves the cursor. When you
+ move a cursor using a method such as <span class="langinline">toParent</span>,
+ <span class="langinline">toFirstAttribute</span>, <span class="langinline">toPrevSibling</span>,
+ and so on, the cursor moves to the token fitting the description. If there
+ is no appropriate token to move to, the cursor remains where it is, and <span class="langinline">false</span>
+ is returned to indicate that it didn't move. For example, if the cursor is
+ at the ENDDOC token (the last tag in the document), a call to the <span class="langinline">toNextSibling</span>
+ method will not move the cursor and will return <span class="langinline">false</span>
+ to indicate that the move was unsuccessful.</p>
+ <p>Note that while you can call the <span class="langinline">XmlCursor.currentTokenType</span>
+ method to find out which token type the cursor is at, you might find it more
+ convenient to use a method such as <span class="langinline">isEnddoc</span>.
+ The <span class="langinline">XmlCursor</span> interface provides several methods
+ that make it easy to discover whether the cursor you're moving is at the token
+ you're looking for. These methods, such as <span class="langinline">isStart</span>,
+ <span class="langinline">isAttr</span>, <span class="langinline">isText</span>,
+ and so on, return a <span class="langinline">boolean</span> value that indicates
+ whether the cursor is at the token type in question.</p>
+ <P>Tokens are represented by constants in the <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlCursor.TokenType.html">TokenType</a></span>
+ class, an inner class of the <span class="langinline">XmlCursor</span> interface.
+ Each has a constant you can use in switch statements to perform by-token actions.
+ The following table lists the token types:</P>
+ <TABLE id="Table1">
+ <TR>
+ <TD><STRONG>Token Type</STRONG></TD>
+ <TD><STRONG>Switch Constant</STRONG></TD>
+ <TD><STRONG>Description</STRONG></TD>
+ </TR>
+ <TR>
+ <TD>STARTDOC</TD>
+ <TD>INT_STARTDOC</TD>
+ <TD>Represents the start of the XML. Always the first token. The document
+ element itself is represented by a START token, not the STARTDOC token.</TD>
+ </TR>
+ <TR>
+ <TD>ENDDOC </TD>
+ <TD>INT_ENDDOC</TD>
+ <TD>Represents the end of the XML. Always the last token.</TD>
+ </TR>
+ <TR>
+ <TD>START </TD>
+ <TD>INT_START</TD>
+ <TD>Represents the start of an element.</TD>
+ </TR>
+ <TR>
+ <TD>END </TD>
+ <TD>INT_END</TD>
+ <TD>Represents the end of an element. The END token has no value, but marks
+ the element's end.</TD>
+ </TR>
+ <TR>
+ <TD>TEXT</TD>
+ <TD>INT_TEXT</TD>
+ <TD>Represents text.</TD>
+ </TR>
+ <TR>
+ <TD>ATTR </TD>
+ <TD>INT_ATTR</TD>
+ <TD>Represents an attribute. ATTR tokens are allowed to appear after a STARTDOC
+ or START token.</TD>
+ </TR>
+ <TR>
+ <TD>NAMESPACE</TD>
+ <TD>INT_NAMESPACE</TD>
+ <TD>Represents a namespace (xmlns) attribute. Also only allowed after START
+ or STARTDOC tokens.</TD>
+ </TR>
+ <TR>
+ <TD>COMMENT </TD>
+ <TD>INT_COMMENT</TD>
+ <TD>Represents a comment.</TD>
+ </TR>
+ <TR>
+ <TD>PROCINST </TD>
+ <TD>INT_PROCINST</TD>
+ <TD>Represents a processing instruction.</TD>
+ </TR>
+ </TABLE>
+ <P>As you use a cursor to navigate through XML, you can use one of the convenience
+ methods described above to discover whether you're at the token you're looking
+ for, or use the <span class="langinline">XmlCursor.currentTokenType</span> method
+ to discover the current token's type. The following figure illustrates example
+ locations for token types:</P>
+ <P><IMG src="../images/conCursorTokenLocations.gif" width="727" height="532">
+ <h2>Switching to Test for Token Types</h2>
+ <p>Here's a bit of code illustrating how you might use a Java <span class="langinline">switch</span>
+ statement to test for the START token type.</p>
+ <pre>
+// Take an incoming XmlObject and insert a cursor.
+XmlCursor documentCursor = xmlDoc.newCursor();
+
+/*
+ * Loop through the document, passing the cursor when it stops at each token
+ * to a function designed to discover the token type. Continue the loop
+ * as long at the cursor is at a token (until it reaches the end).
+ */
+while (!documentCursor.toNextToken().isNone())
+{
+ /*
+ * Use the intValue method to return the int corresponding to the
+ * current token type. If it is the value for INT_START,
+ * then you have a match.
+ */
+ switch (cursor.currentTokenType().intValue())
+ {
+ case TokenType.INT_START:
+ // Print out the token type and a message.
+ System.out.println(cursor.currentTokenType() +
+ "; cursor is at the start of an element.");
+ break;
+ }
+}
+// Be sure to dispose of a cursor when you're finished.
+documentCursor.dispose();
+</pre>
+ <p>The scope of an XML cursor is the XML document in which it is created. For
+ example, you can create a cursor at the orderItem element in the example earlier
+ in this topic. If you then use that <span class="langinline">XmlCursor</span>
+ instance's <span class="langinline">toNextToken</span> method to move the
+ cursor until it won't move any further, you'll have reached the ENDDOC token.
+ In this example, that's at the <span class="langinline"></batchWidgetOrder></span>
+ tag. In other words, the cursor's scope is not limited to the element at which
+ it was created.</p>
+ <p class=relatedtopics>Related Topics</p>
+ <p><a href="../reference/org/apache/xmlbeans/XmlCursor.TokenType.html">XmlCursor.TokenType
+ Class</a></p>
+ <p><a href="conNavigatingXMLwithCursors.html">Navigating XML with Cursors</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conUsingBookmarksToAnnotateXML.html b/v1/docs/guide/conUsingBookmarksToAnnotateXML.html
new file mode 100644
index 0000000..9eaf3d3
--- /dev/null
+++ b/v1/docs/guide/conUsingBookmarksToAnnotateXML.html
@@ -0,0 +1,97 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Using Bookmarks to Annotate XML</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="component" content="">
+<!-- In the description metatag, please provide a BRIEF description of the topic contents. -->
+<meta name="description" content="">
+<!-- In the component metatag, please list keywords that will help a user search for this topic. -->
+<meta name="keywords" content="">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<div id=topictitle>
+ <p class=Title>Using Bookmarks to Annotate XML</p>
+</div>
+<div id=topictext>
+ <p>You can use a cursor to insert bookmarks that annotate XML with markers containing
+ information you design. These bookmarks aren't written into the XML itself,
+ but in a sense "hang" from the location where it was inserted. In this way
+ you can associate arbitrary pieces of information with specific parts of the
+ XML.</p>
+ <P>You design your own bookmark classes by extending <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlCursor.XmlBookmark.html">XmlBookmark</a></span>,
+ a nested class of <span class="langinline"><a href="../reference/org/apache/xmlbeans/XmlCursor.html">XmlCursor</a></span>.
+ You can design your bookmark class to contain information specific to your
+ needs. </P>
+ <P>In the following example, <span class="langinline">OrderBookmark</span> is
+ an inner class that extends <span class="langinline">XmlCursor.XmlBookmark</span>.
+ It merely stores a piece of text.</P>
+ <PRE>
+/*
+ * The OrderBookmark class includes a constructor through which you will
+ * insert your bookmark's content. It also includes get and set methods
+ * you can use to retrieve and change the content.
+ */
+static class OrderBookmark extends XmlCursor.XmlBookmark {
+ public OrderBookmark (String text) { TEXT = text; }
+ public String TEXT;
+ public String getText() { return TEXT; }
+ public void setText(String newText) { TEXT = newText; }
+}
+</PRE>
+ <p>You can use instances of this class to store bookmarks at places in your
+ XML. The following excerpt of code creates a cursor and an instance of the
+ <span class="langinline">OrderBookmark</span> class. Then it uses the cursor
+ to insert the bookmark at the cursor's current location.</p>
+ <pre>
+ XmlCursor orderCursor = xmlDoc.newCursor();
+ OrderBookmark thisBookmark = new OrderBookmark("foo");
+ orderCursor.setBookmark(thisAnnotation);
+</pre>
+ <p class=relatedtopics>Related Topics</p>
+ <p><a href="conNavigatingXMLwithCursors.html">Navigating XML with Cursors</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/guide/conXMLBeansSupportBuiltInSchemaTypes.html b/v1/docs/guide/conXMLBeansSupportBuiltInSchemaTypes.html
new file mode 100644
index 0000000..89fdb16
--- /dev/null
+++ b/v1/docs/guide/conXMLBeansSupportBuiltInSchemaTypes.html
@@ -0,0 +1,343 @@
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
+
+<!-- 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. -->
+<html>
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>Java Types for XML Schema</title>
+<!-- InstanceEndEditable -->
+<!--(Meta)==========================================================-->
+
+<meta http-equiv=Content-Type content="text/html; charset=$CHARSET;">
+
+
+<!-- InstanceBeginEditable name="metatags" -->
+
+<meta name="author" content="your name">
+<meta name="description" content="A description of the topic contents.">
+<meta name="keywords" content="keywords to help in searches">
+<meta name="date last modified" content="10/25/02">
+<!-- InstanceEndEditable -->
+
+<!--(Links)=========================================================-->
+<!-- InstanceBeginEditable name="head" -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<!-- InstanceEndEditable -->
+<link href="../xmlbeans.css" rel="stylesheet" type="text/css">
+<a href="../../../core/index.html" id="index"></a>
+<script language="JavaScript" src="../../../core/topicInfo.js"></script>
+<script language="JavaScript" src="../../../core/CookieClass.js"></script>
+<script language="JavaScript" src="../../../core/displayContent.js"></script>
+</head>
+
+<!--(Body)==========================================================-->
+<body>
+<script language="JavaScript">
+
+</script>
+<!-- InstanceBeginEditable name="body" -->
+<h1> XMLBeans Support for Built-In Schema Types</h1>
+<p>Just as with types in XML schema, the XMLBeans types based on schema are arranged
+ in a hierarchy. In general, the hierarchy of XMLBean types mirrors the hierarchy
+ of the schema types themselves. XML schema types all inherit from <span class="langinline">xs:anyType</span>
+ (which is at the root of the hierarchy); XMLBeans types inherit from <span class="langinline">XmlObject</span>.</p>
+<p>In XML schema, <span class="langinline">xs:anyType</span> is the root type
+ for two type categories: built-in and user-derived. Built-in schema types are
+ common types defined by the XML schema specification. User-derived types are
+ those you define in your schema. This topic lists the built-in types provided
+ with XMLBeans. For information about user-derived types and the Java types generated
+ from them, see <a href="conJavaTypesGeneratedFromUserDerived.html">Java Types Generated
+ from User-Derived Schema Types</a>.</p>
+<p>The following figure illustrates the hierarchy of types, showing both built-in
+ schema types and their XMLBeans parallels. Notice, too, that nearly all of the
+ built-in types are also available as natural Java types.</p>
+<p><img src="../images/conXMLTypeHierarchy.gif" width="865" height="887"> </p>
+<h1>Java Types Representing Built-In Schema Types</h1>
+<p>As you can see from the figure above, all 46 built-in schema types are represented
+ by an XMLBean type provided with XMLBeans. When using built-in XMLBean types,
+ keep in mind that:</p>
+<ul>
+ <li> Since <span class="langinline">XmlObject</span> corresponds to the <span class="langinline">xs:anyType</span>,
+ all Java XMLBean types inherit from <span class="langinline">XmlObject</span>.
+ Therefore all XMLBean types share the <span class="langinline">XmlObject</span>
+ interfaceÂ’s ability to create an <span class="langinline">XmlCursor</span>
+ at the position of the object. They can also render the XML as strings or
+ streams.
+ <li>
+ <div>Where there is a corresponding natural Java type, the XMLBeans type provides
+ a way to get the underlying XML's value as the natural type. See the table
+ in this topic for information on how natural Java types map to XMLBeans
+ types. </div>
+
+ <li> Values assigned to built-in XMLBeans types are validated in keeping with
+ the rules of the schema type they represent. So, for example, an attempt to
+ assign a negative integer value to an <span class="langinline">XmlPositiveInteger</span>
+ will throw an <span class="langinline">XmlValueOutOfRange</span> exception.</li>
+</ul>
+<div>
+ <p>The following table lists the built-in schema types, along with their XMLBeans
+ and natural Java parallels. Unless otherwise noted, natural Java types are
+ in the <span class="langinline">java.lang</span> package; XMLBean types are
+ in the <span class="langinline">org.apache.xmlbeans</span> package.</p>
+</div>
+<div id="topictext">
+ <table>
+ <tr>
+ <td width="30%"><strong>Built-In Schema Type</strong></td>
+ <td width="31%"><strong>XMLBean Type</strong></td>
+ <td width="39%"><strong>Natural Java Type</strong></td>
+ </tr>
+ <tr>
+ <td>xs:anyType</td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlObject.html">XmlObject</a></td>
+ <td> <a href="../reference/org/apache/xmlbeans/XmlObject.html">org.apache.xmlbeans.XmlObject</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#dt-anySimpleType" target="_blank">xs:anySimpleType</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlAnySimpleType.html">XmlAnySimpleType</a></td>
+ <td> <a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#anyURI" target="_blank">xs:anyURI</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlAnyURI.html">XmlAnyURI</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#base64Binary" target="_blank">xs:base64Binary</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlBase64Binary.html">XmlBase64Binary</a></td>
+ <td>byte[]</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#boolean" target="_blank">xs:boolean</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlBoolean.html">XmlBoolean</a></td>
+ <td>boolean</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#byte" target="_blank">xs:byte</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlByte.html">XmlByte</a></td>
+ <td>byte</td>
+ </tr>
+ <tr>
+ <td height="17"><a href="http://www.w3.org/TR/xmlschema-2/#date" target="_blank">xs:date</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlDate.html">XmlDate</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#dateTime" target="_blank">xs:dateTime</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlDateTime.html">XmlDateTime</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#decimal" target="_blank">xs:decimal</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlDecimal.html">XmlDecimal</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html" target="_blank">java.math.BigDecimal</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#double" target="_blank">xs:double</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlDouble.html">XmlDouble</a></td>
+ <td>double</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#duration" target="_blank">xs:duration</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlDuration.html">XmlDuration</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/GDuration.html">org.apache.xmlbeans.GDuration</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#ENTITIES" target="_blank">xs:ENTITIES</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlENTITIES.html">XmlENTITIES</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#ENTITY" target="_blank">xs:ENTITY</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlENTITY.html">XmlENTITY</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#float" target="_blank">xs:float</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlFloat.html">XmlFloat</a></td>
+ <td>float</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#gDay" target="_blank">xs:gDay</a></td>
+ <td><p><a href="../reference/org/apache/xmlbeans/XmlGDay.html">XmlGDay</a></p></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#gMonth" target="_blank">xs:gMonth</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlGMonth.html">XmlGMonth</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#gMonthDay" target="_blank">xs:gMonthDay</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlGMonthDay.html">XmlGMonthDay</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#gYear" target="_blank">xs:gYear</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlGYear.html">XmlGYear</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#gYearMonth" target="_blank">xs:gYearMonth</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlGYearMonth.html">XmlGYearMonth</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#hexBinary" target="_blank">xs:hexBinary</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlHexBinary.html">XmlHexBinary</a></td>
+ <td>byte[]</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#ID" target="_blank">xs:ID</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlID.html">XmlID</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#IDREF" target="_blank">xs:IDREF</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlIDREF.html">XmlIDREF</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#IDREFS" target="_blank">xs:IDREFS</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlIDREFS.html">XmlIDREFS</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#int" target="_blank">xs:int</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlInt.html">XmlInt</a></td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#integer" target="_blank">xs:integer</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlInteger.html">XmlInteger</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#language" target="_blank">xs:language</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlLanguage.html">XmlLanguage</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#long" target="_blank">xs:long</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlLong.html">XmlLong</a></td>
+ <td>long</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#Name" target="_blank">xs:Name</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlName.html">XmlName</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#NCName" target="_blank">xs:NCName</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNCName.html">XmlNCNAME</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#negativeInteger" target="_blank">xs:negativeInteger</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNegativeInteger.html">XmlNegativeInteger</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN" target="_blank">xs:NMTOKEN</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNMTOKEN.html">XmlNMTOKEN</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#NMTOKENS" target="_blank">xs:NMTOKENS</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNMTOKENS.html">XmlNMTOKENS</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger" target="_blank">xs:nonNegativeInteger</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNonNegativeInteger.html">XmlNonNegativeInteger</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger" target="_blank">xs:nonPositiveInteger</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNonPositiveInteger.html">XmlNonPositiveInteger</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#normalizedString" target="_blank">xs:normalizedString</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNormalizedString.html">XmlNormalizedString</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#NOTATION" target="_blank">xs:NOTATION</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlNOTATION.html">XmlNOTATION</a></td>
+ <td> Not supported</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#positiveInteger" target="_blank">xs:positiveInteger</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlPositiveInteger.html">XmlPositiveInteger</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#QName" target="_blank">xs:QName</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlQName.html">XmlQName</a></td>
+ <td><a href="http://java.sun.com/j2ee/1.4/docs/api/javax/xml/namespace/QName.html" target="_blank">javax.xml.namespace.QName</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#short" target="_blank">xs:short</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlShort.html">XmlShort</a></td>
+ <td>short</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#string" target="_blank">xs:string</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlString.html">XmlString</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#time" target="_blank">xs:time</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlTime.html">XmlTime</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html" target="_blank">java.util.Calendar</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#token" target="_blank">xs:token</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlToken.html">XmlToken</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html" target="_blank">String</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedByte" target="_blank">xs:unsignedByte</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlUnsignedByte.html">XmlUnsignedByte</a></td>
+ <td>short</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedInt" target="_blank">xs:unsignedInt</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlUnsignedInt.html">XmlUnsignedInt</a></td>
+ <td>long</td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedLong" target="_blank">xs:unsignedLong</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlUnsignedLong.html">XmlUnsignedLong</a></td>
+ <td><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html" target="_blank">java.math.BigInteger</a></td>
+ </tr>
+ <tr>
+ <td><a href="http://www.w3.org/TR/xmlschema-2/#unsignedShort" target="_blank">xs:unsignedShort</a></td>
+ <td><a href="../reference/org/apache/xmlbeans/XmlUnsignedShort.html">XmlUnsignedShort</a></td>
+ <td>int</td>
+ </tr>
+ </table>
+</div>
+<div>
+ <p class="relatedtopics">Related Topics</p>
+ <p><a href="conGettingStartedwithXMLBeans.html">Getting Started with XMLBeans</a></p>
+</div>
+<!-- InstanceEndEditable -->
+<script language="JavaScript">
+
+</script>
+</body>
+</html>
diff --git a/v1/docs/images/conCursorTokenLocations.gif b/v1/docs/images/conCursorTokenLocations.gif
new file mode 100644
index 0000000..de66d38
--- /dev/null
+++ b/v1/docs/images/conCursorTokenLocations.gif
Binary files differ
diff --git a/v1/docs/images/conXMLTypeHierarchy.gif b/v1/docs/images/conXMLTypeHierarchy.gif
new file mode 100644
index 0000000..970c326
--- /dev/null
+++ b/v1/docs/images/conXMLTypeHierarchy.gif
Binary files differ
diff --git a/v1/docs/stylesheet.css b/v1/docs/stylesheet.css
new file mode 100644
index 0000000..301d803
--- /dev/null
+++ b/v1/docs/stylesheet.css
@@ -0,0 +1,39 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ background-color: #FFFFFF
+}
+
+body {
+/* padding: 0px 0px 0px 15px; */
+ background: #ffffff;
+ color: #00000;
+ font-size: 80%;
+}
+
+/* Table colors */
+.TableHeadingColor { background: #CCCCFF } /* Dark mauve */
+.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */
+.TableRowColor { background: #FFFFFF } /* White */
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
+.FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
+.FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
+
+/* Example of smaller, sans-serif font in frames */
+/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */
+.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
+
diff --git a/v1/docs/xmlbeans.css b/v1/docs/xmlbeans.css
new file mode 100644
index 0000000..6662061
--- /dev/null
+++ b/v1/docs/xmlbeans.css
@@ -0,0 +1,482 @@
+/* The styles most likely to be used are:
+ - Title: The title of the topic
+ - h1, h2, h3: First, second, and third-level headings within the body of a topic
+ - relatedTopics: Related Topics
+ - procTitle: Within How Do I:... topics, for headings within the body of a topic that are followed by
+ bulleted procedures ("To do this").
+ - pre: For code blocks
+ - langinline: For code fragments within a (non-code) regular section.
+ - notepara: Notes
+*/
+h1,
+h2,
+h3,
+h4,
+h5,
+p,
+proctitle,
+relatedtopics {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: #000000;
+}
+
+/* Use h1 for all first-level headings within the body of a topic.
+ For the topic title, use the Title style. */
+h1 {
+ font-size: 135%;
+ margin-top: .5em;
+ margin-bottom: .5em;
+}
+
+/* Use h2 for all second-level headings. */
+h2 {
+ font-size: 125%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+}
+
+/* Use h3 for all third-level headings. */
+h3 {
+ font-size: 110%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+}
+
+/* Use h4 for all fourth-level headings.
+ Note: this style looks identical to the relatedtopics and proctitle styles. */
+h4 {
+ font-size: 105%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+}
+
+/* Use h5 for all fifth-level heading.
+ Currently, there are no h5s in use in the document.*/
+h5 {
+ font-size: 100%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+}
+
+/* Use the Title style for the title of a topic. */
+p.Title {
+ font-weight: bold;
+ font-style: normal;
+ font-family: Verdana, sans-serif;
+ font-size: 142%;
+}
+
+/* This deprated tag creates a div that designates the title. */
+#topictitle {
+}
+
+/* This deprecated tag creates a dive that designates all body text. */
+#topictext {
+}
+
+/* Used for figure captions.*/
+p.arttitle {
+ font-weight: Bold;
+}
+
+/* The attribute style resembles the navtitle and partdesc styles in that it keeps the next paragraph
+ flush with it. Use it when you list the attributes of syntax in a reference topic.
+ The argument style should always be followed by the partdesc style. */
+p.attribute {
+ margin-top: .6em;
+ margin-bottom: 0px;
+ font-weight: Bold;
+
+}
+
+/* Standard HTML tag. */
+body {
+ padding: 0px 0px 0px 15px;
+ background: #ffffff;
+ color: #00000;
+ font-size: 80%;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+/* Standard HTML tag. */
+span.bold {
+ font-weight: Bold;
+}
+
+/* Standard HTML tag. */
+blockquote {
+ margin: 0em 0em 0em 2em;
+ padding: 0px;
+}
+
+/* Use the filepath style to designate file paths. It is currently a monospace file. */
+span.filepath {
+ font: 100% Courier New Courier mono;
+ font-family: "Courier New", monospace;
+}
+
+/* The langinline style, like userinput and filepath, also renders text monospace. Use this
+ to denote any individual instance of code in the context of non-coded text. For example,
+ you would use this to denote the name of a class when you're describing it in the paragraph that
+ precedes a code sample. To denote a code sample, however, use the <pre> tag. */
+span.langinline {
+ font: 100% Courier New Courier mono;
+ font-family: "Courier New", monospace;
+}
+
+/* The listplain style narrows the margin between the formatted line and the one before it.
+ It is to be used when creating a second paragraph in a list item, along with the indent and
+ unindent buttons in Dreamweaver. */
+p.listplain {
+ margin-top: 0.7em;
+ margin-bottom: 0;
+ padding: 0em;
+}
+
+/* All text in the navtitle style should include a link to another topic.
+ The navtitle style is used in navigational node topics, in Class reference
+ topics, and in Method reference topics. For example, in the "Topics
+ Included in this Section" section of a navigation topic, you include the links to all of
+ the topics in that chapter, along with a brief description of what you'll find in each. Use the
+ navtitle style for the linked text. It differs from a normal paragraph style in that it does not
+ include an extra paragraph break between the link and the descriptive text. */
+p.navtitle {
+ margin-top: .6em;
+ margin-bottom: 0em;
+}
+
+/* The navdesc style is used in navigational node topics, in Class reference
+ topics, and in Method reference topics. For example, in the "Topics Included in this Section"
+ section of a navigation topic, you include the links to all of the topics in that chapter,
+ along with a brief description of what you'll find in each. Use this style for the descriptive text.
+ It indents the text one tab stop and keeps the margin between this style and the navtitle style small. */
+p.navdesc {
+ margin-bottom: 1em;
+ margin-left: 1.9em;
+ margin-top: 0em;
+}
+
+/* The notepara style indents your text to the tab stop for note
+ text. You should always begin Note text with the word "Note:" in
+ boldface. */
+p.notepara {
+ margin-left: 2em;
+ margin-right: 2em;
+ margin-bottom: 1.5em;
+}
+
+/* The partname style resembles the navtitle style in that it keeps the next paragraph flush with it.
+ You use it when you list the parameters in a reference topic. It is also used currently in the
+ glossary to designate glossary entries. It renders text italic.
+ The partname style should always be followed by the partdesc style.*/
+p.partname {
+ margin-top: .6em;
+ margin-bottom: 0px;
+ font-style: italic;
+}
+
+/* Use the partdesc style when you describe the function of the properties, parameters, or exceptions
+ listed in a reference topic. It is also used currently in the glossary to designate glossary
+ definitions. The style indents the description slightly.
+ The partdesc style should always follow the partname or attribute style.*/
+p.partdesc {
+ margin-bottom: 1em;
+ margin-left: 1.9em;
+ margin-top: 0em;
+
+}
+
+/* The point of the proctitle style is the same as the point of the relatedtopics style.
+ It applies to all headings that begin with "To [do something]". It looks identical to the h4 style. */
+p.proctitle {
+ font-size: 110%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+ font-weight: Bold;
+
+}
+
+/* Use the relatedtopics style, for the words "Related Topics" at the end of a topic.
+ It looks identical to the h4 style. */
+p.relatedtopics {
+ font-size: 120%;
+ margin-top: 1em;
+ margin-bottom: .6em;
+ font-weight: Bold;
+}
+
+/* The syntax style renders text bold. Use it to style all syntax lines under the
+ Syntax heading of reference topics. */
+p.syntax {
+ font-family: monospace;
+ line-height: normal;
+ font-weight: Bold;
+}
+
+/* Use the syntaxindent style to indent sub-properties of syntax declarations. */
+p.syntaxindent {
+ font-family: monospace;
+ line-height: normal;
+ font-weight: Bold;
+ margin-left: 1.5em;
+ margin-top: 0em;
+ margin-bottom: 0px;
+}
+
+
+p.fileurl {
+ font-size: 8pt;
+}
+
+p.modifieddate {
+ font-size: 8pt;
+}
+
+/* The syntaxpartname character style renders text italic. Use it to designate
+ syntax elements in reference topics.*/
+span.syntaxpartname {
+ font-style: italic;
+ font-weight: normal;
+}
+
+/* These specifications dictate the margins and width of tables. */
+table {
+ width: 90%;
+ margin-top: .6em;
+ margin-bottom: .3em;
+}
+
+/* The background of header cells is grey, and the text is bottom-aligned. */
+th {
+ padding-left: 8px;
+ padding-right: 8px;
+ background: #cccccc;
+ text-align: left;
+ font-size: 80%;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ vertical-align: bottom;
+}
+
+/* The text in normal table cells is top-aligned. */
+td {
+ padding-left: 8px;
+ padding-right: 8px;
+ background: #ffffff;
+ vertical-align: top;
+ font-size: 80%;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+/* This style creates space above and below table text between paragraph and the table borders. */
+p.tabletext {
+ margin-top: .6em;
+ margin-bottom: .6em;
+}
+
+/* The editor uses this style when creating template guides to designate a style annotation.
+ You probably won't want to use it anywhere else in the guide. */
+span.template {
+ color: #FF00FF;
+}
+
+a.toc-node {
+ font-size:11px;
+ color:000000;
+ margin-left: 0px;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ white-space: nowrap;
+ font-family: Tahoma;
+ background-color:#FFFFFF;
+ text-decoration:none;
+}
+
+/* The userinput style renders text monospace.Use this style to highlight text that a user
+ types into a text field. */
+span.userinput {
+ font: 100% Courier New Courier mono;
+ font-family: "Courier New", monospace;
+}
+
+/* Standard HTML tags. */
+ul,
+ol {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ list-style-position: outside;
+ list-style-image: none;
+ margin-top: 0em;
+ margin-bottom: 0em;
+}
+
+/* Standard HTML tag. */
+ol {
+ list-style-type: 1;
+ margin-left: 2em;
+}
+
+/* Standard HTML tag. */
+ul {
+ list-style-type: disc;
+ margin-left: 1.5em;
+}
+
+/* Standard HTML tag. */
+li {
+ margin-top: 1.3em;
+ margin-bottom: 0em;
+}
+
+a:link {
+ color: #3366CC;
+}
+a:hover {
+ x-text-underline: normal;
+ /*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/
+}
+
+a:active {
+ x-text-underline: normal;
+ /*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/
+}
+
+a:visited {
+ color: #803380;
+}
+
+a {
+ x-text-underline: off;
+ x-text-overline: off;
+ x-text-line-through: off;
+ /*begin!kadov{{*/ text-decoration: none none none; /*}}end!kadov*/
+}
+a:link {
+ color: #3366CC;
+}
+
+a:hover {
+ x-text-underline: normal;
+ /*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/
+}
+
+a:active {
+ x-text-underline: normal;
+ /*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/
+}
+
+a:visited {
+ color: #000066;
+}
+
+div.footer {
+}
+
+.buttonclass
+{
+ font-size:10px;
+ height:20px;
+}
+
+.formclass
+{
+ font-size:10px;
+ height:17px;
+}
+
+
+
+
+/*DEPRECATED*/
+p.codeblock {
+ font-size: 100%;
+ font-family: monospace;
+ line-height: 1em;
+ x-text-tab-stops: repeat 1in;
+ white-space: nowrap;
+ color: #000000;
+ cursor: text;
+ padding-right: 1em;
+ padding-left: 1em;
+ padding-top: 0em;
+ padding-bottom: 0em;
+ margin-bottom: 0em;
+ margin-top: 0em;
+ x-text-underline: Off;
+ /*begin!kadov{{*/ text-decoration: none; /*}}end!kadov*/
+}
+
+/* DEPRECATED */
+p.bulletindent1 {
+ margin-left: 1.5em;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* DEPRECATED */
+p.bulletindent2 {
+ margin-left: 5.1em;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* DEPRECATED */
+p.bulletindent3 {
+ margin-left: 4.3em;
+}
+
+/* DEPRECATED */
+p.indent1 {
+ margin-left: 1.5em;
+ margin-right: 1.9em;
+}
+
+/* DEPRECATED */
+p.indent2 {
+ margin-left: 2.9em;
+ margin-right: 1.9em;
+}
+
+/* DEPRECATED */
+p.indent3 {
+ margin-left: 4.3em;
+ margin-right: 1.9em;
+}
+
+/* DEPRECATED */
+p.numberedindent1 {
+ margin-left: 2.2em;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* DEPRECATED */
+p.numberedindent2 {
+ margin-left: 6.3em;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* DEPRECATED */
+p.numberedindent3 {
+ margin-left: 10.5em;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/* DEPRECATED */
+p.tabletitle {
+ margin-left: 0;
+ font-weight: Bold;
+}
+
+
+/* These styles are used by the search results page */
+
+.search-node {
+ font-size:10px;
+ color:000000;
+}
+
+a.search-node {
+ font-size:10px;
+ color:000000;
+}
\ No newline at end of file
diff --git a/v1/docs/xmlbeantask.html b/v1/docs/xmlbeantask.html
new file mode 100644
index 0000000..679b1cc
--- /dev/null
+++ b/v1/docs/xmlbeantask.html
@@ -0,0 +1,322 @@
+<!-- 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. -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+
+ <meta http-equiv="Content-Language" content="en-us">
+ <title>XMLBean Task</title>
+</head>
+ <body>
+
+<h2><a name="xmlbean">XMLBean</a></h2>
+
+<h3>Description</h3>
+
+<p>Compile a set of XSDs and/or WSDLs into xbeans. This is useful for building
+ an XMLBean jar from .XSD and .WSDL files. The task can also generate
+ the source code that makes up the xbean type system specified by the schema
+ files if desired.</p>
+
+<p><b>Note:</b> This task depends on an external library not included in
+the Ant distribution called xbean.jar. It can be found in the XMLBeans
+ developer kit at <a
+ href="http://xml.apache.org/xmlbeans/">http://xml.apache.org/xmlbeans/</a>.
+The build script will need to include a taskdef for xmlbean, which could look
+like this:<br>
+ </p>
+
+<pre> <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="path/to/xbean.jar"/></pre>
+
+<p> </p>
+
+<p>It is possible to refine the set of files that are being processed. This
+ can be done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>,
+ <i>excludesfile</i> and <i>defaultexcludes</i> attributes. With the <i>includes</i>
+ or <i>includesfile</i> attribute you specify the files you want to have
+included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute
+is used to specify the files you want to have excluded. This is also done
+with patterns. And finally with the <i>defaultexcludes</i> attribute, you
+can specify whether you want to use default exclusions or not. See the section
+ on <a
+ href="http://ant.apache.org/manual/dirtasks.html#directorybasedtasks">directory
+ based tasks</a>, on how the inclusion/exclusion of files works, and how
+to write patterns.</p>
+
+<p>This task forms an implicit <a
+ href="http://ant.apache.org/manual/CoreTypes/fileset.html">FileSet</a>
+and supports all attributes of <code><fileset></code> (<code>dir</code>
+ becomes <code>basedir</code>) as well as the nested <code><include></code>,
+ <code><exclude></code> and <code><patternset></code> elements.</p>
+
+<h3>Parameters</h3>
+
+<table border="1" cellpadding="2" cellspacing="0">
+ <tbody>
+ <tr>
+ <td valign="top"><b>Attribute</b></td>
+ <td valign="top"><b>Description</b></td>
+ <td align="center" valign="top"><b>Required</b></td>
+ </tr>
+ <tr>
+ <td valign="top">schema</td>
+ <td valign="top">A file that points to either an individual schema
+ file or a directory of files. Not a path reference. If multiple
+ schema files need to be built together, use a nexted fileset instead of
+setting schema.</td>
+ <td align="center" valign="top">Yes, unless a fileset element is
+ nested.</td>
+ </tr>
+ <tr>
+ <td valign="top">destfile</td>
+ <td valign="top">Define the name of the jar file created.
+For instance, "myXMLBean.jar" will output the results of this task into a
+jar with the same name.</td>
+ <td align="center" valign="top">No, default is "xmltypes.jar".</td>
+ </tr>
+ <tr>
+ <td valign="top">download</td>
+ <td valign="top">Set to true to permit the compiler to download
+URLs for imports and includes. Defaults to false, meaning all imports
+and includes must be copied locally.<br>
+ </td>
+ <td align="center" valign="top">No, default is false.</td>
+ </tr>
+ <tr>
+ <td valign="top">failonerror</td>
+ <td valign="top"> Determines whether or not the ant target
+will continue if the XMLBean creation encounters a build error.<br>
+ </td>
+ <td align="center" valign="top">No, default is true.</td>
+ </tr>
+ <tr>
+ <td valign="top">verbose<br>
+ </td>
+ <td valign="top">Controls the amount of build message output.<br>
+ </td>
+ <td valign="top" align="center">No, default is true.<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">typesystemname<br>
+ </td>
+ <td valign="top">The name of the package that the TypeSystemHolder
+class should be generated in. Normally this should be left unspecified.
+None of the xml beans are generated in this package. Use .xsdconfig files
+to modify xml bean package or class names.<br>
+ </td>
+ <td valign="top" align="center">No<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">classgendir<br>
+ </td>
+ <td valign="top">Set a location to generate .class files into.<br>
+ </td>
+ <td valign="top" align="center">No<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">srconly<br>
+ </td>
+ <td valign="top">A value of true means that only source will be generated.<br>
+ </td>
+ <td valign="top" align="center">No, default is false.<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">srcgendir<br>
+ </td>
+ <td valign="top">Set a location to generate .java files into.<br>
+ </td>
+ <td valign="top" align="center">No<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">classpath</td>
+ <td valign="top">The classpath to use if schemas in the fileset
+import definitions that are supplied by other compiled xml beans JAR files,
+or if .java files are in the schema fileset. Also supports a nested classpath.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">classpathref</td>
+ <td valign="top">Adds a classpath, given as <a
+ href="http://ant.apache.org/manual/using.html#references">reference</a>
+to a path defined elsewhere.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includes</td>
+ <td valign="top">Comma- or space-separated list of patterns of
+files that must be included. All files are included when omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includesfile</td>
+ <td valign="top">The name of a file. Each line of this file is
+taken to be an include pattern</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">excludes</td>
+ <td valign="top">Comma- or space-separated list of patterns of
+files that must be excluded. No files (except default excludes) are
+excluded when omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">excludesfile</td>
+ <td valign="top">The name of a file. Each line of this file is
+taken to be an exclude pattern</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">defaultexcludes</td>
+ <td valign="top">Indicates whether default excludes should be used
+ or not ("yes"/"no"). Default excludes are used when omitted.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">debug</td>
+ <td valign="top">Indicates whether source should be compiled with
+ debug information; defaults to <code>off</code>. If set to
+ <code>off</code>, <code>-g:none</code> will be passed on the
+ command line for compilers that support it (for other compilers, no
+ command line argument will be used). If set to <code>true</code>,
+ the value of the <code>debuglevel</code> attribute determines the
+ command line argument.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">debuglevel</td>
+ <td valign="top">Keyword list to be appended to the <code>-g</code>
+ command-line switch. This will be ignored by all implementations except
+ <code>modern</code> and <code>classic(ver >= 1.2)</code>.
+ Legal values are <code>none</code> or a comma-separated list of the
+ following keywords:
+ <code>lines</code>, <code>vars</code>, and <code>source</code>.
+ If <code>debuglevel</code> is not specified, by default,
+ nothing will be
+ appended to <code>-g</code>. If <code>debug</code> is not turned on,
+ this attribute will be ignored.
+ </td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">optimize</td>
+ <td valign="top">Indicates whether source should be compiled with
+ optimization; defaults to <code>off</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includeAntRuntime</td>
+ <td valign="top">Whether to include the Ant run-time libraries in the
+ classpath; defaults to <code>yes</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">includeJavaRuntime</td>
+ <td valign="top">Whether to include the default run-time
+ libraries from the executing VM in the classpath;
+ defaults to <code>no</code>.</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">fork</td>
+ <td valign="top">Whether to execute <code>javac</code> using the
+ JDK compiler externally; defaults to <code>yes</code>.</td>
+ <td align="center" valign="top">No, default is true</td>
+ </tr>
+ <tr>
+ <td valign="top">executable</td>
+ <td valign="top">Complete path to the <code>javac</code>
+ executable to use in case of <code>fork="yes"</code>.
+ Defaults to the compiler of the Java version that is currently
+ running Ant. Ignored if <code>fork="no"</code></td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">memoryInitialSize</td>
+ <td valign="top">The initial size of the memory for the underlying VM,
+ if <code>javac</code> is run externally; ignored otherwise. Defaults
+ to the standard VM memory setting.
+ (Examples: <code>83886080</code>, <code>81920k</code>, or
+ <code>80m</code>)</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">memoryMaximumSize</td>
+ <td valign="top">The maximum size of the memory for the underlying VM,
+ if <code>javac</code> is run externally; ignored otherwise. Defaults
+ to the standard VM memory setting.
+ (Examples: <code>83886080</code>, <code>81920k</code>, or
+ <code>80m</code>)</td>
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">compiler</td>
+ <td valign="top">The compiler implementation to use.
+ If this attribute is not set, the value of the
+ <code>build.compiler</code> property, if set, will be used.
+ Otherwise, the default compiler for the current VM will be used.
+ <td align="center" valign="top">No</td>
+ </tr>
+ <tr>
+ <td valign="top">ignoreDuplicatesInNamespaces</td>
+ <td valign="top">Comma separated list of one or more namespaces
+ in which duplicate definitions are to be ignored.
+ </td>
+ <td align="center" valign="top">No</td>
+ </tr>
+
+ </tbody>
+</table>
+
+<h3>Example</h3>
+
+<blockquote> Be sure to define the task in your script, like
+this:<br>
+
+ <pre><taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="path/to/xbean.jar"/></pre>
+
+ <pre><br><xmlbean schema="schemas" destfile="Schemas.jar"/><br></pre>
+ Builds all the schemas in the schemas directory and creates a jar called
+ 'Schemas.jar'.<br>
+
+ <pre><xmlbean schema="schemas/ourSchema.xsd" download="true"/><br></pre>
+ Compiles the schema 'ourShema.xsd' into the default jar 'xmltypes.jar'.
+ If any imports and includes are defined by remote URLs, they are
+downloaded during the build.<br>
+
+ <h4>Using a fileset</h4>
+
+ <pre><xmlbean classgendir="${build.dir}" classpath="${class.path}"<br> failonerror="true"><br> <fileset basedir="src" excludes="**/*.xsd"/><br> <fileset basedir="schemas" includes="**/*.*"/><br></xmlbean><br></pre>
+ Gathers all the files in the 'src' directory except .xsd files, along with
+ every file in the 'schemas' directory and compiles them. The fileset can
+include schema files that refer to previously compiled schema components.
+The fileset can also contain .java files. The classpath parameter defines
+the classpath necessary to resolve compiled schema and java references.<br>
+ <br>
+The built classes will go into ${build.dir}.<br>
+
+ <pre></pre>
+ </blockquote>
+
+<hr>
+ <br>
+ <br>
+ <br>
+</body>
+</html>
diff --git a/v1/external/lib/jaxen-1.1-beta-2-src.zip b/v1/external/lib/jaxen-1.1-beta-2-src.zip
new file mode 100644
index 0000000..158e3c6
--- /dev/null
+++ b/v1/external/lib/jaxen-1.1-beta-2-src.zip
Binary files differ
diff --git a/v1/external/lib/jaxen-1.1-beta-2.jar b/v1/external/lib/jaxen-1.1-beta-2.jar
new file mode 100644
index 0000000..19aff5d
--- /dev/null
+++ b/v1/external/lib/jaxen-1.1-beta-2.jar
Binary files differ
diff --git a/v1/external/lib/junit.jar b/v1/external/lib/junit.jar
new file mode 100644
index 0000000..6ee43bb
--- /dev/null
+++ b/v1/external/lib/junit.jar
Binary files differ
diff --git a/v1/external/lib/oldxbean.jar b/v1/external/lib/oldxbean.jar
new file mode 100644
index 0000000..ae81b22
--- /dev/null
+++ b/v1/external/lib/oldxbean.jar
Binary files differ
diff --git a/v1/plugin.jelly b/v1/plugin.jelly
new file mode 100644
index 0000000..7123eea
--- /dev/null
+++ b/v1/plugin.jelly
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+
+<project
+ xmlns:j="jelly:core"
+ xmlns:jelant="jelly:ant"
+ xmlns:util="jelly:util">
+
+ <!-- ================================================================== -->
+ <!-- XMLBean PlugIn -->
+ <!-- ================================================================== -->
+
+ <!-- This goal generates the XMLBeans from the .xsd files -->
+ <goal name="xmlbeans:xmlbean"
+ description="Generates XMLBeans from XML Schema files.">
+
+ <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean">
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ </classpath>
+ </taskdef>
+
+ <xmlbean>
+ <!-- list of additional options -->
+ <j:set var="opsDelim" value=","/>
+ <j:set var="addOps" value="schema,includes,excludes,destfile,classgendir,srconly,srcgendir,debug"/>
+
+ <!-- Setup the XMLBean's ant properties: -->
+ <util:tokenize var="ops" delim="${opsDelim}">${addOps}</util:tokenize>
+ <j:forEach items="${ops}" var="op">
+ <j:set var="op_var_name" value="maven.xmlbeans.xmlbean.${op}"/>
+ <j:set var="opX" value="${op_var_name}X"/>
+ <j:if test="${opX != 'X'}">
+ <jelant:setProperty name="${op}" value="${context.getVariable(op_var_name)}"/>
+ </j:if>
+ </j:forEach>
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ </classpath>
+ </xmlbean>
+
+ </goal>
+
+
+</project>
diff --git a/v1/plugin.properties b/v1/plugin.properties
new file mode 100644
index 0000000..bc8dafd
--- /dev/null
+++ b/v1/plugin.properties
@@ -0,0 +1,27 @@
+#
+# Default project properties for xmlbean V1
+#
+
+# Indicates the directory that schema files can be found (*.xsd):
+maven.xmlbeans.xmlbean.schema=src/xmlbeans
+
+# Files to include in schema build:
+maven.xmlbeans.xmlbean.includes=**/*.xsd
+
+# Files to exclude from schema build:
+maven.xmlbeans.xmlbean.excludes=
+
+# Directory to put compiled files into:
+maven.xmlbeans.xmlbean.classgendir=${maven.build.dir}/classes
+
+# Whether to only generate source (.java) files from the schema(s) or not:
+maven.xmlbeans.xmlbean.srconly=false
+
+# Directory to put the generated source files:
+maven.xmlbeans.xmlbean.srcgendir=${maven.build.dir}/xmlbeans/src
+
+# Jar file containing the compiled XMLBeans and resources:
+maven.xmlbeans.xmlbean.destfile=${maven.build.dir}/xmlbeans/${maven.final.name}.jar
+
+# Indicates if the generated source should be compiled with debug information:
+maven.xmlbeans.xmlbean.debug=false
diff --git a/v1/project.properties b/v1/project.properties
new file mode 100644
index 0000000..c051a2d
--- /dev/null
+++ b/v1/project.properties
@@ -0,0 +1,8 @@
+# -------------------------------------------------------------------
+# P R O J E C T P R O P E R T I E S
+# -------------------------------------------------------------------
+maven.docs.src=${basedir}/xdocs
+maven.xdoc.date=left
+maven.xdoc.version=${pom.currentVersion}
+maven.xdoc.poweredby.image=maven-feather.png
+
diff --git a/v1/project.xml b/v1/project.xml
new file mode 100644
index 0000000..dc16eb8
--- /dev/null
+++ b/v1/project.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project>
+ <pomVersion>3</pomVersion>
+ <groupId>xmlbeans</groupId>
+ <id>maven-xmlbeans-plugin</id>
+ <name>Maven XMLBeans Plugin</name>
+ <currentVersion>1.0-DEV</currentVersion>
+ <organization>
+ <name>Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ <logo> </logo>
+ </organization>
+ <inceptionYear>2004</inceptionYear>
+ <shortDescription>Generates XMLBeans from XML Schema files.</shortDescription>
+
+ <developers>
+ <developer>
+ <name>Dutta Satadip</name>
+ <id>dutta</id>
+ <email>s-dutta@sbcglobal.net</email>
+ <organization>Apache Software Foundation</organization>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Joseph Hindsley</name>
+ <email>jhindsley@providerlink.com</email>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ </developers>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean-apache</artifactId>
+ <version>1.0-DEV</version>
+ <url>http://www.ibiblio.org/maven/xmlbeans/jars/</url>
+ <properties>
+ <classloader>root</classloader>
+ </properties>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <!-- Useful if your plugin uses some beans -->
+ <!--
+ <sourceDirectory>src/java/main</sourceDirectory>
+ <unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
+ -->
+
+ <!--
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </unitTest>
+ -->
+
+ <resources>
+ <!--
+ <resource>
+ <directory>${basedir}/src/plugin-resources</directory>
+ <targetPath>plugin-resources</targetPath>
+ </resource>
+ -->
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>plugin.jelly</include>
+ <include>plugin.properties</include>
+ <include>project.properties</include>
+ <include>project.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/Chars.java b/v1/src/common/org/apache/xmlbeans/impl/common/Chars.java
new file mode 100644
index 0000000..f29c261
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/Chars.java
@@ -0,0 +1,33 @@
+/* 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.xmlbeans.impl.common;
+
+public final class Chars
+{
+ public String asString ( )
+ {
+ return
+ string == null
+ ? buffer == null ? "" : new String( buffer, offset, length )
+ : string;
+ }
+
+ public String string;
+
+ public char[] buffer;
+ public int offset;
+ public int length;
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/EncodingMap.java b/v1/src/common/org/apache/xmlbeans/impl/common/EncodingMap.java
new file mode 100644
index 0000000..51ff8af
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/EncodingMap.java
@@ -0,0 +1,400 @@
+/* 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.xmlbeans.impl.common;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+public class EncodingMap
+{
+ public static String getJava2IANAMapping ( String java )
+ {
+ return (String) _java_to_iana.get( java.toUpperCase() );
+ }
+
+ public static String getIANA2JavaMapping ( String iana )
+ {
+ return (String) _iana_to_java.get( iana.toUpperCase() );
+ }
+
+ private EncodingMap ( ) { }
+
+ private final static HashMap _iana_to_java = new HashMap();
+ private final static HashMap _java_to_iana = new HashMap();
+
+ private final static void addMapping (
+ String java, String iana, boolean isDefault )
+ {
+ assert !_iana_to_java.containsKey( iana );
+ assert java.toUpperCase().equals( java );
+ assert iana.toUpperCase().equals( iana );
+
+ _iana_to_java.put( iana, java );
+
+ if (isDefault)
+ {
+ assert !_java_to_iana.containsKey( java );
+ _java_to_iana.put( java, iana );
+ }
+ }
+
+ private final static boolean completeMappings ( )
+ {
+ HashMap m = new HashMap();
+
+ for ( Iterator i = _iana_to_java.keySet().iterator() ; i.hasNext() ; )
+ m.put( _iana_to_java.get( i.next() ), null );
+
+ for ( Iterator i = m.keySet().iterator() ; i.hasNext() ; )
+ {
+ Object k = i.next();
+ assert _java_to_iana.containsKey( k ): k;
+ }
+
+ return true;
+ }
+
+ static
+ {
+ addMapping( "ASCII", "ANSI_X3.4-1986", false );
+ addMapping( "ASCII", "ASCII", true );
+ addMapping( "ASCII", "CP367", false );
+ addMapping( "ASCII", "CSASCII", false );
+ addMapping( "ASCII", "IBM-367", false );
+ addMapping( "ASCII", "IBM367", false );
+ addMapping( "ASCII", "ISO-IR-6", false );
+ addMapping( "ASCII", "ISO646-US", false );
+ addMapping( "ASCII", "ISO_646.IRV:1991", false );
+ addMapping( "ASCII", "US", false );
+ addMapping( "ASCII", "US-ASCII", false );
+ addMapping( "BIG5", "BIG5", true );
+ addMapping( "BIG5", "CSBIG5", false );
+ addMapping( "CP037", "CP037", false );
+ addMapping( "CP037", "CSIBM037", false );
+ addMapping( "CP037", "EBCDIC-CP-CA", false );
+ addMapping( "CP037", "EBCDIC-CP-NL", false );
+ addMapping( "CP037", "EBCDIC-CP-US", true );
+ addMapping( "CP037", "EBCDIC-CP-WT", false );
+ addMapping( "CP037", "IBM-37", false );
+ addMapping( "CP037", "IBM037", false );
+ addMapping( "CP1026", "CP1026", false );
+ addMapping( "CP1026", "CSIBM1026", false );
+ addMapping( "CP1026", "IBM-1026", false );
+ addMapping( "CP1026", "IBM1026", true );
+ addMapping( "CP1047", "CP1047", false );
+ addMapping( "CP1047", "IBM-1047", false );
+ addMapping( "CP1047", "IBM1047", true );
+ addMapping( "CP1140", "CCSID01140", false );
+ addMapping( "CP1140", "CP01140", false );
+ addMapping( "CP1140", "IBM-1140", false );
+ addMapping( "CP1140", "IBM01140", true );
+ addMapping( "CP1141", "CCSID01141", false );
+ addMapping( "CP1141", "CP01141", false );
+ addMapping( "CP1141", "IBM-1141", false );
+ addMapping( "CP1141", "IBM01141", true );
+ addMapping( "CP1142", "CCSID01142", false );
+ addMapping( "CP1142", "CP01142", false );
+ addMapping( "CP1142", "IBM-1142", false );
+ addMapping( "CP1142", "IBM01142", true );
+ addMapping( "CP1143", "CCSID01143", false );
+ addMapping( "CP1143", "CP01143", false );
+ addMapping( "CP1143", "IBM-1143", false );
+ addMapping( "CP1143", "IBM01143", true );
+ addMapping( "CP1144", "CCSID01144", false );
+ addMapping( "CP1144", "CP01144", false );
+ addMapping( "CP1144", "IBM-1144", false );
+ addMapping( "CP1144", "IBM01144", true );
+ addMapping( "CP1145", "CCSID01145", false );
+ addMapping( "CP1145", "CP01145", false );
+ addMapping( "CP1145", "IBM-1145", false );
+ addMapping( "CP1145", "IBM01145", true );
+ addMapping( "CP1146", "CCSID01146", false );
+ addMapping( "CP1146", "CP01146", false );
+ addMapping( "CP1146", "IBM-1146", false );
+ addMapping( "CP1146", "IBM01146", true );
+ addMapping( "CP1147", "CCSID01147", false );
+ addMapping( "CP1147", "CP01147", false );
+ addMapping( "CP1147", "IBM-1147", false );
+ addMapping( "CP1147", "IBM01147", true );
+ addMapping( "CP1148", "CCSID01148", false );
+ addMapping( "CP1148", "CP01148", false );
+ addMapping( "CP1148", "IBM-1148", false );
+ addMapping( "CP1148", "IBM01148", true );
+ addMapping( "CP1149", "CCSID01149", false );
+ addMapping( "CP1149", "CP01149", false );
+ addMapping( "CP1149", "IBM-1149", false );
+ addMapping( "CP1149", "IBM01149", true );
+ addMapping( "CP1250", "WINDOWS-1250", true );
+ addMapping( "CP1251", "WINDOWS-1251", true );
+ addMapping( "CP1252", "WINDOWS-1252", true );
+ addMapping( "CP1253", "WINDOWS-1253", true );
+ addMapping( "CP1254", "WINDOWS-1254", true );
+ addMapping( "CP1255", "WINDOWS-1255", true );
+ addMapping( "CP1256", "WINDOWS-1256", true );
+ addMapping( "CP1257", "WINDOWS-1257", true );
+ addMapping( "CP1258", "WINDOWS-1258", true );
+ addMapping( "CP273", "CP273", false );
+ addMapping( "CP273", "CSIBM273", false );
+ addMapping( "CP273", "IBM-273", false );
+ addMapping( "CP273", "IBM273", true );
+ addMapping( "CP277", "CP277", false );
+ addMapping( "CP277", "CSIBM277", false );
+ addMapping( "CP277", "EBCDIC-CP-DK", true );
+ addMapping( "CP277", "EBCDIC-CP-NO", false );
+ addMapping( "CP277", "IBM-277", false );
+ addMapping( "CP277", "IBM277", false );
+ addMapping( "CP278", "CP278", false );
+ addMapping( "CP278", "CSIBM278", false );
+ addMapping( "CP278", "EBCDIC-CP-FI", true );
+ addMapping( "CP278", "EBCDIC-CP-SE", false );
+ addMapping( "CP278", "IBM-278", false );
+ addMapping( "CP278", "IBM278", false );
+ addMapping( "CP280", "CP280", false );
+ addMapping( "CP280", "CSIBM280", false );
+ addMapping( "CP280", "EBCDIC-CP-IT", true );
+ addMapping( "CP280", "IBM-280", false );
+ addMapping( "CP280", "IBM280", false );
+ addMapping( "CP284", "CP284", false );
+ addMapping( "CP284", "CSIBM284", false );
+ addMapping( "CP284", "EBCDIC-CP-ES", true );
+ addMapping( "CP284", "IBM-284", false );
+ addMapping( "CP284", "IBM284", false );
+ addMapping( "CP285", "CP285", false );
+ addMapping( "CP285", "CSIBM285", false );
+ addMapping( "CP285", "EBCDIC-CP-GB", true );
+ addMapping( "CP285", "IBM-285", false );
+ addMapping( "CP285", "IBM285", false );
+ addMapping( "CP290", "CP290", false );
+ addMapping( "CP290", "CSIBM290", false );
+ addMapping( "CP290", "EBCDIC-JP-KANA", true );
+ addMapping( "CP290", "IBM-290", false );
+ addMapping( "CP290", "IBM290", false );
+ addMapping( "CP297", "CP297", false );
+ addMapping( "CP297", "CSIBM297", false );
+ addMapping( "CP297", "EBCDIC-CP-FR", true );
+ addMapping( "CP297", "IBM-297", false );
+ addMapping( "CP297", "IBM297", false );
+ addMapping( "CP420", "CP420", false );
+ addMapping( "CP420", "CSIBM420", false );
+ addMapping( "CP420", "EBCDIC-CP-AR1", true );
+ addMapping( "CP420", "IBM-420", false );
+ addMapping( "CP420", "IBM420", false );
+ addMapping( "CP424", "CP424", false );
+ addMapping( "CP424", "CSIBM424", false );
+ addMapping( "CP424", "EBCDIC-CP-HE", true );
+ addMapping( "CP424", "IBM-424", false );
+ addMapping( "CP424", "IBM424", false );
+ addMapping( "CP437", "437", false );
+ addMapping( "CP437", "CP437", false );
+ addMapping( "CP437", "CSPC8CODEPAGE437", false );
+ addMapping( "CP437", "IBM-437", false );
+ addMapping( "CP437", "IBM437", true );
+ addMapping( "CP500", "CP500", false );
+ addMapping( "CP500", "CSIBM500", false );
+ addMapping( "CP500", "EBCDIC-CP-BE", false );
+ addMapping( "CP500", "EBCDIC-CP-CH", true );
+ addMapping( "CP500", "IBM-500", false );
+ addMapping( "CP500", "IBM500", false );
+ addMapping( "CP775", "CP775", false );
+ addMapping( "CP775", "CSPC775BALTIC", false );
+ addMapping( "CP775", "IBM-775", false );
+ addMapping( "CP775", "IBM775", true );
+ addMapping( "CP850", "850", false );
+ addMapping( "CP850", "CP850", false );
+ addMapping( "CP850", "CSPC850MULTILINGUAL", false );
+ addMapping( "CP850", "IBM-850", false );
+ addMapping( "CP850", "IBM850", true );
+ addMapping( "CP852", "852", false );
+ addMapping( "CP852", "CP852", false );
+ addMapping( "CP852", "CSPCP852", false );
+ addMapping( "CP852", "IBM-852", false );
+ addMapping( "CP852", "IBM852", true );
+ addMapping( "CP855", "855", false );
+ addMapping( "CP855", "CP855", false );
+ addMapping( "CP855", "CSIBM855", false );
+ addMapping( "CP855", "IBM-855", false );
+ addMapping( "CP855", "IBM855", true );
+ addMapping( "CP857", "857", false );
+ addMapping( "CP857", "CP857", false );
+ addMapping( "CP857", "CSIBM857", false );
+ addMapping( "CP857", "IBM-857", false );
+ addMapping( "CP857", "IBM857", true );
+ addMapping( "CP858", "CCSID00858", false );
+ addMapping( "CP858", "CP00858", false );
+ addMapping( "CP858", "IBM-858", false );
+ addMapping( "CP858", "IBM00858", true );
+ addMapping( "CP860", "860", false );
+ addMapping( "CP860", "CP860", false );
+ addMapping( "CP860", "CSIBM860", false );
+ addMapping( "CP860", "IBM-860", false );
+ addMapping( "CP860", "IBM860", true );
+ addMapping( "CP861", "861", false );
+ addMapping( "CP861", "CP-IS", false );
+ addMapping( "CP861", "CP861", false );
+ addMapping( "CP861", "CSIBM861", false );
+ addMapping( "CP861", "IBM-861", false );
+ addMapping( "CP861", "IBM861", true );
+ addMapping( "CP862", "862", false );
+ addMapping( "CP862", "CP862", false );
+ addMapping( "CP862", "CSPC862LATINHEBREW", false );
+ addMapping( "CP862", "IBM-862", false );
+ addMapping( "CP862", "IBM862", true );
+ addMapping( "CP863", "863", false );
+ addMapping( "CP863", "CP863", false );
+ addMapping( "CP863", "CSIBM863", false );
+ addMapping( "CP863", "IBM-863", false );
+ addMapping( "CP863", "IBM863", true );
+ addMapping( "CP864", "CP864", false );
+ addMapping( "CP864", "CSIBM864", false );
+ addMapping( "CP864", "IBM-864", false );
+ addMapping( "CP864", "IBM864", true );
+ addMapping( "CP865", "865", false );
+ addMapping( "CP865", "CP865", false );
+ addMapping( "CP865", "CSIBM865", false );
+ addMapping( "CP865", "IBM-865", false );
+ addMapping( "CP865", "IBM865", true );
+ addMapping( "CP866", "866", false );
+ addMapping( "CP866", "CP866", false );
+ addMapping( "CP866", "CSIBM866", false );
+ addMapping( "CP866", "IBM-866", false );
+ addMapping( "CP866", "IBM866", true );
+ addMapping( "CP868", "CP-AR", false );
+ addMapping( "CP868", "CP868", false );
+ addMapping( "CP868", "CSIBM868", false );
+ addMapping( "CP868", "IBM-868", false );
+ addMapping( "CP868", "IBM868", true );
+ addMapping( "CP869", "CP-GR", false );
+ addMapping( "CP869", "CP869", false );
+ addMapping( "CP869", "CSIBM869", false );
+ addMapping( "CP869", "IBM-869", false );
+ addMapping( "CP869", "IBM869", true );
+ addMapping( "CP870", "CP870", false );
+ addMapping( "CP870", "CSIBM870", false );
+ addMapping( "CP870", "EBCDIC-CP-ROECE", true );
+ addMapping( "CP870", "EBCDIC-CP-YU", false );
+ addMapping( "CP870", "IBM-870", false );
+ addMapping( "CP870", "IBM870", false );
+ addMapping( "CP871", "CP871", false );
+ addMapping( "CP871", "CSIBM871", false );
+ addMapping( "CP871", "EBCDIC-CP-IS", true );
+ addMapping( "CP871", "IBM-871", false );
+ addMapping( "CP871", "IBM871", false );
+ addMapping( "CP918", "CP918", false );
+ addMapping( "CP918", "CSIBM918", false );
+ addMapping( "CP918", "EBCDIC-CP-AR2", true );
+ addMapping( "CP918", "IBM-918", false );
+ addMapping( "CP918", "IBM918", false );
+ addMapping( "CP924", "CCSID00924", false );
+ addMapping( "CP924", "CP00924", false );
+ addMapping( "CP924", "EBCDIC-LATIN9--EURO", false );
+ addMapping( "CP924", "IBM-924", false );
+ addMapping( "CP924", "IBM00924", true );
+ addMapping( "EUCJIS", "CSEUCPKDFMTJAPANESE", false );
+ addMapping( "EUCJIS", "EUC-JP", true );
+ addMapping( "EUCJIS", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", false );
+ addMapping( "GB18030", "GB18030", true );
+ addMapping( "GB2312", "CSGB2312", false );
+ addMapping( "GB2312", "GB2312", true );
+ addMapping( "ISO2022CN", "ISO-2022-CN", true );
+ addMapping( "ISO2022KR", "CSISO2022KR", false );
+ addMapping( "ISO2022KR", "ISO-2022-KR", true );
+ addMapping( "ISO8859_1", "CP819", false );
+ addMapping( "ISO8859_1", "CSISOLATIN1", false );
+ addMapping( "ISO8859_1", "IBM-819", false );
+ addMapping( "ISO8859_1", "IBM819", false );
+ addMapping( "ISO8859_1", "ISO-8859-1", true );
+ addMapping( "ISO8859_1", "ISO-IR-100", false );
+ addMapping( "ISO8859_1", "ISO_8859-1", false );
+ addMapping( "ISO8859_1", "L1", false );
+ addMapping( "ISO8859_1", "LATIN1", false );
+ addMapping( "ISO8859_2", "CSISOLATIN2", false );
+ addMapping( "ISO8859_2", "ISO-8859-2", true );
+ addMapping( "ISO8859_2", "ISO-IR-101", false );
+ addMapping( "ISO8859_2", "ISO_8859-2", false );
+ addMapping( "ISO8859_2", "L2", false );
+ addMapping( "ISO8859_2", "LATIN2", false );
+ addMapping( "ISO8859_3", "CSISOLATIN3", false );
+ addMapping( "ISO8859_3", "ISO-8859-3", true );
+ addMapping( "ISO8859_3", "ISO-IR-109", false );
+ addMapping( "ISO8859_3", "ISO_8859-3", false );
+ addMapping( "ISO8859_3", "L3", false );
+ addMapping( "ISO8859_3", "LATIN3", false );
+ addMapping( "ISO8859_4", "CSISOLATIN4", false );
+ addMapping( "ISO8859_4", "ISO-8859-4", true );
+ addMapping( "ISO8859_4", "ISO-IR-110", false );
+ addMapping( "ISO8859_4", "ISO_8859-4", false );
+ addMapping( "ISO8859_4", "L4", false );
+ addMapping( "ISO8859_4", "LATIN4", false );
+ addMapping( "ISO8859_5", "CSISOLATINCYRILLIC", false );
+ addMapping( "ISO8859_5", "CYRILLIC", false );
+ addMapping( "ISO8859_5", "ISO-8859-5", true );
+ addMapping( "ISO8859_5", "ISO-IR-144", false );
+ addMapping( "ISO8859_5", "ISO_8859-5", false );
+ addMapping( "ISO8859_6", "ARABIC", false );
+ addMapping( "ISO8859_6", "ASMO-708", false );
+ addMapping( "ISO8859_6", "CSISOLATINARABIC", false );
+ addMapping( "ISO8859_6", "ECMA-114", false );
+ addMapping( "ISO8859_6", "ISO-8859-6", true );
+ addMapping( "ISO8859_6", "ISO-IR-127", false );
+ addMapping( "ISO8859_6", "ISO_8859-6", false );
+ addMapping( "ISO8859_7", "CSISOLATINGREEK", false );
+ addMapping( "ISO8859_7", "ECMA-118", false );
+ addMapping( "ISO8859_7", "ELOT_928", false );
+ addMapping( "ISO8859_7", "GREEK", false );
+ addMapping( "ISO8859_7", "GREEK8", false );
+ addMapping( "ISO8859_7", "ISO-8859-7", true );
+ addMapping( "ISO8859_7", "ISO-IR-126", false );
+ addMapping( "ISO8859_7", "ISO_8859-7", false );
+ addMapping( "ISO8859_8", "CSISOLATINHEBREW", false );
+ addMapping( "ISO8859_8", "HEBREW", false );
+ addMapping( "ISO8859_8", "ISO-8859-8", true );
+ addMapping( "ISO8859_8", "ISO-8859-8-I", false );
+ addMapping( "ISO8859_8", "ISO-IR-138", false );
+ addMapping( "ISO8859_8", "ISO_8859-8", false );
+ addMapping( "ISO8859_9", "CSISOLATIN5", false );
+ addMapping( "ISO8859_9", "ISO-8859-9", true );
+ addMapping( "ISO8859_9", "ISO-IR-148", false );
+ addMapping( "ISO8859_9", "ISO_8859-9", false );
+ addMapping( "ISO8859_9", "L5", false );
+ addMapping( "ISO8859_9", "LATIN5", false );
+ addMapping( "JIS", "CSISO2022JP", false );
+ addMapping( "JIS", "ISO-2022-JP", true );
+ addMapping( "JIS0201", "CSISO13JISC6220JP", false );
+ addMapping( "JIS0201", "X0201", true );
+ addMapping( "JIS0208", "CSISO87JISX0208", false );
+ addMapping( "JIS0208", "ISO-IR-87", false );
+ addMapping( "JIS0208", "X0208", true );
+ addMapping( "JIS0208", "X0208DBIJIS_X0208-1983", false );
+ addMapping( "JIS0212", "CSISO159JISX02121990", false );
+ addMapping( "JIS0212", "ISO-IR-159", true );
+ addMapping( "JIS0212", "X0212", false );
+ addMapping( "KOI8_R", "CSKOI8R", false );
+ addMapping( "KOI8_R", "KOI8-R", true );
+ addMapping( "KSC5601", "EUC-KR", true );
+ addMapping( "MS932", "CSWINDOWS31J", false );
+ addMapping( "MS932", "WINDOWS-31J", true );
+ addMapping( "SJIS", "CSSHIFTJIS", false );
+ addMapping( "SJIS", "MS_KANJI", false );
+ addMapping( "SJIS", "SHIFT_JIS", true );
+ addMapping( "TIS620", "TIS-620", true );
+ addMapping( "UNICODE", "UTF-16", true );
+ addMapping( "UNICODEBIG", "UTF-16BE", true );
+ addMapping( "UNICODELITTLE", "UTF-16LE", true );
+ addMapping( "UTF8", "UTF-8", true );
+
+ assert completeMappings();
+ };
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/GenericXmlInputStream.java b/v1/src/common/org/apache/xmlbeans/impl/common/GenericXmlInputStream.java
new file mode 100644
index 0000000..2804b7e
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/GenericXmlInputStream.java
@@ -0,0 +1,240 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.xml.stream.ReferenceResolver;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+public class GenericXmlInputStream implements XMLInputStream
+{
+ public GenericXmlInputStream ( )
+ {
+ _master = this;
+ _elementCount = 1; // Go all the way
+ }
+
+ private GenericXmlInputStream ( GenericXmlInputStream master )
+ {
+ (_master = master).ensureInit();
+ _nextEvent = master._nextEvent;
+ }
+
+ //
+ // The source for all events
+ //
+
+ protected XMLEvent nextEvent ( ) throws XMLStreamException
+ {
+ throw new RuntimeException( "nextEvent not overridden" );
+ }
+
+ //
+ //
+ //
+
+ private class EventItem
+ {
+ EventItem ( XMLEvent e )
+ {
+ _event = e;
+ }
+
+ int getType ( ) { return _event.getType(); }
+ boolean hasName ( ) { return _event.hasName(); }
+ XMLName getName ( ) { return _event.getName(); }
+
+ final XMLEvent _event;
+
+ EventItem _next;
+ }
+
+ private void ensureInit ( )
+ {
+ if (!_master._initialized)
+ {
+ try
+ {
+ _master._nextEvent = getNextEvent();
+ }
+ catch ( XMLStreamException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ _master._initialized = true;
+ }
+ }
+
+ private EventItem getNextEvent ( ) throws XMLStreamException
+ {
+ XMLEvent e = nextEvent();
+
+ return e == null ? null : new EventItem( e );
+ }
+
+ public XMLEvent next ( ) throws XMLStreamException
+ {
+ ensureInit();
+
+ EventItem currentEvent = _nextEvent;
+
+ if (_nextEvent != null)
+ {
+ if (_nextEvent._next == null)
+ _nextEvent._next = _master.getNextEvent();
+
+ _nextEvent = _nextEvent._next;
+ }
+
+ if (currentEvent == null)
+ return null;
+
+ if (currentEvent.getType() == XMLEvent.END_ELEMENT)
+ {
+ if (--_elementCount <= 0)
+ _nextEvent = null;
+ }
+ else if (currentEvent.getType() == XMLEvent.START_ELEMENT)
+ _elementCount++;
+
+ return currentEvent._event;
+ }
+
+ public boolean hasNext ( ) throws XMLStreamException
+ {
+ ensureInit();
+
+ return _nextEvent != null;
+ }
+
+ public void skip ( ) throws XMLStreamException
+ {
+ next();
+ }
+
+ public void skipElement ( ) throws XMLStreamException
+ {
+ ensureInit();
+
+ for ( ; _nextEvent != null ; next() )
+ {
+ if (_nextEvent.getType() == XMLEvent.START_ELEMENT)
+ break;
+ }
+
+ int count = 0;
+
+ for ( ; _nextEvent != null ; next() )
+ {
+ int type = next().getType();
+
+ if (type == XMLEvent.START_ELEMENT)
+ count++;
+ else if (type == XMLEvent.END_ELEMENT && --count == 0)
+ break;
+ }
+ }
+
+ public XMLEvent peek ( ) throws XMLStreamException
+ {
+ ensureInit();
+
+ return _nextEvent._event;
+ }
+
+ public boolean skip ( int eventType ) throws XMLStreamException
+ {
+ ensureInit();
+
+ for ( ; _nextEvent != null ; next() )
+ {
+ if (_nextEvent.getType() == eventType)
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean skip ( XMLName name ) throws XMLStreamException
+ {
+ ensureInit();
+
+ for ( ; _nextEvent != null ; next() )
+ {
+ if (_nextEvent.hasName() && _nextEvent.getName().equals( name ))
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean skip ( XMLName name, int eventType ) throws XMLStreamException
+ {
+ ensureInit();
+
+ for ( ; _nextEvent != null ; next() )
+ {
+ if (_nextEvent.getType() == eventType &&
+ _nextEvent.hasName() &&
+ _nextEvent.getName().equals( name ))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public XMLInputStream getSubStream ( ) throws XMLStreamException
+ {
+ ensureInit();
+
+ GenericXmlInputStream subStream = new GenericXmlInputStream( this );
+
+ subStream.skip( XMLEvent.START_ELEMENT );
+
+ return subStream;
+ }
+
+ public void close ( ) throws XMLStreamException
+ {
+ // BUGBUG - can I do anything here, really?
+ // SHould I count the number of open sub streams?
+ // I have no destructor, how can I close properly?
+ }
+
+ public ReferenceResolver getReferenceResolver ( )
+ {
+ ensureInit();
+
+ throw new RuntimeException( "Not impl" );
+ }
+
+ public void setReferenceResolver ( ReferenceResolver resolver )
+ {
+ ensureInit();
+
+ throw new RuntimeException( "Not impl" );
+ }
+
+ private boolean _initialized;
+ private EventItem _nextEvent;
+ private int _elementCount;
+ private GenericXmlInputStream _master;
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/GlobalLock.java b/v1/src/common/org/apache/xmlbeans/impl/common/GlobalLock.java
new file mode 100644
index 0000000..e9d889b
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/GlobalLock.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.impl.common;
+
+/**
+ * Whenever multiple locks must be acquired within the implementation of
+ * XML Beans, this GlobalLock is acquired first, and then released when all
+ * the acutally-needed locks have been acquired. This prevents deadlocks.
+ */
+public class GlobalLock
+{
+ private static final Mutex GLOBAL_MUTEX = new Mutex();
+
+ public static void acquire() throws InterruptedException { GLOBAL_MUTEX.acquire(); }
+ public static void tryToAcquire() { GLOBAL_MUTEX.tryToAcquire(); }
+ public static void release() { GLOBAL_MUTEX.release(); }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/IOUtil.java b/v1/src/common/org/apache/xmlbeans/impl/common/IOUtil.java
new file mode 100644
index 0000000..fe79ca0
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/IOUtil.java
@@ -0,0 +1,94 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URI;
+import java.nio.channels.FileChannel;
+
+public class IOUtil
+{
+ public static void copyCompletely(InputStream input, OutputStream output)
+ throws IOException
+ {
+ //if both are file streams, use channel IO
+ if ((output instanceof FileOutputStream) && (input instanceof FileInputStream))
+ {
+ try
+ {
+ FileChannel target = ((FileOutputStream) output).getChannel();
+ FileChannel source = ((FileInputStream) input).getChannel();
+
+ source.transferTo(0, Integer.MAX_VALUE, target);
+
+ source.close();
+ target.close();
+
+ return;
+ }
+ catch (Exception e)
+ { /* failover to byte stream version */ }
+ }
+
+ byte[] buf = new byte[8192];
+ while (true)
+ {
+ int length = input.read(buf);
+ if (length < 0)
+ break;
+ output.write(buf, 0, length);
+ }
+
+ try { input.close(); } catch (IOException ignore) {}
+ try { output.close(); } catch (IOException ignore) {}
+ }
+
+ public static void copyCompletely(URI input, URI output)
+ throws IOException
+ {
+ try
+ {
+ InputStream in = null;
+ try
+ {
+ File f = new File(input);
+ if (f.exists())
+ in = new FileInputStream(f);
+ }
+ catch (Exception notAFile)
+ {}
+
+ File out = new File(output);
+ File dir = out.getParentFile();
+ dir.mkdirs();
+
+ if (in == null)
+ in = input.toURL().openStream();
+
+ IOUtil.copyCompletely(in, new FileOutputStream(out));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new IOException("Cannot copy to " + output);
+ }
+ }
+
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/IdentityConstraint.java b/v1/src/common/org/apache/xmlbeans/impl/common/IdentityConstraint.java
new file mode 100644
index 0000000..e4af803
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/IdentityConstraint.java
@@ -0,0 +1,562 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.impl.common.ValidatorListener.Event;
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.*;
+import java.util.*;
+
+/**
+ * Identity constraint engine. Performs streaming validation of identity constraints.
+ * This includes key, keyref, & unique, as well as ID & IDRef.
+ */
+public class IdentityConstraint {
+
+ private ConstraintState _constraintStack;
+ private ElementState _elementStack;
+ private Collection _errorListener;
+ private boolean _invalid;
+ private boolean _trackIdrefs; // We only track idrefs if validating from the root element
+
+ public IdentityConstraint(Collection errorListener, boolean trackIdrefs) {
+ _errorListener = errorListener;
+ _trackIdrefs = trackIdrefs;
+ }
+
+ public void element(Event e, SchemaType st, SchemaIdentityConstraint[] ics) {
+
+ // Construct a new state for the element
+ newState();
+
+ // First dispatch this element event
+ for (ConstraintState cs = _constraintStack ; cs != null ; cs = cs._next)
+ cs.element(e, st);
+
+ // Create a new SelectorState for each new Identity Constraint
+
+ for (int i = 0 ; ics != null && i < ics.length ; i++)
+ newConstraintState(ics[i], e, st);
+ }
+
+ public void endElement(Event e) {
+ // Pop the element state stack and any constraints at this depth
+ if (_elementStack._hasConstraints)
+ {
+ for (ConstraintState cs = _constraintStack ; cs != null && cs != _elementStack._savePoint ; cs = cs._next)
+ cs.remove( e );
+
+ _constraintStack = _elementStack._savePoint;
+ }
+
+ _elementStack = _elementStack._next;
+
+ // Dispatch the event
+ for (ConstraintState cs = _constraintStack ; cs != null ; cs = cs._next)
+ cs.endElement(e);
+
+ }
+
+ public void attr(Event e, QName name, SchemaType st, String value) {
+ for (ConstraintState cs = _constraintStack ; cs != null ; cs = cs._next)
+ cs.attr(e, name, st, value);
+ }
+
+ public void text(Event e, SchemaType st, String value, boolean emptyContent) {
+ for (ConstraintState cs = _constraintStack ; cs != null ; cs = cs._next)
+ cs.text(e, st, value, emptyContent);
+ }
+
+ public boolean isValid() {
+ return !_invalid;
+ }
+
+ private void newConstraintState(SchemaIdentityConstraint ic, Event e, SchemaType st)
+ {
+ if (ic.getConstraintCategory() == SchemaIdentityConstraint.CC_KEYREF)
+ new KeyrefState(ic, e, st);
+ else
+ new SelectorState(ic, e, st);
+ }
+
+ private void buildIdStates()
+ {
+ // Construct states to hold the values for IDs and IDRefs
+ IdState ids = new IdState();
+ if (_trackIdrefs)
+ new IdRefState(ids);
+ }
+
+ private void newState() {
+ boolean firstTime = _elementStack == null;
+
+ ElementState st = new ElementState();
+ st._next = _elementStack;
+ _elementStack = st;
+
+ if (firstTime)
+ buildIdStates();
+ }
+
+ private void emitError ( Event event, String msg )
+ {
+ _invalid = true;
+
+ if (_errorListener != null)
+ {
+ assert event != null;
+
+ _errorListener.add(
+ XmlError.forCursor( msg, event.getLocationAsCursor() ) );
+ }
+ }
+
+ private void setSavePoint( ConstraintState cs )
+ {
+ if (! _elementStack._hasConstraints)
+ _elementStack._savePoint = cs;
+
+ _elementStack._hasConstraints = true;
+ }
+
+ private static XmlObject newValue(SchemaType st, String value)
+ {
+ try {
+ return st.newValue(value);
+ }
+ catch (IllegalArgumentException e) {
+ // This is a bit hacky. newValue throws XmlValueOutOfRangeException which is
+ // unchecked and declared in typeimpl. I can only catch its parent class,
+ // typeimpl is built after common.
+
+ // Ignore these exceptions. Assume that validation will catch them.
+ return null;
+ }
+ }
+
+ /**
+ * Return the simple type for schema type. If the schema type is already
+ * simple, just return it. If it is a complex type with simple content,
+ * return the simple type it extends.
+ */
+ static SchemaType getSimpleType(SchemaType st)
+ {
+ assert st.isSimpleType() || st.getContentType() == SchemaType.SIMPLE_CONTENT :
+ st + " does not have simple content.";
+
+ while (! st.isSimpleType() )
+ st = st.getBaseType();
+
+ return st;
+ }
+
+ static boolean hasSimpleContent(SchemaType st)
+ {
+ return st.isSimpleType() || st.getContentType() == SchemaType.SIMPLE_CONTENT;
+ }
+
+ public abstract class ConstraintState {
+ ConstraintState _next;
+
+ ConstraintState()
+ {
+ setSavePoint(_constraintStack);
+ _next = _constraintStack;
+ _constraintStack = this;
+ }
+
+ abstract void element(Event e, SchemaType st);
+ abstract void endElement(Event e);
+ abstract void attr(Event e, QName name, SchemaType st, String value);
+ abstract void text(Event e, SchemaType st, String value, boolean emptyContent);
+ abstract void remove(Event e);
+
+ }
+
+ public class SelectorState extends ConstraintState {
+ SchemaIdentityConstraint _constraint;
+ Set _values = new LinkedHashSet();
+ XPath.ExecutionContext _context;
+
+ SelectorState(SchemaIdentityConstraint constraint, Event e, SchemaType st) {
+ _constraint = constraint;
+ _context = new XPath.ExecutionContext();
+ _context.init((XPath)_constraint.getSelectorPath());
+
+ if ( ( _context.start() & XPath.ExecutionContext.HIT ) != 0 )
+ createFieldState(e, st);
+ }
+
+ void addFields(XmlObjectList fields, Event e)
+ {
+ if (_constraint.getConstraintCategory() == SchemaIdentityConstraint.CC_KEYREF)
+ _values.add(fields);
+ else if (_values.contains(fields))
+ emitError(e, "Duplicate key '" + fields + "' for key or unique constraint " + QNameHelper.pretty(_constraint.getName()));
+ else
+ _values.add(fields);
+ }
+
+ void element(Event e, SchemaType st)
+ {
+ if ( ( _context.element(e.getName()) & XPath.ExecutionContext.HIT) != 0 )
+ createFieldState(e, st);
+ }
+
+ void endElement(Event e)
+ {
+ _context.end();
+ }
+
+ void createFieldState(Event e, SchemaType st) {
+ new FieldState(this, e, st);
+ }
+
+ void remove(Event e) {
+ // Bubble up key, unique values to keyrefs
+ for (ConstraintState cs = _next ; cs != null ; cs = cs._next )
+ {
+ if (cs instanceof KeyrefState)
+ {
+ KeyrefState kr = (KeyrefState)cs;
+ if (kr._constraint.getReferencedKey() == this)
+ kr.addKeyValues(_values);
+ }
+ }
+ }
+
+ void attr(Event e, QName name, SchemaType st, String value) {}
+ void text(Event e, SchemaType st, String value, boolean emptyContent) {}
+ }
+
+ public class KeyrefState extends SelectorState {
+ Set _keyValues = new HashSet();
+
+ KeyrefState(SchemaIdentityConstraint constraint, Event e, SchemaType st) {
+ super(constraint, e, st);
+ }
+
+ void addKeyValues(final Set values)
+ {
+ // BUG: remove duplicates
+ _keyValues.addAll(values);
+ }
+
+ void remove(Event e) {
+ // First check if there are any keys at the same stack level as this
+ // that may contribute key values to me
+ for (ConstraintState cs = _next ; cs != null && cs != _elementStack._savePoint ; cs = cs._next)
+ {
+ if (cs instanceof SelectorState)
+ {
+ SelectorState sel = (SelectorState)cs;
+ if (sel._constraint == _constraint.getReferencedKey())
+ addKeyValues(sel._values);
+ }
+ }
+
+
+ // validate all values have been seen
+ for (Iterator it = _values.iterator() ; it.hasNext() ; )
+ {
+
+ XmlObjectList fields = (XmlObjectList)it.next();
+ if (fields.unfilled() < 0 && ! _keyValues.contains(fields))
+ {
+ emitError(e, "Key '" + fields + "' not found (keyRef " + QNameHelper.pretty(_constraint.getName()) + ")");
+ return;
+ }
+ }
+ }
+ }
+
+ public class FieldState extends ConstraintState {
+ SelectorState _selector;
+ XPath.ExecutionContext[] _contexts;
+ boolean[] _needsValue;
+ XmlObjectList _value;
+
+ FieldState(SelectorState selector, Event e, SchemaType st) {
+
+ // System.out.println("Creating new Field State for: " + e.getName());
+
+ _selector = selector;
+ SchemaIdentityConstraint ic = selector._constraint;
+
+ int fieldCount = ic.getFields().length;
+ _contexts = new XPath.ExecutionContext[fieldCount];
+ _needsValue = new boolean[fieldCount];
+ _value = new XmlObjectList(fieldCount);
+
+ for (int i = 0 ; i < fieldCount ; i++)
+ {
+ _contexts[i] = new XPath.ExecutionContext();
+ _contexts[i].init((XPath)ic.getFieldPath(i));
+ if ( ( _contexts[i].start() & XPath.ExecutionContext.HIT ) != 0 )
+ {
+ // System.out.println("hit for element: " + e.getName());
+
+ if (!hasSimpleContent(st))
+ emitError(e, "Identity constraint field must have simple content");
+ else
+ _needsValue[i] = true;
+ }
+ }
+
+ }
+
+ void element(Event e, SchemaType st)
+ {
+ for (int i = 0 ; i < _contexts.length ; i++) {
+ if (_needsValue[i])
+ {
+ emitError(e, "Identity constraint field must have simple content");
+ _needsValue[i] = false;
+ }
+ }
+
+ for (int i = 0 ; i < _contexts.length ; i++) {
+ if ( ( _contexts[i].element(e.getName()) & XPath.ExecutionContext.HIT) != 0 )
+ {
+ if (! hasSimpleContent(st))
+ emitError(e, "Identity constraint field must have simple content");
+ else
+ _needsValue[i] = true;
+ }
+ }
+ }
+
+ void attr(Event e, QName name, SchemaType st, String value) {
+
+ // Null value indicates previously reported validation problem
+ if (value == null) return;
+
+ for (int i = 0 ; i < _contexts.length ; i++) {
+ if ( _contexts[i].attr(name) ) {
+ XmlObject o = newValue(st, value);
+
+ // Ignore invalid values. Assume that validation catches these
+ if (o == null) return;
+
+ boolean set = _value.set(o, i);
+
+ if (! set)
+ emitError(e, "Multiple instances of field with xpath: '"
+ + _selector._constraint.getFields()[i] + "' for a selector");
+ }
+
+ }
+ }
+
+
+ void text(Event e, SchemaType st, String value, boolean emptyContent) {
+
+ // Null value indicates previously reported validation problem
+ if (value == null && !emptyContent) return;
+
+ for (int i = 0 ; i < _contexts.length ; i++) {
+ if ( _needsValue[i] ) {
+
+ if (emptyContent || !hasSimpleContent(st))
+ {
+ emitError(e, "Identity constraint field must have simple content");
+ return;
+ }
+
+ SchemaType simpleType = getSimpleType(st);
+ XmlObject o = newValue(simpleType, value);
+
+ // Ignore invalid values. Assume that validation catches these
+ if (o == null) return;
+
+ boolean set = _value.set(o, i);
+
+ if (! set)
+ emitError(e, "Multiple instances of field with xpath: '"
+ + _selector._constraint.getFields()[i] + "' for a selector");
+ }
+ }
+ }
+
+ void endElement(Event e) {
+ // reset any _needsValue flags
+ // assume that if we didn't see the text, it was because of another validation
+ // error, so don't emit another one.
+ for (int i = 0 ; i < _needsValue.length ; i++)
+ {
+ _contexts[i].end();
+ _needsValue[i] = false;
+ }
+
+ }
+
+ void remove(Event e)
+ {
+
+ if (_selector._constraint.getConstraintCategory() == SchemaIdentityConstraint.CC_KEY &&
+ _value.unfilled() >= 0 )
+ {
+ // keys must have all values supplied
+ emitError(e, "Key " + QNameHelper.pretty(_selector._constraint.getName()) + " is missing field with xpath: '" + _selector._constraint.getFields()[_value.unfilled()] + "'");
+ }
+ else
+ {
+ // Finished. Add these fields to the selector state
+ _selector.addFields(_value, e);
+ }
+ }
+
+ }
+
+ public class IdState extends ConstraintState
+ {
+ Set _values = new LinkedHashSet();
+
+ IdState() { }
+
+ void attr(Event e, QName name, SchemaType st, String value)
+ {
+ handleValue(e, st, value);
+ }
+
+ void text(Event e, SchemaType st, String value, boolean emptyContent)
+ {
+ if (emptyContent)
+ return;
+
+ handleValue(e, st, value);
+ }
+
+ private void handleValue(Event e, SchemaType st, String value)
+ {
+
+ // Null value indicates previously reported validation problem
+ if (value == null) return;
+
+ if (st == null || st.isNoType())
+ {
+ // ignore invalid values. Assume that validation catches these
+ return;
+ }
+
+ if (XmlID.type.isAssignableFrom(st))
+ {
+ XmlObjectList xmlValue = new XmlObjectList(1);
+ XmlObject o = newValue(XmlID.type, value);
+
+ // Ignore invalid values. Assume that validation catches these
+ if (o == null) return;
+
+ xmlValue.set(o, 0);
+
+ if (_values.contains(xmlValue))
+ emitError(e, "Duplicate ID value '" + value + "'");
+ else
+ _values.add(xmlValue);
+ }
+ }
+
+ void element(Event e, SchemaType st) {}
+ void endElement(Event e){}
+ void remove(Event e){}
+
+ }
+
+ public class IdRefState extends ConstraintState
+ {
+ IdState _ids;
+ List _values;
+
+ IdRefState(IdState ids)
+ {
+ _ids = ids;
+ _values = new ArrayList();
+ }
+
+ private void handleValue(Event e, SchemaType st, String value)
+ {
+ // Null value indicates previously reported validation problem
+ if (value == null) return;
+
+ if (st == null || st.isNoType())
+ {
+ // ignore invalid values. Assume that validation catches these
+ return;
+ }
+ if (XmlIDREFS.type.isAssignableFrom(st))
+ {
+ XmlIDREFS lv = (XmlIDREFS)newValue(XmlIDREFS.type, value);
+
+ // Ignore invalid values. Assume that validation catches these
+ if (lv == null) return;
+
+ List l = lv.xgetListValue();
+
+ // Add one value for each idref in the list
+ for (int i = 0 ; i < l.size() ; i++)
+ {
+ XmlObjectList xmlValue = new XmlObjectList(1);
+ XmlIDREF idref = (XmlIDREF)l.get(i);
+ xmlValue.set(idref, 0);
+ _values.add(xmlValue);
+ }
+ }
+ else if (XmlIDREF.type.isAssignableFrom(st))
+ {
+ XmlObjectList xmlValue = new XmlObjectList(1);
+ XmlIDREF idref = (XmlIDREF)st.newValue(value);
+
+ // Ignore invalid values. Assume that validation catches these
+ if (idref == null) return;
+
+ xmlValue.set(idref, 0);
+ _values.add(xmlValue);
+ }
+ }
+
+ void attr(Event e, QName name, SchemaType st, String value)
+ {
+ handleValue(e, st, value);
+ }
+ void text(Event e, SchemaType st, String value, boolean emptyContent)
+ {
+ if (emptyContent)
+ return;
+
+ handleValue(e, st, value);
+ }
+ void remove(Event e)
+ {
+ // Validate each ref has a corresponding ID
+ for (Iterator it = _values.iterator() ; it.hasNext() ; )
+ {
+ Object o = it.next();
+ if (! _ids._values.contains(o))
+ {
+ emitError(e, "ID not found for IDRef value '" + o + "'");
+ }
+ }
+ }
+ void element(Event e, SchemaType st) { }
+ void endElement(Event e) { }
+ }
+
+ private static class ElementState {
+ ElementState _next;
+ boolean _hasConstraints;
+ ConstraintState _savePoint;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/Levenshtein.java b/v1/src/common/org/apache/xmlbeans/impl/common/Levenshtein.java
new file mode 100644
index 0000000..6360b0e
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/Levenshtein.java
@@ -0,0 +1,88 @@
+/* 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.xmlbeans.impl.common;
+
+public class Levenshtein
+{
+ //****************************
+ // Get minimum of three values
+ //****************************
+
+ private static int minimum(int a, int b, int c)
+ {
+ int mi = a;
+ if (b < mi)
+ mi = b;
+ if (c < mi)
+ mi = c;
+ return mi;
+ }
+
+ //*****************************
+ // Compute Levenshtein distance
+ //*****************************
+ public static int distance(String s, String t)
+ {
+ int d[][]; // matrix
+ int n; // length of s
+ int m; // length of t
+ int i; // iterates through s
+ int j; // iterates through t
+ char s_i; // ith character of s
+ char t_j; // jth character of t
+ int cost; // cost
+
+ // Step 1
+ n = s.length();
+ m = t.length();
+ if (n == 0)
+ return m;
+ if (m == 0)
+ return n;
+ d = new int[n+1][m+1];
+
+ // Step 2
+ for (i = 0; i <= n; i++)
+ d[i][0] = i;
+ for (j = 0; j <= m; j++)
+ d[0][j] = j;
+
+ // Step 3
+ for (i = 1; i <= n; i++)
+ {
+ s_i = s.charAt (i - 1);
+
+ // Step 4
+ for (j = 1; j <= m; j++)
+ {
+ t_j = t.charAt(j - 1);
+
+ // Step 5
+ if (s_i == t_j)
+ cost = 0;
+ else
+ cost = 1;
+
+ // Step 6
+ d[i][j] = minimum(d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1] + cost);
+ }
+ }
+
+ // Step 7
+ return d[n][m];
+ }
+
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/Mutex.java b/v1/src/common/org/apache/xmlbeans/impl/common/Mutex.java
new file mode 100644
index 0000000..b98e90c
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/Mutex.java
@@ -0,0 +1,83 @@
+/* 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.xmlbeans.impl.common;
+
+public class Mutex
+{
+ private Thread owner = null; // Owner of mutex, null if nobody
+ private int lock_count = 0;
+
+ /**
+ * Acquire the mutex. The mutex can be acquired multiple times
+ * by the same thread, provided that it is released as many
+ * times as it is acquired. The calling thread blocks until
+ * it has acquired the mutex. (There is no timeout).
+ */
+ public synchronized void acquire() throws InterruptedException
+ {
+ while (tryToAcquire() == false)
+ {
+ this.wait();
+ }
+ }
+
+ /**
+ * Attempts to acquire the mutex. Returns false (and does not
+ * block) if it can't get it.
+ */
+
+ public synchronized boolean tryToAcquire()
+ {
+ // Try to get the mutex. Return true if you got it.
+
+ if( owner == null )
+ {
+ owner = Thread.currentThread();
+ lock_count = 1;
+ return true;
+ }
+
+ if( owner == Thread.currentThread() )
+ {
+ ++lock_count;
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Release the mutex. The mutex has to be released as many times
+ * as it was acquired to actually unlock the resource. The mutex
+ * must be released by the thread that acquired it
+ *
+ * @throws IllegalStateException (a RuntimeException) if a thread
+ * other than the current owner tries to release the mutex.
+ */
+
+ public synchronized void release()
+ {
+ if (owner != Thread.currentThread())
+ throw new IllegalStateException("Thread calling release() doesn't own mutex");
+
+ if (--lock_count <= 0)
+ {
+ owner = null;
+ notify();
+ }
+ }
+}
+
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/NameUtil.java b/v1/src/common/org/apache/xmlbeans/impl/common/NameUtil.java
new file mode 100644
index 0000000..393ff4d
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/NameUtil.java
@@ -0,0 +1,772 @@
+/* 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.xmlbeans.impl.common;
+
+import javax.xml.namespace.QName;
+
+import java.util.*;
+
+public class NameUtil
+{
+ // punctuation characters
+ public final static char HYPHEN = '\u002D';
+ public final static char PERIOD = '\u002E';
+ public final static char COLON = '\u003A';
+ public final static char USCORE = '\u005F';
+ public final static char DOT = '\u00B7';
+ public final static char TELEIA = '\u0387';
+ public final static char AYAH = '\u06DD';
+ public final static char ELHIZB = '\u06DE';
+
+ private final static boolean DEBUG = false;
+
+ private final static Set javaWords = new HashSet(Arrays.asList(
+ new String[]
+ {
+ "abstract",
+ "boolean",
+ "break",
+ "byte",
+ "case",
+ "catch",
+ "char",
+ "class",
+ "const",
+ "continue",
+ "default",
+ "do",
+ "double",
+ "else",
+ "extends",
+ "false", // not a keyword
+ "final",
+ "finally",
+ "float",
+ "for",
+ "goto",
+ "if",
+ "implements",
+ "import",
+ "instanceof",
+ "int",
+ "interface",
+ "long",
+ "native",
+ "new",
+ "null", // not a keyword
+ "package",
+ "private",
+ "protected",
+ "public",
+ "return",
+ "short",
+ "static",
+ "super",
+ "switch",
+ "synchronized",
+ "this",
+ "threadsafe",
+ "throw",
+ "throws",
+ "transient",
+ "true", // not a keyword
+ "try",
+ "void",
+ "volatile",
+ "while",
+ }
+ ));
+
+ /*
+ private final static Set javaNames = new HashSet(Arrays.asList(
+ new String[]
+ {
+ "CharSequence",
+ "Cloneable",
+ "Comparable",
+ "Runnable",
+
+ "Boolean",
+ "Byte",
+ "Character",
+ "Class",
+ "ClassLoader",
+ "Compiler",
+ "Double",
+ "Float",
+ "InheritableThreadLocal",
+ "Integer",
+ "Long",
+ "Math",
+ "Number",
+ "Object",
+ "Package",
+ "Process",
+ "Runtime",
+ "RuntimePermission",
+ "SecurityManager",
+ "Short",
+ "StackTraceElement",
+ "StrictMath",
+ "String",
+ "StringBuffer",
+ "System",
+ "Thread",
+ "ThreadGroup",
+ "ThreadLocal",
+ "Throwable",
+ "Void",
+
+ "ArithmeticException",
+ "ArrayIndexOutOfBoundsException",
+ "ArrayStoreException",
+ "ClassCastException",
+ "ClassNotFoundException",
+ "CloneNotSupportedException",
+ "Exception",
+ "IllegalAccessException",
+ "IllegalArgumentException",
+ "IllegalMonitorStateException",
+ "IllegalStateException",
+ "IllegalThreadStateException",
+ "IndexOutOfBoundsException",
+ "InstantiationException",
+ "InterruptedException",
+ "NegativeArraySizeException",
+ "NoSuchFieldException",
+ "NoSuchMethodException",
+ "NullPointerException",
+ "NumberFormatException",
+ "RuntimeException",
+ "SecurityException",
+ "StringIndexOutOfBoundsException",
+ "UnsupportedOperationException",
+
+ "AbstractMethodError",
+ "AssertionError",
+ "ClassCircularityError",
+ "ClassFormatError",
+ "Error",
+ "ExceptionInInitializerError",
+ "IllegalAccessError",
+ "IncompatibleClassChangeError",
+ "InstantiationError",
+ "InternalError",
+ "LinkageError",
+ "NoClassDefFoundError",
+ "NoSuchFieldError",
+ "NoSuchMethodError",
+ "OutOfMemoryError",
+ "StackOverflowError",
+ "ThreadDeath",
+ "UnknownError",
+ "UnsatisfiedLinkError",
+ "UnsupportedClassVersionError",
+ "VerifyError",
+ "VirtualMachineError",
+ }
+ ));
+ */
+
+ private final static Set javaNames = new HashSet(Arrays.asList(
+ new String[]
+ {
+ // 1. all the Java.lang classes [1.4.1 JDK].
+ "CharSequence",
+ "Cloneable",
+ "Comparable",
+ "Runnable",
+
+ "Boolean",
+ "Byte",
+ "Character",
+ "Class",
+ "ClassLoader",
+ "Compiler",
+ "Double",
+ "Float",
+ "InheritableThreadLocal",
+ "Integer",
+ "Long",
+ "Math",
+ "Number",
+ "Object",
+ "Package",
+ "Process",
+ "Runtime",
+ "RuntimePermission",
+ "SecurityManager",
+ "Short",
+ "StackTraceElement",
+ "StrictMath",
+ "String",
+ "StringBuffer",
+ "System",
+ "Thread",
+ "ThreadGroup",
+ "ThreadLocal",
+ "Throwable",
+ "Void",
+
+ "ArithmeticException",
+ "ArrayIndexOutOfBoundsException",
+ "ArrayStoreException",
+ "ClassCastException",
+ "ClassNotFoundException",
+ "CloneNotSupportedException",
+ "Exception",
+ "IllegalAccessException",
+ "IllegalArgumentException",
+ "IllegalMonitorStateException",
+ "IllegalStateException",
+ "IllegalThreadStateException",
+ "IndexOutOfBoundsException",
+ "InstantiationException",
+ "InterruptedException",
+ "NegativeArraySizeException",
+ "NoSuchFieldException",
+ "NoSuchMethodException",
+ "NullPointerException",
+ "NumberFormatException",
+ "RuntimeException",
+ "SecurityException",
+ "StringIndexOutOfBoundsException",
+ "UnsupportedOperationException",
+
+ "AbstractMethodError",
+ "AssertionError",
+ "ClassCircularityError",
+ "ClassFormatError",
+ "Error",
+ "ExceptionInInitializerError",
+ "IllegalAccessError",
+ "IncompatibleClassChangeError",
+ "InstantiationError",
+ "InternalError",
+ "LinkageError",
+ "NoClassDefFoundError",
+ "NoSuchFieldError",
+ "NoSuchMethodError",
+ "OutOfMemoryError",
+ "StackOverflowError",
+ "ThreadDeath",
+ "UnknownError",
+ "UnsatisfiedLinkError",
+ "UnsupportedClassVersionError",
+ "VerifyError",
+ "VirtualMachineError",
+
+ // 2. other classes used as primitive types by xml beans
+ "BigInteger",
+ "BigDecimal",
+ "Enum",
+ "Date",
+ "GDate",
+ "GDuration",
+ "QName",
+ "List",
+
+ // 3. the top few org.apache.xmlbeans names
+ "XmlObject",
+ "XmlCursor",
+ "XmlBeans",
+ "SchemaType",
+ }
+ ));
+
+ public static boolean isValidJavaIdentifier(String id)
+ {
+ if (id == null)
+ throw new IllegalArgumentException("id cannot be null");
+
+ int len = id.length();
+ if (len == 0)
+ return false;
+
+ if (javaWords.contains(id))
+ return false;
+
+ if (!Character.isJavaIdentifierStart(id.charAt(0)))
+ return false;
+
+ for (int i = 1; i < len; i++)
+ {
+ if (!Character.isJavaIdentifierPart(id.charAt(i)))
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ public static String getJAXRPCClassName( String name )
+ {
+ name = name.replace('.', '_');
+ name = uppercaseFirstLetter( name );
+
+ if (isValidJavaIdentifer(name))
+ {
+ return name;
+ }
+ else
+ {
+ return "_" + name;
+ }
+ }
+
+ public static String getJAXRPCMethodName(String name)
+ {
+ name = name.replace('.','_');
+ name = lowercaseFirstLetter(name);
+
+ if (isValidJavaIdentifer(name))
+ {
+ return name;
+ }
+ else
+ {
+ return "_" + name;
+ }
+ }
+
+ public static XMLName getXMLNameFromClass(Class clazz)
+ {
+ String uri = NameUtil.getNamespaceFromPackage(clazz);
+ String lname = NameUtil.getRootClassNameFromClass(clazz.getName());
+ XMLName xsd_name = new Name(uri, lname);
+ return xsd_name;
+ }
+ */
+
+ public static String getClassNameFromQName(QName qname)
+ {
+ String java_type = upperCamelCase(qname.getLocalPart());
+
+ String uri = qname.getNamespaceURI();
+ String java_pkg = null;
+
+ java_pkg = getPackageFromNamespace(uri);
+
+ if (java_pkg != null)
+ return java_pkg + "." + java_type;
+ else
+ return java_type;
+ }
+
+ private static final String JAVA_NS_PREFIX="java:";
+ private static final String LANG_PREFIX = "java.";
+
+ public static String getNamespaceFromPackage(final Class clazz)
+ {
+ Class curr_clazz = clazz;
+
+ while (curr_clazz.isArray())
+ curr_clazz = curr_clazz.getComponentType();
+
+ String fullname = clazz.getName();
+ int lastdot = fullname.lastIndexOf('.');
+ String pkg_name = lastdot < 0 ? "" : fullname.substring(0, lastdot);
+
+ //special case for builtin types
+ /*
+ if (curr_clazz.isPrimitive())
+ {
+ pkg_name = c.getJavaLanguageNamespaceUri();
+ }
+ else if (pkg_name.startsWith(LANG_PREFIX))
+ {
+ final String rem_str = pkg_name.substring(LANG_PREFIX.length());
+ pkg_name = c.getJavaLanguageNamespaceUri() + "." + rem_str;
+ }
+ */
+ return JAVA_NS_PREFIX + pkg_name;
+ }
+
+ private static boolean isUriSchemeChar(char ch)
+ {
+ return (ch >= 'a' && ch <='z' ||
+ ch >= 'A' && ch <='Z' ||
+ ch >= '0' && ch <='9' ||
+ ch == '-' || ch == '.' || ch == '+');
+ }
+
+ private static boolean isUriAlphaChar(char ch)
+ {
+ return (ch >= 'a' && ch <='z' || ch >= 'A' && ch <= 'Z');
+ }
+
+ private static int findSchemeColon(String uri)
+ {
+ int len = uri.length();
+ if (len == 0)
+ return -1;
+ if (!isUriAlphaChar(uri.charAt(0)))
+ return -1;
+ int i;
+ for (i = 1; i < len; i++)
+ if (!isUriSchemeChar(uri.charAt(i)))
+ break;
+ if (i == len)
+ return -1;
+ if (uri.charAt(i) != ':')
+ return -1;
+ return i;
+ }
+
+ private static String jls77String(String name)
+ {
+ StringBuffer buf = new StringBuffer(name);
+ for (int i = 0; i < name.length(); i++)
+ {
+ if (!Character.isJavaIdentifierPart(buf.charAt(i)))
+ buf.setCharAt(i, '_');
+ }
+ if (buf.length() == 0 || !Character.isJavaIdentifierStart(buf.charAt(0)))
+ buf.insert(0, '_');
+ if (isJavaReservedWord(name))
+ buf.append('_');
+ return buf.toString();
+ }
+
+ private static List splitDNS(String dns)
+ {
+ // JAXB says: only split+reverse DNS if TLD matches known TLDs or ISO 3166
+ // We are ignoring this now (TH)
+
+ List result = new ArrayList();
+
+ int end = dns.length();
+ int begin = dns.lastIndexOf('.');
+ for ( ; begin != -1 ; begin--)
+ {
+ if (dns.charAt(begin) == '.') {
+ result.add(jls77String(dns.substring(begin + 1, end)));
+ end = begin;
+ }
+ }
+ result.add(jls77String(dns.substring(0, end)));
+
+ // JAXB draft example implies removal of www
+ if (result.size() >= 3 &&
+ ((String)result.get(result.size() - 1)).toLowerCase().equals("www"))
+ result.remove(result.size() - 1);
+
+ return result;
+ }
+
+ private static String processFilename(String filename)
+ {
+ // JAXB says: strip 2 or 3 letter extension or ".html"
+
+ int i = filename.lastIndexOf('.');
+ if (i > 0 && (
+ i + 1 + 2 == filename.length() ||
+ i + 1 + 3 == filename.length() ||
+ filename.substring(i + 1).toLowerCase() == "html"))
+ {
+ return filename.substring(0, i);
+ }
+
+ return filename;
+ }
+
+ public static String getPackageFromNamespace(String uri)
+ {
+ // special case: no namespace -> package "noNamespace"
+ if (uri == null || uri.length() == 0)
+ return "noNamespace";
+
+ // apply draft JAXB rules
+ int len = uri.length();
+ int i = findSchemeColon(uri);
+ List result = null;
+
+ if ( i >= 0 && uri.substring(0, i).equals("java"))
+ result = Arrays.asList(uri.substring(i + 1).split("\\."));
+
+ else {
+ result = new ArrayList();
+ outer: for (i = i + 1; i < len; )
+ {
+ while (uri.charAt(i) == '/')
+ if (++i >= len) break outer;
+ int start = i;
+ while (uri.charAt(i) != '/')
+ if (++i >= len) break;
+ int end = i;
+ result.add(uri.substring(start, end));
+ }
+ if (result.size() > 1)
+ result.set(result.size() - 1, processFilename((String)result.get(result.size() - 1)));
+
+ if (result.size() > 0)
+ {
+ List splitdns = splitDNS((String)result.get(0));
+ result.remove(0);
+ result.addAll(0, splitdns);
+ }
+ }
+
+ StringBuffer buf = new StringBuffer();
+ for (Iterator it = result.iterator(); it.hasNext(); )
+ {
+ buf.append(nonJavaKeyword(lowerCamelCase((String)it.next())));
+ buf.append('.');
+ }
+ return buf.substring(0, buf.length() - 1); // chop off extra dot
+ }
+
+ public static void main(String[] args)
+ {
+ for (int i = 0; i < args.length; i++)
+ System.out.println(upperCaseUnderbar(args[i]));
+ }
+
+ /**
+ * Returns a upper-case-and-underbar string using the JAXB rules.
+ * Always starts with a capital letter that is a valid
+ * java identifier start. (If JAXB rules don't produce
+ * one, then "X_" is prepended.)
+ */
+ public static String upperCaseUnderbar(String xml_name)
+ {
+ StringBuffer buf = new StringBuffer();
+ List words = splitWords(xml_name);
+
+ final int sz = words.size() - 1;
+ if (sz >= 0 && !Character.isJavaIdentifierStart(((String)words.get(0)).charAt(0)))
+ buf.append("X_");
+
+ for(int i = 0 ; i < sz ; i++)
+ {
+ buf.append((String)words.get(i));
+ buf.append(USCORE);
+ }
+
+ if (sz >= 0)
+ {
+ buf.append((String)words.get(sz));
+ }
+
+ //upcase entire buffer
+ final int len = buf.length();
+ for(int j = 0 ; j < len ; j++)
+ {
+ char c = buf.charAt(j);
+ buf.setCharAt(j, Character.toUpperCase(c));
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Returns a camel-cased string using the JAXB rules.
+ * Always starts with a capital letter that is a valid
+ * java identifier start. (If JAXB rules don't produce
+ * one, then "X" is prepended.)
+ */
+ public static String upperCamelCase(String xml_name)
+ {
+ StringBuffer buf = new StringBuffer();
+ List words = splitWords(xml_name);
+
+ if (words.size() > 0)
+ {
+ if (!Character.isJavaIdentifierStart(((String)words.get(0)).charAt(0)))
+ buf.append("X");
+
+ Iterator itr = words.iterator();
+ while(itr.hasNext())
+ buf.append((String)itr.next());
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Returns a camel-cased string using the JAXB rules,
+ * where the first component is lowercased. Note that
+ * if the first component is an acronym, the whole
+ * thigns gets lowercased.
+ * Always starts with a lowercase letter that is a valid
+ * java identifier start. (If JAXB rules don't produce
+ * one, then "x" is prepended.)
+ */
+ public static String lowerCamelCase(String xml_name)
+ {
+ StringBuffer buf = new StringBuffer();
+ List words = splitWords(xml_name);
+
+ if (words.size() > 0)
+ {
+ String first = ((String)words.get(0)).toLowerCase();
+ char f = first.charAt(0);
+ if (!Character.isJavaIdentifierStart(f))
+ buf.append("x");
+ buf.append(first);
+
+ Iterator itr = words.iterator();
+ itr.next(); // skip already-lowercased word
+ while(itr.hasNext())
+ buf.append((String)itr.next());
+ }
+ return buf.toString();
+ }
+
+ public static String upperCaseFirstLetter(String s)
+ {
+ if (s.length() == 0 || Character.isUpperCase(s.charAt(0)))
+ return s;
+
+ StringBuffer buf = new StringBuffer(s);
+ buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
+ return buf.toString();
+ }
+
+
+ /**
+ split an xml name into words via JAXB approach, upcasing first
+ letter of each word as needed, if upcase is true
+
+ ncname is xml ncname (i.e. no colons).
+ */
+ private static void addCapped(List list, String str)
+ {
+ if (str.length() > 0)
+ list.add(upperCaseFirstLetter(str));
+ }
+
+ public static List splitWords(String name)
+ {
+ List list = new ArrayList();
+ int len = name.length();
+ int start = 0;
+ int prefix = START;
+ for (int i = 0; i < len; i++)
+ {
+ int current = getCharClass(name.charAt(i));
+ if (prefix != PUNCT && current == PUNCT)
+ {
+ addCapped(list, name.substring(start, i));
+ while ((current = getCharClass(name.charAt(i))) == PUNCT)
+ if (++i >= len) return list;
+ start = i;
+ }
+ else if ((prefix == DIGIT) != (current == DIGIT) ||
+ (prefix == LOWER && current != LOWER) ||
+ (isLetter(prefix) != isLetter(current)))
+ {
+ addCapped(list, name.substring(start, i));
+ start = i;
+ }
+ else if (prefix == UPPER && current == LOWER && i > start + 1)
+ {
+ addCapped(list, name.substring(start, i - 1));
+ start = i - 1;
+ }
+ prefix = current;
+ }
+ addCapped(list, name.substring(start));
+ return list;
+ }
+
+ //char classes
+ private final static int START = 0;
+ private final static int PUNCT = 1;
+ private final static int DIGIT = 2;
+ private final static int MARK = 3;
+ private final static int UPPER = 4;
+ private final static int LOWER= 5;
+ private final static int NOCASE= 6;
+
+ public static int getCharClass(char c)
+ {
+ //ordering is important here.
+ if (isPunctuation(c))
+ return PUNCT;
+ else if (Character.isDigit(c))
+ return DIGIT;
+ else if (Character.isUpperCase(c))
+ return UPPER;
+ else if (Character.isLowerCase(c))
+ return LOWER;
+ else if (Character.isLetter(c))
+ return NOCASE;
+ else if (Character.isJavaIdentifierPart(c))
+ return MARK;
+ else
+ return PUNCT; // not covered by JAXB: treat it as punctuation
+ }
+
+ private static boolean isLetter(int state)
+ {
+ return (state==UPPER
+ || state==LOWER
+ || state==NOCASE);
+ }
+
+ public static boolean isPunctuation(char c)
+ {
+ return (c == HYPHEN
+ || c == PERIOD
+ || c == COLON
+ || c == USCORE
+ || c == DOT
+ || c == TELEIA
+ || c == AYAH
+ || c == ELHIZB);
+ }
+
+ /**
+ * Intended to be applied to a lowercase-starting identifier that
+ * may collide with a Java keyword. If it does collide, this
+ * prepends the letter "x".
+ */
+ public static String nonJavaKeyword(String word)
+ {
+ if (isJavaReservedWord(word))
+ return 'x' + word;
+ return word;
+ }
+
+ /**
+ * Intended to be applied to an uppercase-starting identifier that
+ * may collide with a java.lang.* classname. If it does collide, this
+ * prepends the letter "X".
+ */
+ public static String nonJavaCommonClassName(String name)
+ {
+ if (isJavaCommonClassName(name))
+ return "X" + name;
+ return name;
+ }
+
+ private static boolean isJavaReservedWord(String word)
+ {
+ return isJavaReservedWord(word, true);
+ }
+
+ private static boolean isJavaReservedWord(String word, boolean ignore_case)
+ {
+ if (ignore_case)
+ word = word.toLowerCase();
+ return javaWords.contains(word);
+ }
+
+ public static boolean isJavaCommonClassName(String word)
+ {
+ return javaNames.contains(word);
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/ParseUtil.java b/v1/src/common/org/apache/xmlbeans/impl/common/ParseUtil.java
new file mode 100644
index 0000000..a790e7e
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/ParseUtil.java
@@ -0,0 +1,32 @@
+/* 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.xmlbeans.impl.common;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Nov 25, 2003
+ */
+public class ParseUtil
+{
+ public static String trimInitialPlus(String xml)
+ {
+ if (xml!=null && xml.charAt(0) == '+') {
+ return xml.substring(1);
+ } else {
+ return xml;
+ }
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/PrefixResolver.java b/v1/src/common/org/apache/xmlbeans/impl/common/PrefixResolver.java
new file mode 100644
index 0000000..32af527
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/PrefixResolver.java
@@ -0,0 +1,31 @@
+/* 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.xmlbeans.impl.common;
+
+public interface PrefixResolver
+{
+ /**
+ * Caled when the user has a prefix and needs to look up the corresponding
+ * namespace URI. If the prefix is not defined in this context, then this
+ * method may return null. The no-namespace is represented by the empty
+ * string return result.
+ *
+ * If the prefix is null or "", then the default namespace is being
+ * requested. To conform with the XML spec, the default namespace will
+ * return the no-namespace ("") if it is not mapped.
+ */
+ String getNamespaceForPrefix(String prefix);
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/PushedInputStream.java b/v1/src/common/org/apache/xmlbeans/impl/common/PushedInputStream.java
new file mode 100644
index 0000000..db06677
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/PushedInputStream.java
@@ -0,0 +1,209 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.InputStream;
+
+
+public abstract class PushedInputStream extends InputStream
+{
+ private static int defaultBufferSize = 2048;
+ protected byte buf[];
+ protected int writepos;
+ protected int readpos;
+ protected int markpos = -1;
+ protected int marklimit;
+ protected OutputStream outputStream = new InternalOutputStream();
+
+ /**
+ * Called when more bytes need to be written into this stream
+ * (as an OutputStream).
+ *
+ * This method must write at least one byte if the stream is
+ * not ended, and it must not write any bytes if the stream has
+ * already ended.
+ */
+ protected abstract void fill(int requestedBytes) throws IOException;
+
+ /**
+ * Returns the linked output stream.
+ *
+ * This is the output stream that must be written to whenever
+ * the fill method is called.
+ */
+ public final OutputStream getOutputStream()
+ {
+ return outputStream;
+ }
+
+ public PushedInputStream()
+ {
+ this(defaultBufferSize);
+ }
+
+ public PushedInputStream(int size)
+ {
+ if (size < 0)
+ {
+ throw new IllegalArgumentException("Negative initial buffer size");
+ }
+ buf = new byte[size];
+ }
+
+ /**
+ * Makes room for cb more bytes of data
+ */
+ private void shift(int cb)
+ {
+ int savepos = readpos;
+ if (markpos > 0)
+ {
+ if (readpos - markpos > marklimit)
+ markpos = -1;
+ else
+ savepos = markpos;
+ }
+
+ int size = writepos - savepos;
+
+ if (savepos > 0 && buf.length - size >= cb && size <= cb)
+ {
+ System.arraycopy(buf, savepos, buf, 0, size);
+ }
+ else
+ {
+ int newcount = size + cb;
+ byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
+ System.arraycopy(buf, savepos, newbuf, 0, size);
+ buf = newbuf;
+ }
+
+ if (savepos > 0)
+ {
+ readpos -= savepos;
+ if (markpos > 0)
+ markpos -= savepos;
+ writepos -= savepos;
+ }
+ }
+
+ public synchronized int read() throws IOException
+ {
+ if (readpos >= writepos)
+ {
+ fill(1);
+ if (readpos >= writepos)
+ return -1;
+ }
+ return buf[readpos++] & 0xff;
+ }
+
+ /**
+ * Read characters into a portion of an array, reading from the underlying
+ * stream at most once if necessary.
+ */
+ public synchronized int read(byte[] b, int off, int len) throws IOException
+ {
+ int avail = writepos - readpos;
+ if (avail < len)
+ {
+ fill(len - avail);
+ avail = writepos - readpos;
+ if (avail <= 0) return -1;
+ }
+ int cnt = (avail < len) ? avail : len;
+ System.arraycopy(buf, readpos, b, off, cnt);
+ readpos += cnt;
+ return cnt;
+ }
+
+ public synchronized long skip(long n) throws IOException
+ {
+ if (n <= 0)
+ return 0;
+
+ long avail = writepos - readpos;
+
+ if (avail < n)
+ {
+ // Fill in buffer to save bytes for reset
+ long req = n - avail;
+ if (req > Integer.MAX_VALUE)
+ req = Integer.MAX_VALUE;
+ fill((int)req);
+ avail = writepos - readpos;
+ if (avail <= 0)
+ return 0;
+ }
+
+ long skipped = (avail < n) ? avail : n;
+ readpos += skipped;
+ return skipped;
+ }
+
+ public synchronized int available()
+ {
+ return writepos - readpos;
+ }
+
+ public synchronized void mark(int readlimit)
+ {
+ marklimit = readlimit;
+ markpos = readpos;
+ }
+
+ public synchronized void reset() throws IOException
+ {
+ if (markpos < 0)
+ throw new IOException("Resetting to invalid mark");
+ readpos = markpos;
+ }
+
+ public boolean markSupported()
+ {
+ return true;
+ }
+
+ private class InternalOutputStream extends OutputStream
+ {
+ public synchronized void write(int b) throws IOException
+ {
+ if (writepos + 1 > buf.length)
+ {
+ shift(1);
+ }
+ buf[writepos] = (byte)b;
+ writepos += 1;
+ }
+
+ public synchronized void write(byte b[], int off, int len)
+ {
+ if ((off < 0) || (off > b.length) || (len < 0) ||
+ ((off + len) > b.length) || ((off + len) < 0))
+ throw new IndexOutOfBoundsException();
+ else if (len == 0)
+ return;
+
+ if (writepos + len > buf.length)
+ shift(len);
+
+ System.arraycopy(b, off, buf, writepos, len);
+ writepos += len;
+ }
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/QNameHelper.java b/v1/src/common/org/apache/xmlbeans/impl/common/QNameHelper.java
new file mode 100644
index 0000000..c6b852f
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/QNameHelper.java
@@ -0,0 +1,376 @@
+/* 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.xmlbeans.impl.common;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.xml.stream.XMLName;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaField;
+
+public class QNameHelper
+{
+ private static final Map WELL_KNOWN_PREFIXES = buildWKP();
+
+ public static XMLName getXMLName(QName qname)
+ {
+ if (qname == null)
+ return null;
+
+ return XMLNameHelper.forLNS( qname.getLocalPart(), qname.getNamespaceURI() );
+ }
+
+ public static QName forLNS(String localname, String uri)
+ {
+ if (uri == null)
+ uri = "";
+ return new QName(uri, localname);
+ }
+
+ public static QName forLN(String localname)
+ {
+ return new QName("", localname);
+ }
+
+ public static QName forPretty(String pretty, int offset)
+ {
+ int at = pretty.indexOf('@', offset);
+ if (at < 0)
+ return new QName("", pretty.substring(offset));
+ return new QName(pretty.substring(at + 1), pretty.substring(offset, at));
+ }
+
+ public static String pretty(QName name)
+ {
+ if (name == null)
+ return "null";
+
+ if (name.getNamespaceURI() == null || name.getNamespaceURI().length() == 0)
+ return name.getLocalPart();
+
+ return name.getLocalPart() + "@" + name.getNamespaceURI();
+ }
+
+ private static final char[] hexdigits = new char[]
+ {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+
+ private static boolean isSafe(int c)
+ {
+ if (c >= 'a' && c <= 'z')
+ return true;
+ if (c >= 'A' && c <= 'Z')
+ return true;
+ if (c >= '0' && c <= '9')
+ return true;
+ return false;
+ }
+
+ // This produces a string which is a safe filename from the given string s.
+ // To make it a safe filename, the following two transformations are applied:
+ //
+ // 1. First all non-ascii-alphanumeric characters are escaped using
+ // their UTF8 byte sequence, in the form _xx_xx_xx, for example,
+ // "Hello_20There" for "Hello There". (Obviously, a single unicode
+ // character may expand into as many as three escape patterns.)
+ // If the resulting string is 64 characters or fewer, that's the result.
+ //
+ // 2. If the resulting string is longer than 64 characters, then it is
+ // discarded. Instead, the SHA1 algorithm is run on the original
+ // string's UTF8 representation, and then the resulting 20-byte message
+ // digest is turned into a 40-character hex string; then "URI_SHA_1_" is
+ // prepended.
+ //
+ // The reason for the "shortening" is to avoid filenames longer than about
+ // 256 characters, which are prohibited on Windows NT.
+
+ public static final int MAX_NAME_LENGTH = 64;
+
+ public static String hexsafe(String s)
+ {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < s.length(); i++)
+ {
+ char ch = s.charAt(i);
+ if (isSafe(ch))
+ {
+ result.append(ch);
+ }
+ else
+ {
+ byte[] utf8 = null;
+ try
+ {
+ utf8 = s.substring(i, i + 1).getBytes("UTF-8");
+ for (int j = 0; j < utf8.length; j++)
+ {
+ result.append('_');
+ result.append(hexdigits[(utf8[j] >> 4) & 0xF]);
+ result.append(hexdigits[utf8[j] & 0xF]);
+ }
+ }
+ catch(UnsupportedEncodingException uee)
+ {
+ // should never happen - UTF-8 i always supported
+ result.append("_BAD_UTF8_CHAR");
+ }
+ }
+ }
+
+ // short enough? Done!
+ if (result.length() <= MAX_NAME_LENGTH)
+ return result.toString();
+
+ // too long? use SHA1
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ byte[] inputBytes = null;
+ try
+ {
+ inputBytes = s.getBytes("UTF-8");
+ }
+ catch(UnsupportedEncodingException uee)
+ {
+ // should never happen - UTF-8 is always supported
+ inputBytes = new byte[0];
+ }
+ byte[] digest = md.digest(inputBytes);
+ assert(digest.length == 20); // SHA1 160 bits == 20 bytes
+ result = new StringBuffer("URI_SHA_1_");
+ for (int j = 0; j < digest.length; j++)
+ {
+ result.append(hexdigits[(digest[j] >> 4) & 0xF]);
+ result.append(hexdigits[digest[j] & 0xF]);
+ }
+ return result.toString();
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ throw new IllegalStateException("Using in a JDK without an SHA implementation");
+ }
+ }
+
+ public static String hexsafedir(QName name)
+ {
+ if (name.getNamespaceURI() == null || name.getNamespaceURI().length() == 0)
+ return "_nons/" + hexsafe(name.getLocalPart());
+ return hexsafe(name.getNamespaceURI()) + "/" + hexsafe(name.getLocalPart());
+ }
+
+ private static Map buildWKP()
+ {
+ Map result = new HashMap();
+ result.put("http://www.w3.org/XML/1998/namespace", "xml");
+ result.put("http://www.w3.org/2001/XMLSchema", "xs");
+ result.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+ result.put("http://schemas.xmlsoap.org/wsdl/", "wsdl");
+ result.put("http://schemas.xmlsoap.org/soap/encoding/", "soapenc");
+ result.put("http://schemas.xmlsoap.org/soap/envelope/", "soapenv");
+ return Collections.unmodifiableMap(result);
+ }
+
+ public static String readable(SchemaType sType)
+ {
+ return readable(sType, WELL_KNOWN_PREFIXES);
+ }
+
+ public static String readable(SchemaType sType, Map nsPrefix)
+ {
+ if (sType.getName() != null)
+ {
+ return readable(sType.getName(), nsPrefix);
+ }
+
+ if (sType.isAttributeType())
+ {
+ return "attribute type " + readable(sType.getAttributeTypeAttributeName(), nsPrefix);
+ }
+
+ if (sType.isDocumentType())
+ {
+ return "document type " + readable(sType.getDocumentElementName(), nsPrefix);
+ }
+
+ if (sType.isNoType() || sType.getOuterType() == null)
+ {
+ return "invalid type";
+ }
+
+ SchemaType outerType = sType.getOuterType();
+ SchemaField container = sType.getContainerField();
+
+ if (outerType.isAttributeType())
+ {
+ return "type of attribute " + readable(container.getName(), nsPrefix);
+ }
+ else if (outerType.isDocumentType())
+ {
+ return "type of element " + readable(container.getName(), nsPrefix);
+ }
+
+ if (container != null)
+ {
+ if (container.isAttribute())
+ {
+ return "type of " + container.getName().getLocalPart() + " attribute in " + readable(outerType, nsPrefix);
+ }
+ else
+ {
+ return "type of " + container.getName().getLocalPart() + " element in " + readable(outerType, nsPrefix);
+ }
+ }
+
+ if (outerType.getBaseType() == sType)
+ return "base type of " + readable(outerType, nsPrefix);
+ else if (outerType.getSimpleVariety() == SchemaType.LIST)
+ return "item type of " + readable(outerType, nsPrefix);
+ else if (outerType.getSimpleVariety() == SchemaType.UNION)
+ return "member type " + sType.getAnonymousUnionMemberOrdinal() + " of " + readable(outerType, nsPrefix);
+ else
+ return "inner type in " + readable(outerType, nsPrefix);
+ }
+
+ public static String readable(QName name)
+ {
+ return readable(name, WELL_KNOWN_PREFIXES);
+ }
+
+ public static String readable(QName name, Map prefixes)
+ {
+ if (name.getNamespaceURI().length() == 0)
+ return name.getLocalPart();
+ String prefix = (String)prefixes.get(name.getNamespaceURI());
+ if (prefix != null)
+ return prefix + ":" + name.getLocalPart();
+ return name.getLocalPart() + " in namespace " + name.getNamespaceURI();
+ }
+
+ public static String suggestPrefix(String namespace)
+ {
+ String result = (String)WELL_KNOWN_PREFIXES.get(namespace);
+ if (result != null)
+ return result;
+
+ int len = namespace.length();
+ int i = namespace.lastIndexOf('/');
+ if (i > 0 && i == namespace.length() - 1)
+ {
+ len = i;
+ i = namespace.lastIndexOf('/', i - 1);
+ }
+
+ i += 1; // skip '/', also covers -1 case.
+
+ if (namespace.startsWith("www.", i))
+ {
+ i += 4; // "www.".length()
+ }
+
+ while (i < len)
+ {
+ if (XMLChar.isNCNameStart(namespace.charAt(i)))
+ break;
+ i += 1;
+ }
+
+ for (int end = i + 1; end < len; end += 1)
+ {
+ if (!XMLChar.isNCName(namespace.charAt(end)) || !Character.isLetterOrDigit(namespace.charAt(end)))
+ {
+ len = end;
+ break;
+ }
+ }
+
+ // prefixes starting with "xml" are forbidden, so change "xmls" -> "xs"
+ if (namespace.length() >= i + 3 && startsWithXml(namespace, i))
+ {
+ if (namespace.length() >= i + 4)
+ return "x" + Character.toLowerCase(namespace.charAt(i + 3));
+ return "ns";
+ }
+
+ if (len - i > 4) // four or less? leave it.
+ {
+ if (isVowel(namespace.charAt(i + 2)) && !isVowel(namespace.charAt(i + 3)))
+ len = i + 4;
+ else
+ len = i + 3; // more than four? truncate to 3.
+ }
+
+ int n;
+
+ if (len - i == 0)
+ return "ns";
+
+ return namespace.substring(i, len).toLowerCase();
+ }
+
+ private static boolean startsWithXml(String s, int i)
+ {
+ if (s.length() < i + 3)
+ return false;
+
+ if (s.charAt(i) != 'X' && s.charAt(i) != 'x')
+ return false;
+ if (s.charAt(i + 1) != 'M' && s.charAt(i + 1) != 'm')
+ return false;
+ if (s.charAt(i + 2) != 'L' && s.charAt(i + 2) != 'l')
+ return false;
+
+ return true;
+ }
+
+ private static boolean isVowel(char ch)
+ {
+ switch (ch)
+ {
+ case 'a':
+ case 'e':
+ case 'i':
+ case 'o':
+ case 'u':
+ case 'A':
+ case 'E':
+ case 'I':
+ case 'O':
+ case 'U':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public static String namespace(SchemaType sType)
+ {
+ while (sType != null)
+ {
+ if (sType.getName() != null)
+ return sType.getName().getNamespaceURI();
+ if (sType.getContainerField() != null && sType.getContainerField().getName().getNamespaceURI().length() > 0)
+ return sType.getContainerField().getName().getNamespaceURI();
+ sType = sType.getOuterType();
+ }
+ return "";
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/ReaderInputStream.java b/v1/src/common/org/apache/xmlbeans/impl/common/ReaderInputStream.java
new file mode 100644
index 0000000..275d8d6
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/ReaderInputStream.java
@@ -0,0 +1,59 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.Reader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+
+public class ReaderInputStream extends PushedInputStream
+{
+ private Reader reader;
+ private Writer writer;
+ private char[] buf;
+ public static int defaultBufferSize = 2048;
+
+ public ReaderInputStream(Reader reader, String encoding) throws UnsupportedEncodingException
+ {
+ this(reader, encoding, defaultBufferSize);
+ }
+
+ public ReaderInputStream(Reader reader, String encoding, int bufferSize) throws UnsupportedEncodingException
+ {
+ if (bufferSize <= 0)
+ throw new IllegalArgumentException("Buffer size <= 0");
+
+ this.reader = reader;
+ this.writer = new OutputStreamWriter(getOutputStream(), encoding);
+ buf = new char[bufferSize];
+ }
+
+ public void fill(int requestedBytes) throws IOException
+ {
+ do
+ {
+ int chars = reader.read(buf);
+ if (chars < 0)
+ return;
+
+ writer.write(buf, 0, chars);
+ writer.flush();
+ }
+ while (available() <= 0); // loop for safety, in case encoding didn't produce any bytes yet
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java b/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java
new file mode 100644
index 0000000..611af92
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java
@@ -0,0 +1,296 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+
+public class SniffedXmlInputStream extends BufferedInputStream
+{
+ // We don't sniff more than 192 bytes.
+ public static int MAX_SNIFFED_BYTES = 192;
+
+ public SniffedXmlInputStream(InputStream stream) throws IOException
+ {
+ super(stream);
+
+ // read byte order marks and detect EBCDIC etc
+ _encoding = sniffFourBytes();
+
+ if (_encoding != null && _encoding.equals("IBM037"))
+ {
+ // First four bytes suggest EBCDIC with <?xm at start
+ String encoding = sniffForXmlDecl(_encoding);
+ if (encoding != null)
+ _encoding = encoding;
+ }
+
+ if (_encoding == null)
+ {
+ // Haven't yet determined encoding: sniff for <?xml encoding="..."?>
+ // assuming we can read it as UTF-8.
+ _encoding = sniffForXmlDecl("UTF-8");
+ }
+
+ if (_encoding == null)
+ {
+ // The XML spec says these two things:
+
+ // (1) "In the absence of external character encoding information
+ // (such as MIME headers), parsed entities which are stored in an
+ // encoding other than UTF-8 or UTF-16 must begin with a text
+ // declaration (see 4.3.1 The Text Declaration) containing an
+ // encoding declaration:"
+
+ // (2) "In the absence of information provided by an external
+ // transport protocol (e.g. HTTP or MIME), it is an error
+ // for an entity including an encoding declaration to be
+ // presented to the XML processor in an encoding other than
+ // that named in the declaration, or for an entity which begins
+ // with neither a Byte Order Mark nor an encoding declaration
+ // to use an encoding other than UTF-8."
+
+ // Since we're using a sniffed stream, we do not have external
+ // character encoding information.
+
+ // Since we're here, we also don't have a recognized byte order
+ // mark or an explicit encoding declaration that can be read in
+ // either ASCII or EBDIC style.
+
+ // Therefore, we must use UTF-8.
+
+ _encoding = "UTF-8";
+ }
+ }
+
+ private int readAsMuchAsPossible(byte[] buf, int startAt, int len) throws IOException
+ {
+ int total = 0;
+ while (total < len)
+ {
+ int count = read(buf, startAt + total, len - total);
+ if (count < 0)
+ break;
+ total += count;
+ }
+ return total;
+ }
+
+ private String sniffFourBytes() throws IOException
+ {
+ mark(4);
+ int skip = 0;
+ try
+ {
+ byte[] buf = new byte[4];
+ if (readAsMuchAsPossible(buf, 0, 4) < 4)
+ return null;
+ long result = 0xFF000000 & (buf[0] << 24) | 0x00FF0000 & (buf[1] << 16) | 0x0000FF00 & (buf[2] << 8) | 0x000000FF & buf[3];
+
+ if (result == 0x0000FEFF)
+ return "UCS-4";
+ else if (result == 0xFFFE0000)
+ return "UCS-4";
+ else if (result == 0x0000003C)
+ return "UCS-4BE";
+ else if (result == 0x3C000000)
+ return "UCS-4LE";
+ else if (result == 0x003C003F)
+ return "UTF-16BE";
+ else if (result == 0x3C003F00)
+ return "UTF-16LE";
+ else if (result == 0x3C3F786D)
+ return null; // looks like US-ASCII with <?xml: sniff
+ else if (result == 0x4C6FA794)
+ return "IBM037"; // Sniff for ebdic codepage
+ else if ((result & 0xFFFF0000) == 0xFEFF0000)
+ return "UTF-16";
+ else if ((result & 0xFFFF0000) == 0xFFFE0000)
+ return "UTF-16";
+ else if ((result & 0xFFFFFF00) == 0xEFBBBF00)
+ return "UTF-8";
+ else return null;
+ }
+ finally
+ {
+ reset();
+ }
+ }
+
+ // BUGBUG in JDK: Charset.forName is not threadsafe, so we'll prime it
+ // with the common charsets.
+
+ private static Charset dummy1 = Charset.forName("UTF-8");
+ private static Charset dummy2 = Charset.forName("UTF-16");
+ private static Charset dummy3 = Charset.forName("UTF-16BE");
+ private static Charset dummy4 = Charset.forName("UTF-16LE");
+ private static Charset dummy5 = Charset.forName("ISO-8859-1");
+ private static Charset dummy6 = Charset.forName("US-ASCII");
+ private static Charset dummy7 = Charset.forName("Cp1252");
+
+
+ private String sniffForXmlDecl(String encoding) throws IOException
+ {
+ mark(MAX_SNIFFED_BYTES);
+ try
+ {
+ byte[] bytebuf = new byte[MAX_SNIFFED_BYTES];
+ int bytelimit = readAsMuchAsPossible(bytebuf, 0, MAX_SNIFFED_BYTES);
+
+ // BUGBUG in JDK: Charset.forName is not threadsafe.
+ Charset charset = Charset.forName(encoding);
+ Reader reader = new InputStreamReader(new ByteArrayInputStream(bytebuf, 0, bytelimit), charset);
+ char[] buf = new char[bytelimit];
+ int limit = 0;
+ while (limit < bytelimit)
+ {
+ int count = reader.read(buf, limit, bytelimit - limit);
+ if (count < 0)
+ break;
+ limit += count;
+ }
+
+ return extractXmlDeclEncoding(buf, 0, limit);
+ }
+ finally
+ {
+ reset();
+ }
+ }
+
+ private String _encoding;
+
+ public String getXmlEncoding()
+ {
+ return _encoding;
+ }
+
+ /* package */ static String extractXmlDeclEncoding(char[] buf, int offset, int size)
+ {
+ int limit = offset + size;
+ int xmlpi = firstIndexOf("<?xml", buf, offset, limit);
+ if (xmlpi >= 0)
+ {
+ int i = xmlpi + 5;
+ ScannedAttribute attr = new ScannedAttribute();
+ while (i < limit)
+ {
+ i = scanAttribute(buf, i, limit, attr);
+ if (i < 0)
+ return null;
+ if (attr.name.equals("encoding"))
+ return attr.value;
+ }
+ }
+ return null;
+ }
+
+ private static int firstIndexOf(String s, char[] buf, int startAt, int limit)
+ {
+ assert(s.length() > 0);
+ char[] lookFor = s.toCharArray();
+
+ char firstchar = lookFor[0];
+ searching: for (limit -= lookFor.length; startAt < limit; startAt++)
+ {
+ if (buf[startAt] == firstchar)
+ {
+ for (int i = 1; i < lookFor.length; i++)
+ {
+ if (buf[startAt + i] != lookFor[i])
+ {
+ continue searching;
+ }
+ }
+ return startAt;
+ }
+ }
+
+ return -1;
+ }
+
+ private static int nextNonmatchingByte(char[] lookFor, char[] buf, int startAt, int limit)
+ {
+ searching: for (; startAt < limit; startAt++)
+ {
+ int thischar = buf[startAt];
+ for (int i = 0; i < lookFor.length; i++)
+ if (thischar == lookFor[i])
+ continue searching;
+ return startAt;
+ }
+ return -1;
+ }
+
+ private static int nextMatchingByte(char[] lookFor, char[] buf, int startAt, int limit)
+ {
+ searching: for (; startAt < limit; startAt++)
+ {
+ int thischar = buf[startAt];
+ for (int i = 0; i < lookFor.length; i++)
+ if (thischar == lookFor[i])
+ return startAt;
+ }
+ return -1;
+ }
+
+ private static int nextMatchingByte(char lookFor, char[] buf, int startAt, int limit)
+ {
+ searching: for (; startAt < limit; startAt++)
+ {
+ if (buf[startAt] == lookFor)
+ return startAt;
+ }
+ return -1;
+ }
+ private static char[] WHITESPACE = new char[] { ' ', '\r', '\t', '\n' };
+ private static char[] NOTNAME = new char[] { '=', ' ', '\r', '\t', '\n', '?', '>', '<', '\'', '\"' };
+
+ private static class ScannedAttribute
+ {
+ public String name;
+ public String value;
+ }
+
+ private static int scanAttribute(char[] buf, int startAt, int limit, ScannedAttribute attr)
+ {
+ int nameStart = nextNonmatchingByte(WHITESPACE, buf, startAt, limit);
+ if (nameStart < 0)
+ return -1;
+ int nameEnd = nextMatchingByte(NOTNAME, buf, nameStart, limit);
+ if (nameEnd < 0)
+ return -1;
+ int equals = nextNonmatchingByte(WHITESPACE, buf, nameEnd, limit);
+ if (equals < 0)
+ return -1;
+ if (buf[equals] != '=')
+ return -1;
+ int valQuote = nextNonmatchingByte(WHITESPACE, buf, equals + 1, limit);
+ if (buf[valQuote] != '\'' && buf[valQuote] != '\"')
+ return -1;
+ int valEndquote = nextMatchingByte(buf[valQuote], buf, valQuote + 1, limit);
+ if (valEndquote < 0)
+ return -1;
+ attr.name = new String(buf, nameStart, nameEnd - nameStart);
+ attr.value = new String(buf, valQuote + 1, valEndquote - valQuote - 1);
+ return valEndquote + 1;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlReader.java b/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlReader.java
new file mode 100644
index 0000000..b497814
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/SniffedXmlReader.java
@@ -0,0 +1,80 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.BufferedReader;
+import java.nio.charset.Charset;
+
+public class SniffedXmlReader extends BufferedReader
+{
+ // We don't sniff more than 192 bytes.
+ public static int MAX_SNIFFED_CHARS = 192;
+
+ public SniffedXmlReader(Reader reader) throws IOException
+ {
+ super(reader);
+ _encoding = sniffForXmlDecl();
+ }
+
+ private int readAsMuchAsPossible(char[] buf, int startAt, int len) throws IOException
+ {
+ int total = 0;
+ while (total < len)
+ {
+ int count = read(buf, startAt + total, len - total);
+ if (count < 0)
+ break;
+ total += count;
+ }
+ return total;
+ }
+
+ // BUGBUG in JDK: Charset.forName is not threadsafe, so we'll prime it
+ // with the common charsets.
+
+ private static Charset dummy1 = Charset.forName("UTF-8");
+ private static Charset dummy2 = Charset.forName("UTF-16");
+ private static Charset dummy3 = Charset.forName("UTF-16BE");
+ private static Charset dummy4 = Charset.forName("UTF-16LE");
+ private static Charset dummy5 = Charset.forName("ISO-8859-1");
+ private static Charset dummy6 = Charset.forName("US-ASCII");
+ private static Charset dummy7 = Charset.forName("Cp1252");
+
+
+ private String sniffForXmlDecl() throws IOException
+ {
+ mark(MAX_SNIFFED_CHARS);
+ try
+ {
+ char[] buf = new char[MAX_SNIFFED_CHARS];
+ int limit = readAsMuchAsPossible(buf, 0, MAX_SNIFFED_CHARS);
+ return SniffedXmlInputStream.extractXmlDeclEncoding(buf, 0, limit);
+ }
+ finally
+ {
+ reset();
+ }
+ }
+
+ private String _encoding;
+
+ public String getXmlEncoding()
+ {
+ return _encoding;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/ValidationContext.java b/v1/src/common/org/apache/xmlbeans/impl/common/ValidationContext.java
new file mode 100644
index 0000000..9c3d067
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/ValidationContext.java
@@ -0,0 +1,21 @@
+/* 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.xmlbeans.impl.common;
+
+public interface ValidationContext
+{
+ public void invalid ( String message );
+}
\ No newline at end of file
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/ValidatorListener.java b/v1/src/common/org/apache/xmlbeans/impl/common/ValidatorListener.java
new file mode 100644
index 0000000..86a3e50
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/ValidatorListener.java
@@ -0,0 +1,58 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.XmlCursor;
+import javax.xml.namespace.QName;
+
+/**
+ * First event must be a BEGIN with no name (to communicate any xsi
+ * information). BEGIN and END need to match.
+ */
+
+public interface ValidatorListener
+{
+ public static final int BEGIN = 1; // Begin element
+ public static final int END = 2; // End element
+ public static final int TEXT = 3; // Text
+ public static final int ATTR = 4; // Attr (non-namespaces, non xsi only)
+ public static final int ENDATTRS = 5; // after BEGIN, after attrs
+
+ void nextEvent ( int kind, Event event );
+
+ public static interface Event extends PrefixResolver
+ {
+ public static final int PRESERVE = 1;
+ public static final int REPLACE = 2;
+ public static final int COLLAPSE = 3;
+
+ XmlCursor getLocationAsCursor ( );
+
+ boolean getXsiType ( Chars chars ); // BEGIN xsi:type
+ boolean getXsiNil ( Chars chars ); // BEGIN xsi:nil
+ boolean getXsiLoc ( Chars chars ); // BEGIN xsi:schemaLocation
+ boolean getXsiNoLoc ( Chars chars ); // BEGIN xsi:noNamespaceSchemaLocation
+
+ // On START and ATTR
+ QName getName ( );
+
+ // On TEXT and ATTR
+ void getText ( Chars chars );
+ void getText ( Chars chars, int wsr );
+
+ boolean textIsWhitespace ( );
+ }
+}
\ No newline at end of file
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XBeanDebug.java b/v1/src/common/org/apache/xmlbeans/impl/common/XBeanDebug.java
new file mode 100644
index 0000000..d2467a0
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XBeanDebug.java
@@ -0,0 +1,117 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class XBeanDebug
+{
+ public static final int TRACE_SCHEMA_LOADING = 0x0001;
+ public static final String traceProp = "org.apache.xmlbeans.impl.debug";
+ public static final String defaultProp = ""; // "TRACE_SCHEMA_LOADING";
+
+ private static int _enabled = initializeBitsFromProperty();
+ private static int _indent = 0;
+ private static String _indentspace = " ";
+
+ private static int initializeBitsFromProperty()
+ {
+ int bits = 0;
+ String prop = System.getProperty(traceProp, defaultProp);
+ if (prop.indexOf("TRACE_SCHEMA_LOADING") >= 0)
+ bits |= TRACE_SCHEMA_LOADING;
+ return bits;
+ }
+ public static void enable(int bits)
+ {
+ _enabled = _enabled | bits;
+ }
+
+ public static void disable(int bits)
+ {
+ _enabled = _enabled & ~bits;
+ }
+
+ public static void trace(int bits, String message, int indent)
+ {
+ if (test(bits))
+ {
+ synchronized (XBeanDebug.class)
+ {
+ if (indent < 0)
+ _indent += indent;
+
+ String spaces = _indent < 0 ? "" : _indent > _indentspace.length() ? _indentspace : _indentspace.substring(0, _indent);
+ String logmessage = Thread.currentThread().getName() + ": " + spaces + message + "\n";
+ System.err.print(logmessage);
+
+ if (indent > 0)
+ _indent += indent;
+ }
+ }
+ }
+
+ public static boolean test(int bits)
+ {
+ return (_enabled & bits) != 0;
+ }
+
+ static PrintStream _err;
+
+ public static String log(String message)
+ {
+ log(message, null);
+ return message;
+ }
+
+ public static String logStackTrace(String message)
+ {
+ log(message, new Throwable());
+ return message;
+ }
+
+ private synchronized static String log(String message, Throwable stackTrace)
+ {
+ if (_err == null)
+ {
+ try
+ {
+ File diagnosticFile = File.createTempFile("xmlbeandebug", ".log");
+ _err = new PrintStream(new FileOutputStream(diagnosticFile));
+ System.err.println("Diagnostic XML Bean debug log file created: " + diagnosticFile);
+ }
+ catch (IOException e)
+ {
+ _err = System.err;
+ }
+ }
+ _err.println(message);
+ if (stackTrace != null)
+ {
+ stackTrace.printStackTrace(_err);
+ }
+ return message;
+ }
+
+ public static Throwable logException(Throwable t)
+ {
+ log(t.getMessage(), t);
+ return t;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XMLChar.java b/v1/src/common/org/apache/xmlbeans/impl/common/XMLChar.java
new file mode 100644
index 0000000..745acb3
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XMLChar.java
@@ -0,0 +1,650 @@
+/* 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.xmlbeans.impl.common;
+
+/**
+ * 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.
+ *
+ * @author Glenn Marcy, IBM
+ * @author Andy Clark, IBM
+ * @author Eric Ye, IBM
+ * @author Arnaud Le Hors, IBM
+ * @author Rahul Srivastava, Sun Microsystems Inc.
+ *
+ * @version $Id$
+ */
+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 '<' and '&'.
+ * 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 '<', '&', 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) == false)
+ return false;
+ for (int i = 1; i < name.length(); i++ ) {
+ ch = name.charAt(i);
+ if( isName( ch ) == false ){
+ 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 name 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) == false)
+ return false;
+ for (int i = 1; i < ncName.length(); i++ ) {
+ ch = ncName.charAt(i);
+ if( isNCName( ch ) == false ){
+ 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/v1/src/common/org/apache/xmlbeans/impl/common/XMLNameHelper.java b/v1/src/common/org/apache/xmlbeans/impl/common/XMLNameHelper.java
new file mode 100644
index 0000000..68f68d1
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XMLNameHelper.java
@@ -0,0 +1,116 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.xml.stream.XMLName;
+import javax.xml.namespace.QName;
+import java.io.UnsupportedEncodingException;
+
+public class XMLNameHelper
+{
+ public static QName getQName(XMLName xmlName)
+ {
+ if (xmlName == null)
+ return null;
+
+ return QNameHelper.forLNS( xmlName.getLocalName(), xmlName.getNamespaceUri() );
+ }
+
+ public static XMLName forLNS(String localname, String uri)
+ {
+ if (uri == null)
+ uri = "";
+ return new XmlNameImpl(uri, localname);
+ }
+
+ public static XMLName forLN(String localname)
+ {
+ return new XmlNameImpl("", localname);
+ }
+
+ public static XMLName forPretty(String pretty, int offset)
+ {
+ int at = pretty.indexOf('@', offset);
+ if (at < 0)
+ return new XmlNameImpl("", pretty.substring(offset));
+ return new XmlNameImpl(pretty.substring(at + 1), pretty.substring(offset, at));
+ }
+
+ public static String pretty(XMLName name)
+ {
+ if (name == null)
+ return "null";
+
+ if (name.getNamespaceUri() == null || name.getNamespaceUri().length() == 0)
+ return name.getLocalName();
+
+ return name.getLocalName() + "@" + name.getNamespaceUri();
+ }
+
+ private static final char[] hexdigits = new char[]
+ {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+
+ private static boolean isSafe(int c)
+ {
+ if (c >= 'a' && c <= 'z')
+ return true;
+ if (c >= 'A' && c <= 'Z')
+ return true;
+ if (c >= '0' && c <= '9')
+ return true;
+ return false;
+ }
+
+ public static String hexsafe(String s)
+ {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < s.length(); i++)
+ {
+ char ch = s.charAt(i);
+ if (isSafe(ch))
+ {
+ result.append(ch);
+ }
+ else
+ {
+ byte[] utf8 = null;
+ try
+ {
+ utf8 = s.substring(i, i + 1).getBytes("UTF-8");
+ for (int j = 0; j < utf8.length; j++)
+ {
+ result.append('_');
+ result.append(hexdigits[(utf8[j] >> 4) & 0xF]);
+ result.append(hexdigits[utf8[j] & 0xF]);
+ }
+ }
+ catch(UnsupportedEncodingException uee)
+ {
+ // should never happen - UTF-8 is always supported
+ result.append("_BAD_UTF8_CHAR");
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ public static String hexsafedir(XMLName name)
+ {
+ if (name.getNamespaceUri() == null || name.getNamespaceUri().length() == 0)
+ return "_nons/" + hexsafe(name.getLocalName());
+ return hexsafe(name.getNamespaceUri()) + "/" + hexsafe(name.getLocalName());
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XPath.java b/v1/src/common/org/apache/xmlbeans/impl/common/XPath.java
new file mode 100644
index 0000000..dd7a538
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XPath.java
@@ -0,0 +1,1000 @@
+/* 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.xmlbeans.impl.common;
+
+import javax.xml.namespace.QName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.common.XMLChar;
+
+public class XPath
+{
+ public static class XPathCompileException extends XmlException
+ {
+ XPathCompileException ( XmlError err )
+ {
+ super( err.toString(), null, err );
+ }
+ }
+
+ //
+ //
+ //
+
+ public static class ExecutionContext
+ {
+ public ExecutionContext ( )
+ {
+ _stack = new ArrayList();
+ }
+
+ public static final int HIT = 0x1;
+ public static final int DESCEND = 0x2;
+ public static final int ATTRS = 0x4;
+
+ public final void init ( XPath xpath )
+ {
+ if (_xpath != xpath)
+ {
+ _xpath = xpath;
+
+ _paths = new PathContext [ xpath._selector._paths.length ];
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ _paths[ i ] = new PathContext();
+ }
+
+ _stack.clear();
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ _paths[ i ].init( xpath._selector._paths[ i ] );
+ }
+
+ public final int start ( )
+ {
+ int result = 0;
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ result |= _paths[ i ].start();
+
+ return result;
+ }
+
+ public final int element ( QName name )
+ {
+ assert name != null;
+
+ _stack.add( name );
+
+ int result = 0;
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ result |= _paths[ i ].element( name );
+
+ return result;
+ }
+
+ public final boolean attr ( QName name )
+ {
+ boolean hit = false;
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ hit = hit | _paths[ i ].attr( name );
+
+ return hit;
+ }
+
+ public final void end ( )
+ {
+ _stack.remove( _stack.size() - 1 );
+
+ for ( int i = 0 ; i < _paths.length ; i++ )
+ _paths[ i ].end();
+ }
+
+ private final class PathContext
+ {
+ PathContext ( )
+ {
+ _prev = new ArrayList();
+ }
+
+ void init ( Step steps )
+ {
+ _curr = steps;
+ _prev.clear();
+ }
+
+ private QName top ( int i )
+ {
+ return (QName) ExecutionContext.this._stack.get( _stack.size() - 1 - i );
+ }
+
+ private void backtrack ( )
+ {
+ assert _curr != null;
+
+ if (_curr._hasBacktrack)
+ {
+ _curr = _curr._backtrack;
+ return;
+ }
+
+ assert !_curr._deep;
+
+ _curr = _curr._prev;
+
+ search: for ( ; !_curr._deep ; _curr = _curr._prev )
+ {
+ int t = 0;
+
+ for ( Step s = _curr ; !s._deep ; s = s._prev )
+ {
+ if (!s.match( top( t++ )))
+ continue search;
+ }
+
+ break;
+ }
+ }
+
+ int start ( )
+ {
+ assert _curr != null;
+ assert _curr._prev == null;
+
+ if (_curr._name != null)
+ return _curr._flags;
+
+ // If the steps consist on only a terminator, then the path can
+ // only be '.'. In this case, we get a hit, but there is
+ // nothing else to match. No need to backtrack.
+
+ _curr = null;
+
+ return HIT;
+ }
+
+ int element ( QName name )
+ {
+ _prev.add( _curr );
+
+ if (_curr == null)
+ return 0;
+
+ assert _curr._name != null;
+
+ if (!_curr._attr && _curr.match( name ))
+ {
+ if ((_curr = _curr._next)._name != null)
+ return _curr._flags;
+
+ backtrack();
+
+ return _curr == null ? HIT : HIT | _curr._flags;
+ }
+
+ for ( ; ; )
+ {
+ backtrack();
+
+ if (_curr == null)
+ return 0;
+
+ if (_curr.match( name ))
+ {
+ _curr = _curr._next;
+ break;
+ }
+
+ if (_curr._deep)
+ break;
+ }
+
+ return _curr._flags;
+ }
+
+ boolean attr ( QName name )
+ {
+ return _curr != null && _curr._attr && _curr.match( name );
+ }
+
+ void end ( )
+ {
+ _curr = (Step) _prev.remove( _prev.size() - 1 );
+ }
+
+ private Step _curr;
+ private List _prev;
+ }
+
+ private XPath _xpath;
+ private ArrayList _stack;
+ private PathContext[] _paths;
+ }
+
+ //
+ //
+ //
+
+ public static XPath compileXPath ( String xpath )
+ throws XPathCompileException
+ {
+ return compileXPath( xpath, "$this", null );
+ }
+
+ public static XPath compileXPath ( String xpath, String currentNodeVar )
+ throws XPathCompileException
+ {
+ return compileXPath( xpath, currentNodeVar, null );
+ }
+
+ public static XPath compileXPath ( String xpath, Map namespaces )
+ throws XPathCompileException
+ {
+ return compileXPath( xpath, "$this", namespaces );
+ }
+
+ public static XPath compileXPath (
+ String xpath, String currentNodeVar, Map namespaces )
+ throws XPathCompileException
+ {
+ return
+ new CompilationContext( namespaces, currentNodeVar ).
+ compile( xpath );
+ }
+
+ private static class CompilationContext
+ {
+ CompilationContext ( Map namespaces, String currentNodeVar )
+ {
+ assert
+ _currentNodeVar == null ||
+ _currentNodeVar.startsWith( "$" );
+
+ if (currentNodeVar == null)
+ _currentNodeVar = "$this";
+ else
+ _currentNodeVar = currentNodeVar;
+
+ _namespaces = new HashMap();
+
+ _externalNamespaces =
+ namespaces == null ? new HashMap() : namespaces;
+ }
+
+ XPath compile ( String expr ) throws XPathCompileException
+ {
+ _offset = 0;
+ _line = 1;
+ _column = 1;
+ _expr = expr;
+
+ return tokenizeXPath();
+ }
+
+ int currChar ( )
+ {
+ return currChar( 0 );
+ }
+
+ int currChar ( int offset )
+ {
+ return
+ _offset + offset >= _expr.length()
+ ? -1
+ : _expr.charAt( _offset + offset );
+ }
+
+ void advance ( )
+ {
+ if (_offset < _expr.length())
+ {
+ char ch = _expr.charAt( _offset );
+
+ _offset++;
+ _column++;
+
+ if (ch == '\r' || ch == '\n')
+ {
+ _line++;
+ _column = 1;
+
+ if (_offset + 1 < _expr.length())
+ {
+ char nextCh = _expr.charAt( _offset + 1 );
+
+ if ((nextCh == '\r' || nextCh == '\n') && ch != nextCh)
+ _offset++;
+ }
+ }
+ }
+ }
+
+ void advance ( int count )
+ {
+ assert count >= 0;
+
+ while ( count-- > 0 )
+ advance();
+ }
+
+ boolean isWhitespace ( )
+ {
+ return isWhitespace( 0 );
+ }
+
+ boolean isWhitespace ( int offset )
+ {
+ int ch = currChar( offset );
+ return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
+ }
+
+ boolean isNCNameStart ( )
+ {
+ return
+ currChar() == -1
+ ? false :
+ XMLChar.isNCNameStart( currChar() );
+ }
+
+ boolean isNCName ( )
+ {
+ return
+ currChar() == -1
+ ? false :
+ XMLChar.isNCName( currChar() );
+ }
+
+ boolean startsWith ( String s )
+ {
+ return startsWith( s, 0 );
+ }
+
+ boolean startsWith ( String s, int offset )
+ {
+ if (_offset + offset >= _expr.length())
+ return false;
+
+ return _expr.startsWith( s, _offset + offset );
+ }
+
+ private XPathCompileException newError ( String msg )
+ {
+ XmlError err =
+ XmlError.forLocation(
+ msg, XmlError.SEVERITY_ERROR, null,
+ _line, _column, _offset );
+
+ return new XPathCompileException( err );
+ }
+
+ String lookupPrefix ( String prefix ) throws XPathCompileException
+ {
+ if (_namespaces.containsKey( prefix ))
+ return (String) _namespaces.get( prefix );
+
+ if (_externalNamespaces.containsKey( prefix ))
+ return (String) _externalNamespaces.get( prefix );
+
+ if (prefix.equals( "xml" ))
+ return "http://www.w3.org/XML/1998/namespace";
+
+ if (prefix.equals( "xs" ))
+ return "http://www.w3.org/2001/XMLSchema";
+
+ if (prefix.equals( "xsi" ))
+ return "http://www.w3.org/2001/XMLSchema-instance";
+
+ if (prefix.equals( "fn" ))
+ return "http://www.w3.org/2002/11/xquery-functions";
+
+ throw newError( "Undefined prefix: " + prefix );
+ }
+
+ private boolean parseWhitespace ( ) throws XPathCompileException
+ {
+ boolean sawSpace = false;
+
+ while ( isWhitespace() )
+ {
+ advance();
+ sawSpace = true;
+ }
+
+ return sawSpace;
+ }
+
+ //
+ // Tokenizing will consume whitespace followed by the tokens, separated
+ // by whitespace. The whitespace following the last token is not
+ // consumed.
+ //
+
+ private boolean tokenize ( String s )
+ {
+ assert s.length() > 0;
+
+ int offset = 0;
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s, offset ))
+ return false;
+
+ offset += s.length();
+
+ advance( offset );
+
+ return true;
+ }
+
+ private boolean tokenize ( String s1, String s2 )
+ {
+ assert s1.length() > 0;
+ assert s2.length() > 0;
+
+ int offset = 0;
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s1, offset ))
+ return false;
+
+ offset += s1.length();
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s2, offset ))
+ return false;
+
+ offset += s2.length();
+
+ advance( offset );
+
+ return true;
+ }
+
+ private boolean tokenize ( String s1, String s2, String s3 )
+ {
+ assert s1.length() > 0;
+ assert s2.length() > 0;
+ assert s3.length() > 0;
+
+ int offset = 0;
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s1, offset ))
+ return false;
+
+ offset += s1.length();
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s2, offset ))
+ return false;
+
+ offset += s2.length();
+
+ while ( isWhitespace( offset ) )
+ offset++;
+
+ if (!startsWith( s3, offset ))
+ return false;
+
+ offset += s3.length();
+
+ advance( offset );
+
+ return true;
+ }
+
+ private String tokenizeNCName ( ) throws XPathCompileException
+ {
+ parseWhitespace();
+
+ if (!isNCNameStart())
+ throw newError( "Expected non-colonized name" );
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( (char) currChar() );
+
+ for ( advance() ; isNCName() ; advance() )
+ sb.append( (char) currChar() );
+
+ return sb.toString();
+ }
+
+ private QName getAnyQName ( )
+ {
+ return new QName( "", "" );
+ }
+
+ private QName tokenizeQName ( ) throws XPathCompileException
+ {
+ if (tokenize( "*" ))
+ return getAnyQName();
+
+ String ncName = tokenizeNCName();
+
+ if (!tokenize( ":" ))
+ return new QName( lookupPrefix( "" ), ncName );
+
+ return
+ new QName(
+ lookupPrefix( ncName ),
+ tokenize( "*" ) ? "" : tokenizeNCName() );
+ }
+
+ private String tokenizeQuotedUri ( ) throws XPathCompileException
+ {
+ char quote;
+
+ if (tokenize( "\"" ))
+ quote = '"';
+ else if (tokenize( "'" ))
+ quote = '\'';
+ else
+ throw newError( "Expected quote (\" or ')" );
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( ; ; )
+ {
+ if (currChar() == -1)
+ throw newError( "Path terminated in URI literal" );
+
+ if (currChar() == quote)
+ {
+ advance();
+
+ if (currChar() != quote)
+ break;
+ }
+
+ sb.append( (char) currChar() );
+
+ advance();
+ }
+
+ return sb.toString();
+ }
+
+ private Step addStep ( boolean deep, boolean attr, QName name, Step steps )
+ {
+ Step step = new Step( deep, attr, name );
+
+ if (steps == null)
+ return step;
+
+ Step s = steps;
+
+ while ( steps._next != null )
+ steps = steps._next;
+
+ steps._next = step;
+ step._prev = steps;
+
+ return s;
+ }
+
+ private Step tokenizeSteps ( ) throws XPathCompileException
+ {
+ if (tokenize( "/" ))
+ throw newError( "Absolute paths unsupported" );
+
+ boolean deep;
+
+ if (tokenize( "$", _currentNodeVar, "//" ) || tokenize( ".", "//" ))
+ deep = true;
+ else if (tokenize( "$", _currentNodeVar, "/" ) || tokenize( ".", "/" ))
+ deep = false;
+ else if (tokenize( "$", _currentNodeVar ) || tokenize( "." ))
+ return addStep( false, false, null, null );
+ else
+ deep = false;
+
+ Step steps = null;
+
+ // Compile the steps removing /. and mergind //. with the next step
+
+ boolean deepDot = false;
+
+ for ( ; ; )
+ {
+ if (tokenize( "attribute", "::" ) || tokenize( "@" ))
+ {
+ steps = addStep( deep, true, tokenizeQName(), steps );
+ break;
+ }
+
+ QName name;
+
+ if (tokenize( "." ))
+ deepDot = deepDot || deep;
+ else if (tokenize( "child", "::" ) && (name = tokenizeQName()) != null)
+ steps = addStep( deep, false, name, steps );
+ else if ((name = tokenizeQName()) != null)
+ steps = addStep( deep, false, name, steps );
+
+ if (tokenize( "//" ))
+ {
+ deep = true;
+ deepDot = false;
+ }
+ else if (tokenize( "/" ))
+ {
+ if (deepDot)
+ deep = true;
+ }
+ else
+ break;
+ }
+
+ // If there was a //. at the end of th path, then we need to make
+ // two paths, one with * at the end and another with @* at the end.
+
+ if ((_lastDeepDot = deepDot))
+ {
+ _lastDeepDot = true;
+ steps = addStep( true, false, getAnyQName(), steps );
+ }
+
+ // Add sentinal step (_name == null)
+
+ return addStep( false, false, null, steps );
+ }
+
+ private void computeBacktrack ( Step steps )
+ throws XPathCompileException
+ {
+ //
+ // Compute static backtrack information
+ //
+ // Note that I use the fact that _hasBacktrack is initialized to
+ // false and _backtrack to null in the following code.
+ //
+
+ Step s, t;
+
+ for ( s = steps ; s != null ; s = t )
+ {
+ // Compute the segment from [ s, t )
+
+ for ( t = s._next ; t != null && !t._deep ; )
+ t = t._next;
+
+ // If the segment is NOT rooted at //, then the backtrack is
+ // null for the entire segment, including possible attr and/or
+ // sentinal
+
+ if (!s._deep)
+ {
+ for ( Step u = s ; u != t ; u = u._next )
+ u._hasBacktrack = true;
+
+ continue;
+ }
+
+ // Compute the sequence [ s, u ) of length n which contain no
+ // wild steps.
+
+ int n = 0;
+ Step u = s;
+
+ while ( u != t && u._name != null && !u.isWild() && !u._attr )
+ {
+ n++;
+ u = u._next;
+ }
+
+ // Now, apply KMP to [ s, u ) for fast backtracking
+
+ QName [] pattern = new QName [ n + 1 ];
+ int [] kmp = new int [ n + 1 ];
+
+ Step v = s;
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ pattern[ i ] = v._name;
+ v = v._next;
+ }
+
+ pattern[ n ] = getAnyQName();
+
+ int i = 0;
+ int j = kmp[ 0 ] = -1;
+
+ while ( i < n )
+ {
+ while ( j > -1 && !pattern[ i ].equals( pattern[ j ] ) )
+ j = kmp[ j ];
+
+ if (pattern[ ++i ].equals( pattern[ ++j ] ))
+ kmp[ i ] = kmp[ j ];
+ else
+ kmp[ i ] = j;
+ }
+
+ i = 0;
+
+ for ( v = s ; v != u ; v = v._next )
+ {
+ v._hasBacktrack = true;
+ v._backtrack = s;
+
+ for ( j = kmp[ i ] ; j > 0 ; j-- )
+ v._backtrack = v._backtrack._next;
+
+ i++;
+ }
+
+ // Compute the success backtrack and stuff it into an attr and
+ // sentinal if they exist for this segment
+
+ v = s;
+
+ if (n > 1)
+ {
+ for ( j = kmp[ n - 1 ] ; j > 0 ; j-- )
+ v = v._next;
+ }
+
+ if (u != t && u._attr)
+ {
+ u._hasBacktrack = true;
+ u._backtrack = v;
+ u = u._next;
+ }
+
+ if (u != t && u._name == null)
+ {
+ u._hasBacktrack = true;
+ u._backtrack = v;
+ }
+
+ // The first part of a deep segment always backtracks to itself
+
+ assert s._deep;
+
+ s._hasBacktrack = true;
+ s._backtrack = s;
+ }
+ }
+
+ private void tokenizePath ( ArrayList paths )
+ throws XPathCompileException
+ {
+ _lastDeepDot = false;
+
+ Step steps = tokenizeSteps();
+
+ computeBacktrack( steps );
+
+ paths.add( steps );
+
+ // If the last path ended in //., that path will match all
+ // elements, here I make a path which matches all attributes.
+
+ if (_lastDeepDot)
+ {
+ _sawDeepDot = true;
+
+ Step s = null;
+
+ for ( Step t = steps ; t != null ; t = t._next )
+ {
+ if (t._next != null && t._next._next == null)
+ s = addStep( t._deep, true, t._name, s );
+ else
+ s = addStep( t._deep, t._attr, t._name, s );
+ }
+
+ computeBacktrack( s );
+
+ paths.add( s );
+ }
+ }
+
+ private Selector tokenizeSelector ( ) throws XPathCompileException
+ {
+ ArrayList paths = new ArrayList();
+
+ tokenizePath( paths );
+
+ while ( tokenize( "|" ) )
+ tokenizePath( paths );
+
+ return new Selector( (Step[]) paths.toArray( new Step [ paths.size() ] ) );
+ }
+
+ private XPath tokenizeXPath ( ) throws XPathCompileException
+ {
+ for ( ; ; )
+ {
+ if (tokenize( "declare", "namespace" ))
+ {
+ if (!parseWhitespace())
+ throw newError( "Expected prefix after 'declare namespace'" );
+
+ String prefix = tokenizeNCName();
+
+ if (!tokenize( "=" ))
+ throw newError( "Expected '='" );
+
+ String uri = tokenizeQuotedUri();
+
+ if (_namespaces.containsKey( prefix ))
+ {
+ throw newError(
+ "Redefinition of namespace prefix: " + prefix );
+ }
+
+ _namespaces.put( prefix, uri );
+
+ continue;
+ }
+
+ if (tokenize( "default", "element", "namespace" ))
+ {
+ if (!tokenize( "=" ))
+ throw newError( "Expected '='" );
+
+ String uri = tokenizeQuotedUri();
+
+ if (_namespaces.containsKey( "" ))
+ {
+ throw newError(
+ "Redefinition of default element namespace" );
+ }
+
+ _namespaces.put( "", uri );
+
+ continue;
+ }
+
+ break;
+ }
+
+ // Add the default prefix mapping if it has not been redefined
+
+ if (!_namespaces.containsKey( "" ))
+ _namespaces.put( "", "" );
+
+ Selector selector = tokenizeSelector();
+
+ parseWhitespace();
+
+ if (currChar() != -1)
+ {
+ throw newError(
+ "Unexpected char '" + (char) currChar() + "'" );
+ }
+
+ return new XPath( selector, _sawDeepDot );
+ }
+
+ private String _expr;
+
+ private boolean _sawDeepDot; // Saw one overall
+ private boolean _lastDeepDot;
+
+ private String _currentNodeVar;
+
+ private Map _namespaces;
+ private Map _externalNamespaces;
+
+ private int _offset;
+ private int _line;
+ private int _column;
+ }
+
+ private static final class Step
+ {
+ Step ( boolean deep, boolean attr, QName name )
+ {
+ _name = name;
+
+ _deep = deep;
+ _attr = attr;
+
+ int flags = 0;
+
+ if (_deep || !_attr)
+ flags |= ExecutionContext.DESCEND;
+
+ if (_attr)
+ flags |= ExecutionContext.ATTRS;
+
+ _flags = flags;
+ }
+
+ boolean isWild ( )
+ {
+ return _name.getLocalPart().length() == 0;
+ }
+
+ boolean match ( QName name )
+ {
+ String local = _name.getLocalPart();
+
+ if (local.length() == 0)
+ {
+ String uri = _name.getNamespaceURI();
+
+ if (uri.length() == 0)
+ return true;
+
+ return uri.equals( name.getNamespaceURI() );
+ }
+
+ return _name.equals( name );
+ }
+
+ final boolean _attr;
+ final boolean _deep;
+
+ int _flags;
+
+ final QName _name;
+
+ Step _next, _prev;
+
+ boolean _hasBacktrack;
+ Step _backtrack;
+ }
+
+ private static final class Selector
+ {
+ Selector ( Step[] paths )
+ {
+ _paths = paths;
+ }
+
+ final Step[] _paths;
+ }
+
+ //
+ //
+ //
+
+ private XPath ( Selector selector, boolean sawDeepDot )
+ {
+ _selector = selector;
+ _sawDeepDot = sawDeepDot;
+ }
+
+ public boolean sawDeepDot ( )
+ {
+ return _sawDeepDot;
+ }
+
+ private final Selector _selector;
+ private final boolean _sawDeepDot;
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlEncodingSniffer.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlEncodingSniffer.java
new file mode 100644
index 0000000..614bbfe
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlEncodingSniffer.java
@@ -0,0 +1,164 @@
+/* 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.xmlbeans.impl.common;
+
+import java.io.Reader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+
+public class XmlEncodingSniffer
+{
+ private String _xmlencoding;
+ private String _javaencoding;
+ private InputStream _stream;
+ private Reader _reader;
+
+ /**
+ * Sniffs the given XML stream for encoding information.
+ *
+ * After a sniffer is constructed, it can return either a stream
+ * (which is a buffered stream wrapper of the original) or a reader
+ * (which applies the proper encoding).
+ *
+ * @param stream The stream to sniff
+ * @param encodingOverride The XML (IANA) name for the overriding encoding
+ * @throws IOException
+ * @throws UnsupportedEncodingException
+ */
+ public XmlEncodingSniffer(InputStream stream, String encodingOverride)
+ throws IOException, UnsupportedEncodingException
+ {
+ _stream = stream;
+
+ if (encodingOverride != null)
+ _xmlencoding = EncodingMap.getJava2IANAMapping(encodingOverride);
+
+ if (_xmlencoding == null)
+ _xmlencoding = encodingOverride;
+
+ if (_xmlencoding == null)
+ {
+ SniffedXmlInputStream sniffed = new SniffedXmlInputStream(_stream);
+ _xmlencoding = sniffed.getXmlEncoding();
+ assert(_xmlencoding != null);
+ _stream = sniffed;
+ }
+
+ _javaencoding = EncodingMap.getIANA2JavaMapping(_xmlencoding);
+
+ // we allow you to use Java's encoding names in XML even though you're
+ // not supposed to.
+
+ if (_javaencoding == null)
+ _javaencoding = _xmlencoding;
+ }
+
+ /**
+ * Sniffs the given XML stream for encoding information.
+ *
+ * After a sniffer is constructed, it can return either a reader
+ * (which is a buffered stream wrapper of the original) or a stream
+ * (which applies the proper encoding).
+ *
+ * @param reader The reader to sniff
+ * @param encodingDefault The Java name for the default encoding to apply, UTF-8 if null.
+ * @throws IOException
+ * @throws UnsupportedEncodingException
+ */
+ public XmlEncodingSniffer(Reader reader, String encodingDefault)
+ throws IOException, UnsupportedEncodingException
+ {
+ if (encodingDefault == null)
+ encodingDefault = "UTF-8";
+
+ SniffedXmlReader sniffedReader = new SniffedXmlReader(reader);
+ _reader = sniffedReader;
+ _xmlencoding = sniffedReader.getXmlEncoding();
+
+ if (_xmlencoding == null)
+ {
+ _xmlencoding = EncodingMap.getJava2IANAMapping(encodingDefault);
+ if (_xmlencoding != null)
+ _javaencoding = encodingDefault;
+ else
+ _xmlencoding = encodingDefault;
+ }
+
+ if (_xmlencoding == null)
+ _xmlencoding = "UTF-8";
+
+ // we allow you to use Java's encoding names in XML even though you're
+ // not supposed to.
+
+ _javaencoding = EncodingMap.getIANA2JavaMapping(_xmlencoding);
+
+ if (_javaencoding == null)
+ _javaencoding = _xmlencoding;
+ }
+
+ public String getXmlEncoding()
+ {
+ return _xmlencoding;
+ }
+
+ public String getJavaEncoding()
+ {
+ return _javaencoding;
+ }
+
+ public InputStream getStream()
+ throws UnsupportedEncodingException
+ {
+ if (_stream != null)
+ {
+ InputStream is = _stream;
+ _stream = null;
+ return is;
+ }
+
+ if (_reader != null)
+ {
+ InputStream is = new ReaderInputStream( _reader, _javaencoding );
+ _reader = null;
+ return is;
+ }
+
+ return null;
+ }
+
+
+ public Reader getReader ( )
+ throws UnsupportedEncodingException
+ {
+ if (_reader != null)
+ {
+ Reader reader = _reader;
+ _reader = null;
+ return reader;
+ }
+
+ if (_stream != null)
+ {
+ Reader reader = new InputStreamReader( _stream, _javaencoding );
+ _stream = null;
+ return reader;
+ }
+
+ return null;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorContext.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorContext.java
new file mode 100644
index 0000000..c663702
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorContext.java
@@ -0,0 +1,80 @@
+/* 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.xmlbeans.impl.common;
+
+public abstract class XmlErrorContext
+{
+ public static final int CANNOT_LOAD_XSD_FILE = 1;
+ public static final int CANNOT_LOAD_XSD_CONFIG_FILE = 2;
+ public static final int NO_SCHEMA_ELEMENT = 3;
+ public static final int MISMATCHED_TARGET_NAMESPACE = 4;
+ public static final int GLOBAL_TYPE_MISSING_NAME = 5;
+ public static final int TYPE_NOT_FOUND = 6;
+ public static final int REDUNDANT_NESTED_TYPE = 7;
+ public static final int ELEMENT_MISSING_NAME = 8;
+ public static final int REDUNDANT_DEFAULT_FIXED = 9;
+ public static final int MODEL_GROUP_MISSING_NAME = 10;
+ public static final int ATTRIBUTE_MISSING_NAME = 11;
+ public static final int ATTRIBUTE_GROUP_MISSING_NAME = 12;
+ public static final int CYCLIC_DEPENDENCY = 13;
+ public static final int UNION_MEMBER_NOT_SIMPLE = 14;
+ public static final int RESTRICTION_REDUNDANT_BASE = 15;
+ public static final int RESTRICTION_MISSING_BASE = 16;
+ public static final int SIMPLE_RESTRICTION_NOT_SIMPLE = 17;
+ public static final int FACET_DOES_NOT_APPLY = 18;
+ public static final int FACET_DUPLICATED = 19;
+ public static final int FACET_VALUE_MALFORMED = 20;
+ public static final int FACET_FIXED = 21;
+ public static final int MALFORMED_NUMBER = 21;
+ public static final int LIST_MISSING_ITEM = 22;
+ public static final int LIST_ITEM_NOT_SIMPLE = 23;
+ public static final int LIST_OF_LIST = 24;
+ public static final int LIST_WHITESPACE = 25;
+ public static final int REDUNDANT_CONTENT_MODEL = 26;
+ public static final int MISSING_RESTRICTION_OR_EXTENSION = 27;
+ public static final int MISSING_BASE = 28;
+ public static final int ELEMENT_REF_NOT_FOUND = 29;
+ public static final int ELEMENT_EXTRA_REF = 30;
+ public static final int ALL_CONTENTS = 31;
+ public static final int EXPLICIT_GROUP_NEEDED = 32;
+ public static final int GROUP_MISSING_REF = 33;
+ public static final int MODEL_GROUP_NOT_FOUND = 34;
+ public static final int MIN_MAX_OCCURS = 35;
+ public static final int ATTRIBUTE_REF_NOT_FOUND = 36;
+ public static final int DUPLICATE_ATTRIBUTE_NAME = 37;
+ public static final int DUPLICATE_ANY_ATTRIBUTE = 38;
+ public static final int ATTRIBUTE_GROUP_MISSING_REF = 39;
+ public static final int ATTRIBUTE_GROUP_NOT_FOUND = 40;
+ public static final int COMPLEX_BASE_NOT_COMPLEX = 41;
+ public static final int CANNOT_EXTEND_ALL = 42;
+ public static final int SIMPLE_BASE_NOT_SIMPLE = 43;
+ public static final int RESERVED_TYPE_NAME = 44;
+ public static final int ILLEGAL_RESTRICTION = 45;
+ public static final int INVALID_SCHEMA = 46;
+ public static final int DUPLICATE_GLOBAL_ELEMENT = 47;
+ public static final int DUPLICATE_GLOBAL_ATTRIBUTE = 48;
+ public static final int DUPLICATE_GLOBAL_TYPE = 49;
+ public static final int INCONSISTENT_TYPE = 50;
+ public static final int UNSUPPORTED_FEATURE = 51;
+ public static final int MALFORMED_SIMPLE_TYPE_DEFN = 52;
+ public static final int INVALID_NAME = 53;
+ public static final int CANNOT_DERIVE_FINAL = 54;
+ public static final int IDC_NOT_FOUND = 55;
+ public static final int CANNOT_FIND_RESOURCE = 56;
+ public static final int NONDETERMINISTIC_MODEL = 57;
+ public static final int XPATH_COMPILATION_FAILURE = 58;
+ public static final int GENERIC_ERROR = 60;
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorPrinter.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorPrinter.java
new file mode 100644
index 0000000..eae88ac
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorPrinter.java
@@ -0,0 +1,60 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.XmlError;
+
+import java.util.AbstractCollection;
+import java.util.Iterator;
+import java.util.Collections;
+import java.net.URI;
+
+public class XmlErrorPrinter extends AbstractCollection
+{
+ private boolean _noisy;
+ private URI _baseURI;
+
+ public XmlErrorPrinter(boolean noisy, URI baseURI)
+ {
+ _noisy = noisy;
+ _baseURI = baseURI;
+ }
+
+ public boolean add(Object o)
+ {
+ if (o instanceof XmlError)
+ {
+ XmlError err = (XmlError)o;
+ if (err.getSeverity() == XmlError.SEVERITY_ERROR ||
+ err.getSeverity() == XmlError.SEVERITY_WARNING)
+ System.err.println(err.toString(_baseURI));
+ else if (_noisy)
+ System.out.println(err.toString(_baseURI));
+ }
+ return false;
+ }
+
+ public Iterator iterator()
+ {
+ return Collections.EMPTY_LIST.iterator();
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+}
+
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorWatcher.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorWatcher.java
new file mode 100644
index 0000000..d802590
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlErrorWatcher.java
@@ -0,0 +1,69 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.XmlError;
+
+import java.util.AbstractCollection;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Collections;
+
+public class XmlErrorWatcher extends AbstractCollection
+{
+ private Collection _underlying;
+ private XmlError _firstError;
+
+ public XmlErrorWatcher(Collection underlying)
+ {
+ _underlying = underlying;
+ }
+
+ public boolean add(Object o)
+ {
+ if (_firstError == null && o instanceof XmlError && ((XmlError)o).getSeverity() == XmlError.SEVERITY_ERROR)
+ _firstError = (XmlError)o;
+ if (_underlying == null)
+ return false;
+ return _underlying.add(o);
+ }
+
+ public Iterator iterator()
+ {
+ if (_underlying == null)
+ return Collections.EMPTY_LIST.iterator();
+
+ return _underlying.iterator();
+ }
+
+ public int size()
+ {
+ if (_underlying == null)
+ return 0;
+
+ return _underlying.size();
+ }
+
+ public boolean hasError()
+ {
+ return _firstError != null;
+ }
+
+ public XmlError firstError()
+ {
+ return _firstError;
+ }
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlEventBase.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlEventBase.java
new file mode 100644
index 0000000..9a771d2
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlEventBase.java
@@ -0,0 +1,112 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.events.ElementTypeNames;
+
+/**
+ * Abstract base class which implements the type part XMLEvent.
+ */
+
+public abstract class XmlEventBase implements XMLEvent
+{
+ public XmlEventBase ( )
+ {
+ }
+
+ public XmlEventBase ( int type )
+ {
+ _type = type;
+ }
+
+ public void setType ( int type )
+ {
+ _type = type;
+ }
+
+ public int getType ( )
+ {
+ return _type;
+ }
+
+ public String getTypeAsString ( )
+ {
+ return ElementTypeNames.getName( _type );
+ }
+
+ public boolean isStartElement ( )
+ {
+ return _type == XMLEvent.START_ELEMENT;
+ }
+
+ public boolean isEndElement ( )
+ {
+ return _type == XMLEvent.END_ELEMENT;
+ }
+
+ public boolean isEntityReference ( )
+ {
+ return _type == XMLEvent.ENTITY_REFERENCE;
+ }
+
+ public boolean isStartPrefixMapping ( )
+ {
+ return _type == XMLEvent.START_PREFIX_MAPPING;
+ }
+
+ public boolean isEndPrefixMapping ( )
+ {
+ return _type == XMLEvent.END_PREFIX_MAPPING;
+ }
+
+ public boolean isChangePrefixMapping ( )
+ {
+ return _type == XMLEvent.CHANGE_PREFIX_MAPPING;
+ }
+
+ public boolean isProcessingInstruction ( )
+ {
+ return _type == XMLEvent.PROCESSING_INSTRUCTION;
+ }
+
+ public boolean isCharacterData ( )
+ {
+ return _type == XMLEvent.CHARACTER_DATA;
+ }
+
+ public boolean isSpace ( )
+ {
+ return _type == XMLEvent.SPACE;
+ }
+
+ public boolean isNull ( )
+ {
+ return _type == XMLEvent.NULL_ELEMENT;
+ }
+
+ public boolean isStartDocument ( )
+ {
+ return _type == XMLEvent.START_DOCUMENT;
+ }
+
+ public boolean isEndDocument ( )
+ {
+ return _type == XMLEvent.END_DOCUMENT;
+ }
+
+ private int _type;
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlNameImpl.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlNameImpl.java
new file mode 100644
index 0000000..13970cc
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlNameImpl.java
@@ -0,0 +1,107 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.xml.stream.XMLName;
+
+public class XmlNameImpl implements XMLName {
+
+ private String namespaceUri=null;
+ private String localName=null;
+ private String prefix=null;
+ private int hash = 0;
+
+ public XmlNameImpl () {}
+ public XmlNameImpl (String localName) {
+ this.localName = localName;
+ }
+ public XmlNameImpl (String namespaceUri,String localName) {
+ setNamespaceUri(namespaceUri);
+ this.localName = localName;
+ }
+ public XmlNameImpl (String namespaceUri,
+ String localName,
+ String prefix) {
+ setNamespaceUri(namespaceUri);
+ this.localName = localName;
+ this.prefix = prefix;
+ }
+
+ public String getNamespaceUri() { return namespaceUri; }
+ public String getLocalName() { return localName; }
+ public String getPrefix() { return prefix; }
+
+ public void setNamespaceUri(String namespaceUri) {
+ hash = 0;
+ if (namespaceUri != null && namespaceUri.equals("")) return;
+ this.namespaceUri = namespaceUri;
+ }
+ public void setLocalName(String localName) {
+ this.localName = localName;
+ hash = 0;
+ }
+ public void setPrefix(String prefix) { this.prefix = prefix; }
+
+ public String getQualifiedName() {
+ if (prefix != null && prefix.length() > 0)
+ return prefix + ":" + localName;
+ else
+ return localName;
+ }
+ public String toString() {
+ if (getNamespaceUri() != null)
+ return "['"+getNamespaceUri()+"']:"+getQualifiedName();
+ else
+ return getQualifiedName();
+ }
+
+ public final int hashCode() {
+ int tmp_hash = hash;
+ if (tmp_hash == 0) {
+ tmp_hash = 17;
+ if (namespaceUri != null) {
+ tmp_hash = 37*tmp_hash + namespaceUri.hashCode();
+ }
+ if (localName != null) {
+ tmp_hash = 37*tmp_hash + localName.hashCode();
+ }
+ hash = tmp_hash;
+ }
+ return tmp_hash;
+ }
+
+ public final boolean equals(Object obj) {
+ if (obj == this) return true;
+
+ if (obj instanceof XMLName) {
+ final XMLName name= (XMLName) obj;
+
+ final String lname = localName;
+ if (!(lname==null ? name.getLocalName()==null :
+ lname.equals(name.getLocalName())))
+ return false;
+
+ final String uri = namespaceUri;
+ return (uri==null ? name.getNamespaceUri()==null :
+ uri.equals(name.getNamespaceUri()));
+
+ }
+ return false;
+ }
+
+
+
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlObjectList.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlObjectList.java
new file mode 100644
index 0000000..b8a6e77
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlObjectList.java
@@ -0,0 +1,135 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SimpleValue;
+
+/**
+ * A class to hold and compare a list of XmlObjects for use by keys
+ * keyrefs during validation.
+ */
+public class XmlObjectList
+{
+ private final XmlObject[] _objects;
+
+ /**
+ * Construct a new empty object list of the given fixed size.
+ */
+ public XmlObjectList(int objectCount) {
+ _objects = new XmlObject[objectCount];
+ }
+
+ /**
+ * Set an object by index unless a value has been previously
+ * set at that location.
+ *
+ * @return true if the value was set, false if the value has
+ * already been set
+ */
+ public boolean set(XmlObject o, int index)
+ {
+ if (_objects[index] != null)
+ return false;
+
+ _objects[index] = o;
+ return true;
+ }
+
+ /**
+ * Tests that all values have been set. Needed for keys.
+ */
+ public boolean filled() {
+ for (int i = 0 ; i < _objects.length ; i++)
+ if (_objects[i] == null) return false;
+
+ return true;
+ }
+
+ /**
+ * Tests that all values have been set. Needed for keys.
+ */
+ public int unfilled()
+ {
+ for (int i = 0 ; i < _objects.length ; i++)
+ if (_objects[i] == null) return i;
+
+ return -1;
+ }
+
+ public boolean equals(Object o) {
+ if (!( o instanceof XmlObjectList))
+ return false;
+
+ XmlObjectList other = (XmlObjectList)o;
+
+ if (other._objects.length != this._objects.length)
+ return false;
+
+ for (int i = 0 ; i < _objects.length ; i++) {
+ // Ignore missing values
+ if (_objects[i] == null || other._objects[i] == null)
+ return false;
+
+ if (! _objects[i].valueEquals(other._objects[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int h = 0;
+
+ for (int i = 0 ; i < _objects.length ; i++)
+ if (_objects[i] != null)
+ h = 31 * h + _objects[i].valueHashCode();
+
+ return h;
+ }
+
+ private static String prettytrim(String s)
+ {
+ int end;
+ for (end = s.length(); end > 0; end -= 1)
+ {
+ if (!XMLChar.isSpace(s.charAt(end - 1)))
+ break;
+ }
+ int start;
+ for (start = 0; start < end; start += 1)
+ {
+ if (!XMLChar.isSpace(s.charAt(start)))
+ break;
+ }
+ return s.substring(start, end);
+ }
+
+ public String toString() {
+ StringBuffer b = new StringBuffer();
+
+ for (int i = 0 ; i < _objects.length ; i++)
+ {
+ if (i != 0) b.append(" ");
+ b.append(prettytrim(((SimpleValue)_objects[i]).stringValue()));
+ }
+
+ return b.toString();
+ }
+}
+
+
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/XmlWhitespace.java b/v1/src/common/org/apache/xmlbeans/impl/common/XmlWhitespace.java
new file mode 100644
index 0000000..e7bd766
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/XmlWhitespace.java
@@ -0,0 +1,148 @@
+/* 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.xmlbeans.impl.common;
+
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlWhitespace
+{
+ public static final int WS_UNSPECIFIED = SchemaType.WS_UNSPECIFIED;
+ public static final int WS_PRESERVE = SchemaType.WS_PRESERVE;
+ public static final int WS_REPLACE = SchemaType.WS_REPLACE;
+ public static final int WS_COLLAPSE = SchemaType.WS_COLLAPSE;
+
+
+ public static boolean isSpace(char ch)
+ {
+ switch (ch)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ case '\t':
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isAllSpace(String v)
+ {
+ for (int i = 0; i < v.length(); i++)
+ {
+ if (!isSpace(v.charAt(i)))
+ return false;
+ }
+ return true;
+ }
+
+ public static String collapse(String v)
+ {
+ return collapse(v, XmlWhitespace.WS_COLLAPSE);
+ }
+
+ /**
+ * The algorithm used by apply_wscanon: sometimes used in impls.
+ */
+ public static String collapse(String v, int wsr)
+ {
+ if (wsr == SchemaType.WS_PRESERVE || wsr == SchemaType.WS_UNSPECIFIED)
+ return v;
+
+ if (v.indexOf('\n') >= 0)
+ v = v.replace('\n', ' ');
+ if (v.indexOf('\t') >= 0)
+ v = v.replace('\t', ' ');
+ if (v.indexOf('\r') >= 0)
+ v = v.replace('\r', ' ');
+
+ if (wsr == SchemaType.WS_REPLACE)
+ return v;
+
+ int j = 0;
+ int len = v.length();
+ if (len == 0)
+ return v;
+
+ int i;
+
+ /* a trick: examine every other character looking for pairs of spaces */
+ if (v.charAt(0) != ' ')
+ {
+ examine: {
+ for (j = 2; j < len; j += 2)
+ {
+ if (v.charAt(j) == ' ')
+ {
+ if (v.charAt(j - 1) == ' ')
+ break examine;
+ if (j == len - 1)
+ break examine;
+ j++;
+ if (v.charAt(j) == ' ')
+ break examine;
+ }
+ }
+ if (j == len && v.charAt(j - 1) == ' ')
+ break examine;
+ return v;
+ }
+ /* j is pointing at the first ws to be removed, or past end */
+ i = j;
+ }
+ else
+ {
+ /**
+ * j is pointing at the last whitespace in the initial run
+ */
+ while (j + 1 < v.length() && v.charAt(j + 1) == ' ')
+ j += 1;
+ i = 0;
+ }
+
+ char[] ch = v.toCharArray();
+
+ shifter: for (;;)
+ {
+ for (;;)
+ {
+ /* j was ws or past end */
+ j++;
+ if (j >= len)
+ break shifter;
+ if (v.charAt(j) != ' ')
+ break;
+ }
+ for (;;)
+ {
+ /* j was nonws */
+ ch[i++] = ch[j++];
+ if (j >= len)
+ break shifter;
+ if (ch[j] == ' ')
+ {
+ ch[i++] = ch[j++];
+ if (j >= len)
+ break shifter;
+ if (ch[j] == ' ')
+ break;
+ }
+ }
+ }
+
+ return new String(ch, 0, (i == 0 || ch[i - 1] != ' ') ? i : i - 1);
+ }
+
+}
diff --git a/v1/src/common/org/apache/xmlbeans/impl/common/readme.txt b/v1/src/common/org/apache/xmlbeans/impl/common/readme.txt
new file mode 100644
index 0000000..ea25143
--- /dev/null
+++ b/v1/src/common/org/apache/xmlbeans/impl/common/readme.txt
@@ -0,0 +1,5 @@
+There are isolated files in this directory taken from the Apache
+Xerces-J 2.0 project
+
+It contains very minor modifications including a change in namespace.
+
diff --git a/v1/src/configschema/schema/xmlconfig.xsd b/v1/src/configschema/schema/xmlconfig.xsd
new file mode 100644
index 0000000..1999131
--- /dev/null
+++ b/v1/src/configschema/schema/xmlconfig.xsd
@@ -0,0 +1,258 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ targetNamespace="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ elementFormDefault="qualified">
+
+ <xs:import namespace="http://www.w3.org/2001/XMLSchema"/>
+
+ <xs:element name="config">
+ <xs:annotation>
+ <xs:documentation>
+ The config element is the top-level element for an .xsdconfig file.
+ It contains configuration information that guides the xsd compiler
+ when it generates Java classes. You can specify package names to
+ be used for whole xml namespaces; you can specify class names
+ to use for individual schema types; and you can supply extension
+ interfaces and implementations to be extended by the generated
+ Java classes.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+
+ <xs:element name="namespace" type="xb:nsconfig">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies configuration for a namespace.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="qname" type="xb:qnameconfig">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies java mapping for a qname.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="extension" type="xb:extensionconfig">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies extensions for the generated types in the 'for' attribute.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="nsconfig">
+
+ <xs:sequence>
+
+ <xs:element name="package" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ The package name to be used for types generated in this
+ namespace.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="prefix" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ A prefix to be used to prepend to top-level Java type names
+ generated in this namespace. (The prefix is not used for
+ inner Java type definitions.)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="suffix" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>
+ A suffix to be used to append to top-level Java type names
+ generated in this namespace. (The suffix is not used for
+ inner Java type definitions.)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+
+ </xs:sequence>
+
+ <xs:attribute name="uri" type="xb:namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A list of any number of namespace URIs or ##local for the no-namespace,
+ or ##any for all namespaces.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="uriprefix" type="xb:namespacePrefixList">
+ <xs:annotation>
+ <xs:documentation>
+ A list of any number of namespace URIs.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ </xs:complexType>
+
+ <xs:complexType name="qnameconfig">
+ <xs:sequence/>
+ <xs:attribute name="name" type="xs:QName"/>
+ <xs:attribute name="javaname" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:simpleType name="namespacePrefixList">
+ <xs:annotation>
+ <xs:documentation>
+ A list of namespace URIs.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:list itemType="xs:anyURI" />
+ </xs:simpleType>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A list of namespace URIs, with ##local for no-uri; or ##any for all URIs.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="extensionconfig">
+ <xs:sequence>
+ <xs:element name="interface" minOccurs="0" maxOccurs="unbounded" >
+ <xs:annotation>
+ <xs:documentation>
+ The extension interface (it has to be on the classpath).
+ All the generated types in this domain will implement this interface,
+ the calls will be redirected to the handler.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="staticHandler" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the handler class for this extension interface.
+ The handler must contain public static methods for each method
+ in the interface, and they have to have the following signature.
+ Example:
+ - method in the extension interface:
+ public String foo(String s)
+ - method in the handler:
+ public static String foo(XmlObject xo, String s)
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <!--xs:element name="implementationClass" type="xs:string" /-->
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The extension interface name (it has to be on the classpath).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="prePostSet" minOccurs="0" maxOccurs="1" >
+ <xs:annotation>
+ <xs:documentation>
+ preSet and postSet calls will get generated in the implementation classes. (Only for setter methods).
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="staticHandler" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the handler class for preSet and postSet methods.
+ The handler must contain the following public static methods.
+ public static boolean preSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {
+ ...
+ return true; // true to execute store implementation code, false to skip it
+ }
+
+ public static void postSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {...}
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="for" type="xb:javaNameList">
+ <xs:annotation>
+ <xs:documentation>
+ '*' or a list of generated java types (interfaces) that reprezents this extension domain.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:simpleType name="javaNameList">
+ <xs:annotation>
+ <xs:documentation>
+ A list of generated java interface names or '*' for all interfaces.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="*" />
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xb:javaName" />
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="javaName">
+ <xs:restriction base="xs:token" />
+ </xs:simpleType>
+
+</xs:schema>
diff --git a/v1/src/license/LICENSE.txt b/v1/src/license/LICENSE.txt
new file mode 100755
index 0000000..cecccc0
--- /dev/null
+++ b/v1/src/license/LICENSE.txt
@@ -0,0 +1,213 @@
+ 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.
+
+
+===========================================================================
+
+ADDITIONAL LICENSES COVERING PARTS OF THIS DISTRIBUTION:
+
+This distribution includes W3C XML Schema documents Copyright (c) 2001-2003
+World Wide Web Consortium. These schemas are licensed under the W3C
+Software License, which is included in the same directory as the schemas.
+The license can also be found at:
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.
+
diff --git a/v1/src/license/NOTICE.txt b/v1/src/license/NOTICE.txt
new file mode 100644
index 0000000..a2578db
--- /dev/null
+++ b/v1/src/license/NOTICE.txt
@@ -0,0 +1,22 @@
+This software consists of voluntary contributions made by many
+individuals on behalf of the Apache Software Foundation and was
+originally based on software copyright (c) 2000-2003 BEA Systems
+Inc., <http://www.bea.com/>. For more information on the Apache
+Software Foundation, please see <http://www.apache.org/>.
+
+Aside from contributions to the Apache XMLBeans project, this
+software also includes:
+
+- one or more source files from the Apache Xerces-J and Apache
+Axis products, Copyright (c) 1999-2003 Apache Software Foundation
+
+- jaxen, Copyright 2003 (c) The Werken Company.
+
+- W3C XML Schema documents Copyright 2001-2003 (c) World Wide
+Web Consortium (Massachusetts Institute of Technology, European
+Research Consortium for Informatics and Mathematics, Keio
+University)
+
+See the LICENSE.txt file for information on all licenses
+associated with this software.
+
diff --git a/v1/src/repackage/repackage/EditBuildScript.java b/v1/src/repackage/repackage/EditBuildScript.java
new file mode 100644
index 0000000..6df16e8
--- /dev/null
+++ b/v1/src/repackage/repackage/EditBuildScript.java
@@ -0,0 +1,99 @@
+/* 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 repackage;
+
+import java.io.*;
+
+public class EditBuildScript
+{
+ //
+ // usgae: edit buildfile token new-value
+ //
+
+ public static void main ( String[] args )
+ throws Exception
+ {
+ if (args.length != 3)
+ throw new IllegalArgumentException( "Wrong number of arguments" );
+
+ args[ 0 ] = args[ 0 ].replace( '/', File.separatorChar );
+
+ File buildFile = new File( args[ 0 ] );
+
+ StringBuffer sb = readFile( buildFile );
+
+ String tokenStr = "<property name=\"" + args[ 1 ] + "\" value=\"";
+
+ int i = sb.indexOf( tokenStr );
+
+ if (i < 0)
+ throw new IllegalArgumentException( "Can't find token: " + tokenStr );
+
+ int j = i + tokenStr.length();
+
+ while ( sb.charAt( j ) != '"' )
+ j++;
+
+ sb.replace( i + tokenStr.length(), j, args[ 2 ] );
+
+ writeFile( buildFile, sb );
+ }
+
+ static StringBuffer readFile ( File f )
+ throws IOException
+ {
+ InputStream in = new FileInputStream( f );
+ Reader r = new InputStreamReader( in );
+ StringWriter w = new StringWriter();
+
+ copy( r, w );
+
+ w.close();
+ r.close();
+ in.close();
+
+ return w.getBuffer();
+ }
+
+ static void writeFile ( File f, StringBuffer chars )
+ throws IOException
+ {
+ OutputStream out = new FileOutputStream( f );
+ Writer w = new OutputStreamWriter( out );
+ Reader r = new StringReader( chars.toString() );
+
+ copy( r, w );
+
+ r.close();
+ w.close();
+ out.close();
+ }
+
+ static void copy ( Reader r, Writer w ) throws IOException
+ {
+ char[] buffer = new char [ 1024 * 16 ];
+
+ for ( ; ; )
+ {
+ int n = r.read( buffer, 0, buffer.length );
+
+ if (n < 0)
+ break;
+
+ w.write( buffer, 0, n );
+ }
+ }
+}
diff --git a/v1/src/repackage/repackage/Repackage.java b/v1/src/repackage/repackage/Repackage.java
new file mode 100644
index 0000000..2115e5d
--- /dev/null
+++ b/v1/src/repackage/repackage/Repackage.java
@@ -0,0 +1,383 @@
+/* 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 repackage;
+
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+public class Repackage
+{
+ public static void main ( String[] args ) throws Exception
+ {
+ new Repackage().repackage( args );
+ }
+
+ public void repackage ( String[] args ) throws Exception
+ {
+ if (args.length != 2 || !args[0].equals( "-repackage" ))
+ throw new RuntimeException( "Usage: repackage -repackage [spec]" );
+
+ _repackager = new Repackager( args[ 1 ] );
+
+ _fromPackages = _repackager.getFromPackages();
+ _toPackages = _repackager.getToPackages();
+
+ _packagePattern =
+ Pattern.compile( "^\\s*package\\s+((?:\\w|\\.)*)\\s*;", Pattern.MULTILINE );
+
+ _moveAlongFiles = new ArrayList();
+ _movedDirs = new HashMap();
+
+ File currentDir = new File( "." );
+ File buildDir = new File( currentDir, "build" );
+ File repackageDir = new File( buildDir, "repackage" );
+
+ System.out.println( "Deleting repackage dir ..." );
+
+ recursiveDelete( repackageDir );
+
+ repackageDir.mkdirs();
+
+ ArrayList files = new ArrayList();
+
+ fillFiles( files, currentDir );
+
+ System.out.println( "Repackaging " + files.size() + " files ..." );
+
+ int prefixLength = currentDir.getCanonicalPath().length();
+
+ _sourceBase = currentDir;
+ _targetBase = repackageDir;
+
+ for ( int i = 0 ; i < files.size() ; i++ )
+ {
+ File from = (File) files.get( i );
+
+ String name = from.getCanonicalPath().substring( prefixLength + 1 );
+
+ repackageFile( name );
+ }
+
+ finishMovingFiles();
+ }
+
+ public void repackageFile ( String name )
+ throws IOException
+ {
+ if (name.endsWith( ".java" ))
+ repackageJavaFile( name );
+ else if (name.endsWith( ".xsdconfig" ))
+ repackageNonJavaFile( name );
+ else if (name.startsWith( "bin" + File.separatorChar ))
+ repackageNonJavaFile( name );
+ else
+ moveAlongWithJavaFiles( name );
+ }
+
+ public void moveAlongWithJavaFiles( String name )
+ {
+ _moveAlongFiles.add(name);
+ }
+
+ public void finishMovingFiles ( )
+ throws IOException
+ {
+ for ( Iterator i = _moveAlongFiles.iterator(); i.hasNext(); )
+ {
+ String name = (String) i.next();
+ String toName = name;
+
+ String srcDir = Repackager.dirForPath( name );
+ String toDir = (String) _movedDirs.get( srcDir );
+
+ if (toDir != null)
+ toName = new File( toDir, new File( name ).getName() ).toString();
+
+ if (name.endsWith( ".html" ))
+ repackageNonJavaFile( name, toName );
+ else
+ copyFile( new File( _sourceBase, name ), new File( _targetBase, toName ) );
+ }
+ }
+
+ public void repackageNonJavaFile ( String name )
+ throws IOException
+ {
+ StringBuffer sb = readFile( new File( _sourceBase, name ) );
+
+ _repackager.repackage( sb );
+
+ writeFile( new File( _targetBase, name ), sb );
+ }
+
+ public void repackageNonJavaFile ( String sourceName, String targetName )
+ throws IOException
+ {
+ StringBuffer sb = readFile( new File( _sourceBase, sourceName ) );
+
+ _repackager.repackage( sb );
+
+ writeFile( new File( _targetBase, targetName ), sb );
+ }
+
+ public void repackageJavaFile ( String name )
+ throws IOException
+ {
+ StringBuffer sb = readFile( new File( _sourceBase, name ) );
+
+ Matcher packageMatcher = _packagePattern.matcher( sb );
+
+ if (packageMatcher.find())
+ {
+ String pkg = packageMatcher.group( 1 );
+ int pkgStart = packageMatcher.start( 1 );
+ int pkgEnd = packageMatcher.end( 1 );
+
+ if (packageMatcher.find())
+ throw new RuntimeException( "Two package specifications found: " + name );
+
+ List filePath = Repackager.splitPath( name, File.separatorChar );
+ String srcDir = Repackager.dirForPath( name );
+
+ // Sort the repackage spec so that longer from's are first to match
+ // longest package first
+
+ for ( ; ; )
+ {
+ boolean swapped = false;
+
+ for ( int i = 1 ; i < filePath.size() ; i++ )
+ {
+ String spec1 = (String) filePath.get( i - 1 );
+ String spec2 = (String) filePath.get( i );
+
+ if (spec1.indexOf( ':' ) < spec2.indexOf( ':' ))
+ {
+ filePath.set( i - 1, spec2 );
+ filePath.set( i, spec1 );
+
+ swapped = true;
+ }
+ }
+
+ if (!swapped)
+ break;
+ }
+
+ List pkgPath = Repackager.splitPath( pkg, '.' );
+
+ int f = filePath.size() - 2;
+
+ for ( int i = pkgPath.size() - 1 ; i >= 0 ; i-- )
+ {
+ if (!pkgPath.get( i ).equals( filePath.get( f-- ) ))
+ throw new RuntimeException( "Package spec differs from file path: " + name );
+ }
+
+ List changeTo = null;
+ List changeFrom = null;
+
+ from:
+ for ( int i = 0 ; i < _fromPackages.size() ; i ++ )
+ {
+ List from = (List) _fromPackages.get( i );
+
+ if (from.size() <= pkgPath.size())
+ {
+ for ( int j = 0 ; j < from.size() ; j++ )
+ if (!from.get( j ).equals( pkgPath.get( j )))
+ continue from;
+
+ changeFrom = from;
+ changeTo = (List) _toPackages.get( i );
+
+ break;
+ }
+ }
+
+ if (changeTo != null)
+ {
+ String newPkg = "";
+ String newName = "";
+
+ for ( int i = 0 ; i < changeTo.size() ; i++ )
+ {
+ if (i > 0)
+ {
+ newPkg += ".";
+ newName += File.separatorChar;
+ }
+
+ newPkg += changeTo.get( i );
+ newName += changeTo.get( i );
+ }
+
+ for ( int i = filePath.size() - pkgPath.size() - 2 ; i >= 0 ; i-- )
+ newName = (String) filePath.get( i ) + File.separatorChar + newName;
+
+ for ( int i = changeFrom.size() ; i < pkgPath.size() ; i++ )
+ {
+ newName += File.separatorChar + (String) pkgPath.get( i );
+ newPkg += '.' + (String) pkgPath.get( i );
+ }
+
+ newName += File.separatorChar + (String) filePath.get( filePath.size() - 1 );
+
+ sb.replace( pkgStart, pkgEnd, newPkg );
+
+ name = newName;
+ String newDir = Repackager.dirForPath( name );
+
+ if (!srcDir.equals(newDir))
+ {
+ _movedDirs.put(srcDir, newDir);
+ }
+ }
+ }
+
+ _repackager.repackage( sb );
+
+ writeFile( new File( _targetBase, name ), sb );
+ }
+
+ void writeFile ( File f, StringBuffer chars )
+ throws IOException
+ {
+ f.getParentFile().mkdirs();
+
+ OutputStream out = new FileOutputStream( f );
+ Writer w = new OutputStreamWriter( out );
+ Reader r = new StringReader( chars.toString() );
+
+ copy( r, w );
+
+ r.close();
+ w.close();
+ out.close();
+ }
+
+ StringBuffer readFile ( File f )
+ throws IOException
+ {
+ InputStream in = new FileInputStream( f );
+ Reader r = new InputStreamReader( in );
+ StringWriter w = new StringWriter();
+
+ copy( r, w );
+
+ w.close();
+ r.close();
+ in.close();
+
+ return w.getBuffer();
+ }
+
+ public void copyFile ( File from, File to ) throws IOException
+ {
+ to.getParentFile().mkdirs();
+
+ FileInputStream in = new FileInputStream( from );
+ FileOutputStream out = new FileOutputStream( to );
+
+ copy( in, out );
+
+ out.close();
+ in.close();
+ }
+
+ public void copy ( InputStream in, OutputStream out ) throws IOException
+ {
+ byte[] buffer = new byte [ 1024 * 16 ];
+
+ for ( ; ; )
+ {
+ int n = in.read( buffer, 0, buffer.length );
+
+ if (n < 0)
+ break;
+
+ out.write( buffer, 0, n );
+ }
+ }
+
+ public void copy ( Reader r, Writer w ) throws IOException
+ {
+ char[] buffer = new char [ 1024 * 16 ];
+
+ for ( ; ; )
+ {
+ int n = r.read( buffer, 0, buffer.length );
+
+ if (n < 0)
+ break;
+
+ w.write( buffer, 0, n );
+ }
+ }
+
+ public void fillFiles ( ArrayList files, File file ) throws IOException
+ {
+ if (!file.isDirectory())
+ {
+ files.add( file );
+ return;
+ }
+
+ // Exclude the build directory
+
+ if (file.getName().equals( "build" ))
+ return;
+
+ // Exclude CVS directories
+ if (file.getName().equals( "CVS" ))
+ return;
+
+ String[] entries = file.list();
+
+ for ( int i = 0 ; i < entries.length ; i++ )
+ fillFiles( files, new File( file, entries[ i ] ) );
+ }
+
+ public void recursiveDelete ( File file ) throws IOException
+ {
+ if (!file.exists())
+ return;
+
+ if (file.isDirectory())
+ {
+ String[] entries = file.list();
+
+ for ( int i = 0 ; i < entries.length ; i++ )
+ recursiveDelete( new File( file, entries[ i ] ) );
+ }
+
+ file.delete();
+ }
+
+ private File _sourceBase;
+ private File _targetBase;
+
+ private List _fromPackages;
+ private List _toPackages;
+
+ private Pattern _packagePattern;
+
+ private Repackager _repackager;
+
+ private Map _movedDirs;
+ private List _moveAlongFiles;
+}
diff --git a/v1/src/repackage/repackage/Repackager.java b/v1/src/repackage/repackage/Repackager.java
new file mode 100644
index 0000000..e2b3f1c
--- /dev/null
+++ b/v1/src/repackage/repackage/Repackager.java
@@ -0,0 +1,168 @@
+/* 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 repackage;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import java.io.File;
+
+public class Repackager
+{
+ public Repackager ( String repackageSpecs )
+ {
+ _fromPackages = new ArrayList();
+ _toPackages = new ArrayList();
+
+ List repackages = splitPath( repackageSpecs, ';' );
+
+ // Sort the repackage spec so that longer from's are first to match
+ // longest package first
+
+ for ( ; ; )
+ {
+ boolean swapped = false;
+
+ for ( int i = 1 ; i < repackages.size() ; i++ )
+ {
+ String spec1 = (String) repackages.get( i - 1 );
+ String spec2 = (String) repackages.get( i );
+
+ if (spec1.indexOf( ':' ) < spec2.indexOf( ':' ))
+ {
+ repackages.set( i - 1, spec2 );
+ repackages.set( i, spec1 );
+
+ swapped = true;
+ }
+ }
+
+ if (!swapped)
+ break;
+ }
+
+ for ( int i = 0 ; i < repackages.size() ; i++ )
+ {
+ String spec = (String) repackages.get( i );
+
+ int j = spec.indexOf( ':' );
+
+ if (j < 0 || spec.indexOf( ':', j + 1 ) >= 0)
+ throw new RuntimeException( "Illegal repackage specification: " + spec );
+
+ String from = spec.substring( 0, j );
+ String to = spec.substring( j + 1 );
+
+ _fromPackages.add( Repackager.splitPath( from, '.' ) );
+ _toPackages.add( Repackager.splitPath( to, '.' ) );
+ }
+
+ _fromMatchers = new Matcher [ _fromPackages.size() * 2 ];
+ _toPackageNames = new String [ _fromPackages.size() * 2 ];
+
+ addPatterns( '.', 0 );
+ addPatterns( '/', _fromPackages.size() );
+ }
+
+ void addPatterns ( char sep, int off )
+ {
+ for ( int i = 0 ; i < _fromPackages.size() ; i++ )
+ {
+ List from = (List) _fromPackages.get( i );
+ List to = (List) _toPackages.get( i );
+
+ String pattern = "";
+
+ for ( int j = 0 ; j < from.size() ; j++ )
+ {
+ if (j > 0)
+ pattern += "\\" + sep;
+
+ pattern += from.get( j );
+ }
+
+ String toPackage = "";
+
+ for ( int j = 0 ; j < to.size() ; j++ )
+ {
+ if (j > 0)
+ toPackage += sep;
+
+ toPackage += to.get( j );
+ }
+
+ _fromMatchers[ off + i ] = Pattern.compile( pattern ).matcher( "" );
+ _toPackageNames[ off + i ] = toPackage;
+ }
+ }
+
+ public void repackage ( StringBuffer sb )
+ {
+ for ( int i = 0 ; i < _fromMatchers.length ; i++ )
+ {
+ Matcher matcher = (Matcher) _fromMatchers[ i ];
+
+ matcher.reset( sb );
+
+ while ( matcher.find() )
+ sb.replace( matcher.start(), matcher.end(), _toPackageNames[ i ] );
+ }
+ }
+
+ public List getFromPackages ( )
+ {
+ return _fromPackages;
+ }
+
+ public List getToPackages ( )
+ {
+ return _toPackages;
+ }
+
+ public static ArrayList splitPath ( String path, char separator )
+ {
+ ArrayList components = new ArrayList();
+
+ for ( ; ; )
+ {
+ int i = path.indexOf( separator );
+
+ if (i < 0)
+ break;
+
+ components.add( path.substring( 0, i ) );
+
+ path = path.substring( i + 1 );
+ }
+
+ if (path.length() > 0)
+ components.add( path );
+
+ return components;
+ }
+
+ public static String dirForPath ( String path )
+ {
+ return new File(path).getParent();
+ }
+
+ private List _fromPackages;
+ private List _toPackages;
+
+ private Matcher[] _fromMatchers;
+ private String[] _toPackageNames;
+}
\ No newline at end of file
diff --git a/v1/src/toolschema/ltgfmt.xsd b/v1/src/toolschema/ltgfmt.xsd
new file mode 100644
index 0000000..e7550b6
--- /dev/null
+++ b/v1/src/toolschema/ltgfmt.xsd
@@ -0,0 +1,60 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://xml.apache.org/xmlbeans/2004/02/xmlbean/ltgfmt"
+ targetNamespace="http://xml.apache.org/xmlbeans/2004/02/xmlbean/ltgfmt"
+ elementFormDefault="qualified">
+
+ <xs:element name="tests">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="test" type="tns:test-case" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="test-case">
+ <xs:sequence>
+ <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="files">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="file" type="tns:file-desc" minOccurs="1" maxOccurs="4"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="origin" type="xs:token"/>
+ <xs:attribute name="modified" type="xs:boolean"/>
+ </xs:complexType>
+
+ <xs:complexType name="file-desc">
+ <xs:attribute name="tsDir" type="xs:token"/>
+ <xs:attribute name="folder" type="xs:token"/>
+ <xs:attribute name="fileName" type="xs:token"/>
+ <xs:attribute name="role">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="schema"/>
+ <xs:enumeration value="instance"/>
+ <xs:enumeration value="resource"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="validity" type="xs:boolean"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/v1/src/toolschema/substwsdl.xsd b/v1/src/toolschema/substwsdl.xsd
new file mode 100644
index 0000000..dc9b012
--- /dev/null
+++ b/v1/src/toolschema/substwsdl.xsd
@@ -0,0 +1,55 @@
+<!-- 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. -->
+<!--
+ This schema stands in for a schema for WSDL.
+
+ It has none of the real structure of a WSDL except "imports" and
+ the 2nd-level tag names.
+
+ When compiling schemas within .wsdl files, we use this schema to load
+ the WSDL files. Of course, WSDL files are actually in the
+ http://schemas.xmlsoap.org/wsdl/ namespace, but we use the
+ LoadSubstituteNamespaces option in order to internally substitute
+ the namespace below.
+-->
+
+
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.apache.org/internal/xmlbeans/wsdlsubst"
+ targetNamespace="http://www.apache.org/internal/xmlbeans/wsdlsubst"
+ elementFormDefault="qualified">
+
+ <xs:element name="definitions">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="import" type="tns:TImport"/>
+ <xs:element name="types"/>
+ <xs:element name="message"/>
+ <xs:element name="binding"/>
+ <xs:element name="portType"/>
+ <xs:element name="service"/>
+ <xs:any namespace="##other"/>
+ </xs:choice>
+ <xs:anyAttribute/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="TImport">
+ <xs:attribute name="namespace" type="xs:anyURI" use="required"/>
+ <xs:attribute name="location" type="xs:anyURI" use="required"/>
+ <xs:anyAttribute namespace="##other"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/v1/src/toolschema/xsdownload.xsd b/v1/src/toolschema/xsdownload.xsd
new file mode 100644
index 0000000..9374269
--- /dev/null
+++ b/v1/src/toolschema/xsdownload.xsd
@@ -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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:i="http://xml.apache.org/xmlbeans/2004/02/xmlbean/xsdownload"
+ targetNamespace="http://xml.apache.org/xmlbeans/2004/02/xmlbean/xsdownload"
+ elementFormDefault="qualified">
+
+ <xs:element name="downloaded-schemas">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="entry" type="i:downloaded-schema-entry"/>
+ </xs:choice>
+ <xs:attribute name="defaultDirectory" type="xs:token"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="downloaded-schema-entry">
+ <xs:sequence>
+ <xs:element name="filename" type="xs:token"/>
+ <xs:element name="sha1" type="xs:token"/>
+ <xs:element name="schemaLocation" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="namespace" type="xs:anyURI" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/BMPattern.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/BMPattern.java
new file mode 100644
index 0000000..43e2d17
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/BMPattern.java
@@ -0,0 +1,230 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.text.CharacterIterator;
+
+/**
+ * Boyer-Moore searcher.
+ */
+public class BMPattern {
+ char[] pattern;
+ int[] shiftTable;
+ boolean ignoreCase;
+
+ public BMPattern(String pat, boolean ignoreCase) {
+ this(pat, 256, ignoreCase);
+ }
+
+ public BMPattern(String pat, int tableSize, boolean ignoreCase) {
+ this.pattern = pat.toCharArray();
+ this.shiftTable = new int[tableSize];
+ this.ignoreCase = ignoreCase;
+
+ int length = pattern.length;
+ for (int i = 0; i < this.shiftTable.length; i ++)
+ this.shiftTable[i] = length;
+
+ for (int i = 0; i < length; i ++) {
+ char ch = this.pattern[i];
+ int diff = length-i-1;
+ int index = ch % this.shiftTable.length;
+ if (diff < this.shiftTable[index])
+ this.shiftTable[index] = diff;
+ if (this.ignoreCase) {
+ ch = Character.toUpperCase(ch);
+ index = ch % this.shiftTable.length;
+ if (diff < this.shiftTable[index])
+ this.shiftTable[index] = diff;
+ ch = Character.toLowerCase(ch);
+ index = ch % this.shiftTable.length;
+ if (diff < this.shiftTable[index])
+ this.shiftTable[index] = diff;
+ }
+ }
+ }
+
+ /**
+ *
+ * @return -1 if <var>iterator</var> does not contain this pattern.
+ */
+ public int matches(CharacterIterator iterator, int start, int limit) {
+ if (this.ignoreCase) return this.matchesIgnoreCase(iterator, start, limit);
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ if ((ch = iterator.setIndex(--index)) != this.pattern[--pindex])
+ break;
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ * @return -1 if <var>str</var> does not contain this pattern.
+ */
+ public int matches(String str, int start, int limit) {
+ if (this.ignoreCase) return this.matchesIgnoreCase(str, start, limit);
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ //System.err.println("Starts at "+index);
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ if ((ch = str.charAt(--index)) != this.pattern[--pindex])
+ break;
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+ /**
+ *
+ * @return -1 if <var>chars</char> does not contain this pattern.
+ */
+ public int matches(char[] chars, int start, int limit) {
+ if (this.ignoreCase) return this.matchesIgnoreCase(chars, start, limit);
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ //System.err.println("Starts at "+index);
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ if ((ch = chars[--index]) != this.pattern[--pindex])
+ break;
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+
+ int matchesIgnoreCase(CharacterIterator iterator, int start, int limit) {
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ char ch1 = ch = iterator.setIndex(--index);
+ char ch2 = this.pattern[--pindex];
+ if (ch1 != ch2) {
+ ch1 = Character.toUpperCase(ch1);
+ ch2 = Character.toUpperCase(ch2);
+ if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
+ break;
+ }
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+
+ int matchesIgnoreCase(String text, int start, int limit) {
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ char ch1 = ch = text.charAt(--index);
+ char ch2 = this.pattern[--pindex];
+ if (ch1 != ch2) {
+ ch1 = Character.toUpperCase(ch1);
+ ch2 = Character.toUpperCase(ch2);
+ if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
+ break;
+ }
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+ int matchesIgnoreCase(char[] chars, int start, int limit) {
+ int plength = this.pattern.length;
+ if (plength == 0) return start;
+ int index = start+plength;
+ while (index <= limit) {
+ int pindex = plength;
+ int nindex = index+1;
+ char ch;
+ do {
+ char ch1 = ch = chars[--index];
+ char ch2 = this.pattern[--pindex];
+ if (ch1 != ch2) {
+ ch1 = Character.toUpperCase(ch1);
+ ch2 = Character.toUpperCase(ch2);
+ if (ch1 != ch2 && Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
+ break;
+ }
+ if (pindex == 0)
+ return index;
+ } while (pindex > 0);
+ index += this.shiftTable[ch % this.shiftTable.length]+1;
+ if (index < nindex) index = nindex;
+ }
+ return -1;
+ }
+
+ /*
+ public static void main(String[] argv) {
+ try {
+ int[] shiftTable = new int[256];
+ initializeBoyerMoore(argv[0], shiftTable, true);
+ int o = -1;
+ CharacterIterator ite = new java.text.StringCharacterIterator(argv[1]);
+ long start = System.currentTimeMillis();
+ //for (int i = 0; i < 10000; i ++)
+ o = searchIgnoreCasesWithBoyerMoore(ite, 0, argv[0], shiftTable);
+ start = System.currentTimeMillis()-start;
+ System.out.println("Result: "+o+", Elapsed: "+start);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }*/
+}
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Match.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Match.java
new file mode 100644
index 0000000..08e9c97
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Match.java
@@ -0,0 +1,180 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.text.CharacterIterator;
+
+/**
+ *
+ * An instance of this class has ranges captured in matching.
+ *
+ * @see RegularExpression#matches(char[], int, int, Match)
+ * @see RegularExpression#matches(char[], Match)
+ * @see RegularExpression#matches(java.text.CharacterIterator, Match)
+ * @see RegularExpression#matches(java.lang.String, int, int, Match)
+ * @see RegularExpression#matches(java.lang.String, Match)
+ * @author TAMURA Kent <kent@trl.ibm.co.jp>
+ */
+public class Match implements Cloneable {
+ int[] beginpos = null;
+ int[] endpos = null;
+ int nofgroups = 0;
+
+ CharacterIterator ciSource = null;
+ String strSource = null;
+ char[] charSource = null;
+
+ /**
+ * Creates an instance.
+ */
+ public Match() {
+ }
+
+ /**
+ *
+ */
+ public synchronized Object clone() {
+ Match ma = new Match();
+ if (this.nofgroups > 0) {
+ ma.setNumberOfGroups(this.nofgroups);
+ if (this.ciSource != null) ma.setSource(this.ciSource);
+ if (this.strSource != null) ma.setSource(this.strSource);
+ for (int i = 0; i < this.nofgroups; i ++) {
+ ma.setBeginning(i, this.getBeginning(i));
+ ma.setEnd(i, this.getEnd(i));
+ }
+ }
+ return ma;
+ }
+
+ /**
+ *
+ */
+ protected void setNumberOfGroups(int n) {
+ int oldn = this.nofgroups;
+ this.nofgroups = n;
+ if (oldn <= 0
+ || oldn < n || n*2 < oldn) {
+ this.beginpos = new int[n];
+ this.endpos = new int[n];
+ }
+ for (int i = 0; i < n; i ++) {
+ this.beginpos[i] = -1;
+ this.endpos[i] = -1;
+ }
+ }
+
+ /**
+ *
+ */
+ protected void setSource(CharacterIterator ci) {
+ this.ciSource = ci;
+ this.strSource = null;
+ this.charSource = null;
+ }
+ /**
+ *
+ */
+ protected void setSource(String str) {
+ this.ciSource = null;
+ this.strSource = str;
+ this.charSource = null;
+ }
+ /**
+ *
+ */
+ protected void setSource(char[] chars) {
+ this.ciSource = null;
+ this.strSource = null;
+ this.charSource = chars;
+ }
+
+ /**
+ *
+ */
+ protected void setBeginning(int index, int v) {
+ this.beginpos[index] = v;
+ }
+
+ /**
+ *
+ */
+ protected void setEnd(int index, int v) {
+ this.endpos[index] = v;
+ }
+
+ /**
+ * Return the number of regular expression groups.
+ * This method returns 1 when the regular expression has no capturing-parenthesis.
+ */
+ public int getNumberOfGroups() {
+ if (this.nofgroups <= 0)
+ throw new IllegalStateException("A result is not set.");
+ return this.nofgroups;
+ }
+
+ /**
+ * Return a start position in the target text matched to specified regular expression group.
+ *
+ * @param index Less than <code>getNumberOfGroups()</code>.
+ */
+ public int getBeginning(int index) {
+ if (this.beginpos == null)
+ throw new IllegalStateException("A result is not set.");
+ if (index < 0 || this.nofgroups <= index)
+ throw new IllegalArgumentException("The parameter must be less than "
+ +this.nofgroups+": "+index);
+ return this.beginpos[index];
+ }
+
+ /**
+ * Return an end position in the target text matched to specified regular expression group.
+ *
+ * @param index Less than <code>getNumberOfGroups()</code>.
+ */
+ public int getEnd(int index) {
+ if (this.endpos == null)
+ throw new IllegalStateException("A result is not set.");
+ if (index < 0 || this.nofgroups <= index)
+ throw new IllegalArgumentException("The parameter must be less than "
+ +this.nofgroups+": "+index);
+ return this.endpos[index];
+ }
+
+ /**
+ * Return an substring of the target text matched to specified regular expression group.
+ *
+ * @param index Less than <code>getNumberOfGroups()</code>.
+ */
+ public String getCapturedText(int index) {
+ if (this.beginpos == null)
+ throw new IllegalStateException("match() has never been called.");
+ if (index < 0 || this.nofgroups <= index)
+ throw new IllegalArgumentException("The parameter must be less than "
+ +this.nofgroups+": "+index);
+ String ret;
+ int begin = this.beginpos[index], end = this.endpos[index];
+ if (begin < 0 || end < 0) return null;
+ if (this.ciSource != null) {
+ ret = REUtil.substring(this.ciSource, begin, end);
+ } else if (this.strSource != null) {
+ ret = this.strSource.substring(begin, end);
+ } else {
+ ret = new String(this.charSource, begin, end-begin);
+ }
+ return ret;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Op.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Op.java
new file mode 100644
index 0000000..428ffc9
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Op.java
@@ -0,0 +1,247 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.util.Vector;
+
+/**
+ */
+class Op {
+ static final int DOT = 0;
+ static final int CHAR = 1; // Single character
+ static final int RANGE = 3; // [a-zA-Z]
+ static final int NRANGE = 4; // [^a-zA-Z]
+ static final int ANCHOR = 5; // ^ $ ...
+ static final int STRING = 6; // literal String
+ static final int CLOSURE = 7; // X*
+ static final int NONGREEDYCLOSURE = 8; // X*?
+ static final int QUESTION = 9; // X?
+ static final int NONGREEDYQUESTION = 10; // X??
+ static final int UNION = 11; // X|Y
+ static final int CAPTURE = 15; // ( and )
+ static final int BACKREFERENCE = 16; // \1 \2 ...
+ static final int LOOKAHEAD = 20; // (?=...)
+ static final int NEGATIVELOOKAHEAD = 21; // (?!...)
+ static final int LOOKBEHIND = 22; // (?<=...)
+ static final int NEGATIVELOOKBEHIND = 23; // (?<!...)
+ static final int INDEPENDENT = 24; // (?>...)
+ static final int MODIFIER = 25; // (?ims-ims:...)
+ static final int CONDITION = 26; // (?(..)yes|no)
+
+ static int nofinstances = 0;
+ static final boolean COUNT = false;
+
+ static Op createDot() {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new Op(Op.DOT);
+ }
+ static CharOp createChar(int data) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new CharOp(Op.CHAR, data);
+ }
+ static CharOp createAnchor(int data) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new CharOp(Op.ANCHOR, data);
+ }
+ static CharOp createCapture(int number, Op next) {
+ if (Op.COUNT) Op.nofinstances ++;
+ CharOp op = new CharOp(Op.CAPTURE, number);
+ op.next = next;
+ return op;
+ }
+ static UnionOp createUnion(int size) {
+ if (Op.COUNT) Op.nofinstances ++;
+ //System.err.println("Creates UnionOp");
+ return new UnionOp(Op.UNION, size);
+ }
+ static ChildOp createClosure(int id) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new ModifierOp(Op.CLOSURE, id, -1);
+ }
+ static ChildOp createNonGreedyClosure() {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new ChildOp(Op.NONGREEDYCLOSURE);
+ }
+ static ChildOp createQuestion(boolean nongreedy) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new ChildOp(nongreedy ? Op.NONGREEDYQUESTION : Op.QUESTION);
+ }
+ static RangeOp createRange(Token tok) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new RangeOp(Op.RANGE, tok);
+ }
+ static ChildOp createLook(int type, Op next, Op branch) {
+ if (Op.COUNT) Op.nofinstances ++;
+ ChildOp op = new ChildOp(type);
+ op.setChild(branch);
+ op.next = next;
+ return op;
+ }
+ static CharOp createBackReference(int refno) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new CharOp(Op.BACKREFERENCE, refno);
+ }
+ static StringOp createString(String literal) {
+ if (Op.COUNT) Op.nofinstances ++;
+ return new StringOp(Op.STRING, literal);
+ }
+ static ChildOp createIndependent(Op next, Op branch) {
+ if (Op.COUNT) Op.nofinstances ++;
+ ChildOp op = new ChildOp(Op.INDEPENDENT);
+ op.setChild(branch);
+ op.next = next;
+ return op;
+ }
+ static ModifierOp createModifier(Op next, Op branch, int add, int mask) {
+ if (Op.COUNT) Op.nofinstances ++;
+ ModifierOp op = new ModifierOp(Op.MODIFIER, add, mask);
+ op.setChild(branch);
+ op.next = next;
+ return op;
+ }
+ static ConditionOp createCondition(Op next, int ref, Op conditionflow, Op yesflow, Op noflow) {
+ if (Op.COUNT) Op.nofinstances ++;
+ ConditionOp op = new ConditionOp(Op.CONDITION, ref, conditionflow, yesflow, noflow);
+ op.next = next;
+ return op;
+ }
+
+ int type;
+ Op next = null;
+
+ protected Op(int type) {
+ this.type = type;
+ }
+
+ int size() { // for UNION
+ return 0;
+ }
+ Op elementAt(int index) { // for UNIoN
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+ Op getChild() { // for CLOSURE, QUESTION
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+ // ModifierOp
+ int getData() { // CharOp for CHAR, BACKREFERENCE, CAPTURE, ANCHOR,
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+ int getData2() { // ModifierOp
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+ RangeToken getToken() { // RANGE, NRANGE
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+ String getString() { // STRING
+ throw new RuntimeException("Internal Error: type="+this.type);
+ }
+
+ // ================================================================
+ static class CharOp extends Op {
+ int charData;
+ CharOp(int type, int data) {
+ super(type);
+ this.charData = data;
+ }
+ int getData() {
+ return this.charData;
+ }
+ }
+
+ // ================================================================
+ static class UnionOp extends Op {
+ Vector branches;
+ UnionOp(int type, int size) {
+ super(type);
+ this.branches = new Vector(size);
+ }
+ void addElement(Op op) {
+ this.branches.addElement(op);
+ }
+ int size() {
+ return this.branches.size();
+ }
+ Op elementAt(int index) {
+ return (Op)this.branches.elementAt(index);
+ }
+ }
+
+ // ================================================================
+ static class ChildOp extends Op {
+ Op child;
+ ChildOp(int type) {
+ super(type);
+ }
+ void setChild(Op child) {
+ this.child = child;
+ }
+ Op getChild() {
+ return this.child;
+ }
+ }
+ // ================================================================
+ static class ModifierOp extends ChildOp {
+ int v1;
+ int v2;
+ ModifierOp(int type, int v1, int v2) {
+ super(type);
+ this.v1 = v1;
+ this.v2 = v2;
+ }
+ int getData() {
+ return this.v1;
+ }
+ int getData2() {
+ return this.v2;
+ }
+ }
+ // ================================================================
+ static class RangeOp extends Op {
+ Token tok;
+ RangeOp(int type, Token tok) {
+ super(type);
+ this.tok = tok;
+ }
+ RangeToken getToken() {
+ return (RangeToken)this.tok;
+ }
+ }
+ // ================================================================
+ static class StringOp extends Op {
+ String string;
+ StringOp(int type, String literal) {
+ super(type);
+ this.string = literal;
+ }
+ String getString() {
+ return this.string;
+ }
+ }
+ // ================================================================
+ static class ConditionOp extends Op {
+ int refNumber;
+ Op condition;
+ Op yes;
+ Op no;
+ ConditionOp(int type, int refno, Op conditionflow, Op yesflow, Op noflow) {
+ super(type);
+ this.refNumber = refno;
+ this.condition = conditionflow;
+ this.yes = yesflow;
+ this.no = noflow;
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParseException.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParseException.java
new file mode 100644
index 0000000..0d16e0d
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParseException.java
@@ -0,0 +1,45 @@
+/* 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.xmlbeans.impl.regex;
+
+/**
+ *
+ * @author TAMURA Kent <kent@trl.ibm.co.jp>
+ */
+public class ParseException extends RuntimeException {
+ int location;
+
+ /*
+ public ParseException(String mes) {
+ this(mes, -1);
+ }
+ */
+ /**
+ *
+ */
+ public ParseException(String mes, int location) {
+ super(mes);
+ this.location = location;
+ }
+
+ /**
+ *
+ * @return -1 if location information is not available.
+ */
+ public int getLocation() {
+ return this.location;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParserForXMLSchema.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParserForXMLSchema.java
new file mode 100644
index 0000000..c8296f8
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/ParserForXMLSchema.java
@@ -0,0 +1,462 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.util.Hashtable;
+import java.util.Locale;
+
+/**
+ * A regular expression parser for the XML Shema.
+ *
+ * @author TAMURA Kent <kent@trl.ibm.co.jp>
+ */
+class ParserForXMLSchema extends RegexParser {
+
+ public ParserForXMLSchema() {
+ //this.setLocale(Locale.getDefault());
+ }
+ public ParserForXMLSchema(Locale locale) {
+ //this.setLocale(locale);
+ }
+
+ Token processCaret() throws ParseException {
+ this.next();
+ return Token.createChar('^');
+ }
+ Token processDollar() throws ParseException {
+ this.next();
+ return Token.createChar('$');
+ }
+ Token processLookahead() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processNegativelookahead() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processLookbehind() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processNegativelookbehind() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_A() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_Z() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_z() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_b() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_B() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_lt() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_gt() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processStar(Token tok) throws ParseException {
+ this.next();
+ return Token.createClosure(tok);
+ }
+ Token processPlus(Token tok) throws ParseException {
+ // X+ -> XX*
+ this.next();
+ return Token.createConcat(tok, Token.createClosure(tok));
+ }
+ Token processQuestion(Token tok) throws ParseException {
+ // X? -> X|
+ this.next();
+ Token par = Token.createUnion();
+ par.addChild(tok);
+ par.addChild(Token.createEmpty());
+ return par;
+ }
+ boolean checkQuestion(int off) {
+ return false;
+ }
+ Token processParen() throws ParseException {
+ this.next();
+ Token tok = Token.createParen(this.parseRegex(), 0);
+ if (this.read() != super.T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // Skips ')'
+ return tok;
+ }
+ Token processParen2() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processCondition() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processModifiers() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processIndependent() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_c() throws ParseException {
+ this.next();
+ return this.getTokenForShorthand('c');
+ }
+ Token processBacksolidus_C() throws ParseException {
+ this.next();
+ return this.getTokenForShorthand('C');
+ }
+ Token processBacksolidus_i() throws ParseException {
+ this.next();
+ return this.getTokenForShorthand('i');
+ }
+ Token processBacksolidus_I() throws ParseException {
+ this.next();
+ return this.getTokenForShorthand('I');
+ }
+ Token processBacksolidus_g() throws ParseException {
+ throw this.ex("parser.process.1", this.offset-2);
+ }
+ Token processBacksolidus_X() throws ParseException {
+ throw ex("parser.process.1", this.offset-2);
+ }
+ Token processBackreference() throws ParseException {
+ throw ex("parser.process.1", this.offset-4);
+ }
+
+ int processCIinCharacterClass(RangeToken tok, int c) {
+ tok.mergeRanges(this.getTokenForShorthand(c));
+ return -1;
+ }
+
+
+ /**
+ * Parses a character-class-expression, not a character-class-escape.
+ *
+ * c-c-expression ::= '[' c-group ']'
+ * c-group ::= positive-c-group | negative-c-group | c-c-subtraction
+ * positive-c-group ::= (c-range | c-c-escape)+
+ * negative-c-group ::= '^' positive-c-group
+ * c-c-subtraction ::= (positive-c-group | negative-c-group) subtraction
+ * subtraction ::= '-' c-c-expression
+ * c-range ::= single-range | from-to-range
+ * single-range ::= multi-c-escape | category-c-escape | block-c-escape | <any XML char>
+ * cc-normal-c ::= <any character except [, ], \>
+ * from-to-range ::= cc-normal-c '-' cc-normal-c
+ *
+ * @param useNrage Ignored.
+ * @return This returns no NrageToken.
+ */
+ protected RangeToken parseCharacterClass(boolean useNrange) throws ParseException {
+ this.setContext(S_INBRACKETS);
+ this.next(); // '['
+ boolean nrange = false;
+ RangeToken base = null;
+ RangeToken tok;
+ if (this.read() == T_CHAR && this.chardata == '^') {
+ nrange = true;
+ this.next(); // '^'
+ base = Token.createRange();
+ base.addRange(0, Token.UTF16_MAX);
+ tok = Token.createRange();
+ } else {
+ tok = Token.createRange();
+ }
+ int type;
+ boolean firstloop = true;
+ while ((type = this.read()) != T_EOF) { // Don't use 'cotinue' for this loop.
+ // single-range | from-to-range | subtraction
+ if (type == T_CHAR && this.chardata == ']' && !firstloop) {
+ if (nrange) {
+ base.subtractRanges(tok);
+ tok = base;
+ }
+ break;
+ }
+ int c = this.chardata;
+ boolean end = false;
+ if (type == T_BACKSOLIDUS) {
+ switch (c) {
+ case 'd': case 'D':
+ case 'w': case 'W':
+ case 's': case 'S':
+ tok.mergeRanges(this.getTokenForShorthand(c));
+ end = true;
+ break;
+
+ case 'i': case 'I':
+ case 'c': case 'C':
+ c = this.processCIinCharacterClass(tok, c);
+ if (c < 0) end = true;
+ break;
+
+ case 'p':
+ case 'P':
+ int pstart = this.offset;
+ RangeToken tok2 = this.processBacksolidus_pP(c);
+ if (tok2 == null) throw this.ex("parser.atom.5", pstart);
+ tok.mergeRanges(tok2);
+ end = true;
+ break;
+
+ default:
+ c = this.decodeEscaped();
+ } // \ + c
+ } // backsolidus
+ else if (type == T_XMLSCHEMA_CC_SUBTRACTION && !firstloop) {
+ // Subraction
+ if (nrange) {
+ base.subtractRanges(tok);
+ tok = base;
+ }
+ RangeToken range2 = this.parseCharacterClass(false);
+ tok.subtractRanges(range2);
+ if (this.read() != T_CHAR || this.chardata != ']')
+ throw this.ex("parser.cc.5", this.offset);
+ break; // Exit this loop
+ }
+ this.next();
+ if (!end) { // if not shorthands...
+ if (type == T_CHAR) {
+ if (c == '[') throw this.ex("parser.cc.6", this.offset-2);
+ if (c == ']') throw this.ex("parser.cc.7", this.offset-2);
+ }
+ if (this.read() != T_CHAR || this.chardata != '-') { // Here is no '-'.
+ tok.addRange(c, c);
+ } else { // Found '-'
+ // Is this '-' is a from-to token??
+ this.next(); // Skips '-'
+ if ((type = this.read()) == T_EOF) throw this.ex("parser.cc.2", this.offset);
+ // c '-' ']' -> '-' is a single-range.
+ if (type == T_CHAR && this.chardata == ']') {
+ tok.addRange(c, c);
+ tok.addRange('-', '-');
+ }
+ // c '-' '-[' -> '-' is a single-range.
+ else if (type == T_XMLSCHEMA_CC_SUBTRACTION) {
+ tok.addRange(c, c);
+ tok.addRange('-', '-');
+ } else {
+ int rangeend = this.chardata;
+ if (type == T_CHAR) {
+ if (rangeend == '[') throw this.ex("parser.cc.6", this.offset-1);
+ if (rangeend == ']') throw this.ex("parser.cc.7", this.offset-1);
+ }
+ if (type == T_BACKSOLIDUS)
+ rangeend = this.decodeEscaped();
+ this.next();
+ tok.addRange(c, rangeend);
+ }
+ }
+ }
+ firstloop = false;
+ }
+ if (this.read() == T_EOF)
+ throw this.ex("parser.cc.2", this.offset);
+ tok.sortRanges();
+ tok.compactRanges();
+ //tok.dumpRanges();
+ this.setContext(S_NORMAL);
+ this.next(); // Skips ']'
+
+ return tok;
+ }
+
+ protected RangeToken parseSetOperations() throws ParseException {
+ throw this.ex("parser.process.1", this.offset);
+ }
+
+ Token getTokenForShorthand(int ch) {
+ switch (ch) {
+ case 'd':
+ return ParserForXMLSchema.getRange("xml:isDigit", true);
+ case 'D':
+ return ParserForXMLSchema.getRange("xml:isDigit", false);
+ case 'w':
+ return ParserForXMLSchema.getRange("xml:isWord", true);
+ case 'W':
+ return ParserForXMLSchema.getRange("xml:isWord", false);
+ case 's':
+ return ParserForXMLSchema.getRange("xml:isSpace", true);
+ case 'S':
+ return ParserForXMLSchema.getRange("xml:isSpace", false);
+ case 'c':
+ return ParserForXMLSchema.getRange("xml:isNameChar", true);
+ case 'C':
+ return ParserForXMLSchema.getRange("xml:isNameChar", false);
+ case 'i':
+ return ParserForXMLSchema.getRange("xml:isInitialNameChar", true);
+ case 'I':
+ return ParserForXMLSchema.getRange("xml:isInitialNameChar", false);
+ default:
+ throw new RuntimeException("Internal Error: shorthands: \\u"+Integer.toString(ch, 16));
+ }
+ }
+ int decodeEscaped() throws ParseException {
+ if (this.read() != T_BACKSOLIDUS) throw ex("parser.next.1", this.offset-1);
+ int c = this.chardata;
+ switch (c) {
+ case 'n': c = '\n'; break; // LINE FEED U+000A
+ case 'r': c = '\r'; break; // CRRIAGE RETURN U+000D
+ case 't': c = '\t'; break; // HORIZONTAL TABULATION U+0009
+
+ case 'e':
+ case 'f':
+ case 'x':
+ case 'u':
+ case 'v':
+ throw ex("parser.process.1", this.offset-2);
+ case 'A':
+ case 'Z':
+ case 'z':
+ throw ex("parser.descape.5", this.offset-2);
+ default:
+ }
+ return c;
+ }
+
+ static private Hashtable ranges = null;
+ static private Hashtable ranges2 = null;
+ static synchronized protected RangeToken getRange(String name, boolean positive) {
+ if (ranges == null) {
+ ranges = new Hashtable();
+ ranges2 = new Hashtable();
+
+ Token tok = Token.createRange();
+ setupRange(tok, SPACES);
+ ranges.put("xml:isSpace", tok);
+ ranges2.put("xml:isSpace", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ setupRange(tok, DIGITS);
+ ranges.put("xml:isDigit", tok);
+ ranges2.put("xml:isDigit", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ setupRange(tok, DIGITS);
+ ranges.put("xml:isDigit", tok);
+ ranges2.put("xml:isDigit", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ setupRange(tok, LETTERS);
+ tok.mergeRanges((Token)ranges.get("xml:isDigit"));
+ ranges.put("xml:isWord", tok);
+ ranges2.put("xml:isWord", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ setupRange(tok, NAMECHARS);
+ ranges.put("xml:isNameChar", tok);
+ ranges2.put("xml:isNameChar", Token.complementRanges(tok));
+
+ tok = Token.createRange();
+ setupRange(tok, LETTERS);
+ tok.addRange('_', '_');
+ tok.addRange(':', ':');
+ ranges.put("xml:isInitialNameChar", tok);
+ ranges2.put("xml:isInitialNameChar", Token.complementRanges(tok));
+ }
+ RangeToken tok = positive ? (RangeToken)ranges.get(name)
+ : (RangeToken)ranges2.get(name);
+ return tok;
+ }
+
+ static void setupRange(Token range, String src) {
+ int len = src.length();
+ for (int i = 0; i < len; i += 2)
+ range.addRange(src.charAt(i), src.charAt(i+1));
+ }
+
+ private static final String SPACES = "\t\n\r\r ";
+ private static final String NAMECHARS =
+ "\u002d\u002e\u0030\u003a\u0041\u005a\u005f\u005f\u0061\u007a\u00b7\u00b7\u00c0\u00d6"
+ +"\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148\u014a\u017e\u0180\u01c3\u01cd\u01f0"
+ +"\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1\u02d0\u02d1\u0300\u0345\u0360\u0361"
+ +"\u0386\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da\u03dc\u03dc"
+ +"\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c\u045e\u0481"
+ +"\u0483\u0486\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
+ +"\u0531\u0556\u0559\u0559\u0561\u0586\u0591\u05a1\u05a3\u05b9\u05bb\u05bd\u05bf\u05bf"
+ +"\u05c1\u05c2\u05c4\u05c4\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0640\u0652\u0660\u0669"
+ +"\u0670\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06e8\u06ea\u06ed\u06f0\u06f9"
+ +"\u0901\u0903\u0905\u0939\u093c\u094d\u0951\u0954\u0958\u0963\u0966\u096f\u0981\u0983"
+ +"\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09bc"
+ +"\u09be\u09c4\u09c7\u09c8\u09cb\u09cd\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09f1"
+ +"\u0a02\u0a02\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36"
+ +"\u0a38\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a59\u0a5c\u0a5e\u0a5e"
+ +"\u0a66\u0a74\u0a81\u0a83\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0"
+ +"\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ae0\u0ae0\u0ae6\u0aef"
+ +"\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b36\u0b39"
+ +"\u0b3c\u0b43\u0b47\u0b48\u0b4b\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b61\u0b66\u0b6f"
+ +"\u0b82\u0b83\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f"
+ +"\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd"
+ +"\u0bd7\u0bd7\u0be7\u0bef\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33"
+ +"\u0c35\u0c39\u0c3e\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c60\u0c61\u0c66\u0c6f"
+ +"\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cbe\u0cc4"
+ +"\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0\u0ce1\u0ce6\u0cef\u0d02\u0d03"
+ +"\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d3e\u0d43\u0d46\u0d48\u0d4a\u0d4d"
+ +"\u0d57\u0d57\u0d60\u0d61\u0d66\u0d6f\u0e01\u0e2e\u0e30\u0e3a\u0e40\u0e4e\u0e50\u0e59"
+ +"\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97\u0e99\u0e9f"
+ +"\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb9\u0ebb\u0ebd"
+ +"\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0f18\u0f19\u0f20\u0f29\u0f35\u0f35"
+ +"\u0f37\u0f37\u0f39\u0f39\u0f3e\u0f47\u0f49\u0f69\u0f71\u0f84\u0f86\u0f8b\u0f90\u0f95"
+ +"\u0f97\u0f97\u0f99\u0fad\u0fb1\u0fb7\u0fb9\u0fb9\u10a0\u10c5\u10d0\u10f6\u1100\u1100"
+ +"\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c\u113e\u113e"
+ +"\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159\u115f\u1161"
+ +"\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173\u1175\u1175"
+ +"\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba\u11bc\u11c2"
+ +"\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15\u1f18\u1f1d"
+ +"\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d\u1f5f\u1f7d"
+ +"\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3\u1fd6\u1fdb"
+ +"\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u20d0\u20dc\u20e1\u20e1\u2126\u2126\u212a\u212b"
+ +"\u212e\u212e\u2180\u2182\u3005\u3005\u3007\u3007\u3021\u302f\u3031\u3035\u3041\u3094"
+ +"\u3099\u309a\u309d\u309e\u30a1\u30fa\u30fc\u30fe\u3105\u312c\u4e00\u9fa5\uac00\ud7a3"
+ +"";
+ private static final String LETTERS =
+ "\u0041\u005a\u0061\u007a\u00c0\u00d6\u00d8\u00f6\u00f8\u0131\u0134\u013e\u0141\u0148"
+ +"\u014a\u017e\u0180\u01c3\u01cd\u01f0\u01f4\u01f5\u01fa\u0217\u0250\u02a8\u02bb\u02c1"
+ +"\u0386\u0386\u0388\u038a\u038c\u038c\u038e\u03a1\u03a3\u03ce\u03d0\u03d6\u03da\u03da"
+ +"\u03dc\u03dc\u03de\u03de\u03e0\u03e0\u03e2\u03f3\u0401\u040c\u040e\u044f\u0451\u045c"
+ +"\u045e\u0481\u0490\u04c4\u04c7\u04c8\u04cb\u04cc\u04d0\u04eb\u04ee\u04f5\u04f8\u04f9"
+ +"\u0531\u0556\u0559\u0559\u0561\u0586\u05d0\u05ea\u05f0\u05f2\u0621\u063a\u0641\u064a"
+ +"\u0671\u06b7\u06ba\u06be\u06c0\u06ce\u06d0\u06d3\u06d5\u06d5\u06e5\u06e6\u0905\u0939"
+ +"\u093d\u093d\u0958\u0961\u0985\u098c\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2"
+ +"\u09b6\u09b9\u09dc\u09dd\u09df\u09e1\u09f0\u09f1\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28"
+ +"\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59\u0a5c\u0a5e\u0a5e\u0a72\u0a74"
+ +"\u0a85\u0a8b\u0a8d\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9"
+ +"\u0abd\u0abd\u0ae0\u0ae0\u0b05\u0b0c\u0b0f\u0b10\u0b13\u0b28\u0b2a\u0b30\u0b32\u0b33"
+ +"\u0b36\u0b39\u0b3d\u0b3d\u0b5c\u0b5d\u0b5f\u0b61\u0b85\u0b8a\u0b8e\u0b90\u0b92\u0b95"
+ +"\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa\u0bae\u0bb5\u0bb7\u0bb9"
+ +"\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39\u0c60\u0c61\u0c85\u0c8c"
+ +"\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3\u0cb5\u0cb9\u0cde\u0cde\u0ce0\u0ce1\u0d05\u0d0c"
+ +"\u0d0e\u0d10\u0d12\u0d28\u0d2a\u0d39\u0d60\u0d61\u0e01\u0e2e\u0e30\u0e30\u0e32\u0e33"
+ +"\u0e40\u0e45\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d\u0e94\u0e97"
+ +"\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead\u0eae\u0eb0\u0eb0"
+ +"\u0eb2\u0eb3\u0ebd\u0ebd\u0ec0\u0ec4\u0f40\u0f47\u0f49\u0f69\u10a0\u10c5\u10d0\u10f6"
+ +"\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110b\u110c\u110e\u1112\u113c\u113c"
+ +"\u113e\u113e\u1140\u1140\u114c\u114c\u114e\u114e\u1150\u1150\u1154\u1155\u1159\u1159"
+ +"\u115f\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169\u116d\u116e\u1172\u1173"
+ +"\u1175\u1175\u119e\u119e\u11a8\u11a8\u11ab\u11ab\u11ae\u11af\u11b7\u11b8\u11ba\u11ba"
+ +"\u11bc\u11c2\u11eb\u11eb\u11f0\u11f0\u11f9\u11f9\u1e00\u1e9b\u1ea0\u1ef9\u1f00\u1f15"
+ +"\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b\u1f5d\u1f5d"
+ +"\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fbc\u1fbe\u1fbe\u1fc2\u1fc4\u1fc6\u1fcc\u1fd0\u1fd3"
+ +"\u1fd6\u1fdb\u1fe0\u1fec\u1ff2\u1ff4\u1ff6\u1ffc\u2126\u2126\u212a\u212b\u212e\u212e"
+ +"\u2180\u2182\u3007\u3007\u3021\u3029\u3041\u3094\u30a1\u30fa\u3105\u312c\u4e00\u9fa5"
+ +"\uac00\ud7a3";
+ private static final String DIGITS =
+ "\u0030\u0039\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6\u09EF\u0A66\u0A6F\u0AE6\u0AEF"
+ +"\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9"
+ +"\u0F20\u0F29";
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/README.txt b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/README.txt
new file mode 100644
index 0000000..6cf1167
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/README.txt
@@ -0,0 +1,11 @@
+This is an isolated directory that was taken from the
+Apache Xerces-J 2.0 project.
+
+It contains the following modifications:
+
+(1) a change in namespace.
+(2) the addition of a SchemaRegularExpression class for fast
+ detection of NCNAME, etc.
+
+No xbean code outside this directory or other directories with
+similar README notices was taken from Apache.
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/REUtil.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/REUtil.java
new file mode 100644
index 0000000..ca0dd2e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/REUtil.java
@@ -0,0 +1,326 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.text.CharacterIterator;
+
+public final class REUtil {
+ private REUtil() {
+ }
+
+ static final int composeFromSurrogates(int high, int low) {
+ return 0x10000 + ((high-0xd800)<<10) + low-0xdc00;
+ }
+
+ static final boolean isLowSurrogate(int ch) {
+ return (ch & 0xfc00) == 0xdc00;
+ }
+
+ static final boolean isHighSurrogate(int ch) {
+ return (ch & 0xfc00) == 0xd800;
+ }
+
+ static final String decomposeToSurrogates(int ch) {
+ char[] chs = new char[2];
+ ch -= 0x10000;
+ chs[0] = (char)((ch>>10)+0xd800);
+ chs[1] = (char)((ch&0x3ff)+0xdc00);
+ return new String(chs);
+ }
+
+ static final String substring(CharacterIterator iterator, int begin, int end) {
+ char[] src = new char[end-begin];
+ for (int i = 0; i < src.length; i ++)
+ src[i] = iterator.setIndex(i+begin);
+ return new String(src);
+ }
+
+ // ================================================================
+
+ static final int getOptionValue(int ch) {
+ int ret = 0;
+ switch (ch) {
+ case 'i':
+ ret = RegularExpression.IGNORE_CASE;
+ break;
+ case 'm':
+ ret = RegularExpression.MULTIPLE_LINES;
+ break;
+ case 's':
+ ret = RegularExpression.SINGLE_LINE;
+ break;
+ case 'x':
+ ret = RegularExpression.EXTENDED_COMMENT;
+ break;
+ case 'u':
+ ret = RegularExpression.USE_UNICODE_CATEGORY;
+ break;
+ case 'w':
+ ret = RegularExpression.UNICODE_WORD_BOUNDARY;
+ break;
+ case 'F':
+ ret = RegularExpression.PROHIBIT_FIXED_STRING_OPTIMIZATION;
+ break;
+ case 'H':
+ ret = RegularExpression.PROHIBIT_HEAD_CHARACTER_OPTIMIZATION;
+ break;
+ case 'X':
+ ret = RegularExpression.XMLSCHEMA_MODE;
+ break;
+ case ',':
+ ret = RegularExpression.SPECIAL_COMMA;
+ break;
+ default:
+ }
+ return ret;
+ }
+
+ static final int parseOptions(String opts) throws ParseException {
+ if (opts == null) return 0;
+ int options = 0;
+ for (int i = 0; i < opts.length(); i ++) {
+ int v = getOptionValue(opts.charAt(i));
+ if (v == 0)
+ throw new ParseException("Unknown Option: "+opts.substring(i), -1);
+ options |= v;
+ }
+ return options;
+ }
+
+ static final String createOptionString(int options) {
+ StringBuffer sb = new StringBuffer(9);
+ if ((options & RegularExpression.PROHIBIT_FIXED_STRING_OPTIMIZATION) != 0)
+ sb.append((char)'F');
+ if ((options & RegularExpression.PROHIBIT_HEAD_CHARACTER_OPTIMIZATION) != 0)
+ sb.append((char)'H');
+ if ((options & RegularExpression.XMLSCHEMA_MODE) != 0)
+ sb.append((char)'X');
+ if ((options & RegularExpression.IGNORE_CASE) != 0)
+ sb.append((char)'i');
+ if ((options & RegularExpression.MULTIPLE_LINES) != 0)
+ sb.append((char)'m');
+ if ((options & RegularExpression.SINGLE_LINE) != 0)
+ sb.append((char)'s');
+ if ((options & RegularExpression.USE_UNICODE_CATEGORY) != 0)
+ sb.append((char)'u');
+ if ((options & RegularExpression.UNICODE_WORD_BOUNDARY) != 0)
+ sb.append((char)'w');
+ if ((options & RegularExpression.EXTENDED_COMMENT) != 0)
+ sb.append((char)'x');
+ if ((options & RegularExpression.SPECIAL_COMMA) != 0)
+ sb.append((char)',');
+ return sb.toString().intern();
+ }
+
+ // ================================================================
+
+ static String stripExtendedComment(String regex) {
+ int len = regex.length();
+ StringBuffer buffer = new StringBuffer(len);
+ int offset = 0;
+ while (offset < len) {
+ int ch = regex.charAt(offset++);
+ // Skips a white space.
+ if (ch == '\t' || ch == '\n' || ch == '\f' || ch == '\r' || ch == ' ')
+ continue;
+
+ if (ch == '#') { // Skips chracters between '#' and a line end.
+ while (offset < len) {
+ ch = regex.charAt(offset++);
+ if (ch == '\r' || ch == '\n')
+ break;
+ }
+ continue;
+ }
+
+ int next; // Strips an escaped white space.
+ if (ch == '\\' && offset < len) {
+ if ((next = regex.charAt(offset)) == '#'
+ || next == '\t' || next == '\n' || next == '\f'
+ || next == '\r' || next == ' ') {
+ buffer.append((char)next);
+ offset ++;
+ } else { // Other escaped character.
+ buffer.append((char)'\\');
+ buffer.append((char)next);
+ offset ++;
+ }
+ } else // As is.
+ buffer.append((char)ch);
+ }
+ return buffer.toString();
+ }
+
+ // ================================================================
+
+ /**
+ * Sample entry.
+ * <div>Usage: <KBD>org.apache.xerces.utils.regex.REUtil <regex> <string></KBD></div>
+ */
+ public static void main(String[] argv) {
+ String pattern = null;
+ try {
+ String options = "";
+ String target = null;
+ if( argv.length == 0 ) {
+ System.out.println( "Error:Usage: java REUtil -i|-m|-s|-u|-w|-X regularExpression String" );
+ System.exit( 0 );
+ }
+ for (int i = 0; i < argv.length; i ++) {
+ if (argv[i].length() == 0 || argv[i].charAt(0) != '-') {
+ if (pattern == null)
+ pattern = argv[i];
+ else if (target == null)
+ target = argv[i];
+ else
+ System.err.println("Unnecessary: "+argv[i]);
+ } else if (argv[i].equals("-i")) {
+ options += "i";
+ } else if (argv[i].equals("-m")) {
+ options += "m";
+ } else if (argv[i].equals("-s")) {
+ options += "s";
+ } else if (argv[i].equals("-u")) {
+ options += "u";
+ } else if (argv[i].equals("-w")) {
+ options += "w";
+ } else if (argv[i].equals("-X")) {
+ options += "X";
+ } else {
+ System.err.println("Unknown option: "+argv[i]);
+ }
+ }
+ RegularExpression reg = new RegularExpression(pattern, options);
+ System.out.println("RegularExpression: "+reg);
+ Match match = new Match();
+ reg.matches(target, match);
+ for (int i = 0; i < match.getNumberOfGroups(); i ++) {
+ if (i == 0 ) System.out.print("Matched range for the whole pattern: ");
+ else System.out.print("["+i+"]: ");
+ if (match.getBeginning(i) < 0)
+ System.out.println("-1");
+ else {
+ System.out.print(match.getBeginning(i)+", "+match.getEnd(i)+", ");
+ System.out.println("\""+match.getCapturedText(i)+"\"");
+ }
+ }
+ } catch (ParseException pe) {
+ if (pattern == null) {
+ pe.printStackTrace();
+ } else {
+ System.err.println("org.apache.xerces.utils.regex.ParseException: "+pe.getMessage());
+ String indent = " ";
+ System.err.println(indent+pattern);
+ int loc = pe.getLocation();
+ if (loc >= 0) {
+ System.err.print(indent);
+ for (int i = 0; i < loc; i ++) System.err.print("-");
+ System.err.println("^");
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ static final int CACHESIZE = 20;
+ static final RegularExpression[] regexCache = new RegularExpression[CACHESIZE];
+ /**
+ * Creates a RegularExpression instance.
+ * This method caches created instances.
+ *
+ * @seeq RegularExpression#RegularExpression(java.lang.String, java.lang.String)
+ */
+ public static RegularExpression createRegex(String pattern, String options)
+ throws ParseException {
+ RegularExpression re = null;
+ int intOptions = REUtil.parseOptions(options);
+ synchronized (REUtil.regexCache) {
+ int i;
+ for (i = 0; i < REUtil.CACHESIZE; i ++) {
+ RegularExpression cached = REUtil.regexCache[i];
+ if (cached == null) {
+ i = -1;
+ break;
+ }
+ if (cached.equals(pattern, intOptions)) {
+ re = cached;
+ break;
+ }
+ }
+ if (re != null) {
+ if (i != 0) {
+ System.arraycopy(REUtil.regexCache, 0, REUtil.regexCache, 1, i);
+ REUtil.regexCache[0] = re;
+ }
+ } else {
+ re = new RegularExpression(pattern, options);
+ System.arraycopy(REUtil.regexCache, 0, REUtil.regexCache, 1, REUtil.CACHESIZE-1);
+ REUtil.regexCache[0] = re;
+ }
+ }
+ return re;
+ }
+
+ /**
+ *
+ * @see RegularExpression#matches(java.lang.String)
+ */
+ public static boolean matches(String regex, String target) throws ParseException {
+ return REUtil.createRegex(regex, null).matches(target);
+ }
+
+ /**
+ *
+ * @see RegularExpression#matches(java.lang.String)
+ */
+ public static boolean matches(String regex, String options, String target) throws ParseException {
+ return REUtil.createRegex(regex, options).matches(target);
+ }
+
+ // ================================================================
+
+ /**
+ *
+ */
+ public static String quoteMeta(String literal) {
+ int len = literal.length();
+ StringBuffer buffer = null;
+ for (int i = 0; i < len; i ++) {
+ int ch = literal.charAt(i);
+ if (".*+?{[()|\\^$".indexOf(ch) >= 0) {
+ if (buffer == null) {
+ buffer = new StringBuffer(i+(len-i)*2);
+ if (i > 0) buffer.append(literal.substring(0, i));
+ }
+ buffer.append((char)'\\');
+ buffer.append((char)ch);
+ } else if (buffer != null)
+ buffer.append((char)ch);
+ }
+ return buffer != null ? buffer.toString() : literal;
+ }
+
+ // ================================================================
+
+ static void dumpString(String v) {
+ for (int i = 0; i < v.length(); i ++) {
+ System.out.print(Integer.toHexString(v.charAt(i)));
+ System.out.print(" ");
+ }
+ System.out.println();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java
new file mode 100644
index 0000000..21f7b98
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java
@@ -0,0 +1,607 @@
+/* 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.xmlbeans.impl.regex;
+
+/**
+ * This class represents a character class such as [a-z] or a period.
+ */
+final class RangeToken extends Token implements java.io.Serializable {
+
+ int[] ranges;
+ boolean sorted;
+ boolean compacted;
+ RangeToken icaseCache = null;
+ int[] map = null;
+ int nonMapIndex;
+
+ RangeToken(int type) {
+ super(type);
+ this.setSorted(false);
+ }
+
+ // for RANGE or NRANGE
+ protected void addRange(int start, int end) {
+ this.icaseCache = null;
+ //System.err.println("Token#addRange(): "+start+" "+end);
+ int r1, r2;
+ if (start <= end) {
+ r1 = start;
+ r2 = end;
+ } else {
+ r1 = end;
+ r2 = start;
+ }
+
+ int pos = 0;
+ if (this.ranges == null) {
+ this.ranges = new int[2];
+ this.ranges[0] = r1;
+ this.ranges[1] = r2;
+ this.setSorted(true);
+ } else {
+ pos = this.ranges.length;
+ if (this.ranges[pos-1]+1 == r1) {
+ this.ranges[pos-1] = r2;
+ return;
+ }
+ int[] temp = new int[pos+2];
+ System.arraycopy(this.ranges, 0, temp, 0, pos);
+ this.ranges = temp;
+ if (this.ranges[pos-1] >= r1)
+ this.setSorted(false);
+ this.ranges[pos++] = r1;
+ this.ranges[pos] = r2;
+ if (!this.sorted)
+ this.sortRanges();
+ }
+ }
+
+ private final boolean isSorted() {
+ return this.sorted;
+ }
+ private final void setSorted(boolean sort) {
+ this.sorted = sort;
+ if (!sort) this.compacted = false;
+ }
+ private final boolean isCompacted() {
+ return this.compacted;
+ }
+ private final void setCompacted() {
+ this.compacted = true;
+ }
+
+ protected void sortRanges() {
+ if (this.isSorted())
+ return;
+ if (this.ranges == null)
+ return;
+ //System.err.println("Do sorting: "+this.ranges.length);
+
+ // Bubble sort
+ // Why? -- In many cases,
+ // this.ranges has few elements.
+ for (int i = this.ranges.length-4; i >= 0; i -= 2) {
+ for (int j = 0; j <= i; j += 2) {
+ if (this.ranges[j] > this.ranges[j+2]
+ || this.ranges[j] == this.ranges[j+2] && this.ranges[j+1] > this.ranges[j+3]) {
+ int tmp;
+ tmp = this.ranges[j+2];
+ this.ranges[j+2] = this.ranges[j];
+ this.ranges[j] = tmp;
+ tmp = this.ranges[j+3];
+ this.ranges[j+3] = this.ranges[j+1];
+ this.ranges[j+1] = tmp;
+ }
+ }
+ }
+ this.setSorted(true);
+ }
+
+ /**
+ * this.ranges is sorted.
+ */
+ protected void compactRanges() {
+ boolean DEBUG = false;
+ if (this.ranges == null || this.ranges.length <= 2)
+ return;
+ if (this.isCompacted())
+ return;
+ int base = 0; // Index of writing point
+ int target = 0; // Index of processing point
+
+ while (target < this.ranges.length) {
+ if (base != target) {
+ this.ranges[base] = this.ranges[target++];
+ this.ranges[base+1] = this.ranges[target++];
+ } else
+ target += 2;
+ int baseend = this.ranges[base+1];
+ while (target < this.ranges.length) {
+ if (baseend+1 < this.ranges[target])
+ break;
+ if (baseend+1 == this.ranges[target]) {
+ if (DEBUG)
+ System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base]
+ +", "+this.ranges[base+1]
+ +"], ["+this.ranges[target]
+ +", "+this.ranges[target+1]
+ +"] -> ["+this.ranges[base]
+ +", "+this.ranges[target+1]
+ +"]");
+ this.ranges[base+1] = this.ranges[target+1];
+ baseend = this.ranges[base+1];
+ target += 2;
+ } else if (baseend >= this.ranges[target+1]) {
+ if (DEBUG)
+ System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base]
+ +", "+this.ranges[base+1]
+ +"], ["+this.ranges[target]
+ +", "+this.ranges[target+1]
+ +"] -> ["+this.ranges[base]
+ +", "+this.ranges[base+1]
+ +"]");
+ target += 2;
+ } else if (baseend < this.ranges[target+1]) {
+ if (DEBUG)
+ System.err.println("Token#compactRanges(): Compaction: ["+this.ranges[base]
+ +", "+this.ranges[base+1]
+ +"], ["+this.ranges[target]
+ +", "+this.ranges[target+1]
+ +"] -> ["+this.ranges[base]
+ +", "+this.ranges[target+1]
+ +"]");
+ this.ranges[base+1] = this.ranges[target+1];
+ baseend = this.ranges[base+1];
+ target += 2;
+ } else {
+ throw new RuntimeException("Token#compactRanges(): Internel Error: ["
+ +this.ranges[base]
+ +","+this.ranges[base+1]
+ +"] ["+this.ranges[target]
+ +","+this.ranges[target+1]+"]");
+ }
+ } // while
+ base += 2;
+ }
+
+ if (base != this.ranges.length) {
+ int[] result = new int[base];
+ System.arraycopy(this.ranges, 0, result, 0, base);
+ this.ranges = result;
+ }
+ this.setCompacted();
+ }
+
+ protected void mergeRanges(Token token) {
+ RangeToken tok = (RangeToken)token;
+ this.sortRanges();
+ tok.sortRanges();
+ if (tok.ranges == null)
+ return;
+ this.icaseCache = null;
+ this.setSorted(true);
+ if (this.ranges == null) {
+ this.ranges = new int[tok.ranges.length];
+ System.arraycopy(tok.ranges, 0, this.ranges, 0, tok.ranges.length);
+ return;
+ }
+ int[] result = new int[this.ranges.length+tok.ranges.length];
+ for (int i = 0, j = 0, k = 0; i < this.ranges.length || j < tok.ranges.length;) {
+ if (i >= this.ranges.length) {
+ result[k++] = tok.ranges[j++];
+ result[k++] = tok.ranges[j++];
+ } else if (j >= tok.ranges.length) {
+ result[k++] = this.ranges[i++];
+ result[k++] = this.ranges[i++];
+ } else if (tok.ranges[j] < this.ranges[i]
+ || tok.ranges[j] == this.ranges[i] && tok.ranges[j+1] < this.ranges[i+1]) {
+ result[k++] = tok.ranges[j++];
+ result[k++] = tok.ranges[j++];
+ } else {
+ result[k++] = this.ranges[i++];
+ result[k++] = this.ranges[i++];
+ }
+ }
+ this.ranges = result;
+ }
+
+ protected void subtractRanges(Token token) {
+ if (token.type == NRANGE) {
+ this.intersectRanges(token);
+ return;
+ }
+ RangeToken tok = (RangeToken)token;
+ if (tok.ranges == null || this.ranges == null)
+ return;
+ this.icaseCache = null;
+ this.sortRanges();
+ this.compactRanges();
+ tok.sortRanges();
+ tok.compactRanges();
+
+ //System.err.println("Token#substractRanges(): Entry: "+this.ranges.length+", "+tok.ranges.length);
+
+ int[] result = new int[this.ranges.length+tok.ranges.length];
+ int wp = 0, src = 0, sub = 0;
+ while (src < this.ranges.length && sub < tok.ranges.length) {
+ int srcbegin = this.ranges[src];
+ int srcend = this.ranges[src+1];
+ int subbegin = tok.ranges[sub];
+ int subend = tok.ranges[sub+1];
+ if (srcend < subbegin) { // Not overlapped
+ // src: o-----o
+ // sub: o-----o
+ // res: o-----o
+ // Reuse sub
+ result[wp++] = this.ranges[src++];
+ result[wp++] = this.ranges[src++];
+ } else if (srcend >= subbegin
+ && srcbegin <= subend) { // Overlapped
+ // src: o--------o
+ // sub: o----o
+ // sub: o----o
+ // sub: o----o
+ // sub: o------------o
+ if (subbegin <= srcbegin && srcend <= subend) {
+ // src: o--------o
+ // sub: o------------o
+ // res: empty
+ // Reuse sub
+ src += 2;
+ } else if (subbegin <= srcbegin) {
+ // src: o--------o
+ // sub: o----o
+ // res: o-----o
+ // Reuse src(=res)
+ this.ranges[src] = subend+1;
+ sub += 2;
+ } else if (srcend <= subend) {
+ // src: o--------o
+ // sub: o----o
+ // res: o-----o
+ // Reuse sub
+ result[wp++] = srcbegin;
+ result[wp++] = subbegin-1;
+ src += 2;
+ } else {
+ // src: o--------o
+ // sub: o----o
+ // res: o-o o-o
+ // Reuse src(=right res)
+ result[wp++] = srcbegin;
+ result[wp++] = subbegin-1;
+ this.ranges[src] = subend+1;
+ sub += 2;
+ }
+ } else if (subend < srcbegin) {
+ // Not overlapped
+ // src: o-----o
+ // sub: o----o
+ sub += 2;
+ } else {
+ throw new RuntimeException("Token#subtractRanges(): Internal Error: ["+this.ranges[src]
+ +","+this.ranges[src+1]
+ +"] - ["+tok.ranges[sub]
+ +","+tok.ranges[sub+1]
+ +"]");
+ }
+ }
+ while (src < this.ranges.length) {
+ result[wp++] = this.ranges[src++];
+ result[wp++] = this.ranges[src++];
+ }
+ this.ranges = new int[wp];
+ System.arraycopy(result, 0, this.ranges, 0, wp);
+ // this.ranges is sorted and compacted.
+ }
+
+ /**
+ * @param tok Ignore whether it is NRANGE or not.
+ */
+ protected void intersectRanges(Token token) {
+ RangeToken tok = (RangeToken)token;
+ if (tok.ranges == null || this.ranges == null)
+ return;
+ this.icaseCache = null;
+ this.sortRanges();
+ this.compactRanges();
+ tok.sortRanges();
+ tok.compactRanges();
+
+ int[] result = new int[this.ranges.length+tok.ranges.length];
+ int wp = 0, src1 = 0, src2 = 0;
+ while (src1 < this.ranges.length && src2 < tok.ranges.length) {
+ int src1begin = this.ranges[src1];
+ int src1end = this.ranges[src1+1];
+ int src2begin = tok.ranges[src2];
+ int src2end = tok.ranges[src2+1];
+ if (src1end < src2begin) { // Not overlapped
+ // src1: o-----o
+ // src2: o-----o
+ // res: empty
+ // Reuse src2
+ src1 += 2;
+ } else if (src1end >= src2begin
+ && src1begin <= src2end) { // Overlapped
+ // src1: o--------o
+ // src2: o----o
+ // src2: o----o
+ // src2: o----o
+ // src2: o------------o
+ if (src2begin <= src2begin && src1end <= src2end) {
+ // src1: o--------o
+ // src2: o------------o
+ // res: o--------o
+ // Reuse src2
+ result[wp++] = src1begin;
+ result[wp++] = src1end;
+ src1 += 2;
+ } else if (src2begin <= src1begin) {
+ // src1: o--------o
+ // src2: o----o
+ // res: o--o
+ // Reuse the rest of src1
+ result[wp++] = src1begin;
+ result[wp++] = src2end;
+ this.ranges[src1] = src2end+1;
+ src2 += 2;
+ } else if (src1end <= src2end) {
+ // src1: o--------o
+ // src2: o----o
+ // res: o--o
+ // Reuse src2
+ result[wp++] = src2begin;
+ result[wp++] = src1end;
+ src1 += 2;
+ } else {
+ // src1: o--------o
+ // src2: o----o
+ // res: o----o
+ // Reuse the rest of src1
+ result[wp++] = src2begin;
+ result[wp++] = src2end;
+ this.ranges[src1] = src2end+1;
+ }
+ } else if (src2end < src1begin) {
+ // Not overlapped
+ // src1: o-----o
+ // src2: o----o
+ src2 += 2;
+ } else {
+ throw new RuntimeException("Token#intersectRanges(): Internal Error: ["
+ +this.ranges[src1]
+ +","+this.ranges[src1+1]
+ +"] & ["+tok.ranges[src2]
+ +","+tok.ranges[src2+1]
+ +"]");
+ }
+ }
+ while (src1 < this.ranges.length) {
+ result[wp++] = this.ranges[src1++];
+ result[wp++] = this.ranges[src1++];
+ }
+ this.ranges = new int[wp];
+ System.arraycopy(result, 0, this.ranges, 0, wp);
+ // this.ranges is sorted and compacted.
+ }
+
+ /**
+ * for RANGE: Creates complement.
+ * for NRANGE: Creates the same meaning RANGE.
+ */
+ static Token complementRanges(Token token) {
+ if (token.type != RANGE && token.type != NRANGE)
+ throw new IllegalArgumentException("Token#complementRanges(): must be RANGE: "+token.type);
+ RangeToken tok = (RangeToken)token;
+ tok.sortRanges();
+ tok.compactRanges();
+ int len = tok.ranges.length+2;
+ if (tok.ranges[0] == 0)
+ len -= 2;
+ int last = tok.ranges[tok.ranges.length-1];
+ if (last == UTF16_MAX)
+ len -= 2;
+ RangeToken ret = Token.createRange();
+ ret.ranges = new int[len];
+ int wp = 0;
+ if (tok.ranges[0] > 0) {
+ ret.ranges[wp++] = 0;
+ ret.ranges[wp++] = tok.ranges[0]-1;
+ }
+ for (int i = 1; i < tok.ranges.length-2; i += 2) {
+ ret.ranges[wp++] = tok.ranges[i]+1;
+ ret.ranges[wp++] = tok.ranges[i+1]-1;
+ }
+ if (last != UTF16_MAX) {
+ ret.ranges[wp++] = last+1;
+ ret.ranges[wp] = UTF16_MAX;
+ }
+ ret.setCompacted();
+ return ret;
+ }
+
+ synchronized RangeToken getCaseInsensitiveToken() {
+ if (this.icaseCache != null)
+ return this.icaseCache;
+
+ RangeToken uppers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
+ for (int i = 0; i < this.ranges.length; i += 2) {
+ for (int ch = this.ranges[i]; ch <= this.ranges[i+1]; ch ++) {
+ if (ch > 0xffff)
+ uppers.addRange(ch, ch);
+ else {
+ char uch = Character.toUpperCase((char)ch);
+ uppers.addRange(uch, uch);
+ }
+ }
+ }
+ RangeToken lowers = this.type == Token.RANGE ? Token.createRange() : Token.createNRange();
+ for (int i = 0; i < uppers.ranges.length; i += 2) {
+ for (int ch = uppers.ranges[i]; ch <= uppers.ranges[i+1]; ch ++) {
+ if (ch > 0xffff)
+ lowers.addRange(ch, ch);
+ else {
+ char uch = Character.toUpperCase((char)ch);
+ lowers.addRange(uch, uch);
+ }
+ }
+ }
+ lowers.mergeRanges(uppers);
+ lowers.mergeRanges(this);
+ lowers.compactRanges();
+
+ this.icaseCache = lowers;
+ return lowers;
+ }
+
+ void dumpRanges() {
+ System.err.print("RANGE: ");
+ if (this.ranges == null)
+ System.err.println(" NULL");
+ for (int i = 0; i < this.ranges.length; i += 2) {
+ System.err.print("["+this.ranges[i]+","+this.ranges[i+1]+"] ");
+ }
+ System.err.println("");
+ }
+
+ boolean match(int ch) {
+ if (this.map == null) this.createMap();
+ boolean ret;
+ if (this.type == RANGE) {
+ if (ch < MAPSIZE)
+ return (this.map[ch/32] & (1<<(ch&0x1f))) != 0;
+ ret = false;
+ for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) {
+ if (this.ranges[i] <= ch && ch <= this.ranges[i+1])
+ return true;
+ }
+ } else {
+ if (ch < MAPSIZE)
+ return (this.map[ch/32] & (1<<(ch&0x1f))) == 0;
+ ret = true;
+ for (int i = this.nonMapIndex; i < this.ranges.length; i += 2) {
+ if (this.ranges[i] <= ch && ch <= this.ranges[i+1])
+ return false;
+ }
+ }
+ return ret;
+ }
+
+ private static final int MAPSIZE = 256;
+ private void createMap() {
+ int asize = MAPSIZE/32; // 32 is the number of bits in `int'.
+ this.map = new int[asize];
+ this.nonMapIndex = this.ranges.length;
+ for (int i = 0; i < asize; i ++) this.map[i] = 0;
+ for (int i = 0; i < this.ranges.length; i += 2) {
+ int s = this.ranges[i];
+ int e = this.ranges[i+1];
+ if (s < MAPSIZE) {
+ for (int j = s; j <= e && j < MAPSIZE; j ++)
+ this.map[j/32] |= 1<<(j&0x1f); // s&0x1f : 0-31
+ } else {
+ this.nonMapIndex = i;
+ break;
+ }
+ if (e >= MAPSIZE) {
+ this.nonMapIndex = i;
+ break;
+ }
+ }
+ //for (int i = 0; i < asize; i ++) System.err.println("Map: "+Integer.toString(this.map[i], 16));
+ }
+
+ public String toString(int options) {
+ String ret;
+ if (this.type == RANGE) {
+ if (this == Token.token_dot)
+ ret = ".";
+ else if (this == Token.token_0to9)
+ ret = "\\d";
+ else if (this == Token.token_wordchars)
+ ret = "\\w";
+ else if (this == Token.token_spaces)
+ ret = "\\s";
+ else {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[");
+ for (int i = 0; i < this.ranges.length; i += 2) {
+ if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");
+ if (this.ranges[i] == this.ranges[i+1]) {
+ sb.append(escapeCharInCharClass(this.ranges[i]));
+ } else {
+ sb.append(escapeCharInCharClass(this.ranges[i]));
+ sb.append((char)'-');
+ sb.append(escapeCharInCharClass(this.ranges[i+1]));
+ }
+ }
+ sb.append("]");
+ ret = sb.toString();
+ }
+ } else {
+ if (this == Token.token_not_0to9)
+ ret = "\\D";
+ else if (this == Token.token_not_wordchars)
+ ret = "\\W";
+ else if (this == Token.token_not_spaces)
+ ret = "\\S";
+ else {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[^");
+ for (int i = 0; i < this.ranges.length; i += 2) {
+ if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");
+ if (this.ranges[i] == this.ranges[i+1]) {
+ sb.append(escapeCharInCharClass(this.ranges[i]));
+ } else {
+ sb.append(escapeCharInCharClass(this.ranges[i]));
+ sb.append('-');
+ sb.append(escapeCharInCharClass(this.ranges[i+1]));
+ }
+ }
+ sb.append("]");
+ ret = sb.toString();
+ }
+ }
+ return ret;
+ }
+
+ private static String escapeCharInCharClass(int ch) {
+ String ret;
+ switch (ch) {
+ case '[': case ']': case '-': case '^':
+ case ',': case '\\':
+ ret = "\\"+(char)ch;
+ break;
+ case '\f': ret = "\\f"; break;
+ case '\n': ret = "\\n"; break;
+ case '\r': ret = "\\r"; break;
+ case '\t': ret = "\\t"; break;
+ case 0x1b: ret = "\\e"; break;
+ //case 0x0b: ret = "\\v"; break;
+ default:
+ if (ch < 0x20) {
+ String pre = "0"+Integer.toHexString(ch);
+ ret = "\\x"+pre.substring(pre.length()-2, pre.length());
+ } else if (ch >= 0x10000) {
+ String pre = "0"+Integer.toHexString(ch);
+ ret = "\\v"+pre.substring(pre.length()-6, pre.length());
+ } else
+ ret = ""+(char)ch;
+ }
+ return ret;
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegexParser.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegexParser.java
new file mode 100644
index 0000000..a2716de
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegexParser.java
@@ -0,0 +1,1092 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+/**
+ * A Regular Expression Parser.
+ */
+class RegexParser {
+ static final int T_CHAR = 0;
+ static final int T_EOF = 1;
+ static final int T_OR = 2; // '|'
+ static final int T_STAR = 3; // '*'
+ static final int T_PLUS = 4; // '+'
+ static final int T_QUESTION = 5; // '?'
+ static final int T_LPAREN = 6; // '('
+ static final int T_RPAREN = 7; // ')'
+ static final int T_DOT = 8; // '.'
+ static final int T_LBRACKET = 9; // '['
+ static final int T_BACKSOLIDUS = 10; // '\'
+ static final int T_CARET = 11; // '^'
+ static final int T_DOLLAR = 12; // '$'
+ static final int T_LPAREN2 = 13; // '(?:'
+ static final int T_LOOKAHEAD = 14; // '(?='
+ static final int T_NEGATIVELOOKAHEAD = 15; // '(?!'
+ static final int T_LOOKBEHIND = 16; // '(?<='
+ static final int T_NEGATIVELOOKBEHIND = 17; // '(?<!'
+ static final int T_INDEPENDENT = 18; // '(?>'
+ static final int T_SET_OPERATIONS = 19; // '(?['
+ static final int T_POSIX_CHARCLASS_START = 20; // '[:' in a character class
+ static final int T_COMMENT = 21; // '(?#'
+ static final int T_MODIFIERS = 22; // '(?' [\-,a-z,A-Z]
+ static final int T_CONDITION = 23; // '(?('
+ static final int T_XMLSCHEMA_CC_SUBTRACTION = 24; // '-[' in a character class
+
+ static class ReferencePosition {
+ int refNumber;
+ int position;
+ ReferencePosition(int n, int pos) {
+ this.refNumber = n;
+ this.position = pos;
+ }
+ }
+
+ int offset;
+ String regex;
+ int regexlen;
+ int options;
+ ResourceBundle resources;
+ int chardata;
+ int nexttoken;
+ static protected final int S_NORMAL = 0;
+ static protected final int S_INBRACKETS = 1;
+ static protected final int S_INXBRACKETS = 2;
+ int context = S_NORMAL;
+ int parennumber = 1;
+ boolean hasBackReferences;
+ Vector references = null;
+
+ public RegexParser() {
+ this.setLocale(Locale.getDefault());
+ }
+ public RegexParser(Locale locale) {
+ this.setLocale(locale);
+ }
+
+ public void setLocale(Locale locale) {
+ try {
+ this.resources = ResourceBundle.getBundle("org.apache.xmlbeans.impl.regex.message", locale);
+ } catch (MissingResourceException mre) {
+ throw new RuntimeException("Installation Problem??? Couldn't load messages: "
+ +mre.getMessage());
+ }
+ }
+
+ final ParseException ex(String key, int loc) {
+ return new ParseException(this.resources.getString(key), loc);
+ }
+
+ private final boolean isSet(int flag) {
+ return (this.options & flag) == flag;
+ }
+
+ synchronized Token parse(String regex, int options) throws ParseException {
+ this.options = options;
+ this.offset = 0;
+ this.setContext(S_NORMAL);
+ this.parennumber = 1;
+ this.hasBackReferences = false;
+ this.regex = regex;
+ if (this.isSet(RegularExpression.EXTENDED_COMMENT))
+ this.regex = REUtil.stripExtendedComment(this.regex);
+ this.regexlen = this.regex.length();
+
+
+ this.next();
+ Token ret = this.parseRegex();
+ if (this.offset != this.regexlen)
+ throw ex("parser.parse.1", this.offset);
+ if (this.references != null) {
+ for (int i = 0; i < this.references.size(); i ++) {
+ ReferencePosition position = (ReferencePosition)this.references.elementAt(i);
+ if (this.parennumber <= position.refNumber)
+ throw ex("parser.parse.2", position.position);
+ }
+ this.references.removeAllElements();
+ }
+ return ret;
+ }
+
+ /*
+ public RegularExpression createRegex(String regex, int options) throws ParseException {
+ Token tok = this.parse(regex, options);
+ return new RegularExpression(regex, tok, this.parennumber, this.hasBackReferences, options);
+ }
+ */
+
+ protected final void setContext(int con) {
+ this.context = con;
+ }
+
+ final int read() {
+ return this.nexttoken;
+ }
+
+ final void next() {
+ if (this.offset >= this.regexlen) {
+ this.chardata = -1;
+ this.nexttoken = T_EOF;
+ return;
+ }
+
+ int ret;
+ int ch = this.regex.charAt(this.offset++);
+ this.chardata = ch;
+
+ if (this.context == S_INBRACKETS) {
+ // In a character class, this.chardata has one character, that is to say,
+ // a pair of surrogates is composed and stored to this.chardata.
+ switch (ch) {
+ case '\\':
+ ret = T_BACKSOLIDUS;
+ if (this.offset >= this.regexlen)
+ throw ex("parser.next.1", this.offset-1);
+ this.chardata = this.regex.charAt(this.offset++);
+ break;
+
+ case '-':
+ if (this.isSet(RegularExpression.XMLSCHEMA_MODE)
+ && this.offset < this.regexlen && this.regex.charAt(this.offset) == '[') {
+ this.offset++;
+ ret = T_XMLSCHEMA_CC_SUBTRACTION;
+ } else
+ ret = T_CHAR;
+ break;
+
+ case '[':
+ if (!this.isSet(RegularExpression.XMLSCHEMA_MODE)
+ && this.offset < this.regexlen && this.regex.charAt(this.offset) == ':') {
+ this.offset++;
+ ret = T_POSIX_CHARCLASS_START;
+ break;
+ } // Through down
+ default:
+ if (REUtil.isHighSurrogate(ch) && this.offset < this.regexlen) {
+ int low = this.regex.charAt(this.offset);
+ if (REUtil.isLowSurrogate(low)) {
+ this.chardata = REUtil.composeFromSurrogates(ch, low);
+ this.offset ++;
+ }
+ }
+ ret = T_CHAR;
+ }
+ this.nexttoken = ret;
+ return;
+ }
+
+ switch (ch) {
+ case '|': ret = T_OR; break;
+ case '*': ret = T_STAR; break;
+ case '+': ret = T_PLUS; break;
+ case '?': ret = T_QUESTION; break;
+ case ')': ret = T_RPAREN; break;
+ case '.': ret = T_DOT; break;
+ case '[': ret = T_LBRACKET; break;
+ case '^': ret = T_CARET; break;
+ case '$': ret = T_DOLLAR; break;
+ case '(':
+ ret = T_LPAREN;
+ if (this.offset >= this.regexlen)
+ break;
+ if (this.regex.charAt(this.offset) != '?')
+ break;
+ if (++this.offset >= this.regexlen)
+ throw ex("parser.next.2", this.offset-1);
+ ch = this.regex.charAt(this.offset++);
+ switch (ch) {
+ case ':': ret = T_LPAREN2; break;
+ case '=': ret = T_LOOKAHEAD; break;
+ case '!': ret = T_NEGATIVELOOKAHEAD; break;
+ case '[': ret = T_SET_OPERATIONS; break;
+ case '>': ret = T_INDEPENDENT; break;
+ case '<':
+ if (this.offset >= this.regexlen)
+ throw ex("parser.next.2", this.offset-3);
+ ch = this.regex.charAt(this.offset++);
+ if (ch == '=') {
+ ret = T_LOOKBEHIND;
+ } else if (ch == '!') {
+ ret = T_NEGATIVELOOKBEHIND;
+ } else
+ throw ex("parser.next.3", this.offset-3);
+ break;
+ case '#':
+ while (this.offset < this.regexlen) {
+ ch = this.regex.charAt(this.offset++);
+ if (ch == ')') break;
+ }
+ if (ch != ')')
+ throw ex("parser.next.4", this.offset-1);
+ ret = T_COMMENT;
+ break;
+ default:
+ if (ch == '-' || 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z') {// Options
+ this.offset --;
+ ret = T_MODIFIERS;
+ break;
+ } else if (ch == '(') { // conditional
+ ret = T_CONDITION; // this.offsets points the next of '('.
+ break;
+ }
+ throw ex("parser.next.2", this.offset-2);
+ }
+ break;
+
+ case '\\':
+ ret = T_BACKSOLIDUS;
+ if (this.offset >= this.regexlen)
+ throw ex("parser.next.1", this.offset-1);
+ this.chardata = this.regex.charAt(this.offset++);
+ break;
+
+ default:
+ ret = T_CHAR;
+ }
+ this.nexttoken = ret;
+ }
+
+ /**
+ * regex ::= term (`|` term)*
+ * term ::= factor+
+ * factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>'
+ * | atom (('*' | '+' | '?' | minmax ) '?'? )?)
+ * | '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')'
+ * atom ::= char | '.' | range | '(' regex ')' | '(?:' regex ')' | '\' [0-9]
+ * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block
+ */
+ Token parseRegex() throws ParseException {
+ Token tok = this.parseTerm();
+ Token parent = null;
+ while (this.read() == T_OR) {
+ this.next(); // '|'
+ if (parent == null) {
+ parent = Token.createUnion();
+ parent.addChild(tok);
+ tok = parent;
+ }
+ tok.addChild(this.parseTerm());
+ }
+ return tok;
+ }
+
+ /**
+ * term ::= factor+
+ */
+ Token parseTerm() throws ParseException {
+ int ch = this.read();
+ if (ch == T_OR || ch == T_RPAREN || ch == T_EOF) {
+ return Token.createEmpty();
+ } else {
+ Token tok = this.parseFactor();
+ Token concat = null;
+ while ((ch = this.read()) != T_OR && ch != T_RPAREN && ch != T_EOF) {
+ if (concat == null) {
+ concat = Token.createConcat();
+ concat.addChild(tok);
+ tok = concat;
+ }
+ concat.addChild(this.parseFactor());
+ //tok = Token.createConcat(tok, this.parseFactor());
+ }
+ return tok;
+ }
+ }
+
+ // ----------------------------------------------------------------
+
+ Token processCaret() throws ParseException {
+ this.next();
+ return Token.token_linebeginning;
+ }
+ Token processDollar() throws ParseException {
+ this.next();
+ return Token.token_lineend;
+ }
+ Token processLookahead() throws ParseException {
+ this.next();
+ Token tok = Token.createLook(Token.LOOKAHEAD, this.parseRegex());
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // ')'
+ return tok;
+ }
+ Token processNegativelookahead() throws ParseException {
+ this.next();
+ Token tok = Token.createLook(Token.NEGATIVELOOKAHEAD, this.parseRegex());
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // ')'
+ return tok;
+ }
+ Token processLookbehind() throws ParseException {
+ this.next();
+ Token tok = Token.createLook(Token.LOOKBEHIND, this.parseRegex());
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // ')'
+ return tok;
+ }
+ Token processNegativelookbehind() throws ParseException {
+ this.next();
+ Token tok = Token.createLook(Token.NEGATIVELOOKBEHIND, this.parseRegex());
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // ')'
+ return tok;
+ }
+ Token processBacksolidus_A() throws ParseException {
+ this.next();
+ return Token.token_stringbeginning;
+ }
+ Token processBacksolidus_Z() throws ParseException {
+ this.next();
+ return Token.token_stringend2;
+ }
+ Token processBacksolidus_z() throws ParseException {
+ this.next();
+ return Token.token_stringend;
+ }
+ Token processBacksolidus_b() throws ParseException {
+ this.next();
+ return Token.token_wordedge;
+ }
+ Token processBacksolidus_B() throws ParseException {
+ this.next();
+ return Token.token_not_wordedge;
+ }
+ Token processBacksolidus_lt() throws ParseException {
+ this.next();
+ return Token.token_wordbeginning;
+ }
+ Token processBacksolidus_gt() throws ParseException {
+ this.next();
+ return Token.token_wordend;
+ }
+ Token processStar(Token tok) throws ParseException {
+ this.next();
+ if (this.read() == T_QUESTION) {
+ this.next();
+ return Token.createNGClosure(tok);
+ } else
+ return Token.createClosure(tok);
+ }
+ Token processPlus(Token tok) throws ParseException {
+ // X+ -> XX*
+ this.next();
+ if (this.read() == T_QUESTION) {
+ this.next();
+ return Token.createConcat(tok, Token.createNGClosure(tok));
+ } else
+ return Token.createConcat(tok, Token.createClosure(tok));
+ }
+ Token processQuestion(Token tok) throws ParseException {
+ // X? -> X|
+ this.next();
+ Token par = Token.createUnion();
+ if (this.read() == T_QUESTION) {
+ this.next();
+ par.addChild(Token.createEmpty());
+ par.addChild(tok);
+ } else {
+ par.addChild(tok);
+ par.addChild(Token.createEmpty());
+ }
+ return par;
+ }
+ boolean checkQuestion(int off) {
+ return off < this.regexlen && this.regex.charAt(off) == '?';
+ }
+ Token processParen() throws ParseException {
+ this.next();
+ int p = this.parennumber++;
+ Token tok = Token.createParen(this.parseRegex(), p);
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // Skips ')'
+ return tok;
+ }
+ Token processParen2() throws ParseException {
+ this.next();
+ Token tok = Token.createParen(this.parseRegex(), 0);
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // Skips ')'
+ return tok;
+ }
+ Token processCondition() throws ParseException {
+ // this.offset points the next of '('
+ if (this.offset+1 >= this.regexlen) throw ex("parser.factor.4", this.offset);
+ // Parses a condition.
+ int refno = -1;
+ Token condition = null;
+ int ch = this.regex.charAt(this.offset);
+ if ('1' <= ch && ch <= '9') {
+ refno = ch-'0';
+ this.hasBackReferences = true;
+ if (this.references == null) this.references = new Vector();
+ this.references.addElement(new ReferencePosition(refno, this.offset));
+ this.offset ++;
+ if (this.regex.charAt(this.offset) != ')') throw ex("parser.factor.1", this.offset);
+ this.offset ++;
+ } else {
+ if (ch == '?') this.offset --; // Points '('.
+ this.next();
+ condition = this.parseFactor();
+ switch (condition.type) {
+ case Token.LOOKAHEAD:
+ case Token.NEGATIVELOOKAHEAD:
+ case Token.LOOKBEHIND:
+ case Token.NEGATIVELOOKBEHIND:
+ break;
+ case Token.ANCHOR:
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ break;
+ default:
+ throw ex("parser.factor.5", this.offset);
+ }
+ }
+ // Parses yes/no-patterns.
+ this.next();
+ Token yesPattern = this.parseRegex();
+ Token noPattern = null;
+ if (yesPattern.type == Token.UNION) {
+ if (yesPattern.size() != 2) throw ex("parser.factor.6", this.offset);
+ noPattern = yesPattern.getChild(1);
+ yesPattern = yesPattern.getChild(0);
+ }
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next();
+ return Token.createCondition(refno, condition, yesPattern, noPattern);
+ }
+ Token processModifiers() throws ParseException {
+ // this.offset points the next of '?'.
+ // modifiers ::= [imsw]* ('-' [imsw]*)? ':'
+ int add = 0, mask = 0, ch = -1;
+ while (this.offset < this.regexlen) {
+ ch = this.regex.charAt(this.offset);
+ int v = REUtil.getOptionValue(ch);
+ if (v == 0) break; // '-' or ':'?
+ add |= v;
+ this.offset ++;
+ }
+ if (this.offset >= this.regexlen) throw ex("parser.factor.2", this.offset-1);
+ if (ch == '-') {
+ this.offset ++;
+ while (this.offset < this.regexlen) {
+ ch = this.regex.charAt(this.offset);
+ int v = REUtil.getOptionValue(ch);
+ if (v == 0) break; // ':'?
+ mask |= v;
+ this.offset ++;
+ }
+ if (this.offset >= this.regexlen) throw ex("parser.factor.2", this.offset-1);
+ }
+ Token tok;
+ if (ch == ':') {
+ this.offset ++;
+ this.next();
+ tok = Token.createModifierGroup(this.parseRegex(), add, mask);
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next();
+ } else if (ch == ')') { // such as (?-i)
+ this.offset ++;
+ this.next();
+ tok = Token.createModifierGroup(this.parseRegex(), add, mask);
+ } else
+ throw ex("parser.factor.3", this.offset);
+
+ return tok;
+ }
+ Token processIndependent() throws ParseException {
+ this.next();
+ Token tok = Token.createLook(Token.INDEPENDENT, this.parseRegex());
+ if (this.read() != T_RPAREN) throw ex("parser.factor.1", this.offset-1);
+ this.next(); // Skips ')'
+ return tok;
+ }
+ Token processBacksolidus_c() throws ParseException {
+ int ch2; // Must be in 0x0040-0x005f
+ if (this.offset >= this.regexlen
+ || ((ch2 = this.regex.charAt(this.offset++)) & 0xffe0) != 0x0040)
+ throw ex("parser.atom.1", this.offset-1);
+ this.next();
+ return Token.createChar(ch2-0x40);
+ }
+ Token processBacksolidus_C() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_i() throws ParseException {
+ Token tok = Token.createChar('i');
+ this.next();
+ return tok;
+ }
+ Token processBacksolidus_I() throws ParseException {
+ throw ex("parser.process.1", this.offset);
+ }
+ Token processBacksolidus_g() throws ParseException {
+ this.next();
+ return Token.getGraphemePattern();
+ }
+ Token processBacksolidus_X() throws ParseException {
+ this.next();
+ return Token.getCombiningCharacterSequence();
+ }
+ Token processBackreference() throws ParseException {
+ int refnum = this.chardata-'0';
+ Token tok = Token.createBackReference(refnum);
+ this.hasBackReferences = true;
+ if (this.references == null) this.references = new Vector();
+ this.references.addElement(new ReferencePosition(refnum, this.offset-2));
+ this.next();
+ return tok;
+ }
+
+ // ----------------------------------------------------------------
+
+ /**
+ * factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>'
+ * | atom (('*' | '+' | '?' | minmax ) '?'? )?)
+ * | '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')'
+ * | '(?#' [^)]* ')'
+ * minmax ::= '{' min (',' max?)? '}'
+ * min ::= [0-9]+
+ * max ::= [0-9]+
+ */
+ Token parseFactor() throws ParseException {
+ int ch = this.read();
+ Token tok;
+ switch (ch) {
+ case T_CARET: return this.processCaret();
+ case T_DOLLAR: return this.processDollar();
+ case T_LOOKAHEAD: return this.processLookahead();
+ case T_NEGATIVELOOKAHEAD: return this.processNegativelookahead();
+ case T_LOOKBEHIND: return this.processLookbehind();
+ case T_NEGATIVELOOKBEHIND: return this.processNegativelookbehind();
+
+ case T_COMMENT:
+ this.next();
+ return Token.createEmpty();
+
+ case T_BACKSOLIDUS:
+ switch (this.chardata) {
+ case 'A': return this.processBacksolidus_A();
+ case 'Z': return this.processBacksolidus_Z();
+ case 'z': return this.processBacksolidus_z();
+ case 'b': return this.processBacksolidus_b();
+ case 'B': return this.processBacksolidus_B();
+ case '<': return this.processBacksolidus_lt();
+ case '>': return this.processBacksolidus_gt();
+ }
+ // through down
+ }
+ tok = this.parseAtom();
+ ch = this.read();
+ switch (ch) {
+ case T_STAR: return this.processStar(tok);
+ case T_PLUS: return this.processPlus(tok);
+ case T_QUESTION: return this.processQuestion(tok);
+ case T_CHAR:
+ if (this.chardata == '{') {
+ // this.offset -> next of '{'
+ int off = this.offset;
+ int min = 0, max = -1;
+ if (off >= this.regexlen) break;
+ ch = this.regex.charAt(off++);
+ if (ch != ',' && (ch < '0' || ch > '9')) break;
+ if (ch != ',') { // 0-9
+ min = ch-'0';
+ while (off < this.regexlen
+ && (ch = this.regex.charAt(off++)) >= '0' && ch <= '9') {
+ min = min*10 +ch-'0';
+ ch = -1;
+ }
+ if (ch < 0) break;
+ }
+ //if (off >= this.regexlen) break;
+ max = min;
+ if (ch == ',') {
+ if (off >= this.regexlen
+ || ((ch = this.regex.charAt(off++)) < '0' || ch > '9')
+ && ch != '}')
+ break;
+ if (ch == '}') {
+ max = -1; // {min,}
+ } else {
+ max = ch-'0'; // {min,max}
+ while (off < this.regexlen
+ && (ch = this.regex.charAt(off++)) >= '0'
+ && ch <= '9') {
+ max = max*10 +ch-'0';
+ ch = -1;
+ }
+ if (ch < 0) break;
+ //if (min > max)
+ // throw new ParseException("parseFactor(): min > max: "+min+", "+max);
+ }
+ }
+ if (ch != '}') break;
+ // off -> next of '}'
+ if (this.checkQuestion(off)) {
+ tok = Token.createNGClosure(tok);
+ this.offset = off+1;
+ } else {
+ tok = Token.createClosure(tok);
+ this.offset = off;
+ }
+ tok.setMin(min);
+ tok.setMax(max);
+ //System.err.println("CLOSURE: "+min+", "+max);
+ this.next();
+ }
+ }
+ return tok;
+ }
+
+ /**
+ * atom ::= char | '.' | char-class | '(' regex ')' | '(?:' regex ')' | '\' [0-9]
+ * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block
+ * | '(?>' regex ')'
+ * char ::= '\\' | '\' [efnrt] | bmp-code | character-1
+ */
+ Token parseAtom() throws ParseException {
+ int ch = this.read();
+ Token tok = null;
+ switch (ch) {
+ case T_LPAREN: return this.processParen();
+ case T_LPAREN2: return this.processParen2(); // '(?:'
+ case T_CONDITION: return this.processCondition(); // '(?('
+ case T_MODIFIERS: return this.processModifiers(); // (?modifiers ... )
+ case T_INDEPENDENT: return this.processIndependent();
+ case T_DOT:
+ this.next(); // Skips '.'
+ tok = Token.token_dot;
+ break;
+
+ /**
+ * char-class ::= '[' ( '^'? range ','?)+ ']'
+ * range ::= '\d' | '\w' | '\s' | category-block | range-char
+ * | range-char '-' range-char
+ * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | bmp-code | character-2
+ * bmp-char ::= '\' 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]
+ */
+ case T_LBRACKET: return this.parseCharacterClass(true);
+ case T_SET_OPERATIONS: return this.parseSetOperations();
+
+ case T_BACKSOLIDUS:
+ switch (this.chardata) {
+ case 'd': case 'D':
+ case 'w': case 'W':
+ case 's': case 'S':
+ tok = this.getTokenForShorthand(this.chardata);
+ this.next();
+ return tok;
+
+ case 'e': case 'f': case 'n': case 'r':
+ case 't': case 'u': case 'v': case 'x':
+ {
+ int ch2 = this.decodeEscaped();
+ if (ch2 < 0x10000) {
+ tok = Token.createChar(ch2);
+ } else {
+ tok = Token.createString(REUtil.decomposeToSurrogates(ch2));
+ }
+ }
+ break;
+
+ case 'c': return this.processBacksolidus_c();
+ case 'C': return this.processBacksolidus_C();
+ case 'i': return this.processBacksolidus_i();
+ case 'I': return this.processBacksolidus_I();
+ case 'g': return this.processBacksolidus_g();
+ case 'X': return this.processBacksolidus_X();
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ return this.processBackreference();
+
+ case 'P':
+ case 'p':
+ int pstart = this.offset;
+ tok = processBacksolidus_pP(this.chardata);
+ if (tok == null) throw this.ex("parser.atom.5", pstart);
+ break;
+
+ default:
+ tok = Token.createChar(this.chardata);
+ }
+ this.next();
+ break;
+
+ case T_CHAR:
+ tok = Token.createChar(this.chardata);
+ int high = this.chardata;
+ this.next();
+ if (REUtil.isHighSurrogate(high)
+ && this.read() == T_CHAR && REUtil.isLowSurrogate(this.chardata)) {
+ char[] sur = new char[2];
+ sur[0] = (char)high;
+ sur[1] = (char)this.chardata;
+ tok = Token.createParen(Token.createString(new String(sur)), 0);
+ this.next();
+ }
+ break;
+
+ default:
+ throw this.ex("parser.atom.4", this.offset-1);
+ }
+ return tok;
+ }
+
+ protected RangeToken processBacksolidus_pP(int c) throws ParseException {
+ boolean positive = c == 'p';
+ this.next();
+ if (this.read() != T_CHAR) throw this.ex("parser.atom.2", this.offset-1);
+ RangeToken tok;
+ switch (this.chardata) {
+ case 'L': // Letter
+ tok = Token.getRange("L", positive); break;
+ case 'M': // Mark
+ tok = Token.getRange("M", positive); break;
+ case 'N': // Number
+ tok = Token.getRange("N", positive); break;
+ case 'Z': // Separator
+ tok = Token.getRange("Z", positive); break;
+ case 'C': // Other
+ tok = Token.getRange("C", positive); break;
+ case 'P': // Punctuation
+ tok = Token.getRange("P", positive); break;
+ case 'S': // Symbol
+ tok = Token.getRange("S", positive); break;
+ case '{':
+ // this.offset points the next of '{'.
+ //pstart = this.offset;
+ int namestart = this.offset;
+ int nameend = this.regex.indexOf('}', namestart);
+ if (nameend < 0) throw this.ex("parser.atom.3", this.offset);
+ String pname = this.regex.substring(namestart, nameend);
+ this.offset = nameend+1;
+ tok = Token.getRange(pname, positive,
+ this.isSet(RegularExpression.XMLSCHEMA_MODE));
+ /*
+ if (this.isSet(RegularExpression.IGNORE_CASE))
+ tok = RangeToken.createCaseInsensitiveToken(tok);
+ */
+ break;
+
+ default:
+ throw this.ex("parser.atom.2", this.offset-1);
+ }
+ return tok;
+ }
+
+ int processCIinCharacterClass(RangeToken tok, int c) {
+ return this.decodeEscaped();
+ }
+
+ /**
+ * char-class ::= '[' ( '^'? range ','?)+ ']'
+ * range ::= '\d' | '\w' | '\s' | category-block | range-char
+ * | range-char '-' range-char
+ * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | bmp-code | character-2
+ * bmp-code ::= '\' 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]
+ */
+ protected RangeToken parseCharacterClass(boolean useNrange) throws ParseException {
+ this.setContext(S_INBRACKETS);
+ this.next(); // '['
+ boolean nrange = false;
+ RangeToken base = null;
+ RangeToken tok;
+ if (this.read() == T_CHAR && this.chardata == '^') {
+ nrange = true;
+ this.next(); // '^'
+ if (useNrange) {
+ tok = Token.createNRange();
+ } else {
+ base = Token.createRange();
+ base.addRange(0, Token.UTF16_MAX);
+ tok = Token.createRange();
+ }
+ } else {
+ tok = Token.createRange();
+ }
+ int type;
+ boolean firstloop = true;
+ while ((type = this.read()) != T_EOF) {
+ if (type == T_CHAR && this.chardata == ']' && !firstloop)
+ break;
+ firstloop = false;
+ int c = this.chardata;
+ boolean end = false;
+ if (type == T_BACKSOLIDUS) {
+ switch (c) {
+ case 'd': case 'D':
+ case 'w': case 'W':
+ case 's': case 'S':
+ tok.mergeRanges(this.getTokenForShorthand(c));
+ end = true;
+ break;
+
+ case 'i': case 'I':
+ case 'c': case 'C':
+ c = this.processCIinCharacterClass(tok, c);
+ if (c < 0) end = true;
+ break;
+
+ case 'p':
+ case 'P':
+ int pstart = this.offset;
+ RangeToken tok2 = this.processBacksolidus_pP(c);
+ if (tok2 == null) throw this.ex("parser.atom.5", pstart);
+ tok.mergeRanges(tok2);
+ end = true;
+ break;
+
+ default:
+ c = this.decodeEscaped();
+ } // \ + c
+ } // backsolidus
+ // POSIX Character class such as [:alnum:]
+ else if (type == T_POSIX_CHARCLASS_START) {
+ int nameend = this.regex.indexOf(':', this.offset);
+ if (nameend < 0) throw this.ex("parser.cc.1", this.offset);
+ boolean positive = true;
+ if (this.regex.charAt(this.offset) == '^') {
+ this.offset ++;
+ positive = false;
+ }
+ String name = this.regex.substring(this.offset, nameend);
+ RangeToken range = Token.getRange(name, positive,
+ this.isSet(RegularExpression.XMLSCHEMA_MODE));
+ if (range == null) throw this.ex("parser.cc.3", this.offset);
+ tok.mergeRanges(range);
+ end = true;
+ if (nameend+1 >= this.regexlen || this.regex.charAt(nameend+1) != ']')
+ throw this.ex("parser.cc.1", nameend);
+ this.offset = nameend+2;
+ }
+ this.next();
+ if (!end) { // if not shorthands...
+ if (this.read() != T_CHAR || this.chardata != '-') { // Here is no '-'.
+ tok.addRange(c, c);
+ } else {
+ this.next(); // Skips '-'
+ if ((type = this.read()) == T_EOF) throw this.ex("parser.cc.2", this.offset);
+ if (type == T_CHAR && this.chardata == ']') {
+ tok.addRange(c, c);
+ tok.addRange('-', '-');
+ } else {
+ int rangeend = this.chardata;
+ if (type == T_BACKSOLIDUS)
+ rangeend = this.decodeEscaped();
+ this.next();
+ tok.addRange(c, rangeend);
+ }
+ }
+ }
+ if (this.isSet(RegularExpression.SPECIAL_COMMA)
+ && this.read() == T_CHAR && this.chardata == ',')
+ this.next();
+ }
+ if (this.read() == T_EOF)
+ throw this.ex("parser.cc.2", this.offset);
+ if (!useNrange && nrange) {
+ base.subtractRanges(tok);
+ tok = base;
+ }
+ tok.sortRanges();
+ tok.compactRanges();
+ //tok.dumpRanges();
+ /*
+ if (this.isSet(RegularExpression.IGNORE_CASE))
+ tok = RangeToken.createCaseInsensitiveToken(tok);
+ */
+ this.setContext(S_NORMAL);
+ this.next(); // Skips ']'
+
+ return tok;
+ }
+
+ /**
+ * '(?[' ... ']' (('-' | '+' | '&') '[' ... ']')? ')'
+ */
+ protected RangeToken parseSetOperations() throws ParseException {
+ RangeToken tok = this.parseCharacterClass(false);
+ int type;
+ while ((type = this.read()) != T_RPAREN) {
+ int ch = this.chardata;
+ if (type == T_CHAR && (ch == '-' || ch == '&')
+ || type == T_PLUS) {
+ this.next();
+ if (this.read() != T_LBRACKET) throw ex("parser.ope.1", this.offset-1);
+ RangeToken t2 = this.parseCharacterClass(false);
+ if (type == T_PLUS)
+ tok.mergeRanges(t2);
+ else if (ch == '-')
+ tok.subtractRanges(t2);
+ else if (ch == '&')
+ tok.intersectRanges(t2);
+ else
+ throw new RuntimeException("ASSERT");
+ } else {
+ throw ex("parser.ope.2", this.offset-1);
+ }
+ }
+ this.next();
+ return tok;
+ }
+
+ Token getTokenForShorthand(int ch) {
+ Token tok;
+ switch (ch) {
+ case 'd':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("Nd", true) : Token.token_0to9;
+ break;
+ case 'D':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("Nd", false) : Token.token_not_0to9;
+ break;
+ case 'w':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("IsWord", true) : Token.token_wordchars;
+ break;
+ case 'W':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("IsWord", false) : Token.token_not_wordchars;
+ break;
+ case 's':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("IsSpace", true) : Token.token_spaces;
+ break;
+ case 'S':
+ tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY)
+ ? Token.getRange("IsSpace", false) : Token.token_not_spaces;
+ break;
+
+ default:
+ throw new RuntimeException("Internal Error: shorthands: \\u"+Integer.toString(ch, 16));
+ }
+ return tok;
+ }
+
+ /**
+ */
+ int decodeEscaped() throws ParseException {
+ if (this.read() != T_BACKSOLIDUS) throw ex("parser.next.1", this.offset-1);
+ int c = this.chardata;
+ switch (c) {
+ case 'e': c = 0x1b; break; // ESCAPE U+001B
+ case 'f': c = '\f'; break; // FORM FEED U+000C
+ case 'n': c = '\n'; break; // LINE FEED U+000A
+ case 'r': c = '\r'; break; // CRRIAGE RETURN U+000D
+ case 't': c = '\t'; break; // HORIZONTAL TABULATION U+0009
+ //case 'v': c = 0x0b; break; // VERTICAL TABULATION U+000B
+ case 'x':
+ this.next();
+ if (this.read() != T_CHAR) throw ex("parser.descape.1", this.offset-1);
+ if (this.chardata == '{') {
+ int v1 = 0;
+ int uv = 0;
+ do {
+ this.next();
+ if (this.read() != T_CHAR) throw ex("parser.descape.1", this.offset-1);
+ if ((v1 = hexChar(this.chardata)) < 0)
+ break;
+ if (uv > uv*16) throw ex("parser.descape.2", this.offset-1);
+ uv = uv*16+v1;
+ } while (true);
+ if (this.chardata != '}') throw ex("parser.descape.3", this.offset-1);
+ if (uv > Token.UTF16_MAX) throw ex("parser.descape.4", this.offset-1);
+ c = uv;
+ } else {
+ int v1 = 0;
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ int uv = v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ c = uv;
+ }
+ break;
+
+ case 'u':
+ int v1 = 0;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ int uv = v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ c = uv;
+ break;
+
+ case 'v':
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ this.next();
+ if (this.read() != T_CHAR || (v1 = hexChar(this.chardata)) < 0)
+ throw ex("parser.descape.1", this.offset-1);
+ uv = uv*16+v1;
+ if (uv > Token.UTF16_MAX) throw ex("parser.descappe.4", this.offset-1);
+ c = uv;
+ break;
+ case 'A':
+ case 'Z':
+ case 'z':
+ throw ex("parser.descape.5", this.offset-2);
+ default:
+ }
+ return c;
+ }
+
+ static private final int hexChar(int ch) {
+ if (ch < '0') return -1;
+ if (ch > 'f') return -1;
+ if (ch <= '9') return ch-'0';
+ if (ch < 'A') return -1;
+ if (ch <= 'F') return ch-'A'+10;
+ if (ch < 'a') return -1;
+ return ch-'a'+10;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegularExpression.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegularExpression.java
new file mode 100644
index 0000000..5cb5303
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/RegularExpression.java
@@ -0,0 +1,3147 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.text.CharacterIterator;
+
+/**
+ * A regular expression matching engine using Non-deterministic Finite Automaton (NFA).
+ * This engine does not conform to the POSIX regular expression.
+ *
+ * <hr width="50%">
+ * <h3>How to use</h3>
+ *
+ * <dl>
+ * <dt>A. Standard way
+ * <dd>
+ * <pre>
+ * RegularExpression re = new RegularExpression(<var>regex</var>);
+ * if (re.matches(text)) { ... }
+ * </pre>
+ *
+ * <dt>B. Capturing groups
+ * <dd>
+ * <pre>
+ * RegularExpression re = new RegularExpression(<var>regex</var>);
+ * Match match = new Match();
+ * if (re.matches(text, match)) {
+ * ... // You can refer captured texts with methods of the <code>Match</code> class.
+ * }
+ * </pre>
+ *
+ * </dl>
+ *
+ * <h4>Case-insensitive matching</h4>
+ * <pre>
+ * RegularExpression re = new RegularExpression(<var>regex</var>, "i");
+ * if (re.matches(text) >= 0) { ...}
+ * </pre>
+ *
+ * <h4>Options</h4>
+ * <p>You can specify options to <a href="#RegularExpression(java.lang.String, java.lang.String)"><code>RegularExpression(</code><var>regex</var><code>, </code><var>options</var><code>)</code></a>
+ * or <a href="#setPattern(java.lang.String, java.lang.String)"><code>setPattern(</code><var>regex</var><code>, </code><var>options</var><code>)</code></a>.
+ * This <var>options</var> parameter consists of the following characters.
+ * </p>
+ * <dl>
+ * <dt><a name="I_OPTION"><code>"i"</code></a>
+ * <dd>This option indicates case-insensitive matching.
+ * <dt><a name="M_OPTION"><code>"m"</code></a>
+ * <dd class="REGEX"><kbd>^</kbd> and <kbd>$</kbd> consider the EOL characters within the text.
+ * <dt><a name="S_OPTION"><code>"s"</code></a>
+ * <dd class="REGEX"><kbd>.</kbd> matches any one character.
+ * <dt><a name="U_OPTION"><code>"u"</code></a>
+ * <dd class="REGEX">Redefines <Kbd>\d \D \w \W \s \S \b \B \< \></kbd> as becoming to Unicode.
+ * <dt><a name="W_OPTION"><code>"w"</code></a>
+ * <dd class="REGEX">By this option, <kbd>\b \B \< \></kbd> are processed with the method of
+ * 'Unicode Regular Expression Guidelines' Revision 4.
+ * When "w" and "u" are specified at the same time,
+ * <kbd>\b \B \< \></kbd> are processed for the "w" option.
+ * <dt><a name="COMMA_OPTION"><code>","</code></a>
+ * <dd>The parser treats a comma in a character class as a range separator.
+ * <kbd class="REGEX">[a,b]</kbd> matches <kbd>a</kbd> or <kbd>,</kbd> or <kbd>b</kbd> without this option.
+ * <kbd class="REGEX">[a,b]</kbd> matches <kbd>a</kbd> or <kbd>b</kbd> with this option.
+ *
+ * <dt><a name="X_OPTION"><code>"X"</code></a>
+ * <dd class="REGEX">
+ * By this option, the engine confoms to <a href="http://www.w3.org/TR/2000/WD-xmlschema-2-20000407/#regexs">XML Schema: Regular Expression</a>.
+ * The <code>match()</code> method does not do subsring matching
+ * but entire string matching.
+ *
+ * </dl>
+ *
+ * <hr width="50%">
+ * <h3>Syntax</h3>
+ * <table border="1" bgcolor="#ddeeff">
+ * <tr>
+ * <td>
+ * <h4>Differences from the Perl 5 regular expression</h4>
+ * <ul>
+ * <li>There is 6-digit hexadecimal character representation (<kbd>\u005cv</kbd><var>HHHHHH</var>.)
+ * <li>Supports subtraction, union, and intersection operations for character classes.
+ * <li>Not supported: <kbd>\</kbd><var>ooo</var> (Octal character representations),
+ * <Kbd>\G</kbd>, <kbd>\C</kbd>, <kbd>\l</kbd><var>c</var>,
+ * <kbd>\u005c u</kbd><var>c</var>, <kbd>\L</kbd>, <kbd>\U</kbd>,
+ * <kbd>\E</kbd>, <kbd>\Q</kbd>, <kbd>\N{</kbd><var>name</var><kbd>}</kbd>,
+ * <Kbd>(?{<kbd><var>code</var><kbd>})</kbd>, <Kbd>(??{<kbd><var>code</var><kbd>})</kbd>
+ * </ul>
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * <P>Meta characters are `<KBD>. * + ? { [ ( ) | \ ^ $</KBD>'.</P>
+ * <ul>
+ * <li>Character
+ * <dl>
+ * <dt class="REGEX"><kbd>.</kbd> (A period)
+ * <dd>Matches any one character except the following characters.
+ * <dd>LINE FEED (U+000A), CARRIAGE RETURN (U+000D),
+ * PARAGRAPH SEPARATOR (U+2029), LINE SEPARATOR (U+2028)
+ * <dd>This expression matches one code point in Unicode. It can match a pair of surrogates.
+ * <dd>When <a href="#S_OPTION">the "s" option</a> is specified,
+ * it matches any character including the above four characters.
+ *
+ * <dt class="REGEX"><Kbd>\e \f \n \r \t</kbd>
+ * <dd>Matches ESCAPE (U+001B), FORM FEED (U+000C), LINE FEED (U+000A),
+ * CARRIAGE RETURN (U+000D), HORIZONTAL TABULATION (U+0009)
+ *
+ * <dt class="REGEX"><kbd>\c</kbd><var>C</var>
+ * <dd>Matches a control character.
+ * The <var>C</var> must be one of '<kbd>@</kbd>', '<kbd>A</kbd>'-'<kbd>Z</kbd>',
+ * '<kbd>[</kbd>', '<kbd>\u005c</kbd>', '<kbd>]</kbd>', '<kbd>^</kbd>', '<kbd>_</kbd>'.
+ * It matches a control character of which the character code is less than
+ * the character code of the <var>C</var> by 0x0040.
+ * <dd class="REGEX">For example, a <kbd>\cJ</kbd> matches a LINE FEED (U+000A),
+ * and a <kbd>\c[</kbd> matches an ESCAPE (U+001B).
+ *
+ * <dt class="REGEX">a non-meta character
+ * <dd>Matches the character.
+ *
+ * <dt class="REGEX"><KBD>\</KBD> + a meta character
+ * <dd>Matches the meta character.
+ *
+ * <dt class="REGEX"><kbd>\u005cx</kbd><var>HH</var> <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd>
+ * <dd>Matches a character of which code point is <var>HH</var> (Hexadecimal) in Unicode.
+ * You can write just 2 digits for <kbd>\u005cx</kbd><var>HH</var>, and
+ * variable length digits for <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd>.
+ *
+ * <!--
+ * <dt class="REGEX"><kbd>\u005c u</kbd><var>HHHH</var>
+ * <dd>Matches a character of which code point is <var>HHHH</var> (Hexadecimal) in Unicode.
+ * -->
+ *
+ * <dt class="REGEX"><kbd>\u005cv</kbd><var>HHHHHH</var>
+ * <dd>Matches a character of which code point is <var>HHHHHH</var> (Hexadecimal) in Unicode.
+ *
+ * <dt class="REGEX"><kbd>\g</kbd>
+ * <dd>Matches a grapheme.
+ * <dd class="REGEX">It is equivalent to <kbd>(?[\p{ASSIGNED}]-[\p{M}\p{C}])?(?:\p{M}|[\x{094D}\x{09CD}\x{0A4D}\x{0ACD}\x{0B3D}\x{0BCD}\x{0C4D}\x{0CCD}\x{0D4D}\x{0E3A}\x{0F84}]\p{L}|[\x{1160}-\x{11A7}]|[\x{11A8}-\x{11FF}]|[\x{FF9E}\x{FF9F}])*</kbd>
+ *
+ * <dt class="REGEX"><kbd>\X</kbd>
+ * <dd class="REGEX">Matches a combining character sequence.
+ * It is equivalent to <kbd>(?:\PM\pM*)</kbd>
+ * </dl>
+ * </li>
+ *
+ * <li>Character class
+ * <dl>
++ * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub></var><var>R<sub>2</sub></var><var>...</var><var>R<sub>n</sub></var><kbd>]</kbd> (without <a href="#COMMA_OPTION">"," option</a>)
++ * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub></var><kbd>,</kbd><var>R<sub>2</sub></var><kbd>,</kbd><var>...</var><kbd>,</kbd><var>R<sub>n</sub></var><kbd>]</kbd> (with <a href="#COMMA_OPTION">"," option</a>)
+ * <dd>Positive character class. It matches a character in ranges.
+ * <dd><var>R<sub>n</sub></var>:
+ * <ul>
+ * <li class="REGEX">A character (including <Kbd>\e \f \n \r \t</kbd> <kbd>\u005cx</kbd><var>HH</var> <kbd>\u005cx{</kbd><var>HHHH</var><kbd>}</kbd> <!--kbd>\u005c u</kbd><var>HHHH</var--> <kbd>\u005cv</kbd><var>HHHHHH</var>)
+ * <p>This range matches the character.
+ * <li class="REGEX"><var>C<sub>1</sub></var><kbd>-</kbd><var>C<sub>2</sub></var>
+ * <p>This range matches a character which has a code point that is >= <var>C<sub>1</sub></var>'s code point and <= <var>C<sub>2</sub></var>'s code point.
++ * <li class="REGEX">A POSIX character class: <Kbd>[:alpha:] [:alnum:] [:ascii:] [:cntrl:] [:digit:] [:graph:] [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:]</kbd>,
++ * and negative POSIX character classes in Perl like <kbd>[:^alpha:]</kbd>
+ * <p>...
+ * <li class="REGEX"><kbd>\d \D \s \S \w \W \p{</kbd><var>name</var><kbd>} \P{</kbd><var>name</var><kbd>}</kbd>
+ * <p>These expressions specifies the same ranges as the following expressions.
+ * </ul>
+ * <p class="REGEX">Enumerated ranges are merged (union operation).
+ * <kbd>[a-ec-z]</kbd> is equivalent to <kbd>[a-z]</kbd>
+ *
+ * <dt class="REGEX"><kbd>[^</kbd><var>R<sub>1</sub></var><var>R<sub>2</sub></var><var>...</var><var>R<sub>n</sub></var><kbd>]</kbd> (without a <a href="#COMMA_OPTION">"," option</a>)
+ * <dt class="REGEX"><kbd>[^</kbd><var>R<sub>1</sub></var><kbd>,</kbd><var>R<sub>2</sub></var><kbd>,</kbd><var>...</var><kbd>,</kbd><var>R<sub>n</sub></var><kbd>]</kbd> (with a <a href="#COMMA_OPTION">"," option</a>)
+ * <dd>Negative character class. It matches a character not in ranges.
+ *
+ * <dt class="REGEX"><kbd>(?[</kbd><var>ranges</var><kbd>]</kbd><var>op</var><kbd>[</kbd><var>ranges</var><kbd>]</kbd><var>op</var><kbd>[</kbd><var>ranges</var><kbd>]</kbd> ... <Kbd>)</kbd>
+ * (<var>op</var> is <kbd>-</kbd> or <kbd>+</kbd> or <kbd>&</kbd>.)
+ * <dd>Subtraction or union or intersection for character classes.
+ * <dd class="REGEX">For exmaple, <kbd>(?[A-Z]-[CF])</kbd> is equivalent to <kbd>[A-BD-EG-Z]</kbd>, and <kbd>(?[0x00-0x7f]-[K]&[\p{Lu}])</kbd> is equivalent to <kbd>[A-JL-Z]</kbd>.
+ * <dd>The result of this operations is a <u>positive character class</u>
+ * even if an expression includes any negative character classes.
+ * You have to take care on this in case-insensitive matching.
+ * For instance, <kbd>(?[^b])</kbd> is equivalent to <kbd>[\x00-ac-\x{10ffff}]</kbd>,
+ * which is equivalent to <kbd>[^b]</kbd> in case-sensitive matching.
+ * But, in case-insensitive matching, <kbd>(?[^b])</kbd> matches any character because
+ * it includes '<kbd>B</kbd>' and '<kbd>B</kbd>' matches '<kbd>b</kbd>'
+ * though <kbd>[^b]</kbd> is processed as <kbd>[^Bb]</kbd>.
+ *
+ * <dt class="REGEX"><kbd>[</kbd><var>R<sub>1</sub>R<sub>2</sub>...</var><kbd>-[</kbd><var>R<sub>n</sub>R<sub>n+1</sub>...</var><kbd>]]</kbd> (with an <a href="#X_OPTION">"X" option</a>)</dt>
+ * <dd>Character class subtraction for the XML Schema.
+ * You can use this syntax when you specify an <a href="#X_OPTION">"X" option</a>.
+ *
+ * <dt class="REGEX"><kbd>\d</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[0-9]</kbd>.
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>\p{Nd}</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\D</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[^0-9]</kbd>
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>\P{Nd}</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\s</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[ \f\n\r\t]</kbd>
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>[ \f\n\r\t\p{Z}]</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\S</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[^ \f\n\r\t]</kbd>
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>[^ \f\n\r\t\p{Z}]</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\w</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[a-zA-Z0-9_]</kbd>
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>[\p{Lu}\p{Ll}\p{Lo}\p{Nd}_]</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\W</kbd>
+ * <dd class="REGEX">Equivalent to <kbd>[^a-zA-Z0-9_]</kbd>
+ * <dd>When <a href="#U_OPTION">a "u" option</a> is set, it is equivalent to
+ * <span class="REGEX"><kbd>[^\p{Lu}\p{Ll}\p{Lo}\p{Nd}_]</kbd></span>.
+ *
+ * <dt class="REGEX"><kbd>\p{</kbd><var>name</var><kbd>}</kbd>
+ * <dd>Matches one character in the specified General Category (the second field in <a href="ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt"><kbd>UnicodeData.txt</kbd></a>) or the specified <a href="ftp://ftp.unicode.org/Public/UNIDATA/Blocks.txt">Block</a>.
+ * The following names are available:
+ * <dl>
+ * <dt>Unicode General Categories:
+ * <dd><kbd>
+ * L, M, N, Z, C, P, S, Lu, Ll, Lt, Lm, Lo, Mn, Me, Mc, Nd, Nl, No, Zs, Zl, Zp,
+ * Cc, Cf, Cn, Co, Cs, Pd, Ps, Pe, Pc, Po, Sm, Sc, Sk, So,
+ * </kbd>
+ * <dd>(Currently the Cn category includes U+10000-U+10FFFF characters)
+ * <dt>Unicode Blocks:
+ * <dd><kbd>
+ * Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B,
+ * IPA Extensions, Spacing Modifier Letters, Combining Diacritical Marks, Greek,
+ * Cyrillic, Armenian, Hebrew, Arabic, Devanagari, Bengali, Gurmukhi, Gujarati,
+ * Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, Tibetan, Georgian,
+ * Hangul Jamo, Latin Extended Additional, Greek Extended, General Punctuation,
+ * Superscripts and Subscripts, Currency Symbols, Combining Marks for Symbols,
+ * Letterlike Symbols, Number Forms, Arrows, Mathematical Operators,
+ * Miscellaneous Technical, Control Pictures, Optical Character Recognition,
+ * Enclosed Alphanumerics, Box Drawing, Block Elements, Geometric Shapes,
+ * Miscellaneous Symbols, Dingbats, CJK Symbols and Punctuation, Hiragana,
+ * Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun,
+ * Enclosed CJK Letters and Months, CJK Compatibility, CJK Unified Ideographs,
+ * Hangul Syllables, High Surrogates, High Private Use Surrogates, Low Surrogates,
+ * Private Use, CJK Compatibility Ideographs, Alphabetic Presentation Forms,
+ * Arabic Presentation Forms-A, Combining Half Marks, CJK Compatibility Forms,
+ * Small Form Variants, Arabic Presentation Forms-B, Specials,
+ * Halfwidth and Fullwidth Forms
+ * </kbd>
+ * <dt>Others:
+ * <dd><kbd>ALL</kbd> (Equivalent to <kbd>[\u005cu0000-\u005cv10FFFF]</kbd>)
+ * <dd><kbd>ASSGINED</kbd> (<kbd>\p{ASSIGNED}</kbd> is equivalent to <kbd>\P{Cn}</kbd>)
+ * <dd><kbd>UNASSGINED</kbd>
+ * (<kbd>\p{UNASSIGNED}</kbd> is equivalent to <kbd>\p{Cn}</kbd>)
+ * </dl>
+ *
+ * <dt class="REGEX"><kbd>\P{</kbd><var>name</var><kbd>}</kbd>
+ * <dd>Matches one character not in the specified General Category or the specified Block.
+ * </dl>
+ * </li>
+ *
+ * <li>Selection and Quantifier
+ * <dl>
+ * <dt class="REGEX"><VAR>X</VAR><kbd>|</kbd><VAR>Y</VAR>
+ * <dd>...
+ *
+ * <dt class="REGEX"><VAR>X</VAR><kbd>*</KBD>
+ * <dd>Matches 0 or more <var>X</var>.
+ *
+ * <dt class="REGEX"><VAR>X</VAR><kbd>+</KBD>
+ * <dd>Matches 1 or more <var>X</var>.
+ *
+ * <dt class="REGEX"><VAR>X</VAR><kbd>?</KBD>
+ * <dd>Matches 0 or 1 <var>X</var>.
+ *
+ * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>number</var><kbd>}</kbd>
+ * <dd>Matches <var>number</var> times.
+ *
+ * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,}</kbd>
+ * <dd>...
+ *
+ * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,</kbd><var>max</var><kbd>}</kbd>
+ * <dd>...
+ *
+ * <dt class="REGEX"><VAR>X</VAR><kbd>*?</kbd>
+ * <dt class="REGEX"><VAR>X</VAR><kbd>+?</kbd>
+ * <dt class="REGEX"><VAR>X</VAR><kbd>??</kbd>
+ * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,}?</kbd>
+ * <dt class="REGEX"><var>X</var><kbd>{</kbd><var>min</var><kbd>,</kbd><var>max</var><kbd>}?</kbd>
+ * <dd>Non-greedy matching.
+ * </dl>
+ * </li>
+ *
+ * <li>Grouping, Capturing, and Back-reference
+ * <dl>
+ * <dt class="REGEX"><KBD>(?:</kbd><VAR>X</VAR><kbd>)</KBD>
+ * <dd>Grouping. "<KBD>foo+</KBD>" matches "<KBD>foo</KBD>" or "<KBD>foooo</KBD>".
+ * If you want it matches "<KBD>foofoo</KBD>" or "<KBD>foofoofoo</KBD>",
+ * you have to write "<KBD>(?:foo)+</KBD>".
+ *
+ * <dt class="REGEX"><KBD>(</kbd><VAR>X</VAR><kbd>)</KBD>
+ * <dd>Grouping with capturing.
+ * It make a group and applications can know
+ * where in target text a group matched with methods of a <code>Match</code> instance
+ * after <code><a href="#matches(java.lang.String, org.apache.xerces.utils.regex.Match)">matches(String,Match)</a></code>.
+ * The 0th group means whole of this regular expression.
+ * The <VAR>N</VAR>th gorup is the inside of the <VAR>N</VAR>th left parenthesis.
+ *
+ * <p>For instance, a regular expression is
+ * "<FONT color=blue><KBD> *([^<:]*) +<([^>]*)> *</KBD></FONT>"
+ * and target text is
+ * "<FONT color=red><KBD>From: TAMURA Kent <kent@trl.ibm.co.jp></KBD></FONT>":
+ * <ul>
+ * <li><code>Match.getCapturedText(0)</code>:
+ * "<FONT color=red><KBD> TAMURA Kent <kent@trl.ibm.co.jp></KBD></FONT>"
+ * <li><code>Match.getCapturedText(1)</code>: "<FONT color=red><KBD>TAMURA Kent</KBD></FONT>"
+ * <li><code>Match.getCapturedText(2)</code>: "<FONT color=red><KBD>kent@trl.ibm.co.jp</KBD></FONT>"
+ * </ul>
+ *
+ * <dt class="REGEX"><kbd>\1 \2 \3 \4 \5 \6 \7 \8 \9</kbd>
+ * <dd>
+ *
+ * <dt class="REGEX"><kbd>(?></kbd><var>X</var><kbd>)</kbd>
+ * <dd>Independent expression group. ................
+ *
+ * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>:</kbd><var>X</var><kbd>)</kbd>
+ * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>-</kbd><var>options2</var><kbd>:</kbd><var>X</var><kbd>)</kbd>
+ * <dd>............................
+ * <dd>The <var>options</var> or the <var>options2</var> consists of 'i' 'm' 's' 'w'.
+ * Note that it can not contain 'u'.
+ *
+ * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>)</kbd>
+ * <dt class="REGEX"><kbd>(?</kbd><var>options</var><kbd>-</kbd><var>options2</var><kbd>)</kbd>
+ * <dd>......
+ * <dd>These expressions must be at the beginning of a group.
+ * </dl>
+ * </li>
+ *
+ * <li>Anchor
+ * <dl>
+ * <dt class="REGEX"><kbd>\A</kbd>
+ * <dd>Matches the beginnig of the text.
+ *
+ * <dt class="REGEX"><kbd>\Z</kbd>
+ * <dd>Matches the end of the text, or before an EOL character at the end of the text,
+ * or CARRIAGE RETURN + LINE FEED at the end of the text.
+ *
+ * <dt class="REGEX"><kbd>\z</kbd>
+ * <dd>Matches the end of the text.
+ *
+ * <dt class="REGEX"><kbd>^</kbd>
+ * <dd>Matches the beginning of the text. It is equivalent to <span class="REGEX"><Kbd>\A</kbd></span>.
+ * <dd>When <a href="#M_OPTION">a "m" option</a> is set,
+ * it matches the beginning of the text, or after one of EOL characters (
+ * LINE FEED (U+000A), CARRIAGE RETURN (U+000D), LINE SEPARATOR (U+2028),
+ * PARAGRAPH SEPARATOR (U+2029).)
+ *
+ * <dt class="REGEX"><kbd>$</kbd>
+ * <dd>Matches the end of the text, or before an EOL character at the end of the text,
+ * or CARRIAGE RETURN + LINE FEED at the end of the text.
+ * <dd>When <a href="#M_OPTION">a "m" option</a> is set,
+ * it matches the end of the text, or before an EOL character.
+ *
+ * <dt class="REGEX"><kbd>\b</kbd>
+ * <dd>Matches word boundary.
+ * (See <a href="#W_OPTION">a "w" option</a>)
+ *
+ * <dt class="REGEX"><kbd>\B</kbd>
+ * <dd>Matches non word boundary.
+ * (See <a href="#W_OPTION">a "w" option</a>)
+ *
+ * <dt class="REGEX"><kbd>\<</kbd>
+ * <dd>Matches the beginning of a word.
+ * (See <a href="#W_OPTION">a "w" option</a>)
+ *
+ * <dt class="REGEX"><kbd>\></kbd>
+ * <dd>Matches the end of a word.
+ * (See <a href="#W_OPTION">a "w" option</a>)
+ * </dl>
+ * </li>
+ * <li>Lookahead and lookbehind
+ * <dl>
+ * <dt class="REGEX"><kbd>(?=</kbd><var>X</var><kbd>)</kbd>
+ * <dd>Lookahead.
+ *
+ * <dt class="REGEX"><kbd>(?!</kbd><var>X</var><kbd>)</kbd>
+ * <dd>Negative lookahead.
+ *
+ * <dt class="REGEX"><kbd>(?<=</kbd><var>X</var><kbd>)</kbd>
+ * <dd>Lookbehind.
+ * <dd>(Note for text capturing......)
+ *
+ * <dt class="REGEX"><kbd>(?<!</kbd><var>X</var><kbd>)</kbd>
+ * <dd>Negative lookbehind.
+ * </dl>
+ * </li>
+ *
+ * <li>Misc.
+ * <dl>
+ * <dt class="REGEX"><kbd>(?(</Kbd><var>condition</var><Kbd>)</kbd><var>yes-pattern</var><kbd>|</kbd><var>no-pattern</var><kbd>)</kbd>,
+ * <dt class="REGEX"><kbd>(?(</kbd><var>condition</var><kbd>)</kbd><var>yes-pattern</var><kbd>)</kbd>
+ * <dd>......
+ * <dt class="REGEX"><kbd>(?#</kbd><var>comment</var><kbd>)</kbd>
+ * <dd>Comment. A comment string consists of characters except '<kbd>)</kbd>'.
+ * You can not write comments in character classes and before quantifiers.
+ * </dl>
+ * </li>
+ * </ul>
+ *
+ *
+ * <hr width="50%">
+ * <h3>BNF for the regular expression</h3>
+ * <pre>
+ * regex ::= ('(?' options ')')? term ('|' term)*
+ * term ::= factor+
+ * factor ::= anchors | atom (('*' | '+' | '?' | minmax ) '?'? )?
+ * | '(?#' [^)]* ')'
+ * minmax ::= '{' ([0-9]+ | [0-9]+ ',' | ',' [0-9]+ | [0-9]+ ',' [0-9]+) '}'
+ * atom ::= char | '.' | char-class | '(' regex ')' | '(?:' regex ')' | '\' [0-9]
+ * | '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block | '\X'
+ * | '(?>' regex ')' | '(?' options ':' regex ')'
+ * | '(?' ('(' [0-9] ')' | '(' anchors ')' | looks) term ('|' term)? ')'
+ * options ::= [imsw]* ('-' [imsw]+)?
+ * anchors ::= '^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>'
+ * looks ::= '(?=' regex ')' | '(?!' regex ')'
+ * | '(?<=' regex ')' | '(?<!' regex ')'
+ * char ::= '\\' | '\' [efnrtv] | '\c' [@-_] | code-point | character-1
+ * category-block ::= '\' [pP] category-symbol-1
+ * | ('\p{' | '\P{') (category-symbol | block-name
+ * | other-properties) '}'
+ * category-symbol-1 ::= 'L' | 'M' | 'N' | 'Z' | 'C' | 'P' | 'S'
+ * category-symbol ::= category-symbol-1 | 'Lu' | 'Ll' | 'Lt' | 'Lm' | Lo'
+ * | 'Mn' | 'Me' | 'Mc' | 'Nd' | 'Nl' | 'No'
+ * | 'Zs' | 'Zl' | 'Zp' | 'Cc' | 'Cf' | 'Cn' | 'Co' | 'Cs'
+ * | 'Pd' | 'Ps' | 'Pe' | 'Pc' | 'Po'
+ * | 'Sm' | 'Sc' | 'Sk' | 'So'
+ * block-name ::= (See above)
+ * other-properties ::= 'ALL' | 'ASSIGNED' | 'UNASSIGNED'
+ * character-1 ::= (any character except meta-characters)
+ *
+ * char-class ::= '[' ranges ']'
+ * | '(?[' ranges ']' ([-+&] '[' ranges ']')? ')'
+ * ranges ::= '^'? (range <a href="#COMMA_OPTION">','?</a>)+
+ * range ::= '\d' | '\w' | '\s' | '\D' | '\W' | '\S' | category-block
+ * | range-char | range-char '-' range-char
+ * range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | code-point | character-2
+ * code-point ::= '\x' hex-char hex-char
+ * | '\x{' hex-char+ '}'
+ * <!-- | '\u005c u' hex-char hex-char hex-char hex-char
+ * --> | '\v' hex-char hex-char hex-char hex-char hex-char hex-char
+ * hex-char ::= [0-9a-fA-F]
+ * character-2 ::= (any character except \[]-,)
+ * </pre>
+ *
+ * <hr width="50%">
+ * <h3>TODO</h3>
+ * <ul>
+ * <li><a href="http://www.unicode.org/unicode/reports/tr18/">Unicode Regular Expression Guidelines</a>
+ * <ul>
+ * <li>2.4 Canonical Equivalents
+ * <li>Level 3
+ * </ul>
+ * <li>Parsing performance
+ * </ul>
+ *
+ * <hr width="50%">
+ *
+ * @author TAMURA Kent <kent@trl.ibm.co.jp>
+ * @version $Id$
+ */
+public class RegularExpression implements java.io.Serializable {
+ static final boolean DEBUG = false;
+
+ /**
+ * Compiles a token tree into an operation flow.
+ */
+ private synchronized void compile(Token tok) {
+ if (this.operations != null)
+ return;
+ this.numberOfClosures = 0;
+ this.operations = this.compile(tok, null, false);
+ }
+
+ /**
+ * Converts a token to an operation.
+ */
+ private Op compile(Token tok, Op next, boolean reverse) {
+ Op ret;
+ switch (tok.type) {
+ case Token.DOT:
+ ret = Op.createDot();
+ ret.next = next;
+ break;
+
+ case Token.CHAR:
+ ret = Op.createChar(tok.getChar());
+ ret.next = next;
+ break;
+
+ case Token.ANCHOR:
+ ret = Op.createAnchor(tok.getChar());
+ ret.next = next;
+ break;
+
+ case Token.RANGE:
+ case Token.NRANGE:
+ ret = Op.createRange(tok);
+ ret.next = next;
+ break;
+
+ case Token.CONCAT:
+ ret = next;
+ if (!reverse) {
+ for (int i = tok.size()-1; i >= 0; i --) {
+ ret = compile(tok.getChild(i), ret, false);
+ }
+ } else {
+ for (int i = 0; i < tok.size(); i ++) {
+ ret = compile(tok.getChild(i), ret, true);
+ }
+ }
+ break;
+
+ case Token.UNION:
+ Op.UnionOp uni = Op.createUnion(tok.size());
+ for (int i = 0; i < tok.size(); i ++) {
+ uni.addElement(compile(tok.getChild(i), next, reverse));
+ }
+ ret = uni; // ret.next is null.
+ break;
+
+ case Token.CLOSURE:
+ case Token.NONGREEDYCLOSURE:
+ Token child = tok.getChild(0);
+ int min = tok.getMin();
+ int max = tok.getMax();
+ if (min >= 0 && min == max) { // {n}
+ ret = next;
+ for (int i = 0; i < min; i ++) {
+ ret = compile(child, ret, reverse);
+ }
+ break;
+ }
+ if (min > 0 && max > 0)
+ max -= min;
+ if (max > 0) {
+ // X{2,6} -> XX(X(X(XX?)?)?)?
+ ret = next;
+ for (int i = 0; i < max; i ++) {
+ Op.ChildOp q = Op.createQuestion(tok.type == Token.NONGREEDYCLOSURE);
+ q.next = next;
+ q.setChild(compile(child, ret, reverse));
+ ret = q;
+ }
+ } else {
+ Op.ChildOp op;
+ if (tok.type == Token.NONGREEDYCLOSURE) {
+ op = Op.createNonGreedyClosure();
+ } else { // Token.CLOSURE
+ if (child.getMinLength() == 0)
+ op = Op.createClosure(this.numberOfClosures++);
+ else
+ op = Op.createClosure(-1);
+ }
+ op.next = next;
+ op.setChild(compile(child, op, reverse));
+ ret = op;
+ }
+ if (min > 0) {
+ for (int i = 0; i < min; i ++) {
+ ret = compile(child, ret, reverse);
+ }
+ }
+ break;
+
+ case Token.EMPTY:
+ ret = next;
+ break;
+
+ case Token.STRING:
+ ret = Op.createString(tok.getString());
+ ret.next = next;
+ break;
+
+ case Token.BACKREFERENCE:
+ ret = Op.createBackReference(tok.getReferenceNumber());
+ ret.next = next;
+ break;
+
+ case Token.PAREN:
+ if (tok.getParenNumber() == 0) {
+ ret = compile(tok.getChild(0), next, reverse);
+ } else if (reverse) {
+ next = Op.createCapture(tok.getParenNumber(), next);
+ next = compile(tok.getChild(0), next, reverse);
+ ret = Op.createCapture(-tok.getParenNumber(), next);
+ } else {
+ next = Op.createCapture(-tok.getParenNumber(), next);
+ next = compile(tok.getChild(0), next, reverse);
+ ret = Op.createCapture(tok.getParenNumber(), next);
+ }
+ break;
+
+ case Token.LOOKAHEAD:
+ ret = Op.createLook(Op.LOOKAHEAD, next, compile(tok.getChild(0), null, false));
+ break;
+ case Token.NEGATIVELOOKAHEAD:
+ ret = Op.createLook(Op.NEGATIVELOOKAHEAD, next, compile(tok.getChild(0), null, false));
+ break;
+ case Token.LOOKBEHIND:
+ ret = Op.createLook(Op.LOOKBEHIND, next, compile(tok.getChild(0), null, true));
+ break;
+ case Token.NEGATIVELOOKBEHIND:
+ ret = Op.createLook(Op.NEGATIVELOOKBEHIND, next, compile(tok.getChild(0), null, true));
+ break;
+
+ case Token.INDEPENDENT:
+ ret = Op.createIndependent(next, compile(tok.getChild(0), null, reverse));
+ break;
+
+ case Token.MODIFIERGROUP:
+ ret = Op.createModifier(next, compile(tok.getChild(0), null, reverse),
+ ((Token.ModifierToken)tok).getOptions(),
+ ((Token.ModifierToken)tok).getOptionsMask());
+ break;
+
+ case Token.CONDITION:
+ Token.ConditionToken ctok = (Token.ConditionToken)tok;
+ int ref = ctok.refNumber;
+ Op condition = ctok.condition == null ? null : compile(ctok.condition, null, reverse);
+ Op yes = compile(ctok.yes, next, reverse);
+ Op no = ctok.no == null ? null : compile(ctok.no, next, reverse);
+ ret = Op.createCondition(next, ref, condition, yes, no);
+ break;
+
+ default:
+ throw new RuntimeException("Unknown token type: "+tok.type);
+ } // switch (tok.type)
+ return ret;
+ }
+
+
+//Public
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @return true if the target is matched to this regular expression.
+ */
+ public boolean matches(char[] target) {
+ return this.matches(target, 0, target .length , (Match)null);
+ }
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern
+ * in specified range or not.
+ *
+ * @param start Start offset of the range.
+ * @param end End offset +1 of the range.
+ * @return true if the target is matched to this regular expression.
+ */
+ public boolean matches(char[] target, int start, int end) {
+ return this.matches(target, start, end, (Match)null);
+ }
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @param match A Match instance for storing matching result.
+ * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match.
+ */
+ public boolean matches(char[] target, Match match) {
+ return this.matches(target, 0, target .length , match);
+ }
+
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern
+ * in specified range or not.
+ *
+ * @param start Start offset of the range.
+ * @param end End offset +1 of the range.
+ * @param match A Match instance for storing matching result.
+ * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match.
+ */
+ public boolean matches(char[] target, int start, int end, Match match) {
+
+ synchronized (this) {
+ if (this.operations == null)
+ this.prepare();
+ if (this.context == null)
+ this.context = new Context();
+ }
+ Context con = null;
+ synchronized (this.context) {
+ con = this.context.inuse ? new Context() : this.context;
+ con.reset(target, start, end, this.numberOfClosures);
+ }
+ if (match != null) {
+ match.setNumberOfGroups(this.nofparen);
+ match.setSource(target);
+ } else if (this.hasBackReferences) {
+ match = new Match();
+ match.setNumberOfGroups(this.nofparen);
+ // Need not to call setSource() because
+ // a caller can not access this match instance.
+ }
+ con.match = match;
+
+ if (this.isSet(this.options, XMLSCHEMA_MODE)) {
+ int matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options);
+ //System.err.println("DEBUG: matchEnd="+matchEnd);
+ if (matchEnd == con.limit) {
+ if (con.match != null) {
+ con.match.setBeginning(0, con.start);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * The pattern has only fixed string.
+ * The engine uses Boyer-Moore.
+ */
+ if (this.fixedStringOnly) {
+ //System.err.println("DEBUG: fixed-only: "+this.fixedString);
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, o);
+ con.match.setEnd(0, o+this.fixedString.length());
+ }
+ con.inuse = false;
+ return true;
+ }
+ con.inuse = false;
+ return false;
+ }
+
+ /*
+ * The pattern contains a fixed string.
+ * The engine checks with Boyer-Moore whether the text contains the fixed string or not.
+ * If not, it return with false.
+ */
+ if (this.fixedString != null) {
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o < 0) {
+ //System.err.println("Non-match in fixed-string search.");
+ con.inuse = false;
+ return false;
+ }
+ }
+
+ int limit = con.limit-this.minlength;
+ int matchStart;
+ int matchEnd = -1;
+
+ /*
+ * Checks whether the expression starts with ".*".
+ */
+ if (this.operations != null
+ && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {
+ if (isSet(this.options, SINGLE_LINE)) {
+ matchStart = con.start;
+ matchEnd = this. matchCharArray (con, this.operations, con.start, 1, this.options);
+ } else {
+ boolean previousIsEOL = true;
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target [ matchStart ] ;
+ if (isEOLChar(ch)) {
+ previousIsEOL = true;
+ } else {
+ if (previousIsEOL) {
+ if (0 <= (matchEnd = this. matchCharArray (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ previousIsEOL = false;
+ }
+ }
+ }
+ }
+
+ /*
+ * Optimization against the first character.
+ */
+ else if (this.firstChar != null) {
+ //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);
+ RangeToken range = this.firstChar;
+ if (this.isSet(this.options, IGNORE_CASE)) {
+ range = this.firstChar.getCaseInsensitiveToken();
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target [ matchStart ] ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) {
+ ch = REUtil.composeFromSurrogates(ch, target [ matchStart+1 ] );
+ if (!range.match(ch)) continue;
+ } else {
+ if (!range.match(ch)) {
+ char ch1 = Character.toUpperCase((char)ch);
+ if (!range.match(ch1))
+ if (!range.match(Character.toLowerCase(ch1)))
+ continue;
+ }
+ }
+ if (0 <= (matchEnd = this. matchCharArray (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ } else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target [ matchStart ] ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target [ matchStart+1 ] );
+ if (!range.match(ch)) continue;
+ if (0 <= (matchEnd = this. matchCharArray (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ }
+ }
+
+ /*
+ * Straightforward matching.
+ */
+ else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ if (0 <= (matchEnd = this. matchCharArray (con, this.operations, matchStart, 1, this.options)))
+ break;
+ }
+ }
+
+ if (matchEnd >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, matchStart);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ } else {
+ con.inuse = false;
+ return false;
+ }
+ }
+
+/**
+ * @return -1 when not match; offset of the end of matched string when match.
+ */
+ private int matchCharArray (Context con, Op op, int offset, int dx, int opts) {
+
+ char[] target = con.charTarget;
+
+
+ while (true) {
+ if (op == null)
+ return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
+ if (offset > con.limit || offset < con.start)
+ return -1;
+ switch (op.type) {
+ case Op.CHAR:
+ if (isSet(opts, IGNORE_CASE)) {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || !matchIgnoreCase(ch, target [ offset ] ))
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target [ o1 ] ))
+ return -1;
+ offset = o1;
+ }
+ } else {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || ch != target [ offset ] )
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || ch != target [ o1 ] )
+ return -1;
+ offset = o1;
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.DOT:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target [ offset ] ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ offset ++;
+ } else {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target [ ++offset ] );
+ if (isEOLChar(ch))
+ return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target [ o1 ] ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ o1 --;
+ } else {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target [ --o1 ] , ch);
+ if (!isEOLChar(ch))
+ return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.RANGE:
+ case Op.NRANGE:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target [ offset ] ;
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target [ ++offset ] );
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target [ o1 ] ;
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target [ --o1 ] , ch);
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.ANCHOR:
+ boolean go = false;
+ switch (op.getData()) {
+ case '^':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target [ offset-1 ] )))
+ return -1;
+ } else {
+ if (offset != con.start)
+ return -1;
+ }
+ break;
+
+ case '@': // Internal use only.
+ // The @ always matches line beginnings.
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target [ offset-1 ] )))
+ return -1;
+ break;
+
+ case '$':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.limit
+ || offset < con.limit && isEOLChar( target [ offset ] )))
+ return -1;
+ } else {
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target [ offset ] )
+ || offset+2 == con.limit && target [ offset ] == CARRIAGE_RETURN
+ && target [ offset+1 ] == LINE_FEED))
+ return -1;
+ }
+ break;
+
+ case 'A':
+ if (offset != con.start) return -1;
+ break;
+
+ case 'Z':
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target [ offset ] )
+ || offset+2 == con.limit && target [ offset ] == CARRIAGE_RETURN
+ && target [ offset+1 ] == LINE_FEED))
+ return -1;
+ break;
+
+ case 'z':
+ if (offset != con.limit) return -1;
+ break;
+
+ case 'b':
+ if (con.length == 0) return -1;
+ {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ if (after == WT_IGNORE) return -1;
+ int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
+ if (after == before) return -1;
+ }
+ break;
+
+ case 'B':
+ if (con.length == 0)
+ go = true;
+ else {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ go = after == WT_IGNORE
+ || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
+ }
+ if (!go) return -1;
+ break;
+
+ case '<':
+ if (con.length == 0 || offset == con.limit) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)
+ return -1;
+ break;
+
+ case '>':
+ if (con.length == 0 || offset == con.start) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)
+ return -1;
+ break;
+ } // switch anchor type
+ op = op.next;
+ break;
+
+ case Op.BACKREFERENCE:
+ {
+ int refno = op.getData();
+ if (refno <= 0 || refno >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);
+ if (con.match.getBeginning(refno) < 0
+ || con.match.getEnd(refno) < 0)
+ return -1; // ********
+ int o2 = con.match.getBeginning(refno);
+ int literallen = con.match.getEnd(refno)-o2;
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+ case Op.STRING:
+ {
+ String literal = op.getString();
+ int literallen = literal.length();
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.CLOSURE:
+ {
+ /*
+ * Saves current position to avoid
+ * zero-width repeats.
+ */
+ int id = op.getData();
+ if (id >= 0) {
+ int previousOffset = con.offsets[id];
+ if (previousOffset < 0 || previousOffset != offset) {
+ con.offsets[id] = offset;
+ } else {
+ con.offsets[id] = -1;
+ op = op.next;
+ break;
+ }
+ }
+
+ int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts);
+ if (id >= 0) con.offsets[id] = -1;
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.QUESTION:
+ {
+ int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.NONGREEDYCLOSURE:
+ case Op.NONGREEDYQUESTION:
+ {
+ int ret = this. matchCharArray (con, op.next, offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.getChild();
+ }
+ break;
+
+ case Op.UNION:
+ for (int i = 0; i < op.size(); i ++) {
+ int ret = this. matchCharArray (con, op.elementAt(i), offset, dx, opts);
+ if (DEBUG) {
+ System.err.println("UNION: "+i+", ret="+ret);
+ }
+ if (ret >= 0) return ret;
+ }
+ return -1;
+
+ case Op.CAPTURE:
+ int refno = op.getData();
+ if (con.match != null && refno > 0) {
+ int save = con.match.getBeginning(refno);
+ con.match.setBeginning(refno, offset);
+ int ret = this. matchCharArray (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setBeginning(refno, save);
+ return ret;
+ } else if (con.match != null && refno < 0) {
+ int index = -refno;
+ int save = con.match.getEnd(index);
+ con.match.setEnd(index, offset);
+ int ret = this. matchCharArray (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setEnd(index, save);
+ return ret;
+ }
+ op = op.next;
+ break;
+
+ case Op.LOOKAHEAD:
+ if (0 > this. matchCharArray (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKAHEAD:
+ if (0 <= this. matchCharArray (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.LOOKBEHIND:
+ if (0 > this. matchCharArray (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKBEHIND:
+ if (0 <= this. matchCharArray (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+
+ case Op.INDEPENDENT:
+ {
+ int ret = this. matchCharArray (con, op.getChild(), offset, dx, opts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.MODIFIER:
+ {
+ int localopts = opts;
+ localopts |= op.getData();
+ localopts &= ~op.getData2();
+ //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16));
+ int ret = this. matchCharArray (con, op.getChild(), offset, dx, localopts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.CONDITION:
+ {
+ Op.ConditionOp cop = (Op.ConditionOp)op;
+ boolean matchp = false;
+ if (cop.refNumber > 0) {
+ if (cop.refNumber >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
+ matchp = con.match.getBeginning(cop.refNumber) >= 0
+ && con.match.getEnd(cop.refNumber) >= 0;
+ } else {
+ matchp = 0 <= this. matchCharArray (con, cop.condition, offset, dx, opts);
+ }
+
+ if (matchp) {
+ op = cop.yes;
+ } else if (cop.no != null) {
+ op = cop.no;
+ } else {
+ op = cop.next;
+ }
+ }
+ break;
+
+ default:
+ throw new RuntimeException("Unknown operation type: "+op.type);
+ } // switch (op.type)
+ } // while
+ }
+
+ private static final int getPreviousWordType(char[] target, int begin, int end,
+ int offset, int opts) {
+ int ret = getWordType(target, begin, end, --offset, opts);
+ while (ret == WT_IGNORE)
+ ret = getWordType(target, begin, end, --offset, opts);
+ return ret;
+ }
+
+ private static final int getWordType(char[] target, int begin, int end,
+ int offset, int opts) {
+ if (offset < begin || offset >= end) return WT_OTHER;
+ return getWordType0( target [ offset ] , opts);
+ }
+
+
+
+ private static final boolean regionMatches(char[] target, int offset, int limit,
+ String part, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = 0;
+ while (partlen-- > 0) {
+ if ( target [ offset++ ] != part.charAt(i++))
+ return false;
+ }
+ return true;
+ }
+
+ private static final boolean regionMatches(char[] target, int offset, int limit,
+ int offset2, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = offset2;
+ while (partlen-- > 0) {
+ if ( target [ offset++ ] != target [ i++ ] )
+ return false;
+ }
+ return true;
+ }
+
+/**
+ * @see java.lang.String#regionMatches
+ */
+ private static final boolean regionMatchesIgnoreCase(char[] target, int offset, int limit,
+ String part, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = 0;
+ while (partlen-- > 0) {
+ char ch1 = target [ offset++ ] ;
+ char ch2 = part.charAt(i++);
+ if (ch1 == ch2)
+ continue;
+ char uch1 = Character.toUpperCase(ch1);
+ char uch2 = Character.toUpperCase(ch2);
+ if (uch1 == uch2)
+ continue;
+ if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
+ return false;
+ }
+ return true;
+ }
+
+ private static final boolean regionMatchesIgnoreCase(char[] target, int offset, int limit,
+ int offset2, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = offset2;
+ while (partlen-- > 0) {
+ char ch1 = target [ offset++ ] ;
+ char ch2 = target [ i++ ] ;
+ if (ch1 == ch2)
+ continue;
+ char uch1 = Character.toUpperCase(ch1);
+ char uch2 = Character.toUpperCase(ch2);
+ if (uch1 == uch2)
+ continue;
+ if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
+ return false;
+ }
+ return true;
+ }
+
+
+
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @return true if the target is matched to this regular expression.
+ */
+ public boolean matches(String target) {
+ return this.matches(target, 0, target .length() , (Match)null);
+ }
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern
+ * in specified range or not.
+ *
+ * @param start Start offset of the range.
+ * @param end End offset +1 of the range.
+ * @return true if the target is matched to this regular expression.
+ */
+ public boolean matches(String target, int start, int end) {
+ return this.matches(target, start, end, (Match)null);
+ }
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @param match A Match instance for storing matching result.
+ * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match.
+ */
+ public boolean matches(String target, Match match) {
+ return this.matches(target, 0, target .length() , match);
+ }
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern
+ * in specified range or not.
+ *
+ * @param start Start offset of the range.
+ * @param end End offset +1 of the range.
+ * @param match A Match instance for storing matching result.
+ * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match.
+ */
+ public boolean matches(String target, int start, int end, Match match) {
+
+ synchronized (this) {
+ if (this.operations == null)
+ this.prepare();
+ if (this.context == null)
+ this.context = new Context();
+ }
+ Context con = null;
+ synchronized (this.context) {
+ con = this.context.inuse ? new Context() : this.context;
+ con.reset(target, start, end, this.numberOfClosures);
+ }
+ if (match != null) {
+ match.setNumberOfGroups(this.nofparen);
+ match.setSource(target);
+ } else if (this.hasBackReferences) {
+ match = new Match();
+ match.setNumberOfGroups(this.nofparen);
+ // Need not to call setSource() because
+ // a caller can not access this match instance.
+ }
+ con.match = match;
+
+ if (this.isSet(this.options, XMLSCHEMA_MODE)) {
+ if (DEBUG) {
+ System.err.println("target string="+target);
+ }
+ int matchEnd = this. matchString (con, this.operations, con.start, 1, this.options);
+ if (DEBUG) {
+ System.err.println("matchEnd="+matchEnd);
+ System.err.println("con.limit="+con.limit);
+ }
+ if (matchEnd == con.limit) {
+ if (con.match != null) {
+ con.match.setBeginning(0, con.start);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * The pattern has only fixed string.
+ * The engine uses Boyer-Moore.
+ */
+ if (this.fixedStringOnly) {
+ //System.err.println("DEBUG: fixed-only: "+this.fixedString);
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, o);
+ con.match.setEnd(0, o+this.fixedString.length());
+ }
+ con.inuse = false;
+ return true;
+ }
+ con.inuse = false;
+ return false;
+ }
+
+ /*
+ * The pattern contains a fixed string.
+ * The engine checks with Boyer-Moore whether the text contains the fixed string or not.
+ * If not, it return with false.
+ */
+ if (this.fixedString != null) {
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o < 0) {
+ //System.err.println("Non-match in fixed-string search.");
+ con.inuse = false;
+ return false;
+ }
+ }
+
+ int limit = con.limit-this.minlength;
+ int matchStart;
+ int matchEnd = -1;
+
+ /*
+ * Checks whether the expression starts with ".*".
+ */
+ if (this.operations != null
+ && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {
+ if (isSet(this.options, SINGLE_LINE)) {
+ matchStart = con.start;
+ matchEnd = this. matchString (con, this.operations, con.start, 1, this.options);
+ } else {
+ boolean previousIsEOL = true;
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .charAt( matchStart ) ;
+ if (isEOLChar(ch)) {
+ previousIsEOL = true;
+ } else {
+ if (previousIsEOL) {
+ if (0 <= (matchEnd = this. matchString (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ previousIsEOL = false;
+ }
+ }
+ }
+ }
+
+ /*
+ * Optimization against the first character.
+ */
+ else if (this.firstChar != null) {
+ //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);
+ RangeToken range = this.firstChar;
+ if (this.isSet(this.options, IGNORE_CASE)) {
+ range = this.firstChar.getCaseInsensitiveToken();
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .charAt( matchStart ) ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) {
+ ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) );
+ if (!range.match(ch)) continue;
+ } else {
+ if (!range.match(ch)) {
+ char ch1 = Character.toUpperCase((char)ch);
+ if (!range.match(ch1))
+ if (!range.match(Character.toLowerCase(ch1)))
+ continue;
+ }
+ }
+ if (0 <= (matchEnd = this. matchString (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ } else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .charAt( matchStart ) ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .charAt( matchStart+1 ) );
+ if (!range.match(ch)) continue;
+ if (0 <= (matchEnd = this. matchString (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ }
+ }
+
+ /*
+ * Straightforward matching.
+ */
+ else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ if (0 <= (matchEnd = this. matchString (con, this.operations, matchStart, 1, this.options)))
+ break;
+ }
+ }
+
+ if (matchEnd >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, matchStart);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ } else {
+ con.inuse = false;
+ return false;
+ }
+ }
+
+ /**
+ * @return -1 when not match; offset of the end of matched string when match.
+ */
+ private int matchString (Context con, Op op, int offset, int dx, int opts) {
+
+
+
+
+ String target = con.strTarget;
+
+
+
+
+ while (true) {
+ if (op == null)
+ return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
+ if (offset > con.limit || offset < con.start)
+ return -1;
+ switch (op.type) {
+ case Op.CHAR:
+ if (isSet(opts, IGNORE_CASE)) {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || !matchIgnoreCase(ch, target .charAt( offset ) ))
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .charAt( o1 ) ))
+ return -1;
+ offset = o1;
+ }
+ } else {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || ch != target .charAt( offset ) )
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || ch != target .charAt( o1 ) )
+ return -1;
+ offset = o1;
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.DOT:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target .charAt( offset ) ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ offset ++;
+ } else {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) );
+ if (isEOLChar(ch))
+ return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target .charAt( o1 ) ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ o1 --;
+ } else {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch);
+ if (!isEOLChar(ch))
+ return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.RANGE:
+ case Op.NRANGE:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target .charAt( offset ) ;
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .charAt( ++offset ) );
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target .charAt( o1 ) ;
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target .charAt( --o1 ) , ch);
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.ANCHOR:
+ boolean go = false;
+ switch (op.getData()) {
+ case '^':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target .charAt( offset-1 ) )))
+ return -1;
+ } else {
+ if (offset != con.start)
+ return -1;
+ }
+ break;
+
+ case '@': // Internal use only.
+ // The @ always matches line beginnings.
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target .charAt( offset-1 ) )))
+ return -1;
+ break;
+
+ case '$':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.limit
+ || offset < con.limit && isEOLChar( target .charAt( offset ) )))
+ return -1;
+ } else {
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target .charAt( offset ) )
+ || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN
+ && target .charAt( offset+1 ) == LINE_FEED))
+ return -1;
+ }
+ break;
+
+ case 'A':
+ if (offset != con.start) return -1;
+ break;
+
+ case 'Z':
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target .charAt( offset ) )
+ || offset+2 == con.limit && target .charAt( offset ) == CARRIAGE_RETURN
+ && target .charAt( offset+1 ) == LINE_FEED))
+ return -1;
+ break;
+
+ case 'z':
+ if (offset != con.limit) return -1;
+ break;
+
+ case 'b':
+ if (con.length == 0) return -1;
+ {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ if (after == WT_IGNORE) return -1;
+ int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
+ if (after == before) return -1;
+ }
+ break;
+
+ case 'B':
+ if (con.length == 0)
+ go = true;
+ else {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ go = after == WT_IGNORE
+ || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
+ }
+ if (!go) return -1;
+ break;
+
+ case '<':
+ if (con.length == 0 || offset == con.limit) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)
+ return -1;
+ break;
+
+ case '>':
+ if (con.length == 0 || offset == con.start) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)
+ return -1;
+ break;
+ } // switch anchor type
+ op = op.next;
+ break;
+
+ case Op.BACKREFERENCE:
+ {
+ int refno = op.getData();
+ if (refno <= 0 || refno >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);
+ if (con.match.getBeginning(refno) < 0
+ || con.match.getEnd(refno) < 0)
+ return -1; // ********
+ int o2 = con.match.getBeginning(refno);
+ int literallen = con.match.getEnd(refno)-o2;
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+ case Op.STRING:
+ {
+ String literal = op.getString();
+ int literallen = literal.length();
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.CLOSURE:
+ {
+ /*
+ * Saves current position to avoid
+ * zero-width repeats.
+ */
+ int id = op.getData();
+ if (id >= 0) {
+ int previousOffset = con.offsets[id];
+ if (previousOffset < 0 || previousOffset != offset) {
+ con.offsets[id] = offset;
+ } else {
+ con.offsets[id] = -1;
+ op = op.next;
+ break;
+ }
+ }
+ int ret = this. matchString (con, op.getChild(), offset, dx, opts);
+ if (id >= 0) con.offsets[id] = -1;
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.QUESTION:
+ {
+ int ret = this. matchString (con, op.getChild(), offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.NONGREEDYCLOSURE:
+ case Op.NONGREEDYQUESTION:
+ {
+ int ret = this. matchString (con, op.next, offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.getChild();
+ }
+ break;
+
+ case Op.UNION:
+ for (int i = 0; i < op.size(); i ++) {
+ int ret = this. matchString (con, op.elementAt(i), offset, dx, opts);
+ if (DEBUG) {
+ System.err.println("UNION: "+i+", ret="+ret);
+ }
+ if (ret >= 0) return ret;
+ }
+ return -1;
+
+ case Op.CAPTURE:
+ int refno = op.getData();
+ if (con.match != null && refno > 0) {
+ int save = con.match.getBeginning(refno);
+ con.match.setBeginning(refno, offset);
+ int ret = this. matchString (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setBeginning(refno, save);
+ return ret;
+ } else if (con.match != null && refno < 0) {
+ int index = -refno;
+ int save = con.match.getEnd(index);
+ con.match.setEnd(index, offset);
+ int ret = this. matchString (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setEnd(index, save);
+ return ret;
+ }
+ op = op.next;
+ break;
+
+ case Op.LOOKAHEAD:
+ if (0 > this. matchString (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKAHEAD:
+ if (0 <= this. matchString (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.LOOKBEHIND:
+ if (0 > this. matchString (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKBEHIND:
+ if (0 <= this. matchString (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+
+ case Op.INDEPENDENT:
+ {
+ int ret = this. matchString (con, op.getChild(), offset, dx, opts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.MODIFIER:
+ {
+ int localopts = opts;
+ localopts |= op.getData();
+ localopts &= ~op.getData2();
+ //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16));
+ int ret = this. matchString (con, op.getChild(), offset, dx, localopts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.CONDITION:
+ {
+ Op.ConditionOp cop = (Op.ConditionOp)op;
+ boolean matchp = false;
+ if (cop.refNumber > 0) {
+ if (cop.refNumber >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
+ matchp = con.match.getBeginning(cop.refNumber) >= 0
+ && con.match.getEnd(cop.refNumber) >= 0;
+ } else {
+ matchp = 0 <= this. matchString (con, cop.condition, offset, dx, opts);
+ }
+
+ if (matchp) {
+ op = cop.yes;
+ } else if (cop.no != null) {
+ op = cop.no;
+ } else {
+ op = cop.next;
+ }
+ }
+ break;
+
+ default:
+ throw new RuntimeException("Unknown operation type: "+op.type);
+ } // switch (op.type)
+ } // while
+ }
+
+ private static final int getPreviousWordType(String target, int begin, int end,
+ int offset, int opts) {
+ int ret = getWordType(target, begin, end, --offset, opts);
+ while (ret == WT_IGNORE)
+ ret = getWordType(target, begin, end, --offset, opts);
+ return ret;
+ }
+
+ private static final int getWordType(String target, int begin, int end,
+ int offset, int opts) {
+ if (offset < begin || offset >= end) return WT_OTHER;
+ return getWordType0( target .charAt( offset ) , opts);
+ }
+
+
+ private static final boolean regionMatches(String text, int offset, int limit,
+ String part, int partlen) {
+ if (limit-offset < partlen) return false;
+ return text.regionMatches(offset, part, 0, partlen);
+ }
+
+ private static final boolean regionMatches(String text, int offset, int limit,
+ int offset2, int partlen) {
+ if (limit-offset < partlen) return false;
+ return text.regionMatches(offset, text, offset2, partlen);
+ }
+
+ private static final boolean regionMatchesIgnoreCase(String text, int offset, int limit,
+ String part, int partlen) {
+ return text.regionMatches(true, offset, part, 0, partlen);
+ }
+
+ private static final boolean regionMatchesIgnoreCase(String text, int offset, int limit,
+ int offset2, int partlen) {
+ if (limit-offset < partlen) return false;
+ return text.regionMatches(true, offset, text, offset2, partlen);
+ }
+
+
+
+
+
+
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @return true if the target is matched to this regular expression.
+ */
+ public boolean matches(CharacterIterator target) {
+ return this.matches(target, (Match)null);
+ }
+
+
+ /**
+ * Checks whether the <var>target</var> text <strong>contains</strong> this pattern or not.
+ *
+ * @param match A Match instance for storing matching result.
+ * @return Offset of the start position in <VAR>target</VAR>; or -1 if not match.
+ */
+ public boolean matches(CharacterIterator target, Match match) {
+ int start = target.getBeginIndex();
+ int end = target.getEndIndex();
+
+
+
+ synchronized (this) {
+ if (this.operations == null)
+ this.prepare();
+ if (this.context == null)
+ this.context = new Context();
+ }
+ Context con = null;
+ synchronized (this.context) {
+ con = this.context.inuse ? new Context() : this.context;
+ con.reset(target, start, end, this.numberOfClosures);
+ }
+ if (match != null) {
+ match.setNumberOfGroups(this.nofparen);
+ match.setSource(target);
+ } else if (this.hasBackReferences) {
+ match = new Match();
+ match.setNumberOfGroups(this.nofparen);
+ // Need not to call setSource() because
+ // a caller can not access this match instance.
+ }
+ con.match = match;
+
+ if (this.isSet(this.options, XMLSCHEMA_MODE)) {
+ int matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options);
+ //System.err.println("DEBUG: matchEnd="+matchEnd);
+ if (matchEnd == con.limit) {
+ if (con.match != null) {
+ con.match.setBeginning(0, con.start);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * The pattern has only fixed string.
+ * The engine uses Boyer-Moore.
+ */
+ if (this.fixedStringOnly) {
+ //System.err.println("DEBUG: fixed-only: "+this.fixedString);
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, o);
+ con.match.setEnd(0, o+this.fixedString.length());
+ }
+ con.inuse = false;
+ return true;
+ }
+ con.inuse = false;
+ return false;
+ }
+
+ /*
+ * The pattern contains a fixed string.
+ * The engine checks with Boyer-Moore whether the text contains the fixed string or not.
+ * If not, it return with false.
+ */
+ if (this.fixedString != null) {
+ int o = this.fixedStringTable.matches(target, con.start, con.limit);
+ if (o < 0) {
+ //System.err.println("Non-match in fixed-string search.");
+ con.inuse = false;
+ return false;
+ }
+ }
+
+ int limit = con.limit-this.minlength;
+ int matchStart;
+ int matchEnd = -1;
+
+ /*
+ * Checks whether the expression starts with ".*".
+ */
+ if (this.operations != null
+ && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {
+ if (isSet(this.options, SINGLE_LINE)) {
+ matchStart = con.start;
+ matchEnd = this. matchCharacterIterator (con, this.operations, con.start, 1, this.options);
+ } else {
+ boolean previousIsEOL = true;
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .setIndex( matchStart ) ;
+ if (isEOLChar(ch)) {
+ previousIsEOL = true;
+ } else {
+ if (previousIsEOL) {
+ if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ previousIsEOL = false;
+ }
+ }
+ }
+ }
+
+ /*
+ * Optimization against the first character.
+ */
+ else if (this.firstChar != null) {
+ //System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);
+ RangeToken range = this.firstChar;
+ if (this.isSet(this.options, IGNORE_CASE)) {
+ range = this.firstChar.getCaseInsensitiveToken();
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .setIndex( matchStart ) ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit) {
+ ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) );
+ if (!range.match(ch)) continue;
+ } else {
+ if (!range.match(ch)) {
+ char ch1 = Character.toUpperCase((char)ch);
+ if (!range.match(ch1))
+ if (!range.match(Character.toLowerCase(ch1)))
+ continue;
+ }
+ }
+ if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ } else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ int ch = target .setIndex( matchStart ) ;
+ if (REUtil.isHighSurrogate(ch) && matchStart+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .setIndex( matchStart+1 ) );
+ if (!range.match(ch)) continue;
+ if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations,
+ matchStart, 1, this.options)))
+ break;
+ }
+ }
+ }
+
+ /*
+ * Straightforward matching.
+ */
+ else {
+ for (matchStart = con.start; matchStart <= limit; matchStart ++) {
+ if (0 <= (matchEnd = this. matchCharacterIterator (con, this.operations, matchStart, 1, this.options)))
+ break;
+ }
+ }
+
+ if (matchEnd >= 0) {
+ if (con.match != null) {
+ con.match.setBeginning(0, matchStart);
+ con.match.setEnd(0, matchEnd);
+ }
+ con.inuse = false;
+ return true;
+ } else {
+ con.inuse = false;
+ return false;
+ }
+ }
+
+ /**
+ * @return -1 when not match; offset of the end of matched string when match.
+ */
+ private int matchCharacterIterator (Context con, Op op, int offset, int dx, int opts) {
+
+
+ CharacterIterator target = con.ciTarget;
+
+
+
+
+
+
+ while (true) {
+ if (op == null)
+ return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
+ if (offset > con.limit || offset < con.start)
+ return -1;
+ switch (op.type) {
+ case Op.CHAR:
+ if (isSet(opts, IGNORE_CASE)) {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || !matchIgnoreCase(ch, target .setIndex( offset ) ))
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target .setIndex( o1 ) ))
+ return -1;
+ offset = o1;
+ }
+ } else {
+ int ch = op.getData();
+ if (dx > 0) {
+ if (offset >= con.limit || ch != target .setIndex( offset ) )
+ return -1;
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0 || ch != target .setIndex( o1 ) )
+ return -1;
+ offset = o1;
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.DOT:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target .setIndex( offset ) ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ offset ++;
+ } else {
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) );
+ if (isEOLChar(ch))
+ return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target .setIndex( o1 ) ;
+ if (isSet(opts, SINGLE_LINE)) {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ o1 --;
+ } else {
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch);
+ if (!isEOLChar(ch))
+ return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.RANGE:
+ case Op.NRANGE:
+ if (dx > 0) {
+ if (offset >= con.limit)
+ return -1;
+ int ch = target .setIndex( offset ) ;
+ if (REUtil.isHighSurrogate(ch) && offset+1 < con.limit)
+ ch = REUtil.composeFromSurrogates(ch, target .setIndex( ++offset ) );
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset ++;
+ } else {
+ int o1 = offset-1;
+ if (o1 >= con.limit || o1 < 0)
+ return -1;
+ int ch = target .setIndex( o1 ) ;
+ if (REUtil.isLowSurrogate(ch) && o1-1 >= 0)
+ ch = REUtil.composeFromSurrogates( target .setIndex( --o1 ) , ch);
+ RangeToken tok = op.getToken();
+ if (isSet(opts, IGNORE_CASE)) {
+ tok = tok.getCaseInsensitiveToken();
+ if (!tok.match(ch)) {
+ if (ch >= 0x10000) return -1;
+ char uch;
+ if (!tok.match(uch = Character.toUpperCase((char)ch))
+ && !tok.match(Character.toLowerCase(uch)))
+ return -1;
+ }
+ } else {
+ if (!tok.match(ch)) return -1;
+ }
+ offset = o1;
+ }
+ op = op.next;
+ break;
+
+ case Op.ANCHOR:
+ boolean go = false;
+ switch (op.getData()) {
+ case '^':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target .setIndex( offset-1 ) )))
+ return -1;
+ } else {
+ if (offset != con.start)
+ return -1;
+ }
+ break;
+
+ case '@': // Internal use only.
+ // The @ always matches line beginnings.
+ if (!(offset == con.start
+ || offset > con.start && isEOLChar( target .setIndex( offset-1 ) )))
+ return -1;
+ break;
+
+ case '$':
+ if (isSet(opts, MULTIPLE_LINES)) {
+ if (!(offset == con.limit
+ || offset < con.limit && isEOLChar( target .setIndex( offset ) )))
+ return -1;
+ } else {
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) )
+ || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN
+ && target .setIndex( offset+1 ) == LINE_FEED))
+ return -1;
+ }
+ break;
+
+ case 'A':
+ if (offset != con.start) return -1;
+ break;
+
+ case 'Z':
+ if (!(offset == con.limit
+ || offset+1 == con.limit && isEOLChar( target .setIndex( offset ) )
+ || offset+2 == con.limit && target .setIndex( offset ) == CARRIAGE_RETURN
+ && target .setIndex( offset+1 ) == LINE_FEED))
+ return -1;
+ break;
+
+ case 'z':
+ if (offset != con.limit) return -1;
+ break;
+
+ case 'b':
+ if (con.length == 0) return -1;
+ {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ if (after == WT_IGNORE) return -1;
+ int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
+ if (after == before) return -1;
+ }
+ break;
+
+ case 'B':
+ if (con.length == 0)
+ go = true;
+ else {
+ int after = getWordType(target, con.start, con.limit, offset, opts);
+ go = after == WT_IGNORE
+ || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
+ }
+ if (!go) return -1;
+ break;
+
+ case '<':
+ if (con.length == 0 || offset == con.limit) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER)
+ return -1;
+ break;
+
+ case '>':
+ if (con.length == 0 || offset == con.start) return -1;
+ if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER
+ || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER)
+ return -1;
+ break;
+ } // switch anchor type
+ op = op.next;
+ break;
+
+ case Op.BACKREFERENCE:
+ {
+ int refno = op.getData();
+ if (refno <= 0 || refno >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);
+ if (con.match.getBeginning(refno) < 0
+ || con.match.getEnd(refno) < 0)
+ return -1; // ********
+ int o2 = con.match.getBeginning(refno);
+ int literallen = con.match.getEnd(refno)-o2;
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ o2, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+ case Op.STRING:
+ {
+ String literal = op.getString();
+ int literallen = literal.length();
+ if (!isSet(opts, IGNORE_CASE)) {
+ if (dx > 0) {
+ if (!regionMatches(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatches(target, offset-literallen, con.limit, literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ } else {
+ if (dx > 0) {
+ if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen))
+ return -1;
+ offset += literallen;
+ } else {
+ if (!regionMatchesIgnoreCase(target, offset-literallen, con.limit,
+ literal, literallen))
+ return -1;
+ offset -= literallen;
+ }
+ }
+ }
+ op = op.next;
+ break;
+
+ case Op.CLOSURE:
+ {
+ /*
+ * Saves current position to avoid
+ * zero-width repeats.
+ */
+ int id = op.getData();
+ if (id >= 0) {
+ int previousOffset = con.offsets[id];
+ if (previousOffset < 0 || previousOffset != offset) {
+ con.offsets[id] = offset;
+ } else {
+ con.offsets[id] = -1;
+ op = op.next;
+ break;
+ }
+ }
+
+ int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);
+ if (id >= 0) con.offsets[id] = -1;
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.QUESTION:
+ {
+ int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.NONGREEDYCLOSURE:
+ case Op.NONGREEDYQUESTION:
+ {
+ int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);
+ if (ret >= 0) return ret;
+ op = op.getChild();
+ }
+ break;
+
+ case Op.UNION:
+ for (int i = 0; i < op.size(); i ++) {
+ int ret = this. matchCharacterIterator (con, op.elementAt(i), offset, dx, opts);
+ if (DEBUG) {
+ System.err.println("UNION: "+i+", ret="+ret);
+ }
+ if (ret >= 0) return ret;
+ }
+ return -1;
+
+ case Op.CAPTURE:
+ int refno = op.getData();
+ if (con.match != null && refno > 0) {
+ int save = con.match.getBeginning(refno);
+ con.match.setBeginning(refno, offset);
+ int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setBeginning(refno, save);
+ return ret;
+ } else if (con.match != null && refno < 0) {
+ int index = -refno;
+ int save = con.match.getEnd(index);
+ con.match.setEnd(index, offset);
+ int ret = this. matchCharacterIterator (con, op.next, offset, dx, opts);
+ if (ret < 0) con.match.setEnd(index, save);
+ return ret;
+ }
+ op = op.next;
+ break;
+
+ case Op.LOOKAHEAD:
+ if (0 > this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKAHEAD:
+ if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, 1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.LOOKBEHIND:
+ if (0 > this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+ case Op.NEGATIVELOOKBEHIND:
+ if (0 <= this. matchCharacterIterator (con, op.getChild(), offset, -1, opts)) return -1;
+ op = op.next;
+ break;
+
+ case Op.INDEPENDENT:
+ {
+ int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, opts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.MODIFIER:
+ {
+ int localopts = opts;
+ localopts |= op.getData();
+ localopts &= ~op.getData2();
+ //System.err.println("MODIFIER: "+Integer.toString(opts, 16)+" -> "+Integer.toString(localopts, 16));
+ int ret = this. matchCharacterIterator (con, op.getChild(), offset, dx, localopts);
+ if (ret < 0) return ret;
+ offset = ret;
+ op = op.next;
+ }
+ break;
+
+ case Op.CONDITION:
+ {
+ Op.ConditionOp cop = (Op.ConditionOp)op;
+ boolean matchp = false;
+ if (cop.refNumber > 0) {
+ if (cop.refNumber >= this.nofparen)
+ throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
+ matchp = con.match.getBeginning(cop.refNumber) >= 0
+ && con.match.getEnd(cop.refNumber) >= 0;
+ } else {
+ matchp = 0 <= this. matchCharacterIterator (con, cop.condition, offset, dx, opts);
+ }
+
+ if (matchp) {
+ op = cop.yes;
+ } else if (cop.no != null) {
+ op = cop.no;
+ } else {
+ op = cop.next;
+ }
+ }
+ break;
+
+ default:
+ throw new RuntimeException("Unknown operation type: "+op.type);
+ } // switch (op.type)
+ } // while
+ }
+
+ private static final int getPreviousWordType(CharacterIterator target, int begin, int end,
+ int offset, int opts) {
+ int ret = getWordType(target, begin, end, --offset, opts);
+ while (ret == WT_IGNORE)
+ ret = getWordType(target, begin, end, --offset, opts);
+ return ret;
+ }
+
+ private static final int getWordType(CharacterIterator target, int begin, int end,
+ int offset, int opts) {
+ if (offset < begin || offset >= end) return WT_OTHER;
+ return getWordType0( target .setIndex( offset ) , opts);
+ }
+
+
+
+ private static final boolean regionMatches(CharacterIterator target, int offset, int limit,
+ String part, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = 0;
+ while (partlen-- > 0) {
+ if ( target .setIndex( offset++ ) != part.charAt(i++))
+ return false;
+ }
+ return true;
+ }
+
+ private static final boolean regionMatches(CharacterIterator target, int offset, int limit,
+ int offset2, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = offset2;
+ while (partlen-- > 0) {
+ if ( target .setIndex( offset++ ) != target .setIndex( i++ ) )
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see java.lang.String#regionMatches
+ */
+ private static final boolean regionMatchesIgnoreCase(CharacterIterator target, int offset, int limit,
+ String part, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = 0;
+ while (partlen-- > 0) {
+ char ch1 = target .setIndex( offset++ ) ;
+ char ch2 = part.charAt(i++);
+ if (ch1 == ch2)
+ continue;
+ char uch1 = Character.toUpperCase(ch1);
+ char uch2 = Character.toUpperCase(ch2);
+ if (uch1 == uch2)
+ continue;
+ if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
+ return false;
+ }
+ return true;
+ }
+
+ private static final boolean regionMatchesIgnoreCase(CharacterIterator target, int offset, int limit,
+ int offset2, int partlen) {
+ if (offset < 0) return false;
+ if (limit-offset < partlen)
+ return false;
+ int i = offset2;
+ while (partlen-- > 0) {
+ char ch1 = target .setIndex( offset++ ) ;
+ char ch2 = target .setIndex( i++ ) ;
+ if (ch1 == ch2)
+ continue;
+ char uch1 = Character.toUpperCase(ch1);
+ char uch2 = Character.toUpperCase(ch2);
+ if (uch1 == uch2)
+ continue;
+ if (Character.toLowerCase(uch1) != Character.toLowerCase(uch2))
+ return false;
+ }
+ return true;
+ }
+
+
+
+
+ // ================================================================
+
+ /**
+ * A regular expression.
+ * @serial
+ */
+ String regex;
+ /**
+ * @serial
+ */
+ int options;
+
+ /**
+ * The number of parenthesis in the regular expression.
+ * @serial
+ */
+ int nofparen;
+ /**
+ * Internal representation of the regular expression.
+ * @serial
+ */
+ Token tokentree;
+
+ boolean hasBackReferences = false;
+
+ transient int minlength;
+ transient Op operations = null;
+ transient int numberOfClosures;
+ transient Context context = null;
+ transient RangeToken firstChar = null;
+
+ transient String fixedString = null;
+ transient int fixedStringOptions;
+ transient BMPattern fixedStringTable = null;
+ transient boolean fixedStringOnly = false;
+
+
+ static final class Context {
+ CharacterIterator ciTarget;
+ String strTarget;
+ char[] charTarget;
+ int start;
+ int limit;
+ int length;
+ Match match;
+ boolean inuse = false;
+ int[] offsets;
+
+ Context() {
+ }
+
+ private void resetCommon(int nofclosures) {
+ this.length = this.limit-this.start;
+ this.inuse = true;
+ this.match = null;
+ if (this.offsets == null || this.offsets.length != nofclosures)
+ this.offsets = new int[nofclosures];
+ for (int i = 0; i < nofclosures; i ++) this.offsets[i] = -1;
+ }
+ void reset(CharacterIterator target, int start, int limit, int nofclosures) {
+ this.ciTarget = target;
+ this.start = start;
+ this.limit = limit;
+ this.resetCommon(nofclosures);
+ }
+ void reset(String target, int start, int limit, int nofclosures) {
+ this.strTarget = target;
+ this.start = start;
+ this.limit = limit;
+ this.resetCommon(nofclosures);
+ }
+ void reset(char[] target, int start, int limit, int nofclosures) {
+ this.charTarget = target;
+ this.start = start;
+ this.limit = limit;
+ this.resetCommon(nofclosures);
+ }
+ }
+
+ /**
+ * Prepares for matching. This method is called just before starting matching.
+ */
+ void prepare() {
+ if (Op.COUNT) Op.nofinstances = 0;
+ this.compile(this.tokentree);
+ /*
+ if (this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) { // .*
+ Op anchor = Op.createAnchor(isSet(this.options, SINGLE_LINE) ? 'A' : '@');
+ anchor.next = this.operations;
+ this.operations = anchor;
+ }
+ */
+ if (Op.COUNT) System.err.println("DEBUG: The number of operations: "+Op.nofinstances);
+
+ this.minlength = this.tokentree.getMinLength();
+
+ this.firstChar = null;
+ if (!isSet(this.options, PROHIBIT_HEAD_CHARACTER_OPTIMIZATION)
+ && !isSet(this.options, XMLSCHEMA_MODE)) {
+ RangeToken firstChar = Token.createRange();
+ int fresult = this.tokentree.analyzeFirstCharacter(firstChar, this.options);
+ if (fresult == Token.FC_TERMINAL) {
+ firstChar.compactRanges();
+ this.firstChar = firstChar;
+ if (DEBUG)
+ System.err.println("DEBUG: Use the first character optimization: "+firstChar);
+ }
+ }
+
+ if (this.operations != null
+ && (this.operations.type == Op.STRING || this.operations.type == Op.CHAR)
+ && this.operations.next == null) {
+ if (DEBUG)
+ System.err.print(" *** Only fixed string! *** ");
+ this.fixedStringOnly = true;
+ if (this.operations.type == Op.STRING)
+ this.fixedString = this.operations.getString();
+ else if (this.operations.getData() >= 0x10000) { // Op.CHAR
+ this.fixedString = REUtil.decomposeToSurrogates(this.operations.getData());
+ } else {
+ char[] ac = new char[1];
+ ac[0] = (char)this.operations.getData();
+ this.fixedString = new String(ac);
+ }
+ this.fixedStringOptions = this.options;
+ this.fixedStringTable = new BMPattern(this.fixedString, 256,
+ isSet(this.fixedStringOptions, IGNORE_CASE));
+ } else if (!isSet(this.options, PROHIBIT_FIXED_STRING_OPTIMIZATION)
+ && !isSet(this.options, XMLSCHEMA_MODE)) {
+ Token.FixedStringContainer container = new Token.FixedStringContainer();
+ this.tokentree.findFixedString(container, this.options);
+ this.fixedString = container.token == null ? null : container.token.getString();
+ this.fixedStringOptions = container.options;
+ if (this.fixedString != null && this.fixedString.length() < 2)
+ this.fixedString = null;
+ // This pattern has a fixed string of which length is more than one.
+ if (this.fixedString != null) {
+ this.fixedStringTable = new BMPattern(this.fixedString, 256,
+ isSet(this.fixedStringOptions, IGNORE_CASE));
+ if (DEBUG) {
+ System.err.println("DEBUG: The longest fixed string: "+this.fixedString.length()
+ +"/" //+this.fixedString
+ +"/"+REUtil.createOptionString(this.fixedStringOptions));
+ System.err.print("String: ");
+ REUtil.dumpString(this.fixedString);
+ }
+ }
+ }
+ }
+
+ /**
+ * An option.
+ * If you specify this option, <span class="REGEX"><kbd>(</kbd><var>X</var><kbd>)</kbd></span>
+ * captures matched text, and <span class="REGEX"><kbd>(:?</kbd><var>X</var><kbd>)</kbd></span>
+ * does not capture.
+ *
+ * @see #RegularExpression(java.lang.String,int)
+ * @see #setPattern(java.lang.String,int)
+ static final int MARK_PARENS = 1<<0;
+ */
+
+ /**
+ * "i"
+ */
+ static final int IGNORE_CASE = 1<<1;
+
+ /**
+ * "s"
+ */
+ static final int SINGLE_LINE = 1<<2;
+
+ /**
+ * "m"
+ */
+ static final int MULTIPLE_LINES = 1<<3;
+
+ /**
+ * "x"
+ */
+ static final int EXTENDED_COMMENT = 1<<4;
+
+ /**
+ * This option redefines <span class="REGEX"><kbd>\d \D \w \W \s \S</kbd></span>.
+ *
+ * @see #RegularExpression(java.lang.String,int)
+ * @see #setPattern(java.lang.String,int)
+ * @see #UNICODE_WORD_BOUNDARY
+ */
+ static final int USE_UNICODE_CATEGORY = 1<<5; // "u"
+
+ /**
+ * An option.
+ * This enables to process locale-independent word boundary for <span class="REGEX"><kbd>\b \B \< \></kbd></span>.
+ * <p>By default, the engine considers a position between a word character
+ * (<span class="REGEX"><Kbd>\w</kbd></span>) and a non word character
+ * is a word boundary.
+ * <p>By this option, the engine checks word boundaries with the method of
+ * 'Unicode Regular Expression Guidelines' Revision 4.
+ *
+ * @see #RegularExpression(java.lang.String,int)
+ * @see #setPattern(java.lang.String,int)
+ */
+ static final int UNICODE_WORD_BOUNDARY = 1<<6; // "w"
+
+ /**
+ * "H"
+ */
+ static final int PROHIBIT_HEAD_CHARACTER_OPTIMIZATION = 1<<7;
+ /**
+ * "F"
+ */
+ static final int PROHIBIT_FIXED_STRING_OPTIMIZATION = 1<<8;
+ /**
+ * "X". XML Schema mode.
+ */
+ static final int XMLSCHEMA_MODE = 1<<9;
+ /**
+ * ",".
+ */
+ static final int SPECIAL_COMMA = 1<<10;
+
+
+ private static final boolean isSet(int options, int flag) {
+ return (options & flag) == flag;
+ }
+
+ /**
+ * Creates a new RegularExpression instance.
+ *
+ * @param regex A regular expression
+ * @exception org.apache.xerces.utils.regex.ParseException <VAR>regex</VAR> is not conforming to the syntax.
+ */
+ public RegularExpression(String regex) throws ParseException {
+ this.setPattern(regex, null);
+ }
+
+ /**
+ * Creates a new RegularExpression instance with options.
+ *
+ * @param regex A regular expression
+ * @param options A String consisted of "i" "m" "s" "u" "w" "," "X"
+ * @exception org.apache.xerces.utils.regex.ParseException <VAR>regex</VAR> is not conforming to the syntax.
+ */
+ public RegularExpression(String regex, String options) throws ParseException {
+ this.setPattern(regex, options);
+ }
+
+ RegularExpression(String regex, Token tok, int parens, boolean hasBackReferences, int options) {
+ this.regex = regex;
+ this.tokentree = tok;
+ this.nofparen = parens;
+ this.options = options;
+ this.hasBackReferences = hasBackReferences;
+ }
+
+ /**
+ *
+ */
+ public void setPattern(String newPattern) throws ParseException {
+ this.setPattern(newPattern, this.options);
+ }
+
+ private void setPattern(String newPattern, int options) throws ParseException {
+ this.regex = newPattern;
+ this.options = options;
+ RegexParser rp = this.isSet(this.options, RegularExpression.XMLSCHEMA_MODE)
+ ? new ParserForXMLSchema() : new RegexParser();
+ this.tokentree = rp.parse(this.regex, this.options);
+ this.nofparen = rp.parennumber;
+ this.hasBackReferences = rp.hasBackReferences;
+
+ this.operations = null;
+ this.context = null;
+ }
+ /**
+ *
+ */
+ public void setPattern(String newPattern, String options) throws ParseException {
+ this.setPattern(newPattern, REUtil.parseOptions(options));
+ }
+
+ /**
+ *
+ */
+ public String getPattern() {
+ return this.regex;
+ }
+
+ /**
+ * Represents this instence in String.
+ */
+ public String toString() {
+ return this.tokentree.toString(this.options);
+ }
+
+ /**
+ * Returns a option string.
+ * The order of letters in it may be different from a string specified
+ * in a constructor or <code>setPattern()</code>.
+ *
+ * @see #RegularExpression(java.lang.String,java.lang.String)
+ * @see #setPattern(java.lang.String,java.lang.String)
+ */
+ public String getOptions() {
+ return REUtil.createOptionString(this.options);
+ }
+
+ /**
+ * Return true if patterns are the same and the options are equivalent.
+ */
+ public boolean equals(Object obj) {
+ if (obj == null) return false;
+ if (!(obj instanceof RegularExpression))
+ return false;
+ RegularExpression r = (RegularExpression)obj;
+ return this.regex.equals(r.regex) && this.options == r.options;
+ }
+
+ boolean equals(String pattern, int options) {
+ return this.regex.equals(pattern) && this.options == options;
+ }
+
+ /**
+ *
+ */
+ public int hashCode() {
+ return (this.regex+"/"+this.getOptions()).hashCode();
+ }
+
+ /**
+ * Return the number of regular expression groups.
+ * This method returns 1 when the regular expression has no capturing-parenthesis.
+ *
+ */
+ public int getNumberOfGroups() {
+ return this.nofparen;
+ }
+
+ // ================================================================
+
+ private static final int WT_IGNORE = 0;
+ private static final int WT_LETTER = 1;
+ private static final int WT_OTHER = 2;
+ private static final int getWordType0(char ch, int opts) {
+ if (!isSet(opts, UNICODE_WORD_BOUNDARY)) {
+ if (isSet(opts, USE_UNICODE_CATEGORY)) {
+ return (Token.getRange("IsWord", true).match(ch)) ? WT_LETTER : WT_OTHER;
+ }
+ return isWordChar(ch) ? WT_LETTER : WT_OTHER;
+ }
+
+ switch (Character.getType(ch)) {
+ case Character.UPPERCASE_LETTER: // L
+ case Character.LOWERCASE_LETTER: // L
+ case Character.TITLECASE_LETTER: // L
+ case Character.MODIFIER_LETTER: // L
+ case Character.OTHER_LETTER: // L
+ case Character.LETTER_NUMBER: // N
+ case Character.DECIMAL_DIGIT_NUMBER: // N
+ case Character.OTHER_NUMBER: // N
+ case Character.COMBINING_SPACING_MARK: // Mc
+ return WT_LETTER;
+
+ case Character.FORMAT: // Cf
+ case Character.NON_SPACING_MARK: // Mn
+ case Character.ENCLOSING_MARK: // Mc
+ return WT_IGNORE;
+
+ case Character.CONTROL: // Cc
+ switch (ch) {
+ case '\t':
+ case '\n':
+ case '\u000B':
+ case '\f':
+ case '\r':
+ return WT_OTHER;
+ default:
+ return WT_IGNORE;
+ }
+
+ default:
+ return WT_OTHER;
+ }
+ }
+
+ // ================================================================
+
+ static final int LINE_FEED = 0x000A;
+ static final int CARRIAGE_RETURN = 0x000D;
+ static final int LINE_SEPARATOR = 0x2028;
+ static final int PARAGRAPH_SEPARATOR = 0x2029;
+
+ private static final boolean isEOLChar(int ch) {
+ return ch == LINE_FEED || ch == CARRIAGE_RETURN || ch == LINE_SEPARATOR
+ || ch == PARAGRAPH_SEPARATOR;
+ }
+
+ private static final boolean isWordChar(int ch) { // Legacy word characters
+ if (ch == '_') return true;
+ if (ch < '0') return false;
+ if (ch > 'z') return false;
+ if (ch <= '9') return true;
+ if (ch < 'A') return false;
+ if (ch <= 'Z') return true;
+ if (ch < 'a') return false;
+ return true;
+ }
+
+ private static final boolean matchIgnoreCase(int chardata, int ch) {
+ if (chardata == ch) return true;
+ if (chardata > 0xffff || ch > 0xffff) return false;
+ char uch1 = Character.toUpperCase((char)chardata);
+ char uch2 = Character.toUpperCase((char)ch);
+ if (uch1 == uch2) return true;
+ return Character.toLowerCase(uch1) == Character.toLowerCase(uch2);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/SchemaRegularExpression.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/SchemaRegularExpression.java
new file mode 100644
index 0000000..7aa1557
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/SchemaRegularExpression.java
@@ -0,0 +1,51 @@
+/* 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.xmlbeans.impl.regex;
+
+import org.apache.xmlbeans.impl.common.XMLChar;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SchemaRegularExpression extends RegularExpression
+{
+ private SchemaRegularExpression(String pattern)
+ {
+ super(pattern, "X");
+ }
+
+ public static RegularExpression forPattern(String s)
+ {
+ SchemaRegularExpression tre = (SchemaRegularExpression)knownPatterns.get(s);
+ if (tre != null)
+ return tre;
+ return new RegularExpression(s, "X");
+ }
+
+ static final Map knownPatterns = buildKnownPatternMap();
+
+ private static Map buildKnownPatternMap()
+ {
+ Map result = new HashMap();
+ result.put("\\c+", new SchemaRegularExpression("\\c+")
+ { public boolean matches(String s) { return XMLChar.isValidNmtoken(s); } } );
+ result.put("\\i\\c*", new SchemaRegularExpression("\\i\\c*")
+ { public boolean matches(String s) { return XMLChar.isValidName(s); } } );
+ result.put("[\\i-[:]][\\c-[:]]*", new SchemaRegularExpression("[\\i-[:]][\\c-[:]]*")
+ { public boolean matches(String s) { return XMLChar.isValidNCName(s); } } );
+ return result;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java
new file mode 100644
index 0000000..5113590
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java
@@ -0,0 +1,1521 @@
+/* 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.xmlbeans.impl.regex;
+
+import java.util.Vector;
+import java.util.Hashtable;
+
+/**
+ * This class represents a node in parse tree.
+ */
+class Token implements java.io.Serializable {
+ static final boolean COUNTTOKENS = true;
+ static int tokens = 0;
+
+ static final int CHAR = 0; // Literal char
+ static final int DOT = 11; // .
+ static final int CONCAT = 1; // XY
+ static final int UNION = 2; // X|Y|Z
+ static final int CLOSURE = 3; // X*
+ static final int RANGE = 4; // [a-zA-Z] etc.
+ static final int NRANGE = 5; // [^a-zA-Z] etc.
+ static final int PAREN = 6; // (X) or (?:X)
+ static final int EMPTY = 7; //
+ static final int ANCHOR = 8; // ^ $ \b \B \< \> \A \Z \z
+ static final int NONGREEDYCLOSURE = 9; // *? +?
+ static final int STRING = 10; // strings
+ static final int BACKREFERENCE = 12; // back references
+ static final int LOOKAHEAD = 20; // (?=...)
+ static final int NEGATIVELOOKAHEAD = 21; // (?!...)
+ static final int LOOKBEHIND = 22; // (?<=...)
+ static final int NEGATIVELOOKBEHIND = 23; // (?<!...)
+ static final int INDEPENDENT = 24; // (?>...)
+ static final int MODIFIERGROUP = 25; // (?ims-ims:...)
+ static final int CONDITION = 26; // (?(...)yes|no)
+
+ static final int UTF16_MAX = 0x10ffff;
+
+ int type;
+
+ static Token token_dot;
+ static Token token_0to9;
+ static Token token_wordchars;
+ static Token token_not_0to9;
+ static Token token_not_wordchars;
+ static Token token_spaces;
+ static Token token_not_spaces;
+ static Token token_empty;
+ static Token token_linebeginning;
+ static Token token_linebeginning2;
+ static Token token_lineend;
+ static Token token_stringbeginning;
+ static Token token_stringend;
+ static Token token_stringend2;
+ static Token token_wordedge;
+ static Token token_not_wordedge;
+ static Token token_wordbeginning;
+ static Token token_wordend;
+ static {
+ Token.token_empty = new Token(Token.EMPTY);
+
+ Token.token_linebeginning = Token.createAnchor('^');
+ Token.token_linebeginning2 = Token.createAnchor('@');
+ Token.token_lineend = Token.createAnchor('$');
+ Token.token_stringbeginning = Token.createAnchor('A');
+ Token.token_stringend = Token.createAnchor('z');
+ Token.token_stringend2 = Token.createAnchor('Z');
+ Token.token_wordedge = Token.createAnchor('b');
+ Token.token_not_wordedge = Token.createAnchor('B');
+ Token.token_wordbeginning = Token.createAnchor('<');
+ Token.token_wordend = Token.createAnchor('>');
+
+ Token.token_dot = new Token(Token.DOT);
+
+ Token.token_0to9 = Token.createRange();
+ Token.token_0to9.addRange('0', '9');
+ Token.token_wordchars = Token.createRange();
+ Token.token_wordchars.addRange('0', '9');
+ Token.token_wordchars.addRange('A', 'Z');
+ Token.token_wordchars.addRange('_', '_');
+ Token.token_wordchars.addRange('a', 'z');
+ Token.token_spaces = Token.createRange();
+ Token.token_spaces.addRange('\t', '\t');
+ Token.token_spaces.addRange('\n', '\n');
+ Token.token_spaces.addRange('\f', '\f');
+ Token.token_spaces.addRange('\r', '\r');
+ Token.token_spaces.addRange(' ', ' ');
+
+ Token.token_not_0to9 = Token.complementRanges(Token.token_0to9);
+ Token.token_not_wordchars = Token.complementRanges(Token.token_wordchars);
+ Token.token_not_spaces = Token.complementRanges(Token.token_spaces);
+ }
+
+ static Token.ParenToken createLook(int type, Token child) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ParenToken(type, child, 0);
+ }
+ static Token.ParenToken createParen(Token child, int pnumber) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ParenToken(Token.PAREN, child, pnumber);
+ }
+ static Token.ClosureToken createClosure(Token tok) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ClosureToken(Token.CLOSURE, tok);
+ }
+ static Token.ClosureToken createNGClosure(Token tok) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ClosureToken(Token.NONGREEDYCLOSURE, tok);
+ }
+ static Token.ConcatToken createConcat(Token tok1, Token tok2) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ConcatToken(tok1, tok2);
+ }
+ static Token.UnionToken createConcat() {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.UnionToken(Token.CONCAT); // *** It is not a bug.
+ }
+ static Token.UnionToken createUnion() {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.UnionToken(Token.UNION);
+ }
+ static Token createEmpty() {
+ return Token.token_empty;
+ }
+ static RangeToken createRange() {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new RangeToken(Token.RANGE);
+ }
+ static RangeToken createNRange() {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new RangeToken(Token.NRANGE);
+ }
+ static Token.CharToken createChar(int ch) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.CharToken(Token.CHAR, ch);
+ }
+ static private Token.CharToken createAnchor(int ch) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.CharToken(Token.ANCHOR, ch);
+ }
+ static Token.StringToken createBackReference(int refno) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.StringToken(Token.BACKREFERENCE, null, refno);
+ }
+ static Token.StringToken createString(String str) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.StringToken(Token.STRING, str, 0);
+ }
+ static Token.ModifierToken createModifierGroup(Token child, int add, int mask) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ModifierToken(child, add, mask);
+ }
+ static Token.ConditionToken createCondition(int refno, Token condition,
+ Token yespat, Token nopat) {
+ if (COUNTTOKENS) Token.tokens ++;
+ return new Token.ConditionToken(refno, condition, yespat, nopat);
+ }
+
+ protected Token(int type) {
+ this.type = type;
+ }
+
+ /**
+ * A number of children.
+ */
+ int size() {
+ return 0;
+ }
+ Token getChild(int index) {
+ return null;
+ }
+ void addChild(Token tok) {
+ throw new RuntimeException("Not supported.");
+ }
+
+ // for RANGE or NRANGE
+ protected void addRange(int start, int end) {
+ throw new RuntimeException("Not supported.");
+ }
+ protected void sortRanges() {
+ throw new RuntimeException("Not supported.");
+ }
+ protected void compactRanges() {
+ throw new RuntimeException("Not supported.");
+ }
+ protected void mergeRanges(Token tok) {
+ throw new RuntimeException("Not supported.");
+ }
+ protected void subtractRanges(Token tok) {
+ throw new RuntimeException("Not supported.");
+ }
+ protected void intersectRanges(Token tok) {
+ throw new RuntimeException("Not supported.");
+ }
+ static Token complementRanges(Token tok) {
+ return RangeToken.complementRanges(tok);
+ }
+
+
+ void setMin(int min) { // for CLOSURE
+ }
+ void setMax(int max) { // for CLOSURE
+ }
+ int getMin() { // for CLOSURE
+ return -1;
+ }
+ int getMax() { // for CLOSURE
+ return -1;
+ }
+ int getReferenceNumber() { // for STRING
+ return 0;
+ }
+ String getString() { // for STRING
+ return null;
+ }
+
+ int getParenNumber() {
+ return 0;
+ }
+ int getChar() {
+ return -1;
+ }
+
+ public String toString() {
+ return this.toString(0);
+ }
+ public String toString(int options) {
+ return this.type == Token.DOT ? "." : "";
+ }
+
+ /**
+ * How many characters are needed?
+ */
+ final int getMinLength() {
+ switch (this.type) {
+ case CONCAT:
+ int sum = 0;
+ for (int i = 0; i < this.size(); i ++)
+ sum += this.getChild(i).getMinLength();
+ return sum;
+
+ case CONDITION:
+ case UNION:
+ if (this.size() == 0)
+ return 0;
+ int ret = this.getChild(0).getMinLength();
+ for (int i = 1; i < this.size(); i ++) {
+ int min = this.getChild(i).getMinLength();
+ if (min < ret) ret = min;
+ }
+ return ret;
+
+ case CLOSURE:
+ case NONGREEDYCLOSURE:
+ if (this.getMin() >= 0)
+ return this.getMin() * this.getChild(0).getMinLength();
+ return 0;
+
+ case EMPTY:
+ case ANCHOR:
+ return 0;
+
+ case DOT:
+ case CHAR:
+ case RANGE:
+ case NRANGE:
+ return 1;
+
+ case INDEPENDENT:
+ case PAREN:
+ case MODIFIERGROUP:
+ return this.getChild(0).getMinLength();
+
+ case BACKREFERENCE:
+ return 0; // *******
+
+ case STRING:
+ return this.getString().length();
+
+ case LOOKAHEAD:
+ case NEGATIVELOOKAHEAD:
+ case LOOKBEHIND:
+ case NEGATIVELOOKBEHIND:
+ return 0; // ***** Really?
+
+ default:
+ throw new RuntimeException("Token#getMinLength(): Invalid Type: "+this.type);
+ }
+ }
+
+ final int getMaxLength() {
+ switch (this.type) {
+ case CONCAT:
+ int sum = 0;
+ for (int i = 0; i < this.size(); i ++) {
+ int d = this.getChild(i).getMaxLength();
+ if (d < 0) return -1;
+ sum += d;
+ }
+ return sum;
+
+ case CONDITION:
+ case UNION:
+ if (this.size() == 0)
+ return 0;
+ int ret = this.getChild(0).getMaxLength();
+ for (int i = 1; ret >= 0 && i < this.size(); i ++) {
+ int max = this.getChild(i).getMaxLength();
+ if (max < 0) { // infinity
+ ret = -1;
+ break;
+ }
+ if (max > ret) ret = max;
+ }
+ return ret;
+
+ case CLOSURE:
+ case NONGREEDYCLOSURE:
+ if (this.getMax() >= 0)
+ // When this.child.getMaxLength() < 0,
+ // this returns minus value
+ return this.getMax() * this.getChild(0).getMaxLength();
+ return -1;
+
+ case EMPTY:
+ case ANCHOR:
+ return 0;
+
+ case CHAR:
+ return 1;
+ case DOT:
+ case RANGE:
+ case NRANGE:
+ return 2;
+
+ case INDEPENDENT:
+ case PAREN:
+ case MODIFIERGROUP:
+ return this.getChild(0).getMaxLength();
+
+ case BACKREFERENCE:
+ return -1; // ******
+
+ case STRING:
+ return this.getString().length();
+
+ case LOOKAHEAD:
+ case NEGATIVELOOKAHEAD:
+ case LOOKBEHIND:
+ case NEGATIVELOOKBEHIND:
+ return 0; // ***** Really?
+
+ default:
+ throw new RuntimeException("Token#getMaxLength(): Invalid Type: "+this.type);
+ }
+ }
+
+ static final int FC_CONTINUE = 0;
+ static final int FC_TERMINAL = 1;
+ static final int FC_ANY = 2;
+ private static final boolean isSet(int options, int flag) {
+ return (options & flag) == flag;
+ }
+ final int analyzeFirstCharacter(RangeToken result, int options) {
+ switch (this.type) {
+ case CONCAT:
+ int ret = FC_CONTINUE;
+ for (int i = 0; i < this.size(); i ++)
+ if ((ret = this.getChild(i).analyzeFirstCharacter(result, options)) != FC_CONTINUE)
+ break;
+ return ret;
+
+ case UNION:
+ if (this.size() == 0)
+ return FC_CONTINUE;
+ /*
+ * a|b|c -> FC_TERMINAL
+ * a|.|c -> FC_ANY
+ * a|b| -> FC_CONTINUE
+ */
+ int ret2 = FC_CONTINUE;
+ boolean hasEmpty = false;
+ for (int i = 0; i < this.size(); i ++) {
+ ret2 = this.getChild(i).analyzeFirstCharacter(result, options);
+ if (ret2 == FC_ANY)
+ break;
+ else if (ret2 == FC_CONTINUE)
+ hasEmpty = true;
+ }
+ return hasEmpty ? FC_CONTINUE : ret2;
+
+ case CONDITION:
+ int ret3 = this.getChild(0).analyzeFirstCharacter(result, options);
+ if (this.size() == 1) return FC_CONTINUE;
+ if (ret3 == FC_ANY) return ret3;
+ int ret4 = this.getChild(1).analyzeFirstCharacter(result, options);
+ if (ret4 == FC_ANY) return ret4;
+ return ret3 == FC_CONTINUE || ret4 == FC_CONTINUE ? FC_CONTINUE : FC_TERMINAL;
+
+ case CLOSURE:
+ case NONGREEDYCLOSURE:
+ this.getChild(0).analyzeFirstCharacter(result, options);
+ return FC_CONTINUE;
+
+ case EMPTY:
+ case ANCHOR:
+ return FC_CONTINUE;
+
+ case CHAR:
+ int ch = this.getChar();
+ result.addRange(ch, ch);
+ if (ch < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) {
+ ch = Character.toUpperCase((char)ch);
+ result.addRange(ch, ch);
+ ch = Character.toLowerCase((char)ch);
+ result.addRange(ch, ch);
+ }
+ return FC_TERMINAL;
+
+ case DOT: // ****
+ if (isSet(options, RegularExpression.SINGLE_LINE)) {
+ return FC_CONTINUE; // **** We can not optimize.
+ } else {
+ return FC_CONTINUE;
+ /*
+ result.addRange(0, RegularExpression.LINE_FEED-1);
+ result.addRange(RegularExpression.LINE_FEED+1, RegularExpression.CARRIAGE_RETURN-1);
+ result.addRange(RegularExpression.CARRIAGE_RETURN+1,
+ RegularExpression.LINE_SEPARATOR-1);
+ result.addRange(RegularExpression.PARAGRAPH_SEPARATOR+1, UTF16_MAX);
+ return 1;
+ */
+ }
+
+ case RANGE:
+ if (isSet(options, RegularExpression.IGNORE_CASE)) {
+ result.mergeRanges(((RangeToken)this).getCaseInsensitiveToken());
+ } else {
+ result.mergeRanges(this);
+ }
+ return FC_TERMINAL;
+
+ case NRANGE: // ****
+ if (isSet(options, RegularExpression.IGNORE_CASE)) {
+ result.mergeRanges(Token.complementRanges(((RangeToken)this).getCaseInsensitiveToken()));
+ } else {
+ result.mergeRanges(Token.complementRanges(this));
+ }
+ return FC_TERMINAL;
+
+ case INDEPENDENT:
+ case PAREN:
+ return this.getChild(0).analyzeFirstCharacter(result, options);
+
+ case MODIFIERGROUP:
+ options |= ((ModifierToken)this).getOptions();
+ options &= ~((ModifierToken)this).getOptionsMask();
+ return this.getChild(0).analyzeFirstCharacter(result, options);
+
+ case BACKREFERENCE:
+ result.addRange(0, UTF16_MAX); // **** We can not optimize.
+ return FC_ANY;
+
+ case STRING:
+ int cha = this.getString().charAt(0);
+ int ch2;
+ if (REUtil.isHighSurrogate(cha)
+ && this.getString().length() >= 2
+ && REUtil.isLowSurrogate((ch2 = this.getString().charAt(1))))
+ cha = REUtil.composeFromSurrogates(cha, ch2);
+ result.addRange(cha, cha);
+ if (cha < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) {
+ cha = Character.toUpperCase((char)cha);
+ result.addRange(cha, cha);
+ cha = Character.toLowerCase((char)cha);
+ result.addRange(cha, cha);
+ }
+ return FC_TERMINAL;
+
+ case LOOKAHEAD:
+ case NEGATIVELOOKAHEAD:
+ case LOOKBEHIND:
+ case NEGATIVELOOKBEHIND:
+ return FC_CONTINUE;
+
+ default:
+ throw new RuntimeException("Token#analyzeHeadCharacter(): Invalid Type: "+this.type);
+ }
+ }
+
+ private final boolean isShorterThan(Token tok) {
+ if (tok == null) return false;
+ /*
+ int mylength;
+ if (this.type == STRING) mylength = this.getString().length();
+ else if (this.type == CHAR) mylength = this.getChar() >= 0x10000 ? 2 : 1;
+ else throw new RuntimeException("Internal Error: Illegal type: "+this.type);
+ int otherlength;
+ if (tok.type == STRING) otherlength = tok.getString().length();
+ else if (tok.type == CHAR) otherlength = tok.getChar() >= 0x10000 ? 2 : 1;
+ else throw new RuntimeException("Internal Error: Illegal type: "+tok.type);
+ */
+ int mylength;
+ if (this.type == STRING) mylength = this.getString().length();
+ else throw new RuntimeException("Internal Error: Illegal type: "+this.type);
+ int otherlength;
+ if (tok.type == STRING) otherlength = tok.getString().length();
+ else throw new RuntimeException("Internal Error: Illegal type: "+tok.type);
+ return mylength < otherlength;
+ }
+
+ static class FixedStringContainer {
+ Token token = null;
+ int options = 0;
+ FixedStringContainer() {
+ }
+ }
+
+ final void findFixedString(FixedStringContainer container, int options) {
+ switch (this.type) {
+ case CONCAT:
+ Token prevToken = null;
+ int prevOptions = 0;
+ for (int i = 0; i < this.size(); i ++) {
+ this.getChild(i).findFixedString(container, options);
+ if (prevToken == null || prevToken.isShorterThan(container.token)) {
+ prevToken = container.token;
+ prevOptions = container.options;
+ }
+ }
+ container.token = prevToken;
+ container.options = prevOptions;
+ return;
+
+ case UNION:
+ case CLOSURE:
+ case NONGREEDYCLOSURE:
+ case EMPTY:
+ case ANCHOR:
+ case RANGE:
+ case DOT:
+ case NRANGE:
+ case BACKREFERENCE:
+ case LOOKAHEAD:
+ case NEGATIVELOOKAHEAD:
+ case LOOKBEHIND:
+ case NEGATIVELOOKBEHIND:
+ case CONDITION:
+ container.token = null;
+ return;
+
+ case CHAR: // Ignore CHAR tokens.
+ container.token = null; // **
+ return; // **
+
+ case STRING:
+ container.token = this;
+ container.options = options;
+ return;
+
+ case INDEPENDENT:
+ case PAREN:
+ this.getChild(0).findFixedString(container, options);
+ return;
+
+ case MODIFIERGROUP:
+ options |= ((ModifierToken)this).getOptions();
+ options &= ~((ModifierToken)this).getOptionsMask();
+ this.getChild(0).findFixedString(container, options);
+ return;
+
+ default:
+ throw new RuntimeException("Token#findFixedString(): Invalid Type: "+this.type);
+ }
+ }
+
+ boolean match(int ch) {
+ throw new RuntimeException("NFAArrow#match(): Internal error: "+this.type);
+ }
+
+ // ------------------------------------------------------
+ private final static Hashtable categories = new Hashtable();
+ private final static Hashtable categories2 = new Hashtable();
+ private static final String[] categoryNames = {
+ "Cn", "Lu", "Ll", "Lt", "Lm", "Lo", "Mn", "Me", "Mc", "Nd",
+ "Nl", "No", "Zs", "Zl", "Zp", "Cc", "Cf", null, "Co", "Cs",
+ "Pd", "Ps", "Pe", "Pc", "Po", "Sm", "Sc", "Sk", "So", // 28
+ "Pi", "Pf", // 29, 30
+ "L", "M", "N", "Z", "C", "P", "S", // 31-37
+ };
+
+ // Schema Rec. {Datatypes} - Punctuation
+ static final int CHAR_INIT_QUOTE = 29; // Pi - initial quote
+ static final int CHAR_FINAL_QUOTE = 30; // Pf - final quote
+ static final int CHAR_LETTER = 31;
+ static final int CHAR_MARK = 32;
+ static final int CHAR_NUMBER = 33;
+ static final int CHAR_SEPARATOR = 34;
+ static final int CHAR_OTHER = 35;
+ static final int CHAR_PUNCTUATION = 36;
+ static final int CHAR_SYMBOL = 37;
+
+ //blockNames in UNICODE 3.1 that supported by XML Schema REC
+ private static final String[] blockNames = {
+ /*0000..007F;*/ "Basic Latin",
+ /*0080..00FF;*/ "Latin-1 Supplement",
+ /*0100..017F;*/ "Latin Extended-A",
+ /*0180..024F;*/ "Latin Extended-B",
+ /*0250..02AF;*/ "IPA Extensions",
+ /*02B0..02FF;*/ "Spacing Modifier Letters",
+ /*0300..036F;*/ "Combining Diacritical Marks",
+ /*0370..03FF;*/ "Greek",
+ /*0400..04FF;*/ "Cyrillic",
+ /*0530..058F;*/ "Armenian",
+ /*0590..05FF;*/ "Hebrew",
+ /*0600..06FF;*/ "Arabic",
+ /*0700..074F;*/ "Syriac",
+ /*0780..07BF;*/ "Thaana",
+ /*0900..097F;*/ "Devanagari",
+ /*0980..09FF;*/ "Bengali",
+ /*0A00..0A7F;*/ "Gurmukhi",
+ /*0A80..0AFF;*/ "Gujarati",
+ /*0B00..0B7F;*/ "Oriya",
+ /*0B80..0BFF;*/ "Tamil",
+ /*0C00..0C7F;*/ "Telugu",
+ /*0C80..0CFF;*/ "Kannada",
+ /*0D00..0D7F;*/ "Malayalam",
+ /*0D80..0DFF;*/ "Sinhala",
+ /*0E00..0E7F;*/ "Thai",
+ /*0E80..0EFF;*/ "Lao",
+ /*0F00..0FFF;*/ "Tibetan",
+ /*1000..109F;*/ "Myanmar",
+ /*10A0..10FF;*/ "Georgian",
+ /*1100..11FF;*/ "Hangul Jamo",
+ /*1200..137F;*/ "Ethiopic",
+ /*13A0..13FF;*/ "Cherokee",
+ /*1400..167F;*/ "Unified Canadian Aboriginal Syllabics",
+ /*1680..169F;*/ "Ogham",
+ /*16A0..16FF;*/ "Runic",
+ /*1780..17FF;*/ "Khmer",
+ /*1800..18AF;*/ "Mongolian",
+ /*1E00..1EFF;*/ "Latin Extended Additional",
+ /*1F00..1FFF;*/ "Greek Extended",
+ /*2000..206F;*/ "General Punctuation",
+ /*2070..209F;*/ "Superscripts and Subscripts",
+ /*20A0..20CF;*/ "Currency Symbols",
+ /*20D0..20FF;*/ "Combining Marks for Symbols",
+ /*2100..214F;*/ "Letterlike Symbols",
+ /*2150..218F;*/ "Number Forms",
+ /*2190..21FF;*/ "Arrows",
+ /*2200..22FF;*/ "Mathematical Operators",
+ /*2300..23FF;*/ "Miscellaneous Technical",
+ /*2400..243F;*/ "Control Pictures",
+ /*2440..245F;*/ "Optical Character Recognition",
+ /*2460..24FF;*/ "Enclosed Alphanumerics",
+ /*2500..257F;*/ "Box Drawing",
+ /*2580..259F;*/ "Block Elements",
+ /*25A0..25FF;*/ "Geometric Shapes",
+ /*2600..26FF;*/ "Miscellaneous Symbols",
+ /*2700..27BF;*/ "Dingbats",
+ /*2800..28FF;*/ "Braille Patterns",
+ /*2E80..2EFF;*/ "CJK Radicals Supplement",
+ /*2F00..2FDF;*/ "Kangxi Radicals",
+ /*2FF0..2FFF;*/ "Ideographic Description Characters",
+ /*3000..303F;*/ "CJK Symbols and Punctuation",
+ /*3040..309F;*/ "Hiragana",
+ /*30A0..30FF;*/ "Katakana",
+ /*3100..312F;*/ "Bopomofo",
+ /*3130..318F;*/ "Hangul Compatibility Jamo",
+ /*3190..319F;*/ "Kanbun",
+ /*31A0..31BF;*/ "Bopomofo Extended",
+ /*3200..32FF;*/ "Enclosed CJK Letters and Months",
+ /*3300..33FF;*/ "CJK Compatibility",
+ /*3400..4DB5;*/ "CJK Unified Ideographs Extension A",
+ /*4E00..9FFF;*/ "CJK Unified Ideographs",
+ /*A000..A48F;*/ "Yi Syllables",
+ /*A490..A4CF;*/ "Yi Radicals",
+ /*AC00..D7A3;*/ "Hangul Syllables",
+ /*D800..DB7F;*/ "High Surrogates",
+ /*DB80..DBFF;*/ "High Private Use Surrogates",
+ /*DC00..DFFF;*/ "Low Surrogates",
+ /*E000..F8FF;*/ "Private Use",
+ /*F900..FAFF;*/ "CJK Compatibility Ideographs",
+ /*FB00..FB4F;*/ "Alphabetic Presentation Forms",
+ /*FB50..FDFF;*/ "Arabic Presentation Forms-A",
+ /*FE20..FE2F;*/ "Combining Half Marks",
+ /*FE30..FE4F;*/ "CJK Compatibility Forms",
+ /*FE50..FE6F;*/ "Small Form Variants",
+ /*FE70..FEFE;*/ "Arabic Presentation Forms-B",
+ /*FEFF..FEFF;*/ "Specials",
+ /*FF00..FFEF;*/ "Halfwidth and Fullwidth Forms",
+ //missing Specials add manually
+ /*10300..1032F;*/ "Old Italic", // 87
+ /*10330..1034F;*/ "Gothic",
+ /*10400..1044F;*/ "Deseret",
+ /*1D000..1D0FF;*/ "Byzantine Musical Symbols",
+ /*1D100..1D1FF;*/ "Musical Symbols",
+ /*1D400..1D7FF;*/ "Mathematical Alphanumeric Symbols",
+ /*20000..2A6D6;*/ "CJK Unified Ideographs Extension B",
+ /*2F800..2FA1F;*/ "CJK Compatibility Ideographs Supplement",
+ /*E0000..E007F;*/ "Tags",
+ //missing 2 private use add manually
+
+ };
+ //ADD THOSE MANUALLY
+ //F0000..FFFFD; "Private Use",
+ //100000..10FFFD; "Private Use"
+ //FFF0..FFFD; "Specials",
+ static final String blockRanges =
+ "\u0000\u007F\u0080\u00FF\u0100\u017F\u0180\u024F\u0250\u02AF\u02B0\u02FF\u0300\u036F"
+ +"\u0370\u03FF\u0400\u04FF\u0530\u058F\u0590\u05FF\u0600\u06FF\u0700\u074F\u0780\u07BF"
+ +"\u0900\u097F\u0980\u09FF\u0A00\u0A7F\u0A80\u0AFF\u0B00\u0B7F\u0B80\u0BFF\u0C00\u0C7F\u0C80\u0CFF"
+ +"\u0D00\u0D7F\u0D80\u0DFF\u0E00\u0E7F\u0E80\u0EFF\u0F00\u0FFF\u1000\u109F\u10A0\u10FF\u1100\u11FF"
+ +"\u1200\u137F\u13A0\u13FF\u1400\u167F\u1680\u169F\u16A0\u16FF\u1780\u17FF\u1800\u18AF\u1E00\u1EFF"
+ +"\u1F00\u1FFF\u2000\u206F\u2070\u209F\u20A0\u20CF\u20D0\u20FF\u2100\u214F\u2150\u218F\u2190\u21FF\u2200\u22FF"
+ +"\u2300\u23FF\u2400\u243F\u2440\u245F\u2460\u24FF\u2500\u257F\u2580\u259F\u25A0\u25FF\u2600\u26FF\u2700\u27BF"
+ +"\u2800\u28FF\u2E80\u2EFF\u2F00\u2FDF\u2FF0\u2FFF\u3000\u303F\u3040\u309F\u30A0\u30FF\u3100\u312F\u3130\u318F"
+ +"\u3190\u319F\u31A0\u31BF\u3200\u32FF\u3300\u33FF\u3400\u4DB5\u4E00\u9FFF\uA000\uA48F\uA490\uA4CF"
+ +"\uAC00\uD7A3\uD800\uDB7F\uDB80\uDBFF\uDC00\uDFFF\uE000\uF8FF\uF900\uFAFF\uFB00\uFB4F\uFB50\uFDFF"
+ +"\uFE20\uFE2F\uFE30\uFE4F\uFE50\uFE6F\uFE70\uFEFE\uFEFF\uFEFF\uFF00\uFFEF";
+ static final int[] nonBMPBlockRanges = {
+ 0x10300, 0x1032F, // 87
+ 0x10330, 0x1034F,
+ 0x10400, 0x1044F,
+ 0x1D000, 0x1D0FF,
+ 0x1D100, 0x1D1FF,
+ 0x1D400, 0x1D7FF,
+ 0x20000, 0x2A6D6,
+ 0x2F800, 0x2FA1F,
+ 0xE0000, 0xE007F
+ };
+ private static final int NONBMP_BLOCK_START = 87;
+
+ static protected RangeToken getRange(String name, boolean positive) {
+ if (Token.categories.size() == 0) {
+ synchronized (Token.categories) {
+ Token[] ranges = new Token[Token.categoryNames.length];
+ for (int i = 0; i < ranges.length; i ++) {
+ ranges[i] = Token.createRange();
+ }
+ int type;
+ for (int i = 0; i < 0x10000; i ++) {
+ type = Character.getType((char)i);
+ if (type == Character.START_PUNCTUATION ||
+ type == Character.END_PUNCTUATION) {
+ //build table of Pi values
+ if (i == 0x00AB || i == 0x2018 || i == 0x201B || i == 0x201C ||
+ i == 0x201F || i == 0x2039) {
+ type = CHAR_INIT_QUOTE;
+ }
+ //build table of Pf values
+ if (i == 0x00BB || i == 0x2019 || i == 0x201D || i == 0x203A ) {
+ type = CHAR_FINAL_QUOTE;
+ }
+ }
+ ranges[type].addRange(i, i);
+ switch (type) {
+ case Character.UPPERCASE_LETTER:
+ case Character.LOWERCASE_LETTER:
+ case Character.TITLECASE_LETTER:
+ case Character.MODIFIER_LETTER:
+ case Character.OTHER_LETTER:
+ type = CHAR_LETTER;
+ break;
+ case Character.NON_SPACING_MARK:
+ case Character.COMBINING_SPACING_MARK:
+ case Character.ENCLOSING_MARK:
+ type = CHAR_MARK;
+ break;
+ case Character.DECIMAL_DIGIT_NUMBER:
+ case Character.LETTER_NUMBER:
+ case Character.OTHER_NUMBER:
+ type = CHAR_NUMBER;
+ break;
+ case Character.SPACE_SEPARATOR:
+ case Character.LINE_SEPARATOR:
+ case Character.PARAGRAPH_SEPARATOR:
+ type = CHAR_SEPARATOR;
+ break;
+ case Character.CONTROL:
+ case Character.FORMAT:
+ case Character.SURROGATE:
+ case Character.PRIVATE_USE:
+ case Character.UNASSIGNED:
+ type = CHAR_OTHER;
+ break;
+ case Character.CONNECTOR_PUNCTUATION:
+ case Character.DASH_PUNCTUATION:
+ case Character.START_PUNCTUATION:
+ case Character.END_PUNCTUATION:
+ case CHAR_INIT_QUOTE:
+ case CHAR_FINAL_QUOTE:
+ case Character.OTHER_PUNCTUATION:
+ type = CHAR_PUNCTUATION;
+ break;
+ case Character.MATH_SYMBOL:
+ case Character.CURRENCY_SYMBOL:
+ case Character.MODIFIER_SYMBOL:
+ case Character.OTHER_SYMBOL:
+ type = CHAR_SYMBOL;
+ break;
+ default:
+ throw new RuntimeException("org.apache.xerces.utils.regex.Token#getRange(): Unknown Unicode category: "+type);
+ }
+ ranges[type].addRange(i, i);
+ } // for all characters
+ ranges[Character.UNASSIGNED].addRange(0x10000, Token.UTF16_MAX);
+
+ for (int i = 0; i < ranges.length; i ++) {
+ if (Token.categoryNames[i] != null) {
+ if (i == Character.UNASSIGNED) { // Unassigned
+ ranges[i].addRange(0x10000, Token.UTF16_MAX);
+ }
+ Token.categories.put(Token.categoryNames[i], ranges[i]);
+ Token.categories2.put(Token.categoryNames[i],
+ Token.complementRanges(ranges[i]));
+ }
+ }
+ //REVISIT: do we really need to support block names as in Unicode 3.1
+ // or we can just create all the names in IsBLOCKNAME format (XML Schema REC)?
+ //
+ StringBuffer buffer = new StringBuffer(50);
+ for (int i = 0; i < Token.blockNames.length; i ++) {
+ Token r1 = Token.createRange();
+ int location;
+ if (i < NONBMP_BLOCK_START) {
+ location = i*2;
+ int rstart = Token.blockRanges.charAt(location);
+ int rend = Token.blockRanges.charAt(location+1);
+ //DEBUGING
+ //System.out.println(n+" " +Integer.toHexString(rstart)
+ // +"-"+ Integer.toHexString(rend));
+ r1.addRange(rstart, rend);
+ } else {
+ location = (i - NONBMP_BLOCK_START) * 2;
+ r1.addRange(Token.nonBMPBlockRanges[location],
+ Token.nonBMPBlockRanges[location + 1]);
+ }
+ String n = Token.blockNames[i];
+ if (n.equals("Specials"))
+ r1.addRange(0xfff0, 0xfffd);
+ if (n.equals("Private Use")) {
+ r1.addRange(0xF0000,0xFFFFD);
+ r1.addRange(0x100000,0x10FFFD);
+ }
+ Token.categories.put(n, r1);
+ Token.categories2.put(n, Token.complementRanges(r1));
+ buffer.setLength(0);
+ buffer.append("Is");
+ if (n.indexOf(' ') >= 0) {
+ for (int ci = 0; ci < n.length(); ci ++)
+ if (n.charAt(ci) != ' ') buffer.append((char)n.charAt(ci));
+ }
+ else {
+ buffer.append(n);
+ }
+ Token.setAlias(buffer.toString(), n, true);
+ }
+
+ // TR#18 1.2
+ Token.setAlias("ASSIGNED", "Cn", false);
+ Token.setAlias("UNASSIGNED", "Cn", true);
+ Token all = Token.createRange();
+ all.addRange(0, Token.UTF16_MAX);
+ Token.categories.put("ALL", all);
+ Token.categories2.put("ALL", Token.complementRanges(all));
+ Token.registerNonXS("ASSIGNED");
+ Token.registerNonXS("UNASSIGNED");
+ Token.registerNonXS("ALL");
+
+ Token isalpha = Token.createRange();
+ isalpha.mergeRanges(ranges[Character.UPPERCASE_LETTER]); // Lu
+ isalpha.mergeRanges(ranges[Character.LOWERCASE_LETTER]); // Ll
+ isalpha.mergeRanges(ranges[Character.OTHER_LETTER]); // Lo
+ Token.categories.put("IsAlpha", isalpha);
+ Token.categories2.put("IsAlpha", Token.complementRanges(isalpha));
+ Token.registerNonXS("IsAlpha");
+
+ Token isalnum = Token.createRange();
+ isalnum.mergeRanges(isalpha); // Lu Ll Lo
+ isalnum.mergeRanges(ranges[Character.DECIMAL_DIGIT_NUMBER]); // Nd
+ Token.categories.put("IsAlnum", isalnum);
+ Token.categories2.put("IsAlnum", Token.complementRanges(isalnum));
+ Token.registerNonXS("IsAlnum");
+
+ Token isspace = Token.createRange();
+ isspace.mergeRanges(Token.token_spaces);
+ isspace.mergeRanges(ranges[CHAR_SEPARATOR]); // Z
+ Token.categories.put("IsSpace", isspace);
+ Token.categories2.put("IsSpace", Token.complementRanges(isspace));
+ Token.registerNonXS("IsSpace");
+
+ Token isword = Token.createRange();
+ isword.mergeRanges(isalnum); // Lu Ll Lo Nd
+ isword.addRange('_', '_');
+ Token.categories.put("IsWord", isword);
+ Token.categories2.put("IsWord", Token.complementRanges(isword));
+ Token.registerNonXS("IsWord");
+
+ Token isascii = Token.createRange();
+ isascii.addRange(0, 127);
+ Token.categories.put("IsASCII", isascii);
+ Token.categories2.put("IsASCII", Token.complementRanges(isascii));
+ Token.registerNonXS("IsASCII");
+
+ Token isnotgraph = Token.createRange();
+ isnotgraph.mergeRanges(ranges[CHAR_OTHER]);
+ isnotgraph.addRange(' ', ' ');
+ Token.categories.put("IsGraph", Token.complementRanges(isnotgraph));
+ Token.categories2.put("IsGraph", isnotgraph);
+ Token.registerNonXS("IsGraph");
+
+ Token isxdigit = Token.createRange();
+ isxdigit.addRange('0', '9');
+ isxdigit.addRange('A', 'F');
+ isxdigit.addRange('a', 'f');
+ Token.categories.put("IsXDigit", Token.complementRanges(isxdigit));
+ Token.categories2.put("IsXDigit", isxdigit);
+ Token.registerNonXS("IsXDigit");
+
+ Token.setAlias("IsDigit", "Nd", true);
+ Token.setAlias("IsUpper", "Lu", true);
+ Token.setAlias("IsLower", "Ll", true);
+ Token.setAlias("IsCntrl", "C", true);
+ Token.setAlias("IsPrint", "C", false);
+ Token.setAlias("IsPunct", "P", true);
+ Token.registerNonXS("IsDigit");
+ Token.registerNonXS("IsUpper");
+ Token.registerNonXS("IsLower");
+ Token.registerNonXS("IsCntrl");
+ Token.registerNonXS("IsPrint");
+ Token.registerNonXS("IsPunct");
+
+ Token.setAlias("alpha", "IsAlpha", true);
+ Token.setAlias("alnum", "IsAlnum", true);
+ Token.setAlias("ascii", "IsASCII", true);
+ Token.setAlias("cntrl", "IsCntrl", true);
+ Token.setAlias("digit", "IsDigit", true);
+ Token.setAlias("graph", "IsGraph", true);
+ Token.setAlias("lower", "IsLower", true);
+ Token.setAlias("print", "IsPrint", true);
+ Token.setAlias("punct", "IsPunct", true);
+ Token.setAlias("space", "IsSpace", true);
+ Token.setAlias("upper", "IsUpper", true);
+ Token.setAlias("word", "IsWord", true); // Perl extension
+ Token.setAlias("xdigit", "IsXDigit", true);
+ Token.registerNonXS("alpha");
+ Token.registerNonXS("alnum");
+ Token.registerNonXS("ascii");
+ Token.registerNonXS("cntrl");
+ Token.registerNonXS("digit");
+ Token.registerNonXS("graph");
+ Token.registerNonXS("lower");
+ Token.registerNonXS("print");
+ Token.registerNonXS("punct");
+ Token.registerNonXS("space");
+ Token.registerNonXS("upper");
+ Token.registerNonXS("word");
+ Token.registerNonXS("xdigit");
+ } // synchronized
+ } // if null
+ RangeToken tok = positive ? (RangeToken)Token.categories.get(name)
+ : (RangeToken)Token.categories2.get(name);
+ //if (tok == null) System.out.println(name);
+ return tok;
+ }
+ static protected RangeToken getRange(String name, boolean positive, boolean xs) {
+ RangeToken range = Token.getRange(name, positive);
+ if (xs && range != null && Token.isRegisterNonXS(name))
+ range = null;
+ return range;
+ }
+
+ static Hashtable nonxs = null;
+ /**
+ * This method is called by only getRange().
+ * So this method need not MT-safe.
+ */
+ static protected void registerNonXS(String name) {
+ if (Token.nonxs == null)
+ Token.nonxs = new Hashtable();
+ Token.nonxs.put(name, name);
+ }
+ static protected boolean isRegisterNonXS(String name) {
+ if (Token.nonxs == null)
+ return false;
+ //DEBUG
+ //System.err.println("isRegisterNonXS: "+name);
+ return Token.nonxs.containsKey(name);
+ }
+
+ private static void setAlias(String newName, String name, boolean positive) {
+ Token t1 = (Token)Token.categories.get(name);
+ Token t2 = (Token)Token.categories2.get(name);
+ if (positive) {
+ Token.categories.put(newName, t1);
+ Token.categories2.put(newName, t2);
+ } else {
+ Token.categories2.put(newName, t1);
+ Token.categories.put(newName, t2);
+ }
+ }
+
+ // ------------------------------------------------------
+
+ static final String viramaString =
+ "\u094D"// ;DEVANAGARI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u09CD"//;BENGALI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0A4D"//;GURMUKHI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0ACD"//;GUJARATI SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0B4D"//;ORIYA SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0BCD"//;TAMIL SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0C4D"//;TELUGU SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0CCD"//;KANNADA SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0D4D"//;MALAYALAM SIGN VIRAMA;Mn;9;ON;;;;;N;;;;;
+ +"\u0E3A"//;THAI CHARACTER PHINTHU;Mn;9;ON;;;;;N;THAI VOWEL SIGN PHINTHU;;;;
+ +"\u0F84";//;TIBETAN MARK HALANTA;Mn;9;ON;;;;;N;TIBETAN VIRAMA;;;;
+
+ static private Token token_grapheme = null;
+ static synchronized Token getGraphemePattern() {
+ if (Token.token_grapheme != null)
+ return Token.token_grapheme;
+
+ Token base_char = Token.createRange(); // [{ASSIGNED}]-[{M},{C}]
+ base_char.mergeRanges(Token.getRange("ASSIGNED", true));
+ base_char.subtractRanges(Token.getRange("M", true));
+ base_char.subtractRanges(Token.getRange("C", true));
+
+ Token virama = Token.createRange();
+ for (int i = 0; i < Token.viramaString.length(); i ++) {
+ int ch = viramaString.charAt(i);
+ virama.addRange(i, i);
+ }
+
+ Token combiner_wo_virama = Token.createRange();
+ combiner_wo_virama.mergeRanges(Token.getRange("M", true));
+ combiner_wo_virama.addRange(0x1160, 0x11ff); // hangul_medial and hangul_final
+ combiner_wo_virama.addRange(0xff9e, 0xff9f); // extras
+
+ Token left = Token.createUnion(); // base_char?
+ left.addChild(base_char);
+ left.addChild(Token.token_empty);
+
+ Token foo = Token.createUnion();
+ foo.addChild(Token.createConcat(virama, Token.getRange("L", true)));
+ foo.addChild(combiner_wo_virama);
+
+ foo = Token.createClosure(foo);
+
+ foo = Token.createConcat(left, foo);
+
+ Token.token_grapheme = foo;
+ return Token.token_grapheme;
+ }
+
+ /**
+ * Combing Character Sequence in Perl 5.6.
+ */
+ static private Token token_ccs = null;
+ static synchronized Token getCombiningCharacterSequence() {
+ if (Token.token_ccs != null)
+ return Token.token_ccs;
+
+ Token foo = Token.createClosure(Token.getRange("M", true)); // \pM*
+ foo = Token.createConcat(Token.getRange("M", false), foo); // \PM + \pM*
+ Token.token_ccs = foo;
+ return Token.token_ccs;
+ }
+
+ // ------------------------------------------------------
+
+ // ------------------------------------------------------
+ /**
+ * This class represents a node in parse tree.
+ */
+ static class StringToken extends Token implements java.io.Serializable {
+ String string;
+ int refNumber;
+
+ StringToken(int type, String str, int n) {
+ super(type);
+ this.string = str;
+ this.refNumber = n;
+ }
+
+ int getReferenceNumber() { // for STRING
+ return this.refNumber;
+ }
+ String getString() { // for STRING
+ return this.string;
+ }
+
+ public String toString(int options) {
+ if (this.type == BACKREFERENCE)
+ return "\\"+this.refNumber;
+ else
+ return REUtil.quoteMeta(this.string);
+ }
+ }
+
+ /**
+ * This class represents a node in parse tree.
+ */
+ static class ConcatToken extends Token implements java.io.Serializable {
+ Token child;
+ Token child2;
+
+ ConcatToken(Token t1, Token t2) {
+ super(Token.CONCAT);
+ this.child = t1;
+ this.child2 = t2;
+ }
+
+ int size() {
+ return 2;
+ }
+ Token getChild(int index) {
+ return index == 0 ? this.child : this.child2;
+ }
+
+ public String toString(int options) {
+ String ret;
+ if (this.child2.type == CLOSURE && this.child2.getChild(0) == this.child) {
+ ret = this.child.toString(options)+"+";
+ } else if (this.child2.type == NONGREEDYCLOSURE && this.child2.getChild(0) == this.child) {
+ ret = this.child.toString(options)+"+?";
+ } else
+ ret = this.child.toString(options)+this.child2.toString(options);
+ return ret;
+ }
+ }
+
+ /**
+ * This class represents a node in parse tree.
+ */
+ static class CharToken extends Token implements java.io.Serializable {
+ int chardata;
+
+ CharToken(int type, int ch) {
+ super(type);
+ this.chardata = ch;
+ }
+
+ int getChar() {
+ return this.chardata;
+ }
+
+ public String toString(int options) {
+ String ret;
+ switch (this.type) {
+ case CHAR:
+ switch (this.chardata) {
+ case '|': case '*': case '+': case '?':
+ case '(': case ')': case '.': case '[':
+ case '{': case '\\':
+ ret = "\\"+(char)this.chardata;
+ break;
+ case '\f': ret = "\\f"; break;
+ case '\n': ret = "\\n"; break;
+ case '\r': ret = "\\r"; break;
+ case '\t': ret = "\\t"; break;
+ case 0x1b: ret = "\\e"; break;
+ //case 0x0b: ret = "\\v"; break;
+ default:
+ if (this.chardata >= 0x10000) {
+ String pre = "0"+Integer.toHexString(this.chardata);
+ ret = "\\v"+pre.substring(pre.length()-6, pre.length());
+ } else
+ ret = ""+(char)this.chardata;
+ }
+ break;
+
+ case ANCHOR:
+ if (this == Token.token_linebeginning || this == Token.token_lineend)
+ ret = ""+(char)this.chardata;
+ else
+ ret = "\\"+(char)this.chardata;
+ break;
+
+ default:
+ ret = null;
+ }
+ return ret;
+ }
+
+ boolean match(int ch) {
+ if (this.type == CHAR) {
+ return ch == this.chardata;
+ } else
+ throw new RuntimeException("NFAArrow#match(): Internal error: "+this.type);
+ }
+ }
+
+ /**
+ * This class represents a node in parse tree.
+ */
+ static class ClosureToken extends Token implements java.io.Serializable {
+ int min;
+ int max;
+ Token child;
+
+ ClosureToken(int type, Token tok) {
+ super(type);
+ this.child = tok;
+ this.setMin(-1);
+ this.setMax(-1);
+ }
+
+ int size() {
+ return 1;
+ }
+ Token getChild(int index) {
+ return this.child;
+ }
+
+ final void setMin(int min) {
+ this.min = min;
+ }
+ final void setMax(int max) {
+ this.max = max;
+ }
+ final int getMin() {
+ return this.min;
+ }
+ final int getMax() {
+ return this.max;
+ }
+
+ public String toString(int options) {
+ String ret;
+ if (this.type == CLOSURE) {
+ if (this.getMin() < 0 && this.getMax() < 0) {
+ ret = this.child.toString(options)+"*";
+ } else if (this.getMin() == this.getMax()) {
+ ret = this.child.toString(options)+"{"+this.getMin()+"}";
+ } else if (this.getMin() >= 0 && this.getMax() >= 0) {
+ ret = this.child.toString(options)+"{"+this.getMin()+","+this.getMax()+"}";
+ } else if (this.getMin() >= 0 && this.getMax() < 0) {
+ ret = this.child.toString(options)+"{"+this.getMin()+",}";
+ } else
+ throw new RuntimeException("Token#toString(): CLOSURE "
+ +this.getMin()+", "+this.getMax());
+ } else {
+ if (this.getMin() < 0 && this.getMax() < 0) {
+ ret = this.child.toString(options)+"*?";
+ } else if (this.getMin() == this.getMax()) {
+ ret = this.child.toString(options)+"{"+this.getMin()+"}?";
+ } else if (this.getMin() >= 0 && this.getMax() >= 0) {
+ ret = this.child.toString(options)+"{"+this.getMin()+","+this.getMax()+"}?";
+ } else if (this.getMin() >= 0 && this.getMax() < 0) {
+ ret = this.child.toString(options)+"{"+this.getMin()+",}?";
+ } else
+ throw new RuntimeException("Token#toString(): NONGREEDYCLOSURE "
+ +this.getMin()+", "+this.getMax());
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * This class represents a node in parse tree.
+ */
+ static class ParenToken extends Token implements java.io.Serializable {
+ Token child;
+ int parennumber;
+
+ ParenToken(int type, Token tok, int paren) {
+ super(type);
+ this.child = tok;
+ this.parennumber = paren;
+ }
+
+ int size() {
+ return 1;
+ }
+ Token getChild(int index) {
+ return this.child;
+ }
+
+ int getParenNumber() {
+ return this.parennumber;
+ }
+
+ public String toString(int options) {
+ String ret = null;
+ switch (this.type) {
+ case PAREN:
+ if (this.parennumber == 0) {
+ ret = "(?:"+this.child.toString(options)+")";
+ } else {
+ ret = "("+this.child.toString(options)+")";
+ }
+ break;
+
+ case LOOKAHEAD:
+ ret = "(?="+this.child.toString(options)+")";
+ break;
+ case NEGATIVELOOKAHEAD:
+ ret = "(?!"+this.child.toString(options)+")";
+ break;
+ case LOOKBEHIND:
+ ret = "(?<="+this.child.toString(options)+")";
+ break;
+ case NEGATIVELOOKBEHIND:
+ ret = "(?<!"+this.child.toString(options)+")";
+ break;
+ case INDEPENDENT:
+ ret = "(?>"+this.child.toString(options)+")";
+ break;
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * (?(condition)yes-pattern|no-pattern)
+ */
+ static class ConditionToken extends Token implements java.io.Serializable {
+ int refNumber;
+ Token condition;
+ Token yes;
+ Token no;
+ ConditionToken(int refno, Token cond, Token yespat, Token nopat) {
+ super(Token.CONDITION);
+ this.refNumber = refno;
+ this.condition = cond;
+ this.yes = yespat;
+ this.no = nopat;
+ }
+ int size() {
+ return this.no == null ? 1 : 2;
+ }
+ Token getChild(int index) {
+ if (index == 0) return this.yes;
+ if (index == 1) return this.no;
+ throw new RuntimeException("Internal Error: "+index);
+ }
+
+ public String toString(int options) {
+ String ret;
+ if (refNumber > 0) {
+ ret = "(?("+refNumber+")";
+ } else if (this.condition.type == Token.ANCHOR) {
+ ret = "(?("+this.condition+")";
+ } else {
+ ret = "(?"+this.condition;
+ }
+
+ if (this.no == null) {
+ ret += this.yes+")";
+ } else {
+ ret += this.yes+"|"+this.no+")";
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * (ims-ims: .... )
+ */
+ static class ModifierToken extends Token implements java.io.Serializable {
+ Token child;
+ int add;
+ int mask;
+
+ ModifierToken(Token tok, int add, int mask) {
+ super(Token.MODIFIERGROUP);
+ this.child = tok;
+ this.add = add;
+ this.mask = mask;
+ }
+
+ int size() {
+ return 1;
+ }
+ Token getChild(int index) {
+ return this.child;
+ }
+
+ int getOptions() {
+ return this.add;
+ }
+ int getOptionsMask() {
+ return this.mask;
+ }
+
+ public String toString(int options) {
+ return "(?"
+ +(this.add == 0 ? "" : REUtil.createOptionString(this.add))
+ +(this.mask == 0 ? "" : REUtil.createOptionString(this.mask))
+ +":"
+ +this.child.toString(options)
+ +")";
+ }
+ }
+
+ /**
+ * This class represents a node in parse tree.
+ * for UNION or CONCAT.
+ */
+ static class UnionToken extends Token implements java.io.Serializable {
+ Vector children;
+
+ UnionToken(int type) {
+ super(type);
+ }
+
+ void addChild(Token tok) {
+ if (tok == null) return;
+ if (this.children == null) this.children = new Vector();
+ if (this.type == UNION) {
+ this.children.addElement(tok);
+ return;
+ }
+ // This is CONCAT, and new child is CONCAT.
+ if (tok.type == CONCAT) {
+ for (int i = 0; i < tok.size(); i ++)
+ this.addChild(tok.getChild(i)); // Recursion
+ return;
+ }
+ int size = this.children.size();
+ if (size == 0) {
+ this.children.addElement(tok);
+ return;
+ }
+ Token previous = (Token)this.children.elementAt(size-1);
+ if (!((previous.type == CHAR || previous.type == STRING)
+ && (tok.type == CHAR || tok.type == STRING))) {
+ this.children.addElement(tok);
+ return;
+ }
+
+ //System.err.println("Merge '"+previous+"' and '"+tok+"'.");
+
+ StringBuffer buffer;
+ int nextMaxLength = (tok.type == CHAR ? 2 : tok.getString().length());
+ if (previous.type == CHAR) { // Replace previous token by STRING
+ buffer = new StringBuffer(2 + nextMaxLength);
+ int ch = previous.getChar();
+ if (ch >= 0x10000)
+ buffer.append(REUtil.decomposeToSurrogates(ch));
+ else
+ buffer.append((char)ch);
+ previous = Token.createString(null);
+ this.children.setElementAt(previous, size-1);
+ } else { // STRING
+ buffer = new StringBuffer(previous.getString().length() + nextMaxLength);
+ buffer.append(previous.getString());
+ }
+
+ if (tok.type == CHAR) {
+ int ch = tok.getChar();
+ if (ch >= 0x10000)
+ buffer.append(REUtil.decomposeToSurrogates(ch));
+ else
+ buffer.append((char)ch);
+ } else {
+ buffer.append(tok.getString());
+ }
+
+ ((StringToken)previous).string = new String(buffer);
+ }
+
+ int size() {
+ return this.children == null ? 0 : this.children.size();
+ }
+ Token getChild(int index) {
+ return (Token)this.children.elementAt(index);
+ }
+
+ public String toString(int options) {
+ String ret;
+ if (this.type == CONCAT) {
+ if (this.children.size() == 2) {
+ Token ch = this.getChild(0);
+ Token ch2 = this.getChild(1);
+ if (ch2.type == CLOSURE && ch2.getChild(0) == ch) {
+ ret = ch.toString(options)+"+";
+ } else if (ch2.type == NONGREEDYCLOSURE && ch2.getChild(0) == ch) {
+ ret = ch.toString(options)+"+?";
+ } else
+ ret = ch.toString(options)+ch2.toString(options);
+ } else {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < this.children.size(); i ++) {
+ sb.append(((Token)this.children.elementAt(i)).toString(options));
+ }
+ ret = new String(sb);
+ }
+ return ret;
+ }
+ if (this.children.size() == 2 && this.getChild(1).type == EMPTY) {
+ ret = this.getChild(0).toString(options)+"?";
+ } else if (this.children.size() == 2
+ && this.getChild(0).type == EMPTY) {
+ ret = this.getChild(1).toString(options)+"??";
+ } else {
+ StringBuffer sb = new StringBuffer();
+ sb.append(((Token)this.children.elementAt(0)).toString(options));
+ for (int i = 1; i < this.children.size(); i ++) {
+ sb.append((char)'|');
+ sb.append(((Token)this.children.elementAt(i)).toString(options));
+ }
+ ret = new String(sb);
+ }
+ return ret;
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message.properties b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message.properties
new file mode 100644
index 0000000..abe4880
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message.properties
@@ -0,0 +1,32 @@
+parser.parse.1=Wrong character.
+parser.parse.2=Invalid reference number.
+parser.next.1=A character is required after \\.
+parser.next.2='?' is not expected. '(?:' or '(?=' or '(?!' or '(?<' or '(?#' or '(?>'?
+parser.next.3='(?<=' or '(?<!' is expected.
+parser.next.4=A comment is not terminated.
+parser.factor.1=')' is expected.
+parser.factor.2=Unexpected end of the pattern in a modifier group.
+parser.factor.3=':' is expected.
+parser.factor.4=Unexpected end of the pattern in a conditional group.
+parser.factor.5=A back reference or an anchor or a lookahead or a lookbehind is expected in a conditional pattern.
+parser.factor.6=There are more than three choises in a conditional group.
+parser.atom.1=A character in U+0040-U+005f must follow \\c.
+parser.atom.2=A Category character or '{' is required.
+parser.atom.3=A property name is not closed by '}'.
+parser.atom.4=Unexpected meta character.
+parser.atom.5=Unknown property.
+parser.cc.1=A POSIX character class must be closed by ':]'.
+parser.cc.2=Unexpected end of the pattern in a character class.
+parser.cc.3=Unknown name for a POSIX character class.
+parser.cc.4='-' is invalid here.
+parser.cc.5=']' is expected.
+parser.cc.6='[' is invalid in a characer class. Write '\\['.
+parser.cc.7=']' is invalid in a characer class. Write '\\]'.
+parser.ope.1='[' is expected.
+parser.ope.2=')' or '-[' or '+[' or '&[' is expected.
+parser.descape.1=Invalid Unicode hex notation.
+parser.descape.2=Overflow in a hex notation.
+parser.descape.3='\\x{' must be closed by '}'.
+parser.descape.4=Invalid Unicode code point.
+parser.descape.5=An anchor must not be here.
+parser.process.1=This expression is not supported in the current option setting.
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_fr.properties b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_fr.properties
new file mode 100644
index 0000000..fd3e981
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_fr.properties
@@ -0,0 +1,32 @@
+ parser.parse.1=Caract\u00e8re invalide.
+parser.parse.2=Num\u00e9ro de r\u00e9f\u00e9rence invalide.
+parser.next.1=Un \\ doit \u00eatre suivi d'un caract\u00e8re.
+parser.next.2='?' n'est pas possible ici. '(?:' ou '(?=' ou '(?!' ou '(?<' ou '(?#' ou '(?>'?
+parser.next.3='(?<=' ou '(?<!' sont attendus.
+parser.next.4=Un commentaire n'est pas ferm\u00e9.
+parser.factor.1=')' manquant.
+parser.factor.2=Fin pr\u00e9matur\u00e9e de motif dans un groupe modifiant.
+parser.factor.3=':' manquant.
+parser.factor.4=Fin pr\u00e9matur\u00e9e de motif dans un groupe conditionel.
+parser.factor.5=Une r\u00e9f\u00e9rence arri\u00e8re ou une ancre ou un lookahead ou un lookbehind est attendu dans un groupe conditionel.
+parser.factor.6=Il y a plus de trois choix dans un groupe conditionel.
+parser.atom.1=\\c doit \u00eatre suivi d'un caract\u00e8re dans l'intervalle U+0040-U+005f .
+parser.atom.2=Un caract\u00e8re de cat\u00e9gorie ou '{' est requis.
+parser.atom.3=Un nom de propri\u00e9t\u00e9 ne se termine pas par '}'.
+parser.atom.4=M\u00e9tacaract\u00e8re interdit.
+parser.atom.5=Propri\u00e9t\u00e9 inconnue.
+parser.cc.1=Une classe de caract\u00e8re POSIX doit \u00eatre termin\u00e9e par ':]'.
+parser.cc.2=Fin pr\u00e9matur\u00e9e de motif dans une classe de caract\u00e8re.
+parser.cc.3=Nom inconnu pour une classe de caract\u00e8re POSIX.
+parser.cc.4='-' est invalide, dans ce cas.
+parser.cc.5=']' manquant.
+parser.cc.6='[' est invalide dans une classe de caract\u00e8re. Ecrivez '\\['.
+parser.cc.7=']' est invalide dans une classe de caract\u00e8re. Ecrivez '\\]'.
+parser.ope.1='[' est attendu.
+parser.ope.2=')' ou '-[' ou '+[' ou '&[' sont attendus.
+parser.descape.1=Notation hexad\u00e9cimale Unicode invalide.
+parser.descape.2=D\u00e9passement de capacit\u00e9 dans une expression hexad\u00e9cimale.
+parser.descape.3='\\x{' doit se terminer par un '}'.
+parser.descape.4=Point de code Unicode invalide.
+parser.descape.5=Ancre interdite ici.
+parser.process.1=Cette expression n'est pas autoris\u00e9e compte tenu des options en cours.
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_ja.properties b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_ja.properties
new file mode 100644
index 0000000..9be8394
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/regex/message_ja.properties
@@ -0,0 +1,32 @@
+parser.parse.1=\u3078\u3093\u306a\u6587\u5b57.
+parser.parse.2=\u5b58\u5728\u3057\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u756a\u53f7\u3067\u3059.
+parser.next.1=\\ \u306e\u5f8c\u306b1\u6587\u5b57\u5fc5\u8981\u3067\u3059.
+parser.next.2='?' \u3092\u3053\u3053\u306b\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. \u3082\u3057\u304b\u3057\u3066 '(?:' \u304b '(?=' \u304b '(?!' \u304b '(?<' \u304b '(?#' \u304b '(?>' \u3067\u3059\u304b?
+parser.next.3='(?<=' \u304b '(?<!' \u304c\u5fc5\u8981\u3067\u3059.
+parser.next.4=\u8a3b\u91c8\u304c\u9589\u3058\u3066\u3044\u307e\u305b\u3093.
+parser.factor.1=')' \u304c\u5fc5\u8981\u3067\u3059.
+parser.factor.2=\u30aa\u30d7\u30b7\u30e7\u30f3\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+parser.factor.3=':' \u304c\u5fc5\u8981\u3067\u3059.
+parser.factor.4=\u6761\u4ef6\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+parser.factor.5=\u6761\u4ef6\u30d1\u30bf\u30fc\u30f3\u306b\u306f\u3001\u5f8c\u65b9\u53c2\u7167\u30fb\u30a2\u30f3\u30ab\u30fc\u30fb\u5148\u8aad\u307f\u30fb\u5f8c\u8aad\u307f\u306e\u307f\u4f7f\u7528\u3067\u304d\u307e\u3059.
+parser.factor.6=\u6761\u4ef6\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u306b3\u500b\u4ee5\u4e0a\u306e\u9078\u629e\u3092\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+parser.atom.1=\\c \u306e\u5f8c\u306b\u306f\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u304c U+0040\uff5eU+005f \u306e\u7bc4\u56f2\u306e\u6587\u5b57\u304c\u5fc5\u8981\u3067\u3059.
+parser.atom.2=1\u6587\u5b57\u306e\u30ab\u30c6\u30b4\u30ea\u6587\u5b57\u304b '{' \u304c\u5fc5\u8981\u3067\u3059.
+parser.atom.3=\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u304c '}' \u3067\u9589\u3058\u3066\u3044\u307e\u305b\u3093.
+parser.atom.4=\u30e1\u30bf\u6587\u5b57\u304c\u5909\u306a\u3068\u3053\u308d\u306b\u3042\u308a\u307e\u3059.
+parser.atom.5=\u672a\u77e5\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3067\u3059.
+parser.cc.1=POSIX \u6587\u5b57\u30af\u30e9\u30b9\u306f ':]' \u3067\u9589\u3058\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.
+parser.cc.2=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+parser.cc.3=\u672a\u77e5\u306e POSIX \u6587\u5b57\u30af\u30e9\u30b9\u540d\u3067\u3059.
+parser.cc.4=\u3053\u3053\u306b '-' \u3092\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+parser.cc.5=']' \u304c\u5fc5\u8981\u3067\u3059.
+parser.cc.6=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u306f '[' \u3092\u76f4\u63a5\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. '\\[' \u3068\u66f8\u3044\u3066\u304f\u3060\u3055\u3044.
+parser.cc.7=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u306f ']' \u3092\u76f4\u63a5\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. '\\]' \u3068\u66f8\u3044\u3066\u304f\u3060\u3055\u3044.
+parser.ope.1='[' \u304c\u5fc5\u8981\u3067\u3059.
+parser.ope.2=')' \u304b '-[' \u304b '+[' \u304b '&[' \u304c\u5fc5\u8981\u3067\u3059.
+parser.descape.1=\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306e16\u9032\u6570\u8868\u8a18\u4e2d\u306b\u9593\u9055\u3063\u305f\u6587\u5b57\u304c\u3042\u308a\u307e\u3059.
+parser.descape.2=\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u6570\u5024\u304c\u5927\u304d\u3059\u304e\u307e\u3059.
+parser.descape.3='\\x{' \u306f '}' \u3067\u9589\u3058\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093.
+parser.descape.4=Unicode \u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u4e0d\u6b63\u3067\u3059.
+parser.descape.5=\u30a2\u30f3\u30ab\u30fc\u3092\u3053\u3053\u306b\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+parser.process.1=\u3053\u306e\u8868\u73fe\u306f\u73fe\u5728\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u8a2d\u5b9a\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093.
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/BuiltinSchemaTypeSystem.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/BuiltinSchemaTypeSystem.java
new file mode 100644
index 0000000..8f53a26
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/BuiltinSchemaTypeSystem.java
@@ -0,0 +1,1051 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.values.XmlIntegerImpl;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.values.XmlStringImpl;
+import org.apache.xmlbeans.impl.regex.RegularExpression;
+import org.apache.xmlbeans.impl.regex.SchemaRegularExpression;
+
+import javax.xml.namespace.QName;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.math.BigInteger;
+
+public class BuiltinSchemaTypeSystem extends SchemaTypeLoaderBase implements SchemaTypeSystem
+{
+ // The global builtin type system
+ public static SchemaTypeSystem get()
+ { return _global; }
+
+ // some constants that need to be initialized early
+ private static final SchemaType[] EMPTY_SCHEMATYPE_ARRAY = new SchemaType[0];
+ private static final SchemaType.Ref[] EMPTY_SCHEMATYPEREF_ARRAY = new SchemaType.Ref[0];
+ private static final SchemaGlobalElement[] EMPTY_SCHEMAELEMENT_ARRAY = new SchemaGlobalElement[0];
+ private static final SchemaGlobalAttribute[] EMPTY_SCHEMAATTRIBUTE_ARRAY = new SchemaGlobalAttribute[0];
+ private static final SchemaModelGroup[] EMPTY_SCHEMAMODELGROUP_ARRAY = new SchemaModelGroup[0];
+ private static final SchemaAttributeGroup[] EMPTY_SCHEMAATTRIBUTEGROUP_ARRAY = new SchemaAttributeGroup[0];
+
+ private static BuiltinSchemaTypeSystem _global = new BuiltinSchemaTypeSystem();
+
+ // UR types
+ public static final SchemaTypeImpl ST_ANY_TYPE = _global.getBuiltinType(SchemaType.BTC_ANY_TYPE);
+ public static final SchemaTypeImpl ST_ANY_SIMPLE = _global.getBuiltinType(SchemaType.BTC_ANY_SIMPLE);
+
+ // primitives
+ public static final SchemaTypeImpl ST_BOOLEAN = _global.getBuiltinType(SchemaType.BTC_BOOLEAN);
+ public static final SchemaTypeImpl ST_BASE_64_BINARY = _global.getBuiltinType(SchemaType.BTC_BASE_64_BINARY);
+ public static final SchemaTypeImpl ST_HEX_BINARY = _global.getBuiltinType(SchemaType.BTC_HEX_BINARY);
+ public static final SchemaTypeImpl ST_ANY_URI = _global.getBuiltinType(SchemaType.BTC_ANY_URI);
+ public static final SchemaTypeImpl ST_QNAME = _global.getBuiltinType(SchemaType.BTC_QNAME);
+ public static final SchemaTypeImpl ST_NOTATION = _global.getBuiltinType(SchemaType.BTC_NOTATION);
+ public static final SchemaTypeImpl ST_FLOAT = _global.getBuiltinType(SchemaType.BTC_FLOAT);
+ public static final SchemaTypeImpl ST_DOUBLE = _global.getBuiltinType(SchemaType.BTC_DOUBLE);
+ public static final SchemaTypeImpl ST_DECIMAL = _global.getBuiltinType(SchemaType.BTC_DECIMAL);
+ public static final SchemaTypeImpl ST_STRING = _global.getBuiltinType(SchemaType.BTC_STRING);
+
+ public static final SchemaTypeImpl ST_DURATION = _global.getBuiltinType(SchemaType.BTC_DURATION);
+ public static final SchemaTypeImpl ST_DATE_TIME = _global.getBuiltinType(SchemaType.BTC_DATE_TIME);
+ public static final SchemaTypeImpl ST_TIME = _global.getBuiltinType(SchemaType.BTC_TIME);
+ public static final SchemaTypeImpl ST_DATE = _global.getBuiltinType(SchemaType.BTC_DATE);
+ public static final SchemaTypeImpl ST_G_YEAR_MONTH = _global.getBuiltinType(SchemaType.BTC_G_YEAR_MONTH);
+ public static final SchemaTypeImpl ST_G_YEAR = _global.getBuiltinType(SchemaType.BTC_G_YEAR);
+ public static final SchemaTypeImpl ST_G_MONTH_DAY = _global.getBuiltinType(SchemaType.BTC_G_MONTH_DAY);
+ public static final SchemaTypeImpl ST_G_DAY = _global.getBuiltinType(SchemaType.BTC_G_DAY);
+ public static final SchemaTypeImpl ST_G_MONTH = _global.getBuiltinType(SchemaType.BTC_G_MONTH);
+
+ // derived numerics
+ public static final SchemaTypeImpl ST_INTEGER = _global.getBuiltinType(SchemaType.BTC_INTEGER);
+ public static final SchemaTypeImpl ST_LONG = _global.getBuiltinType(SchemaType.BTC_LONG);
+ public static final SchemaTypeImpl ST_INT = _global.getBuiltinType(SchemaType.BTC_INT);
+ public static final SchemaTypeImpl ST_SHORT = _global.getBuiltinType(SchemaType.BTC_SHORT);
+ public static final SchemaTypeImpl ST_BYTE = _global.getBuiltinType(SchemaType.BTC_BYTE);
+ public static final SchemaTypeImpl ST_NON_POSITIVE_INTEGER = _global.getBuiltinType(SchemaType.BTC_NON_POSITIVE_INTEGER);
+ public static final SchemaTypeImpl ST_NEGATIVE_INTEGER = _global.getBuiltinType(SchemaType.BTC_NEGATIVE_INTEGER);
+ public static final SchemaTypeImpl ST_NON_NEGATIVE_INTEGER = _global.getBuiltinType(SchemaType.BTC_NON_NEGATIVE_INTEGER);
+ public static final SchemaTypeImpl ST_POSITIVE_INTEGER = _global.getBuiltinType(SchemaType.BTC_POSITIVE_INTEGER);
+ public static final SchemaTypeImpl ST_UNSIGNED_LONG = _global.getBuiltinType(SchemaType.BTC_UNSIGNED_LONG);
+ public static final SchemaTypeImpl ST_UNSIGNED_INT = _global.getBuiltinType(SchemaType.BTC_UNSIGNED_INT);
+ public static final SchemaTypeImpl ST_UNSIGNED_SHORT = _global.getBuiltinType(SchemaType.BTC_UNSIGNED_SHORT);
+ public static final SchemaTypeImpl ST_UNSIGNED_BYTE = _global.getBuiltinType(SchemaType.BTC_UNSIGNED_BYTE);
+
+ // derived strings
+ public static final SchemaTypeImpl ST_NORMALIZED_STRING = _global.getBuiltinType(SchemaType.BTC_NORMALIZED_STRING);
+ public static final SchemaTypeImpl ST_TOKEN = _global.getBuiltinType(SchemaType.BTC_TOKEN);
+ public static final SchemaTypeImpl ST_NAME = _global.getBuiltinType(SchemaType.BTC_NAME);
+ public static final SchemaTypeImpl ST_NCNAME = _global.getBuiltinType(SchemaType.BTC_NCNAME);
+ public static final SchemaTypeImpl ST_LANGUAGE = _global.getBuiltinType(SchemaType.BTC_LANGUAGE);
+ public static final SchemaTypeImpl ST_ID = _global.getBuiltinType(SchemaType.BTC_ID);
+ public static final SchemaTypeImpl ST_IDREF = _global.getBuiltinType(SchemaType.BTC_IDREF);
+ public static final SchemaTypeImpl ST_IDREFS = _global.getBuiltinType(SchemaType.BTC_IDREFS);
+ public static final SchemaTypeImpl ST_ENTITY = _global.getBuiltinType(SchemaType.BTC_ENTITY);
+ public static final SchemaTypeImpl ST_ENTITIES = _global.getBuiltinType(SchemaType.BTC_ENTITIES);
+ public static final SchemaTypeImpl ST_NMTOKEN = _global.getBuiltinType(SchemaType.BTC_NMTOKEN);
+ public static final SchemaTypeImpl ST_NMTOKENS = _global.getBuiltinType(SchemaType.BTC_NMTOKENS);
+
+ // the no-type
+ public static final SchemaTypeImpl ST_NO_TYPE = _global.getBuiltinType(SchemaType.BTC_NOT_BUILTIN);
+
+ private final static XmlValueRef XMLSTR_PRESERVE = buildString("preserve");
+ private final static XmlValueRef XMLSTR_REPLACE = buildString("preserve");
+ private final static XmlValueRef XMLSTR_COLLAPSE = buildString("preserve");
+
+ private final static XmlValueRef[] FACETS_NONE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ null, null, null };
+
+ private final static boolean[] FIXED_FACETS_NONE = new boolean[]
+ { false, false, false, false, false, false, false, false, false,
+ false, false, false };
+
+ private final static XmlValueRef[] FACETS_WS_COLLAPSE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_WS_REPLACE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ build_wsstring(SchemaType.WS_REPLACE), null, null };
+
+ private final static XmlValueRef[] FACETS_WS_PRESERVE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ build_wsstring(SchemaType.WS_PRESERVE), null, null };
+
+ private final static XmlValueRef[] FACETS_INTEGER = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_LONG = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.valueOf(Long.MIN_VALUE)), buildInteger(BigInteger.valueOf(Long.MAX_VALUE)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_INT = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.valueOf(Integer.MIN_VALUE)), buildInteger(BigInteger.valueOf(Integer.MAX_VALUE)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_SHORT = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.valueOf(Short.MIN_VALUE)), buildInteger(BigInteger.valueOf(Short.MAX_VALUE)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_BYTE = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.valueOf(Byte.MIN_VALUE)), buildInteger(BigInteger.valueOf(Byte.MAX_VALUE)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_NONNEGATIVE = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ZERO), null, null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_POSITIVE = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ONE), null, null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_NONPOSITIVE = new XmlValueRef[]
+ { null, null, null, null, null, buildInteger(BigInteger.ZERO), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_NEGATIVE = new XmlValueRef[]
+ { null, null, null, null, null, buildInteger(BigInteger.ONE.negate()), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_UNSIGNED_LONG = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ZERO), buildInteger(new BigInteger("18446744073709551615")), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_UNSIGNED_INT = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ZERO), buildInteger(BigInteger.valueOf(4294967295L)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_UNSIGNED_SHORT = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ZERO), buildInteger(BigInteger.valueOf(65535)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_UNSIGNED_BYTE = new XmlValueRef[]
+ { null, null, null, null, buildInteger(BigInteger.ZERO), buildInteger(BigInteger.valueOf(255)), null, null, buildNnInteger(BigInteger.ZERO),
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static XmlValueRef[] FACETS_BUILTIN_LIST = new XmlValueRef[]
+ { null, buildNnInteger(BigInteger.ONE), null, null, null, null, null, null, null,
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static boolean[] FIXED_FACETS_WS = new boolean[]
+ { false, false, false, false, false, false, false, false, false,
+ true, false, false };
+
+ private final static boolean[] FIXED_FACETS_INTEGER = new boolean[]
+ { false, false, false, false, false, false, false, false, true,
+ true, false, false };
+
+ final static XmlValueRef[] FACETS_UNION = FACETS_NONE;
+ final static boolean[] FIXED_FACETS_UNION = FIXED_FACETS_NONE;
+
+ final static XmlValueRef[] FACETS_LIST = FACETS_WS_COLLAPSE;
+ final static boolean[] FIXED_FACETS_LIST = FIXED_FACETS_WS;
+
+
+ /*
+ * LAST Static initializer
+ */
+ static {
+ for (int i = SchemaType.BTC_NOT_BUILTIN; i <= SchemaType.BTC_LAST_BUILTIN; i++)
+ {
+ _global.fillInType(i);
+ }
+ }
+
+ private Map _typeMap = new HashMap();
+ private SchemaTypeImpl[] _typeArray = new SchemaTypeImpl[SchemaType.BTC_LAST_BUILTIN + 1];
+ private Map _handlesToObjects = new HashMap();
+ private Map _objectsToHandles = new HashMap();
+ private Map _typesByClassname = new HashMap();
+
+ private SchemaTypeImpl getBuiltinType(int btc)
+ {
+ return _typeArray[btc];
+ }
+
+ private BuiltinSchemaTypeSystem()
+ {
+ // UR types
+ setupBuiltin(SchemaType.BTC_ANY_TYPE, "anyType", "org.apache.xmlbeans.XmlObject");
+ setupBuiltin(SchemaType.BTC_ANY_SIMPLE, "anySimpleType", "org.apache.xmlbeans.XmlAnySimpleType");
+
+ // primitives
+ setupBuiltin(SchemaType.BTC_BOOLEAN, "boolean", "org.apache.xmlbeans.XmlBoolean");
+ setupBuiltin(SchemaType.BTC_BASE_64_BINARY, "base64Binary", "org.apache.xmlbeans.XmlBase64Binary");
+ setupBuiltin(SchemaType.BTC_HEX_BINARY, "hexBinary", "org.apache.xmlbeans.XmlHexBinary");
+ setupBuiltin(SchemaType.BTC_ANY_URI, "anyURI", "org.apache.xmlbeans.XmlAnyURI");
+ setupBuiltin(SchemaType.BTC_QNAME, "QName", "org.apache.xmlbeans.XmlQName");
+ setupBuiltin(SchemaType.BTC_NOTATION, "NOTATION", "org.apache.xmlbeans.XmlNOTATION");
+ setupBuiltin(SchemaType.BTC_FLOAT, "float", "org.apache.xmlbeans.XmlFloat");
+ setupBuiltin(SchemaType.BTC_DOUBLE, "double", "org.apache.xmlbeans.XmlDouble");
+ setupBuiltin(SchemaType.BTC_DECIMAL, "decimal", "org.apache.xmlbeans.XmlDecimal");
+ setupBuiltin(SchemaType.BTC_STRING, "string", "org.apache.xmlbeans.XmlString");
+
+ setupBuiltin(SchemaType.BTC_DURATION, "duration", "org.apache.xmlbeans.XmlDuration");
+ setupBuiltin(SchemaType.BTC_DATE_TIME, "dateTime", "org.apache.xmlbeans.XmlDateTime");
+ setupBuiltin(SchemaType.BTC_TIME, "time", "org.apache.xmlbeans.XmlTime");
+ setupBuiltin(SchemaType.BTC_DATE, "date", "org.apache.xmlbeans.XmlDate");
+ setupBuiltin(SchemaType.BTC_G_YEAR_MONTH, "gYearMonth", "org.apache.xmlbeans.XmlGYearMonth");
+ setupBuiltin(SchemaType.BTC_G_YEAR, "gYear", "org.apache.xmlbeans.XmlGYear");
+ setupBuiltin(SchemaType.BTC_G_MONTH_DAY, "gMonthDay", "org.apache.xmlbeans.XmlGMonthDay");
+ setupBuiltin(SchemaType.BTC_G_DAY, "gDay", "org.apache.xmlbeans.XmlGDay");
+ setupBuiltin(SchemaType.BTC_G_MONTH, "gMonth", "org.apache.xmlbeans.XmlGMonth");
+
+ // derived numerics
+ setupBuiltin(SchemaType.BTC_INTEGER, "integer", "org.apache.xmlbeans.XmlInteger");
+ setupBuiltin(SchemaType.BTC_LONG, "long", "org.apache.xmlbeans.XmlLong");
+ setupBuiltin(SchemaType.BTC_INT, "int", "org.apache.xmlbeans.XmlInt");
+ setupBuiltin(SchemaType.BTC_SHORT, "short", "org.apache.xmlbeans.XmlShort");
+ setupBuiltin(SchemaType.BTC_BYTE, "byte", "org.apache.xmlbeans.XmlByte");
+ setupBuiltin(SchemaType.BTC_NON_POSITIVE_INTEGER, "nonPositiveInteger", "org.apache.xmlbeans.XmlNonPositiveInteger");
+ setupBuiltin(SchemaType.BTC_NEGATIVE_INTEGER, "negativeInteger", "org.apache.xmlbeans.XmlNegativeInteger");
+ setupBuiltin(SchemaType.BTC_NON_NEGATIVE_INTEGER, "nonNegativeInteger", "org.apache.xmlbeans.XmlNonNegativeInteger");
+ setupBuiltin(SchemaType.BTC_POSITIVE_INTEGER, "positiveInteger", "org.apache.xmlbeans.XmlPositiveInteger");
+ setupBuiltin(SchemaType.BTC_UNSIGNED_LONG, "unsignedLong", "org.apache.xmlbeans.XmlUnsignedLong");
+ setupBuiltin(SchemaType.BTC_UNSIGNED_INT, "unsignedInt", "org.apache.xmlbeans.XmlUnsignedInt");
+ setupBuiltin(SchemaType.BTC_UNSIGNED_SHORT, "unsignedShort", "org.apache.xmlbeans.XmlUnsignedShort");
+ setupBuiltin(SchemaType.BTC_UNSIGNED_BYTE, "unsignedByte", "org.apache.xmlbeans.XmlUnsignedByte");
+
+ // derived strings
+ setupBuiltin(SchemaType.BTC_NORMALIZED_STRING, "normalizedString", "org.apache.xmlbeans.XmlNormalizedString");
+ setupBuiltin(SchemaType.BTC_TOKEN, "token", "org.apache.xmlbeans.XmlToken");
+ setupBuiltin(SchemaType.BTC_NAME, "Name", "org.apache.xmlbeans.XmlName");
+ setupBuiltin(SchemaType.BTC_NCNAME, "NCName", "org.apache.xmlbeans.XmlNCName");
+ setupBuiltin(SchemaType.BTC_LANGUAGE, "language", "org.apache.xmlbeans.XmlLanguage");
+ setupBuiltin(SchemaType.BTC_ID, "ID", "org.apache.xmlbeans.XmlID");
+ setupBuiltin(SchemaType.BTC_IDREF, "IDREF", "org.apache.xmlbeans.XmlIDREF");
+ setupBuiltin(SchemaType.BTC_IDREFS, "IDREFS", "org.apache.xmlbeans.XmlIDREFS");
+ setupBuiltin(SchemaType.BTC_ENTITY, "ENTITY", "org.apache.xmlbeans.XmlENTITY");
+ setupBuiltin(SchemaType.BTC_ENTITIES, "ENTITIES", "org.apache.xmlbeans.XmlENTITIES");
+ setupBuiltin(SchemaType.BTC_NMTOKEN, "NMTOKEN", "org.apache.xmlbeans.XmlNMTOKEN");
+ setupBuiltin(SchemaType.BTC_NMTOKENS, "NMTOKENS", "org.apache.xmlbeans.XmlNMTOKENS");
+
+ // the no-type
+ setupBuiltin(SchemaType.BTC_NOT_BUILTIN, null, null);
+ }
+
+
+ /**
+ * Returns the name of this loader.
+ */
+ public String getName()
+ {
+ return "schema.typesystem.builtin";
+ }
+
+ public boolean isNamespaceDefined(String namespace)
+ {
+ return namespace.equals("http://www.w3.org/2001/XMLSchema");
+ }
+
+ public SchemaType findType(QName name)
+ {
+ return (SchemaType)_typeMap.get(name);
+ }
+
+
+ public SchemaType findDocumentType(QName name)
+ {
+ return null;
+ }
+
+ public SchemaType findAttributeType(QName name)
+ {
+ return null;
+ }
+
+ public SchemaGlobalElement findElement(QName name)
+ {
+ return null;
+ }
+
+ public SchemaGlobalAttribute findAttribute(QName name)
+ {
+ return null;
+ }
+
+ public SchemaType.Ref findTypeRef(QName name)
+ {
+ SchemaType type = findType(name);
+ return (type == null ? null : type.getRef());
+ }
+
+ public SchemaType.Ref findDocumentTypeRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaType.Ref findAttributeTypeRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaGlobalElement.Ref findElementRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaGlobalAttribute.Ref findAttributeRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaModelGroup.Ref findModelGroupRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaAttributeGroup.Ref findAttributeGroupRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaIdentityConstraint.Ref findIdentityConstraintRef(QName name)
+ {
+ return null;
+ }
+
+ public SchemaType typeForClassname(String classname)
+ {
+ return (SchemaType)_typesByClassname.get(classname);
+ }
+
+ public InputStream getSourceAsStream(String sourceName)
+ {
+ return null; // builtin schema type system has no source.
+ }
+
+ /**
+ * Returns the global types defined in this loader.
+ */
+ public SchemaType[] globalTypes()
+ {
+ SchemaType[] result = new SchemaType[_typeArray.length - 1];
+ System.arraycopy(_typeArray, 1, result, 0, result.length);
+ return result;
+ }
+
+ /**
+ * Returns the document types defined in this loader.
+ */
+ public SchemaType[] documentTypes()
+ {
+ return EMPTY_SCHEMATYPE_ARRAY;
+ }
+
+ /**
+ * Returns the attribute types defined in this loader.
+ */
+ public SchemaType[] attributeTypes()
+ {
+ return EMPTY_SCHEMATYPE_ARRAY;
+ }
+
+ /**
+ * Returns the global elements defined in this loader.
+ */
+ public SchemaGlobalElement[] globalElements()
+ {
+ return EMPTY_SCHEMAELEMENT_ARRAY;
+ }
+
+ /**
+ * Returns the global attributes defined in this loader.
+ */
+ public SchemaGlobalAttribute[] globalAttributes()
+ {
+ return EMPTY_SCHEMAATTRIBUTE_ARRAY;
+ }
+
+ /**
+ * Returns the model groups defined in this loader.
+ */
+ public SchemaModelGroup[] modelGroups()
+ {
+ return EMPTY_SCHEMAMODELGROUP_ARRAY;
+ }
+
+ /**
+ * Returns the attribute groups defined in this loader.
+ */
+ public SchemaAttributeGroup[] attributeGroups()
+ {
+ return EMPTY_SCHEMAATTRIBUTEGROUP_ARRAY;
+ }
+
+ /**
+ * Returns the handle for the given type within this loader.
+ */
+ public String handleForType(SchemaType type)
+ {
+ return (String)_objectsToHandles.get(type);
+ }
+
+ /**
+ * Returns the classloader used by this loader for resolving types.
+ */
+ public ClassLoader getClassLoader()
+ {
+ return BuiltinSchemaTypeSystem.class.getClassLoader();
+ }
+
+ /**
+ * Saves this type to a directory.
+ */
+ public void saveToDirectory(File classDir)
+ {
+ throw new UnsupportedOperationException("The builtin schema type system cannot be saved.");
+ }
+
+ private static XmlValueRef build_wsstring(int wsr)
+ {
+ switch (wsr)
+ {
+ case SchemaType.WS_PRESERVE:
+ return XMLSTR_PRESERVE;
+ case SchemaType.WS_REPLACE:
+ return XMLSTR_REPLACE;
+ case SchemaType.WS_COLLAPSE:
+ return XMLSTR_COLLAPSE;
+ }
+ return null;
+ }
+
+ private static XmlValueRef buildNnInteger(BigInteger bigInt)
+ {
+ if (bigInt == null)
+ return null;
+ if (bigInt.signum() < 0)
+ return null;
+ try
+ {
+ XmlIntegerImpl i = new XmlIntegerImpl();
+ i.set(bigInt);
+ i.setImmutable();
+ return new XmlValueRef(i);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ return null;
+ }
+ }
+
+ private static XmlValueRef buildInteger(BigInteger bigInt)
+ {
+ if (bigInt == null)
+ return null;
+ try
+ {
+ XmlIntegerImpl i = new XmlIntegerImpl();
+ i.set(bigInt);
+ i.setImmutable();
+ return new XmlValueRef(i);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ return null;
+ }
+ }
+
+ private static XmlValueRef buildString(String str)
+ {
+ if (str == null)
+ return null;
+
+ try
+ {
+ XmlStringImpl i = new XmlStringImpl();
+ i.set(str);
+ i.setImmutable();
+ return new XmlValueRef(i);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ return null;
+ }
+ }
+
+ private void setupBuiltin(int btc, String localname, String classname)
+ {
+ SchemaTypeImpl result = new SchemaTypeImpl(this, true);
+ QName name = localname == null ? null : QNameHelper.forLNS(localname, "http://www.w3.org/2001/XMLSchema");
+ String handle = "_BI_" + (localname == null ? "NO_TYPE" : localname);
+ result.setName(name);
+ result.setBuiltinTypeCode(btc);
+ if (classname != null)
+ result.setFullJavaName(classname);
+
+ _typeArray[btc] = result;
+ _typeMap.put(name, result);
+ _handlesToObjects.put(handle, result);
+ _objectsToHandles.put(result, handle);
+ if (classname != null)
+ _typesByClassname.put(classname, result);
+ }
+
+ public void resolve()
+ {
+ // we're born resolved and don't need to do anything.
+ }
+
+ public SchemaType typeForHandle(String handle)
+ {
+ return (SchemaType)_handlesToObjects.get(handle);
+ }
+
+ public SchemaComponent resolveHandle(String handle)
+ {
+ return (SchemaComponent)_handlesToObjects.get(handle);
+ }
+
+ /**
+ * Links a type.
+ */
+ public void fillInType(int btc)
+ {
+ SchemaTypeImpl result = getBuiltinType(btc);
+ SchemaType base;
+ SchemaType item = null;
+ int variety = SchemaType.ATOMIC;
+ int derivationType = SchemaType.DT_RESTRICTION;
+
+ switch (btc)
+ {
+ case SchemaType.BTC_NOT_BUILTIN:
+ variety = SchemaType.NOT_SIMPLE;
+ base = ST_ANY_TYPE;
+ break;
+
+ case SchemaType.BTC_ANY_TYPE:
+ variety = SchemaType.NOT_SIMPLE;
+ base = null;
+ derivationType = SchemaType.DT_RESTRICTION;
+ break;
+
+ default:
+ assert(false);
+
+ case SchemaType.BTC_ANY_SIMPLE:
+ base = ST_ANY_TYPE; break;
+
+ case SchemaType.BTC_BOOLEAN:
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ base = ST_ANY_SIMPLE; break;
+
+ // derived numerics
+ case SchemaType.BTC_INTEGER:
+ base = ST_DECIMAL; break;
+
+ case SchemaType.BTC_LONG:
+ base = ST_INTEGER; break;
+
+ case SchemaType.BTC_INT:
+ base = ST_LONG; break;
+
+ case SchemaType.BTC_SHORT:
+ base = ST_INT; break;
+
+ case SchemaType.BTC_BYTE:
+ base = ST_SHORT; break;
+
+ case SchemaType.BTC_NON_POSITIVE_INTEGER:
+ base = ST_INTEGER; break;
+
+ case SchemaType.BTC_NEGATIVE_INTEGER:
+ base = ST_NON_POSITIVE_INTEGER; break;
+
+ case SchemaType.BTC_NON_NEGATIVE_INTEGER:
+ base = ST_INTEGER; break;
+
+ case SchemaType.BTC_POSITIVE_INTEGER:
+ base = ST_NON_NEGATIVE_INTEGER; break;
+
+ case SchemaType.BTC_UNSIGNED_LONG:
+ base = ST_NON_NEGATIVE_INTEGER; break;
+
+ case SchemaType.BTC_UNSIGNED_INT:
+ base = ST_UNSIGNED_LONG; break;
+
+ case SchemaType.BTC_UNSIGNED_SHORT:
+ base = ST_UNSIGNED_INT; break;
+
+ case SchemaType.BTC_UNSIGNED_BYTE:
+ base = ST_UNSIGNED_SHORT; break;
+
+ // derived strings
+ case SchemaType.BTC_NORMALIZED_STRING:
+ base = ST_STRING; break;
+
+ case SchemaType.BTC_TOKEN:
+ base = ST_NORMALIZED_STRING; break;
+
+ case SchemaType.BTC_NAME:
+ base = ST_TOKEN; break;
+
+ case SchemaType.BTC_NCNAME:
+ base = ST_NAME; break;
+
+ case SchemaType.BTC_ID:
+ case SchemaType.BTC_IDREF:
+ case SchemaType.BTC_ENTITY:
+ base = ST_NCNAME; break;
+
+ case SchemaType.BTC_LANGUAGE:
+ case SchemaType.BTC_NMTOKEN:
+ base = ST_TOKEN; break;
+
+ case SchemaType.BTC_IDREFS:
+ case SchemaType.BTC_ENTITIES:
+ case SchemaType.BTC_NMTOKENS:
+ variety = SchemaType.LIST;
+ base = ST_ANY_SIMPLE;
+ if (btc == SchemaType.BTC_IDREFS)
+ item = ST_IDREF;
+ else if (btc == SchemaType.BTC_ENTITIES)
+ item = ST_ENTITY;
+ else
+ item = ST_NMTOKEN;
+ break;
+ }
+
+ result.setDerivationType(derivationType);
+ result.setSimpleTypeVariety(variety);
+ if (variety != SchemaType.NOT_SIMPLE)
+ {
+ result.setSimpleType(true);
+ }
+ else
+ {
+ assert (btc == SchemaType.BTC_ANY_TYPE || btc == SchemaType.BTC_NOT_BUILTIN);
+ }
+ result.setBaseTypeRef(base == null ? null : base.getRef());
+ result.setBaseDepth(base == null ? 0 : ((SchemaTypeImpl)base).getBaseDepth() + 1);
+ result.setListItemTypeRef(item == null ? null : item.getRef());
+ if (btc >= SchemaType.BTC_FIRST_PRIMITIVE && btc <= SchemaType.BTC_LAST_PRIMITIVE)
+ result.setPrimitiveTypeRef(result.getRef());
+ else if (variety == SchemaType.ATOMIC)
+ {
+ if (base == null)
+ throw new IllegalStateException("Base was null for " + btc);
+ if (base.getPrimitiveType() == null)
+ throw new IllegalStateException("Base.gpt was null for " + btc);
+ result.setPrimitiveTypeRef(base.getPrimitiveType().getRef());
+ }
+
+ XmlValueRef[] facets;
+ boolean[] fixedf;
+ int wsr = SchemaType.WS_COLLAPSE;
+ int decimalSize = SchemaType.NOT_DECIMAL;
+
+ // now set up facets
+ switch (btc)
+ {
+ default:
+ assert(false);
+
+ case SchemaType.BTC_ANY_TYPE:
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_NOT_BUILTIN:
+ facets = FACETS_NONE;
+ fixedf = FIXED_FACETS_NONE;
+ wsr = SchemaType.WS_UNSPECIFIED;
+ break;
+
+ case SchemaType.BTC_STRING:
+ facets = FACETS_WS_PRESERVE;
+ fixedf = FIXED_FACETS_NONE;
+ wsr = SchemaType.WS_PRESERVE;
+ break;
+
+ case SchemaType.BTC_BOOLEAN:
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ facets = FACETS_WS_COLLAPSE;
+ fixedf = FIXED_FACETS_WS;
+ break;
+
+ case SchemaType.BTC_DECIMAL:
+ facets = FACETS_WS_COLLAPSE;
+ fixedf = FIXED_FACETS_WS;
+ decimalSize = SchemaType.SIZE_BIG_DECIMAL;
+ break;
+
+ // derived numerics
+ case SchemaType.BTC_INTEGER:
+ facets = FACETS_INTEGER;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_LONG:
+ facets = FACETS_LONG;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_LONG;
+ break;
+
+ case SchemaType.BTC_INT:
+ facets = FACETS_INT;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_INT;
+ break;
+
+ case SchemaType.BTC_SHORT:
+ facets = FACETS_SHORT;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_SHORT;
+ break;
+
+ case SchemaType.BTC_BYTE:
+ facets = FACETS_BYTE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BYTE;
+ break;
+
+ case SchemaType.BTC_NON_POSITIVE_INTEGER:
+ facets = FACETS_NONPOSITIVE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_NEGATIVE_INTEGER:
+ facets = FACETS_NEGATIVE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_NON_NEGATIVE_INTEGER:
+ facets = FACETS_NONNEGATIVE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_POSITIVE_INTEGER:
+ facets = FACETS_POSITIVE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_UNSIGNED_LONG:
+ facets = FACETS_UNSIGNED_LONG;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_BIG_INTEGER;
+ break;
+
+ case SchemaType.BTC_UNSIGNED_INT:
+ facets = FACETS_UNSIGNED_INT;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_LONG;
+ break;
+
+ case SchemaType.BTC_UNSIGNED_SHORT:
+ facets = FACETS_UNSIGNED_SHORT;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_INT;
+ break;
+
+ case SchemaType.BTC_UNSIGNED_BYTE:
+ facets = FACETS_UNSIGNED_BYTE;
+ fixedf = FIXED_FACETS_INTEGER;
+ decimalSize = SchemaType.SIZE_SHORT;
+ break;
+
+
+ // derived strings
+ case SchemaType.BTC_NORMALIZED_STRING:
+ facets = FACETS_WS_REPLACE;
+ fixedf = FIXED_FACETS_NONE;
+ wsr = SchemaType.WS_REPLACE;
+ break;
+
+ case SchemaType.BTC_TOKEN:
+ case SchemaType.BTC_NAME:
+ case SchemaType.BTC_NCNAME:
+ case SchemaType.BTC_LANGUAGE:
+ case SchemaType.BTC_ID:
+ case SchemaType.BTC_IDREF:
+ case SchemaType.BTC_IDREFS:
+ case SchemaType.BTC_ENTITY:
+ case SchemaType.BTC_NMTOKEN:
+ facets = FACETS_WS_COLLAPSE;
+ fixedf = FIXED_FACETS_NONE;
+ wsr = SchemaType.WS_COLLAPSE;
+ break;
+
+ case SchemaType.BTC_ENTITIES:
+ case SchemaType.BTC_NMTOKENS:
+ facets = FACETS_BUILTIN_LIST;
+ fixedf = FIXED_FACETS_NONE;
+ wsr = SchemaType.WS_UNSPECIFIED;
+ break;
+ }
+
+ // fundamental facets
+ int ordered = SchemaType.UNORDERED;
+ boolean isNumeric = false;
+ boolean isFinite = false;
+ boolean isBounded = false;
+
+ switch (btc)
+ {
+ default:
+ assert(false);
+
+ case SchemaType.BTC_ANY_TYPE:
+ case SchemaType.BTC_NOT_BUILTIN:
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_NORMALIZED_STRING:
+ case SchemaType.BTC_TOKEN:
+ case SchemaType.BTC_NAME:
+ case SchemaType.BTC_NCNAME:
+ case SchemaType.BTC_LANGUAGE:
+ case SchemaType.BTC_ID:
+ case SchemaType.BTC_IDREF:
+ case SchemaType.BTC_IDREFS:
+ case SchemaType.BTC_ENTITY:
+ case SchemaType.BTC_NMTOKEN:
+ case SchemaType.BTC_ENTITIES:
+ case SchemaType.BTC_NMTOKENS:
+ break;
+
+ case SchemaType.BTC_BOOLEAN:
+ isFinite = true;
+ break;
+
+
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_INTEGER:
+ isNumeric = true;
+ ordered = SchemaType.TOTAL_ORDER;
+ break;
+
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ ordered = SchemaType.PARTIAL_ORDER;
+ break;
+
+ case SchemaType.BTC_LONG:
+ case SchemaType.BTC_INT:
+ case SchemaType.BTC_SHORT:
+ case SchemaType.BTC_BYTE:
+ case SchemaType.BTC_NON_POSITIVE_INTEGER:
+ case SchemaType.BTC_NEGATIVE_INTEGER:
+ case SchemaType.BTC_NON_NEGATIVE_INTEGER:
+ case SchemaType.BTC_POSITIVE_INTEGER:
+ case SchemaType.BTC_UNSIGNED_LONG:
+ case SchemaType.BTC_UNSIGNED_INT:
+ case SchemaType.BTC_UNSIGNED_SHORT:
+ case SchemaType.BTC_UNSIGNED_BYTE:
+ isNumeric = true;
+ ordered = SchemaType.TOTAL_ORDER;
+ isFinite = true;
+ isBounded = true;
+ break;
+ }
+
+ result.setBasicFacets(facets, fixedf);
+ result.setWhiteSpaceRule(wsr);
+ result.setOrdered(ordered);
+ result.setBounded(isBounded);
+ result.setNumeric(isNumeric);
+ result.setFinite(isFinite);
+ result.setDecimalSize(decimalSize);
+ result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
+
+ // TODO: set up patterns for NCNAME, language, etc.
+
+ String pattern = null;
+ boolean hasPattern = false;
+
+ switch (btc)
+ {
+ case SchemaType.BTC_LANGUAGE:
+ pattern = "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"; // we used to have ([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*", but s4s uses the more lenient pattern to the left.
+ hasPattern = true;
+ break;
+ case SchemaType.BTC_NMTOKEN:
+ pattern = "\\c+";
+ hasPattern = true;
+ break;
+ case SchemaType.BTC_NAME:
+ pattern = "\\i\\c*";
+ hasPattern = true;
+ break;
+ case SchemaType.BTC_NCNAME:
+ pattern = "[\\i-[:]][\\c-[:]]*";
+ hasPattern = true;
+ break;
+
+ // These types inherit their patterns
+ case SchemaType.BTC_ID:
+ case SchemaType.BTC_IDREF:
+ case SchemaType.BTC_ENTITY:
+ hasPattern = true;
+ break;
+ }
+
+ if (pattern != null)
+ {
+ org.apache.xmlbeans.impl.regex.RegularExpression p = null;
+ try { p = org.apache.xmlbeans.impl.regex.SchemaRegularExpression.forPattern(pattern); }
+ catch (org.apache.xmlbeans.impl.regex.ParseException e) { assert false; }
+ result.setPatterns(new org.apache.xmlbeans.impl.regex.RegularExpression[] {p});
+ }
+ result.setPatternFacet(hasPattern);
+
+
+
+ // ANY_TYPE has to be able to act like a complex type
+ if (btc == SchemaType.BTC_ANY_TYPE)
+ {
+ SchemaParticleImpl contentModel = new SchemaParticleImpl();
+ contentModel.setParticleType(SchemaParticle.WILDCARD);
+ contentModel.setWildcardSet(QNameSet.ALL);
+ contentModel.setWildcardProcess(SchemaParticle.LAX);
+ contentModel.setMinOccurs(BigInteger.ZERO);
+ contentModel.setMaxOccurs(null);
+ contentModel.setTransitionRules(QNameSet.ALL, true);
+ contentModel.setTransitionNotes(QNameSet.ALL, true);
+
+ SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl();
+ attrModel.setWildcardProcess(SchemaAttributeModel.LAX);
+ attrModel.setWildcardSet(QNameSet.ALL);
+
+ result.setComplexTypeVariety(SchemaType.MIXED_CONTENT);
+ result.setContentModel(contentModel, attrModel, Collections.EMPTY_MAP, Collections.EMPTY_MAP, false);
+ result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
+ result.setWildcardSummary(QNameSet.ALL, true, QNameSet.ALL, true);
+ }
+ else if (btc == SchemaType.BTC_NOT_BUILTIN)
+ {
+ // so does the no_type : it permits no contents (and even empty contents is invalid, but that's special-cased)
+ SchemaParticleImpl contentModel = null; // empty
+ SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl(); // empty
+ result.setComplexTypeVariety(SchemaType.EMPTY_CONTENT);
+ result.setContentModel(contentModel, attrModel, Collections.EMPTY_MAP, Collections.EMPTY_MAP, false);
+ result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
+ result.setWildcardSummary(QNameSet.EMPTY, false, QNameSet.EMPTY, false);
+ }
+
+ result.setOrderSensitive(false);
+ }
+
+ public static SchemaType getNoType()
+ {
+ return ST_NO_TYPE;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ClassLoaderResourceLoader.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ClassLoaderResourceLoader.java
new file mode 100644
index 0000000..32be2a4
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ClassLoaderResourceLoader.java
@@ -0,0 +1,35 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.io.InputStream;
+
+public class ClassLoaderResourceLoader implements ResourceLoader
+{
+ ClassLoader _classLoader;
+
+ ClassLoaderResourceLoader(ClassLoader classLoader)
+ {
+ _classLoader = classLoader;
+ }
+
+ public InputStream getResourceAsStream(String resourceName)
+ {
+ return _classLoader.getResourceAsStream(resourceName);
+ }
+
+ public void close() {}
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/FileResourceLoader.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/FileResourceLoader.java
new file mode 100644
index 0000000..314acda
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/FileResourceLoader.java
@@ -0,0 +1,78 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+
+public class FileResourceLoader implements ResourceLoader
+{
+ private File _directory;
+ private ZipFile _zipfile;
+
+ public FileResourceLoader(File file) throws IOException
+ {
+ if (file.isDirectory())
+ _directory = file;
+ else
+ {
+ _zipfile = new ZipFile(file);
+ }
+ }
+
+ public InputStream getResourceAsStream(String resourceName)
+ {
+ try
+ {
+ if (_zipfile != null)
+ {
+ ZipEntry entry = _zipfile.getEntry(resourceName);
+ if (entry == null)
+ return null;
+ return _zipfile.getInputStream(entry);
+ }
+ else
+ {
+ return new FileInputStream(new File(_directory, resourceName));
+ }
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ }
+
+ public void close()
+ {
+ if (_zipfile != null)
+ {
+ try
+ {
+ _zipfile.close();
+ }
+ catch (IOException e)
+ {
+ // oh well.
+ }
+ _zipfile = null;
+ }
+ }
+}
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/PathResourceLoader.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/PathResourceLoader.java
new file mode 100644
index 0000000..526d891
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/PathResourceLoader.java
@@ -0,0 +1,77 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.io.InputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PathResourceLoader implements ResourceLoader
+{
+ private ResourceLoader[] _path;
+
+ public PathResourceLoader(ResourceLoader[] loaderpath) throws IOException
+ {
+ _path = new ResourceLoader[loaderpath.length];
+ System.arraycopy(loaderpath, 0, _path, 0, _path.length);
+ }
+
+ public PathResourceLoader(File[] filepath)
+ {
+ List pathlist = new ArrayList();
+ for (int i = 0; i < filepath.length; i++)
+ {
+ try
+ {
+ ResourceLoader path = new FileResourceLoader(filepath[i]);
+ pathlist.add(path);
+ }
+ catch (IOException e)
+ {
+ continue; // can't read a file on classpath? skip it.
+ }
+ }
+ _path = (ResourceLoader[])pathlist.toArray(new ResourceLoader[pathlist.size()]);
+ }
+
+ public InputStream getResourceAsStream(String resourceName)
+ {
+ for (int i = 0; i < _path.length; i++)
+ {
+ InputStream result = _path[i].getResourceAsStream(resourceName);
+ if (result != null)
+ return result;
+ }
+ return null;
+ }
+
+ public void close()
+ {
+ for (int i = 0; i < _path.length; i++)
+ {
+ try
+ {
+ _path[i].close();
+ }
+ catch (Exception e)
+ {
+ // oh well.
+ }
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ResourceLoader.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ResourceLoader.java
new file mode 100644
index 0000000..6f5ab27
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/ResourceLoader.java
@@ -0,0 +1,24 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.io.InputStream;
+
+public interface ResourceLoader
+{
+ InputStream getResourceAsStream(String resourceName);
+ void close();
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeGroupImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeGroupImpl.java
new file mode 100644
index 0000000..973fe14
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeGroupImpl.java
@@ -0,0 +1,85 @@
+/* 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.xmlbeans.impl.schema;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaTypeSystem;
+
+public class SchemaAttributeGroupImpl implements SchemaAttributeGroup
+{
+ private SchemaTypeSystem _typeSystem;
+ private QName _name;
+ private XmlObject _parseObject;
+ private String _parseTNS;
+ private boolean _chameleon;
+ private boolean _redefinition;
+
+ public SchemaAttributeGroupImpl(SchemaTypeSystem typeSystem)
+ {
+ _typeSystem = typeSystem;
+ }
+
+ public SchemaAttributeGroupImpl(SchemaTypeSystem typeSystem, QName name)
+ {
+ this(typeSystem);
+ _name = name;
+ }
+
+ public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x)
+ {
+ assert _name == null || name.equals( _name );
+
+ _name = name;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ _redefinition = redefinition;
+ _parseObject = x;
+ }
+
+ public SchemaTypeSystem getTypeSystem()
+ {
+ return _typeSystem;
+ }
+
+ public int getComponentType()
+ { return SchemaComponent.ATTRIBUTE_GROUP; }
+
+ public QName getName()
+ { return _name; }
+
+ public XmlObject getParseObject()
+ { return _parseObject; }
+
+ public String getTargetNamespace()
+ { return _parseTNS; }
+
+ public String getChameleonNamespace()
+ { return _chameleon ? _parseTNS : null; }
+
+ private SchemaAttributeGroup.Ref _selfref = new SchemaAttributeGroup.Ref(this);
+
+ public SchemaAttributeGroup.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+
+ public boolean isRedefinition()
+ { return _redefinition; }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeModelImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeModelImpl.java
new file mode 100644
index 0000000..f1febba
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeModelImpl.java
@@ -0,0 +1,110 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.QNameSetBuilder;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import javax.xml.namespace.QName;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+public class SchemaAttributeModelImpl implements SchemaAttributeModel
+{
+ private Map attrMap;
+ private QNameSet wcSet;
+ private int wcProcess;
+
+ public SchemaAttributeModelImpl()
+ {
+ attrMap = new LinkedHashMap();
+ wcSet = null;
+ wcProcess = NONE;
+ }
+
+ public SchemaAttributeModelImpl(SchemaAttributeModel sam)
+ {
+ attrMap = new LinkedHashMap();
+ if (sam == null)
+ {
+ wcSet = null;
+ wcProcess = NONE;
+ }
+ else
+ {
+ SchemaLocalAttribute[] attrs = sam.getAttributes();
+ for (int i = 0; i < attrs.length; i++)
+ {
+ attrMap.put(attrs[i].getName(), attrs[i]);
+ }
+
+ if (sam.getWildcardProcess() != SchemaAttributeModel.NONE)
+ {
+ wcSet = sam.getWildcardSet();
+ wcProcess = sam.getWildcardProcess();
+ }
+ }
+ }
+
+ private static final SchemaLocalAttribute[] EMPTY_SLA_ARRAY = new SchemaLocalAttribute[0];
+
+ public SchemaLocalAttribute[] getAttributes()
+ {
+ if (attrMap.values().size() == 0)
+ return EMPTY_SLA_ARRAY;
+
+ SchemaLocalAttribute[] data = new SchemaLocalAttribute[attrMap.values().size()];
+ return (SchemaLocalAttribute[])attrMap.values().toArray(data);
+ }
+
+ public SchemaLocalAttribute getAttribute(QName name)
+ {
+ return (SchemaLocalAttribute)attrMap.get(name);
+ }
+
+ public void addAttribute(SchemaLocalAttribute attruse)
+ {
+ attrMap.put(attruse.getName(), attruse);
+ }
+
+ public void removeProhibitedAttribute(QName name)
+ {
+ attrMap.remove(name);
+ }
+
+ public QNameSet getWildcardSet()
+ {
+ return wcSet == null ? QNameSet.EMPTY : wcSet;
+ }
+
+ public void setWildcardSet(QNameSet set)
+ {
+ wcSet = set;
+ }
+
+ public int getWildcardProcess()
+ {
+ return wcProcess;
+ }
+
+ public void setWildcardProcess(int proc)
+ {
+ wcProcess = proc;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalAttributeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalAttributeImpl.java
new file mode 100644
index 0000000..4015016
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalAttributeImpl.java
@@ -0,0 +1,80 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlObject;
+
+public class SchemaGlobalAttributeImpl extends SchemaLocalAttributeImpl
+ implements SchemaGlobalAttribute
+{
+ SchemaTypeSystem _typeSystem;
+ String _filename;
+ private String _parseTNS;
+ private boolean _chameleon;
+
+ public SchemaGlobalAttributeImpl(SchemaTypeSystem typeSystem)
+ {
+ _typeSystem = typeSystem;
+ }
+
+ public SchemaTypeSystem getTypeSystem()
+ {
+ return _typeSystem;
+ }
+
+
+ public int getComponentType()
+ {
+ return SchemaComponent.ATTRIBUTE;
+ }
+
+ public String getSourceName()
+ {
+ return _filename;
+ }
+
+ public void setFilename(String filename)
+ {
+ _filename = filename;
+ }
+
+ public void setParseContext(XmlObject parseObject, String targetNamespace, boolean chameleon)
+ {
+ _parseObject = parseObject;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ }
+
+ public XmlObject getParseObject()
+ { return _parseObject; }
+
+ public String getTargetNamespace()
+ { return _parseTNS; }
+
+ public String getChameleonNamespace()
+ { return _chameleon ? _parseTNS : null; }
+
+ private SchemaGlobalAttribute.Ref _selfref = new SchemaGlobalAttribute.Ref(this);
+
+ public SchemaGlobalAttribute.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalElementImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalElementImpl.java
new file mode 100644
index 0000000..02db289
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaGlobalElementImpl.java
@@ -0,0 +1,127 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlObject;
+import javax.xml.namespace.QName;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public class SchemaGlobalElementImpl extends SchemaLocalElementImpl
+ implements SchemaGlobalElement
+{
+ private static final QName[] EMPTY_QNAME_ARRAY = new QName[0];
+ private Set _sgMembers = new LinkedHashSet();
+ private boolean _finalExt;
+ private boolean _finalRest;
+ private SchemaTypeSystem _typeSystem;
+ private String _filename;
+ // private XmlObject _parseObject; now inherited from base
+ private String _parseTNS;
+ private boolean _chameleon;
+ private SchemaGlobalElement.Ref _sg;
+
+ public SchemaGlobalElementImpl(SchemaTypeSystem typeSystem)
+ {
+ _typeSystem = typeSystem;
+ }
+
+ public SchemaTypeSystem getTypeSystem()
+ {
+ return _typeSystem;
+ }
+
+ public String getSourceName()
+ {
+ return _filename;
+ }
+
+ public void setFilename(String filename)
+ {
+ _filename = filename;
+ }
+
+ void setFinal(boolean finalExt, boolean finalRest)
+ {
+ mutate(); _finalExt = finalExt; _finalRest = finalRest;
+ }
+
+ public int getComponentType()
+ {
+ return SchemaComponent.ELEMENT;
+ }
+
+ public SchemaGlobalElement substitutionGroup()
+ {
+ return _sg == null ? null : _sg.get();
+ }
+
+ public void setSubstitutionGroup(SchemaGlobalElement.Ref sg)
+ {
+ _sg = sg;
+ }
+
+ public QName[] substitutionGroupMembers()
+ {
+ if (_sgMembers.size() == 0)
+ return EMPTY_QNAME_ARRAY;
+ return (QName[])_sgMembers.toArray(new QName[_sgMembers.size()]);
+ }
+
+ public void addSubstitutionGroupMember(QName name)
+ {
+ mutate(); _sgMembers.add(name);
+ }
+
+
+ public boolean finalExtension()
+ {
+ return _finalExt;
+ }
+
+ public boolean finalRestriction()
+ {
+ return _finalRest;
+ }
+
+ public void setParseContext(XmlObject parseObject, String targetNamespace, boolean chameleon)
+ {
+ _parseObject = parseObject;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ }
+
+ public XmlObject getParseObject()
+ { return _parseObject; }
+
+ public String getTargetNamespace()
+ { return _parseTNS; }
+
+ public String getChameleonNamespace()
+ { return _chameleon ? _parseTNS : null; }
+
+ private SchemaGlobalElement.Ref _selfref = new SchemaGlobalElement.Ref(this);
+
+ public SchemaGlobalElement.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaIdentityConstraintImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaIdentityConstraintImpl.java
new file mode 100644
index 0000000..f073367
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaIdentityConstraintImpl.java
@@ -0,0 +1,182 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.XPath;
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.Collections;
+
+public class SchemaIdentityConstraintImpl implements SchemaIdentityConstraint
+{
+ private SchemaTypeSystem _typeSystem;
+ private String _selector;
+ private String[] _fields;
+ private SchemaIdentityConstraint.Ref _key;
+ private QName _name;
+ private int _type;
+ private XmlObject _parse;
+ private Map _nsMap = Collections.EMPTY_MAP;
+ private String _parseTNS;
+ private boolean _chameleon;
+
+ // Lazily computed paths
+ private volatile XPath _selectorPath;
+ private volatile XPath[] _fieldPaths;
+
+ public SchemaIdentityConstraintImpl(SchemaTypeSystem sys) {
+ _typeSystem = sys;
+ }
+
+ public String getSelector() {
+ return _selector;
+ }
+
+ public Object getSelectorPath() {
+ XPath p = _selectorPath;
+ if (p == null) {
+ try {
+ buildPaths();
+ p = _selectorPath;
+ }
+ catch (XPath.XPathCompileException e) {
+ assert false: "Failed to compile xpath. Should be caught by compiler " + e;
+ return null;
+ }
+ }
+ return p;
+ }
+
+ public void setNSMap(Map nsMap) {
+ _nsMap = nsMap;
+ }
+
+ public Map getNSMap() {
+ return Collections.unmodifiableMap(_nsMap);
+ }
+
+ public void setSelector(String selector) {
+ assert selector != null;
+ _selector = selector;
+ }
+
+ public void setFields(String[] fields) {
+ assert fields != null && fields.length > 0;
+ _fields = fields;
+ }
+
+ public String[] getFields() {
+ String[] fields = new String[_fields.length];
+ System.arraycopy(_fields, 0, fields, 0, fields.length);
+ return fields;
+ }
+
+ public Object getFieldPath(int index) {
+ XPath[] p = _fieldPaths;
+ if (p == null) {
+ try {
+ buildPaths();
+ p = _fieldPaths;
+ }
+ catch (XPath.XPathCompileException e) {
+ assert false: "Failed to compile xpath. Should be caught by compiler " + e;
+ return null;
+ }
+ }
+ return p[index];
+ }
+
+ public void buildPaths() throws XPath.XPathCompileException {
+ // TODO: Need the namespace map - requires store support
+ _selectorPath = XPath.compileXPath(_selector, _nsMap);
+
+ _fieldPaths = new XPath[_fields.length];
+ for (int i = 0 ; i < _fieldPaths.length ; i++)
+ _fieldPaths[i] = XPath.compileXPath(_fields[i], _nsMap);
+ }
+
+ public void setReferencedKey(SchemaIdentityConstraint.Ref key) {
+ _key = key;
+ }
+
+ public SchemaIdentityConstraint getReferencedKey() {
+ return _key.get();
+ }
+
+ public void setConstraintCategory(int type) {
+ assert type >= CC_KEY && type <= CC_UNIQUE;
+ _type = type;
+ }
+
+ public int getConstraintCategory() {
+ return _type;
+ }
+
+ public void setName(QName name) {
+ assert name != null;
+ _name = name;
+ }
+
+ public QName getName() {
+ return _name;
+ }
+
+ public int getComponentType() {
+ return IDENTITY_CONSTRAINT;
+ }
+
+ public SchemaTypeSystem getTypeSystem() {
+ return _typeSystem;
+ }
+
+ public void setParseContext(XmlObject o, String targetNamespace, boolean chameleon) {
+ _parse = o;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ }
+
+ public XmlObject getParseObject() {
+ return _parse;
+ }
+
+ public String getTargetNamespace() {
+ return _parseTNS;
+ }
+
+ public String getChameleonNamespace() {
+ return _chameleon ? _parseTNS : null;
+ }
+
+
+ /**
+ * Only applicable to keyrefs. Other types are implicitly resolved.
+ */
+ public boolean isResolved() {
+ return getConstraintCategory() != CC_KEYREF || _key != null;
+ }
+
+ private SchemaIdentityConstraint.Ref _selfref = new SchemaIdentityConstraint.Ref(this);
+
+ public SchemaIdentityConstraint.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalAttributeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalAttributeImpl.java
new file mode 100644
index 0000000..5c66e75
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalAttributeImpl.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans.impl.schema;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlQName;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.soap.SchemaWSDLArrayType;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+
+import java.math.BigInteger;
+
+public class SchemaLocalAttributeImpl implements SchemaLocalAttribute, SchemaWSDLArrayType
+{
+ public SchemaLocalAttributeImpl()
+ {
+ }
+
+ public void init(QName name, SchemaType.Ref typeref, int use, String deftext, XmlObject parseObject, XmlValueRef defvalue, boolean isFixed, SOAPArrayType wsdlArray)
+ {
+ if (_xmlName != null || _typeref != null)
+ throw new IllegalStateException("Already initialized");
+ _use = use;
+ _typeref = typeref;
+ _defaultText = deftext;
+ _parseObject = parseObject;
+ _defaultValue = defvalue;
+ _isDefault = (deftext != null);
+ _isFixed = isFixed;
+ _xmlName = name;
+ _wsdlArrayType = wsdlArray;
+ }
+
+ private String _defaultText;
+ /* package */ XmlValueRef _defaultValue;
+ private boolean _isFixed;
+ private boolean _isDefault;
+ private QName _xmlName;
+ private SchemaType.Ref _typeref;
+ private SOAPArrayType _wsdlArrayType;
+ private int _use;
+ protected XmlObject _parseObject; // for QName resolution
+
+ public boolean isTypeResolved()
+ {
+ return (_typeref != null);
+ }
+
+ public void resolveTypeRef(SchemaType.Ref typeref)
+ {
+ if (_typeref != null)
+ throw new IllegalStateException();
+ _typeref = typeref;
+ }
+
+ public int getUse()
+ { return _use; }
+
+ public QName getName()
+ { return _xmlName; }
+
+ public String getDefaultText()
+ { return _defaultText; }
+
+ public boolean isDefault()
+ { return _isDefault; }
+
+ public boolean isFixed()
+ { return _isFixed; }
+
+ public boolean isAttribute()
+ { return true; }
+
+ public SchemaType getType()
+ { return _typeref.get(); }
+
+ public SchemaType.Ref getTypeRef()
+ { return _typeref; }
+
+ public BigInteger getMinOccurs()
+ { return _use == REQUIRED ? BigInteger.ONE : BigInteger.ZERO; }
+
+ public BigInteger getMaxOccurs()
+ { return _use == PROHIBITED ? BigInteger.ZERO : BigInteger.ONE; }
+
+ public boolean isNillable()
+ { return false; }
+
+ public SOAPArrayType getWSDLArrayType()
+ { return _wsdlArrayType; }
+
+ public XmlAnySimpleType getDefaultValue()
+ {
+ if (_defaultValue != null)
+ return _defaultValue.get();
+ if (_defaultText != null && XmlAnySimpleType.type.isAssignableFrom(getType()))
+ {
+ if (_parseObject != null)
+ {
+ try
+ {
+ NamespaceContext.push(new NamespaceContext(_parseObject));
+ return getType().newValue(_defaultText);
+ }
+ finally
+ {
+ NamespaceContext.pop();
+ }
+ }
+ return getType().newValue(_defaultText);
+ }
+ return null;
+ }
+
+ public void setDefaultValue(XmlValueRef defaultRef)
+ { _defaultValue = defaultRef; }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalElementImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalElementImpl.java
new file mode 100644
index 0000000..48c5fc0
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalElementImpl.java
@@ -0,0 +1,101 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.soap.SchemaWSDLArrayType;
+
+public class SchemaLocalElementImpl extends SchemaParticleImpl
+ implements SchemaLocalElement, SchemaWSDLArrayType
+{
+ private boolean _blockExt;
+ private boolean _blockRest;
+ private boolean _blockSubst;
+ protected boolean _abs;
+ private SOAPArrayType _wsdlArrayType;
+ private SchemaIdentityConstraint.Ref[] _constraints = new SchemaIdentityConstraint.Ref[0];
+
+
+ public SchemaLocalElementImpl()
+ {
+ setParticleType(SchemaParticle.ELEMENT);
+ }
+
+ public boolean blockExtension()
+ {
+ return _blockExt;
+ }
+
+ public boolean blockRestriction()
+ {
+ return _blockRest;
+ }
+
+ public boolean blockSubstitution()
+ {
+ return _blockSubst;
+ }
+
+ public boolean isAbstract()
+ {
+ return _abs;
+ }
+
+ public void setAbstract(boolean abs)
+ {
+ _abs = abs;
+ }
+
+ public void setBlock(boolean extension, boolean restriction, boolean substitution)
+ {
+ mutate();
+ _blockExt = extension;
+ _blockRest = restriction;
+ _blockSubst = substitution;
+ }
+
+ public void setWsdlArrayType(SOAPArrayType arrayType)
+ {
+ _wsdlArrayType = arrayType;
+ }
+
+ public SOAPArrayType getWSDLArrayType()
+ {
+ return _wsdlArrayType;
+ }
+
+ public void setIdentityConstraints(SchemaIdentityConstraint.Ref[] constraints) {
+ mutate();
+ _constraints = constraints;
+ }
+
+ public SchemaIdentityConstraint[] getIdentityConstraints() {
+ SchemaIdentityConstraint[] result = new SchemaIdentityConstraint[_constraints.length];
+ for (int i = 0 ; i < result.length ; i++)
+ result[i] = _constraints[i].get();
+ return result;
+ }
+
+ public SchemaIdentityConstraint.Ref[] getIdentityConstraintRefs() {
+ SchemaIdentityConstraint.Ref[] result = new SchemaIdentityConstraint.Ref[_constraints.length];
+ System.arraycopy(_constraints, 0, result, 0, result.length);
+ return result;
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaModelGroupImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaModelGroupImpl.java
new file mode 100644
index 0000000..fc21c47
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaModelGroupImpl.java
@@ -0,0 +1,85 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import javax.xml.namespace.QName;
+
+public class SchemaModelGroupImpl implements SchemaModelGroup
+{
+ private SchemaTypeSystem _typeSystem;
+ private QName _name;
+ private XmlObject _parseObject;
+ private String _parseTNS;
+ private boolean _chameleon;
+ private boolean _redefinition;
+
+ public SchemaModelGroupImpl(SchemaTypeSystem typeSystem)
+ {
+ _typeSystem = typeSystem;
+ }
+
+ public SchemaModelGroupImpl(SchemaTypeSystem typeSystem, QName name)
+ {
+ this(typeSystem);
+ _name = name;
+ }
+
+ public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x)
+ {
+ assert _name == null || name.equals( _name );
+
+ _name = name;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ _redefinition = redefinition;
+ _parseObject = x;
+ }
+
+ public SchemaTypeSystem getTypeSystem()
+ {
+ return _typeSystem;
+ }
+
+ public int getComponentType()
+ { return SchemaComponent.MODEL_GROUP; }
+
+ public QName getName()
+ { return _name; }
+
+ public XmlObject getParseObject()
+ { return _parseObject; }
+
+ public String getTargetNamespace()
+ { return _parseTNS; }
+
+ public String getChameleonNamespace()
+ { return _chameleon ? _parseTNS : null; }
+
+ public boolean isRedefinition()
+ { return _redefinition; }
+
+ private SchemaModelGroup.Ref _selfref = new SchemaModelGroup.Ref(this);
+
+ public SchemaModelGroup.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaParticleImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaParticleImpl.java
new file mode 100644
index 0000000..ccf6899
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaParticleImpl.java
@@ -0,0 +1,240 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlQName;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+public class SchemaParticleImpl implements SchemaParticle
+{
+ private int _particleType;
+ private BigInteger _minOccurs;
+ private BigInteger _maxOccurs;
+ private SchemaParticle[] _particleChildren;
+ private boolean _isImmutable;
+ private QNameSet _startSet;
+ private QNameSet _excludeNextSet;
+ private boolean _isSkippable;
+ private boolean _isDeterministic;
+ private int _intMinOccurs;
+ private int _intMaxOccurs;
+ private QNameSet _wildcardSet;
+ private int _wildcardProcess;
+ private String _defaultText;
+ private boolean _isDefault;
+ private boolean _isFixed;
+ private QName _qName;
+ private boolean _isNillable;
+ private SchemaType.Ref _typeref;
+ protected XmlObject _parseObject;
+ private XmlValueRef _defaultValue;
+
+ protected void mutate()
+ { if (_isImmutable) throw new IllegalStateException(); }
+
+ public void setImmutable()
+ { mutate(); _isImmutable = true; }
+
+ public boolean hasTransitionRules()
+ { return (_startSet != null); }
+
+ public boolean hasTransitionNotes()
+ { return (_excludeNextSet != null); }
+
+ public void setTransitionRules(QNameSet start,
+ boolean isSkippable)
+ {
+ _startSet = start;
+ _isSkippable = isSkippable;
+ }
+
+ public void setTransitionNotes(QNameSet excludeNext, boolean isDeterministic)
+ {
+ _excludeNextSet = excludeNext;
+ _isDeterministic = isDeterministic;
+ }
+
+ public boolean canStartWithElement(QName name)
+ { return name != null && _startSet.contains(name); }
+
+ public QNameSet acceptedStartNames()
+ { return _startSet; }
+
+ public QNameSet getExcludeNextSet()
+ { return _excludeNextSet; }
+
+ public boolean isSkippable()
+ { return _isSkippable; }
+
+ public boolean isDeterministic()
+ { return _isDeterministic; }
+
+ public int getParticleType()
+ { return _particleType; }
+
+ public void setParticleType(int pType)
+ { mutate(); _particleType = pType; }
+
+ public boolean isSingleton()
+ { return _maxOccurs != null &&
+ _maxOccurs.compareTo(BigInteger.ONE) == 0 &&
+ _minOccurs.compareTo(BigInteger.ONE) == 0; }
+
+ public BigInteger getMinOccurs()
+ { return _minOccurs; }
+
+ public void setMinOccurs(BigInteger min)
+ { mutate(); _minOccurs = min; _intMinOccurs = pegBigInteger(min); }
+
+ public int getIntMinOccurs()
+ { return _intMinOccurs; }
+
+ public BigInteger getMaxOccurs()
+ { return _maxOccurs; }
+
+ public int getIntMaxOccurs()
+ { return _intMaxOccurs; }
+
+ public void setMaxOccurs(BigInteger max)
+ { mutate(); _maxOccurs = max; _intMaxOccurs = pegBigInteger(max); }
+
+ public SchemaParticle[] getParticleChildren()
+ {
+ SchemaParticle[] result = new SchemaParticle[_particleChildren.length];
+ System.arraycopy(_particleChildren, 0, result, 0, _particleChildren.length);
+ return result;
+ }
+
+ public void setParticleChildren(SchemaParticle[] children)
+ { mutate(); _particleChildren = children; }
+
+ public SchemaParticle getParticleChild(int i)
+ { return _particleChildren[i]; }
+
+ public int countOfParticleChild()
+ { return _particleChildren == null ? 0 : _particleChildren.length; }
+
+ public void setWildcardSet(QNameSet set)
+ { mutate(); _wildcardSet = set; }
+
+ public QNameSet getWildcardSet()
+ { return _wildcardSet; }
+
+ public void setWildcardProcess(int process)
+ { mutate(); _wildcardProcess = process; }
+
+ public int getWildcardProcess()
+ { return _wildcardProcess; }
+
+ private static final BigInteger _maxint = BigInteger.valueOf(Integer.MAX_VALUE);
+
+ private static final int pegBigInteger(BigInteger bi)
+ {
+ if (bi == null)
+ return Integer.MAX_VALUE;
+ if (bi.signum() <= 0)
+ return 0;
+ if (bi.compareTo(_maxint) >= 0)
+ return Integer.MAX_VALUE;
+ return bi.intValue();
+ }
+
+ public QName getName()
+ { return _qName; }
+
+ public void setNameAndTypeRef(QName formname, SchemaType.Ref typeref)
+ { mutate(); _qName = formname; _typeref = typeref; }
+
+ public boolean isTypeResolved()
+ {
+ return (_typeref != null);
+ }
+
+ public void resolveTypeRef(SchemaType.Ref typeref)
+ {
+ if (_typeref != null)
+ throw new IllegalStateException();
+ _typeref = typeref;
+ }
+
+ public boolean isAttribute()
+ { return false; }
+
+ public SchemaType getType()
+ { if (_typeref == null) return null; return _typeref.get(); }
+
+ public String getDefaultText()
+ { return _defaultText; }
+
+ public boolean isDefault()
+ { return _isDefault; }
+
+ public boolean isFixed()
+ { return _isFixed; }
+
+ public void setDefault(String deftext, boolean isFixed, XmlObject parseObject)
+ {
+ mutate();
+ _defaultText = deftext;
+ _isDefault = (deftext != null);
+ _isFixed = isFixed;
+ _parseObject = parseObject;
+ }
+
+ public boolean isNillable()
+ { return _isNillable; }
+
+ public void setNillable(boolean nillable)
+ { mutate(); _isNillable = nillable; }
+
+ public XmlAnySimpleType getDefaultValue()
+ {
+ if (_defaultValue != null)
+ return _defaultValue.get();
+ if (_defaultText != null && XmlAnySimpleType.type.isAssignableFrom(getType()))
+ {
+ if (_parseObject != null && XmlQName.type.isAssignableFrom(getType()))
+ {
+ try
+ {
+ NamespaceContext.push(new NamespaceContext(_parseObject));
+ return getType().newValue(_defaultText);
+ }
+ finally
+ {
+ NamespaceContext.pop();
+ }
+ }
+ return getType().newValue(_defaultText);
+ }
+ return null;
+ }
+
+ public void setDefaultValue(XmlValueRef defaultRef)
+ {
+ mutate();
+ _defaultValue = defaultRef;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaPropertyImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaPropertyImpl.java
new file mode 100644
index 0000000..b2b2cd8
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaPropertyImpl.java
@@ -0,0 +1,197 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlQName;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+
+import java.math.BigInteger;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+public class SchemaPropertyImpl implements SchemaProperty
+{
+ private QName _name;
+ private SchemaType.Ref _typeref;
+ private boolean _isAttribute;
+ private SchemaType.Ref _containerTypeRef;
+ private String _javaPropertyName;
+ private BigInteger _minOccurs;
+ private BigInteger _maxOccurs;
+ private int _hasNillable;
+ private int _hasDefault;
+ private int _hasFixed;
+ private String _defaultText;
+ private boolean _isImmutable;
+ private SchemaType.Ref _javaBasedOnTypeRef;
+ private boolean _extendsSingleton;
+ private boolean _extendsArray;
+ private boolean _extendsOption;
+ private int _javaTypeCode;
+ private QNameSet _javaSetterDelimiter;
+ private XmlValueRef _defaultValue;
+ private Set _acceptedNames;
+
+ private void mutate()
+ { if (_isImmutable) throw new IllegalStateException(); }
+
+ public void setImmutable()
+ { mutate(); _isImmutable = true; }
+
+ public SchemaType getContainerType()
+ { return _containerTypeRef.get(); }
+
+ public void setContainerTypeRef(SchemaType.Ref typeref)
+ { mutate(); _containerTypeRef = typeref; }
+
+ public QName getName()
+ { return _name; }
+
+ public void setName(QName name)
+ { mutate(); _name = name; }
+
+ public String getJavaPropertyName()
+ { return _javaPropertyName; }
+
+ public void setJavaPropertyName(String name)
+ { mutate(); _javaPropertyName = name; }
+
+ public boolean isAttribute()
+ { return _isAttribute; }
+
+ public void setAttribute(boolean isAttribute)
+ { mutate(); _isAttribute = isAttribute; }
+
+ public boolean isReadOnly()
+ { return false; }
+
+ public SchemaType getType()
+ { return _typeref.get(); }
+
+ public void setTypeRef(SchemaType.Ref typeref)
+ { mutate(); _typeref = typeref; }
+
+ public SchemaType javaBasedOnType()
+ { return _javaBasedOnTypeRef.get(); }
+
+ public boolean extendsJavaSingleton()
+ { return _extendsSingleton; }
+
+ public boolean extendsJavaArray()
+ { return _extendsArray; }
+
+ public boolean extendsJavaOption()
+ { return _extendsOption; }
+
+ public void setExtendsJava(SchemaType.Ref javaBasedOnTypeRef, boolean singleton, boolean option, boolean array)
+ {
+ mutate();
+ _javaBasedOnTypeRef = javaBasedOnTypeRef;
+ _extendsSingleton = singleton;
+ _extendsOption = option;
+ _extendsArray = array;
+ }
+
+ public QNameSet getJavaSetterDelimiter()
+ { return _javaSetterDelimiter == null ? QNameSet.EMPTY : _javaSetterDelimiter; }
+
+ public void setJavaSetterDelimiter(QNameSet set)
+ { mutate(); _javaSetterDelimiter = set; }
+
+ public QName[] acceptedNames()
+ {
+ if (_acceptedNames == null)
+ return new QName[] { _name };
+
+ return (QName[])_acceptedNames.toArray(new QName[_acceptedNames.size()]);
+ }
+
+ public void setAcceptedNames(Set set)
+ {
+ mutate();
+ _acceptedNames = set;
+ }
+ public void setAcceptedNames(QNameSet set)
+ {
+ mutate();
+ _acceptedNames = set.includedQNamesInExcludedURIs();
+ }
+
+ public BigInteger getMinOccurs()
+ { return _minOccurs; }
+
+ public void setMinOccurs(BigInteger min)
+ { mutate(); _minOccurs = min; }
+
+ public BigInteger getMaxOccurs()
+ { return _maxOccurs; }
+
+ public void setMaxOccurs(BigInteger max)
+ { mutate(); _maxOccurs = max; }
+
+ public int hasNillable()
+ { return _hasNillable; }
+
+ public void setNillable(int when)
+ { mutate(); _hasNillable = when; }
+
+ public int hasDefault()
+ { return _hasDefault; }
+
+ public void setDefault(int when)
+ { mutate(); _hasDefault = when; }
+
+ public int hasFixed()
+ { return _hasFixed; }
+
+ public void setFixed(int when)
+ { mutate(); _hasFixed = when; }
+
+ public String getDefaultText()
+ { return _defaultText; }
+
+ public void setDefaultText(String val)
+ { mutate(); _defaultText = val; }
+
+ public XmlAnySimpleType getDefaultValue()
+ {
+ if (_defaultValue != null)
+ return _defaultValue.get();
+ return null;
+ }
+
+ public void setDefaultValue(XmlValueRef defaultRef)
+ {
+ mutate();
+ _defaultValue = defaultRef;
+ }
+
+ public int getJavaTypeCode()
+ { return _javaTypeCode; }
+
+ public void setJavaTypeCode(int code)
+ { mutate(); _javaTypeCode = code; }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaStringEnumEntryImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaStringEnumEntryImpl.java
new file mode 100644
index 0000000..6ac2c70
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaStringEnumEntryImpl.java
@@ -0,0 +1,47 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaStringEnumEntry;
+
+public class SchemaStringEnumEntryImpl implements SchemaStringEnumEntry
+{
+ private String _string;
+ private int _int;
+ private String _enumName;
+
+ public SchemaStringEnumEntryImpl(String str, int i, String enumName)
+ {
+ _string = str;
+ _int = i;
+ _enumName = enumName;
+ }
+
+ public String getString()
+ {
+ return _string;
+ }
+
+ public int getIntValue()
+ {
+ return _int;
+ }
+
+ public String getEnumName()
+ {
+ return _enumName;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
new file mode 100644
index 0000000..0ce47d9
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
@@ -0,0 +1,2255 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.io.Writer;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.common.NameUtil;
+import org.apache.xmlbeans.impl.config.InterfaceExtension;
+import org.apache.xmlbeans.impl.config.ExtensionHolder;
+import org.apache.xmlbeans.impl.config.PrePostExtension;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.SchemaStringEnumEntry;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Prints the java code for a single schema type
+ */
+public final class SchemaTypeCodePrinter
+{
+ Writer _writer;
+ int _indent;
+
+ static final String LINE_SEPARATOR =
+ System.getProperty("line.separator") == null
+ ? "\n"
+ : System.getProperty("line.separator");
+
+ static final String MAX_SPACES = " ";
+ static final int INDENT_INCREMENT = 4;
+
+ public static final String INDEX_CLASSNAME = "TypeSystemHolder";
+
+ public SchemaTypeCodePrinter ( Writer writer )
+ {
+ _writer = writer;
+ _indent = 0;
+ }
+
+ void indent()
+ {
+ _indent += INDENT_INCREMENT;
+ }
+
+ void outdent()
+ {
+ _indent -= INDENT_INCREMENT;
+ }
+
+ String encodeString ( String s )
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( '"' );
+
+ for ( int i = 0 ; i < s.length() ; i++ )
+ {
+ char ch = s.charAt( i );
+
+ if (ch == '"')
+ {
+ sb.append( '\\' );
+ sb.append( '\"' );
+ }
+ else if (ch == '\\')
+ {
+ sb.append( '\\' );
+ sb.append( '\\' );
+ }
+ else if (ch == '\r')
+ {
+ sb.append( '\\' );
+ sb.append( 'r' );
+ }
+ else if (ch == '\n')
+ {
+ sb.append( '\\' );
+ sb.append( 'n' );
+ }
+ else if (ch == '\t')
+ {
+ sb.append( '\\' );
+ sb.append( 't' );
+ }
+ else
+ sb.append( ch );
+ }
+
+ sb.append( '"' );
+
+ return sb.toString();
+ }
+
+ void emit(String s) throws IOException
+ {
+ int indent = _indent;
+
+ if (indent > MAX_SPACES.length() / 2)
+ indent = MAX_SPACES.length() / 4 + indent / 2;
+
+ if (indent > MAX_SPACES.length())
+ indent = MAX_SPACES.length();
+
+ _writer.write(MAX_SPACES.substring(0, indent));
+ _writer.write(s);
+ _writer.write(LINE_SEPARATOR);
+
+ // System.out.print(MAX_SPACES.substring(0, indent));
+ // System.out.println(s);
+ }
+
+ public static void printTypeImpl ( Writer writer, SchemaType sType )
+ throws IOException
+ {
+ new SchemaTypeCodePrinter( writer ).printTypeImpl( sType, sType.getTypeSystem() );
+ }
+
+ public static void printType ( Writer writer, SchemaType sType )
+ throws IOException
+ {
+ new SchemaTypeCodePrinter( writer ). printType( sType, sType.getTypeSystem() );
+ }
+
+ public static void printLoader ( Writer writer, SchemaTypeSystem system )
+ throws IOException
+ {
+ new SchemaTypeCodePrinter( writer ).printIndexType( system );
+ }
+
+ void printType(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ printTopComment(sType);
+ printPackage(sType, true);
+ emit("");
+ printInnerType(sType, system);
+ _writer.flush();
+ }
+
+ void printTypeImpl(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ printTopComment(sType);
+ printPackage(sType, false);
+ printInnerTypeImpl(sType, system, false);
+ }
+
+ /**
+ * Since not all schema types have java types, this skips
+ * over any that don't and gives you the nearest java base type.
+ */
+ String findJavaType ( SchemaType sType )
+ {
+ while ( sType.getFullJavaName() == null )
+ sType = sType.getBaseType();
+
+ return sType.getFullJavaName();
+ }
+
+ static String prettyQName(QName qname)
+ {
+ String result = qname.getLocalPart();
+ if (qname.getNamespaceURI() != null)
+ result += "(@" + qname.getNamespaceURI() + ")";
+ return result;
+ }
+
+ void printInnerTypeJavaDoc(SchemaType sType) throws IOException
+ {
+ QName name = sType.getName();
+ if (name == null)
+ {
+ if (sType.isDocumentType())
+ name = sType.getDocumentElementName();
+ else if (sType.isAttributeType())
+ name = sType.getAttributeTypeAttributeName();
+ else if (sType.getContainerField() != null)
+ name = sType.getContainerField().getName();
+ }
+
+ emit("/**");
+ if (sType.isDocumentType())
+ emit(" * A document containing one " + prettyQName(name) + " element.");
+ else if (sType.isAttributeType())
+ emit(" * A document containing one " + prettyQName(name) + " attribute.");
+ else if (name != null)
+ emit(" * An XML " + prettyQName(name) + ".");
+ else
+ emit(" * An anonymous inner XML type.");
+ emit(" *");
+ switch (sType.getSimpleVariety())
+ {
+ case SchemaType.NOT_SIMPLE:
+ emit(" * This is a complex type.");
+ break;
+ case SchemaType.ATOMIC:
+ emit(" * This is an atomic type that is a restriction of " + sType.getBaseType().getFullJavaName() + ".");
+ break;
+ case SchemaType.LIST:
+ emit(" * This is a list type whose items are " + sType.getListItemType().getFullJavaName() + ".");
+ break;
+ case SchemaType.UNION:
+ emit(" * This is a union type. Instances are of one of the following types:");
+ SchemaType[] members = sType.getUnionConstituentTypes();
+ for (int i = 0; i < members.length; i++)
+ emit(" * " + members[i].getFullJavaName());
+ break;
+ }
+ emit(" */");
+ }
+
+ public static String indexClassForSystem(SchemaTypeSystem system)
+ {
+ String name = system.getName();
+ return name + "." + INDEX_CLASSNAME;
+ }
+
+ static String shortIndexClassForSystem(SchemaTypeSystem system)
+ {
+ return INDEX_CLASSNAME;
+ }
+
+ void printStaticTypeDeclaration(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ emit("public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)" +
+ indexClassForSystem(system) +
+ ".typeSystem.resolveHandle(\"" +
+ ((SchemaTypeSystemImpl)system).handleForType(sType) + "\");");
+ }
+
+ void printIndexType(SchemaTypeSystem system) throws IOException
+ {
+ String shortName = shortIndexClassForSystem(system);
+ emit("package " + system.getName() + ";");
+ emit("");
+ emit("public final class " + shortName);
+ emit("{");
+ indent();
+ emit("private " + shortName + "() { }");
+ emit("public static final org.apache.xmlbeans.SchemaTypeSystem typeSystem = loadTypeSystem();");
+ emit("static { typeSystem.resolve(); }");
+ emit("private static final org.apache.xmlbeans.SchemaTypeSystem loadTypeSystem()");
+ emit("{");
+ indent();
+ emit("try { return (org.apache.xmlbeans.SchemaTypeSystem)Class.forName(\"org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl\", true, " + shortName + ".class.getClassLoader()).getConstructor(new Class[] { Class.class }).newInstance(new java.lang.Object[] { " + shortName + ".class }); }");
+ emit("catch (ClassNotFoundException e) { throw new RuntimeException(\"Cannot load org.apache.xmlbeans.impl.SchemaTypeSystemImpl: make sure xbean.jar is on the classpath.\", e); }");
+ emit("catch (Exception e) { throw new RuntimeException(\"Could not instantiate SchemaTypeSystemImpl (\" + e.toString() + \"): is the version of xbean.jar correct?\", e); }");
+ outdent();
+ emit("}");
+ outdent();
+ emit("}");
+ }
+
+ void printInnerType(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ emit("");
+
+ printInnerTypeJavaDoc(sType);
+
+ startInterface(sType);
+
+ printStaticTypeDeclaration(sType, system);
+
+ if (sType.isSimpleType())
+ {
+ if (sType.hasStringEnumValues())
+ printStringEnumeration(sType);
+ }
+ else
+ {
+ SchemaProperty[] props = sType.getDerivedProperties();
+ for (int i = 0; i < props.length; i++)
+ {
+ SchemaProperty prop = props[i];
+
+ printPropertyGetters(
+ prop.getName(),
+ prop.isAttribute(),
+ prop.getJavaPropertyName(),
+ prop.getJavaTypeCode(),
+ javaTypeForProperty(prop),
+ xmlTypeForProperty(prop),
+ prop.hasNillable() != SchemaProperty.NEVER,
+ prop.extendsJavaOption(),
+ prop.extendsJavaArray(),
+ prop.extendsJavaSingleton()
+ );
+
+ if (!prop.isReadOnly())
+ {
+ printPropertySetters(
+ prop.getName(),
+ prop.isAttribute(),
+ prop.getJavaPropertyName(),
+ prop.getJavaTypeCode(),
+ javaTypeForProperty(prop),
+ xmlTypeForProperty(prop),
+ prop.hasNillable() != SchemaProperty.NEVER,
+ prop.extendsJavaOption(),
+ prop.extendsJavaArray(),
+ prop.extendsJavaSingleton()
+ );
+ }
+ }
+
+ }
+
+ printNestedInnerTypes(sType, system);
+
+ printFactory(sType);
+
+ endBlock();
+ }
+
+ void printFactory(SchemaType sType) throws IOException
+ {
+ // Only need full factories for top-level types
+ boolean fullFactory = true;
+ if (sType.isAnonymousType() && ! sType.isDocumentType() && !sType.isAttributeType())
+ fullFactory = false;
+
+ String fullName = sType.getFullJavaName().replace('$', '.');
+
+ emit("");
+ emit("/**");
+ emit(" * A factory class with static methods for creating instances");
+ emit(" * of this type.");
+ emit(" */");
+ emit("");
+ // BUGBUG - Can I use the name loader here? could it be a
+ // nested type name? It is lower case!
+ emit("public static final class Factory");
+ emit("{");
+ indent();
+
+ if (sType.isSimpleType())
+ {
+ emit("public static " + fullName + " newValue(java.lang.Object obj) {");
+ emit(" return (" + fullName + ") type.newValue( obj ); }");
+ emit("");
+ }
+
+ emit("public static " + fullName + " newInstance() {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " newInstance(org.apache.xmlbeans.XmlOptions options) {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }");
+ emit("");
+
+ if (fullFactory)
+ {
+ emit("public static " + fullName + " parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( s, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( s, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( f, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( f, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }");
+ emit("");
+
+ emit("public static " + fullName + " parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
+ emit(" return (" + fullName + ") org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }");
+ emit("");
+
+ emit("public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
+ emit(" return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }");
+ emit("");
+
+ emit("public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {");
+ emit(" return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }");
+ emit("");
+ }
+
+ emit("private Factory() { } // No instance of this class allowed");
+ outdent();
+ emit("}");
+ }
+
+ void printNestedInnerTypes(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ SchemaType[] anonTypes = sType.getAnonymousTypes();
+ for (int i = 0; i < anonTypes.length; i++)
+ {
+ if (anonTypes[i].isSkippedAnonymousType())
+ printNestedInnerTypes(anonTypes[i], system);
+ else
+ printInnerType(anonTypes[i], system);
+ }
+ }
+
+ void printTopComment(SchemaType sType) throws IOException
+ {
+ emit("/*");
+ if (sType.getName() != null)
+ {
+ emit(" * XML Type: " + sType.getName().getLocalPart());
+ emit(" * Namespace: " + sType.getName().getNamespaceURI());
+ }
+ else
+ {
+ QName thename = null;
+
+ if (sType.isDocumentType())
+ {
+ thename = sType.getDocumentElementName();
+ emit(" * An XML document type.");
+ }
+ else if (sType.isAttributeType())
+ {
+ thename = sType.getAttributeTypeAttributeName();
+ emit(" * An XML attribute type.");
+ }
+ else
+ assert false;
+
+ assert( thename != null );
+
+ emit(" * Localname: " + thename.getLocalPart());
+ emit(" * Namespace: " + thename.getNamespaceURI());
+ }
+ emit(" * Java type: " + sType.getFullJavaName());
+ emit(" *");
+ emit(" * Automatically generated - do not modify.");
+ emit(" */");
+ }
+
+ void printPackage(SchemaType sType, boolean intf) throws IOException
+ {
+ String fqjn;
+ if (intf)
+ fqjn = sType.getFullJavaName();
+ else
+ fqjn = sType.getFullJavaImplName();
+
+ int lastdot = fqjn.lastIndexOf('.');
+ if (lastdot < 0)
+ return;
+ String pkg = fqjn.substring(0, lastdot);
+ emit("package " + pkg + ";");
+ }
+
+ void startInterface(SchemaType sType) throws IOException
+ {
+ String shortName = sType.getShortJavaName();
+
+ String baseInterface = findJavaType(sType.getBaseType());
+
+ /*
+ StringBuffer specializedInterfaces = new StringBuffer();
+
+ if (sType.getSimpleVariety() == SchemaType.ATOMIC &&
+ sType.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL)
+ {
+ int bits = sType.getDecimalSize();
+ if (bits == SchemaType.SIZE_BIG_INTEGER)
+ specializedInterfaces.append(", org.apache.xmlbeans.BigIntegerValue");
+ if (bits == SchemaType.SIZE_LONG)
+ specializedInterfaces.append(", org.apache.xmlbeans.LongValue");
+ if (bits <= SchemaType.SIZE_INT)
+ specializedInterfaces.append(", org.apache.xmlbeans.IntValue");
+ }
+ if (sType.getSimpleVariety() == SchemaType.LIST)
+ specializedInterfaces.append(", org.apache.xmlbeans.ListValue");
+
+ if (sType.getSimpleVariety() == SchemaType.UNION)
+ {
+ SchemaType ctype = sType.getUnionCommonBaseType();
+ String javaTypeHolder = javaTypeHolderForType(ctype);
+ if (javaTypeHolder != null)
+ specializedInterfaces.append(", " + javaTypeHolder);
+ }
+ */
+
+ emit("public interface " + shortName + " extends " + baseInterface + getExtensionInterfaces(sType) );
+ emit("{");
+ indent();
+ emitSpecializedAccessors(sType);
+ }
+
+ private static String getExtensionInterfaces(SchemaType sType)
+ {
+ SchemaTypeImpl sImpl = getImpl(sType);
+ if (sImpl==null)
+ return "";
+
+ StringBuffer sb = new StringBuffer();
+
+ ExtensionHolder extHolder = sImpl.getExtensionHolder();
+ if (extHolder!=null)
+ {
+ List exts = extHolder.getInterfaceExtensionsFor(sType.getFullJavaName());
+ for (Iterator i = exts.iterator(); i.hasNext(); )
+ {
+ InterfaceExtension ext = (InterfaceExtension)i.next();
+ sb.append(", " + ext.getInterfaceNameForJavaSource() );
+ }
+ }
+ return sb.toString();
+ }
+
+ private static SchemaTypeImpl getImpl(SchemaType sType)
+ {
+ if (sType instanceof SchemaTypeImpl)
+ return (SchemaTypeImpl)sType;
+ else
+ return null;
+ }
+
+ private void emitSpecializedAccessors(SchemaType sType) throws IOException
+ {
+ if (sType.getSimpleVariety() == SchemaType.ATOMIC &&
+ sType.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL)
+ {
+ int bits = sType.getDecimalSize();
+ int parentBits = sType.getBaseType().getDecimalSize();
+ if (bits != parentBits || sType.getBaseType().getFullJavaName() == null)
+ {
+ if (bits == SchemaType.SIZE_BIG_INTEGER)
+ {
+ emit("java.math.BigInteger getBigIntegerValue();");
+ emit("void setBigIntegerValue(java.math.BigInteger bi);");
+ emit("/** @deprecated */");
+ emit("java.math.BigInteger bigIntegerValue();");
+ emit("/** @deprecated */");
+ emit("void set(java.math.BigInteger bi);");
+ }
+ else if (bits == SchemaType.SIZE_LONG)
+ {
+ emit("long getLongValue();");
+ emit("void setLongValue(long l);");
+ emit("/** @deprecated */");
+ emit("long longValue();");
+ emit("/** @deprecated */");
+ emit("void set(long l);");
+ }
+ else if (bits == SchemaType.SIZE_INT)
+ {
+ emit("int getIntValue();");
+ emit("void setIntValue(int i);");
+ emit("/** @deprecated */");
+ emit("int intValue();");
+ emit("/** @deprecated */");
+ emit("void set(int i);");
+ }
+ else if (bits == SchemaType.SIZE_SHORT)
+ {
+ emit("short getShortValue();");
+ emit("void setShortValue(short s);");
+ emit("/** @deprecated */");
+ emit("short shortValue();");
+ emit("/** @deprecated */");
+ emit("void set(short s);");
+ }
+ else if (bits == SchemaType.SIZE_BYTE)
+ {
+ emit("byte getByteValue();");
+ emit("void setByteValue(byte b);");
+ emit("/** @deprecated */");
+ emit("byte byteValue();");
+ emit("/** @deprecated */");
+ emit("void set(byte b);");
+ }
+ }
+ }
+
+ if (sType.getSimpleVariety() == SchemaType.UNION)
+ {
+ emit("java.lang.Object getObjectValue();");
+ emit("void setObjectValue(java.lang.Object val);");
+ emit("/** @deprecated */");
+ emit("java.lang.Object objectValue();");
+ emit("/** @deprecated */");
+ emit("void objectSet(java.lang.Object val);");
+ emit("org.apache.xmlbeans.SchemaType instanceType();");
+ SchemaType ctype = sType.getUnionCommonBaseType();
+ if (ctype != null && ctype.getSimpleVariety() != SchemaType.UNION);
+ emitSpecializedAccessors(ctype);
+ }
+
+ if (sType.getSimpleVariety() == SchemaType.LIST)
+ {
+ emit("java.util.List getListValue();");
+ emit("java.util.List xgetListValue();");
+ emit("void setListValue(java.util.List list);");
+ emit("/** @deprecated */");
+ emit("java.util.List listValue();");
+ emit("/** @deprecated */");
+ emit("java.util.List xlistValue();");
+ emit("/** @deprecated */");
+ emit("void set(java.util.List list);");
+ }
+ }
+
+ void startBlock() throws IOException
+ {
+ emit("{");
+ indent();
+ }
+ void endBlock() throws IOException
+ {
+ outdent();
+ emit("}");
+ }
+
+ void printJavaDoc(String sentence) throws IOException
+ {
+ emit("");
+ emit("/**");
+ emit(" * " + sentence);
+ emit(" */");
+ }
+
+ void printShortJavaDoc(String sentence) throws IOException
+ {
+ emit("/** " + sentence + " */");
+ }
+
+ static SchemaType findBaseEnumType(SchemaType sType)
+ {
+ while (sType.getBaseType().hasStringEnumValues())
+ sType = sType.getBaseType();
+ return sType;
+ }
+
+ public static String javaStringEscape(String str)
+ {
+ // forbidden: \n, \r, \", \\.
+ test: {
+ for (int i = 0; i < str.length(); i++)
+ {
+ switch (str.charAt(i))
+ {
+ case '\n':
+ case '\r':
+ case '\"':
+ case '\\':
+ break test;
+ }
+ }
+ return str;
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < str.length(); i++)
+ {
+ char ch = str.charAt(i);
+ switch (ch)
+ {
+ default:
+ sb.append(ch);
+ break;
+ case '\n':
+ sb.append("\\n");
+ break;
+ case '\r':
+ sb.append("\\r");
+ break;
+ case '\"':
+ sb.append("\\\"");
+ break;
+ case '\\':
+ sb.append("\\\\");
+ break;
+ }
+ }
+ return sb.toString();
+ }
+
+ void printStringEnumeration(SchemaType sType) throws IOException
+ {
+ SchemaType baseEnumType = findBaseEnumType(sType);
+ String baseEnumClass = baseEnumType.getFullJavaName();
+
+ if (baseEnumType == sType)
+ {
+ emit("");
+ emit("org.apache.xmlbeans.StringEnumAbstractBase enumValue();");
+ emit("void set(org.apache.xmlbeans.StringEnumAbstractBase e);");
+ }
+
+ emit("");
+ SchemaStringEnumEntry[] entries = sType.getStringEnumEntries();
+ for (int i = 0; i < entries.length; i++)
+ {
+ String enumValue = entries[i].getString();
+ String constName = entries[i].getEnumName();
+ if (baseEnumType != sType)
+ emit("static final " + baseEnumClass + ".Enum " + constName + " = " + baseEnumClass + "." + constName + ";");
+ else
+ emit("static final Enum " + constName + " = Enum.forString(\"" + javaStringEscape(enumValue) + "\");");
+ }
+ emit("");
+ for (int i = 0; i < entries.length; i++)
+ {
+ String constName = "INT_" + entries[i].getEnumName();
+ if (baseEnumType != sType)
+ emit("static final int " + constName + " = " + baseEnumClass + "." + constName + ";");
+ else
+ emit("static final int " + constName + " = Enum." + constName + ";");
+ }
+ if (baseEnumType == sType)
+ {
+ emit("");
+ emit("/**");
+ emit(" * Enumeration value class for " + baseEnumClass + ".");
+ emit(" * These enum values can be used as follows:");
+ emit(" * <pre>");
+ emit(" * enum.toString(); // returns the string value of the enum");
+ emit(" * enum.intValue(); // returns an int value, useful for switches");
+ if (entries.length > 0)
+ emit(" * // e.g., case Enum.INT_" + entries[0].getEnumName());
+ emit(" * Enum.forString(s); // returns the enum value for a string");
+ emit(" * Enum.forInt(i); // returns the enum value for an int");
+ emit(" * </pre>");
+ emit(" * Enumeration objects are immutable singleton objects that");
+ emit(" * can be compared using == object equality. They have no");
+ emit(" * public constructor. See the constants defined within this");
+ emit(" * class for all the valid values.");
+ emit(" */");
+ emit("static final class Enum extends org.apache.xmlbeans.StringEnumAbstractBase");
+ emit("{");
+ indent();
+ emit("/**");
+ emit(" * Returns the enum value for a string, or null if none.");
+ emit(" */");
+ emit("public static Enum forString(java.lang.String s)");
+ emit(" { return (Enum)table.forString(s); }");
+ emit("/**");
+ emit(" * Returns the enum value corresponding to an int, or null if none.");
+ emit(" */");
+ emit("public static Enum forInt(int i)");
+ emit(" { return (Enum)table.forInt(i); }");
+ emit("");
+ emit("private Enum(java.lang.String s, int i)");
+ emit(" { super(s, i); }");
+ emit("");
+ for (int i = 0; i < entries.length; i++)
+ {
+ String constName = "INT_" + entries[i].getEnumName();
+ int intValue = entries[i].getIntValue();
+ emit("static final int " + constName + " = " + intValue + ";");
+ }
+ emit("");
+ emit("public static final org.apache.xmlbeans.StringEnumAbstractBase.Table table =");
+ emit(" new org.apache.xmlbeans.StringEnumAbstractBase.Table");
+ emit("(");
+ indent();
+ emit("new Enum[]");
+ emit("{");
+ indent();
+ for (int i = 0; i < entries.length; i++)
+ {
+ String enumValue = entries[i].getString();
+ String constName = "INT_" + entries[i].getEnumName();
+ emit("new Enum(\"" + javaStringEscape(enumValue) + "\", " + constName + "),");
+ }
+ outdent();
+ emit("}");
+ outdent();
+ emit(");");
+ emit("private static final long serialVersionUID = 1L;");
+ emit("private java.lang.Object readResolve() { return forInt(intValue()); } ");
+ outdent();
+ emit("}");
+ }
+ }
+
+ String xmlTypeForProperty(SchemaProperty sProp)
+ {
+ SchemaType sType = sProp.javaBasedOnType();
+ return findJavaType(sType).replace('$', '.');
+ }
+
+ static boolean xmlTypeForPropertyIsUnion(SchemaProperty sProp)
+ {
+ SchemaType sType = sProp.javaBasedOnType();
+ return (sType.isSimpleType() && sType.getSimpleVariety() == SchemaType.UNION);
+ }
+
+ String javaTypeForProperty(SchemaProperty sProp)
+ {
+ // The type to use is the XML object....
+ if (sProp.getJavaTypeCode() == SchemaProperty.XML_OBJECT)
+ {
+ SchemaType sType = sProp.javaBasedOnType();
+ return findJavaType(sType).replace('$', '.');
+ }
+
+ switch (sProp.getJavaTypeCode())
+ {
+ case SchemaProperty.JAVA_BOOLEAN:
+ return "boolean";
+ case SchemaProperty.JAVA_FLOAT:
+ return "float";
+ case SchemaProperty.JAVA_DOUBLE:
+ return "double";
+ case SchemaProperty.JAVA_BYTE:
+ return "byte";
+ case SchemaProperty.JAVA_SHORT:
+ return "short";
+ case SchemaProperty.JAVA_INT:
+ return "int";
+ case SchemaProperty.JAVA_LONG:
+ return "long";
+
+ case SchemaProperty.JAVA_BIG_DECIMAL:
+ return "java.math.BigDecimal";
+ case SchemaProperty.JAVA_BIG_INTEGER:
+ return "java.math.BigInteger";
+ case SchemaProperty.JAVA_STRING:
+ return "java.lang.String";
+ case SchemaProperty.JAVA_BYTE_ARRAY:
+ return "byte[]";
+ case SchemaProperty.JAVA_GDATE:
+ return "org.apache.xmlbeans.GDate";
+ case SchemaProperty.JAVA_GDURATION:
+ return "org.apache.xmlbeans.GDuration";
+ case SchemaProperty.JAVA_DATE:
+ return "java.util.Date";
+ case SchemaProperty.JAVA_QNAME:
+ return "javax.xml.namespace.QName";
+ case SchemaProperty.JAVA_LIST:
+ return "java.util.List";
+ case SchemaProperty.JAVA_CALENDAR:
+ return "java.util.Calendar";
+
+ case SchemaProperty.JAVA_ENUM:
+ SchemaType sType = sProp.javaBasedOnType().getBaseEnumType();
+ return findJavaType(sType).replace('$', '.') + ".Enum";
+
+ case SchemaProperty.JAVA_OBJECT:
+ return "java.lang.Object";
+
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+ }
+
+ void printPropertyGetters(QName qName, boolean isAttr,
+ String propertyName, int javaType,
+ String type, String xtype,
+ boolean nillable, boolean optional,
+ boolean several, boolean singleton)
+ throws IOException
+ {
+ String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
+ boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
+
+ if (singleton)
+ {
+ printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
+ emit(type + " get" + propertyName + "();");
+
+ if (!xmltype)
+ {
+ printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc);
+ emit(xtype + " xget" + propertyName + "();");
+ }
+
+ if (nillable)
+ {
+ printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc);
+ emit("boolean isNil" + propertyName + "();");
+ }
+ }
+
+ if (optional)
+ {
+ printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc);
+ emit("boolean isSet" + propertyName + "();");
+ }
+
+ if (several)
+ {
+ String arrayName = propertyName + "Array";
+
+ printJavaDoc("Gets array of all " + propdesc + "s");
+ emit(type + "[] get" + arrayName + "();");
+
+ printJavaDoc("Gets ith " + propdesc);
+ emit(type + " get" + arrayName + "(int i);");
+
+ if (!xmltype)
+ {
+ printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
+ emit(xtype + "[] xget" + arrayName + "();");
+
+ printJavaDoc("Gets (as xml) ith " + propdesc);
+ emit(xtype + " xget" + arrayName + "(int i);");
+ }
+
+ if (nillable)
+ {
+ printJavaDoc("Tests for nil ith " + propdesc);
+ emit("boolean isNil" + arrayName + "(int i);");
+ }
+
+ printJavaDoc("Returns number of " + propdesc);
+ emit("int sizeOf" + arrayName + "();");
+ }
+ }
+
+ void printPropertySetters(QName qName, boolean isAttr,
+ String propertyName, int javaType, String type, String xtype,
+ boolean nillable, boolean optional,
+ boolean several, boolean singleton)
+ throws IOException
+ {
+ String safeVarName = NameUtil.nonJavaKeyword(NameUtil.lowerCamelCase(propertyName));
+ if (safeVarName.equals("i"))
+ safeVarName = "iValue";
+ boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
+
+ String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
+
+ if (singleton)
+ {
+ printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
+ emit("void set" + propertyName + "(" + type + " " + safeVarName + ");");
+
+ if (!xmltype)
+ {
+ printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc);
+ emit("void xset" + propertyName + "(" + xtype + " " + safeVarName + ");");
+ }
+
+ if (xmltype && !several)
+ {
+ printJavaDoc("Appends and returns a new empty " + propdesc);
+ emit(xtype + " addNew" + propertyName + "();");
+ }
+
+ if (nillable)
+ {
+ printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc);
+ emit("void setNil" + propertyName + "();");
+ }
+ }
+
+ if (optional)
+ {
+ printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc);
+ emit("void unset" + propertyName + "();");
+ }
+
+ if (several)
+ {
+ String arrayName = propertyName + "Array";
+
+ printJavaDoc("Sets array of all " + propdesc);
+ emit("void set" + arrayName + "(" + type + "[] " + safeVarName + "Array);");
+
+ printJavaDoc("Sets ith " + propdesc);
+ emit("void set" + arrayName + "(int i, " + type + " " + safeVarName + ");");
+
+ if (!xmltype)
+ {
+ printJavaDoc("Sets (as xml) array of all " + propdesc);
+ emit("void xset" + arrayName + "(" + xtype + "[]" + safeVarName + "Array);");
+
+ printJavaDoc("Sets (as xml) ith " + propdesc);
+ emit("void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ");");
+ }
+
+ if (nillable)
+ {
+ printJavaDoc("Nils the ith " + propdesc);
+ emit("void setNil" + arrayName + "(int i);");
+ }
+
+ if (!xmltype)
+ {
+ printJavaDoc("Inserts the value as the ith " + propdesc);
+ emit("void insert" + propertyName + "(int i, " + type + " " + safeVarName + ");");
+
+ printJavaDoc("Appends the value as the last " + propdesc);
+ emit("void add" + propertyName + "(" + type + " " + safeVarName + ");");
+ }
+
+ if (xmltype)
+ {
+ printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
+ emit(xtype + " insertNew" + propertyName + "(int i);");
+
+ printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
+ emit(xtype + " addNew" + propertyName + "();");
+ }
+
+ printJavaDoc("Removes the ith " + propdesc);
+ emit("void remove" + propertyName + "(int i);");
+ }
+ }
+
+ String getAtomicRestrictionType(SchemaType sType) {
+ SchemaType pType = sType.getPrimitiveType();
+ switch (pType.getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_ANY_SIMPLE:
+ return "org.apache.xmlbeans.impl.values.XmlAnySimpleTypeImpl";
+ case SchemaType.BTC_BOOLEAN:
+ return "org.apache.xmlbeans.impl.values.JavaBooleanHolderEx";
+ case SchemaType.BTC_BASE_64_BINARY:
+ return "org.apache.xmlbeans.impl.values.JavaBase64HolderEx";
+ case SchemaType.BTC_HEX_BINARY:
+ return "org.apache.xmlbeans.impl.values.JavaHexBinaryHolderEx";
+ case SchemaType.BTC_ANY_URI:
+ return "org.apache.xmlbeans.impl.values.JavaUriHolderEx";
+ case SchemaType.BTC_QNAME:
+ return "org.apache.xmlbeans.impl.values.JavaQNameHolderEx";
+ case SchemaType.BTC_NOTATION:
+ return "org.apache.xmlbeans.impl.values.JavaNotationHolderEx";
+ case SchemaType.BTC_FLOAT:
+ return "org.apache.xmlbeans.impl.values.JavaFloatHolderEx";
+ case SchemaType.BTC_DOUBLE:
+ return "org.apache.xmlbeans.impl.values.JavaDoubleHolderEx";
+ case SchemaType.BTC_DECIMAL:
+ switch (sType.getDecimalSize())
+ {
+ default:
+ assert(false);
+ case SchemaType.SIZE_BIG_DECIMAL:
+ return "org.apache.xmlbeans.impl.values.JavaDecimalHolderEx";
+ case SchemaType.SIZE_BIG_INTEGER:
+ return "org.apache.xmlbeans.impl.values.JavaIntegerHolderEx";
+ case SchemaType.SIZE_LONG:
+ return "org.apache.xmlbeans.impl.values.JavaLongHolderEx";
+ case SchemaType.SIZE_INT:
+ case SchemaType.SIZE_SHORT:
+ case SchemaType.SIZE_BYTE:
+ return "org.apache.xmlbeans.impl.values.JavaIntHolderEx";
+ }
+ case SchemaType.BTC_STRING:
+ if (sType.hasStringEnumValues())
+ return "org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx";
+ else
+ return "org.apache.xmlbeans.impl.values.JavaStringHolderEx";
+
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ return "org.apache.xmlbeans.impl.values.JavaGDateHolderEx";
+
+ case SchemaType.BTC_DURATION:
+ return "org.apache.xmlbeans.impl.values.JavaGDurationHolderEx";
+ default:
+ assert(false) : "unrecognized primitive type";
+ return null;
+ }
+ }
+
+ static SchemaType findBaseType(SchemaType sType)
+ {
+ while (sType.getFullJavaName() == null)
+ sType = sType.getBaseType();
+ return sType;
+ }
+
+ String getBaseClass(SchemaType sType) {
+ SchemaType baseType = findBaseType(sType.getBaseType());
+
+ switch (sType.getSimpleVariety())
+ {
+ case SchemaType.NOT_SIMPLE:
+ // non-simple-content: inherit from base type impl
+ if (!XmlObject.type.equals(baseType))
+ return baseType.getFullJavaImplName();
+ return "org.apache.xmlbeans.impl.values.XmlComplexContentImpl";
+
+ case SchemaType.ATOMIC:
+ // We should only get called for restrictions
+ assert(! sType.isBuiltinType());
+ return getAtomicRestrictionType(sType);
+
+ case SchemaType.LIST:
+ return "org.apache.xmlbeans.impl.values.XmlListImpl";
+
+ case SchemaType.UNION:
+ return "org.apache.xmlbeans.impl.values.XmlUnionImpl";
+
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ void printConstructor(SchemaType sType, String shortName) throws IOException {
+ emit("");
+ emit("public " + shortName + "(org.apache.xmlbeans.SchemaType sType)");
+ startBlock();
+ emit("super(sType" + (sType.getSimpleVariety() == SchemaType.NOT_SIMPLE ?
+ "":
+ ", " + !sType.isSimpleType()) +
+ ");");
+ endBlock();
+
+ if (sType.getSimpleVariety() != SchemaType.NOT_SIMPLE)
+ {
+ emit("");
+ emit("protected " + shortName + "(org.apache.xmlbeans.SchemaType sType, boolean b)");
+ startBlock();
+ emit("super(sType, b);");
+ endBlock();
+ }
+ }
+
+ void startClass(SchemaType sType, boolean isInner) throws IOException
+ {
+ String shortName = sType.getShortJavaImplName();
+ String baseClass = getBaseClass(sType);
+ StringBuffer interfaces = new StringBuffer();
+ interfaces.append(sType.getFullJavaName().replace('$', '.'));
+
+ if (sType.getSimpleVariety() == SchemaType.UNION) {
+ SchemaType[] memberTypes = sType.getUnionMemberTypes();
+ for (int i = 0 ; i < memberTypes.length ; i++)
+ interfaces.append(", " + memberTypes[i].getFullJavaName().replace('$', '.'));
+ }
+
+ emit("public " + ( isInner ? "static ": "" ) + "class " + shortName +
+ " extends " + baseClass + " implements " + interfaces.toString());
+
+ startBlock();
+ }
+
+ void makeAttributeDefaultValue(String jtargetType, SchemaProperty prop, String identifier) throws IOException
+ {
+ String fullName = jtargetType;
+ if (fullName == null)
+ fullName = prop.javaBasedOnType().getFullJavaName().replace('$', '.');
+
+ emit("target = (" + fullName + ")get_default_attribute_value(" + identifier + ");");
+ }
+
+ void makeMissingValue(int javaType) throws IOException
+ {
+ switch (javaType)
+ {
+ case SchemaProperty.JAVA_BOOLEAN:
+ emit("return false;"); break;
+
+ case SchemaProperty.JAVA_FLOAT:
+ emit("return 0.0f;"); break;
+
+ case SchemaProperty.JAVA_DOUBLE:
+ emit("return 0.0;"); break;
+
+ case SchemaProperty.JAVA_BYTE:
+ case SchemaProperty.JAVA_SHORT:
+ case SchemaProperty.JAVA_INT:
+ emit("return 0;"); break;
+
+ case SchemaProperty.JAVA_LONG:
+ emit("return 0L;"); break;
+
+ default:
+ case SchemaProperty.XML_OBJECT:
+ case SchemaProperty.JAVA_BIG_DECIMAL:
+ case SchemaProperty.JAVA_BIG_INTEGER:
+ case SchemaProperty.JAVA_STRING:
+ case SchemaProperty.JAVA_BYTE_ARRAY:
+ case SchemaProperty.JAVA_GDATE:
+ case SchemaProperty.JAVA_GDURATION:
+ case SchemaProperty.JAVA_DATE:
+ case SchemaProperty.JAVA_QNAME:
+ case SchemaProperty.JAVA_LIST:
+ case SchemaProperty.JAVA_CALENDAR:
+ case SchemaProperty.JAVA_ENUM:
+ case SchemaProperty.JAVA_OBJECT:
+ emit("return null;"); break;
+ }
+ }
+
+ void printJGetArrayValue(int javaType, String type) throws IOException {
+ switch (javaType)
+ {
+ case SchemaProperty.XML_OBJECT:
+ emit(type + "[] result = new " + type + "[targetList.size()];");
+ emit("targetList.toArray(result);");
+ break;
+
+ case SchemaProperty.JAVA_ENUM:
+ emit(type + "[] result = new " + type + "[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = (" + type + ")((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getEnumValue();");
+ break;
+
+ case SchemaProperty.JAVA_BOOLEAN:
+ emit("boolean[] result = new boolean[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getBooleanValue();");
+ break;
+
+ case SchemaProperty.JAVA_FLOAT:
+ emit("float[] result = new float[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getFloatValue();");
+ break;
+
+ case SchemaProperty.JAVA_DOUBLE:
+ emit("double[] result = new double[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getDoubleValue();");
+ break;
+
+ case SchemaProperty.JAVA_BYTE:
+ emit("byte[] result = new byte[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getByteValue();");
+ break;
+
+ case SchemaProperty.JAVA_SHORT:
+ emit("short[] result = new short[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getShortValue();");
+ break;
+
+ case SchemaProperty.JAVA_INT:
+ emit("int[] result = new int[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getIntValue();");
+ break;
+
+ case SchemaProperty.JAVA_LONG:
+ emit("long[] result = new long[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getLongValue();");
+ break;
+
+ case SchemaProperty.JAVA_BIG_DECIMAL:
+ emit("java.math.BigDecimal[] result = new java.math.BigDecimal[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getBigDecimalValue();");
+ break;
+
+ case SchemaProperty.JAVA_BIG_INTEGER:
+ emit("java.math.BigInteger[] result = new java.math.BigInteger[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getBigIntegerValue();");
+ break;
+
+ case SchemaProperty.JAVA_STRING:
+ emit("java.lang.String[] result = new java.lang.String[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getStringValue();");
+ break;
+
+ case SchemaProperty.JAVA_BYTE_ARRAY:
+ emit("byte[][] result = new byte[targetList.size()][];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getByteArrayValue();");
+ break;
+
+ case SchemaProperty.JAVA_CALENDAR:
+ emit("java.util.Calendar[] result = new java.util.Calendar[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getCalendarValue();");
+ break;
+
+ case SchemaProperty.JAVA_DATE:
+ emit("java.util.Date[] result = new java.util.Date[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getDateValue();");
+ break;
+
+ case SchemaProperty.JAVA_GDATE:
+ emit("org.apache.xmlbeans.GDate[] result = new org.apache.xmlbeans.GDate[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getGDateValue();");
+ break;
+
+ case SchemaProperty.JAVA_GDURATION:
+ emit("org.apache.xmlbeans.GDuration[] result = new org.apache.xmlbeans.GDuration[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getGDurationValue();");
+ break;
+
+ case SchemaProperty.JAVA_QNAME:
+ emit("javax.xml.namespace.QName[] result = new javax.xml.namespace.QName[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getQNameValue();");
+ break;
+
+ case SchemaProperty.JAVA_LIST:
+ emit("java.util.List[] result = new java.util.List[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getListValue();");
+ break;
+
+ case SchemaProperty.JAVA_OBJECT:
+ emit("java.lang.Object[] result = new java.lang.Object[targetList.size()];");
+ emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
+ emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getObjectValue();");
+ break;
+
+ }
+ emit("return result;");
+ }
+ void printJGetValue(int javaType, String type) throws IOException {
+ switch (javaType)
+ {
+ case SchemaProperty.XML_OBJECT:
+ emit("return target;"); break;
+
+ case SchemaProperty.JAVA_BOOLEAN:
+ emit("return target.getBooleanValue();"); break;
+
+ case SchemaProperty.JAVA_FLOAT:
+ emit("return target.getFloatValue();"); break;
+
+ case SchemaProperty.JAVA_DOUBLE:
+ emit("return target.getDoubleValue();"); break;
+
+ case SchemaProperty.JAVA_BYTE:
+ emit("return target.getByteValue();"); break;
+
+ case SchemaProperty.JAVA_SHORT:
+ emit("return target.getShortValue();"); break;
+
+ case SchemaProperty.JAVA_INT:
+ emit("return target.getIntValue();"); break;
+
+ case SchemaProperty.JAVA_LONG:
+ emit("return target.getLongValue();"); break;
+
+ case SchemaProperty.JAVA_BIG_DECIMAL:
+ emit("return target.getBigDecimalValue();"); break;
+
+ case SchemaProperty.JAVA_BIG_INTEGER:
+ emit("return target.getBigIntegerValue();"); break;
+
+ case SchemaProperty.JAVA_STRING:
+ emit("return target.getStringValue();"); break;
+
+ case SchemaProperty.JAVA_BYTE_ARRAY:
+ emit("return target.getByteArrayValue();"); break;
+
+ case SchemaProperty.JAVA_GDATE:
+ emit("return target.getGDateValue();"); break;
+
+ case SchemaProperty.JAVA_GDURATION:
+ emit("return target.getGDurationValue();"); break;
+
+ case SchemaProperty.JAVA_CALENDAR:
+ emit("return target.getCalendarValue();"); break;
+
+ case SchemaProperty.JAVA_DATE:
+ emit("return target.getDateValue();"); break;
+
+ case SchemaProperty.JAVA_QNAME:
+ emit("return target.getQNameValue();"); break;
+
+ case SchemaProperty.JAVA_LIST:
+ emit("return target.getListValue();"); break;
+
+ case SchemaProperty.JAVA_ENUM:
+ emit("return (" + type + ")target.getEnumValue();"); break;
+
+ case SchemaProperty.JAVA_OBJECT:
+ emit("return target.getObjectValue();"); break;
+ }
+ }
+
+ String jsetMethod(int javaType) throws IOException
+ {
+ switch (javaType)
+ {
+ case SchemaProperty.XML_OBJECT:
+ return "target.set";
+
+ case SchemaProperty.JAVA_BOOLEAN:
+ return "target.setBooleanValue";
+
+ case SchemaProperty.JAVA_FLOAT:
+ return "target.setFloatValue";
+
+ case SchemaProperty.JAVA_DOUBLE:
+ return "target.setDoubleValue";
+
+ case SchemaProperty.JAVA_BYTE:
+ return "target.setByteValue";
+
+ case SchemaProperty.JAVA_SHORT:
+ return "target.setShortValue";
+
+ case SchemaProperty.JAVA_INT:
+ return "target.setIntValue";
+
+ case SchemaProperty.JAVA_LONG:
+ return "target.setLongValue";
+
+ case SchemaProperty.JAVA_BIG_DECIMAL:
+ return "target.setBigDecimalValue";
+
+ case SchemaProperty.JAVA_BIG_INTEGER:
+ return "target.setBigIntegerValue";
+
+ case SchemaProperty.JAVA_STRING:
+ return "target.setStringValue";
+
+ case SchemaProperty.JAVA_BYTE_ARRAY:
+ return "target.setByteArrayValue";
+
+ case SchemaProperty.JAVA_GDATE:
+ return "target.setGDateValue";
+
+ case SchemaProperty.JAVA_GDURATION:
+ return "target.setGDurationValue";
+
+ case SchemaProperty.JAVA_CALENDAR:
+ return "target.setCalendarValue";
+
+ case SchemaProperty.JAVA_DATE:
+ return "target.setDateValue";
+
+ case SchemaProperty.JAVA_QNAME:
+ return "target.setQNameValue";
+
+ case SchemaProperty.JAVA_LIST:
+ return "target.setListValue";
+
+ case SchemaProperty.JAVA_ENUM:
+ return "target.setEnumValue";
+
+ case SchemaProperty.JAVA_OBJECT:
+ return "target.setObjectValue";
+
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ String getIdentifier(Map qNameMap, QName qName) {
+ return ((String[])qNameMap.get(qName))[0];
+ }
+
+ String getSetIdentifier(Map qNameMap, QName qName) {
+ String[] identifiers = (String[])qNameMap.get(qName);
+ return identifiers[1] == null ? identifiers[0] : identifiers[1];
+ }
+
+ Map printStaticFields(SchemaProperty[] properties) throws IOException {
+ final Map results = new HashMap();
+
+ emit("");
+ for (int i = 0; i < properties.length; i++)
+ {
+ final String[] identifiers = new String[2];
+ final SchemaProperty prop = properties[i];
+ final QName name = prop.getName();
+ results.put(name, identifiers);
+ final String javaName = prop.getJavaPropertyName();
+ identifiers[0] = (javaName + "$" + (i * 2)).toUpperCase();
+ final String uriString = "\"" + name.getNamespaceURI() + "\"";
+
+ emit("private static final javax.xml.namespace.QName " + identifiers[0] +
+ " = " );
+ indent();
+ emit("new javax.xml.namespace.QName(" +
+ uriString + ", \"" + name.getLocalPart() + "\");");
+ outdent();
+
+ if (properties[i].acceptedNames() != null)
+ {
+ final QName[] qnames = properties[i].acceptedNames();
+
+ if (qnames.length > 1)
+ {
+ identifiers[1] = (javaName + "$" + (i*2+1)).toUpperCase();
+
+ emit("private static final org.apache.xmlbeans.QNameSet " + identifiers[1] +
+ " = org.apache.xmlbeans.QNameSet.forArray( new javax.xml.namespace.QName[] { " );
+ indent();
+ for (int j = 0 ; j < qnames.length ; j++)
+ {
+ emit("new javax.xml.namespace.QName(\"" + qnames[j].getNamespaceURI() +
+ "\", \"" + qnames[j].getLocalPart() + "\"),");
+ }
+
+ outdent();
+
+ emit("});");
+ }
+ }
+ }
+ emit("");
+ return results;
+ }
+
+ void emitImplementationPreamble() throws IOException
+ {
+ emit("synchronized (monitor())");
+ emit("{");
+ indent();
+ emit("check_orphaned();");
+ }
+
+ void emitImplementationPostamble() throws IOException
+ {
+ outdent();
+ emit("}");
+ }
+
+ void emitDeclareTarget(boolean declareTarget, String xtype)
+ throws IOException
+ {
+ if (declareTarget)
+ emit(xtype + " target = null;");
+ }
+
+ void emitAddTarget(String identifier, boolean isAttr, boolean declareTarget, String xtype)
+ throws IOException
+ {
+ if (isAttr)
+ emit("target = (" + xtype + ")get_store().add_attribute_user(" + identifier + ");");
+ else
+ emit("target = (" + xtype + ")get_store().add_element_user(" + identifier + ");");
+ }
+
+ void emitPre(SchemaType sType, int opType, String identifier, boolean isAttr) throws IOException
+ {
+ emitPre(sType, opType, identifier, isAttr, "-1");
+ }
+
+ void emitPre(SchemaType sType, int opType, String identifier, boolean isAttr, String index) throws IOException
+ {
+ SchemaTypeImpl sImpl = getImpl(sType);
+ if (sImpl==null)
+ return;
+
+ ExtensionHolder extHolder = sImpl.getExtensionHolder();
+ if (extHolder==null)
+ return;
+
+ PrePostExtension ext = extHolder.getPrePostExtensionsFor(sType.getFullJavaName());
+ if (ext!=null)
+ {
+ if (ext.hasPreCall())
+ {
+ emit("if ( " + ext.getPreCall(opType, identifier, isAttr, index) + " )");
+ startBlock();
+ }
+ }
+ }
+
+ void emitPost(SchemaType sType, int opType, String identifier, boolean isAttr) throws IOException
+ {
+ emitPost(sType, opType, identifier, isAttr, "-1");
+ }
+
+ void emitPost(SchemaType sType, int opType, String identifier, boolean isAttr, String index) throws IOException
+ {
+ SchemaTypeImpl sImpl = getImpl(sType);
+ if (sImpl==null)
+ return;
+
+ ExtensionHolder extHolder = sImpl.getExtensionHolder();
+ if (extHolder==null)
+ return;
+
+ PrePostExtension ext = extHolder.getPrePostExtensionsFor(sType.getFullJavaName());
+ if (ext!=null)
+ {
+ if (ext.hasPreCall())
+ {
+ endBlock();
+ }
+
+ if (ext.hasPostCall())
+ emit(ext.getPostCall(opType, identifier, isAttr, index));
+ }
+ }
+
+ private static final int NOTHING = 1;
+ private static final int ADD_NEW_VALUE = 3;
+ private static final int THROW_EXCEPTION = 4;
+
+ void emitGetTarget(String setIdentifier,
+ String identifier,
+ boolean isAttr,
+ String index,
+ int nullBehaviour,
+ String xtype)
+ throws IOException
+ {
+ assert setIdentifier != null && identifier != null;
+
+ emit(xtype + " target = null;");
+
+ if (isAttr)
+ emit("target = (" + xtype + ")get_store().find_attribute_user(" + identifier + ");");
+ else
+ emit("target = (" + xtype + ")get_store().find_element_user(" + setIdentifier + ", " + index + ");");
+
+ if (nullBehaviour == NOTHING)
+ return;
+
+ emit("if (target == null)");
+
+ startBlock();
+
+ switch (nullBehaviour)
+ {
+ case ADD_NEW_VALUE:
+ // target already emited, no need for emitDeclareTarget(false, xtype);
+ emitAddTarget(identifier, isAttr, false, xtype);
+ break;
+
+ case THROW_EXCEPTION:
+ emit("throw new IndexOutOfBoundsException();");
+ break;
+
+ case NOTHING:
+ break;
+
+ default:
+ assert false : "Bad behaviour type: " + nullBehaviour;
+ }
+
+ endBlock();
+ }
+
+ void printGetterImpls(
+ SchemaProperty prop, QName qName, boolean isAttr, String propertyName,
+ int javaType, String type, String xtype, boolean nillable,
+ boolean optional, boolean several, boolean singleton,
+ boolean isunion,
+ String identifier, String setIdentifier )
+ throws IOException
+ {
+ String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
+ boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
+ String jtargetType = (isunion || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
+
+ if (singleton)
+ {
+ // Value getProp()
+ printJavaDoc((several ? "Gets first " : "Gets the ") + propdesc);
+ emit("public " + type + " get" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", NOTHING, jtargetType);
+
+ if (isAttr && (prop.hasDefault() == SchemaProperty.CONSISTENTLY ||
+ prop.hasFixed() == SchemaProperty.CONSISTENTLY))
+ {
+ emit("if (target == null)");
+ startBlock();
+ makeAttributeDefaultValue(jtargetType, prop, identifier);
+ endBlock();
+ }
+ emit("if (target == null)");
+ startBlock();
+ makeMissingValue(javaType);
+ endBlock();
+
+
+ printJGetValue(javaType, type);
+
+ emitImplementationPostamble();
+
+ endBlock();
+
+ if (!xmltype)
+ {
+ // Value xgetProp()
+ printJavaDoc((several ? "Gets (as xml) first " : "Gets (as xml) the ") + propdesc);
+ emit("public " + xtype + " xget" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", NOTHING, xtype);
+
+ if (isAttr && (prop.hasDefault() == SchemaProperty.CONSISTENTLY ||
+ prop.hasFixed() == SchemaProperty.CONSISTENTLY))
+ {
+ emit("if (target == null)");
+ startBlock();
+ makeAttributeDefaultValue(xtype, prop, identifier);
+ endBlock();
+ }
+
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (nillable)
+ {
+ // boolean isNilProp()
+ printJavaDoc((several ? "Tests for nil first " : "Tests for nil ") + propdesc);
+ emit("public boolean isNil" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", NOTHING, xtype);
+
+ emit("if (target == null) return false;");
+ emit("return target.isNil();");
+ emitImplementationPostamble();
+ endBlock();
+ }
+ }
+
+ if (optional)
+ {
+ // boolean isSetProp()
+ printJavaDoc((several ? "True if has at least one " : "True if has ") + propdesc);
+ emit("public boolean isSet" + propertyName + "()");
+
+ startBlock();
+ emitImplementationPreamble();
+
+ if (isAttr)
+ emit("return get_store().find_attribute_user(" + identifier +") != null;");
+ else
+ emit("return get_store().count_elements(" + setIdentifier + ") != 0;");
+
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (several)
+ {
+ String arrayName = propertyName + "Array";
+
+ // Value[] getProp()
+ printJavaDoc("Gets array of all " + propdesc + "s");
+ emit("public " + type + "[] get" + arrayName + "()");
+ startBlock();
+ emitImplementationPreamble();
+
+ emit("java.util.List targetList = new java.util.ArrayList();");
+ emit("get_store().find_all_element_users(" + setIdentifier + ", targetList);");
+
+ printJGetArrayValue(javaType, type);
+
+ emitImplementationPostamble();
+ endBlock();
+
+ // Value getProp(int i)
+ printJavaDoc("Gets ith " + propdesc);
+ emit("public " + type + " get" + arrayName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
+ printJGetValue(javaType, type);
+
+ emitImplementationPostamble();
+ endBlock();
+
+ if (!xmltype)
+ {
+ // Value[] xgetProp()
+ printJavaDoc("Gets (as xml) array of all " + propdesc + "s");
+ emit("public " + xtype + "[] xget" + arrayName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emit("java.util.List targetList = new java.util.ArrayList();");
+ emit("get_store().find_all_element_users(" + setIdentifier + ", targetList);");
+ emit(xtype + "[] result = new " + xtype + "[targetList.size()];");
+ emit("targetList.toArray(result);");
+ emit("return result;");
+ emitImplementationPostamble();
+ endBlock();
+
+ // Value xgetProp(int i)
+ printJavaDoc("Gets (as xml) ith " + propdesc);
+ emit("public " + xtype + " xget" + arrayName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, xtype);
+ emit("return (" + xtype + ")target;");
+ emitImplementationPostamble();
+ endBlock();
+
+ }
+
+ if (nillable)
+ {
+ // boolean isNil(int i);
+ printJavaDoc("Tests for nil ith " + propdesc);
+ emit("public boolean isNil" + arrayName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, xtype);
+ emit("return target.isNil();");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ // int countProp();
+ printJavaDoc("Returns number of " + propdesc);
+ emit("public int sizeOf" + arrayName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emit("return get_store().count_elements(" + setIdentifier +");");
+ emitImplementationPostamble();
+ endBlock();
+ }
+ }
+
+ void printSetterImpls(QName qName, boolean isAttr,
+ String propertyName, int javaType, String type, String xtype,
+ boolean nillable, boolean optional,
+ boolean several, boolean singleton,
+ boolean isunion,
+ String identifier, String setIdentifier, SchemaType sType )
+ throws IOException
+ {
+ String safeVarName = NameUtil.nonJavaKeyword(NameUtil.lowerCamelCase(propertyName));
+ if (safeVarName.equals("i"))
+ safeVarName = "iValue";
+ else if (safeVarName.equals("target"))
+ safeVarName = "targetValue";
+
+ boolean xmltype = (javaType == SchemaProperty.XML_OBJECT);
+ boolean isobj = (javaType == SchemaProperty.JAVA_OBJECT);
+ boolean isSubstGroup = identifier != setIdentifier;
+ String jSet = jsetMethod(javaType);
+ String jtargetType = (isunion || !xmltype) ? "org.apache.xmlbeans.SimpleValue" : xtype;
+
+ String propdesc = "\"" + qName.getLocalPart() + "\"" + (isAttr ? " attribute" : " element");
+
+ if (singleton)
+ {
+ // void setProp(Value v);
+ printJavaDoc((several ? "Sets first " : "Sets the ") + propdesc);
+ emit("public void set" + propertyName + "(" + type + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, jtargetType);
+ emit(jSet + "(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitImplementationPostamble();
+ endBlock();
+
+ if (!xmltype)
+ {
+ // void xsetProp(Value v)
+ printJavaDoc((several ? "Sets (as xml) first " : "Sets (as xml) the ") + propdesc);
+ emit("public void xset" + propertyName + "(" + xtype + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, xtype);
+ emit("target.set(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitImplementationPostamble();
+ endBlock();
+
+ }
+
+ if (xmltype && !several)
+ {
+ // Value addNewProp()
+ printJavaDoc("Appends and returns a new empty " + propdesc);
+ emit("public " + xtype + " addNew" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitDeclareTarget(true, xtype);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitAddTarget(identifier, isAttr, true, xtype);
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (nillable)
+ {
+ printJavaDoc((several ? "Nils the first " : "Nils the ") + propdesc);
+ emit("public void setNil" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitGetTarget(setIdentifier, identifier, isAttr, "0", ADD_NEW_VALUE, xtype);
+ emit("target.setNil();");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, several ? "0" : "-1");
+ emitImplementationPostamble();
+ endBlock();
+ }
+ }
+
+ if (optional)
+ {
+ printJavaDoc((several ? "Removes first " : "Unsets the ") + propdesc);
+ emit("public void unset" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, several ? "0" : "-1");
+ if (isAttr)
+ emit("get_store().remove_attribute(" + identifier + ");");
+ else
+ emit("get_store().remove_element(" + setIdentifier + ", 0);");
+ emitPost(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, several ? "0" : "-1");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (several)
+ {
+ String arrayName = propertyName + "Array";
+
+ // JSET_INDEX
+ printJavaDoc("Sets array of all " + propdesc);
+ emit("public void set" + arrayName + "(" + type + "[] " + safeVarName + "Array)");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+
+ if (isobj)
+ {
+ if (!isSubstGroup)
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");" );
+ else
+ emit("unionArraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");" );
+ }
+ else
+ {
+ if (!isSubstGroup)
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");" );
+ else
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ", " + setIdentifier + ");" );
+ }
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ emitImplementationPostamble();
+ endBlock();
+
+ printJavaDoc("Sets ith " + propdesc);
+ emit("public void set" + arrayName + "(int i, " + type + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, jtargetType);
+ emit(jSet + "(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+
+ if (!xmltype)
+ {
+ printJavaDoc("Sets (as xml) array of all " + propdesc);
+ emit("public void xset" + arrayName + "(" + xtype + "[]" + safeVarName + "Array)");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ emit("arraySetterHelper(" + safeVarName + "Array" + ", " + identifier + ");" );
+
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr);
+ emitImplementationPostamble();
+ endBlock();
+
+ printJavaDoc("Sets (as xml) ith " + propdesc);
+ emit("public void xset" + arrayName + "(int i, " + xtype + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, xtype);
+ emit("target.set(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (nillable)
+ {
+ printJavaDoc("Nils the ith " + propdesc);
+ emit("public void setNil" + arrayName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitGetTarget(setIdentifier, identifier, isAttr, "i", THROW_EXCEPTION, xtype);
+ emit("target.setNil();");
+ emitPost(sType, PrePostExtension.OPERATION_SET, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (!xmltype)
+ {
+ printJavaDoc("Inserts the value as the ith " + propdesc);
+ emit("public void insert" + propertyName + "(int i, " + type + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emit(jtargetType + " target = ");
+ indent();
+ if (!isSubstGroup)
+ emit("(" + jtargetType + ")get_store().insert_element_user(" + identifier + ", i);");
+ else // This is a subst group case
+ emit ("(" + jtargetType +")get_store().insert_element_user(" + setIdentifier + ", " +
+ identifier + ", i);");
+ outdent();
+ emit(jSet + "(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+
+ printJavaDoc("Appends the value as the last " + propdesc);
+ emit("public void add" + propertyName + "(" + type + " " + safeVarName + ")");
+ startBlock();
+ emitImplementationPreamble();
+ emitDeclareTarget(true, jtargetType);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitAddTarget(identifier, isAttr, true, jtargetType);
+ emit(jSet + "(" + safeVarName + ");");
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ if (xmltype)
+ {
+ printJavaDoc("Inserts and returns a new empty value (as xml) as the ith " + propdesc);
+ emit("public " + xtype + " insertNew" + propertyName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitDeclareTarget(true, xtype);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emit("target = (" + xtype + ")get_store().insert_element_user(" + identifier + ", i);");
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr, "i");
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
+
+ printJavaDoc("Appends and returns a new empty value (as xml) as the last " + propdesc);
+ emit("public " + xtype + " addNew" + propertyName + "()");
+ startBlock();
+ emitImplementationPreamble();
+ emitDeclareTarget(true, xtype);
+ emitPre(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emitAddTarget(identifier, isAttr, true, xtype);
+ emitPost(sType, PrePostExtension.OPERATION_INSERT, identifier, isAttr);
+ emit("return target;");
+ emitImplementationPostamble();
+ endBlock();
+ }
+
+ printJavaDoc("Removes the ith " + propdesc);
+ emit("public void remove" + propertyName + "(int i)");
+ startBlock();
+ emitImplementationPreamble();
+ emitPre(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
+ emit("get_store().remove_element(" + setIdentifier + ", i);");
+ emitPost(sType, PrePostExtension.OPERATION_REMOVE, identifier, isAttr, "i");
+ emitImplementationPostamble();
+ endBlock();
+ }
+ }
+
+ static void getTypeName(Class c, StringBuffer sb) {
+ int arrayCount = 0;
+ while (c.isArray()) {
+ c = c.getComponentType();
+ arrayCount++;
+ }
+
+ sb.append(c.getName());
+
+ for (int i = 0 ; i < arrayCount; i++)
+ sb.append("[]");
+
+ }
+
+ void printInnerTypeImpl(
+ SchemaType sType, SchemaTypeSystem system, boolean isInner ) throws IOException
+ {
+ String shortName = sType.getShortJavaImplName();
+
+ printInnerTypeJavaDoc(sType);
+
+ startClass(sType, isInner);
+
+ printConstructor(sType, shortName);
+
+ printExtensionImplMethods(sType);
+
+ if (!sType.isSimpleType())
+ {
+ SchemaProperty[] properties;
+
+ if (sType.getContentType() == SchemaType.SIMPLE_CONTENT)
+ {
+ // simple content types impls derive directly from "holder" impls
+ // in order to handle the case (for ints or string enums e.g.) where
+ // there is a simple type restriction. So property getters need to
+ // be implemented "from scratch" for each derived complex type
+
+ properties = sType.getProperties();
+ }
+ else
+ {
+ // complex content type implementations derive from base type impls
+ // so derived property impls can be reused
+
+ properties = sType.getDerivedProperties();
+ }
+
+ Map qNameMap = printStaticFields(properties);
+
+ for (int i = 0; i < properties.length; i++)
+ {
+ SchemaProperty prop = properties[i];
+
+ QName name = prop.getName();
+ String xmlType = xmlTypeForProperty( prop );
+
+ printGetterImpls(
+ prop,
+ name,
+ prop.isAttribute(),
+ prop.getJavaPropertyName(),
+ prop.getJavaTypeCode(),
+ javaTypeForProperty(prop),
+ xmlType,
+ prop.hasNillable() != SchemaProperty.NEVER,
+ prop.extendsJavaOption(),
+ prop.extendsJavaArray(),
+ prop.extendsJavaSingleton(),
+ xmlTypeForPropertyIsUnion(prop),
+ getIdentifier(qNameMap, name),
+ getSetIdentifier(qNameMap, name)
+ );
+
+ if (!prop.isReadOnly())
+ {
+ printSetterImpls(
+ name,
+ prop.isAttribute(),
+ prop.getJavaPropertyName(),
+ prop.getJavaTypeCode(),
+ javaTypeForProperty(prop),
+ xmlType,
+ prop.hasNillable() != SchemaProperty.NEVER,
+ prop.extendsJavaOption(),
+ prop.extendsJavaArray(),
+ prop.extendsJavaSingleton(),
+ xmlTypeForPropertyIsUnion(prop),
+ getIdentifier(qNameMap, name),
+ getSetIdentifier(qNameMap, name),
+ sType
+ );
+ }
+ }
+ }
+
+ printNestedTypeImpls(sType, system);
+
+ endBlock();
+ }
+
+ private void printExtensionImplMethods(SchemaType sType) throws IOException
+ {
+ SchemaTypeImpl sImpl = getImpl(sType);
+ if (sImpl==null)
+ return;
+
+ ExtensionHolder extHolder = sImpl.getExtensionHolder();
+ if (extHolder==null)
+ return;
+
+ List exts = extHolder.getInterfaceExtensionsFor(sType.getFullJavaName());
+ for (Iterator i = exts.iterator(); i.hasNext(); )
+ {
+ InterfaceExtension ext = (InterfaceExtension)i.next();
+ for( int j = 0; j<ext.getInterfaceMethodCount(); j++)
+ {
+ printJavaDoc("Implementation method for interface " + ext.getInterfaceNameForJavaSource() );
+ emit(ext.getInterfaceMethodDecl(j));
+ startBlock();
+ emit(ext.getInterfaceMethodImpl(j));
+ endBlock();
+ }
+ }
+ }
+
+ void printNestedTypeImpls(SchemaType sType, SchemaTypeSystem system) throws IOException
+ {
+ SchemaType[] anonTypes = sType.getAnonymousTypes();
+ for (int i = 0; i < anonTypes.length; i++)
+ {
+ if (anonTypes[i].isSkippedAnonymousType())
+ printNestedTypeImpls(anonTypes[i], system);
+ else
+ printInnerTypeImpl(anonTypes[i], system, true);
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java
new file mode 100644
index 0000000..4ed4868
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java
@@ -0,0 +1,2021 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.impl.values.*;
+import org.apache.xmlbeans.impl.regex.RegularExpression;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.config.ExtensionHolder;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaTypeElementSequencer;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.StringEnumAbstractBase;
+import org.apache.xmlbeans.SchemaStringEnumEntry;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+import java.lang.reflect.Constructor;
+import java.util.*;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+public final class SchemaTypeImpl implements SchemaType, TypeStoreUserFactory
+{
+ // global types have names
+ private QName _name;
+
+ // compilation support
+ private int _resolvePhase;
+ private static final int UNRESOLVED = 0;
+ private static final int RESOLVING_SGS = 1; // For document types only
+ private static final int RESOLVED_SGS = 2; // For document types only
+ private static final int RESOLVING = 3;
+ private static final int RESOLVED = 4;
+ private static final int JAVAIZING = 5;
+ private static final int JAVAIZED = 6;
+
+ // anonymous type support
+ private SchemaType.Ref _outerSchemaTypeRef;
+ private volatile SchemaComponent.Ref _containerFieldRef;
+ private volatile SchemaField _containerField;
+ private volatile int _containerFieldCode;
+ private volatile int _containerFieldIndex;
+ private SchemaType.Ref[] _anonymousTyperefs;
+ private boolean _isDocumentType;
+ private boolean _isAttributeType;
+ // private boolean _skippedAnonymousType;
+
+ // compiletime java type support
+ private boolean _isCompiled;
+ private String _shortJavaName;
+ private String _fullJavaName;
+ private String _shortJavaImplName;
+ private String _fullJavaImplName;
+ private ExtensionHolder _extensionHolder;
+
+ // runtime java type support: volatile because they're cached
+ private volatile Class _javaClass;
+ private volatile Class _javaEnumClass;
+ private volatile Class _javaImplClass;
+ private volatile Constructor _javaImplConstructor;
+ private volatile Constructor _javaImplConstructor2;
+ private volatile boolean _implNotAvailable;
+
+ private final Object[] _ctrArgs = new Object[] { this };
+
+ // reflective support
+ private SchemaTypeSystem _typeSystem;
+ private String _filename;
+
+ // complex content support
+ private SchemaParticle _contentModel;
+ private volatile SchemaLocalElement[] _localElts; // lazily computed
+ private volatile Map _eltToIndexMap; // lazily computed
+ private volatile Map _attrToIndexMap; // lazily computed
+ private Map _propertyModelByElementName;
+ private Map _propertyModelByAttributeName;
+ private boolean _hasAllContent;
+ private boolean _orderSensitive;
+ private QNameSet _typedWildcardElements;
+ private QNameSet _typedWildcardAttributes;
+ private boolean _hasWildcardElements;
+ private boolean _hasWildcardAttributes;
+ // set of valid QNames that can be substituted for a property
+ private Set _validSubstitutions = Collections.EMPTY_SET;
+
+ // simple content support
+ private int _complexTypeVariety;
+ private SchemaAttributeModel _attributeModel;
+
+ // simple type support
+ private int _builtinTypeCode;
+
+ private int _simpleTypeVariety;
+ private boolean _isSimpleType;
+
+ private SchemaType.Ref _baseTyperef; // via restriction or extension
+ private int _baseDepth; // how many inheritance steps to AnyType
+ private int _derivationType;
+
+ // facets
+ private XmlValueRef[] _facetArray;
+ private boolean[] _fixedFacetArray;
+
+ // fundamental facets
+ private int _ordered;
+ private boolean _isFinite;
+ private boolean _isBounded;
+ private boolean _isNumeric;
+
+ private boolean _abs;
+ private boolean _finalExt;
+ private boolean _finalRest;
+ private boolean _finalList;
+ private boolean _finalUnion;
+ private boolean _blockExt;
+ private boolean _blockRest;
+
+ // whitespace facet
+ private int _whiteSpaceRule;
+
+ // regex patterns
+ private boolean _hasPatterns; // also takes into account base classes
+ private org.apache.xmlbeans.impl.regex.RegularExpression[] _patterns;
+
+ // enumerated values
+ private XmlValueRef[] _enumerationValues;
+ private SchemaType.Ref _baseEnumTyperef;
+ private boolean _stringEnumEnsured;
+ private volatile Map _lookupStringEnum;
+ private volatile List _listOfStringEnum;
+ private volatile Map _lookupStringEnumEntry;
+ private SchemaStringEnumEntry[] _stringEnumEntries;
+
+ // for lists only
+ private SchemaType.Ref _listItemTyperef;
+
+ // for unions only
+ private boolean _isUnionOfLists;
+ private SchemaType.Ref[] _unionMemberTyperefs;
+ private int _anonymousUnionMemberOrdinal;
+ private volatile SchemaType[] _unionConstituentTypes;
+ private volatile SchemaType[] _unionSubTypes;
+ private volatile SchemaType _unionCommonBaseType;
+
+ // for atomic types only
+ private SchemaType.Ref _primitiveTypeRef;
+
+ // for decimal restrictions only
+ private int _decimalSize;
+
+ // lazy loading support
+ private volatile boolean _unloaded;
+
+ // for document types only - only valid during compilation
+ private QName _sg;
+ private List _sgMembers = new ArrayList();
+
+ public boolean isUnloaded()
+ {
+ return _unloaded;
+ }
+
+ public void finishLoading()
+ {
+ _unloaded = false;
+ }
+
+
+
+ SchemaTypeImpl(SchemaTypeSystem typeSystem)
+ {
+ _typeSystem = typeSystem;
+ }
+
+ SchemaTypeImpl(SchemaTypeSystem typeSystem, boolean unloaded)
+ {
+ _typeSystem = typeSystem;
+ _unloaded = unloaded;
+ if (unloaded)
+ finishQuick();
+ }
+
+ public boolean isSGResolved()
+ { return _resolvePhase >= RESOLVED_SGS; }
+
+ public boolean isSGResolving()
+ { return _resolvePhase >= RESOLVING_SGS; }
+
+ public boolean isResolved()
+ { return _resolvePhase >= RESOLVED; }
+
+ public boolean isResolving()
+ { return _resolvePhase == RESOLVING; }
+
+ public boolean isUnjavaized()
+ { return _resolvePhase < JAVAIZED; }
+
+ public boolean isJavaized()
+ { return _resolvePhase == JAVAIZED; }
+
+ public void startResolvingSGs()
+ {
+ if (_resolvePhase != UNRESOLVED)
+ throw new IllegalStateException();
+ _resolvePhase = RESOLVING_SGS;
+ }
+
+ public void finishResolvingSGs()
+ {
+ if (_resolvePhase != RESOLVING_SGS)
+ throw new IllegalStateException();
+ _resolvePhase = RESOLVED_SGS;
+ }
+
+ public void startResolving()
+ {
+ if ( (_isDocumentType && _resolvePhase != RESOLVED_SGS) ||
+ (!_isDocumentType && _resolvePhase != UNRESOLVED))
+ throw new IllegalStateException();
+ _resolvePhase = RESOLVING;
+ }
+
+ public void finishResolving()
+ {
+ if (_resolvePhase != RESOLVING)
+ throw new IllegalStateException();
+ _resolvePhase = RESOLVED;
+ }
+
+ public void startJavaizing()
+ {
+ if (_resolvePhase != RESOLVED)
+ throw new IllegalStateException();
+ _resolvePhase = JAVAIZING;
+ }
+
+ public void finishJavaizing()
+ {
+ if (_resolvePhase != JAVAIZING)
+ throw new IllegalStateException();
+ _resolvePhase = JAVAIZED;
+ }
+
+ private void finishQuick()
+ {
+ _resolvePhase = JAVAIZED;
+ }
+
+ private void assertUnresolved()
+ {
+ if (_resolvePhase != UNRESOLVED && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ private void assertSGResolving()
+ {
+ if (_resolvePhase != RESOLVING_SGS && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ private void assertSGResolved()
+ {
+ if (_resolvePhase != RESOLVED_SGS && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ private void assertResolving()
+ {
+ if (_resolvePhase != RESOLVING && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ private void assertResolved()
+ {
+ if (_resolvePhase != RESOLVED && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ private void assertJavaizing()
+ {
+ if (_resolvePhase != JAVAIZING && !_unloaded)
+ throw new IllegalStateException();
+ }
+
+ public QName getName()
+ { return _name; }
+
+ public void setName(QName name)
+ { assertUnresolved(); _name = name; }
+
+ public String getSourceName()
+ {
+ if (_filename != null)
+ return _filename;
+ if (getOuterType() != null)
+ return getOuterType().getSourceName();
+
+ SchemaField field = getContainerField();
+ if (field != null)
+ {
+ if (field instanceof SchemaGlobalElement)
+ return ((SchemaGlobalElement)field).getSourceName();
+ if (field instanceof SchemaGlobalAttribute)
+ return ((SchemaGlobalAttribute)field).getSourceName();
+ }
+ return null;
+ }
+
+ public void setFilename(String filename)
+ { assertUnresolved(); _filename = filename; }
+
+ public int getComponentType()
+ { return SchemaComponent.TYPE; }
+
+ public boolean isAnonymousType()
+ { return _name == null; }
+
+ public boolean isDocumentType()
+ { return _isDocumentType; }
+
+ public boolean isAttributeType()
+ { return _isAttributeType; }
+
+ public QName getDocumentElementName()
+ {
+ if (_isDocumentType)
+ {
+ SchemaParticle sp = getContentModel();
+ if (sp != null)
+ return sp.getName();
+ }
+
+ return null;
+ }
+
+ public QName getAttributeTypeAttributeName()
+ {
+ if (_isAttributeType)
+ {
+ SchemaAttributeModel sam = getAttributeModel();
+ if (sam != null)
+ {
+ SchemaLocalAttribute[] slaArray = sam.getAttributes();
+ if (slaArray != null && slaArray.length > 0)
+ {
+ SchemaLocalAttribute sla = slaArray[0];
+ return sla.getName();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void setDocumentType(boolean isDocument)
+ { assertUnresolved(); _isDocumentType = isDocument; }
+
+ public void setAttributeType(boolean isAttribute)
+ { assertUnresolved(); _isAttributeType = isAttribute; }
+
+ public int getContentType()
+ { return _complexTypeVariety; }
+
+ public void setComplexTypeVariety(int complexTypeVariety)
+ { assertResolving(); _complexTypeVariety = complexTypeVariety; }
+
+ public SchemaTypeElementSequencer getElementSequencer()
+ {
+ if (_complexTypeVariety == NOT_COMPLEX_TYPE)
+ return new SequencerImpl(null);
+
+ return new SequencerImpl(new SchemaTypeVisitorImpl(_contentModel));
+ }
+
+ /** Set the abstract and final flags for a complex type */
+ void setAbstractFinal(
+ boolean abs, boolean finalExt, boolean finalRest, boolean finalList, boolean finalUnion)
+ {
+ assertResolving();
+ _abs = abs;
+ _finalExt = finalExt; _finalRest = finalRest;
+ _finalList = finalList; _finalUnion = finalUnion;
+ }
+
+ /** Set the final flags for a simple type */
+ void setSimpleFinal(boolean finalRest, boolean finalList, boolean finalUnion)
+ {
+ assertResolving(); _finalRest = finalRest; _finalList = finalList ; _finalUnion = finalUnion;
+ }
+
+ void setBlock(boolean blockExt, boolean blockRest)
+ {
+ assertResolving(); _blockExt = blockExt ; _blockRest = blockRest;
+ }
+
+ public boolean blockRestriction()
+ { return _blockRest; }
+
+ public boolean blockExtension()
+ { return _blockExt; }
+
+ public boolean isAbstract()
+ { return _abs; }
+
+ public boolean finalExtension()
+ { return _finalExt; }
+
+ public boolean finalRestriction()
+ { return _finalRest; }
+
+ public boolean finalList()
+ { return _finalList; }
+
+ public boolean finalUnion()
+ { return _finalUnion; }
+
+ public synchronized SchemaField getContainerField()
+ {
+ if (_containerFieldCode != -1)
+ {
+ SchemaType outer = getOuterType();
+ if (_containerFieldCode == 0)
+ _containerField = _containerFieldRef == null ? null : (SchemaField)_containerFieldRef.getComponent();
+ else if (_containerFieldCode == 1)
+ _containerField = outer.getAttributeModel().getAttributes()[_containerFieldIndex];
+ else
+ _containerField = ((SchemaTypeImpl)outer).getLocalElementByIndex(_containerFieldIndex);
+ _containerFieldCode = -1;
+ }
+ return _containerField;
+ }
+
+ public void setContainerField(SchemaField field)
+ {
+ assertUnresolved();
+ _containerField = field;
+ _containerFieldCode = -1;
+ }
+
+ public void setContainerFieldRef(SchemaComponent.Ref ref)
+ {
+ assertUnresolved();
+ _containerFieldRef = ref;
+ _containerFieldCode = 0;
+ }
+
+ public void setContainerFieldIndex(short code, int index)
+ {
+ assertUnresolved();
+ _containerFieldCode = code;
+ _containerFieldIndex = index;
+ }
+
+ public SchemaType getOuterType()
+ { return _outerSchemaTypeRef == null ? null : _outerSchemaTypeRef.get(); }
+
+ public void setOuterSchemaTypeRef(SchemaType.Ref typeref)
+ { assertUnresolved(); _outerSchemaTypeRef = typeref; }
+
+ public boolean isCompiled()
+ { return _isCompiled; }
+
+ public void setCompiled(boolean f)
+ { assertJavaizing(); _isCompiled = f; }
+
+ public boolean isSkippedAnonymousType()
+ { return _outerSchemaTypeRef.get().getBaseType() == this; }
+
+ public String getShortJavaName()
+ { return _shortJavaName; }
+
+ public void setShortJavaName(String name)
+ {
+ assertResolved();
+ _shortJavaName = name;
+ SchemaType outer = _outerSchemaTypeRef.get();
+ while (outer.getFullJavaName() == null)
+ outer = outer.getOuterType();
+
+ _fullJavaName = outer.getFullJavaName() + "$" + _shortJavaName;
+ }
+
+ public String getFullJavaName()
+ { return _fullJavaName; }
+
+ public void setFullJavaName(String name)
+ {
+ assertResolved();
+ _fullJavaName = name;
+ int index = Math.max(_fullJavaName.lastIndexOf('$'),
+ _fullJavaName.lastIndexOf('.')) + 1;
+ _shortJavaName = _fullJavaName.substring(index);
+ }
+
+ public void setShortJavaImplName(String name)
+ {
+ assertResolved();
+ _shortJavaImplName = name;
+ SchemaType outer = _outerSchemaTypeRef.get();
+ while (outer.getFullJavaImplName() == null)
+ outer = outer.getOuterType();
+
+ _fullJavaImplName = outer.getFullJavaImplName() + "$" + _shortJavaImplName;
+ }
+
+ public void setFullJavaImplName(String name)
+ {
+ assertResolved();
+ _fullJavaImplName = name;
+ int index = Math.max(_fullJavaImplName.lastIndexOf('$'),
+ _fullJavaImplName.lastIndexOf('.')) + 1;
+ _shortJavaImplName = _fullJavaImplName.substring(index);
+ }
+
+ public void setExtensionHolder(ExtensionHolder extHolder)
+ {
+ assertResolved();
+ _extensionHolder = extHolder;
+ }
+
+ public ExtensionHolder getExtensionHolder()
+ {
+ return _extensionHolder;
+ }
+
+ public String getFullJavaImplName() { return _fullJavaImplName;}
+ public String getShortJavaImplName() { return _shortJavaImplName;}
+
+ public SchemaTypeSystem getTypeSystem()
+ { return _typeSystem; }
+
+ public SchemaParticle getContentModel()
+ { return _contentModel; }
+
+ private static void buildEltList(List eltList, SchemaParticle contentModel)
+ {
+ if (contentModel == null)
+ return;
+
+ switch (contentModel.getParticleType())
+ {
+ case SchemaParticle.ELEMENT:
+ eltList.add(contentModel);
+ return;
+ case SchemaParticle.ALL:
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.SEQUENCE:
+ for (int i = 0; i < contentModel.countOfParticleChild(); i++)
+ buildEltList(eltList, contentModel.getParticleChild(i));
+ return;
+ default:
+ return;
+ }
+ }
+
+ private void buildLocalElts()
+ {
+ List eltList = new ArrayList();
+ buildEltList(eltList, _contentModel);
+ _localElts = (SchemaLocalElement[])eltList.toArray(new SchemaLocalElement[eltList.size()]);
+ }
+
+ public SchemaLocalElement getLocalElementByIndex(int i)
+ {
+ SchemaLocalElement[] elts = _localElts;
+ if (elts == null)
+ {
+ buildLocalElts();
+ elts = _localElts;
+ }
+ return elts[i];
+ }
+
+ public int getIndexForLocalElement(SchemaLocalElement elt)
+ {
+ Map localEltMap = _eltToIndexMap;
+ if (localEltMap == null)
+ {
+ if (_localElts == null)
+ buildLocalElts();
+ localEltMap = new HashMap();
+ for (int i = 0; i < _localElts.length; i++)
+ {
+ localEltMap.put(_localElts[i], new Integer(i));
+ }
+ _eltToIndexMap = localEltMap;
+ }
+ return ((Integer)localEltMap.get(elt)).intValue();
+ }
+
+ public int getIndexForLocalAttribute(SchemaLocalAttribute attr)
+ {
+ Map localAttrMap = _attrToIndexMap;
+ if (localAttrMap == null)
+ {
+ localAttrMap = new HashMap();
+ SchemaLocalAttribute[] attrs = this._attributeModel.getAttributes();
+ for (int i = 0; i < attrs.length; i++)
+ {
+ localAttrMap.put(attrs[i], new Integer(i));
+ }
+ _attrToIndexMap = localAttrMap;
+ }
+ return ((Integer)localAttrMap.get(attr)).intValue();
+ }
+
+ public SchemaAttributeModel getAttributeModel()
+ { return _attributeModel; }
+
+ public SchemaProperty[] getProperties()
+ {
+ if (_propertyModelByElementName == null)
+ return getAttributeProperties();
+
+ if (_propertyModelByAttributeName == null)
+ return getElementProperties();
+
+ List list = new ArrayList();
+ list.addAll(_propertyModelByElementName.values());
+ list.addAll(_propertyModelByAttributeName.values());
+ if (list.size()==0)
+ return NO_PROPERTIES;
+ return (SchemaProperty[])list.toArray(new SchemaProperty[list.size()]);
+ }
+
+ private static final SchemaProperty[] NO_PROPERTIES = new SchemaProperty[0];
+
+ public SchemaProperty[] getDerivedProperties()
+ {
+ SchemaType baseType = getBaseType();
+ if (baseType == null)
+ return getProperties();
+
+ List results = new ArrayList();
+
+ if (_propertyModelByElementName != null)
+ results.addAll(_propertyModelByElementName.values());
+
+ if (_propertyModelByAttributeName != null)
+ results.addAll(_propertyModelByAttributeName.values());
+
+ for (Iterator it = results.iterator() ; it.hasNext() ; )
+ {
+ SchemaProperty prop = (SchemaProperty)it.next();
+ SchemaProperty baseProp = prop.isAttribute() ?
+ baseType.getAttributeProperty(prop.getName()) :
+ baseType.getElementProperty(prop.getName());
+
+
+ // Remove the derived property from the results if it is
+ // A) present in the base type and
+ // B) all the details are the same (cardinality, nillability)
+
+ if (baseProp != null)
+ {
+ if ( eq(prop.getMinOccurs(), baseProp.getMinOccurs()) &&
+ eq(prop.getMaxOccurs(), baseProp.getMaxOccurs()) &&
+ prop.hasNillable() == baseProp.hasNillable())
+ {
+ it.remove();
+ }
+
+ }
+
+ }
+
+ if (results.size() == 0)
+ return NO_PROPERTIES;
+ return (SchemaProperty[])results.toArray(new SchemaProperty[results.size()]);
+ }
+
+ private static boolean eq(BigInteger a, BigInteger b)
+ {
+ if (a == null && b == null)
+ return true;
+ if (a== null || b == null)
+ return false;
+ return a.equals(b);
+ }
+
+ public SchemaProperty[] getElementProperties()
+ {
+ if (_propertyModelByElementName == null)
+ return NO_PROPERTIES;
+
+ return (SchemaProperty[])
+ _propertyModelByElementName.values().toArray(new SchemaProperty[_propertyModelByElementName.size()]);
+ }
+
+ public SchemaProperty[] getAttributeProperties()
+ {
+ if (_propertyModelByAttributeName == null)
+ return NO_PROPERTIES;
+
+ return (SchemaProperty[])
+ _propertyModelByAttributeName.values().toArray(new SchemaProperty[_propertyModelByAttributeName.size()]);
+ }
+
+ public SchemaProperty getElementProperty(QName eltName)
+ { return _propertyModelByElementName == null ? null : (SchemaProperty)_propertyModelByElementName.get(eltName); }
+
+ public SchemaProperty getAttributeProperty(QName attrName)
+ { return _propertyModelByAttributeName == null ? null : (SchemaProperty)_propertyModelByAttributeName.get(attrName); }
+
+ public boolean hasAllContent()
+ { return _hasAllContent; }
+
+ public boolean isOrderSensitive()
+ { return _orderSensitive; }
+
+ public void setOrderSensitive(boolean sensitive)
+ { assertJavaizing(); _orderSensitive = sensitive; }
+
+ public void setContentModel(
+ SchemaParticle contentModel,
+ SchemaAttributeModel attrModel,
+ Map propertyModelByElementName,
+ Map propertyModelByAttributeName,
+ boolean isAll)
+ {
+ assertResolving();
+ _contentModel = contentModel;
+ _attributeModel = attrModel;
+ _propertyModelByElementName = propertyModelByElementName;
+ _propertyModelByAttributeName = propertyModelByAttributeName;
+ _hasAllContent = isAll;
+
+
+ // Add entries for each element property for substitution group members
+ if (_propertyModelByElementName != null)
+ {
+ _validSubstitutions = new LinkedHashSet();
+ Collection eltProps = _propertyModelByElementName.values();
+ for (Iterator it = eltProps.iterator() ; it.hasNext() ; )
+ {
+ SchemaProperty prop = (SchemaProperty)it.next();
+ QName[] names = prop.acceptedNames();
+ for (int i = 0 ; i < names.length ; i++)
+ {
+ if (! _propertyModelByElementName.containsKey(names[i]))
+ _validSubstitutions.add(names[i]);
+ }
+ }
+ }
+ }
+
+ private boolean containsElements()
+ {
+ return getContentType() == ELEMENT_CONTENT ||
+ getContentType() == MIXED_CONTENT;
+ }
+
+ public boolean hasAttributeWildcards()
+ {
+ return _hasWildcardAttributes;
+ }
+
+ public boolean hasElementWildcards()
+ {
+ return _hasWildcardElements;
+ }
+
+ public boolean isValidSubstitution(QName name)
+ {
+ return _validSubstitutions.contains(name);
+ }
+
+ public SchemaType getElementType(QName eltName, QName xsiType, SchemaTypeLoader wildcardTypeLoader)
+ {
+ if (isSimpleType() || !containsElements() || isNoType())
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+
+ SchemaType type;
+ SchemaProperty prop = (SchemaProperty)_propertyModelByElementName.get(eltName);
+ if (prop != null)
+ {
+ type = prop.getType();
+ }
+ else
+ {
+ if (!_typedWildcardElements.contains(eltName) || wildcardTypeLoader == null)
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+
+ SchemaGlobalElement elt = wildcardTypeLoader.findElement(eltName);
+ if (elt == null)
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ // According to http://www.w3.org/TR/xmlschema-1/#key-lva,
+ // the line above should return ST_ANY_TYPE.
+ type = elt.getType();
+ }
+
+ if (xsiType != null && wildcardTypeLoader != null)
+ {
+ SchemaType itype = wildcardTypeLoader.findType(xsiType);
+
+ // NOTE: a previous version of XMLBeans used ST_NO_TYPE if the
+ // xsiType was not derived from 'type', but this results in a
+ // ClassCastException. Instead we ignore xsi:type if it's not
+ // found or a derived type.
+ if (itype != null && type.isAssignableFrom(itype)) {
+ return itype;
+ }
+ }
+
+ return type;
+ }
+
+ public SchemaType getAttributeType(QName attrName, SchemaTypeLoader wildcardTypeLoader)
+ {
+ if (isSimpleType() || isNoType())
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+
+ if (isURType())
+ return BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+
+ SchemaProperty prop = (SchemaProperty)_propertyModelByAttributeName.get(attrName);
+ if (prop != null)
+ return prop.getType();
+
+ if (!_typedWildcardAttributes.contains(attrName) || wildcardTypeLoader == null)
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+
+ SchemaGlobalAttribute attr = wildcardTypeLoader.findAttribute(attrName);
+ if (attr == null)
+ return BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ return attr.getType();
+ }
+
+ public XmlObject createElementType(QName eltName, QName xsiType, SchemaTypeLoader wildcardTypeLoader)
+ {
+ SchemaType type = null;
+ SchemaProperty prop = null;
+ if (isSimpleType() || !containsElements() || isNoType())
+ {
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+ else
+ {
+ prop = (SchemaProperty)_propertyModelByElementName.get(eltName);
+ if (prop != null)
+ {
+ type = prop.getType();
+ }
+ else if (!_typedWildcardElements.contains(eltName) &&
+ !_validSubstitutions.contains(eltName))
+ {
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+ else
+ {
+ SchemaGlobalElement elt = wildcardTypeLoader.findElement(eltName);
+ if (elt != null)
+ type = elt.getType();
+ else
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+
+ if (xsiType != null)
+ {
+ SchemaType itype = wildcardTypeLoader.findType(xsiType);
+
+ // NOTE: a previous version of XMLBeans used ST_NO_TYPE if the
+ // xsiType was not derived from 'type', but this results in a
+ // ClassCastException. Instead we ignore xsi:type if it's not
+ // found or a derived type.
+ if (itype != null && type.isAssignableFrom(itype)) {
+ type = itype;
+ }
+ }
+ }
+
+ if (type != null)
+ return ((SchemaTypeImpl)type).createUnattachedNode(prop);
+ return null;
+ }
+
+ public XmlObject createAttributeType(QName attrName, SchemaTypeLoader wildcardTypeLoader)
+ {
+ SchemaTypeImpl type = null;
+ SchemaProperty prop = null;
+ if (isSimpleType() || isNoType())
+ {
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+ else if (isURType())
+ {
+ type = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ else
+ {
+ prop = (SchemaProperty)_propertyModelByAttributeName.get(attrName);
+ if (prop != null)
+ {
+ type = (SchemaTypeImpl)prop.getType();
+ }
+ else if (!_typedWildcardAttributes.contains(attrName))
+ {
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+ else
+ {
+ SchemaGlobalAttribute attr = wildcardTypeLoader.findAttribute(attrName);
+ if (attr != null)
+ type = (SchemaTypeImpl)attr.getType();
+ else
+ type = BuiltinSchemaTypeSystem.ST_NO_TYPE;
+ }
+ }
+
+ if (type != null)
+ return type.createUnattachedNode(prop);
+
+ return null;
+ }
+
+ public void setWildcardSummary(QNameSet elementSet, boolean haswcElt, QNameSet attributeSet, boolean haswcAtt)
+ {
+ assertResolving(); _typedWildcardElements = elementSet; _hasWildcardElements = haswcElt; _typedWildcardAttributes = attributeSet; _hasWildcardAttributes = haswcAtt;
+ }
+
+ public SchemaType[] getAnonymousTypes()
+ {
+ SchemaType[] result = new SchemaType[_anonymousTyperefs.length];
+ for (int i = 0; i < result.length; i++)
+ result[i] = _anonymousTyperefs[i].get();
+ return result;
+ }
+
+ public void setAnonymousTypeRefs(SchemaType.Ref[] anonymousTyperefs)
+ {
+ _anonymousTyperefs = anonymousTyperefs;
+ }
+
+
+ private static SchemaType[] staCopy(SchemaType[] a)
+ {
+ if (a == null)
+ return null;
+
+ SchemaType[] result = new SchemaType[a.length];
+ System.arraycopy(a, 0, result, 0, a.length);
+ return result;
+ }
+
+ private static boolean[] boaCopy(boolean[] a)
+ {
+ if (a == null)
+ return null;
+
+ boolean[] result = new boolean[a.length];
+ System.arraycopy(a, 0, result, 0, a.length);
+ return result;
+ }
+
+
+
+ public void setSimpleTypeVariety(int variety)
+ { assertResolving(); _simpleTypeVariety = variety; }
+
+ public int getSimpleVariety()
+ { return _simpleTypeVariety; }
+
+ public boolean isURType()
+ { return _builtinTypeCode == BTC_ANY_TYPE || _builtinTypeCode == BTC_ANY_SIMPLE; }
+
+ public boolean isNoType()
+ { return this == BuiltinSchemaTypeSystem.ST_NO_TYPE; }
+
+ public boolean isSimpleType()
+ { return _isSimpleType; }
+
+ public void setSimpleType(boolean f)
+ { assertUnresolved(); _isSimpleType = f; }
+
+ public boolean isUnionOfLists()
+ { return _isUnionOfLists; }
+
+ public void setUnionOfLists(boolean f)
+ { assertResolving(); _isUnionOfLists = f; }
+
+ public SchemaType getPrimitiveType()
+ { return _primitiveTypeRef == null ? null : _primitiveTypeRef.get(); }
+
+ public void setPrimitiveTypeRef(SchemaType.Ref typeref)
+ { assertResolving(); _primitiveTypeRef = typeref; }
+
+ public int getDecimalSize()
+ { return _decimalSize; }
+
+ public void setDecimalSize(int bits)
+ { assertResolving(); _decimalSize = bits; }
+
+ public SchemaType getBaseType()
+ { return _baseTyperef == null ? null : _baseTyperef.get(); }
+
+ public void setBaseTypeRef(SchemaType.Ref typeref)
+ { assertResolving(); _baseTyperef = typeref; }
+
+ public int getBaseDepth()
+ { return _baseDepth; }
+
+ public void setBaseDepth(int depth)
+ { assertResolving(); _baseDepth = depth; }
+
+ public int getDerivationType()
+ { return _derivationType; }
+
+ public void setDerivationType(int type)
+ { assertResolving(); _derivationType = type; }
+
+ public SchemaType getListItemType()
+ { return _listItemTyperef == null ? null : _listItemTyperef.get(); }
+
+ public void setListItemTypeRef(SchemaType.Ref typeref)
+ { assertResolving(); _listItemTyperef = typeref; }
+
+ public SchemaType[] getUnionMemberTypes()
+ {
+ SchemaType[] result = new SchemaType[_unionMemberTyperefs ==null ? 0 : _unionMemberTyperefs.length];
+ for (int i = 0; i < result.length; i++)
+ result[i] = _unionMemberTyperefs[i].get();
+ return result;
+ }
+
+ public void setUnionMemberTypeRefs(SchemaType.Ref[] typerefs)
+ { assertResolving(); _unionMemberTyperefs = typerefs; }
+
+ public int getAnonymousUnionMemberOrdinal()
+ { return _anonymousUnionMemberOrdinal; }
+
+ public void setAnonymousUnionMemberOrdinal(int i)
+ { assertUnresolved(); _anonymousUnionMemberOrdinal = i; }
+
+ public synchronized SchemaType[] getUnionConstituentTypes()
+ {
+ if (_unionCommonBaseType == null)
+ computeFlatUnionModel();
+ return staCopy(_unionConstituentTypes);
+ }
+
+ private void setUnionConstituentTypes(SchemaType[] types)
+ { _unionConstituentTypes = types; }
+
+ public synchronized SchemaType[] getUnionSubTypes()
+ {
+ if (_unionCommonBaseType == null)
+ computeFlatUnionModel();
+ return staCopy(_unionSubTypes);
+ }
+
+ private void setUnionSubTypes(SchemaType[] types)
+ { _unionSubTypes = types; }
+
+ public synchronized SchemaType getUnionCommonBaseType()
+ {
+ if (_unionCommonBaseType == null)
+ computeFlatUnionModel();
+ return _unionCommonBaseType;
+ }
+
+ private void setUnionCommonBaseType(SchemaType type)
+ { _unionCommonBaseType = type; }
+
+ private void computeFlatUnionModel()
+ {
+ Set constituentMemberTypes = new LinkedHashSet();
+ Set allSubTypes = new LinkedHashSet();
+ SchemaType commonBaseType = null;
+
+ allSubTypes.add(this);
+
+ for (int i = 0; i < _unionMemberTyperefs.length; i++)
+ {
+ SchemaTypeImpl mImpl = (SchemaTypeImpl)_unionMemberTyperefs[i].get();
+
+ switch (mImpl.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ constituentMemberTypes.add(mImpl);
+ allSubTypes.add(mImpl);
+ commonBaseType = mImpl.getCommonBaseType(commonBaseType);
+ break;
+ case SchemaType.UNION:
+ constituentMemberTypes.addAll(Arrays.asList(mImpl.getUnionConstituentTypes()));
+ allSubTypes.addAll(Arrays.asList(mImpl.getUnionSubTypes()));
+ SchemaType otherCommonBaseType = mImpl.getUnionCommonBaseType();
+ if (otherCommonBaseType != null)
+ commonBaseType = otherCommonBaseType.getCommonBaseType(commonBaseType);
+ break;
+ case SchemaType.ATOMIC:
+ constituentMemberTypes.add(mImpl);
+ allSubTypes.add(mImpl);
+ commonBaseType = mImpl.getCommonBaseType(commonBaseType);
+ break;
+ default:
+ assert(false);
+ }
+ }
+
+ setUnionConstituentTypes((SchemaType[])
+ constituentMemberTypes.toArray(StscState.EMPTY_ST_ARRAY));
+ setUnionSubTypes((SchemaType[])
+ allSubTypes.toArray(StscState.EMPTY_ST_ARRAY));
+ setUnionCommonBaseType(commonBaseType);
+ }
+
+ public QName getSubstitutionGroup()
+ { return _sg; }
+
+ public void setSubstitutionGroup(QName sg)
+ { assertSGResolving(); _sg = sg; }
+
+ public void addSubstitutionGroupMember(QName member)
+ { assertSGResolved(); _sgMembers.add(member); }
+
+ public QName[] getSubstitutionGroupMembers()
+ {
+ QName[] result = new QName[_sgMembers.size()];
+ return (QName[])_sgMembers.toArray(result);
+ }
+
+ public int getWhiteSpaceRule()
+ { return _whiteSpaceRule; }
+
+ public void setWhiteSpaceRule(int ws)
+ { assertResolving(); _whiteSpaceRule = ws; }
+
+ public XmlAnySimpleType getFacet(int facetCode)
+ {
+ if (_facetArray == null)
+ return null;
+ XmlValueRef ref = _facetArray[facetCode];
+ if (ref == null)
+ return null;
+ return ref.get();
+ }
+
+ public boolean isFacetFixed(int facetCode)
+ {
+ return _fixedFacetArray[facetCode];
+ }
+
+ public XmlAnySimpleType[] getBasicFacets()
+ {
+ XmlAnySimpleType[] result = new XmlAnySimpleType[SchemaType.LAST_FACET + 1];
+ for (int i = 0; i <= SchemaType.LAST_FACET; i++)
+ {
+ result[i] = getFacet(i);
+ }
+ return result;
+ }
+
+ public boolean[] getFixedFacets()
+ {
+ return boaCopy(_fixedFacetArray);
+ }
+
+ public void setBasicFacets(XmlValueRef[] values, boolean[] fixed)
+ {
+ assertResolving();
+ _facetArray = values;
+ _fixedFacetArray = fixed;
+ }
+
+ public int ordered()
+ { return _ordered; }
+
+ public void setOrdered(int ordering)
+ { assertResolving(); _ordered = ordering; }
+
+ public boolean isBounded()
+ { return _isBounded; }
+
+ public void setBounded(boolean f)
+ { assertResolving(); _isBounded = f; }
+
+ public boolean isFinite()
+ { return _isFinite; }
+
+ public void setFinite(boolean f)
+ { assertResolving(); _isFinite = f; }
+
+ public boolean isNumeric()
+ { return _isNumeric; }
+
+ public void setNumeric(boolean f)
+ { assertResolving(); _isNumeric = f; }
+
+
+ public boolean hasPatternFacet()
+ { return _hasPatterns; }
+
+ public void setPatternFacet(boolean hasPatterns)
+ { assertResolving(); _hasPatterns = hasPatterns; }
+
+ public boolean matchPatternFacet(String s)
+ {
+ if (!_hasPatterns)
+ return true;
+
+ if (_patterns != null && _patterns.length > 0)
+ {
+ int i;
+ for (i = 0; i < _patterns.length; i++)
+ {
+ if (_patterns[i].matches(s))
+ break;
+ }
+ if (i >= _patterns.length)
+ return false;
+ }
+
+ return getBaseType().matchPatternFacet(s);
+ }
+
+ public String[] getPatterns()
+ {
+ if (_patterns == null)
+ return new String[0];
+ String[] patterns = new String[_patterns.length];
+ for (int i=0; i< _patterns.length; i++)
+ patterns[i] = _patterns[i].getPattern();
+ return patterns;
+ }
+
+ public org.apache.xmlbeans.impl.regex.RegularExpression[] getPatternExpressions()
+ {
+ if (_patterns == null)
+ return new org.apache.xmlbeans.impl.regex.RegularExpression[0];
+ org.apache.xmlbeans.impl.regex.RegularExpression[] result = new org.apache.xmlbeans.impl.regex.RegularExpression[_patterns.length];
+ System.arraycopy(_patterns, 0, result, 0, _patterns.length);
+ return result;
+ }
+
+ public void setPatterns(org.apache.xmlbeans.impl.regex.RegularExpression[] list)
+ { assertResolving(); _patterns = list; }
+
+ public XmlAnySimpleType[] getEnumerationValues()
+ {
+ if (_enumerationValues == null)
+ return null;
+ XmlAnySimpleType[] result = new XmlAnySimpleType[_enumerationValues.length];
+ for (int i = 0; i < result.length; i++)
+ {
+ XmlValueRef ref = _enumerationValues[i];
+ result[i] = (ref == null ? null : ref.get());
+
+ }
+ return result;
+ }
+
+ public void setEnumerationValues(XmlValueRef[] a)
+ { assertResolving(); _enumerationValues = a; }
+
+ public StringEnumAbstractBase enumForString(String s)
+ {
+ ensureStringEnumInfo();
+ if (_lookupStringEnum == null)
+ return null;
+ return (StringEnumAbstractBase)_lookupStringEnum.get(s);
+ }
+
+ public StringEnumAbstractBase enumForInt(int i)
+ {
+ ensureStringEnumInfo();
+ if (_listOfStringEnum == null || i < 0 || i >= _listOfStringEnum.size())
+ return null;
+ return (StringEnumAbstractBase)_listOfStringEnum.get(i);
+ }
+
+ public SchemaStringEnumEntry enumEntryForString(String s)
+ {
+ ensureStringEnumInfo();
+ if (_lookupStringEnumEntry == null)
+ return null;
+ return (SchemaStringEnumEntry)_lookupStringEnumEntry.get(s);
+ }
+
+ public SchemaType getBaseEnumType()
+ {
+ return _baseEnumTyperef == null ? null : _baseEnumTyperef.get();
+ }
+
+ public void setBaseEnumTypeRef(SchemaType.Ref baseEnumTyperef)
+ {
+ _baseEnumTyperef = baseEnumTyperef;
+ }
+
+ public SchemaStringEnumEntry[] getStringEnumEntries()
+ {
+ if (_stringEnumEntries == null)
+ return null;
+ SchemaStringEnumEntry[] result = new SchemaStringEnumEntry[_stringEnumEntries.length];
+ System.arraycopy(_stringEnumEntries, 0, result, 0, result.length);
+ return result;
+ }
+
+ public void setStringEnumEntries(SchemaStringEnumEntry sEnums[])
+ {
+ assertJavaizing();
+ _stringEnumEntries = sEnums;
+ }
+
+ private void ensureStringEnumInfo()
+ {
+ if (_stringEnumEnsured)
+ return;
+
+ SchemaStringEnumEntry[] sEnums = _stringEnumEntries;
+ if (sEnums == null)
+ {
+ _stringEnumEnsured = true;
+ return;
+ }
+
+ Map lookupStringEnum = new HashMap(sEnums.length);
+ List listOfStringEnum = new ArrayList(sEnums.length + 1);
+ Map lookupStringEnumEntry = new HashMap(sEnums.length);
+
+ for (int i = 0; i < sEnums.length; i++)
+ {
+ lookupStringEnumEntry.put(sEnums[i].getString(), sEnums[i]);
+ }
+
+ Class jc = _baseEnumTyperef.get().getEnumJavaClass();
+ if (jc != null)
+ {
+ try
+ {
+ StringEnumAbstractBase.Table table = (StringEnumAbstractBase.Table)jc.getField("table").get(null);
+ for (int i = 0; i < sEnums.length; i++)
+ {
+ int j = sEnums[i].getIntValue();
+ StringEnumAbstractBase enumVal = table.forInt(j);
+ lookupStringEnum.put(sEnums[i].getString(), enumVal);
+ while (listOfStringEnum.size() <= j)
+ listOfStringEnum.add(null);
+ listOfStringEnum.set(j, enumVal);
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println("Something wrong: could not locate enum table for " + jc);
+ jc = null;
+ lookupStringEnum.clear();
+ listOfStringEnum.clear();
+ }
+ }
+
+ if (jc == null)
+ {
+ for (int i = 0; i < sEnums.length; i++)
+ {
+ int j = sEnums[i].getIntValue();
+ String s = sEnums[i].getString();
+ StringEnumAbstractBase enumVal = new StringEnumValue(s, j);
+ lookupStringEnum.put(s, enumVal);
+ while (listOfStringEnum.size() <= j)
+ listOfStringEnum.add(null);
+ listOfStringEnum.set(j, enumVal);
+ }
+ }
+
+ synchronized (this)
+ {
+ if (!_stringEnumEnsured)
+ {
+ _lookupStringEnum = lookupStringEnum;
+ _listOfStringEnum = listOfStringEnum;
+ _lookupStringEnumEntry = lookupStringEnumEntry;
+ }
+ }
+ // HACKHACK: two syncrhonized blocks force a memory barrier:
+ // BUGBUG: this behavior is likely to change in future VMs
+ synchronized (this)
+ {
+ _stringEnumEnsured = true;
+ }
+ }
+
+ public boolean hasStringEnumValues()
+ {
+ return _stringEnumEntries != null;
+ }
+
+ public void copyEnumerationValues(SchemaTypeImpl baseImpl)
+ {
+ assertResolving();
+ _enumerationValues = baseImpl._enumerationValues;
+ _baseEnumTyperef = baseImpl._baseEnumTyperef;
+ }
+
+ public int getBuiltinTypeCode()
+ { return _builtinTypeCode; } // special: set up pre-init
+
+ public void setBuiltinTypeCode(int builtinTypeCode)
+ { assertResolving(); _builtinTypeCode = builtinTypeCode; }
+
+ public Class getJavaClass()
+ {
+ // This field is declared volatile and Class is immutable so this is allowed.
+ if (_javaClass == null && getFullJavaName() != null)
+ {
+ try
+ { _javaClass = Class.forName(getFullJavaName(), false, _typeSystem.getClassLoader()); }
+ catch (ClassNotFoundException e)
+ {
+ System.err.println("Could not find class name " + getFullJavaName());
+ System.err.println("Searched in classloader " + _typeSystem.getClassLoader());
+ e.printStackTrace(System.err);
+ _javaClass = null;
+ }
+ }
+
+ return _javaClass;
+ }
+
+ public Class getJavaImplClass() {
+ if (_implNotAvailable)
+ return null;
+
+ if (_javaImplClass == null)
+ {
+ try {
+ if (getFullJavaImplName() != null)
+ _javaImplClass = Class.forName(getFullJavaImplName(), false, _typeSystem.getClassLoader());
+ else
+ _implNotAvailable = true;
+ }
+ catch (ClassNotFoundException e) {
+ _implNotAvailable = true;
+ }
+ }
+
+ return _javaImplClass;
+ }
+
+ public Constructor getJavaImplConstructor()
+ {
+ if (_javaImplConstructor == null && !_implNotAvailable)
+ {
+ final Class impl = getJavaImplClass();
+ if (impl == null) return null;
+ try
+ {
+ _javaImplConstructor = impl.getConstructor(new Class[] { SchemaType.class });
+ }
+ catch (NoSuchMethodException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return _javaImplConstructor;
+
+ }
+
+ public Constructor getJavaImplConstructor2()
+ {
+ if (_javaImplConstructor2 == null && !_implNotAvailable)
+ {
+ final Class impl = getJavaImplClass();
+ if (impl == null) return null;
+ try
+ {
+ _javaImplConstructor2 = impl.getConstructor(new Class[] { SchemaType.class, boolean.class });
+ }
+ catch (NoSuchMethodException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return _javaImplConstructor2;
+
+ }
+
+ public Class getEnumJavaClass()
+ {
+ // This field is declared volatile and Class is immutable so this is allowed.
+ if (_javaEnumClass == null)
+ {
+ try
+ { _javaEnumClass = Class.forName(getBaseEnumType().getFullJavaName() + "$Enum", false, _typeSystem.getClassLoader()); }
+ catch (ClassNotFoundException e)
+ { _javaEnumClass = null; }
+ }
+
+ return _javaEnumClass;
+ }
+
+ public void setJavaClass(Class javaClass)
+ {
+ assertResolved();
+ _javaClass = javaClass;
+ setFullJavaName(javaClass.getName());
+ }
+
+ public boolean isPrimitiveType()
+ {
+ return (getBuiltinTypeCode() >= BTC_FIRST_PRIMITIVE &&
+ getBuiltinTypeCode() <= BTC_LAST_PRIMITIVE);
+ }
+
+ public boolean isBuiltinType()
+ {
+ return getBuiltinTypeCode() != 0;
+ }
+
+ public XmlObject createUnwrappedNode()
+ {
+ // Todo: attach a new xml store!
+ XmlObject result = createUnattachedNode(null);
+ return result;
+ }
+
+ /**
+ * TypeStoreUserFactory implementation
+ */
+ public TypeStoreUser createTypeStoreUser()
+ {
+ return (TypeStoreUser)createUnattachedNode(null);
+ }
+
+
+ public XmlAnySimpleType newValidatingValue(Object obj)
+ {
+ return newValue(obj, true);
+ }
+ /**
+ * Creates an immutable simple value.
+ */
+ public XmlAnySimpleType newValue(Object obj)
+ {
+ return newValue(obj, false);
+ }
+
+ public XmlAnySimpleType newValue(Object obj, boolean validateOnSet)
+ {
+ if (!isSimpleType() && getContentType() != SchemaType.SIMPLE_CONTENT)
+ throw new XmlValueOutOfRangeException(); // values must be simple
+
+ XmlObjectBase result = (XmlObjectBase)createUnattachedNode(null);
+ if (validateOnSet)
+ result.setValidateOnSet();
+
+ // In the case of tree copy, need to call a specla setter to avoid
+ // set(XmlObject)
+ if (obj instanceof XmlObject)
+ result.set_newValue((XmlObject)obj);
+ else
+ result.objectSet(obj);
+
+ result.check_dated();
+ result.setImmutable();
+
+ return (XmlAnySimpleType) result;
+ }
+
+ /**
+ * Creates an instance of this type.
+ */
+ private XmlObject createUnattachedNode(SchemaProperty prop)
+ {
+ XmlObject result = null;
+
+ if (!isBuiltinType() && !isNoType())
+ {
+ // System.out.println("Attempting to load impl class: " + getFullJavaImplName());
+ Constructor ctr = getJavaImplConstructor();
+ if (ctr != null)
+ {
+ try
+ {
+ // System.out.println("Succeeded!");
+ return (XmlObject)ctr.newInstance(_ctrArgs);
+ }
+ catch (Exception e)
+ {
+ System.out.println("Exception trying to instantiate impl class.");
+ e.printStackTrace();
+ }
+ }
+ }
+ else
+ {
+ result = createBuiltinInstance();
+ }
+
+ // if no result, we must be a restriction of some compiled type
+ for (SchemaType sType = this; result == null; sType = sType.getBaseType())
+ result = ((SchemaTypeImpl)sType).createUnattachedSubclass(this);
+
+ ((XmlObjectBase)result).init_flags(prop);
+ return result;
+ }
+
+ private XmlObject createUnattachedSubclass(SchemaType sType)
+ {
+ if (!isBuiltinType() && !isNoType())
+ {
+ // System.out.println("Attempting to load impl class: " + getFullJavaImplName());
+ Constructor ctr = getJavaImplConstructor2();
+ if (ctr != null)
+ {
+ try
+ {
+ // System.out.println("Succeeded!");
+ return (XmlObject)ctr.newInstance(new Object[] { sType, sType.isSimpleType() ? Boolean.FALSE : Boolean.TRUE });
+ }
+ catch (Exception e)
+ {
+ System.out.println("Exception trying to instantiate impl class.");
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+ else
+ {
+ return createBuiltinSubclass(sType);
+ }
+ }
+
+ private XmlObject createBuiltinInstance()
+ {
+ switch (getBuiltinTypeCode())
+ {
+ case BTC_NOT_BUILTIN:
+ return new XmlAnyTypeImpl(BuiltinSchemaTypeSystem.ST_NO_TYPE);
+ case BTC_ANY_TYPE:
+ return new XmlAnyTypeImpl();
+ case BTC_ANY_SIMPLE:
+ return new XmlAnySimpleTypeImpl();
+ case BTC_BOOLEAN:
+ return new XmlBooleanImpl();
+ case BTC_BASE_64_BINARY:
+ return new XmlBase64BinaryImpl();
+ case BTC_HEX_BINARY:
+ return new XmlHexBinaryImpl();
+ case BTC_ANY_URI:
+ return new XmlAnyUriImpl();
+ case BTC_QNAME:
+ return new XmlQNameImpl();
+ case BTC_NOTATION:
+ return new XmlNotationImpl();
+ case BTC_FLOAT:
+ return new XmlFloatImpl();
+ case BTC_DOUBLE:
+ return new XmlDoubleImpl();
+ case BTC_DECIMAL:
+ return new XmlDecimalImpl();
+ case BTC_STRING:
+ return new XmlStringImpl();
+ case BTC_DURATION:
+ return new XmlDurationImpl();
+ case BTC_DATE_TIME:
+ return new XmlDateTimeImpl();
+ case BTC_TIME:
+ return new XmlTimeImpl();
+ case BTC_DATE:
+ return new XmlDateImpl();
+ case BTC_G_YEAR_MONTH:
+ return new XmlGYearMonthImpl();
+ case BTC_G_YEAR:
+ return new XmlGYearImpl();
+ case BTC_G_MONTH_DAY:
+ return new XmlGMonthDayImpl();
+ case BTC_G_DAY:
+ return new XmlGDayImpl();
+ case BTC_G_MONTH:
+ return new XmlGMonthImpl();
+ case BTC_INTEGER:
+ return new XmlIntegerImpl();
+ case BTC_LONG:
+ return new XmlLongImpl();
+ case BTC_INT:
+ return new XmlIntImpl();
+ case BTC_SHORT:
+ return new XmlShortImpl();
+ case BTC_BYTE:
+ return new XmlByteImpl();
+ case BTC_NON_POSITIVE_INTEGER:
+ return new XmlNonPositiveIntegerImpl();
+ case BTC_NEGATIVE_INTEGER:
+ return new XmlNegativeIntegerImpl();
+ case BTC_NON_NEGATIVE_INTEGER:
+ return new XmlNonNegativeIntegerImpl();
+ case BTC_POSITIVE_INTEGER:
+ return new XmlPositiveIntegerImpl();
+ case BTC_UNSIGNED_LONG:
+ return new XmlUnsignedLongImpl();
+ case BTC_UNSIGNED_INT:
+ return new XmlUnsignedIntImpl();
+ case BTC_UNSIGNED_SHORT:
+ return new XmlUnsignedShortImpl();
+ case BTC_UNSIGNED_BYTE:
+ return new XmlUnsignedByteImpl();
+ case BTC_NORMALIZED_STRING:
+ return new XmlNormalizedStringImpl();
+ case BTC_TOKEN:
+ return new XmlTokenImpl();
+ case BTC_NAME:
+ return new XmlNameImpl();
+ case BTC_NCNAME:
+ return new XmlNCNameImpl();
+ case BTC_LANGUAGE:
+ return new XmlLanguageImpl();
+ case BTC_ID:
+ return new XmlIdImpl();
+ case BTC_IDREF:
+ return new XmlIdRefImpl();
+ case BTC_IDREFS:
+ return new XmlIdRefsImpl();
+ case BTC_ENTITY:
+ return new XmlEntityImpl();
+ case BTC_ENTITIES:
+ return new XmlEntitiesImpl();
+ case BTC_NMTOKEN:
+ return new XmlNmTokenImpl();
+ case BTC_NMTOKENS:
+ return new XmlNmTokensImpl();
+ default:
+ throw new IllegalStateException("Unrecognized builtin type: " + getBuiltinTypeCode());
+ }
+ }
+
+ private XmlObject createBuiltinSubclass(SchemaType sType)
+ {
+ boolean complex = !sType.isSimpleType();
+ switch (getBuiltinTypeCode())
+ {
+ case BTC_NOT_BUILTIN:
+ return new XmlAnyTypeImpl(BuiltinSchemaTypeSystem.ST_NO_TYPE);
+ case BTC_ANY_TYPE:
+ case BTC_ANY_SIMPLE:
+ switch (sType.getSimpleVariety())
+ {
+ case NOT_SIMPLE:
+ return new XmlComplexContentImpl(sType);
+ case ATOMIC:
+ return new XmlAnySimpleTypeRestriction(sType, complex);
+ case LIST:
+ return new XmlListImpl(sType, complex);
+ case UNION:
+ return new XmlUnionImpl(sType, complex);
+ default:
+ throw new IllegalStateException();
+ }
+ case BTC_BOOLEAN:
+ return new XmlBooleanRestriction(sType, complex);
+ case BTC_BASE_64_BINARY:
+ return new XmlBase64BinaryRestriction(sType, complex);
+ case BTC_HEX_BINARY:
+ return new XmlHexBinaryRestriction(sType, complex);
+ case BTC_ANY_URI:
+ return new XmlAnyUriRestriction(sType, complex);
+ case BTC_QNAME:
+ return new XmlQNameRestriction(sType, complex);
+ case BTC_NOTATION:
+ return new XmlNotationRestriction(sType, complex);
+ case BTC_FLOAT:
+ return new XmlFloatRestriction(sType, complex);
+ case BTC_DOUBLE:
+ return new XmlDoubleRestriction(sType, complex);
+ case BTC_DECIMAL:
+ return new XmlDecimalRestriction(sType, complex);
+ case BTC_STRING:
+ if (sType.hasStringEnumValues())
+ return new XmlStringEnumeration(sType, complex);
+ else
+ return new XmlStringRestriction(sType, complex);
+ case BTC_DURATION:
+ return new XmlDurationImpl(sType, complex);
+ case BTC_DATE_TIME:
+ return new XmlDateTimeImpl(sType, complex);
+ case BTC_TIME:
+ return new XmlTimeImpl(sType, complex);
+ case BTC_DATE:
+ return new XmlDateImpl(sType, complex);
+ case BTC_G_YEAR_MONTH:
+ return new XmlGYearMonthImpl(sType, complex);
+ case BTC_G_YEAR:
+ return new XmlGYearImpl(sType, complex);
+ case BTC_G_MONTH_DAY:
+ return new XmlGMonthDayImpl(sType, complex);
+ case BTC_G_DAY:
+ return new XmlGDayImpl(sType, complex);
+ case BTC_G_MONTH:
+ return new XmlGMonthImpl(sType, complex);
+ case BTC_INTEGER:
+ return new XmlIntegerRestriction(sType, complex);
+ case BTC_LONG:
+ return new XmlLongRestriction(sType, complex);
+ case BTC_INT:
+ return new XmlIntRestriction(sType, complex);
+ case BTC_SHORT:
+ return new XmlShortImpl(sType, complex);
+ case BTC_BYTE:
+ return new XmlByteImpl(sType, complex);
+ case BTC_NON_POSITIVE_INTEGER:
+ return new XmlNonPositiveIntegerImpl(sType, complex);
+ case BTC_NEGATIVE_INTEGER:
+ return new XmlNegativeIntegerImpl(sType, complex);
+ case BTC_NON_NEGATIVE_INTEGER:
+ return new XmlNonNegativeIntegerImpl(sType, complex);
+ case BTC_POSITIVE_INTEGER:
+ return new XmlPositiveIntegerImpl(sType, complex);
+ case BTC_UNSIGNED_LONG:
+ return new XmlUnsignedLongImpl(sType, complex);
+ case BTC_UNSIGNED_INT:
+ return new XmlUnsignedIntImpl(sType, complex);
+ case BTC_UNSIGNED_SHORT:
+ return new XmlUnsignedShortImpl(sType, complex);
+ case BTC_UNSIGNED_BYTE:
+ return new XmlUnsignedByteImpl(sType, complex);
+ case BTC_NORMALIZED_STRING:
+ return new XmlNormalizedStringImpl(sType, complex);
+ case BTC_TOKEN:
+ return new XmlTokenImpl(sType, complex);
+ case BTC_NAME:
+ return new XmlNameImpl(sType, complex);
+ case BTC_NCNAME:
+ return new XmlNCNameImpl(sType, complex);
+ case BTC_LANGUAGE:
+ return new XmlLanguageImpl(sType, complex);
+ case BTC_ID:
+ return new XmlIdImpl(sType, complex);
+ case BTC_IDREF:
+ return new XmlIdRefImpl(sType, complex);
+ case BTC_IDREFS:
+ return new XmlIdRefsImpl(sType, complex);
+ case BTC_ENTITY:
+ return new XmlEntityImpl(sType, complex);
+ case BTC_ENTITIES:
+ return new XmlEntitiesImpl(sType, complex);
+ case BTC_NMTOKEN:
+ return new XmlNmTokenImpl(sType, complex);
+ case BTC_NMTOKENS:
+ return new XmlNmTokensImpl(sType, complex);
+ default:
+ throw new IllegalStateException("Unrecognized builtin type: " + getBuiltinTypeCode());
+ }
+ }
+
+ public SchemaType getCommonBaseType(SchemaType type)
+ {
+ // null type is treated as the no-type
+ if (this == BuiltinSchemaTypeSystem.ST_ANY_TYPE || type == null || type.isNoType())
+ return this;
+
+ // any type is the universal base type; noType is the universal derived type
+ if (type == BuiltinSchemaTypeSystem.ST_ANY_TYPE || isNoType())
+ return type;
+
+ // the regular case:
+ SchemaTypeImpl sImpl1 = (SchemaTypeImpl)type;
+ while (sImpl1.getBaseDepth() > getBaseDepth())
+ sImpl1 = (SchemaTypeImpl)sImpl1.getBaseType();
+ SchemaTypeImpl sImpl2 = this;
+ while (sImpl2.getBaseDepth() > sImpl1.getBaseDepth())
+ sImpl2 = (SchemaTypeImpl)sImpl2.getBaseType();
+ for (;;)
+ {
+ if (sImpl1.equals(sImpl2))
+ break;
+ sImpl1 = (SchemaTypeImpl)sImpl1.getBaseType();
+ sImpl2 = (SchemaTypeImpl)sImpl2.getBaseType();
+ assert(sImpl1 != null && sImpl2 != null); // must meet at anyType
+ }
+ return sImpl1;
+ }
+
+ public boolean isAssignableFrom(SchemaType type)
+ {
+ if (type == null || type.isNoType())
+ return true;
+
+ if (isNoType())
+ return false;
+
+ int depth = ((SchemaTypeImpl)type).getBaseDepth() - getBaseDepth();
+ if (depth < 0)
+ return false;
+ while (depth > 0)
+ {
+ type = type.getBaseType();
+ depth -= 1;
+ }
+ return (type.equals(this));
+ }
+
+
+ public String toString()
+ {
+ if (getName() != null)
+ return "T=" + QNameHelper.pretty(getName());
+
+ if (isDocumentType())
+ return "D=" + QNameHelper.pretty(getDocumentElementName());
+
+ if (isAttributeType())
+ return "R=" + QNameHelper.pretty(getAttributeTypeAttributeName());
+
+ String prefix;
+
+ if (getContainerField() != null)
+ {
+ prefix = (getContainerField().getName().getNamespaceURI().length() > 0 ?
+ (getContainerField().isAttribute() ? "Q=" : "E=") :
+ (getContainerField().isAttribute() ? "A=" : "U="))
+ + getContainerField().getName().getLocalPart();
+ if (getOuterType() == null)
+ return prefix + "@" + getContainerField().getName().getNamespaceURI();
+ }
+ else if (isNoType())
+ return "N=";
+ else if (getOuterType() == null)
+ return "noouter";
+ else if (getOuterType().getBaseType() == this)
+ prefix = "B=";
+ else if (getOuterType().getSimpleVariety() == SchemaType.LIST)
+ prefix = "I=";
+ else if (getOuterType().getSimpleVariety() == SchemaType.UNION)
+ prefix = "M=" + getAnonymousUnionMemberOrdinal();
+ else
+ prefix = "strange=";
+
+ return prefix + "|" + getOuterType().toString();
+ }
+
+ private XmlObject _parseObject;
+ private String _parseTNS;
+ private boolean _chameleon;
+ private boolean _redefinition;
+
+ public void setParseContext(XmlObject parseObject, String targetNamespace, boolean chameleon, boolean redefinition)
+ {
+ _parseObject = parseObject;
+ _parseTNS = targetNamespace;
+ _chameleon = chameleon;
+ _redefinition = redefinition;
+ }
+
+ public XmlObject getParseObject()
+ { return _parseObject; }
+
+ public String getTargetNamespace()
+ { return _parseTNS; }
+
+ public boolean isChameleon ( )
+ { return _chameleon; }
+
+ public String getChameleonNamespace()
+ { return _chameleon ? _parseTNS : null; }
+
+ public boolean isRedefinition()
+ { return _redefinition; }
+
+ private SchemaType.Ref _selfref = new SchemaType.Ref(this);
+
+ public SchemaType.Ref getRef()
+ { return _selfref; }
+
+ public SchemaComponent.Ref getComponentRef()
+ { return getRef(); }
+
+ /**
+ * Gives access to the internals of element validation
+ */
+ private static class SequencerImpl implements SchemaTypeElementSequencer
+ {
+ private SchemaTypeVisitorImpl _visitor;
+
+ private SequencerImpl(SchemaTypeVisitorImpl visitor)
+ {
+ _visitor = visitor;
+ }
+
+ public boolean next(QName elementName)
+ {
+ if (_visitor == null)
+ return false;
+
+ return _visitor.visit(elementName);
+ }
+
+ public boolean peek(QName elementName)
+ {
+ if (_visitor == null)
+ return false;
+
+ return _visitor.testValid(elementName);
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java
new file mode 100644
index 0000000..7b7c249
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderBase.java
@@ -0,0 +1,572 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.values.XmlStore;
+import org.apache.xmlbeans.impl.validator.ValidatingXMLInputStream;
+
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlSaxHandler;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlFactoryHook;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.util.List;
+import java.util.ArrayList;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.HttpURLConnection;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Node;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+public abstract class SchemaTypeLoaderBase implements SchemaTypeLoader
+{
+ private static final Method _rootBuilder = getMethod( "org.apache.xmlbeans.impl.store.Root", "newStore", new Class[] { SchemaTypeLoader.class, SchemaType.class, XmlOptions.class } );
+ private static final Method _pathCompiler = getMethod( "org.apache.xmlbeans.impl.store.Path", "getCompiledPath", new Class[] { String.class, XmlOptions.class } );
+ private static final Method _queryCompiler = getMethod( "org.apache.xmlbeans.impl.store.Path", "getCompiledQuery", new Class[] { String.class, XmlOptions.class } );
+
+ private static Method getMethod ( String className, String methodName, Class[] args )
+ {
+ try
+ {
+ return
+ Class.forName( className ).
+ getDeclaredMethod( methodName, args );
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException(
+ "Cannot find " + className + "." + methodName +
+ ". verify that xmlstore " +
+ "(from xbean.jar) is on classpath" );
+ }
+ }
+
+ private static Object invokeMethod ( Method method, Object[] args )
+ {
+ try
+ {
+ return method.invoke( method, args );
+ }
+ catch ( InvocationTargetException e )
+ {
+ IllegalStateException ise = new IllegalStateException( e.getCause().getMessage() );
+ ise.initCause( e );
+ throw ise;
+ }
+ catch ( Exception e )
+ {
+ IllegalStateException ise = new IllegalStateException( e.getMessage() );
+ ise.initCause( e );
+ throw ise;
+ }
+ }
+
+ private XmlStore createNewStore ( SchemaType type, XmlOptions options )
+ {
+ return
+ (XmlStore)
+ invokeMethod( _rootBuilder, new Object[] { this, type, options } );
+ }
+
+ private static String doCompilePath ( String pathExpr, XmlOptions options ) { return (String) invokeMethod( _pathCompiler, new Object[] { pathExpr, options } ); }
+ private static String doCompileQuery ( String queryExpr, XmlOptions options ) { return (String) invokeMethod( _queryCompiler, new Object[] { queryExpr, options } ); }
+
+ public SchemaType findType(QName name)
+ {
+ SchemaType.Ref ref = findTypeRef(name);
+ if (ref == null)
+ return null;
+ SchemaType result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaType findDocumentType(QName name)
+ {
+ SchemaType.Ref ref = findDocumentTypeRef(name);
+ if (ref == null)
+ return null;
+ SchemaType result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaType findAttributeType(QName name)
+ {
+ SchemaType.Ref ref = findAttributeTypeRef(name);
+ if (ref == null)
+ return null;
+ SchemaType result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaModelGroup findModelGroup(QName name)
+ {
+ SchemaModelGroup.Ref ref = findModelGroupRef(name);
+ if (ref == null)
+ return null;
+ SchemaModelGroup result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaAttributeGroup findAttributeGroup(QName name)
+ {
+ SchemaAttributeGroup.Ref ref = findAttributeGroupRef(name);
+ if (ref == null)
+ return null;
+ SchemaAttributeGroup result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaGlobalElement findElement(QName name)
+ {
+ SchemaGlobalElement.Ref ref = findElementRef(name);
+ if (ref == null)
+ return null;
+ SchemaGlobalElement result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ public SchemaGlobalAttribute findAttribute(QName name)
+ {
+ SchemaGlobalAttribute.Ref ref = findAttributeRef(name);
+ if (ref == null)
+ return null;
+ SchemaGlobalAttribute result = ref.get();
+ assert(result != null);
+ return result;
+ }
+
+ //
+ //
+ //
+
+ public XmlObject newInstance ( SchemaType type, XmlOptions options )
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.newInstance( this, type, options );
+
+ return createNewStore( type, options ).getObject();
+ }
+
+ public XmlObject parse ( String xmlText, SchemaType type, XmlOptions options ) throws XmlException
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.parse( this, xmlText, type, options );
+
+ return createNewStore( null, options ).loadXml( xmlText, type, options );
+ }
+
+ public XmlObject parse ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.parse( this, xis, type, options );
+
+ return createNewStore( null, options ).loadXml( xis, type, options );
+ }
+
+ public XmlObject parse ( File file, SchemaType type, XmlOptions options ) throws XmlException, IOException
+ {
+ if (options == null)
+ {
+ options = new XmlOptions();
+ options.put( XmlOptions.DOCUMENT_SOURCE_NAME, file.toURI().normalize().toString() );
+ }
+
+ else if (! options.hasOption(XmlOptions.DOCUMENT_SOURCE_NAME))
+ {
+ options = new XmlOptions( options );
+ options.put( XmlOptions.DOCUMENT_SOURCE_NAME, file.toURI().normalize().toString() );
+ }
+
+ InputStream fis = new FileInputStream( file );
+
+ try
+ {
+ return parse( fis, type, options );
+ }
+ finally
+ {
+ fis.close();
+ }
+ }
+
+ public XmlObject parse ( URL url, SchemaType type, XmlOptions options ) throws XmlException, IOException
+ {
+ if (options == null)
+ {
+ options = new XmlOptions();
+ options.put( XmlOptions.DOCUMENT_SOURCE_NAME, url.toString() );
+ }
+
+ else if (! options.hasOption(XmlOptions.DOCUMENT_SOURCE_NAME))
+ {
+ options = new XmlOptions( options );
+ options.put( XmlOptions.DOCUMENT_SOURCE_NAME, url.toString() );
+ }
+
+ URLConnection conn = null;
+ InputStream stream = null;
+ download: try
+ {
+
+ boolean redirected = false;
+ int count = 0;
+
+ do {
+ conn = url.openConnection();
+ conn.addRequestProperty("User-Agent", "Apache XMLBeans/1.0.3");
+ conn.addRequestProperty("Accept", "application/xml, text/xml, */*");
+ if (conn instanceof HttpURLConnection)
+ {
+ HttpURLConnection httpcon = (HttpURLConnection)conn;
+ int code = httpcon.getResponseCode();
+ redirected = (code == HttpURLConnection.HTTP_MOVED_PERM || code == HttpURLConnection.HTTP_MOVED_TEMP);
+ if (redirected && count > 5)
+ redirected = false;
+
+ if (redirected)
+ {
+ String newLocation = httpcon.getHeaderField("Location");
+ if (newLocation == null)
+ redirected = false;
+ else
+ {
+ url = new URL(newLocation);
+ count ++;
+ }
+ }
+ }
+ } while (redirected);
+
+ stream = conn.getInputStream();
+ return parse( stream, type, options );
+ }
+ finally
+ {
+ if (stream != null)
+ stream.close();
+ }
+ }
+
+ public XmlObject parse ( InputStream jiois, SchemaType type, XmlOptions options ) throws XmlException, IOException
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ DigestInputStream digestStream = null;
+ setupDigest: if (options != null && options.hasOption(XmlOptions.LOAD_MESSAGE_DIGEST))
+ {
+ MessageDigest sha;
+ try
+ {
+ sha = MessageDigest.getInstance("SHA");
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ break setupDigest;
+ }
+
+ digestStream = new DigestInputStream(jiois, sha);
+ jiois = digestStream;
+ }
+
+ if (hook != null)
+ return hook.parse( this, jiois, type, options );
+
+ XmlObject result = createNewStore( null, options ).loadXml( jiois, type, options );
+
+ if (digestStream != null)
+ result.documentProperties().setMessageDigest(digestStream.getMessageDigest().digest());
+
+ return result;
+ }
+
+ public XmlObject parse ( Reader jior, SchemaType type, XmlOptions options ) throws XmlException, IOException
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.parse( this, jior, type, options );
+
+ return createNewStore( null, options ).loadXml( jior, type, options );
+ }
+
+ public XmlObject parse ( Node node, SchemaType type, XmlOptions options ) throws XmlException
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.parse( this, node, type, options );
+
+ return createNewStore( null, options ).loadXml( node, type, options );
+ }
+
+ public XmlSaxHandler newXmlSaxHandler ( SchemaType type, XmlOptions options )
+ {
+ XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
+ if (hook != null)
+ return hook.newXmlSaxHandler( this, type, options );
+
+ return createNewStore( null, options ).newSaxHandler( type, options );
+ }
+
+ public XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException
+ {
+ return new ValidatingXMLInputStream( xis, this, type, options );
+ }
+
+ //
+ //
+ //
+
+ public String compilePath ( String pathExpr )
+ {
+ return compilePath( pathExpr, null );
+ }
+
+ public String compilePath ( String pathExpr, XmlOptions options )
+ {
+ return doCompilePath( pathExpr, options );
+ }
+
+ public String compileQuery ( String queryExpr )
+ {
+ return compileQuery( queryExpr, null );
+ }
+
+ public String compileQuery ( String queryExpr, XmlOptions options )
+ {
+ return doCompileQuery( queryExpr, options );
+ }
+
+ /**
+ * Utility function to load a type from a signature.
+ *
+ * A signature is the string you get from type.toString().
+ */
+ public SchemaType typeForSignature(String signature)
+ {
+ int end = signature.indexOf('@');
+ String uri;
+
+ if (end < 0)
+ {
+ uri = "";
+ end = signature.length();
+ }
+ else
+ {
+ uri = signature.substring(end + 1);
+ }
+
+ List parts = new ArrayList();
+
+ for (int index = 0; index < end; )
+ {
+ int nextc = signature.indexOf(':', index);
+ int nextd = signature.indexOf('|', index);
+ int next = (nextc < 0 ? nextd : nextd < 0 ? nextc : nextc < nextd ? nextc : nextd);
+ if (next < 0 || next > end)
+ next = end;
+ String part = signature.substring(index, next);
+ parts.add(part);
+ index = next + 1;
+ }
+
+ SchemaType curType = null;
+
+ outer: for (int i = parts.size() - 1; i >= 0; i -= 1)
+ {
+ String part = (String)parts.get(i);
+ if (part.length() < 1)
+ throw new IllegalArgumentException();
+ int offset = (part.length() >= 2 && part.charAt(1) == '=') ? 2 : 1;
+ cases: switch (part.charAt(0))
+ {
+ case 'T':
+ if (curType != null)
+ throw new IllegalArgumentException();
+ curType = findType(QNameHelper.forLNS(part.substring(offset), uri));
+ if (curType == null)
+ return null;
+ break;
+
+ case 'D':
+ if (curType != null)
+ throw new IllegalArgumentException();
+ curType = findDocumentType(QNameHelper.forLNS(part.substring(offset), uri));
+ if (curType == null)
+ return null;
+ break;
+
+ case 'C': // deprecated
+ case 'R': // current
+ if (curType != null)
+ throw new IllegalArgumentException();
+ curType = findAttributeType(QNameHelper.forLNS(part.substring(offset), uri));
+ if (curType == null)
+ return null;
+ break;
+
+ case 'E':
+ case 'U': // distinguish qualified/unqualified TBD
+ if (curType != null)
+ {
+ if (curType.getContentType() < SchemaType.ELEMENT_CONTENT)
+ return null;
+ SchemaType[] subTypes = curType.getAnonymousTypes();
+ String localName = part.substring(offset);
+ for (int j = 0; j < subTypes.length; j++)
+ {
+ SchemaField field = subTypes[j].getContainerField();
+ if (field != null && !field.isAttribute() && field.getName().getLocalPart().equals(localName))
+ {
+ curType = subTypes[j];
+ break cases;
+ }
+ }
+ return null;
+ }
+ else
+ {
+ SchemaGlobalElement elt = findElement(QNameHelper.forLNS(part.substring(offset), uri));
+ if (elt == null)
+ return null;
+ curType = elt.getType();
+ }
+ break;
+
+ case 'A':
+ case 'Q': // distinguish qualified/unqualified TBD
+ if (curType != null)
+ {
+ if (curType.isSimpleType())
+ return null;
+ SchemaType[] subTypes = curType.getAnonymousTypes();
+ String localName = part.substring(offset);
+ for (int j = 0; j < subTypes.length; j++)
+ {
+ SchemaField field = subTypes[j].getContainerField();
+ if (field != null && field.isAttribute() && field.getName().getLocalPart().equals(localName))
+ {
+ curType = subTypes[j];
+ break cases;
+ }
+ }
+ return null;
+ }
+ else
+ {
+ SchemaGlobalAttribute attr = findAttribute(QNameHelper.forLNS(part.substring(offset), uri));
+ if (attr == null)
+ return null;
+ curType = attr.getType();
+ }
+ break;
+
+ case 'B':
+ if (curType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ else
+ {
+ if (curType.getSimpleVariety() != SchemaType.ATOMIC)
+ return null;
+ SchemaType[] subTypes = curType.getAnonymousTypes();
+ if (subTypes.length != 1)
+ return null;
+ curType = subTypes[0];
+ }
+ break;
+
+ case 'I':
+ if (curType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ else
+ {
+ if (curType.getSimpleVariety() != SchemaType.LIST)
+ return null;
+ SchemaType[] subTypes = curType.getAnonymousTypes();
+ if (subTypes.length != 1)
+ return null;
+ curType = subTypes[0];
+ }
+ break;
+
+ case 'M':
+ if (curType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ else
+ {
+ int index;
+ try
+ {
+ index = Integer.parseInt(part.substring(offset));
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (curType.getSimpleVariety() != SchemaType.UNION)
+ return null;
+ SchemaType[] subTypes = curType.getAnonymousTypes();
+ if (subTypes.length <= index)
+ return null;
+ curType = subTypes[index];
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+ return curType;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java
new file mode 100644
index 0000000..a480c1a
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeLoaderImpl.java
@@ -0,0 +1,511 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XBeanDebug;
+import javax.xml.namespace.QName;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.WeakHashMap;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.IdentityHashMap;
+
+public class SchemaTypeLoaderImpl extends SchemaTypeLoaderBase
+{
+ private ResourceLoader _resourceLoader;
+ private ClassLoader _classLoader;
+ private SchemaTypeLoader[] _searchPath;
+
+ private Map _classpathTypeSystems;
+ private Map _classLoaderTypeSystems;
+ private Map _elementCache;
+ private Map _attributeCache;
+ private Map _modelGroupCache;
+ private Map _attributeGroupCache;
+ private Map _idConstraintCache;
+ private Map _typeCache;
+ private Map _documentCache;
+ private Map _classnameCache;
+
+ private static SchemaTypeLoaderImpl buildContextTypeLoader()
+ {
+ return new SchemaTypeLoaderImpl(new SchemaTypeLoader[] { BuiltinSchemaTypeSystem.get() } , null, Thread.currentThread().getContextClassLoader());
+ }
+
+ private static ThreadLocal _threadTypeSystems =
+ new ThreadLocal()
+ {
+ protected Object initialValue() { return new WeakHashMap(); }
+ };
+
+ public static SchemaTypeLoaderImpl getContextTypeLoader()
+ {
+ WeakHashMap candidates = (WeakHashMap) _threadTypeSystems.get();
+ ClassLoader threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ SchemaTypeLoaderImpl candidate = (SchemaTypeLoaderImpl) candidates.get( threadContextClassLoader );
+
+ if (candidate == null)
+ {
+ candidate = buildContextTypeLoader();
+ candidates.put( threadContextClassLoader, candidate );
+ }
+ return candidate;
+ }
+
+ public static SchemaTypeLoader build(SchemaTypeLoader[] searchPath, ResourceLoader resourceLoader, ClassLoader classLoader)
+ {
+ if (searchPath == null)
+ {
+ searchPath = EMPTY_SCHEMATYPELOADER_ARRAY;
+ }
+ else
+ {
+ // assemble a flattened search path with no duplicates
+ SubLoaderList list = new SubLoaderList();
+ for (int i = 0; i < searchPath.length; i++)
+ {
+ if (searchPath[i] == null)
+ throw new IllegalArgumentException("searchPath[" + i + "] is null");
+ if (!(searchPath[i] instanceof SchemaTypeLoaderImpl))
+ list.add(searchPath[i]);
+ else
+ {
+ SchemaTypeLoaderImpl sub = (SchemaTypeLoaderImpl)searchPath[i];
+ if (sub._classLoader != null || sub._resourceLoader != null)
+ list.add(sub);
+ else for (int j = 0; j < sub._searchPath.length; j++)
+ list.add(sub._searchPath[j]);
+ }
+ }
+ searchPath = list.toArray();
+ }
+
+ if (searchPath.length == 1 && resourceLoader == null && classLoader == null)
+ return searchPath[0];
+
+ return new SchemaTypeLoaderImpl(searchPath, resourceLoader, classLoader);
+ }
+
+ /**
+ * Just used to avoid duplicate path entries
+ */
+ private static class SubLoaderList
+ {
+ private List theList = new ArrayList();
+ private Map seen = new IdentityHashMap();
+
+ private boolean add(SchemaTypeLoader loader)
+ {
+ if (seen.containsKey(loader))
+ return false;
+ theList.add(loader);
+ seen.put(loader, null);
+ return true;
+ }
+
+ private SchemaTypeLoader[] toArray()
+ {
+ if (theList.size() == 0)
+ return EMPTY_SCHEMATYPELOADER_ARRAY;
+ return (SchemaTypeLoader[])theList.toArray(new SchemaTypeLoader[theList.size()]);
+ }
+ }
+
+ /**
+ * Constructs a SchemaTypeLoaderImpl that searches for objects
+ * in the following order:
+ *
+ * (1) First on the searchPath of other SchemaTypeSystems supplied,
+ * in order that they are listed.
+ * (2) Next on the classpath of .jar files or directories supplied,
+ * in the order that they are listed. When types are returned in
+ * this way, they are instantiated from a private typesystem.
+ * In other words, if a type is loaded from another SchemaTypeLoaderImpl
+ * that was initialized on the same file, the instance of the type will
+ * be different.
+ * (3) Finally on the classloader supplied.
+ */
+ private SchemaTypeLoaderImpl(SchemaTypeLoader[] searchPath, ResourceLoader resourceLoader, ClassLoader classLoader)
+ {
+ if (searchPath == null)
+ _searchPath = EMPTY_SCHEMATYPELOADER_ARRAY;
+ else
+ _searchPath = searchPath;
+ _resourceLoader = resourceLoader;
+ _classLoader = classLoader;
+
+ initCaches();
+ }
+
+ /**
+ * Initializes the caches.
+ */
+ private final void initCaches()
+ {
+ _classpathTypeSystems = Collections.synchronizedMap(new HashMap());
+ _classLoaderTypeSystems = Collections.synchronizedMap(new HashMap());
+ _elementCache = Collections.synchronizedMap(new HashMap());
+ _attributeCache = Collections.synchronizedMap(new HashMap());
+ _modelGroupCache = Collections.synchronizedMap(new HashMap());
+ _attributeGroupCache = Collections.synchronizedMap(new HashMap());
+ _idConstraintCache = Collections.synchronizedMap(new HashMap());
+ _typeCache = Collections.synchronizedMap(new HashMap());
+ _documentCache = Collections.synchronizedMap(new HashMap());
+ _classnameCache = Collections.synchronizedMap(new HashMap());
+ }
+
+ SchemaTypeSystemImpl typeSystemForComponent(String searchdir, QName name)
+ {
+ String searchfor = searchdir + QNameHelper.hexsafedir(name) + ".xsb";
+ String tsname = null;
+
+ if (_resourceLoader != null)
+ tsname = crackEntry(_resourceLoader, searchfor);
+
+ if (_classLoader != null)
+ tsname = crackEntry(_classLoader, searchfor);
+
+ if (tsname != null)
+ return (SchemaTypeSystemImpl)typeSystemForName(tsname);
+
+ return null;
+ }
+
+ public SchemaTypeSystem typeSystemForName(String name)
+ {
+ if (_resourceLoader != null)
+ {
+ SchemaTypeSystem result = getTypeSystemOnClasspath(name);
+ if (result != null)
+ return result;
+ }
+
+ if (_classLoader != null)
+ {
+ SchemaTypeSystem result = getTypeSystemOnClassloader(name);
+ if (result != null)
+ return result;
+ }
+ return null;
+ }
+
+ SchemaTypeSystemImpl typeSystemForClassname(String searchdir, String name)
+ {
+ String searchfor = searchdir + name.replace('.', '/') + ".xsb";
+
+ if (_resourceLoader != null)
+ {
+ String tsname = crackEntry(_resourceLoader, searchfor);
+ if (tsname != null)
+ return getTypeSystemOnClasspath(tsname);
+ }
+
+ if (_classLoader != null)
+ {
+ String tsname = crackEntry(_classLoader, searchfor);
+ if (tsname != null)
+ return getTypeSystemOnClassloader(tsname);
+ }
+
+ return null;
+ }
+
+ SchemaTypeSystemImpl getTypeSystemOnClasspath(String name)
+ {
+ SchemaTypeSystemImpl result = (SchemaTypeSystemImpl)_classpathTypeSystems.get(name);
+ if (result == null)
+ {
+ result = new SchemaTypeSystemImpl(_resourceLoader, name, this);
+ _classpathTypeSystems.put(name, result);
+ }
+ return result;
+ }
+
+ SchemaTypeSystemImpl getTypeSystemOnClassloader(String name)
+ {
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Finding type system " + name + " on classloader", 0);
+ SchemaTypeSystemImpl result = (SchemaTypeSystemImpl)_classLoaderTypeSystems.get(name);
+ if (result == null)
+ {
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Type system " + name + " not cached - consulting field", 0);
+ result = SchemaTypeSystemImpl.forName(name, _classLoader);
+ _classLoaderTypeSystems.put(name, result);
+ }
+ return result;
+ }
+
+ static String crackEntry(ResourceLoader loader, String searchfor)
+ {
+ InputStream is = loader.getResourceAsStream(searchfor);
+ if (is == null)
+ return null;
+ return crackPointer(is);
+ }
+
+ static String crackEntry(ClassLoader loader, String searchfor)
+ {
+ InputStream stream = loader.getResourceAsStream(searchfor);
+ if (stream == null)
+ return null;
+ return crackPointer(stream);
+ }
+
+ static String crackPointer(InputStream stream)
+ {
+ return SchemaTypeSystemImpl.crackPointer(stream);
+ }
+
+ public boolean isNamespaceDefined(String namespace)
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (_searchPath[i].isNamespaceDefined(namespace))
+ return true;
+
+ SchemaTypeSystem sts = typeSystemForComponent("schema/namespace/", new QName(namespace, "xmlns"));
+ return (sts != null);
+ }
+
+ public SchemaType.Ref findTypeRef(QName name)
+ {
+ SchemaType.Ref result = (SchemaType.Ref)_typeCache.get(name);
+ if (result == null && !_typeCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findTypeRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/type/", name);
+ if (ts != null)
+ {
+ result = ts.findTypeRef(name);
+ assert(result != null) : "Type system registered type " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _typeCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaType typeForClassname(String classname)
+ {
+ classname = classname.replace('$', '.');
+
+ SchemaType result = (SchemaType)_classnameCache.get(classname);
+ if (result == null && !_classnameCache.containsKey(classname))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].typeForClassname(classname)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForClassname("schema/javaname/", classname);
+ if (ts != null)
+ {
+ result = ts.typeForClassname(classname);
+ assert(result != null) : "Type system registered type " + classname + " but does not return it";
+ }
+ }
+ _classnameCache.put(classname, result);
+ }
+ return result;
+ }
+
+ public SchemaType.Ref findDocumentTypeRef(QName name)
+ {
+ SchemaType.Ref result = (SchemaType.Ref)_documentCache.get(name);
+ if (result == null && !_documentCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findDocumentTypeRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/element/", name);
+ if (ts != null)
+ {
+ result = ts.findDocumentTypeRef(name);
+ assert(result != null) : "Type system registered element " + QNameHelper.pretty(name) + " but does not contain document type";
+ }
+ }
+ _documentCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaType.Ref findAttributeTypeRef(QName name)
+ {
+ SchemaType.Ref result = (SchemaType.Ref)_attributeCache.get(name);
+ if (result == null && !_attributeCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findAttributeTypeRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/attribute/", name);
+ if (ts != null)
+ {
+ result = ts.findAttributeTypeRef(name);
+ assert(result != null) : "Type system registered attribute " + QNameHelper.pretty(name) + " but does not contain attribute type";
+ }
+ }
+ _attributeCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaGlobalElement.Ref findElementRef(QName name)
+ {
+ SchemaGlobalElement.Ref result = (SchemaGlobalElement.Ref)_elementCache.get(name);
+ if (result == null && !_elementCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findElementRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/element/", name);
+ if (ts != null)
+ {
+ result = ts.findElementRef(name);
+ assert(result != null) : "Type system registered element " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _elementCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaGlobalAttribute.Ref findAttributeRef(QName name)
+ {
+ SchemaGlobalAttribute.Ref result = (SchemaGlobalAttribute.Ref)_attributeCache.get(name);
+ if (result == null && !_attributeCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findAttributeRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/attribute/", name);
+ if (ts != null)
+ {
+ result = ts.findAttributeRef(name);
+ assert(result != null) : "Type system registered attribute " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _attributeCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaModelGroup.Ref findModelGroupRef(QName name)
+ {
+ SchemaModelGroup.Ref result = (SchemaModelGroup.Ref)_modelGroupCache.get(name);
+ if (result == null && !_modelGroupCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findModelGroupRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/modelgroup/", name);
+ if (ts != null)
+ {
+ result = ts.findModelGroupRef(name);
+ assert(result != null) : "Type system registered model group " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _modelGroupCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaAttributeGroup.Ref findAttributeGroupRef(QName name)
+ {
+ SchemaAttributeGroup.Ref result = (SchemaAttributeGroup.Ref)_attributeGroupCache.get(name);
+ if (result == null && !_attributeGroupCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findAttributeGroupRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/attributegroup/", name);
+ if (ts != null)
+ {
+ result = ts.findAttributeGroupRef(name);
+ assert(result != null) : "Type system registered attribute group " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _attributeGroupCache.put(name, result);
+ }
+ return result;
+ }
+
+ public SchemaIdentityConstraint.Ref findIdentityConstraintRef(QName name)
+ {
+ SchemaIdentityConstraint.Ref result = (SchemaIdentityConstraint.Ref)_idConstraintCache.get(name);
+ if (result == null && !_idConstraintCache.containsKey(name))
+ {
+ for (int i = 0; i < _searchPath.length; i++)
+ if (null != (result = _searchPath[i].findIdentityConstraintRef(name)))
+ break;
+ if (result == null)
+ {
+ SchemaTypeSystem ts = typeSystemForComponent("schema/identityconstraint/", name);
+ if (ts != null)
+ {
+ result = ts.findIdentityConstraintRef(name);
+ assert(result != null) : "Type system registered identity constraint " + QNameHelper.pretty(name) + " but does not return it";
+ }
+ }
+ _idConstraintCache.put(name, result);
+ }
+ return result;
+ }
+
+ public InputStream getSourceAsStream(String sourceName)
+ {
+ InputStream result = null;
+
+ if (!sourceName.startsWith("/"))
+ sourceName = "/" + sourceName;
+
+ if (_resourceLoader != null)
+ result = _resourceLoader.getResourceAsStream("schema/src" + sourceName);
+
+ if (result == null && _classLoader != null)
+ return _classLoader.getResourceAsStream("schema/src" + sourceName);
+
+ return result;
+ }
+
+ private static final SchemaTypeLoader[] EMPTY_SCHEMATYPELOADER_ARRAY = new SchemaTypeLoader[0];
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
new file mode 100644
index 0000000..8c9cf79
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemCompiler.java
@@ -0,0 +1,225 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaTypeSystem;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
+import java.net.URI;
+
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument.Config;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument;
+import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
+import org.apache.xmlbeans.impl.config.SchemaConfig;
+
+import java.util.Collection;
+
+public class SchemaTypeSystemCompiler
+{
+ public static class Parameters
+ {
+ private String name;
+ private Schema[] schemas;
+ private Config[] configs;
+ private SchemaTypeLoader linkTo;
+ private XmlOptions options;
+ private Collection errorListener;
+ private boolean javaize;
+ private URI baseURI;
+ private Map sourcesToCopyMap;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public SchemaDocument.Schema[] getSchemas()
+ {
+ return schemas;
+ }
+
+ public void setSchemas(SchemaDocument.Schema[] schemas)
+ {
+ this.schemas = schemas;
+ }
+
+ public ConfigDocument.Config[] getConfigs()
+ {
+ return configs;
+ }
+
+ public void setConfigs(ConfigDocument.Config[] configs)
+ {
+ this.configs = configs;
+ }
+
+ public SchemaTypeLoader getLinkTo()
+ {
+ return linkTo;
+ }
+
+ public void setLinkTo(SchemaTypeLoader linkTo)
+ {
+ this.linkTo = linkTo;
+ }
+
+ public XmlOptions getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(XmlOptions options)
+ {
+ this.options = options;
+ }
+
+ public Collection getErrorListener()
+ {
+ return errorListener;
+ }
+
+ public void setErrorListener(Collection errorListener)
+ {
+ this.errorListener = errorListener;
+ }
+
+ public boolean isJavaize()
+ {
+ return javaize;
+ }
+
+ public void setJavaize(boolean javaize)
+ {
+ this.javaize = javaize;
+ }
+
+ public URI getBaseURI()
+ {
+ return baseURI;
+ }
+
+ public void setBaseURI(URI baseURI)
+ {
+ this.baseURI = baseURI;
+ }
+
+ public Map getSourcesToCopyMap()
+ {
+ return sourcesToCopyMap;
+ }
+
+ public void setSourcesToCopyMap(Map sourcesToCopyMap)
+ {
+ this.sourcesToCopyMap = sourcesToCopyMap;
+ }
+ }
+
+ public static SchemaTypeSystem compile(Parameters params)
+ {
+ return compileImpl(params.getName(), params.getSchemas(), params.getConfigs(), params.getLinkTo(), params.getOptions(), params.getErrorListener(), params.isJavaize(), params.getBaseURI(), params.getSourcesToCopyMap());
+ }
+
+ /* package!!! */ static SchemaTypeSystemImpl compileImpl(
+ String name, Schema[] schemas, Config[] configs,
+ SchemaTypeLoader linkTo, XmlOptions options, Collection outsideErrors, boolean javaize, URI baseURI, Map sourcesToCopyMap)
+ {
+ if (linkTo == null)
+ throw new IllegalArgumentException("Must supply linkTo");
+
+ XmlErrorWatcher errorWatcher = new XmlErrorWatcher(outsideErrors);
+
+ // construct the state
+ StscState state = StscState.start();
+ boolean validate = (options == null || !options.hasOption(XmlOptions.COMPILE_NO_VALIDATION));
+ try
+ {
+ state.setErrorListener(errorWatcher);
+ state.setSchemaConfig(SchemaConfig.forConfigDocuments(configs));
+ state.setOptions(options);
+ state.setGivenTypeSystemName(name);
+ if (baseURI != null)
+ state.setBaseUri(baseURI);
+
+ // construct the classpath (you always get the builtin types)
+ linkTo = SchemaTypeLoaderImpl.build(new SchemaTypeLoader[] { BuiltinSchemaTypeSystem.get(), linkTo }, null, null);
+ state.setImportingTypeLoader(linkTo);
+
+ List validSchemas = new ArrayList(schemas.length);
+
+ // load all the xsd files into it
+ if (validate)
+ {
+ for (int i = 0; i < schemas.length; i++)
+ {
+ if (schemas[i].validate(new XmlOptions().setErrorListener(errorWatcher)))
+ validSchemas.add(schemas[i]);
+ }
+ }
+ else
+ {
+ validSchemas.addAll(Arrays.asList(schemas));
+ }
+
+ Schema[] startWith = (Schema[])validSchemas.toArray(new Schema[validSchemas.size()]);
+
+ // deal with imports and includes
+ StscImporter.SchemaToProcess[] schemasAndChameleons = StscImporter.resolveImportsAndIncludes(startWith);
+
+ // call the translator so that it may also perform magic
+ StscTranslator.addAllDefinitions(schemasAndChameleons);
+
+ // call the resolver to do its magic
+ StscResolver.resolveAll();
+
+ // call the checker to check both restrictions and defaults
+ StscChecker.checkAll();
+
+ // call the javaizer to do its magic
+ StscJavaizer.javaizeAllTypes(javaize);
+
+ // construct the loader out of the state
+ state.get().sts().loadFromStscState(state);
+
+ // fill in the source-copy map
+ if (sourcesToCopyMap != null)
+ sourcesToCopyMap.putAll(state.sourceCopyMap());
+
+ // if any errors, return null
+ if (errorWatcher.hasError())
+ return null;
+
+ return state.get().sts();
+ }
+ finally
+ {
+ StscState.end();
+ }
+ }
+
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
new file mode 100644
index 0000000..3227afc
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
@@ -0,0 +1,3119 @@
+/* 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.xmlbeans.impl.schema;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.common.NameUtil;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XBeanDebug;
+import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
+
+import java.io.InputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.*;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.math.BigInteger;
+
+
+import org.apache.xmlbeans.impl.regex.RegularExpression;
+import org.apache.xmlbeans.impl.util.HexBin;
+import org.apache.xmlbeans.impl.values.XmlObjectBase;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.SchemaStringEnumEntry;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.SchemaTypeLoaderException;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.soap.SchemaWSDLArrayType;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument.Config;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.w3.x2001.xmlSchema.GroupDocument;
+import org.w3.x2001.xmlSchema.AttributeGroupDocument;
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+
+public class SchemaTypeSystemImpl extends SchemaTypeLoaderBase implements SchemaTypeSystem
+{
+ public static final int DATA_BABE = 0xDA7ABABE;
+ public static final int MAJOR_VERSION = 2; // must match == to be compatible
+ public static final int MINOR_VERSION = 18; // must be <= to be compatible
+ public static final int RELEASE_NUMBER = 0; // should be compatible even if < or >
+
+ public static final int FILETYPE_SCHEMAINDEX = 1;
+ public static final int FILETYPE_SCHEMATYPE = 2;
+ public static final int FILETYPE_SCHEMAELEMENT = 3;
+ public static final int FILETYPE_SCHEMAATTRIBUTE = 4;
+ public static final int FILETYPE_SCHEMAPOINTER = 5;
+ public static final int FILETYPE_SCHEMAMODELGROUP = 6;
+ public static final int FILETYPE_SCHEMAATTRIBUTEGROUP = 7;
+ public static final int FILETYPE_SCHEMAIDENTITYCONSTRAINT = 8;
+
+ public static final int FLAG_PART_SKIPPABLE = 1;
+ public static final int FLAG_PART_FIXED = 4;
+ public static final int FLAG_PART_NILLABLE = 8;
+ public static final int FLAG_PART_BLOCKEXT = 16;
+ public static final int FLAG_PART_BLOCKREST = 32;
+ public static final int FLAG_PART_BLOCKSUBST = 64;
+ public static final int FLAG_PART_ABSTRACT = 128;
+ public static final int FLAG_PART_FINALEXT = 256;
+ public static final int FLAG_PART_FINALREST = 512;
+
+ public static final int FLAG_PROP_ISATTR = 1;
+ public static final int FLAG_PROP_JAVASINGLETON = 2;
+ public static final int FLAG_PROP_JAVAOPTIONAL = 4;
+ public static final int FLAG_PROP_JAVAARRAY = 8;
+
+ public static final int FIELD_NONE = 0;
+ public static final int FIELD_GLOBAL = 1;
+ public static final int FIELD_LOCALATTR = 2;
+ public static final int FIELD_LOCALELT = 3;
+
+ // type flags
+ static final int FLAG_SIMPLE_TYPE = 0x1;
+ static final int FLAG_DOCUMENT_TYPE = 0x2;
+ static final int FLAG_ORDERED = 0x4;
+ static final int FLAG_BOUNDED = 0x8;
+ static final int FLAG_FINITE = 0x10;
+ static final int FLAG_NUMERIC = 0x20;
+ static final int FLAG_STRINGENUM = 0x40;
+ static final int FLAG_UNION_OF_LISTS = 0x80;
+ static final int FLAG_HAS_PATTERN = 0x100;
+ static final int FLAG_ORDER_SENSITIVE = 0x200;
+ static final int FLAG_TOTAL_ORDER = 0x400;
+ static final int FLAG_COMPILED = 0x800;
+ static final int FLAG_BLOCK_EXT = 0x1000;
+ static final int FLAG_BLOCK_REST = 0x2000;
+ static final int FLAG_FINAL_EXT = 0x4000;
+ static final int FLAG_FINAL_REST = 0x8000;
+ static final int FLAG_FINAL_UNION = 0x10000;
+ static final int FLAG_FINAL_LIST = 0x20000;
+ static final int FLAG_ABSTRACT = 0x40000;
+ static final int FLAG_ATTRIBUTE_TYPE = 0x80000;
+
+
+ private static String nameToPathString(String nameForSystem)
+ {
+ nameForSystem = nameForSystem.replace('.', '/');
+
+ if (!nameForSystem.endsWith("/") && nameForSystem.length() > 0)
+ nameForSystem = nameForSystem + "/";
+
+ return nameForSystem;
+ }
+
+ public SchemaTypeSystemImpl(Class indexclass)
+ {
+ String fullname = indexclass.getName();
+ _name = fullname.substring(0, fullname.lastIndexOf('.'));
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Loading type system " + _name, 1);
+ _basePackage = nameToPathString(_name);
+ _classloader = indexclass.getClassLoader();
+ _linker = SchemaTypeLoaderImpl.build(null, null, _classloader);
+ _resourceLoader = new ClassLoaderResourceLoader(_classloader);
+ initFromHeader();
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Finished loading type system " + _name, -1);
+ }
+
+ private static final Schema[] EMPTY_SCHEMA_ARRAY = new Schema[0];
+ private static final Config[] EMPTY_CONFIG_ARRAY = new Config[0];
+
+ public static SchemaTypeSystemImpl forSchemaXml(
+ XmlObject[] input, SchemaTypeLoader linkTo, XmlOptions options)
+ throws XmlException
+ {
+ options = XmlOptions.maskNull(options);
+ ArrayList schemas = new ArrayList();
+ ArrayList configs = new ArrayList();
+
+ for (int i = 0; i < input.length; i++)
+ {
+ if (input[i] instanceof Schema)
+ schemas.add(input[i]);
+ else if (input[i] instanceof SchemaDocument && ((SchemaDocument)input[i]).getSchema() != null)
+ schemas.add(((SchemaDocument)input[i]).getSchema());
+ else if (input[i] instanceof Config)
+ configs.add(input[i]);
+ else if (input[i] instanceof ConfigDocument && ((ConfigDocument)input[i]).getConfig() != null)
+ configs.add(((ConfigDocument)input[i]).getConfig());
+ else
+ throw new XmlException("Thread " + Thread.currentThread().getName() + ": The " + i + "th supplied input is not a schema or a config document: its type is " + input[i].schemaType());
+ }
+
+
+
+ Collection userErrors = (Collection)options.get(XmlOptions.ERROR_LISTENER);
+ XmlErrorWatcher errorWatcher = new XmlErrorWatcher(userErrors);
+
+ SchemaTypeSystemImpl stsi =
+ SchemaTypeSystemCompiler.compileImpl(
+ null, (Schema[])schemas.toArray(EMPTY_SCHEMA_ARRAY),
+ (Config[])configs.toArray(EMPTY_CONFIG_ARRAY), linkTo, options, errorWatcher, false, null, null);
+
+ if (errorWatcher.hasError())
+ {
+ throw new XmlException(errorWatcher.firstError());
+ }
+
+ return stsi;
+ }
+
+ public static boolean fileContainsTypeSystem(File file, String name)
+ {
+ String indexname = nameToPathString(name) + "index.xsb";
+
+ if (file.isDirectory())
+ {
+ return (new File(file, indexname)).isFile();
+ }
+ else
+ {
+ ZipFile zipfile = null;
+ try
+ {
+ zipfile = new ZipFile(file);
+ ZipEntry entry = zipfile.getEntry(indexname);
+ return (entry != null && !entry.isDirectory());
+ }
+ catch (IOException e)
+ {
+ XBeanDebug.log("Problem loading SchemaTypeSystem, zipfilename " + file);
+ XBeanDebug.logException(e);
+ throw new SchemaTypeLoaderException(e.getMessage(), name, "index", SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ finally
+ {
+ if (zipfile != null)
+ try { zipfile.close(); } catch (IOException e) {}
+ }
+ }
+ }
+
+ public static SchemaTypeSystemImpl forName(String name, ClassLoader loader)
+ {
+ try
+ {
+ Class c = Class.forName(name + "." + SchemaTypeCodePrinter.INDEX_CLASSNAME, true, loader);
+ return (SchemaTypeSystemImpl)c.getField("typeSystem").get(null);
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+ public SchemaTypeSystemImpl(ResourceLoader resourceLoader, String name, SchemaTypeLoader linker)
+ {
+ _name = name;
+ _basePackage = nameToPathString(_name);
+ _linker = linker;
+ _resourceLoader = resourceLoader;
+ try
+ {
+ initFromHeader();
+ }
+ catch (RuntimeException e)
+ {
+ XBeanDebug.logException(e);
+ throw e;
+ }
+ catch (Error e)
+ {
+ XBeanDebug.logException(e);
+ throw e;
+ }
+ }
+
+ private void initFromHeader()
+ {
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Reading unresolved handles for type system " + _name, 0);
+ XsbReader reader = null;
+ try
+ {
+ // Read the index file, which starts with a header.
+ reader = new XsbReader("index", FILETYPE_SCHEMAINDEX);
+
+ // has a handle pool (count, handle/type, handle/type...)
+ _localHandles = new HandlePool();
+ reader.readHandlePool(_localHandles);
+
+ // then a qname map of global elements (count, qname/handle, qname/handle...)
+ _globalElements = reader.readQNameRefMap();
+
+ // qname map of global attributes
+ _globalAttributes = reader.readQNameRefMap();
+
+ // qname map of model groups
+ _modelGroups = reader.readQNameRefMap();
+
+ // qname map of attribute groups
+ _attributeGroups = reader.readQNameRefMap();
+
+ _identityConstraints = reader.readQNameRefMap();
+
+ // qname map of global types
+ _globalTypes = reader.readQNameRefMap();
+
+ // qname map of document types, by the qname of the contained element
+ _documentTypes = reader.readQNameRefMap();
+
+ // qname mape of attribute types, by the qname of the contained attribute
+ _attributeTypes = reader.readQNameRefMap();
+
+ // string map of all types, by fully qualified classname
+ _typeRefsByClassname = reader.readClassnameRefMap();
+
+ _namespaces = reader.readNamespaces();
+
+ // support for redefine, at the end of the file
+ if (reader.atLeast(2, 15, 0))
+ {
+ _redefinedGlobalTypes = reader.readQNameRefMap();
+ _redefinedModelGroups = reader.readQNameRefMap();
+ _redefinedAttributeGroups = reader.readQNameRefMap();
+ }
+ }
+ finally
+ {
+ if (reader != null)
+ reader.readEnd();
+ }
+ }
+
+ void saveIndex()
+ {
+ String handle = "index";
+ XsbReader saver = new XsbReader(handle);
+ saver.writeIndexData();
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAINDEX);
+ saver.writeIndexData();
+ saver.writeEnd();
+ }
+
+ void savePointers()
+ {
+ savePointersForComponents(globalElements(), "schema/element/");
+ savePointersForComponents(globalAttributes(), "schema/attribute/");
+ savePointersForComponents(modelGroups(), "schema/modelgroup/");
+ savePointersForComponents(attributeGroups(), "schema/attributegroup/");
+ savePointersForComponents(globalTypes(), "schema/type/");
+ savePointersForComponents(identityConstraints(), "schema/identityconstraint/");
+ savePointersForNamespaces(_namespaces, "schema/namespace/");
+ savePointersForClassnames(_typeRefsByClassname.keySet(), "schema/javaname/");
+ savePointersForComponents(redefinedModelGroups(), "schema/redefinedmodelgroup/");
+ savePointersForComponents(redefinedAttributeGroups(), "schema/redefinedattributegroup/");
+ savePointersForComponents(redefinedGlobalTypes(), "schema/redefinedtype/");
+ }
+
+ void savePointersForComponents(SchemaComponent[] components, String dir)
+ {
+ for (int i = 0; i < components.length; i++)
+ {
+ savePointerFile(dir + QNameHelper.hexsafedir(components[i].getName()), _name);
+ }
+ }
+
+ void savePointersForClassnames(Set classnames, String dir)
+ {
+ for (Iterator i = classnames.iterator(); i.hasNext(); )
+ {
+ String classname = (String)i.next();
+ savePointerFile(dir + classname.replace('.', '/'), _name);
+ }
+ }
+
+ void savePointersForNamespaces(Set namespaces, String dir)
+ {
+ for (Iterator i = namespaces.iterator(); i.hasNext(); )
+ {
+ String ns = (String)i.next();
+ savePointerFile(dir + QNameHelper.hexsafedir(new QName(ns, "xmlns")), _name);
+ }
+ }
+
+ void savePointerFile(String filename, String name)
+ {
+ XsbReader saver = new XsbReader(filename);
+ saver.writeString(name);
+ saver.writeRealHeader(filename, FILETYPE_SCHEMAPOINTER);
+ saver.writeString(name);
+ saver.writeEnd();
+ }
+
+ /**
+ * Only used in the nonbootstrapped case.
+ */
+ private Map buildTypeRefsByClassname()
+ {
+ List allSeenTypes = new ArrayList();
+ Map result = new LinkedHashMap();
+ allSeenTypes.addAll(Arrays.asList(documentTypes()));
+ allSeenTypes.addAll(Arrays.asList(attributeTypes()));
+ allSeenTypes.addAll(Arrays.asList(globalTypes()));
+
+ // now fully javaize everything deeply.
+ for (int i = 0; i < allSeenTypes.size(); i++)
+ {
+ SchemaType gType = (SchemaType)allSeenTypes.get(i);
+ String className = gType.getFullJavaName();
+ if (className != null)
+ {
+ result.put(className.replace('$', '.'), gType.getRef());
+ }
+ allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes()));
+ }
+ return result;
+ }
+
+ private Map buildTypeRefsByClassname(Map typesByClassname)
+ {
+ Map result = new LinkedHashMap();
+ for (Iterator i = typesByClassname.keySet().iterator(); i.hasNext(); )
+ {
+ String className = (String)i.next();
+ result.put(className, ((SchemaType)typesByClassname.get(className)).getRef());
+ }
+ return result;
+ }
+
+ private static Map buildComponentRefMap(SchemaComponent[] components)
+ {
+ Map result = new LinkedHashMap();
+ for (int i = 0; i < components.length; i++)
+ result.put(components[i].getName(), components[i].getComponentRef());
+ return result;
+ }
+
+ private static Map buildDocumentMap(SchemaType[] types)
+ {
+ Map result = new LinkedHashMap();
+ for (int i = 0; i < types.length; i++)
+ result.put(types[i].getDocumentElementName(), types[i].getRef());
+ return result;
+ }
+
+ private static Map buildAttributeTypeMap(SchemaType[] types)
+ {
+ Map result = new LinkedHashMap();
+ for (int i = 0; i < types.length; i++)
+ result.put(types[i].getAttributeTypeAttributeName(), types[i].getRef());
+ return result;
+ }
+
+ private static Random _random;
+ private static byte[] _mask = new byte[128 / 8];
+
+ /**
+ * Fun, fun. Produce 128 bits of uniqueness randomly.
+ * We used to use SecureRandom, but now we don't because SecureRandom
+ * hits the filesystem and hangs us on a filesystem lock. It also eats
+ * a thread and other expensive resources.. :-).
+ *
+ * We don't really care that non-secure Random() can only do 48 bits of
+ * randomness, since we're certainly not going to be called more than 2^48
+ * times within our process lifetime.
+ *
+ * Our real concern is that by seeding Random() with the current
+ * time, two users will end up with the same bits if they start a
+ * schema compilation within the same millisecond. That makes the
+ * probability of collision in the real world slightly too high.
+ * We're going to have millions of users, remember? With a million
+ * users, and one-compilation-per-day each, we'd see a collision every
+ * few months.
+ *
+ * So we'll just xor the results of random with our few extra
+ * bits of information computed below to help reduce the probability
+ * of collision by a few decimal places. To collide, you will have had
+ * to have the same amount of free memory, the same user name, timezone,
+ * and country, the same current directory, the same java classpath,
+ * the same operating system and jvm version, and the same choices of
+ * identity hashcodes for a few objects. And be started within the same
+ * millisecond. Or you can collide if you have a cosmic 128-bit mathematical
+ * coincidence. No worries.
+ */
+ private static synchronized void nextBytes(byte[] result)
+ {
+ if (_random == null)
+ {
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream daos = new DataOutputStream(baos);
+
+ // at least 10 bits of unqieueness, right? Maybe even 50 or 60.
+ daos.writeInt(System.identityHashCode(SchemaTypeSystemImpl.class));
+ String[] props = new String[] { "user.name", "user.dir", "user.timezone", "user.country", "java.class.path", "java.home", "java.vendor", "java.version", "os.version" };
+ for (int i = 0; i < props.length; i++)
+ {
+ String prop = System.getProperty(props[i]);
+ if (prop != null)
+ {
+ daos.writeUTF(prop);
+ daos.writeInt(System.identityHashCode(prop));
+ }
+ }
+ daos.writeLong(Runtime.getRuntime().freeMemory());
+ daos.close();
+ byte[] bytes = baos.toByteArray();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ int j = i % _mask.length;
+ _mask[j] *= 21;
+ _mask[j] += i;
+ }
+ }
+ catch (IOException e)
+ {
+ XBeanDebug.logException(e);
+ }
+
+ _random = new Random(System.currentTimeMillis());
+ }
+ _random.nextBytes(result);
+ for (int i = 0; i < result.length; i++)
+ {
+ int j = i & _mask.length;
+ result[i] ^= _mask[j];
+ }
+ }
+
+ public SchemaTypeSystemImpl(String nameForSystem)
+ {
+ // if we have no name, select a random one
+ if (nameForSystem == null)
+ {
+ // get 128 random bits (that'll be 32 hex digits)
+ byte[] bytes = new byte[128/8];
+ nextBytes(bytes);
+ nameForSystem = "s" + new String(HexBin.encode(bytes));
+ }
+
+ _name = "schema.system." + nameForSystem;
+ _basePackage = nameToPathString(_name);
+ _classloader = null;
+
+ }
+
+ public void loadFromBuilder(SchemaGlobalElement[] globalElements,
+ SchemaGlobalAttribute[] globalAttributes,
+ SchemaType[] globalTypes,
+ SchemaType[] documentTypes,
+ SchemaType[] attributeTypes)
+ {
+ assert(_classloader == null);
+ _localHandles = new HandlePool();
+ _globalElements = buildComponentRefMap(globalElements);
+ _globalAttributes = buildComponentRefMap(globalAttributes);
+ _globalTypes = buildComponentRefMap(globalTypes);
+ _documentTypes = buildDocumentMap(documentTypes);
+ _attributeTypes = buildDocumentMap(attributeTypes);
+ _typeRefsByClassname = buildTypeRefsByClassname();
+ _namespaces = new HashSet();
+ }
+
+ public void loadFromStscState(StscState state)
+ {
+ assert(_classloader == null);
+ _localHandles = new HandlePool();
+ _globalElements = buildComponentRefMap(state.globalElements());
+ _globalAttributes = buildComponentRefMap(state.globalAttributes());
+ _modelGroups = buildComponentRefMap(state.modelGroups());
+ _redefinedModelGroups = buildComponentRefMap(state.redefinedModelGroups());
+ _attributeGroups = buildComponentRefMap(state.attributeGroups());
+ _redefinedAttributeGroups = buildComponentRefMap(state.redefinedAttributeGroups());
+ _globalTypes = buildComponentRefMap(state.globalTypes());
+ _redefinedGlobalTypes = buildComponentRefMap(state.redefinedGlobalTypes());
+ _documentTypes = buildDocumentMap(state.documentTypes());
+ _attributeTypes = buildAttributeTypeMap(state.attributeTypes());
+ _typeRefsByClassname = buildTypeRefsByClassname(state.typesByClassname());
+ _identityConstraints = buildComponentRefMap(state.idConstraints());
+ _namespaces = new HashSet(Arrays.asList(state.getNamespaces()));
+ }
+
+ final SchemaTypeSystemImpl getTypeSystem()
+ {
+ return this;
+ }
+
+ static class StringPool
+ {
+ private List intsToStrings = new ArrayList();
+ private Map stringsToInts = new HashMap();
+ private String _handle;
+ private String _name;
+
+ /**
+ * Constructs an empty StringPool to be filled with strings.
+ */
+ StringPool(String handle, String name)
+ {
+ _handle = handle;
+ _name = name;
+ intsToStrings.add(null);
+ }
+
+ int codeForString(String str)
+ {
+ if (str == null)
+ return 0;
+ Integer result = (Integer)stringsToInts.get(str);
+ if (result == null)
+ {
+ result = new Integer(intsToStrings.size());
+ intsToStrings.add(str);
+ stringsToInts.put(str, result);
+ }
+ return result.intValue();
+ }
+
+ String stringForCode(int code)
+ {
+ if (code == 0)
+ return null;
+ return (String)intsToStrings.get(code);
+ }
+
+ void writeTo(DataOutputStream output)
+ {
+ if (intsToStrings.size() > Short.MAX_VALUE)
+ throw new SchemaTypeLoaderException("Too many strings (" + intsToStrings.size() + ")", _name, _handle, SchemaTypeLoaderException.INT_TOO_LARGE);
+
+ try
+ {
+ output.writeShort(intsToStrings.size());
+ Iterator i = intsToStrings.iterator();
+ for (i.next(); i.hasNext(); )
+ {
+ String str = (String)i.next();
+ output.writeUTF(str);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ void readFrom(DataInputStream input)
+ {
+ if (intsToStrings.size() != 1 || stringsToInts.size() != 0)
+ throw new IllegalStateException();
+
+ try
+ {
+ int size = input.readShort();
+ for (int i = 1; i < size; i++)
+ {
+ String str = input.readUTF().intern();
+ int code = codeForString(str);
+ if (code != i)
+ throw new IllegalStateException();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage() == null ? e.getMessage() : "IO Exception", _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION, e);
+ }
+ }
+ }
+
+ class HandlePool
+ {
+ private Map _handlesToRefs = new LinkedHashMap();
+ private Map _componentsToHandles = new LinkedHashMap(); // populated on write
+ private boolean _started;
+
+ /**
+ * Constructs an empty HandlePool to be populated.
+ */
+ HandlePool()
+ {
+ }
+
+ private String addUniqueHandle(SchemaComponent obj, String base)
+ {
+ base = base.toLowerCase(); // we lowercase handles because of case-insensitive Windows filenames!!!
+ String handle = base;
+ for (int index = 2; _handlesToRefs.containsKey(handle); index++)
+ {
+ handle = base + index;
+ }
+ _handlesToRefs.put(handle, obj.getComponentRef());
+ _componentsToHandles.put(obj, handle);
+ return handle;
+ }
+
+ String handleForComponent(SchemaComponent comp)
+ {
+ if (comp == null)
+ return null;
+ if (comp.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ if (comp instanceof SchemaType)
+ return handleForType((SchemaType)comp);
+ if (comp instanceof SchemaGlobalElement)
+ return handleForElement((SchemaGlobalElement)comp);
+ if (comp instanceof SchemaGlobalAttribute)
+ return handleForAttribute((SchemaGlobalAttribute)comp);
+ if (comp instanceof SchemaModelGroup)
+ return handleForModelGroup((SchemaModelGroup)comp);
+ if (comp instanceof SchemaAttributeGroup)
+ return handleForAttributeGroup((SchemaAttributeGroup)comp);
+ if (comp instanceof SchemaIdentityConstraint)
+ return handleForIdentityConstraint((SchemaIdentityConstraint)comp);
+ throw new IllegalStateException("Component type cannot have a handle");
+ }
+
+ String handleForElement(SchemaGlobalElement element)
+ {
+ if (element == null)
+ return null;
+ if (element.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(element);
+ if (handle == null)
+ handle = addUniqueHandle(element, NameUtil.upperCamelCase(element.getName().getLocalPart()) + "Element");
+ return handle;
+ }
+
+ String handleForAttribute(SchemaGlobalAttribute attribute)
+ {
+ if (attribute == null)
+ return null;
+ if (attribute.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(attribute);
+ if (handle == null)
+ handle = addUniqueHandle(attribute, NameUtil.upperCamelCase(attribute.getName().getLocalPart()) + "Attribute");
+ return handle;
+ }
+
+ String handleForModelGroup(SchemaModelGroup group)
+ {
+ if (group == null)
+ return null;
+ if (group.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(group);
+ if (handle == null)
+ handle = addUniqueHandle(group, NameUtil.upperCamelCase(group.getName().getLocalPart()) + "ModelGroup");
+ return handle;
+ }
+
+ String handleForAttributeGroup(SchemaAttributeGroup group)
+ {
+ if (group == null)
+ return null;
+ if (group.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(group);
+ if (handle == null)
+ handle = addUniqueHandle(group, NameUtil.upperCamelCase(group.getName().getLocalPart()) + "AttributeGroup");
+ return handle;
+ }
+
+ String handleForIdentityConstraint(SchemaIdentityConstraint idc)
+ {
+ if (idc == null)
+ return null;
+ if (idc.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(idc);
+ if (handle == null)
+ handle = addUniqueHandle(idc, NameUtil.upperCamelCase(idc.getName().getLocalPart()) + "IdentityConstraint");
+ return handle;
+ }
+
+ String handleForType(SchemaType type)
+ {
+ if (type == null)
+ return null;
+ if (type.getTypeSystem() != getTypeSystem())
+ throw new IllegalArgumentException("Cannot supply handles for types from another type system");
+ String handle = (String)_componentsToHandles.get(type);
+ if (handle == null)
+ {
+ QName name = type.getName();
+ String suffix = "";
+ if (name == null)
+ {
+ if (type.isDocumentType())
+ {
+ name = type.getDocumentElementName();
+ suffix = "Doc";
+ }
+ else if (type.isAttributeType())
+ {
+ name = type.getAttributeTypeAttributeName();
+ suffix = "AttrType";
+ }
+ else if (type.getContainerField() != null)
+ {
+ name = type.getContainerField().getName();
+ suffix = type.getContainerField().isAttribute() ? "Attr" : "Elem";
+ }
+ }
+
+ String baseName;
+ String uniq = Integer.toHexString(type.toString().hashCode() | 0x80000000).substring(4).toUpperCase();
+ if (name == null)
+ baseName = "Anon" + uniq + "Type";
+ else
+ baseName = NameUtil.upperCamelCase(name.getLocalPart()) + uniq + suffix + "Type";
+
+ handle = addUniqueHandle(type, baseName);
+ }
+
+ return handle;
+ }
+
+ SchemaComponent.Ref refForHandle(String handle)
+ {
+ if (handle == null)
+ return null;
+
+ return (SchemaComponent.Ref)_handlesToRefs.get(handle);
+ }
+
+ Set getAllHandles()
+ {
+ return _handlesToRefs.keySet();
+ }
+
+ void startWriteMode()
+ {
+ _started = true;
+ _componentsToHandles = new LinkedHashMap();
+ for (Iterator i = _handlesToRefs.keySet().iterator(); i.hasNext(); )
+ {
+ String handle = (String)i.next();
+// System.err.println("Writing preexisting handle " + handle);
+ SchemaComponent comp = ((SchemaComponent.Ref)_handlesToRefs.get(handle)).getComponent();
+ _componentsToHandles.put(comp, handle);
+ }
+ }
+
+ }
+
+ private String _name;
+ private String _basePackage;
+
+ // classloader is available for sts's that were compiled and loaded, not dynamic ones
+ private ClassLoader _classloader;
+
+ // the loader for loading .xsb resources
+ private ResourceLoader _resourceLoader;
+
+ // the following is used to link references during load
+ SchemaTypeLoader _linker;
+
+ private HandlePool _localHandles;
+ private File _baseSaveDir;
+
+ // actual type system data, map QNames -> SchemaComponent.Ref
+ private Map _redefinedModelGroups;
+ private Map _redefinedAttributeGroups;
+ private Map _redefinedGlobalTypes;
+
+ private Map _globalElements;
+ private Map _globalAttributes;
+ private Map _modelGroups;
+ private Map _attributeGroups;
+ private Map _globalTypes;
+ private Map _documentTypes;
+ private Map _attributeTypes;
+ private Map _identityConstraints = Collections.EMPTY_MAP;
+ private Map _typeRefsByClassname = new HashMap();
+ private Set _namespaces;
+
+ static private final SchemaType[] EMPTY_ST_ARRAY = new SchemaType[0];
+ static private final SchemaGlobalElement[] EMPTY_GE_ARRAY = new SchemaGlobalElement[0];
+ static private final SchemaGlobalAttribute[] EMPTY_GA_ARRAY = new SchemaGlobalAttribute[0];
+ static private final SchemaModelGroup[] EMPTY_MG_ARRAY = new SchemaModelGroup[0];
+ static private final SchemaAttributeGroup[] EMPTY_AG_ARRAY = new SchemaAttributeGroup[0];
+ static private final SchemaIdentityConstraint[] EMPTY_IC_ARRAY = new SchemaIdentityConstraint[0];
+
+ public void saveToDirectory(File classDir)
+ {
+ _baseSaveDir = classDir;
+
+ _localHandles.startWriteMode();
+ saveTypesRecursively(globalTypes());
+ saveTypesRecursively(documentTypes());
+ saveTypesRecursively(attributeTypes());
+ saveGlobalElements(globalElements());
+ saveGlobalAttributes(globalAttributes());
+ saveModelGroups(modelGroups());
+ saveAttributeGroups(attributeGroups());
+ saveIdentityConstraints(identityConstraints());
+
+ saveTypesRecursively(redefinedGlobalTypes());
+ saveModelGroups(redefinedModelGroups());
+ saveAttributeGroups(redefinedAttributeGroups());
+
+ saveIndex();
+ savePointers();
+ }
+
+ void saveTypesRecursively(SchemaType[] types)
+ {
+ for (int i = 0; i < types.length; i++)
+ {
+ if (types[i].getTypeSystem() != getTypeSystem())
+ continue;
+ saveType(types[i]);
+ saveTypesRecursively(types[i].getAnonymousTypes());
+ }
+ }
+
+ public void saveGlobalElements(SchemaGlobalElement[] elts)
+ {
+ for (int i = 0; i < elts.length; i++)
+ {
+ saveGlobalElement(elts[i]);
+ }
+ }
+
+ public void saveGlobalAttributes(SchemaGlobalAttribute[] attrs)
+ {
+ for (int i = 0; i < attrs.length; i++)
+ {
+ saveGlobalAttribute(attrs[i]);
+ }
+ }
+
+ public void saveModelGroups(SchemaModelGroup[] groups)
+ {
+ for (int i = 0; i < groups.length; i++)
+ {
+ saveModelGroup(groups[i]);
+ }
+ }
+
+ public void saveAttributeGroups(SchemaAttributeGroup[] groups)
+ {
+ for (int i = 0; i < groups.length; i++)
+ {
+ saveAttributeGroup(groups[i]);
+ }
+ }
+
+ public void saveIdentityConstraints(SchemaIdentityConstraint[] idcs)
+ {
+ for (int i = 0; i < idcs.length; i++)
+ {
+ saveIdentityConstraint(idcs[i]);
+ }
+ }
+
+ public void saveGlobalElement(SchemaGlobalElement elt)
+ {
+ String handle = _localHandles.handleForElement(elt);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeParticleData((SchemaParticle)elt);
+ saver.writeString(elt.getSourceName());
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAELEMENT);
+ saver.writeParticleData((SchemaParticle)elt);
+ saver.writeString(elt.getSourceName());
+ saver.writeEnd();
+ }
+
+ public void saveGlobalAttribute(SchemaGlobalAttribute attr)
+ {
+ String handle = _localHandles.handleForAttribute(attr);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeAttributeData(attr);
+ saver.writeString(attr.getSourceName());
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAATTRIBUTE);
+ saver.writeAttributeData(attr);
+ saver.writeString(attr.getSourceName());
+ saver.writeEnd();
+ }
+
+ public void saveModelGroup(SchemaModelGroup grp)
+ {
+ String handle = _localHandles.handleForModelGroup(grp);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeModelGroupData(grp);
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAMODELGROUP);
+ saver.writeModelGroupData(grp);
+ saver.writeEnd();
+ }
+
+ public void saveAttributeGroup(SchemaAttributeGroup grp)
+ {
+ String handle = _localHandles.handleForAttributeGroup(grp);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeAttributeGroupData(grp);
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAATTRIBUTEGROUP);
+ saver.writeAttributeGroupData(grp);
+ saver.writeEnd();
+ }
+
+ public void saveIdentityConstraint(SchemaIdentityConstraint idc)
+ {
+ String handle = _localHandles.handleForIdentityConstraint(idc);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeIdConstraintData(idc);
+ saver.writeRealHeader(handle, FILETYPE_SCHEMAIDENTITYCONSTRAINT);
+ saver.writeIdConstraintData(idc);
+ saver.writeEnd();
+ }
+
+ void saveType(SchemaType type)
+ {
+ String handle = _localHandles.handleForType(type);
+ XsbReader saver = new XsbReader(handle);
+ saver.writeTypeData(type);
+ saver.writeRealHeader(handle, FILETYPE_SCHEMATYPE);
+ saver.writeTypeData(type);
+ saver.writeEnd();
+ }
+
+ public static String crackPointer(InputStream stream)
+ {
+ DataInputStream input = null;
+ try
+ {
+ input = new DataInputStream(stream);
+
+ int magic = input.readInt();
+ if (magic != DATA_BABE)
+ return null;
+
+ int majorver = input.readShort();
+ int minorver = input.readShort();
+
+ if (majorver != MAJOR_VERSION)
+ return null;
+
+ if (minorver > MINOR_VERSION)
+ return null;
+
+ if (majorver > 2 || majorver == 2 && minorver >= 18)
+ input.readShort(); // release number present in atLeast(2, 18, 0)
+
+ int actualfiletype = input.readShort();
+ if (actualfiletype != FILETYPE_SCHEMAPOINTER)
+ return null;
+
+ StringPool stringPool = new StringPool("pointer", "unk");
+ stringPool.readFrom(input);
+
+ return stringPool.stringForCode(input.readShort());
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ finally
+ {
+ if (input != null)
+ try { input.close(); } catch (IOException e) {}
+ }
+ }
+
+ private class XsbReader
+ {
+ DataInputStream _input;
+ DataOutputStream _output;
+ StringPool _stringPool;
+ String _handle;
+ private int _majorver;
+ private int _minorver;
+ private int _releaseno;
+ int _actualfiletype;
+
+ public XsbReader(String handle, int filetype)
+ {
+ String resourcename = _basePackage + handle + ".xsb";
+ InputStream rawinput = getLoaderStream(resourcename);
+ if (rawinput == null)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: Could not locate compiled schema resource " + resourcename, _name, handle, SchemaTypeLoaderException.NO_RESOURCE);
+
+ _input = new DataInputStream(rawinput);
+ _handle = handle;
+
+ int magic = readInt();
+ if (magic != DATA_BABE)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: Wrong magic cookie", _name, handle, SchemaTypeLoaderException.WRONG_MAGIC_COOKIE);
+
+ _majorver = readShort();
+ _minorver = readShort();
+
+ if (_majorver != MAJOR_VERSION)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: Wrong major version - expecting " + MAJOR_VERSION + ", got " + _majorver, _name, handle, SchemaTypeLoaderException.WRONG_MAJOR_VERSION);
+
+ if (_minorver > MINOR_VERSION)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: Incompatible minor version - expecting up to " + MINOR_VERSION + ", got " + _minorver, _name, handle, SchemaTypeLoaderException.WRONG_MINOR_VERSION);
+
+ // Clip to 14 because we're not backward compatible with earlier
+ // minor versions. Remove this when upgrading to a new major
+ // version
+
+ if (_minorver < 14)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: Incompatible minor version - expecting at least 14, got " + _minorver, _name, handle, SchemaTypeLoaderException.WRONG_MINOR_VERSION);
+
+ if (atLeast(2, 18, 0))
+ _releaseno = readShort();
+
+ int actualfiletype = readShort();
+ if (actualfiletype != filetype && filetype != -1)
+ throw new SchemaTypeLoaderException("XML-BEANS compiled schema: File has the wrong type - expecting type " + filetype + ", got type " + actualfiletype, _name, handle, SchemaTypeLoaderException.WRONG_FILE_TYPE);
+
+ _stringPool = new StringPool(_handle, _name);
+ _stringPool.readFrom(_input);
+
+ _actualfiletype = actualfiletype;
+ }
+
+ protected boolean atLeast(int majorver, int minorver, int releaseno)
+ {
+ if (_majorver > majorver)
+ return true;
+ if (_majorver < majorver)
+ return false;
+ if (_minorver > minorver)
+ return true;
+ if (_minorver < minorver)
+ return false;
+ return (_releaseno >= releaseno);
+ }
+
+ protected boolean atMost(int majorver, int minorver, int releaseno)
+ {
+ if (_majorver > majorver)
+ return false;
+ if (_majorver < majorver)
+ return true;
+ if (_minorver > minorver)
+ return false;
+ if (_minorver < minorver)
+ return true;
+ return (_releaseno <= releaseno);
+ }
+
+ int getActualFiletype()
+ {
+ return _actualfiletype;
+ }
+
+ XsbReader(String handle)
+ {
+ _handle = handle;
+ _stringPool = new StringPool(_handle, _name);
+ }
+
+ void writeRealHeader(String handle, int filetype)
+ {
+ // hackeroo: if handle contains a "/" it's not relative.
+ String resourcename;
+
+ if (handle.indexOf('/') >= 0)
+ resourcename = handle + ".xsb";
+ else
+ resourcename = _basePackage + handle + ".xsb";
+
+ OutputStream rawoutput = getSaverStream(resourcename);
+ if (rawoutput == null)
+ throw new SchemaTypeLoaderException("Could not write compiled schema resource " + resourcename, _name, handle, SchemaTypeLoaderException.NOT_WRITEABLE);
+
+ _output = new DataOutputStream(rawoutput);
+ _handle = handle;
+
+ writeInt(DATA_BABE);
+ writeShort(MAJOR_VERSION);
+ writeShort(MINOR_VERSION);
+ writeShort(RELEASE_NUMBER);
+ writeShort(filetype);
+
+ _stringPool.writeTo(_output);
+ }
+
+ void readEnd()
+ {
+ try
+ {
+ if (_input != null)
+ _input.close();
+ }
+ catch (IOException e)
+ {
+ // oh, well.
+ }
+ _input = null;
+ _stringPool = null;
+ _handle = null;
+ }
+
+ void writeEnd()
+ {
+ try
+ {
+ if (_output != null)
+ {
+ _output.flush();
+ _output.close();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ _output = null;
+ _stringPool = null;
+ _handle = null;
+ }
+
+ int fileTypeFromComponentType(int componentType)
+ {
+ switch (componentType)
+ {
+ case SchemaComponent.TYPE:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMATYPE;
+ case SchemaComponent.ELEMENT:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMAELEMENT;
+ case SchemaComponent.ATTRIBUTE:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMAATTRIBUTE;
+ case SchemaComponent.MODEL_GROUP:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMAMODELGROUP;
+ case SchemaComponent.ATTRIBUTE_GROUP:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMAATTRIBUTEGROUP;
+ case SchemaComponent.IDENTITY_CONSTRAINT:
+ return SchemaTypeSystemImpl.FILETYPE_SCHEMAIDENTITYCONSTRAINT;
+ default:
+ throw new IllegalStateException("Unexpected component type");
+ }
+ }
+
+ void writeIndexData()
+ {
+ // has a handle pool (count, handle/type, handle/type...)
+ writeHandlePool(_localHandles);
+
+ // then a qname map of global elements (count, qname/handle, qname/handle...)
+ writeQNameMap(globalElements());
+
+ // qname map of global attributes
+ writeQNameMap(globalAttributes());
+
+ // qname map of model groups
+ writeQNameMap(modelGroups());
+
+ // qname map of attribute groups
+ writeQNameMap(attributeGroups());
+
+ // qname map of identity constraints
+ writeQNameMap(identityConstraints());
+
+ // qname map of global types
+ writeQNameMap(globalTypes());
+
+ // qname map of document types, by the qname of the contained element
+ writeDocumentTypeMap(documentTypes());
+
+ // qname map of attribute types, by the qname of the contained attribute
+ writeAttributeTypeMap(attributeTypes());
+
+ // all the types by classname
+ writeClassnameMap(_typeRefsByClassname);
+
+ // all the namespaces
+ writeNamespaces(_namespaces);
+
+ // VERSION 2.15 and newer below
+ writeQNameMap(redefinedGlobalTypes());
+ writeQNameMap(redefinedModelGroups());
+ writeQNameMap(redefinedAttributeGroups());
+ }
+
+ void writeHandlePool(HandlePool pool)
+ {
+ writeShort(pool._componentsToHandles.size());
+ for (Iterator i = pool._componentsToHandles.keySet().iterator(); i.hasNext(); )
+ {
+ SchemaComponent comp = (SchemaComponent)i.next();
+ String handle = (String)pool._componentsToHandles.get(comp);
+ int code = fileTypeFromComponentType(comp.getComponentType());
+ writeString(handle);
+ writeShort(code);
+ }
+ }
+
+ void readHandlePool(HandlePool pool)
+ {
+ if (pool._handlesToRefs.size() != 0 || pool._started)
+ throw new IllegalStateException("Nonempty handle set before read");
+
+ int size = readShort();
+ for (int i = 0; i < size; i++)
+ {
+ String handle = readString();
+ short code = readShort();
+ Object result;
+ switch (code)
+ {
+ case FILETYPE_SCHEMATYPE:
+ result = new SchemaType.Ref(getTypeSystem(), handle);
+ break;
+ case FILETYPE_SCHEMAELEMENT:
+ result = new SchemaGlobalElement.Ref(getTypeSystem(), handle);
+ break;
+ case FILETYPE_SCHEMAATTRIBUTE:
+ result = new SchemaGlobalAttribute.Ref(getTypeSystem(), handle);
+ break;
+ case FILETYPE_SCHEMAMODELGROUP:
+ result = new SchemaModelGroup.Ref(getTypeSystem(), handle);
+ break;
+ case FILETYPE_SCHEMAATTRIBUTEGROUP:
+ result = new SchemaAttributeGroup.Ref(getTypeSystem(), handle);
+ break;
+ case FILETYPE_SCHEMAIDENTITYCONSTRAINT:
+ result = new SchemaIdentityConstraint.Ref(getTypeSystem(), handle);
+ break;
+ default:
+ throw new SchemaTypeLoaderException("Schema index has an unrecognized entry of type " + code, _name, handle, SchemaTypeLoaderException.UNRECOGNIZED_INDEX_ENTRY);
+ }
+ pool._handlesToRefs.put(handle, result);
+ }
+ }
+
+ short readShort()
+ {
+ try
+ {
+ return _input.readShort();
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ void writeShort(int s)
+ {
+ if (s > Short.MAX_VALUE || s < Short.MIN_VALUE)
+ throw new SchemaTypeLoaderException("Value " + s + " out of range: must fit in a 16-bit short.", _name, _handle, SchemaTypeLoaderException.INT_TOO_LARGE);
+ if (_output != null)
+ {
+ try
+ {
+ _output.writeShort(s);
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+ }
+
+ int readInt()
+ {
+ try
+ {
+ return _input.readInt();
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ void writeInt(int i)
+ {
+ if (_output != null)
+ {
+ try
+ {
+ _output.writeInt(i);
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+ }
+
+ String readString()
+ {
+ return _stringPool.stringForCode(readShort());
+ }
+
+ void writeString(String str)
+ {
+ int code = _stringPool.codeForString(str);
+ writeShort(code);
+ }
+
+ QName readQName()
+ {
+ String namespace = readString();
+ String localname = readString();
+ if (localname == null)
+ return null;
+ return new QName(namespace, localname);
+ }
+
+ void writeQName(QName qname)
+ {
+ if (qname == null)
+ {
+ writeString(null);
+ writeString(null);
+ return;
+ }
+ writeString(qname.getNamespaceURI());
+ writeString(qname.getLocalPart());
+ }
+
+ SOAPArrayType readSOAPArrayType()
+ {
+ QName qName = readQName();
+ String dimensions = readString();
+ if (qName == null)
+ return null;
+ return new SOAPArrayType(qName, dimensions);
+ }
+
+ void writeSOAPArrayType(SOAPArrayType arrayType)
+ {
+ if (arrayType == null)
+ {
+ writeQName(null);
+ writeString(null);
+ }
+ else
+ {
+ writeQName(arrayType.getQName());
+ writeString(arrayType.soap11DimensionString());
+ }
+ }
+
+ SchemaComponent.Ref readHandle()
+ {
+ String handle = readString();
+ if (handle == null)
+ return null;
+
+ if (handle.charAt(0) != '_')
+ return _localHandles.refForHandle(handle);
+
+ switch (handle.charAt(2))
+ {
+ case 'I': // _BI_ - built-in schema type system
+ return ((SchemaType)BuiltinSchemaTypeSystem.get().resolveHandle(handle)).getRef();
+ case 'T': // _XT_ - external type
+ return _linker.findTypeRef(QNameHelper.forPretty(handle, 4));
+ case 'E': // _XE_ - external element
+ return _linker.findElementRef(QNameHelper.forPretty(handle, 4));
+ case 'A': // _XA_ - external attribute
+ return _linker.findAttributeRef(QNameHelper.forPretty(handle, 4));
+ case 'M': // _XM_ - external model group
+ return _linker.findModelGroupRef(QNameHelper.forPretty(handle, 4));
+ case 'N': // _XN_ - external attribute group
+ return _linker.findAttributeGroupRef(QNameHelper.forPretty(handle, 4));
+ case 'D': // _XD_ - external identity constraint
+ return _linker.findIdentityConstraintRef(QNameHelper.forPretty(handle, 4));
+ case 'R': // _XR_ - external ref to attribute's type
+ return _linker.findAttribute(QNameHelper.forPretty(handle, 4)).getType().getRef();
+ case 'S': // _XS_ - external ref to element's type
+ return _linker.findElement(QNameHelper.forPretty(handle, 4)).getType().getRef();
+ default:
+ throw new SchemaTypeLoaderException("Cannot resolve handle " + handle, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+ }
+ }
+
+ void writeHandle(SchemaComponent comp)
+ {
+ if (comp == null || comp.getTypeSystem() == getTypeSystem())
+ {
+ writeString(_localHandles.handleForComponent(comp));
+ return;
+ }
+
+ switch (comp.getComponentType())
+ {
+ case SchemaComponent.ATTRIBUTE:
+ writeString("_XA_" + QNameHelper.pretty(comp.getName()));
+ return;
+ case SchemaComponent.MODEL_GROUP:
+ writeString("_XM_" + QNameHelper.pretty(comp.getName()));
+ return;
+ case SchemaComponent.ATTRIBUTE_GROUP:
+ writeString("_XN_" + QNameHelper.pretty(comp.getName()));
+ return;
+ case SchemaComponent.ELEMENT:
+ writeString("_XE_" + QNameHelper.pretty(comp.getName()));
+ return;
+ case SchemaComponent.IDENTITY_CONSTRAINT:
+ writeString("_XD_" + QNameHelper.pretty(comp.getName()));
+ return;
+ case SchemaComponent.TYPE:
+ SchemaType type = (SchemaType)comp;
+ if (type.isBuiltinType())
+ {
+ writeString("_BI_" + type.getName().getLocalPart());
+ return;
+ }
+
+ // fix for CR120759 - added output of types _XR_ & _XS_
+ // when an attribute (_XR_) or element (_XS_) declaration
+ // uses ref to refer to an attribute or element in another
+ // schema and the type of that attribute or element
+ // is an anonymous (local) type
+ if (type.getName() != null)
+ {
+ writeString("_XT_" + QNameHelper.pretty(type.getName()));
+ }
+ else
+ {
+ SchemaField sf = type.getContainerField();
+ assert (sf != null);
+ if (sf.isAttribute())
+ {
+ writeString("_XR_" + QNameHelper.pretty(sf.getName()));
+ }
+ else
+ {
+ writeString("_XS_" + QNameHelper.pretty(sf.getName()));
+ }
+ }
+
+ return;
+
+ default:
+ assert(false);
+ throw new SchemaTypeLoaderException("Cannot write handle for component " + comp, _name, _handle, SchemaTypeLoaderException.BAD_HANDLE);
+ }
+ }
+
+ SchemaType.Ref readTypeRef()
+ {
+ return (SchemaType.Ref)readHandle();
+ }
+
+ void writeType(SchemaType type)
+ {
+ writeHandle(type);
+ }
+
+ Map readQNameRefMap()
+ {
+ Map result = new HashMap();
+ int size = readShort();
+ for (int i = 0; i < size; i++)
+ {
+ QName name = readQName();
+ SchemaComponent.Ref obj = readHandle();
+ result.put(name, obj);
+ }
+ return result;
+ }
+
+ void writeQNameMap(SchemaComponent[] components)
+ {
+ writeShort(components.length);
+ for (int i = 0; i < components.length; i++)
+ {
+ writeQName(components[i].getName());
+ writeHandle(components[i]);
+ }
+ }
+
+ void writeDocumentTypeMap(SchemaType[] doctypes)
+ {
+ writeShort(doctypes.length);
+ for (int i = 0; i < doctypes.length; i++)
+ {
+ writeQName(doctypes[i].getDocumentElementName());
+ writeHandle(doctypes[i]);
+ }
+ }
+
+ void writeAttributeTypeMap(SchemaType[] attrtypes)
+ {
+ writeShort(attrtypes.length);
+ for (int i = 0; i < attrtypes.length; i++)
+ {
+ writeQName(attrtypes[i].getAttributeTypeAttributeName());
+ writeHandle(attrtypes[i]);
+ }
+ }
+
+ SchemaType.Ref[] readTypeRefArray()
+ {
+ int size = readShort();
+ SchemaType.Ref[] result = new SchemaType.Ref[size];
+ for (int i = 0; i < size; i++)
+ {
+ result[i] = readTypeRef();
+ }
+ return result;
+ }
+
+ void writeTypeArray(SchemaType[] array)
+ {
+ writeShort(array.length);
+ for (int i = 0; i < array.length; i++)
+ {
+ writeHandle(array[i]);
+ }
+ }
+
+ Map readClassnameRefMap()
+ {
+ Map result = new HashMap();
+ int size = readShort();
+ for (int i = 0; i < size; i++)
+ {
+ String name = readString();
+ SchemaComponent.Ref obj = readHandle();
+ result.put(name, obj);
+ }
+ return result;
+ }
+
+ void writeClassnameMap(Map typesByClass)
+ {
+ writeShort(typesByClass.size());
+ for (Iterator i = typesByClass.keySet().iterator(); i.hasNext(); )
+ {
+ String className = (String)i.next();
+ writeString(className);
+ writeHandle(((SchemaType.Ref)typesByClass.get(className)).get());
+ }
+ }
+
+ Set readNamespaces()
+ {
+ Set result = new HashSet();
+ int size = readShort();
+ for (int i = 0; i < size; i++)
+ {
+ String ns = readString();
+ result.add(ns);
+ }
+ return result;
+ }
+
+ void writeNamespaces(Set namespaces)
+ {
+ writeShort(namespaces.size());
+ for (Iterator i = namespaces.iterator(); i.hasNext(); )
+ {
+ String ns = (String)i.next();
+ writeString(ns);
+ }
+ }
+
+ OutputStream getSaverStream(String name)
+ {
+ File targetFile = new File(_baseSaveDir, name);
+ try
+ {
+ targetFile.getParentFile().mkdirs();
+ return new FileOutputStream(targetFile);
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ InputStream getLoaderStream(String resourcename)
+ {
+ return _resourceLoader.getResourceAsStream(resourcename);
+ }
+
+ /**
+ * Finishes loading an element after the header has already been loaded.
+ */
+ public SchemaGlobalElement finishLoadingElement()
+ {
+ String handle = null;
+ try
+ {
+ SchemaGlobalElementImpl impl = new SchemaGlobalElementImpl(getTypeSystem());
+ short particleType = readShort();
+ if (particleType != SchemaParticle.ELEMENT)
+ throw new SchemaTypeLoaderException("Wrong particle type ", _name, _handle, SchemaTypeLoaderException.BAD_PARTICLE_TYPE);
+ loadParticle(impl, SchemaParticle.ELEMENT, true);
+ impl.setFilename(readString());
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ public SchemaGlobalAttribute finishLoadingAttribute()
+ {
+ SchemaGlobalAttributeImpl impl = new SchemaGlobalAttributeImpl(getTypeSystem());
+ try
+ {
+ loadAttribute(impl);
+ impl.setFilename(readString());
+
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, _handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ SchemaModelGroup finishLoadingModelGroup()
+ {
+ SchemaModelGroupImpl impl = new SchemaModelGroupImpl(getTypeSystem());
+
+ try
+ {
+ loadModelGroup(impl);
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, _handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ SchemaIdentityConstraint finishLoadingIdentityConstraint()
+ {
+ try {
+ SchemaIdentityConstraintImpl impl = new SchemaIdentityConstraintImpl(getTypeSystem());
+ impl.setName(readQName());
+ impl.setConstraintCategory(readShort());
+ impl.setSelector(readString());
+
+ String[] fields = new String[readShort()];
+ for (int i = 0 ; i < fields.length ; i++)
+ fields[i] = readString();
+ impl.setFields(fields);
+
+ if (impl.getConstraintCategory() == SchemaIdentityConstraint.CC_KEYREF)
+ impl.setReferencedKey((SchemaIdentityConstraint.Ref)readHandle());
+
+ int mapCount = readShort();
+ Map nsMappings = new HashMap();
+ for (int i = 0 ; i < mapCount ; i++)
+ {
+ String prefix = readString();
+ String uri = readString();
+ nsMappings.put(prefix, uri);
+ }
+ impl.setNSMap(nsMappings);
+
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, _handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ SchemaAttributeGroup finishLoadingAttributeGroup()
+ {
+ SchemaAttributeGroupImpl impl = new SchemaAttributeGroupImpl(getTypeSystem());
+
+ try
+ {
+ loadAttributeGroup(impl);
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, _handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ public SchemaType finishLoadingType()
+ {
+ try
+ {
+ SchemaTypeImpl impl = new SchemaTypeImpl(getTypeSystem(), true);
+ impl.setName(readQName());
+ impl.setOuterSchemaTypeRef(readTypeRef());
+ impl.setBaseDepth(readShort());
+ impl.setBaseTypeRef(readTypeRef());
+ impl.setDerivationType(readShort());
+
+ switch (readShort())
+ {
+ case FIELD_GLOBAL:
+ impl.setContainerFieldRef(readHandle());
+ break;
+ case FIELD_LOCALATTR:
+ impl.setContainerFieldIndex((short)1, readShort());
+ break;
+ case FIELD_LOCALELT:
+ impl.setContainerFieldIndex((short)2, readShort());
+ break;
+ }
+ impl.setFullJavaName(readString());
+ impl.setFullJavaImplName(readString());
+
+ impl.setAnonymousTypeRefs(readTypeRefArray());
+
+ impl.setAnonymousUnionMemberOrdinal(readShort());
+
+ int flags;
+ flags = readInt();
+
+
+ boolean isComplexType = ((flags & FLAG_SIMPLE_TYPE) == 0);
+ impl.setCompiled((flags & FLAG_COMPILED) != 0);
+ impl.setDocumentType((flags & FLAG_DOCUMENT_TYPE) != 0);
+ impl.setAttributeType((flags & FLAG_ATTRIBUTE_TYPE) != 0);
+ impl.setSimpleType(!isComplexType);
+
+ short complexVariety = SchemaType.NOT_COMPLEX_TYPE;
+ if (isComplexType)
+ {
+ impl.setAbstractFinal((flags & FLAG_ABSTRACT) != 0,
+ (flags & FLAG_FINAL_EXT) != 0,
+ (flags & FLAG_FINAL_REST) != 0,
+ (flags & FLAG_FINAL_LIST) != 0,
+ (flags & FLAG_FINAL_UNION) != 0);
+ impl.setBlock((flags & FLAG_BLOCK_EXT) != 0,
+ (flags & FLAG_BLOCK_REST) != 0);
+
+ impl.setOrderSensitive((flags & FLAG_ORDER_SENSITIVE) != 0);
+ complexVariety = readShort();
+ impl.setComplexTypeVariety(complexVariety);
+
+ // Attribute Model Table
+ SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl();
+
+ short attrCount = readShort();
+ for (int i = 0; i < attrCount; i++)
+ attrModel.addAttribute(readAttributeData());
+
+ attrModel.setWildcardSet(readQNameSet());
+ attrModel.setWildcardProcess(readShort());
+
+ // Attribute Property Table
+ Map attrProperties = new LinkedHashMap();
+ short attrPropCount = readShort();
+ for (int i = 0; i < attrPropCount; i++)
+ {
+ SchemaProperty prop = readPropertyData();
+ if (!prop.isAttribute())
+ throw new SchemaTypeLoaderException("Attribute property " + i + " is not an attribute", _name, _handle, SchemaTypeLoaderException.WRONG_PROPERTY_TYPE);
+ attrProperties.put(prop.getName(), prop);
+ }
+
+ SchemaParticle contentModel = null;
+ Map elemProperties = null;
+ short isAll = 0;
+
+ if (complexVariety == SchemaType.ELEMENT_CONTENT || complexVariety == SchemaType.MIXED_CONTENT)
+ {
+ // Content Model Tree
+ isAll = readShort();
+ SchemaParticle[] parts = readParticleArray();
+ if (parts.length == 1)
+ contentModel = parts[0];
+ else if (parts.length == 0)
+ contentModel = null;
+ else
+ throw new SchemaTypeLoaderException("Content model not well-formed", _name, _handle, SchemaTypeLoaderException.MALFORMED_CONTENT_MODEL);
+
+ // Element Property Table
+
+ elemProperties = new LinkedHashMap();
+ short elemPropCount = readShort();
+ for (int i = 0; i < elemPropCount; i++)
+ {
+ SchemaProperty prop = readPropertyData();
+ if (prop.isAttribute())
+ throw new SchemaTypeLoaderException("Element property " + i + " is not an element", _name, _handle, SchemaTypeLoaderException.WRONG_PROPERTY_TYPE);
+ elemProperties.put(prop.getName(), prop);
+ }
+ }
+
+ impl.setContentModel(contentModel, attrModel, elemProperties, attrProperties, isAll == 1);
+ StscComplexTypeResolver.WildcardResult wcElt = StscComplexTypeResolver.summarizeEltWildcards(contentModel);
+ StscComplexTypeResolver.WildcardResult wcAttr = StscComplexTypeResolver.summarizeAttrWildcards(attrModel);
+ impl.setWildcardSummary(wcElt.typedWildcards, wcElt.hasWildcards, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ }
+
+ if (!isComplexType || complexVariety == SchemaType.SIMPLE_CONTENT)
+ {
+ short simpleVariety = readShort();
+ impl.setSimpleTypeVariety(simpleVariety);
+
+ boolean isStringEnum = ((flags & FLAG_STRINGENUM) != 0);
+
+ impl.setOrdered((flags & FLAG_ORDERED) != 0 ? SchemaType.UNORDERED : ((flags & FLAG_TOTAL_ORDER) != 0 ? SchemaType.TOTAL_ORDER : SchemaType.PARTIAL_ORDER));
+ impl.setBounded((flags & FLAG_BOUNDED) != 0);
+ impl.setFinite((flags & FLAG_FINITE) != 0);
+ impl.setNumeric((flags & FLAG_NUMERIC) != 0);
+ impl.setUnionOfLists((flags & FLAG_UNION_OF_LISTS) != 0);
+ impl.setSimpleFinal((flags & FLAG_FINAL_REST) != 0,
+ (flags & FLAG_FINAL_LIST) != 0,
+ (flags & FLAG_FINAL_UNION) != 0);
+
+ XmlValueRef[] facets = new XmlValueRef[SchemaType.LAST_FACET + 1];
+ boolean[] fixedFacets = new boolean[SchemaType.LAST_FACET + 1];
+ short facetCount = readShort();
+ for (int i = 0; i < facetCount; i++)
+ {
+ short facetCode = readShort();
+ facets[facetCode] = readXmlValueObject();
+ fixedFacets[facetCode] = (readShort() == 1);
+ }
+ impl.setBasicFacets(facets, fixedFacets);
+
+ impl.setWhiteSpaceRule(readShort());
+
+ impl.setPatternFacet((flags & FLAG_HAS_PATTERN) != 0);
+
+ short patternCount = readShort();
+ org.apache.xmlbeans.impl.regex.RegularExpression[] patterns = new org.apache.xmlbeans.impl.regex.RegularExpression[patternCount];
+ for (int i = 0; i < patternCount; i++)
+ {
+ patterns[i] = new org.apache.xmlbeans.impl.regex.RegularExpression(readString(), "X");
+ }
+ impl.setPatterns(patterns);
+
+ short enumCount = readShort();
+ XmlValueRef[] enumValues = new XmlValueRef[enumCount];
+ for (int i = 0; i < enumCount; i++)
+ {
+ enumValues[i] = readXmlValueObject();
+ }
+ impl.setEnumerationValues(enumCount == 0 ? null : enumValues);
+
+ impl.setBaseEnumTypeRef(readTypeRef());
+ if (isStringEnum)
+ {
+ short seCount = readShort();
+ SchemaStringEnumEntry[] entries = new SchemaStringEnumEntry[seCount];
+ for (int i = 0; i < seCount; i++)
+ {
+ entries[i] = new SchemaStringEnumEntryImpl(readString(), readShort(), readString());
+ }
+ impl.setStringEnumEntries(entries);
+ }
+
+ switch (simpleVariety)
+ {
+ case SchemaType.ATOMIC:
+ impl.setPrimitiveTypeRef(readTypeRef());
+ impl.setDecimalSize(readInt());
+ break;
+
+ case SchemaType.LIST:
+ impl.setPrimitiveTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ impl.setListItemTypeRef(readTypeRef());
+ break;
+
+ case SchemaType.UNION:
+ impl.setPrimitiveTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ impl.setUnionMemberTypeRefs(readTypeRefArray());
+ break;
+
+ default:
+ throw new SchemaTypeLoaderException("Simple type does not have a recognized variety", _name, _handle, SchemaTypeLoaderException.WRONG_SIMPLE_VARIETY);
+ }
+ }
+
+ impl.setFilename(readString());
+
+ return impl;
+ }
+ catch (SchemaTypeLoaderException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new SchemaTypeLoaderException("Cannot load type from typesystem", _name, _handle, SchemaTypeLoaderException.NESTED_EXCEPTION, e);
+ }
+ finally
+ {
+ readEnd();
+ }
+ }
+
+ void writeTypeData(SchemaType type)
+ {
+ writeQName(type.getName());
+ writeType(type.getOuterType());
+ writeShort(((SchemaTypeImpl)type).getBaseDepth());
+ writeType(type.getBaseType());
+ writeShort(type.getDerivationType());
+ if (type.getContainerField() == null)
+ {
+ writeShort(FIELD_NONE);
+ }
+ else if (type.getOuterType().isAttributeType() || type.getOuterType().isDocumentType())
+ {
+ writeShort(FIELD_GLOBAL);
+ writeHandle((SchemaComponent)type.getContainerField());
+ }
+ else if (type.getContainerField().isAttribute())
+ {
+ writeShort(FIELD_LOCALATTR);
+ writeShort(((SchemaTypeImpl)type.getOuterType()).getIndexForLocalAttribute((SchemaLocalAttribute)type.getContainerField()));
+ }
+ else
+ {
+ writeShort(FIELD_LOCALELT);
+ writeShort(((SchemaTypeImpl)type.getOuterType()).getIndexForLocalElement((SchemaLocalElement)type.getContainerField()));
+ }
+ writeString(type.getFullJavaName());
+ writeString(type.getFullJavaImplName());
+ writeTypeArray(type.getAnonymousTypes());
+ writeShort(type.getAnonymousUnionMemberOrdinal());
+
+ int flags = 0;
+ if (type.isSimpleType())
+ flags |= FLAG_SIMPLE_TYPE;
+ if (type.isDocumentType())
+ flags |= FLAG_DOCUMENT_TYPE;
+ if (type.isAttributeType())
+ flags |= FLAG_ATTRIBUTE_TYPE;
+ if (type.ordered() != SchemaType.UNORDERED)
+ flags |= FLAG_ORDERED;
+ if (type.ordered() == SchemaType.TOTAL_ORDER)
+ flags |= FLAG_TOTAL_ORDER;
+ if (type.isBounded())
+ flags |= FLAG_BOUNDED;
+ if (type.isFinite())
+ flags |= FLAG_FINITE;
+ if (type.isNumeric())
+ flags |= FLAG_NUMERIC;
+ if (type.hasStringEnumValues())
+ flags |= FLAG_STRINGENUM;
+ if (((SchemaTypeImpl)type).isUnionOfLists())
+ flags |= FLAG_UNION_OF_LISTS;
+ if (type.hasPatternFacet())
+ flags |= FLAG_HAS_PATTERN;
+ if (type.isOrderSensitive())
+ flags |= FLAG_ORDER_SENSITIVE;
+
+ if (type.blockExtension())
+ flags |= FLAG_BLOCK_EXT;
+ if (type.blockRestriction())
+ flags |= FLAG_BLOCK_REST;
+ if (type.finalExtension())
+ flags |= FLAG_FINAL_EXT;
+ if (type.finalRestriction())
+ flags |= FLAG_FINAL_EXT;
+ if (type.finalList())
+ flags |= FLAG_FINAL_LIST;
+ if (type.finalUnion())
+ flags |= FLAG_FINAL_UNION;
+ if (type.isAbstract())
+ flags |= FLAG_ABSTRACT;
+
+ writeInt(flags);
+
+ if (!type.isSimpleType())
+ {
+ writeShort(type.getContentType());
+
+ // Attribute Model Table
+ SchemaAttributeModel attrModel = type.getAttributeModel();
+ SchemaLocalAttribute[] attrs = attrModel.getAttributes();
+
+ writeShort(attrs.length);
+ for (int i = 0; i < attrs.length; i++)
+ writeAttributeData(attrs[i]);
+
+ writeQNameSet(attrModel.getWildcardSet());
+ writeShort(attrModel.getWildcardProcess());
+
+ // Attribute Property Table
+ SchemaProperty[] attrProperties = type.getAttributeProperties();
+ writeShort(attrProperties.length);
+ for (int i = 0; i < attrProperties.length; i++)
+ writePropertyData(attrProperties[i]);
+
+ if (type.getContentType() == SchemaType.ELEMENT_CONTENT ||
+ type.getContentType() == SchemaType.MIXED_CONTENT)
+ {
+ // Content Model Tree
+ writeShort(type.hasAllContent() ? 1 : 0);
+ SchemaParticle[] parts;
+ if (type.getContentModel() != null)
+ parts = new SchemaParticle[] { type.getContentModel() };
+ else
+ parts = new SchemaParticle[0];
+
+ writeParticleArray(parts);
+
+ // Element Property Table
+ SchemaProperty[] eltProperties = type.getElementProperties();
+ writeShort(eltProperties.length);
+ for (int i = 0; i < eltProperties.length; i++)
+ writePropertyData(eltProperties[i]);
+ }
+ }
+
+ if (type.isSimpleType() || type.getContentType() == SchemaType.SIMPLE_CONTENT)
+ {
+ writeShort(type.getSimpleVariety());
+
+ int facetCount = 0;
+ for (int i = 0; i <= SchemaType.LAST_FACET; i++)
+ if (type.getFacet(i) != null)
+ facetCount++;
+ writeShort(facetCount);
+ for (int i = 0; i <= SchemaType.LAST_FACET; i++)
+ {
+ XmlAnySimpleType facet = type.getFacet(i);
+ if (facet != null)
+ {
+ writeShort(i);
+ writeXmlValueObject(facet);
+ writeShort(type.isFacetFixed(i) ? 1 : 0);
+ }
+ }
+
+ writeShort(type.getWhiteSpaceRule());
+
+ org.apache.xmlbeans.impl.regex.RegularExpression[] patterns = ((SchemaTypeImpl)type).getPatternExpressions();
+ writeShort(patterns.length);
+ for (int i = 0; i < patterns.length; i++)
+ writeString(patterns[i].getPattern());
+
+ XmlAnySimpleType[] enumValues = type.getEnumerationValues();
+ if (enumValues == null)
+ writeShort(0);
+ else
+ {
+ writeShort(enumValues.length);
+ for (int i = 0; i < enumValues.length; i++)
+ writeXmlValueObject(enumValues[i]);
+ }
+
+ // new for version 2.3
+ writeType(type.getBaseEnumType());
+ if (type.hasStringEnumValues())
+ {
+ SchemaStringEnumEntry[] entries = type.getStringEnumEntries();
+ writeShort(entries.length);
+ for (int i = 0; i < entries.length; i++)
+ {
+ writeString(entries[i].getString());
+ writeShort(entries[i].getIntValue());
+ writeString(entries[i].getEnumName());
+ }
+ }
+
+ switch (type.getSimpleVariety())
+ {
+ case SchemaType.ATOMIC:
+ writeType(type.getPrimitiveType());
+ writeInt(type.getDecimalSize());
+ break;
+
+ case SchemaType.LIST:
+ writeType(type.getListItemType());
+ break;
+
+ case SchemaType.UNION:
+ writeTypeArray(type.getUnionMemberTypes());
+ break;
+ }
+ }
+
+ writeString(type.getSourceName());
+ }
+
+ void readExtensionsList()
+ {
+ int count = readShort();
+ assert count == 0;
+
+ for (int i = 0; i < count; i++)
+ {
+ readString();
+ readString();
+ readString();
+ }
+ }
+
+ SchemaLocalAttribute readAttributeData()
+ {
+ SchemaLocalAttributeImpl result = new SchemaLocalAttributeImpl();
+ loadAttribute(result);
+ return result;
+ }
+
+ void loadModelGroup(SchemaModelGroupImpl result)
+ {
+ try
+ {
+ result.init(readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, GroupDocument.Factory.parse( readString() ).getGroup());
+ }
+ catch ( XmlException e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ void loadAttributeGroup(SchemaAttributeGroupImpl result)
+ {
+ try
+ {
+ result.init( readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, AttributeGroupDocument.Factory.parse( readString() ).getAttributeGroup());
+ }
+ catch ( XmlException e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ void loadAttribute(SchemaLocalAttributeImpl result)
+ {
+ // name, type, use, deftext, defval, fixed, soaparraytype
+ result.init(readQName(), readTypeRef(), readShort(), readString(), null, atLeast(2, 16, 0) ? readXmlValueObject() : null, readShort() == 1, readSOAPArrayType());
+ }
+
+ void writeAttributeData(SchemaLocalAttribute attr)
+ {
+ writeQName(attr.getName());
+ writeType(attr.getType());
+ writeShort(attr.getUse());
+ writeString(attr.getDefaultText());
+ writeXmlValueObject(attr.getDefaultValue());
+ writeShort(attr.isFixed() ? 1 : 0);
+ writeSOAPArrayType(((SchemaWSDLArrayType)attr).getWSDLArrayType());
+ }
+
+ void writeIdConstraintData(SchemaIdentityConstraint idc)
+ {
+ writeQName(idc.getName());
+ writeShort(idc.getConstraintCategory());
+ writeString(idc.getSelector());
+
+ String[] fields = idc.getFields();
+ writeShort(fields.length);
+ for (int i = 0 ; i < fields.length ; i++)
+ writeString(fields[i]);
+
+
+ if (idc.getConstraintCategory() == SchemaIdentityConstraint.CC_KEYREF)
+ writeHandle(idc.getReferencedKey());
+
+ Set mappings = idc.getNSMap().entrySet();
+ writeShort(mappings.size());
+ for (Iterator it = mappings.iterator() ; it.hasNext() ; ) {
+ Map.Entry e = (Map.Entry)it.next();
+ String prefix = (String)e.getKey();
+ String uri = (String)e.getValue();
+
+ writeString(prefix);
+ writeString(uri);
+ }
+
+ }
+
+ SchemaParticle[] readParticleArray()
+ {
+ SchemaParticle[] result = new SchemaParticle[readShort()];
+ for (int i = 0; i < result.length; i++)
+ result[i] = readParticleData();
+ return result;
+ }
+
+ void writeParticleArray(SchemaParticle[] spa)
+ {
+ writeShort(spa.length);
+ for (int i = 0; i < spa.length; i++)
+ writeParticleData(spa[i]);
+ }
+
+ SchemaParticle readParticleData()
+ {
+ short particleType = readShort();
+ SchemaParticleImpl result;
+ if (particleType != SchemaParticle.ELEMENT)
+ result = new SchemaParticleImpl();
+ else
+ result = new SchemaLocalElementImpl();
+ loadParticle(result, particleType, false);
+ return result;
+ }
+
+ void loadParticle(SchemaParticleImpl result, int particleType, boolean global)
+ {
+ short particleFlags = readShort();
+
+ result.setParticleType(particleType);
+ result.setMinOccurs(readBigInteger());
+ result.setMaxOccurs(readBigInteger());
+
+ result.setTransitionRules(readQNameSet(),
+ (particleFlags & FLAG_PART_SKIPPABLE) != 0);
+
+ switch (particleType)
+ {
+ case SchemaParticle.WILDCARD:
+ result.setWildcardSet(readQNameSet());
+ result.setWildcardProcess(readShort());
+ break;
+
+ case SchemaParticle.ELEMENT:
+ SchemaLocalElementImpl lresult = (SchemaLocalElementImpl)result;
+ lresult.setNameAndTypeRef(readQName(), readTypeRef());
+ lresult.setDefault(readString(), (particleFlags & FLAG_PART_FIXED) != 0, null);
+ if (atLeast(2, 16, 0))
+ lresult.setDefaultValue(readXmlValueObject());
+ lresult.setNillable((particleFlags & FLAG_PART_NILLABLE) != 0);
+ lresult.setBlock((particleFlags & FLAG_PART_BLOCKEXT) != 0,
+ (particleFlags & FLAG_PART_BLOCKREST) != 0,
+ (particleFlags & FLAG_PART_BLOCKSUBST) != 0);
+ lresult.setWsdlArrayType(readSOAPArrayType());
+ lresult.setAbstract((particleFlags & FLAG_PART_ABSTRACT) != 0);
+ if (global)
+ {
+ SchemaGlobalElementImpl gresult = (SchemaGlobalElementImpl)lresult;
+ gresult.setFinal(
+ (particleFlags & FLAG_PART_FINALEXT) != 0,
+ (particleFlags & FLAG_PART_FINALREST) != 0);
+
+ if (atLeast(2, 17, 0))
+ gresult.setSubstitutionGroup((SchemaGlobalElement.Ref)readHandle());
+
+ short substGroupCount = readShort();
+ for (int i = 0; i < substGroupCount; i++)
+ {
+ gresult.addSubstitutionGroupMember(readQName());
+ }
+ }
+
+ SchemaIdentityConstraint.Ref[] idcs = new SchemaIdentityConstraint.Ref[readShort()];
+
+ for (int i = 0 ; i < idcs.length ; i++)
+ idcs[i] = (SchemaIdentityConstraint.Ref)readHandle();
+
+ lresult.setIdentityConstraints(idcs);
+
+ break;
+
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ result.setParticleChildren(readParticleArray());
+ break;
+
+ default:
+ throw new SchemaTypeLoaderException("Unrecognized particle type ", _name, _handle, SchemaTypeLoaderException.BAD_PARTICLE_TYPE);
+ }
+ }
+
+ void writeParticleData(SchemaParticle part)
+ {
+ writeShort(part.getParticleType());
+ short flags = 0;
+ if (part.isSkippable())
+ flags |= FLAG_PART_SKIPPABLE;
+ if (part.getParticleType() == SchemaParticle.ELEMENT)
+ {
+ SchemaLocalElement lpart = (SchemaLocalElement)part;
+ if (lpart.isFixed())
+ flags |= FLAG_PART_FIXED;
+ if (lpart.isNillable())
+ flags |= FLAG_PART_NILLABLE;
+ if (lpart.blockExtension())
+ flags |= FLAG_PART_BLOCKEXT;
+ if (lpart.blockRestriction())
+ flags |= FLAG_PART_BLOCKREST;
+ if (lpart.blockSubstitution())
+ flags |= FLAG_PART_BLOCKSUBST;
+ if (lpart.isAbstract())
+ flags |= FLAG_PART_ABSTRACT;
+
+ if (lpart instanceof SchemaGlobalElement)
+ {
+ SchemaGlobalElement gpart = (SchemaGlobalElement)lpart;
+ if (gpart.finalExtension())
+ flags |= FLAG_PART_FINALEXT;
+ if (gpart.finalRestriction())
+ flags |= FLAG_PART_FINALREST;
+ }
+ }
+ writeShort(flags);
+ writeBigInteger(part.getMinOccurs());
+ writeBigInteger(part.getMaxOccurs());
+ writeQNameSet(part.acceptedStartNames());
+
+ switch (part.getParticleType())
+ {
+ case SchemaParticle.WILDCARD:
+ writeQNameSet(part.getWildcardSet());
+ writeShort(part.getWildcardProcess());
+ break;
+
+ case SchemaParticle.ELEMENT:
+ SchemaLocalElement lpart = (SchemaLocalElement)part;
+ writeQName(lpart.getName());
+ writeType(lpart.getType());
+ writeString(lpart.getDefaultText());
+ writeXmlValueObject(lpart.getDefaultValue());
+ writeSOAPArrayType(((SchemaWSDLArrayType)lpart).getWSDLArrayType());
+ if (lpart instanceof SchemaGlobalElement)
+ {
+ SchemaGlobalElement gpart = (SchemaGlobalElement)lpart;
+
+ writeHandle(gpart.substitutionGroup());
+
+ QName[] substGroupMembers = gpart.substitutionGroupMembers();
+ writeShort(substGroupMembers.length);
+ for (int i = 0; i < substGroupMembers.length; i++)
+ writeQName(substGroupMembers[i]);
+ }
+
+ SchemaIdentityConstraint[] idcs = lpart.getIdentityConstraints();
+
+ writeShort(idcs.length);
+ for (int i = 0 ; i < idcs.length ; i++)
+ writeHandle(idcs[i]);
+
+ break;
+
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ writeParticleArray(part.getParticleChildren());
+ break;
+
+ default:
+ throw new SchemaTypeLoaderException("Unrecognized particle type ", _name, _handle, SchemaTypeLoaderException.BAD_PARTICLE_TYPE);
+ }
+ }
+
+ SchemaProperty readPropertyData()
+ {
+ SchemaPropertyImpl prop = new SchemaPropertyImpl();
+ prop.setName(readQName());
+ prop.setTypeRef(readTypeRef());
+ short propflags = readShort();
+ prop.setAttribute((propflags & FLAG_PROP_ISATTR) != 0);
+ prop.setContainerTypeRef(readTypeRef());
+ prop.setMinOccurs(readBigInteger());
+ prop.setMaxOccurs(readBigInteger());
+ prop.setNillable(readShort());
+ prop.setDefault(readShort());
+ prop.setFixed(readShort());
+ prop.setDefaultText(readString());
+
+ prop.setJavaPropertyName(readString());
+ prop.setJavaTypeCode(readShort());
+ prop.setExtendsJava(readTypeRef(),
+ (propflags & FLAG_PROP_JAVASINGLETON) != 0,
+ (propflags & FLAG_PROP_JAVAOPTIONAL) != 0,
+ (propflags & FLAG_PROP_JAVAARRAY) != 0);
+ prop.setJavaSetterDelimiter(readQNameSet());
+ if (atLeast(2, 16, 0))
+ prop.setDefaultValue(readXmlValueObject());
+
+ if (!prop.isAttribute() && atLeast(2, 17, 0))
+ {
+ short size = readShort();
+ LinkedHashSet qnames = new LinkedHashSet(size);
+ for (int i = 0 ; i < size ; i++)
+ qnames.add(readQName());
+ prop.setAcceptedNames(qnames);
+ }
+ prop.setImmutable();
+ return prop;
+ }
+
+ void writePropertyData(SchemaProperty prop)
+ {
+ writeQName(prop.getName());
+ writeType(prop.getType());
+ writeShort((prop.isAttribute() ? FLAG_PROP_ISATTR : 0) |
+ (prop.extendsJavaSingleton() ? FLAG_PROP_JAVASINGLETON : 0) |
+ (prop.extendsJavaOption() ? FLAG_PROP_JAVAOPTIONAL : 0) |
+ (prop.extendsJavaArray() ? FLAG_PROP_JAVAARRAY : 0));
+ writeType(prop.getContainerType());
+ writeBigInteger(prop.getMinOccurs());
+ writeBigInteger(prop.getMaxOccurs());
+ writeShort(prop.hasNillable());
+ writeShort(prop.hasDefault());
+ writeShort(prop.hasFixed());
+ writeString(prop.getDefaultText());
+
+ writeString(prop.getJavaPropertyName());
+ writeShort(prop.getJavaTypeCode());
+ writeType(prop.javaBasedOnType());
+ writeQNameSet(prop.getJavaSetterDelimiter());
+ writeXmlValueObject(prop.getDefaultValue());
+
+ if (! prop.isAttribute())
+ {
+ QName[] names = prop.acceptedNames();
+ writeShort(names.length);
+ for (int i = 0 ; i < names.length ; i++)
+ writeQName(names[i]);
+ }
+ }
+
+ void writeModelGroupData(SchemaModelGroup grp)
+ {
+ SchemaModelGroupImpl impl = (SchemaModelGroupImpl)grp;
+ writeQName(impl.getName());
+ writeString(impl.getTargetNamespace());
+ writeShort(impl.getChameleonNamespace() != null ? 1 : 0);
+ writeShort(impl.isRedefinition() ? 1 : 0); // new for version 2.15
+ writeString(impl.getParseObject().xmlText(new XmlOptions().setSaveOuter()));
+ }
+
+ void writeAttributeGroupData(SchemaAttributeGroup grp)
+ {
+ SchemaAttributeGroupImpl impl = (SchemaAttributeGroupImpl)grp;
+ writeQName(impl.getName());
+ writeString(impl.getTargetNamespace());
+ writeShort(impl.getChameleonNamespace() != null ? 1 : 0);
+ writeShort(impl.isRedefinition() ? 1 : 0); // new for version 2.15
+ writeString(impl.getParseObject().xmlText(new XmlOptions().setSaveOuter()));
+ }
+
+ XmlValueRef readXmlValueObject()
+ {
+ SchemaType.Ref typeref = readTypeRef();
+ if (typeref == null)
+ return null;
+ int btc = readShort();
+ switch (btc)
+ {
+ default:
+ assert(false);
+ case 0:
+ return new XmlValueRef(typeref, null);
+ case -1:
+ {
+ int size = readShort();
+ List values = new ArrayList();
+ writeShort(values.size());
+ for (int i = 0; i < size; i++)
+ {
+ values.add(readXmlValueObject());
+ }
+ return new XmlValueRef(typeref, values);
+ }
+
+
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_BOOLEAN:
+ return new XmlValueRef(typeref, readString());
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ return new XmlValueRef(typeref, readByteArray());
+
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ return new XmlValueRef(typeref, readQName());
+
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ return new XmlValueRef(typeref, new Double(readDouble()));
+ }
+ }
+
+ void writeXmlValueObject(XmlAnySimpleType value)
+ {
+ SchemaType type = value == null ? null : value.schemaType();
+ writeType(type);
+ if (type == null)
+ return;
+
+ SchemaType iType = ((SimpleValue)value).instanceType();
+ if (iType == null)
+ {
+ writeShort(0);
+ }
+ else if (iType.getSimpleVariety() == SchemaType.LIST)
+ {
+ writeShort(-1);
+ List values = ((XmlObjectBase)value).xgetListValue();
+ writeShort(values.size());
+ for (Iterator i = values.iterator(); i.hasNext(); )
+ {
+ writeXmlValueObject((XmlAnySimpleType)i.next());
+ }
+ }
+ else
+ {
+ int btc = iType.getPrimitiveType().getBuiltinTypeCode();
+ writeShort(btc);
+ switch (btc)
+ {
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_BOOLEAN:
+ writeString(value.getStringValue());
+ break;
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ writeByteArray(((SimpleValue)value).getByteArrayValue());
+ break;
+
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ writeQName(((SimpleValue)value).getQNameValue());
+ break;
+
+ case SchemaType.BTC_FLOAT:
+ writeDouble(((SimpleValue)value).getFloatValue());
+ break;
+
+ case SchemaType.BTC_DOUBLE:
+ writeDouble(((SimpleValue)value).getDoubleValue());
+ break;
+ }
+ }
+ }
+
+ double readDouble()
+ {
+ try
+ {
+ return _input.readDouble();
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ void writeDouble(double d)
+ {
+ if (_output != null)
+ {
+ try
+ {
+ _output.writeDouble(d);
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+ }
+
+ QNameSet readQNameSet()
+ {
+ short flag = readShort();
+
+ Set uriSet = new HashSet();
+ short uriCount = readShort();
+ for (int i = 0; i < uriCount; i++)
+ uriSet.add(readString());
+
+ Set qnameSet1 = new HashSet();
+ short qncount1 = readShort();
+ for (int i = 0; i < qncount1; i++)
+ qnameSet1.add(readQName());
+
+ Set qnameSet2 = new HashSet();
+ short qncount2 = readShort();
+ for (int i = 0; i < qncount2; i++)
+ qnameSet2.add(readQName());
+
+ if (flag == 1)
+ return QNameSet.forSets(uriSet, null, qnameSet1, qnameSet2);
+ else
+ return QNameSet.forSets(null, uriSet, qnameSet2, qnameSet1);
+ }
+
+ void writeQNameSet(QNameSet set)
+ {
+ boolean invert = (set.excludedURIs() != null);
+ writeShort(invert ? 1 : 0);
+
+ Set uriSet = invert ? set.excludedURIs() : set.includedURIs();
+ writeShort(uriSet.size());
+ for (Iterator i = uriSet.iterator(); i.hasNext(); )
+ writeString((String)i.next());
+
+ Set qnameSet1 = invert ? set.excludedQNamesInIncludedURIs() : set.includedQNamesInExcludedURIs();
+ writeShort(qnameSet1.size());
+ for (Iterator i = qnameSet1.iterator(); i.hasNext(); )
+ writeQName((QName)i.next());
+
+ Set qnameSet2 = invert ? set.includedQNamesInExcludedURIs() : set.excludedQNamesInIncludedURIs();
+ writeShort(qnameSet2.size());
+ for (Iterator i = qnameSet2.iterator(); i.hasNext(); )
+ writeQName((QName)i.next());
+ }
+
+ byte[] readByteArray()
+ {
+ try
+ {
+ short len = _input.readShort();
+ byte[] result = new byte[len];
+ _input.readFully(result);
+ return result;
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ void writeByteArray(byte[] ba)
+ {
+ try
+ {
+ writeShort(ba.length);
+ if (_output != null)
+ _output.write(ba);
+ }
+ catch (IOException e)
+ {
+ throw new SchemaTypeLoaderException(e.getMessage(), _name, _handle, SchemaTypeLoaderException.IO_EXCEPTION);
+ }
+ }
+
+ BigInteger readBigInteger()
+ {
+ byte[] result = readByteArray();
+ if (result.length == 0)
+ return null;
+ if (result.length == 1 && result[0] == 0)
+ return BigInteger.ZERO;
+ if (result.length == 1 && result[0] == 1)
+ return BigInteger.ONE;
+ return new BigInteger(result);
+ }
+
+ void writeBigInteger(BigInteger bi)
+ {
+ if (bi == null)
+ {
+ writeShort(0);
+ }
+ else if (bi.signum() == 0)
+ {
+ writeByteArray(SINGLE_ZERO_BYTE);
+ }
+ else
+ {
+ writeByteArray(bi.toByteArray());
+ }
+ }
+
+ }
+
+ static final byte[] SINGLE_ZERO_BYTE = new byte[] { (byte)0 };
+
+ public SchemaType typeForHandle(String handle)
+ {
+ synchronized (_resolvedHandles)
+ {
+ return (SchemaType)_resolvedHandles.get(handle);
+ }
+ }
+
+ public SchemaType typeForClassname(String classname)
+ {
+ SchemaType.Ref ref = (SchemaType.Ref)_typeRefsByClassname.get(classname);
+ return (ref != null) ? ref.get() : null;
+ }
+
+ public SchemaComponent resolveHandle(String handle)
+ {
+ SchemaComponent result;
+
+ synchronized (_resolvedHandles)
+ {
+ result = (SchemaComponent)_resolvedHandles.get(handle);
+ }
+ if (result == null)
+ {
+ XsbReader reader = new XsbReader(handle, -1);
+ int filetype = reader.getActualFiletype();
+ switch (filetype)
+ {
+ case FILETYPE_SCHEMATYPE:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving type for handle " + handle, 0);
+ result = reader.finishLoadingType();
+ break;
+ case FILETYPE_SCHEMAELEMENT:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving element for handle " + handle, 0);
+ result = reader.finishLoadingElement();
+ break;
+ case FILETYPE_SCHEMAATTRIBUTE:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving attribute for handle " + handle, 0);
+ result = reader.finishLoadingAttribute();
+ break;
+ case FILETYPE_SCHEMAMODELGROUP:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving model group for handle " + handle, 0);
+ result = reader.finishLoadingModelGroup();
+ break;
+ case FILETYPE_SCHEMAATTRIBUTEGROUP:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving attribute group for handle " + handle, 0);
+ result = reader.finishLoadingAttributeGroup();
+ break;
+ case FILETYPE_SCHEMAIDENTITYCONSTRAINT:
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving id constraint for handle " + handle, 0);
+ result = reader.finishLoadingIdentityConstraint();
+ break;
+ default:
+ throw new IllegalStateException("Illegal handle type");
+ }
+
+ synchronized (_resolvedHandles)
+ {
+ if (!_resolvedHandles.containsKey(handle))
+ _resolvedHandles.put(handle, result);
+ else
+ result = (SchemaComponent)_resolvedHandles.get(handle);
+ }
+ }
+ return result;
+ }
+
+ private final Map _resolvedHandles = new HashMap();
+ private boolean _allNonGroupHandlesResolved = false;
+
+ public void resolve()
+ {
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolve called type system " + _name, 0);
+ if (_allNonGroupHandlesResolved)
+ return;
+
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Resolving all handles for type system " + _name, 1);
+
+ List refs = new ArrayList();
+ refs.addAll(_globalElements.values());
+ refs.addAll(_globalAttributes.values());
+ refs.addAll(_globalTypes.values());
+ refs.addAll(_documentTypes.values());
+ refs.addAll(_attributeTypes.values());
+ refs.addAll(_identityConstraints.values());
+
+ for (Iterator i = refs.iterator(); i.hasNext(); )
+ {
+ SchemaComponent.Ref ref = (SchemaComponent.Ref)i.next();
+ ref.getComponent(); // Forces ref to be resolved
+ }
+
+ XBeanDebug.trace(XBeanDebug.TRACE_SCHEMA_LOADING, "Finished resolving type system " + _name, -1);
+ _allNonGroupHandlesResolved = true;
+ }
+
+
+ public boolean isNamespaceDefined(String namespace)
+ {
+ return _namespaces.contains(namespace);
+ }
+
+ public SchemaType.Ref findTypeRef(QName name)
+ {
+ return (SchemaType.Ref)_globalTypes.get(name);
+ }
+
+ public SchemaType.Ref findDocumentTypeRef(QName name)
+ {
+ return (SchemaType.Ref)_documentTypes.get(name);
+ }
+
+ public SchemaType.Ref findAttributeTypeRef(QName name)
+ {
+ return (SchemaType.Ref)_attributeTypes.get(name);
+ }
+
+ public SchemaGlobalElement.Ref findElementRef(QName name)
+ {
+ return (SchemaGlobalElement.Ref)_globalElements.get(name);
+ }
+
+ public SchemaGlobalAttribute.Ref findAttributeRef(QName name)
+ {
+ return (SchemaGlobalAttribute.Ref)_globalAttributes.get(name);
+ }
+
+ public SchemaModelGroup.Ref findModelGroupRef(QName name)
+ {
+ return (SchemaModelGroup.Ref)_modelGroups.get(name);
+ }
+
+ public SchemaAttributeGroup.Ref findAttributeGroupRef(QName name)
+ {
+ return (SchemaAttributeGroup.Ref)_attributeGroups.get(name);
+ }
+
+ public SchemaIdentityConstraint.Ref findIdentityConstraintRef(QName name)
+ {
+ return (SchemaIdentityConstraint.Ref)_identityConstraints.get(name);
+ }
+
+ public SchemaType[] globalTypes()
+ {
+ if (_globalTypes.isEmpty())
+ return EMPTY_ST_ARRAY;
+
+ SchemaType[] result = new SchemaType[_globalTypes.size()];
+ int j = 0;
+ for (Iterator i = _globalTypes.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaType[] redefinedGlobalTypes()
+ {
+ if (_redefinedGlobalTypes.isEmpty())
+ return EMPTY_ST_ARRAY;
+
+ SchemaType[] result = new SchemaType[_redefinedGlobalTypes.size()];
+ int j = 0;
+ for (Iterator i = _redefinedGlobalTypes.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType.Ref)i.next()).get();
+ return result;
+ }
+
+ public InputStream getSourceAsStream(String sourceName)
+ {
+ if (!sourceName.startsWith("/"))
+ sourceName = "/" + sourceName;
+
+ return _resourceLoader.getResourceAsStream("schema/src" + sourceName);
+ }
+
+ public SchemaType[] documentTypes()
+ {
+ if (_documentTypes.isEmpty())
+ return EMPTY_ST_ARRAY;
+
+ SchemaType[] result = new SchemaType[_documentTypes.size()];
+ int j = 0;
+ for (Iterator i = _documentTypes.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaType[] attributeTypes()
+ {
+ if (_attributeTypes.isEmpty())
+ return EMPTY_ST_ARRAY;
+
+ SchemaType[] result = new SchemaType[_attributeTypes.size()];
+ int j = 0;
+ for (Iterator i = _attributeTypes.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaGlobalElement[] globalElements()
+ {
+ if (_globalElements.isEmpty())
+ return EMPTY_GE_ARRAY;
+
+ SchemaGlobalElement[] result = new SchemaGlobalElement[_globalElements.size()];
+ int j = 0;
+ for (Iterator i = _globalElements.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaGlobalElement.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaGlobalAttribute[] globalAttributes()
+ {
+ if (_globalAttributes.isEmpty())
+ return EMPTY_GA_ARRAY;
+
+ SchemaGlobalAttribute[] result = new SchemaGlobalAttribute[_globalAttributes.size()];
+ int j = 0;
+ for (Iterator i = _globalAttributes.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaGlobalAttribute.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaModelGroup[] modelGroups()
+ {
+ if (_modelGroups.isEmpty())
+ return EMPTY_MG_ARRAY;
+
+ SchemaModelGroup[] result = new SchemaModelGroup[_modelGroups.size()];
+ int j = 0;
+ for (Iterator i = _modelGroups.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaModelGroup.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaModelGroup[] redefinedModelGroups()
+ {
+ if (_redefinedModelGroups.isEmpty())
+ return EMPTY_MG_ARRAY;
+
+ SchemaModelGroup[] result = new SchemaModelGroup[_redefinedModelGroups.size()];
+ int j = 0;
+ for (Iterator i = _redefinedModelGroups.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaModelGroup.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaAttributeGroup[] attributeGroups()
+ {
+ if (_attributeGroups.isEmpty())
+ return EMPTY_AG_ARRAY;
+
+ SchemaAttributeGroup[] result = new SchemaAttributeGroup[_attributeGroups.size()];
+ int j = 0;
+ for (Iterator i = _attributeGroups.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaAttributeGroup.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaAttributeGroup[] redefinedAttributeGroups()
+ {
+ if (_redefinedAttributeGroups.isEmpty())
+ return EMPTY_AG_ARRAY;
+
+ SchemaAttributeGroup[] result = new SchemaAttributeGroup[_redefinedAttributeGroups.size()];
+ int j = 0;
+ for (Iterator i = _redefinedAttributeGroups.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaAttributeGroup.Ref)i.next()).get();
+ return result;
+ }
+
+ public SchemaIdentityConstraint[] identityConstraints()
+ {
+ if (_identityConstraints.isEmpty())
+ return EMPTY_IC_ARRAY;
+
+ SchemaIdentityConstraint[] result = new SchemaIdentityConstraint[_identityConstraints.size()];
+ int j = 0;
+ for (Iterator i = _identityConstraints.values().iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaIdentityConstraint.Ref)i.next()).get();
+ return result;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return _classloader;
+ }
+
+ /**
+ * Used INTERNALLY ONLY by the code generator AFTER the type system has
+ * been saved and a handle has been established for each type.
+ */
+ public String handleForType(SchemaType type)
+ {
+ return _localHandles.handleForType(type);
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ public SchemaTypeSystem typeSystemForName(String name)
+ {
+ if (_name != null && name.equals(_name))
+ return this;
+ return null;
+ }
+}
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeVisitorImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeVisitorImpl.java
new file mode 100644
index 0000000..8c0a433
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeVisitorImpl.java
@@ -0,0 +1,510 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.impl.values.TypeStoreVisitor;
+import org.apache.xmlbeans.impl.values.TypeStore;
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.SchemaField;
+
+import java.util.Arrays;
+
+/**
+ * This state machine validates element order based on a deterministic
+ * content model.
+ */
+public class SchemaTypeVisitorImpl implements TypeStoreVisitor
+{
+ /**
+ * Construct it by passing the root of the content model.
+ */
+ public SchemaTypeVisitorImpl(SchemaParticle part)
+ {
+ init(part);
+ }
+
+ public SchemaTypeVisitorImpl()
+ {
+
+ }
+
+ public void init(SchemaParticle part)
+ {
+ if (_stack == null)
+ {
+ _stack = expand(null);
+ }
+ if (_rollback == null)
+ {
+ _rollback = expand(null);
+ }
+
+ _stackSize = 0;
+ _rollbackSize = 0;
+
+ if (part != null)
+ {
+ push(part);
+ _rollbackIndex = 1;
+ }
+ }
+
+ public VisitorState[] expand(VisitorState[] orig)
+ {
+ int newsize = (orig == null ? 4 : orig.length * 2);
+ VisitorState[] result = new VisitorState[newsize];
+ if (orig != null)
+ System.arraycopy(orig, 0, result, 0, orig.length);
+ for (int i = (orig == null ? 0 : orig.length); i < newsize; i++)
+ {
+ result[i] = new VisitorState();
+ }
+ return result;
+ }
+
+
+ final static boolean PROBE_VALIDITY = true;
+ final static boolean CHECK_VALIDITY = false;
+
+ private VisitorState[] _stack;
+ private VisitorState[] _rollback;
+ int _stackSize;
+ int _rollbackSize;
+ private boolean _isValid;
+ private SchemaParticle _matchedParticle;
+ private VisitorState _top;
+ private int _rollbackIndex;
+
+ private static class VisitorState
+ {
+ public void copy(VisitorState orig)
+ {
+ _curPart = orig._curPart;
+ _curCount = orig._curCount;
+ _curMin = orig._curMin;
+ _curMax = orig._curMax;
+ _processedChildCount = orig._processedChildCount;
+ _childCount = orig._childCount;
+ _seen = orig._seen;
+ }
+
+ public void init(SchemaParticle part)
+ {
+ _curPart = part;
+ _curMin = part.getIntMinOccurs();
+ _curMax = part.getIntMaxOccurs();
+ _curCount = 0;
+ _processedChildCount = 0;
+ _childCount = part.countOfParticleChild();
+ _seen = part.getParticleType() == SchemaParticle.ALL ?
+ new boolean[_childCount] : null;
+ }
+
+ SchemaParticle _curPart;
+ int _curCount;
+ int _curMax;
+ int _curMin;
+ int _processedChildCount;
+ int _childCount;
+ boolean[] _seen;
+ }
+
+ VisitorState topRef()
+ {
+ return _stack[_stackSize - 1];
+ }
+
+ void saveCopy(VisitorState ref)
+ {
+ if (_rollback.length == _rollbackSize)
+ _rollback = expand(_rollback);
+
+ _rollback[_rollbackSize].copy(ref);
+ _rollbackSize += 1;
+ }
+
+ void addParticle(SchemaParticle part)
+ {
+ if (_stack.length == _stackSize)
+ _stack = expand(_stack);
+ _stack[_stackSize].init(part);
+ _stackSize += 1;
+ }
+
+ /**
+ * Precondition:
+ * stack: (R1 R2 R3 R4)
+ * top: null or discardable due to pop in progress
+ * rollback: (R8 R7 R6 R5) (empty at the start of "visit")
+ *
+ * Postcondition:
+ * stack: (R1 R2 R3)
+ * top: D4 = mutable copy of R4
+ * rollback (R8 R7 R6 R5 R4)
+ */
+ boolean prepare()
+ {
+ if (_rollbackIndex == 0)
+ {
+ _top = null;
+ return false;
+ }
+
+ _top = topRef();
+ saveCopy(_top);
+ _rollbackIndex = _stackSize - 1;
+ return true;
+ }
+
+ /**
+ * Precondition:
+ * stack: (R1 R2 R3 R4 D5 D6)
+ * top: D7
+ * rollback: (R8 R7 R6 R5)
+ *
+ * Postcondition:
+ * stack: (R1 R2 R3 R4 D5 D6 D7)
+ * top: D8 = new state based on part
+ * rollback (R8 R7 R6 R5)
+ */
+ void push(SchemaParticle part)
+ {
+ addParticle(part);
+ _top = topRef();
+ }
+
+ /**
+ * Precondition:
+ * stack: (R1 R2 R3 R4 D5 D6)
+ * top: D7 is discardable
+ * rollback: (R8 R7 R6 R5)
+ *
+ * Postcondition:
+ * stack: (R1 R2 R3 R4 D5)
+ * top: D6 (see prepare in case it's an R state)
+ * rollback (R8 R7 R6 R5)
+ */
+ boolean pop()
+ {
+ _stackSize -= 1;
+ if (_stackSize <= _rollbackIndex)
+ return prepare();
+ _top = topRef();
+ return true;
+ }
+
+ /**
+ * Precondition:
+ * stack: (R1 R2 R3 R4 D5 D6)
+ * top: D7
+ * rollback: (R8 R7 R6 R5)
+ *
+ * Postcondition:
+ * stack: (R1 R2 R3 R4 D5 D6 D7) -> and rename to D's to R's
+ * top: null
+ * rollback ()
+ */
+ void commit()
+ {
+ _top = null;
+ _rollbackIndex = _stackSize;
+ _rollbackSize = 0;
+ }
+
+ /**
+ * Precondition:
+ * stack: (R1 R2 R3 R4 D5 D6)
+ * top: D7 is discardable
+ * rollback: (R8 R7 R6 R5)
+ *
+ * Postcondition:
+ * stack: (R1 R2 R3 R4 R5 R6 R7 R8)
+ * top: null
+ * rollback ()
+ */
+ void rollback()
+ {
+ while (_rollbackSize > 0)
+ {
+ _rollbackSize -= 1;
+ VisitorState temp = _stack[_rollbackIndex];
+ _stack[_rollbackIndex] = _rollback[_rollbackSize];
+ _rollback[_rollbackSize] = temp;
+ _rollbackIndex += 1;
+ }
+ _stackSize = _rollbackIndex;
+ _top = null;
+ }
+
+ /**
+ * When no valid next state can be found, then "notValid"
+ * is returned. It rolls back any changes to the state
+ * machine stack, sets to false the valid bit, and clears
+ * the matched element state before returning false.
+ */
+ boolean notValid()
+ {
+ _isValid = false;
+ _matchedParticle = null;
+ rollback();
+ return false;
+ }
+
+ /**
+ * When a valid state transition has been done, then "ok"
+ * is returned. It commits the changed state machine state,
+ * stores the matched element state, and returns true.
+ */
+ boolean ok(SchemaParticle part, boolean testValidity)
+ {
+ if ( ! testValidity )
+ {
+ _matchedParticle = part;
+ commit();
+ }
+ else
+ {
+ rollback();
+ }
+ return true;
+ }
+
+ /*== VISITOR IMPLEMENTATION ==*/
+
+ /**
+ * Traverses a deterministic content model, checking for
+ * validity at any given point.
+ *
+ * Call visit(null) once at the end if you're checking for
+ * complete validity of the sequence of elements.
+ *
+ * This is a wrapper for the actual visit implementation.
+ */
+ public boolean visit(QName eltName)
+ {
+ return visit(eltName, CHECK_VALIDITY);
+ }
+
+ /**
+ * The actual implementation that
+ * traverses a deterministic content model, checking for
+ * validity at any given point.
+ *
+ * When testValidity is false then this method will change states
+ * if the current state is valid
+ *
+ * When testValidity is true then this method will not change states
+ * and will return if a particular state is valid or invalid
+ */
+
+ public boolean visit(QName eltName ,boolean testValidity)
+ {
+ if (!prepare())
+ return notValid();
+
+ // init with some values out of processedChildCount and stackSize range
+ int lastAtProcessedChildCount = -2;
+ int lastAtStackSize = -2;
+
+ traversing: for (;;)
+ {
+ // optimization for cases where state doesn't change between _top._curMin and _top._curMax
+ // check for state change see JIRA bug XMLBEANS-37
+ if (_top._curCount>_top._curMin &&
+ lastAtProcessedChildCount==_top._processedChildCount &&
+ lastAtStackSize==_stackSize)
+ {
+ _top._curCount = _top._curMax;
+ }
+
+ // save state
+ lastAtProcessedChildCount = _top._processedChildCount;
+ lastAtStackSize = _stackSize;
+
+ while (_top._curCount >= _top._curMax)
+ {
+ if (!pop())
+ break traversing;
+ }
+
+ minmax: switch (_top._curPart.getParticleType())
+ {
+ default:
+ assert(false);
+
+ case SchemaParticle.WILDCARD:
+ if (!_top._curPart.canStartWithElement(eltName))
+ {
+ if (_top._curCount < _top._curMin)
+ return notValid();
+ break minmax;
+ }
+ _top._curCount++;
+ return ok(_top._curPart, testValidity);
+
+ case SchemaParticle.ELEMENT:
+ if (!_top._curPart.canStartWithElement(eltName))
+ {
+ if (_top._curCount < _top._curMin)
+ return notValid();
+ break minmax;
+ }
+ _top._curCount++;
+ return ok(_top._curPart, testValidity);
+
+ case SchemaParticle.SEQUENCE:
+ for (int i = _top._processedChildCount; i < _top._childCount; i++)
+ {
+ SchemaParticle candidate = _top._curPart.getParticleChild(i);
+ if (candidate.canStartWithElement(eltName))
+ {
+ _top._processedChildCount = i + 1;
+ push(candidate);
+ continue traversing;
+ }
+ if (!candidate.isSkippable())
+ {
+ if (_top._processedChildCount != 0 || _top._curCount < _top._curMin)
+ return notValid();
+ break minmax;
+ }
+ }
+ _top._curCount++;
+ _top._processedChildCount = 0;
+
+ continue traversing;
+
+
+ case SchemaParticle.CHOICE:
+ for (int i = 0; i < _top._childCount; i++)
+ {
+ SchemaParticle candidate = _top._curPart.getParticleChild(i);
+ if (candidate.canStartWithElement(eltName))
+ {
+ _top._curCount++;
+ push(candidate);
+ continue traversing;
+ }
+ }
+ if (_top._curCount < _top._curMin && !_top._curPart.isSkippable())
+ return notValid();
+ break minmax;
+
+ case SchemaParticle.ALL:
+
+ int skipped = _top._processedChildCount;
+ allscan: for (int i = 0; i < _top._childCount; i++)
+ {
+ if (_top._seen[i])
+ continue allscan;
+
+ SchemaParticle candidate = _top._curPart.getParticleChild(i);
+ if (candidate.canStartWithElement(eltName))
+ {
+ _top._processedChildCount++;
+ _top._seen[i] = true;
+ push(candidate);
+ continue traversing;
+ }
+ else if (candidate.isSkippable())
+ {
+ skipped += 1;
+ }
+ }
+ if (skipped < _top._childCount)
+ {
+ if (_top._curCount < _top._curMin)
+ return notValid();
+ break minmax;
+ }
+ _top._curCount++;
+ _top._processedChildCount = 0;
+ Arrays.fill(_top._seen, false);
+ continue traversing;
+ }
+
+ // somebody called "break minmax", so pop out of loop
+ if (!pop())
+ break traversing;
+ }
+
+ // we've completed the outermost loop
+ if (eltName == null)
+ return ok(null, testValidity);
+
+ // this means we have extra elements at the end
+ return notValid();
+ }
+
+ public boolean testValid(QName eltName)
+ {
+ return visit(eltName,PROBE_VALIDITY);
+ }
+
+ /**
+ * Constructs elementflags
+ */
+ public int get_elementflags()
+ {
+ if (currentParticle() == null || currentParticle().getParticleType() != SchemaParticle.ELEMENT)
+ return 0;
+
+ SchemaLocalElement elt = (SchemaLocalElement)currentParticle();
+
+ return (elt.isNillable() ? TypeStore.NILLABLE : 0) |
+ (elt.isDefault() ? TypeStore.HASDEFAULT : 0) |
+ (elt.isFixed() ? TypeStore.FIXED : 0);
+ }
+
+ /**
+ * Returns default text
+ */
+ public String get_default_text()
+ {
+ if (currentParticle() == null || currentParticle().getParticleType() != SchemaParticle.ELEMENT)
+ return null;
+
+ return ((SchemaLocalElement)currentParticle()).getDefaultText();
+ }
+
+ /**
+ * Returns the schema field for this field.
+ */
+ public SchemaField get_schema_field() {
+ if (currentParticle() instanceof SchemaField)
+ return (SchemaField)currentParticle();
+
+ return null;
+ }
+
+ /**
+ * Returns the current schema element
+ */
+ public SchemaParticle currentParticle()
+ {
+ return _matchedParticle;
+ }
+
+ /**
+ * Returns true if the entire content up to now is valid.
+ */
+ public boolean isAllValid()
+ {
+ return _isValid;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java
new file mode 100644
index 0000000..b7ee780
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java
@@ -0,0 +1,1595 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.XmlID;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlString;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.impl.common.XBeanDebug;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.math.BigInteger;
+
+public class StscChecker
+{
+ public static void checkAll()
+ {
+ // walk the tree of types
+ StscState state = StscState.get();
+
+ List allSeenTypes = new ArrayList();
+ allSeenTypes.addAll(Arrays.asList(state.documentTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.attributeTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.redefinedGlobalTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.globalTypes()));
+
+ for (int i = 0; i < allSeenTypes.size(); i++)
+ {
+ SchemaType gType = (SchemaType)allSeenTypes.get(i);
+ if (!state.noPvr() && // option to turn off particle restriction checking
+ !gType.isDocumentType()) // Don't check doc types for restriction.
+ {
+ checkRestriction((SchemaTypeImpl)gType);
+ }
+ checkFields((SchemaTypeImpl)gType);
+ allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes()));
+ }
+
+ checkSubstitutionGroups(state.globalElements());
+ }
+
+ /**
+ * The following code checks rule #5 of http://www.w3.org/TR/xmlschema-1/#coss-ct
+ * as well as attribute + element default/fixed validity.
+ */
+ public static void checkFields(SchemaTypeImpl sType)
+ {
+ if (sType.isSimpleType())
+ return;
+
+ XmlObject location = sType.getParseObject();
+
+ SchemaAttributeModel sAttrModel = sType.getAttributeModel();
+ if (sAttrModel != null)
+ {
+ SchemaLocalAttribute[] sAttrs = sAttrModel.getAttributes();
+ QName idAttr = null;
+ for (int i = 0; i < sAttrs.length; i++)
+ {
+ if (XmlID.type.isAssignableFrom(sAttrs[i].getType()))
+ {
+ if (idAttr == null)
+ idAttr = sAttrs[i].getName();
+ else
+ StscState.get().error("Both " + QNameHelper.pretty(idAttr) + " and " + sAttrs[i].getName() + " are xs:ID attributes; only one ID attribute is allowed on a type.", XmlErrorContext.GENERIC_ERROR, location);
+ if (sAttrs[i].getDefaultText() != null)
+ StscState.get().error("An attribute of type xs:ID is not allowed to have a default or fixed constraint.", XmlErrorContext.GENERIC_ERROR, location);
+ }
+ else
+ {
+ String valueConstraint = sAttrs[i].getDefaultText();
+ if (valueConstraint != null)
+ {
+ try
+ {
+ XmlAnySimpleType val = sAttrs[i].getDefaultValue();
+ if (!val.validate())
+ throw new Exception();
+
+ SchemaPropertyImpl sProp = (SchemaPropertyImpl)sType.getAttributeProperty(sAttrs[i].getName());
+ if (sProp != null && sProp.getDefaultText() != null)
+ {
+ sProp.setDefaultValue(new XmlValueRef(val));
+ }
+ }
+ catch (Exception e)
+ {
+ if (sAttrs[i].isFixed())
+ StscState.get().error("The " + QNameHelper.pretty(sAttrs[i].getName()) + " element fixed value '" + valueConstraint + "' is not a valid value for " + QNameHelper.readable(sAttrs[i].getType()), XmlErrorContext.GENERIC_ERROR, location);
+ else
+ StscState.get().error("The " + QNameHelper.pretty(sAttrs[i].getName()) + " element default value '" + valueConstraint + "' is not a valid value for " + QNameHelper.readable(sAttrs[i].getType()), XmlErrorContext.GENERIC_ERROR, location);
+ }
+ }
+ }
+ }
+ }
+
+ checkElementDefaults(sType.getContentModel(), location, sType);
+ }
+
+ private static void checkElementDefaults(SchemaParticle model, XmlObject location, SchemaType parentType)
+ {
+ if (model == null)
+ return;
+ switch (model.getParticleType())
+ {
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.ALL:
+ SchemaParticle[] children = model.getParticleChildren();
+ for (int i = 0; i < children.length; i++)
+ {
+ checkElementDefaults(children[i], location, parentType);
+ }
+ break;
+ case SchemaParticle.ELEMENT:
+ String valueConstraint = model.getDefaultText();
+ if (valueConstraint != null)
+ {
+ if (model.getType().isSimpleType() || model.getType().getContentType() == SchemaType.SIMPLE_CONTENT)
+ {
+ try
+ {
+ XmlAnySimpleType val = model.getDefaultValue();
+ if (!val.validate())
+ throw new Exception();
+
+ SchemaPropertyImpl sProp = (SchemaPropertyImpl)parentType.getElementProperty(model.getName());
+ if (sProp != null && sProp.getDefaultText() != null)
+ {
+ sProp.setDefaultValue(new XmlValueRef(val));
+ }
+ }
+ catch (Exception e)
+ {
+ if (model.isFixed())
+ StscState.get().error("The " + QNameHelper.pretty(model.getName()) + " element fixed value '" + valueConstraint + "' is not a valid value for " + QNameHelper.readable(model.getType()), XmlErrorContext.GENERIC_ERROR, location);
+ else
+ StscState.get().error("The " + QNameHelper.pretty(model.getName()) + " element default value '" + valueConstraint + "' is not a valid value for " + QNameHelper.readable(model.getType()), XmlErrorContext.GENERIC_ERROR, location);
+ }
+ }
+ else if (model.getType().getContentType() == SchemaType.MIXED_CONTENT)
+ {
+ if (!model.getType().getContentModel().isSkippable())
+ {
+ String constraintName = (model.isFixed() ? "fixed" : "default");
+
+ StscState.get().error("The " + QNameHelper.pretty(model.getName()) + " element cannot have a " +
+ constraintName + " value '" + valueConstraint + "' because it's content is mixed " +
+ "but not emptiable.", XmlErrorContext.GENERIC_ERROR, location);
+ }
+ else
+ {
+ // Element Default Valid (Immediate): cos-valid-default.2.2.2
+ // no need to validate the value; type is a xs:string
+ SchemaPropertyImpl sProp = (SchemaPropertyImpl)parentType.getElementProperty(model.getName());
+ if (sProp != null && sProp.getDefaultText() != null)
+ {
+ sProp.setDefaultValue(new XmlValueRef(XmlString.type.newValue(valueConstraint)));
+ }
+ }
+ }
+ else if (model.getType().getContentType() == SchemaType.ELEMENT_CONTENT)
+ {
+ StscState.get().error("The " + QNameHelper.pretty(model.getName()) + " element cannot have a default value '" + valueConstraint + "' because its type has element content only.", XmlErrorContext.GENERIC_ERROR, location);
+ }
+ else if (model.getType().getContentType() == SchemaType.EMPTY_CONTENT)
+ {
+ StscState.get().error("The " + QNameHelper.pretty(model.getName()) + " element cannot have a default value '" + valueConstraint + "' because its type has empty content only.", XmlErrorContext.GENERIC_ERROR, location);
+ }
+ }
+ break;
+
+ default:
+ // nothing to do.
+ break;
+ }
+ }
+
+ /**
+ * The following code only checks rule #5 of http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
+ * (Everything else can and should be done in StscResolver, because we can give more detailed line # info there
+ */
+ public static boolean checkRestriction(SchemaTypeImpl sType)
+ {
+ if (sType.getDerivationType() == SchemaType.DT_RESTRICTION && !sType.isSimpleType())
+ {
+ StscState state = StscState.get();
+
+ // we don't remember very precise line number information, but it's better than nothin.
+ XmlObject location = sType.getParseObject();
+
+ SchemaType baseType = sType.getBaseType();
+ if (baseType.isSimpleType())
+ {
+ state.error("The base type of a complex type restriction must be a complex type.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+
+ // 5 The appropriate case among the following must be true:
+ switch (sType.getContentType())
+ {
+ case SchemaType.SIMPLE_CONTENT:
+ // 5.1 If the {content type} of the complex type definition is a simple type definition, then one of the following must be true:
+ switch (baseType.getContentType())
+ {
+ case SchemaType.SIMPLE_CONTENT:
+ // 5.1.1 The {content type} of the {base type definition} must be a simple type definition of which the {content type} is a ·valid restriction· as defined in Derivation Valid (Restriction, Simple) (§3.14.6).
+ // todo: we don't allow the content type to be an "on the side" simple type, so nothing fancy to check here
+ break;
+
+ case SchemaType.MIXED_CONTENT:
+ // 5.1.2 The {base type definition} must be mixed and have a particle which is ·emptiable· as defined in Particle Emptiable (§3.9.6).
+ if (baseType.getContentModel() != null && !baseType.getContentModel().isSkippable())
+ {
+ state.error("A type with a simple content model can only restrict a mixed content model that has skippable elements.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+ break;
+
+ default:
+ state.error("A type with a simple content model can only restrict a simple or mixed content model.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+ break;
+
+ case SchemaType.EMPTY_CONTENT:
+ // 5.2 If the {content type} of the complex type itself is empty , then one of the following must be true:
+ switch (baseType.getContentType())
+ {
+ case SchemaType.EMPTY_CONTENT:
+ // 5.2.1 The {content type} of the {base type definition} must also be empty.
+ break;
+ case SchemaType.MIXED_CONTENT:
+ case SchemaType.ELEMENT_CONTENT:
+ // 5.2.2 The {content type} of the {base type definition} must be elementOnly or mixed and have a particle which is ·emptiable· as defined in Particle Emptiable (§3.9.6).
+ if (baseType.getContentModel() != null && !baseType.getContentModel().isSkippable())
+ {
+ state.error("A type with an empty content model can only restrict a content model that has skippable elements.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+ break;
+ default:
+ state.error("A type with an empty content model cannot restrict a type with a simple content model.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+ break;
+
+ case SchemaType.MIXED_CONTENT:
+ // 5.3 If the {content type} of the {base type definition} is mixed...
+ if (baseType.getContentType() != SchemaType.MIXED_CONTENT)
+ {
+ state.error("A type with a mixed content model can only restrict another type with a mixed content model.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+
+ // FALLTHROUGH
+ case SchemaType.ELEMENT_CONTENT:
+ // 5.3 ... or the {content type} of the complex type definition itself is element-only,...
+ if (baseType.getContentType() == SchemaType.EMPTY_CONTENT)
+ {
+ state.error("A type with element or mixed content cannot restrict an empty type.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+ if (baseType.getContentType() == SchemaType.SIMPLE_CONTENT)
+ {
+ state.error("A type with element or mixed content cannot restrict a simple type.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+
+ // 5.3 ... then the particle of the complex type definition itself must be a ·valid restriction· of the particle of the {content type} of the {base type definition}
+ SchemaParticle baseModel = baseType.getContentModel();
+ SchemaParticle derivedModel = sType.getContentModel();
+ assert(baseModel != null && derivedModel != null);
+ if (baseModel == null || derivedModel == null)
+ {
+ XBeanDebug.logStackTrace("Null models that weren't caught by EMPTY_CONTENT: " + baseType + " (" + baseModel + "), " + sType + " (" + derivedModel + ")");
+ state.error("Illegal restriction.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ return false;
+ }
+
+ // 5.3 ... as defined in Particle Valid (Restriction) (§3.9.6).
+ List errors = new ArrayList();
+ boolean isValid = isParticleValidRestriction(baseModel, derivedModel, errors, location);
+ if (!isValid)
+ {
+ // we only add the last error, because isParticleValidRestriction may add errors
+ // to the collection that it later changes its mind about, or it may (inadvertently)
+ // forget to describe an error into the collection....
+ if (errors.size() == 0)
+ state.error("Invalid restriction.", XmlErrorContext.ILLEGAL_RESTRICTION, location);
+ else
+ state.getErrorListener().add(errors.get(errors.size() - 1));
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This function takes in two schema particle types, a baseModel, and a derived model and returns true if the
+ * derivedModel can be egitimately be used for restriction. Errors are put into the errors collections.
+ * @param baseModel - The base schema particle
+ * @param derivedModel - The derived (restricted) schema particle
+ * @param errors - Invalid restriction errors are put into this collection
+ * @param context
+ * @return boolean, true if valid restruction, false if invalid restriction
+ * @
+ */
+ public static boolean isParticleValidRestriction(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ boolean restrictionValid = false;
+ // 1 They are the same particle.
+ if (baseModel.equals(derivedModel)) {
+ restrictionValid = true;
+ } else {
+ // Implement table defined in schema spec on restrictions at:
+ // http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict
+ switch (baseModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ restrictionValid = nameAndTypeOK((SchemaLocalElement) baseModel, (SchemaLocalElement) derivedModel, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.ALL:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.CHOICE:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.SEQUENCE:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Derived Type");
+ }
+ break;
+ case SchemaParticle.WILDCARD:
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ restrictionValid = nsCompat(baseModel, (SchemaLocalElement) derivedModel, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ restrictionValid = nsSubset(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.ALL:
+ restrictionValid = nsRecurseCheckCardinality(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.CHOICE:
+ restrictionValid = nsRecurseCheckCardinality(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.SEQUENCE:
+ restrictionValid = nsRecurseCheckCardinality(baseModel, derivedModel, errors, context);
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Derived Type");
+ }
+ break;
+ case SchemaParticle.ALL:
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ restrictionValid = recurseAsIfGroup(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.ALL:
+ restrictionValid = recurse(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.CHOICE:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.SEQUENCE:
+ restrictionValid = recurseUnordered(baseModel, derivedModel, errors, context);
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Derived Type");
+ }
+ break;
+ case SchemaParticle.CHOICE:
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ restrictionValid = recurseAsIfGroup(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.ALL:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.CHOICE:
+ restrictionValid = recurseLax(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.SEQUENCE:
+ restrictionValid = mapAndSum(baseModel, derivedModel, errors, context);
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Derived Type");
+ }
+ break;
+ case SchemaParticle.SEQUENCE:
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ restrictionValid = recurseAsIfGroup(baseModel, derivedModel, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.ALL:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.CHOICE:
+ errors.add(XmlError.forObject(formatInvalidCombinationError(baseModel, derivedModel), context));
+ restrictionValid = false;
+ break;
+ case SchemaParticle.SEQUENCE:
+ restrictionValid = recurse(baseModel, derivedModel, errors, context);
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Derived Type");
+ }
+ break;
+ default:
+ assert false : XBeanDebug.logStackTrace("Unknown schema type for Base Type");
+
+ }
+ }
+
+ return restrictionValid;
+ }
+
+ private static boolean mapAndSum(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // mapAndSum is call if base: CHOICE, derived: SEQUENCE
+ assert baseModel.getParticleType() == SchemaParticle.CHOICE;
+ assert derivedModel.getParticleType() == SchemaParticle.SEQUENCE;
+ boolean mapAndSumValid = true;
+ // Schema Component Constraint: Particle Derivation OK (Sequence:Choice -- MapAndSum)
+ // For a sequence group particle to be a ·valid restriction· of a choice group particle all of the following
+ // must be true:
+ // 1 There is a complete functional mapping from the particles in the {particles} of R to the particles in the
+ // {particles} of B such that each particle in the {particles} of R is a ·valid restriction· of the particle in
+ // the {particles} of B it maps to as defined by Particle Valid (Restriction) (§3.9.6).
+ // interpretation: each particle child in derived should have a match in base.
+ // 2 The pair consisting of the product of the {min occurs} of R and the length of its {particles} and unbounded
+ // if {max occurs} is unbounded otherwise the product of the {max occurs} of R and the length of its {particles}
+ // is a valid restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6).
+ // NOTE: This clause is in principle more restrictive than absolutely necessary, but in practice will cover
+ // all the likely cases, and is much easier to specify than the fully general version.
+ // NOTE: This case allows the "unfolding" of iterated disjunctions into sequences. It may be particularly useful
+ // when the disjunction is an implicit one arising from the use of substitution groups.
+
+ // Map step - for each member of the derived model's particle children search base model's particle children
+ // for match
+ SchemaParticle[] derivedParticleArray = derivedModel.getParticleChildren();
+ SchemaParticle[] baseParticleArray = baseModel.getParticleChildren();
+ for (int i = 0; i < derivedParticleArray.length; i++) {
+ SchemaParticle derivedParticle = derivedParticleArray[i];
+ boolean foundMatch = false;
+ for (int j = 0; j < baseParticleArray.length; j++) {
+ SchemaParticle baseParticle = baseParticleArray[j];
+ // recurse to check if there is a match
+ if (isParticleValidRestriction(baseParticle, derivedParticle, errors, context)) {
+ // if there is a match then no need to check base particles anymore
+ foundMatch = true;
+ break;
+ }
+ }
+ if (!foundMatch) {
+ mapAndSumValid = false;
+ errors.add(XmlError.forObject(formatMappingError(), context));
+ break;
+ }
+ }
+
+ // Sum step
+ BigInteger derivedRangeMin = derivedModel.getMinOccurs().multiply(BigInteger.valueOf(derivedModel.getParticleChildren().length));
+ BigInteger derivedRangeMax = null;
+ BigInteger UNBOUNDED = null;
+ if (derivedModel.getMaxOccurs() == UNBOUNDED) {
+ derivedRangeMax = null;
+ } else {
+ derivedRangeMax = derivedModel.getMaxOccurs().multiply(BigInteger.valueOf(derivedModel.getParticleChildren().length));
+ }
+
+ // Now check derivedRange (derivedRangeMin and derivedRangeMax) against base model occurrence range
+ // Schema Component Constraint: Occurrence Range OK
+ // For a particle's occurrence range to be a valid restriction of another's occurrence range all of the following must be true:
+ // 1 Its {min occurs} is greater than or equal to the other's {min occurs}.
+ // 2 one of the following must be true:
+ // 2.1 The other's {max occurs} is unbounded.
+ // 2.2 Both {max occurs} are numbers, and the particle's is less than or equal to the other's.
+
+ if (derivedRangeMin.compareTo(baseModel.getMinOccurs()) < 0) {
+ mapAndSumValid = false;
+ errors.add(XmlError.forObject(formatOccurenceRangeMinErrorChoiceSequence(derivedRangeMin, baseModel), context));
+ } else if (baseModel.getMaxOccurs() == UNBOUNDED || derivedRangeMax != UNBOUNDED && derivedRangeMax.compareTo(baseModel.getMaxOccurs()) > 0) {
+ mapAndSumValid = false;
+ errors.add(XmlError.forObject(formatOccurenceRangeMaxErrorChoiceSequence(derivedRangeMax, baseModel), context));
+ }
+
+ return mapAndSumValid;
+ }
+
+ private static String formatOccurenceRangeMinErrorChoiceSequence(BigInteger derivedRangeMin, SchemaParticle baseModel) {
+ return "Invalid Restriction. The total minOccurs for the derived <sequence>'s elements: "
+ + derivedRangeMin.toString()
+ + "must not be less than the base <choice>'s minOccurs ("
+ + baseModel.getMinOccurs().toString() + ")";
+ }
+
+ private static String formatOccurenceRangeMaxErrorChoiceSequence(BigInteger derivedRangeMax, SchemaParticle baseModel) {
+ return "Invalid Restriction. The total maxOccurs for the derived <sequence>'s elements ("
+ + derivedRangeMax.toString()
+ + ") must not be greater than the base <choice>'s maxOccurs ("
+ + printMaxOccurs(baseModel.getMaxOccurs()) + ")";
+
+ }
+
+ private static String formatMappingError() {
+ return "Invalid Restriction. At least one restricted type does not match.";
+ }
+
+ private static boolean recurseAsIfGroup(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // recurseAsIfGroup is called if:
+ // base: ALL, derived: ELEMENT
+ // base: CHOICE, derived: ELEMENT
+ // base: SEQUENCE, derived: ELEMENT
+ assert (baseModel.getParticleType() == SchemaParticle.ALL && derivedModel.getParticleType() == SchemaParticle.ELEMENT)
+ || (baseModel.getParticleType() == SchemaParticle.CHOICE && derivedModel.getParticleType() == SchemaParticle.ELEMENT)
+ || (baseModel.getParticleType() == SchemaParticle.SEQUENCE && derivedModel.getParticleType() == SchemaParticle.ELEMENT);
+ // Schema Component Constraint: Particle Derivation OK (Elt:All/Choice/Sequence -- RecurseAsIfGroup)
+
+ // For an element declaration particle to be a ·valid restriction· of a group particle
+ // (all, choice or sequence) a group particle of the variety corresponding to B's, with {min occurs} and
+ // {max occurs} of 1 and with {particles} consisting of a single particle the same as the element declaration
+ // must be a ·valid restriction· of the group as defined by Particle Derivation OK
+ // (All:All,Sequence:Sequence -- Recurse) (§3.9.6), Particle Derivation OK (Choice:Choice -- RecurseLax)
+ // (§3.9.6) or Particle Derivation OK (All:All,Sequence:Sequence -- Recurse) (§3.9.6), depending on whether
+ // the group is all, choice or sequence
+
+ // interpretation: make a fake group of the right type, with min occurs and max occurs of 1
+ SchemaParticleImpl asIfPart = new SchemaParticleImpl();
+ asIfPart.setParticleType(baseModel.getParticleType());
+ asIfPart.setMinOccurs(BigInteger.ONE);
+ asIfPart.setMaxOccurs(BigInteger.ONE);
+ asIfPart.setParticleChildren(new SchemaParticle[] { derivedModel });
+
+ // the recurse
+ return isParticleValidRestriction(baseModel, asIfPart, errors, context);
+ }
+
+ private static boolean recurseLax(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // recurseLax is called if base: CHOICE, derived: CHOICE
+ assert baseModel.getParticleType() == SchemaParticle.CHOICE && derivedModel.getParticleType() == SchemaParticle.CHOICE;
+ boolean recurseLaxValid = true;
+ //Schema Component Constraint: Particle Derivation OK (Choice:Choice -- RecurseLax)
+ // For a choice group particle to be a ·valid restriction· of another choice group particle all of the
+ // following must be true:
+ // 1 R's occurrence range is a valid restriction of B's occurrence range as defined by Occurrence
+ // Range OK (§3.9.6);
+ // 2 There is a complete ·order-preserving· functional mapping from the particles in the {particles} of R
+ // to the particles in the {particles} of B such that each particle in the {particles} of R is a
+ // ·valid restriction· of the particle in the {particles} of B it maps to as defined by
+ // Particle Valid (Restriction) (§3.9.6).
+ // NOTE: Although the ·validation· semantics of a choice group does not depend on the order of its particles,
+ // derived choice groups are required to match the order of their base in order to simplify
+ // checking that the derivation is OK.
+ // interpretation: check derived choices for match in order, must get an in order match on a base particle,
+ // don't need to check if base particles are skippable. a lot like recurse
+
+ if (!occurrenceRangeOK(baseModel, derivedModel, errors, context)) {
+ return false;
+ }
+ // cycle thru both derived particle children and base particle children looking for matches
+ // if the derived particle does not match the base particle then base particle can be skipped
+
+ SchemaParticle[] derivedParticleArray = derivedModel.getParticleChildren();
+ SchemaParticle[] baseParticleArray = baseModel.getParticleChildren();
+ int i = 0, j = 0;
+ for (; i < derivedParticleArray.length && j < baseParticleArray.length;) {
+ SchemaParticle derivedParticle = derivedParticleArray[i];
+ SchemaParticle baseParticle = baseParticleArray[j];
+ // try to match the two particles by recursing
+ if (isParticleValidRestriction(baseParticle, derivedParticle, errors, context)) {
+ // cool found a match, increment both indexes
+ i++;
+ j++;
+ } else {
+ // did not match, increment the base particle array index only
+ // Ok, let's skip this base particle, increment base particle array index only
+ j++;
+ }
+ }
+
+ // ok, got to the end of one of the arrays
+ // if at end of base particle array and not at the end of derived particle array then remaining derived
+ // particles must not match
+ if (i < derivedParticleArray.length) {
+ recurseLaxValid = false;
+ String message = "Found derived particles that are not matched in the base content model.";
+ errors.add(XmlError.forObject(formatDerivedMappingError(message, baseModel, derivedModel), context));
+ }
+
+
+ return recurseLaxValid;
+ }
+
+ private static boolean recurseUnordered(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // recurseUnorder is called when base: ALL and derived: SEQ
+ assert baseModel.getParticleType() == SchemaParticle.ALL && derivedModel.getParticleType() == SchemaParticle.SEQUENCE;
+ boolean recurseUnorderedValid = true;
+ // Schema Component Constraint: Particle Derivation OK (Sequence:All -- RecurseUnordered)
+ // For a sequence group particle to be a ·valid restriction· of an all group particle all of the
+ // following must be true:
+ // 1 R's occurrence range is a valid restriction of B's occurrence range as defined by
+ // Occurrence Range OK (§3.9.6).
+ // 2 There is a complete functional mapping from the particles in the {particles} of R to the particles
+ // in the {particles} of B such that all of the following must be true:
+ // 2.1 No particle in the {particles} of B is mapped to by more than one of the particles in
+ // the {particles} of R;
+ // 2.2 Each particle in the {particles} of R is a ·valid restriction· of the particle in the {particles} of B
+ // it maps to as defined by Particle Valid (Restriction) (§3.9.6);
+ // 2.3 All particles in the {particles} of B which are not mapped to by any particle in the {particles}
+ // of R are ·emptiable· as defined by Particle Emptiable (§3.9.6).
+ // NOTE: Although this clause allows reordering, because of the limits on the contents of all groups the
+ // checking process can still be deterministic.
+ // 1, 2.2, and 2.3 are the same as recurse, so do 2.1 and then call recurse
+
+ if (!occurrenceRangeOK(baseModel, derivedModel, errors, context)) {
+ return false;
+ }
+
+ // read baseParticle array QNames into hashmap
+ SchemaParticle[] baseParticles = baseModel.getParticleChildren();
+ HashMap baseParticleMap = new HashMap(10);
+ Object MAPPED = new Object();
+ // Initialize the hashmap
+ for (int i = 0; i < baseParticles.length; i++)
+ baseParticleMap.put(baseParticles[i].getName(), baseParticles[i]);
+
+ // go thru the sequence (derived model's children) and check off from base particle map
+ SchemaParticle[] derivedParticles = derivedModel.getParticleChildren();
+ for (int i = 0; i < derivedParticles.length; i++) {
+ SchemaParticle matchedBaseParticle = (SchemaParticle) baseParticleMap.get(derivedParticles[i].getName());
+ if (matchedBaseParticle == null) {
+ recurseUnorderedValid = false;
+ errors.add(XmlError.forObject(formatInvalidAllSeqMappingError(), context));
+ break;
+ } else {
+ // got a match
+ if (matchedBaseParticle == MAPPED) {
+ // whoa, this base particle has already been matched (see 2.1 above)
+ recurseUnorderedValid = false;
+ errors.add(XmlError.forObject(formatMappedMoreThanOnceError(baseModel, derivedModel), context));
+ break;
+ } else {
+ if (derivedParticles[i].getMaxOccurs() == null ||
+ derivedParticles[i].getMaxOccurs().compareTo(BigInteger.ONE) > 0) {
+ // no derived particles can have a max occurs greater than 1
+ recurseUnorderedValid = false;
+ errors.add(XmlError.forObject(formatAllSeqMaxOccursGreaterThan1Error(derivedParticles[i]), context));
+ break;
+ }
+ if (!isParticleValidRestriction(matchedBaseParticle, derivedParticles[i], errors, context))
+ {
+ // already have an error
+ recurseUnorderedValid = false;
+ break;
+ }
+ // everything is cool, got a match, update to MAPPED
+ baseParticleMap.put(derivedParticles[i].getName(), MAPPED);
+ }
+ }
+ }
+
+ // if everything is cool so far then check to see if any base particles are not matched
+ if (recurseUnorderedValid) {
+ // get all the hashmap keys and loop thru looking for NOT_MAPPED
+ Set baseParticleCollection = baseParticleMap.keySet();
+ for (Iterator iterator = baseParticleCollection.iterator(); iterator.hasNext();) {
+ QName baseParticleQName = (QName) iterator.next();
+ if (baseParticleMap.get(baseParticleQName) != MAPPED && !((SchemaParticle)baseParticleMap.get(baseParticleQName)).isSkippable()) {
+ // this base particle was not mapped and is not "particle emptiable" (skippable)
+ recurseUnorderedValid = false;
+ errors.add(XmlError.forObject(formatGroupMappingError(baseModel, derivedModel), context));
+ }
+ }
+ }
+
+ return recurseUnorderedValid;
+ }
+
+ private static String formatAllSeqMaxOccursGreaterThan1Error(SchemaParticle derivedModel) {
+ return "Invalid Restriction. The "
+ + printParticle(derivedModel)
+ + " has a maxOccurs great than 1 ("
+ + printMaxOccurs(derivedModel.getMaxOccurs())
+ + "). When restricting an <all> with a <sequence>, no <element> can have a maxOccurs > 1";
+ }
+
+ private static String formatInvalidAllSeqMappingError() {
+ return "Invalid Restriction. Each element in the derived content model must match an element in the base "
+ + "content model.";
+ }
+
+ private static String formatGroupMappingError(SchemaParticle baseModel, SchemaParticle derivedModel) {
+ return "Invalid Restriction. The members of the derived content model must match the members of the base "
+ + " content model unless the member of the base content model is optional (particle emptiable).";
+ }
+
+ private static String formatMappedMoreThanOnceError(SchemaParticle baseModel, SchemaParticle derivedModel) {
+ return "Invalid Restriction. When using a <sequence> to restrict an <all> the elements in the <all> can be mapped only once. "
+ + " Found element in the <sequence> that maps an element in the <all> more than once.";
+ }
+
+ private static boolean recurse(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // recurse is called when base: ALL derived: ALL or base: SEQUENCE derived: SEQUENCE
+ boolean recurseValid = true;
+ // For an all or sequence group particle to be a ·valid restriction· of another group particle with the same
+ // {compositor} all of the following must be true:
+ // 1 R's occurrence range is a valid restriction of B's occurrence range as defined by
+ // Occurrence Range OK (§3.9.6).
+ // 2 There is a complete ·order-preserving· functional mapping from the particles in the {particles} of R to
+ // the particles in the {particles} of B such that all of the following must be true:
+ // 2.1 Each particle in the {particles} of R is a ·valid restriction· of the particle in the {particles}
+ // of B it maps to as defined by Particle Valid (Restriction) (§3.9.6).
+ // 2.2 All particles in the {particles} of B which are not mapped to by any particle in the {particles}
+ // of R are ·emptiable· as defined by Particle Emptiable (§3.9.6).
+ // NOTE: Although the ·validation· semantics of an all group does not depend on the order of its particles,
+ // derived all groups are required to match the order of their base in order to simplify checking that
+ // the derivation is OK.
+ // [Definition:] A complete functional mapping is order-preserving if each particle r in the domain R maps
+ // to a particle b in the range B which follows (not necessarily immediately) the particle in the range B
+ // mapped to by the predecessor of r, if any, where "predecessor" and "follows" are defined with respect to
+ // the order of the lists which constitute R and B.
+
+ if (!occurrenceRangeOK(baseModel, derivedModel, errors, context)) {
+ // error message is formatted in occurrencRangeOK ...
+ return false;
+ }
+ // cycle thru both derived particle children and base particle children looking for matches
+ // if the derived particle does not match the base particle then base particle can be skipped if it is
+ // skippable (same as "particle emptiable") otherwise is an invalid restriction.
+ // after the derived particles have been cycled if there are any base particles left over then they
+ // must be skippable or invalid restriction
+
+ SchemaParticle[] derivedParticleArray = derivedModel.getParticleChildren();
+ SchemaParticle[] baseParticleArray = baseModel.getParticleChildren();
+ int i = 0, j = 0;
+ for (; i < derivedParticleArray.length && j < baseParticleArray.length;) {
+ SchemaParticle derivedParticle = derivedParticleArray[i];
+ SchemaParticle baseParticle = baseParticleArray[j];
+ // try to match the two particles by recursing
+ if (isParticleValidRestriction(baseParticle, derivedParticle, errors, context)) {
+ // cool found a match, increment both indexes
+ i++;
+ j++;
+ } else {
+ // did not match, increment the base particle array index only
+ // that's ok if the base particle is skippable
+ if (baseParticle.isSkippable()) {
+ // Ok, let's skip this base particle, increment base particle array index only
+ j++;
+ } else {
+ // whoa, particles are not valid restrictions and base is not skippable - ERROR
+ recurseValid = false;
+ String message = "Found non-optional particle that is not mapped in base content model.";
+ errors.add(XmlError.forObject(formatDerivedMappingError(message, baseModel, derivedModel), context));
+ break;
+ }
+ }
+ }
+
+ // ok, got to the end of one of the arrays
+ // if at end of base particle array and not at the end of derived particle array then remaining derived
+ // particles must not match
+ if (i < derivedParticleArray.length) {
+ recurseValid = false;
+ String message = "Found derived particles that are not matched in the base content model.";
+ errors.add(XmlError.forObject(formatDerivedMappingError(message, baseModel, derivedModel), context));
+ } else {
+ // if at end of derived particle array and not at end of base particle array then chck remaining
+ // base particles to assure they are skippable
+ if (j < baseParticleArray.length) {
+ for (int k = j; k < baseParticleArray.length; k++) {
+ if (!baseParticleArray[k].isSkippable()) {
+ recurseValid = false;
+ String message = "Found trailing base particles that are not optional and are not " +
+ "represented in the derived content model.";
+ errors.add(XmlError.forObject(formatDerivedMappingError(message, baseModel, derivedModel), context));
+ }
+
+ }
+ }
+ }
+
+ return recurseValid;
+ }
+
+ private static String formatDerivedMappingError(String message, SchemaParticle baseModel, SchemaParticle derivedModel) {
+ return "Invalid Restriction. The derived (restricted) content model must match the base content model unless "
+ + "the part of the base content model that does not match is optional. A mismatch found between a base " +
+ printParticle(baseModel) + " and a derived " + printParticle(derivedModel) + ". " + message;
+ }
+
+ private static boolean nsRecurseCheckCardinality(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // nsRecurseCheckCardinality is called when:
+ // base: ANY, derived: ALL
+ // base: ANY, derived: CHOICE
+ // base: ANY, derived: SEQUENCE
+ assert baseModel.getParticleType() == SchemaParticle.WILDCARD;
+ assert (derivedModel.getParticleType() == SchemaParticle.ALL)
+ || (derivedModel.getParticleType() == SchemaParticle.CHOICE)
+ || (derivedModel.getParticleType() == SchemaParticle.SEQUENCE);
+ boolean nsRecurseCheckCardinality = true;
+ // For a group particle to be a ·valid restriction· of a wildcard particle all of the following must be true:
+ // 1 Every member of the {particles} of the group is a ·valid restriction· of the wildcard as defined by Particle Valid (Restriction) (§3.9.6).
+ // Note: not positive what this means. Interpreting to mean that every particle of the group must adhere to wildcard derivation rules
+ // in a recursive manner
+ // Loop thru the children particles of the group and invoke the appropriate function to check for wildcard restriction validity
+
+ // BAU - an errata should be submitted on this clause of the spec, because the
+ // spec makes no sense, as the xstc particlesR013.xsd test exemplifies.
+ // what we _should_ so is an "as if" on the wildcard, allowing it minOccurs="0" maxOccurs="unbounded"
+ // before recursing
+ SchemaParticleImpl asIfPart = new SchemaParticleImpl();
+ asIfPart.setParticleType(baseModel.getParticleType());
+ asIfPart.setWildcardProcess(baseModel.getWildcardProcess());
+ asIfPart.setWildcardSet(baseModel.getWildcardSet());
+ asIfPart.setMinOccurs(BigInteger.ZERO);
+ asIfPart.setMaxOccurs(null);
+ asIfPart.setTransitionRules(baseModel.getWildcardSet(), true);
+ asIfPart.setTransitionNotes(baseModel.getWildcardSet(), true);
+
+ SchemaParticle[] particleChildren = derivedModel.getParticleChildren();
+ for (int i = 0; i < particleChildren.length; i++) {
+ SchemaParticle particle = particleChildren[i];
+ switch (particle.getParticleType()) {
+ case SchemaParticle.ELEMENT:
+ // Check for valid Wildcard/Element derivation
+ nsRecurseCheckCardinality = nsCompat(asIfPart, (SchemaLocalElement) particle, errors, context);
+ break;
+ case SchemaParticle.WILDCARD:
+ // Check for valid Wildcard/Wildcard derivation
+ nsRecurseCheckCardinality = nsSubset(asIfPart, particle, errors, context);
+ break;
+ case SchemaParticle.ALL:
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.SEQUENCE:
+ // Check for valid Wildcard/Group derivation
+ nsRecurseCheckCardinality = nsRecurseCheckCardinality(asIfPart, derivedModel, errors, context);
+ break;
+ }
+ // If any particle is invalid then break the loop
+ if (!nsRecurseCheckCardinality) {
+ break;
+ }
+ }
+
+ // 2 The effective total range of the group, as defined by Effective Total Range (all and sequence) (§3.8.6)
+ // (if the group is all or sequence) or Effective Total Range (choice) (§3.8.6) (if it is choice) is a valid
+ // restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6).
+
+ if (nsRecurseCheckCardinality) {
+ nsRecurseCheckCardinality = checkGroupOccurrenceOK(baseModel, derivedModel, errors, context);
+ }
+
+ return nsRecurseCheckCardinality;
+ }
+
+ private static boolean checkGroupOccurrenceOK(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ boolean groupOccurrenceOK = true;
+ BigInteger minRange = BigInteger.ZERO;
+ BigInteger maxRange = BigInteger.ZERO;
+ switch (derivedModel.getParticleType()) {
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ minRange = getEffectiveMinRangeAllSeq(derivedModel);
+ maxRange = getEffectiveMaxRangeAllSeq(derivedModel);
+ break;
+ case SchemaParticle.CHOICE:
+ minRange = getEffectiveMinRangeChoice(derivedModel);
+ maxRange = getEffectiveMaxRangeChoice(derivedModel);
+ break;
+ }
+
+ // Check min occurs for validity
+ // derived min occurs is valid if its {min occurs} is greater than or equal to the other's {min occurs}.
+ if (minRange.compareTo(baseModel.getMinOccurs()) < 0) {
+ groupOccurrenceOK = false;
+ errors.add(XmlError.forObject(formatGroupMinOccursError(derivedModel, baseModel), context));
+ }
+ // Check max occurs for validity
+ // one of the following must be true:
+ // The base model's {max occurs} is unbounded.
+ // or both {max occurs} are numbers, and the particle's is less than or equal to the other's
+ BigInteger UNBOUNDED = null;
+ if (baseModel.getMaxOccurs() != UNBOUNDED) {
+ if (maxRange == UNBOUNDED) {
+ groupOccurrenceOK = false;
+ errors.add(XmlError.forObject(formatGroupMaxOccursError(derivedModel, baseModel), context));
+ } else {
+ if (maxRange.compareTo(baseModel.getMaxOccurs()) > 0) {
+ groupOccurrenceOK = false;
+ errors.add(XmlError.forObject(formatGroupMaxOccursError(derivedModel, baseModel), context));
+ }
+ }
+ }
+ return groupOccurrenceOK;
+ }
+
+ private static String formatGroupMaxOccursError(SchemaParticle derivedModel, SchemaParticle baseModel) {
+ return "Invalid Restriction. The maxOccurs for the derived group "
+ + printParticle(derivedModel)
+ + " is great than the base maxOccurs of "
+ + printMaxOccurs(baseModel.getMaxOccurs());
+ }
+
+ private static String formatGroupMinOccursError(SchemaParticle derivedModel, SchemaParticle baseModel) {
+ return "Invalid Restriction. The minOccurs for the derived group "
+ + printParticle(derivedModel)
+ + " is less than the base minOccurs of "
+ + baseModel.getMinOccurs();
+ }
+
+ private static BigInteger getEffectiveMaxRangeChoice(SchemaParticle derivedModel) {
+ BigInteger maxRange = BigInteger.ZERO;
+ BigInteger UNBOUNDED = null;
+ // Schema Component Constraint: Effective Total Range (choice)
+ // The effective total range of a particle whose {term} is a group whose {compositor} is choice
+ // is a pair of minimum and maximum, as follows:
+ // MAXIMUM
+ // 1) unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or
+ // the maximum part of the effective total range of any of the group particles in the group's {particles} is
+ // unbounded (note: seems to be the same as Max Range All or Sequence),
+ // or 2) if any of those is non-zero and the {max occurs} of the particle itself is unbounded,
+ // otherwise 3) the product of the particle's {max occurs} and the maximum of the {max occurs} of every
+ // wildcard or element declaration particle in the group's {particles} and the *maximum* (note: this is the difference
+ // between MaxRange Choice ans MaxRange All or Sequence) part of the
+ // effective total range of each of the group particles in the group's {particles}
+ // (or 0 if there are no {particles}).
+
+ boolean nonZeroParticleChildFound = false;
+ BigInteger maxOccursInWildCardOrElement = BigInteger.ZERO;
+ BigInteger maxOccursInGroup = BigInteger.ZERO;
+ SchemaParticle[] particleChildren = derivedModel.getParticleChildren();
+ for (int i = 0; i < particleChildren.length; i++) {
+ SchemaParticle particle = particleChildren[i];
+ switch (particle.getParticleType()) {
+ case SchemaParticle.WILDCARD:
+ case SchemaParticle.ELEMENT:
+ // if unbounded then maxoccurs will be null
+ if (particle.getMaxOccurs() == UNBOUNDED) {
+ maxRange = UNBOUNDED;
+ } else {
+ if (particle.getIntMaxOccurs() > 0) {
+ // show tht at least one non-zero particle is found for later test
+ nonZeroParticleChildFound = true;
+ if (particle.getMaxOccurs().compareTo(maxOccursInWildCardOrElement) > 0) {
+ maxOccursInWildCardOrElement = particle.getMaxOccurs();
+ }
+ }
+ }
+ break;
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ maxRange = getEffectiveMaxRangeAllSeq(derivedModel);
+ if (maxRange != UNBOUNDED) {
+ // keep highest maxoccurs found
+ if (maxRange.compareTo(maxOccursInGroup) > 0) {
+ maxOccursInGroup = maxRange;
+ }
+ }
+ break;
+ case SchemaParticle.CHOICE:
+ maxRange = getEffectiveMaxRangeChoice(derivedModel);
+ if (maxRange != UNBOUNDED) {
+ // keep highest maxoccurs found
+ if (maxRange.compareTo(maxOccursInGroup) > 0) {
+ maxOccursInGroup = maxRange;
+ }
+ }
+ break;
+ }
+ // if an unbounded has been found then we are done
+ if (maxRange == UNBOUNDED) {
+ break;
+ }
+ }
+
+ // 1) unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or
+ // the maximum part of the effective total range of any of the group particles in the group's {particles} is
+ // unbounded
+ if (maxRange != UNBOUNDED) {
+ // 2) if any of those is non-zero and the {max occurs} of the particle itself is unbounded
+ if (nonZeroParticleChildFound && derivedModel.getMaxOccurs() == UNBOUNDED) {
+ maxRange = UNBOUNDED;
+ } else {
+ // 3) the product of the particle's {max occurs} and the maximum of the {max occurs} of every
+ // wildcard or element declaration particle in the group's {particles} and the *maximum*
+ // part of the effective total range of each of the group particles in the group's {particles}
+ maxRange = derivedModel.getMaxOccurs().multiply(maxOccursInWildCardOrElement.add(maxOccursInGroup));
+ }
+ }
+
+ return maxRange;
+ }
+
+ private static BigInteger getEffectiveMaxRangeAllSeq(SchemaParticle derivedModel) {
+ BigInteger maxRange = BigInteger.ZERO;
+ BigInteger UNBOUNDED = null;
+ // Schema Component Constraint: Effective Total Range (all and sequence)
+ // The effective total range of a particle whose {term} is a group whose {compositor} is all or sequence is a
+ // pair of minimum and maximum, as follows:
+ // MAXIMUM
+ // 1) unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or
+ // the maximum part of the effective total range of any of the group particles in the group's {particles} is
+ // unbounded, or 2) if any of those is non-zero and the {max occurs} of the particle itself is unbounded, otherwise
+ // 3) the product of the particle's {max occurs} and the *sum* of the {max occurs} of every wildcard or element
+ // declaration particle in the group's {particles} and the maximum part of the effective total range of each of
+ // the group particles in the group's {particles} (or 0 if there are no {particles}).
+
+ boolean nonZeroParticleChildFound = false;
+ BigInteger maxOccursTotal = BigInteger.ZERO;
+ BigInteger maxOccursInGroup = BigInteger.ZERO;
+ SchemaParticle[] particleChildren = derivedModel.getParticleChildren();
+ for (int i = 0; i < particleChildren.length; i++) {
+ SchemaParticle particle = particleChildren[i];
+ switch (particle.getParticleType()) {
+ case SchemaParticle.WILDCARD:
+ case SchemaParticle.ELEMENT:
+ // if unbounded then maxoccurs will be null
+ if (particle.getMaxOccurs() == UNBOUNDED) {
+ maxRange = UNBOUNDED;
+ } else {
+ if (particle.getIntMaxOccurs() > 0) {
+ // show tht at least one non-zero particle is found for later test
+ nonZeroParticleChildFound = true;
+ maxOccursTotal = maxOccursTotal.add(particle.getMaxOccurs());
+ }
+ }
+ break;
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ maxRange = getEffectiveMaxRangeAllSeq(derivedModel);
+ if (maxRange != UNBOUNDED) {
+ // keep highest maxoccurs found
+ if (maxRange.compareTo(maxOccursInGroup) > 0) {
+ maxOccursInGroup = maxRange;
+ }
+ }
+ break;
+ case SchemaParticle.CHOICE:
+ maxRange = getEffectiveMaxRangeChoice(derivedModel);
+ if (maxRange != UNBOUNDED) {
+ // keep highest maxoccurs found
+ if (maxRange.compareTo(maxOccursInGroup) > 0) {
+ maxOccursInGroup = maxRange;
+ }
+ }
+ break;
+ }
+ // if an unbounded has been found then we are done
+ if (maxRange == UNBOUNDED) {
+ break;
+ }
+ }
+
+ // 1) unbounded if the {max occurs} of any wildcard or element declaration particle in the group's {particles} or
+ // the maximum part of the effective total range of any of the group particles in the group's {particles} is
+ // unbounded
+ if (maxRange != UNBOUNDED) {
+ // 2) if any of those is non-zero and the {max occurs} of the particle itself is unbounded
+ if (nonZeroParticleChildFound && derivedModel.getMaxOccurs() == UNBOUNDED) {
+ maxRange = UNBOUNDED;
+ } else {
+ // 3) the product of the particle's {max occurs} and the sum of the {max occurs} of every wildcard or element
+ // declaration particle in the group's {particles} and the maximum part of the effective total range of each of
+ // the group particles in the group's {particles}
+ maxRange = derivedModel.getMaxOccurs().multiply(maxOccursTotal.add(maxOccursInGroup));
+ }
+ }
+
+ return maxRange;
+
+ }
+
+ private static BigInteger getEffectiveMinRangeChoice(SchemaParticle derivedModel) {
+ // Schema Component Constraint: Effective Total Range (choice)
+ // The effective total range of a particle whose {term} is a group whose {compositor} is choice is a pair of
+ // minimum and maximum, as follows:
+ // MINIMUM
+ // The product of the particle's {min occurs}
+ // and the *minimum* of the {min occurs} of every wildcard or element
+ // declaration particle in the group's {particles} and the minimum part of the effective total range of each of
+ // the group particles in the group's {particles} (or 0 if there are no {particles}).
+ SchemaParticle[] particleChildren = derivedModel.getParticleChildren();
+ if (particleChildren.length == 0)
+ return BigInteger.ZERO;
+ BigInteger minRange = null;
+ // get the minimum of every wildcard or element
+ // total up the effective total range for each group
+ for (int i = 0; i < particleChildren.length; i++) {
+ SchemaParticle particle = particleChildren[i];
+ switch (particle.getParticleType()) {
+ case SchemaParticle.WILDCARD:
+ case SchemaParticle.ELEMENT:
+ if (minRange == null || minRange.compareTo(particle.getMinOccurs()) > 0) {
+ minRange = particle.getMinOccurs();
+ }
+ break;
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ BigInteger mrs = getEffectiveMinRangeAllSeq(derivedModel);
+ if (minRange == null || minRange.compareTo(mrs) > 0) {
+ minRange = mrs;
+ }
+ break;
+ case SchemaParticle.CHOICE:
+ BigInteger mrc = getEffectiveMinRangeChoice(derivedModel);
+ if (minRange == null || minRange.compareTo(mrc) > 0) {
+ minRange = mrc;
+ }
+ break;
+ }
+ }
+ if (minRange == null)
+ minRange = BigInteger.ZERO;
+
+ // calculate the total
+ minRange = derivedModel.getMinOccurs().multiply(minRange);
+ return minRange;
+ }
+
+ private static BigInteger getEffectiveMinRangeAllSeq(SchemaParticle derivedModel) {
+ BigInteger minRange = BigInteger.ZERO;
+ // Schema Component Constraint: Effective Total Range (all and sequence)
+ // The effective total range of a particle whose {term} is a group whose {compositor} is all or sequence is a
+ // pair of minimum and maximum, as follows:
+ // MINIMUM
+ // The product of the particle's {min occurs}
+ // and the *sum* of the {min occurs} of every wildcard or element
+ // declaration particle in the group's {particles}
+ // and the minimum part of the effective total range of each
+ // of the group particles in the group's {particles} (or 0 if there are no {particles}).
+ SchemaParticle[] particleChildren = derivedModel.getParticleChildren();
+ BigInteger particleTotalMinOccurs = BigInteger.ZERO;
+ for (int i = 0; i < particleChildren.length; i++) {
+ SchemaParticle particle = particleChildren[i];
+ switch (particle.getParticleType()) {
+ case SchemaParticle.WILDCARD:
+ case SchemaParticle.ELEMENT:
+ particleTotalMinOccurs = particleTotalMinOccurs.add(particle.getMinOccurs());
+ break;
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ particleTotalMinOccurs = particleTotalMinOccurs.add(getEffectiveMinRangeAllSeq(derivedModel));
+ break;
+ case SchemaParticle.CHOICE:
+ particleTotalMinOccurs = particleTotalMinOccurs.add(getEffectiveMinRangeChoice(derivedModel));
+ break;
+ }
+ }
+
+ minRange = derivedModel.getMinOccurs().multiply(particleTotalMinOccurs);
+
+ return minRange;
+ }
+
+ private static boolean nsSubset(SchemaParticle baseModel, SchemaParticle derivedModel, Collection errors, XmlObject context) {
+ // nsSubset is called when base: ANY, derived: ANY
+ assert baseModel.getParticleType() == SchemaParticle.WILDCARD;
+ assert derivedModel.getParticleType() == SchemaParticle.WILDCARD;
+ boolean nsSubset = false;
+ // For a wildcard particle to be a ·valid restriction· of another wildcard particle all of the following must be true:
+ // 1 R's occurrence range must be a valid restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6).
+ if (occurrenceRangeOK(baseModel, derivedModel, errors, context)) {
+ // 2 R's {namespace constraint} must be an intensional subset of B's {namespace constraint} as defined
+ // by Wildcard Subset (§3.10.6).
+ if (baseModel.getWildcardSet().inverse().isDisjoint(derivedModel.getWildcardSet())) {
+ nsSubset = true;
+ } else {
+ nsSubset = false;
+ errors.add(XmlError.forObject(formatNSIsNotSubsetError(baseModel, derivedModel), context));
+ }
+ } else {
+ nsSubset = false;
+ errors.add(XmlError.forObject(formatNSIsNotSubsetError(baseModel, derivedModel), context));
+ }
+
+
+ return nsSubset;
+ }
+
+ private static boolean nsCompat(SchemaParticle baseModel, SchemaLocalElement derivedElement, Collection errors, XmlObject context) {
+ // nsCompat is called when base: ANY, derived: ELEMENT
+ assert baseModel.getParticleType() == SchemaParticle.WILDCARD;
+ boolean nsCompat = false;
+ // For an element declaration particle to be a ·valid restriction· of a wildcard particle all of the following must be true:
+ // 1 The element declaration's {target namespace} is ·valid· with respect to the wildcard's {namespace constraint}
+ // as defined by Wildcard allows Namespace Name (§3.10.4).
+ if (baseModel.getWildcardSet().contains(derivedElement.getName())) {
+ // 2 R's occurrence range is a valid restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6).
+ if (occurrenceRangeOK(baseModel, (SchemaParticle) derivedElement, errors, context)) {
+ nsCompat = true;
+ } else {
+ errors.add(XmlError.forObject(formatOccurenceRangeMinError(baseModel, (SchemaParticle) derivedElement), context));
+ }
+ } else {
+ nsCompat = false;
+ errors.add(XmlError.forObject(formatNSIsNotSubsetError(baseModel, (SchemaParticle) derivedElement), context));
+ }
+
+
+ return nsCompat;
+ }
+
+ private static String formatNSIsNotSubsetError(SchemaParticle baseParticle, SchemaParticle derivedParticle) {
+ return "Invalid Restriction. The namespace(s) of the derived field: " + printParticle(derivedParticle)
+ + " are not a subset of the namespace(s) of the base field: " + printParticle(baseParticle);
+ }
+
+ private static String formatInvalidCombinationError(SchemaParticle baseModel, SchemaParticle derivedModel) {
+ return "Invalid Restriction. The derived content model "
+ + printParticle(derivedModel)
+ + " cannot restrict base content model "
+ + printParticle(baseModel);
+ }
+
+ private static boolean nameAndTypeOK(SchemaLocalElement baseElement, SchemaLocalElement derivedElement, Collection errors, XmlObject context) {
+ // nameAndTypeOK called when base: ELEMENT and derived: ELEMENT
+ boolean nameAndTypeOK = false;
+ // Schema Component Constraint: Particle Restriction OK (Elt:Elt -- NameAndTypeOK)
+ // 1 The declarations' {name}s and {target namespace}s are the same.
+ if (((SchemaParticle)baseElement).canStartWithElement(derivedElement.getName())) {
+ // 2 Either B's {nillable} is true or R's {nillable} is false.
+ if (baseElement.isNillable() || !derivedElement.isNillable()) {
+ // 3 R's occurrence range is a valid restriction of B's occurrence range as defined by Occurrence Range OK (§3.9.6).
+ if (occurrenceRangeOK((SchemaParticle) baseElement, (SchemaParticle) derivedElement, errors, context)) {
+ // 4 either B's declaration's {value constraint} is absent, or is not fixed,
+ // or R's declaration's {value constraint} is fixed with the same value.
+ nameAndTypeOK = checkFixed(baseElement, derivedElement, errors, context);
+ if (nameAndTypeOK) {
+ // 5 R's declaration's {identity-constraint definitions} is a subset of B's declaration's {identity-constraint definitions}, if any.
+ nameAndTypeOK = checkIdentityConstraints(baseElement, derivedElement, errors, context);
+ if (nameAndTypeOK) {
+ // 7 R's {type definition} is validly derived given {extension, list, union} from B's {type definition} as
+ // defined by Type Derivation OK (Complex) (§3.4.6) or Type Derivation OK (Simple) (§3.14.6), as appropriate.
+ nameAndTypeOK = typeDerivationOK(baseElement.getType(), derivedElement.getType(), errors, context);
+ if (nameAndTypeOK) {
+ // 6 R's declaration's {disallowed substitutions} is a superset of B's declaration's {disallowed substitutions}.
+ nameAndTypeOK = blockSetOK(baseElement, derivedElement, errors, context);
+ }
+ }
+ }
+ }
+ }
+ }
+ return nameAndTypeOK;
+ }
+
+ private static boolean blockSetOK(SchemaLocalElement baseElement, SchemaLocalElement derivedElement, Collection errors, XmlObject context)
+ {
+ if (baseElement.blockRestriction() && !derivedElement.blockRestriction())
+ {
+ errors.add(XmlError.forObject("Restriction Invalid. Derived " + printParticle((SchemaParticle)derivedElement) + " does not block restriction as does the base " + printParticle((SchemaParticle)baseElement), context));
+ return false;
+ }
+ if (baseElement.blockExtension() && !derivedElement.blockExtension())
+ {
+ errors.add(XmlError.forObject("Restriction Invalid. Derived " + printParticle((SchemaParticle)derivedElement) + " does not block extension as does the base " + printParticle((SchemaParticle)baseElement), context));
+ return false;
+ }
+ if (baseElement.blockSubstitution() && !derivedElement.blockSubstitution())
+ {
+ errors.add(XmlError.forObject("Restriction Invalid. Derived " + printParticle((SchemaParticle)derivedElement) + " does not block substitution as does the base " + printParticle((SchemaParticle)baseElement), context));
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean typeDerivationOK(SchemaType baseType, SchemaType derivedType, Collection errors, XmlObject context) {
+ boolean typeDerivationOK = false;
+ // 1 If B and D are not the same type definition, then the {derivation method} of D must not be in the subset.
+ // 2 One of the following must be true:
+ // 2.1 B and D must be the same type definition.
+ // 2.2 B must be D's {base type definition}.
+ // 2.3 All of the following must be true:
+ // 2.3.1 D's {base type definition} must not be the ·ur-type definition·.
+ // 2.3.2 The appropriate case among the following must be true:
+ // 2.3.2.1 If D's {base type definition} is complex, then it must be validly derived from B given the subset as defined by this constraint.
+ // 2.3.2.2 If D's {base type definition} is simple, then it must be validly derived from B given the subset as defined in Type Derivation OK (Simple) (§3.14.6).
+ // This line will check if derivedType is a subType of baseType (should handle all of the 2.xx checks above)
+ if (baseType.isAssignableFrom(derivedType)) {
+ // Ok derived type is subtype but need to make sure that all of the derivations between the two types are by
+ // Restriction.
+ typeDerivationOK = checkAllDerivationsForRestriction(baseType, derivedType, errors, context);
+ } else {
+ // derived type is not a sub-type of base type
+ typeDerivationOK = false;
+ errors.add(XmlError.forObject(formatDerivedTypeNotSubTypeError(baseType, derivedType), context));
+ }
+
+ return typeDerivationOK;
+ }
+
+ private static String formatDerivedTypeNotSubTypeError(SchemaType baseType, SchemaType derivedType) {
+ return "Restriction Invalid. Derived Type: " + printType(derivedType) + " is not a sub-type of Base Type: " + printType(baseType);
+ }
+
+ private static boolean checkAllDerivationsForRestriction(SchemaType baseType, SchemaType derivedType, Collection errors, XmlObject context) {
+
+ boolean allDerivationsAreRestrictions = true;
+ SchemaType currentType = derivedType;
+ // run up the types hierarchy from derived Type to base Type and make sure that all are derived by
+ // restriction. If any are not then this is not a valid restriction.
+ while (!baseType.equals(currentType)) {
+ if (currentType.getDerivationType() == SchemaType.DT_RESTRICTION) {
+ currentType = currentType.getBaseType();
+ } else {
+ allDerivationsAreRestrictions = false;
+ errors.add(XmlError.forObject(formatAllDerivationsAreNotRestrictionsError(baseType, derivedType, currentType), context));
+ break;
+ }
+ }
+ return allDerivationsAreRestrictions;
+ }
+
+ private static String formatAllDerivationsAreNotRestrictionsError(SchemaType baseType, SchemaType derivedType, SchemaType currentType) {
+ return "Invalid Restriction. The type " + printType(derivedType) + " derived from base type "
+ + printType(baseType) + " has an intermediary type " + printType(currentType)
+ + "that is not derived by restriction.";
+ }
+
+ private static boolean checkIdentityConstraints(SchemaLocalElement baseElement, SchemaLocalElement derivedElement, Collection errors, XmlObject context) {
+ // 5 R's declaration's {identity-constraint definitions} is a subset of B's declaration's {identity-constraint definitions}, if any.
+ boolean identityConstraintsOK = true;
+
+ SchemaIdentityConstraint[] baseConstraints = baseElement.getIdentityConstraints();
+ SchemaIdentityConstraint[] derivedConstraints = derivedElement.getIdentityConstraints();
+ // cycle thru derived's identity constraints and check each to assure they in the array of base constraints
+ for (int i = 0; i < derivedConstraints.length; i++) {
+ SchemaIdentityConstraint derivedConstraint = derivedConstraints[i];
+ if (checkForIdentityConstraintExistence(baseConstraints, derivedConstraint)) {
+ identityConstraintsOK = false;
+ errors.add(XmlError.forObject(formatIdentityConstraintsNotSubsetError(baseElement, derivedElement), context));
+ break;
+ }
+ }
+ return identityConstraintsOK;
+ }
+
+ private static String formatIdentityConstraintsNotSubsetError(SchemaLocalElement baseElement, SchemaLocalElement derivedElement) {
+ return "Restriction Invalid. The identity constraints for " + printParticle((SchemaParticle)derivedElement)
+ + " are not a subset of the identity constraints for " + printParticle((SchemaParticle)baseElement);
+ }
+
+ private static boolean checkForIdentityConstraintExistence(SchemaIdentityConstraint[] baseConstraints, SchemaIdentityConstraint derivedConstraint) {
+ // spin thru the base identity constraints check to see if derived constraint exists
+ boolean identityConstraintExists = false;
+ for (int i = 0; i < baseConstraints.length; i++) {
+ SchemaIdentityConstraint baseConstraint = baseConstraints[i];
+ if (baseConstraint.getName().equals(derivedConstraint.getName())) {
+ identityConstraintExists = true;
+ break;
+ }
+ }
+ return identityConstraintExists;
+ }
+
+
+ private static boolean checkFixed(SchemaLocalElement baseModel, SchemaLocalElement derivedModel, Collection errors, XmlObject context) {
+ // 4 either B's declaration's {value constraint} is absent, or is not fixed,
+ // or R's declaration's {value constraint} is fixed with the same value.
+ boolean checkFixed = false;
+ if (baseModel.isFixed()) {
+ if (baseModel.getDefaultText().equals(derivedModel.getDefaultText())) {
+ // R's declaration's {value constraint} is fixed with the same value.
+ checkFixed = true;
+ } else {
+ // The derived element has a fixed value that is different than the base element
+ errors.add(XmlError.forObject(formatInvalidFixedError(baseModel, derivedModel), context));
+ checkFixed = false;
+ }
+ } else {
+ // B's declaration's {value constraint} is absent, or is not fixed,
+ checkFixed = true;
+ }
+ return checkFixed;
+ }
+
+ private static String formatInvalidFixedError(SchemaLocalElement baseModel, SchemaLocalElement derivedModel) {
+ return "The Derived Content Model on Element: '"
+ + printParticle((SchemaParticle)derivedModel)
+ + "' has a fixed value of: '"
+ + derivedModel.getDefaultText()
+ + "' which does not match the Base Content Model: '"
+ + printParticle((SchemaParticle)baseModel)
+ + "' what has a fixed value of: '"
+ + baseModel.getDefaultText() + "'";
+ }
+
+ private static boolean occurrenceRangeOK(SchemaParticle baseParticle, SchemaParticle derivedParticle, Collection errors, XmlObject context) {
+ boolean occurrenceRangeOK = false;
+ // Note: in the following comments (from the schema spec) other is the baseModel
+ // 1 Its {min occurs} is greater than or equal to the other's {min occurs}.
+ if (derivedParticle.getMinOccurs().compareTo(baseParticle.getMinOccurs()) >= 0) {
+ // 2 one of the following must be true:
+ // 2.1 The other's {max occurs} is unbounded.
+ if (baseParticle.getMaxOccurs() == null) {
+ occurrenceRangeOK = true;
+ } else {
+ // 2.2 Both {max occurs} are numbers, and the particle's is less than or equal to the other's.
+ if (derivedParticle.getMaxOccurs() != null && baseParticle.getMaxOccurs() != null &&
+ derivedParticle.getMaxOccurs().compareTo(baseParticle.getMaxOccurs()) <= 0) {
+ occurrenceRangeOK = true;
+ } else {
+ occurrenceRangeOK = false;
+ if (baseParticle.getName() == null || derivedParticle.getName() == null) {
+ errors.add(XmlError.forObject(formatOccurenceRangeMaxErrorGroup(baseParticle, derivedParticle), context));
+ } else {
+ errors.add(XmlError.forObject(formatOccurenceRangeMaxError(baseParticle, derivedParticle), context));
+ }
+ }
+ }
+ } else {
+ occurrenceRangeOK = false;
+ if (baseParticle.getName() == null || derivedParticle.getName() == null) {
+ errors.add(XmlError.forObject(formatOccurenceRangeMinErrorGroup(baseParticle, derivedParticle), context));
+ } else {
+ errors.add(XmlError.forObject(formatOccurenceRangeMinError(baseParticle, derivedParticle), context));
+ }
+ }
+ return occurrenceRangeOK;
+ }
+
+ private static String formatOccurenceRangeMaxErrorGroup(SchemaParticle baseParticle, SchemaParticle derivedParticle) {
+ return "Invalid Restriction. The maxOccurs for the "
+ + printParticle(derivedParticle)
+ + " (" + printMaxOccurs(derivedParticle.getMaxOccurs())
+ + ") is greater than than the maxOccurs for the base "
+ + printParticle(baseParticle)
+ + " (" + printMaxOccurs(baseParticle.getMaxOccurs()) + ")";
+ }
+
+ private static String formatOccurenceRangeMinErrorGroup(SchemaParticle baseParticle, SchemaParticle derivedParticle) {
+ return "Invalid Restriction. The minOccurs for the "
+ + printParticle(derivedParticle)
+ + " (" + derivedParticle.getMinOccurs().toString()
+ + ") is less than than the minOccurs for the base "
+ + printParticle(baseParticle)
+ + " (" + baseParticle.getMinOccurs().toString() + ")";
+ }
+
+ private static String formatOccurenceRangeMinError(SchemaParticle baseField, SchemaParticle derivedField) {
+ return "Invalid Restriction. The minOccurs for the element: '"
+ + printParticle(derivedField)
+ + "' (" + derivedField.getMinOccurs().toString()
+ + ") is less than than the minOccurs for the base element: '"
+ + printParticle(baseField)
+ + "' (" + baseField.getMinOccurs().toString() + ")";
+ }
+
+ private static String formatOccurenceRangeMaxError(SchemaParticle baseField, SchemaParticle derivedField) {
+ return "Invalid Restriction. The maxOccurs for the element: '"
+ + printParticle(derivedField)
+ + "' (" + printMaxOccurs(derivedField.getMaxOccurs())
+ + ") is greater than than the maxOccurs for the base element: '"
+ + printParticle(baseField) + "' (" + printMaxOccurs(baseField.getMaxOccurs()) + ")";
+ }
+
+ private static String printParticle(SchemaParticle part)
+ {
+ switch (part.getParticleType()) {
+ case SchemaParticle.ALL:
+ return "<all>";
+ case SchemaParticle.CHOICE:
+ return "<choice>";
+ case SchemaParticle.ELEMENT:
+ return "<element name=\"" + QNameHelper.pretty(part.getName()) + "\">";
+ case SchemaParticle.SEQUENCE:
+ return "<sequence>";
+ case SchemaParticle.WILDCARD:
+ return "<any>";
+ default :
+ return "??";
+ }
+ }
+
+ private static String printMaxOccurs(BigInteger bi)
+ {
+ if (bi == null)
+ return "unbounded";
+ return bi.toString();
+ }
+
+ private static String printType(SchemaType type)
+ {
+ if (type.getName() != null)
+ return QNameHelper.pretty(type.getName());
+ return type.toString();
+ }
+
+ private static void checkSubstitutionGroups(SchemaGlobalElement[] elts)
+ {
+ StscState state = StscState.get();
+
+ for (int i = 0 ; i < elts.length ; i++)
+ {
+ SchemaGlobalElement elt = elts[i];
+ SchemaGlobalElement head = elt.substitutionGroup();
+
+ if (head != null)
+ {
+ SchemaType headType = head.getType();
+ SchemaType tailType = elt.getType();
+ XmlObject parseTree = ((SchemaGlobalElementImpl)elt)._parseObject;
+
+ if (! headType.isAssignableFrom(tailType))
+ {
+ state.error("Element " + QNameHelper.pretty(elt.getName()) +
+ " must have a type that is derived from the type of its substitution group.",
+ XmlErrorContext.INCONSISTENT_TYPE, parseTree);
+
+ }
+ else if (head.finalExtension() && head.finalRestriction())
+ {
+ state.error("Element " + QNameHelper.pretty(elt.getName()) +
+ " cannot be substituted for element with final='#all'",
+ XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
+ }
+ else if (! headType.equals(tailType))
+ {
+ if (head.finalExtension() &&
+ tailType.getDerivationType() == SchemaType.DT_EXTENSION)
+ {
+ state.error("Element " + QNameHelper.pretty(elt.getName()) +
+ " cannot be substituted for element with final='extension'",
+ XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
+ }
+ else if (head.finalRestriction() &&
+ tailType.getDerivationType() == SchemaType.DT_RESTRICTION)
+ {
+ state.error("Element " + QNameHelper.pretty(elt.getName()) +
+ " cannot be substituted for element with final='restriction'",
+ XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree);
+ }
+ }
+ }
+
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
new file mode 100644
index 0000000..216c6d4
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscComplexTypeResolver.java
@@ -0,0 +1,1964 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.math.BigInteger;
+import java.util.*;
+import java.util.List;
+
+import org.w3.x2001.xmlSchema.*;
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.AnyDocument.Any;
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.QNameSetBuilder;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlNonNegativeInteger;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.QNameSetSpecification;
+
+public class StscComplexTypeResolver
+{
+ public static Group getContentModel(ComplexType parseCt)
+ {
+ if (parseCt.getAll() != null)
+ return parseCt.getAll();
+
+ if (parseCt.getSequence() != null)
+ return parseCt.getSequence();
+
+ if (parseCt.getChoice() != null)
+ return parseCt.getChoice();
+
+ if (parseCt.getGroup() != null)
+ return parseCt.getGroup();
+
+ return null;
+ }
+
+ public static Group getContentModel(ComplexRestrictionType parseRest)
+ {
+ if (parseRest.getAll() != null)
+ return parseRest.getAll();
+
+ if (parseRest.getSequence() != null)
+ return parseRest.getSequence();
+
+ if (parseRest.getChoice() != null)
+ return parseRest.getChoice();
+
+ if (parseRest.getGroup() != null)
+ return parseRest.getGroup();
+
+ return null;
+
+ }
+
+ public static Group getContentModel(ExtensionType parseExt)
+ {
+ if (parseExt.getAll() != null)
+ return parseExt.getAll();
+
+ if (parseExt.getSequence() != null)
+ return parseExt.getSequence();
+
+ if (parseExt.getChoice() != null)
+ return parseExt.getChoice();
+
+ if (parseExt.getGroup() != null)
+ return parseExt.getGroup();
+
+ return null;
+
+ }
+
+ private static Schema getSchema(XmlObject o)
+ {
+ XmlCursor c = o.newCursor();
+
+ try
+ {
+ while ( c.toParent() )
+ {
+ o = c.getObject();
+
+ if (o.schemaType().equals(Schema.type))
+ return (Schema) o;
+ }
+ }
+ finally
+ {
+ c.dispose();
+ }
+
+ return null;
+ }
+
+ public static void resolveComplexType(SchemaTypeImpl sImpl)
+ {
+ ComplexType parseCt = (ComplexType)sImpl.getParseObject();
+ StscState state = StscState.get();
+ Schema schema = getSchema(parseCt);
+
+ // Set abstract & final flags
+ boolean abs = parseCt.isSetAbstract() ? parseCt.getAbstract() : false;
+ boolean finalExt = false;
+ boolean finalRest = false;
+ boolean finalList = false;
+ boolean finalUnion = false;
+
+ Object ds = null;
+ if (parseCt.isSetFinal())
+ {
+ ds = parseCt.getFinal();
+ }
+ // Inspect the final default attribute on the schema
+ else if (schema != null && schema.isSetFinalDefault())
+ {
+ ds = schema.getFinalDefault();
+ }
+
+ if (ds != null)
+ {
+ if (ds instanceof String && ds.equals("#all"))
+ {
+ // #ALL value
+ finalExt = finalRest = finalList = finalUnion = true;
+ }
+ else if (ds instanceof List)
+ {
+ if (((List)ds).contains("extension"))
+ finalExt = true;
+
+ if (((List)ds).contains("restriction"))
+ finalRest = true;
+
+// Since complex types don't participate in list and unions, these can remain
+// false. Perhaps we should throw an error.
+
+// if (((List)ds).contains("list"))
+// finalList = true;
+//
+// if (((List)ds).contains("union"))
+// finalUnion = true;
+ }
+ }
+
+ sImpl.setAbstractFinal(abs, finalExt, finalRest, finalList, finalUnion);
+
+ // Set block flags
+ boolean blockExt = false;
+ boolean blockRest = false;
+ Object block = null;
+
+ if (parseCt.isSetBlock())
+ block = parseCt.getBlock();
+ else if (schema != null && schema.isSetBlockDefault())
+ block = schema.getBlockDefault();
+
+ if (block != null)
+ {
+ if (block instanceof String && block.equals("#all"))
+ {
+ // #ALL value
+ blockExt = blockRest = true;
+ }
+ else if (block instanceof List)
+ {
+ if (((List)block).contains("extension"))
+ blockExt = true;
+ if (((List)block).contains("restriction"))
+ blockRest = true;
+ }
+ }
+
+ sImpl.setBlock(blockExt, blockRest);
+
+ // Verify: have simpleContent, complexContent, or direct stuff
+ ComplexContentDocument.ComplexContent parseCc = parseCt.getComplexContent();
+ SimpleContentDocument.SimpleContent parseSc = parseCt.getSimpleContent();
+ Group parseGroup = getContentModel(parseCt);
+ int count =
+ (parseCc != null ? 1 : 0) +
+ (parseSc != null ? 1 : 0) +
+ (parseGroup != null ? 1 : 0);
+ if (count > 1)
+ {
+ state.error("A complex type must define either a content model, " +
+ "or a simpleContent or complexContent derivation: " +
+ "more than one found.",
+ XmlErrorContext.REDUNDANT_CONTENT_MODEL, parseCt);
+ // recovery: treat it as the first of complexContent, simpleContent, model
+ parseGroup = null;
+ if (parseCc != null && parseSc != null)
+ parseSc = null;
+ }
+
+ if (parseCc != null)
+ {
+ if (parseCc.getExtension() != null && parseCc.getRestriction() != null)
+ state.error("Restriction conflicts with extension", XmlErrorContext.REDUNDANT_CONTENT_MODEL, parseCc.getRestriction());
+
+ // Mixed can be specified in two places: the rules are that Cc wins over Ct if present
+ // http://www.w3.org/TR/xmlschema-1/#c-mve
+ boolean mixed = parseCc.isSetMixed() ? parseCc.getMixed() : parseCt.getMixed();
+
+ if (parseCc.getExtension() != null)
+ resolveCcExtension(sImpl, parseCc.getExtension(), mixed);
+ else if (parseCc.getRestriction() != null)
+ resolveCcRestriction(sImpl, parseCc.getRestriction(), mixed);
+ else
+ {
+ state.error("Missing restriction or extension", XmlErrorContext.MISSING_RESTRICTION_OR_EXTENSION, parseCc);
+ resolveErrorType(sImpl);
+ }
+ return;
+ }
+ else if (parseSc != null)
+ {
+ if (parseSc.getExtension() != null && parseSc.getRestriction() != null)
+ state.error("Restriction conflicts with extension", XmlErrorContext.REDUNDANT_CONTENT_MODEL, parseSc.getRestriction());
+
+ if (parseSc.getExtension() != null)
+ resolveScExtension(sImpl, parseSc.getExtension());
+ else if (parseSc.getRestriction() != null)
+ resolveScRestriction(sImpl, parseSc.getRestriction());
+ else
+ {
+ state.error("Missing restriction or extension", XmlErrorContext.MISSING_RESTRICTION_OR_EXTENSION, parseSc);
+ resolveErrorType(sImpl);
+ }
+ return;
+ }
+ else
+ resolveBasicComplexType(sImpl);
+ }
+
+ static void resolveErrorType(SchemaTypeImpl sImpl)
+ {
+ throw new RuntimeException("This type of error recovery not yet implemented.");
+ }
+
+ private static SchemaType.Ref[] makeRefArray(Collection typeList)
+ {
+ SchemaType.Ref[] result = new SchemaType.Ref[typeList.size()];
+ int j = 0;
+ for (Iterator i = typeList.iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType)i.next()).getRef();
+ return result;
+ }
+
+
+ static void resolveBasicComplexType(SchemaTypeImpl sImpl)
+ {
+ List anonymousTypes = new ArrayList();
+ ComplexType parseTree = (ComplexType)sImpl.getParseObject();
+ String targetNamespace = sImpl.getTargetNamespace();
+ boolean chameleon = (sImpl.getChameleonNamespace() != null);
+ Group parseGroup = getContentModel(parseTree);
+
+ if (sImpl.isRedefinition())
+ {
+ StscState.get().error("A type redefinition must extend or restrict the original definition of the type.", XmlErrorContext.GENERIC_ERROR, parseTree);
+ // recovery: oh well.
+ }
+
+ int particleCode = translateParticleCode(parseGroup);
+
+ // used to ensure consistency (doesn't become part of the result)
+ Map elementModel = new LinkedHashMap();
+
+ // build content model and anonymous types
+ SchemaParticle contentModel = translateContentModel(sImpl, parseGroup, targetNamespace, chameleon, particleCode, anonymousTypes, elementModel, false, null);
+
+ // detect the nonempty "all" case (empty <all> doesn't count - it needs to be eliminated to match XSD test cases)
+ boolean isAll = contentModel != null && contentModel.getParticleType() == SchemaParticle.ALL;
+
+ // build attr model and anonymous types
+ SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl();
+ translateAttributeModel(parseTree, targetNamespace, chameleon, anonymousTypes, sImpl, null, attrModel, null, true, null);
+
+ // summarize wildcard information
+ WildcardResult wcElt = summarizeEltWildcards(contentModel);
+ WildcardResult wcAttr = summarizeAttrWildcards(attrModel);
+
+ // build state machine and verify that content model is deterministic
+ if (contentModel != null)
+ {
+ buildStateMachine(contentModel);
+ if (!StscState.get().noUpa() && !((SchemaParticleImpl)contentModel).isDeterministic())
+ StscState.get().error("Content model violates the unique particle attribution rule", XmlErrorContext.NONDETERMINISTIC_MODEL, parseGroup);
+ }
+
+ // build property model
+ // emitDBG("Building content Model for " + sImpl);
+ Map elementPropertyModel = buildContentPropertyModelByQName(contentModel, sImpl);
+
+ // add attribute property model
+ Map attributePropertyModel = buildAttributePropertyModelByQName(attrModel, sImpl);
+
+ // figure out content type
+ int complexVariety =
+ parseTree.getMixed()
+ ? SchemaType.MIXED_CONTENT
+ : contentModel == null
+ ? SchemaType.EMPTY_CONTENT
+ : SchemaType.ELEMENT_CONTENT;
+
+ // now fill in the actual schema type implementation
+ sImpl.setBaseTypeRef(BuiltinSchemaTypeSystem.ST_ANY_TYPE.getRef());
+ sImpl.setBaseDepth(BuiltinSchemaTypeSystem.ST_ANY_TYPE.getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_EXTENSION);
+ sImpl.setComplexTypeVariety(complexVariety);
+ sImpl.setContentModel(contentModel, attrModel, elementPropertyModel, attributePropertyModel, isAll);
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonymousTypes));
+ sImpl.setWildcardSummary(wcElt.typedWildcards, wcElt.hasWildcards, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ }
+
+ static void resolveCcRestriction(SchemaTypeImpl sImpl, ComplexRestrictionType parseTree, boolean mixed)
+ {
+ StscState state = StscState.get();
+ String targetNamespace = sImpl.getTargetNamespace();
+ boolean chameleon = (sImpl.getChameleonNamespace() != null);
+
+ // BUGBUG: NOT YET REALLY IMPLEMENTED
+ // throw new RuntimeException("Not yet implemented.");
+
+ SchemaType baseType;
+ if (parseTree.getBase() == null)
+ {
+ state.error("A complexContent must define a base type", XmlErrorContext.MISSING_BASE, parseTree);
+ baseType = null; // recovery: no inheritance.
+ }
+ else
+ {
+ if (sImpl.isRedefinition())
+ {
+ baseType = state.findRedefinedGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace(), sImpl.getName());
+ if (baseType != null && !baseType.getName().equals(sImpl.getName()))
+ state.error("A type redefinition must extend the original type definition", XmlErrorContext.GENERIC_ERROR, parseTree);
+ }
+ else
+ {
+ baseType = state.findGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace());
+ }
+
+ if (baseType == null)
+ state.notFoundError(parseTree.getBase(), XmlErrorContext.TYPE_NOT_FOUND, parseTree.xgetBase());
+ }
+
+ if (baseType == null)
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_TYPE;
+
+ if (baseType != null && baseType.finalRestriction())
+ {
+ state.error("Cannot restrict a final type", XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree.xgetBase());
+ // recovery: just keep going
+ }
+
+ // Recursion
+ if (baseType != null)
+ {
+ if (!StscResolver.resolveType((SchemaTypeImpl)baseType))
+ baseType = null; // circular dependency: no inheritance
+ }
+
+ List anonymousTypes = new ArrayList();
+ Group parseEg = getContentModel(parseTree);
+
+ // detect the "all" case
+ int particleCode = translateParticleCode(parseEg);
+
+ // used to ensure consistency (doesn't become part of the result)
+ Map elementModel = new LinkedHashMap();
+
+ // build content model and anonymous types
+ SchemaParticle contentModel = translateContentModel(
+ sImpl, parseEg, targetNamespace, chameleon, particleCode, anonymousTypes, elementModel, false, null);
+
+ // detect the nonempty "all" case (empty <all> doesn't count - it needs to be eliminated to match XSD test cases)
+ boolean isAll = contentModel != null && contentModel.getParticleType() == SchemaParticle.ALL;
+
+ // build attr model and anonymous types
+ SchemaAttributeModelImpl attrModel;
+ if (baseType == null)
+ attrModel = new SchemaAttributeModelImpl();
+ else
+ attrModel = new SchemaAttributeModelImpl(baseType.getAttributeModel());
+ translateAttributeModel(parseTree, targetNamespace, chameleon, anonymousTypes, sImpl, null, attrModel, baseType, false, null);
+
+ // summarize wildcard information
+ WildcardResult wcElt = summarizeEltWildcards(contentModel);
+ WildcardResult wcAttr = summarizeAttrWildcards(attrModel);
+
+ // build state machine and verify that content model is deterministic
+ if (contentModel != null)
+ {
+ buildStateMachine(contentModel);
+ if (!StscState.get().noUpa() && !((SchemaParticleImpl)contentModel).isDeterministic())
+ StscState.get().error("Content model violates the unique particle attribution rule", XmlErrorContext.NONDETERMINISTIC_MODEL, parseEg);
+ }
+
+ // build property model
+ // emitDBG("Building content Model for " + sImpl);
+ Map elementPropertyModel = buildContentPropertyModelByQName(contentModel, sImpl);
+
+ // add attribute property model
+ Map attributePropertyModel = buildAttributePropertyModelByQName(attrModel, sImpl);
+
+ // compute empty/element/mixed
+ int complexVariety = (contentModel == null ? SchemaType.EMPTY_CONTENT :
+ (mixed ? SchemaType.MIXED_CONTENT : SchemaType.ELEMENT_CONTENT));
+
+ // now fill in the actual schema type implementation
+ sImpl.setBaseTypeRef(baseType.getRef());
+ sImpl.setBaseDepth(((SchemaTypeImpl)baseType).getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_RESTRICTION);
+ sImpl.setComplexTypeVariety(complexVariety);
+ sImpl.setContentModel(contentModel, attrModel, elementPropertyModel, attributePropertyModel, isAll);
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonymousTypes));
+ sImpl.setWildcardSummary(wcElt.typedWildcards, wcElt.hasWildcards, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ }
+
+ static Map extractElementModel(SchemaType sType)
+ {
+ Map elementModel = new HashMap();
+ if (sType != null)
+ {
+ SchemaProperty[] sProps = sType.getProperties();
+ for (int i = 0; i < sProps.length; i++)
+ {
+ if (sProps[i].isAttribute())
+ continue;
+ elementModel.put(sProps[i].getName(),
+ sProps[i].getType());
+ }
+ }
+ return elementModel;
+ }
+
+ static void resolveCcExtension(SchemaTypeImpl sImpl, ExtensionType parseTree, boolean mixed)
+ {
+ SchemaType baseType;
+ StscState state = StscState.get();
+ String targetNamespace = sImpl.getTargetNamespace();
+ boolean chameleon = (sImpl.getChameleonNamespace() != null);
+
+ if (parseTree.getBase() == null)
+ {
+ state.error("A complexContent must define a base type", XmlErrorContext.MISSING_BASE, parseTree);
+ baseType = null; // recovery: no inheritance.
+ }
+ else
+ {
+ if (sImpl.isRedefinition())
+ {
+ baseType = state.findRedefinedGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace(), sImpl.getName());
+ if (baseType != null && !baseType.getName().equals(sImpl.getName()))
+ state.error("A type redefinition must extend the original type definition", XmlErrorContext.GENERIC_ERROR, parseTree);
+ }
+ else
+ {
+ baseType = state.findGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace());
+ }
+ if (baseType == null)
+ state.notFoundError(parseTree.getBase(), XmlErrorContext.TYPE_NOT_FOUND, parseTree.xgetBase());
+ }
+
+ // Recursion
+ if (baseType != null)
+ {
+ if (!StscResolver.resolveType((SchemaTypeImpl)baseType))
+ baseType = null; // circular dependency: no inheritance
+ }
+
+ if (baseType != null && (baseType.isSimpleType() || baseType.getContentType() == SchemaType.SIMPLE_CONTENT))
+ {
+ state.error("The specified base type is not a complex type with complex content.", XmlErrorContext.COMPLEX_BASE_NOT_COMPLEX, parseTree.xgetBase());
+ baseType = null; // recovery: no inheritance.
+ }
+
+ if (baseType != null && baseType.finalExtension())
+ {
+ state.error("Cannot extend a final type", XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree.xgetBase());
+ // recovery: just keep going
+ }
+
+ // get base content model
+ SchemaParticle baseContentModel = (baseType == null ? null : baseType.getContentModel());
+ // TODO: attribute model also
+
+ List anonymousTypes = new ArrayList();
+ Map baseElementModel = extractElementModel(baseType);
+ Group parseEg = getContentModel(parseTree);
+
+ // build extension model
+ SchemaParticle extensionModel = translateContentModel(
+ sImpl, parseEg, targetNamespace, chameleon, translateParticleCode(parseEg),
+ anonymousTypes, baseElementModel, false, null);
+
+ // apply rule #2 near http://www.w3.org/TR/xmlschema-1/#c-mve: empty ext model -> mixed taken from base
+ if (extensionModel == null && !mixed)
+ mixed = (baseType.getContentType() == SchemaType.MIXED_CONTENT);
+
+ // apply Derivation Valid (Extension) rule 1.4.2.2
+ if (baseType != null && (baseType.getContentType() != SchemaType.EMPTY_CONTENT) &&
+ ((baseType.getContentType() == SchemaType.MIXED_CONTENT) != mixed))
+ {
+ state.error("Cannot extend an element-only type with a mixed type or vice-versa", XmlErrorContext.INCONSISTENT_TYPE, parseTree.xgetBase());
+ // recovery: just keep going
+ }
+
+ // detect the "all" base case
+ if (baseType != null && baseType.hasAllContent() && extensionModel != null)
+ {
+ state.error("Cannot extend a type with 'all' content model", XmlErrorContext.CANNOT_EXTEND_ALL, parseTree.xgetBase());
+ extensionModel = null; // recovery: drop extension
+ }
+
+ // build content model and anonymous types
+ SchemaParticle contentModel = extendContentModel(baseContentModel, extensionModel, parseTree);
+
+ // detect the nonempty "all" case (empty <all> doesn't count - it needs to be eliminated to match XSD test cases)
+ boolean isAll = contentModel != null && contentModel.getParticleType() == SchemaParticle.ALL;
+
+ // build attr model and anonymous types
+ SchemaAttributeModelImpl attrModel;
+ if (baseType == null)
+ attrModel = new SchemaAttributeModelImpl();
+ else
+ attrModel = new SchemaAttributeModelImpl(baseType.getAttributeModel());
+ translateAttributeModel(parseTree, targetNamespace, chameleon, anonymousTypes, sImpl, null, attrModel, baseType, true, null);
+
+ // summarize wildcard information
+ WildcardResult wcElt = summarizeEltWildcards(contentModel);
+ WildcardResult wcAttr = summarizeAttrWildcards(attrModel);
+
+ // build state machine and verify that content model is deterministic
+ if (contentModel != null)
+ {
+ buildStateMachine(contentModel);
+ if (!StscState.get().noUpa() && !((SchemaParticleImpl)contentModel).isDeterministic())
+ StscState.get().error("Content model violates the unique particle attribution rule", XmlErrorContext.NONDETERMINISTIC_MODEL, parseEg);
+ }
+
+ // build property model
+ // emitDBG("Building content Model for " + sImpl);
+ Map elementPropertyModel = buildContentPropertyModelByQName(contentModel, sImpl);
+
+ // add attribute property model
+ Map attributePropertyModel = buildAttributePropertyModelByQName(attrModel, sImpl);
+
+ // compute empty/element/mixed
+ int complexVariety = ( mixed ? SchemaType.MIXED_CONTENT :
+ (contentModel == null ? SchemaType.EMPTY_CONTENT : SchemaType.ELEMENT_CONTENT));
+
+ // now fill in the actual schema type implementation
+ if (baseType == null)
+ baseType = XmlObject.type;
+ sImpl.setBaseTypeRef(baseType.getRef());
+ sImpl.setBaseDepth(((SchemaTypeImpl)baseType).getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_EXTENSION);
+ sImpl.setComplexTypeVariety(complexVariety);
+ sImpl.setContentModel(contentModel, attrModel, elementPropertyModel, attributePropertyModel, isAll);
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonymousTypes));
+ sImpl.setWildcardSummary(wcElt.typedWildcards, wcElt.hasWildcards, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ }
+
+ static void resolveScRestriction(SchemaTypeImpl sImpl, SimpleRestrictionType parseTree)
+ {
+ SchemaType baseType;
+ StscState state = StscState.get();
+ String targetNamespace = sImpl.getTargetNamespace();
+ boolean chameleon = (sImpl.getChameleonNamespace() != null);
+ if (parseTree.getSimpleType() != null)
+ {
+ state.warning("Nested simple types inside simple content restrictions are unsupported - ignoring", XmlErrorContext.ILLEGAL_RESTRICTION, parseTree);
+ // recovery: ignore the nested simple type element.
+ }
+ if (parseTree.getBase() == null)
+ {
+ state.error("A simpleContent restriction must define a base type", XmlErrorContext.MISSING_BASE, parseTree);
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ else
+ {
+ if (sImpl.isRedefinition())
+ {
+ baseType = state.findRedefinedGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace(), sImpl.getName());
+ if (baseType != null && !baseType.getName().equals(sImpl.getName()))
+ state.error("A type redefinition must restrict the original type definition", XmlErrorContext.GENERIC_ERROR, parseTree);
+ }
+ else
+ {
+ baseType = state.findGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace());
+ }
+ if (baseType == null)
+ {
+ state.notFoundError(parseTree.getBase(), XmlErrorContext.TYPE_NOT_FOUND, parseTree.xgetBase());
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ }
+
+ // Recursion
+ StscResolver.resolveType((SchemaTypeImpl)baseType);
+
+ if (baseType.isSimpleType())
+ {
+ state.error("Simple type '" + baseType.getName() + "' cannot be used as the base type of a simple content restriction. (Use extension instead.)", XmlErrorContext.SIMPLE_BASE_NOT_SIMPLE, parseTree);
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ // BUGBUG: can restrict mixed content as long as all child elements are optional
+ else if (baseType.getContentType() != SchemaType.SIMPLE_CONTENT)
+ {
+ state.error("The specified base type " + baseType.toString() + " does not have simple content.", XmlErrorContext.SIMPLE_BASE_NOT_SIMPLE, parseTree);
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ if (baseType != null && baseType.finalRestriction())
+ {
+ state.error("Cannot restrict a final type", XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree.xgetBase());
+ // recovery: just keep going
+ }
+
+ // build attr model and anonymous types
+ List anonymousTypes = new ArrayList();
+ SchemaAttributeModelImpl attrModel;
+ if (baseType == null)
+ attrModel = new SchemaAttributeModelImpl();
+ else
+ attrModel = new SchemaAttributeModelImpl(baseType.getAttributeModel());
+ translateAttributeModel(parseTree, targetNamespace, chameleon, anonymousTypes, sImpl, null, attrModel, baseType, false, null);
+
+ // summarize wildcard information
+ WildcardResult wcAttr = summarizeAttrWildcards(attrModel);
+
+ // add attribute property model
+ Map attributePropertyModel = buildAttributePropertyModelByQName(attrModel, sImpl);
+
+ // now fill in the actual schema type implementation
+ sImpl.setBaseTypeRef(baseType.getRef());
+ sImpl.setBaseDepth(((SchemaTypeImpl)baseType).getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_RESTRICTION);
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonymousTypes));
+ sImpl.setWildcardSummary(QNameSet.EMPTY, false, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ sImpl.setComplexTypeVariety(SchemaType.SIMPLE_CONTENT);
+ sImpl.setContentModel(null, attrModel, null, attributePropertyModel, false);
+ sImpl.setSimpleTypeVariety(baseType.getSimpleVariety());
+ sImpl.setPrimitiveTypeRef(baseType.getPrimitiveType() == null ? null : baseType.getPrimitiveType().getRef());
+ switch (sImpl.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ sImpl.setListItemTypeRef(baseType.getListItemType().getRef());
+ break;
+
+ case SchemaType.UNION:
+ sImpl.setUnionMemberTypeRefs(makeRefArray(Arrays.asList(baseType.getUnionMemberTypes())));
+ break;
+ }
+
+ // deal with facets
+ StscSimpleTypeResolver.resolveFacets(sImpl, parseTree, (SchemaTypeImpl)baseType);
+
+ // now compute our intrinsic properties
+ StscSimpleTypeResolver.resolveFundamentalFacets(sImpl);
+ }
+
+ static void resolveScExtension(SchemaTypeImpl sImpl, SimpleExtensionType parseTree)
+ {
+ SchemaType baseType;
+ StscState state = StscState.get();
+ String targetNamespace = sImpl.getTargetNamespace();
+ boolean chameleon = (sImpl.getChameleonNamespace() != null);
+ if (parseTree.getBase() == null)
+ {
+ state.error("A simpleContent extension must define a base type", XmlErrorContext.MISSING_BASE, parseTree);
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ else
+ {
+ if (sImpl.isRedefinition())
+ {
+ baseType = state.findRedefinedGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace(), sImpl.getName());
+ if (baseType != null && !baseType.getName().equals(sImpl.getName()))
+ state.error("A type redefinition must extend the original type definition", XmlErrorContext.GENERIC_ERROR, parseTree);
+ }
+ else
+ {
+ baseType = state.findGlobalType(parseTree.getBase(), sImpl.getChameleonNamespace());
+ }
+ if (baseType == null)
+ {
+ state.notFoundError(parseTree.getBase(), XmlErrorContext.TYPE_NOT_FOUND, parseTree.xgetBase());
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ }
+
+ // Recursion
+ StscResolver.resolveType((SchemaTypeImpl)baseType);
+
+ if (!baseType.isSimpleType() && baseType.getContentType() != SchemaType.SIMPLE_CONTENT)
+ {
+ state.error("The specified base type " + baseType.toString() + " does not have simple content.", XmlErrorContext.SIMPLE_BASE_NOT_SIMPLE, parseTree);
+ // recovery: extends ANY_SIMPLE type
+ baseType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ if (baseType != null && baseType.finalExtension())
+ {
+ state.error("Cannot extend a final type", XmlErrorContext.CANNOT_DERIVE_FINAL, parseTree.xgetBase());
+ // recovery: just keep going
+ }
+
+ // build attr model and anonymous types
+ List anonymousTypes = new ArrayList();
+ SchemaAttributeModelImpl attrModel;
+ attrModel = new SchemaAttributeModelImpl(baseType.getAttributeModel());
+ translateAttributeModel(parseTree, targetNamespace, chameleon, anonymousTypes, sImpl, null, attrModel, baseType, true, null);
+
+ // summarize wildcard information
+ WildcardResult wcAttr = summarizeAttrWildcards(attrModel);
+
+ // add attribute property model
+ Map attributePropertyModel = buildAttributePropertyModelByQName(attrModel, sImpl);
+
+ // now fill in the actual schema type implementation
+ sImpl.setBaseTypeRef(baseType.getRef());
+ sImpl.setBaseDepth(((SchemaTypeImpl)baseType).getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_EXTENSION);
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonymousTypes));
+ sImpl.setWildcardSummary(QNameSet.EMPTY, false, wcAttr.typedWildcards, wcAttr.hasWildcards);
+ sImpl.setComplexTypeVariety(SchemaType.SIMPLE_CONTENT);
+ sImpl.setContentModel(null, attrModel, null, attributePropertyModel, false);
+ sImpl.setSimpleTypeVariety(baseType.getSimpleVariety());
+ sImpl.setPrimitiveTypeRef(baseType.getPrimitiveType() == null ? null : baseType.getPrimitiveType().getRef());
+ switch (sImpl.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ sImpl.setListItemTypeRef(baseType.getListItemType().getRef());
+ break;
+
+ case SchemaType.UNION:
+ sImpl.setUnionMemberTypeRefs(makeRefArray(Arrays.asList(baseType.getUnionMemberTypes())));
+ break;
+ }
+
+ // deal with facets
+ StscSimpleTypeResolver.resolveFacets(sImpl, null, (SchemaTypeImpl)baseType);
+
+ // now compute our intrinsic properties
+ StscSimpleTypeResolver.resolveFundamentalFacets(sImpl);
+ }
+
+ static class WildcardResult
+ {
+ WildcardResult(QNameSet typedWildcards, boolean hasWildcards)
+ {
+ this.typedWildcards = typedWildcards;
+ this.hasWildcards = hasWildcards;
+ }
+ QNameSet typedWildcards;
+ boolean hasWildcards;
+ }
+
+ static WildcardResult summarizeAttrWildcards(SchemaAttributeModel attrModel)
+ {
+ if (attrModel.getWildcardProcess() == SchemaAttributeModel.NONE)
+ return new WildcardResult(QNameSet.EMPTY, false);
+ if (attrModel.getWildcardProcess() == SchemaAttributeModel.SKIP)
+ return new WildcardResult(QNameSet.EMPTY, true);
+ return new WildcardResult(attrModel.getWildcardSet(), true);
+ }
+
+ static WildcardResult summarizeEltWildcards(SchemaParticle contentModel)
+ {
+ if (contentModel == null)
+ {
+ return new WildcardResult(QNameSet.EMPTY, false);
+ }
+
+ switch (contentModel.getParticleType())
+ {
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ QNameSetBuilder set = new QNameSetBuilder();
+ boolean hasWildcards = false;
+ for (int i = 0; i < contentModel.countOfParticleChild(); i++)
+ {
+ WildcardResult inner = summarizeEltWildcards(contentModel.getParticleChild(i));
+ set.addAll(inner.typedWildcards);
+ hasWildcards |= inner.hasWildcards;
+ }
+ return new WildcardResult(set.toQNameSet(), hasWildcards);
+ case SchemaParticle.WILDCARD:
+ return new WildcardResult(
+ (contentModel.getWildcardProcess() == SchemaParticle.SKIP) ?
+ QNameSet.EMPTY : contentModel.getWildcardSet(), true);
+ // otherwise fallthrough
+
+ default:
+ return new WildcardResult(QNameSet.EMPTY, false);
+ }
+ }
+
+ static void translateAttributeModel(
+ XmlObject parseTree, String targetNamespace, boolean chameleon,
+ List anonymousTypes, SchemaType outerType,
+ Set seenAttributes, SchemaAttributeModelImpl result, SchemaType baseType, boolean extension, QName redefinitionFor)
+ {
+ StscState state = StscState.get();
+ if (seenAttributes == null)
+ seenAttributes = new HashSet();
+ boolean seenWildcard = false;
+ boolean seenRedefinition = false;
+ SchemaAttributeModel baseModel = null;
+ if (baseType != null)
+ baseModel = baseType.getAttributeModel();
+
+ XmlCursor cur = parseTree.newCursor();
+
+ for (boolean more = cur.toFirstChild(); more; more = cur.toNextSibling())
+ {
+ switch (translateAttributeCode(cur.getName()))
+ {
+ case ATTRIBUTE_CODE:
+ {
+ Attribute xsdattr = (Attribute)cur.getObject();
+
+ SchemaLocalAttribute sAttr = StscTranslator.translateAttribute(xsdattr, targetNamespace, chameleon, anonymousTypes, outerType, baseModel, true);
+ if (sAttr == null)
+ continue;
+
+ if (seenAttributes.contains(sAttr.getName()))
+ {
+ state.error("Attribute with the same name already defined ", XmlErrorContext.DUPLICATE_ATTRIBUTE_NAME, xsdattr.xgetName());
+ continue; // ignore the duplicate attr
+ }
+
+ seenAttributes.add(sAttr.getName());
+
+ if (baseModel != null)
+ {
+ SchemaLocalAttribute baseAttr = baseModel.getAttribute(sAttr.getName());
+ if (baseAttr == null)
+ {
+ if (!extension)
+ {
+ if (!baseModel.getWildcardSet().contains(sAttr.getName()))
+ state.error("A restriction cannot introduce a new attribute that would not be allowed in the base type.", XmlErrorContext.DUPLICATE_ATTRIBUTE_NAME, xsdattr);
+ }
+ }
+ else
+ {
+ if (extension)
+ {
+ if (sAttr.getUse() == SchemaLocalAttribute.PROHIBITED)
+ state.error("An extension cannot prohibit an attribute from the base type; use restriction instead.", XmlErrorContext.DUPLICATE_ATTRIBUTE_NAME, xsdattr.xgetUse());
+ }
+ else
+ {
+ if (sAttr.getUse() != SchemaLocalAttribute.REQUIRED)
+ {
+ if (baseAttr.getUse() == SchemaLocalAttribute.REQUIRED)
+ state.error("A restriction cannot modify an attribute that is required in the base type to be prohibited or optional.", XmlErrorContext.DUPLICATE_ATTRIBUTE_NAME, xsdattr);
+
+ if (sAttr.getUse() == SchemaLocalAttribute.PROHIBITED)
+ result.removeProhibitedAttribute(sAttr.getName());
+ }
+ }
+ }
+ }
+
+ if (sAttr.getUse() != SchemaLocalAttribute.PROHIBITED)
+ result.addAttribute(sAttr);
+
+ if (sAttr.getDefaultText() != null && !sAttr.isFixed())
+ {
+ if (sAttr.getUse() != SchemaLocalAttribute.OPTIONAL)
+ state.error("An attribute declaration must be optional in order to specify a default", XmlErrorContext.GENERIC_ERROR, xsdattr);
+ }
+
+
+ break;
+ }
+ case ANY_ATTRIBUTE_CODE:
+ {
+ Wildcard xsdwc = (Wildcard)cur.getObject();
+ if (seenWildcard)
+ {
+ state.error("Only one attribute wildcard allowed", XmlErrorContext.DUPLICATE_ANY_ATTRIBUTE, xsdwc);
+ continue; // ignore the extra wildcard
+ }
+ seenWildcard = true;
+ NamespaceList nsList = xsdwc.xgetNamespace();
+ String nsText;
+ if (nsList == null)
+ nsText = "##any";
+ else
+ nsText = nsList.getStringValue();
+ QNameSet wcset = QNameSet.forWildcardNamespaceString(nsText, targetNamespace);
+
+ if (baseModel != null && !extension)
+ {
+ if (baseModel.getWildcardSet() == null)
+ {
+ state.error("A restriction cannot add anyAttribute when the base type does not have anyAttribute", XmlErrorContext.DUPLICATE_ANY_ATTRIBUTE, xsdwc);
+ continue; // ignore the extra wildcard
+ }
+ else if (!baseModel.getWildcardSet().containsAll(wcset))
+ {
+ state.error("The anyAttribute namespace='" + nsText + "' is not a subset of the base type anyAttribute", XmlErrorContext.DUPLICATE_ANY_ATTRIBUTE, xsdwc);
+ continue; // ignore the restriction
+ }
+ }
+
+ int wcprocess = translateWildcardProcess(xsdwc.xgetProcessContents());
+ if (result.getWildcardProcess() == SchemaAttributeModel.NONE)
+ {
+ result.setWildcardSet(wcset);
+ result.setWildcardProcess(wcprocess);
+ }
+ else
+ {
+ if (extension)
+ {
+ result.setWildcardSet(wcset.union(result.getWildcardSet()));
+ result.setWildcardProcess(wcprocess);
+ }
+ else
+ {
+ result.setWildcardSet(wcset.intersect(result.getWildcardSet()));
+ // keep old process
+ }
+ }
+ break;
+ }
+ case ATTRIBUTE_GROUP_CODE:
+ {
+ AttributeGroupRef xsdag = (AttributeGroupRef)cur.getObject();
+ QName ref = xsdag.getRef();
+ if (ref == null)
+ {
+ state.error("Attribute group reference must have a ref attribute", XmlErrorContext.ATTRIBUTE_GROUP_MISSING_REF, xsdag);
+ continue;
+ }
+ SchemaAttributeGroupImpl group;
+ if (redefinitionFor != null)
+ {
+ group = state.findRedefinedAttributeGroup(ref, chameleon ? targetNamespace : null, redefinitionFor);
+ if (group != null && redefinitionFor.equals(group.getName()))
+ {
+ if (seenRedefinition)
+ state.error("An attribute group redefinition must include at most one reference to the original definition.", XmlErrorContext.GENERIC_ERROR, xsdag);
+ seenRedefinition = true;
+ }
+ }
+ else
+ {
+ group = state.findAttributeGroup(ref, chameleon ? targetNamespace : null);
+ }
+ if (group == null)
+ {
+ state.notFoundError(ref, XmlErrorContext.ATTRIBUTE_GROUP_NOT_FOUND, xsdag.xgetRef());
+ continue;
+ }
+ if (state.isProcessing(group))
+ {
+ state.error("Attribute group " + QNameHelper.pretty(group.getName()) + " references itself", XmlErrorContext.CYCLIC_DEPENDENCY, group.getParseObject());
+ continue;
+ }
+ String subTargetNamespace = targetNamespace;
+ if (group.getTargetNamespace() != null)
+ {
+ subTargetNamespace = group.getTargetNamespace();
+ chameleon = group.getChameleonNamespace() != null;
+ }
+
+ state.startProcessing(group);
+ QName nestedRedefinitionFor = null;
+ if (group.isRedefinition())
+ nestedRedefinitionFor = group.getName();
+ translateAttributeModel(group.getParseObject(), subTargetNamespace, chameleon, anonymousTypes, outerType, seenAttributes, result, baseType, extension, nestedRedefinitionFor);
+ state.finishProcessing(group);
+ break;
+ }
+ default:
+ {
+ continue; // skip things that are not part of the attribute model.
+ }
+ }
+ }
+ }
+
+ static SchemaParticle extendContentModel(SchemaParticle baseContentModel, SchemaParticle extendedContentModel, XmlObject parseTree)
+ {
+ // http://www.w3.org/TR/xmlschema-1/#element-complexContent::extension
+
+ // 2.1 If the ·explicit content· is empty, then the {content type} of the type definition ·resolved· to by the ·actual value· of the base [attribute]
+ if (extendedContentModel == null)
+ return baseContentModel;
+
+ // 2.2 If the type definition ·resolved· to by the ·actual value· of the base [attribute] has a {content type} of empty, then a pair of mixed or elementOnly (determined as per clause 1.2.1 above) and the ·explicit content· itself;
+ if (baseContentModel == null)
+ return extendedContentModel;
+
+ // 2.3 otherwise a pair of mixed or elementOnly (determined as per clause 1.2.1 above) and a particle whose properties are as follows:
+ SchemaParticleImpl sPart = new SchemaParticleImpl();
+ sPart.setParticleType(SchemaParticle.SEQUENCE);
+
+ List accumulate = new ArrayList();
+ addMinusPointlessParticles(accumulate, baseContentModel, SchemaParticle.SEQUENCE);
+ addMinusPointlessParticles(accumulate, extendedContentModel, SchemaParticle.SEQUENCE);
+ sPart.setMinOccurs(BigInteger.ONE);
+ sPart.setMaxOccurs(BigInteger.ONE);
+ sPart.setParticleChildren((SchemaParticle[])
+ accumulate.toArray(new SchemaParticle[accumulate.size()]));
+
+ return filterPointlessParticlesAndVerifyAllParticles(sPart, parseTree);
+ }
+
+ static BigInteger extractMinOccurs(XmlNonNegativeInteger nni)
+ {
+ if (nni == null)
+ return BigInteger.ONE;
+ BigInteger result = nni.getBigIntegerValue();
+ if (result == null)
+ return BigInteger.ONE;
+ return result;
+ }
+
+ static BigInteger extractMaxOccurs(AllNNI allNNI)
+ {
+ if (allNNI == null)
+ return BigInteger.ONE;
+
+ if (allNNI.instanceType().getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL)
+ return ((XmlInteger)allNNI).getBigIntegerValue();
+ else
+ return null;
+ }
+
+ private static class RedefinitionForGroup
+ {
+ private QName groupName;
+ private boolean seenRedefinition = false;
+
+ public RedefinitionForGroup(QName groupName)
+ {
+ this.groupName = groupName;
+ }
+
+ public QName getGroupName()
+ {
+ return groupName;
+ }
+
+ public boolean isSeenRedefinition()
+ {
+ return seenRedefinition;
+ }
+
+ public void setSeenRedefinition(boolean seenRedefinition)
+ {
+ this.seenRedefinition = seenRedefinition;
+ }
+ }
+
+ static SchemaParticle translateContentModel(
+ SchemaType outerType,
+ XmlObject parseTree, String targetNamespace, boolean chameleon,
+ int particleCode,
+ List anonymousTypes, Map elementModel,
+ boolean allowElt, RedefinitionForGroup redefinitionFor)
+ {
+ if (parseTree == null || particleCode == 0)
+ return null;
+
+ StscState state = StscState.get();
+
+ // emitDBG("Translating content model for " + outerType);
+ // indentDBG();
+ assert(particleCode != 0);
+
+ boolean hasChildren = false;
+ BigInteger minOccurs;
+ BigInteger maxOccurs;
+ SchemaModelGroupImpl group = null;
+
+ SchemaParticleImpl sPart;
+
+ if (particleCode == SchemaParticle.ELEMENT)
+ {
+ if (!allowElt)
+ state.error("Must be a sequence, choice or all here", XmlErrorContext.EXPLICIT_GROUP_NEEDED, parseTree);
+
+ // TODO: detect substitution group for this element and construct a choice
+
+ LocalElement parseElt = (LocalElement)parseTree;
+ sPart = StscTranslator.translateElement(parseElt, targetNamespace, chameleon, anonymousTypes, outerType);
+ if (sPart == null)
+ return null;
+ minOccurs = extractMinOccurs(parseElt.xgetMinOccurs());
+ maxOccurs = extractMaxOccurs(parseElt.xgetMaxOccurs());
+
+ SchemaType oldType = (SchemaType)elementModel.get(sPart.getName());
+ if (oldType == null)
+ {
+ elementModel.put(sPart.getName(), sPart.getType());
+ }
+ else if (!sPart.getType().equals(oldType))
+ {
+ state.error("Type of " + QNameHelper.pretty(sPart.getName()) + " is inconsistent with another element with the same name in this content model", XmlErrorContext.INCONSISTENT_TYPE, parseTree);
+ return null;
+ }
+ }
+ else if (particleCode == SchemaParticle.WILDCARD)
+ {
+ if (!allowElt)
+ state.error("Must be a sequence, choice or all here", XmlErrorContext.EXPLICIT_GROUP_NEEDED, parseTree);
+ Any parseAny = (Any)parseTree;
+ sPart = new SchemaParticleImpl();
+ sPart.setParticleType(SchemaParticle.WILDCARD);
+ QNameSet wcset;
+ NamespaceList nslist = parseAny.xgetNamespace();
+ if (nslist == null)
+ wcset = QNameSet.ALL;
+ else
+ wcset = QNameSet.forWildcardNamespaceString(nslist.getStringValue(), targetNamespace);
+ sPart.setWildcardSet(wcset);
+ sPart.setWildcardProcess(translateWildcardProcess(parseAny.xgetProcessContents()));
+ minOccurs = extractMinOccurs(parseAny.xgetMinOccurs());
+ maxOccurs = extractMaxOccurs(parseAny.xgetMaxOccurs());
+ }
+ else
+ {
+ Group parseGroup = (Group)parseTree;
+ sPart = new SchemaParticleImpl();
+
+ // grab min/maxOccurs before dereferencign group ref
+ minOccurs = extractMinOccurs(parseGroup.xgetMinOccurs());
+ maxOccurs = extractMaxOccurs(parseGroup.xgetMaxOccurs());
+
+ if (particleCode == MODEL_GROUP_CODE)
+ {
+ QName ref = parseGroup.getRef();
+ if (ref == null)
+ {
+ state.error("Group reference must have a ref attribute", XmlErrorContext.GROUP_MISSING_REF, parseTree);
+ return null;
+ }
+
+ if (redefinitionFor != null)
+ {
+ group = state.findRedefinedModelGroup(ref, chameleon ? targetNamespace : null, redefinitionFor.getGroupName());
+ if (group != null && group.getName().equals(redefinitionFor.getGroupName()))
+ {
+ if (redefinitionFor.isSeenRedefinition())
+ state.error("Group redefinition must refer to the original definition at most once", XmlErrorContext.GENERIC_ERROR, parseTree);
+ if (!BigInteger.ONE.equals(maxOccurs) || !BigInteger.ONE.equals(minOccurs))
+ state.error("When referencing the original group definition in a redefinition, maxOccurs and minOccurs must be 1", XmlErrorContext.GENERIC_ERROR, parseTree);
+ redefinitionFor.setSeenRedefinition(true);
+ }
+ }
+ else
+ {
+ group = state.findModelGroup(ref, chameleon ? targetNamespace : null);
+ }
+ if (group == null)
+ {
+ state.notFoundError(ref, XmlErrorContext.MODEL_GROUP_NOT_FOUND, ((Group)parseTree).xgetRef());
+ return null;
+ }
+ if (state.isProcessing(group))
+ {
+ state.error("Model group " + QNameHelper.pretty(group.getName()) + " references itself", XmlErrorContext.CYCLIC_DEPENDENCY, group.getParseObject());
+ return null;
+ }
+
+ // no go to the child.
+ XmlCursor cur = group.getParseObject().newCursor();
+ for (boolean more = cur.toFirstChild(); more; more = cur.toNextSibling())
+ {
+ particleCode = translateParticleCode(cur.getName());
+ if (particleCode != 0)
+ {
+ parseTree = parseGroup = (Group)cur.getObject();
+ break;
+ }
+ }
+ if (particleCode == 0)
+ {
+ state.error("Model group " + QNameHelper.pretty(group.getName()) + " is empty", XmlErrorContext.EXPLICIT_GROUP_NEEDED, group.getParseObject());
+ return null;
+ }
+ if (particleCode != SchemaParticle.ALL && particleCode != SchemaParticle.SEQUENCE && particleCode != SchemaParticle.CHOICE)
+ {
+ state.error("Model group " + QNameHelper.pretty(group.getName()) + " is not a sequence, all, or choice", XmlErrorContext.EXPLICIT_GROUP_NEEDED, group.getParseObject());
+ }
+
+ String newTargetNamespace = group.getTargetNamespace();
+ if (newTargetNamespace != null)
+ targetNamespace = newTargetNamespace;
+ }
+
+ switch (particleCode)
+ {
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ sPart.setParticleType(particleCode);
+ hasChildren = true;
+ break;
+
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+ }
+
+ if (maxOccurs != null && minOccurs.compareTo(maxOccurs) > 0)
+ {
+ state.error("maxOccurs must not be less than minOccurs", XmlErrorContext.MIN_MAX_OCCURS, parseTree);
+ maxOccurs = minOccurs; // remedy: pin max up to min
+ }
+
+ if (maxOccurs != null && maxOccurs.compareTo(BigInteger.ONE) < 0)
+ {
+ // remove from list of anonymous types if it was added
+ anonymousTypes.remove(sPart.getType());
+ return null; // maxOccurs == minOccurs == 0, same as no particle at all.
+ }
+
+ sPart.setMinOccurs(minOccurs);
+ sPart.setMaxOccurs(maxOccurs);
+
+ if (group != null)
+ {
+ state.startProcessing(group);
+ redefinitionFor = null;
+ if (group.isRedefinition())
+ redefinitionFor = new RedefinitionForGroup(group.getName());
+ }
+
+ if (hasChildren)
+ {
+ XmlCursor cur = parseTree.newCursor();
+ List accumulate = new ArrayList();
+ for (boolean more = cur.toFirstChild(); more; more = cur.toNextSibling())
+ {
+ int code = translateParticleCode(cur.getName());
+ if (code == 0)
+ continue;
+ addMinusPointlessParticles(accumulate,
+ translateContentModel(outerType,
+ cur.getObject(), targetNamespace, chameleon, code,
+ anonymousTypes, elementModel, true, redefinitionFor),
+ sPart.getParticleType());
+ }
+ sPart.setParticleChildren((SchemaParticle[])
+ accumulate.toArray(new SchemaParticle[accumulate.size()]));
+ cur.dispose();
+ }
+
+
+ SchemaParticle result = filterPointlessParticlesAndVerifyAllParticles(sPart, parseTree);
+
+ if (group != null)
+ {
+ state.finishProcessing(group);
+ }
+ // outdentDBG();
+ return result;
+ }
+
+ static int translateWildcardProcess(Any.ProcessContents process)
+ {
+ if (process == null)
+ return SchemaParticle.STRICT;
+
+ String processValue = process.getStringValue();
+
+ if ("lax".equals(processValue))
+ return SchemaParticle.LAX;
+
+ if ("skip".equals(processValue))
+ return SchemaParticle.SKIP;
+
+ return SchemaParticle.STRICT;
+ }
+
+ static SchemaParticle filterPointlessParticlesAndVerifyAllParticles(SchemaParticle part, XmlObject parseTree)
+ {
+ if (part.getMaxOccurs() != null && part.getMaxOccurs().signum() == 0)
+ return null;
+
+ switch (part.getParticleType())
+ {
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.ALL:
+ if (part.getParticleChildren().length == 0)
+ return null;
+ if (part.isSingleton() && part.countOfParticleChild() == 1)
+ return part.getParticleChild(0);
+ break;
+
+ case SchemaParticle.CHOICE:
+ if (part.getParticleChildren().length == 0 &&
+ part.getMinOccurs().compareTo(BigInteger.ZERO) == 0)
+ return null;
+ if (part.isSingleton() && part.countOfParticleChild() == 1)
+ return part.getParticleChild(0);
+ break;
+
+ case SchemaParticle.ELEMENT:
+ case SchemaParticle.WILDCARD:
+ return part;
+
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+
+ boolean isAll = part.getParticleType() == SchemaParticle.ALL;
+
+ if (isAll)
+ {
+ // http://www.w3.org/TR/xmlschema-1/#cos-all-limited
+ if (part.getMaxOccurs() == null || part.getMaxOccurs().compareTo(BigInteger.ONE) > 0)
+ {
+ StscState.get().error("An all group must have maxOccurs <= 1", XmlErrorContext.ALL_CONTENTS, parseTree);
+ }
+ }
+
+ for (int i = 0; i < part.countOfParticleChild(); i++)
+ {
+ SchemaParticle child = part.getParticleChild(i);
+ if (child.getParticleType() == SchemaParticle.ALL)
+ {
+ StscState.get().error("An all group is only allowed at the top level of the content model", XmlErrorContext.CANNOT_EXTEND_ALL, parseTree);
+ }
+ else if (isAll && (child.getParticleType() != SchemaParticle.ELEMENT || child.getMaxOccurs() == null || child.getMaxOccurs().compareTo(BigInteger.ONE) > 0))
+ {
+ StscState.get().error("An all group can contain only element particles with maxOccurs <= 1", XmlErrorContext.ALL_CONTENTS, parseTree);
+ }
+ }
+
+ return part;
+ }
+
+ static void addMinusPointlessParticles(
+ List list, SchemaParticle part, int parentParticleType)
+ {
+ if (part == null)
+ return;
+
+ switch (part.getParticleType())
+ {
+ case SchemaParticle.SEQUENCE:
+ if (parentParticleType == SchemaParticle.SEQUENCE && part.isSingleton())
+ {
+ // emitDBG("dropping redundant sequence");
+ list.addAll(Arrays.asList(part.getParticleChildren()));
+ return;
+ }
+ break;
+
+ case SchemaParticle.CHOICE:
+ if (parentParticleType == SchemaParticle.CHOICE && part.isSingleton())
+ {
+ // emitDBG("dropping redundant choice");
+ list.addAll(Arrays.asList(part.getParticleChildren()));
+ return;
+ }
+ break;
+
+ case SchemaParticle.ALL:
+ default:
+ }
+ list.add(part);
+ }
+
+ static Map buildAttributePropertyModelByQName(SchemaAttributeModel attrModel, SchemaType owner)
+ {
+ Map result = new LinkedHashMap();
+ SchemaLocalAttribute[] attruses = attrModel.getAttributes();
+
+ for (int i = 0; i < attruses.length; i++)
+ result.put(attruses[i].getName(), buildUseProperty(attruses[i], owner));
+
+ return result;
+ }
+
+ static Map buildContentPropertyModelByQName(SchemaParticle part, SchemaType owner)
+ {
+ if (part == null)
+ return Collections.EMPTY_MAP;
+
+ boolean asSequence = false;
+ Map model = null;
+
+ switch (part.getParticleType())
+ {
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ asSequence = true;
+ break;
+ case SchemaParticle.CHOICE:
+ asSequence = false;
+ break;
+ case SchemaParticle.ELEMENT:
+ model = buildElementPropertyModel((SchemaLocalElement)part, owner);
+ break;
+ case SchemaParticle.WILDCARD:
+ model = Collections.EMPTY_MAP;
+ break;
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+
+ if (model == null)
+ {
+ // build model for children
+ model = new LinkedHashMap();
+ SchemaParticle[] children = part.getParticleChildren();
+
+ for (int i = 0; i < children.length; i++)
+ {
+ // indentDBG();
+ Map childModel = buildContentPropertyModelByQName(children[i], owner);
+ // outdentDBG();
+ for (Iterator j = childModel.values().iterator(); j.hasNext(); )
+ {
+ SchemaProperty iProp = (SchemaProperty)j.next();
+ SchemaPropertyImpl oProp = (SchemaPropertyImpl)model.get(iProp.getName());
+ if (oProp == null)
+ {
+ if (!asSequence)
+ ((SchemaPropertyImpl)iProp).setMinOccurs(BigInteger.ZERO);
+ model.put(iProp.getName(), iProp);
+ continue;
+ }
+ // consistency verified in an earlier step
+ assert(oProp.getType().equals(iProp.getType()));
+
+ mergeProperties(oProp, iProp, asSequence);
+ }
+ }
+
+ // finally deal with minOccurs, maxOccurs over whole group
+ BigInteger min = part.getMinOccurs();
+ BigInteger max = part.getMaxOccurs();
+
+ for (Iterator j = model.values().iterator(); j.hasNext(); )
+ {
+ SchemaProperty oProp = (SchemaProperty)j.next();
+ BigInteger minOccurs = oProp.getMinOccurs();
+ BigInteger maxOccurs = oProp.getMaxOccurs();
+
+ minOccurs = minOccurs.multiply(min);
+ if (max != null && max.equals(BigInteger.ZERO))
+ maxOccurs = BigInteger.ZERO;
+ else if (maxOccurs != null && !maxOccurs.equals(BigInteger.ZERO))
+ maxOccurs = max == null ? null : maxOccurs.multiply(max);
+
+ ((SchemaPropertyImpl)oProp).setMinOccurs(minOccurs);
+ ((SchemaPropertyImpl)oProp).setMaxOccurs(maxOccurs);
+ }
+ }
+
+ return model;
+ }
+
+ static Map buildElementPropertyModel(SchemaLocalElement epart, SchemaType owner)
+ {
+ Map result = new HashMap(1);
+
+ SchemaProperty sProp = buildUseProperty(epart, owner);
+ result.put(sProp.getName(), sProp);
+ return result;
+ }
+
+ static SchemaProperty buildUseProperty(SchemaField use, SchemaType owner)
+ {
+ SchemaPropertyImpl sPropImpl = new SchemaPropertyImpl();
+ sPropImpl.setName(use.getName());
+ sPropImpl.setContainerTypeRef(owner.getRef());
+ sPropImpl.setTypeRef(use.getType().getRef());
+ sPropImpl.setAttribute(use.isAttribute());
+ sPropImpl.setDefault(use.isDefault() ? SchemaProperty.CONSISTENTLY : SchemaProperty.NEVER);
+ sPropImpl.setFixed(use.isFixed() ? SchemaProperty.CONSISTENTLY : SchemaProperty.NEVER);
+ sPropImpl.setNillable(use.isNillable() ? SchemaProperty.CONSISTENTLY : SchemaProperty.NEVER);
+ sPropImpl.setDefaultText(use.getDefaultText());
+ sPropImpl.setMinOccurs(use.getMinOccurs());
+ sPropImpl.setMaxOccurs(use.getMaxOccurs());
+
+ if (use instanceof SchemaLocalElementImpl)
+ {
+ SchemaLocalElementImpl elt = (SchemaLocalElementImpl)use;
+ sPropImpl.setAcceptedNames(elt.acceptedStartNames());
+ }
+
+ return sPropImpl;
+ }
+
+ static void mergeProperties(SchemaPropertyImpl into, SchemaProperty from, boolean asSequence)
+ {
+ // minoccur, maxoccur
+ BigInteger minOccurs = into.getMinOccurs();
+ BigInteger maxOccurs = into.getMaxOccurs();
+ if (asSequence)
+ {
+ minOccurs = minOccurs.add(from.getMinOccurs());
+ if (maxOccurs != null)
+ maxOccurs = (from.getMaxOccurs() == null ? null :
+ maxOccurs.add(from.getMaxOccurs()));
+ }
+ else
+ {
+ minOccurs = minOccurs.min(from.getMinOccurs());
+ if (maxOccurs != null)
+ maxOccurs = (from.getMaxOccurs() == null ? null :
+ maxOccurs.max(from.getMaxOccurs()));
+ }
+ into.setMinOccurs(minOccurs);
+ into.setMaxOccurs(maxOccurs);
+
+ // nillable, default, fixed
+ if (from.hasNillable() != into.hasNillable())
+ into.setNillable(SchemaProperty.VARIABLE);
+ if (from.hasDefault() != into.hasDefault())
+ into.setDefault(SchemaProperty.VARIABLE);
+ if (from.hasFixed() != into.hasFixed())
+ into.setFixed(SchemaProperty.VARIABLE);
+
+ // default value
+ if (into.getDefaultText() != null)
+ {
+ if (from.getDefaultText() == null ||
+ !into.getDefaultText().equals(from.getDefaultText()))
+ into.setDefaultText(null);
+ }
+ }
+
+ static SchemaParticle[] ensureStateMachine(SchemaParticle[] children)
+ {
+ for (int i = 0; i < children.length; i++)
+ {
+ buildStateMachine(children[i]);
+ }
+ return children;
+ }
+
+ static void buildStateMachine(SchemaParticle contentModel)
+ {
+ if (contentModel == null)
+ return;
+
+ SchemaParticleImpl partImpl = (SchemaParticleImpl)contentModel;
+ if (partImpl.hasTransitionNotes())
+ return;
+
+ QNameSetBuilder start = new QNameSetBuilder();
+ QNameSetBuilder excludenext = new QNameSetBuilder();
+ boolean deterministic = true;
+ SchemaParticle[] children = null;
+ boolean canskip = (partImpl.getMinOccurs().signum() == 0);
+
+ switch (partImpl.getParticleType())
+ {
+ case SchemaParticle.ELEMENT:
+ // compute start and excludeNext; canskip is already correct
+ if (partImpl.hasTransitionRules())
+ start.addAll(partImpl.acceptedStartNames());
+ else
+ start.add(partImpl.getName());
+
+ break;
+
+ case SchemaParticle.WILDCARD:
+ // compute start and excludeNext; canskip is already correct
+ start.addAll(partImpl.getWildcardSet());
+ break;
+
+ case SchemaParticle.SEQUENCE:
+ children = ensureStateMachine(partImpl.getParticleChildren());
+
+ // adjust canskip if all children are skippable
+ canskip = true;
+ for (int i = 0; canskip && i < children.length; i++)
+ {
+ if (!(children[i]).isSkippable())
+ canskip = false;
+ }
+
+ // bubble up nondeterministic bit
+ for (int i = 0; deterministic && i < children.length; i++)
+ {
+ if (!((SchemaParticleImpl)children[i]).isDeterministic())
+ deterministic = false;
+ }
+
+ // verify deterministic and compute excludeNext set
+ for (int i = 1; i < children.length; i++)
+ {
+ excludenext.addAll(((SchemaParticleImpl)children[i - 1]).getExcludeNextSet());
+ if (deterministic && !excludenext.isDisjoint((children[i]).acceptedStartNames()))
+ deterministic = false;
+ if ((children[i]).isSkippable())
+ excludenext.addAll((children[i]).acceptedStartNames());
+ else
+ excludenext.clear();
+ }
+
+ // next, compute start set
+ for (int i = 0; i < children.length; i++)
+ {
+ start.addAll((children[i]).acceptedStartNames());
+ if (!(children[i]).isSkippable())
+ break;
+ }
+ break;
+
+ case SchemaParticle.CHOICE:
+ children = ensureStateMachine(partImpl.getParticleChildren());
+
+ // adjust canskip if any children are skippable
+ canskip = false;
+ for (int i = 0; !canskip && i < children.length; i++)
+ {
+ if ((children[i]).isSkippable())
+ canskip = true;
+ }
+
+ // bubble up nondeterministic bit
+ for (int i = 0; deterministic && i < children.length; i++)
+ {
+ if (!((SchemaParticleImpl)children[i]).isDeterministic())
+ deterministic = false;
+ }
+
+ // compute start and excludeNext sets, verify deterministic
+ for (int i = 0; i < children.length; i++)
+ {
+ if (deterministic && !start.isDisjoint((children[i]).acceptedStartNames()))
+ deterministic = false;
+ start.addAll((children[i]).acceptedStartNames());
+ excludenext.addAll(((SchemaParticleImpl)children[i]).getExcludeNextSet());
+ }
+
+ break;
+
+ case SchemaParticle.ALL:
+ children = ensureStateMachine(partImpl.getParticleChildren());
+
+ // adjust canskip if all children are skippable
+ canskip = true;
+ for (int i = 0; !canskip && i < children.length; i++)
+ {
+ if (!(children[i]).isSkippable())
+ canskip = false;
+ }
+
+ // bubble up nondeterministic bit
+ for (int i = 0; deterministic && i < children.length; i++)
+ {
+ if (!((SchemaParticleImpl)children[i]).isDeterministic())
+ deterministic = false;
+ }
+
+ // compute start and excludeNext sets, verify deterministic
+ for (int i = 0; i < children.length; i++)
+ {
+ if (deterministic && !start.isDisjoint((children[i]).acceptedStartNames()))
+ deterministic = false;
+ start.addAll((children[i]).acceptedStartNames());
+ excludenext.addAll(((SchemaParticleImpl)children[i]).getExcludeNextSet());
+ }
+ if (canskip)
+ excludenext.addAll(start);
+
+ break;
+
+ default:
+ // wildcard, all cases nyi
+ throw new IllegalStateException("Unrecognized schema particle");
+ }
+
+ // apply looping logic
+
+ BigInteger minOccurs = partImpl.getMinOccurs();
+ BigInteger maxOccurs = partImpl.getMaxOccurs();
+ boolean canloop = (maxOccurs == null || maxOccurs.compareTo(BigInteger.ONE) > 0);
+ boolean varloop = (maxOccurs == null || minOccurs.compareTo(maxOccurs) < 0);
+
+ if (canloop && deterministic && !excludenext.isDisjoint(start))
+ {
+ // we have a possible looping nondeterminism.
+ // let's take some time now to see if it's actually caused
+ // by non-unique-particle-attribute or not.
+ QNameSet suspectSet = excludenext.intersect(start);
+
+ // compute the set of all particles that could start this group
+ Map startMap = new HashMap();
+ particlesMatchingStart(partImpl, suspectSet, startMap, new QNameSetBuilder());
+
+ // compute the set of all particles that could have been repeated rather than ending this group
+ Map afterMap = new HashMap();
+ particlesMatchingAfter(partImpl, suspectSet, afterMap, new QNameSetBuilder(), true);
+
+ // see if we can find a member of after that is not a member of start
+ // if we can, then particle attribution is not unique
+ deterministic = afterMapSubsumedByStartMap(startMap, afterMap);
+ }
+
+ if (varloop)
+ excludenext.addAll(start);
+
+ canskip = canskip || minOccurs.signum() == 0;
+
+ partImpl.setTransitionRules(start.toQNameSet(), canskip);
+ partImpl.setTransitionNotes(excludenext.toQNameSet(), deterministic);
+ }
+
+ private static boolean afterMapSubsumedByStartMap(Map startMap, Map afterMap)
+ {
+ if (afterMap.size() > startMap.size())
+ return false;
+
+ if (afterMap.isEmpty())
+ return true;
+
+ for (Iterator i = startMap.keySet().iterator(); i.hasNext(); )
+ {
+ SchemaParticle part = (SchemaParticle)i.next();
+ if (part.getParticleType() == SchemaParticle.WILDCARD)
+ {
+ if (afterMap.containsKey(part))
+ {
+ QNameSet startSet = (QNameSet)startMap.get(part);
+ QNameSet afterSet = (QNameSet)afterMap.get(part);
+ if (!startSet.containsAll(afterSet))
+ return false;
+ }
+ }
+ afterMap.remove(part);
+ if (afterMap.isEmpty())
+ return true;
+ }
+ return (afterMap.isEmpty());
+ }
+
+ private static void particlesMatchingStart(SchemaParticle part, QNameSetSpecification suspectSet, Map result, QNameSetBuilder eliminate)
+ {
+ switch (part.getParticleType())
+ {
+ case SchemaParticle.ELEMENT:
+ if (!suspectSet.contains(part.getName()))
+ return;
+ result.put(part, null);
+ eliminate.add(part.getName());
+ return;
+
+ case SchemaParticle.WILDCARD:
+ if (suspectSet.isDisjoint(part.getWildcardSet()))
+ return;
+ result.put(part, part.getWildcardSet().intersect(suspectSet));
+ eliminate.addAll(part.getWildcardSet());
+ return;
+
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.ALL:
+ {
+ SchemaParticle[] children = part.getParticleChildren();
+ for (int i = 0; i < children.length; i++)
+ particlesMatchingStart(children[i], suspectSet, result, eliminate);
+ return;
+ }
+
+ case SchemaParticle.SEQUENCE:
+ {
+ SchemaParticle[] children = part.getParticleChildren();
+ if (children.length == 0)
+ return;
+ if (!children[0].isSkippable())
+ {
+ particlesMatchingStart(children[0], suspectSet, result, eliminate);
+ return;
+ }
+ QNameSetBuilder remainingSuspects = new QNameSetBuilder(suspectSet);
+ QNameSetBuilder suspectsToEliminate = new QNameSetBuilder();
+ for (int i = 0; i < children.length; i++)
+ {
+ particlesMatchingStart(children[i], remainingSuspects, result, suspectsToEliminate);
+ eliminate.addAll(suspectsToEliminate);
+ if (!children[i].isSkippable())
+ return;
+ remainingSuspects.removeAll(suspectsToEliminate);
+ if (remainingSuspects.isEmpty())
+ return;
+ suspectsToEliminate.clear();
+ }
+ return;
+ }
+ }
+ }
+
+ private static void particlesMatchingAfter(SchemaParticle part, QNameSetSpecification suspectSet, Map result, QNameSetBuilder eliminate, boolean top)
+ {
+ recurse: switch (part.getParticleType())
+ {
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.ALL:
+ {
+ SchemaParticle[] children = part.getParticleChildren();
+ for (int i = 0; i < children.length; i++)
+ particlesMatchingAfter(children[i], suspectSet, result, eliminate, false);
+ break recurse;
+ }
+
+ case SchemaParticle.SEQUENCE:
+ {
+ SchemaParticle[] children = part.getParticleChildren();
+ if (children.length == 0)
+ break recurse;
+ if (!children[children.length - 1].isSkippable())
+ {
+ particlesMatchingAfter(children[0], suspectSet, result, eliminate, false);
+ break recurse;
+ }
+ QNameSetBuilder remainingSuspects = new QNameSetBuilder(suspectSet);
+ QNameSetBuilder suspectsToEliminate = new QNameSetBuilder();
+ for (int i = children.length - 1; i >= 0; i--)
+ {
+ particlesMatchingAfter(children[i], remainingSuspects, result, suspectsToEliminate, false);
+ eliminate.addAll(suspectsToEliminate);
+ if (!children[i].isSkippable())
+ break recurse;
+ remainingSuspects.removeAll(suspectsToEliminate);
+ if (remainingSuspects.isEmpty())
+ break recurse;
+ suspectsToEliminate.clear();
+ }
+ break recurse;
+ }
+ }
+
+ if (!top)
+ {
+ BigInteger minOccurs = part.getMinOccurs();
+ BigInteger maxOccurs = part.getMaxOccurs();
+ boolean varloop = (maxOccurs == null || minOccurs.compareTo(maxOccurs) < 0);
+ if (varloop)
+ {
+ particlesMatchingStart(part, suspectSet, result, eliminate);
+ }
+ }
+ }
+
+ private static class CodeForNameEntry
+ {
+ CodeForNameEntry(QName name, int code)
+ { this.name = name; this.code = code; }
+ public QName name;
+ public int code;
+ }
+
+ private static final int MODEL_GROUP_CODE = 100;
+
+ private static CodeForNameEntry[] particleCodes = new CodeForNameEntry[]
+ {
+ new CodeForNameEntry(QNameHelper.forLNS("all", "http://www.w3.org/2001/XMLSchema"), SchemaParticle.ALL),
+ new CodeForNameEntry(QNameHelper.forLNS("sequence", "http://www.w3.org/2001/XMLSchema"), SchemaParticle.SEQUENCE),
+ new CodeForNameEntry(QNameHelper.forLNS("choice", "http://www.w3.org/2001/XMLSchema"), SchemaParticle.CHOICE),
+ new CodeForNameEntry(QNameHelper.forLNS("element", "http://www.w3.org/2001/XMLSchema"), SchemaParticle.ELEMENT),
+ new CodeForNameEntry(QNameHelper.forLNS("any", "http://www.w3.org/2001/XMLSchema"), SchemaParticle.WILDCARD),
+ new CodeForNameEntry(QNameHelper.forLNS("group", "http://www.w3.org/2001/XMLSchema"), MODEL_GROUP_CODE),
+ };
+
+ private static Map particleCodeMap = buildParticleCodeMap();
+
+ private static Map buildParticleCodeMap()
+ {
+ Map result = new HashMap();
+ for (int i = 0; i < particleCodes.length; i++)
+ result.put(particleCodes[i].name, new Integer(particleCodes[i].code));
+ return result;
+ }
+
+ private static int translateParticleCode(Group parseEg)
+ {
+ if (parseEg == null)
+ return 0;
+ return translateParticleCode(parseEg.newCursor().getName());
+ }
+
+ private static int translateParticleCode(QName name)
+ {
+ Integer result = (Integer)particleCodeMap.get(name);
+ if (result == null)
+ return 0;
+ return result.intValue();
+ }
+
+ private static final int ATTRIBUTE_CODE = 100;
+ private static final int ATTRIBUTE_GROUP_CODE = 101;
+ private static final int ANY_ATTRIBUTE_CODE = 102;
+
+ private static CodeForNameEntry[] attributeCodes = new CodeForNameEntry[]
+ {
+ new CodeForNameEntry(QNameHelper.forLNS("attribute", "http://www.w3.org/2001/XMLSchema"), ATTRIBUTE_CODE),
+ new CodeForNameEntry(QNameHelper.forLNS("attributeGroup", "http://www.w3.org/2001/XMLSchema"), ATTRIBUTE_GROUP_CODE),
+ new CodeForNameEntry(QNameHelper.forLNS("anyAttribute", "http://www.w3.org/2001/XMLSchema"), ANY_ATTRIBUTE_CODE),
+ };
+
+ private static Map attributeCodeMap = buildAttributeCodeMap();
+
+ private static Map buildAttributeCodeMap()
+ {
+ Map result = new HashMap();
+ for (int i = 0; i < attributeCodes.length; i++)
+ result.put(attributeCodes[i].name, new Integer(attributeCodes[i].code));
+ return result;
+ }
+
+ static int translateAttributeCode(QName currentName)
+ {
+ Integer result = (Integer)attributeCodeMap.get(currentName);
+ if (result == null)
+ return 0;
+ return result.intValue();
+ }
+
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java
new file mode 100644
index 0000000..62c38a3
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscImporter.java
@@ -0,0 +1,707 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.w3.x2001.xmlSchema.RedefineDocument.Redefine;
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.w3.x2001.xmlSchema.ImportDocument.Import;
+import org.w3.x2001.xmlSchema.IncludeDocument.Include;
+
+import java.util.Map;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Arrays;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.InputStream;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.transform.Source;
+
+public class StscImporter
+{
+ public static SchemaToProcess[] resolveImportsAndIncludes(Schema[] startWith)
+ {
+ DownloadTable engine = new DownloadTable(startWith);
+ return engine.resolveImportsAndIncludes();
+ }
+
+ public static class SchemaToProcess
+ {
+ private Schema schema;
+ private String chameleonNamespace;
+ private Redefine redefine;
+
+ public SchemaToProcess(Schema schema, String chameleonNamespace, Redefine redefine)
+ {
+ this.schema = schema;
+ this.chameleonNamespace = chameleonNamespace;
+ this.redefine = redefine;
+ }
+
+ /**
+ * The schema to parse.
+ */
+ public Schema getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * The base URI for this stp
+ */
+ public String getSourceName()
+ {
+ return schema.documentProperties().getSourceName();
+ }
+
+ /**
+ * The redefine element, if processed via redefine
+ */
+ public Redefine getRedefine()
+ {
+ return redefine;
+ }
+
+ /**
+ * The chameleon namespace. Null if this schema is not being treated
+ * as a chameleon. (The ordinary targetNamespace will just be extracted
+ * from the syntax of the schema.)
+ */
+ public String getChameleonNamespace()
+ {
+ return chameleonNamespace;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof SchemaToProcess)) return false;
+
+ final SchemaToProcess schemaToProcess = (SchemaToProcess) o;
+
+ if (chameleonNamespace != null ? !chameleonNamespace.equals(schemaToProcess.chameleonNamespace) : schemaToProcess.chameleonNamespace != null) return false;
+ if (redefine != null ? !redefine.equals(schemaToProcess.redefine) : schemaToProcess.redefine != null) return false;
+ if (!schema.equals(schemaToProcess.schema)) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = schema.hashCode();
+ result = 29 * result + (chameleonNamespace != null ? chameleonNamespace.hashCode() : 0);
+ result = 29 * result + (redefine != null ? redefine.hashCode() : 0);
+ return result;
+ }
+ }
+
+ private final static String PROJECT_URL_PREFIX = "project://local";
+
+ private static String baseURLForDoc(XmlObject obj)
+ {
+ String path = obj.documentProperties().getSourceName();
+
+ if (path == null)
+ return null;
+
+ if (path.startsWith("/"))
+ return PROJECT_URL_PREFIX + path.replace('\\', '/');
+
+ // looks like a URL?
+ int colon = path.indexOf(':');
+ if (colon > 1 && path.substring(0, colon).matches("^\\w+$"))
+ return path;
+
+ return PROJECT_URL_PREFIX + "/" + path.replace('\\', '/');
+ }
+
+ private static URI parseURI(String s)
+ {
+ if (s == null)
+ return null;
+
+ try
+ {
+ return new URI(s);
+ }
+ catch (URISyntaxException syntax)
+ {
+ return null;
+ }
+ }
+
+ //workaround for Sun bug # 4723726
+ private static URI resolve(URI base, String child)
+ {
+ URI ruri = base.resolve(child);
+
+ //fix up normalization bug
+ if ("file".equals(ruri.getScheme()) && ! child.equals(ruri))
+ {
+ if (base.getPath().startsWith("//") && !ruri.getPath().startsWith("//"))
+ {
+ String path = "///".concat(ruri.getPath());
+ try
+ {
+ ruri = new URI("file", null, path, ruri.getQuery(), ruri.getFragment());
+ }
+ catch(URISyntaxException uris)
+ {}
+ }
+ }
+ return ruri;
+ }
+
+ public static class DownloadTable
+ {
+ /**
+ * Namespace/schemaLocation pair.
+ *
+ * Downloaded schemas are indexed by namespace, schemaLocation, and both.
+ *
+ * A perfect match is preferred, but a match-by-namespace is accepted.
+ * A match-by-schemaLocation is only accepted for includes (not imports).
+ */
+ private static class NsLocPair
+ {
+ private String namespaceURI;
+ private String locationURL;
+
+ public NsLocPair(String namespaceURI, String locationURL)
+ {
+ this.namespaceURI = namespaceURI;
+ this.locationURL = locationURL;
+ }
+
+ /**
+ * Empty string for no-namespace, null for namespace-not-part-of-key
+ */
+ public String getNamespaceURI()
+ {
+ return namespaceURI;
+ }
+
+ public String getLocationURL()
+ {
+ return locationURL;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof NsLocPair)) return false;
+
+ final NsLocPair nsLocPair = (NsLocPair) o;
+
+ if (locationURL != null ? !locationURL.equals(nsLocPair.locationURL) : nsLocPair.locationURL != null) return false;
+ if (namespaceURI != null ? !namespaceURI.equals(nsLocPair.namespaceURI) : nsLocPair.namespaceURI != null) return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (namespaceURI != null ? namespaceURI.hashCode() : 0);
+ result = 29 * result + (locationURL != null ? locationURL.hashCode() : 0);
+ return result;
+ }
+ }
+
+ private static class DigestKey
+ {
+ byte[] _digest;
+ int _hashCode;
+ DigestKey(byte[] digest)
+ {
+ _digest = digest;
+ for (int i = 0; i < 4 && i < digest.length; i++)
+ {
+ _hashCode = _hashCode << 8;
+ _hashCode = _hashCode + digest[i];
+ }
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof DigestKey)) return false;
+ return Arrays.equals(_digest, ((DigestKey)o)._digest);
+ }
+
+ public int hashCode()
+ {
+ return _hashCode;
+ }
+ }
+
+ private Map schemaByNsLocPair = new HashMap();
+ private Map schemaByDigestKey = new HashMap();
+ private LinkedList scanNeeded = new LinkedList();
+ private Set emptyNamespaceSchemas = new HashSet();
+ private Set scannedAlready = new HashSet();
+ private Set failedDownloads = new HashSet();
+
+ private Schema downloadSchema(XmlObject referencedBy, String targetNamespace, String locationURL)
+ {
+ // no location URL provided? Then nothing to do.
+ if (locationURL == null)
+ return null;
+
+ // First resolve relative URLs with respect to base URL for doc
+ URI baseURI = parseURI(baseURLForDoc(referencedBy));
+ String absoluteURL = baseURI == null ? locationURL : resolve(baseURI, locationURL).toString();
+
+ // probe 1: ns+url - perfect match
+ if (absoluteURL != null && targetNamespace != null)
+ {
+ Schema result = (Schema)schemaByNsLocPair.get(new NsLocPair(targetNamespace, absoluteURL));
+ if (result != null)
+ return result;
+ }
+
+ StscState state = StscState.get();
+
+ // probe 2: we have preexisting knowledge of this namespace,
+ // either from another schema file or from the linker.
+ // If we're not downloading the given URL, skip it silently if the
+ // namespace is already represented by a file we have.
+ // Also, suppress downloads of URLs to namespaces that are already
+ // known by the linker.
+ // (We never assume preexisting knowledge of the no-namespace,
+ // even if we have some definitions, since it's likely that
+ // more than one person is playing in the no-namespace at once.)
+ if (targetNamespace != null && !targetNamespace.equals(""))
+ {
+ // the URL is not one to download; should we assume we know about the namespace?
+ if (!state.shouldDownloadURI(absoluteURL))
+ {
+ // If we already have a schema representing this namespace,
+ // then skip this URL silently without producing an error.
+ Schema result = (Schema)schemaByNsLocPair.get(new NsLocPair(targetNamespace, null));
+ if (result != null)
+ return result;
+ }
+
+ // If the linker already knows about this namespace, skip
+ // this URL.
+ if (state.linkerDefinesNamespace(targetNamespace))
+ return null;
+ }
+
+ // probe 3: url only
+ if (absoluteURL != null)
+ {
+ Schema result = (Schema)schemaByNsLocPair.get(new NsLocPair(null, absoluteURL));
+ if (result != null)
+ return result;
+ }
+
+ // no match: error if we can't or won't download.
+ if (absoluteURL == null)
+ {
+ state.error("Could not find resource - no valid location URL.", XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ return null;
+ }
+
+ if (previouslyFailedToDownload(absoluteURL))
+ {
+ // an error message has already been produced.
+ return null;
+ }
+
+ if (!state.shouldDownloadURI(absoluteURL))
+ {
+ state.error("Could not load resource \"" + absoluteURL + "\" (network downloads disabled).", XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ addFailedDownload(absoluteURL);
+ return null;
+ }
+
+ // try to download
+ download: try
+ {
+ XmlObject xdoc = downloadDocument(state.getS4SLoader(), targetNamespace, absoluteURL);
+
+ Schema result = findMatchByDigest(xdoc);
+ String shortname = state.relativize(absoluteURL);
+ if (result != null)
+ {
+ // if an exactly-the-same document has already been loaded, use the original and spew
+ String dupname = state.relativize(result.documentProperties().getSourceName());
+ if (dupname != null)
+ state.info(shortname + " is the same as " + dupname + " (ignoring the duplicate file)");
+ else
+ state.info(shortname + " is the same as another schema");
+ }
+ else
+ {
+ // otherwise, it's a new document: validate it and grab the contents
+ XmlOptions voptions = new XmlOptions();
+ voptions.setErrorListener(state.getErrorListener());
+ if (!(xdoc instanceof SchemaDocument) || !xdoc.validate(voptions))
+ {
+ state.error("Referenced document is not a valid schema", XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ break download;
+ }
+
+ SchemaDocument sDoc = (SchemaDocument)xdoc;
+
+ result = sDoc.getSchema();
+ state.info("Loading referenced file " + shortname);
+ }
+ NsLocPair key = new NsLocPair(emptyStringIfNull(result.getTargetNamespace()), absoluteURL);
+ addSuccessfulDownload(key, result);
+ return result;
+ }
+ catch (MalformedURLException malformed)
+ {
+ state.error("URL \"" + absoluteURL + "\" is not well-formed", XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ }
+ catch (IOException connectionProblem)
+ {
+ state.error(connectionProblem.toString(), XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ }
+ catch (XmlException e)
+ {
+ state.error("Problem parsing referenced XML resource - " + e.getMessage(), XmlErrorContext.CANNOT_FIND_RESOURCE, referencedBy);
+ }
+
+ // record failure so that we don't try to download this URL again
+ addFailedDownload(absoluteURL);
+ return null;
+ }
+
+ private XmlObject downloadDocument(SchemaTypeLoader loader, String namespace, String absoluteURL)
+ throws MalformedURLException, IOException, XmlException
+ {
+ StscState state = StscState.get();
+
+ EntityResolver resolver = state.getEntityResolver();
+ if (resolver != null)
+ {
+ InputSource source;
+ try
+ {
+ source = resolver.resolveEntity(namespace, absoluteURL);
+ }
+ catch (SAXException e)
+ {
+ throw new XmlException(e);
+ }
+
+ // first preference for InputSource contract: character stream
+ Reader reader = source.getCharacterStream();
+ if (reader != null)
+ {
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setDocumentSourceName(absoluteURL);
+ return loader.parse(reader, null, options);
+ }
+
+ // second preference for InputSource contract:
+ InputStream bytes = source.getByteStream();
+ if (bytes != null)
+ {
+ String encoding = source.getEncoding();
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setLoadMessageDigest();
+ options.setDocumentSourceName(absoluteURL);
+ if (encoding != null)
+ options.setCharacterEncoding(encoding);
+ return loader.parse(bytes, null, options);
+ }
+
+ // third preference: use the (possibly redirected) url
+ String urlToLoad = source.getSystemId();
+ if (urlToLoad == null)
+ throw new IOException("EntityResolver unable to resolve " + absoluteURL + " (for namespace " + namespace + ")");
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setLoadMessageDigest();
+ options.setDocumentSourceName(absoluteURL);
+ URL urlDownload = new URL(urlToLoad);
+ return loader.parse(urlDownload, null, options);
+ }
+
+ // no resolver - just use the URL directly, no substitution
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setLoadMessageDigest();
+
+ URL urlDownload = new URL(absoluteURL);
+ return loader.parse(urlDownload, null, options);
+ }
+
+ private void addSuccessfulDownload(NsLocPair key, Schema schema)
+ {
+ byte[] digest = schema.documentProperties().getMessageDigest();
+ if (digest == null)
+ {
+ StscState.get().addSchemaDigest(null);
+ }
+ else
+ {
+ DigestKey dk = new DigestKey(digest);
+ if (!schemaByDigestKey.containsKey(dk))
+ {
+ schemaByDigestKey.put(new DigestKey(digest), schema);
+ StscState.get().addSchemaDigest(digest);
+ }
+ }
+
+ schemaByNsLocPair.put(key, schema);
+ NsLocPair key1 = new NsLocPair(key.getNamespaceURI(), null);
+ if (!schemaByNsLocPair.containsKey(key1))
+ schemaByNsLocPair.put(key1, schema);
+ NsLocPair key2 = new NsLocPair(null, key.getLocationURL());
+ if (!schemaByNsLocPair.containsKey(key2))
+ schemaByNsLocPair.put(key2, schema);
+ }
+
+ private Schema findMatchByDigest(XmlObject original)
+ {
+ byte[] digest = original.documentProperties().getMessageDigest();
+ if (digest == null)
+ return null;
+ return (Schema)schemaByDigestKey.get(new DigestKey(digest));
+ }
+
+ private void addFailedDownload(String locationURL)
+ {
+ failedDownloads.add(locationURL);
+ }
+
+ private boolean previouslyFailedToDownload(String locationURL)
+ {
+ return failedDownloads.contains(locationURL);
+ }
+
+ private static boolean nullableStringsMatch(String s1, String s2)
+ {
+ if (s1 == null && s2 == null)
+ return true;
+ if (s1 == null || s2 == null)
+ return false;
+ return (s1.equals(s2));
+ }
+
+ private static String emptyStringIfNull(String s)
+ {
+ if (s == null)
+ return "";
+ return s;
+ }
+
+ private void addScanNeeded(SchemaToProcess stp)
+ {
+ if (!scannedAlready.contains(stp))
+ {
+ scannedAlready.add(stp);
+ scanNeeded.add(stp);
+ }
+ }
+
+ private void addEmptyNamespaceSchema(Schema s)
+ {
+ emptyNamespaceSchemas.add(s);
+ }
+
+ private void usedEmptyNamespaceSchema(Schema s)
+ {
+ emptyNamespaceSchemas.remove(s);
+ }
+
+ private boolean fetchRemainingEmptyNamespaceSchemas()
+ {
+ if (emptyNamespaceSchemas.isEmpty())
+ return false;
+
+ for (Iterator i = emptyNamespaceSchemas.iterator(); i.hasNext();)
+ {
+ Schema schema = (Schema)i.next();
+ addScanNeeded(new SchemaToProcess(schema, null, null));
+ }
+
+ emptyNamespaceSchemas.clear();
+ return true;
+ }
+
+ private boolean hasNextToScan()
+ {
+ return !scanNeeded.isEmpty();
+ }
+
+ private SchemaToProcess nextToScan()
+ {
+ SchemaToProcess next = (SchemaToProcess)scanNeeded.removeFirst();
+ return next;
+ }
+
+ public DownloadTable(Schema[] startWith)
+ {
+ for (int i = 0; i < startWith.length; i++)
+ {
+ String targetNamespace = startWith[i].getTargetNamespace();
+ NsLocPair key = new NsLocPair(targetNamespace, baseURLForDoc(startWith[i]));
+ addSuccessfulDownload(key, startWith[i]);
+ if (targetNamespace != null)
+ addScanNeeded(new SchemaToProcess(startWith[i], null, null));
+ else
+ addEmptyNamespaceSchema(startWith[i]);
+ }
+ }
+
+ public SchemaToProcess[] resolveImportsAndIncludes()
+ {
+ StscState state = StscState.get();
+ List result = new ArrayList();
+
+ // algorithm is to scan through each schema document and
+ // 1. download each import and include (if not already downloaded)
+ // 2. queue each imported or included schema to be process (if not already queued)
+
+ // The algorithm is run twice twice: first we begin with non-empty
+ // namespace schemas only. Then we repeat starting with any
+ // empty empty-namespace schemas that have NOT been chameleon-
+ // included by other schemas and process them.
+
+ for (;;)
+ {
+ while (hasNextToScan())
+ {
+ SchemaToProcess stp = nextToScan();
+ state.addSourceUri(stp.getSourceName(), null);
+ result.add(stp);
+
+ {
+ // handle imports
+ Import[] imports = stp.getSchema().getImportArray();
+ for (int i = 0; i < imports.length; i++)
+ {
+ Schema imported = downloadSchema(imports[i], emptyStringIfNull(imports[i].getNamespace()), imports[i].getSchemaLocation());
+
+ // if download fails, an error has already been reported.
+ if (imported == null)
+ continue;
+
+ if (!nullableStringsMatch(imported.getTargetNamespace(), imports[i].getNamespace()))
+ {
+ StscState.get().error("Imported schema has a target namespace \"" + imported.getTargetNamespace() + "\" that does not match the specified \"" + imports[i].getNamespace() + "\"", XmlErrorContext.MISMATCHED_TARGET_NAMESPACE, imports[i]);
+ }
+ else
+ {
+ addScanNeeded(new SchemaToProcess(imported, null, null));
+ }
+ }
+ }
+
+ {
+ // handle includes
+ Include[] includes = stp.getSchema().getIncludeArray();
+ String sourceNamespace = stp.getChameleonNamespace();
+ if (sourceNamespace == null)
+ sourceNamespace = emptyStringIfNull(stp.getSchema().getTargetNamespace());
+
+ for (int i = 0; i < includes.length; i++)
+ {
+ Schema included = downloadSchema(includes[i], null, includes[i].getSchemaLocation());
+ // if download fails, an error has already been reported.
+ if (included == null)
+ continue;
+
+ if (emptyStringIfNull(included.getTargetNamespace()).equals(sourceNamespace))
+ {
+ // non-chameleon case - just like an import
+ addScanNeeded(new SchemaToProcess(included, null, null));
+ }
+ else if (included.getTargetNamespace() != null)
+ {
+ // illegal include: included schema in wrong namespace.
+ StscState.get().error("Included schema has a target namespace \"" + included.getTargetNamespace() + "\" that does not match the source namespace \"" + sourceNamespace + "\"", XmlErrorContext.MISMATCHED_TARGET_NAMESPACE, includes[i]);
+ }
+ else
+ {
+ // chameleon include
+ addScanNeeded(new SchemaToProcess(included, sourceNamespace, null));
+ usedEmptyNamespaceSchema(included);
+ }
+ }
+ }
+
+ {
+ // handle redefines
+ Redefine[] redefines = stp.getSchema().getRedefineArray();
+ String sourceNamespace = stp.getChameleonNamespace();
+ if (sourceNamespace == null)
+ sourceNamespace = emptyStringIfNull(stp.getSchema().getTargetNamespace());
+ for (int i = 0; i < redefines.length; i++)
+ {
+ Schema redefined = downloadSchema(redefines[i], null, redefines[i].getSchemaLocation());
+ // if download fails, an error has already been reported.
+ if (redefined == null)
+ continue;
+
+ if (emptyStringIfNull(redefined.getTargetNamespace()).equals(sourceNamespace))
+ {
+ // non-chameleon case
+ addScanNeeded(new SchemaToProcess(redefined, null, redefines[i]));
+ }
+ else if (redefined.getTargetNamespace() != null)
+ {
+ // illegal include: included schema in wrong namespace.
+ StscState.get().error("Redefined schema has a target namespace \"" + redefined.getTargetNamespace() + "\" that does not match the source namespace \"" + sourceNamespace + "\"", XmlErrorContext.MISMATCHED_TARGET_NAMESPACE, redefines[i]);
+ }
+ else
+ {
+ // chameleon redefine
+ addScanNeeded(new SchemaToProcess(redefined, sourceNamespace, redefines[i]));
+ usedEmptyNamespaceSchema(redefined);
+ }
+ }
+ }
+ }
+
+ if (!fetchRemainingEmptyNamespaceSchemas())
+ break;
+ }
+
+ return (SchemaToProcess[])result.toArray(new SchemaToProcess[result.size()]);
+ }
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java
new file mode 100644
index 0000000..6387171
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java
@@ -0,0 +1,931 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.QNameSetBuilder;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.SchemaStringEnumEntry;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.impl.common.NameUtil;
+import org.apache.xmlbeans.impl.config.InterfaceExtension;
+import org.apache.xmlbeans.impl.config.ExtensionHolder;
+
+import javax.xml.namespace.QName;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class StscJavaizer
+{
+ /**
+ * Does a topo walk of all the types to resolve them.
+ */
+ public static void javaizeAllTypes(boolean javaize)
+ {
+ StscState state = StscState.get();
+
+ List allSeenTypes = new ArrayList();
+ allSeenTypes.addAll(Arrays.asList(state.documentTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.attributeTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.globalTypes()));
+
+ // First distribute the global names among the top entities.
+ if (javaize)
+ assignGlobalJavaNames(allSeenTypes);
+
+ // now fully javaize everything deeply.
+ for (int i = 0; i < allSeenTypes.size(); i++)
+ {
+ SchemaType gType = (SchemaType)allSeenTypes.get(i);
+ if (javaize)
+ {
+ javaizeType((SchemaTypeImpl)gType);
+ String className = gType.getFullJavaName();
+ if (className != null)
+ state.addClassname(className.replace('$', '.'), gType);
+ }
+ else
+ skipJavaizingType((SchemaTypeImpl)gType);
+ allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes()));
+ }
+ }
+
+ static void assignGlobalJavaNames(Collection schemaTypes)
+ {
+ HashSet usedNames = new HashSet();
+ StscState state = StscState.get();
+
+ for (Iterator i = schemaTypes.iterator(); i.hasNext(); )
+ {
+ SchemaTypeImpl sImpl = (SchemaTypeImpl)i.next();
+ QName topName = findTopName(sImpl);
+ String pickedName = state.getJavaname(topName);
+ if (sImpl.isUnjavaized())
+ {
+ sImpl.setFullJavaName(pickFullJavaClassName(usedNames, findTopName(sImpl), pickedName, sImpl.isDocumentType(), sImpl.isAttributeType()));
+ sImpl.setFullJavaImplName(pickFullJavaImplName(usedNames, sImpl.getFullJavaName()));
+ setExtensions(sImpl, state);
+ }
+ }
+
+ verifyInterfaceNameCollisions(usedNames, state);
+ }
+
+ private static void verifyInterfaceNameCollisions(Set usedNames, StscState state)
+ {
+ state.getExtensionHolder().verifyInterfaceNameCollisions(usedNames);
+ }
+
+ private static void setExtensions(SchemaTypeImpl sImpl, StscState state)
+ {
+ String javaName = sImpl.getFullJavaName();
+
+ if (javaName!=null)
+ {
+ sImpl.setExtensionHolder(state.getExtensionHolder(javaName));
+ }
+ }
+
+ private static boolean isStringType(SchemaType type)
+ {
+ if (type == null || type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+ return (type.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_STRING);
+ }
+
+ static String pickConstantName(Set usedNames, String words)
+ {
+ String base = NameUtil.upperCaseUnderbar(words);
+
+ if (base.length() == 0)
+ {
+ base = "X";
+ }
+
+ if (base.startsWith("INT_")) // reserved for int codes
+ {
+ base = "X_" + base;
+ }
+
+ String uniqName;
+ int index = 1;
+ for (uniqName = base; usedNames.contains(uniqName); )
+ {
+ index++;
+ uniqName = base + "_" + index;
+ }
+
+ usedNames.add(uniqName);
+
+ return uniqName;
+ }
+
+ static void skipJavaizingType(SchemaTypeImpl sImpl)
+ {
+ if (sImpl.isJavaized())
+ return;
+
+ SchemaTypeImpl baseType = (SchemaTypeImpl)sImpl.getBaseType();
+ if (baseType != null)
+ skipJavaizingType(baseType);
+
+ sImpl.startJavaizing();
+ secondPassProcessType(sImpl);
+ sImpl.finishJavaizing();
+ }
+
+ static void secondPassProcessType(SchemaTypeImpl sImpl)
+ {
+ if (isStringType(sImpl))
+ {
+ XmlAnySimpleType[] enumVals = sImpl.getEnumerationValues();
+
+ // if this is an enumerated string type, values are to be
+ // javaized as constants.
+ if (enumVals != null)
+ {
+ SchemaStringEnumEntry[] entryArray = new SchemaStringEnumEntry[enumVals.length];
+ SchemaType basedOn = sImpl.getBaseEnumType();
+ if (basedOn == sImpl)
+ {
+ Set usedNames = new HashSet();
+ for (int i = 0; i < enumVals.length; i++)
+ {
+ String val = enumVals[i].getStringValue();
+
+ entryArray[i] = new SchemaStringEnumEntryImpl(val, i + 1, pickConstantName(usedNames, val));
+ }
+ }
+ else
+ {
+ for (int i = 0; i < enumVals.length; i++)
+ {
+ String val = enumVals[i].getStringValue();
+ entryArray[i] = basedOn.enumEntryForString(val);
+ }
+ }
+ sImpl.setStringEnumEntries(entryArray);
+ }
+ }
+ }
+
+ static void javaizeType(SchemaTypeImpl sImpl)
+ {
+ if (sImpl.isJavaized())
+ return;
+
+ SchemaTypeImpl baseType = (SchemaTypeImpl)sImpl.getBaseType();
+ if (baseType != null)
+ javaizeType(baseType);
+
+ sImpl.startJavaizing();
+
+ sImpl.setCompiled(true);
+
+ secondPassProcessType(sImpl);
+
+ if (!sImpl.isSimpleType())
+ {
+ SchemaProperty[] eltProps = sImpl.getElementProperties();
+ SchemaProperty[] attrProps = sImpl.getAttributeProperties();
+
+ // element setters result from a computation
+ if (eltProps.length > 0)
+ assignJavaElementSetterModel(eltProps, sImpl.getContentModel());
+
+ // Handing out java names - this permits us to avoid collisions.
+ Set usedPropNames = new HashSet();
+
+ // count in the methods from extension interfaces
+ avoidExtensionMethods(usedPropNames, sImpl);
+
+ // Assign names in two passes: first inherited names, then others.
+ for (boolean doInherited = true; ; doInherited = false)
+ {
+ if (eltProps.length > 0)
+ assignJavaPropertyNames(usedPropNames, eltProps, baseType, doInherited);
+
+ assignJavaPropertyNames(usedPropNames, attrProps, baseType, doInherited);
+
+ if (doInherited == false)
+ break;
+ }
+
+ SchemaProperty[] allprops = sImpl.getProperties();
+
+ // determine whether order insensitive
+ boolean insensitive = isPropertyModelOrderInsensitive(allprops);
+
+ // Fill in the java type codes now.
+ // This depends on recursive type information, so it's done in typechecking
+ assignJavaTypeCodes(allprops);
+
+ sImpl.setOrderSensitive(!insensitive);
+ }
+
+ // assign java type names to anonymous types
+ assignJavaAnonymousTypeNames(sImpl);
+
+ sImpl.finishJavaizing();
+ }
+
+ private static final String[] PREFIXES = new String[]
+ {"get", "xget", "isNil", "isSet", "sizeOf", "set", "xset", "addNew", "setNil", "unset", "insert", "add", "insertNew", "addNew", "remove"};
+
+ private static void avoidExtensionMethods(Set usedPropNames, SchemaTypeImpl sImpl)
+ {
+ ExtensionHolder extHolder = sImpl.getExtensionHolder();
+ if (extHolder!=null)
+ {
+ List exts = extHolder.getInterfaceExtensionsFor(sImpl.getFullJavaName());
+ for (int i = 0; i < exts.size(); i++)
+ {
+ InterfaceExtension ext = (InterfaceExtension) exts.get(i);
+ int methodCount = ext.getInterfaceMethodCount();
+ for (int j=0; j<methodCount; j++)
+ {
+ String methodName = ext.getInterfaceMethodName(j);
+ for (int k = 0; k < PREFIXES.length; k++)
+ {
+ String prefix = PREFIXES[k];
+ if (methodName.startsWith(prefix))
+ usedPropNames.add(methodName.substring(prefix.length()));
+ }
+ }
+ }
+ }
+ }
+
+ static void assignJavaAnonymousTypeNames(SchemaTypeImpl outerType)
+ {
+ Set usedTypeNames = new HashSet();
+ SchemaType[] anonymousTypes = outerType.getAnonymousTypes();
+ StscState state = StscState.get();
+
+ // Because we generate nested java interfaces, and nested
+ // interface names must not be the same as an ancestor, use up
+ // the ancestors
+
+ for ( SchemaType scanOuterType = outerType ;
+ scanOuterType != null ;
+ scanOuterType = scanOuterType.getOuterType() )
+ {
+ usedTypeNames.add( scanOuterType.getShortJavaName() );
+ }
+
+ for ( SchemaType scanOuterType = outerType ;
+ scanOuterType != null ;
+ scanOuterType = scanOuterType.getOuterType() )
+ {
+ usedTypeNames.add( scanOuterType.getShortJavaImplName() );
+ }
+
+ // and because things are problematic if an inner type name
+ // is the same as a top-level package name, also get rid of that
+ // collision
+ usedTypeNames.add(getOutermostPackage(outerType.getFullJavaName()));
+
+ // assign names
+ for (int i = 0; i < anonymousTypes.length; i++)
+ {
+ SchemaTypeImpl sImpl = (SchemaTypeImpl)anonymousTypes[i];
+ if (sImpl == null) // already handled in first pass
+ continue;
+ if (sImpl.isSkippedAnonymousType())
+ continue;
+ String localname = null;
+ String javaname = null;
+
+ SchemaField containerField = sImpl.getContainerField();
+ if (containerField != null)
+ {
+ QName qname = sImpl.getContainerField().getName();
+ localname = qname.getLocalPart();
+ javaname = state.getJavaname(sImpl.getContainerField().getName());
+ }
+ else
+ {
+ // not defined inside an Elt or Attr: must be a nested simple type
+ switch (sImpl.getOuterType().getSimpleVariety())
+ {
+ case SchemaType.UNION:
+ javaname = "Member"; break;
+ case SchemaType.LIST:
+ javaname = "Item"; break;
+ case SchemaType.ATOMIC:
+ default:
+ assert(false) : "Weird type " + sImpl.toString();
+ javaname = "Base"; break;
+ }
+ }
+ sImpl.setShortJavaName(
+ pickInnerJavaClassName(usedTypeNames, localname, javaname));
+ sImpl.setShortJavaImplName(
+ pickInnerJavaImplName(usedTypeNames, localname, javaname == null ? null : javaname + "Impl"));
+ setExtensions(sImpl, state);
+ }
+ }
+
+ /**
+ * Used to compute the setter model.
+ *
+ * Returns the set of all QNames of elements that could possibly be
+ * contained in the given contentModel. The state variable is used
+ * to record the results, so that if they are needed again later,
+ * they do not need to be recomputed.
+ */
+ static QNameSet computeAllContainedElements(SchemaParticle contentModel, Map state)
+ {
+ // Remember previously computed results to avoid complexity explosion
+ QNameSet result = (QNameSet)state.get(contentModel);
+ if (result != null)
+ return result;
+
+ QNameSetBuilder builder;
+
+ switch (contentModel.getParticleType())
+ {
+ case SchemaParticle.ALL:
+ case SchemaParticle.CHOICE:
+ case SchemaParticle.SEQUENCE:
+ default:
+ builder = new QNameSetBuilder();
+ for (int i = 0; i < contentModel.countOfParticleChild(); i++)
+ {
+ builder.addAll(computeAllContainedElements(contentModel.getParticleChild(i), state));
+ }
+ result = builder.toQNameSet();
+ break;
+
+ case SchemaParticle.WILDCARD:
+ result = contentModel.getWildcardSet();
+ break;
+
+ case SchemaParticle.ELEMENT:
+ result = QNameSet.singleton(contentModel.getName());
+ break;
+ }
+ state.put(contentModel, result);
+ return result;
+ }
+
+ /**
+ * Used to compute setter model.
+ *
+ * Returns the QNameSet of all elements that can possibly come before an
+ * element whose name is given by the target in a valid instance of the
+ * contentModel. When appending an element, it comes before the first
+ * one that is not in this set.
+ */
+ static QNameSet computeNondelimitingElements(QName target, SchemaParticle contentModel, Map state)
+ {
+ QNameSet allContents = computeAllContainedElements(contentModel, state);
+ if (!allContents.contains(target))
+ return QNameSet.EMPTY;
+
+ // If iterated, then all contents are delimiting.
+ if (contentModel.getMaxOccurs() == null ||
+ contentModel.getMaxOccurs().compareTo(BigInteger.ONE) > 0)
+ return allContents;
+
+ QNameSetBuilder builder;
+
+ switch (contentModel.getParticleType())
+ {
+ case SchemaParticle.ALL:
+ case SchemaParticle.ELEMENT:
+ default:
+ return allContents;
+
+ case SchemaParticle.WILDCARD:
+ return QNameSet.singleton(target);
+
+ case SchemaParticle.CHOICE:
+ builder = new QNameSetBuilder();
+ for (int i = 0; i < contentModel.countOfParticleChild(); i++)
+ {
+ QNameSet childContents = computeAllContainedElements(contentModel.getParticleChild(i), state);
+ if (childContents.contains(target))
+ builder.addAll(computeNondelimitingElements(target, contentModel.getParticleChild(i), state));
+ }
+ return builder.toQNameSet();
+
+ case SchemaParticle.SEQUENCE:
+ builder = new QNameSetBuilder();
+ boolean seenTarget = false;
+ for (int i = contentModel.countOfParticleChild(); i > 0; )
+ {
+ i--;
+ QNameSet childContents = computeAllContainedElements(contentModel.getParticleChild(i), state);
+ if (seenTarget)
+ {
+ builder.addAll(childContents);
+ }
+ else if (childContents.contains(target))
+ {
+ builder.addAll(computeNondelimitingElements(target, contentModel.getParticleChild(i), state));
+ seenTarget = true;
+ }
+ }
+ return builder.toQNameSet();
+ }
+ }
+
+ static void assignJavaElementSetterModel(SchemaProperty[] eltProps, SchemaParticle contentModel)
+ {
+ // To compute the element setter model, we need to compute the
+ // delimiting elements for each element.
+
+ Map state = new HashMap();
+ QNameSet allContents = computeAllContainedElements(contentModel, state);
+
+ for (int i = 0; i < eltProps.length; i++)
+ {
+ SchemaPropertyImpl sImpl = (SchemaPropertyImpl)eltProps[i];
+ QNameSet nde = computeNondelimitingElements(sImpl.getName(), contentModel, state);
+ QNameSetBuilder builder = new QNameSetBuilder(allContents);
+ builder.removeAll(nde);
+ sImpl.setJavaSetterDelimiter(builder.toQNameSet());
+ }
+ }
+
+ static void assignJavaPropertyNames(Set usedNames, SchemaProperty[] props, SchemaType baseType, boolean doInherited)
+ {
+ StscState state = StscState.get();
+
+ // two passes: first deal with inherited properties, then with new ones.
+ // this ensures that we match up with base class definitions cleanly
+
+ for (int i = 0; i < props.length; i++)
+ {
+ SchemaPropertyImpl sImpl = (SchemaPropertyImpl)props[i];
+
+ SchemaProperty baseProp =
+ (sImpl.isAttribute() ?
+ baseType.getAttributeProperty(sImpl.getName()) :
+ baseType.getElementProperty(sImpl.getName()));
+
+ if ((baseProp != null) != doInherited)
+ continue;
+
+ QName propQName = sImpl.getName();
+
+ String theName;
+
+ if (baseProp == null)
+ theName = pickJavaPropertyName(usedNames, propQName.getLocalPart(), state.getJavaname(propQName));
+ else
+ {
+ theName = baseProp.getJavaPropertyName();
+ assert(!usedNames.contains(theName));
+ usedNames.add(theName);
+ }
+
+ sImpl.setJavaPropertyName(theName);
+
+ boolean isArray = (sImpl.getMaxOccurs() == null ||
+ sImpl.getMaxOccurs().compareTo(BigInteger.ONE) > 0);
+ boolean isSingleton = !isArray && (sImpl.getMaxOccurs().signum() > 0);
+ boolean isOption = isSingleton && (sImpl.getMinOccurs().signum() == 0);
+ SchemaType javaBasedOnType = sImpl.getType();
+
+ if (baseProp != null)
+ {
+ if (baseProp.extendsJavaArray())
+ {
+ isSingleton = false;
+ isOption = false;
+ isArray = true;
+ }
+ if (baseProp.extendsJavaSingleton())
+ {
+ isSingleton = true;
+ }
+ if (baseProp.extendsJavaOption())
+ {
+ isOption = true;
+ }
+ javaBasedOnType = baseProp.javaBasedOnType();
+ }
+
+ sImpl.setExtendsJava(javaBasedOnType.getRef(), isSingleton, isOption, isArray);
+ }
+
+ }
+
+ static void assignJavaTypeCodes(SchemaProperty[] properties)
+ {
+ for (int i = 0; i < properties.length; i++)
+ {
+ SchemaPropertyImpl sImpl = (SchemaPropertyImpl)properties[i];
+ SchemaType sType = sImpl.javaBasedOnType();
+ sImpl.setJavaTypeCode(javaTypeCodeForType(sType));
+ }
+ }
+
+ static int javaTypeCodeInCommon(SchemaType[] types)
+ {
+ if (types == null || types.length == 0)
+ return SchemaProperty.XML_OBJECT;
+
+ int code = javaTypeCodeForType(types[0]);
+ if (code == SchemaProperty.JAVA_OBJECT)
+ return code;
+ for (int i = 1; i < types.length; i++)
+ {
+ // if any two are different, the answer is java.lang.Object
+ if (code != javaTypeCodeForType(types[i]))
+ return SchemaProperty.JAVA_OBJECT;
+ }
+ return code;
+ }
+
+ static int javaTypeCodeForType(SchemaType sType)
+ {
+ if (!sType.isSimpleType())
+ return SchemaProperty.XML_OBJECT;
+
+ if (sType.getSimpleVariety() == SchemaType.UNION)
+ {
+ // see if we can find an interesting common base type, e.g., for string enums
+ SchemaType baseType = sType.getUnionCommonBaseType();
+ if (baseType != null && !baseType.isURType())
+ sType = baseType;
+ else
+ return javaTypeCodeInCommon(sType.getUnionConstituentTypes());
+ }
+
+ if (sType.getSimpleVariety() == SchemaType.LIST)
+ return SchemaProperty.JAVA_LIST;
+
+ if (sType.isURType())
+ return SchemaProperty.XML_OBJECT;
+
+ switch (sType.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_ANY_SIMPLE:
+ // return SchemaProperty.XML_OBJECT;
+ return SchemaProperty.JAVA_STRING;
+
+ case SchemaType.BTC_BOOLEAN:
+ return SchemaProperty.JAVA_BOOLEAN;
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ return SchemaProperty.JAVA_BYTE_ARRAY;
+
+ case SchemaType.BTC_HEX_BINARY:
+ return SchemaProperty.JAVA_BYTE_ARRAY;
+
+ case SchemaType.BTC_ANY_URI:
+ return SchemaProperty.JAVA_STRING;
+
+ case SchemaType.BTC_QNAME:
+ return SchemaProperty.JAVA_QNAME;
+
+ case SchemaType.BTC_NOTATION:
+ return SchemaProperty.XML_OBJECT;
+
+ case SchemaType.BTC_FLOAT:
+ return SchemaProperty.JAVA_FLOAT;
+
+ case SchemaType.BTC_DOUBLE:
+ return SchemaProperty.JAVA_DOUBLE;
+
+ case SchemaType.BTC_DECIMAL:
+ switch (sType.getDecimalSize())
+ {
+ case SchemaType.SIZE_BYTE:
+ return SchemaProperty.JAVA_BYTE;
+ case SchemaType.SIZE_SHORT:
+ return SchemaProperty.JAVA_SHORT;
+ case SchemaType.SIZE_INT:
+ return SchemaProperty.JAVA_INT;
+ case SchemaType.SIZE_LONG:
+ return SchemaProperty.JAVA_LONG;
+ case SchemaType.SIZE_BIG_INTEGER:
+ return SchemaProperty.JAVA_BIG_INTEGER;
+ case SchemaType.SIZE_BIG_DECIMAL:
+ default:
+ return SchemaProperty.JAVA_BIG_DECIMAL;
+ }
+
+ case SchemaType.BTC_STRING:
+ if (isStringType(sType.getBaseEnumType()))
+ return SchemaProperty.JAVA_ENUM;
+ return SchemaProperty.JAVA_STRING;
+
+ case SchemaType.BTC_DURATION:
+ return SchemaProperty.JAVA_GDURATION;
+
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_DATE:
+ // return SchemaProperty.JAVA_DATE; // converted to calendar
+
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ // return SchemaProperty.JAVA_GDATE; // converted to calendar (JAX-B)
+ return SchemaProperty.JAVA_CALENDAR;
+
+ default:
+ assert(false) : "unrecognized code " + sType.getPrimitiveType().getBuiltinTypeCode();
+ throw new IllegalStateException("unrecognized code " + sType.getPrimitiveType().getBuiltinTypeCode() + " of " + sType.getPrimitiveType().getName());
+ }
+ }
+
+ static boolean isPropertyModelOrderInsensitive(SchemaProperty[] properties)
+ {
+ for (int i = 0; i < properties.length; i++)
+ {
+ SchemaProperty prop = properties[i];
+ if (prop.hasNillable() == SchemaProperty.VARIABLE)
+ return false;
+ if (prop.hasDefault() == SchemaProperty.VARIABLE)
+ return false;
+ if (prop.hasFixed() == SchemaProperty.VARIABLE)
+ return false;
+ if (prop.hasDefault() != SchemaProperty.NEVER &&
+ prop.getDefaultText() == null)
+ return false;
+ }
+ return true;
+ }
+
+ static boolean protectReservedGlobalClassNames(String name)
+ {
+ int i = name.lastIndexOf('.');
+ String lastSegment = name.substring(i + 1);
+ if (lastSegment.endsWith("Document") && !lastSegment.equals("Document"))
+ return true;
+ return false;
+ }
+
+ static boolean protectReservedInnerClassNames(String name)
+ {
+ return (name.equals("Enum") || name.equals("Factory"));
+ }
+
+ static String[] PROTECTED_PROPERTIES = {
+ "StringValue",
+ "BooleanValue",
+ "ByteValue",
+ "ShortValue",
+ "IntValue",
+ "LongValue",
+ "BigIntegerValue",
+ "BigDecimalValue",
+ "FloatValue",
+ "DoubleValue",
+ "ByteArrayValue",
+ "EnumValue",
+ "CalendarValue",
+ "DateValue",
+ "GDateValue",
+ "GDurationValue",
+ "QNameValue",
+ "ListValue",
+ "ObjectValue",
+ "Class",
+ };
+ static Set PROTECTED_PROPERTIES_SET = new HashSet(Arrays.asList(PROTECTED_PROPERTIES));
+
+ static boolean protectReservedPropertyNames(String name)
+ {
+ return PROTECTED_PROPERTIES_SET.contains(name) ||
+ (name.endsWith("Array") && !name.equals("Array"));
+ }
+
+ static String pickFullJavaClassName(Set usedNames, QName qName, String configname, boolean isDocument, boolean isAttrType)
+ {
+ String base;
+ boolean protect;
+
+ if (configname != null && configname.indexOf('.') >= 0)
+ {
+ // a configname with dots defines the fully qualified java class name
+ base = configname;
+ protect = protectReservedGlobalClassNames(base);
+ }
+ else
+ {
+ StscState state = StscState.get();
+ String uri = qName.getNamespaceURI();
+
+ base = NameUtil.getClassNameFromQName(qName);
+
+ // Check to see if we have a mapping from namespace URI to Java package
+ // name. If so, apply the mapped package prefix at the beginning of
+ // the base name
+
+ String pkgPrefix = state.getPackageOverride(uri);
+
+ if (pkgPrefix != null)
+ {
+ // Form the new qualified class name from the new package name
+ // and the old class name
+ base = pkgPrefix + "." + base.substring(base.lastIndexOf('.') + 1);
+ }
+
+ // See if there is a prefix...
+ String javaPrefix = state.getJavaPrefix(uri);
+ if (javaPrefix != null)
+ base = base.substring(0, base.lastIndexOf('.') + 1) + javaPrefix + base.substring(base.lastIndexOf('.') + 1);
+
+ // a configname without dots may override the shortname part.
+ if (configname != null)
+ {
+ base = base.substring(0, base.lastIndexOf('.') + 1) + configname;
+ }
+
+ protect = protectReservedGlobalClassNames(base);
+ if (configname == null)
+ {
+ // add special suffix
+ if (isDocument)
+ base = base + "Document";
+ else if (isAttrType)
+ base = base + "Attribute";
+
+ // add configured suffix
+ String javaSuffix = state.getJavaSuffix(uri);
+ if (javaSuffix != null)
+ base = base + javaSuffix;
+ }
+ }
+
+ String outermostPkg = getOutermostPackage(base);
+
+ int index = 1;
+ String uniqName;
+ if (protect)
+ uniqName = base + index;
+ else
+ uniqName = base;
+ while (usedNames.contains(uniqName.toLowerCase()) || uniqName.equals(outermostPkg))
+ {
+ index++;
+ uniqName = base + index;
+ }
+
+ usedNames.add(uniqName.toLowerCase());
+
+ return uniqName;
+ }
+
+ static String getOutermostPackage(String fqcn)
+ {
+ if (fqcn == null)
+ return "";
+
+ // remove class name
+ int lastdot = fqcn.indexOf('.');
+ if (lastdot < 0)
+ return "";
+
+ // remove outer package names
+ return fqcn.substring(0, lastdot);
+ }
+
+ static String pickFullJavaImplName(Set usedNames, String intfName)
+ {
+ // Strip off the package from the class name so we can replace it
+ String className = intfName;
+ String pkgName = null;
+ int index = intfName.lastIndexOf('.');
+ if (index >= 0)
+ {
+ className = intfName.substring(index + 1);
+ pkgName = intfName.substring(0, index);
+ }
+
+ // Form the new qualified class name from the new package name
+ // and the old class name
+ String base = pkgName + ".impl." + className + "Impl";
+
+ index = 1;
+ String uniqName = base;
+ while (usedNames.contains(uniqName.toLowerCase()))
+ {
+ index++;
+ uniqName = base + index;
+ }
+
+ usedNames.add(uniqName.toLowerCase());
+
+ return uniqName;
+ }
+
+ static String pickJavaPropertyName(Set usedNames, String localName, String javaName)
+ {
+ if (javaName == null)
+ javaName = NameUtil.upperCamelCase(localName);
+ boolean protect = protectReservedPropertyNames(javaName);
+ String uniqName;
+ int index = 1;
+ if (protect)
+ uniqName = javaName + index;
+ else
+ uniqName = javaName;
+ while (usedNames.contains(uniqName))
+ {
+ index++;
+ uniqName = javaName + index;
+ }
+
+ usedNames.add(uniqName);
+
+ return uniqName;
+ }
+
+ static String pickInnerJavaClassName(Set usedNames, String localName, String javaName)
+ {
+ if (javaName == null)
+ javaName = NameUtil.upperCamelCase(localName);
+ boolean protect = protectReservedInnerClassNames(javaName);
+ String uniqName;
+ int index = 1;
+ if (protect)
+ uniqName = javaName + index;
+ else
+ uniqName = javaName;
+ while (usedNames.contains(uniqName))
+ {
+ index++;
+ uniqName = javaName + index;
+ }
+
+ usedNames.add(uniqName);
+
+ return uniqName;
+ }
+
+ static String pickInnerJavaImplName(Set usedNames, String localName, String javaName)
+ {
+ if (javaName == null)
+ javaName = NameUtil.upperCamelCase(localName) + "Impl";
+ String uniqName = javaName;
+ int index = 1;
+ while (usedNames.contains(uniqName))
+ {
+ index++;
+ uniqName = javaName + index;
+ }
+
+ usedNames.add(uniqName);
+
+ return uniqName;
+ }
+
+ static QName findTopName(SchemaType sType)
+ {
+ if (sType.getName() != null)
+ return sType.getName();
+
+ if (sType.isDocumentType())
+ {
+ // A document type must have a content model consisting of a single elt
+ if (sType.getContentModel() == null || sType.getContentModel().getParticleType() != SchemaParticle.ELEMENT)
+ throw new IllegalStateException();
+ return (sType.getDocumentElementName());
+ }
+
+ if (sType.isAttributeType())
+ {
+ if (sType.getAttributeModel() == null || sType.getAttributeModel().getAttributes().length != 1)
+ throw new IllegalStateException();
+ return sType.getAttributeTypeAttributeName();
+ }
+
+ SchemaField sElt = sType.getContainerField();
+ assert(sElt != null);
+ assert(sType.getOuterType() == null);
+ return sElt.getName();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscResolver.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscResolver.java
new file mode 100644
index 0000000..5868d8b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscResolver.java
@@ -0,0 +1,303 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.QNameSet;
+
+import java.math.BigInteger;
+
+import java.util.*;
+
+import org.w3.x2001.xmlSchema.TopLevelElement;
+import org.w3.x2001.xmlSchema.TopLevelAttribute;
+import org.w3.x2001.xmlSchema.SimpleType;
+import org.w3.x2001.xmlSchema.Attribute;
+import org.w3.x2001.xmlSchema.Element;
+import org.w3.x2001.xmlSchema.KeyrefDocument.Keyref;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import javax.xml.namespace.QName;
+
+public class StscResolver
+{
+ /**
+ * Does a topo walk of all the types to resolve them.
+ */
+ public static void resolveAll()
+ {
+ // resolve tree of types
+ StscState state = StscState.get();
+
+ SchemaType[] documentTypes = state.documentTypes();
+ for (int i = 0 ; i < documentTypes.length ; i++)
+ resolveSubstitutionGroup((SchemaTypeImpl)documentTypes[i]);
+
+ List allSeenTypes = new ArrayList();
+ allSeenTypes.addAll(Arrays.asList(state.documentTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.attributeTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.redefinedGlobalTypes()));
+ allSeenTypes.addAll(Arrays.asList(state.globalTypes()));
+
+ for (int i = 0; i < allSeenTypes.size(); i++)
+ {
+ SchemaType gType = (SchemaType)allSeenTypes.get(i);
+ resolveType((SchemaTypeImpl)gType);
+ allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes()));
+ }
+
+ // Resolve all keyref refs
+ resolveIdentityConstraints();
+ }
+
+ public static boolean resolveType(SchemaTypeImpl sImpl)
+ {
+ if (sImpl.isResolved())
+ return true;
+ if (sImpl.isResolving())
+ {
+ StscState.get().error("Cyclic dependency error", XmlErrorContext.CYCLIC_DEPENDENCY, sImpl.getParseObject());
+ return false; // cyclic dependency error
+ }
+ // System.out.println("Resolving " + sImpl);
+
+ sImpl.startResolving();
+
+ if (sImpl.isDocumentType())
+ resolveDocumentType(sImpl);
+ else if (sImpl.isAttributeType())
+ resolveAttributeType(sImpl);
+ else if (sImpl.isSimpleType())
+ StscSimpleTypeResolver.resolveSimpleType(sImpl);
+ else
+ StscComplexTypeResolver.resolveComplexType(sImpl);
+
+ sImpl.finishResolving();
+ // System.out.println("Finished resolving " + sImpl);
+ return true;
+ }
+
+ public static boolean resolveSubstitutionGroup(SchemaTypeImpl sImpl)
+ {
+ assert sImpl.isDocumentType();
+
+ if (sImpl.isSGResolved())
+ return true;
+ if (sImpl.isSGResolving())
+ {
+ StscState.get().error("Cyclic dependency error", XmlErrorContext.CYCLIC_DEPENDENCY, sImpl.getParseObject());
+ return false; // cyclic dependency error
+ }
+
+ sImpl.startResolvingSGs();
+
+ // Resolve substitution group
+
+ TopLevelElement elt = (TopLevelElement)sImpl.getParseObject();
+ SchemaTypeImpl substitutionGroup = null;
+ QName eltName = new QName(sImpl.getTargetNamespace(), elt.getName());
+
+ // BUG: How do I tell if the type is in this compilation unit?
+ if (elt.isSetSubstitutionGroup())
+ {
+ substitutionGroup = StscState.get().findDocumentType(elt.getSubstitutionGroup(),
+ sImpl.getChameleonNamespace());
+
+ if (substitutionGroup == null)
+ StscState.get().notFoundError(elt.getSubstitutionGroup(), XmlErrorContext.ELEMENT_REF_NOT_FOUND, elt.xgetSubstitutionGroup());
+ // recovery - ignore substitution group
+ else if (! resolveSubstitutionGroup(substitutionGroup) )
+ substitutionGroup = null;
+ else
+ sImpl.setSubstitutionGroup(elt.getSubstitutionGroup());
+ }
+
+ // Walk up the chain of subtitution groups adding this schematype to each head's
+ // member list
+ while (substitutionGroup != null)
+ {
+
+ substitutionGroup.addSubstitutionGroupMember(eltName);
+
+ if (substitutionGroup.getSubstitutionGroup() == null)
+ break;
+
+ substitutionGroup = StscState.get().findDocumentType(
+ substitutionGroup.getSubstitutionGroup(), substitutionGroup.getChameleonNamespace());
+
+ assert substitutionGroup != null : "Could not find document type for: " + substitutionGroup.getSubstitutionGroup();
+
+ if (! resolveSubstitutionGroup(substitutionGroup) )
+ substitutionGroup = null; // cyclic dependency - no subst group
+
+ }
+
+ sImpl.finishResolvingSGs();
+ return true;
+
+ }
+
+ public static void resolveDocumentType ( SchemaTypeImpl sImpl )
+ {
+ assert sImpl.isResolving();
+
+ assert sImpl.isDocumentType();
+
+
+ // translate the global element associated with this document type
+ // and construct a content model which allows just that element
+
+ List anonTypes = new ArrayList();
+
+ SchemaGlobalElementImpl element =
+ (SchemaGlobalElementImpl)
+ StscTranslator.translateElement(
+ (Element) sImpl.getParseObject(),
+ sImpl.getTargetNamespace(), sImpl.isChameleon(),
+ anonTypes, sImpl );
+
+ SchemaLocalElementImpl contentModel = null;
+
+ if (element != null)
+ {
+ StscState.get().addGlobalElement( element );
+
+ contentModel = new SchemaLocalElementImpl();
+
+ contentModel.setParticleType( SchemaParticle.ELEMENT );
+ StscTranslator.copyGlobalElementToLocalElement( element, contentModel );
+ contentModel.setMinOccurs( BigInteger.ONE );
+ contentModel.setMaxOccurs( BigInteger.ONE );
+
+ contentModel.setTransitionNotes(QNameSet.EMPTY, true);
+ }
+
+ Map elementPropertyModel =
+ StscComplexTypeResolver.buildContentPropertyModelByQName(
+ contentModel, sImpl );
+
+ SchemaTypeImpl baseType = sImpl.getSubstitutionGroup() == null ?
+ BuiltinSchemaTypeSystem.ST_ANY_TYPE :
+ StscState.get().findDocumentType(sImpl.getSubstitutionGroup(),
+ sImpl.isChameleon() ? sImpl.getTargetNamespace() : null)
+ ;
+
+ sImpl.setBaseTypeRef( baseType.getRef() );
+ sImpl.setBaseDepth( baseType.getBaseDepth() + 1 );
+ sImpl.setDerivationType( SchemaType.DT_RESTRICTION );
+ sImpl.setComplexTypeVariety( SchemaType.ELEMENT_CONTENT );
+
+ sImpl.setContentModel(
+ contentModel, new SchemaAttributeModelImpl(),
+ elementPropertyModel, Collections.EMPTY_MAP, false );
+
+ sImpl.setWildcardSummary(
+ QNameSet.EMPTY, false, QNameSet.EMPTY, false );
+
+ sImpl.setAnonymousTypeRefs( makeRefArray( anonTypes ) );
+
+
+
+ }
+
+ public static void resolveAttributeType ( SchemaTypeImpl sImpl )
+ {
+ assert sImpl.isResolving();
+
+ assert sImpl.isAttributeType();
+
+ List anonTypes = new ArrayList();
+
+ SchemaGlobalAttributeImpl attribute =
+ (SchemaGlobalAttributeImpl) StscTranslator.translateAttribute(
+ (Attribute) sImpl.getParseObject(), sImpl.getTargetNamespace(),
+ sImpl.isChameleon(), anonTypes, sImpl, null, false );
+
+ SchemaAttributeModelImpl attributeModel = new SchemaAttributeModelImpl();
+
+ if (attribute != null)
+ {
+ StscState.get().addGlobalAttribute( attribute );
+
+ SchemaLocalAttributeImpl attributeCopy = new SchemaLocalAttributeImpl();
+ StscTranslator.copyGlobalAttributeToLocalAttribute( attribute, attributeCopy );
+ attributeModel.addAttribute( attributeCopy );
+ }
+
+ sImpl.setBaseTypeRef( BuiltinSchemaTypeSystem.ST_ANY_TYPE.getRef() );
+ sImpl.setBaseDepth( sImpl.getBaseDepth() + 1 );
+ sImpl.setDerivationType( SchemaType.DT_RESTRICTION );
+ sImpl.setComplexTypeVariety( SchemaType.EMPTY_CONTENT );
+
+ Map attributePropertyModel =
+ StscComplexTypeResolver.buildAttributePropertyModelByQName(
+ attributeModel, sImpl );
+
+ sImpl.setContentModel(
+ null, attributeModel, Collections.EMPTY_MAP, attributePropertyModel, false );
+
+ sImpl.setWildcardSummary(
+ QNameSet.EMPTY, false, QNameSet.EMPTY, false );
+
+ sImpl.setAnonymousTypeRefs( makeRefArray( anonTypes ) );
+ }
+
+ private static SchemaType.Ref[] makeRefArray(Collection typeList)
+ {
+ SchemaType.Ref[] result = new SchemaType.Ref[typeList.size()];
+ int j = 0;
+ for (Iterator i = typeList.iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType)i.next()).getRef();
+ return result;
+ }
+
+
+ public static void resolveIdentityConstraints()
+ {
+ StscState state = StscState.get();
+ SchemaIdentityConstraintImpl[] idcs = state.idConstraints();
+
+ for (int i = 0 ; i < idcs.length ; i++)
+ {
+ if (!idcs[i].isResolved())
+ {
+ Keyref xsdkr = (Keyref)idcs[i].getParseObject();
+ QName keyName = xsdkr.getRefer();
+ SchemaIdentityConstraintImpl key = null;
+
+ key = state.findIdConstraint(keyName, idcs[i].getChameleonNamespace());
+ if (key == null)
+ {
+ state.notFoundError(keyName, XmlErrorContext.IDC_NOT_FOUND, xsdkr);
+ }
+ else
+ {
+ if (key.getConstraintCategory() == SchemaIdentityConstraintImpl.CC_KEYREF)
+ state.error("Keyref cannot refer to another keyref.",
+ XmlErrorContext.IDC_NOT_FOUND, idcs[i].getParseObject());
+
+ if (key.getFields().length != idcs[i].getFields().length)
+ state.error("Keyref does not have same number of fields as key",
+ XmlErrorContext.IDC_NOT_FOUND, idcs[i].getParseObject());
+
+ idcs[i].setReferencedKey(key.getRef());
+ }
+ }
+ }
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
new file mode 100644
index 0000000..89cb3ba
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscSimpleTypeResolver.java
@@ -0,0 +1,1120 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.util.*;
+import java.util.List;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.regex.RegularExpression;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.XmlByte;
+import org.apache.xmlbeans.XmlShort;
+import org.apache.xmlbeans.XmlUnsignedByte;
+import org.apache.xmlbeans.XmlPositiveInteger;
+import org.apache.xmlbeans.XmlNonNegativeInteger;
+import org.w3.x2001.xmlSchema.*;
+
+public class StscSimpleTypeResolver
+{
+
+ /**************************************************************************
+ * SIMPLE TYPE RESOLUTION HERE
+ *
+ * Simple types can be declared as lists, unions, or restrictions.
+ * These three cases are treated separately in resolveListType,
+ * resolveUnionType, and resolveSimpleRestrictionType.
+ *
+ * The intricate work with facets is done in the restriction case,
+ * using method called resolveFacets (the union and list cases have
+ * trivial facet rules). Then all simple types call resolveProperties
+ * in the end to have their "fundamental facets" resolved.
+ */
+
+ public static void resolveSimpleType(SchemaTypeImpl sImpl)
+ {
+ SimpleType parseSt = (SimpleType)sImpl.getParseObject();
+
+ assert sImpl.isSimpleType();
+
+ // Verify: have list, union, or restriction, but not more than one
+ int count =
+ (parseSt.isSetList() ? 1 : 0) +
+ (parseSt.isSetUnion() ? 1 : 0) +
+ (parseSt.isSetRestriction() ? 1 : 0);
+ if (count > 1)
+ {
+ StscState.get().error(
+ "A simple type must define either a list, a union, or a restriction: more than one found.",
+ XmlErrorContext.MALFORMED_SIMPLE_TYPE_DEFN,
+ parseSt);
+ // recovery: treat it as the first of list, union, restr
+ }
+ else if (count < 1)
+ {
+ StscState.get().error("A simple type must define either a list, a union, or a restriction: none was found.",
+ XmlErrorContext.MALFORMED_SIMPLE_TYPE_DEFN,
+ parseSt);
+ // recovery: treat it as restriction of anySimpleType
+ resolveErrorSimpleType(sImpl);
+ return;
+ }
+
+ // Set final flags
+ boolean finalRest = false;
+ boolean finalList = false;
+ boolean finalUnion = false;
+
+ if (parseSt.isSetFinal())
+ {
+ String value = parseSt.getFinal();
+ if (value.equals("#all"))
+ finalRest = finalList = finalUnion = true;
+ else if (value.equals("restriction"))
+ finalRest = true;
+ else if (value.equals("list"))
+ finalList = true;
+ else if (value.equals("union"))
+ finalUnion = true;
+ }
+ sImpl.setSimpleFinal(finalRest, finalList, finalUnion);
+
+ List anonTypes = new ArrayList();
+
+ if (parseSt.getList() != null)
+ resolveListType(sImpl, parseSt.getList(), anonTypes);
+ else if (parseSt.getUnion() != null)
+ resolveUnionType(sImpl, parseSt.getUnion(), anonTypes);
+ else if (parseSt.getRestriction() != null)
+ resolveSimpleRestrictionType(sImpl, parseSt.getRestriction(), anonTypes);
+
+ sImpl.setAnonymousTypeRefs(makeRefArray(anonTypes));
+ }
+
+ private static SchemaType.Ref[] makeRefArray(Collection typeList)
+ {
+ SchemaType.Ref[] result = new SchemaType.Ref[typeList.size()];
+ int j = 0;
+ for (Iterator i = typeList.iterator(); i.hasNext(); j++)
+ result[j] = ((SchemaType)i.next()).getRef();
+ return result;
+ }
+
+ static void resolveErrorSimpleType(SchemaTypeImpl sImpl)
+ {
+ sImpl.setSimpleTypeVariety(SchemaType.ATOMIC);
+ sImpl.setBaseTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ sImpl.setBaseDepth(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getBaseDepth() + 1);
+ sImpl.setPrimitiveTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ }
+
+ static void resolveListType(SchemaTypeImpl sImpl, org.w3.x2001.xmlSchema.ListDocument.List parseList, List anonTypes)
+ {
+ StscState state = StscState.get();
+
+ sImpl.setSimpleTypeVariety(SchemaType.LIST);
+ sImpl.setBaseTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ sImpl.setBaseDepth(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_RESTRICTION);
+
+ if (sImpl.isRedefinition())
+ {
+ StscState.get().error("A type redefinition must restrict the original definition of the type.", XmlErrorContext.GENERIC_ERROR, parseList);
+ // recovery: oh well.
+ }
+
+ QName itemName = parseList.getItemType();
+ LocalSimpleType parseInner = parseList.getSimpleType();
+
+ if (itemName != null && parseInner != null)
+ {
+ state.error("List type definitions provide either an itemType attribute " +
+ "or contain a nested simpleType: both were found.",
+ XmlErrorContext.REDUNDANT_NESTED_TYPE,
+ parseList);
+ // recovery: ignore the inner simple type.
+ parseInner = null;
+ }
+
+ SchemaTypeImpl itemImpl;
+ XmlObject errorLoc;
+
+ if (itemName != null)
+ {
+ itemImpl = state.findGlobalType(itemName, sImpl.getChameleonNamespace());
+ errorLoc = parseList.xgetItemType();
+ if (itemImpl == null)
+ {
+ state.notFoundError(itemName, XmlErrorContext.TYPE_NOT_FOUND, parseList.xgetItemType());
+ // recovery: treat it as a list of anySimpleType
+ itemImpl = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ }
+ else if (parseInner != null)
+ {
+ itemImpl = new SchemaTypeImpl(state.sts());
+ errorLoc = parseInner;
+ itemImpl.setSimpleType(true);
+ itemImpl.setParseContext(parseInner, sImpl.getTargetNamespace(), sImpl.getChameleonNamespace() != null, false);
+ itemImpl.setOuterSchemaTypeRef(sImpl.getRef());
+ anonTypes.add(itemImpl);
+ }
+ else
+ {
+ state.error("List type definitions provide either an itemType attribute " +
+ "or contain a nested simpleType: neither was found.",
+ XmlErrorContext.LIST_MISSING_ITEM,
+ parseList);
+ // recovery: treat it as an extension of anySimpleType
+ resolveErrorSimpleType(sImpl);
+ return;
+ }
+
+ // Verify final restrictions
+ if (itemImpl.finalList())
+ state.error("Cannot derive by list a final type.", XmlErrorContext.CANNOT_DERIVE_FINAL, parseList);
+
+ // Recursion...
+ StscResolver.resolveType(itemImpl);
+
+ if (!itemImpl.isSimpleType())
+ {
+ state.error("Item type for this list type is not simple",
+ XmlErrorContext.LIST_ITEM_NOT_SIMPLE, errorLoc);
+ // recovery: treat the item type as anySimpleType
+ sImpl = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ switch (itemImpl.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ state.error("This item type is another list type; lists of lists are not allowed.", XmlErrorContext.LIST_OF_LIST, errorLoc);
+ // recovery: treat the list as an anySimpleType
+ resolveErrorSimpleType(sImpl);
+ return;
+ case SchemaType.UNION:
+ if (itemImpl.isUnionOfLists())
+ {
+ state.error("This item type is a union containing a list; lists of lists are not allowed.", XmlErrorContext.LIST_OF_LIST, errorLoc);
+ resolveErrorSimpleType(sImpl);
+ return;
+ }
+ // fallthrough: nonlist unions are just like atomic items
+ case SchemaType.ATOMIC:
+ sImpl.setListItemTypeRef(itemImpl.getRef());
+ break;
+ default:
+ assert(false);
+ sImpl.setListItemTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ }
+
+ // now deal with facets
+ sImpl.setBasicFacets(StscState.FACETS_LIST, StscState.FIXED_FACETS_LIST);
+ sImpl.setWhiteSpaceRule( SchemaType.WS_COLLAPSE );
+
+ // now compute our intrinsic properties
+ resolveFundamentalFacets(sImpl);
+ }
+
+
+
+
+ static void resolveUnionType(SchemaTypeImpl sImpl, UnionDocument.Union parseUnion, List anonTypes)
+ {
+ sImpl.setSimpleTypeVariety(SchemaType.UNION);
+ sImpl.setBaseTypeRef(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getRef());
+ sImpl.setBaseDepth(BuiltinSchemaTypeSystem.ST_ANY_SIMPLE.getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_RESTRICTION);
+
+ StscState state = StscState.get();
+
+ if (sImpl.isRedefinition())
+ {
+ StscState.get().error("A type redefinition must restrict the original definition of the type.", XmlErrorContext.GENERIC_ERROR, parseUnion);
+ // recovery: oh well.
+ }
+
+ List memberTypes = parseUnion.getMemberTypes();
+ SimpleType[] simpleTypes = parseUnion.getSimpleTypeArray();
+
+ List memberImplList = new ArrayList();
+
+ if (simpleTypes.length == 0 && (memberTypes == null || memberTypes.size() == 0))
+ {
+ state.error("A union type must specify at least one member type", XmlErrorContext.UNION_MEMBER_NOT_SIMPLE, parseUnion);
+ // recovery: oh well, zero member types is fine.
+ }
+
+ if (memberTypes != null)
+ {
+ for (Iterator mNames = memberTypes.iterator(); mNames.hasNext(); )
+ {
+ QName mName = (QName)mNames.next();
+ SchemaTypeImpl memberImpl = state.findGlobalType(mName, sImpl.getChameleonNamespace());
+ if (memberImpl == null)
+ // recovery: skip member
+ state.notFoundError(mName, XmlErrorContext.TYPE_NOT_FOUND, parseUnion.xgetMemberTypes());
+ else
+ memberImplList.add(memberImpl);
+ }
+ }
+
+ for (int i = 0; i < simpleTypes.length; i++)
+ {
+ // BUGBUG: see if non<simpleType> children can leak through
+ SchemaTypeImpl mImpl = new SchemaTypeImpl(state.sts());
+ mImpl.setSimpleType(true);
+ mImpl.setParseContext(simpleTypes[i], sImpl.getTargetNamespace(), sImpl.getChameleonNamespace() != null, false);
+ memberImplList.add(mImpl);
+ mImpl.setOuterSchemaTypeRef(sImpl.getRef());
+ mImpl.setAnonymousUnionMemberOrdinal(i + 1);
+ anonTypes.add(mImpl);
+ }
+
+ // Recurse and resolve all member types
+ for (Iterator mImpls = memberImplList.iterator(); mImpls.hasNext(); )
+ {
+ SchemaTypeImpl mImpl = (SchemaTypeImpl)mImpls.next();
+ if (!StscResolver.resolveType(mImpl))
+ {
+ if (mImpl.getOuterType().equals(sImpl))
+ state.error("Member has a cyclic dependency on the containing union", XmlErrorContext.CYCLIC_DEPENDENCY, mImpl.getParseObject());
+ else
+ state.error("Member " + QNameHelper.pretty(mImpl.getName()) + " has a cyclic dependency on the union", XmlErrorContext.CYCLIC_DEPENDENCY, parseUnion.xgetMemberTypes());
+
+ // recovery: ignore the errant union member
+ mImpls.remove();
+ continue;
+ }
+ }
+
+ // Now verify members
+ boolean isUnionOfLists = false;
+
+ for (Iterator mImpls = memberImplList.iterator(); mImpls.hasNext(); )
+ {
+ SchemaTypeImpl mImpl = (SchemaTypeImpl)mImpls.next();
+
+ if (!mImpl.isSimpleType())
+ {
+ if (mImpl.getOuterType() != null && mImpl.getOuterType().equals(sImpl))
+ state.error("Member is not simple", XmlErrorContext.UNION_MEMBER_NOT_SIMPLE, mImpl.getParseObject());
+ else
+ state.error("Member " + QNameHelper.pretty(mImpl.getName()) + " is not simple", XmlErrorContext.UNION_MEMBER_NOT_SIMPLE, parseUnion.xgetMemberTypes());
+
+ // recovery: ignore the errant union member
+ mImpls.remove();
+ continue;
+ }
+
+ if (mImpl.getSimpleVariety() == SchemaType.LIST ||
+ mImpl.getSimpleVariety() == SchemaType.UNION && mImpl.isUnionOfLists())
+ isUnionOfLists = true;
+ }
+
+ // Verify any final restrictions
+ for (int i = 0 ; i < memberImplList.size() ; i++)
+ {
+ SchemaTypeImpl mImpl = (SchemaTypeImpl)memberImplList.get(i);
+ if (mImpl.finalUnion())
+ state.error("Cannot derive by union a final type.", XmlErrorContext.CANNOT_DERIVE_FINAL, parseUnion);
+ }
+
+ sImpl.setUnionOfLists(isUnionOfLists);
+
+ sImpl.setUnionMemberTypeRefs(makeRefArray(memberImplList));
+
+ // now deal with facets
+ sImpl.setBasicFacets(StscState.FACETS_UNION, StscState.FIXED_FACETS_UNION);
+
+ // now compute our intrinsic properties
+ resolveFundamentalFacets(sImpl);
+ }
+
+ static void resolveSimpleRestrictionType(SchemaTypeImpl sImpl, RestrictionDocument.Restriction parseRestr, List anonTypes)
+ {
+ QName baseName = parseRestr.getBase();
+ SimpleType parseInner = parseRestr.getSimpleType();
+ StscState state = StscState.get();
+
+ if (baseName != null && parseInner != null)
+ {
+ state.error("Simple type restrictions must name a base type " +
+ "or contain a nested simple type: both were found.",
+ XmlErrorContext.RESTRICTION_REDUNDANT_BASE,
+ parseRestr);
+ // recovery: ignore the inner simple type.
+ parseInner = null;
+ }
+
+ SchemaTypeImpl baseImpl;
+
+ if (baseName != null)
+ {
+ if (sImpl.isRedefinition())
+ {
+ baseImpl = state.findRedefinedGlobalType(parseRestr.getBase(), sImpl.getChameleonNamespace(), sImpl.getName());
+ if (baseImpl != null && !baseImpl.getName().equals(sImpl.getName()))
+ state.error("A type redefinition must restrict the original type definition", XmlErrorContext.GENERIC_ERROR, parseRestr);
+ }
+ else
+ {
+ baseImpl = state.findGlobalType(baseName, sImpl.getChameleonNamespace());
+ }
+ if (baseImpl == null)
+ {
+ state.notFoundError(baseName, XmlErrorContext.TYPE_NOT_FOUND, parseRestr.xgetBase());
+ // recovery: treat it as an extension of anySimpleType
+ baseImpl = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+ }
+ else if (parseInner != null)
+ {
+ if (sImpl.isRedefinition())
+ {
+ StscState.get().error("A type redefinition must restrict the original definition of the type.", XmlErrorContext.GENERIC_ERROR, parseInner);
+ // recovery: oh well.
+ }
+
+ baseImpl = new SchemaTypeImpl(state.sts());
+ baseImpl.setSimpleType(true);
+ baseImpl.setParseContext(parseInner, sImpl.getTargetNamespace(), sImpl.getChameleonNamespace() != null, false);
+ // baseImpl.setSkippedAnonymousType(true);
+ baseImpl.setOuterSchemaTypeRef(sImpl.getRef());
+ anonTypes.add(baseImpl);
+ }
+ else
+ {
+ state.error("Simple type restrictions must name a base type " +
+ "or contain a nested simple type: neither were found.",
+ XmlErrorContext.RESTRICTION_MISSING_BASE,
+ parseRestr);
+ // recovery: treat it as an extension of anySimpleType
+ baseImpl = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ // Recursion!
+ if (!StscResolver.resolveType(baseImpl))
+ {
+ // cyclic dependency recovery: treat it as an extension of anySimpleType
+ baseImpl = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ if (baseImpl.finalRestriction())
+ state.error("Cannot restrict a final type", XmlErrorContext.CANNOT_DERIVE_FINAL, parseRestr);
+
+ sImpl.setBaseTypeRef(baseImpl.getRef());
+ sImpl.setBaseDepth(baseImpl.getBaseDepth() + 1);
+ sImpl.setDerivationType(SchemaType.DT_RESTRICTION);
+
+ if (!baseImpl.isSimpleType())
+ {
+ state.error("Base type for this simple type restriction is not simple",
+ XmlErrorContext.SIMPLE_RESTRICTION_NOT_SIMPLE,
+ parseRestr.xgetBase());
+ // recovery: treat it as a restriction of anySimpleType
+ resolveErrorSimpleType(sImpl);
+ return;
+ }
+
+ sImpl.setSimpleTypeVariety(baseImpl.getSimpleVariety());
+
+ // copy variety-specific properties
+ switch (baseImpl.getSimpleVariety())
+ {
+ case SchemaType.ATOMIC:
+ sImpl.setPrimitiveTypeRef(baseImpl.getPrimitiveType().getRef());
+ break;
+ case SchemaType.UNION:
+ sImpl.setUnionOfLists(baseImpl.isUnionOfLists());
+ sImpl.setUnionMemberTypeRefs(makeRefArray(Arrays.asList(baseImpl.getUnionMemberTypes())));
+ break;
+ case SchemaType.LIST:
+ sImpl.setListItemTypeRef(baseImpl.getListItemType().getRef());
+ break;
+ }
+
+ // deal with facets
+ resolveFacets(sImpl, parseRestr, baseImpl);
+
+ // now compute our intrinsic properties
+ resolveFundamentalFacets(sImpl);
+ }
+
+ static int translateWhitespaceCode(XmlAnySimpleType value)
+ {
+ // BUGBUG: add whitespace rule to textvalue.
+ String textval = value.getStringValue();
+
+ if (textval.equals("collapse"))
+ return SchemaType.WS_COLLAPSE;
+
+ if (textval.equals("preserve"))
+ return SchemaType.WS_PRESERVE;
+
+ if (textval.equals("replace"))
+ return SchemaType.WS_REPLACE;
+
+ StscState.get().error("Unrecognized whitespace value \"" + textval + "\"", XmlErrorContext.FACET_VALUE_MALFORMED, value);
+ return SchemaType.WS_UNSPECIFIED;
+ }
+
+ static boolean isMultipleFacet(int facetcode)
+ {
+ return (facetcode == SchemaType.FACET_ENUMERATION ||
+ facetcode == SchemaType.FACET_PATTERN);
+ }
+
+ static boolean facetAppliesToType(int facetCode, SchemaTypeImpl baseImpl)
+ {
+ switch (baseImpl.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_LENGTH:
+ case SchemaType.FACET_MIN_LENGTH:
+ case SchemaType.FACET_MAX_LENGTH:
+ case SchemaType.FACET_ENUMERATION:
+ case SchemaType.FACET_PATTERN:
+ case SchemaType.FACET_WHITE_SPACE:
+ return true;
+ }
+ return false;
+
+ case SchemaType.UNION:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_ENUMERATION:
+ case SchemaType.FACET_PATTERN:
+ return true;
+ }
+ return false;
+ }
+
+ // the atomic case
+
+ switch (baseImpl.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_ANY_SIMPLE:
+ return false;
+
+ case SchemaType.BTC_BOOLEAN:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_PATTERN:
+ case SchemaType.FACET_WHITE_SPACE:
+ return true;
+ }
+ return false;
+
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_MIN_EXCLUSIVE:
+ case SchemaType.FACET_MIN_INCLUSIVE:
+ case SchemaType.FACET_MAX_INCLUSIVE:
+ case SchemaType.FACET_MAX_EXCLUSIVE:
+ case SchemaType.FACET_ENUMERATION:
+ case SchemaType.FACET_PATTERN:
+ case SchemaType.FACET_WHITE_SPACE:
+ return true;
+ }
+ return false;
+
+ case SchemaType.BTC_DECIMAL:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_MIN_EXCLUSIVE:
+ case SchemaType.FACET_MIN_INCLUSIVE:
+ case SchemaType.FACET_MAX_INCLUSIVE:
+ case SchemaType.FACET_MAX_EXCLUSIVE:
+ case SchemaType.FACET_TOTAL_DIGITS:
+ case SchemaType.FACET_FRACTION_DIGITS:
+ case SchemaType.FACET_ENUMERATION:
+ case SchemaType.FACET_PATTERN:
+ case SchemaType.FACET_WHITE_SPACE:
+ return true;
+ }
+ return false;
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_STRING:
+ switch (facetCode)
+ {
+ case SchemaType.FACET_LENGTH:
+ case SchemaType.FACET_MIN_LENGTH:
+ case SchemaType.FACET_MAX_LENGTH:
+ case SchemaType.FACET_ENUMERATION:
+ case SchemaType.FACET_PATTERN:
+ case SchemaType.FACET_WHITE_SPACE:
+ return true;
+ }
+ return false;
+ default:
+ assert(false);
+ return false;
+ }
+ }
+
+ private static int other_similar_limit(int facetcode)
+ {
+ switch (facetcode)
+ {
+ case SchemaType.FACET_MIN_EXCLUSIVE:
+ return SchemaType.FACET_MIN_INCLUSIVE;
+ case SchemaType.FACET_MIN_INCLUSIVE:
+ return SchemaType.FACET_MIN_EXCLUSIVE;
+ case SchemaType.FACET_MAX_INCLUSIVE:
+ return SchemaType.FACET_MAX_EXCLUSIVE;
+ case SchemaType.FACET_MAX_EXCLUSIVE:
+ return SchemaType.FACET_MAX_INCLUSIVE;
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+ }
+
+ static void resolveFacets(SchemaTypeImpl sImpl, XmlObject restriction, SchemaTypeImpl baseImpl)
+ {
+ StscState state = StscState.get();
+
+ boolean[] seenFacet = new boolean[SchemaType.LAST_FACET + 1];
+ XmlAnySimpleType[] myFacets = baseImpl.getBasicFacets(); // makes a copy
+ boolean[] fixedFacets = baseImpl.getFixedFacets();
+ int wsr = SchemaType.WS_UNSPECIFIED;
+ List enumeratedValues = null;
+ List patterns = null;
+
+ if (restriction != null)
+ {
+ XmlCursor cur = restriction.newCursor();
+ for (boolean more = cur.toFirstChild(); more; more = cur.toNextSibling())
+ {
+ int code = translateFacetCode(cur.getName());
+ if (code == -1)
+ continue;
+
+ Facet facet = (Facet)cur.getObject();
+
+ if (!facetAppliesToType(code, baseImpl))
+ {
+ state.error("The facet " + facet.newCursor().getName().getLocalPart() + " does not apply to the base type " + baseImpl, XmlErrorContext.FACET_DOES_NOT_APPLY, facet);
+ continue;
+ }
+ if (seenFacet[code] && !isMultipleFacet(code))
+ {
+ state.error("Facet specified multiple times", XmlErrorContext.FACET_DUPLICATED, facet);
+ continue;
+ }
+ seenFacet[code] = true;
+
+ switch (code)
+ {
+ case SchemaType.FACET_LENGTH:
+ if (myFacets[SchemaType.FACET_MIN_LENGTH] != null ||
+ myFacets[SchemaType.FACET_MAX_LENGTH] != null)
+ {
+ state.error("Cannot specify length in addition to minLength or maxLength", XmlErrorContext.FACET_DUPLICATED, facet);
+ continue;
+ }
+ XmlInteger len = StscTranslator.buildNnInteger(facet.getValue());
+ if (len == null)
+ {
+ state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ if (fixedFacets[code] && !myFacets[code].valueEquals(len))
+ {
+ state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
+ continue;
+ }
+ myFacets[code] = len;
+ break;
+
+ case SchemaType.FACET_MIN_LENGTH:
+ case SchemaType.FACET_MAX_LENGTH:
+ if (myFacets[SchemaType.FACET_LENGTH] != null)
+ {
+ state.error("Cannot specify minLength or maxLength in addition to length", XmlErrorContext.FACET_DUPLICATED, facet);
+ continue;
+ }
+ XmlInteger mlen = StscTranslator.buildNnInteger(facet.getValue());
+ if (mlen == null)
+ {
+ state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ if (fixedFacets[code] && !myFacets[code].valueEquals(mlen))
+ {
+ state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
+ continue;
+ }
+ if (myFacets[SchemaType.FACET_MAX_LENGTH] != null)
+ {
+ if (mlen.compareValue(myFacets[SchemaType.FACET_MAX_LENGTH]) > 0)
+ {
+ state.error("Larger than prior maxLength", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ }
+ if (myFacets[SchemaType.FACET_MIN_LENGTH] != null)
+ {
+ if (mlen.compareValue(myFacets[SchemaType.FACET_MIN_LENGTH]) < 0)
+ {
+ state.error("Smaller than prior minLength", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ }
+ myFacets[code] = mlen;
+ break;
+
+ case SchemaType.FACET_TOTAL_DIGITS:
+ XmlPositiveInteger dig = StscTranslator.buildPosInteger(facet.getValue());
+ if (dig == null)
+ {
+ state.error("Must be a positive integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ break;
+ }
+ if (fixedFacets[code] && !myFacets[code].valueEquals(dig))
+ {
+ state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
+ continue;
+ }
+ if (myFacets[SchemaType.FACET_TOTAL_DIGITS] != null)
+ {
+ if (dig.compareValue(myFacets[SchemaType.FACET_TOTAL_DIGITS]) > 0)
+ state.error("Larger than prior totalDigits", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ }
+ myFacets[code] = dig;
+ break;
+
+ case SchemaType.FACET_FRACTION_DIGITS:
+ XmlNonNegativeInteger fdig = StscTranslator.buildNnInteger(facet.getValue());
+ if (fdig == null)
+ {
+ state.error("Must be a nonnegative integer", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ break;
+ }
+ if (fixedFacets[code] && !myFacets[code].valueEquals(fdig))
+ {
+ state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
+ continue;
+ }
+ if (myFacets[SchemaType.FACET_FRACTION_DIGITS] != null)
+ {
+ if (fdig.compareValue(myFacets[SchemaType.FACET_FRACTION_DIGITS]) > 0)
+ state.error("Larger than prior fractionDigits", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ }
+ myFacets[code] = fdig;
+ break;
+
+ case SchemaType.FACET_MIN_EXCLUSIVE:
+ case SchemaType.FACET_MIN_INCLUSIVE:
+ case SchemaType.FACET_MAX_INCLUSIVE:
+ case SchemaType.FACET_MAX_EXCLUSIVE:
+
+ if (seenFacet[other_similar_limit(code)])
+ {
+ state.error("Cannot define both inclusive and exclusive limit in the same restriciton", XmlErrorContext.FACET_DUPLICATED, facet);
+ continue;
+ }
+ boolean ismin = (code == SchemaType.FACET_MIN_EXCLUSIVE || code == SchemaType.FACET_MIN_INCLUSIVE);
+ boolean isexclusive = (code == SchemaType.FACET_MIN_EXCLUSIVE || code == SchemaType.FACET_MAX_EXCLUSIVE);
+
+ XmlAnySimpleType limit;
+ try
+ {
+ limit = baseImpl.newValue(facet.getValue());
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ // note: this guarantees that the limit is a valid number in the
+ // base data type!!
+ state.error("Must be valid value in base type", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+
+ // BUGBUG: if there are actual schemas that redefine min/maxExclusive,
+ // they will need this rule relaxed for them!!
+ continue;
+ }
+ if (fixedFacets[code] && !myFacets[code].valueEquals(limit))
+ {
+ state.error("This facet is fixed and cannot be overridden", XmlErrorContext.FACET_FIXED, facet);
+ continue;
+ }
+ if (myFacets[code] != null)
+ {
+ int comparison = limit.compareValue(myFacets[code]);
+ if (comparison == 2 || comparison == (ismin ? -1 : 1))
+ {
+ state.error(ismin ?
+ (isexclusive ?
+ "Must be greater than or equal to previous minExclusive" :
+ "Must be greater than or equal to previous minInclusive") :
+ (isexclusive ?
+ "Must be less than or equal to previous maxExclusive" :
+ "Must be less than or equal to previous maxInclusive"),
+ XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ }
+ myFacets[code] = limit;
+ myFacets[other_similar_limit(code)] = null;
+ break;
+
+ case SchemaType.FACET_WHITE_SPACE:
+ wsr = translateWhitespaceCode(facet.getValue());
+ if (baseImpl.getWhiteSpaceRule() > wsr)
+ {
+ wsr = SchemaType.WS_UNSPECIFIED;
+ state.error("Cannot apply this whitespace facet over the previous one", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ myFacets[code] = StscState.build_wsstring(wsr).get();
+ break;
+
+ case SchemaType.FACET_ENUMERATION:
+ XmlObject enumval;
+ try
+ {
+ enumval = baseImpl.newValue(facet.getValue());
+ // enumval.set(facet.getValue());
+ // ((XmlObjectBase)enumval).setImmutable();
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ state.error("Enumerated value invalid in base type", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ if (enumeratedValues == null)
+ enumeratedValues = new ArrayList();
+ enumeratedValues.add(enumval);
+ break;
+
+ case SchemaType.FACET_PATTERN:
+ RegularExpression p;
+ try { p = new RegularExpression(facet.getValue().getStringValue(), "X"); }
+ catch (org.apache.xmlbeans.impl.regex.ParseException e)
+ {
+ state.error("Malformed regular expression", XmlErrorContext.FACET_VALUE_MALFORMED, facet);
+ continue;
+ }
+ if (patterns == null)
+ patterns = new ArrayList();
+ patterns.add(p);
+ break;
+ }
+
+ if (facet.getFixed())
+ fixedFacets[code] = true;
+ }
+ }
+
+ // Store the array of basic facets
+
+ sImpl.setBasicFacets(makeValueRefArray(myFacets), fixedFacets);
+
+ // Update the numeric whitespace rule
+ if (wsr == SchemaType.WS_UNSPECIFIED)
+ wsr = baseImpl.getWhiteSpaceRule();
+ sImpl.setWhiteSpaceRule(wsr);
+
+ // store away the enumerated values
+ if (enumeratedValues != null)
+ {
+ sImpl.setEnumerationValues(makeValueRefArray((XmlAnySimpleType[])
+ enumeratedValues.toArray(new XmlAnySimpleType[enumeratedValues.size()])));
+
+ SchemaType beType = sImpl;
+ if (sImpl.getBaseType().getBaseEnumType() != null)
+ beType = sImpl.getBaseType().getBaseEnumType();
+ sImpl.setBaseEnumTypeRef(beType.getRef());
+ }
+ else
+ {
+ sImpl.copyEnumerationValues(baseImpl);
+ }
+
+ // store the pattern list
+ RegularExpression[] patternArray;
+ if (patterns != null && patterns.size() != 0)
+ {
+ patternArray = new RegularExpression[patterns.size()];
+ patterns.toArray(patternArray);
+ }
+ else
+ {
+ patternArray = EMPTY_REGEX_ARRAY;
+ }
+ sImpl.setPatternFacet((patternArray.length > 0 || baseImpl.hasPatternFacet()));
+ sImpl.setPatterns(patternArray);
+ }
+
+ private static XmlValueRef[] makeValueRefArray(XmlAnySimpleType[] source)
+ {
+ XmlValueRef[] result = new XmlValueRef[source.length];
+ for (int i = 0; i < result.length; i++)
+ result[i] = (source[i] == null ? null : new XmlValueRef(source[i]));
+ return result;
+ }
+
+ private static final RegularExpression[] EMPTY_REGEX_ARRAY = new RegularExpression[0];
+
+ private static boolean isDiscreteType(SchemaTypeImpl sImpl)
+ {
+ if (sImpl.getFacet(SchemaType.FACET_FRACTION_DIGITS) != null)
+ return true;
+ // BUGBUG: spec is silent on enumerations; they're finite too.
+ switch (sImpl.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_BOOLEAN:
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean isNumericPrimitive(SchemaType sImpl)
+ {
+ switch (sImpl.getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ return true;
+ }
+ return false;
+ }
+
+ private static int decimalSizeOfType(SchemaTypeImpl sImpl)
+ {
+ int size = mathematicalSizeOfType(sImpl);
+
+ // byte and short are inconvenient, because setByte((byte)4) requires a cast.
+ // So use "int" unless you're really a xs:byte, xs:short, or an xs:unsignedByte
+ // (the last case is included for alignment with JAXB)
+
+ if (size == SchemaType.SIZE_BYTE && !XmlByte.type.isAssignableFrom(sImpl))
+ size = SchemaType.SIZE_SHORT;
+ if (size == SchemaType.SIZE_SHORT && !XmlShort.type.isAssignableFrom(sImpl) && !XmlUnsignedByte.type.isAssignableFrom(sImpl))
+ size = SchemaType.SIZE_INT;
+
+ return size;
+ }
+
+ private static int mathematicalSizeOfType(SchemaTypeImpl sImpl)
+ {
+ if (sImpl.getPrimitiveType().getBuiltinTypeCode() != SchemaType.BTC_DECIMAL)
+ return SchemaType.NOT_DECIMAL;
+
+ if (sImpl.getFacet(SchemaType.FACET_FRACTION_DIGITS) == null ||
+ ((SimpleValue)sImpl.getFacet(SchemaType.FACET_FRACTION_DIGITS)).getBigIntegerValue().signum() != 0)
+ return SchemaType.SIZE_BIG_DECIMAL;
+
+ BigInteger min = null;
+ BigInteger max = null;
+
+ if (sImpl.getFacet(SchemaType.FACET_MIN_EXCLUSIVE) != null)
+ min = ((SimpleValue)sImpl.getFacet(SchemaType.FACET_MIN_EXCLUSIVE)).getBigIntegerValue(); // .add(BigInteger.ONE);
+ if (sImpl.getFacet(SchemaType.FACET_MIN_INCLUSIVE) != null)
+ min = ((SimpleValue)sImpl.getFacet(SchemaType.FACET_MIN_INCLUSIVE)).getBigIntegerValue();
+ if (sImpl.getFacet(SchemaType.FACET_MAX_INCLUSIVE) != null)
+ max = ((SimpleValue)sImpl.getFacet(SchemaType.FACET_MAX_INCLUSIVE)).getBigIntegerValue();
+ if (sImpl.getFacet(SchemaType.FACET_MAX_EXCLUSIVE) != null)
+ max = ((SimpleValue)sImpl.getFacet(SchemaType.FACET_MAX_EXCLUSIVE)).getBigIntegerValue(); // .subtract(BigInteger.ONE);
+
+ if (sImpl.getFacet(SchemaType.FACET_TOTAL_DIGITS) != null)
+ {
+ BigInteger peg = null;
+ try
+ {
+ BigInteger totalDigits = ((SimpleValue)sImpl.getFacet(SchemaType.FACET_TOTAL_DIGITS)).getBigIntegerValue();
+
+ switch (totalDigits.intValue())
+ {
+ case 0: case 1: case 2:
+ peg = BigInteger.valueOf(99L); // BYTE size
+ break;
+ case 3: case 4:
+ peg = BigInteger.valueOf(9999L); // SHORT size
+ break;
+ case 5: case 6: case 7: case 8: case 9:
+ peg = BigInteger.valueOf(999999999L); // INT size
+ break;
+ case 10: case 11: case 12: case 13: case 14:
+ case 15: case 16: case 17: case 18:
+ peg = BigInteger.valueOf(999999999999999999L); // LONG size
+ break;
+ }
+ }
+ catch (XmlValueOutOfRangeException e) {}
+ if (peg != null)
+ {
+ min = (min == null ? peg.negate() : min.max(peg.negate()));
+ max = (max == null ? peg : max.min(peg));
+ }
+ }
+
+ if (min != null && max != null)
+ {
+ // find the largest "absolute value" number that must be dealt with
+ if (min.signum() < 0)
+ min = min.negate().subtract(BigInteger.ONE);
+ if (max.signum() < 0)
+ max = max.negate().subtract(BigInteger.ONE);
+
+ max = max.max(min);
+ if (max.compareTo(BigInteger.valueOf(Byte.MAX_VALUE)) <= 0)
+ return SchemaType.SIZE_BYTE;
+ if (max.compareTo(BigInteger.valueOf(Short.MAX_VALUE)) <= 0)
+ return SchemaType.SIZE_SHORT;
+ if (max.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) <= 0)
+ return SchemaType.SIZE_INT;
+ if (max.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) <= 0)
+ return SchemaType.SIZE_LONG;
+ }
+
+ return SchemaType.SIZE_BIG_INTEGER;
+ }
+
+
+ static void resolveFundamentalFacets(SchemaTypeImpl sImpl)
+ {
+ // deal with, isOrdered, isBounded, isFinite, isNumeric
+ // also deal with
+ switch (sImpl.getSimpleVariety())
+ {
+ case SchemaType.ATOMIC:
+ SchemaTypeImpl baseImpl = (SchemaTypeImpl)sImpl.getBaseType();
+ sImpl.setOrdered(baseImpl.ordered());
+ sImpl.setBounded(
+ (sImpl.getFacet(SchemaType.FACET_MIN_EXCLUSIVE) != null ||
+ sImpl.getFacet(SchemaType.FACET_MIN_INCLUSIVE) != null) &&
+ (sImpl.getFacet(SchemaType.FACET_MAX_INCLUSIVE) != null ||
+ sImpl.getFacet(SchemaType.FACET_MAX_EXCLUSIVE) != null));
+ sImpl.setFinite(baseImpl.isFinite() ||
+ sImpl.isBounded() && isDiscreteType(sImpl));
+ sImpl.setNumeric(baseImpl.isNumeric() ||
+ isNumericPrimitive(sImpl.getPrimitiveType()));
+ sImpl.setDecimalSize(decimalSizeOfType(sImpl));
+ break;
+ case SchemaType.UNION:
+ SchemaType[] mTypes = sImpl.getUnionMemberTypes();
+ int ordered = SchemaType.UNORDERED;
+ boolean isBounded = true;
+ boolean isFinite = true;
+ boolean isNumeric = true;
+ // ordered if any is ordered, bounded if all are bounded.
+ for (int i = 0; i < mTypes.length; i++)
+ {
+ if (mTypes[i].ordered() != SchemaType.UNORDERED)
+ ordered = SchemaType.PARTIAL_ORDER;
+ if (!mTypes[i].isBounded())
+ isBounded = false;
+ if (!mTypes[i].isFinite())
+ isFinite = false;
+ if (!mTypes[i].isNumeric())
+ isNumeric = false;
+ }
+ sImpl.setOrdered(ordered);
+ sImpl.setBounded(isBounded);
+ sImpl.setFinite(isFinite);
+ sImpl.setNumeric(isNumeric);
+ sImpl.setDecimalSize(SchemaType.NOT_DECIMAL);
+ break;
+ case SchemaType.LIST:
+ sImpl.setOrdered(SchemaType.UNORDERED);
+ // BUGBUG: the schema spec is wrong here: MIN_LENGTH is not needed, beause len >=0
+ sImpl.setBounded(sImpl.getFacet(SchemaType.FACET_LENGTH) != null ||
+ sImpl.getFacet(SchemaType.FACET_MAX_LENGTH) != null);
+ // BUGBUG: the schema spec is wrong here: finite cardinality requires item type is finite
+ sImpl.setFinite(sImpl.getListItemType().isFinite() && sImpl.isBounded());
+ sImpl.setNumeric(false);
+ sImpl.setDecimalSize(SchemaType.NOT_DECIMAL);
+ break;
+ }
+ }
+
+ private static class CodeForNameEntry
+ {
+ CodeForNameEntry(QName name, int code)
+ { this.name = name; this.code = code; }
+ public QName name;
+ public int code;
+ }
+
+ private static CodeForNameEntry[] facetCodes = new CodeForNameEntry[]
+ {
+ new CodeForNameEntry(QNameHelper.forLNS("length", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_LENGTH),
+ new CodeForNameEntry(QNameHelper.forLNS("minLength", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MIN_LENGTH),
+ new CodeForNameEntry(QNameHelper.forLNS("maxLength", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MAX_LENGTH),
+ new CodeForNameEntry(QNameHelper.forLNS("pattern", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_PATTERN),
+ new CodeForNameEntry(QNameHelper.forLNS("enumeration", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_ENUMERATION),
+ new CodeForNameEntry(QNameHelper.forLNS("whiteSpace", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_WHITE_SPACE),
+ new CodeForNameEntry(QNameHelper.forLNS("maxInclusive", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MAX_INCLUSIVE),
+ new CodeForNameEntry(QNameHelper.forLNS("maxExclusive", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MAX_EXCLUSIVE),
+ new CodeForNameEntry(QNameHelper.forLNS("minInclusive", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MIN_INCLUSIVE),
+ new CodeForNameEntry(QNameHelper.forLNS("minExclusive", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_MIN_EXCLUSIVE),
+ new CodeForNameEntry(QNameHelper.forLNS("totalDigits", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_TOTAL_DIGITS),
+ new CodeForNameEntry(QNameHelper.forLNS("fractionDigits", "http://www.w3.org/2001/XMLSchema"), SchemaType.FACET_FRACTION_DIGITS),
+ };
+
+ private static final Map facetCodeMap = buildFacetCodeMap();
+
+ private static Map buildFacetCodeMap()
+ {
+ Map result = new HashMap();
+ for (int i = 0; i < facetCodes.length; i++)
+ result.put(facetCodes[i].name, new Integer(facetCodes[i].code));
+ return result;
+ }
+
+ private static int translateFacetCode(QName name)
+ {
+ Integer result = ((Integer)facetCodeMap.get(name));
+ if (result == null)
+ return -1;
+ return result.intValue();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java
new file mode 100644
index 0000000..fbe52dd
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscState.java
@@ -0,0 +1,1090 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.config.SchemaConfig;
+import org.apache.xmlbeans.impl.config.ExtensionHolder;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaComponent;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.SchemaAttributeGroup;
+import org.apache.xmlbeans.SchemaModelGroup;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.values.XmlStringImpl;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.util.HexBin;
+
+import java.util.*;
+import java.net.URISyntaxException;
+import java.net.URI;
+import java.io.File;
+
+
+import javax.xml.namespace.QName;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.xml.sax.EntityResolver;
+
+/**
+ * This class represents the state of the SchemaTypeSystemCompiler as it's
+ * going.
+ */
+public class StscState
+{
+ private String _givenStsName;
+ private Collection _errorListener;
+ private SchemaTypeSystemImpl _target;
+ private SchemaConfig _config;
+ private Map _compatMap;
+ private boolean _doingDownloads;
+ private byte[] _digest = null;
+ private boolean _noDigest = false;
+
+ private SchemaTypeLoader _importingLoader;
+
+ private Map _redefinedGlobalTypes = new LinkedHashMap();
+ private Map _redefinedModelGroups = new LinkedHashMap();
+ private Map _redefinedAttributeGroups = new LinkedHashMap();
+
+ private Map _globalTypes = new LinkedHashMap();
+ private Map _globalElements = new LinkedHashMap();
+ private Map _globalAttributes = new LinkedHashMap();
+ private Map _modelGroups = new LinkedHashMap();
+ private Map _attributeGroups = new LinkedHashMap();
+ private Map _documentTypes = new LinkedHashMap();
+ private Map _attributeTypes = new LinkedHashMap();
+ private Map _typesByClassname = new LinkedHashMap();
+ private Map _misspelledNames = new HashMap();
+ private Set _processingGroups = new HashSet();
+ private Map _idConstraints = new LinkedHashMap();
+ private Set _namespaces = new HashSet();
+ private boolean _noUpa;
+ private boolean _noPvr;
+ private Set _mdefNamespaces = buildDefaultMdefNamespaces();
+ private EntityResolver _entityResolver;
+
+ private static Set buildDefaultMdefNamespaces()
+ {
+ // namespaces which are known to appear in WSDLs redundantly
+ return new HashSet(
+ Arrays.asList( new String[] {
+ "http://www.openuri.org/2002/04/soap/conversation/",
+ }));
+ }
+
+ /**
+ * Used to store the new target namespace for a chameleon
+ * included schema.
+ */
+ public static final Object CHAMELEON_INCLUDE_URI = new Object();
+
+ /**
+ * Only constructed via StscState.start().
+ */
+ private StscState()
+ {
+ }
+
+ /**
+ * Initializer for schematypepath
+ */
+ public void setImportingTypeLoader(SchemaTypeLoader loader)
+ {
+ _importingLoader = loader;
+ }
+
+ /**
+ * Initializer for error handling.
+ */
+ public void setErrorListener(Collection errorListener)
+ { _errorListener = errorListener; }
+
+ /**
+ * Passes an error on to the current XmlErrorContext.
+ */
+ public void error(String message, int code, XmlObject loc)
+ { addError(_errorListener, message, code, loc); }
+
+ /**
+ * Passes a warning on to the current XmlErrorContext.
+ */
+ public void warning(String message, int code, XmlObject loc)
+ {
+ // it's OK for XMLSchema.xsd itself to have reserved type names
+ if (code == XmlErrorContext.RESERVED_TYPE_NAME &&
+ loc.documentProperties().getSourceName() != null &&
+ loc.documentProperties().getSourceName().indexOf("XMLSchema.xsd") > 0)
+ return;
+
+ addWarning(_errorListener, message, code, loc);
+ }
+
+ /**
+ * Passes a warning on to the current XmlErrorContext.
+ */
+ public void info(String message)
+ { addInfo(_errorListener, message); }
+
+ public static void addError(Collection errorListener, String message, int code, XmlObject location)
+ {
+ XmlError err =
+ XmlError.forObject(
+ message,
+ XmlError.SEVERITY_ERROR,
+ location);
+ errorListener.add(err);
+ }
+
+ public static void addError(Collection errorListener, String message, int code, File location)
+ {
+ XmlError err =
+ XmlError.forLocation(
+ message,
+ XmlError.SEVERITY_ERROR,
+ location.toURI().toString(), 0, 0, 0);
+ errorListener.add(err);
+ }
+
+ public static void addWarning(Collection errorListener, String message, int code, XmlObject location)
+ {
+ XmlError err =
+ XmlError.forObject(
+ message,
+ XmlError.SEVERITY_WARNING,
+ location);
+ errorListener.add(err);
+ }
+
+ public static void addInfo(Collection errorListener, String message)
+ {
+ XmlError err = XmlError.forMessage(message, XmlError.SEVERITY_INFO);
+ errorListener.add(err);
+ }
+
+ public void setGivenTypeSystemName(String name)
+ { _givenStsName = name; }
+
+ /**
+ * Initializer for references to the SchemaTypeLoader
+ */
+ public void setTargetSchemaTypeSystem(SchemaTypeSystemImpl target)
+ { _target = target; }
+
+ /**
+ * Accumulates a schema digest...
+ */
+ public void addSchemaDigest(byte[] digest)
+ {
+ if (_noDigest)
+ return;
+
+ if (digest == null)
+ {
+ _noDigest = true;
+ _digest = null;
+ return;
+ }
+
+ if (_digest == null)
+ _digest = new byte[128/8]; // 128 bits.
+ int len = _digest.length;
+ if (digest.length < len)
+ len = digest.length;
+ for (int i = 0; i < len; i++)
+ _digest[i] ^= digest[i];
+ }
+
+ /**
+ * The SchemaTypeSystem which we're building types on behalf of.
+ */
+ public SchemaTypeSystemImpl sts()
+ {
+ if (_target != null)
+ return _target;
+
+ String name = _givenStsName;
+ if (name == null && _digest != null)
+ name = "s" + new String(HexBin.encode(_digest));
+
+ _target = new SchemaTypeSystemImpl(name);
+ return _target;
+ }
+
+ /**
+ * True if the given URI is a local file
+ */
+ public boolean shouldDownloadURI(String uriString)
+ {
+ if (_doingDownloads)
+ return true;
+
+ if (uriString == null)
+ return false;
+
+ try
+ {
+ URI uri = new URI(uriString);
+ return uri.getScheme().equalsIgnoreCase("file");
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Initializer for compatMap.
+ */
+ public void setOptions(XmlOptions options)
+ {
+ if (options == null)
+ {
+ return; // defaults are all false.
+ }
+
+ _compatMap = (Map)options.get(XmlOptions.COMPILE_SUBSTITUTE_NAMES);
+ _noUpa = options.hasOption(XmlOptions.COMPILE_NO_UPA_RULE) ? true :
+ !"true".equals(System.getProperty("xmlbean.uniqueparticleattribution", "true"));
+ _noPvr = options.hasOption(XmlOptions.COMPILE_NO_PVR_RULE) ? true :
+ !"true".equals(System.getProperty("xmlbean.particlerestriction", "true"));
+ _doingDownloads = options.hasOption(XmlOptions.COMPILE_DOWNLOAD_URLS) ? true :
+ "true".equals(System.getProperty("xmlbean.downloadurls", "false"));
+ _entityResolver = (EntityResolver)options.get(XmlOptions.ENTITY_RESOLVER);
+ if (_entityResolver != null)
+ _doingDownloads = true;
+
+ if (options.hasOption(XmlOptions.COMPILE_MDEF_NAMESPACES))
+ {
+ _mdefNamespaces.addAll((Collection)options.get(XmlOptions.COMPILE_MDEF_NAMESPACES));
+
+ String local = "##local";
+
+ if (_mdefNamespaces.contains(local))
+ {
+ _mdefNamespaces.remove(local);
+ _mdefNamespaces.add("");
+ }
+ }
+ }
+
+ /**
+ * May return null if there is no custom entity resolver.
+ */
+ public EntityResolver getEntityResolver()
+ {
+ return _entityResolver;
+ }
+
+ /**
+ * True if no unique particle attribution option is set
+ */
+ public boolean noUpa()
+ {
+ return _noUpa;
+ }
+
+ /**
+ * True if no particle valid (restriciton) option is set
+ */
+ public boolean noPvr()
+ {
+ return _noPvr;
+ }
+
+
+ /**
+ * Intercepts XML names and translates them
+ * through the compat map, if any.
+ *
+ * Also looks for a default namespace for global definitions.
+ */
+ private QName compatName(QName name, String chameleonNamespace)
+ {
+ // first check for a chameleonNamespace namespace
+ if (name.getNamespaceURI().length() == 0 && chameleonNamespace != null && chameleonNamespace.length() > 0)
+ name = new QName(chameleonNamespace, name.getLocalPart());
+
+ if (_compatMap == null)
+ return name;
+
+ QName subst = (QName)_compatMap.get(name);
+ if (subst == null)
+ return name;
+ return subst;
+ }
+
+ /**
+ * Initializer for the schema config object.
+ */
+ public void setSchemaConfig(SchemaConfig config)
+ throws IllegalArgumentException
+ {
+ _config = config;
+ }
+
+ /**
+ * Looks up package override for a namespace URI
+ */
+ public String getPackageOverride(String namespace)
+ {
+ return _config.lookupPackageForNamespace(namespace);
+ }
+
+ /**
+ * Looks up package override for a namespace URI
+ */
+ public String getJavaPrefix(String namespace)
+ {
+ return _config.lookupPrefixForNamespace(namespace);
+ }
+
+ /**
+ * Looks up package override for a namespace URI
+ */
+ public String getJavaSuffix(String namespace)
+ {
+ return _config.lookupSuffixForNamespace(namespace);
+ }
+
+ /**
+ * Looks up configured java name for the given qname.
+ */
+ public String getJavaname(QName qname)
+ {
+ return _config.lookupJavanameForQName(qname);
+ }
+
+ /**
+ * Gets configured extension set, null if javaName is not contained in any extension.
+ */
+ public ExtensionHolder getExtensionHolder(String javaName)
+ {
+ return _config.extensionHolderFor(javaName);
+ }
+
+ /**
+ * Gets configured extension set.
+ */
+ public ExtensionHolder getExtensionHolder()
+ {
+ return _config.getExtensionHolder();
+ }
+
+ /* SPELLINGS ======================================================*/
+
+ private static String crunchName(QName name)
+ {
+ // lowercase, and drop namespace.
+ return name.getLocalPart().toLowerCase();
+ }
+
+ void addSpelling(QName name, SchemaComponent comp)
+ {
+ _misspelledNames.put(crunchName(name), comp);
+ }
+
+ SchemaComponent findSpelling(QName name)
+ {
+ return (SchemaComponent)_misspelledNames.get(crunchName(name));
+ }
+
+ /* NAMESPACES ======================================================*/
+
+ void addNamespace(String targetNamespace)
+ {
+ _namespaces.add(targetNamespace);
+ }
+
+ String[] getNamespaces()
+ {
+ return (String[])_namespaces.toArray(new String[_namespaces.size()]);
+ }
+
+ boolean linkerDefinesNamespace(String namespace)
+ {
+ return _importingLoader.isNamespaceDefined(namespace);
+ }
+
+ /* TYPES ==========================================================*/
+
+ SchemaTypeImpl findGlobalType(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaTypeImpl result = (SchemaTypeImpl)_globalTypes.get(name);
+ if (result == null)
+ result = (SchemaTypeImpl)_importingLoader.findType(name);
+ return result;
+ }
+
+ SchemaTypeImpl findRedefinedGlobalType(QName name, String chameleonNamespace, QName redefinedName)
+ {
+ name = compatName(name, chameleonNamespace);
+ if (name.equals(redefinedName))
+ {
+ return (SchemaTypeImpl)_redefinedGlobalTypes.get(name);
+ // BUGBUG: should also link against _importingLoader.findRedefinedType
+ }
+ SchemaTypeImpl result = (SchemaTypeImpl)_globalTypes.get(name);
+ if (result == null)
+ result = (SchemaTypeImpl)_importingLoader.findType(name);
+ return result;
+ }
+
+ void addGlobalType(SchemaTypeImpl type, boolean redefined)
+ {
+ if (type != null)
+ {
+ QName name = type.getName();
+
+ if (redefined)
+ {
+ if (_redefinedGlobalTypes.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate global type: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ _redefinedGlobalTypes.put(name, type);
+ }
+ else
+ {
+ if (_globalTypes.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate global type: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ {
+ _globalTypes.put(name, type);
+ addSpelling(name, type);
+ }
+ }
+ }
+ }
+
+ private boolean ignoreMdef(QName name)
+ {
+ return _mdefNamespaces.contains(name.getNamespaceURI());
+ }
+
+ SchemaType[] globalTypes()
+ { return (SchemaType[])_globalTypes.values().toArray(new SchemaType[_globalTypes.size()]); }
+
+ SchemaType[] redefinedGlobalTypes()
+ { return (SchemaType[])_redefinedGlobalTypes.values().toArray(new SchemaType[_redefinedGlobalTypes.size()]); }
+
+ /* DOCUMENT TYPES =================================================*/
+
+ SchemaTypeImpl findDocumentType(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaTypeImpl result = (SchemaTypeImpl)_documentTypes.get(name);
+ if (result == null)
+ result = (SchemaTypeImpl)_importingLoader.findDocumentType(name);
+ return result;
+ }
+
+ void addDocumentType(SchemaTypeImpl type, QName name)
+ {
+ if (_documentTypes.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate global element: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_ELEMENT, null);
+ }
+ else
+ _documentTypes.put(name, type);
+ }
+
+ SchemaType[] documentTypes()
+ { return (SchemaType[])_documentTypes.values().toArray(new SchemaType[_documentTypes.size()]); }
+
+ /* ATTRIBUTE TYPES =================================================*/
+
+ SchemaTypeImpl findAttributeType(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaTypeImpl result = (SchemaTypeImpl)_attributeTypes.get(name);
+ if (result == null)
+ result = (SchemaTypeImpl)_importingLoader.findAttributeType(name);
+ return result;
+ }
+
+ void addAttributeType(SchemaTypeImpl type, QName name)
+ {
+ if (_attributeTypes.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate global attribute: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_ATTRIBUTE, null);
+ }
+ else
+ _attributeTypes.put(name, type);
+ }
+
+ SchemaType[] attributeTypes()
+ { return (SchemaType[])_attributeTypes.values().toArray(new SchemaType[_attributeTypes.size()]); }
+
+ /* ATTRIBUTES =====================================================*/
+
+ SchemaGlobalAttributeImpl findGlobalAttribute(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaGlobalAttributeImpl result = (SchemaGlobalAttributeImpl)_globalAttributes.get(name);
+ if (result == null)
+ result = (SchemaGlobalAttributeImpl)_importingLoader.findAttribute(name);
+ return result;
+ }
+
+ void addGlobalAttribute(SchemaGlobalAttributeImpl attribute)
+ {
+ if (attribute != null)
+ {
+ QName name = attribute.getName();
+ _globalAttributes.put(name, attribute);
+ addSpelling(name, attribute);
+ }
+ }
+
+ SchemaGlobalAttribute[] globalAttributes()
+ { return (SchemaGlobalAttribute[])_globalAttributes.values().toArray(new SchemaGlobalAttribute[_globalAttributes.size()]); }
+
+ /* ELEMENTS =======================================================*/
+
+ SchemaGlobalElementImpl findGlobalElement(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaGlobalElementImpl result = (SchemaGlobalElementImpl)_globalElements.get(name);
+ if (result == null)
+ result = (SchemaGlobalElementImpl)_importingLoader.findElement(name);
+ return result;
+ }
+
+ void addGlobalElement(SchemaGlobalElementImpl element)
+ {
+ if (element != null)
+ {
+ QName name = element.getName();
+ _globalElements.put(name, element);
+ addSpelling(name, element);
+ }
+ }
+
+ SchemaGlobalElement[] globalElements()
+ { return (SchemaGlobalElement[])_globalElements.values().toArray(new SchemaGlobalElement[_globalElements.size()]); }
+
+ /* ATTRIBUTE GROUPS ===============================================*/
+
+ SchemaAttributeGroupImpl findAttributeGroup(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaAttributeGroupImpl result = (SchemaAttributeGroupImpl)_attributeGroups.get(name);
+ if (result == null)
+ result = (SchemaAttributeGroupImpl)_importingLoader.findAttributeGroup(name);
+ return result;
+ }
+
+ SchemaAttributeGroupImpl findRedefinedAttributeGroup(QName name, String chameleonNamespace, QName redefinitionFor)
+ {
+ name = compatName(name, chameleonNamespace);
+ if (name.equals(redefinitionFor))
+ {
+ return (SchemaAttributeGroupImpl)_redefinedAttributeGroups.get(name);
+ // BUGBUG: should also link against _importingLoader.findRedefinedAttributeGroup
+ }
+ SchemaAttributeGroupImpl result = (SchemaAttributeGroupImpl)_attributeGroups.get(name);
+ if (result == null)
+ result = (SchemaAttributeGroupImpl)_importingLoader.findAttributeGroup(name);
+ return result;
+ }
+
+ void addAttributeGroup(SchemaAttributeGroupImpl attributeGroup, boolean redefined)
+ {
+ if (attributeGroup != null)
+ {
+ QName name = attributeGroup.getName();
+ if (redefined)
+ {
+ if (_redefinedAttributeGroups.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate attribute group: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ _redefinedAttributeGroups.put(name, attributeGroup);
+
+ }
+ else
+ {
+ if (_attributeGroups.containsKey( name ))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate attribute group: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ {
+ _attributeGroups.put(attributeGroup.getName(), attributeGroup);
+ addSpelling(attributeGroup.getName(), attributeGroup);
+ }
+ }
+ }
+ }
+
+ SchemaAttributeGroup[] attributeGroups()
+ { return (SchemaAttributeGroup[])_attributeGroups.values().toArray(new SchemaAttributeGroup[_attributeGroups.size()]); }
+
+ SchemaAttributeGroup[] redefinedAttributeGroups()
+ { return (SchemaAttributeGroup[])_redefinedAttributeGroups.values().toArray(new SchemaAttributeGroup[_redefinedAttributeGroups.size()]); }
+
+ /* MODEL GROUPS ===================================================*/
+
+ SchemaModelGroupImpl findModelGroup(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ SchemaModelGroupImpl result = (SchemaModelGroupImpl)_modelGroups.get(name);
+ if (result == null)
+ result = (SchemaModelGroupImpl)_importingLoader.findModelGroup(name);
+ return result;
+ }
+
+ SchemaModelGroupImpl findRedefinedModelGroup(QName name, String chameleonNamespace, QName redefinitionFor)
+ {
+ name = compatName(name, chameleonNamespace);
+ if (name.equals(redefinitionFor))
+ {
+ return (SchemaModelGroupImpl)_redefinedModelGroups.get(name);
+ // BUGBUG: should also link against _importingLoader.findRedefinedModelGroup
+ }
+ SchemaModelGroupImpl result = (SchemaModelGroupImpl)_modelGroups.get(name);
+ if (result == null)
+ result = (SchemaModelGroupImpl)_importingLoader.findModelGroup(name);
+ return result;
+ }
+
+ void addModelGroup(SchemaModelGroupImpl modelGroup, boolean redefined)
+ {
+ if (modelGroup != null)
+ {
+ QName name = modelGroup.getName();
+ if (redefined)
+ {
+ if (_redefinedModelGroups.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate model group: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ _redefinedModelGroups.put(name, modelGroup);
+ }
+ else
+ {
+ if (_modelGroups.containsKey(name))
+ {
+ if (!ignoreMdef(name))
+ error("Duplicate model group: " + QNameHelper.pretty(name), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ }
+ else
+ {
+ _modelGroups.put(modelGroup.getName(), modelGroup);
+ addSpelling(modelGroup.getName(), modelGroup);
+ }
+ }
+ }
+ }
+
+ SchemaModelGroup[] modelGroups()
+ { return (SchemaModelGroup[])_modelGroups.values().toArray(new SchemaModelGroup[_modelGroups.size()]); }
+
+ SchemaModelGroup[] redefinedModelGroups()
+ { return (SchemaModelGroup[])_redefinedModelGroups.values().toArray(new SchemaModelGroup[_redefinedModelGroups.size()]); }
+
+ /* IDENTITY CONSTRAINTS ===========================================*/
+
+ SchemaIdentityConstraintImpl findIdConstraint(QName name, String chameleonNamespace)
+ {
+ name = compatName(name, chameleonNamespace);
+ return (SchemaIdentityConstraintImpl)_idConstraints.get(name);
+ }
+
+ void addIdConstraint(SchemaIdentityConstraintImpl idc)
+ {
+ if (idc != null)
+ {
+ _idConstraints.put(idc.getName(), idc);
+ addSpelling(idc.getName(), idc);
+ }
+ }
+
+ SchemaIdentityConstraintImpl[] idConstraints()
+ { return (SchemaIdentityConstraintImpl[])_idConstraints.values().toArray(new SchemaIdentityConstraintImpl[_idConstraints.size()]); }
+
+ /* RECURSION AVOIDANCE ============================================*/
+ boolean isProcessing(Object obj)
+ {
+ return _processingGroups.contains(obj);
+ }
+
+ void startProcessing(Object obj)
+ {
+ assert(!_processingGroups.contains(obj));
+ _processingGroups.add(obj);
+ }
+
+ void finishProcessing(Object obj)
+ {
+ assert(_processingGroups.contains(obj));
+ _processingGroups.remove(obj);
+ }
+
+ /* JAVAIZATION ====================================================*/
+
+ Map typesByClassname()
+ { return Collections.unmodifiableMap(_typesByClassname); }
+
+ void addClassname(String classname, SchemaType type)
+ { _typesByClassname.put(classname, type); }
+
+
+
+ /**
+ * Stack management if (heaven help us) we ever need to do
+ * nested compilation of schema type system.
+ */
+ private static final class StscStack
+ {
+ StscState current;
+ ArrayList stack = new ArrayList();
+ final StscState push()
+ {
+ stack.add(current);
+ current = new StscState();
+ return current;
+ }
+ final void pop()
+ {
+ current = (StscState)stack.get(stack.size() - 1);
+ stack.remove(stack.size() - 1);
+ }
+ }
+
+ private static ThreadLocal stscStack = new ThreadLocal()
+ {
+ protected Object initialValue() { return new StscStack(); }
+ };
+
+ public static StscState start()
+ {
+ return ((StscStack)stscStack.get()).push();
+ }
+
+ public static StscState get()
+ {
+ return ((StscStack)stscStack.get()).current;
+ }
+
+ public static void end()
+ {
+ ((StscStack)stscStack.get()).pop();
+ }
+
+ private final static XmlValueRef XMLSTR_PRESERVE = buildString("preserve");
+ private final static XmlValueRef XMLSTR_REPLACE = buildString("preserve");
+ private final static XmlValueRef XMLSTR_COLLAPSE = buildString("preserve");
+
+ static final SchemaType[] EMPTY_ST_ARRAY = new SchemaType[0];
+ static final SchemaType.Ref[] EMPTY_STREF_ARRAY = new SchemaType.Ref[0];
+
+ private final static XmlValueRef[] FACETS_NONE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ null, null, null };
+
+ private final static boolean[] FIXED_FACETS_NONE = new boolean[]
+ { false, false, false, false, false, false, false, false, false,
+ false, false, false };
+
+ private final static XmlValueRef[] FACETS_WS_COLLAPSE = new XmlValueRef[]
+ { null, null, null, null, null, null, null, null, null,
+ build_wsstring(SchemaType.WS_COLLAPSE), null, null };
+
+ private final static boolean[] FIXED_FACETS_WS = new boolean[]
+ { false, false, false, false, false, false, false, false, false,
+ true, false, false };
+
+ final static XmlValueRef[] FACETS_UNION = FACETS_NONE;
+ final static boolean[] FIXED_FACETS_UNION = FIXED_FACETS_NONE;
+ final static XmlValueRef[] FACETS_LIST = FACETS_WS_COLLAPSE;
+ final static boolean[] FIXED_FACETS_LIST = FIXED_FACETS_WS;
+
+ static XmlValueRef build_wsstring(int wsr)
+ {
+ switch (wsr)
+ {
+ case SchemaType.WS_PRESERVE:
+ return XMLSTR_PRESERVE;
+ case SchemaType.WS_REPLACE:
+ return XMLSTR_REPLACE;
+ case SchemaType.WS_COLLAPSE:
+ return XMLSTR_COLLAPSE;
+ }
+ return null;
+ }
+
+ static XmlValueRef buildString(String str)
+ {
+ if (str == null)
+ return null;
+
+ try
+ {
+ XmlStringImpl i = new XmlStringImpl();
+ i.set(str);
+ i.setImmutable();
+ return new XmlValueRef(i);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ return null;
+ }
+ }
+
+ public void notFoundError(QName itemName, int code, XmlObject loc)
+ {
+ String basicMessage;
+
+ switch (code)
+ {
+ case XmlErrorContext.TYPE_NOT_FOUND:
+ basicMessage = "Type " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ case XmlErrorContext.ELEMENT_REF_NOT_FOUND:
+ basicMessage = "Element " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ case XmlErrorContext.ATTRIBUTE_REF_NOT_FOUND:
+ basicMessage = "Attribute " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ case XmlErrorContext.MODEL_GROUP_NOT_FOUND:
+ basicMessage = "Model group " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ case XmlErrorContext.ATTRIBUTE_GROUP_NOT_FOUND:
+ basicMessage = "Attribute group " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ case XmlErrorContext.IDC_NOT_FOUND:
+ basicMessage = "Identity constraint '" + QNameHelper.pretty(itemName) + "' not found.";
+ break;
+ default:
+ assert(false);
+ basicMessage = "Definition " + QNameHelper.pretty(itemName) + " not found.";
+ break;
+ }
+
+ String helpfulMessage = "";
+ SchemaComponent foundComponent = findSpelling(itemName);
+ QName name;
+ if (foundComponent != null)
+ {
+ name = foundComponent.getName();
+ if (name != null)
+ {
+ String sourceName = null;
+ switch (foundComponent.getComponentType())
+ {
+ case SchemaComponent.TYPE:
+ sourceName = ((SchemaType)foundComponent).getSourceName();
+ break;
+ case SchemaComponent.ELEMENT:
+ sourceName = ((SchemaGlobalElement)foundComponent).getSourceName();
+ break;
+ case SchemaComponent.ATTRIBUTE:
+ sourceName = ((SchemaGlobalAttribute)foundComponent).getSourceName();
+ break;
+ }
+ String source = "";
+ if (sourceName != null)
+ {
+ source = " (in " + sourceName.substring(sourceName.lastIndexOf('/') + 1) + ")";
+ }
+
+ if (name.equals(itemName))
+ {
+ switch (foundComponent.getComponentType())
+ {
+ case SchemaComponent.TYPE:
+ helpfulMessage = " Do you mean to refer to the type with that name" + source + "?";
+ break;
+ case SchemaComponent.ELEMENT:
+ helpfulMessage = " Do you mean to refer to the element with that name" + source + "?";
+ break;
+ case SchemaComponent.ATTRIBUTE:
+ helpfulMessage = " Do you mean to refer to the attribute with that name" + source + "?";
+ break;
+ case SchemaComponent.ATTRIBUTE_GROUP:
+ helpfulMessage = " Do you mean to refer to the attribute group with that name" + source + "?";
+ break;
+ case SchemaComponent.MODEL_GROUP:
+ helpfulMessage = " Do you mean to refer to the model group with that name" + source + "?";
+ break;
+ }
+ }
+ else
+ {
+ switch (foundComponent.getComponentType())
+ {
+ case SchemaComponent.TYPE:
+ helpfulMessage = " Do you mean to refer to the type named " + QNameHelper.pretty(name) + source + "?";
+ break;
+ case SchemaComponent.ELEMENT:
+ helpfulMessage = " Do you mean to refer to the element named " + QNameHelper.pretty(name) + source + "?";
+ break;
+ case SchemaComponent.ATTRIBUTE:
+ helpfulMessage = " Do you mean to refer to the attribute named " + QNameHelper.pretty(name) + source + "?";
+ break;
+ case SchemaComponent.ATTRIBUTE_GROUP:
+ helpfulMessage = " Do you mean to refer to the attribute group named " + QNameHelper.pretty(name) + source + "?";
+ break;
+ case SchemaComponent.MODEL_GROUP:
+ helpfulMessage = " Do you mean to refer to the model group named " + QNameHelper.pretty(name) + source + "?";
+ break;
+ }
+ }
+ }
+ }
+
+ error(basicMessage + helpfulMessage, code, loc);
+ }
+
+ /**
+ * Produces the "sourceName" (to be used within the schema project
+ * source file copies) from the URI of the original source.
+ *
+ * Returns null if none.
+ */
+ public String sourceNameForUri(String uri)
+ {
+ return (String)_sourceForUri.get(uri);
+ }
+
+ /**
+ * Returns the whole sourceCopyMap, mapping URI's that have
+ * been read to "sourceName" local names that have been used
+ * to tag the types.
+ */
+ public Map sourceCopyMap()
+ {
+ return Collections.unmodifiableMap(_sourceForUri);
+ }
+
+ /**
+ * The base URI to use for nice filenames when saving sources.
+ */
+ public void setBaseUri(URI uri)
+ {
+ _baseURI = uri;
+ }
+
+ private final static String PROJECT_URL_PREFIX = "project://local";
+
+ public String relativize(String uri)
+ {
+ return relativize(uri, false);
+ }
+
+ public String computeSavedFilename(String uri)
+ {
+ return relativize(uri, true);
+ }
+
+ private String relativize(String uri, boolean forSavedFilename)
+ {
+ if (uri == null)
+ return null;
+
+ // deal with things that do not look like absolute uris
+ if (uri.startsWith("/"))
+ {
+ uri = PROJECT_URL_PREFIX + uri.replace('\\', '/');
+ }
+ else
+ {
+ // looks like a URL?
+ int colon = uri.indexOf(':');
+ if (colon <= 1 || !uri.substring(0, colon).matches("^\\w+$"))
+ uri = PROJECT_URL_PREFIX + "/" + uri.replace('\\', '/');
+ }
+
+ // now relativize against that...
+ if (_baseURI != null)
+ {
+ try
+ {
+ URI relative = _baseURI.relativize(new URI(uri));
+ if (!relative.isAbsolute())
+ return relative.toString();
+ else
+ uri = relative.toString();
+ }
+ catch (URISyntaxException e)
+ {
+ }
+ }
+
+ if (!forSavedFilename)
+ return uri;
+
+ int lastslash = uri.lastIndexOf('/');
+ String dir = QNameHelper.hexsafe(lastslash == -1 ? "" : uri.substring(0, lastslash));
+ return dir + "/" + uri.substring(lastslash + 1);
+ }
+
+ /**
+ * Notes another URI that has been consumed during compilation
+ * (this is the URI that is in the document .NAME property)
+ */
+ public void addSourceUri(String uri, String nameToUse)
+ {
+ if (uri == null)
+ return;
+
+ if (nameToUse == null)
+ nameToUse = computeSavedFilename(uri);
+
+ _sourceForUri.put(uri, nameToUse);
+ }
+
+ /**
+ * Returns the error listener being filled in during this compilation
+ */
+ public Collection getErrorListener()
+ {
+ return _errorListener;
+ }
+
+ /**
+ * Returns the schema type loader to use for processing s4s
+ */
+ public SchemaTypeLoader getS4SLoader()
+ {
+ return _s4sloader;
+ }
+
+ Map _sourceForUri = new HashMap();
+ URI _baseURI = URI.create(PROJECT_URL_PREFIX + "/");
+ SchemaTypeLoader _s4sloader = XmlBeans.typeLoaderForClassLoader(SchemaDocument.class.getClassLoader());
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java
new file mode 100644
index 0000000..ecb7d71
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java
@@ -0,0 +1,1145 @@
+/* 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.xmlbeans.impl.schema;
+
+import java.util.*;
+import java.util.List;
+import java.math.BigInteger;
+
+import org.w3.x2001.xmlSchema.*;
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.RedefineDocument.Redefine;
+
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XMLChar;
+import org.apache.xmlbeans.impl.common.XPath;
+import org.apache.xmlbeans.impl.values.XmlIntegerImpl;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+import org.apache.xmlbeans.impl.values.XmlPositiveIntegerImpl;
+import org.apache.xmlbeans.impl.values.XmlNonNegativeIntegerImpl;
+import org.apache.xmlbeans.impl.regex.RegularExpression;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.QNameSetBuilder;
+import org.apache.xmlbeans.SchemaIdentityConstraint;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaGlobalAttribute;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.XmlNonNegativeInteger;
+import org.apache.xmlbeans.XmlPositiveInteger;
+
+import javax.xml.namespace.QName;
+
+public class StscTranslator
+{
+ private static final QName WSDL_ARRAYTYPE_NAME =
+ QNameHelper.forLNS("arrayType", "http://schemas.xmlsoap.org/wsdl/");
+
+ public static void addAllDefinitions(StscImporter.SchemaToProcess[] schemasAndChameleons)
+ {
+ for (int i = 0; i < schemasAndChameleons.length; i++)
+ {
+ addAllDefinitions(
+ schemasAndChameleons[i].getSchema(),
+ schemasAndChameleons[i].getChameleonNamespace(),
+ schemasAndChameleons[i].getRedefine());
+ }
+ }
+
+ public static void addAllDefinitions(Schema schema, String givenTargetNamespace, Redefine redefine)
+ {
+ StscState state = StscState.get();
+
+ // quick check for a few unsupported features
+
+ if (schema.sizeOfNotationArray() > 0)
+ {
+ state.warning("Schema <notation> is not yet supported for this release.", XmlErrorContext.UNSUPPORTED_FEATURE, schema.getNotationArray(0));
+ }
+
+ // figure namespace (taking into account chameleons)
+ String targetNamespace = schema.getTargetNamespace();
+ boolean chameleon = false;
+ if (givenTargetNamespace != null && targetNamespace == null)
+ {
+ targetNamespace = givenTargetNamespace;
+ chameleon = true;
+ }
+ if (targetNamespace == null)
+ targetNamespace = "";
+
+ state.addNamespace(targetNamespace);
+
+ // make a note of all redefinitions
+ RedefinitionHolder redefinitions = new RedefinitionHolder(redefine);
+
+ TopLevelComplexType[] complexTypes = schema.getComplexTypeArray();
+ for (int i = 0; i < complexTypes.length; i++)
+ {
+ TopLevelComplexType redef = redefinitions.redefineComplexType(complexTypes[i].getName());
+ state.addGlobalType(translateGlobalComplexType(complexTypes[i], targetNamespace, chameleon, false), redef != null);
+ if (redef != null)
+ state.addGlobalType(translateGlobalComplexType(redef, targetNamespace, chameleon, true), false);
+ }
+
+ TopLevelSimpleType[] simpleTypes = schema.getSimpleTypeArray();
+ for (int i = 0; i < simpleTypes.length; i++)
+ {
+ TopLevelSimpleType redef = redefinitions.redefineSimpleType(simpleTypes[i].getName());
+ state.addGlobalType(translateGlobalSimpleType(simpleTypes[i], targetNamespace, chameleon, false), redef != null);
+ if (redef != null)
+ state.addGlobalType(translateGlobalSimpleType(redef, targetNamespace, chameleon, true), false);
+ }
+
+ TopLevelElement[] elements = schema.getElementArray();
+ for (int i = 0; i < elements.length; i++)
+ {
+ TopLevelElement element = elements[i];
+ state.addDocumentType(translateDocumentType(element, targetNamespace, chameleon), QNameHelper.forLNS(element.getName(), targetNamespace));
+ }
+
+ TopLevelAttribute[] attributes = schema.getAttributeArray();
+ for (int i = 0; i < attributes.length ; i++)
+ {
+ TopLevelAttribute attribute = attributes[i];
+ state.addAttributeType(translateAttributeType(attribute, targetNamespace, chameleon), QNameHelper.forLNS(attribute.getName(), targetNamespace));
+ }
+
+ NamedGroup[] modelgroups = schema.getGroupArray();
+ for (int i = 0; i < modelgroups.length; i++)
+ {
+ NamedGroup redef = redefinitions.redefineModelGroup(modelgroups[i].getName());
+ state.addModelGroup(translateModelGroup(modelgroups[i], targetNamespace, chameleon, false), redef != null);
+ if (redef != null)
+ state.addModelGroup(translateModelGroup(redef, targetNamespace, chameleon, true), false);
+ }
+
+ NamedAttributeGroup[] attrgroups = schema.getAttributeGroupArray();
+ for (int i = 0; i < attrgroups.length; i++)
+ {
+ NamedAttributeGroup redef = redefinitions.redefineAttributeGroup(attrgroups[i].getName());
+ state.addAttributeGroup(translateAttributeGroup(attrgroups[i], targetNamespace, chameleon, false), redef != null);
+ if (redef != null)
+ state.addAttributeGroup(translateAttributeGroup(redef, targetNamespace, chameleon, true), false);
+ }
+
+ redefinitions.complainAboutMissingDefinitions();
+ }
+
+ private static class RedefinitionHolder
+ {
+ // record redefinitions
+ private Map stRedefinitions = Collections.EMPTY_MAP;
+ private Map ctRedefinitions = Collections.EMPTY_MAP;
+ private Map agRedefinitions = Collections.EMPTY_MAP;
+ private Map mgRedefinitions = Collections.EMPTY_MAP;
+ private String schemaLocation = "";
+
+ // first build set of redefined components
+ RedefinitionHolder(Redefine redefine)
+ {
+ if (redefine != null)
+ {
+ StscState state = StscState.get();
+
+ stRedefinitions = new HashMap();
+ ctRedefinitions = new HashMap();
+ agRedefinitions = new HashMap();
+ mgRedefinitions = new HashMap();
+ if (redefine.getSchemaLocation() != null)
+ schemaLocation = redefine.getSchemaLocation();
+
+ TopLevelComplexType[] complexTypes = redefine.getComplexTypeArray();
+ for (int i = 0; i < complexTypes.length; i++)
+ {
+ if (complexTypes[i].getName() != null)
+ {
+ if (ctRedefinitions.containsKey(complexTypes[i].getName()))
+ state.error("Duplicate type redefinition: " + complexTypes[i].getName(), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ else
+ ctRedefinitions.put(complexTypes[i].getName(), complexTypes[i]);
+ }
+ }
+
+ TopLevelSimpleType[] simpleTypes = redefine.getSimpleTypeArray();
+ for (int i = 0; i < simpleTypes.length; i++)
+ {
+ if (simpleTypes[i].getName() != null)
+ {
+ if (stRedefinitions.containsKey(simpleTypes[i].getName()))
+ state.error("Duplicate type redefinition: " + simpleTypes[i].getName(), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ else
+ stRedefinitions.put(simpleTypes[i].getName(), simpleTypes[i]);
+ }
+ }
+
+ NamedGroup[] modelgroups = redefine.getGroupArray();
+ for (int i = 0; i < modelgroups.length; i++)
+ {
+ if (modelgroups[i].getName() != null)
+ {
+ if (mgRedefinitions.containsKey(modelgroups[i].getName()))
+ state.error("Duplicate type redefinition: " + modelgroups[i].getName(), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ else
+ mgRedefinitions.put(modelgroups[i].getName(), modelgroups[i]);
+ }
+ }
+
+ NamedAttributeGroup[] attrgroups = redefine.getAttributeGroupArray();
+ for (int i = 0; i < attrgroups.length; i++)
+ {
+ if (attrgroups[i].getName() != null)
+ {
+ if (agRedefinitions.containsKey(attrgroups[i].getName()))
+ state.error("Duplicate type redefinition: " + attrgroups[i].getName(), XmlErrorContext.DUPLICATE_GLOBAL_TYPE, null);
+ else
+ agRedefinitions.put(attrgroups[i].getName(), attrgroups[i]);
+ }
+ }
+ }
+ }
+
+ public TopLevelSimpleType redefineSimpleType(String name)
+ {
+ if (name == null || !stRedefinitions.containsKey(name))
+ return null;
+ return (TopLevelSimpleType)stRedefinitions.remove(name);
+ }
+
+ public TopLevelComplexType redefineComplexType(String name)
+ {
+ if (name == null || !ctRedefinitions.containsKey(name))
+ return null;
+ return (TopLevelComplexType)ctRedefinitions.remove(name);
+ }
+
+ public NamedGroup redefineModelGroup(String name)
+ {
+ if (name == null || !mgRedefinitions.containsKey(name))
+ return null;
+ return (NamedGroup)mgRedefinitions.remove(name);
+ }
+
+ public NamedAttributeGroup redefineAttributeGroup(String name)
+ {
+ if (name == null || !agRedefinitions.containsKey(name))
+ return null;
+ return (NamedAttributeGroup)agRedefinitions.remove(name);
+ }
+
+ public void complainAboutMissingDefinitions()
+ {
+ if (stRedefinitions.isEmpty() && ctRedefinitions.isEmpty() &&
+ agRedefinitions.isEmpty() && mgRedefinitions.isEmpty())
+ return;
+
+ StscState state = StscState.get();
+
+ for (Iterator i = stRedefinitions.keySet().iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ state.error("Redefined simple type " + name + " not found in " + schemaLocation, XmlErrorContext.GENERIC_ERROR, (XmlObject)stRedefinitions.get(name));
+ }
+
+ for (Iterator i = ctRedefinitions.keySet().iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ state.error("Redefined complex type " + name + " not found in " + schemaLocation, XmlErrorContext.GENERIC_ERROR, (XmlObject)ctRedefinitions.get(name));
+ }
+
+ for (Iterator i = agRedefinitions.keySet().iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ state.error("Redefined attribute group " + name + " not found in " + schemaLocation, XmlErrorContext.GENERIC_ERROR, (XmlObject)agRedefinitions.get(name));
+ }
+
+ for (Iterator i = mgRedefinitions.keySet().iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ state.error("Redefined model group " + name + " not found in " + schemaLocation, XmlErrorContext.GENERIC_ERROR, (XmlObject)mgRedefinitions.get(name));
+ }
+ }
+ }
+
+ private static String findFilename(XmlObject xobj)
+ {
+ return StscState.get().sourceNameForUri(xobj.documentProperties().getSourceName());
+ }
+
+ private static SchemaTypeImpl translateDocumentType ( TopLevelElement xsdType, String targetNamespace, boolean chameleon )
+ {
+ SchemaTypeImpl sType = new SchemaTypeImpl( StscState.get().sts() );
+
+ sType.setDocumentType(true);
+ sType.setParseContext( xsdType, targetNamespace, chameleon, false);
+ sType.setFilename( findFilename( xsdType ) );
+
+ return sType;
+ }
+
+ private static SchemaTypeImpl translateAttributeType ( TopLevelAttribute xsdType, String targetNamespace, boolean chameleon )
+ {
+ SchemaTypeImpl sType = new SchemaTypeImpl( StscState.get().sts() );
+
+ sType.setAttributeType(true);
+ sType.setParseContext( xsdType, targetNamespace, chameleon, false);
+ sType.setFilename( findFilename( xsdType ) );
+
+ return sType;
+ }
+
+ private static SchemaTypeImpl translateGlobalComplexType(TopLevelComplexType xsdType, String targetNamespace, boolean chameleon, boolean redefinition)
+ {
+ StscState state = StscState.get();
+
+ String localname = xsdType.getName();
+ if (localname == null)
+ {
+ state.error("Global type missing a name", XmlErrorContext.GLOBAL_TYPE_MISSING_NAME, xsdType);
+ // recovery: ignore unnamed types.
+ return null;
+ }
+ if (!XMLChar.isValidNCName(localname))
+ {
+ state.error("Invalid type name \"" + localname + "\"", XmlErrorContext.INVALID_NAME, xsdType.xgetName());
+ // recovery: let the name go through anyway.
+ }
+
+ QName name = QNameHelper.forLNS(localname, targetNamespace);
+
+ if (isReservedTypeName(name))
+ {
+ state.warning("Skipping definition of built-in type " + QNameHelper.pretty(name), XmlErrorContext.RESERVED_TYPE_NAME, xsdType);
+ return null;
+ }
+ // System.err.println("Recording type " + QNameHelper.pretty(name));
+
+ SchemaTypeImpl sType = new SchemaTypeImpl(state.sts());
+ sType.setParseContext(xsdType, targetNamespace, chameleon, redefinition);
+ sType.setFilename(findFilename(xsdType));
+ sType.setName(QNameHelper.forLNS(localname, targetNamespace));
+ return sType;
+ }
+
+ private static SchemaTypeImpl translateGlobalSimpleType(TopLevelSimpleType xsdType, String targetNamespace, boolean chameleon, boolean redefinition)
+ {
+ StscState state = StscState.get();
+
+ String localname = xsdType.getName();
+ if (localname == null)
+ {
+ state.error("Global type missing a name", XmlErrorContext.GLOBAL_TYPE_MISSING_NAME, xsdType);
+ // recovery: ignore unnamed types.
+ return null;
+ }
+ if (!XMLChar.isValidNCName(localname))
+ {
+ state.error("Invalid type name \"" + localname + "\"", XmlErrorContext.INVALID_NAME, xsdType.xgetName());
+ // recovery: let the name go through anyway.
+ }
+
+ QName name = QNameHelper.forLNS(localname, targetNamespace);
+
+ if (isReservedTypeName(name))
+ {
+ state.warning("Skipping definition of built-in type " + QNameHelper.pretty(name), XmlErrorContext.RESERVED_TYPE_NAME, xsdType);
+ return null;
+ }
+ // System.err.println("Recording type " + QNameHelper.pretty(name));
+
+ SchemaTypeImpl sType = new SchemaTypeImpl(state.sts());
+ sType.setSimpleType(true);
+ sType.setParseContext(xsdType, targetNamespace, chameleon, redefinition);
+ sType.setFilename(findFilename(xsdType));
+ sType.setName(name);
+ return sType;
+ }
+
+ static FormChoice findElementFormDefault(XmlObject obj)
+ {
+ XmlCursor cur = obj.newCursor();
+ while (cur.getObject().schemaType() != Schema.type)
+ if (!cur.toParent())
+ return null;
+ return ((Schema)cur.getObject()).xgetElementFormDefault();
+ }
+
+ public static boolean uriMatch(String s1, String s2)
+ {
+ if (s1 == null)
+ return s2 == null || s2.equals("");
+ if (s2 == null)
+ return s1.equals("");
+ return s1.equals(s2);
+ }
+
+ public static void copyGlobalElementToLocalElement(SchemaGlobalElement referenced, SchemaLocalElementImpl target )
+ {
+
+ target.setNameAndTypeRef(referenced.getName(), referenced.getType().getRef());
+ target.setNillable(referenced.isNillable());
+ target.setDefault(referenced.getDefaultText(), referenced.isFixed(), ((SchemaGlobalElementImpl)referenced).getParseObject());
+ target.setIdentityConstraints(((SchemaLocalElementImpl)referenced).getIdentityConstraintRefs());
+ target.setBlock(referenced.blockExtension(), referenced.blockRestriction(), referenced.blockSubstitution());
+ target.setAbstract(referenced.isAbstract());
+ target.setTransitionRules(((SchemaParticle)referenced).acceptedStartNames(),
+ ((SchemaParticle)referenced).isSkippable());
+ }
+
+ public static void copyGlobalAttributeToLocalAttribute(SchemaGlobalAttributeImpl referenced, SchemaLocalAttributeImpl target )
+ {
+ target.init(
+ referenced.getName(), referenced.getTypeRef(), referenced.getUse(),
+ referenced.getDefaultText(),
+ referenced.getParseObject(), referenced._defaultValue,
+ referenced.isFixed(),
+ referenced.getWSDLArrayType() );
+ }
+
+ /**
+ * Translates a local or global schema element.
+ */
+ // check rule 3.3.3
+ // http://www.w3c.org/TR/#section-Constraints-on-XML-Representations-of-Element-Declarations
+ public static SchemaLocalElementImpl translateElement(
+ Element xsdElt, String targetNamespace, boolean chameleon,
+ List anonymousTypes, SchemaType outerType)
+ {
+ StscState state = StscState.get();
+
+ SchemaTypeImpl sgHead = null;
+
+ // translate sg head
+ if (xsdElt.isSetSubstitutionGroup())
+ {
+ sgHead = state.findDocumentType(xsdElt.getSubstitutionGroup(),
+ ((SchemaTypeImpl)outerType).getChameleonNamespace());
+
+ if (sgHead != null)
+ StscResolver.resolveType(sgHead);
+ }
+
+ String name = xsdElt.getName();
+ QName ref = xsdElt.getRef();
+
+
+ if (ref != null && name != null)
+ {
+ // if (name.equals(ref.getLocalPart()) && uriMatch(targetNamespace, ref.getNamespaceURI()))
+ // state.warning("Element " + name + " specifies both a ref and a name", XmlErrorContext.ELEMENT_EXTRA_REF, xsdElt.xgetRef());
+ // else
+ state.error("Element " + name + " specifies both a ref and a name", XmlErrorContext.ELEMENT_EXTRA_REF, xsdElt.xgetRef());
+ // ignore name
+ name = null;
+ }
+ if (ref == null && name == null)
+ {
+ state.error("Element has no name", XmlErrorContext.ELEMENT_MISSING_NAME, xsdElt);
+ // recovery: ignore this element
+ return null;
+ }
+ if (name != null && !XMLChar.isValidNCName(name))
+ {
+ state.error("Invalid element name \"" + name + "\"", XmlErrorContext.INVALID_NAME, xsdElt.xgetName());
+ // recovery: let the name go through anyway.
+ }
+
+ if (ref != null)
+ {
+ if (xsdElt.getType() != null || xsdElt.getSimpleType() != null || xsdElt.getComplexType() != null)
+ {
+ state.error("Element reference cannot also specify a type", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: let the name go through anyway.
+ }
+
+ if (xsdElt.getForm() != null)
+ {
+ state.error("Element reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: let the name go through anyway.
+ }
+
+ if (xsdElt.sizeOfKeyArray() > 0 || xsdElt.sizeOfKeyrefArray() > 0 || xsdElt.sizeOfUniqueArray() > 0)
+ {
+ state.warning("Element reference cannot also contain key, keyref, or unique", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetDefault())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify default", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetFixed())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify fixed", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetBlock())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify block", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetNillable())
+ {
+ state.warning("Element with reference to '" + ref.getLocalPart() + "' cannot also specify nillable", XmlErrorContext.INVALID_NAME, xsdElt);
+ // recovery: ignore
+ }
+
+ assert(xsdElt instanceof LocalElement);
+ SchemaGlobalElement referenced = state.findGlobalElement(ref, chameleon ? targetNamespace : null);
+ if (referenced == null)
+ {
+ state.notFoundError(ref, XmlErrorContext.ELEMENT_REF_NOT_FOUND, xsdElt.xgetRef());
+ // recovery: ignore this element
+ return null;
+ }
+ SchemaLocalElementImpl target = new SchemaLocalElementImpl();
+ target.setParticleType(SchemaParticle.ELEMENT);
+ copyGlobalElementToLocalElement( referenced, target );
+ return target;
+ }
+
+ QName qname;
+ SchemaLocalElementImpl impl;
+ SchemaType sType = null;
+
+ if (xsdElt instanceof LocalElement)
+ {
+ impl = new SchemaLocalElementImpl();
+ FormChoice form = xsdElt.xgetForm();
+ if (form == null)
+ form = findElementFormDefault(xsdElt);
+ if (form == null || form.getStringValue().equals("unqualified"))
+ qname = QNameHelper.forLN(name);
+ else
+ qname = QNameHelper.forLNS(name, targetNamespace);
+ }
+ else
+ {
+ SchemaGlobalElementImpl gelt = new SchemaGlobalElementImpl(state.sts());
+ impl = gelt;
+
+ // Set subst group head
+ if (sgHead != null)
+ {
+ SchemaGlobalElementImpl head = state.findGlobalElement(xsdElt.getSubstitutionGroup(), chameleon ? targetNamespace : null);
+ if (head != null)
+ gelt.setSubstitutionGroup(head.getRef());
+ }
+
+ // Set subst group members
+ qname = QNameHelper.forLNS(name, targetNamespace);
+ SchemaTypeImpl docType = (SchemaTypeImpl)outerType;
+
+ QName[] sgMembers = docType.getSubstitutionGroupMembers();
+ QNameSetBuilder transitionRules = new QNameSetBuilder();
+ transitionRules.add(qname);
+
+ for (int i = 0 ; i < sgMembers.length ; i++)
+ {
+ gelt.addSubstitutionGroupMember(sgMembers[i]);
+ transitionRules.add(sgMembers[i]);
+ }
+
+ impl.setTransitionRules(QNameSet.forSpecification(transitionRules), false);
+ impl.setTransitionNotes(QNameSet.EMPTY, true);
+
+ boolean finalExt = false;
+ boolean finalRest = false;
+ Object ds = xsdElt.getFinal();
+ if (ds != null)
+ {
+ if (ds instanceof String && ds.equals("#all"))
+ {
+ // #ALL value
+ finalExt = finalRest = true;
+ }
+ else if (ds instanceof List)
+ {
+ if (((List)ds).contains("extension"))
+ finalExt = true;
+ if (((List)ds).contains("restriction"))
+ finalRest = true;
+ }
+ }
+
+ gelt.setFinal(finalExt, finalRest);
+ gelt.setAbstract(xsdElt.getAbstract());
+ gelt.setFilename(findFilename(xsdElt));
+ gelt.setParseContext(xsdElt, targetNamespace, chameleon);
+ }
+
+ if (xsdElt.getType() != null)
+ {
+ sType = state.findGlobalType(xsdElt.getType(), chameleon ? targetNamespace : null );
+ if (sType == null)
+ state.notFoundError(xsdElt.getType(), XmlErrorContext.TYPE_NOT_FOUND, xsdElt.xgetType());
+ }
+
+ boolean simpleTypedef = false;
+ XmlObject typedef = xsdElt.getComplexType();
+ if (typedef == null)
+ {
+ typedef = xsdElt.getSimpleType();
+ simpleTypedef = true;
+ }
+
+ if ((sType != null) && typedef != null)
+ {
+ state.error("Illegal to define a nested type when a type attribute is specified", XmlErrorContext.REDUNDANT_NESTED_TYPE, typedef);
+ typedef = null;
+ }
+
+ if (typedef != null)
+ {
+ SchemaTypeImpl sTypeImpl = new SchemaTypeImpl(state.sts());
+ sType = sTypeImpl;
+ sTypeImpl.setContainerField(impl);
+ sTypeImpl.setOuterSchemaTypeRef(outerType == null ? null : outerType.getRef());
+ // leave the anonymous type unresolved: it will be resolved later.
+ anonymousTypes.add(sType);
+ sTypeImpl.setSimpleType(simpleTypedef);
+ sTypeImpl.setParseContext(typedef, targetNamespace, chameleon, false);
+ }
+
+ if (sType == null)
+ {
+ // type may inherit from substitution group head
+ if (sgHead != null)
+ {
+ SchemaGlobalElement head = state.findGlobalElement(xsdElt.getSubstitutionGroup(), chameleon ? targetNamespace : null);
+
+ // Bug - Do I need to copy the type if it's anonymous?
+ // If element does not exist, error has already been reported
+ if (head != null)
+ sType = head.getType();
+ }
+
+ }
+
+
+
+ if (sType == null)
+ sType = BuiltinSchemaTypeSystem.ST_ANY_TYPE;
+
+ SOAPArrayType wat = null;
+ XmlCursor c = xsdElt.newCursor();
+ String arrayType = c.getAttributeText(WSDL_ARRAYTYPE_NAME);
+ c.dispose();
+ if (arrayType != null)
+ {
+ wat = new SOAPArrayType(arrayType, new NamespaceContext(xsdElt));
+ }
+ impl.setWsdlArrayType(wat);
+
+ boolean isFixed = xsdElt.isSetFixed();
+ if (xsdElt.isSetDefault() && isFixed)
+ {
+ state.error("Should not set both default and fixed on the same element", XmlErrorContext.REDUNDANT_DEFAULT_FIXED, xsdElt.xgetFixed());
+ // recovery: ignore fixed
+ isFixed = false;
+ }
+ impl.setParticleType(SchemaParticle.ELEMENT);
+ impl.setNameAndTypeRef(qname, sType.getRef());
+ impl.setNillable(xsdElt.getNillable());
+ impl.setDefault(isFixed ? xsdElt.getFixed() : xsdElt.getDefault(), isFixed, xsdElt);
+
+ Object block = xsdElt.getBlock();
+ boolean blockExt = false;
+ boolean blockRest = false;
+ boolean blockSubst = false;
+
+ if (block != null)
+ {
+ if (block instanceof String && block.equals("#all"))
+ {
+ // #ALL value
+ blockExt = blockRest = blockSubst = true;
+ }
+ else if (block instanceof List)
+ {
+ if (((List)block).contains("extension"))
+ blockExt = true;
+ if (((List)block).contains("restriction"))
+ blockRest = true;
+ if (((List)block).contains("substitution"))
+ blockSubst = true;
+ }
+ }
+
+ impl.setBlock(blockExt, blockRest, blockSubst);
+
+ boolean constraintFailed = false;
+
+ // Translate Identity constraints
+
+ int length = xsdElt.sizeOfKeyArray() + xsdElt.sizeOfKeyrefArray() + xsdElt.sizeOfUniqueArray();
+ SchemaIdentityConstraintImpl[] constraints = new SchemaIdentityConstraintImpl[length];
+ int cur = 0;
+
+ // Handle key constraints
+ Keybase[] keys = xsdElt.getKeyArray();
+ for (int i = 0 ; i < keys.length ; i++, cur++) {
+ constraints[cur] = translateIdentityConstraint(keys[i], targetNamespace, chameleon);
+ if (constraints[cur] != null)
+ constraints[cur].setConstraintCategory(SchemaIdentityConstraint.CC_KEY);
+ else
+ constraintFailed = true;
+ }
+
+ // Handle unique constraints
+ Keybase[] uc = xsdElt.getUniqueArray();
+ for (int i = 0 ; i < uc.length ; i++, cur++) {
+ constraints[cur] = translateIdentityConstraint(uc[i], targetNamespace, chameleon);
+ if (constraints[cur] != null)
+ constraints[cur].setConstraintCategory(SchemaIdentityConstraint.CC_UNIQUE);
+ else
+ constraintFailed = true;
+ }
+
+ // Handle keyref constraints
+ KeyrefDocument.Keyref[] krs = xsdElt.getKeyrefArray();
+ for (int i = 0 ; i < krs.length ; i++, cur++) {
+ constraints[cur] = translateIdentityConstraint(krs[i], targetNamespace, chameleon);
+ if (constraints[cur] != null)
+ constraints[cur].setConstraintCategory(SchemaIdentityConstraint.CC_KEYREF);
+ else
+ constraintFailed = true;
+ }
+
+ if (!constraintFailed)
+ {
+ SchemaIdentityConstraint.Ref[] refs = new SchemaIdentityConstraint.Ref[length];
+ for (int i = 0 ; i < refs.length ; i++)
+ refs[i] = constraints[i].getRef();
+
+ impl.setIdentityConstraints(refs);
+ }
+
+ return impl;
+ }
+
+ private static String removeWhitespace(String xpath)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < xpath.length(); i++)
+ {
+ char ch = xpath.charAt(i);
+ if (XMLChar.isSpace(ch))
+ continue;
+ sb.append(ch);
+ }
+ return sb.toString();
+ }
+
+ public static final org.apache.xmlbeans.impl.regex.RegularExpression XPATH_REGEXP = new org.apache.xmlbeans.impl.regex.RegularExpression("(\\.//)?((((child::)?((\\i\\c*:)?(\\i\\c*|\\*)))|\\.)/)*((((child::)?((\\i\\c*:)?(\\i\\c*|\\*)))|\\.)|((attribute::|@)((\\i\\c*:)?(\\i\\c*|\\*))))(\\|(\\.//)?((((child::)?((\\i\\c*:)?(\\i\\c*|\\*)))|\\.)/)*((((child::)?((\\i\\c*:)?(\\i\\c*|\\*)))|\\.)|((attribute::|@)((\\i\\c*:)?(\\i\\c*|\\*)))))*", "X");
+
+ private static boolean checkXPathSyntax(String xpath)
+ {
+ if (xpath == null)
+ return false;
+
+ // strip whitespace from xpath
+ xpath = removeWhitespace(xpath);
+
+ // apply regexp
+ synchronized (XPATH_REGEXP)
+ {
+ return (XPATH_REGEXP.matches(xpath));
+ }
+ }
+
+ private static SchemaIdentityConstraintImpl translateIdentityConstraint(Keybase parseIC,
+ String targetNamespace, boolean chameleon)
+ {
+ StscState state = StscState.get();
+
+ // first do some checking
+ String selector = parseIC.getSelector() == null ? null : parseIC.getSelector().getXpath();
+ if (!checkXPathSyntax(selector))
+ {
+ StscState.get().error("Invalid xpath in selector.",
+ XmlErrorContext.XPATH_COMPILATION_FAILURE, parseIC.getSelector().xgetXpath());
+ return null;
+ }
+
+ FieldDocument.Field[] fieldElts = parseIC.getFieldArray();
+ for (int j = 0; j < fieldElts.length; j++)
+ {
+ if (!checkXPathSyntax(fieldElts[j].getXpath()))
+ {
+ StscState.get().error("Invalid xpath in field.",
+ XmlErrorContext.XPATH_COMPILATION_FAILURE, fieldElts[j].xgetXpath());
+ return null;
+ }
+ }
+
+ // then translate.
+ SchemaIdentityConstraintImpl ic = new SchemaIdentityConstraintImpl(state.sts());
+ ic.setName(QNameHelper.forLNS(parseIC.getName(), targetNamespace));
+ ic.setSelector(parseIC.getSelector().getXpath());
+ ic.setParseContext(parseIC, targetNamespace, chameleon);
+
+ // Set the ns map
+ XmlCursor c = parseIC.newCursor();
+ Map nsMap = new HashMap();
+
+ c.getAllNamespaces(nsMap);
+ nsMap.remove(""); // Remove the default mapping. This cannot be used by the xpath expressions.
+ ic.setNSMap(nsMap);
+ c.dispose();
+
+ String[] fields = new String[fieldElts.length];
+ for (int j = 0 ; j < fields.length ; j++)
+ fields[j] = fieldElts[j].getXpath();
+ ic.setFields(fields);
+
+ try {
+ ic.buildPaths();
+ }
+ catch (XPath.XPathCompileException e) {
+ StscState.get().error("Invalid xpath in identity constraint: " + e.getMessage(),
+ XmlErrorContext.XPATH_COMPILATION_FAILURE, parseIC);
+
+ return null;
+ }
+
+ state.addIdConstraint(ic);
+
+ return ic;
+
+ }
+
+ public static SchemaModelGroupImpl translateModelGroup(NamedGroup namedGroup, String targetNamespace, boolean chameleon, boolean redefinition)
+ {
+ String name = namedGroup.getName();
+ if (name == null)
+ {
+ StscState.get().error("Model groups must be named", XmlErrorContext.MODEL_GROUP_MISSING_NAME, namedGroup);
+ return null;
+ }
+ SchemaModelGroupImpl result = new SchemaModelGroupImpl(StscState.get().sts());
+ result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, namedGroup);
+ return result;
+ }
+
+ public static SchemaAttributeGroupImpl translateAttributeGroup(AttributeGroup attrGroup, String targetNamespace, boolean chameleon, boolean redefinition)
+ {
+ String name = attrGroup.getName();
+ if (name == null)
+ {
+ StscState.get().error("Attribute groups must be named", XmlErrorContext.ATTRIBUTE_GROUP_MISSING_NAME, attrGroup);
+ return null;
+ }
+ SchemaAttributeGroupImpl result = new SchemaAttributeGroupImpl(StscState.get().sts());
+ result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, attrGroup);
+ return result;
+ }
+
+ static FormChoice findAttributeFormDefault(XmlObject obj)
+ {
+ XmlCursor cur = obj.newCursor();
+ while (cur.getObject().schemaType() != Schema.type)
+ if (!cur.toParent())
+ return null;
+ return ((Schema)cur.getObject()).xgetAttributeFormDefault();
+ }
+
+ static SchemaLocalAttributeImpl translateAttribute(
+ Attribute xsdAttr, String targetNamespace, boolean chameleon, List anonymousTypes,
+ SchemaType outerType, SchemaAttributeModel baseModel, boolean local)
+ {
+ StscState state = StscState.get();
+
+ String name = xsdAttr.getName();
+ QName ref = xsdAttr.getRef();
+
+ if (ref != null && name != null)
+ {
+ if (name.equals(ref.getLocalPart()) && uriMatch(targetNamespace, ref.getNamespaceURI()))
+ state.warning("Attribute " + name + " specifies both a ref and a name", XmlErrorContext.ELEMENT_EXTRA_REF, xsdAttr.xgetRef());
+ else
+ state.error("Attribute " + name + " specifies both a ref and a name", XmlErrorContext.ELEMENT_EXTRA_REF, xsdAttr.xgetRef());
+ // ignore name
+ name = null;
+ }
+ if (ref == null && name == null)
+ {
+ state.error("Attribute has no name", XmlErrorContext.ELEMENT_MISSING_NAME, xsdAttr);
+ // recovery: ignore this element
+ return null;
+ }
+ if (name != null && !XMLChar.isValidNCName(name))
+ {
+ state.error("Invalid attribute name \"" + name + "\"", XmlErrorContext.INVALID_NAME, xsdAttr.xgetName());
+ // recovery: let the name go through anyway.
+ }
+
+ boolean isFixed = false;
+ String deftext = null;
+ QName qname;
+ SchemaLocalAttributeImpl sAttr;
+ SchemaType sType = null;
+ int use = SchemaLocalAttribute.OPTIONAL;
+
+ if (local)
+ sAttr = new SchemaLocalAttributeImpl();
+ else
+ {
+ sAttr = new SchemaGlobalAttributeImpl(state.sts());
+ ((SchemaGlobalAttributeImpl)sAttr).setParseContext(xsdAttr, targetNamespace, chameleon);
+ }
+
+ if (ref != null)
+ {
+ if (xsdAttr.getType() != null || xsdAttr.getSimpleType() != null)
+ {
+ state.error("Attribute reference cannot also specify type", XmlErrorContext.INVALID_NAME, xsdAttr);
+ // recovery: ignore type, simpleType
+ }
+
+ if (xsdAttr.getForm() != null)
+ {
+ state.error("Attribute reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdAttr);
+ // recovery: ignore form
+ }
+
+ SchemaGlobalAttribute referenced = state.findGlobalAttribute(ref, chameleon ? targetNamespace : null);
+ if (referenced == null)
+ {
+ state.notFoundError(ref, XmlErrorContext.ATTRIBUTE_REF_NOT_FOUND, xsdAttr.xgetRef());
+ // recovery: ignore this element
+ return null;
+ }
+
+ qname = ref;
+ use = referenced.getUse();
+ sType = referenced.getType();
+ deftext = referenced.getDefaultText();
+ if (deftext != null)
+ {
+ isFixed = referenced.isFixed();
+ }
+ }
+ else
+ {
+ if (local)
+ {
+ FormChoice form = xsdAttr.xgetForm();
+ if (form == null)
+ form = findAttributeFormDefault(xsdAttr);
+ if (form == null || form.getStringValue().equals("unqualified"))
+ qname = QNameHelper.forLN(name);
+ else
+ qname = QNameHelper.forLNS(name, targetNamespace);
+ }
+ else
+ {
+ qname = QNameHelper.forLNS(name, targetNamespace);
+ }
+
+ if (xsdAttr.getType() != null)
+ {
+ sType = state.findGlobalType(xsdAttr.getType(), chameleon ? targetNamespace : null );
+ if (sType == null)
+ state.notFoundError(xsdAttr.getType(), XmlErrorContext.TYPE_NOT_FOUND, xsdAttr.xgetType());
+ }
+
+ if (qname.getNamespaceURI().equals("http://www.w3.org/2001/XMLSchema-instance"))
+ {
+ state.error("Illegal namespace for attribute declaration.", XmlErrorContext.INVALID_NAME, xsdAttr.xgetName());
+ }
+
+ if (qname.getNamespaceURI().length() == 0 && qname.getLocalPart().equals("xmlns"))
+ {
+ state.error("Illegal name for attribute declaration.", XmlErrorContext.INVALID_NAME, xsdAttr.xgetName());
+ }
+
+ XmlObject typedef = xsdAttr.getSimpleType();
+
+ if ((sType != null) && typedef != null)
+ {
+ state.error("Illegal to define a nested type when a type attribute is specified", XmlErrorContext.REDUNDANT_NESTED_TYPE, typedef);
+ typedef = null;
+ }
+
+ if (typedef != null)
+ {
+ SchemaTypeImpl sTypeImpl = new SchemaTypeImpl(state.sts());
+ sType = sTypeImpl;
+ sTypeImpl.setContainerField(sAttr);
+ sTypeImpl.setOuterSchemaTypeRef(outerType == null ? null : outerType.getRef());
+ // leave the anonymous type unresolved: it will be resolved later.
+ anonymousTypes.add(sType);
+ sTypeImpl.setSimpleType(true);
+ sTypeImpl.setParseContext(typedef, targetNamespace, chameleon, false);
+ }
+
+ if (sType == null && baseModel != null && baseModel.getAttribute(qname) != null)
+ sType = baseModel.getAttribute(qname).getType();
+ }
+
+ if (sType == null)
+ sType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+
+ if (!sType.isSimpleType())
+ {
+ state.error("Attributes must have a simple type (not complex).", XmlErrorContext.INVALID_SCHEMA, xsdAttr);
+ // recovery: switch to the any-type
+ sType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE;
+ }
+
+ if (xsdAttr.isSetUse())
+ {
+ use = translateUseCode(xsdAttr.xgetUse());
+
+ // ignore referenced default if no longer optional
+ if (use != SchemaLocalAttribute.OPTIONAL && !isFixed)
+ deftext = null;
+ }
+
+ if (xsdAttr.isSetDefault() || xsdAttr.isSetFixed())
+ {
+ if (isFixed && !xsdAttr.isSetFixed())
+ state.error("A use of a fixed attribute definition must also be fixed", XmlErrorContext.REDUNDANT_DEFAULT_FIXED, xsdAttr.xgetFixed());
+
+ isFixed = xsdAttr.isSetFixed();
+
+ if (xsdAttr.isSetDefault() && isFixed)
+ {
+ state.error("Should not set both default and fixed on the same attribute", XmlErrorContext.REDUNDANT_DEFAULT_FIXED, xsdAttr.xgetFixed());
+ // recovery: ignore fixed
+ isFixed = false;
+ }
+ deftext = isFixed ? xsdAttr.getFixed() : xsdAttr.getDefault();
+ }
+
+ if (!local)
+ {
+ ((SchemaGlobalAttributeImpl)sAttr).setFilename(findFilename(xsdAttr));
+ }
+
+ SOAPArrayType wat = null;
+ XmlCursor c = xsdAttr.newCursor();
+ String arrayType = c.getAttributeText(WSDL_ARRAYTYPE_NAME);
+ c.dispose();
+ if (arrayType != null)
+ {
+ wat = new SOAPArrayType(arrayType, new NamespaceContext(xsdAttr));
+ }
+
+ sAttr.init(
+ qname,
+ sType.getRef(),
+ use,
+ deftext, xsdAttr, null, isFixed,
+ wat);
+
+ return sAttr;
+ }
+
+ static int translateUseCode(Attribute.Use attruse)
+ {
+ if (attruse == null)
+ return SchemaLocalAttribute.OPTIONAL;
+
+ String val = attruse.getStringValue();
+ if (val.equals("optional"))
+ return SchemaLocalAttribute.OPTIONAL;
+ if (val.equals("required"))
+ return SchemaLocalAttribute.REQUIRED;
+ if (val.equals("prohibited"))
+ return SchemaLocalAttribute.PROHIBITED;
+ return SchemaLocalAttribute.OPTIONAL;
+ }
+
+ static BigInteger buildBigInt(XmlAnySimpleType value)
+ {
+ if (value == null)
+ return null;
+ String text = value.getStringValue();
+ BigInteger bigInt;
+ try
+ {
+ bigInt = new BigInteger(text);
+ }
+ catch (NumberFormatException e)
+ {
+ StscState.get().error("Must be nonnegative integer", XmlErrorContext.MALFORMED_NUMBER, value);
+ return null;
+ }
+
+ if (bigInt.signum() < 0)
+ {
+ StscState.get().error("Must be nonnegative integer", XmlErrorContext.MALFORMED_NUMBER, value);
+ return null;
+ }
+
+ return bigInt;
+ }
+
+
+ static XmlNonNegativeInteger buildNnInteger(XmlAnySimpleType value)
+ {
+ BigInteger bigInt = buildBigInt(value);
+ try
+ {
+ XmlNonNegativeIntegerImpl i = new XmlNonNegativeIntegerImpl();
+ i.set(bigInt);
+ i.setImmutable();
+ return i;
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ StscState.get().error("Internal error processing number", XmlErrorContext.MALFORMED_NUMBER, value);
+ return null;
+ }
+ }
+
+ static XmlPositiveInteger buildPosInteger(XmlAnySimpleType value)
+ {
+ BigInteger bigInt = buildBigInt(value);
+ try
+ {
+ XmlPositiveIntegerImpl i = new XmlPositiveIntegerImpl();
+ i.set(bigInt);
+ i.setImmutable();
+ return i;
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ StscState.get().error("Internal error processing number", XmlErrorContext.MALFORMED_NUMBER, value);
+ return null;
+ }
+ }
+
+ private static boolean isReservedTypeName(QName name)
+ {
+ return (BuiltinSchemaTypeSystem.get().findType(name) != null);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/XmlValueRef.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/XmlValueRef.java
new file mode 100644
index 0000000..12355ad
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/schema/XmlValueRef.java
@@ -0,0 +1,67 @@
+/* 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.xmlbeans.impl.schema;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+public class XmlValueRef
+{
+ XmlAnySimpleType _obj;
+ SchemaType.Ref _typeref;
+ Object _initVal;
+
+ XmlValueRef(XmlAnySimpleType xobj)
+ {
+ if (xobj == null)
+ throw new IllegalArgumentException();
+ _obj = xobj;
+ }
+
+ XmlValueRef(SchemaType.Ref typeref, Object initVal)
+ {
+ if (typeref == null)
+ throw new IllegalArgumentException();
+ _typeref = typeref;
+ _initVal = initVal;
+ }
+
+ synchronized XmlAnySimpleType get()
+ {
+ if (_obj == null)
+ {
+ SchemaType type = _typeref.get();
+ if (type.getSimpleVariety() != SchemaType.LIST)
+ _obj = type.newValue(_initVal);
+ else
+ {
+ List actualVals = new ArrayList();
+ for (Iterator i = ((List)_initVal).iterator(); i.hasNext(); )
+ {
+ XmlValueRef ref = (XmlValueRef)i.next();
+ actualVals.add(ref.get());
+ }
+ _obj = type.newValue(actualVals);
+ }
+ }
+ return _obj;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/util/Base64.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/util/Base64.java
new file mode 100644
index 0000000..0d29f5f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/util/Base64.java
@@ -0,0 +1,361 @@
+/* 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.xmlbeans.impl.util;
+
+import java.io.UnsupportedEncodingException;
+/**
+ * This class provides encode/decode for RFC 2045 Base64 as
+ * defined by RFC 2045, N. Freed and N. Borenstein.
+ * RFC 2045: Multipurpose Internet Mail Extensions (MIME)
+ * Part One: Format of Internet Message Bodies. Reference
+ * 1996 Available at: http://www.ietf.org/rfc/rfc2045.txt
+ * This class is used by XML Schema binary format validation
+ *
+ * This implementation does not encode/decode streaming
+ * data. You need the data that you will encode/decode
+ * already on a byte arrray.
+ *
+ * @author Jeffrey Rodriguez
+ * @author Sandy Gao
+ * @version $Id$
+ */
+public final class Base64 {
+
+ static private final int BASELENGTH = 255;
+ static private final int LOOKUPLENGTH = 64;
+ static private final int TWENTYFOURBITGROUP = 24;
+ static private final int EIGHTBIT = 8;
+ static private final int SIXTEENBIT = 16;
+ //static private final int SIXBIT = 6;
+ static private final int FOURBYTE = 4;
+ static private final int SIGN = -128;
+ static private final byte PAD = ( byte ) '=';
+ static private final boolean fDebug = false;
+ static private byte [] base64Alphabet = new byte[BASELENGTH];
+ static private byte [] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
+
+ static {
+
+ for (int i = 0; i<BASELENGTH; i++) {
+ base64Alphabet[i] = -1;
+ }
+ for (int i = 'Z'; i >= 'A'; i--) {
+ base64Alphabet[i] = (byte) (i-'A');
+ }
+ for (int i = 'z'; i>= 'a'; i--) {
+ base64Alphabet[i] = (byte) ( i-'a' + 26);
+ }
+
+ for (int i = '9'; i >= '0'; i--) {
+ base64Alphabet[i] = (byte) (i-'0' + 52);
+ }
+
+ base64Alphabet['+'] = 62;
+ base64Alphabet['/'] = 63;
+
+ for (int i = 0; i<=25; i++)
+ lookUpBase64Alphabet[i] = (byte) ('A'+i );
+
+ for (int i = 26, j = 0; i<=51; i++, j++)
+ lookUpBase64Alphabet[i] = (byte) ('a'+ j );
+
+ for (int i = 52, j = 0; i<=61; i++, j++)
+ lookUpBase64Alphabet[i] = (byte) ('0' + j );
+ lookUpBase64Alphabet[62] = (byte) '+';
+ lookUpBase64Alphabet[63] = (byte) '/';
+
+ }
+
+ protected static boolean isWhiteSpace(byte octect) {
+ return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
+ }
+
+ protected static boolean isPad(byte octect) {
+ return (octect == PAD);
+ }
+
+ protected static boolean isData(byte octect) {
+ return (base64Alphabet[octect] != -1);
+ }
+
+ protected static boolean isBase64(byte octect) {
+ return (isWhiteSpace(octect) || isPad(octect) || isData(octect));
+ }
+
+ /**
+ * Encodes hex octects into Base64
+ *
+ * @param binaryData Array containing binaryData
+ * @return Encoded Base64 array
+ */
+ public static byte[] encode(byte[] binaryData) {
+
+ if (binaryData == null)
+ return null;
+
+ int lengthDataBits = binaryData.length*EIGHTBIT;
+ int fewerThan24bits = lengthDataBits%TWENTYFOURBITGROUP;
+ int numberTriplets = lengthDataBits/TWENTYFOURBITGROUP;
+ byte encodedData[] = null;
+
+ if (fewerThan24bits != 0) //data not divisible by 24 bit
+ encodedData = new byte[ (numberTriplets + 1 )*4 ];
+ else // 16 or 8 bit
+ encodedData = new byte[ numberTriplets*4 ];
+
+ byte k=0, l=0, b1=0,b2=0,b3=0;
+
+ int encodedIndex = 0;
+ int dataIndex = 0;
+ int i = 0;
+ if (fDebug) {
+ System.out.println("number of triplets = " + numberTriplets );
+ }
+ for (i = 0; i<numberTriplets; i++) {
+
+ dataIndex = i*3;
+ b1 = binaryData[dataIndex];
+ b2 = binaryData[dataIndex + 1];
+ b3 = binaryData[dataIndex + 2];
+
+ if (fDebug) {
+ System.out.println( "b1= " + b1 +", b2= " + b2 + ", b3= " + b3 );
+ }
+
+ l = (byte)(b2 & 0x0f);
+ k = (byte)(b1 & 0x03);
+
+ encodedIndex = i*4;
+ byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+
+ byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
+ byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
+
+ encodedData[encodedIndex] = lookUpBase64Alphabet[ val1 ];
+ if (fDebug) {
+ System.out.println( "val2 = " + val2 );
+ System.out.println( "k4 = " + (k<<4));
+ System.out.println( "vak = " + (val2 | (k<<4)));
+ }
+
+ encodedData[encodedIndex+1] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
+ encodedData[encodedIndex+2] = lookUpBase64Alphabet[ (l <<2 ) | val3 ];
+ encodedData[encodedIndex+3] = lookUpBase64Alphabet[ b3 & 0x3f ];
+ }
+
+ // form integral number of 6-bit groups
+ dataIndex = i*3;
+ encodedIndex = i*4;
+ if (fewerThan24bits == EIGHTBIT) {
+ b1 = binaryData[dataIndex];
+ k = (byte) ( b1 &0x03 );
+ if (fDebug) {
+ System.out.println("b1=" + b1);
+ System.out.println("b1<<2 = " + (b1>>2) );
+ }
+ byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+ encodedData[encodedIndex] = lookUpBase64Alphabet[ val1 ];
+ encodedData[encodedIndex + 1] = lookUpBase64Alphabet[ k<<4 ];
+ encodedData[encodedIndex + 2] = PAD;
+ encodedData[encodedIndex + 3] = PAD;
+ } else if (fewerThan24bits == SIXTEENBIT) {
+
+ b1 = binaryData[dataIndex];
+ b2 = binaryData[dataIndex +1 ];
+ l = ( byte ) ( b2 &0x0f );
+ k = ( byte ) ( b1 &0x03 );
+
+ byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+ byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
+
+ encodedData[encodedIndex] = lookUpBase64Alphabet[ val1 ];
+ encodedData[encodedIndex + 1] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
+ encodedData[encodedIndex + 2] = lookUpBase64Alphabet[ l<<2 ];
+ encodedData[encodedIndex + 3] = PAD;
+ }
+
+ return encodedData;
+ }
+
+ /**
+ * Decodes Base64 data into octects
+ *
+ * @param base64Data Byte array containing Base64 data
+ * @return Array containind decoded data.
+ */
+ public static byte[] decode(byte[] base64Data) {
+
+ if (base64Data == null)
+ return null;
+
+ // remove white spaces
+ base64Data = removeWhiteSpace(base64Data);
+
+ if (base64Data.length%FOURBYTE != 0) {
+ return null;//should be divisible by four
+ }
+
+ int numberQuadruple = (base64Data.length/FOURBYTE );
+
+ if (numberQuadruple == 0)
+ return new byte[0];
+
+ byte decodedData[] = null;
+ byte b1=0,b2=0,b3=0, b4=0;//, marker0=0, marker1=0;
+ byte d1=0,d2=0,d3=0,d4=0;
+
+ // Throw away anything not in normalizedBase64Data
+ // Adjust size
+ int i = 0;
+ int encodedIndex = 0;
+ int dataIndex = 0;
+ decodedData = new byte[ (numberQuadruple)*3];
+
+ for (; i<numberQuadruple-1; i++) {
+
+ if (!isData( (d1 = base64Data[dataIndex++]) )||
+ !isData( (d2 = base64Data[dataIndex++]) )||
+ !isData( (d3 = base64Data[dataIndex++]) )||
+ !isData( (d4 = base64Data[dataIndex++]) ))
+ return null;//if found "no data" just return null
+
+ b1 = base64Alphabet[d1];
+ b2 = base64Alphabet[d2];
+ b3 = base64Alphabet[d3];
+ b4 = base64Alphabet[d4];
+
+ decodedData[encodedIndex++] = (byte)( b1 <<2 | b2>>4 ) ;
+ decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) );
+ decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
+ }
+
+ if (!isData( (d1 = base64Data[dataIndex++]) ) ||
+ !isData( (d2 = base64Data[dataIndex++]) )) {
+ return null;//if found "no data" just return null
+ }
+
+ b1 = base64Alphabet[d1];
+ b2 = base64Alphabet[d2];
+
+ d3 = base64Data[dataIndex++];
+ d4 = base64Data[dataIndex++];
+ if (!isData( (d3 ) ) ||
+ !isData( (d4 ) )) {//Check if they are PAD characters
+ if (isPad( d3 ) && isPad( d4)) { //Two PAD e.g. 3c[Pad][Pad]
+ if ((b2 & 0xf) != 0)//last 4 bits should be zero
+ return null;
+ byte[] tmp = new byte[ i*3 + 1 ];
+ System.arraycopy( decodedData, 0, tmp, 0, i*3 );
+ tmp[encodedIndex] = (byte)( b1 <<2 | b2>>4 ) ;
+ return tmp;
+ } else if (!isPad( d3) && isPad(d4)) { //One PAD e.g. 3cQ[Pad]
+ b3 = base64Alphabet[ d3 ];
+ if ((b3 & 0x3 ) != 0)//last 2 bits should be zero
+ return null;
+ byte[] tmp = new byte[ i*3 + 2 ];
+ System.arraycopy( decodedData, 0, tmp, 0, i*3 );
+ tmp[encodedIndex++] = (byte)( b1 <<2 | b2>>4 );
+ tmp[encodedIndex] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) );
+ return tmp;
+ } else {
+ return null;//an error like "3c[Pad]r", "3cdX", "3cXd", "3cXX" where X is non data
+ }
+ } else { //No PAD e.g 3cQl
+ b3 = base64Alphabet[ d3 ];
+ b4 = base64Alphabet[ d4 ];
+ decodedData[encodedIndex++] = (byte)( b1 <<2 | b2>>4 ) ;
+ decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2) & 0xf) );
+ decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
+
+ }
+
+ return decodedData;
+ }
+
+ /**
+ * Decodes Base64 data into octects
+ *
+ * @param base64Data String containing Base64 data
+ * @return string containing decoded data.
+ */
+ public static String decode(String base64Data) {
+ if (base64Data == null)
+ return null;
+
+ byte[] decoded = null;
+ try {
+ decoded = decode(base64Data.getBytes("utf-8"));
+ }
+ catch(UnsupportedEncodingException e) {
+ }
+ finally {
+ return decoded == null ? null : new String(decoded);
+ }
+ }
+
+ /**
+ * Encodes octects (using utf-8) into Base64 data
+ *
+ * @param binaryData String containing Hex data
+ * @return string containing decoded data.
+ */
+ public static String encode(String binaryData) {
+ if (binaryData == null)
+ return null;
+
+ byte[] encoded = null;
+ try {
+ encoded = encode(binaryData.getBytes("utf-8"));
+ }
+ catch(UnsupportedEncodingException e) {}
+ finally {
+ return encoded == null ? null : new String(encoded);
+ }
+ }
+
+ /**
+ * remove WhiteSpace from MIME containing encoded Base64 data.
+ *
+ * @param data the byte array of base64 data (with WS)
+ * @return the byte array of base64 data (without WS)
+ */
+ protected static byte[] removeWhiteSpace(byte[] data) {
+ if (data == null)
+ return null;
+
+ // count characters that's not whitespace
+ int newSize = 0;
+ int len = data.length;
+ for (int i = 0; i < len; i++) {
+ if (!isWhiteSpace(data[i]))
+ newSize++;
+ }
+
+ // if no whitespace, just return the input array
+ if (newSize == len)
+ return data;
+
+ // create the array to return
+ byte[] newArray = new byte[newSize];
+
+ int j = 0;
+ for (int i = 0; i < len; i++) {
+ if (!isWhiteSpace(data[i]))
+ newArray[j++] = data[i];
+ }
+ return newArray;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java
new file mode 100644
index 0000000..ddfaf5e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/util/HexBin.java
@@ -0,0 +1,159 @@
+/* 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.xmlbeans.impl.util;
+
+import java.io.UnsupportedEncodingException;
+/**
+ * format validation
+ *
+ * This class encodes/decodes hexadecimal data
+ * @author Jeffrey Rodriguez
+ * @version $Id$
+ */
+public final class HexBin {
+ static private final int BASELENGTH = 255;
+ static private final int LOOKUPLENGTH = 16;
+ static private byte [] hexNumberTable = new byte[BASELENGTH];
+ static private byte [] lookUpHexAlphabet = new byte[LOOKUPLENGTH];
+
+
+ static {
+ for (int i = 0; i<BASELENGTH; i++ ) {
+ hexNumberTable[i] = -1;
+ }
+ for ( int i = '9'; i >= '0'; i--) {
+ hexNumberTable[i] = (byte) (i-'0');
+ }
+ for ( int i = 'F'; i>= 'A'; i--) {
+ hexNumberTable[i] = (byte) ( i-'A' + 10 );
+ }
+ for ( int i = 'f'; i>= 'a'; i--) {
+ hexNumberTable[i] = (byte) ( i-'a' + 10 );
+ }
+
+ for(int i = 0; i<10; i++ )
+ lookUpHexAlphabet[i] = (byte) ('0'+i );
+ for(int i = 10; i<=15; i++ )
+ lookUpHexAlphabet[i] = (byte) ('A'+i -10);
+ }
+
+ /**
+ * byte to be tested if it is Base64 alphabet
+ *
+ * @param octect
+ * @return
+ */
+ static boolean isHex(byte octect) {
+ return (hexNumberTable[octect] != -1);
+ }
+
+ /**
+ * Converts bytes to a hex string
+ */
+ static public String bytesToString(byte[] binaryData)
+ {
+ if (binaryData == null)
+ return null;
+ return new String(encode(binaryData));
+ }
+
+ /**
+ * Converts a hex string to a byte array.
+ */
+ static public byte[] stringToBytes(String hexEncoded)
+ {
+ return decode(hexEncoded.getBytes());
+ }
+
+ /**
+ * array of byte to encode
+ *
+ * @param binaryData
+ * @return return encode binary array
+ */
+ static public byte[] encode(byte[] binaryData) {
+ if (binaryData == null)
+ return null;
+ int lengthData = binaryData.length;
+ int lengthEncode = lengthData * 2;
+ byte[] encodedData = new byte[lengthEncode];
+ for( int i = 0; i<lengthData; i++ ){
+ encodedData[i*2] = lookUpHexAlphabet[(binaryData[i] >> 4) & 0xf];
+ encodedData[i*2+1] = lookUpHexAlphabet[ binaryData[i] & 0xf];
+ }
+ return encodedData;
+ }
+
+ static public byte[] decode(byte[] binaryData) {
+ if (binaryData == null)
+ return null;
+ int lengthData = binaryData.length;
+ if (lengthData % 2 != 0)
+ return null;
+
+ int lengthDecode = lengthData / 2;
+ byte[] decodedData = new byte[lengthDecode];
+ for( int i = 0; i<lengthDecode; i++ ){
+ if (!isHex(binaryData[i*2]) || !isHex(binaryData[i*2+1])) {
+ return null;
+ }
+ decodedData[i] = (byte)((hexNumberTable[binaryData[i*2]] << 4) | hexNumberTable[binaryData[i*2+1]]);
+ }
+ return decodedData;
+ }
+
+ /**
+ * Decodes Hex data into octects
+ *
+ * @param binaryData String containing Hex data
+ * @return string containing decoded data.
+ */
+ public static String decode(String binaryData) {
+ if (binaryData == null)
+ return null;
+
+ byte[] decoded = null;
+ try {
+ decoded = decode(binaryData.getBytes("utf-8"));
+ }
+ catch(UnsupportedEncodingException e) {
+ }
+ finally {
+ return decoded == null ? null : new String(decoded);
+ }
+ }
+
+ /**
+ * Encodes octects (using utf-8) into Hex data
+ *
+ * @param binaryData String containing Hex data
+ * @return string containing decoded data.
+ */
+ public static String encode(String binaryData) {
+ if (binaryData == null)
+ return null;
+
+ byte[] encoded = null;
+ try {
+ encoded = encode(binaryData.getBytes("utf-8"));
+ }
+ catch(UnsupportedEncodingException e) {}
+ finally {
+ return encoded == null ? null : new String(encoded);
+ }
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java
new file mode 100644
index 0000000..1a9ac3a
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java
@@ -0,0 +1,379 @@
+/* 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.xmlbeans.impl.validator;
+
+import org.apache.xmlbeans.impl.common.Chars;
+import org.apache.xmlbeans.impl.common.XMLNameHelper;
+import org.apache.xmlbeans.impl.common.GenericXmlInputStream;
+import org.apache.xmlbeans.impl.common.ValidatorListener.Event;
+import org.apache.xmlbeans.impl.common.ValidatorListener;
+import org.apache.xmlbeans.impl.common.XmlWhitespace;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XMLStreamValidationException;
+import java.util.Map;
+import java.util.AbstractCollection;
+import java.util.Iterator;
+import java.util.Collections;
+
+import org.apache.xmlbeans.xml.stream.Attribute;
+import org.apache.xmlbeans.xml.stream.AttributeIterator;
+import org.apache.xmlbeans.xml.stream.CharacterData;
+import org.apache.xmlbeans.xml.stream.StartElement;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+
+public final class ValidatingXMLInputStream
+ extends GenericXmlInputStream implements Event
+{
+ public ValidatingXMLInputStream (
+ XMLInputStream xis,
+ SchemaTypeLoader typeLoader, SchemaType sType, XmlOptions options )
+ throws XMLStreamException
+ {
+ _source = xis;
+
+ // Figure out the root type
+
+ options = XmlOptions.maskNull( options );
+
+ SchemaType type = (SchemaType) options.get( XmlOptions.DOCUMENT_TYPE );
+
+ if (type == null)
+ type = sType;
+
+ if (type == null)
+ {
+ type = BuiltinSchemaTypeSystem.ST_ANY_TYPE;
+
+ xis = xis.getSubStream();
+
+ if (xis.skip( XMLEvent.START_ELEMENT ))
+ {
+ SchemaType docType =
+ typeLoader.findDocumentType(
+ XMLNameHelper.getQName( xis.next().getName() ) );
+
+ if (docType != null)
+ type = docType;
+ }
+
+ xis.close();
+ }
+
+ // Create the validator
+
+ _validator =
+ new Validator(
+ type, null, typeLoader, options, new ExceptionXmlErrorListener() );
+
+ nextEvent( ValidatorListener.BEGIN );
+ }
+
+ // TODO - this is the quick and dirty impl of streaming validation,
+ // may objects are created (like strings) which can be optimized
+
+ protected XMLEvent nextEvent ( ) throws XMLStreamException
+ {
+ XMLEvent e = _source.next();
+
+ if (e == null)
+ {
+ if (!_finished)
+ {
+ flushText();
+ nextEvent( ValidatorListener.END );
+ _finished = true;
+ }
+ }
+ else
+ {
+ switch ( e.getType() )
+ {
+ case XMLEvent.CHARACTER_DATA :
+ case XMLEvent.SPACE :
+ {
+ CharacterData cd = (CharacterData) e;
+
+ if (cd.hasContent())
+ _text.append( cd.getContent() );
+
+ break;
+ }
+ case XMLEvent.START_ELEMENT :
+ {
+ StartElement se = (StartElement) e;
+
+ flushText();
+
+ // Used for prefix to namespace mapping
+ _startElement = se;
+
+ // Prepare the xsi:* values
+
+ AttributeIterator attrs = se.getAttributes();
+
+ while ( attrs.hasNext() )
+ {
+ Attribute attr = attrs.next();
+
+ XMLName attrName = attr.getName();
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(
+ attrName.getNamespaceUri() ))
+ {
+ String local = attrName.getLocalName();
+
+ if (local.equals( "type" ))
+ _xsiType = attr.getValue();
+ else if (local.equals( "nil" ))
+ _xsiNil = attr.getValue();
+ else if (local.equals( "schemaLocation" ))
+ _xsiLoc = attr.getValue();
+ else if (local.equals( "noNamespaceSchemaLocation" ))
+ _xsiNoLoc = attr.getValue();
+ }
+ }
+
+ // Emit the START
+
+ // TODO - should delay the aquisition of the name
+ _name = e.getName();
+
+ nextEvent( ValidatorListener.BEGIN );
+
+ // Emit the attrs
+
+ attrs = se.getAttributes();
+
+ while ( attrs.hasNext() )
+ {
+ Attribute attr = attrs.next();
+
+ XMLName attrName = attr.getName();
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(
+ attrName.getNamespaceUri() ))
+ {
+ String local = attrName.getLocalName();
+
+ if (local.equals( "type" ))
+ continue;
+ else if (local.equals( "nil" ))
+ continue;
+ else if (local.equals( "schemaLocation" ))
+ continue;
+ else if (local.equals( "noNamespaceSchemaLocation" ))
+ continue;
+ }
+
+ // TODO - God, this is lame :-)
+
+ _text.append( attr.getValue() );
+ _name = attr.getName();
+
+ nextEvent( ValidatorListener.ATTR );
+ }
+
+ clearText();
+
+ _startElement = null;
+
+ break;
+ }
+
+ case XMLEvent.END_ELEMENT :
+ {
+ flushText();
+
+ nextEvent( ValidatorListener.END );
+
+ break;
+ }
+ }
+ }
+
+ return e;
+ }
+
+ private void clearText ( )
+ {
+ _text.delete( 0, _text.length() );
+ }
+
+ private void flushText ( ) throws XMLStreamException
+ {
+ if (_text.length() > 0)
+ {
+ nextEvent( ValidatorListener.TEXT );
+ clearText();
+ }
+ }
+
+ public String getNamespaceForPrefix ( String prefix )
+ {
+ if (_startElement == null)
+ return null;
+
+ Map map = _startElement.getNamespaceMap();
+
+ if (map == null)
+ return null;
+
+ return (String) map.get( prefix );
+ }
+
+ public XmlCursor getLocationAsCursor ( )
+ {
+ return null;
+ }
+
+ public boolean getXsiType ( Chars chars )
+ {
+ if (_xsiType == null)
+ return false;
+
+ chars.string = _xsiType;
+ chars.buffer = null;
+
+ return true;
+ }
+
+ public boolean getXsiNil ( Chars chars )
+ {
+ if (_xsiNil == null)
+ return false;
+
+ chars.string = _xsiNil;
+ chars.buffer = null;
+
+ return true;
+ }
+
+ public boolean getXsiLoc ( Chars chars )
+ {
+ if (_xsiLoc == null)
+ return false;
+
+ chars.string = _xsiLoc;
+ chars.buffer = null;
+
+ return true;
+ }
+
+ public boolean getXsiNoLoc ( Chars chars )
+ {
+ if (_xsiNoLoc == null)
+ return false;
+
+ chars.string = _xsiNoLoc;
+ chars.buffer = null;
+
+ return true;
+ }
+
+ public QName getName ( )
+ {
+ return XMLNameHelper.getQName( _name );
+ }
+
+ public void getText ( Chars chars )
+ {
+ chars.string = _text.toString();
+ chars.buffer = null;
+ }
+
+ public void getText ( Chars chars, int wsr )
+ {
+ chars.string = XmlWhitespace.collapse( _text.toString(), wsr );
+ chars.buffer = null;
+ }
+
+ // TODO - very expensive to get a string here
+ public boolean textIsWhitespace ( )
+ {
+ for ( int i = 0 ; i < _text.length() ; i++ )
+ {
+ switch ( _text.charAt( i ) )
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ case '\t':
+ break;
+
+ default :
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private final class ExceptionXmlErrorListener extends AbstractCollection
+ {
+ public boolean add(Object o)
+ {
+ assert ValidatingXMLInputStream.this._exception == null;
+
+ ValidatingXMLInputStream.this._exception =
+ new XMLStreamValidationException( (XmlError)o );
+
+ return false;
+ }
+
+ public Iterator iterator()
+ {
+ return Collections.EMPTY_LIST.iterator();
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+ }
+
+ private void nextEvent ( int kind )
+ throws XMLStreamException
+ {
+ assert _exception == null;
+
+ _validator.nextEvent( kind, this );
+
+ if (_exception != null)
+ throw _exception;
+ }
+
+ private XMLStreamValidationException _exception;
+
+ private XMLInputStream _source;
+ private Validator _validator;
+ private StringBuffer _text = new StringBuffer();
+ private boolean _finished;
+ private String _xsiType;
+ private String _xsiNil;
+ private String _xsiLoc;
+ private String _xsiNoLoc;
+ private XMLName _name;
+ private StartElement _startElement;
+}
\ No newline at end of file
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java
new file mode 100644
index 0000000..459df48
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/validator/Validator.java
@@ -0,0 +1,1730 @@
+/* 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.xmlbeans.impl.validator;
+
+import org.apache.xmlbeans.impl.common.Chars;
+import org.apache.xmlbeans.impl.common.IdentityConstraint;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.ValidatorListener.Event;
+import org.apache.xmlbeans.impl.common.ValidatorListener;
+import org.apache.xmlbeans.impl.common.XmlWhitespace;
+import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
+import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+import org.apache.xmlbeans.impl.values.JavaUriHolderEx;
+import org.apache.xmlbeans.impl.values.JavaBase64HolderEx;
+import org.apache.xmlbeans.impl.values.JavaBooleanHolderEx;
+import org.apache.xmlbeans.impl.values.XmlDateImpl;
+import org.apache.xmlbeans.impl.values.JavaDecimalHolderEx;
+import org.apache.xmlbeans.impl.values.JavaDoubleHolderEx;
+import org.apache.xmlbeans.impl.values.XmlDurationImpl;
+import org.apache.xmlbeans.impl.values.JavaFloatHolderEx;
+import org.apache.xmlbeans.impl.values.JavaHexBinaryHolderEx;
+import org.apache.xmlbeans.impl.values.JavaBooleanHolder;
+import org.apache.xmlbeans.impl.values.XmlQNameImpl;
+import org.apache.xmlbeans.impl.values.JavaQNameHolderEx;
+import org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.values.XmlListImpl;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlQName;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaLocalElement;
+import org.apache.xmlbeans.SchemaGlobalElement;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.XmlString;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+
+public final class Validator
+ implements ValidatorListener
+{
+ public Validator (
+ SchemaType type, SchemaField field, SchemaTypeLoader globalLoader,
+ XmlOptions options, Collection defaultErrorListener )
+ {
+ options = XmlOptions.maskNull(options);
+ _errorListener = (Collection) options.get(XmlOptions.ERROR_LISTENER);
+
+ if (_errorListener == null)
+ _errorListener = defaultErrorListener;
+
+ _constraintEngine = new IdentityConstraint(_errorListener, type.isDocumentType());
+
+ _globalTypes = globalLoader;
+ _chars = new Chars();
+ _rootType = type;
+ _rootField = field;
+
+ _vc = new ValidatorVC();
+ }
+
+ private class ValidatorVC implements ValidationContext
+ {
+ public void invalid ( String message )
+ {
+ Validator.this.emitError( _event, message );
+ }
+
+ Event _event;
+ }
+
+ public boolean isValid ( )
+ {
+ return !_invalid && _constraintEngine.isValid();
+ }
+
+ private void emitError ( Event event, String msg )
+ {
+ emitError(event, msg, XmlError.SEVERITY_ERROR);
+ }
+
+ private void emitError ( Event event, String msg, int severity )
+ {
+ _errorState++;
+
+ if (_suspendErrors == 0)
+ {
+ if (severity == XmlError.SEVERITY_ERROR)
+ _invalid = true;
+
+ if (_errorListener != null)
+ {
+ assert event != null;
+
+ _errorListener.add(
+ XmlError.forCursor( msg, severity, event.getLocationAsCursor() ) );
+ }
+ }
+ }
+
+ private void emitFieldError ( Event event, String msg, QName name )
+ {
+ emitFieldError( event, msg + " " + QNameHelper.pretty( name ) );
+ }
+
+ private void emitFieldError ( Event event, String msg )
+ {
+ emitFieldError(event, msg, XmlError.SEVERITY_ERROR);
+ }
+
+ private void emitFieldError ( Event event, String msg, int severity )
+ {
+ if (_stateStack != null && _stateStack._field != null)
+ {
+ msg +=
+ " in element " + QNameHelper.pretty( _stateStack._field.getName() );
+ }
+
+ Validator.this.emitError( event, msg, severity );
+ }
+
+ // For XmlEventListener.error
+
+ public void error ( XmlError error )
+ {
+ _errorState++;
+
+ if (_suspendErrors == 0)
+ {
+ _invalid = true;
+
+ if (_errorListener != null)
+ _errorListener.add( error );
+ }
+ }
+
+ public void nextEvent ( int kind, Event event )
+ {
+ resetValues();
+
+ if (_eatContent > 0)
+ {
+ switch ( kind )
+ {
+ case END : _eatContent--; break;
+ case BEGIN : _eatContent++; break;
+ }
+ }
+ else
+ {
+ assert
+ kind == BEGIN || kind == ATTR ||
+ kind == END || kind == TEXT || kind == ENDATTRS;
+
+ switch ( kind )
+ {
+ case BEGIN : beginEvent( event ); break;
+ case ATTR : attrEvent( event ); break;
+ case ENDATTRS : endAttrsEvent( event ); break;
+ case TEXT : textEvent( event ); break;
+ case END : endEvent( event ); break;
+ }
+ }
+ }
+
+ private void beginEvent ( Event event )
+ {
+ _localElement = null;
+ _wildcardElement = null;
+ String message = null;
+ State state = topState();
+
+ SchemaType elementType = null;
+ SchemaField elementField = null;
+
+ if (state == null)
+ {
+ elementType = _rootType;
+ elementField = _rootField;
+ }
+ else
+ {
+
+ QName name = event.getName();
+
+ assert name != null;
+
+ state._isEmpty = false;
+
+ if (state._isNil)
+ {
+ emitFieldError(event, "Nil element cannot have element content");
+ _eatContent = 1;
+ return;
+ }
+
+ if (!state._isNil && state._field != null && state._field.isFixed())
+ {
+ emitFieldError(event, "Element '" + QNameHelper.pretty(state._field.getName()) + "' is fixed and not nil so is not allowed to have element children.");
+ }
+
+ if (!state.visit( name ))
+ {
+ message = findDetailedErrorBegin(state , name);
+ if (message != null)
+ {
+ emitFieldError(event, message);
+ message = null;
+ }
+ else
+ {
+ emitFieldError(event, "Element not allowed:", name);
+ }
+ _eatContent = 1;
+
+ return;
+ }
+
+ SchemaParticle currentParticle = state.currentParticle();
+ _wildcardElement = currentParticle;
+
+ if (currentParticle.getParticleType() == SchemaParticle.WILDCARD)
+ {
+ //_wildcardElement = currentParticle;
+ QNameSet elemWildcardSet = currentParticle.getWildcardSet();
+
+ if (!elemWildcardSet.contains( name ))
+ {
+ // Additional processing may be needed to generate more
+ // descriptive messages
+ emitFieldError( event, "Element not allowed:", name );
+ _eatContent = 1;
+
+ return;
+ }
+
+ int wildcardProcess = currentParticle.getWildcardProcess();
+
+ if (wildcardProcess == SchemaParticle.SKIP)
+ {
+ _eatContent = 1;
+ return;
+ }
+
+ _localElement = _globalTypes.findElement( name );
+ elementField = _localElement;
+
+ if (elementField == null)
+ {
+ if (wildcardProcess == SchemaParticle.STRICT)
+ {
+ emitFieldError(
+ event, "Element not allowed (strict wildcard, and no definition found):", name );
+ }
+
+ _eatContent = 1;
+
+ return;
+ }
+ }
+ else
+ {
+ assert
+ currentParticle.getParticleType() == SchemaParticle.ELEMENT;
+
+ // If the current element particle name does not match the name
+ // of the event, then the current element is a substitute for
+ // the current particle. Replace the field with the global
+ // element for the replacement
+
+ if (! currentParticle.getName().equals(name))
+ {
+ if (((SchemaLocalElement)currentParticle).blockSubstitution())
+ {
+ emitFieldError(event,
+ "Element substitution not allowed when group head has block='substitution'", name);
+ _eatContent = 1;
+ return;
+ }
+
+ SchemaGlobalElement newField = _globalTypes.findElement(name);
+
+ assert newField != null;
+
+ if (newField != null)
+ {
+ elementField = newField;
+ _localElement = newField;
+ }
+ }
+ else
+ {
+ elementField = (SchemaField) currentParticle;
+ }
+ }
+
+ elementType = elementField.getType();
+ }
+
+ assert elementType != null;
+
+ //
+ // the no-type is always invalid (even if there is an xsi:type)
+ //
+
+ if (elementType.isNoType())
+ {
+ emitFieldError(event, "Invalid type.");
+ _eatContent = 1;
+ }
+
+ //
+ // See if the element has an xsi:type on it
+ //
+
+ SchemaType xsiType = null;
+
+ if (event.getXsiType( _chars ))
+ {
+ String value = _chars.asString();
+
+ // Turn off the listener so a public error message
+ // does not get generated, but I can see if there was
+ // an error through the error state
+
+ int originalErrorState = _errorState;
+
+ _suspendErrors++;
+
+ try
+ {
+ _vc._event = null;
+
+ xsiType =
+ _globalTypes.findType(
+ XmlQNameImpl.validateLexical( value, _vc, event ) );
+
+ }
+ catch ( Throwable t )
+ {
+ _errorState++;
+ }
+ finally
+ {
+ _suspendErrors--;
+ }
+
+ if (originalErrorState != _errorState)
+ {
+ emitFieldError(
+ event, "Invalid xsi:type qname: '" + value + "'" );
+
+ _eatContent = 1;
+
+ return;
+ }
+ else if (xsiType == null)
+ {
+ emitError(event, "Could not find xsi:type: '" + value + "'");
+
+ _eatContent = 1;
+
+ return;
+ }
+ }
+
+ if (xsiType != null && !xsiType.equals(elementType))
+ {
+ if (!elementType.isAssignableFrom(xsiType))
+ {
+ emitFieldError(
+ event,
+ "Type '" + xsiType +
+ "' is not derived from '" + elementType + "'" );
+
+ _eatContent = 1;
+
+ return;
+ }
+
+ if (elementType.blockExtension())
+ {
+ for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
+ t = t.getBaseType() )
+ {
+ if (t.getDerivationType() == SchemaType.DT_EXTENSION)
+ {
+ emitFieldError(
+ event,
+ "Extension type: '" + xsiType +
+ "' may not be substituted for: '" +
+ elementType + "'" );
+
+ _eatContent = 1;
+
+ return;
+ }
+ }
+ }
+
+ if (elementType.blockRestriction())
+ {
+ for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
+ t = t.getBaseType() )
+ {
+ if (t.getDerivationType() == SchemaType.DT_RESTRICTION)
+ {
+ emitFieldError(
+ event,
+ "Restriction type: '" + xsiType +
+ "' may not be substituted for: '" +
+ elementType + "'" );
+
+ _eatContent = 1;
+
+ return;
+ }
+ }
+ }
+
+ if (elementField instanceof SchemaLocalElement)
+ {
+ SchemaLocalElement sle = (SchemaLocalElement)elementField;
+ _localElement = sle;
+
+ if (sle.blockExtension() || sle.blockRestriction())
+ {
+ for ( SchemaType t = xsiType ; ! t.equals( elementType ) ;
+ t = t.getBaseType() )
+ {
+ if ((t.getDerivationType() == SchemaType.DT_RESTRICTION && sle.blockRestriction()) ||
+ (t.getDerivationType() == SchemaType.DT_EXTENSION && sle.blockExtension()))
+ {
+ emitError(
+ event,
+ "Derived type: '" + xsiType +
+ "' may not be substituted for element '" +
+ QNameHelper.pretty(sle.getName()) + "'" );
+
+ _eatContent = 1;
+
+ return;
+ }
+ }
+ }
+
+ }
+
+ elementType = xsiType;
+ }
+
+ if (elementField instanceof SchemaLocalElement)
+ {
+ SchemaLocalElement sle = (SchemaLocalElement)elementField;
+ _localElement = sle;
+
+ if (sle.isAbstract())
+ {
+ emitError(event, "Element '" + QNameHelper.pretty(sle.getName()) +
+ "' is abstract and cannot be used in an instance.");
+ _eatContent = 1;
+ return;
+ }
+ }
+
+ if (elementType != null && elementType.isAbstract())
+ {
+ emitFieldError(
+ event,
+ "Abstract type: " + elementType +
+ " cannot be used in an instance" );
+
+ _eatContent = 1;
+
+ return;
+ }
+
+ boolean isNil = false;
+ boolean hasNil = false;
+
+ if (event.getXsiNil(_chars))
+ {
+ _vc._event = event;
+ isNil = JavaBooleanHolder.validateLexical(_chars.asString(), _vc);
+ hasNil = true;
+ }
+
+ // note in schema spec 3.3.4, you're not even allowed to say xsi:nil="false" if you're not nillable!
+ if (hasNil && !elementField.isNillable())
+ {
+ emitFieldError(event, "Element has xsi:nil attribute but is not nillable");
+
+ _eatContent = 1;
+ return;
+ }
+
+ newState( elementType, elementField, isNil );
+
+ // Dispatch this element event to any identity constraints
+ // As well as adding any new identity constraints that exist
+
+ _constraintEngine.element(
+ event,
+ elementType,
+ elementField instanceof SchemaLocalElement
+ ? ((SchemaLocalElement) elementField).getIdentityConstraints()
+ : null );
+ }
+
+ private void attrEvent ( Event event )
+ {
+ QName attrName = event.getName();
+
+ State state = topState();
+
+ if (state._attrs == null)
+ state._attrs = new HashSet();
+
+ if (state._attrs.contains( attrName ))
+ {
+ emitFieldError(
+ event,
+ "Duplicate attribute: " + QNameHelper.pretty( attrName ) );
+
+ return;
+ }
+
+ state._attrs.add( attrName );
+
+ if (!state._canHaveAttrs)
+ {
+ emitFieldError( event, "Can't have attributes" );
+ return;
+ }
+
+ SchemaLocalAttribute attrSchema =
+ state._attrModel == null
+ ? null
+ : state._attrModel.getAttribute( attrName );
+
+ if (attrSchema != null)
+ {
+ _localAttribute = attrSchema;
+
+ if (attrSchema.getUse() == SchemaLocalAttribute.PROHIBITED)
+ {
+ emitFieldError(
+ event,
+ "Attribute is prohibited: "
+ + QNameHelper.pretty( attrName ) );
+
+ return;
+ }
+
+ String value =
+ validateSimpleType(
+ attrSchema.getType(), attrSchema, event, false, false );
+
+ _constraintEngine.attr( event, attrName, attrSchema.getType(), value );
+
+ return;
+ }
+
+ int wildcardProcess = state._attrModel.getWildcardProcess();
+ _wildcardAttribute = state._attrModel;
+
+ if (wildcardProcess == SchemaAttributeModel.NONE)
+ {
+ emitFieldError(
+ event,
+ "Attribute not allowed (no wildcards allowed): "
+ + QNameHelper.pretty( attrName ) );
+
+ return;
+ }
+
+ QNameSet attrWildcardSet = state._attrModel.getWildcardSet();
+
+ if (!attrWildcardSet.contains( attrName ))
+ {
+ emitFieldError(
+ event,
+ "Attribute not allowed: " + QNameHelper.pretty( attrName ) );
+
+ return;
+ }
+
+ if (wildcardProcess == SchemaAttributeModel.SKIP)
+ return;
+
+ attrSchema = _globalTypes.findAttribute( attrName );
+ _localAttribute = attrSchema;
+
+ if (attrSchema == null)
+ {
+ if (wildcardProcess == SchemaAttributeModel.LAX)
+ return;
+
+ assert wildcardProcess == SchemaAttributeModel.STRICT;
+
+ emitFieldError(
+ event,
+ "Attribute not allowed (strict wildcard, and no definition found): " + QNameHelper.pretty( attrName ) );
+
+ return;
+ }
+
+ String value =
+ validateSimpleType(
+ attrSchema.getType(), attrSchema, event, false, false );
+
+ _constraintEngine.attr( event, attrName, attrSchema.getType(), value );
+ }
+
+ private void endAttrsEvent ( Event event )
+ {
+ State state = topState();
+
+ if (state._attrModel != null)
+ {
+ SchemaLocalAttribute[] attrs = state._attrModel.getAttributes();
+
+ for ( int i = 0 ; i < attrs.length ; i++ )
+ {
+ SchemaLocalAttribute sla = attrs[ i ];
+
+ if (state._attrs == null ||
+ !state._attrs.contains( sla.getName() ))
+ {
+ if (sla.getUse() == SchemaLocalAttribute.REQUIRED)
+ {
+ emitFieldError(
+ event, "Expected attribute: ", sla.getName() );
+ }
+ else if (sla.isDefault() || sla.isFixed())
+ {
+ _constraintEngine.attr(event, sla.getName(), sla.getType(), sla.getDefaultText());
+
+ // We don't need to validate attribute defaults because this is done at compiletime.
+ /*
+ String value = sla.getDefaultText();
+ SchemaType type = sla.getType();
+
+ if (XmlQName.type.isAssignableFrom(type))
+ {
+ emitFieldError(
+ event,
+ "Default QName values are unsupported for attribute: " +
+ QNameHelper.pretty(sla.getName()),
+ XmlError.SEVERITY_INFO);
+ }
+
+ else
+ {
+ validateSimpleType(
+ type, sla.getDefaultText(), event );
+
+ _constraintEngine.attr( event, type, value );
+ }
+ */
+ }
+ }
+ }
+ }
+ }
+
+ private void endEvent ( Event event )
+ {
+ _localElement = null;
+ _wildcardElement = null;
+ String message = null;
+ State state = topState();
+
+ if (!state._isNil)
+ {
+ if (!state.end())
+ {
+
+ message = findDetailedErrorEnd(state);
+
+ if (message != null)
+ {
+ emitFieldError(event, message);
+ }
+ else
+ {
+ emitFieldError(event, "Expected element(s)");
+ }
+ }
+
+ // This end event has no text, use this fact to pass no text to
+ // handleText
+
+ if (state._isEmpty)
+ handleText( event, true, state._field );
+ }
+
+ popState( event );
+
+ _constraintEngine.endElement( event );
+ }
+
+ private void textEvent ( Event event )
+ {
+ State state = topState();
+
+ if (state._isNil)
+ emitFieldError(event, "Nil element cannot have simple content");
+ else
+ handleText( event, false, state._field );
+
+ state._isEmpty = false;
+ }
+
+
+ private void handleText (
+ Event event, boolean emptyContent, SchemaField field )
+ {
+ State state = topState();
+
+ if (!state._sawText)
+ {
+ if (state._hasSimpleContent)
+ {
+ String value =
+ validateSimpleType(
+ state._type, field, event, emptyContent, true );
+
+ _constraintEngine.text( event, state._type, value, false );
+ }
+ else if (state._canHaveMixedContent)
+ {
+ // handles cvc-elt.5.2.2.2.1, checking mixed content against fixed.
+ // if we see <mixedType>a</b>c</mixedType>, we validate against
+ // the first 'a' text and we check the content of mixedType to
+ // be empty in beginElem(). we don't care about checking against
+ // the 'c' text since there will already be an error for <b/>
+ String value =
+ validateSimpleType(
+ XmlString.type, field, event, emptyContent, true );
+
+ _constraintEngine.text( event, XmlString.type, value, false );
+ }
+ else if (emptyContent)
+ {
+ _constraintEngine.text( event, state._type, null, true );
+ }
+ else
+ _constraintEngine.text( event, state._type, "", false);
+ }
+
+ if (!emptyContent && !state._canHaveMixedContent &&
+ !event.textIsWhitespace() && !state._hasSimpleContent)
+ {
+ if (field instanceof SchemaLocalElement)
+ {
+ SchemaLocalElement e = (SchemaLocalElement)field;
+ emitError(event, "Element: '" + QNameHelper.pretty(e.getName()) + "' cannot have mixed content.");
+ }
+ else
+ emitError( event, "Can't have mixed content" );
+ }
+
+ if (!emptyContent)
+ state._sawText = true;
+ }
+
+ private String findDetailedErrorBegin(State state, QName qName)
+ {
+ String message = null;
+ SchemaProperty[] eltProperties = state._type.getElementProperties();
+
+ ArrayList expectedNames = new ArrayList();
+ ArrayList optionalNames = new ArrayList();
+
+ for (int ii = 0; ii < eltProperties.length; ii++)
+ {
+ //Get the element from the schema
+ SchemaProperty sProp = eltProperties[ii];
+
+ // test if the element is valid
+ if (state.test(sProp.getName()))
+ {
+ if (0 == BigInteger.ZERO.compareTo(sProp.getMinOccurs()))
+ optionalNames.add(sProp.getName());
+ else
+ expectedNames.add(sProp.getName());
+ }
+ }
+
+ List names = (expectedNames.size() > 0 ? expectedNames : optionalNames);
+
+ if (names.size() > 0)
+ {
+ StringBuffer buf = new StringBuffer();
+ for (Iterator iter = names.iterator(); iter.hasNext(); )
+ {
+ buf.append(QNameHelper.pretty((QName)iter.next()));
+ buf.append(" ");
+ }
+
+ message = "Expected element" + (names.size()>1 ? "s " : " ") +
+ buf.toString() + "at the end of the content";
+ }
+
+ return message;
+ }
+
+ private String findDetailedErrorEnd(State state)
+ {
+ SchemaProperty[] eltProperties = state._type.getElementProperties();
+ String message = null;
+
+ ArrayList expectedNames = new ArrayList();
+ ArrayList optionalNames = new ArrayList();
+
+ for (int ii = 0; ii < eltProperties.length; ii++)
+ {
+ //Get the element from the schema
+ SchemaProperty sProp = eltProperties[ii];
+
+ // test if the element is valid
+ if (state.test(sProp.getName()))
+ {
+ if (0 == BigInteger.ZERO.compareTo(sProp.getMinOccurs()))
+ optionalNames.add(sProp.getName());
+ else
+ expectedNames.add(sProp.getName());
+ }
+ }
+
+ List names = (expectedNames.size() > 0 ? expectedNames : optionalNames);
+
+ if (names.size() > 0)
+ {
+ StringBuffer buf = new StringBuffer();
+ for (Iterator iter = names.iterator(); iter.hasNext(); )
+ {
+ buf.append(QNameHelper.pretty((QName)iter.next()));
+ buf.append(" ");
+ }
+
+ message = "Expected element" + (names.size()>1 ? "s " : " ") +
+ buf.toString() + "at the end of the content";
+ }
+
+ return message;
+ }
+
+
+ private final class State
+ {
+ boolean visit ( QName name )
+ {
+ return _canHaveElements && _visitor.visit( name );
+ }
+
+ boolean test( QName name )
+ {
+ return _canHaveElements && _visitor.testValid( name );
+ }
+
+ boolean end ( )
+ {
+ return !_canHaveElements || _visitor.visit( null );
+ }
+
+ SchemaParticle currentParticle ( )
+ {
+ assert _visitor != null;
+ return _visitor.currentParticle();
+ }
+
+ SchemaType _type;
+ SchemaField _field;
+
+ boolean _canHaveAttrs;
+ boolean _canHaveMixedContent;
+ boolean _hasSimpleContent;
+
+ boolean _sawText;
+ boolean _isEmpty;
+ boolean _isNil;
+
+ SchemaTypeVisitorImpl _visitor;
+ boolean _canHaveElements;
+
+ SchemaAttributeModel _attrModel;
+
+ HashSet _attrs;
+
+ State _next;
+ }
+
+ private void newState ( SchemaType type, SchemaField field, boolean isNil )
+ {
+ State state = new State();
+
+ state._type = type;
+ state._field = field;
+ state._isEmpty = true;
+ state._isNil = isNil;
+
+ if (type.isSimpleType())
+ {
+ state._hasSimpleContent = true;
+ }
+ else
+ {
+ state._canHaveAttrs = true;
+ state._attrModel = type.getAttributeModel();
+
+ switch ( type.getContentType() )
+ {
+ case SchemaType.EMPTY_CONTENT :
+ break;
+
+ case SchemaType.SIMPLE_CONTENT :
+ state._hasSimpleContent = true;
+ break;
+
+ case SchemaType.MIXED_CONTENT :
+ state._canHaveMixedContent = true;
+ // Fall through
+
+ case SchemaType.ELEMENT_CONTENT :
+
+ SchemaParticle particle = type.getContentModel();
+
+ state._canHaveElements = particle != null;
+
+ if (state._canHaveElements)
+ state._visitor = initVisitor( particle );
+
+ break;
+
+ default :
+ throw new RuntimeException( "Unexpected content type" );
+ }
+ }
+
+ pushState( state );
+ }
+
+ private void popState ( Event e )
+ {
+ if (_stateStack._visitor != null)
+ {
+ poolVisitor( _stateStack._visitor );
+ _stateStack._visitor = null;
+ }
+
+ _stateStack = _stateStack._next;
+ }
+
+ private void pushState ( State state )
+ {
+ state._next = _stateStack;
+ _stateStack = state;
+ }
+
+ private LinkedList _visitorPool = new LinkedList();
+
+ private void poolVisitor( SchemaTypeVisitorImpl visitor )
+ {
+ _visitorPool.add( visitor );
+ }
+
+ private SchemaTypeVisitorImpl initVisitor( SchemaParticle particle )
+ {
+ if (_visitorPool.isEmpty())
+ return new SchemaTypeVisitorImpl( particle );
+
+ SchemaTypeVisitorImpl result =
+ (SchemaTypeVisitorImpl) _visitorPool.removeLast();
+
+ result.init( particle );
+
+ return result;
+ }
+
+ private State topState ( )
+ {
+ return _stateStack;
+ }
+
+ //
+ // Simple Type Validation
+ //
+ // emptyContent means that you can't use the event to get text: there is
+ // no text, but you can use the event to do prefix resolution (in the case
+ // where the default is a qname)
+ //
+
+ private String validateSimpleType (
+ SchemaType type, SchemaField field, Event event,
+ boolean emptyContent, boolean canApplyDefault )
+ {
+ if (!type.isSimpleType() &&
+ type.getContentType() != SchemaType.SIMPLE_CONTENT)
+ {
+ assert false;
+ // throw new RuntimeException( "Not a simple type" );
+ return null; // should never happen
+ }
+
+ //
+ // the no-type is always invalid
+ //
+
+ if (type.isNoType())
+ {
+ emitError(event, "Invalid type.");
+ return null;
+ }
+
+ // Get the value as a string (as normalized by the white space rule
+ // TODO - will want to optimize this later
+
+ String value = "";
+
+ if (!emptyContent)
+ {
+ event.getText( _chars, type.getWhiteSpaceRule() );
+ value = _chars.asString();
+ }
+
+ // See if I can apply a default/fixed value
+
+ if (value.length() == 0 && canApplyDefault && field != null &&
+ (field.isDefault() || field.isFixed()))
+ {
+ if (XmlQName.type.isAssignableFrom(type))
+ {
+ emitError(
+ event,
+ "Default QName values are unsupported for " +
+ QNameHelper.readable(type) + " - ignoring.",
+ XmlError.SEVERITY_INFO);
+
+ return null;
+ }
+
+ String defaultValue =
+ XmlWhitespace.collapse(
+ field.getDefaultText(), type.getWhiteSpaceRule() );
+
+// BUGBUG - should validate defaultValue at compile time
+ return
+ validateSimpleType( type, defaultValue, event )
+ ? defaultValue
+ : null;
+ }
+
+ if (!validateSimpleType( type, value, event ))
+ return null;
+
+ if (field != null && field.isFixed())
+ {
+// TODO - fixed value should have been cooked at compile time
+ String fixedValue =
+ XmlWhitespace.collapse(
+ field.getDefaultText(), type.getWhiteSpaceRule() );
+
+ if (!validateSimpleType( type, fixedValue, event ))
+ return null;
+
+ XmlObject val = type.newValue( value );
+ XmlObject def = type.newValue( fixedValue );
+
+ if (!val.valueEquals( def ))
+ {
+ // BUGBUG - make this more verbose
+
+ emitError(
+ event,
+ "Value not equal to fixed value. " + value );
+
+ return null;
+ }
+ }
+
+ return value;
+ }
+
+ private boolean validateSimpleType (
+ SchemaType type, String value, Event event )
+ {
+ if (!type.isSimpleType() &&
+ type.getContentType() != SchemaType.SIMPLE_CONTENT)
+ {
+ assert false;
+ throw new RuntimeException( "Not a simple type" );
+ }
+
+ int retState = _errorState;
+
+ switch ( type.getSimpleVariety() )
+ {
+ case SchemaType.ATOMIC : validateAtomicType( type, value, event );break;
+ case SchemaType.UNION : validateUnionType( type, value, event );break;
+ case SchemaType.LIST : validateListType( type, value, event );break;
+
+ default : throw new RuntimeException( "Unexpected simple variety" );
+ }
+
+ return retState == _errorState;
+ }
+
+ private void validateAtomicType (
+ SchemaType type, String value, Event event )
+ {
+ // Now we should have only an atomic type to validate
+
+ assert type.getSimpleVariety() == SchemaType.ATOMIC;
+
+ // Record the current error state to see if any new errors are made
+ int errorState = _errorState;
+ _vc._event = event;
+
+ switch ( type.getPrimitiveType().getBuiltinTypeCode() )
+ {
+ case SchemaType.BTC_ANY_SIMPLE :
+ {
+ // Always valid!
+ break;
+ }
+ case SchemaType.BTC_STRING :
+ {
+ JavaStringEnumerationHolderEx.validateLexical( value, type, _vc );
+ _stringValue = value;
+ break;
+ }
+ case SchemaType.BTC_DECIMAL :
+ {
+ JavaDecimalHolderEx.validateLexical( value, type, _vc );
+
+ if (errorState == _errorState)
+ {
+ _decimalValue = new BigDecimal( value );
+ JavaDecimalHolderEx.validateValue( _decimalValue, type, _vc );
+ }
+
+ break;
+ }
+ case SchemaType.BTC_BOOLEAN :
+ {
+ _booleanValue = JavaBooleanHolderEx.validateLexical( value, type, _vc );
+ break;
+ }
+ case SchemaType.BTC_FLOAT :
+ {
+ float f =
+ JavaFloatHolderEx.validateLexical( value, type, _vc );
+
+ if (errorState == _errorState)
+ JavaFloatHolderEx.validateValue( f, type, _vc );
+
+ _floatValue = f;
+ break;
+ }
+ case SchemaType.BTC_DOUBLE :
+ {
+ double d =
+ JavaDoubleHolderEx.validateLexical( value, type, _vc );
+
+ if (errorState == _errorState)
+ JavaDoubleHolderEx.validateValue( d, type, _vc );
+
+ _doubleValue = d;
+ break;
+ }
+ case SchemaType.BTC_QNAME :
+ {
+ QName n =
+ JavaQNameHolderEx.validateLexical(
+ value, type, _vc, event );
+
+ if (errorState == _errorState)
+ JavaQNameHolderEx.validateValue( n, type, _vc );
+
+ _qnameValue = n;
+ break;
+ }
+ case SchemaType.BTC_ANY_URI :
+ {
+ JavaUriHolderEx.validateLexical( value, type, _vc );
+ _stringValue = value;
+ break;
+ }
+ case SchemaType.BTC_DATE_TIME :
+ case SchemaType.BTC_TIME :
+ case SchemaType.BTC_DATE :
+ case SchemaType.BTC_G_YEAR_MONTH :
+ case SchemaType.BTC_G_YEAR :
+ case SchemaType.BTC_G_MONTH_DAY :
+ case SchemaType.BTC_G_DAY :
+ case SchemaType.BTC_G_MONTH :
+ {
+ GDate d = XmlDateImpl.validateLexical( value, type, _vc );
+
+ if (d != null)
+ XmlDateImpl.validateValue( d, type, _vc );
+
+ _gdateValue = d;
+ break;
+ }
+ case SchemaType.BTC_DURATION :
+ {
+ GDuration d = XmlDurationImpl.validateLexical( value, type, _vc );
+
+ if (d != null)
+ XmlDurationImpl.validateValue( d, type, _vc );
+
+ _gdurationValue = d;
+ break;
+ }
+ case SchemaType.BTC_BASE_64_BINARY :
+ {
+ byte[] v =
+ JavaBase64HolderEx.validateLexical( value, type, _vc );
+
+ if (v != null)
+ JavaBase64HolderEx.validateValue( v, type, _vc );
+
+ _byteArrayValue = v;
+ break;
+ }
+ case SchemaType.BTC_HEX_BINARY :
+ {
+ byte[] v =
+ JavaHexBinaryHolderEx.validateLexical( value, type, _vc );
+
+ if (v != null)
+ JavaHexBinaryHolderEx.validateValue( v, type, _vc );
+
+ _byteArrayValue = v;
+ break;
+ }
+ case SchemaType.BTC_NOTATION :
+ // Unimplemented.
+ break;
+
+ default :
+ throw new RuntimeException( "Unexpected primitive type code" );
+ }
+ }
+
+ private void validateListType (
+ SchemaType type, String value, Event event )
+ {
+ int errorState = _errorState;
+
+ if (!type.matchPatternFacet( value ))
+ {
+ emitError(
+ event,
+ "List '" + value + "' does not match pattern for " + QNameHelper.readable(type) );
+ }
+
+ String[] items = XmlListImpl.split_list(value);
+
+
+ int i;
+ XmlObject o;
+
+ if ((o = type.getFacet( SchemaType.FACET_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) != items.length)
+ {
+ emitError(
+ event,
+ "List (" + value + ") does not have " + i +
+ " items per length facet for " + QNameHelper.readable(type));
+ }
+ }
+
+ if ((o = type.getFacet( SchemaType.FACET_MIN_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) > items.length)
+ {
+ emitError(
+ event,
+ "List (" + value + ") has only " + items.length +
+ " items, fewer than min length facet (" + i + ") for " + QNameHelper.readable(type) );
+ }
+ }
+
+ if ((o = type.getFacet( SchemaType.FACET_MAX_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) < items.length)
+ {
+ emitError(
+ event,
+ "List (" + value + ") has " + items.length +
+ " items, more than max length facet (" + i + ") for " + QNameHelper.readable(type) );
+ }
+ }
+
+ SchemaType itemType = type.getListItemType();
+ _listValue = new ArrayList();
+ _listTypes = new ArrayList();
+
+ for ( i = 0 ; i < items.length ; i++ )
+ {
+ validateSimpleType(
+ itemType, items[i], event );
+ addToList(itemType);
+ }
+
+ // If no errors up to this point, then I can create an
+ // XmlList from this value and campare it again enums.
+
+ if (errorState == _errorState)
+ {
+ if (type.getEnumerationValues() != null)
+ {
+ // Lists which contain QNames will need a resolver
+
+ NamespaceContext.push(
+ new NamespaceContext( event ) );
+
+ try
+ {
+ XmlObject listValue = ( (SchemaTypeImpl) type).newValidatingValue( value );
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ emitError(
+ event,
+ "List value (" + value +
+ ") is not a valid enumeration value for " + QNameHelper.readable(type));
+ }
+ finally
+ {
+ NamespaceContext.pop();
+ }
+ }
+ }
+ }
+
+ private void validateUnionType (
+ SchemaType type, String value, Event event )
+ {
+ // TODO - if xsi:type is specified on a union, it selects
+ // that union member type
+
+ if (!type.matchPatternFacet( value ))
+ {
+ emitError(
+ event,
+ "Union '" + value + "' does not match pattern for " + QNameHelper.readable(type));
+ }
+
+ int currentWsr = SchemaType.WS_PRESERVE;
+ String currentValue = value;
+
+ SchemaType[] types = type.getUnionMemberTypes();
+
+ int originalState = _errorState;
+
+ int i;
+ for ( i = 0 ; i < types.length ; i++ )
+ {
+ int memberWsr = types[ i ].getWhiteSpaceRule();
+
+ if (memberWsr == SchemaType.WS_UNSPECIFIED)
+ memberWsr = SchemaType.WS_PRESERVE;
+
+ if (memberWsr != currentWsr)
+ {
+ currentWsr = memberWsr;
+ currentValue = XmlWhitespace.collapse( value, currentWsr );
+ }
+
+ int originalErrorState = _errorState;
+
+ _suspendErrors++;
+
+ try
+ {
+ validateSimpleType( types[ i ], currentValue, event );
+ }
+ finally
+ {
+ _suspendErrors--;
+ }
+
+ if (originalErrorState == _errorState)
+ {
+ _unionType = types[i];
+ break;
+ }
+ }
+
+ _errorState = originalState;
+
+ if (i >= types.length)
+ {
+ emitError(
+ event,
+ "Union '" + value + "' does not match any members of " + QNameHelper.readable(type) );
+ }
+ else
+ {
+ XmlObject[] unionEnumvals = type.getEnumerationValues();
+
+ if (unionEnumvals != null)
+ {
+ // Unions which contain QNames will need a resolver
+
+ NamespaceContext.push( new NamespaceContext( event ) );
+
+ try
+ {
+ XmlObject unionValue = type.newValue( value );
+
+ for ( i = 0 ; i < unionEnumvals.length ; i++ )
+ {
+ if (unionValue.valueEquals( unionEnumvals[ i ] ))
+ break;
+ }
+
+ if (i >= unionEnumvals.length)
+ {
+ emitError(
+ event,
+ "Union '" + value +
+ "' is not a valid enumeration value for " + QNameHelper.readable(type) );
+ }
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ // actually, the current union code always ends up here when invalid
+ emitError(
+ event,
+ "Union '" + value +
+ "' is not a valid enumeration value for " + QNameHelper.readable(type) );
+ }
+ finally
+ {
+ NamespaceContext.pop();
+ }
+ }
+ }
+ }
+
+ private void addToList(SchemaType type)
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return;
+
+ if (type.getUnionMemberTypes().length>0 && getUnionType()!=null)
+ {
+ type = getUnionType();
+ _unionType = null;
+ }
+
+ _listTypes.add(type);
+
+ switch ( type.getPrimitiveType().getBuiltinTypeCode() )
+ {
+ case SchemaType.BTC_ANY_SIMPLE :
+ {
+ _listValue.add(_stringValue);
+ break;
+ }
+ case SchemaType.BTC_STRING :
+ {
+ _listValue.add(_stringValue);
+ _stringValue = null;
+ break;
+ }
+ case SchemaType.BTC_DECIMAL :
+ {
+ _listValue.add( _decimalValue );
+ _decimalValue = null;
+ break;
+ }
+ case SchemaType.BTC_BOOLEAN :
+ {
+ _listValue.add(_booleanValue ? Boolean.TRUE : Boolean.FALSE);
+ _booleanValue = false;
+ break;
+ }
+ case SchemaType.BTC_FLOAT :
+ {
+ _listValue.add(new Float(_floatValue));
+ _floatValue = 0;
+ break;
+ }
+ case SchemaType.BTC_DOUBLE :
+ {
+ _listValue.add(new Double(_doubleValue));
+ _doubleValue = 0;
+ break;
+ }
+ case SchemaType.BTC_QNAME :
+ {
+ _listValue.add(_qnameValue);
+ _qnameValue = null;
+ break;
+ }
+ case SchemaType.BTC_ANY_URI :
+ {
+ _listTypes.add(_stringValue);
+ break;
+ }
+ case SchemaType.BTC_DATE_TIME :
+ case SchemaType.BTC_TIME :
+ case SchemaType.BTC_DATE :
+ case SchemaType.BTC_G_YEAR_MONTH :
+ case SchemaType.BTC_G_YEAR :
+ case SchemaType.BTC_G_MONTH_DAY :
+ case SchemaType.BTC_G_DAY :
+ case SchemaType.BTC_G_MONTH :
+ {
+ _listValue.add(_gdateValue);
+ _gdateValue = null;
+ break;
+ }
+ case SchemaType.BTC_DURATION :
+ {
+ _listValue.add(_gdurationValue);
+ _gdurationValue = null;
+ break;
+ }
+ case SchemaType.BTC_BASE_64_BINARY :
+ {
+ _listValue.add(_byteArrayValue);
+ _byteArrayValue = null;
+ break;
+ }
+ case SchemaType.BTC_HEX_BINARY :
+ {
+ _listValue.add(_byteArrayValue);
+ _byteArrayValue = null;
+ break;
+ }
+ case SchemaType.BTC_NOTATION :
+ {
+ _listValue.add(_stringValue);
+ _stringValue = null;
+ break;
+ }
+
+ default :
+ throw new RuntimeException( "Unexpected primitive type code" );
+ }
+ }
+
+ //
+ // Members of the validator class
+ //
+
+ private boolean _invalid;
+ private SchemaType _rootType;
+ private SchemaField _rootField;
+ private SchemaTypeLoader _globalTypes;
+ private Chars _chars;
+ private State _stateStack;
+ private int _errorState;
+ private Collection _errorListener;
+ private ValidatorVC _vc;
+ private int _suspendErrors;
+ private IdentityConstraint _constraintEngine;
+ private int _eatContent;
+
+ private SchemaLocalElement _localElement;
+ private SchemaParticle _wildcardElement;
+ private SchemaLocalAttribute _localAttribute;
+ private SchemaAttributeModel _wildcardAttribute;
+ private SchemaType _unionType;
+
+ // Strongly typed values
+ private String _stringValue;
+ private BigDecimal _decimalValue;
+ private boolean _booleanValue;
+ private float _floatValue;
+ private double _doubleValue;
+ private QName _qnameValue;
+ private GDate _gdateValue;
+ private GDuration _gdurationValue;
+ private byte[] _byteArrayValue;
+ private List _listValue;
+ private List _listTypes;
+
+ private void resetValues()
+ {
+ _localAttribute = null;
+ _wildcardAttribute = null;
+ _stringValue = null;
+ _decimalValue = null;
+ _booleanValue = false;
+ _floatValue = 0;
+ _doubleValue = 0;
+ _qnameValue = null;
+ _gdateValue = null;
+ _gdurationValue = null;
+ _byteArrayValue = null;
+ _listValue = null;
+ _listTypes = null;
+ _unionType = null;
+ _localAttribute = null;
+ }
+
+ public SchemaLocalElement getCurrentElement()
+ {
+ if (_localElement != null)
+ return _localElement;
+
+ // it means the element is to be skiped and it doesn't have a known SchemaLocalElement
+ if (_eatContent>0)
+ return null;
+
+ //try getting it from the stack (this should happen after END)
+ if (_stateStack!=null && _stateStack._field instanceof SchemaLocalElement )
+ return (SchemaLocalElement)_stateStack._field;
+
+ return null;
+ }
+
+ public SchemaParticle getCurrentWildcardElement()
+ {
+ return _wildcardElement;
+ }
+
+ public SchemaLocalAttribute getCurrentAttribute()
+ {
+ return _localAttribute;
+ }
+
+ public SchemaAttributeModel getCurrentWildcardAttribute()
+ {
+ return _wildcardAttribute;
+ }
+
+ public String getStringValue()
+ {
+ return _stringValue;
+ }
+
+ public BigDecimal getDecimalValue()
+ {
+ return _decimalValue;
+ }
+
+ public boolean getBooleanValue()
+ {
+ return _booleanValue;
+ }
+
+ public float getFloatValue()
+ {
+ return _floatValue;
+ }
+
+ public double getDoubleValue()
+ {
+ return _doubleValue;
+ }
+
+ public QName getQNameValue()
+ {
+ return _qnameValue;
+ }
+
+ public GDate getGDateValue()
+ {
+ return _gdateValue;
+ }
+
+ public GDuration getGDurationValue()
+ {
+ return _gdurationValue;
+ }
+
+ public byte[] getByteArrayValue()
+ {
+ return _byteArrayValue;
+ }
+
+ public List getListValue()
+ {
+ return _listValue;
+ }
+
+ public List getListTypes()
+ {
+ return _listTypes;
+ }
+
+ public SchemaType getUnionType()
+ {
+ return _unionType;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64Holder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64Holder.java
new file mode 100644
index 0000000..243d6f4
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64Holder.java
@@ -0,0 +1,151 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+import org.apache.xmlbeans.impl.util.Base64;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlBase64Binary;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import java.io.UnsupportedEncodingException;
+
+public abstract class JavaBase64Holder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_BASE_64_BINARY; }
+
+ protected byte[] _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets raw text value
+ protected String compute_text(NamespaceManager nsm)
+ {
+ return new String(Base64.encode(_value));
+ }
+ protected void set_text(String s)
+ {
+ _hashcached = false;
+ if (_validateOnSet())
+ _value = validateLexical(s, schemaType(), _voorVc);
+ else
+ _value = lex(s, _voorVc);
+ }
+ protected void set_nil()
+ {
+ _hashcached = false;
+ _value = null;
+ }
+
+ public static byte[] lex(String v, ValidationContext c)
+ {
+ byte[] vBytes = null;
+ try
+ {
+ vBytes = v.getBytes("UTF-8");
+ }
+ catch(UnsupportedEncodingException uee)
+ {
+ // should never happen - UTF-8 is always supported
+ }
+ final byte[] bytes = Base64.decode(vBytes);
+
+ if (bytes == null)
+ {
+ // TODO - get a decent error with line numbers and such here
+ c.invalid("Base 64 encoded data not encoded properly");
+ }
+
+ return bytes;
+ }
+
+ public static byte[] validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ final byte[] bytes = lex(v, context);
+ if (bytes == null) return null;
+
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid( "Base 64 encoded data does not match pattern for " + QNameHelper.readable(sType));
+ return null;
+ }
+
+ return bytes;
+ }
+
+ public byte[] byteArrayValue()
+ {
+ check_dated();
+ if (_value == null)
+ return null;
+
+ byte[] result = new byte[_value.length];
+ System.arraycopy(_value, 0, result, 0, _value.length);
+ return result;
+ }
+
+ // setters
+ protected void set_ByteArray(byte[] ba)
+ {
+ _hashcached = false;
+ _value = new byte[ba.length];
+ System.arraycopy(ba, 0, _value, 0, ba.length);
+ }
+
+ // comparators
+ protected boolean equal_to(XmlObject i)
+ {
+ byte[] ival = ((XmlBase64Binary) i).getByteArrayValue();
+ return Arrays.equals(_value, ival);
+ }
+
+ //because computing hashcode is expensive we'll cache it
+ protected boolean _hashcached = false;
+ protected int hashcode = 0;
+ protected static MessageDigest md5;
+ static
+ {
+ try
+ {
+ md5 = MessageDigest.getInstance("MD5");
+ }
+ catch( NoSuchAlgorithmException e )
+ {
+ throw new IllegalStateException("Cannot find MD5 hash Algorithm");
+ }
+ }
+
+ protected int value_hash_code()
+ {
+ if( _hashcached )
+ return hashcode;
+
+ _hashcached = true;
+
+ if( _value == null )
+ return hashcode = 0;
+
+ byte[] res = md5.digest(_value);
+ return hashcode = res[0]<<24 + res[1]<<16 + res[2]<<8 + res[3];
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64HolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64HolderEx.java
new file mode 100644
index 0000000..9bff3d5
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBase64HolderEx.java
@@ -0,0 +1,125 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+public abstract class JavaBase64HolderEx extends JavaBase64Holder
+{
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaBase64HolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ final byte[] v;
+
+ if (_validateOnSet())
+ v = validateLexical(s, schemaType(), _voorVc);
+ else
+ v = lex(s, _voorVc);
+
+ if (v != null && _validateOnSet())
+ validateValue(v, schemaType(), XmlObjectBase._voorVc);
+
+ super.set_ByteArray(v);
+ }
+
+ // setters
+ protected void set_ByteArray(byte[] v)
+ {
+ if (_validateOnSet())
+ validateValue(v, schemaType(), _voorVc);
+
+ super.set_ByteArray(v);
+ }
+
+ public static void validateValue(byte[] v, SchemaType sType, ValidationContext context)
+ {
+ int i;
+ XmlObject o;
+
+ if ((o = sType.getFacet(SchemaType.FACET_LENGTH)) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) != v.length)
+ {
+ context.invalid(
+ "Base 64 encoded data does not have " + i +
+ " bytes per length facet" );
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MIN_LENGTH )) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) > v.length)
+ {
+ context.invalid(
+ "Base 64 encoded data has only " + v.length +
+ " bytes, fewer than min length facet" );
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MAX_LENGTH )) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) < v.length)
+ {
+ context.invalid(
+ "Base 64 encoded data has " + v.length +
+ " bytes, more than max length facet" );
+ }
+ }
+
+ XmlObject[] vals = sType.getEnumerationValues();
+
+ if (vals != null)
+ {
+ enumLoop: for ( i = 0 ; i < vals.length ; i++ )
+ {
+ byte[] enumBytes = ((XmlObjectBase)vals[i]).byteArrayValue();
+
+ if (enumBytes.length != v.length)
+ continue;
+
+ for ( int j = 0 ; j < enumBytes.length ; j++ )
+ if (enumBytes[j] != v[j])
+ continue enumLoop;
+
+ break;
+ }
+
+ if (i >= vals.length)
+ context.invalid("Base 64 encoded data does not match any of the enumeration values");
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(byteArrayValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolder.java
new file mode 100644
index 0000000..096d50e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolder.java
@@ -0,0 +1,80 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlBoolean;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+public abstract class JavaBooleanHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_BOOLEAN; }
+
+ private boolean _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets raw text value
+ protected String compute_text(NamespaceManager nsm) { return _value ? "true" : "false"; }
+ protected void set_text(String s)
+ {
+ _value = validateLexical(s, _voorVc);
+ }
+ public static boolean validateLexical(String v, ValidationContext context)
+ {
+ if (v.equals("true") || v.equals("1"))
+ return true;
+
+ if (v.equals("false") || v.equals("0"))
+ return false;
+
+ context.invalid("Invalid value for boolean: " + v);
+
+ return false;
+ }
+ protected void set_nil()
+ {
+ _value = false;
+ }
+ // numerics: fractional
+ public boolean booleanValue() { check_dated(); return _value; }
+
+ // setters
+ protected void set_boolean(boolean f)
+ {
+ _value = f;
+ }
+
+ // comparators
+ protected int compare_to(XmlObject i)
+ {
+ // no ordering defined between true and false
+ return _value == ((XmlBoolean)i).getBooleanValue() ? 0 : 2;
+ }
+
+ protected boolean equal_to(XmlObject i)
+ {
+ return _value == ((XmlBoolean)i).getBooleanValue();
+ }
+
+ protected int value_hash_code()
+ {
+ return _value ? 957379554 : 676335975;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolderEx.java
new file mode 100644
index 0000000..d12697c
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaBooleanHolderEx.java
@@ -0,0 +1,59 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+
+
+public abstract class JavaBooleanHolderEx extends JavaBooleanHolder
+{
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public static boolean validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ boolean b = JavaBooleanHolder.validateLexical(v, context);
+ validatePattern(v, sType, context);
+ return b;
+ }
+
+ public static void validatePattern(String v, SchemaType sType, ValidationContext context)
+ {
+ // the only new facet that can apply to booleans is pattern!
+ if (!sType.matchPatternFacet(v))
+ context.invalid("Boolean (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+ }
+
+ public JavaBooleanHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ validatePattern(s, _schemaType, _voorVc);
+ super.set_text(s);
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolder.java
new file mode 100644
index 0000000..8ce09d1
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolder.java
@@ -0,0 +1,172 @@
+/* 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.xmlbeans.impl.values;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+public class JavaDecimalHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_DECIMAL; }
+
+ private BigDecimal _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // sets/gets raw text value
+ protected String compute_text(NamespaceManager nsm) { return _value.toString(); }
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ validateLexical(s, _voorVc);
+
+ try {
+ set_BigDecimal(new BigDecimal(s));
+ }
+ catch (NumberFormatException e)
+ {
+ _voorVc.invalid("Invalid Decimal");
+ }
+ }
+ protected void set_nil()
+ {
+ _value = null;
+ }
+
+ /**
+ * Performs lexical validation only.
+ */
+
+ public static void validateLexical(String v, ValidationContext context)
+ {
+ // TODO - will want to validate Chars with built in white space handling
+ // However, this fcn sometimes takes a value with wsr applied
+ // already
+ int l = v.length();
+ int i = 0;
+
+ if (i < l)
+ {
+ int ch = v.charAt(i);
+
+ if (ch == '+' || ch == '-')
+ i++;
+ }
+
+ boolean sawDot = false;
+ boolean sawDigit = false;
+
+ for ( ; i < l ; i++ )
+ {
+ int ch = v.charAt(i);
+
+ if (ch == '.')
+ {
+ if (sawDot)
+ {
+ context.invalid("Illegal decimal, saw '.' more than once");
+ return;
+ }
+
+ sawDot = true;
+ }
+ else if (ch >= '0' && ch <= '9')
+ {
+ sawDigit = true;
+ }
+ else
+ {
+ // TODO - may need to escape error char
+ context.invalid("Illegal decimal, unexpected char: " + ch);
+ return;
+ }
+ }
+
+ if (!sawDigit)
+ {
+ context.invalid("Illegal decimal, expected at least one digit");
+ return;
+ }
+ }
+
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return _value; }
+
+ // setters
+ protected void set_BigDecimal(BigDecimal v) { _value = v; }
+
+ // comparators
+ protected int compare_to(XmlObject decimal)
+ {
+ return _value.compareTo(((XmlObjectBase)decimal).bigDecimalValue());
+ }
+ protected boolean equal_to(XmlObject decimal)
+ {
+ return (_value.compareTo(((XmlObjectBase)decimal).bigDecimalValue())) == 0;
+ }
+
+ static private BigInteger _maxlong = BigInteger.valueOf(Long.MAX_VALUE);
+ static private BigInteger _minlong = BigInteger.valueOf(Long.MIN_VALUE);
+
+ /**
+ * Note, this is carefully aligned with hash codes for all xsd:decimal
+ * primitives.
+ */
+ protected int value_hash_code()
+ {
+ if (_value.scale() > 0)
+ {
+ if (_value.setScale(0, BigDecimal.ROUND_DOWN).compareTo(_value) != 0)
+ return decimalHashCode();
+ }
+
+ BigInteger intval = _value.toBigInteger();
+
+ if (intval.compareTo(_maxlong) > 0 ||
+ intval.compareTo(_minlong) < 0)
+ return intval.hashCode();
+
+ long longval = intval.longValue();
+
+ return (int)((longval >> 32) * 19 + longval);
+ }
+
+ /**
+ * This method will has BigDecimals with the same arithmetic value to
+ * the same hash code (eg, 2.3 & 2.30 will have the same hash.)
+ * This differs from BigDecimal.hashCode()
+ */
+ protected int decimalHashCode() {
+ assert _value.scale() > 0;
+
+ // Get decimal value as string, and strip off zeroes on the right
+ String strValue = _value.toString();
+ int i;
+ for (i = strValue.length() - 1 ; i >= 0 ; i --)
+ if (strValue.charAt(i) != '0') break;
+
+ assert strValue.indexOf('.') < i;
+
+ // Return the canonicalized string hashcode
+ return strValue.substring(0, i + 1).hashCode();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolderEx.java
new file mode 100644
index 0000000..3eeaaf9
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDecimalHolderEx.java
@@ -0,0 +1,189 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+
+import java.math.BigDecimal;
+
+public abstract class JavaDecimalHolderEx extends JavaDecimalHolder
+{
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaDecimalHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ validateLexical(s, _schemaType, _voorVc);
+
+ BigDecimal v = null;
+ try {
+ v = new BigDecimal(s);
+ }
+ catch (NumberFormatException e)
+ {
+ _voorVc.invalid("Invalid Decimal");
+ }
+
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ super.set_BigDecimal(v);
+ }
+
+ protected void set_BigDecimal(BigDecimal v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+ super.set_BigDecimal(v);
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ JavaDecimalHolder.validateLexical(v, context);
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ // TODO - describe string and pattern here in error
+ context.invalid("Decimal (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+ }
+
+ /**
+ * Performs facet validation only.
+ */
+
+ public static void validateValue(BigDecimal v, SchemaType sType, ValidationContext context)
+ {
+ // fractional digits
+ XmlObject fd = sType.getFacet(SchemaType.FACET_FRACTION_DIGITS);
+ if (fd != null)
+ {
+ int scale = ((XmlObjectBase)fd).bigIntegerValue().intValue();
+ if (v.scale() > scale)
+ {
+ context.invalid(
+ "Decimal fractional digits (" + v.scale() + ") does not match " +
+ "fractional digits facet (" + scale + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // total digits
+ XmlObject td = sType.getFacet(SchemaType.FACET_TOTAL_DIGITS);
+ if (td != null)
+ {
+ String temp = v.unscaledValue().toString();
+ int tdf = ((XmlObjectBase)td).bigIntegerValue().intValue();
+ int len = temp.length();
+ if (len > 0 && temp.charAt(0) == '-')
+ len -= 1;
+ if (len > tdf)
+ {
+ context.invalid(
+ "Decimal total digits (" + temp + ") is greater than " +
+ "total digits facet (" + tdf + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min ex
+ XmlObject mine = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (mine != null)
+ {
+ BigDecimal m = ((XmlObjectBase)mine).bigDecimalValue();
+ if (v.compareTo(m) <= 0)
+ {
+ context.invalid(
+ "Decimal (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min in
+ XmlObject mini = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (mini != null)
+ {
+ BigDecimal m = ((XmlObjectBase)mini).bigDecimalValue();
+ if (v.compareTo(m) < 0)
+ {
+ context.invalid(
+ "Decimal (" + v + ") is less than " +
+ "min inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max in
+ XmlObject maxi = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (maxi != null)
+ {
+ BigDecimal m = ((XmlObjectBase)maxi).bigDecimalValue();
+ if (v.compareTo(m) > 0)
+ {
+ context.invalid(
+ "Decimal (" + v + ") is greater than " +
+ "max inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max ex
+ XmlObject maxe = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (maxe != null)
+ {
+ BigDecimal m = ((XmlObjectBase)maxe).bigDecimalValue();
+ if (v.compareTo(m) >= 0)
+ {
+ context.invalid(
+ "Decimal (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // enumeration
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (v.equals(((XmlObjectBase)vals[i]).bigDecimalValue()))
+ return;
+ context.invalid("Decimal (" + v + ") does not match any enumeration values for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(bigDecimalValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolder.java
new file mode 100644
index 0000000..4e7f452
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolder.java
@@ -0,0 +1,113 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public abstract class JavaDoubleHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_DOUBLE; }
+
+ double _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets/sets raw text value
+ protected String compute_text(NamespaceManager nsm) { return serialize(_value); }
+
+ public static String serialize(double d)
+ {
+ if (d == Double.POSITIVE_INFINITY)
+ return "INF";
+ else if (d == Double.NEGATIVE_INFINITY)
+ return "-INF";
+ else if (d == Double.NaN)
+ return "NaN";
+ else
+ return Double.toString(d);
+ }
+ protected void set_text(String s)
+ {
+ set_double(validateLexical(s,_voorVc));
+ }
+ public static double validateLexical(String v, ValidationContext context)
+ {
+ try
+ {
+ return Double.parseDouble(v);
+ }
+ catch(NumberFormatException e)
+ {
+ if (v.equals("INF")) return Double.POSITIVE_INFINITY;
+ if (v.equals("-INF")) return Double.NEGATIVE_INFINITY;
+ if (v.equals("NaN")) return Double.NaN;
+
+ context.invalid("Invalid double value");
+
+ return Double.NaN;
+ }
+ }
+ protected void set_nil()
+ {
+ _value = 0.0;
+ }
+
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return new BigDecimal(_value); }
+ public double doubleValue() { check_dated(); return _value; }
+ public float floatValue() { check_dated(); return (float)_value; }
+
+ // setters
+ protected void set_double(double v) { _value = v; }
+ protected void set_float(float v) { set_double((double)v); }
+ protected void set_long(long v) { set_double((double)v); }
+ protected void set_BigDecimal(BigDecimal v) { set_double(v.doubleValue()); }
+ protected void set_BigInteger(BigInteger v) { set_double(v.doubleValue()); }
+
+ // comparators
+ protected int compare_to(XmlObject d)
+ {
+ return compare(_value,((XmlObjectBase)d).doubleValue());
+ }
+ static int compare(double thisValue, double thatValue)
+ {
+ if (thisValue < thatValue) return -1;
+ if (thisValue > thatValue) return 1;
+
+ long thisBits = Double.doubleToLongBits(thisValue);
+ long thatBits = Double.doubleToLongBits(thatValue);
+
+ return thisBits == thatBits ? 0 : thisBits < thatBits ? -1 : 1;
+ }
+
+ protected boolean equal_to(XmlObject d)
+ {
+ return compare(_value, ((XmlObjectBase)d).doubleValue()) == 0;
+ }
+
+ protected int value_hash_code()
+ {
+ long v = Double.doubleToLongBits(_value);
+ return (int)((v >> 32) * 19 + v);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolderEx.java
new file mode 100644
index 0000000..136240b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaDoubleHolderEx.java
@@ -0,0 +1,112 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+
+
+public abstract class JavaDoubleHolderEx extends JavaDoubleHolder
+{
+ public JavaDoubleHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ protected void set_double(double v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+ super.set_double(v);
+ }
+
+ public static double validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ double d = JavaDoubleHolder.validateLexical(v, context);
+
+ if (!sType.matchPatternFacet(v))
+ context.invalid("Double (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+
+ return d;
+ }
+
+ public static void validateValue(double v, SchemaType sType, ValidationContext context)
+ {
+ XmlObject x;
+ double d;
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE)) != null)
+ {
+ if (compare(v, d = ((XmlObjectBase)x).doubleValue()) <= 0)
+ {
+ context.invalid(
+ "Double (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + d + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE)) != null)
+ {
+ if (compare(v, d = ((XmlObjectBase)x).doubleValue()) < 0)
+ {
+ context.invalid(
+ "Double (" + v + ") is less than " +
+ "min inclusive facet (" + d + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE)) != null)
+ {
+ if (compare(v, d = ((XmlObjectBase)x).doubleValue()) > 0)
+ {
+ context.invalid(
+ "Double (" + v + ") is greater than " +
+ "max inclusive facet (" + d + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE)) != null)
+ {
+ if (compare(v, d = ((XmlObjectBase)x).doubleValue()) >= 0)
+ {
+ context.invalid(
+ "Double (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + d + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (compare(v, ((XmlObjectBase)vals[i]).doubleValue()) == 0)
+ return;
+ context.invalid("Double (" + v + ") is not a valid enumerated value for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(doubleValue(), schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolder.java
new file mode 100644
index 0000000..2e25857
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolder.java
@@ -0,0 +1,114 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public abstract class JavaFloatHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_FLOAT; }
+
+ private float _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets+sets raw text value
+ protected String compute_text(NamespaceManager nsm) {
+ return serialize(_value);
+ }
+
+ public static String serialize(float f)
+ {
+ if (f == Float.POSITIVE_INFINITY)
+ return "INF";
+ else if (f == Float.NEGATIVE_INFINITY)
+ return "-INF";
+ else if (f == Float.NaN)
+ return "NaN";
+ else
+ return Float.toString(f);
+ }
+ protected void set_text(String s)
+ {
+ set_float(validateLexical(s,_voorVc));
+ }
+ public static float validateLexical(String v, ValidationContext context)
+ {
+ try
+ {
+ return Float.parseFloat(v);
+ }
+ catch(NumberFormatException e)
+ {
+ if (v.equals("INF")) return Float.POSITIVE_INFINITY;
+ if (v.equals("-INF")) return Float.NEGATIVE_INFINITY;
+ if (v.equals("NaN")) return Float.NaN;
+
+ context.invalid("Invalid float value");
+
+ return Float.NaN;
+ }
+ }
+ protected void set_nil()
+ {
+ _value = 0.0f;
+ }
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return new BigDecimal(_value); }
+ public double doubleValue() { check_dated(); return _value; }
+ public float floatValue() { check_dated(); return _value; }
+
+ // setters
+ protected void set_double(double v) { set_float((float)v); }
+ protected void set_float(float v) { _value = v; }
+ protected void set_long(long v) { set_float((float)v); }
+ protected void set_BigDecimal(BigDecimal v) { set_float(v.floatValue()); }
+ protected void set_BigInteger(BigInteger v) { set_float(v.floatValue()); }
+
+ // comparators
+ protected int compare_to(XmlObject f)
+ {
+ return compare(_value,((XmlObjectBase)f).floatValue());
+ }
+
+ static int compare(float thisValue, float thatValue)
+ {
+ if (thisValue < thatValue) return -1;
+ if (thisValue > thatValue) return 1;
+
+ int thisBits = Float.floatToIntBits(thisValue);
+ int thatBits = Float.floatToIntBits(thatValue);
+
+ return thisBits == thatBits ? 0 : thisBits < thatBits ? -1 : 1;
+ }
+
+ protected boolean equal_to(XmlObject f)
+ {
+ return compare(_value, ((XmlObjectBase)f).floatValue()) == 0;
+ }
+
+ protected int value_hash_code()
+ {
+ return Float.floatToIntBits(_value);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolderEx.java
new file mode 100644
index 0000000..42c4efc
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaFloatHolderEx.java
@@ -0,0 +1,113 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+
+
+public abstract class JavaFloatHolderEx extends JavaFloatHolder
+{
+ public JavaFloatHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ protected void set_float(float v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+ super.set_float(v);
+ }
+
+ public static float validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ float f = JavaFloatHolder.validateLexical(v, context);
+
+ if (!sType.matchPatternFacet(v))
+ context.invalid("Float (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+
+ return f;
+ }
+
+ public static void validateValue(float v, SchemaType sType, ValidationContext context)
+ {
+ XmlObject x;
+ float f;
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE)) != null)
+ {
+ if (compare(v, f = ((XmlObjectBase)x).floatValue()) <= 0)
+ {
+ context.invalid(
+ "Float (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + f + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE)) != null)
+ {
+ if (compare(v, f = ((XmlObjectBase)x).floatValue()) < 0)
+ {
+ context.invalid(
+ "Float (" + v + ") is less than " +
+ "min inclusive facet (" + f + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE)) != null)
+ {
+ if (compare(v, f = ((XmlObjectBase)x).floatValue()) > 0)
+ {
+ context.invalid(
+ "Float (" + v + ") is greater than " +
+ "max inclusive facet (" + f + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE)) != null)
+ {
+ if (compare(v, f = ((XmlObjectBase)x).floatValue()) >= 0)
+ {
+ context.invalid(
+ "Float (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + f + ") for " + QNameHelper.readable(sType));
+ }
+ }
+
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (compare(v, ((XmlObjectBase)vals[i]).floatValue()) == 0)
+ return;
+ context.invalid("Float (" + v + ") is not a valid enumerated value for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(floatValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDateHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDateHolderEx.java
new file mode 100644
index 0000000..d78043c
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDateHolderEx.java
@@ -0,0 +1,312 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDateSpecification;
+import org.apache.xmlbeans.GDateBuilder;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import java.util.Date;
+import java.util.Calendar;
+
+public abstract class JavaGDateHolderEx extends XmlObjectBase
+{
+ public JavaGDateHolderEx(SchemaType type, boolean complex)
+ {
+ _schemaType = type;
+ initComplexType(complex, false);
+ }
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ private SchemaType _schemaType;
+ private GDate _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // sets/gets raw text value
+ protected String compute_text(NamespaceManager nsm)
+ { return _value == null ? "" : _value.toString(); }
+
+ protected void set_text(String s)
+ {
+ GDate newVal;
+ if (_validateOnSet())
+ newVal = validateLexical(s, _schemaType, _voorVc);
+ else
+ newVal = lex(s, _schemaType, _voorVc);
+
+ if (_validateOnSet() && newVal != null)
+ validateValue(newVal, _schemaType, _voorVc);
+
+ _value = newVal;
+ }
+
+ public static GDate lex(String v, SchemaType sType, ValidationContext context)
+ {
+ GDate date = null;
+
+ try
+ {
+ date = new GDate(v);
+ }
+ catch (Exception e)
+ {
+ context.invalid("Date value is malformed: "+v);
+ }
+
+ if (date != null)
+ {
+ if (date.getBuiltinTypeCode() != sType.getPrimitiveType().getBuiltinTypeCode())
+ {
+ context.invalid("Date value is of wrong type: " + v);
+ date = null;
+ }
+ else if (!date.isValid())
+ {
+ context.invalid("Date value is invalid: " + v);
+ date = null;
+ }
+ }
+
+ return date;
+ }
+
+ public static GDate validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+
+ GDate date = lex(v, sType, context);
+
+ if (date != null && sType.hasPatternFacet())
+ if (!sType.matchPatternFacet(v))
+ context.invalid("Date (' + v + ') does not match pattern for " + QNameHelper.readable(sType));
+
+ return date;
+ }
+
+ public static void validateValue(GDateSpecification v, SchemaType sType, ValidationContext context)
+ {
+ XmlObject x;
+ GDate g;
+
+ if (v.getBuiltinTypeCode() != sType.getPrimitiveType().getBuiltinTypeCode())
+ context.invalid("Date (" + v + ") does not have the set of fields required for " + QNameHelper.readable(sType));
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE)) != null)
+ if (v.compareToGDate(g = ((XmlObjectBase)x).gDateValue()) <= 0)
+ context.invalid("Date (" + v + ") is less than or equal to min exclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE)) != null)
+ if (v.compareToGDate(g = ((XmlObjectBase)x).gDateValue()) < 0)
+ context.invalid("Date (" + v + ") is less than min inclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE)) != null)
+ if (v.compareToGDate(g = ((XmlObjectBase)x).gDateValue()) >= 0)
+ context.invalid("Date (" + v + ") is greater than or equal to max exclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE)) != null)
+ if (v.compareToGDate(g = ((XmlObjectBase)x).gDateValue()) > 0)
+ context.invalid("Date (" + v + ") is greater than max inclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (v.compareToGDate(((XmlObjectBase)vals[i]).gDateValue()) == 0)
+ return;
+ context.invalid("Date (" + v + ") is not a valid enumeration value for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected void set_nil()
+ {
+ _value = null;
+ }
+
+ // numerics: gYear, gMonth, gDay accept an integer
+ public int intValue()
+ {
+ int code = schemaType().getPrimitiveType().getBuiltinTypeCode();
+
+ if (code != SchemaType.BTC_G_DAY &&
+ code != SchemaType.BTC_G_MONTH &&
+ code != SchemaType.BTC_G_YEAR)
+ throw new XmlValueOutOfRangeException();
+
+ check_dated();
+
+ if (_value == null)
+ return 0;
+
+ switch (code)
+ {
+ case SchemaType.BTC_G_DAY:
+ return _value.getDay();
+ case SchemaType.BTC_G_MONTH:
+ return _value.getMonth();
+ case SchemaType.BTC_G_YEAR:
+ return _value.getYear();
+ default:
+ assert(false);
+ throw new IllegalStateException();
+ }
+ }
+
+ public GDate gDateValue()
+ {
+ check_dated();
+
+ if (_value == null)
+ return null;
+
+ return _value;
+ }
+
+ public Calendar calendarValue()
+ {
+ check_dated();
+
+ if (_value == null)
+ return null;
+
+ return _value.getCalendar();
+ }
+
+ public Date dateValue()
+ {
+ check_dated();
+
+ if (_value == null)
+ return null;
+
+ return _value.getDate();
+ }
+
+ // setters
+ protected void set_int(int v)
+ {
+ int code = schemaType().getPrimitiveType().getBuiltinTypeCode();
+
+ if (code != SchemaType.BTC_G_DAY &&
+ code != SchemaType.BTC_G_MONTH &&
+ code != SchemaType.BTC_G_YEAR)
+ throw new XmlValueOutOfRangeException();
+
+ GDateBuilder value = new GDateBuilder();
+
+ switch (code)
+ {
+ case SchemaType.BTC_G_DAY:
+ value.setDay(v); break;
+ case SchemaType.BTC_G_MONTH:
+ value.setMonth(v); break;
+ case SchemaType.BTC_G_YEAR:
+ value.setYear(v); break;
+ }
+
+ if (_validateOnSet())
+ validateValue(value, _schemaType, _voorVc);
+
+ _value = value.toGDate();
+ }
+
+ protected void set_GDate(GDateSpecification v)
+ {
+ int code = schemaType().getPrimitiveType().getBuiltinTypeCode();
+
+ GDate candidate;
+
+ if (v.isImmutable() && (v instanceof GDate) && v.getBuiltinTypeCode() == code)
+ candidate = (GDate)v;
+ else
+ {
+ // truncate extra fields from the date if necessary.
+ if (v.getBuiltinTypeCode() != code)
+ {
+ GDateBuilder gDateBuilder = new GDateBuilder(v);
+ gDateBuilder.setBuiltinTypeCode(code);
+ v = gDateBuilder;
+ }
+ candidate = new GDate(v);
+ }
+
+ if (_validateOnSet())
+ validateValue(candidate, _schemaType, _voorVc);
+
+ _value = candidate;
+ }
+
+ protected void set_Calendar(Calendar c)
+ {
+ int code = schemaType().getPrimitiveType().getBuiltinTypeCode();
+
+ GDateBuilder gDateBuilder = new GDateBuilder(c);
+ gDateBuilder.setBuiltinTypeCode(code);
+ GDate value = gDateBuilder.toGDate();
+
+ if (_validateOnSet())
+ validateValue(value, _schemaType, _voorVc);
+
+ _value = value;
+ }
+
+ protected void set_Date(Date v)
+ {
+ int code = schemaType().getPrimitiveType().getBuiltinTypeCode();
+
+ if (code != SchemaType.BTC_DATE && code != SchemaType.BTC_DATE_TIME ||
+ v == null)
+ throw new XmlValueOutOfRangeException();
+
+ GDateBuilder gDateBuilder = new GDateBuilder(v);
+ gDateBuilder.setBuiltinTypeCode(code);
+ GDate value = gDateBuilder.toGDate();
+
+ if (_validateOnSet())
+ validateValue(value, _schemaType, _voorVc);
+
+ _value = value;
+ }
+
+
+ // comparators
+ protected int compare_to(XmlObject obj)
+ {
+ return _value.compareToGDate(((XmlObjectBase)obj).gDateValue());
+ }
+
+ protected boolean equal_to(XmlObject obj)
+ {
+ return _value.equals(((XmlObjectBase)obj).gDateValue());
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(gDateValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDurationHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDurationHolderEx.java
new file mode 100644
index 0000000..deed7f3
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaGDurationHolderEx.java
@@ -0,0 +1,153 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.GDurationSpecification;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.XmlObject;
+
+public abstract class JavaGDurationHolderEx extends XmlObjectBase
+{
+ public JavaGDurationHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ GDuration _value;
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType() { return _schemaType; }
+
+ protected void set_text(String s)
+ {
+ GDuration newVal;
+ if (_validateOnSet())
+ newVal = validateLexical(s, _schemaType, _voorVc);
+ else
+ newVal = lex(s, _voorVc);
+
+ if (_validateOnSet() && newVal != null)
+ validateValue(newVal, _schemaType, _voorVc);
+
+ _value = newVal;
+ }
+
+ protected void set_GDuration(GDurationSpecification v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ if (v.isImmutable() && (v instanceof GDuration))
+ _value = (GDuration)v;
+ else
+ _value = new GDuration(v);
+ }
+
+ protected String compute_text(NamespaceManager nsm)
+ { return _value == null ? "" : _value.toString(); }
+
+ protected void set_nil()
+ {
+ _value = null;
+ }
+
+ public GDuration gDurationValue()
+ {
+ check_dated();
+
+ return _value == null ? null : _value;
+ }
+
+ public static GDuration lex(String v, ValidationContext context)
+ {
+ GDuration duration = null;
+
+ try
+ {
+ duration = new GDuration(v);
+ }
+ catch (Exception e)
+ {
+ context.invalid("Duration value is malformed: "+v);
+ }
+
+ return duration;
+ }
+
+ public static GDuration validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ GDuration duration = lex(v, context);
+
+ if (duration != null && sType.hasPatternFacet())
+ if (!sType.matchPatternFacet(v))
+ context.invalid("Duration (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+
+ return duration;
+ }
+
+ public static void validateValue(GDurationSpecification v, SchemaType sType, ValidationContext context)
+ {
+ XmlObject x;
+ GDuration g;
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE)) != null)
+ if (v.compareToGDuration(g = ((XmlObjectBase)x).gDurationValue()) <= 0)
+ context.invalid("Duration (" + v + ") is less than or equal to min exclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE)) != null)
+ if (v.compareToGDuration(g = ((XmlObjectBase)x).gDurationValue()) < 0)
+ context.invalid("Duration (" + v + ") is less than min inclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE)) != null)
+ if (v.compareToGDuration(g = ((XmlObjectBase)x).gDurationValue()) >= 0)
+ context.invalid("Duration (" + v + ") is greater than or equal to max exclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE)) != null)
+ if (v.compareToGDuration(g = ((XmlObjectBase)x).gDurationValue()) > 0)
+ context.invalid("Duration (" + v + ") is greater than max inclusive facet (" + g + ") for " + QNameHelper.readable(sType) );
+
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (v.compareToGDuration(((XmlObjectBase)vals[i]).gDurationValue()) == 0)
+ return;
+ context.invalid("Duration (" + v + ") is not a valid enumeration value for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected int compare_to(XmlObject d)
+ {
+ return _value.compareToGDuration(((XmlObjectBase) d).gDurationValue());
+ }
+
+ protected boolean equal_to(XmlObject d)
+ {
+ return _value.equals(((XmlObjectBase) d).gDurationValue());
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(gDurationValue(), schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolder.java
new file mode 100644
index 0000000..ef4a79d
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolder.java
@@ -0,0 +1,154 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+import org.apache.xmlbeans.impl.util.HexBin;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlHexBinary;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.MessageDigest;
+import java.util.Arrays;
+import java.io.UnsupportedEncodingException;
+
+public abstract class JavaHexBinaryHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_HEX_BINARY; }
+
+ protected byte[] _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets raw text value
+ protected String compute_text(NamespaceManager nsm)
+ {
+ return new String(HexBin.encode(_value));
+ }
+ protected void set_text(String s)
+ {
+ _hashcached = false;
+ if (_validateOnSet())
+ _value = validateLexical(s, schemaType(), _voorVc);
+ else
+ _value = lex(s, _voorVc);
+ }
+ protected void set_nil()
+ {
+ _hashcached = false;
+ _value = null;
+ }
+
+ public static byte[] lex(String v, ValidationContext context)
+ {
+ byte[] vBytes = null;
+ try
+ {
+ vBytes = v.getBytes("UTF-8");
+ }
+ catch(UnsupportedEncodingException uee)
+ {
+ // should never happen - UTF-8 is always supported
+ }
+ byte[] bytes = HexBin.decode(vBytes);
+
+ if (bytes == null)
+ {
+ // TODO - get a decent error with line numbers and such here
+ context.invalid("Hex encoded data not encoded properly");
+ }
+
+ return bytes;
+ }
+
+ public static byte[] validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ byte[] bytes = lex(v, context);
+
+ if (bytes == null)
+ return null;
+
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid( "Hex encoded data does not match pattern for " + QNameHelper.readable(sType));
+ return null;
+ }
+
+ return bytes;
+ }
+
+ public byte[] byteArrayValue()
+ {
+ check_dated();
+ if (_value == null)
+ return null;
+
+ byte[] result = new byte[_value.length];
+ System.arraycopy(_value, 0, result, 0, _value.length);
+ return result;
+ }
+
+ // setters
+ protected void set_ByteArray(byte[] ba)
+ {
+ _hashcached = false;
+ _value = new byte[ba.length];
+ System.arraycopy(ba, 0, _value, 0, ba.length);
+ }
+
+ // comparators
+ protected boolean equal_to(XmlObject i)
+ {
+ byte[] ival = ((XmlHexBinary) i).getByteArrayValue();
+ return Arrays.equals(_value, ival);
+ }
+
+ //because computing hashcode is expensive we'll cache it
+ protected boolean _hashcached = false;
+ protected int hashcode = 0;
+ protected static MessageDigest md5;
+ static
+ {
+ try
+ {
+ md5 = MessageDigest.getInstance("MD5");
+ }
+ catch( NoSuchAlgorithmException e )
+ {
+ throw new IllegalStateException("Cannot find MD5 hash Algorithm");
+ }
+ }
+
+ protected int value_hash_code()
+ {
+ if( _hashcached )
+ return hashcode;
+
+ _hashcached = true;
+
+ if( _value == null )
+ return hashcode = 0;
+
+ byte[] res = md5.digest(_value);
+ return hashcode = res[0]<<24 + res[1]<<16 + res[2]<<8 + res[3];
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolderEx.java
new file mode 100644
index 0000000..53b307b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaHexBinaryHolderEx.java
@@ -0,0 +1,128 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+
+public abstract class JavaHexBinaryHolderEx extends JavaHexBinaryHolder
+{
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaHexBinaryHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ byte[] v;
+
+ if (_validateOnSet())
+ v = validateLexical(s, schemaType(), _voorVc);
+ else
+ v = lex(s, _voorVc);
+
+ if (_validateOnSet() && v != null)
+ validateValue(v, schemaType(), XmlObjectBase._voorVc);
+
+ super.set_ByteArray(v);
+
+ _value = v;
+ }
+
+ // setters
+ protected void set_ByteArray(byte[] v)
+ {
+ if (_validateOnSet())
+ validateValue(v, schemaType(), _voorVc);
+
+ super.set_ByteArray(v);
+ }
+
+ public static void validateValue(byte[] v, SchemaType sType, ValidationContext context)
+ {
+ int i;
+ XmlObject o;
+
+ if ((o = sType.getFacet(SchemaType.FACET_LENGTH)) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) != v.length)
+ {
+ context.invalid(
+ "Hex encoded data does not have " + i +
+ " bytes per length facet" );
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MIN_LENGTH )) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) > v.length)
+ {
+ context.invalid(
+ "Hex encoded data has only " + v.length +
+ " bytes, fewer than min length facet" );
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MAX_LENGTH )) != null)
+ {
+ if ((i = ((XmlObjectBase)o).bigIntegerValue().intValue()) < v.length)
+ {
+ context.invalid(
+ "Hex encoded data has " + v.length +
+ " bytes, more than max length facet" );
+ }
+ }
+
+ XmlObject[] vals = sType.getEnumerationValues();
+
+ if (vals != null)
+ {
+ enumLoop: for ( i = 0 ; i < vals.length ; i++ )
+ {
+ byte[] enumBytes = ((XmlObjectBase)vals[i]).byteArrayValue();
+
+ if (enumBytes.length != v.length)
+ continue;
+
+ for ( int j = 0 ; j < enumBytes.length ; j++ )
+ if (enumBytes[j] != v[j])
+ continue enumLoop;
+
+ break;
+ }
+
+ if (i >= vals.length)
+ context.invalid("Hex encoded data does not match any of the enumeration values");
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(byteArrayValue(), schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolder.java
new file mode 100644
index 0000000..f9278f2
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolder.java
@@ -0,0 +1,102 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SimpleValue;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.impl.common.ParseUtil;
+
+public abstract class JavaIntHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_INT; }
+
+ private int _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets raw text value
+ public String compute_text(NamespaceManager nsm) { return Long.toString(_value); }
+ protected void set_text(String s)
+ {
+ try { set_int(Integer.parseInt(ParseUtil.trimInitialPlus(s))); }
+ catch (Exception e) { throw new XmlValueOutOfRangeException(); }
+ }
+ protected void set_nil()
+ {
+ _value = 0;
+ }
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return new BigDecimal(_value); }
+ public BigInteger bigIntegerValue() { check_dated(); return BigInteger.valueOf(_value); }
+ public long longValue() { check_dated(); return _value; }
+ public int intValue() { check_dated(); return _value; }
+
+ static final BigInteger _max = BigInteger.valueOf(Integer.MAX_VALUE);
+ static final BigInteger _min = BigInteger.valueOf(Integer.MIN_VALUE);
+
+ // setters
+ protected void set_BigDecimal(BigDecimal v) { set_BigInteger(v.toBigInteger()); }
+ protected void set_BigInteger(BigInteger v)
+ {
+ if (v.compareTo(_max) > 0 || v.compareTo(_min) < 0)
+ throw new XmlValueOutOfRangeException();
+ set_int(v.intValue());
+ }
+ protected void set_long(long l)
+ {
+ if (l > Integer.MAX_VALUE || l < Integer.MIN_VALUE)
+ throw new XmlValueOutOfRangeException();
+ set_int((int)l);
+ }
+ protected void set_int(int i)
+ {
+ _value = i;
+ }
+
+ // comparators
+ protected int compare_to(XmlObject i)
+ {
+ if (((SimpleValue)i).instanceType().getDecimalSize() > SchemaType.SIZE_INT)
+ return -i.compareTo(this);
+
+ return _value == ((XmlObjectBase)i).intValue() ? 0 :
+ _value < ((XmlObjectBase)i).intValue() ? -1 : 1;
+ }
+
+ protected boolean equal_to(XmlObject i)
+ {
+ if (((SimpleValue)i).instanceType().getDecimalSize() > SchemaType.SIZE_INT)
+ return i.valueEquals(this);
+
+ return _value == ((XmlObjectBase)i).intValue();
+ }
+
+ /**
+ * Note, this is carefully aligned with hash codes for all xsd:decimal
+ * primitives.
+ */
+ protected int value_hash_code()
+ {
+ return _value;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolderEx.java
new file mode 100644
index 0000000..5de2e4f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntHolderEx.java
@@ -0,0 +1,185 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.ParseUtil;
+
+public abstract class JavaIntHolderEx extends JavaIntHolder
+{
+ public JavaIntHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ protected void set_text(String s)
+ {
+ int v;
+
+ try { v = Integer.parseInt(ParseUtil.trimInitialPlus(s)); }
+ catch (Exception e) { throw new XmlValueOutOfRangeException(); }
+
+ if (_validateOnSet())
+ {
+ validateValue(v, _schemaType, _voorVc);
+ validateLexical(s, _schemaType, _voorVc);
+ }
+
+ super.set_int(v);
+ }
+
+ protected void set_int(int v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ super.set_int(v);
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ JavaDecimalHolder.validateLexical(v, context);
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid("Integer (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+ }
+
+ private static void validateValue(int v, SchemaType sType, ValidationContext context)
+ {
+ // total digits
+ XmlObject td = sType.getFacet(SchemaType.FACET_TOTAL_DIGITS);
+ if (td != null)
+ {
+ String temp = Integer.toString(v);
+ int len = temp.length();
+ if (len > 0 && temp.charAt(0) == '-')
+ len -= 1;
+ int m = getIntValue(td);
+ if (len > m)
+ {
+ context.invalid(
+ "Integer total digits (" + temp + ") is greater than " +
+ "total digits facet (" + getIntValue(td) + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min ex
+ XmlObject mine = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (mine != null)
+ {
+ int m = getIntValue(mine);
+ if (!(v > m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min in
+ XmlObject mini = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (mini != null)
+ {
+ int m = getIntValue(mini);
+ if (!(v >= m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than " +
+ "min inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max in
+ XmlObject maxi = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (maxi != null)
+ {
+ int m = getIntValue(maxi);
+ if (!(v <= m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is greater than " +
+ "max inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max ex
+ XmlObject maxe = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (maxe != null)
+ {
+ int m = getIntValue(maxe);
+ if (!(v < m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // enumeration
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ {
+ if (v == getIntValue(vals[i]))
+ return;
+ }
+ context.invalid("Integer (" + v + ") does not match any enumeration values for " + QNameHelper.readable(sType));
+ }
+ }
+
+ private static int getIntValue(XmlObject o) {
+ SchemaType s = o.schemaType();
+ switch (s.getDecimalSize())
+ {
+ case SchemaType.SIZE_BIG_DECIMAL:
+ return ((XmlObjectBase)o).bigDecimalValue().intValue();
+ case SchemaType.SIZE_BIG_INTEGER:
+ return ((XmlObjectBase)o).bigIntegerValue().intValue();
+ case SchemaType.SIZE_LONG:
+ return (int)((XmlObjectBase)o).longValue();
+ default:
+ return ((XmlObjectBase)o).intValue();
+ }
+
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(intValue(), schemaType(), ctx);
+ }
+
+}
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolder.java
new file mode 100644
index 0000000..3efbe58
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolder.java
@@ -0,0 +1,97 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+public abstract class JavaIntegerHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_INTEGER; }
+
+ private BigInteger _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets/sets raw text value
+ protected String compute_text(NamespaceManager nsm) { return _value.toString(); }
+ protected void set_text(String s)
+ {
+ set_BigInteger(lex(s, _voorVc));
+ }
+ public static BigInteger lex(String s, ValidationContext vc)
+ {
+ if (s.length() > 0 && s.charAt( 0 ) == '+' )
+ s = s.substring(1);
+
+ try { return new BigInteger(s); }
+ catch (Exception e) { vc.invalid("Not a valid integer: " + s); return null; }
+ }
+ protected void set_nil()
+ {
+ _value = null;
+ }
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return _value == null ? null : new BigDecimal(_value); }
+ public BigInteger bigIntegerValue() { check_dated(); return _value; }
+
+ // setters
+ protected void set_BigDecimal(BigDecimal v) { _value = v.toBigInteger(); }
+ protected void set_BigInteger(BigInteger v) { _value = v; }
+
+ // comparators
+ protected int compare_to(XmlObject i)
+ {
+ if (((SimpleValue)i).instanceType().getDecimalSize() > SchemaType.SIZE_BIG_INTEGER)
+ return -i.compareTo(this);
+
+ return _value.compareTo(((XmlObjectBase)i).bigIntegerValue());
+ }
+
+ protected boolean equal_to(XmlObject i)
+ {
+ if (((SimpleValue)i).instanceType().getDecimalSize() > SchemaType.SIZE_BIG_INTEGER)
+ return i.valueEquals(this);
+
+ return _value.equals(((XmlObjectBase)i).bigIntegerValue());
+ }
+
+ static private BigInteger _maxlong = BigInteger.valueOf(Long.MAX_VALUE);
+ static private BigInteger _minlong = BigInteger.valueOf(Long.MIN_VALUE);
+
+ /**
+ * Note, this is carefully aligned with hash codes for all xsd:decimal
+ * primitives.
+ */
+ protected int value_hash_code()
+ {
+ if (_value.compareTo(_maxlong) > 0 ||
+ _value.compareTo(_minlong) < 0)
+ return _value.hashCode();
+
+ long longval = _value.longValue();
+
+ return (int)((longval >> 32) * 19 + longval);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolderEx.java
new file mode 100644
index 0000000..b0c2545
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaIntegerHolderEx.java
@@ -0,0 +1,180 @@
+/* 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.xmlbeans.impl.values;
+
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlPositiveInteger;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+public class JavaIntegerHolderEx extends JavaIntegerHolder
+{
+ public JavaIntegerHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ protected void set_text(String s)
+ {
+ BigInteger v = lex(s, _voorVc);
+
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ if (_validateOnSet())
+ validateLexical(s, _schemaType, _voorVc);
+
+ super.set_BigInteger(v);
+ }
+
+ protected void set_BigInteger(BigInteger v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ super.set_BigInteger(v);
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ JavaDecimalHolder.validateLexical(v, context);
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid("Integer (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+ }
+
+ private static void validateValue(BigInteger v, SchemaType sType, ValidationContext context)
+ {
+ // total digits
+ XmlPositiveInteger td = (XmlPositiveInteger)sType.getFacet(SchemaType.FACET_TOTAL_DIGITS);
+ if (td != null)
+ {
+ String temp = v.toString();
+ int len = temp.length();
+ if (len > 0 && temp.charAt(0) == '-')
+ len -= 1;
+ if (len > td.getBigIntegerValue().intValue())
+ {
+ context.invalid(
+ "Integer total digits (" + temp + ") is greater than " +
+ "total digits facet (" + td.getBigIntegerValue().intValue() + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min ex
+ XmlObject mine = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (mine != null)
+ {
+ BigInteger m = getBigIntegerValue(mine);
+ if (!(v.compareTo(m) > 0))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min in
+ XmlObject mini = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (mini != null)
+ {
+ BigInteger m = getBigIntegerValue(mini);
+ if (!(v.compareTo(m) >= 0))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than " +
+ "min inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max in
+ XmlObject maxi = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (maxi != null)
+ {
+ BigInteger m = getBigIntegerValue(maxi);
+ if (!(v.compareTo(m) <= 0))
+ {
+ context.invalid(
+ "Integer (" + v + ") is greater than " +
+ "max inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max ex
+ XmlObject maxe = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (maxe != null)
+ {
+ BigInteger m = getBigIntegerValue(maxe);
+ if (!(v.compareTo(m) < 0))
+ {
+ context.invalid(
+ "Integer (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // enumeration
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ {
+ if (v.equals(getBigIntegerValue(vals[i])))
+ return;
+ }
+ context.invalid("Integer (" + v + ") does not match any enumeration values for " + QNameHelper.readable(sType));
+ }
+ }
+
+ private static BigInteger getBigIntegerValue(XmlObject o)
+ {
+ SchemaType s = o.schemaType();
+ switch (s.getDecimalSize())
+ {
+ case SchemaType.SIZE_BIG_DECIMAL:
+ return ((XmlObjectBase)o).bigDecimalValue().toBigInteger();
+ case SchemaType.SIZE_BIG_INTEGER:
+ return ((XmlObjectBase)o).bigIntegerValue();
+ default:
+ throw new IllegalStateException("Bad facet type for Big Int: " + s);
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(bigIntegerValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolder.java
new file mode 100644
index 0000000..3dbfb0b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolder.java
@@ -0,0 +1,94 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SimpleValue;
+
+import java.math.BigInteger;
+import java.math.BigDecimal;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.impl.common.ParseUtil;
+
+public abstract class JavaLongHolder extends XmlObjectBase
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_LONG; }
+
+ private long _value;
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // gets raw text value
+ protected String compute_text(NamespaceManager nsm) { return Long.toString(_value); }
+ protected void set_text(String s)
+ {
+ try { set_long(Long.parseLong(ParseUtil.trimInitialPlus(s))); }
+ catch (Exception e) { throw new XmlValueOutOfRangeException(); }
+ }
+ protected void set_nil()
+ {
+ _value = 0L;
+ }
+
+ // numerics: fractional
+ public BigDecimal bigDecimalValue() { check_dated(); return BigDecimal.valueOf(_value); }
+ public BigInteger bigIntegerValue() { check_dated(); return BigInteger.valueOf(_value); }
+ public long longValue() { check_dated(); return _value; }
+
+ private static final BigInteger _max = BigInteger.valueOf(Long.MAX_VALUE);
+ private static final BigInteger _min = BigInteger.valueOf(Long.MIN_VALUE);
+
+ // setters
+ protected void set_BigDecimal(BigDecimal v) { set_BigInteger(v.toBigInteger()); }
+ protected void set_BigInteger(BigInteger v)
+ {
+ if (v.compareTo(_max) > 0 || v.compareTo(_min) < 0)
+ throw new XmlValueOutOfRangeException();
+ _value = v.longValue();
+ }
+ protected void set_long(long l) { _value = l; }
+
+ // comparators
+ protected int compare_to(XmlObject l)
+ {
+ if (((SimpleValue)l).instanceType().getDecimalSize() > SchemaType.SIZE_LONG)
+ return -l.compareTo(this);
+
+ return _value == ((XmlObjectBase)l).longValue() ? 0 :
+ _value < ((XmlObjectBase)l).longValue() ? -1 : 1;
+ }
+
+ protected boolean equal_to(XmlObject l)
+ {
+ if (((SimpleValue)l).instanceType().getDecimalSize() > SchemaType.SIZE_LONG)
+ return l.valueEquals(this);
+
+ return _value == ((XmlObjectBase)l).longValue();
+ }
+
+ /**
+ * Note, this is carefully aligned with hash codes for all xsd:decimal
+ * primitives.
+ */
+ protected int value_hash_code()
+ {
+ return (int)((_value >> 32) * 19 + _value);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolderEx.java
new file mode 100644
index 0000000..a3406d9
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaLongHolderEx.java
@@ -0,0 +1,183 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.ParseUtil;
+
+public abstract class JavaLongHolderEx extends JavaLongHolder
+{
+ public JavaLongHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ protected void set_text(String s)
+ {
+ long v;
+
+ try { v = Long.parseLong(ParseUtil.trimInitialPlus(s)); }
+ catch (Exception e) { throw new XmlValueOutOfRangeException(); }
+
+ if (_validateOnSet())
+ {
+ validateValue(v, _schemaType, _voorVc);
+ validateLexical(s, _schemaType, _voorVc);
+ }
+
+ super.set_long(v);
+ }
+
+ protected void set_long(long v)
+ {
+ if (_validateOnSet())
+ validateValue(v, _schemaType, _voorVc);
+
+ super.set_long(v);
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ JavaDecimalHolder.validateLexical(v, context);
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid("Integer (" + v + ") does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+ }
+
+ private static void validateValue(long v, SchemaType sType, ValidationContext context)
+ {
+ // total digits
+ XmlObject td = sType.getFacet(SchemaType.FACET_TOTAL_DIGITS);
+ if (td != null)
+ {
+ long m = getLongValue(td);
+ String temp = Long.toString(v);
+ int len = temp.length();
+ if (len > 0 && temp.charAt(0) == '-')
+ len -= 1;
+ if (len > m)
+ {
+ context.invalid(
+ "Integer total digits (" + temp + ") is greater than " +
+ "total digits facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min ex
+ XmlObject mine = sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
+ if (mine != null)
+ {
+ long m = getLongValue(mine);
+ if (!(v > m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // min in
+ XmlObject mini = sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
+ if (mini != null)
+ {
+ long m = getLongValue(mini);
+ if (!(v >= m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than or equal to " +
+ "min exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max in
+ XmlObject maxi = sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
+ if (maxi != null)
+ {
+ long m = getLongValue(maxi);
+ if (!(v <= m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is less than " +
+ "min inclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // max ex
+ XmlObject maxe = sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
+ if (maxe != null)
+ {
+ long m = getLongValue(maxe);
+ if (!(v < m))
+ {
+ context.invalid(
+ "Integer (" + v + ") is greater than or equal to " +
+ "max exclusive facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // enumeration
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ {
+ if (v == getLongValue(vals[i]))
+ return;
+ }
+ context.invalid("Integer (" + v + ") does not match any enumeration values for " + QNameHelper.readable(sType));
+ }
+ }
+
+ private static long getLongValue(XmlObject o) {
+ SchemaType s = o.schemaType();
+ switch (s.getDecimalSize())
+ {
+ case SchemaType.SIZE_BIG_DECIMAL:
+ return ((XmlObjectBase)o).bigDecimalValue().longValue();
+ case SchemaType.SIZE_BIG_INTEGER:
+ return ((XmlObjectBase)o).bigIntegerValue().longValue();
+ case SchemaType.SIZE_LONG:
+ return ((XmlObjectBase)o).longValue();
+ default:
+ throw new IllegalStateException("Bad facet type: " + s);
+ }
+
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(lexical, schemaType(), ctx);
+ validateValue(longValue(), schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolder.java
new file mode 100644
index 0000000..ff329c1
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolder.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+public abstract class JavaNotationHolder extends XmlQNameImpl
+{
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_NOTATION; }
+
+// protected int get_wscanon_rule()
+// { return SchemaType.WS_PRESERVE; }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolderEx.java
new file mode 100644
index 0000000..3448463
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaNotationHolderEx.java
@@ -0,0 +1,86 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+
+public abstract class JavaNotationHolderEx extends JavaNotationHolder
+{
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaNotationHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ {
+ if (!check(s, _schemaType))
+ throw new XmlValueOutOfRangeException();
+
+ if (!_schemaType.matchPatternFacet(s))
+ throw new XmlValueOutOfRangeException();
+ }
+
+ super.set_text(s);
+ }
+
+ protected void set_notation(String v)
+ { set_text(v); }
+
+ private static boolean check(String v, SchemaType sType)
+ {
+ // check against length
+ XmlObject len = sType.getFacet(SchemaType.FACET_LENGTH);
+ if (len != null)
+ {
+ int m = ((XmlObjectBase)len).bigIntegerValue().intValue();
+ if (!(v.length() != m))
+ return false;
+ }
+
+ // check against min length
+ XmlObject min = sType.getFacet(SchemaType.FACET_MIN_LENGTH);
+ if (min != null)
+ {
+ int m = ((XmlObjectBase)min).bigIntegerValue().intValue();
+ if (!(v.length() >= m))
+ return false;
+ }
+
+ // check against min length
+ XmlObject max = sType.getFacet(SchemaType.FACET_MAX_LENGTH);
+ if (max != null)
+ {
+ int m = ((XmlObjectBase)max).bigIntegerValue().intValue();
+ if (!(v.length() <= m))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolder.java
new file mode 100644
index 0000000..4b4ee65
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolder.java
@@ -0,0 +1,186 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.XMLChar;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.values.NamespaceContext;
+
+public class JavaQNameHolder extends XmlObjectBase
+{
+ public JavaQNameHolder() {}
+
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_QNAME; }
+
+ private QName _value;
+
+ protected int get_wscanon_rule()
+ { return SchemaType.WS_PRESERVE; }
+
+ // an ergonomic prefixer so that you can say stringValue() on a free-floating QName.
+ private static final NamespaceManager PRETTY_PREFIXER = new PrettyNamespaceManager();
+
+ private static class PrettyNamespaceManager implements NamespaceManager
+ {
+ public String find_prefix_for_nsuri(String nsuri, String suggested_prefix)
+ {
+ return QNameHelper.suggestPrefix(nsuri);
+ }
+ public String getNamespaceForPrefix(String prefix)
+ {
+ throw new RuntimeException( "Should not be called" );
+ }
+ }
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+ public String compute_text(NamespaceManager nsm)
+ {
+ if (nsm == null)
+ {
+ // we used to: throw new IllegalStateException("Cannot create QName prefix outside of a document");
+ // but it's not nice to throw on stringValue()
+ nsm = PRETTY_PREFIXER;
+ }
+
+// TODO - what I really need to do here is that if there is no
+// namespace for this qname, then instead of finding the prefix for the
+// uri, I should make a call to set the default namespace for the
+// immediate context for this qname to be "".
+
+ String namespace = _value.getNamespaceURI();
+ String localPart = _value.getLocalPart();
+
+ if (namespace == null || namespace.length() == 0)
+ return localPart;
+
+ String prefix = nsm.find_prefix_for_nsuri( namespace, null );
+
+ assert prefix != null;
+
+ return prefix + ":" + localPart;
+ }
+
+ public static QName validateLexical(
+ String v, ValidationContext context, PrefixResolver resolver)
+ {
+ QName name;
+
+ try
+ {
+ name = parse(v, resolver);
+ }
+ catch ( XmlValueOutOfRangeException e )
+ {
+ context.invalid(e.getMessage());
+ name = null;
+ }
+
+ return name;
+ }
+
+ private static QName parse(String v, PrefixResolver resolver)
+ {
+ String prefix, localname;
+ int start;
+ int end;
+ for (end = v.length(); end > 0; end -= 1)
+ if (!XMLChar.isSpace(v.charAt(end-1)))
+ break;
+ for (start = 0; start < end; start += 1)
+ if (!XMLChar.isSpace(v.charAt(start)))
+ break;
+
+ int firstcolon = v.indexOf(':', start);
+ if (firstcolon >= 0)
+ {
+ prefix = v.substring(start, firstcolon);
+ localname = v.substring(firstcolon + 1, end);
+ }
+ else
+ {
+ prefix = "";
+ localname = v.substring(start, end);
+ }
+
+ String uri =
+ resolver == null ? null : resolver.getNamespaceForPrefix(prefix);
+
+ if (uri == null)
+ {
+ if (prefix.length() > 0)
+ throw new XmlValueOutOfRangeException("Can't resolve prefix: " + prefix);
+
+ uri = "";
+ }
+
+ return new QName( uri, localname );
+ }
+
+ protected void set_text(String s)
+ {
+ PrefixResolver resolver = NamespaceContext.getCurrent();
+
+ if (resolver == null && has_store())
+ resolver = get_store();
+
+ _value = parse(s, resolver);
+ }
+
+ // BUGBUG - having prefix here may not work
+ protected void set_QName(QName name)
+ {
+ assert name != null;
+
+ // Sync force of creation of namesapce mapping ..
+
+ if (has_store())
+ get_store().find_prefix_for_nsuri( name.getNamespaceURI(), null );
+
+ _value = name;
+ }
+
+ protected void set_xmlanysimple(XmlAnySimpleType value)
+ {
+ _value = parse(value.getStringValue(), NamespaceContext.getCurrent());
+ }
+
+ protected void set_nil() { _value = null; }
+
+ // setters, getters (setter already handled via set_text)
+
+ public QName qNameValue()
+ { check_dated(); return _value; }
+
+ // comparators
+ protected boolean equal_to(XmlObject obj)
+ {
+ return _value.equals(((XmlObjectBase)obj).qNameValue());
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolderEx.java
new file mode 100644
index 0000000..885b9cb
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaQNameHolderEx.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import javax.xml.namespace.QName;
+
+public abstract class JavaQNameHolderEx extends JavaQNameHolder
+{
+ private SchemaType _schemaType;
+
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaQNameHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ PrefixResolver resolver = NamespaceContext.getCurrent();
+
+ if (resolver == null && has_store())
+ resolver = get_store();
+
+ QName v;
+ if (_validateOnSet())
+ {
+ v = validateLexical(s, _schemaType, _voorVc, resolver);
+ if (v != null)
+ validateValue(v, _schemaType, _voorVc);
+ }
+ else
+ v = JavaQNameHolder.validateLexical(s, _voorVc, resolver);
+
+ super.set_QName(v);
+ }
+
+ protected void set_QName(QName name)
+ {
+ if (_validateOnSet())
+ validateValue(name, _schemaType, _voorVc);
+ super.set_QName( name );
+ }
+
+ protected void set_xmlanysimple(XmlAnySimpleType value)
+ {
+ QName v;
+ if (_validateOnSet())
+ {
+ v = validateLexical(value.getStringValue(), _schemaType, _voorVc, NamespaceContext.getCurrent());
+
+ if (v != null)
+ validateValue(v, _schemaType, _voorVc);
+ }
+ else
+ v = JavaQNameHolder.validateLexical(value.getStringValue(), _voorVc, NamespaceContext.getCurrent());
+
+ super.set_QName(v);
+ }
+
+ public static QName validateLexical(String v, SchemaType sType, ValidationContext context, PrefixResolver resolver)
+ {
+ QName name = JavaQNameHolder.validateLexical(v, context, resolver);
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ // TODO - describe string and pattern here in error
+ context.invalid("QName '" + v + "' does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+
+ XmlObject x;
+
+ if ((x = sType.getFacet(SchemaType.FACET_LENGTH)) != null)
+ if ((((XmlObjectBase)x).bigIntegerValue().intValue()) != v.length())
+ context.invalid("QName '" + v + "' does not match length facet for " + QNameHelper.readable(sType));
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_LENGTH)) != null)
+ if ((((XmlObjectBase)x).bigIntegerValue().intValue()) > v.length())
+ context.invalid("QName '" + v + "' does not match min length facet for " + QNameHelper.readable(sType));
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_LENGTH)) != null)
+ if ((((XmlObjectBase)x).bigIntegerValue().intValue()) < v.length())
+ context.invalid("QName '" + v + "' does not match max length facet for " + QNameHelper.readable(sType));
+
+ return name;
+ }
+
+ public static void validateValue(QName v, SchemaType sType, ValidationContext context)
+ {
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ if (v.equals(((XmlObjectBase)vals[i]).qNameValue()))
+ return;
+ context.invalid("QName '" + v + "' is not a valid enuemrated value for " + QNameHelper.readable(sType));
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateValue(qNameValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
new file mode 100644
index 0000000..d8d89d8
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
@@ -0,0 +1,82 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.StringEnumAbstractBase;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+
+public abstract class JavaStringEnumerationHolderEx extends JavaStringHolderEx
+{
+ public JavaStringEnumerationHolderEx(SchemaType type, boolean complex)
+ {
+ super(type, complex);
+ }
+
+ private StringEnumAbstractBase _val;
+
+ // update the intval when setting via text, nil.
+ protected void set_text(String s)
+ {
+ StringEnumAbstractBase enumValue = schemaType().enumForString(s);
+ if (enumValue == null)
+ throw new XmlValueOutOfRangeException("String '" + s + "' is not a valid enumerated value for " + schemaType());
+
+ super.set_text(s);
+ _val = enumValue;
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ JavaStringHolderEx.validateLexical(v, sType, context);
+
+ if (sType.hasStringEnumValues())
+ {
+ if (sType.enumForString(v) == null)
+ {
+ if (context != null)
+ {
+ context.invalid("String '" + v + "' is not a valid enumerated value for " + QNameHelper.readable(sType));
+ }
+ }
+ }
+ }
+
+ protected void set_nil()
+ {
+ _val = null;
+ super.set_nil();
+ }
+
+ // set/get the enumValue
+ public StringEnumAbstractBase enumValue()
+ {
+ check_dated();
+ return _val;
+ }
+
+ protected void set_enum(StringEnumAbstractBase enumValue)
+ {
+ Class ejc = schemaType().getEnumJavaClass();
+ if (ejc != null && !enumValue.getClass().equals(ejc))
+ throw new XmlValueOutOfRangeException();
+
+ super.set_text(enumValue.toString());
+ _val = enumValue;
+ }
+}
\ No newline at end of file
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolder.java
new file mode 100644
index 0000000..0247270
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolder.java
@@ -0,0 +1,56 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+public class JavaStringHolder extends XmlObjectBase
+{
+ public JavaStringHolder() {}
+
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_STRING; }
+
+ private String _value;
+
+ protected int get_wscanon_rule()
+ { return SchemaType.WS_PRESERVE; }
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+ public String compute_text(NamespaceManager nsm) { return _value; }
+ protected void set_text(String s) { _value = s; }
+ protected void set_nil() { _value = null; }
+
+ // string setter and getter already handled by XmlObjectBase
+
+ // comparators
+ protected boolean equal_to(XmlObject obj)
+ {
+ return _value.equals(((XmlObjectBase)obj).stringValue());
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+ protected boolean is_defaultable_ws(String v)
+ {
+ return false;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
new file mode 100644
index 0000000..eb173eb
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
@@ -0,0 +1,113 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+public abstract class JavaStringHolderEx extends JavaStringHolder
+{
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaStringHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ validateLexical(s, _schemaType, _voorVc);
+
+ super.set_text(s);
+ }
+
+ protected boolean is_defaultable_ws(String v) {
+ try {
+ validateLexical(v, _schemaType, _voorVc);
+ return false;
+ }
+ catch (XmlValueOutOfRangeException e) {
+ return true;
+ }
+ }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ // check against pattern
+ if (!sType.matchPatternFacet(v))
+ {
+ context.invalid( "String: '" + v + "' does not match pattern for " + QNameHelper.readable(sType));
+ return;
+ }
+
+ // check against length
+ XmlObject len = sType.getFacet(SchemaType.FACET_LENGTH);
+ if (len != null)
+ {
+ int m = ((XmlObjectBase)len).bigIntegerValue().intValue();
+ if (v.length() != m)
+ {
+ context.invalid(
+ "String length (" + v.length() + ") does not match " +
+ "length facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // check against min length
+ XmlObject min = sType.getFacet(SchemaType.FACET_MIN_LENGTH);
+ if (min != null)
+ {
+ int m = ((XmlObjectBase)min).bigIntegerValue().intValue();
+ if (v.length() < m)
+ {
+ context.invalid(
+ "String length (" + v.length() + ") is less than " +
+ "min length facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+
+ // check against min length
+ XmlObject max = sType.getFacet(SchemaType.FACET_MAX_LENGTH);
+ if (max != null)
+ {
+ int m = ((XmlObjectBase)max).bigIntegerValue().intValue();
+ if (v.length() > m)
+ {
+ context.invalid(
+ "String length (" + v.length() + ") is greater than " +
+ "max length facet (" + m + ") for " + QNameHelper.readable(sType));
+ return;
+ }
+ }
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(stringValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolder.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolder.java
new file mode 100644
index 0000000..e49dbc7
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolder.java
@@ -0,0 +1,65 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnyURI;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+public abstract class JavaUriHolder extends XmlObjectBase
+{
+ public JavaUriHolder() {}
+
+ public SchemaType schemaType()
+ { return BuiltinSchemaTypeSystem.ST_ANY_URI; }
+
+ private String _value;
+
+ public String compute_text(NamespaceManager nsm) { return _value == null ? "" : _value; }
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ validateLexical(s, _voorVc);
+ _value = s;
+ }
+
+ public static void validateLexical(String v, ValidationContext context)
+ {
+ // Enough validation to get schema for schema working
+
+ if (v.startsWith( "##" ))
+ context.invalid("XmlAnyURI is malformed: " + v );
+
+ }
+
+ protected void set_nil() { _value = null; }
+
+ // string setter and getter already handled by XmlObjectBase
+
+ // comparators
+ protected boolean equal_to(XmlObject obj)
+ {
+ return _value.equals(((XmlAnyURI)obj).getStringValue());
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolderEx.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolderEx.java
new file mode 100644
index 0000000..317138f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/JavaUriHolderEx.java
@@ -0,0 +1,146 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+public class JavaUriHolderEx extends JavaUriHolder
+{
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public JavaUriHolderEx(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ protected int get_wscanon_rule()
+ {
+ return schemaType().getWhiteSpaceRule();
+ }
+
+ protected void set_text(String s)
+ {
+ if (_validateOnSet())
+ {
+ if (!check(s, _schemaType))
+ throw new XmlValueOutOfRangeException();
+
+ if (!_schemaType.matchPatternFacet(s))
+ throw new XmlValueOutOfRangeException();
+ }
+
+ super.set_text(s);
+ }
+
+// // setters
+// protected void set_uri(URI uri)
+// {
+// if (!check(uri.toString(), _schemaType))
+// throw new XmlValueOutOfRangeException();
+//
+// super.set_uri(uri);
+// }
+
+ public static void validateLexical(String v, SchemaType sType, ValidationContext context)
+ {
+ XmlAnyUriImpl.validateLexical(v, context);
+
+ XmlObject[] vals = sType.getEnumerationValues();
+
+ if (vals != null)
+ {
+ int i;
+
+ for ( i = 0 ; i < vals.length ; i++ )
+ {
+ String e = ((SimpleValue)vals[i]).getStringValue();
+
+ if (e.equals( v ))
+ break;
+ }
+
+ if (i >= vals.length)
+ context.invalid("anyURI '" + v + "' is not a valid enumerated value for " + QNameHelper.readable(sType));
+ }
+
+ // check pattern
+ if (sType.hasPatternFacet())
+ {
+ if (!sType.matchPatternFacet(v))
+ {
+ // TODO - describe string and pattern here in error
+ context.invalid("anyURI value '" + v + "' does not match pattern for " + QNameHelper.readable(sType));
+ }
+ }
+
+ XmlObject x;
+
+ if ((x = sType.getFacet(SchemaType.FACET_LENGTH)) != null)
+ if ((((SimpleValue)x).getBigIntegerValue().intValue()) != v.length())
+ context.invalid("anyURI value '" + v + "' does not match length facet (" + ((SimpleValue)x).getBigIntegerValue() + ") for " + QNameHelper.readable(sType));
+
+ if ((x = sType.getFacet(SchemaType.FACET_MIN_LENGTH)) != null)
+ if ((((SimpleValue)x).getBigIntegerValue().intValue()) > v.length())
+ context.invalid("anyURI value '" + v + "' does not match min length facet (" + ((SimpleValue)x).getBigIntegerValue() + ") for " + QNameHelper.readable(sType));
+
+ if ((x = sType.getFacet(SchemaType.FACET_MAX_LENGTH)) != null)
+ if ((((SimpleValue)x).getBigIntegerValue().intValue()) < v.length())
+ context.invalid("anyURI value '" + v + "' does not match max length facet (" + ((SimpleValue)x).getBigIntegerValue() + ") for " + QNameHelper.readable(sType));
+ }
+
+ private static boolean check(String v, SchemaType sType)
+ {
+ int length = v==null ? 0 : v.length();
+ // check against length
+ XmlObject len = sType.getFacet(SchemaType.FACET_LENGTH);
+ if (len != null)
+ {
+ int m = ((SimpleValue)len).getBigIntegerValue().intValue();
+ if (!(length != m))
+ return false;
+ }
+
+ // check against min length
+ XmlObject min = sType.getFacet(SchemaType.FACET_MIN_LENGTH);
+ if (min != null)
+ {
+ int m = ((SimpleValue)min).getBigIntegerValue().intValue();
+ if (!(length >= m))
+ return false;
+ }
+
+ // check against min length
+ XmlObject max = sType.getFacet(SchemaType.FACET_MAX_LENGTH);
+ if (max != null)
+ {
+ int m = ((SimpleValue)max).getBigIntegerValue().intValue();
+ if (!(length <= m))
+ return false;
+ }
+
+ return true;
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateLexical(stringValue(), schemaType(), ctx);
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/NamespaceContext.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/NamespaceContext.java
new file mode 100644
index 0000000..75b5608
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/NamespaceContext.java
@@ -0,0 +1,155 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.lang.reflect.Proxy;
+
+import org.apache.xmlbeans.xml.stream.StartElement;
+
+public class NamespaceContext implements PrefixResolver
+{
+ private static final int TYPE_STORE = 1;
+ private static final int XML_OBJECT = 2;
+ private static final int MAP = 3;
+ private static final int START_ELEMENT = 4;
+ private static final int RESOLVER = 5;
+
+ private Object _obj;
+ private int _code;
+
+ public NamespaceContext(Map prefixToUriMap)
+ {
+ _code = MAP;
+ _obj = prefixToUriMap;
+ }
+
+ public NamespaceContext(TypeStore typeStore)
+ {
+ _code = TYPE_STORE;
+ _obj = typeStore;
+ }
+
+ public NamespaceContext(XmlObject xmlObject)
+ {
+ _code = XML_OBJECT;
+ _obj = xmlObject;
+ }
+
+ public NamespaceContext(StartElement start)
+ {
+ _code = START_ELEMENT;
+ _obj = start;
+ }
+
+ public NamespaceContext(PrefixResolver resolver)
+ {
+ _code = RESOLVER;
+ _obj = resolver;
+ }
+
+ /**
+ * Stack management if (heaven help us) we ever need to do
+ * nested compilation of schema type system.
+ */
+ private static final class NamespaceContextStack
+ {
+ NamespaceContext current;
+ ArrayList stack = new ArrayList();
+ final void push(NamespaceContext next)
+ {
+ stack.add(current);
+ current = next;
+ }
+ final void pop()
+ {
+ current = (NamespaceContext)stack.get(stack.size() - 1);
+ stack.remove(stack.size() - 1);
+ }
+ }
+
+ private static ThreadLocal NamespaceContextStack = new ThreadLocal()
+ {
+ protected Object initialValue() { return new NamespaceContextStack(); }
+ };
+
+ public static void push(NamespaceContext next)
+ {
+ ((NamespaceContextStack)NamespaceContextStack.get()).push(next);
+ }
+
+ public String getNamespaceForPrefix(String prefix)
+ {
+ if (prefix != null && prefix.equals("xml"))
+ return "http://www.w3.org/XML/1998/namespace";
+
+ switch (_code)
+ {
+ case XML_OBJECT:
+ {
+ TypeStoreUser impl;
+ Object obj = _obj;
+ if (Proxy.isProxyClass(obj.getClass()))
+ obj = Proxy.getInvocationHandler(obj);
+
+ if (obj instanceof TypeStoreUser)
+ return ((TypeStoreUser)obj).get_store().getNamespaceForPrefix(prefix);
+
+ XmlCursor cur = ((XmlObject)_obj).newCursor();
+ if (cur != null)
+ {
+ if (cur.currentTokenType() == XmlCursor.TokenType.ATTR)
+ cur.toParent();
+ try { return cur.namespaceForPrefix(prefix); }
+ finally { cur.dispose(); }
+ }
+ }
+
+ case MAP:
+ return (String)((Map)_obj).get(prefix);
+
+ case TYPE_STORE:
+ return ((TypeStore)_obj).getNamespaceForPrefix(prefix);
+
+ case START_ELEMENT:
+ return ((StartElement)_obj).getNamespaceUri(prefix);
+
+ case RESOLVER:
+ return ((PrefixResolver)_obj).getNamespaceForPrefix(prefix);
+
+ default:
+ assert false : "Improperly initialized NamespaceContext.";
+ return null;
+ }
+ }
+
+ public static PrefixResolver getCurrent()
+ {
+ return ((NamespaceContextStack)NamespaceContextStack.get()).current;
+ }
+
+ public static void pop()
+ {
+ ((NamespaceContextStack)NamespaceContextStack.get()).pop();
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/StringEnumValue.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/StringEnumValue.java
new file mode 100644
index 0000000..b777fc4
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/StringEnumValue.java
@@ -0,0 +1,24 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.StringEnumAbstractBase;
+
+public class StringEnumValue extends StringEnumAbstractBase
+{
+ public StringEnumValue(String s, int i)
+ { super(s, i); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeImpl.java
new file mode 100644
index 0000000..3ffe7e7
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeImpl.java
@@ -0,0 +1,73 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
+
+/**
+ * This class implements the anySimpleType for XML.
+ *
+ */
+public class XmlAnySimpleTypeImpl extends XmlObjectBase implements XmlAnySimpleType
+{
+ public XmlAnySimpleTypeImpl(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ public XmlAnySimpleTypeImpl()
+ { _schemaType = BuiltinSchemaTypeSystem.ST_ANY_SIMPLE; }
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ private SchemaType _schemaType;
+
+ String _textvalue = "";
+
+ protected int get_wscanon_rule()
+ {
+ return SchemaType.WS_PRESERVE;
+ }
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+ // gets raw text value
+ protected String compute_text(NamespaceManager nsm) { return _textvalue; }
+ protected void set_text(String s)
+ {
+ _textvalue = s;
+ }
+
+ protected void set_nil()
+ {
+ _textvalue = null;
+ }
+
+ // comparators
+ protected boolean equal_to(XmlObject obj)
+ {
+ // compares against another anySimpleType
+ // rule is: lexical values must match.
+ return _textvalue.equals(((XmlAnySimpleType)obj).getStringValue());
+ }
+
+ protected int value_hash_code()
+ {
+ // matches JavaStringHolder's value_hash_code, so we can be hased against strings
+ return (_textvalue == null ? 0 : _textvalue.hashCode());
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeRestriction.java
new file mode 100644
index 0000000..4629cb6
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnySimpleTypeRestriction.java
@@ -0,0 +1,29 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlAnySimpleTypeRestriction extends XmlAnySimpleTypeImpl
+{
+ public XmlAnySimpleTypeRestriction(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ private SchemaType _schemaType;
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyTypeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyTypeImpl.java
new file mode 100644
index 0000000..eaea9ba
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyTypeImpl.java
@@ -0,0 +1,32 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+
+/**
+ * This class implements the anyType for XML.
+ *
+ */
+public class XmlAnyTypeImpl extends XmlComplexContentImpl implements XmlObject
+{
+ public XmlAnyTypeImpl()
+ { super(type); }
+
+ public XmlAnyTypeImpl(SchemaType type)
+ { super(type); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriImpl.java
new file mode 100644
index 0000000..61acd97
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriImpl.java
@@ -0,0 +1,20 @@
+/* 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.xmlbeans.impl.values;
+
+public class XmlAnyUriImpl extends JavaUriHolder implements org.apache.xmlbeans.XmlAnyURI
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriRestriction.java
new file mode 100644
index 0000000..2df9f0b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlAnyUriRestriction.java
@@ -0,0 +1,24 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlAnyUriRestriction extends JavaUriHolderEx implements org.apache.xmlbeans.XmlAnyURI
+{
+ public XmlAnyUriRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryImpl.java
new file mode 100644
index 0000000..3d4e344
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryImpl.java
@@ -0,0 +1,24 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlBase64Binary;
+
+
+public class XmlBase64BinaryImpl extends JavaBase64Holder implements XmlBase64Binary
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryRestriction.java
new file mode 100644
index 0000000..cec661e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBase64BinaryRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlBase64Binary;
+
+public class XmlBase64BinaryRestriction extends JavaBase64HolderEx implements XmlBase64Binary
+{
+ public XmlBase64BinaryRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanImpl.java
new file mode 100644
index 0000000..1002ec0
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanImpl.java
@@ -0,0 +1,22 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlBoolean;
+
+public class XmlBooleanImpl extends JavaBooleanHolder implements XmlBoolean
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanRestriction.java
new file mode 100644
index 0000000..a8da4ba
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlBooleanRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlBoolean;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlBooleanRestriction extends JavaBooleanHolderEx implements XmlBoolean
+{
+ public XmlBooleanRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlByteImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlByteImpl.java
new file mode 100644
index 0000000..a218aac
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlByteImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlByte;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlByteImpl extends JavaIntHolderEx implements XmlByte
+{
+ public XmlByteImpl()
+ { super(XmlByte.type, false); }
+ public XmlByteImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
new file mode 100644
index 0000000..653a592
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
@@ -0,0 +1,1082 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.*;
+
+import java.lang.String;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.List;
+import java.util.Calendar;
+import javax.xml.namespace.QName;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
+import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
+
+public class XmlComplexContentImpl extends XmlObjectBase
+{
+ public XmlComplexContentImpl(SchemaType type)
+ {
+ _schemaType = (SchemaTypeImpl)type;
+ initComplexType(true, true);
+ }
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ private SchemaTypeImpl _schemaType;
+
+ public String compute_text(NamespaceManager nsm)
+ { return null; }
+
+ protected final void set_String(String v)
+ {
+ assert _schemaType.getContentType() != SchemaType.SIMPLE_CONTENT;
+
+ if (_schemaType.getContentType() != SchemaType.MIXED_CONTENT &&
+ !_schemaType.isNoType())
+ {
+ throw new IllegalArgumentException(
+ "Type does not allow for textual content: " + _schemaType );
+ }
+
+ super.set_String(v);
+ }
+
+ public void set_text(String str)
+ {
+ assert
+ _schemaType.getContentType() == SchemaType.MIXED_CONTENT ||
+ _schemaType.isNoType();
+ }
+
+ protected void update_from_complex_content()
+ {
+ // No complex caching yet ...
+ }
+
+ public void set_nil()
+ { /* BUGBUG: what to do? */ }
+
+ // LEFT
+ public boolean equal_to(XmlObject complexObject)
+ {
+ if (!_schemaType.equals(complexObject.schemaType()))
+ return false;
+
+ // BUGBUG: by-value structure comparison undone
+ return true;
+ }
+
+ // LEFT
+ protected int value_hash_code()
+ {
+ throw new IllegalStateException("Complex types cannot be used as hash keys");
+ }
+
+ // DONE
+ public TypeStoreVisitor new_visitor()
+ {
+ return new SchemaTypeVisitorImpl(_schemaType.getContentModel());
+ }
+
+ // DONE
+ public boolean is_child_element_order_sensitive()
+ {
+ return schemaType().isOrderSensitive();
+ }
+
+ public int get_elementflags(QName eltName)
+ {
+ SchemaProperty prop = schemaType().getElementProperty(eltName);
+ if (prop == null)
+ return 0;
+ if (prop.hasDefault() == SchemaProperty.VARIABLE ||
+ prop.hasFixed() == SchemaProperty.VARIABLE ||
+ prop.hasNillable() == SchemaProperty.VARIABLE)
+ return -1;
+ return
+ (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) |
+ (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED) |
+ (prop.hasNillable() == SchemaProperty.NEVER ? 0 : TypeStore.NILLABLE);
+ }
+
+ // DONE
+ public String get_default_attribute_text(QName attrName)
+ {
+ return super.get_default_attribute_text(attrName);
+ }
+
+ // DONE
+ public String get_default_element_text(QName eltName)
+ {
+ SchemaProperty prop = schemaType().getElementProperty(eltName);
+ if (prop == null)
+ return "";
+ return prop.getDefaultText();
+ }
+
+ //
+ // Code gen helpers
+ //
+ // So much redundant code ..... what I'd give for generics!
+ //
+
+ protected void unionArraySetterHelper ( Object[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).objectSet( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( boolean[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( float[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( double[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( byte[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( short[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( int[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( long[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( BigDecimal[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( BigInteger[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( String[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( byte[][] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( GDate[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( GDuration[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( Calendar[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( Date[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( QName[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( StringEnumAbstractBase[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( List[] sources, QName elemName )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( elemName );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( elemName, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( elemName, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void unionArraySetterHelper ( Object[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).objectSet( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( boolean[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( float[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( double[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( byte[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( short[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( int[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( long[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( BigDecimal[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( BigInteger[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( String[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( byte[][] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( GDate[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( GDuration[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( Calendar[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( Date[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( QName[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( StringEnumAbstractBase[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( List[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+ protected void arraySetterHelper ( XmlObject[] sources, QName elemName )
+ {
+ get_store().array_setter( sources, elemName );
+ }
+
+ protected void arraySetterHelper ( XmlObject[] sources, QName elemName, QNameSet set )
+ {
+ int n = sources == null ? 0 : sources.length;
+
+ TypeStore store = get_store();
+
+ int m = store.count_elements( set );
+
+ for ( ; m > n ; m-- )
+ store.remove_element( set, m - 1 );
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ TypeStoreUser user;
+
+ if (i >= m)
+ user = store.add_element_user( elemName );
+ else
+ user = store.find_element_user( set, i );
+
+ ((XmlObjectBase) user).set( sources[ i ] );
+ }
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateImpl.java
new file mode 100644
index 0000000..73c217e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDate;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlDateImpl extends JavaGDateHolderEx implements XmlDate
+{
+ public XmlDateImpl()
+ { super(XmlDate.type, false); }
+ public XmlDateImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateTimeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateTimeImpl.java
new file mode 100644
index 0000000..7d2db6b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDateTimeImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlDateTime;
+
+
+public class XmlDateTimeImpl extends JavaGDateHolderEx implements XmlDateTime
+{
+ public XmlDateTimeImpl()
+ { super(XmlDateTime.type, false); }
+ public XmlDateTimeImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalImpl.java
new file mode 100644
index 0000000..d7b3ea3
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalImpl.java
@@ -0,0 +1,22 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDecimal;
+
+public class XmlDecimalImpl extends JavaDecimalHolder implements XmlDecimal
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalRestriction.java
new file mode 100644
index 0000000..a6f20c7
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDecimalRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDecimal;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlDecimalRestriction extends JavaDecimalHolderEx implements XmlDecimal
+{
+ public XmlDecimalRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleImpl.java
new file mode 100644
index 0000000..92526f0
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleImpl.java
@@ -0,0 +1,22 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDouble;
+
+public class XmlDoubleImpl extends JavaDoubleHolder implements XmlDouble
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleRestriction.java
new file mode 100644
index 0000000..bdae890
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDoubleRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDouble;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlDoubleRestriction extends JavaDoubleHolderEx implements XmlDouble
+{
+ public XmlDoubleRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDurationImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDurationImpl.java
new file mode 100644
index 0000000..9db131f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlDurationImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlDuration;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlDurationImpl extends JavaGDurationHolderEx implements XmlDuration
+{
+ public XmlDurationImpl()
+ { super(XmlDuration.type, false); }
+ public XmlDurationImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntitiesImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntitiesImpl.java
new file mode 100644
index 0000000..a062129
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntitiesImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlENTITIES;
+
+
+public class XmlEntitiesImpl extends XmlListImpl implements XmlENTITIES
+{
+ public XmlEntitiesImpl()
+ { super(XmlENTITIES.type, false); }
+ public XmlEntitiesImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntityImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntityImpl.java
new file mode 100644
index 0000000..7bc7f4b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlEntityImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlENTITY;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlEntityImpl extends JavaStringHolderEx implements XmlENTITY
+{
+ public XmlEntityImpl()
+ { super(XmlENTITY.type, false); }
+ public XmlEntityImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatImpl.java
new file mode 100644
index 0000000..3d4343d
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlFloat;
+
+
+public class XmlFloatImpl extends JavaFloatHolder implements XmlFloat
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatRestriction.java
new file mode 100644
index 0000000..7a2b6a0
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlFloatRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlFloat;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlFloatRestriction extends JavaFloatHolderEx implements XmlFloat
+{
+ public XmlFloatRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGDayImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGDayImpl.java
new file mode 100644
index 0000000..3a66545
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGDayImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlGDay;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlGDayImpl extends JavaGDateHolderEx implements XmlGDay
+{
+ public XmlGDayImpl()
+ { super(XmlGDay.type, false); }
+ public XmlGDayImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthDayImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthDayImpl.java
new file mode 100644
index 0000000..58b76ed
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthDayImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlGMonthDay;
+
+public class XmlGMonthDayImpl extends JavaGDateHolderEx implements XmlGMonthDay
+{
+ public XmlGMonthDayImpl()
+ { super(XmlGMonthDay.type, false); }
+ public XmlGMonthDayImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthImpl.java
new file mode 100644
index 0000000..5946b51
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGMonthImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlGMonth;
+
+public class XmlGMonthImpl extends JavaGDateHolderEx implements XmlGMonth
+{
+ public XmlGMonthImpl()
+ { super(XmlGMonth.type, false); }
+ public XmlGMonthImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearImpl.java
new file mode 100644
index 0000000..5c0f834
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlGYear;
+
+public class XmlGYearImpl extends JavaGDateHolderEx implements XmlGYear
+{
+ public XmlGYearImpl()
+ { super(XmlGYear.type, false); }
+ public XmlGYearImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearMonthImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearMonthImpl.java
new file mode 100644
index 0000000..b5897c7
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlGYearMonthImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlGYearMonth;
+
+public class XmlGYearMonthImpl extends JavaGDateHolderEx implements XmlGYearMonth
+{
+ public XmlGYearMonthImpl()
+ { super(XmlGYearMonth.type, false); }
+ public XmlGYearMonthImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryImpl.java
new file mode 100644
index 0000000..c489e34
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlHexBinary;
+
+
+public class XmlHexBinaryImpl extends JavaHexBinaryHolder implements XmlHexBinary
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryRestriction.java
new file mode 100644
index 0000000..4b42027
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlHexBinaryRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlHexBinary;
+
+public class XmlHexBinaryRestriction extends JavaHexBinaryHolderEx implements XmlHexBinary
+{
+ public XmlHexBinaryRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdImpl.java
new file mode 100644
index 0000000..f260b12
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlID;
+
+
+public class XmlIdImpl extends JavaStringHolderEx implements XmlID
+{
+ public XmlIdImpl()
+ { super(XmlID.type, false); }
+ public XmlIdImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefImpl.java
new file mode 100644
index 0000000..6dfea62
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlIDREF;
+
+
+public class XmlIdRefImpl extends JavaStringHolderEx implements XmlIDREF
+{
+ public XmlIdRefImpl()
+ { super(XmlIDREF.type, false); }
+ public XmlIdRefImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefsImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefsImpl.java
new file mode 100644
index 0000000..1c9fb15
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIdRefsImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlIDREFS;
+
+public class XmlIdRefsImpl extends XmlListImpl implements XmlIDREFS
+{
+ public XmlIdRefsImpl()
+ { super(XmlIDREFS.type, false); }
+ public XmlIdRefsImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntImpl.java
new file mode 100644
index 0000000..cb86181
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlInt;
+
+
+public class XmlIntImpl extends JavaIntHolder implements XmlInt
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntRestriction.java
new file mode 100644
index 0000000..a608504
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlInt;
+
+public class XmlIntRestriction extends JavaIntHolderEx implements XmlInt
+{
+ public XmlIntRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerImpl.java
new file mode 100644
index 0000000..031f619
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlInteger;
+
+
+public class XmlIntegerImpl extends JavaIntegerHolder implements XmlInteger
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerRestriction.java
new file mode 100644
index 0000000..57875ac
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlIntegerRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlInteger;
+
+public class XmlIntegerRestriction extends JavaIntegerHolderEx implements XmlInteger
+{
+ public XmlIntegerRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLanguageImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLanguageImpl.java
new file mode 100644
index 0000000..e2c5008
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLanguageImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlLanguage;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlLanguageImpl extends JavaStringHolderEx implements XmlLanguage
+{
+ public XmlLanguageImpl()
+ { super(XmlLanguage.type, false); }
+ public XmlLanguageImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlListImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlListImpl.java
new file mode 100644
index 0000000..d203c21
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlListImpl.java
@@ -0,0 +1,363 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.XmlSimpleList;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+import org.apache.xmlbeans.impl.common.XMLChar;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+
+public class XmlListImpl extends XmlObjectBase implements XmlAnySimpleType
+{
+ public XmlListImpl(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ private SchemaType _schemaType;
+ private XmlSimpleList _value;
+ private XmlSimpleList _jvalue;
+
+
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+ // gets raw text value
+
+ private static String nullAsEmpty(String s)
+ {
+ if (s == null)
+ return "";
+ return s;
+ }
+
+ private static String compute_list_text(List xList)
+ {
+ if (xList.size() == 0)
+ return "";
+
+ StringBuffer sb = new StringBuffer();
+ sb.append(nullAsEmpty(((SimpleValue)xList.get(0)).getStringValue()));
+
+ for (int i = 1; i < xList.size(); i++)
+ {
+ sb.append(' ');
+ sb.append(nullAsEmpty(((SimpleValue)xList.get(i)).getStringValue()));
+ }
+
+ return sb.toString();
+ }
+
+ protected String compute_text(NamespaceManager nsm)
+ {
+ return compute_list_text(_value);
+ }
+
+ protected boolean is_defaultable_ws(String v) {
+ try {
+ XmlSimpleList savedValue = _value;
+ set_text(v);
+
+ // restore the saved value
+ _value = savedValue;
+
+ return false;
+ }
+ catch (XmlValueOutOfRangeException e) {
+ return true;
+ }
+ }
+
+ protected void set_text(String s)
+ {
+ // first check against any patterns...
+ if (_validateOnSet() && !_schemaType.matchPatternFacet(s))
+ throw new XmlValueOutOfRangeException();
+
+ SchemaType itemType = _schemaType.getListItemType();
+
+ XmlSimpleList newval = lex(s, itemType, _voorVc, has_store() ? get_store() : null);
+
+ // check enumeration
+ if (_validateOnSet())
+ validateValue(newval, _schemaType, _voorVc);
+
+ // we made it all the way through; so we're OK.
+ _value = newval;
+ }
+
+ private static final String[] EMPTY_STRINGARRAY = new String[0];
+
+ public static String[] split_list(String s)
+ {
+ if (s.length() == 0)
+ return EMPTY_STRINGARRAY;
+
+ List result = new ArrayList();
+ int i = 0;
+ int start = 0;
+ for (;;)
+ {
+ while (i < s.length() && XMLChar.isSpace(s.charAt(i)))
+ i += 1;
+ if (i >= s.length())
+ {
+ if (result.size() == 0)
+ return EMPTY_STRINGARRAY;
+ return (String[])result.toArray(new String[result.size()]);
+ }
+ start = i;
+ while (i < s.length() && !XMLChar.isSpace(s.charAt(i)))
+ i += 1;
+ result.add(s.substring(start, i));
+ }
+ }
+
+ public static XmlSimpleList lex(String s, SchemaType itemType, ValidationContext ctx, PrefixResolver resolver)
+ {
+ String[] parts = split_list(s);
+
+ XmlAnySimpleType[] newArray = new XmlAnySimpleType[parts.length];
+ boolean pushed = false;
+ if (resolver != null)
+ {
+ NamespaceContext.push(new NamespaceContext(resolver));
+ pushed = true;
+ }
+ int i = 0;
+ try
+ {
+ for (i = 0; i < parts.length; i++)
+ {
+ try
+ {
+ newArray[i] = itemType.newValue(parts[i]);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ ctx.invalid("List item '" + parts[i] + "' is not a valid value of " + QNameHelper.readable(itemType));
+ }
+ }
+ }
+ finally
+ {
+ if (pushed)
+ NamespaceContext.pop();
+ }
+ return new XmlSimpleList(Arrays.asList(newArray));
+ }
+
+ protected void set_nil()
+ {
+ _value = null;
+ }
+
+ public List xlistValue()
+ {
+ check_dated();
+ return _value;
+ }
+
+ public List listValue()
+ {
+ check_dated();
+ if (_value == null)
+ return null;
+ if (_jvalue != null)
+ return _jvalue;
+ List javaResult = new ArrayList();
+ for (int i = 0; i < _value.size(); i++)
+ javaResult.add(java_value((XmlObject)_value.get(i)));
+ _jvalue = new XmlSimpleList(javaResult);
+ return _jvalue;
+ }
+
+ private static boolean permits_inner_space(XmlObject obj)
+ {
+ switch (((SimpleValue)obj).instanceType().getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_ANY_TYPE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private static boolean contains_white_space(String s)
+ {
+ return s.indexOf(' ') >= 0 ||
+ s.indexOf('\t') >= 0 ||
+ s.indexOf('\n') >= 0 ||
+ s.indexOf('\r') >= 0;
+ }
+
+ public void set_list(List list)
+ {
+ SchemaType itemType = _schemaType.getListItemType();
+ XmlSimpleList xList;
+
+ boolean pushed = false;
+ if (has_store())
+ {
+ NamespaceContext.push(new NamespaceContext(get_store()));
+ pushed = true;
+ }
+
+ try
+ {
+ XmlAnySimpleType[] newval = new XmlAnySimpleType[list.size()];
+ for (int i = 0; i < list.size(); i++)
+ {
+ Object entry = list.get(i);
+ if ((entry instanceof XmlObject) && permits_inner_space((XmlObject)list.get(i)))
+ {
+ String stringrep = list.get(i).toString();
+ if (contains_white_space(stringrep))
+ throw new XmlValueOutOfRangeException();
+ }
+ newval[i] = itemType.newValue(entry);
+ }
+ xList = new XmlSimpleList(Arrays.asList(newval));
+ }
+ finally
+ {
+ if (pushed)
+ NamespaceContext.pop();
+ }
+
+
+ if (_validateOnSet())
+ {
+ // check enumeration + min/max/etc
+ validateValue(xList, _schemaType, _voorVc);
+ }
+
+ _value = xList;
+ }
+
+ public static void validateValue(XmlSimpleList items, SchemaType sType, ValidationContext context)
+ {
+ XmlObject[] enumvals = sType.getEnumerationValues();
+ checkEnum: if (enumvals != null)
+ {
+ for (int i = 0; i < enumvals.length; i++)
+ {
+ if (equal_xmlLists(items, ((XmlObjectBase)enumvals[i]).xlistValue()))
+ break checkEnum;
+ }
+ context.invalid("List (" + items + ") is not a valid enumerated value for " + QNameHelper.readable(sType));
+ }
+
+ XmlObject o;
+ int i;
+
+ if ((o = sType.getFacet( SchemaType.FACET_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) != items.size())
+ {
+ context.invalid(
+ "List (" + items + ") does not have " + i +
+ " items per length facet for " + QNameHelper.readable(sType));
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MIN_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) > items.size())
+ {
+ context.invalid(
+ "List (" + items + ") has only " + items.size() +
+ " items, fewer than min length facet (" + i + ") for " + QNameHelper.readable(sType) );
+ }
+ }
+
+ if ((o = sType.getFacet( SchemaType.FACET_MAX_LENGTH )) != null)
+ {
+ if ((i = ((SimpleValue)o).getIntValue()) < items.size())
+ {
+ context.invalid(
+ "List (" + items + ") has " + items.size() +
+ " items, more than max length facet (" + i + ") for " + QNameHelper.readable(sType) );
+ }
+ }
+ }
+
+ // comparators
+ // protected int compare_to(XmlObject i) - no sorting order; inherit from base
+
+ protected boolean equal_to(XmlObject obj)
+ {
+ return equal_xmlLists(_value, ((XmlObjectBase)obj).xlistValue());
+ }
+
+
+ private static boolean equal_xmlLists(List a, List b)
+ {
+ if (a.size() != b.size())
+ return false;
+ for (int i = 0; i < a.size(); i++)
+ {
+ if (!a.get(i).equals(b.get(i)))
+ return false;
+ }
+ return true;
+ }
+
+ protected int value_hash_code()
+ {
+ if (_value == null)
+ return 0;
+
+ // hash code probes 9 distributed values, plus the last
+ int hash = _value.size();
+ int incr = _value.size() / 9;
+ if (incr < 1)
+ incr = 1;
+
+ int i;
+ for (i = 0; i < _value.size(); i += incr)
+ {
+ hash *= 19;
+ hash += _value.get(i).hashCode();
+ }
+
+ if (i < _value.size())
+ {
+ hash *= 19;
+ hash += _value.get(i).hashCode();
+ }
+
+ return hash;
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ validateValue((XmlSimpleList)xlistValue(), schemaType(), ctx);
+ }
+
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongImpl.java
new file mode 100644
index 0000000..285b0bc
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlLong;
+
+
+public class XmlLongImpl extends JavaLongHolder implements XmlLong
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongRestriction.java
new file mode 100644
index 0000000..9ea36de
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlLongRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlLong;
+
+public class XmlLongRestriction extends JavaLongHolderEx implements XmlLong
+{
+ public XmlLongRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNCNameImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNCNameImpl.java
new file mode 100644
index 0000000..29abc2f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNCNameImpl.java
@@ -0,0 +1,38 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlNCName;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.XMLChar;
+
+public class XmlNCNameImpl extends JavaStringHolderEx implements XmlNCName
+{
+ public XmlNCNameImpl()
+ { super(XmlNCName.type, false); }
+ public XmlNCNameImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+
+ public static void validateLexical(String v, ValidationContext context)
+ {
+ if ( !XMLChar.isValidNCName(v) )
+ {
+ context.invalid("Value '" + v + "' it's not a valid NCName.");
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNameImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNameImpl.java
new file mode 100644
index 0000000..1f3a081
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNameImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlName;
+
+
+public class XmlNameImpl extends JavaStringHolderEx implements XmlName
+{
+ public XmlNameImpl()
+ { super(XmlName.type, false); }
+ public XmlNameImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNegativeIntegerImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNegativeIntegerImpl.java
new file mode 100644
index 0000000..20dff35
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNegativeIntegerImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlNegativeInteger;
+
+
+public class XmlNegativeIntegerImpl extends JavaIntegerHolderEx implements XmlNegativeInteger
+{
+ public XmlNegativeIntegerImpl()
+ { super(XmlNegativeInteger.type, false); }
+ public XmlNegativeIntegerImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokenImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokenImpl.java
new file mode 100644
index 0000000..62462c4
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokenImpl.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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlNMTOKEN;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.XMLChar;
+
+
+public class XmlNmTokenImpl extends JavaStringHolderEx implements XmlNMTOKEN
+{
+ public XmlNmTokenImpl()
+ { super(XmlNMTOKEN.type, false); }
+ public XmlNmTokenImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+
+ public static void validateLexical(String v, ValidationContext context)
+ {
+ if ( !XMLChar.isValidNmtoken(v) )
+ {
+ context.invalid("Value '" + v + "' it's not a valid NMTOKEN.");
+ return;
+ }
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokensImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokensImpl.java
new file mode 100644
index 0000000..3b8cd4b
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNmTokensImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlNMTOKENS;
+
+
+public class XmlNmTokensImpl extends XmlListImpl implements XmlNMTOKENS
+{
+ public XmlNmTokensImpl()
+ { super(XmlNMTOKENS.type, false);}
+ public XmlNmTokensImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonNegativeIntegerImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonNegativeIntegerImpl.java
new file mode 100644
index 0000000..7026b98
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonNegativeIntegerImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlNonNegativeInteger;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlNonNegativeIntegerImpl extends JavaIntegerHolderEx implements XmlNonNegativeInteger
+{
+ public XmlNonNegativeIntegerImpl()
+ { super(XmlNonNegativeInteger.type, false); }
+ public XmlNonNegativeIntegerImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonPositiveIntegerImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonPositiveIntegerImpl.java
new file mode 100644
index 0000000..901e5ef
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNonPositiveIntegerImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlNonPositiveInteger;
+
+
+public class XmlNonPositiveIntegerImpl extends JavaIntegerHolderEx implements XmlNonPositiveInteger
+{
+ public XmlNonPositiveIntegerImpl()
+ { super(XmlNonPositiveInteger.type, false); }
+ public XmlNonPositiveIntegerImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNormalizedStringImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNormalizedStringImpl.java
new file mode 100644
index 0000000..47de463
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNormalizedStringImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlNormalizedString;
+
+public class XmlNormalizedStringImpl extends JavaStringHolderEx implements XmlNormalizedString
+{
+ public XmlNormalizedStringImpl()
+ { super(XmlNormalizedString.type, false); }
+ public XmlNormalizedStringImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationImpl.java
new file mode 100644
index 0000000..f2632b0
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationImpl.java
@@ -0,0 +1,22 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlNOTATION;
+
+public class XmlNotationImpl extends JavaNotationHolder implements XmlNOTATION
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationRestriction.java
new file mode 100644
index 0000000..1823057
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlNotationRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlNOTATION;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlNotationRestriction extends JavaNotationHolderEx implements XmlNOTATION
+{
+ public XmlNotationRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
new file mode 100644
index 0000000..66a7a6c
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
@@ -0,0 +1,2639 @@
+/* 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.xmlbeans.impl.values;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+import java.math.BigInteger;
+import java.math.BigDecimal;
+import java.io.Serializable;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.lang.reflect.Array;
+import java.util.Date;
+import java.util.List;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Calendar;
+import java.util.Collection;
+
+import org.apache.xmlbeans.impl.common.XmlWhitespace;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.GlobalLock;
+import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
+import org.apache.xmlbeans.impl.schema.SchemaTypeVisitorImpl;
+import org.apache.xmlbeans.impl.validator.Validator;
+import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaAttributeModel;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlDocumentProperties;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlRuntimeException;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.GDateSpecification;
+import org.apache.xmlbeans.GDurationSpecification;
+import org.apache.xmlbeans.StringEnumAbstractBase;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.FilterXmlObject;
+import org.apache.xmlbeans.DelegateXmlObject;
+
+import org.w3c.dom.Node;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.SAXException;
+
+public abstract class XmlObjectBase implements TypeStoreUser, Serializable, XmlObject, SimpleValue
+{
+ public static final short MAJOR_VERSION_NUMBER = (short) 1; // for serialization
+ public static final short MINOR_VERSION_NUMBER = (short) 1; // for serialization
+
+ public final Object monitor()
+ {
+ if (has_store())
+ return get_store().get_root_object();
+ return this;
+ }
+
+ private static XmlObjectBase underlying(XmlObject obj)
+ {
+ if (obj == null)
+ return null;
+ if (obj instanceof XmlObjectBase)
+ return (XmlObjectBase)obj;
+ while (obj instanceof DelegateXmlObject)
+ obj = ((DelegateXmlObject)obj).underlyingXmlObject();
+ if (obj instanceof XmlObjectBase)
+ return (XmlObjectBase)obj;
+ throw new IllegalStateException("Non-native implementations of XmlObject should extend FilterXmlObject or implement DelegateXmlObject");
+ }
+
+ public final XmlObject copy()
+ {
+ synchronized (monitor())
+ {
+ // immutable objects don't get copied. They're immutable
+ if (isImmutable())
+ return this;
+
+ check_orphaned();
+
+ // copy the type
+ XmlObject result = get_store().get_schematypeloader().newInstance(schemaType(), null);
+
+
+ // copy the data
+ XmlObjectBase target = underlying(result);
+ target.get_store().copy_contents_from(get_store());
+
+ return result;
+ }
+ }
+
+ public XmlDocumentProperties documentProperties()
+ { XmlCursor cur = newCursorForce(); try { return cur.documentProperties(); } finally { cur.dispose(); } }
+
+ public XMLInputStream newXMLInputStream()
+ { return newXMLInputStream(null); }
+
+ public XMLInputStream newXMLInputStream(XmlOptions options)
+ { XmlCursor cur = newCursorForce(); try { return cur.newXMLInputStream(makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public InputStream newInputStream()
+ { return newInputStream(null); }
+
+ public InputStream newInputStream(XmlOptions options)
+ { XmlCursor cur = newCursorForce(); try { return cur.newInputStream(makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public Reader newReader()
+ { return newReader(null); }
+
+ public Reader newReader(XmlOptions options)
+ { XmlCursor cur = newCursorForce(); try { return cur.newReader(makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public Node newDomNode()
+ { return newDomNode(null); }
+
+ public Node newDomNode(XmlOptions options)
+ { XmlCursor cur = newCursorForce(); try { return cur.newDomNode(makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public void save(ContentHandler ch, LexicalHandler lh, XmlOptions options) throws SAXException
+ { XmlCursor cur = newCursorForce(); try { cur.save(ch, lh, makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public void save(File file, XmlOptions options) throws IOException
+ { XmlCursor cur = newCursorForce(); try { cur.save(file, makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public void save(OutputStream os, XmlOptions options) throws IOException
+ { XmlCursor cur = newCursorForce(); try { cur.save(os, makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public void save(Writer w, XmlOptions options) throws IOException
+ { XmlCursor cur = newCursorForce(); try { cur.save(w, makeInnerOptions(options)); } finally { cur.dispose(); } }
+
+ public void save(ContentHandler ch, LexicalHandler lh) throws SAXException
+ { save( ch, lh, null ); }
+
+ public void save(File file) throws IOException
+ { save( file, null ); }
+
+ public void save(OutputStream os) throws IOException
+ { save( os, null ); }
+
+ public void save(Writer w) throws IOException
+ { save( w, null ); }
+
+ public XmlCursor newCursorForce()
+ {
+ synchronized (monitor())
+ {
+ return ensureStore().newCursor();
+ }
+ }
+
+ private XmlObject ensureStore()
+ {
+ if ((_flags & FLAG_STORE) != 0)
+ return this;
+
+ check_dated();
+
+ String value =
+ (_flags & FLAG_NIL) != 0
+ ? ""
+ : compute_text( has_store() ? get_store() : null );
+
+ XmlOptions options = new XmlOptions().setDocumentType(schemaType());
+
+ XmlObject x = XmlObject.Factory.newInstance( options );
+
+ XmlCursor c = x.newCursor();
+ c.toNextToken();
+ c.insertChars( value );
+
+ return x;
+ }
+
+ private static XmlOptions makeInnerOptions(XmlOptions options)
+ {
+ XmlOptions innerOptions = new XmlOptions( options );
+ innerOptions.put( XmlOptions.SAVE_INNER );
+ return innerOptions;
+ }
+
+ public XmlCursor newCursor()
+ {
+ if ((_flags & FLAG_STORE) == 0)
+ throw new IllegalStateException("XML Value Objects cannot create cursors");
+
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return get_store().new_cursor();
+ }
+ }
+
+ public abstract SchemaType schemaType();
+
+ public SchemaType instanceType()
+ { synchronized (monitor()) { return isNil() ? null : schemaType(); } }
+
+ private SchemaField schemaField() {
+ SchemaType st = schemaType();
+ SchemaField field;
+
+ // First check if this field has an anonymous type
+ field = st.getContainerField();
+
+ if (field == null)
+ field = get_store().get_schema_field();
+
+ return field;
+ }
+
+ /**
+ * Use _voorVc when you want to throw a ValueOutOfRangeException when
+ * validating a simple type.
+ */
+ private static final class ValueOutOfRangeValidationContext implements ValidationContext
+ {
+ public void invalid(String message)
+ {
+ throw new XmlValueOutOfRangeException( message );
+ }
+ }
+
+ /**
+ * Used to supply validation context for the validate_value methods
+ */
+ private static final class ImmutableValueValidationContext implements ValidationContext
+ {
+ private XmlObject _loc;
+ private Collection _coll;
+ ImmutableValueValidationContext(Collection coll, XmlObject loc)
+ {
+ _coll = coll;
+ _loc = loc;
+ }
+ public void invalid(String message)
+ {
+ _coll.add(XmlError.forObject(message, _loc));
+ }
+ }
+
+ public static final ValidationContext _voorVc = new ValueOutOfRangeValidationContext();
+
+ public boolean validate()
+ { return validate(null); }
+
+ public boolean validate(XmlOptions options)
+ {
+ if ((_flags & FLAG_STORE) == 0)
+ {
+ if ((_flags & FLAG_IMMUTABLE) != 0)
+ {
+ return validate_immutable(options);
+ }
+
+ throw new IllegalStateException(
+ "XML objects with no underlying store cannot be validated");
+ }
+
+ synchronized (monitor())
+ {
+ if ((_flags & FLAG_ORPHANED) != 0)
+ throw new XmlValueDisconnectedException();
+
+ SchemaField field = schemaField();
+ SchemaType type = schemaType();
+
+ TypeStore typeStore = get_store();
+
+ Validator validator =
+ new Validator(
+ type, field, typeStore.get_schematypeloader(), options, null);
+
+ typeStore.validate( validator );
+
+ return validator.isValid();
+ }
+ }
+
+ private boolean validate_immutable(XmlOptions options)
+ {
+ Collection errorListener = options == null ? null : (Collection)options.get(XmlOptions.ERROR_LISTENER);
+ XmlErrorWatcher watcher = new XmlErrorWatcher(errorListener);
+ if (!schemaType().isSimpleType())
+ {
+ // cannot have any required attributes or elements
+ SchemaProperty[] properties = schemaType().getProperties();
+ for (int i = 0; i < properties.length; i++)
+ {
+ if (properties[i].getMinOccurs().signum() > 0)
+ {
+ if (properties[i].isAttribute())
+ watcher.add(XmlError.forObject("Missing required attribute " + QNameHelper.pretty(properties[i].getName()), this));
+ else
+ watcher.add(XmlError.forObject("Missing required element " + QNameHelper.pretty(properties[i].getName()), this));
+ }
+ }
+
+ if (schemaType().getContentType() != SchemaType.SIMPLE_CONTENT)
+ return !watcher.hasError(); // don't validate non-simple-content
+ }
+
+ String text = (String)_textsource;
+ if (text == null)
+ text = "";
+ validate_simpleval(text, new ImmutableValueValidationContext(watcher, this));
+ return !watcher.hasError();
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ return;
+ }
+
+ private static XmlObject[] _typedArray(XmlObject[] input)
+ {
+ if (input.length == 0)
+ return input;
+ SchemaType commonType = input[0].schemaType();
+ if (commonType.equals(XmlObject.type))
+ return input;
+ for (int i = 1; i < input.length; i++)
+ {
+ commonType = commonType.getCommonBaseType(input[i].schemaType());
+ if (commonType.equals(XmlObject.type))
+ return input;
+ }
+ Class desiredClass = commonType.getJavaClass();
+ while (desiredClass == null)
+ {
+ commonType = commonType.getBaseType();
+ if (XmlObject.type.equals(commonType))
+ return input;
+ desiredClass = commonType.getJavaClass();
+ }
+
+ XmlObject[] result = (XmlObject[])Array.newInstance(desiredClass, input.length);
+ System.arraycopy(input, 0, result, 0, input.length);
+ return result;
+ }
+
+ public XmlObject[] selectPath ( String path )
+ {
+ return selectPath( path, null );
+ }
+
+ public XmlObject[] selectPath ( String path, XmlOptions options )
+ {
+ XmlObject [] selections;
+
+ // all user-level code; doesn't need to be synchronized
+
+ XmlCursor c = newCursor();
+
+ if (c == null)
+ throw new XmlValueDisconnectedException();
+
+ try
+ {
+ c.selectPath( path, options );
+
+ if (!c.hasNextSelection())
+ selections = new XmlObject[ 0 ];
+ else
+ {
+ selections = new XmlObject [ c.getSelectionCount() ];
+
+ for (int i = 0 ; c.toNextSelection() ; i++)
+ {
+ if ((selections[ i ] = c.getObject()) == null)
+ {
+ throw
+ new XmlRuntimeException(
+ "Path must select only elements " +
+ "and attributes" );
+ }
+ }
+ }
+ }
+ finally
+ {
+ c.dispose();
+ }
+
+ return _typedArray(selections);
+ }
+
+ public XmlObject[] execQuery ( String path )
+ {
+ return execQuery( path, null );
+ }
+
+ public XmlObject[] execQuery ( String queryExpr, XmlOptions options )
+ {
+ synchronized (monitor())
+ {
+ TypeStore typeStore = get_store();
+
+ if (typeStore == null)
+ {
+ throw
+ new XmlRuntimeException(
+ "Cannot do XQuery on XML Value Objects" );
+ }
+
+ try
+ {
+ return _typedArray(typeStore.exec_query( queryExpr, options ));
+ }
+ catch (XmlException e)
+ {
+ throw new XmlRuntimeException( e );
+ }
+ }
+ }
+
+ public XmlObject changeType(SchemaType type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException( "Invalid type (null)" );
+
+ if ((_flags & FLAG_STORE) == 0)
+ {
+ throw
+ new IllegalStateException(
+ "XML Value Objects cannot have thier type changed" );
+ }
+
+ synchronized (monitor())
+ {
+ check_orphaned();
+ return (XmlObject) get_store().change_type( type );
+ }
+ }
+
+ private int _flags;
+ private Object _textsource;
+
+ protected XmlObjectBase()
+ {
+ _flags = FLAG_NILLABLE | FLAG_NIL;
+ }
+
+ public void init_flags(SchemaProperty prop)
+ {
+ if (prop == null) return;
+
+ if (prop.hasDefault() == SchemaProperty.VARIABLE ||
+ prop.hasFixed() == SchemaProperty.VARIABLE ||
+ prop.hasNillable() == SchemaProperty.VARIABLE)
+ return;
+
+ _flags |=
+ (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) |
+ (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED) |
+ (prop.hasNillable() == SchemaProperty.NEVER ? 0 : TypeStore.NILLABLE) |
+ (FLAG_NOT_VARIABLE);
+ }
+
+ {
+ assert TypeStore.NILLABLE == 1;
+ assert TypeStore.HASDEFAULT == 2;
+ assert TypeStore.FIXED == 4;
+ }
+
+ private static final int FLAG_NILLABLE = TypeStore.NILLABLE;
+ private static final int FLAG_HASDEFAULT = TypeStore.HASDEFAULT;
+ private static final int FLAG_FIXED = TypeStore.FIXED;
+ private static final int FLAG_ATTRIBUTE = 8;
+ private static final int FLAG_STORE = 16;
+ private static final int FLAG_VALUE_DATED = 32;
+ private static final int FLAG_NIL = 64;
+ private static final int FLAG_NIL_DATED = 128;
+ private static final int FLAG_ISDEFAULT = 256;
+ private static final int FLAG_ELEMENT_DATED = 512;
+ private static final int FLAG_SETTINGDEFAULT = 1024;
+ private static final int FLAG_ORPHANED = 2048;
+ private static final int FLAG_IMMUTABLE = 4096;
+ private static final int FLAG_COMPLEXTYPE = 8192;
+ private static final int FLAG_COMPLEXCONTENT = 16384;
+ private static final int FLAG_NOT_VARIABLE = 32768;
+ private static final int FLAG_VALIDATE_ON_SET = 65536;
+
+
+ /**
+ * The three dated flags are always stacked:
+ * FLAG_ELEMENT_DATED implies FLAG_NIL_DATED is set
+ * FLAG_NIL_DATED implies FLAG_TEXT_DATED is set.
+ * checkers work on the flags from top to bottom.
+ */
+ private static final int FLAGS_DATED =
+ FLAG_VALUE_DATED | FLAG_NIL_DATED | FLAG_ELEMENT_DATED;
+
+ /**
+ * The three element status flags have one interrlationshiop:
+ * FLAG_FIXED implies FLAG_HASDEFAULT is set.
+ * These flags are used when setting nils, defaults, strings.
+ * Since an initial get implies setting from text, they're
+ * also used during getting.
+ */
+ private static final int FLAGS_ELEMENT =
+ FLAG_NILLABLE | FLAG_FIXED | FLAG_HASDEFAULT;
+
+
+ /**
+ * Called by restriction subclasses within their constructors to enable
+ * complex type support.
+ */
+ protected void initComplexType(boolean complexType, boolean complexContent)
+ {
+ _flags |= (complexType ? FLAG_COMPLEXTYPE : 0) |
+ (complexContent ? FLAG_COMPLEXCONTENT : 0);
+ }
+
+ protected boolean _isComplexType()
+ { return (_flags & FLAG_COMPLEXTYPE) != 0; }
+
+ protected boolean _isComplexContent()
+ { return (_flags & FLAG_COMPLEXCONTENT) != 0; }
+
+ public void setValidateOnSet() {
+ _flags |= FLAG_VALIDATE_ON_SET;
+ }
+
+ protected boolean _validateOnSet()
+ { return (_flags & FLAG_VALIDATE_ON_SET) != 0; }
+
+ /**
+ * True if the value is nilled.
+ */
+ public final boolean isNil()
+ {
+ synchronized (monitor())
+ {
+ check_dated();
+ return ((_flags & FLAG_NIL) != 0);
+ }
+ }
+
+ /**
+ * True if the value is fixed.
+ */
+ public final boolean isFixed()
+ {
+ check_element_dated();
+ return ((_flags & FLAG_FIXED) != 0);
+ }
+
+ /**
+ * True if the value is allowed to be nil.
+ */
+ public final boolean isNillable()
+ {
+ check_element_dated();
+ return ((_flags & FLAG_NILLABLE) != 0);
+ }
+
+ /**
+ * True if the value is currently defaulted.
+ */
+ public final boolean isDefaultable()
+ {
+ check_element_dated();
+ return ((_flags & FLAG_HASDEFAULT) != 0);
+ }
+
+ /**
+ * True if the value is currently defaulted.
+ */
+ public final boolean isDefault()
+ {
+ check_dated();
+ return ((_flags & FLAG_ISDEFAULT) != 0);
+ }
+
+
+ /**
+ * Nils the value.
+ */
+ public final void setNil()
+ {
+ synchronized (monitor())
+ {
+ set_prepare();
+
+ // if we're not nillable, throw exception on setNil(true)
+ if ((_flags & FLAG_NILLABLE) == 0)
+ throw new XmlValueNotNillableException();
+
+ // the implementation should zero the value to reflect nil
+ set_nil();
+
+ // set the nil flag
+ _flags |= FLAG_NIL;
+
+ // ordinary commit except no clearing of nil flag
+ if ((_flags & FLAG_STORE) != 0)
+ {
+ _flags &= ~FLAGS_DATED;
+ get_store().invalidate_nil();
+ }
+ else
+ {
+ _textsource = null;
+ }
+ }
+ }
+
+ /**
+ * Used for situations where these flags must be passed on to
+ * chained values. (See XmlAnySimpleType (allSimpleValue), union
+ * implementations).
+ */
+ protected int elementFlags()
+ {
+ check_element_dated();
+ return (_flags & FLAGS_ELEMENT);
+ }
+
+ /**
+ * Used to make a free-standing xml simple value instance immutable.
+ * This is a one-way street, and it is illegal to attempt to make a
+ * value that is embedded in an xml document immutable.
+ *
+ * Once a value is marked as immutable, it is illegal to call setters
+ * of any kind.
+ */
+ public void setImmutable()
+ {
+ if ((_flags & (FLAG_IMMUTABLE | FLAG_STORE)) != 0)
+ throw new IllegalStateException();
+
+ _flags |= FLAG_IMMUTABLE;
+ }
+
+ /**
+ * Is this instance an immutable value?
+ */
+ public boolean isImmutable()
+ {
+ return (_flags & FLAG_IMMUTABLE) != 0;
+ }
+
+
+
+
+ // TEXTUSER implementation
+
+ /**
+ * Called to initialize the TypeStore associated with this XmlObject
+ * implementation. If not called, this is a free-floating value holder.
+ *
+ * When a value is first attached, it is put in a completely invalidated
+ * state.
+ */
+ public final void attach_store(TypeStore store)
+ {
+ _textsource = store;
+ if ((_flags & FLAG_IMMUTABLE) != 0)
+ throw new IllegalStateException();
+ _flags |= FLAG_STORE | FLAG_VALUE_DATED | FLAG_NIL_DATED | FLAG_ELEMENT_DATED;
+
+ if (store.is_attribute())
+ _flags |= FLAG_ATTRIBUTE;
+
+ if (store.validate_on_set())
+ _flags |= FLAG_VALIDATE_ON_SET;
+ }
+
+ /**
+ * Called by a TypeStore to indicate that the text has been
+ * invalidated and should be fetched next time the value is
+ * needed.
+ */
+ public final void invalidate_value()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ _flags |= FLAG_VALUE_DATED;
+ }
+
+ public final boolean uses_invalidate_value()
+ {
+ SchemaType type = schemaType();
+ return type.isSimpleType() || type.getContentType() == SchemaType.SIMPLE_CONTENT;
+ }
+
+ /**
+ * Called by a TypeStore to indicate that the xsi:nil attribute
+ * on the containing element (and possibly the text) has been
+ * invalidated and both should be consulted next time the value
+ * is needed.
+ */
+ public final void invalidate_nilvalue()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ _flags |= FLAG_VALUE_DATED | FLAG_NIL_DATED;
+ }
+
+ /**
+ * Called by a TypeStore to indicate that the element's default
+ * value, nillability, fixedness, etc, may have changed by
+ * virtue of the element order changing (and xsi:nil and the
+ * text may have changed too); so the store should be consulted
+ * next time any setter or getter is called.
+ */
+ public final void invalidate_element_order()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ _flags |= FLAG_VALUE_DATED | FLAG_NIL_DATED | FLAG_ELEMENT_DATED;
+ }
+
+ /**
+ * Used by the ComplexTypeImpl subclass to get direct access
+ * to the store.
+ */
+ public final TypeStore get_store()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ return (TypeStore)_textsource;
+ }
+
+ protected final boolean has_store()
+ {
+ return (_flags & FLAG_STORE) != 0;
+ }
+
+ /**
+ * Called by a TypeStore to pull out the most reasonable
+ * text value from us. This is done after we have invalidated
+ * the store (typically when our value has been set).
+ */
+ public final String build_text(NamespaceManager nsm)
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ assert((_flags & FLAG_VALUE_DATED) == 0);
+ if ((_flags & (FLAG_NIL | FLAG_ISDEFAULT)) != 0)
+ return "";
+ return compute_text(
+ nsm == null ? has_store() ? get_store() : null : nsm);
+ }
+
+ /**
+ * A store will call back on build_nil after we've called invalidate_nil
+ * and it needs to know what the nil value is.
+ */
+ public boolean build_nil()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ assert((_flags & FLAG_VALUE_DATED) == 0);
+ return (_flags & FLAG_NIL) != 0;
+ }
+
+ /**
+ * A store will call back on validate_now to force us to look at
+ * the text if we're in an invalid state. We're allowed to throw
+ * an exception if the text isn't valid for our type.
+ */
+ public void validate_now()
+ {
+ check_dated();
+ }
+
+ /**
+ * A store calls back here in order to force a disconnect.
+ * After this is done, the object should be considered invalid.
+ * Any attempt to access or set a value should result in an
+ * exception.
+ *
+ * Note that this is how we handle deletions and xsi:type changes.
+ */
+ public void disconnect_store()
+ {
+ assert((_flags & FLAG_STORE) != 0);
+ _flags |= FLAGS_DATED | FLAG_ORPHANED;
+ // do NOT null out _textsource, because we need it non-null for synchronization
+ }
+
+ /**
+ * A typestore user can create a new TypeStoreUser instance for
+ * a given element child name as long as you also pass the
+ * qname contained by the xsi:type attribute, if any.
+ *
+ * Note that we will ignore the xsiType if it turns out to be invalid.
+ *
+ * Returns null if there is no strongly typed information for that
+ * given element (which implies, recusively, no strongly typed information
+ * downwards).
+ */
+ public TypeStoreUser create_element_user(QName eltName, QName xsiType)
+ {
+ return
+ (TypeStoreUser)
+ ((SchemaTypeImpl) schemaType()).createElementType(
+ eltName, xsiType, get_store().get_schematypeloader() );
+
+ /*
+ SchemaTypeImpl stype = (SchemaTypeImpl)schemaType().getElementType(eltName, xsiType, get_store().get_schematypeloader());
+ if (stype == null)
+ return null;
+ return (TypeStoreUser)stype.createUnattachedNode();
+ */
+ }
+
+ /**
+ * A typestore user can create a new TypeStoreUser instance for
+ * a given attribute child, based on the attribute name.
+ *
+ * Returns null if there is no strongly typed information for that
+ * given attributes.
+ */
+ public TypeStoreUser create_attribute_user(QName attrName)
+ {
+ return (TypeStoreUser)((SchemaTypeImpl)schemaType()).createAttributeType(attrName, get_store().get_schematypeloader());
+ }
+
+ public SchemaType get_schema_type()
+ {
+ return schemaType();
+ }
+
+ public SchemaType get_element_type(QName eltName, QName xsiType)
+ {
+ return schemaType().getElementType(
+ eltName, xsiType, get_store().get_schematypeloader() );
+ }
+
+ public SchemaType get_attribute_type(QName attrName)
+ {
+ return schemaType().getAttributeType(
+ attrName, get_store().get_schematypeloader() );
+ }
+
+ /**
+ * Returns the default element text, if it's consistent. If it's
+ * not consistent, returns null, and requires a visitor walk.
+ *
+ * Also returns null if there is no default at all (although
+ * that can also be discovered via get_elementflags without
+ * doing a walk).
+ */
+ public String get_default_element_text(QName eltName)
+ {
+ assert(_isComplexContent());
+ if (!_isComplexContent())
+ throw new IllegalStateException();
+
+ SchemaProperty prop = schemaType().getElementProperty(eltName);
+ if (prop == null)
+ return "";
+ return prop.getDefaultText();
+ }
+
+ /**
+ * Returns the default attribute text for the attribute with
+ * the given name, or null if no default.
+ */
+ public String get_default_attribute_text(QName attrName)
+ {
+ assert(_isComplexType());
+ if (!_isComplexType())
+ throw new IllegalStateException();
+
+ SchemaProperty prop = schemaType().getAttributeProperty(attrName);
+ if (prop == null)
+ return "";
+ return prop.getDefaultText();
+ }
+
+ /**
+ * Returns the elementflags, if they're consistent. If they're
+ * not, returns -1, and requires a vistor walk.
+ */
+ public int get_elementflags(QName eltName)
+ {
+ if (!_isComplexContent())
+ return 0;
+
+ SchemaProperty prop = schemaType().getElementProperty(eltName);
+ if (prop == null)
+ return 0;
+ if (prop.hasDefault() == SchemaProperty.VARIABLE ||
+ prop.hasFixed() == SchemaProperty.VARIABLE ||
+ prop.hasNillable() == SchemaProperty.VARIABLE)
+ return -1;
+ return
+ (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) |
+ (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED) |
+ (prop.hasNillable() == SchemaProperty.NEVER ? 0 : TypeStore.NILLABLE);
+ }
+
+ /**
+ * Returns the flags for the given attribute.
+ */
+ public int get_attributeflags(QName attrName)
+ {
+ if (!_isComplexType())
+ return 0;
+ SchemaProperty prop = schemaType().getAttributeProperty(attrName);
+ if (prop == null)
+ return 0;
+ return
+ (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) |
+ (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED);
+ // BUGBUG: todo: hook up required?
+ }
+
+ /**
+ * Returns false if child elements are insensitive to order;
+ * if it returns true, you're required to call invalidate_element_order
+ * on children to the right of any child order rearrangement.
+ */
+ public boolean is_child_element_order_sensitive()
+ {
+ if (!_isComplexType())
+ return false;
+ return schemaType().isOrderSensitive();
+ }
+
+ /**
+ * Inserting a new element is always unambiguous except in one
+ * situation: when adding an element after the last one with
+ * that name (or the first one if there are none).
+ *
+ * In that case, add the element at the first possible slot
+ * BEFORE any element whose qname is contained in the QNameSet
+ * given. (If the QNameSet is empty, that means add the new
+ * element at the very end.)
+ *
+ * If the returned QNameSet is null, treat it as if the QNameSet
+ * contained all QNames, i.e., add the new element at the very
+ * first position possible (adjacent to the last element of the
+ * same name, or at the very first slot if it is the first elt
+ * with that name).
+ */
+ public final QNameSet get_element_ending_delimiters(QName eltname)
+ {
+ SchemaProperty prop = schemaType().getElementProperty(eltname);
+ if (prop == null)
+ return null;
+ return prop.getJavaSetterDelimiter();
+ }
+
+ /**
+ * A typestore user can return a visitor that is used to compute
+ * default text and elementflags for an arbitrary element.
+ */
+ public TypeStoreVisitor new_visitor()
+ {
+ if (!_isComplexContent())
+ return null;
+ return new SchemaTypeVisitorImpl(schemaType().getContentModel());
+ }
+
+ public SchemaField get_attribute_field(QName attrName)
+ {
+ SchemaAttributeModel model = schemaType().getAttributeModel();
+ if (model == null)
+ return null;
+ return model.getAttribute(attrName);
+ }
+
+
+ /**
+ * Setting a string preserves any noncanonical literal
+ * representation. This is done by storing the actual
+ * string in the underlying store after checking it
+ * against the primitive type for validity.
+ */
+ protected void set_String(String v)
+ {
+ if ((_flags & FLAG_IMMUTABLE) != 0)
+ throw new IllegalStateException();
+
+ boolean wasNilled = ((_flags & FLAG_NIL) != 0);
+
+ // update the underlying value from the string
+ String wscanon = apply_wscanon(v);
+ update_from_wscanon_text(wscanon);
+
+ // Now store the literal text immediately in the underlying
+ if ((_flags & FLAG_STORE) != 0)
+ {
+ _flags &= ~FLAG_VALUE_DATED;
+ get_store().store_text(v);
+ if (wasNilled)
+ get_store().invalidate_nil();
+ }
+ else
+ _textsource = v;
+ }
+
+ /**
+ * Update the value based on complex content.
+ */
+ protected void update_from_complex_content()
+ {
+ throw new XmlValueOutOfRangeException();
+ }
+
+ /**
+ * Utility to update the value based on a string that
+ * was passed either from the text store or from the user.
+ * This function handles the cases where there is a default
+ * that must be applied, and where the value must match
+ * a fixed value.
+ */
+ private final void update_from_wscanon_text(String v)
+ {
+ // Whitespace is default if this type treats this space as defaultable
+ if ((_flags & FLAG_HASDEFAULT) != 0 && (_flags & FLAG_SETTINGDEFAULT) == 0)
+ {
+ // This isn't quite correct since the .equals("") test should be
+ // done on the actual text, not the wscanon text
+ if ((_flags & FLAG_ATTRIBUTE) == 0 && v.equals(""))
+ {
+ String def = get_store().compute_default_text();
+ if (def == null)
+ throw new XmlValueOutOfRangeException();
+
+ // protect against recursion with this flag
+ _flags |= FLAG_SETTINGDEFAULT;
+ try { this.set(def); }
+ finally { _flags &= ~FLAG_SETTINGDEFAULT; }
+ _flags &= ~FLAG_NIL;
+ _flags |= FLAG_ISDEFAULT;
+ return;
+ }
+ }
+ // If we haven't returned yet, the default doesn't apply.
+
+ // Ask underlying impl to parse ordinary non-default text
+ set_text(v);
+ _flags &= ~(FLAG_NIL | FLAG_ISDEFAULT);
+ }
+
+ /**
+ * Types should return false if they don't treat the given
+ * whitespace as a default value.
+ */
+ protected boolean is_defaultable_ws(String v)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the whitespace rule that will be applied before
+ * building a string to pass to get_text().
+ *
+ * Overridden by subclasses that don't need their text
+ * for set_text canonicalized; perhaps they already implement
+ * scanners that can deal with whitespace, and they know
+ * they have no regex pattern restrictions.
+ */
+ protected int get_wscanon_rule()
+ {
+ return SchemaType.WS_COLLAPSE;
+ }
+
+ /**
+ * Called to canonicalize whitespace before calling set_text.
+ *
+ * Tries to avoid allocation when the string is already canonical, but
+ * otherwise this is not particularly efficient. Hopefully the common
+ * case is that we pass our wscanon rule to the store via fetch_text
+ * and it's canonicalized before we even see it as a string.
+ */
+ private final String apply_wscanon(String v)
+ {
+ return XmlWhitespace.collapse(v, get_wscanon_rule());
+ }
+
+ /**
+ * Called before every set and get, to ensure that we have
+ * a correct picture of whether we're nillable, fixed, or
+ * if we have a default that can be applied.
+ */
+ private final void check_element_dated()
+ {
+ if ((_flags & FLAG_ELEMENT_DATED) != 0 &&
+ (_flags & FLAG_NOT_VARIABLE) == 0)
+ {
+ if ((_flags & FLAG_ORPHANED) != 0)
+ throw new XmlValueDisconnectedException();
+
+ int eltflags = get_store().compute_flags();
+ // int eltflags = 0;
+ _flags &= ~(FLAGS_ELEMENT | FLAG_ELEMENT_DATED);
+ _flags |= eltflags;
+ }
+ if ((_flags & FLAG_NOT_VARIABLE) != 0)
+ _flags &= ~(FLAG_ELEMENT_DATED);
+ }
+
+ /**
+ * Describes the orphaned status of this object.
+ */
+ protected final boolean is_orphaned()
+ {
+ return (_flags & FLAG_ORPHANED) != 0;
+ }
+
+ /**
+ * Called before every getter and setter on the strongly
+ * typed classes to ensure that the object has not been
+ * orphaned.
+ */
+ protected final void check_orphaned()
+ {
+ if (is_orphaned())
+ throw new XmlValueDisconnectedException();
+ }
+
+ /**
+ * Called prior to every get operation, to ensure
+ * that the value being read is valid. If the value
+ * has been invalidated, it is re-read from the underlying
+ * text store, and this may cause an out of range exception.
+ *
+ * This method deals with nils, nillability, defaults, etc.
+ */
+ public final void check_dated()
+ {
+ if ((_flags & FLAGS_DATED) != 0)
+ {
+ if ((_flags & FLAG_ORPHANED) != 0)
+ throw new XmlValueDisconnectedException();
+
+ assert((_flags & FLAG_STORE) != 0);
+
+ check_element_dated();
+
+ if ((_flags & FLAG_ELEMENT_DATED) != 0)
+ {
+ int eltflags = get_store().compute_flags();
+ _flags &= ~(FLAGS_ELEMENT | FLAG_ELEMENT_DATED);
+ _flags |= eltflags;
+ }
+
+ boolean nilled = false;
+
+ if ((_flags & FLAG_NIL_DATED) != 0)
+ {
+ if (get_store().find_nil())
+ {
+ if ((_flags & FLAG_NILLABLE) == 0)
+ throw new XmlValueOutOfRangeException(); // nil not allowed
+
+ // let the implementation know that we're nil now
+ set_nil();
+
+ _flags |= FLAG_NIL;
+ nilled = true;
+ }
+ else
+ {
+ _flags &= ~FLAG_NIL;
+ }
+ _flags &= ~FLAG_NIL_DATED;
+ }
+
+ if (!nilled)
+ {
+ String text;
+
+ if ((_flags & FLAG_COMPLEXCONTENT) != 0 || (text = get_wscanon_text()) == null)
+ update_from_complex_content();
+ else
+ {
+ NamespaceContext.push(new NamespaceContext(get_store()));
+ try { update_from_wscanon_text(text); }
+ finally { NamespaceContext.pop(); }
+ }
+ }
+
+ _flags &= ~FLAG_VALUE_DATED;
+ }
+ }
+
+ /**
+ * Called before every set operation (except for the
+ * special case of setting a string) to:
+ * (1) get the nillable, fixed, etc flags
+ * (2) throw an exception if it's fixed (not for strings)
+ */
+ private final void set_prepare()
+ {
+ check_element_dated();
+ if ((_flags & FLAG_IMMUTABLE) != 0)
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Called after every set operation to invalidate
+ * the attached raw text. Also, if we were dated,
+ * we make a note that we're now current, since the
+ * latest set beats the previous invalidate. Also,
+ * if we were nil, we're no longer.
+ */
+ private final void set_commit()
+ {
+ boolean wasNilled = ((_flags & FLAG_NIL) != 0);
+ _flags &= ~(FLAG_NIL | FLAG_ISDEFAULT);
+
+ if ((_flags & FLAG_STORE) != 0)
+ {
+ _flags &= ~(FLAGS_DATED);
+ get_store().invalidate_text();
+ if (wasNilled)
+ get_store().invalidate_nil();
+ }
+ else
+ {
+ _textsource = null;
+ }
+ }
+
+ /**
+ * Grabs the undelying litral representation, applying the
+ * implementation's wscanon rule.
+ * Null if not simple content.
+ */
+ public final String get_wscanon_text()
+ {
+ if ((_flags & FLAG_STORE) == 0)
+ {
+ return apply_wscanon((String)_textsource);
+ }
+ else return get_store().fetch_text(get_wscanon_rule());
+ }
+
+ /**
+ * This should set the value of the type from text,
+ * or throw an XmlValueOutOfRangeException if it can't.
+ */
+ abstract protected void set_text(String text);
+
+ /**
+ * This should clear the value, and set it to whatever
+ * is supposed to be returned when the value is nilled.
+ */
+ abstract protected void set_nil();
+
+ /**
+ * This should return the canonical string value of the primitive.
+ * Only called when non-nil.
+ */
+ abstract protected String compute_text(NamespaceManager nsm);
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+
+ // numerics: fractional
+ public float floatValue()
+ { BigDecimal bd = bigDecimalValue(); return bd == null ? 0.0f : bd.floatValue(); }
+ public double doubleValue()
+ { BigDecimal bd = bigDecimalValue(); return bd == null ? 0.0 : bd.doubleValue(); }
+ public BigDecimal bigDecimalValue()
+ { throw new XmlValueOutOfRangeException(); }
+
+ // numerics: integral
+ public BigInteger bigIntegerValue()
+ { BigDecimal bd = bigDecimalValue(); return bd == null ? null : bd.toBigInteger(); }
+
+ public byte byteValue()
+ {
+ long l = intValue();
+ if (l > Byte.MAX_VALUE) throw new XmlValueOutOfRangeException();
+ if (l < Byte.MIN_VALUE) throw new XmlValueOutOfRangeException();
+ return (byte)l;
+ }
+
+ public short shortValue()
+ {
+ long l = intValue();
+ if (l > Short.MAX_VALUE) throw new XmlValueOutOfRangeException();
+ if (l < Short.MIN_VALUE) throw new XmlValueOutOfRangeException();
+ return (short)l;
+ }
+
+ public int intValue()
+ {
+ long l = longValue();
+ if (l > Integer.MAX_VALUE) throw new XmlValueOutOfRangeException();
+ if (l < Integer.MIN_VALUE) throw new XmlValueOutOfRangeException();
+ return (int)l;
+ }
+ private static final BigInteger _max = BigInteger.valueOf(Long.MAX_VALUE);
+ private static final BigInteger _min = BigInteger.valueOf(Long.MIN_VALUE);
+
+ public long longValue()
+ {
+ BigInteger b = bigIntegerValue();
+ if (b == null) return 0L;
+ if (b.compareTo(_max) >= 0) throw new XmlValueOutOfRangeException();
+ if (b.compareTo(_min) <= 0) throw new XmlValueOutOfRangeException();
+ return b.longValue();
+ }
+
+ private static final XmlOptions _toStringOptions =
+ buildInnerPrettyOptions();
+
+ static final XmlOptions buildInnerPrettyOptions()
+ {
+ XmlOptions options = new XmlOptions();
+ options.put( XmlOptions.SAVE_INNER );
+ options.put( XmlOptions.SAVE_PRETTY_PRINT );
+ options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
+ options.put( XmlOptions.SAVE_USE_DEFAULT_NAMESPACE );
+ return options;
+ }
+
+ /*
+ private static final void dumpStack ( String msg )
+ {
+ try
+ {
+ java.io.FileOutputStream fos = new java.io.FileOutputStream( "C:\\ee.txt", true );
+ java.io.PrintStream ps = new java.io.PrintStream( fos );
+ ps.println( "======================================" );
+ ps.println( msg );
+ new Exception().printStackTrace( ps );
+ ps.close();
+ fos.close();
+ }
+ catch ( Exception e )
+ {
+ }
+
+ }
+ */
+
+ public final String toString( )
+ {
+ synchronized (monitor())
+ {
+ return ensureStore().xmlText(_toStringOptions);
+ }
+ }
+
+ public String xmlText()
+ {
+ return xmlText(null);
+ }
+
+ public String xmlText (XmlOptions options)
+ {
+ XmlCursor cur = newCursorForce();
+
+ try
+ {
+ return cur.xmlText(makeInnerOptions(options));
+ }
+ finally
+ {
+ cur.dispose();
+ }
+ }
+
+ // enums
+ public StringEnumAbstractBase enumValue()
+ { throw new XmlValueOutOfRangeException(); }
+
+ // various
+ public String stringValue()
+ {
+ // Since complex-content types don't have a "natural" string value, we
+ // emit the deeply concatenated, tag-removed content of the tag.
+ synchronized (monitor())
+ {
+ if (_isComplexContent())
+ return get_store().fetch_text(TypeStore.WS_PRESERVE);
+
+ check_dated();
+ if ((_flags & FLAG_NIL) != 0)
+ return null;
+ return compute_text(has_store() ? get_store() : null);
+ }
+ }
+
+ public String getStringValue()
+ { return stringValue(); }
+ public boolean getBooleanValue()
+ { return booleanValue(); }
+ public byte getByteValue()
+ { return byteValue(); }
+ public short getShortValue()
+ { return shortValue(); }
+ public int getIntValue()
+ { return intValue(); }
+ public long getLongValue()
+ { return longValue(); }
+ public BigInteger getBigIntegerValue()
+ { return bigIntegerValue(); }
+ public BigDecimal getBigDecimalValue()
+ { return bigDecimalValue(); }
+ public float getFloatValue()
+ { return floatValue(); }
+ public double getDoubleValue()
+ { return doubleValue(); }
+ public byte[] getByteArrayValue()
+ { return byteArrayValue(); }
+ public StringEnumAbstractBase getEnumValue()
+ { return enumValue(); }
+ public Calendar getCalendarValue()
+ { return calendarValue(); }
+ public Date getDateValue()
+ { return dateValue(); }
+ public GDate getGDateValue()
+ { return gDateValue(); }
+ public GDuration getGDurationValue()
+ { return gDurationValue(); }
+ public QName getQNameValue()
+ { return qNameValue(); }
+ public List xgetListValue()
+ { return xlistValue(); }
+ public List getListValue()
+ { return listValue(); }
+ public Object getObjectValue()
+ { return objectValue(); }
+
+ public void setStringValue(String obj)
+ { set(obj); }
+ public void setBooleanValue(boolean v)
+ { set(v); }
+ public void setByteValue(byte v)
+ { set(v); }
+ public void setShortValue(short v)
+ { set(v); }
+ public void setIntValue(int v)
+ { set(v); }
+ public void setLongValue(long v)
+ { set(v); }
+ public void setBigIntegerValue(BigInteger obj)
+ { set(obj); }
+ public void setBigDecimalValue(BigDecimal obj)
+ { set(obj); }
+ public void setFloatValue(float v)
+ { set(v); }
+ public void setDoubleValue(double v)
+ { set(v); }
+ public void setByteArrayValue(byte[] obj)
+ { set(obj); }
+ public void setEnumValue(StringEnumAbstractBase obj)
+ { set(obj); }
+ public void setCalendarValue(Calendar obj)
+ { set(obj); }
+ public void setDateValue(Date obj)
+ { set(obj); }
+ public void setGDateValue(GDate obj)
+ { set(obj); }
+ public void setGDurationValue(GDuration obj)
+ { set(obj); }
+ public void setQNameValue(QName obj)
+ { set(obj); }
+ public void setListValue(List obj)
+ { set(obj); }
+ public void setObjectValue(Object obj)
+ { objectSet(obj); }
+
+ public byte[] byteArrayValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public boolean booleanValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public GDate gDateValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public Date dateValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public Calendar calendarValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public GDuration gDurationValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public QName qNameValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public List listValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public List xlistValue()
+ { throw new XmlValueOutOfRangeException(); }
+ public Object objectValue()
+ { return java_value(this); }
+
+ // set this value
+ public final void set(boolean v)
+ { synchronized (monitor()) { set_prepare(); set_boolean(v); set_commit(); } }
+ public final void set(byte v)
+ { synchronized (monitor()) { set_prepare(); set_byte(v); set_commit(); } }
+ public final void set(short v)
+ { synchronized (monitor()) { set_prepare(); set_short(v); set_commit(); } }
+ public final void set(int v)
+ { synchronized (monitor()) { set_prepare(); set_int(v); set_commit(); } }
+ public final void set(long v)
+ { synchronized (monitor()) { set_prepare(); set_long(v); set_commit(); } }
+ public final void set(float v)
+ { synchronized (monitor()) { set_prepare(); set_float(v); set_commit(); } }
+ public final void set(double v)
+ { synchronized (monitor()) { set_prepare(); set_double(v); set_commit(); } }
+ public final void set(byte[] obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_ByteArray(obj); set_commit(); } } }
+ public final void set(StringEnumAbstractBase obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_enum(obj); set_commit(); } } }
+ public final void set(BigInteger obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_BigInteger(obj); set_commit(); } } }
+ public final void set(BigDecimal obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_BigDecimal(obj); set_commit(); } } }
+ public final void set(Calendar obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_Calendar(obj); set_commit(); } } }
+ public final void set(Date obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_Date(obj); set_commit(); } } }
+ public final void set(GDateSpecification obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_GDate(obj); set_commit(); } } }
+ public final void set(GDurationSpecification obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_GDuration(obj); set_commit(); } } }
+ public final void set(QName obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_QName(obj); set_commit(); } } }
+ public final void set(List obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_list(obj); set_commit(); } } }
+ public final void set(String obj)
+ { if (obj == null) setNil(); else { synchronized (monitor()) { set_prepare(); set_String(obj); /* strings are special, so set_String does its own commit.*/ } } }
+
+ public void objectSet(Object o)
+ {
+ if (o == null)
+ {
+ setNil();
+ return;
+ }
+
+ if (o instanceof XmlObject)
+ set( (XmlObject) o );
+ else if (o instanceof String)
+ set( (String) o );
+ else if (o instanceof StringEnumAbstractBase)
+ set( (StringEnumAbstractBase) o );
+ else if (o instanceof BigInteger)
+ set( (BigInteger) o );
+ else if (o instanceof BigDecimal)
+ set( (BigDecimal) o );
+ else if (o instanceof Byte)
+ set( ((Byte)o).byteValue() );
+ else if (o instanceof Short)
+ set( ((Short)o).shortValue() );
+ else if (o instanceof Integer)
+ set( ((Integer)o).intValue() );
+ else if (o instanceof Long)
+ set( ((Long)o).longValue() );
+ else if (o instanceof Boolean)
+ set( ((Boolean)o).booleanValue() );
+ else if (o instanceof Float)
+ set( ((Float)o).floatValue() );
+ else if (o instanceof Double)
+ set( ((Double)o).doubleValue() );
+ else if (o instanceof Calendar)
+ set( ((Calendar)o) );
+ else if (o instanceof Date)
+ set( (Date) o );
+ else if (o instanceof GDateSpecification)
+ set( (GDateSpecification) o );
+ else if (o instanceof GDurationSpecification)
+ set( (GDurationSpecification) o );
+ else if (o instanceof QName)
+ set( (QName) o );
+ else if (o instanceof List)
+ set( (List) o );
+ else if (o instanceof byte[])
+ set( (byte[]) o );
+ else
+ {
+ throw
+ new XmlValueOutOfRangeException(
+ "Can't set union object of class : " +
+ o.getClass().getName() );
+ }
+ }
+
+ public final void set_newValue(XmlObject obj)
+ {
+ if (obj == null || obj.isNil())
+ {
+ setNil();
+ return;
+ }
+
+ primitive:
+ if (obj instanceof XmlAnySimpleType)
+ {
+ XmlAnySimpleType v = (XmlAnySimpleType)obj;
+ SchemaType instanceType = ((SimpleValue)v).instanceType();
+ assert(instanceType != null) : "Nil case should have been handled already";
+
+ // handle lists
+ if (instanceType.getSimpleVariety() == SchemaType.LIST)
+ {
+ synchronized (monitor())
+ {
+ set_prepare();
+ set_list(((SimpleValue)v).xgetListValue());
+ set_commit();
+ return;
+ }
+ }
+
+ // handle atomic types
+ synchronized (monitor())
+ {
+ assert(instanceType.getSimpleVariety() == SchemaType.ATOMIC);
+ switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
+ {
+ default:
+ assert(false) : "encountered nonprimitive type.";
+ // case SchemaType.BTC_ANY_SIMPLE: This is handled below...
+ // but we eventually want to handle it with a treecopy, so
+ // eventually we should break here.
+ break primitive;
+
+ case SchemaType.BTC_BOOLEAN:
+ {
+ boolean bool = ((SimpleValue)v).getBooleanValue();
+ set_prepare();
+ set_boolean(bool);
+ break;
+ }
+ case SchemaType.BTC_BASE_64_BINARY:
+ {
+ byte[] byteArr = ((SimpleValue)v).getByteArrayValue();
+ set_prepare();
+ set_b64(byteArr);
+ break;
+ }
+ case SchemaType.BTC_HEX_BINARY:
+ {
+ byte[] byteArr = ((SimpleValue)v).getByteArrayValue();
+ set_prepare();
+ set_hex(byteArr);
+ break;
+ }
+ case SchemaType.BTC_QNAME:
+ {
+ QName name = ((SimpleValue)v).getQNameValue();
+ set_prepare();
+ set_QName(name);
+ break;
+ }
+ case SchemaType.BTC_FLOAT:
+ {
+ float f = ((SimpleValue)v).getFloatValue();
+ set_prepare();
+ set_float(f);
+ break;
+ }
+ case SchemaType.BTC_DOUBLE:
+ {
+ double d = ((SimpleValue)v).getDoubleValue();
+ set_prepare();
+ set_double(d);
+ break;
+ }
+ case SchemaType.BTC_DECIMAL:
+ {
+ switch (instanceType.getDecimalSize())
+ {
+ case SchemaType.SIZE_BYTE:
+ {
+ byte b = ((SimpleValue)v).getByteValue();
+ set_prepare();
+ set_byte(b);
+ break;
+ }
+ case SchemaType.SIZE_SHORT:
+ {
+ short s = ((SimpleValue)v).getShortValue();
+ set_prepare();
+ set_short(s);
+ break;
+ }
+ case SchemaType.SIZE_INT:
+ {
+ int i = ((SimpleValue)v).getIntValue();
+ set_prepare();
+ set_int(i);
+ break;
+ }
+ case SchemaType.SIZE_LONG:
+ {
+ long l = ((SimpleValue)v).getLongValue();
+ set_prepare();
+ set_long(l);
+ break;
+ }
+ case SchemaType.SIZE_BIG_INTEGER:
+ {
+ BigInteger bi = ((SimpleValue)v).getBigIntegerValue();
+ set_prepare();
+ set_BigInteger(bi);
+ break;
+ }
+ default:
+ {
+ assert(false) : "invalid numeric bit count";
+ // fallthrough
+ }
+ case SchemaType.SIZE_BIG_DECIMAL:
+ {
+ BigDecimal bd = ((SimpleValue)v).getBigDecimalValue();
+ set_prepare();
+ set_BigDecimal(bd);
+ break;
+ }
+ }
+ break;
+ }
+ case SchemaType.BTC_ANY_URI:
+ {
+ String uri = v.getStringValue();
+ set_prepare();
+ set_text(uri);
+ break;
+ }
+ case SchemaType.BTC_NOTATION:
+ {
+ String s = v.getStringValue();
+ set_prepare();
+ set_notation(s);
+ break;
+ }
+ case SchemaType.BTC_DURATION:
+ {
+ GDuration gd = ((SimpleValue)v).getGDurationValue();
+ set_prepare();
+ set_GDuration(gd);
+ break;
+ }
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ {
+ GDate gd = ((SimpleValue)v).getGDateValue();
+ set_prepare();
+ set_GDate(gd);
+ break;
+ }
+ case SchemaType.BTC_STRING:
+ {
+ String s = v.getStringValue();
+ set_prepare();
+ set_String(s);
+ break;
+ }
+ case SchemaType.BTC_ANY_SIMPLE:
+ {
+ boolean pushed = false;
+ if (!v.isImmutable())
+ {
+ pushed = true;
+ NamespaceContext.push(new NamespaceContext(v));
+ }
+ try
+ {
+ set_prepare();
+ set_xmlanysimple(v);
+ }
+ finally
+ {
+ if (pushed)
+ NamespaceContext.pop();
+ }
+ break;
+ }
+ }
+ set_commit();
+ return; // primitive node tree copy handled.
+ }
+ }
+
+ throw new IllegalStateException("Complex type unexpected");
+ }
+
+ private TypeStoreUser setterHelper ( XmlObjectBase src )
+ {
+ check_orphaned();
+
+ src.check_orphaned();
+
+ return
+ get_store().copy_contents_from( src.get_store() ).
+ get_store().change_type( src.schemaType() );
+ }
+
+ public final XmlObject set(XmlObject src)
+ {
+ if (isImmutable())
+ throw new IllegalStateException("Cannot set the value of an immutable XmlObject");
+
+ XmlObjectBase obj = underlying(src);
+
+ TypeStoreUser newObj = this;
+
+ if (obj == null)
+ {
+ setNil();
+ return this;
+ }
+
+ if (obj.isImmutable())
+ set(obj.stringValue());
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ if (monitor() == obj.monitor())
+ {
+ synchronized (monitor())
+ {
+ newObj = setterHelper( obj );
+ }
+ }
+ else
+ {
+ // about to grab two locks: don't deadlock ourselves
+ GlobalLock.acquire();
+ acquired = true;
+
+ synchronized (monitor())
+ {
+ synchronized (obj.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ newObj = setterHelper( obj );
+ }
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+
+ return (XmlObject) newObj;
+ }
+
+ protected void set_list(List list)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_boolean(boolean v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_byte(byte v)
+ { set_int((int) v); }
+ protected void set_short(short v)
+ { set_int((int) v); }
+ protected void set_int(int v)
+ { set_long((long) v); }
+ protected void set_long(long v)
+ { set_BigInteger(BigInteger.valueOf(v)); }
+ protected void set_char(char v)
+ { set_String(Character.toString(v)); }
+ protected void set_float(float v)
+ { set_BigDecimal(new BigDecimal(v)); }
+ protected void set_double(double v)
+ { set_BigDecimal(new BigDecimal(v)); }
+
+ protected void set_enum(StringEnumAbstractBase e)
+ { throw new XmlValueOutOfRangeException(); }
+
+ protected void set_ByteArray(byte[] b)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_b64(byte[] b)
+ { set_ByteArray(b); }
+ protected void set_hex(byte[] b)
+ { set_ByteArray(b); }
+ protected void set_BigInteger(BigInteger v)
+ { set(new BigDecimal(v)); }
+ protected void set_BigDecimal(BigDecimal v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_Date(Date v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_Calendar(Calendar v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_GDate(GDateSpecification v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_GDuration(GDurationSpecification v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_ComplexXml(XmlObject v)
+ { throw new XmlValueOutOfRangeException(); }
+ protected void set_QName(QName v)
+ { throw new XmlValueOutOfRangeException(); }
+
+ protected void set_notation(String v)
+ { throw new XmlValueOutOfRangeException(); }
+
+ protected void set_xmlanysimple(XmlAnySimpleType v)
+ { set_String(v.getStringValue()); }
+
+ private final boolean comparable_value_spaces(SchemaType t1, SchemaType t2)
+ {
+ assert(t1.getSimpleVariety() != SchemaType.UNION && t2.getSimpleVariety() != SchemaType.UNION);
+
+ if (!t1.isSimpleType() && !t2.isSimpleType())
+ return (t1.getContentType() == t2.getContentType());
+
+ if (!t1.isSimpleType() || !t2.isSimpleType())
+ return false;
+
+ if (t1.getSimpleVariety() == SchemaType.LIST && t2.getSimpleVariety() == SchemaType.LIST)
+ return true;
+
+ if (t1.getSimpleVariety() == SchemaType.LIST || t2.getSimpleVariety() == SchemaType.LIST)
+ return false;
+
+ return (t1.getPrimitiveType().equals(t2.getPrimitiveType()));
+ }
+
+ private final boolean valueEqualsImpl(XmlObject xmlobj)
+ {
+ check_dated();
+
+ SchemaType typethis = instanceType();
+ SchemaType typeother = ((SimpleValue)xmlobj).instanceType();
+
+ if (typethis == null && typeother == null) // detects nil
+ return true;
+
+ if (typethis == null || typeother == null)
+ return false;
+
+ if (!comparable_value_spaces(typethis, typeother))
+ return false;
+
+ if (xmlobj.schemaType().getSimpleVariety() == SchemaType.UNION)
+ return (underlying(xmlobj)).equal_to(this);
+
+ return equal_to(xmlobj);
+ }
+
+ public final boolean valueEquals(XmlObject xmlobj)
+ {
+ boolean acquired = false;
+ try
+ {
+ if (isImmutable())
+ {
+ if (xmlobj.isImmutable())
+ {
+ return valueEqualsImpl(xmlobj);
+ }
+ else
+ {
+ synchronized (xmlobj.monitor())
+ {
+ return valueEqualsImpl(xmlobj);
+ }
+ }
+ }
+ else
+ {
+ if (xmlobj.isImmutable() || monitor() == xmlobj.monitor())
+ {
+ synchronized (monitor())
+ {
+ return valueEqualsImpl(xmlobj);
+ }
+ }
+ else
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized (monitor())
+ {
+ synchronized (xmlobj.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+ return valueEqualsImpl(xmlobj);
+ }
+ }
+ }
+ }
+
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+
+ /**
+ * Implements Comparable. This compareTo is inconsistent with
+ * equals unless isImmutable() is true.
+ */
+ public final int compareTo(Object obj)
+ {
+ int result = compareValue((XmlObject)obj); // can throw ClassCast
+ if (result == 2)
+ throw new ClassCastException();
+ return result;
+ }
+
+ /**
+ * Allowed to return 2 for incomparable.
+ */
+ private final int compareValueImpl(XmlObject xmlobj)
+ {
+ SchemaType type1, type2;
+
+ try
+ {
+ type1 = instanceType();
+ type2 = ((SimpleValue)xmlobj).instanceType();
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ return 2;
+ }
+
+ if (type1 == null && type2 == null)
+ return 0;
+ if (type1 == null || type2 == null)
+ return 2;
+
+ if (!type1.isSimpleType() || type1.isURType())
+ return 2;
+
+ if (!type2.isSimpleType() || type2.isURType())
+ return 2;
+
+ type1 = type1.getPrimitiveType();
+ type2 = type2.getPrimitiveType();
+
+ // Different value spaces: different
+ if (type1.getBuiltinTypeCode() != type2.getBuiltinTypeCode())
+ return 2;
+
+ // now we'll depend on our impl class to do the work
+ return compare_to(xmlobj);
+ }
+
+ public final int compareValue(XmlObject xmlobj)
+ {
+ if (xmlobj == null)
+ return 2;
+
+ boolean acquired = false;
+ try
+ {
+ if (isImmutable())
+ {
+ if (xmlobj.isImmutable())
+ {
+ return compareValueImpl(xmlobj);
+ }
+ else
+ {
+ synchronized (xmlobj.monitor())
+ {
+ return compareValueImpl(xmlobj);
+ }
+ }
+ }
+ else
+ {
+ if (xmlobj.isImmutable() || monitor() == xmlobj.monitor())
+ {
+ synchronized (monitor())
+ {
+ return compareValueImpl(xmlobj);
+ }
+ }
+ else
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized (monitor())
+ {
+ synchronized (xmlobj.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+ return compareValueImpl(xmlobj);
+ }
+ }
+ }
+ }
+
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ /**
+ * This implementation of compare_to is allowed to do two
+ * unusual things:
+ * (1) it can assume that the xmlobj passed has a primitive
+ * type underlying the instance type that matches the
+ * current instance, and that neither is nil.
+ * (2) it is allowed to return 2 for "incomparable";
+ * it should not throw an exception.
+ */
+ protected int compare_to(XmlObject xmlobj)
+ {
+ if (equal_to(xmlobj))
+ return 0;
+ return 2;
+ }
+
+ protected abstract boolean equal_to(XmlObject xmlobj);
+
+ protected abstract int value_hash_code();
+
+ public int valueHashCode()
+ {
+ synchronized (monitor())
+ {
+ return value_hash_code();
+ }
+ }
+
+
+ public boolean isInstanceOf(SchemaType type)
+ {
+ SchemaType myType;
+
+ if (type.getSimpleVariety() != SchemaType.UNION)
+ {
+ for (myType = instanceType(); myType != null; myType = myType.getBaseType())
+ if (type == myType)
+ return true;
+ return false;
+ }
+ else
+ {
+ Set ctypes = new HashSet(Arrays.asList(type.getUnionConstituentTypes()));
+ for (myType = instanceType(); myType != null; myType = myType.getBaseType())
+ if (ctypes.contains(myType))
+ return true;
+ return false;
+ }
+ }
+
+ public final boolean equals(Object obj)
+ {
+ if (!isImmutable())
+ return super.equals(obj);
+
+ if (!(obj instanceof XmlObject))
+ return false;
+
+ XmlObject xmlobj = (XmlObject)obj;
+ if (!xmlobj.isImmutable())
+ return false;
+
+ return valueEquals(xmlobj);
+ }
+
+ public final int hashCode()
+ {
+ if (!isImmutable())
+ return super.hashCode();
+
+ synchronized (monitor())
+ {
+ if (isNil())
+ return 0;
+
+ return value_hash_code();
+ }
+ }
+
+ /**
+ * This method can writeReplace either an unwrapped XmlObjectBase
+ * or an XBean proxy. A "true" argument means unwrapped.
+ *
+ * The serialization strategy for XmlObjects is this:
+ *
+ * (1) Only the root XmlObject for a document actually gets
+ * fully serialized; it is serialized as a SerializedRootObject,
+ * which simply saves itself as XML text.
+ *
+ * (2) Interior XmlObjects get serialized as a reference to the
+ * root XmlObject for their document, plus an integer which
+ * indicates the position of the XmlObject within the owner
+ * document. This pair is stored as a SerializedInteriorObject.
+ *
+ * Both objects can be maked as wrapped or unwrapped. If wrapped,
+ * then the proxy is returned when deserializing; if unwrapped, then
+ * the proxy is stripped when deserializing.
+ */
+ public Object writeReplace()
+ {
+ synchronized (monitor())
+ {
+ if (isRootXmlObject())
+ return new SerializedRootObject(this);
+
+ return new SerializedInteriorObject(this, getRootXmlObject());
+ }
+ }
+
+ /**
+ * True if the object is at the root of the document.
+ */
+ private boolean isRootXmlObject()
+ {
+ XmlCursor cur = newCursor();
+ if (cur == null)
+ return false;
+
+ boolean result = !cur.toParent();
+ cur.dispose();
+ return result;
+ }
+
+ /**
+ * Gets the root XmlObject for this document.
+ */
+ private XmlObject getRootXmlObject()
+ {
+ XmlCursor cur = newCursor();
+ if (cur == null)
+ return this;
+ cur.toStartDoc();
+ XmlObject result = cur.getObject();
+ cur.dispose();
+ return result;
+ }
+
+ /**
+ * Serializable rewrite object that knows how to resolve
+ * to an XmlObjectBase or a proxy for the root object of
+ * a document.
+ */
+ private static class SerializedRootObject implements Serializable
+ {
+ private static final long serialVersionUID = 1;
+
+ transient Class _xbeanClass;
+ transient XmlObject _impl;
+
+ private SerializedRootObject()
+ {
+ }
+
+ private SerializedRootObject(XmlObject impl)
+ {
+ _xbeanClass = impl.schemaType().getJavaClass();
+ _impl = impl;
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ out.writeObject(_xbeanClass);
+ // the first short is written out for backwards compatibility
+ // it will always be zero for objects written with
+ // this code, but it used to be the first 2 bytes of the
+ // writeUTF() method
+ out.writeShort((short)0);
+ out.writeShort(MAJOR_VERSION_NUMBER);
+ out.writeShort(MINOR_VERSION_NUMBER);
+ // CR122401 - need to use writeObject instead of writeUTF
+ // for xmlText as writeUTF has a length limitation of
+ // 65535 bytes
+ String xmlText = _impl.xmlText();
+ out.writeObject(xmlText);
+ out.writeBoolean(false);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException
+ {
+ try
+ {
+ // read class object first - this is
+ // first just for historical reasons - really
+ // it would be better to have the version numbers
+ // first
+ _xbeanClass = (Class)in.readObject();
+
+ int utfBytes = in.readUnsignedShort();
+
+ // determine version numbers
+ // if utfBytes is non-zero then we default to 0.0
+ // otherwise expect major and minor version numbers
+ // to be next entries in stream
+ int majorVersionNum = 0;
+ int minorVersionNum = 0;
+ if (utfBytes == 0)
+ {
+ majorVersionNum = in.readUnsignedShort();
+ minorVersionNum = in.readUnsignedShort();
+ }
+
+ String xmlText = null;
+ switch (majorVersionNum)
+ {
+ case 0: // original, unnumbered version
+ // minorVersionNum is always zero
+ xmlText = readObjectV0(in, utfBytes);
+ in.readBoolean(); // ignored
+ break;
+
+ case 1:
+ switch (minorVersionNum)
+ {
+ case 1:
+ xmlText = (String)in.readObject();
+ in.readBoolean(); // ignored
+ break;
+
+ default:
+ throw new IOException("Deserialization error: " +
+ "version number " + majorVersionNum + "." +
+ minorVersionNum + " not supported.");
+ }
+ break;
+
+ default:
+ throw new IOException("Deserialization error: " +
+ "version number " + majorVersionNum + "." +
+ minorVersionNum + " not supported.");
+ }
+
+ XmlOptions opts = new XmlOptions().setDocumentType(XmlBeans.typeForClass(_xbeanClass));
+ _impl = XmlBeans.getContextTypeLoader().parse(xmlText, null, opts);
+ }
+ catch (Exception e)
+ {
+ throw (IOException)(new IOException(e.getMessage()).initCause(e));
+ }
+ }
+
+ // this method is for reading the UTF-8 String that used to be
+ // written out for a serialized XmlObject according to the
+ // original format before this fix, i.e. it expects it
+ // to have been written using the following algorithm:
+ //
+ // writeObject(Class object)
+ // writeUTF(xmlText of object as String)
+ // writeBoolean()
+ //
+ // this method is passed the original input stream positioned as though
+ // it had just read the class object plus the next 2 bytes. Those 2
+ // bytes are interpreted as an unsigned short saying how many more
+ // bytes there are representing the bytes of the UTF-8-formatted String;
+ // this value is passed in as the argument utfBytes
+ private String readObjectV0(ObjectInputStream in, int utfBytes)
+ throws IOException
+ {
+ // allow an extra 2 bytes up front for the unsigned short
+ byte[] bArray = new byte[utfBytes+2];
+
+ // for format of these first 2 bytes see
+ // Java API docs - DataOutputStream.writeShort()
+ bArray[0] = (byte)( 0xff & (utfBytes >> 8) );
+ bArray[1] = (byte)( 0xff & utfBytes );
+
+ // read the next numBytes bytes from the input stream
+ // into the byte array starting at offset 2; this may
+ // take multiple calls to read()
+ int totalBytesRead = 0;
+ int numRead;
+ while (totalBytesRead < utfBytes)
+ {
+ numRead =
+ in.read(bArray, 2+totalBytesRead, utfBytes-totalBytesRead);
+ if (numRead == -1) // reached end of stream
+ break;
+
+ totalBytesRead += numRead;
+ }
+
+ if (totalBytesRead != utfBytes)
+ {
+ throw new IOException("Error reading backwards compatible " +
+ "XmlObject: number of bytes read (" + totalBytesRead +
+ ") != number expected (" + utfBytes + ")" );
+ }
+
+ // now set up a DataInputStream to read those
+ // bytes as a UTF-8 String i.e. as though we'd never
+ // read the first 2 bytes from the original stream
+ DataInputStream dis = null;
+ String str = null;
+ try
+ {
+ dis = new DataInputStream(new ByteArrayInputStream(bArray));
+ str = dis.readUTF();
+ }
+ finally
+ {
+ if (dis != null)
+ dis.close();
+ }
+
+ return str;
+ }
+
+ private Object readResolve() throws ObjectStreamException
+ {
+ return _impl;
+ }
+ }
+
+ /**
+ * Serializable rewrite object that knows how to resolve
+ * to an XmlObjectBase or a proxy for an interior position
+ * within a document.
+ */
+ private static class SerializedInteriorObject implements Serializable
+ {
+ private static final long serialVersionUID = 1;
+
+ transient XmlObject _impl;
+ transient XmlObject _root;
+
+ private SerializedInteriorObject()
+ {
+ }
+
+ private SerializedInteriorObject(XmlObject impl, XmlObject root)
+ {
+ _impl = impl;
+ _root = root;
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ out.writeObject(_root);
+ out.writeBoolean(false);
+ out.writeInt(distanceToRoot());
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ _root = (XmlObject)in.readObject();
+ in.readBoolean();
+ _impl = objectAtDistance(in.readInt());
+ }
+
+ private Object readResolve() throws ObjectStreamException
+ {
+ return _impl;
+ }
+
+ private int distanceToRoot()
+ {
+ XmlCursor cur = _impl.newCursor();
+ int count = 0;
+ while (!cur.toPrevToken().isNone())
+ {
+ if (!cur.currentTokenType().isNamespace())
+ {
+ count += 1;
+ // System.out.println("Count: " + count + " " + cur.currentTokenType().toString() + " " + QName.pretty(cur.getName()));
+ }
+ }
+ cur.dispose();
+ return count;
+ }
+
+ private XmlObject objectAtDistance(int count)
+ {
+ XmlCursor cur = _root.newCursor();
+ while (count > 0)
+ {
+ cur.toNextToken();
+ if (!cur.currentTokenType().isNamespace())
+ {
+ count -= 1;
+ // System.out.println("Count: " + count + " " + cur.currentTokenType().toString() + " " + QName.pretty(cur.getName()));
+ }
+ }
+ XmlObject result = cur.getObject();
+ cur.dispose();
+ return result;
+ }
+ }
+
+ protected static Object java_value(XmlObject obj)
+ {
+ if (obj.isNil())
+ return null;
+
+ if (!(obj instanceof XmlAnySimpleType))
+ return obj;
+
+ SchemaType instanceType = ((SimpleValue)obj).instanceType();
+ assert(instanceType != null) : "Nil case should have been handled above";
+
+ // handle lists
+ if (instanceType.getSimpleVariety() == SchemaType.LIST)
+ return ((SimpleValue)obj).getListValue();
+
+ SimpleValue base = (SimpleValue)obj;
+
+ switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_BOOLEAN:
+ return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ return base.getByteArrayValue();
+
+ case SchemaType.BTC_QNAME:
+ return base.getQNameValue();
+
+ case SchemaType.BTC_FLOAT:
+ return new Float(base.getFloatValue());
+
+ case SchemaType.BTC_DOUBLE:
+ return new Double(base.getDoubleValue());
+
+ case SchemaType.BTC_DECIMAL:
+ {
+ switch (instanceType.getDecimalSize())
+ {
+ case SchemaType.SIZE_BYTE:
+ return new Byte(base.getByteValue());
+
+ case SchemaType.SIZE_SHORT:
+ return new Short(base.getShortValue());
+
+ case SchemaType.SIZE_INT:
+ return new Integer(base.getIntValue());
+
+ case SchemaType.SIZE_LONG:
+ return new Long(base.getLongValue());
+
+ case SchemaType.SIZE_BIG_INTEGER:
+ return base.getBigIntegerValue();
+
+ default:
+ assert(false) : "invalid numeric bit count";
+ // fallthrough
+ case SchemaType.SIZE_BIG_DECIMAL:
+ return base.getBigDecimalValue();
+ }
+ }
+ case SchemaType.BTC_ANY_URI:
+ return base.getStringValue();
+
+ case SchemaType.BTC_DURATION:
+ return base.getGDurationValue();
+
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ return base.getCalendarValue();
+
+ default:
+ assert(false) : "encountered nonprimitive type.";
+ // fallthrough
+
+ // NB: for string enums we just do java.lang.String
+ // when in the context of unions. It's easier on users.
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_ANY_SIMPLE:
+ // return base.getStringValue();
+ return base.getStringValue();
+ }
+ }
+
+ /**
+ * Called by code generated code to get the default attribute value
+ * for a given attribute name, or null if none.
+ */
+ protected XmlAnySimpleType get_default_attribute_value(QName name)
+ {
+ SchemaType sType = schemaType();
+ SchemaAttributeModel aModel = sType.getAttributeModel();
+ if (aModel == null)
+ return null;
+ SchemaLocalAttribute sAttr = aModel.getAttribute(name);
+ if (sAttr == null)
+ return null;
+ return sAttr.getDefaultValue();
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlPositiveIntegerImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlPositiveIntegerImpl.java
new file mode 100644
index 0000000..08b7f35
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlPositiveIntegerImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlPositiveInteger;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlPositiveIntegerImpl extends JavaIntegerHolderEx implements XmlPositiveInteger
+{
+ public XmlPositiveIntegerImpl()
+ { super(XmlPositiveInteger.type, false); }
+ public XmlPositiveIntegerImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameImpl.java
new file mode 100644
index 0000000..95062eb
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlQName;
+
+
+public class XmlQNameImpl extends JavaQNameHolder implements XmlQName
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameRestriction.java
new file mode 100644
index 0000000..34250e5
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlQNameRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlQName;
+
+public class XmlQNameRestriction extends JavaQNameHolderEx implements XmlQName
+{
+ public XmlQNameRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlShortImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlShortImpl.java
new file mode 100644
index 0000000..1fa2b7f
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlShortImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlShort;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlShortImpl extends JavaIntHolderEx implements XmlShort
+{
+ public XmlShortImpl()
+ { super(XmlShort.type, false); }
+ public XmlShortImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringEnumeration.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringEnumeration.java
new file mode 100644
index 0000000..b576a98
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringEnumeration.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlString;
+
+public class XmlStringEnumeration extends JavaStringEnumerationHolderEx implements XmlString
+{
+ public XmlStringEnumeration(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringImpl.java
new file mode 100644
index 0000000..ac0a782
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringImpl.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlString;
+
+
+public class XmlStringImpl extends JavaStringHolder implements XmlString
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringRestriction.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringRestriction.java
new file mode 100644
index 0000000..e54f670
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlStringRestriction.java
@@ -0,0 +1,25 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlString;
+
+public class XmlStringRestriction extends JavaStringHolderEx implements XmlString
+{
+ public XmlStringRestriction(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTimeImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTimeImpl.java
new file mode 100644
index 0000000..b11c3da
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTimeImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlTime;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlTimeImpl extends JavaGDateHolderEx implements XmlTime
+{
+ public XmlTimeImpl()
+ { super(XmlTime.type, false); }
+ public XmlTimeImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTokenImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTokenImpl.java
new file mode 100644
index 0000000..d6e78c8
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlTokenImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlToken;
+
+
+public class XmlTokenImpl extends JavaStringHolderEx implements XmlToken
+{
+ public XmlTokenImpl()
+ { super(XmlToken.type, false); }
+ public XmlTokenImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java
new file mode 100644
index 0000000..3264808
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java
@@ -0,0 +1,647 @@
+/* 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.xmlbeans.impl.values;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Calendar;
+import java.math.BigInteger;
+import java.math.BigDecimal;
+
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.StringEnumAbstractBase;
+import org.apache.xmlbeans.GDateSpecification;
+import org.apache.xmlbeans.GDurationSpecification;
+import org.apache.xmlbeans.SimpleValue;
+
+import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
+import org.apache.xmlbeans.impl.common.ValidationContext;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * This class implements simple union types.
+ *
+ */
+public class XmlUnionImpl extends XmlObjectBase implements XmlAnySimpleType
+{
+ public XmlUnionImpl(SchemaType type, boolean complex)
+ { _schemaType = type; initComplexType(complex, false); }
+
+ public SchemaType schemaType()
+ { return _schemaType; }
+
+ public SchemaType instanceType()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).instanceType(); }
+
+ private SchemaType _schemaType;
+ private XmlAnySimpleType _value; // underlying value
+ private String _textvalue = ""; // textual value
+
+
+
+
+ // SIMPLE VALUE ACCESSORS BELOW -------------------------------------------
+ // gets raw text value
+
+ protected String compute_text(NamespaceManager nsm)
+ { return _textvalue; }
+
+ protected boolean is_defaultable_ws(String v) {
+ try {
+ XmlAnySimpleType savedValue = _value;
+ set_text(v);
+
+ // restore the saved value
+ _value = savedValue;
+
+ return false;
+ }
+ catch (XmlValueOutOfRangeException e) {
+ return true;
+ }
+ }
+
+ protected void set_text(String s)
+ {
+ // first check against any patterns...
+ if (!_schemaType.matchPatternFacet(s))
+ throw new XmlValueOutOfRangeException();
+
+ // save state for rollback
+ String original = _textvalue;
+ _textvalue = s;
+
+ // iterate through the types, trying to create a type
+ SchemaType[] members = _schemaType.getUnionConstituentTypes();
+ assert(members != null);
+
+ boolean pushed = false;
+ // boolean wasstrict = set_strict(true); // tell types to complain ferverently about errors
+ if (has_store())
+ {
+ NamespaceContext.push(new NamespaceContext(get_store()));
+ pushed = true;
+ }
+ try
+ {
+ for (int i = 0; i < members.length; i++)
+ {
+ // From the point of view of the following call, "this" is a generic
+ // XmlAnySimpleType implementation, for which only getText can be called.
+ // (Note that "this" is not wrapped in the proxy object.)
+ try
+ {
+ XmlAnySimpleType newval = ((SchemaTypeImpl)members[i]).newValidatingValue(s);
+
+ // now we need to check against (enuemration) restrictions
+ if (!check(newval, _schemaType))
+ continue;
+
+ // found one that works!
+ _value = newval;
+ return;
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ continue;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Troublesome union exception caused by unexpected " + e, e);
+ // assert(false) : "Unexpected " + e;
+ // continue;
+ }
+ }
+ }
+ finally
+ {
+ if (pushed)
+ NamespaceContext.pop();
+ // set_strict(wasstrict);
+ }
+
+
+ // doesn't match any of the members; rollback and throw
+ _textvalue = original;
+ throw new XmlValueOutOfRangeException();
+ }
+
+ protected void set_nil()
+ {
+ _value = null;
+ _textvalue = null;
+ }
+
+ protected int get_wscanon_rule() { return SchemaType.WS_PRESERVE; }
+
+
+ // numerics
+ public float floatValue()
+ { check_dated(); return _value == null ? 0.0f : ((SimpleValue)_value).floatValue(); }
+
+ public double doubleValue()
+ { check_dated(); return _value == null ? 0.0 : ((SimpleValue)_value).doubleValue(); }
+
+ public BigDecimal bigDecimalValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).bigDecimalValue(); }
+
+ public BigInteger bigIntegerValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).bigIntegerValue(); }
+
+ public byte byteValue()
+ { check_dated(); return _value == null ? 0 : ((SimpleValue)_value).byteValue(); }
+
+ public short shortValue()
+ { check_dated(); return _value == null ? 0 : ((SimpleValue)_value).shortValue(); }
+
+ public int intValue()
+ { check_dated(); return _value == null ? 0 : ((SimpleValue)_value).intValue(); }
+
+ public long longValue()
+ { check_dated(); return _value == null ? 0 : ((SimpleValue)_value).longValue(); }
+
+
+ // various
+ public byte[] byteArrayValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).byteArrayValue(); }
+
+ public boolean booleanValue()
+ { check_dated(); return _value == null ? false : ((SimpleValue)_value).booleanValue(); }
+
+ public Calendar calendarValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).calendarValue(); }
+
+ public Date dateValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).dateValue(); }
+
+ public GDate gDateValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).gDateValue(); }
+
+ public GDuration gDurationValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).gDurationValue(); }
+
+ public QName qNameValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).qNameValue(); }
+
+ public List listValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).listValue(); }
+
+ public List xlistValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).xlistValue(); }
+
+ public StringEnumAbstractBase enumValue()
+ { check_dated(); return _value == null ? null : ((SimpleValue)_value).enumValue(); }
+
+ public String stringValue()
+ { check_dated(); return _value == null ? null : _value.stringValue(); }
+
+ /**
+ * Returns true if the space of canonical lexical forms
+ * of the first (source) type overlaps with the full lexical space
+ * of the second (target) type. Both types must be primitives.
+ */
+ static boolean lexical_overlap(int source, int target)
+ {
+ // types are the same
+ if (source == target)
+ return true;
+
+ // one of the types has the full lexical space
+ if (source == SchemaType.BTC_ANY_SIMPLE ||
+ target == SchemaType.BTC_ANY_SIMPLE ||
+ source == SchemaType.BTC_STRING ||
+ target == SchemaType.BTC_STRING ||
+ source == SchemaType.BTC_ANY_URI ||
+ target == SchemaType.BTC_ANY_URI)
+ return true;
+
+ switch (source)
+ {
+ case SchemaType.BTC_BOOLEAN: switch(target)
+ {
+ case SchemaType.BTC_QNAME: // "true" is valid NcName and therefore QName
+ case SchemaType.BTC_NOTATION: // "true" is valid NCName
+ return true;
+ default:
+ return false;
+ }
+ case SchemaType.BTC_BASE_64_BINARY: switch(target)
+ {
+ case SchemaType.BTC_BOOLEAN: // "0" is valid boolean
+ case SchemaType.BTC_HEX_BINARY: // "0" is valid hex
+ case SchemaType.BTC_QNAME: // "a" is valid NcName and therefore QName
+ case SchemaType.BTC_NOTATION: // "a" is valid NcName
+ case SchemaType.BTC_FLOAT: // "0" is valid float
+ case SchemaType.BTC_DOUBLE: // "0" is valid double
+ case SchemaType.BTC_DECIMAL: // "0" is valid decimal
+ case SchemaType.BTC_DURATION: // "P1Y2M3DT10H30M" is both b64 and duration
+ case SchemaType.BTC_G_YEAR: // "1999" is valid year
+ return true;
+ default:
+ return false; // "-" and ":" cannot come from b64
+ }
+ case SchemaType.BTC_HEX_BINARY: switch(target)
+ {
+ case SchemaType.BTC_BOOLEAN: // "0" is valid boolean
+ case SchemaType.BTC_BASE_64_BINARY: // "0" is valid b64
+ case SchemaType.BTC_QNAME: // "A" is valid NcName and therefore QName
+ case SchemaType.BTC_NOTATION: // "A" is valid NcName
+ case SchemaType.BTC_FLOAT: // "0" is valid float
+ case SchemaType.BTC_DOUBLE: // "0" is valid double
+ case SchemaType.BTC_DECIMAL: // "0" is valid decimal
+ case SchemaType.BTC_G_YEAR: // "1999" is valid year
+ return true;
+ default:
+ return false; // "-" and ":" cannot come from b64
+ }
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION: switch(target)
+ {
+ case SchemaType.BTC_BOOLEAN: // "true" is valid boolean
+ case SchemaType.BTC_BASE_64_BINARY: // "a" is valid b64
+ case SchemaType.BTC_HEX_BINARY: // "a" is valid hex
+ case SchemaType.BTC_QNAME: // "A" is valid NcName and therefore QName
+ case SchemaType.BTC_NOTATION: // "A" is valid NcName and therefore QName
+ case SchemaType.BTC_DURATION: // "P1Y2M3DT10H30M" is both NcName and duration
+ return true;
+ default:
+ return false;
+ }
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_G_YEAR: switch(target)
+ {
+ case SchemaType.BTC_BASE_64_BINARY: // "0" is valid b64
+ case SchemaType.BTC_HEX_BINARY: // "0" is valid hex
+ case SchemaType.BTC_FLOAT: // "0" is valid float
+ case SchemaType.BTC_DOUBLE: // "0" is valid double
+ case SchemaType.BTC_DECIMAL: // "0" is valid decimal
+ case SchemaType.BTC_G_YEAR: // "1999" is valid year
+ return true;
+ default:
+ return false;
+ }
+ case SchemaType.BTC_DURATION: switch(target)
+ {
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ case SchemaType.BTC_BASE_64_BINARY:
+ return true;
+ default:
+ return false;
+ }
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * True if the given schema type's logical type is a match for
+ * the given category of java concepts.
+ */
+
+ private static final int JAVA_NUMBER = SchemaType.BTC_LAST_BUILTIN + 1;
+ private static final int JAVA_DATE = SchemaType.BTC_LAST_BUILTIN + 2;
+ private static final int JAVA_CALENDAR = SchemaType.BTC_LAST_BUILTIN + 3;
+ private static final int JAVA_BYTEARRAY = SchemaType.BTC_LAST_BUILTIN + 4;
+ private static final int JAVA_LIST = SchemaType.BTC_LAST_BUILTIN + 5;
+
+ private static boolean logical_overlap(SchemaType type, int javacode)
+ {
+ // non-union types because it's being applied on irreducible union members!
+ assert(type.getSimpleVariety() != SchemaType.UNION);
+
+ if (javacode <= SchemaType.BTC_LAST_BUILTIN)
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+
+ return (type.getPrimitiveType().getBuiltinTypeCode() == javacode);
+ }
+
+ switch (javacode)
+ {
+ case JAVA_NUMBER:
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+
+ switch (type.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_G_DAY:
+ return true;
+ }
+ return false;
+ }
+ case JAVA_DATE:
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+
+ switch (type.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_DATE:
+ return true;
+ }
+ return false;
+ }
+ case JAVA_CALENDAR:
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+
+ switch (type.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_G_DAY:
+ return true;
+ }
+ return false;
+ }
+
+ case JAVA_BYTEARRAY:
+ {
+ if (type.getSimpleVariety() != SchemaType.ATOMIC)
+ return false;
+
+ switch (type.getPrimitiveType().getBuiltinTypeCode())
+ {
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ return true;
+ }
+ return false;
+ }
+ case JAVA_LIST:
+ {
+ return (type.getSimpleVariety() == SchemaType.LIST);
+ }
+ }
+
+ assert(false) : "missing case";
+ return false;
+ }
+
+ /**
+ * Grabs a chained value of type st, creating and attaching
+ * one if not present.
+ */
+ private void set_primitive(int typecode, Object val)
+ {
+ SchemaType[] members = _schemaType.getUnionConstituentTypes();
+ assert(members != null);
+
+ boolean pushed = false;
+ if (has_store())
+ {
+ NamespaceContext.push(new NamespaceContext(get_store()));
+ pushed = true;
+ }
+ try
+ {
+ outer: for (int i = 0; i < members.length; i++)
+ {
+ // candidates must be a logical match for the desired typecode
+ if (logical_overlap(members[i], typecode))
+ {
+ XmlAnySimpleType newval;
+
+ try
+ {
+ newval = members[i].newValue(val);
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ // doesn't match this type even though logical categories
+ // line up (probably because of restriciton); try the next type.
+ continue outer;
+ }
+ catch (Exception e)
+ {
+ assert(false) : "Unexpected " + e;
+ continue outer;
+ }
+
+ /* TODO: rethink this - disabling for now.
+
+ // OK, now we've got a newval... We have to verify
+ // that lexically it doesn't overlap with previous types
+
+ String newvaltext = null;
+
+ inner: for (int j = 0; j < i; j++)
+ {
+ if (members[j].getSimpleVariety() == SchemaType.LIST ||
+ lexical_overlap(members[j].getPrimitiveType().getBuiltinTypeCode(),
+ newval.schemaType().getPrimitiveType().getBuiltinTypeCode()))
+ {
+ // there is a preceding type that may lexically overlap with ours...
+ // if it lexically contains the string representation of our new
+ // proposed value, then it's impossible for the union to have our
+ // logical value (because it would have been masked) and throw an
+ // error.
+ if (newvaltext == null)
+ newvaltext = newval.stringValue();
+ try
+ {
+ // discard return value
+ members[i].newValue(newvaltext);
+
+ // oh bad, we succeeded. Our instance lexically looks like a
+ // previous type, and this isn't a valid value. Keep on hunting.
+ continue outer;
+ }
+ catch (XmlValueOutOfRangeException e)
+ {
+ // this is good: this error means that our value doesn't look like
+ // the other type.
+ continue inner;
+ }
+ }
+ }
+
+ */
+
+ // No lexical masking: we're OK
+ _value = newval;
+ _textvalue = _value.stringValue();
+ return;
+ }
+ }
+ }
+ finally
+ {
+ if (pushed)
+ NamespaceContext.pop();
+ }
+ }
+
+ // here are the setters
+
+ protected void set_boolean(boolean v)
+ { set_primitive(SchemaType.BTC_BOOLEAN, new Boolean(v)); }
+
+ protected void set_byte(byte v)
+ { set_primitive(JAVA_NUMBER, new Byte(v)); }
+ protected void set_short(short v)
+ { set_primitive(JAVA_NUMBER, new Short(v)); }
+ protected void set_int(int v)
+ { set_primitive(JAVA_NUMBER, new Integer(v)); }
+ protected void set_long(long v)
+ { set_primitive(JAVA_NUMBER, new Long(v)); }
+ protected void set_float(float v)
+ { set_primitive(JAVA_NUMBER, new Float(v)); }
+ protected void set_double(double v)
+ { set_primitive(JAVA_NUMBER, new Double(v)); }
+
+ protected void set_ByteArray(byte[] b)
+ { set_primitive(JAVA_BYTEARRAY, b); }
+ protected void set_hex(byte[] b)
+ { set_primitive(JAVA_BYTEARRAY, b); }
+ protected void set_b64(byte[] b)
+ { set_primitive(JAVA_BYTEARRAY, b); }
+ protected void set_BigInteger(BigInteger v)
+ { set_primitive(JAVA_NUMBER, v); }
+ protected void set_BigDecimal(BigDecimal v)
+ { set_primitive(JAVA_NUMBER, v); }
+ protected void set_QName(QName v)
+ { set_primitive(SchemaType.BTC_QNAME, v); }
+
+ protected void set_Calendar(Calendar c)
+ { set_primitive(JAVA_CALENDAR, c); }
+ protected void set_Date(Date d)
+ { set_primitive(JAVA_DATE, d); }
+ protected void set_GDate(GDateSpecification d)
+ {
+ int btc = d.getBuiltinTypeCode();
+ if (btc <= 0)
+ throw new XmlValueOutOfRangeException();
+ set_primitive(btc, d);
+ }
+
+ protected void set_GDuration(GDurationSpecification d)
+ { set_primitive(SchemaType.BTC_DURATION, d); }
+
+ protected void set_enum(StringEnumAbstractBase e)
+ { set_primitive(SchemaType.BTC_STRING, e); }
+
+ protected void set_list(List v)
+ { set_primitive(JAVA_LIST, v); }
+
+
+ protected void set_xmlfloat(XmlObject v)
+ { set_primitive(SchemaType.BTC_FLOAT, v); }
+ protected void set_xmldouble(XmlObject v)
+ { set_primitive(SchemaType.BTC_DOUBLE, v); }
+ protected void set_xmldecimal(XmlObject v)
+ { set_primitive(SchemaType.BTC_DECIMAL, v); }
+ protected void set_xmlduration(XmlObject v)
+ { set_primitive(SchemaType.BTC_DURATION, v); }
+ protected void set_xmldatetime(XmlObject v)
+ { set_primitive(SchemaType.BTC_DATE_TIME, v); }
+ protected void set_xmltime(XmlObject v)
+ { set_primitive(SchemaType.BTC_TIME, v); }
+ protected void set_xmldate(XmlObject v)
+ { set_primitive(SchemaType.BTC_DATE, v); }
+ protected void set_xmlgyearmonth(XmlObject v)
+ { set_primitive(SchemaType.BTC_G_YEAR_MONTH, v); }
+ protected void set_xmlgyear(XmlObject v)
+ { set_primitive(SchemaType.BTC_G_YEAR, v); }
+ protected void set_xmlgmonthday(XmlObject v)
+ { set_primitive(SchemaType.BTC_G_MONTH_DAY, v); }
+ protected void set_xmlgday(XmlObject v)
+ { set_primitive(SchemaType.BTC_G_DAY, v); }
+ protected void set_xmlgmonth(XmlObject v)
+ { set_primitive(SchemaType.BTC_G_MONTH, v); }
+
+
+
+ private static boolean check(XmlObject v, SchemaType sType)
+ {
+ XmlObject[] vals = sType.getEnumerationValues();
+ if (vals != null)
+ {
+ for (int i = 0; i < vals.length; i++)
+ {
+ if (vals[i].valueEquals(v))
+ return true;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ protected boolean equal_to(XmlObject xmlobj)
+ {
+ return _value.valueEquals(xmlobj);
+ }
+
+ protected int value_hash_code()
+ {
+ return _value.hashCode();
+ }
+
+ protected void validate_simpleval(String lexical, ValidationContext ctx)
+ {
+ try
+ {
+ check_dated();
+ }
+ catch (Exception e)
+ {
+ ctx.invalid("Union value " + lexical + " does not match any of the member types for " + QNameHelper.readable(schemaType()));
+ return;
+ }
+ if (_value == null)
+ {
+ ctx.invalid("Union value " + lexical + " does not match any of the member types for " + QNameHelper.readable(schemaType()));
+ return;
+ }
+
+ ((XmlObjectBase)_value).validate_simpleval(lexical, ctx);
+ }
+
+
+}
+
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedByteImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedByteImpl.java
new file mode 100644
index 0000000..235895a
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedByteImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlUnsignedByte;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlUnsignedByteImpl extends JavaIntHolderEx implements XmlUnsignedByte
+{
+ public XmlUnsignedByteImpl()
+ { super(XmlUnsignedByte.type, false); }
+ public XmlUnsignedByteImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedIntImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedIntImpl.java
new file mode 100644
index 0000000..fa127d1
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedIntImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlUnsignedInt;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlUnsignedIntImpl extends JavaLongHolderEx implements XmlUnsignedInt
+{
+ public XmlUnsignedIntImpl()
+ { super(XmlUnsignedInt.type, false); }
+ public XmlUnsignedIntImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedLongImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedLongImpl.java
new file mode 100644
index 0000000..5f78679
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedLongImpl.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlUnsignedLong;
+import org.apache.xmlbeans.SchemaType;
+
+
+public class XmlUnsignedLongImpl extends JavaIntegerHolderEx implements XmlUnsignedLong
+{
+ public XmlUnsignedLongImpl()
+ { super(XmlUnsignedLong.type, false); }
+ public XmlUnsignedLongImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedShortImpl.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedShortImpl.java
new file mode 100644
index 0000000..74a6b43
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnsignedShortImpl.java
@@ -0,0 +1,27 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.XmlUnsignedShort;
+import org.apache.xmlbeans.SchemaType;
+
+public class XmlUnsignedShortImpl extends JavaIntHolderEx implements XmlUnsignedShort
+{
+ public XmlUnsignedShortImpl()
+ { super(XmlUnsignedShort.type, false); }
+ public XmlUnsignedShortImpl(SchemaType type, boolean complex)
+ { super(type, complex); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueDisconnectedException.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueDisconnectedException.java
new file mode 100644
index 0000000..cfa4b3e
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueDisconnectedException.java
@@ -0,0 +1,33 @@
+/* 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.xmlbeans.impl.values;
+
+public class XmlValueDisconnectedException extends RuntimeException
+{
+ XmlValueDisconnectedException ( )
+ {
+ }
+
+ XmlValueDisconnectedException ( String message )
+ {
+ super( message );
+ }
+
+ XmlValueDisconnectedException ( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotNillableException.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotNillableException.java
new file mode 100644
index 0000000..0f5e2ea
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueNotNillableException.java
@@ -0,0 +1,20 @@
+/* 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.xmlbeans.impl.values;
+
+public class XmlValueNotNillableException extends RuntimeException
+{
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueOutOfRangeException.java b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueOutOfRangeException.java
new file mode 100644
index 0000000..70f1ee5
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlValueOutOfRangeException.java
@@ -0,0 +1,22 @@
+/* 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.xmlbeans.impl.values;
+
+public class XmlValueOutOfRangeException extends IllegalArgumentException
+{
+ public XmlValueOutOfRangeException() {}
+ public XmlValueOutOfRangeException(String message) { super(message); }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/soap/SOAPArrayType.java b/v1/src/typeimpl/org/apache/xmlbeans/soap/SOAPArrayType.java
new file mode 100644
index 0000000..3f683d7
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/soap/SOAPArrayType.java
@@ -0,0 +1,457 @@
+/* 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.xmlbeans.soap;
+
+import javax.xml.namespace.QName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.apache.xmlbeans.impl.common.XmlWhitespace;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+
+public final class SOAPArrayType
+{
+ // Example foo:bar[,][][,,][7,9]
+ // -> _type = QName(foo:bar)
+ // -> _ranks = {2,1,3}
+ // -> _dimensions = {7,9}
+ private QName _type;
+ private int[] _ranks; // if ranks is empty, it means there are no nested arrays
+ private int[] _dimensions; // Any dimension can be -1 to indicate "any".
+
+ /**
+ * True if the ranks for the passed SOAPArrayType
+ * are equal to this one.
+ *
+ * Does NOT compare the _type fields.
+ */
+ public boolean isSameRankAs(SOAPArrayType otherType)
+ {
+ if (_ranks.length != otherType._ranks.length)
+ return false;
+ for (int i = 0; i < _ranks.length; i++)
+ {
+ if (_ranks[i] != otherType._ranks[i])
+ return false;
+ }
+ if (_dimensions.length != otherType._dimensions.length)
+ return false;
+ return true;
+ }
+
+ /**
+ * Given SOAP 1.1-formatted index string, returns an array
+ * index. For example, given "[4,3,5]", returns an int array
+ * containing 4, 3, and 5.
+ */
+ public static int[] parseSoap11Index(String inbraces)
+ {
+ inbraces = XmlWhitespace.collapse(inbraces, XmlWhitespace.WS_COLLAPSE);
+ if (!inbraces.startsWith("[") || !inbraces.endsWith("]"))
+ throw new IllegalArgumentException("Misformed SOAP 1.1 index: must be contained in braces []");
+ return internalParseCommaIntString(inbraces.substring(1, inbraces.length() - 1));
+ }
+
+ private static int[] internalParseCommaIntString(String csl)
+ {
+ List dimStrings = new ArrayList();
+ int i = 0;
+ for (;;)
+ {
+ int j = csl.indexOf(',', i);
+ if (j < 0)
+ {
+ dimStrings.add(csl.substring(i));
+ break;
+ }
+ dimStrings.add(csl.substring(i, j));
+ i = j + 1;
+ }
+
+ int[] result = new int[dimStrings.size()];
+ i = 0;
+ for (Iterator it = dimStrings.iterator(); it.hasNext(); i++)
+ {
+ String dimString = XmlWhitespace.collapse((String)it.next(), XmlWhitespace.WS_COLLAPSE);
+ if (dimString.equals("*") || dimString.equals(""))
+ {
+ result[i] = -1;
+ }
+ else
+ {
+ try
+ {
+ result[i] = Integer.parseInt(dimString);
+ }
+ catch (Exception e)
+ {
+ throw new XmlValueOutOfRangeException("Malformed integer in SOAP array index");
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Parses a SOAP 1.1 array type string.
+ *
+ * Since an array type string contains a QName, a prefix resolver
+ * must be passed.
+ */
+ public SOAPArrayType(String s, PrefixResolver m)
+ {
+ int firstbrace = s.indexOf('[');
+ if (firstbrace < 0)
+ throw new XmlValueOutOfRangeException();
+
+ // grab the QName
+ String firstpart = XmlWhitespace.collapse(s.substring(0, firstbrace), XmlWhitespace.WS_COLLAPSE);
+ int firstcolon = firstpart.indexOf(':');
+ String prefix = "";
+ if (firstcolon >= 0)
+ prefix = firstpart.substring(0, firstcolon);
+
+ String uri = m.getNamespaceForPrefix(prefix);
+ if (uri == null)
+ throw new XmlValueOutOfRangeException();
+
+ _type = QNameHelper.forLNS(firstpart.substring(firstcolon + 1), uri);
+
+ initDimensions(s, firstbrace);
+ }
+
+ private static int[] EMPTY_INT_ARRAY = new int[0];
+
+ /**
+ * Parses SOAP 1.1(advanced) array type strings.
+ *
+ * Since in SOAP 1.1(advanced) the dimension specification is separated from the
+ * QName for the underlying type, these are passed in separate
+ * arguments.
+ */
+ public SOAPArrayType(QName name, String dimensions)
+ {
+ int firstbrace = dimensions.indexOf('[');
+ if (firstbrace < 0)
+ {
+ _type = name;
+ _ranks = EMPTY_INT_ARRAY;
+ dimensions = XmlWhitespace.collapse(dimensions, XmlWhitespace.WS_COLLAPSE);
+ String[] dimStrings = dimensions.split(" ");
+ for (int i = 0; i < dimStrings.length; i++)
+ {
+ String dimString = dimStrings[i];
+ if (dimString.equals("*"))
+ {
+ _dimensions[i] = -1;
+ // _hasIndeterminateDimensions = true;
+ }
+ else
+ {
+ try
+ {
+ _dimensions[i] = Integer.parseInt(dimStrings[i]);
+ }
+ catch (Exception e)
+ {
+ throw new XmlValueOutOfRangeException();
+ }
+ }
+ }
+ }
+ else
+ {
+ _type = name;
+ initDimensions(dimensions, firstbrace);
+ }
+ }
+
+ /**
+ * Given a nested SOAPArrayType and a set of dimensions for the outermost
+ * array, comes up with the right SOAPArrayType for the whole thing.
+ *
+ * E.g.,
+ * Nested foo:bar[,][][,,][1,2]
+ * Dimensions [6,7,8]
+ * Result -> foo:bar[,][][,,][,][6,7,8]
+ */
+ public SOAPArrayType(SOAPArrayType nested, int[] dimensions)
+ {
+ _type = nested._type;
+
+ _ranks = new int[nested._ranks.length + 1];
+ System.arraycopy(_ranks, 0, nested._ranks, 0, nested._ranks.length);
+ _ranks[_ranks.length - 1] = nested._dimensions.length;
+
+ _dimensions = new int[dimensions.length];
+ System.arraycopy(dimensions, 0, _dimensions, 0, dimensions.length);
+ }
+
+ /**
+ * Initialize dimensions based on SOAP11 parsed dimension substring
+ */
+ private void initDimensions(String s, int firstbrace)
+ {
+ List braces = new ArrayList();
+ int lastbrace = -1;
+ for (int i = firstbrace; i >= 0; )
+ {
+ lastbrace = s.indexOf(']', i);
+ if (lastbrace < 0)
+ throw new XmlValueOutOfRangeException();
+ braces.add(s.substring(i + 1, lastbrace));
+ i = s.indexOf('[', lastbrace);
+ }
+
+ String trailer = s.substring(lastbrace + 1);
+ if (!XmlWhitespace.isAllSpace(trailer))
+ throw new XmlValueOutOfRangeException();
+
+ // now fill in rank array
+ _ranks = new int[braces.size() - 1];
+ for (int i = 0; i < _ranks.length; i++)
+ {
+ String commas = (String)braces.get(i);
+ int commacount = 0;
+ for (int j = 0; j < commas.length(); j++)
+ {
+ char ch = commas.charAt(j);
+ if (ch == ',')
+ commacount += 1;
+ else if (!XmlWhitespace.isSpace(ch))
+ throw new XmlValueOutOfRangeException();
+ }
+ _ranks[i] = commacount + 1;
+ }
+
+ // finally fill in dimension array
+ _dimensions = internalParseCommaIntString((String)braces.get(braces.size() - 1));
+
+ /*
+ for (int i = 0; i < _dimensions.length; i++)
+ {
+ if (_dimensions[i] < 0)
+ _hasIndeterminateDimensions = true;
+ }
+ */
+ }
+
+ /**
+ * Returns the QName for the referenced type.
+ */
+ public QName getQName()
+ {
+ return _type;
+ }
+
+ /**
+ * Returns the array of ranks for inner nested arrays.
+ * In SOAP 1.1-advanced, this is always an array of length zero.
+ * In SOAP 1.1, this array reflects the ranks of nested
+ * arrays. For example foo:bar[,][,,][][5,6] will produce
+ * a ranks result of 2, 3, 1.
+ */
+ public int[] getRanks()
+ {
+ int[] result = new int[_ranks.length];
+ System.arraycopy(_ranks, 0, result, 0, result.length);
+ return result;
+ }
+
+ /**
+ * Returns the array of dimensions.
+ */
+ public int[] getDimensions()
+ {
+ int[] result = new int[_dimensions.length];
+ System.arraycopy(_dimensions, 0, result, 0, result.length);
+ return result;
+ }
+
+ /**
+ * True if this array contains nested arrays. Equivalent
+ * to (getRanks().length > 0).
+ */
+ public boolean containsNestedArrays()
+ {
+ return (_ranks.length > 0);
+ }
+
+ /**
+ * Returns the dimensions as a string, e.g., [,][2,3,4]
+ */
+ public String soap11DimensionString()
+ {
+ return soap11DimensionString(_dimensions);
+ }
+
+ /**
+ * Given an actual set of dimensions that may differ from
+ * the default that is stored, outputs the soap arrayType
+ * string.
+ */
+ public String soap11DimensionString(int[] actualDimensions)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < _ranks.length; i++)
+ {
+ sb.append('[');
+ for (int j = 1; j < _ranks[i]; j++)
+ sb.append(',');
+ sb.append(']');
+ }
+
+ sb.append('[');
+ for (int i = 0; i < actualDimensions.length; i++)
+ {
+ if (i > 0)
+ sb.append(',');
+ if (actualDimensions[i] >= 0)
+ sb.append(actualDimensions[i]);
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+ private SOAPArrayType()
+ {
+ }
+
+ /**
+ * SOAP 1.2
+ * Constructs a SOAPArrayType from soap-enc:itemType and
+ * soap-enc:arraySize attributes
+ * @param itemType the item type QName
+ * @param arraySize a string with dimentions like: * 3 4
+ * @return a SOAPArrayType to represent this
+ */
+ public static SOAPArrayType newSoap12Array(QName itemType, String arraySize)
+ {
+ int [] ranks = EMPTY_INT_ARRAY;
+ arraySize = XmlWhitespace.collapse(arraySize, XmlWhitespace.WS_COLLAPSE);
+ String[] dimStrings = arraySize.split(" ");
+ int[] dimensions = new int[dimStrings.length];
+ for (int i = 0; i < dimStrings.length; i++)
+ {
+ String dimString = dimStrings[i];
+ if (i==0 && dimString.equals("*"))
+ {
+ dimensions[i] = -1;
+ // _hasIndeterminateDimensions = true;
+ }
+ else
+ {
+ try
+ {
+ dimensions[i] = Integer.parseInt(dimStrings[i]);
+ }
+ catch (Exception e)
+ {
+ throw new XmlValueOutOfRangeException();
+ }
+ }
+ }
+ SOAPArrayType sot = new SOAPArrayType();
+ sot._ranks = ranks;
+ sot._type = itemType;
+ sot._dimensions = dimensions;
+ return sot;
+ }
+
+ /**
+ * SOAP 1.2
+ * Given an actual set of dimensions that may differ from
+ * the default that is stored, outputs the soap arraySize
+ * string.
+ */
+ public String soap12DimensionString(int[] actualDimensions)
+ {
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < actualDimensions.length; i++)
+ {
+ if (i > 0)
+ sb.append(' ');
+ if (actualDimensions[i] >= 0)
+ sb.append(actualDimensions[i]);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Constructs a SOAPArrayType reflecting the dimensions
+ * of the next nested array.
+ */
+ public SOAPArrayType nestedArrayType()
+ {
+ if (!containsNestedArrays())
+ throw new IllegalStateException();
+
+ SOAPArrayType result = new SOAPArrayType();
+
+ result._type = _type;
+
+ result._ranks = new int[_ranks.length - 1];
+ System.arraycopy(_ranks, 0, result._ranks, 0, result._ranks.length);
+
+ result._dimensions = new int[_ranks[_ranks.length - 1]];
+ for (int i = 0; i < result._dimensions.length; i++)
+ result._dimensions[i] = -1;
+
+ // result._hasIndeterminateDimensions = (result._dimensions.length > 0);
+
+ return result;
+ }
+
+ public int hashCode()
+ {
+ return (_type.hashCode() + _dimensions.length + _ranks.length + (_dimensions.length == 0 ? 0 : _dimensions[0]));
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+
+ if (!obj.getClass().equals(getClass()))
+ return false;
+
+ SOAPArrayType sat = (SOAPArrayType)obj;
+
+ if (!_type.equals(sat._type))
+ return false;
+
+ if (_ranks.length != sat._ranks.length)
+ return false;
+
+ if (_dimensions.length != sat._dimensions.length)
+ return false;
+
+ for (int i = 0; i < _ranks.length; i++)
+ if (_ranks[i] != sat._ranks[i])
+ return false;
+
+ for (int i = 0; i < _dimensions.length; i++)
+ if (_dimensions[i] != sat._dimensions[i])
+ return false;
+
+ return true;
+ }
+}
diff --git a/v1/src/typeimpl/org/apache/xmlbeans/soap/SchemaWSDLArrayType.java b/v1/src/typeimpl/org/apache/xmlbeans/soap/SchemaWSDLArrayType.java
new file mode 100644
index 0000000..4f66243
--- /dev/null
+++ b/v1/src/typeimpl/org/apache/xmlbeans/soap/SchemaWSDLArrayType.java
@@ -0,0 +1,26 @@
+/* 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.xmlbeans.soap;
+
+/**
+ * In the current implementation, schema elements and attributes
+ * can be coerced to this interface in order to retrieve the value
+ * of the wsdl:arrayType attributes on attributes and elements.
+ */
+public interface SchemaWSDLArrayType
+{
+ SOAPArrayType getWSDLArrayType();
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/NamespaceManager.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/NamespaceManager.java
new file mode 100644
index 0000000..1ba9f3d
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/NamespaceManager.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.impl.common.PrefixResolver;
+
+public interface NamespaceManager extends PrefixResolver
+{
+ /**
+ * Caled when the user needs a prefix by which to reference a given
+ * Xml namespace. A suggested prefix is passed, which may be null;
+ * the suggestion may be ignored.
+ */
+
+ String find_prefix_for_nsuri ( String nsuri, String suggested_prefix );
+}
+
\ No newline at end of file
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStore.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStore.java
new file mode 100644
index 0000000..b1cabe0
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStore.java
@@ -0,0 +1,337 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.QNameSet;
+import java.util.List;
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.common.ValidatorListener;
+
+public interface TypeStore extends NamespaceManager
+{
+ /**
+ * Creates a new cursor positioned just before the part of the tree
+ * where this TypeStore is located.
+ */
+ XmlCursor new_cursor();
+
+ /**
+ */
+ void validate ( ValidatorListener vEventSink );
+
+ /**
+ * Get the SchemaTypeLoader associated with the store contianing this
+ * TypeStore.
+ */
+ SchemaTypeLoader get_schematypeloader ( );
+
+ /**
+ * Change the type of this store (perhaps by applying xsi:type) and
+ * return the new TypeStoreUser (or old one if the new type is not
+ * different).
+ */
+ TypeStoreUser change_type ( SchemaType sType );
+
+ /**
+ * Tells if this store is an attribute or not
+ */
+ boolean is_attribute ( );
+
+ /**
+ * Get the value of xsi:type. Return null if none or this is an attribute
+ * store.
+ */
+ QName get_xsi_type ( );
+
+ /**
+ * A user of a TypeStore calls invalidate_text when the underlying
+ * value has changed and he wants the textstore to call him back with
+ * a fetch_text (TypeStore/TypeStoreUsers work in pairs).
+ */
+ void invalidate_text();
+
+ /**
+ * A user of a TypeStore calls fetch_text when he knows his view
+ * of the text is invalid and he wants to see what the actual text
+ * value is.
+ */
+ // BUGBUG (ericvas) 12111
+ String fetch_text(int whitespaceRule);
+
+ public static int WS_UNSPECIFIED = 0;
+ public static int WS_PRESERVE = 1;
+ public static int WS_REPLACE = 2;
+ public static int WS_COLLAPSE = 3;
+
+ /**
+ * A user of a TypeStore calls store_text when he wants the TypeStore
+ * to remember the given text immediately. This typically happens when
+ * the user has a noncanonical (but valid) string representation to save,
+ * but doesn't have the storage in which to save it.
+ */
+ void store_text(String text);
+
+ /**
+ * Here the TypeStore is responsible for locating the default value.
+ * This is done as follows
+ * (1) go to the parent TypeStoreUser
+ * (2) ask it to get_default_element_text(qname) (or _attribute_), and return it if not null.
+ * (2) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor();
+ * (3) call v.visit(name) on _every_ element qname up to and including this one in order
+ * (4) return the result of v.get_default_text().
+ */
+ String compute_default_text();
+
+ /**
+ * Here the TypeStore is responsible for figuring if this value is
+ * nillable and/or fixed. This is done by
+ * (1) go to the parent TypeStoreUser
+ * (2) ask it to get_elementflags(qname), and return it if not -1.
+ * (2) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor();
+ * (3) call v.visit(name) on _every_ element qname up to and including this one in order
+ * (4) return the result of v.get_elementflags().
+ */
+ int compute_flags();
+
+
+ /**
+ * Tells if this store was created with this option which tells the strongly typed
+ * objects to perform lexical and value validation after a setter is called.
+ */
+ boolean validate_on_set();
+
+ /**
+ * Here the typestore is resposible for finding the schema field for
+ * this object. This is done by
+ * (1) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor();
+ * (2) call v.visit(name) on _every_ element qname up to and including this one in order
+ * (3) return the result of v.get_schema_field().
+ */
+ SchemaField get_schema_field();
+
+ public static final int NILLABLE = 1;
+ public static final int HASDEFAULT = 2;
+ public static final int FIXED = 4; // always set with HASDEFAULT
+
+ /**
+ * Called when the value has been nilled or unnilled, so the textstore
+ * knows it needs to update the xsi:nil attribute.
+ */
+ void invalidate_nil();
+
+ /**
+ * The TypeStore is reponsible for discovering if this value is nil.
+ * This is done by (1) going to the element and (2) finding the
+ * xsi:nil attribute if present and (3) return true if the collapsed
+ * textual value is either exactly the string "true" or "1".
+ */
+ boolean find_nil();
+
+ /**
+ * Returns the count of elements with the given name owned by this
+ * textstore.
+ */
+ int count_elements(QName name);
+
+ /**
+ * Returns the count of elements that match of the names.
+ */
+ int count_elements(QNameSet names);
+
+ /**
+ * Returns the TypeStoreUser underneath the ith element with the given
+ * name owned by this textstore, or null if none was found.
+ *
+ * Do not throw an IndexOutOfBoundsException if i is bad -
+ * return null instead. The reason is to allow us to fail
+ * and then follow with an add_element_etc if we choose to,
+ * without randomly catching exceptions.
+ */
+// BUGBUG - this should be called find_element
+// BUGBUG - this should be called find_element
+// BUGBUG - this should be called find_element
+// BUGBUG - this should be called find_element
+// BUGBUG - this should be called find_element
+ TypeStoreUser find_element_user(QName name, int i);
+
+ /**
+ * Like find_element_user but accepts a set of names to search for.
+ */
+ TypeStoreUser find_element_user(QNameSet names, int i);
+
+ /**
+ * Returns all the TypeStoreUsers corresponding to elements with the
+ * given name owned by this typestore, or the empty array of
+ * TypeStoreUsers if none was found.
+ */
+// BUGBUG - this should be called find_all_element
+// BUGBUG - this should be called find_all_element
+// BUGBUG - this should be called find_all_element
+// BUGBUG - this should be called find_all_element
+ void find_all_element_users(QName name, List fillMeUp);
+
+
+ /**
+ * Returns all TypeStoreUsers corresponding to elements with one
+ * of the names is the QNameSet.
+ */
+ void find_all_element_users(QNameSet name, List fillMeUp);
+
+ /**
+ * Inserts a new element at the position that will make it
+ * the ith element with the given name owned by this textstore,
+ * and returns a TypeStoreUser for that element.
+ *
+ * Note that if there are no existing elements of the given
+ * name, you may need to call back to discover the proper
+ * ordering to use to insert the first one. Otherwise,
+ * it should be inserted adjacent to existing elements with
+ * the same name.
+ *
+ * Should throw an IndexOutOfBoundsException if i < 0
+ * or if i > # of elts
+ */
+
+// BUGBUG - this should be called insert_element
+// BUGBUG - this should be called insert_element
+// BUGBUG - this should be called insert_element
+ TypeStoreUser insert_element_user(QName name, int i);
+
+ /**
+ * Like the above method, except that it inserts an element named
+ * name, after the ith member of set.
+ */
+ TypeStoreUser insert_element_user(QNameSet set, QName name, int i);
+
+ /**
+ * Adds a new element at the last position adjacent to existing
+ * elements of the same name.
+ *
+ * Note that if there are no existing elements of the given
+ * name, the same comment applies as with insert_element_user.
+ */
+// BUGBUG - this should be called add_element
+// BUGBUG - this should be called add_element
+// BUGBUG - this should be called add_element
+// BUGBUG - this should be called add_element
+ TypeStoreUser add_element_user(QName name);
+
+ /**
+ * Removes the ith element with the given name.
+ *
+ * Should throw an IndexOutOfBoundsException if i < 0
+ * or if i > # of elts-1.
+ */
+ void remove_element(QName name, int i);
+
+ /**
+ * Removes the ith element that matches names.
+ */
+ void remove_element(QNameSet names, int i);
+
+
+ /**
+ * Returns the TypeStoreUser underneath the attribute with the given
+ * name, or null if there is no such attribute.
+ */
+// BUGBUG - this should be called find_attribute
+// BUGBUG - this should be called find_attribute
+// BUGBUG - this should be called find_attribute
+// BUGBUG - this should be called find_attribute
+ TypeStoreUser find_attribute_user(QName name);
+
+ /**
+ * Adds an attribute with the given name and returns a TypeStoreUser
+ * underneath it. Should throw an IndexOutOfBoundsException if there
+ * is already an existing attribute with the given name.
+ */
+// BUGBUG - this should be called add_attribute
+// BUGBUG - this should be called add_attribute
+// BUGBUG - this should be called add_attribute
+// BUGBUG - this should be called add_attribute
+ TypeStoreUser add_attribute_user(QName name);
+
+ /**
+ * Removes the attribute with the given name.
+ */
+ void remove_attribute(QName name);
+
+ /**
+ * Copies the contents of the given TypeStore (including attributes,
+ * elements, and mixed content), to the target type store.
+ *
+ * SPECIAL NOTE: The xsi:type attribute should not be removed from
+ * the target or copied from the soruce, and the TypeStoreUser attached
+ * to this TypeStore should not be disconnected.
+ *
+ * This is for implementing obj.set(foo).
+ */
+ TypeStoreUser copy_contents_from(TypeStore source);
+
+// BUGBUG - Need to use this in the future
+// /**
+// * Copies the contents of the given TypeStore (including attributes,
+// * elemets, mixed content), to the child element given by the given
+// * name and index. Any TypeStoreUser that might be currently attached
+// * to that element is disconnected. The xsi:type attribute of the
+// * element should be set according to the given QName (or deleted if
+// * the xsitype argument is null)
+// */
+// void copy_to_element(
+// TypeStore source, QName xsitype, QName name, int i);
+
+ /**
+ * Copies the contents of the given array of XmlObject (including
+ * attributes, elements, mixed content), over all the elements of the
+ * given name under the current typestore.
+ *
+ * The lengths of the two arrays that are passed should be the same.
+ *
+ * If there are n current elements of the given name and m elements
+ * in the source array, there are several cases for individual elements:
+ *
+ * 1. If i < n and i < m, then the contents of the ith source are copied
+ * underneath the ith element; the ith element is not moved, but its
+ * TypeStoreUser is disconnected.
+ * 2. if i >= n and i < m, then first enough new elements are appended
+ * so that there is an element with the name i, then rule #1 is followed.
+ * 3. if i >= m and i < n, then the element #i and all its contents
+ * are removed.
+ */
+
+ void array_setter ( XmlObject[] sources, QName elementName );
+
+ /**
+ * Visits all the elements immediately, using the given visitor.
+ * A TypeStoreUser calls this when somebody has requested validation.
+ */
+ void visit_elements(TypeStoreVisitor visitor);
+
+ XmlObject[] exec_query ( String queryExpr, XmlOptions options )
+ throws XmlException;
+
+ /**
+ * Returns the monitor object, used for synchronizing access to the doc.
+ */
+ Object get_root_object();
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreFactory.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreFactory.java
new file mode 100644
index 0000000..73a7d0e
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreFactory.java
@@ -0,0 +1,34 @@
+/* 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.xmlbeans.impl.values;
+
+import org.apache.xmlbeans.SchemaType;
+import javax.xml.namespace.QName;
+
+/**
+ * This gives the non default bindings to take control of TypeStoreUser
+ * creation. It is set once per document and called each time instead of
+ * TypeStoreUser.createElementUser() and createAttributeUser()
+ */
+public interface TypeStoreFactory
+{
+ /** A key to pass in for the XmlOptions to set the factory */
+ public static final String KEY = "TypeStoreFactory";
+
+ TypeStoreUser createElementUser(SchemaType parentType, QName name, QName xsiType);
+
+ TypeStoreUser createAttributeUser(SchemaType parentType, QName name);
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUser.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUser.java
new file mode 100644
index 0000000..97284b5
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUser.java
@@ -0,0 +1,185 @@
+/* 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.xmlbeans.impl.values;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaField;
+
+/**
+ * Represents the strongly-typed user of a typestore.
+ * A typestore is responsible for all the lexical aspects of XML, and
+ * a typestore user is responsible for all strongly-typed aspects.
+ * Where there is interaction between the two models, it is represented
+ * by the TypeStore and TypeStoreUser interfaces.
+ */
+public interface TypeStoreUser
+{
+ /**
+ * Called to attach to the given textStore. When a TypeStoreUser is
+ * attached, it is put into a completely invalidated state.
+ */
+ void attach_store(TypeStore store);
+
+ /**
+ * Returns the schema type of this user
+ */
+ SchemaType get_schema_type();
+
+ /**
+ * Returns the store to which this typestoreuser is attached, or
+ * null if none.
+ */
+ TypeStore get_store();
+
+ /**
+ * A store will call back on invalidate_value when its text has
+ * changed and it therefore knows that any cached type value is
+ * invalid. It is the responsibilty of the type to call fetch_text
+ * and reparse next time the user does a strongly-typed get.
+ */
+ void invalidate_value();
+
+ /**
+ * A store can call uses_invalidate_value to know if calls to
+ * invalidate_value will be fruitful. If uses_invalidate_value
+ * returns false, invalidate_value need never be called.
+ */
+ boolean uses_invalidate_value();
+
+ /**
+ * A store will call back on build_text when it knows its own text
+ * is invalid and needs to fill it in. If forExternal is true, then
+ * the value returned will be used to replenish the store's cache of
+ * the value. Otherwise, the value is being computed for purposes
+ * other than validation, like persistence.
+ *
+ * Also, the only member on TypeStore which may be called while build_text
+ * is on the stack is find_prefix_for_nsuri which must have the
+ * forExternal state passed to it as it is passed here.
+ */
+ String build_text(NamespaceManager nsm);
+
+ /**
+ * A store will call back on build_nil after you've called invalidate_nil
+ * and it needs to know what the nil value is.
+ */
+ boolean build_nil();
+
+ /**
+ * A store calls back on invalidate_nilvalue when the value of
+ * the xsi:nil tag has changed.
+ */
+ void invalidate_nilvalue();
+
+ /**
+ * A store calls back on invalidate_element_order when a rearrangment
+ * of sibling elements to the left of this element means that the
+ * nillable value may no longer be valid.
+ */
+ void invalidate_element_order();
+
+ /**
+ * A store will call back on validate_now to force us to look at
+ * the text if we're in an invalid state. This function is allowed
+ * and expected to throw an exception if the text isn't valid for
+ * our type.
+ */
+ void validate_now();
+
+ /**
+ * A store calls back on this call in order to force a disconnect.
+ * After this is done, the object should be considered invalid.
+ */
+ void disconnect_store();
+
+ /**
+ * A typestore user can create a new TypeStoreUser instance for
+ * a given element child name as long as you also pass the
+ * qname contained by the xsi:type attribute, if any.
+ *
+ * Note that we will ignore the xsiType if it turns out to be invalid.
+ */
+ TypeStoreUser create_element_user(QName eltName, QName xsiType);
+
+ /**
+ * A typestore user can create a new TypeStoreUser instance for
+ * a given attribute child, based on the attribute name.
+ */
+ TypeStoreUser create_attribute_user(QName attrName);
+
+ /**
+ * Return the SchemaType which a child element of this name and xsi:type
+ * would be.
+ */
+
+ SchemaType get_element_type(QName eltName, QName xsiType);
+
+ /**
+ * Return the SchemaType which an attribute of this name would be.
+ */
+
+ SchemaType get_attribute_type(QName attrName);
+
+ /**
+ * Returns the default element text, if it's consistent. If it's
+ * not consistent, returns null, and requires a visitor walk.
+ */
+ String get_default_element_text(QName eltName);
+
+ /**
+ * Returns the default attribute text for the attribute with
+ * the given name.
+ */
+ String get_default_attribute_text(QName attrName);
+
+ /**
+ * Returns the elementflags, if they're consistent. If they're
+ * not, returns -1, and requires a vistor walk.
+ */
+ int get_elementflags(QName eltName);
+
+ /**
+ * Returns the flags for an attribute.
+ */
+ int get_attributeflags(QName attrName);
+
+ /**
+ * Returns the schema field for an attribute
+ */
+ SchemaField get_attribute_field(QName attrName);
+
+ /**
+ * Returns false if child elements are insensitive to order;
+ * if it returns true, you're required to call invalidate_element_order
+ * on children to the right of any child order rearrangement.
+ */
+ boolean is_child_element_order_sensitive();
+
+ /**
+ * A typestore user can return the element sort order to use for
+ * insertion operations if needed. Settable elements should
+ * be stored in this order if possible.
+ */
+ QNameSet get_element_ending_delimiters(QName eltname);
+
+ /**
+ * A typestore user can return a visitor that is used to compute
+ * default text and elementflags for an arbitrary element.
+ */
+ TypeStoreVisitor new_visitor();
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUserFactory.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUserFactory.java
new file mode 100644
index 0000000..b875821
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreUserFactory.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.impl.values;
+
+/**
+ * Every SchemaTypeLoader is actually a TypeStoreUserFactory.
+ *
+ * To get and use the default TypeStoreUserFactory, do the following:
+ *
+ * TypeStoreUser user = ((TypeStoreUserFactory)SchemaTypeLoader.global()).createTypeStoreUser(store);
+ */
+public interface TypeStoreUserFactory
+{
+ TypeStoreUser createTypeStoreUser();
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreVisitor.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreVisitor.java
new file mode 100644
index 0000000..f80b7ba
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/TypeStoreVisitor.java
@@ -0,0 +1,51 @@
+/* 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.xmlbeans.impl.values;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.SchemaField;
+
+/**
+ * This interface is used by the TypeStore to visit every element in order
+ * to compute nillable flags and default values.
+ */
+public interface TypeStoreVisitor
+{
+ /**
+ * When using a visitor, you must call "visit" on every qname of
+ * every element in order up to the one you're interested in.
+ *
+ * If you're using it for validation, call visit(null) at the end
+ * of the sequence of children. If you're not validating, you can
+ * just walk away once you get the info you need.
+ */
+ boolean visit(QName eltName);
+
+ /**
+ * Returns the elementflags for this element.
+ */
+ int get_elementflags();
+
+ /**
+ * Returns the default text for this element.
+ */
+ String get_default_text();
+
+ /**
+ * Returns the schema field for this field.
+ */
+ SchemaField get_schema_field();
+}
diff --git a/v1/src/typestore/org/apache/xmlbeans/impl/values/XmlStore.java b/v1/src/typestore/org/apache/xmlbeans/impl/values/XmlStore.java
new file mode 100644
index 0000000..93ae78f
--- /dev/null
+++ b/v1/src/typestore/org/apache/xmlbeans/impl/values/XmlStore.java
@@ -0,0 +1,51 @@
+/* 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.xmlbeans.impl.values;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.util.Map;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlSaxHandler;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+public interface XmlStore
+{
+ //
+ //
+ //
+
+ XmlObject loadXml ( String s, SchemaType type, XmlOptions options ) throws XmlException;
+ XmlObject loadXml ( InputStream in, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ XmlObject loadXml ( Reader r, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ XmlObject loadXml ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException;
+ XmlObject loadXml ( Node node, SchemaType type, XmlOptions options ) throws XmlException;
+
+ XmlSaxHandler newSaxHandler ( SchemaType type, XmlOptions options );
+
+ XmlObject getObject ( );
+}
\ No newline at end of file
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/BaseSchemaResourceManager.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/BaseSchemaResourceManager.java
new file mode 100644
index 0000000..bf71d89
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/BaseSchemaResourceManager.java
@@ -0,0 +1,717 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.impl.util.HexBin;
+import org.apache.xmlbeans.impl.common.IOUtil;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemasDocument;
+import org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemasDocument.DownloadedSchemas;
+import org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemaEntry;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+
+public abstract class BaseSchemaResourceManager extends SchemaImportResolver
+{
+ private String _defaultCopyDirectory;
+ private DownloadedSchemasDocument _importsDoc;
+ private Map _resourceForFilename = new HashMap();
+ private Map _resourceForURL = new HashMap();
+ private Map _resourceForNamespace = new HashMap();
+ private Map _resourceForDigest = new HashMap();
+ private Map _resourceForCacheEntry = new HashMap();
+ private Set _redownloadSet = new HashSet();
+
+ protected BaseSchemaResourceManager()
+ {
+ // concrete subclasses should call init in their constructors
+ }
+
+ protected final void init()
+ {
+ if (fileExists(getIndexFilename()))
+ {
+ try
+ {
+ _importsDoc = DownloadedSchemasDocument.Factory.parse( inputStreamForFile( getIndexFilename() ) );
+ }
+ catch (IOException e)
+ {
+ _importsDoc = null;
+ }
+ catch (Exception e)
+ {
+ throw (IllegalStateException)(new IllegalStateException("Problem reading xsdownload.xml: please fix or delete this file")).initCause(e);
+ }
+ }
+ if (_importsDoc == null)
+ {
+ try
+ {
+ _importsDoc = DownloadedSchemasDocument.Factory.parse(
+ "<dls:downloaded-schemas xmlns:dls='http://xml.apache.org/xmlbeans/2004/02/xmlbean/xsdownload' defaultDirectory='" + getDefaultSchemaDir() + "'/>"
+ );
+ }
+ catch (Exception e)
+ {
+ throw (IllegalStateException)(new IllegalStateException()).initCause(e);
+ }
+ }
+
+ String defaultDir = _importsDoc.getDownloadedSchemas().getDefaultDirectory();
+ if (defaultDir == null)
+ defaultDir = getDefaultSchemaDir();;
+ _defaultCopyDirectory = defaultDir;
+
+ // now initialize data structures
+ DownloadedSchemaEntry[] entries = _importsDoc.getDownloadedSchemas().getEntryArray();
+ for (int i = 0; i < entries.length; i++)
+ {
+ updateResource(entries[i]);
+ }
+ }
+
+ public final void writeCache() throws IOException
+ {
+ InputStream input = _importsDoc.newInputStream(new XmlOptions().setSavePrettyPrint());
+ writeInputStreamToFile(input, getIndexFilename());
+ }
+
+ public final void processAll(boolean sync, boolean refresh, boolean imports)
+ {
+ if (refresh)
+ {
+ _redownloadSet = new HashSet();
+ }
+ else
+ {
+ _redownloadSet = null;
+ }
+
+ String[] allFilenames = getAllXSDFilenames();
+
+ if (sync)
+ syncCacheWithLocalXsdFiles(allFilenames, false);
+
+ SchemaResource[] starters = (SchemaResource[])
+ _resourceForFilename.values().toArray(
+ new SchemaResource[_resourceForFilename.values().size()]);
+
+ if (refresh)
+ redownloadEntries(starters);
+
+ if (imports)
+ resolveImports(starters);
+
+ _redownloadSet = null;
+ }
+
+ public final void process(String[] uris, String[] filenames, boolean sync, boolean refresh, boolean imports)
+ {
+ if (refresh)
+ {
+ _redownloadSet = new HashSet();
+ }
+ else
+ {
+ _redownloadSet = null;
+ }
+
+ if (filenames.length > 0)
+ syncCacheWithLocalXsdFiles(filenames, true);
+ else if (sync)
+ syncCacheWithLocalXsdFiles(getAllXSDFilenames(), false);
+
+ Set starterset = new HashSet();
+
+ for (int i = 0; i < uris.length; i++)
+ {
+ SchemaResource resource = (SchemaResource)lookupResource(null, uris[i]);
+ if (resource != null)
+ starterset.add(resource);
+ }
+
+ for (int i = 0; i < filenames.length; i++)
+ {
+ SchemaResource resource = (SchemaResource)_resourceForFilename.get(filenames);
+ if (resource != null)
+ starterset.add(resource);
+ }
+
+ SchemaResource[] starters = (SchemaResource[])
+ starterset.toArray(new SchemaResource[starterset.size()]);
+
+ if (refresh)
+ redownloadEntries(starters);
+
+ if (imports)
+ resolveImports(starters);
+
+ _redownloadSet = null;
+ }
+
+ /**
+ * Adds items to the cache that point to new files that aren't
+ * described in the cache, and optionally deletes old entries.
+ *
+ * If an old file is gone and a new file is
+ * found with exactly the same contents, the cache entry is moved
+ * to point to the new file.
+ */
+ public final void syncCacheWithLocalXsdFiles(String[] filenames, boolean deleteOnlyMentioned)
+ {
+ Set seenResources = new HashSet();
+ Set vanishedResources = new HashSet();
+
+ for (int i = 0; i < filenames.length; i++)
+ {
+ String filename = filenames[i];
+
+ // first, if the filename matches exactly, trust the filename
+ SchemaResource resource = (SchemaResource)_resourceForFilename.get(filename);
+ if (resource != null)
+ {
+ if (fileExists(filename))
+ seenResources.add(resource);
+ else
+ vanishedResources.add(resource);
+ continue;
+ }
+
+ // new file that is not in the index?
+ // not if the digest is known to the index and the original file is gone - that's a rename!
+ String digest = null;
+ try
+ {
+ digest = shaDigestForFile(filename);
+ resource = (SchemaResource)_resourceForDigest.get(digest);
+ if (resource != null)
+ {
+ String oldFilename = resource.getFilename();
+ if (!fileExists(oldFilename))
+ {
+ warning("File " + filename + " is a rename of " + oldFilename);
+ resource.setFilename(filename);
+ seenResources.add(resource);
+ if (_resourceForFilename.get(oldFilename) == resource)
+ _resourceForFilename.remove(oldFilename);
+ if (_resourceForFilename.containsKey(filename))
+ _resourceForFilename.put(filename, resource);
+ continue;
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // unable to read digest... no problem, ignore then
+ }
+
+ // ok, this really is a new XSD file then, of unknown URL origin
+ DownloadedSchemaEntry newEntry = addNewEntry();
+ newEntry.setFilename(filename);
+ warning("Caching information on new local file " + filename);
+ if (digest != null)
+ newEntry.setSha1(digest);
+
+ seenResources.add(updateResource(newEntry));
+ }
+
+ if (deleteOnlyMentioned)
+ deleteResourcesInSet(vanishedResources, true);
+ else
+ deleteResourcesInSet(seenResources, false);
+ }
+
+ /**
+ * Iterates through every entry and refetches it from its primary URL,
+ * if known. Replaces the contents of the file if the data is different.
+ */
+ private void redownloadEntries(SchemaResource[] resources)
+ {
+ for (int i = 0; i < resources.length; i++)
+ {
+ redownloadResource(resources[i]);
+ }
+ }
+
+ private void deleteResourcesInSet(Set seenResources, boolean setToDelete)
+ {
+ Set seenCacheEntries = new HashSet();
+ for (Iterator i = seenResources.iterator(); i.hasNext(); )
+ {
+ SchemaResource resource = (SchemaResource)i.next();
+ seenCacheEntries.add(resource._cacheEntry);
+ }
+
+ DownloadedSchemas downloadedSchemas = _importsDoc.getDownloadedSchemas();
+ for (int i = 0; i < downloadedSchemas.sizeOfEntryArray(); i++)
+ {
+ DownloadedSchemaEntry cacheEntry = downloadedSchemas.getEntryArray(i);
+
+ if (seenCacheEntries.contains(cacheEntry) == setToDelete)
+ {
+ SchemaResource resource = (SchemaResource)_resourceForCacheEntry.get(cacheEntry);
+ warning("Removing obsolete cache entry for " + resource.getFilename());
+
+ if (resource != null)
+ {
+ _resourceForCacheEntry.remove(cacheEntry);
+
+ if (resource == _resourceForFilename.get(resource.getFilename()))
+ _resourceForFilename.remove(resource.getFilename());
+
+ if (resource == _resourceForDigest.get(resource.getSha1()))
+ _resourceForDigest.remove(resource.getSha1());
+
+ if (resource == _resourceForNamespace.get(resource.getNamespace()))
+ _resourceForNamespace.remove(resource.getNamespace());
+
+ // Finally, any or all URIs
+ String[] urls = resource.getSchemaLocationArray();
+ for (int j = 0; j < urls.length; j++)
+ {
+ if (resource == _resourceForURL.get(urls[j]))
+ _resourceForURL.remove(urls[j]);
+ }
+ }
+
+ downloadedSchemas.removeEntry(i);
+ i -= 1;
+ }
+ }
+ }
+
+ private SchemaResource updateResource(DownloadedSchemaEntry entry)
+ {
+ // The file
+ String filename = entry.getFilename();
+ if (filename == null)
+ return null;
+
+ SchemaResource resource = new SchemaResource(entry);
+ _resourceForCacheEntry.put(entry, resource);
+
+ if (!_resourceForFilename.containsKey(filename))
+ _resourceForFilename.put(filename, resource);
+
+ // The digest
+ String digest = resource.getSha1();
+ if (digest != null)
+ {
+ if (!_resourceForDigest.containsKey(digest))
+ _resourceForDigest.put(digest, resource);
+ }
+
+ // Next, the namespace
+ String namespace = resource.getNamespace();
+ if (namespace != null)
+ {
+ if (!_resourceForNamespace.containsKey(namespace))
+ _resourceForNamespace.put(namespace, resource);
+ }
+
+ // Finally, any or all URIs
+ String[] urls = resource.getSchemaLocationArray();
+ for (int j = 0; j < urls.length; j++)
+ {
+ if (!_resourceForURL.containsKey(urls[j]))
+ _resourceForURL.put(urls[j], resource);
+ }
+
+ return resource;
+ }
+
+ private static DigestInputStream digestInputStream(InputStream input)
+ {
+ MessageDigest sha;
+ try
+ {
+ sha = MessageDigest.getInstance("SHA");
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ throw (IllegalStateException)(new IllegalStateException().initCause(e));
+ }
+
+ DigestInputStream str = new DigestInputStream(input, sha);
+
+ return str;
+ }
+
+ private DownloadedSchemaEntry addNewEntry()
+ {
+ return _importsDoc.getDownloadedSchemas().addNewEntry();
+ }
+
+ private class SchemaResource implements SchemaImportResolver.SchemaResource
+ {
+ SchemaResource(DownloadedSchemaEntry entry)
+ {
+ _cacheEntry = entry;
+ }
+
+ DownloadedSchemaEntry _cacheEntry;
+
+ public void setFilename(String filename)
+ {
+ _cacheEntry.setFilename(filename);
+ }
+
+ public String getFilename()
+ {
+ return _cacheEntry.getFilename();
+ }
+
+ public Schema getSchema()
+ {
+ if (!fileExists(getFilename()))
+ redownloadResource(this);
+
+ try
+ {
+ return SchemaDocument.Factory.parse(inputStreamForFile(getFilename())).getSchema();
+ }
+ catch (Exception e)
+ {
+ return null; // return null if _any_ problems reading schema file
+ }
+ }
+
+ public String getSha1()
+ {
+ return _cacheEntry.getSha1();
+ }
+
+ public String getNamespace()
+ {
+ return _cacheEntry.getNamespace();
+ }
+
+ public void setNamespace(String namespace)
+ {
+ _cacheEntry.setNamespace(namespace);
+ }
+
+ public String getSchemaLocation()
+ {
+ if (_cacheEntry.sizeOfSchemaLocationArray() > 0)
+ return _cacheEntry.getSchemaLocationArray(0);
+ return null;
+ }
+
+ public String[] getSchemaLocationArray()
+ {
+ return _cacheEntry.getSchemaLocationArray();
+ }
+
+ public int hashCode()
+ {
+ return getFilename().hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ return this == obj || getFilename().equals(((SchemaResource)obj).getFilename());
+ }
+
+ public void addSchemaLocation(String schemaLocation)
+ {
+ _cacheEntry.addSchemaLocation(schemaLocation);
+ }
+ }
+
+ /**
+ * Called when the ImportLoader wishes to resolve the
+ * given import. Should return a SchemaResource whose
+ * "equals" relationship reveals when a SchemaResource is
+ * duplicated and shouldn't be examined again.
+ *
+ * Returns null if the resource reference should be ignored.
+ */
+ public SchemaImportResolver.SchemaResource lookupResource(String nsURI, String schemaLocation)
+ {
+ SchemaResource result = fetchFromCache(nsURI, schemaLocation);
+ if (result != null)
+ {
+ if (_redownloadSet != null)
+ {
+ redownloadResource(result);
+ }
+ return result;
+ }
+
+ if (schemaLocation == null)
+ {
+ warning("No cached schema for namespace '" + nsURI + "', and no url specified");
+ return null;
+ }
+
+ result = copyOrIdentifyDuplicateURL(schemaLocation, nsURI);
+ if (_redownloadSet != null)
+ _redownloadSet.add(result);
+ return result;
+ }
+
+ private SchemaResource fetchFromCache(String nsURI, String schemaLocation)
+ {
+ SchemaResource result;
+
+ if (schemaLocation != null)
+ {
+ result = (SchemaResource)_resourceForURL.get(schemaLocation);
+ if (result != null)
+ return result;
+ }
+
+ if (nsURI != null)
+ {
+ result = (SchemaResource)_resourceForNamespace.get(nsURI);
+ if (result != null)
+ return result;
+ }
+
+ return null;
+ }
+
+ private String uniqueFilenameForURI(String schemaLocation) throws IOException, URISyntaxException
+ {
+ String localFilename = new URI( schemaLocation ).getRawPath();
+ int i = localFilename.lastIndexOf('/');
+ if (i >= 0)
+ localFilename = localFilename.substring(i + 1);
+ if (localFilename.endsWith(".xsd"))
+ localFilename = localFilename.substring(0, localFilename.length() - 4);
+ if (localFilename.length() == 0)
+ localFilename = "schema";
+
+ // TODO: remove other unsafe characters for filenames?
+
+ String candidateFilename = localFilename;
+ int suffix = 1;
+ while (suffix < 1000)
+ {
+ String candidate = _defaultCopyDirectory + "/" + candidateFilename + ".xsd";
+ if (!fileExists(candidate))
+ return candidate;
+ suffix += 1;
+ candidateFilename = localFilename + suffix;
+ }
+
+ throw new IOException("Problem with filename " + localFilename + ".xsd");
+ }
+
+ private void redownloadResource(SchemaResource resource)
+ {
+ if (_redownloadSet != null)
+ {
+ if (_redownloadSet.contains(resource))
+ return;
+ _redownloadSet.add(resource);
+ }
+
+ String filename = resource.getFilename();
+ String schemaLocation = resource.getSchemaLocation();
+ String digest = null;
+
+ // nothing to do?
+ if (schemaLocation == null || filename == null)
+ return;
+
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ try
+ {
+ URL url = new URL( schemaLocation );
+ URLConnection conn = url.openConnection();
+ conn.addRequestProperty("User-Agent", "Apache XMLBeans/1.0.3");
+ conn.addRequestProperty("Accept", "application/xml, text/xml, */*");
+ DigestInputStream input = digestInputStream(conn.getInputStream());
+ IOUtil.copyCompletely(input, buffer);
+ digest = HexBin.bytesToString(input.getMessageDigest().digest());
+ }
+ catch (Exception e)
+ {
+ warning("Could not copy remote resource " + schemaLocation + ":" + e.getMessage());
+ return;
+ }
+
+ if (digest.equals(resource.getSha1()) && fileExists(filename))
+ {
+ warning("Resource " + filename + " is unchanged from " + schemaLocation + ".");
+ return;
+ }
+
+ try
+ {
+ InputStream source = new ByteArrayInputStream(buffer.toByteArray());
+ writeInputStreamToFile(source, filename);
+ }
+ catch (IOException e)
+ {
+ warning("Could not write to file " + filename + " for " + schemaLocation + ":" + e.getMessage());
+ return;
+ }
+
+ warning("Refreshed " + filename + " from " + schemaLocation);
+ }
+
+ private SchemaResource copyOrIdentifyDuplicateURL(String schemaLocation, String namespace)
+ {
+ String targetFilename;
+ String digest;
+ SchemaResource result;
+
+ try
+ {
+ targetFilename = uniqueFilenameForURI(schemaLocation);
+ }
+ catch (URISyntaxException e)
+ {
+ warning("Invalid URI '" + schemaLocation + "':" + e.getMessage());
+ return null;
+ }
+ catch (IOException e)
+ {
+ warning("Could not create local file for " + schemaLocation + ":" + e.getMessage());
+ return null;
+ }
+
+ try
+ {
+ URL url = new URL( schemaLocation );
+ DigestInputStream input = digestInputStream(url.openStream());
+ writeInputStreamToFile(input, targetFilename);
+ digest = HexBin.bytesToString(input.getMessageDigest().digest());
+ }
+ catch (Exception e)
+ {
+ warning("Could not copy remote resource " + schemaLocation + ":" + e.getMessage());
+ return null;
+ }
+
+ result = (SchemaResource)_resourceForDigest.get(digest);
+ if (result != null)
+ {
+ deleteFile(targetFilename);
+ result.addSchemaLocation(schemaLocation);
+ if (!_resourceForURL.containsKey(schemaLocation))
+ _resourceForURL.put(schemaLocation, result);
+ return result;
+ }
+
+ warning("Downloaded " + schemaLocation + " to " + targetFilename);
+
+ DownloadedSchemaEntry newEntry = addNewEntry();
+ newEntry.setFilename(targetFilename);
+ newEntry.setSha1(digest);
+ if (namespace != null)
+ newEntry.setNamespace(namespace);
+ newEntry.addSchemaLocation(schemaLocation);
+ return updateResource(newEntry);
+ }
+
+ /**
+ * Updates actual namespace in the table.
+ */
+ public void reportActualNamespace(SchemaImportResolver.SchemaResource rresource, String actualNamespace)
+ {
+ SchemaResource resource = (SchemaResource)rresource;
+ String oldNamespace = resource.getNamespace();
+ if (oldNamespace != null && _resourceForNamespace.get(oldNamespace) == resource)
+ _resourceForNamespace.remove(oldNamespace);
+ if (!_resourceForNamespace.containsKey(actualNamespace))
+ _resourceForNamespace.put(actualNamespace, resource);
+ resource.setNamespace(actualNamespace);
+ }
+
+ private String shaDigestForFile(String filename) throws IOException
+ {
+ DigestInputStream str = digestInputStream(inputStreamForFile(filename));
+
+ byte[] dummy = new byte[4096];
+ for (int i = 1; i > 0; i = str.read(dummy));
+
+ str.close();
+
+ return HexBin.bytesToString(str.getMessageDigest().digest());
+ }
+
+ // SOME METHODS TO OVERRIDE ============================
+
+ protected String getIndexFilename()
+ {
+ return "./xsdownload.xml";
+ }
+
+ protected String getDefaultSchemaDir()
+ {
+ return "./schema";
+ }
+
+ /**
+ * Produces diagnostic messages such as "downloading X to file Y".
+ */
+ abstract protected void warning(String msg);
+
+ /**
+ * Returns true if the given filename exists. The filenames
+ * are of the form "/foo/bar/zee.xsd" and should be construed
+ * as rooted at the root of the project.
+ */
+ abstract protected boolean fileExists(String filename);
+
+ /**
+ * Gets the data in the given filename as an InputStream.
+ */
+ abstract protected InputStream inputStreamForFile(String filename) throws IOException;
+
+ /**
+ * Writes an entire file in one step. An InputStream is passed and
+ * copied to the file.
+ */
+ abstract protected void writeInputStreamToFile(InputStream input, String filename) throws IOException;
+
+ /**
+ * Deletes a file. Sometimes immediately after writing a new file
+ * we notice that it's exactly the same as an existing file and
+ * we delete it. We never delete a file that was given to us
+ * by the user.
+ */
+ abstract protected void deleteFile(String filename);
+
+ /**
+ * Returns a list of all the XSD filesnames in the project.
+ */
+ abstract protected String[] getAllXSDFilenames();
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java
new file mode 100644
index 0000000..72fda88
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CodeGenUtil.java
@@ -0,0 +1,408 @@
+/* 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.xmlbeans.impl.tool;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+import java.util.Arrays;
+import java.io.File;
+import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.FileFilter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+public class CodeGenUtil
+{
+ public static String DEFAULT_MEM_START = "8m";
+ public static String DEFAULT_MEM_MAX = "256m";
+ public static String DEFAULT_COMPILER = "javac";
+ public static String DEFAULT_JAR = "jar";
+
+ //workaround for Sun bug # 4723726
+ public static URI resolve(URI base, URI child)
+ {
+ URI ruri = base.resolve(child);
+
+ //fix up normalization bug
+ if ("file".equals(ruri.getScheme()) && ! child.equals(ruri))
+ {
+ if (base.getPath().startsWith("//") && !ruri.getPath().startsWith("//"))
+ {
+ String path = "///".concat(ruri.getPath());
+ try
+ {
+ ruri = new URI("file", null, path, ruri.getQuery(), ruri.getFragment());
+ }
+ catch(URISyntaxException uris)
+ {}
+ }
+ }
+ return ruri;
+ }
+
+ static void addAllJavaFiles(List srcFiles, List args)
+ {
+ for (Iterator i = srcFiles.iterator(); i.hasNext(); )
+ {
+ File f = (File)i.next();
+ if (!f.isDirectory())
+ {
+ args.add(quoteAndEscapeFilename(f.getAbsolutePath()));
+ }
+ else
+ {
+ List inside = (Arrays.asList(f.listFiles(
+ new FileFilter()
+ {
+ public boolean accept(File file)
+ { return (file.isFile() && file.getName().endsWith(".java")) || file.isDirectory(); }
+ }
+ )));
+ addAllJavaFiles(inside, args);
+ }
+ }
+ }
+
+ static private String quoteAndEscapeFilename(String filename)
+ {
+ // don't quote if there's no space
+ if (filename.indexOf(" ") < 0)
+ return filename;
+
+ // bizarre. javac expects backslash escaping if we quote the classpath
+ // bizarre also. replaceAll expects replacement backslashes to be double escaped.
+ return "\"" + filename.replaceAll("\\\\", "\\\\\\\\") + "\"";
+ }
+
+ static private String quoteNoEscapeFilename(String filename)
+ {
+ // don't quote if there's no space, and don't quote on linux
+ if (filename.indexOf(" ") < 0 || File.separatorChar == '/')
+ return filename;
+
+ return "\"" + filename + "\"";
+ }
+
+ /**
+ * Invokes javac on the generated source files in order to turn them
+ * into binary files in the output directory. This will return a list of
+ * <code>GenFile</code>s for all of the classes produced or null if an
+ * error occurred.
+ *
+ * @deprecated
+ */
+ static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug)
+ {
+ return externalCompile(srcFiles, outdir, cp, debug, DEFAULT_COMPILER, DEFAULT_MEM_START, DEFAULT_MEM_MAX, false, false);
+ }
+
+ /**
+ * Invokes javac on the generated source files in order to turn them
+ * into binary files in the output directory. This will return a list of
+ * <code>GenFile</code>s for all of the classes produced or null if an
+ * error occurred.
+ */
+ static public boolean externalCompile(List srcFiles, File outdir, File[] cp, boolean debug, String javacPath, String memStart, String memMax, boolean quiet, boolean verbose)
+ {
+ List args = new ArrayList();
+
+ File javac = findJavaTool(javacPath == null ? DEFAULT_COMPILER : javacPath);
+ assert (javac.exists()) : "compiler not found " + javac;
+ args.add(javac.getAbsolutePath());
+
+ if (outdir == null)
+ {
+ outdir = new File(".");
+ }
+ else
+ {
+ args.add("-d");
+ args.add(quoteAndEscapeFilename(outdir.getAbsolutePath()));
+ }
+
+ if (cp == null)
+ {
+ cp = systemClasspath();
+ }
+
+ if (cp.length > 0)
+ {
+ StringBuffer classPath = new StringBuffer();
+ // Add the output directory to the classpath. We do this so that
+ // javac will be able to find classes that were compiled
+ // previously but are not in the list of sources this time.
+ classPath.append(outdir.getAbsolutePath());
+
+ // Add everything on our classpath.
+ for (int i = 0; i < cp.length; i++)
+ {
+ classPath.append(File.pathSeparator);
+ classPath.append(cp[i].getAbsolutePath());
+ }
+
+ args.add("-classpath");
+
+ // bizarre. javac expects backslash escaping if we quote the classpath
+ args.add(quoteAndEscapeFilename(classPath.toString()));
+ }
+
+ args.add("-source");
+ args.add("1.4");
+
+ args.add(debug ? "-g" : "-g:none");
+
+ if (verbose)
+ args.add("-verbose");
+
+ addAllJavaFiles(srcFiles, args);
+
+ File clFile = null;
+ try
+ {
+ clFile = File.createTempFile("javac", "");
+ FileWriter fw = new FileWriter(clFile);
+ Iterator i = args.iterator();
+ for (i.next(); i.hasNext();)
+ {
+ String arg = (String)i.next();
+ fw.write(arg);
+ fw.write('\n');
+ }
+ fw.close();
+ List newargs = new ArrayList();
+ newargs.add(args.get(0));
+
+ if (memStart != null && memStart.length() != 0)
+ newargs.add("-J-Xms" + memStart);
+ if (memMax != null && memMax.length() != 0)
+ newargs.add("-J-Xmx" + memMax);
+
+ newargs.add("@" + clFile.getAbsolutePath());
+ args = newargs;
+ }
+ catch (Exception e)
+ {
+ System.err.println("Could not create command-line file for javac");
+ }
+
+ try
+ {
+ String[] strArgs = (String[]) args.toArray(new String[args.size()]);
+
+ if (verbose)
+ {
+ System.out.print("compile command:");
+ for (int i = 0; i < strArgs.length; i++)
+ System.out.print(" " + strArgs[i]);
+ System.out.println();
+ }
+
+ final Process proc = Runtime.getRuntime().exec(strArgs);
+
+ StringBuffer errorBuffer = new StringBuffer();
+ StringBuffer outputBuffer = new StringBuffer();
+
+ ThreadedReader out = new ThreadedReader(proc.getInputStream(), outputBuffer);
+ ThreadedReader err = new ThreadedReader(proc.getErrorStream(), errorBuffer);
+
+ proc.waitFor();
+
+ if (verbose || proc.exitValue() != 0)
+ {
+ if (outputBuffer.length() > 0) {
+ System.out.println(outputBuffer.toString());
+ System.out.flush();
+ }
+ if (errorBuffer.length() > 0) {
+ System.err.println(errorBuffer.toString());
+ System.err.flush();
+ }
+
+ if (proc.exitValue() != 0)
+ return false;
+ }
+ }
+ catch (Throwable e)
+ {
+ if ( e instanceof IOException )
+ System.err.println("'javac' is required on the path.");
+
+ System.err.println(e.toString());
+ System.err.println(e.getCause());
+ e.printStackTrace(System.err);
+ return false;
+ }
+
+ if (clFile != null)
+ clFile.delete();
+
+ return true;
+ }
+
+ public static File[] systemClasspath()
+ {
+ List cp = new ArrayList();
+ String[] systemcp = System.getProperty("java.class.path").split(File.pathSeparator);
+ for (int i = 0; i < systemcp.length; i++)
+ {
+ cp.add(new File(systemcp[i]));
+ }
+ return (File[])cp.toArray(new File[cp.size()]);
+ }
+
+ static public boolean externalJar(File srcdir, File outfile)
+ {
+ return externalJar(srcdir, outfile, DEFAULT_JAR, false, false);
+ }
+
+ static public boolean externalJar(File srcdir, File outfile, String jarPath, boolean quiet, boolean verbose)
+ {
+ List args = new ArrayList();
+
+ File jar = findJavaTool(jarPath == null ? DEFAULT_JAR : jarPath);
+ assert (jar.exists()) : "jar not found " + jar;
+ args.add(jar.getAbsolutePath());
+
+ args.add("cf" + (verbose ? "v" : ""));
+ args.add(quoteNoEscapeFilename(outfile.getAbsolutePath()));
+
+ args.add("-C");
+ args.add(quoteNoEscapeFilename(srcdir.getAbsolutePath()));
+
+ args.add(".");
+
+ try
+ {
+ String[] strArgs = (String[]) args.toArray(new String[args.size()]);
+
+ if (verbose)
+ {
+ System.out.print("jar command:");
+ for (int i = 0; i < strArgs.length; i++)
+ System.out.print(" " + strArgs[i]);
+ System.out.println();
+ }
+
+ final Process proc = Runtime.getRuntime().exec(strArgs);
+
+ StringBuffer errorBuffer = new StringBuffer();
+ StringBuffer outputBuffer = new StringBuffer();
+
+ ThreadedReader out = new ThreadedReader(proc.getInputStream(), outputBuffer);
+ ThreadedReader err = new ThreadedReader(proc.getErrorStream(), errorBuffer);
+
+ proc.waitFor();
+
+ if (verbose || proc.exitValue() != 0)
+ {
+ if (outputBuffer.length() > 0) {
+ System.out.println(outputBuffer.toString());
+ System.out.flush();
+ }
+ if (errorBuffer.length() > 0) {
+ System.err.println(errorBuffer.toString());
+ System.err.flush();
+ }
+
+ if (proc.exitValue() != 0)
+ return false;
+ }
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace(System.err);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Look for tool in current directory and ${JAVA_HOME}/../bin and
+ * try with .exe file extension.
+ */
+ private static File findJavaTool(String tool)
+ {
+ File toolFile = new File(tool);
+ if (toolFile.isFile()) {
+ return toolFile;
+ }
+
+ File result = new File(tool + ".exe");
+ if (result.isFile()) {
+ return result;
+ }
+
+ String home = System.getProperty("java.home");
+
+ String sep = File.separator;
+ result = new File(home + sep + ".." + sep + "bin", tool);
+
+ if (result.isFile()) {
+ return result;
+ }
+
+ result = new File(result.getPath() + ".exe");
+ if (result.isFile()) {
+ return result;
+ }
+
+ result = new File(home + sep + "bin", tool);
+ if (result.isFile()) {
+ return result;
+ }
+
+ result = new File(result.getPath() + ".exe");
+ if (result.isFile()) {
+ return result;
+ }
+
+ // just return the original toolFile and hope that it is on the PATH.
+ return toolFile;
+ }
+
+ /**
+ * Reads the given input stream into the given buffer until there is
+ * nothing left to read.
+ */
+ static private class ThreadedReader
+ {
+ public ThreadedReader(InputStream stream, final StringBuffer output)
+ {
+ final BufferedReader reader =
+ new BufferedReader(new InputStreamReader(stream));
+
+ Thread readerThread = new Thread(new Runnable() {
+ public void run()
+ {
+ String s;
+ try
+ {
+ while ((s = reader.readLine()) != null)
+ output.append(s + "\n");
+ }
+ catch (Exception e)
+ {}
+ }
+ });
+ readerThread.start();
+ }
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CommandLine.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CommandLine.java
new file mode 100644
index 0000000..105c572
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/CommandLine.java
@@ -0,0 +1,167 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.impl.common.IOUtil;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Collection;
+import java.io.File;
+import java.io.FileFilter;
+import java.net.URI;
+
+public class CommandLine
+{
+ public CommandLine(String[] args, Collection scheme)
+ {
+ _options = new LinkedHashMap();
+ ArrayList endargs = new ArrayList();
+
+ for (int i = 0; i < args.length; i++)
+ {
+ if (args[i].indexOf('-') == 0)
+ {
+ String opt = args[i].substring(1);
+ String val = null;
+ if (scheme != null && scheme.contains(opt) && i < args.length)
+ val = args[++i];
+ else
+ val = "";
+
+ _options.put(opt, val);
+ }
+ else
+ {
+ endargs.add(args[i]);
+ }
+ }
+
+ _args = (String[])endargs.toArray(new String[endargs.size()]);
+ }
+
+ public static void printLicense()
+ {
+ try
+ {
+ IOUtil.copyCompletely(CommandLine.class.getClassLoader().getResourceAsStream("license.txt"), System.out);
+ }
+ catch (Exception e)
+ {
+ System.out.println("License available in this JAR in license.txt");
+ }
+ }
+
+ private Map _options;
+ private String[] _args;
+
+ public String[] args()
+ {
+ String[] result = new String[_args.length];
+ System.arraycopy(_args, 0, result, 0, _args.length);
+ return result;
+ }
+
+ public String getOpt(String opt)
+ {
+ return (String)_options.get(opt);
+ }
+
+ private static List collectFiles(File[] dirs)
+ {
+ List files = new ArrayList();
+ for (int i = 0; i < dirs.length; i++)
+ {
+ File f = dirs[i];
+ if (!f.isDirectory())
+ {
+ files.add(f);
+ }
+ else
+ {
+ files.addAll(collectFiles(f.listFiles()));
+ }
+ }
+ return files;
+ }
+
+ private List _files;
+ private File _baseDir;
+ private static final File[] EMPTY_FILEARRAY = new File[0];
+
+ private List getFileList()
+ {
+ if (_files == null)
+ {
+ String[] args = args();
+ File[] files = new File[args.length];
+ boolean noBaseDir = false;
+ for (int i = 0; i < args.length; i++)
+ {
+ files[i] = new File(args[i]);
+ if (!noBaseDir && (_baseDir == null))
+ {
+ if (files[i].isDirectory())
+ _baseDir = files[i];
+ else
+ _baseDir = files[i].getParentFile();
+ }
+ else
+ {
+ URI currUri = files[i].toURI();
+
+ // Give up on the basedir. There may be none
+ if (_baseDir != null && _baseDir.toURI().relativize(currUri).equals(currUri))
+ {
+ _baseDir = null;
+ noBaseDir = true;
+ }
+ }
+ }
+ _files = Collections.unmodifiableList(collectFiles(files));
+ }
+ return _files;
+ }
+
+ public File[] getFiles()
+ {
+ int size = getFileList().size();
+ if (size == 0)
+ return EMPTY_FILEARRAY;
+ return (File[])getFileList().toArray(new File[size]);
+ }
+
+ public File getBaseDir()
+ {
+ return _baseDir;
+ }
+
+ public File[] filesEndingWith(String ext)
+ {
+ List result = new ArrayList();
+ for (Iterator i = getFileList().iterator(); i.hasNext(); )
+ {
+ File f = (File)i.next();
+ if (f.getName().endsWith(ext))
+ result.add(f);
+ }
+ return (File[])result.toArray(new File[result.size()]);
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/Extension.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/Extension.java
new file mode 100644
index 0000000..ffd7b8d
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/Extension.java
@@ -0,0 +1,70 @@
+/* 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.xmlbeans.impl.tool;
+
+import java.util.List;
+import java.util.ArrayList;
+
+
+ /**
+ * An extension is a javabean that represents a SchemaCompilerExtension to be passed for callback into the
+ * XmlBeans Schema Compiler.
+ */
+public class Extension {
+ private Class className;
+ private List params = new ArrayList();
+
+ public Class getClassName() {
+ return className;
+ }
+
+ public void setClassName(Class className) {
+ this.className = className;
+ }
+ public List getParams() {
+ return params;
+ }
+
+ public Param createParam() {
+ Param p = new Param();
+ params.add(p);
+ return p;
+ }
+
+ /**
+ * A Param is just a name value pair applicable to the extension.
+ */
+ public class Param {
+ private String name;
+ private String value;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+ }
\ No newline at end of file
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/FactorImports.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/FactorImports.java
new file mode 100644
index 0000000..0409052
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/FactorImports.java
@@ -0,0 +1,435 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.w3.x2001.xmlSchema.TopLevelComplexType;
+import org.w3.x2001.xmlSchema.TopLevelSimpleType;
+import org.w3.x2001.xmlSchema.TopLevelElement;
+import org.w3.x2001.xmlSchema.TopLevelAttribute;
+import org.w3.x2001.xmlSchema.NamedGroup;
+import org.w3.x2001.xmlSchema.NamedAttributeGroup;
+import org.w3.x2001.xmlSchema.FormChoice;
+import org.w3.x2001.xmlSchema.IncludeDocument;
+
+import java.util.Arrays;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This program takes a collection of .xsd files as input, finds all duplicate
+ * name definitions, and factors out the first instance of each of those into
+ * a common.xsd file, adding an appropriate <import> statement in the original
+ * xsd file.
+ */
+public class FactorImports
+{
+ public static void main(String[] args) throws Exception
+ {
+ CommandLine cl = new CommandLine(args, Arrays.asList(new String[] {"import", "out"}));
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+
+ args = cl.args();
+ if (args.length != 1)
+ {
+ System.out.println("Refactors a directory of .xsd files to remove name conflicts");
+ System.out.println("Usage:");
+ System.out.println("sfactor [-import common.xsd] [-out outputdir] inputdir");
+ System.out.println(" where inputdir is a directory containing .xsd files");
+ System.out.println(" and outputdir is a directory into which new xsd files,");
+ System.out.println(" plus a commonly imported common.xsd, is placed.");
+ System.out.println(" -license prints license information");
+ System.exit(0);
+ return;
+ }
+
+ String commonName = cl.getOpt("import");
+ if (commonName == null)
+ commonName = "common.xsd";
+
+ String out = cl.getOpt("out");
+ if (out == null)
+ {
+ System.out.println("Using output directory 'out'");
+ out = "out";
+ }
+ File outdir = new File(out);
+ File basedir = new File(args[0]);
+
+ // first, parse all the schema files
+ File[] files = cl.getFiles();
+ Map schemaDocs = new HashMap();
+ Set elementNames = new HashSet();
+ Set attributeNames = new HashSet();
+ Set typeNames = new HashSet();
+ Set modelGroupNames = new HashSet();
+ Set attrGroupNames = new HashSet();
+
+ Set dupeElementNames = new HashSet();
+ Set dupeAttributeNames = new HashSet();
+ Set dupeTypeNames = new HashSet();
+ Set dupeModelGroupNames = new HashSet();
+ Set dupeAttrGroupNames = new HashSet();
+ Set dupeNamespaces = new HashSet();
+
+ for (int i = 0; i < files.length; i++)
+ {
+ try
+ {
+ // load schema
+ SchemaDocument doc = SchemaDocument.Factory.parse(files[i]);
+ schemaDocs.put(doc, files[i]);
+
+ // warn about for imports, includes
+ if (doc.getSchema().sizeOfImportArray() > 0 || doc.getSchema().sizeOfIncludeArray() > 0)
+ System.out.println("warning: " + files[i] + " contains imports or includes that are being ignored.");
+
+ // collect together names
+ String targetNamespace = doc.getSchema().getTargetNamespace();
+ if (targetNamespace == null)
+ targetNamespace = "";
+
+ TopLevelComplexType ct[] = doc.getSchema().getComplexTypeArray();
+ for (int j = 0; j < ct.length; j++)
+ noteName(ct[j].getName(), targetNamespace, typeNames, dupeTypeNames, dupeNamespaces);
+
+ TopLevelSimpleType st[] = doc.getSchema().getSimpleTypeArray();
+ for (int j = 0; j < st.length; j++)
+ noteName(st[j].getName(), targetNamespace, typeNames, dupeTypeNames, dupeNamespaces);
+
+ TopLevelElement el[] = doc.getSchema().getElementArray();
+ for (int j = 0; j < el.length; j++)
+ noteName(el[j].getName(), targetNamespace, elementNames, dupeElementNames, dupeNamespaces);
+
+ TopLevelAttribute at[] = doc.getSchema().getAttributeArray();
+ for (int j = 0; j < at.length; j++)
+ noteName(at[j].getName(), targetNamespace, attributeNames, dupeAttributeNames, dupeNamespaces);
+
+ NamedGroup gr[] = doc.getSchema().getGroupArray();
+ for (int j = 0; j < gr.length; j++)
+ noteName(gr[j].getName(), targetNamespace, modelGroupNames, dupeModelGroupNames, dupeNamespaces);
+
+ NamedAttributeGroup ag[] = doc.getSchema().getAttributeGroupArray();
+ for (int j = 0; j < ag.length; j++)
+ noteName(ag[j].getName(), targetNamespace, attrGroupNames, dupeAttrGroupNames, dupeNamespaces);
+
+ }
+ catch (XmlException e)
+ {
+ System.out.println("warning: " + files[i] + " is not a schema file - " + e.getError().toString());
+ }
+ catch (IOException e)
+ {
+ System.err.println("Unable to load " + files[i] + " - " + e.getMessage());
+ System.exit(1);
+ return;
+ }
+ }
+
+ if (schemaDocs.size() == 0)
+ {
+ System.out.println("No schema files found.");
+ System.exit(0);
+ return;
+ }
+
+ if (dupeTypeNames.size() + dupeElementNames.size() + dupeAttributeNames.size() +
+ dupeModelGroupNames.size() + dupeAttrGroupNames.size() == 0)
+ {
+ System.out.println("No duplicate names found.");
+ System.exit(0);
+ return;
+ }
+
+ // create a schema doc for each namespace to be imported
+ Map commonDocs = new HashMap();
+ Map commonFiles = new HashMap();
+ int count = dupeNamespaces.size() == 1 ? 0 : 1;
+ for (Iterator i = dupeNamespaces.iterator(); i.hasNext(); )
+ {
+ String namespace = (String)i.next();
+ SchemaDocument commonDoc = SchemaDocument.Factory.parse(
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>"
+ );
+ if (namespace.length() > 0)
+ commonDoc.getSchema().setTargetNamespace(namespace);
+ commonDoc.getSchema().setElementFormDefault(FormChoice.QUALIFIED);
+ commonDocs.put(namespace, commonDoc);
+ commonFiles.put(commonDoc, commonFileFor(commonName, namespace, count++, outdir));
+ }
+
+ // pull out all the duplicate definitions and drop them into the file
+ // we reuse the elementNames (etc) sets to keep track of which definitions
+ // we have already inserted.
+ for (Iterator i = schemaDocs.keySet().iterator(); i.hasNext(); )
+ {
+ SchemaDocument doc = (SchemaDocument)i.next();
+
+ // collect together names
+ String targetNamespace = doc.getSchema().getTargetNamespace();
+ if (targetNamespace == null)
+ targetNamespace = "";
+
+ SchemaDocument commonDoc = (SchemaDocument)commonDocs.get(targetNamespace);
+
+ boolean needImport = false;
+
+ TopLevelComplexType ct[] = doc.getSchema().getComplexTypeArray();
+ for (int j = ct.length - 1; j >= 0; j--)
+ {
+ if (!isDuplicate(ct[j].getName(), targetNamespace, dupeTypeNames))
+ continue;
+ if (isFirstDuplicate(ct[j].getName(), targetNamespace, typeNames, dupeTypeNames))
+ commonDoc.getSchema().addNewComplexType().set(ct[j]);
+ needImport = true;
+ doc.getSchema().removeComplexType(j);
+ }
+
+ TopLevelSimpleType st[] = doc.getSchema().getSimpleTypeArray();
+ for (int j = 0; j < st.length; j++)
+ {
+ if (!isDuplicate(st[j].getName(), targetNamespace, dupeTypeNames))
+ continue;
+ if (isFirstDuplicate(st[j].getName(), targetNamespace, typeNames, dupeTypeNames))
+ commonDoc.getSchema().addNewSimpleType().set(st[j]);
+ needImport = true;
+ doc.getSchema().removeSimpleType(j);
+ }
+
+ TopLevelElement el[] = doc.getSchema().getElementArray();
+ for (int j = 0; j < el.length; j++)
+ {
+ if (!isDuplicate(el[j].getName(), targetNamespace, dupeElementNames))
+ continue;
+ if (isFirstDuplicate(el[j].getName(), targetNamespace, elementNames, dupeElementNames))
+ commonDoc.getSchema().addNewElement().set(el[j]);
+ needImport = true;
+ doc.getSchema().removeElement(j);
+ }
+
+ TopLevelAttribute at[] = doc.getSchema().getAttributeArray();
+ for (int j = 0; j < at.length; j++)
+ {
+ if (!isDuplicate(at[j].getName(), targetNamespace, dupeAttributeNames))
+ continue;
+ if (isFirstDuplicate(at[j].getName(), targetNamespace, attributeNames, dupeAttributeNames))
+ commonDoc.getSchema().addNewElement().set(at[j]);
+ needImport = true;
+ doc.getSchema().removeElement(j);
+ }
+
+ NamedGroup gr[] = doc.getSchema().getGroupArray();
+ for (int j = 0; j < gr.length; j++)
+ {
+ if (!isDuplicate(gr[j].getName(), targetNamespace, dupeModelGroupNames))
+ continue;
+ if (isFirstDuplicate(gr[j].getName(), targetNamespace, modelGroupNames, dupeModelGroupNames))
+ commonDoc.getSchema().addNewElement().set(gr[j]);
+ needImport = true;
+ doc.getSchema().removeElement(j);
+ }
+
+ NamedAttributeGroup ag[] = doc.getSchema().getAttributeGroupArray();
+ for (int j = 0; j < ag.length; j++)
+ {
+ if (!isDuplicate(ag[j].getName(), targetNamespace, dupeAttrGroupNames))
+ continue;
+ if (isFirstDuplicate(ag[j].getName(), targetNamespace, attrGroupNames, dupeAttrGroupNames))
+ commonDoc.getSchema().addNewElement().set(ag[j]);
+ needImport = true;
+ doc.getSchema().removeElement(j);
+ }
+
+ if (needImport)
+ {
+ IncludeDocument.Include newInclude = doc.getSchema().addNewInclude();
+ File inputFile = (File)schemaDocs.get(doc);
+ File outputFile = outputFileFor(inputFile, basedir, outdir);
+ File commonFile = (File)commonFiles.get(commonDoc);
+ if (targetNamespace != null)
+ newInclude.setSchemaLocation(relativeURIFor(outputFile, commonFile));
+ }
+ }
+
+ // make the directory for output
+ if (!outdir.isDirectory() && !outdir.mkdirs())
+ {
+ System.err.println("Unable to makedir " + outdir);
+ System.exit(1);
+ return;
+ }
+
+ // now write all those docs back out.
+ for (Iterator i = schemaDocs.keySet().iterator(); i.hasNext(); )
+ {
+ SchemaDocument doc = (SchemaDocument)i.next();
+ File inputFile = (File)schemaDocs.get(doc);
+ File outputFile = outputFileFor(inputFile, basedir, outdir);
+ if (outputFile == null)
+ System.out.println("Cannot copy " + inputFile);
+ else
+ doc.save(outputFile, new XmlOptions().setSavePrettyPrint().setSaveAggresiveNamespaces());
+ }
+
+ for (Iterator i = commonFiles.keySet().iterator(); i.hasNext(); )
+ {
+ SchemaDocument doc = (SchemaDocument)i.next();
+ File outputFile = (File)commonFiles.get(doc);
+ doc.save(outputFile, new XmlOptions().setSavePrettyPrint().setSaveAggresiveNamespaces());
+ }
+
+ }
+
+ private static File outputFileFor(File file, File baseDir, File outdir)
+ {
+ URI base = baseDir.getAbsoluteFile().toURI();
+ URI abs = file.getAbsoluteFile().toURI();
+ URI rel = base.relativize(abs);
+ if (rel.isAbsolute())
+ {
+ System.out.println("Cannot relativize " + file);
+ return null;
+ }
+
+ URI outbase = outdir.toURI();
+ URI out = CodeGenUtil.resolve(outbase, rel);
+ return new File(out);
+ }
+
+ private static URI commonAncestor(URI first, URI second)
+ {
+ String firstStr = first.toString();
+ String secondStr = second.toString();
+ int len = firstStr.length();
+ if (secondStr.length() < len)
+ len = secondStr.length();
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ if (firstStr.charAt(i) != secondStr.charAt(i))
+ break;
+ }
+ i -= 1;
+ if (i >= 0)
+ i = firstStr.lastIndexOf('/', i);
+ if (i < 0)
+ return null;
+ try
+ {
+ return new URI(firstStr.substring(0, i));
+ }
+ catch (URISyntaxException e)
+ {
+ return null;
+ }
+ }
+
+
+ private static String relativeURIFor(File source, File target)
+ {
+ URI base = source.getAbsoluteFile().toURI();
+ URI abs = target.getAbsoluteFile().toURI();
+ // find common substring...
+ URI commonBase = commonAncestor(base, abs);
+ if (commonBase == null)
+ return abs.toString();
+
+ URI baserel = commonBase.relativize(base);
+ URI targetrel = commonBase.relativize(abs);
+ if (baserel.isAbsolute() || targetrel.isAbsolute())
+ return abs.toString();
+ String prefix = "";
+ String sourceRel = baserel.toString();
+ for (int i = 0; i < sourceRel.length();)
+ {
+ i = sourceRel.indexOf('/', i);
+ if (i < 0)
+ break;
+ prefix += "../";
+ i += 1;
+ }
+ return prefix + targetrel.toString();
+ }
+
+ private static File commonFileFor(String commonName, String namespace, int i, File outdir)
+ {
+ String name = commonName;
+ if (i > 0)
+ {
+ int index = commonName.lastIndexOf('.');
+ if (index < 0)
+ index = commonName.length();
+ name = commonName.substring(0, index) + i + commonName.substring(index);
+ }
+ return new File(outdir, name);
+ }
+
+
+ private static void noteName(String name, String targetNamespace, Set seen, Set dupes, Set dupeNamespaces)
+ {
+ if (name == null)
+ return;
+ QName qName = new QName(targetNamespace, name);
+ if (seen.contains(qName))
+ {
+ dupes.add(qName);
+ dupeNamespaces.add(targetNamespace);
+ }
+ else
+ seen.add(qName);
+
+ }
+
+ private static boolean isFirstDuplicate(String name, String targetNamespace, Set notseen, Set dupes)
+ {
+ if (name == null)
+ return false;
+ QName qName = new QName(targetNamespace, name);
+ if (dupes.contains(qName) && notseen.contains(qName))
+ {
+ notseen.remove(qName);
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean isDuplicate(String name, String targetNamespace, Set dupes)
+ {
+ if (name == null)
+ return false;
+ QName qName = new QName(targetNamespace, name);
+ return (dupes.contains(qName));
+ }
+
+
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
new file mode 100644
index 0000000..c23d8bf
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
@@ -0,0 +1,142 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlException;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.io.File;
+
+public class InstanceValidator
+{
+ public static void main(String[] args)
+ {
+ CommandLine cl = new CommandLine(args, Collections.EMPTY_SET);
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+ if (cl.args().length == 0)
+ {
+ System.out.println("Validates a schema defintion and instances within the schema.");
+ System.out.println("Usage: validate [switches] schema.xsd instance.xml");
+ System.out.println("Switches:");
+ System.out.println(" -dl enable network downloads for imports and includes");
+ System.out.println(" -nopvr disable particle valid (restriction) rule");
+ System.out.println(" -noupa diable unique particle attributeion rule");
+ System.out.println(" -license prints license information");
+ return;
+ }
+
+ boolean dl = (cl.getOpt("dl") != null);
+ boolean nopvr = (cl.getOpt("nopvr") != null);
+ boolean noupa = (cl.getOpt("noupa") != null);
+
+ File[] schemaFiles = cl.filesEndingWith(".xsd");
+ File[] instanceFiles = cl.filesEndingWith(".xml");
+
+ List sdocs = new ArrayList();
+
+
+ for (int i = 0; i < schemaFiles.length; i++)
+ {
+ try
+ {
+ sdocs.add(
+ XmlObject.Factory.parse(
+ schemaFiles[i], (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
+ }
+ catch (Exception e)
+ {
+ System.err.println( schemaFiles[i] + " not loadable: " + e );
+ }
+ }
+
+ XmlObject[] schemas = (XmlObject[])sdocs.toArray(new XmlObject[0]);
+
+ SchemaTypeLoader sLoader;
+ Collection compErrors = new ArrayList();
+ XmlOptions schemaOptions = new XmlOptions();
+ schemaOptions.setErrorListener(compErrors);
+ if (dl)
+ schemaOptions.setCompileDownloadUrls();
+ if (nopvr)
+ schemaOptions.setCompileNoPvrRule();
+ if (noupa)
+ schemaOptions.setCompileNoUpaRule();
+
+ try
+ {
+ sLoader = XmlBeans.loadXsd(schemas, schemaOptions);
+ }
+ catch (Exception e)
+ {
+ if (compErrors.isEmpty() || !(e instanceof XmlException))
+ {
+ e.printStackTrace(System.err);
+ }
+ System.out.println("Schema invalid");
+ for (Iterator i = compErrors.iterator(); i.hasNext(); )
+ System.out.println(i.next());
+ return;
+ }
+
+ for (int i = 0; i < instanceFiles.length; i++)
+ {
+ XmlObject xobj;
+
+ try
+ {
+ xobj =
+ sLoader.parse( instanceFiles[i], null, (new XmlOptions()).setLoadLineNumbers() );
+ }
+ catch (Exception e)
+ {
+ System.err.println(instanceFiles[i] + " not loadable: " + e);
+ e.printStackTrace(System.err);
+ continue;
+ }
+
+ Collection errors = new ArrayList();
+
+ if (xobj.schemaType() == XmlObject.type)
+ {
+ System.out.println(instanceFiles[i] + " NOT valid. ");
+ System.out.println(" Document type not found." );
+ }
+ else if (xobj.validate(new XmlOptions().setErrorListener(errors)))
+ System.out.println(instanceFiles[i] + " valid.");
+ else
+ {
+ System.out.println(instanceFiles[i] + " NOT valid.");
+ for (Iterator it = errors.iterator(); it.hasNext(); )
+ {
+ System.out.println(it.next());
+ }
+ }
+ }
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/PrettyPrinter.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/PrettyPrinter.java
new file mode 100644
index 0000000..bfcc8d3
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/PrettyPrinter.java
@@ -0,0 +1,79 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+
+import java.util.Collections;
+import java.io.File;
+import java.io.IOException;
+
+public class PrettyPrinter
+{
+ public static void main(String[] args)
+ {
+ CommandLine cl = new CommandLine(args, Collections.singleton("indent"));
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+
+ if (cl.args().length == 0)
+ {
+ System.out.println("Pretty prints XML files.");
+ System.out.println("Usage: xpretty [switches] file.xml");
+ System.out.println("Switches:");
+ System.out.println(" -indent # use the given indent");
+ System.out.println(" -license prints license information");
+ return;
+ }
+
+ String indentStr = cl.getOpt("indent");
+ int indent;
+ if (indentStr == null)
+ indent = 2;
+ else
+ indent = Integer.parseInt(indentStr);
+
+ File[] files = cl.getFiles();
+
+ for (int i = 0; i < files.length; i++)
+ {
+ XmlObject doc;
+ try
+ {
+ doc = XmlObject.Factory.parse(files[i], (new XmlOptions()).setLoadLineNumbers());
+ }
+ catch (Exception e)
+ {
+ System.err.println(files[i] + " not loadable: " + e.getMessage());
+ continue;
+ }
+
+ try
+ {
+ doc.save(System.out, new XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(indent));
+ }
+ catch (IOException e)
+ {
+ System.err.println("Unable to pretty print " + files[i] + ": " + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/RunXQuery.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/RunXQuery.java
new file mode 100644
index 0000000..d2850e6
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/RunXQuery.java
@@ -0,0 +1,206 @@
+/* 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.xmlbeans.impl.tool;
+
+import java.io.*;
+import java.util.*;
+import org.apache.xmlbeans.*;
+
+public class RunXQuery
+{
+ public static void main ( String[] args ) throws Exception
+ {
+ CommandLine cl =
+ new CommandLine(
+ args,
+ Arrays.asList( new String[] { "q", "qf" } ) );
+
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+
+ args = cl.args();
+
+ if (args.length == 0)
+ {
+ System.out.println("Run an XQuery against an XML instance");
+ System.out.println("Usage:");
+ System.out.println("xquery [-verbose] [-pretty] [-q <query> | -qf query.xq] [file.xml]*");
+ System.out.println(" -q <query> to specify a query on the command-line");
+ System.out.println(" -qf <query> to specify a file containing a query");
+ System.out.println(" -pretty pretty-prints the results");
+ System.out.println(" -license prints license information");
+ System.out.println(" the query is run on each XML file specified");
+ System.out.println("");
+ System.exit(0);
+ return;
+ }
+
+ boolean verbose = cl.getOpt( "verbose" ) != null;
+ boolean pretty = cl.getOpt( "pretty" ) != null;
+
+ //
+ // Get and compile the query
+ //
+
+ String query = cl.getOpt( "q" );
+ String queryfile = cl.getOpt( "qf" );
+
+ if (query == null && queryfile == null)
+ {
+ System.err.println( "No query specified" );
+ System.exit(0);
+ return;
+ }
+
+ if (query != null && queryfile != null)
+ {
+ System.err.println( "Specify -qf or -q, not both." );
+ System.exit(0);
+ return;
+ }
+
+ try
+ {
+ if (queryfile != null)
+ {
+ File queryFile = new File( queryfile );
+ FileInputStream is = new FileInputStream( queryFile );
+ InputStreamReader r = new InputStreamReader( is );
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( ; ; )
+ {
+ int ch = r.read();
+
+ if (ch < 0)
+ break;
+
+ sb.append( (char) ch );
+ }
+
+ r.close();
+ is.close();
+
+ query = sb.toString();
+ }
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Cannot read query file: " + e.getMessage() );
+ System.exit(1);
+ return;
+ }
+
+ if (verbose)
+ {
+ System.out.println( "Compile Query:" );
+ System.out.println( query );
+ System.out.println();
+ }
+
+ try
+ {
+ query= XmlBeans.compileQuery( query );
+ }
+ catch ( Exception e )
+ {
+ System.err.println( "Error compiling query: " + e.getMessage() );
+ System.exit(1);
+ return;
+ }
+
+ //
+ // Get the instance
+ //
+
+ File[] files = cl.getFiles();
+
+ for (int i = 0; i < files.length; i++)
+ {
+ XmlObject x;
+
+ try
+ {
+ if (verbose)
+ {
+ InputStream is = new FileInputStream( files[i] );
+
+ for ( ; ; )
+ {
+ int ch = is.read();
+
+ if (ch < 0)
+ break;
+
+ System.out.write( ch );
+ }
+
+ is.close();
+
+ System.out.println();
+ }
+
+ x = XmlObject.Factory.parse( files[i] );
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Error parsing instance: " + e.getMessage() );
+ System.exit(1);
+ return;
+ }
+
+ if (verbose)
+ {
+ System.out.println( "Executing Query..." );
+ System.err.println();
+ }
+
+ XmlObject[] result = null;
+
+ try
+ {
+ result = x.execQuery( query );
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Error executing query: " + e.getMessage() );
+ System.exit(1);
+ return;
+ }
+
+ if (verbose)
+ {
+ System.out.println( "Query Result:" );
+ }
+
+ XmlOptions opts = new XmlOptions();
+ opts.setSaveOuter();
+ if (pretty)
+ opts.setSavePrettyPrint();
+
+ for (int j = 0; j < result.length; j++)
+ {
+ result[j].save( System.out, opts );
+ System.out.println();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java
new file mode 100644
index 0000000..d26374a
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCodeGenerator.java
@@ -0,0 +1,408 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
+
+import java.io.*;
+import java.util.*;
+import java.net.URL;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.xmlbeans.impl.schema.SchemaTypeCodePrinter;
+import org.apache.xmlbeans.impl.common.IOUtil;
+
+import repackage.Repackager;
+
+public class SchemaCodeGenerator
+{
+ // input directory, output dir filename
+ // todo: output jar
+ public static boolean compileTypeSystem(SchemaTypeSystem saver, File sourcedir, File[] javasrc, Map sourcesToCopyMap, File[] classpath, File classesdir, File outputJar, boolean nojavac, boolean jaxb, XmlErrorWatcher errors, String repackage, boolean verbose, List sourcefiles )
+ {
+
+ if (sourcedir == null || classesdir == null)
+ throw new IllegalArgumentException("Source and class gen dir must not be null.");
+
+ boolean failure = false;
+
+ saver.saveToDirectory(classesdir);
+
+ // Save the schema sources to the classes directory
+ if ((sourcesToCopyMap != null) && (sourcesToCopyMap.size() > 0))
+ {
+ File schemasdir = createDir(classesdir, "schema/src");
+
+ for (Iterator iter = sourcesToCopyMap.keySet().iterator(); iter.hasNext();)
+ {
+ String key = (String)iter.next();
+
+ try
+ {
+ URL url = new URL(key);
+ String schemalocation = (String)sourcesToCopyMap.get(key);
+
+ File targetFile = new File(schemasdir, schemalocation);
+ File parentDir = new File(targetFile.getParent());
+ createDir(parentDir, null);
+
+ // Copy the file from filepath to schema/src/<schemaFile>
+ InputStream in = url.openStream();
+ FileOutputStream out = new FileOutputStream(new File(schemasdir, schemalocation));
+ IOUtil.copyCompletely(in, out);
+ }
+ catch (IOException e)
+ {
+ System.err.println("IO Error " + e);
+ // failure = true; - not cause for failure
+ }
+ }
+ }
+
+ Repackager repackager = repackage == null ? null : new Repackager( repackage );
+
+ try
+ {
+ String filename = SchemaTypeCodePrinter.indexClassForSystem(saver).replace('.', File.separatorChar) + ".java";
+ File sourcefile = new File(sourcedir, filename);
+ sourcefile.getParentFile().mkdirs();
+
+ Writer writer =
+ repackager == null
+ ? (Writer) new FileWriter( sourcefile )
+ : (Writer) new RepackagingWriter( sourcefile, repackager );
+
+ SchemaTypeCodePrinter.printLoader(writer, saver);
+
+ writer.close();
+
+ sourcefiles.add(sourcefile);
+ }
+ catch (IOException e)
+ {
+ System.err.println("IO Error " + e);
+ failure = true;
+ }
+
+ if (! jaxb)
+ failure &= genTypes(saver, sourcefiles, sourcedir, repackager, verbose);
+ else
+ failure &= jaxbCodeGenerator(saver, sourcefiles, sourcedir, classesdir, errors);
+
+ if (failure)
+ return false;
+
+ return true;
+ }
+
+ private static boolean genTypes(SchemaTypeSystem saver, List sourcefiles, File sourcedir, Repackager repackager, boolean verbose)
+ {
+ boolean failure = false;
+
+ List types = new ArrayList();
+ types.addAll(Arrays.asList(saver.globalTypes()));
+ types.addAll(Arrays.asList(saver.documentTypes()));
+ types.addAll(Arrays.asList(saver.attributeTypes()));
+
+ for (Iterator i = types.iterator(); i.hasNext(); )
+ {
+ SchemaType type = (SchemaType)i.next();
+ if (verbose)
+ System.err.println("Compiling type " + type);
+ if (type.isBuiltinType())
+ continue;
+ if (type.getFullJavaName() == null)
+ continue;
+
+ String fjn = type.getFullJavaName();
+
+ if (fjn.indexOf('$') > 0)
+ {
+ fjn =
+ fjn.substring( 0, fjn.lastIndexOf( '.' ) ) + "." +
+ fjn.substring( fjn.indexOf( '$' ) + 1 );
+ }
+
+ String filename = fjn.replace('.', File.separatorChar) + ".java";
+
+ Writer writer = null;
+
+ try
+ {
+ File sourcefile = new File(sourcedir, filename);
+ sourcefile.getParentFile().mkdirs();
+ if (verbose)
+ System.err.println("created " + sourcefile.getAbsolutePath());
+ writer =
+ repackager == null
+ ? (Writer) new FileWriter( sourcefile )
+ : (Writer) new RepackagingWriter( sourcefile, repackager );
+
+
+ SchemaTypeCodePrinter.printType(writer, type);
+
+ writer.close();
+
+ sourcefiles.add(sourcefile);
+ }
+ catch (IOException e)
+ {
+ System.err.println("IO Error " + e);
+ failure = true;
+ }
+ finally {
+ try { if (writer != null) writer.close(); } catch (IOException e) {}
+ }
+
+ try
+ {
+ // Generate Implementation class
+ filename = type.getFullJavaImplName().replace('.', File.separatorChar) + ".java";
+ File implFile = new File(sourcedir, filename);
+ if (verbose)
+ System.err.println("created " + implFile.getAbsolutePath());
+ implFile.getParentFile().mkdirs();
+
+
+ writer =
+ repackager == null
+ ? (Writer) new FileWriter( implFile )
+ : (Writer) new RepackagingWriter( implFile, repackager );
+
+ SchemaTypeCodePrinter.printTypeImpl(writer, type);
+
+ writer.close();
+
+ sourcefiles.add(implFile);
+ }
+ catch (IOException e)
+ {
+ System.err.println("IO Error " + e);
+ failure = true;
+ }
+ finally {
+ try { if (writer != null) writer.close(); } catch (IOException e) {}
+ }
+ }
+
+ return failure;
+ }
+
+ private static class JaxbCodeGeneratorHolder
+ {
+ private static final Method _jaxbCodeGeneratorMethod = buildJaxbCodeGeneratorMethod();
+
+ private static Method buildJaxbCodeGeneratorMethod()
+ {
+ try
+ {
+ return Class.forName("org.apache.xmlbeans.impl.jaxb.compiler.JaxbCodeGenerator", false, SchemaCodeGenerator.class.getClassLoader())
+ .getMethod("compile", new Class[] {SchemaTypeSystem.class, List.class, File.class, File.class, XmlErrorWatcher.class });
+ }
+ catch (Exception e)
+ {
+ IllegalStateException e2 = new IllegalStateException("Cannot load JaxbCodeGenerator: verify that xbean.jar is on the classpath");
+ e2.initCause(e);
+ throw e2;
+ }
+ }
+ }
+
+ private static boolean jaxbCodeGenerator(SchemaTypeSystem saver, List sourcefiles, File sourcedir, File classesdir, XmlErrorWatcher errors)
+ {
+ try
+ {
+ return ((Boolean)JaxbCodeGeneratorHolder._jaxbCodeGeneratorMethod.invoke(null, new Object[] { saver, sourcefiles, sourcedir, classesdir, errors })).booleanValue();
+ }
+ catch (InvocationTargetException e)
+ {
+ IllegalStateException e2 = new IllegalStateException(e.getMessage());
+ e2.initCause(e);
+ throw e2;
+ }
+ catch (IllegalAccessException e)
+ {
+ IllegalStateException e2 = new IllegalStateException(e.getMessage());
+ e2.initCause(e);
+ throw e2;
+ }
+ }
+
+ protected static File createDir(File rootdir, String subdir)
+ {
+ File newdir = (subdir == null) ? rootdir : new File(rootdir, subdir);
+ boolean created = (newdir.exists() && newdir.isDirectory()) || newdir.mkdirs();
+ assert(created) : "Could not create " + newdir.getAbsolutePath();
+ return newdir;
+ }
+
+ protected static File createTempDir() throws IOException
+ {
+ File tmpFile = File.createTempFile("xbean", null);
+ String path = tmpFile.getAbsolutePath();
+ if (!path.endsWith(".tmp"))
+ throw new IOException("Error: createTempFile did not create a file ending with .tmp");
+ path = path.substring(0, path.length() - 4);
+ File tmpSrcDir = null;
+
+ for (int count = 0; count < 100; count++)
+ {
+ String name = path + ".d" + (count == 0 ? "" : Integer.toString(count++));
+
+ tmpSrcDir = new File(name);
+
+ if (!tmpSrcDir.exists())
+ {
+ boolean created = tmpSrcDir.mkdirs();
+ assert created : "Could not create " + tmpSrcDir.getAbsolutePath();
+ break;
+ }
+ }
+ tmpFile.deleteOnExit();
+
+ return tmpSrcDir;
+ }
+
+ protected static void tryHardToDelete(File dir)
+ {
+ tryToDelete(dir);
+ if (dir.exists())
+ tryToDeleteLater(dir);
+ }
+
+ private static void tryToDelete(File dir)
+ {
+ if (dir.exists())
+ {
+ if (dir.isDirectory())
+ {
+ String[] list = dir.list();
+ for (int i = 0; i < list.length; i++)
+ tryToDelete(new File(dir, list[i]));
+ }
+ if (!dir.delete())
+ return; // don't try very hard, because we're just deleting tmp
+ }
+ }
+
+ private static Set deleteFileQueue = new HashSet();
+ private static int triesRemaining = 0;
+
+ private static boolean tryNowThatItsLater()
+ {
+ List files;
+
+ synchronized (deleteFileQueue)
+ {
+ files = new ArrayList(deleteFileQueue);
+ deleteFileQueue.clear();
+ }
+
+ List retry = new ArrayList();
+
+ for (Iterator i = files.iterator(); i.hasNext(); )
+ {
+ File file = (File)i.next();
+ tryToDelete(file);
+ if (file.exists())
+ retry.add(file);
+ }
+
+ synchronized (deleteFileQueue)
+ {
+ if (triesRemaining > 0)
+ triesRemaining -= 1;
+
+ if (triesRemaining <= 0 || retry.size() == 0) // done?
+ triesRemaining = 0;
+ else
+ deleteFileQueue.addAll(retry); // try again?
+
+ return (triesRemaining <= 0);
+ }
+ }
+
+ private static void giveUp()
+ {
+ synchronized (deleteFileQueue)
+ {
+ deleteFileQueue.clear();
+ triesRemaining = 0;
+ }
+ }
+
+ private static void tryToDeleteLater(File dir)
+ {
+ synchronized (deleteFileQueue)
+ {
+ deleteFileQueue.add(dir);
+ if (triesRemaining == 0)
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ // repeats tryNow until triesRemaining == 0
+ try
+ {
+ for (;;)
+ {
+ if (tryNowThatItsLater())
+ return; // succeeded
+ Thread.sleep(1000 * 3); // wait three seconds
+ }
+ }
+ catch (InterruptedException e)
+ {
+ giveUp();
+ }
+ }
+ };
+ }
+
+ if (triesRemaining < 10)
+ triesRemaining = 10;
+ }
+ }
+
+ static class RepackagingWriter extends StringWriter
+ {
+ public RepackagingWriter ( File file, Repackager repackager )
+ {
+ _file = file;
+ _repackager = repackager;
+ }
+
+ public void close ( ) throws IOException
+ {
+ super.close();
+
+ StringBuffer sb = getBuffer();
+
+ _repackager.repackage( sb );
+
+ FileWriter fw = new FileWriter( _file );
+ fw.write( sb.toString() );
+ fw.close();
+ }
+
+ private File _file;
+ private Repackager _repackager;
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
new file mode 100644
index 0000000..f310b49
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
@@ -0,0 +1,931 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
+import org.apache.xmlbeans.impl.schema.PathResourceLoader;
+import org.apache.xmlbeans.impl.schema.ResourceLoader;
+import org.apache.xmlbeans.impl.schema.StscState;
+import org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl;
+import org.apache.xmlbeans.impl.common.XmlErrorPrinter;
+import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
+import org.apache.xmlbeans.impl.common.XmlErrorContext;
+import org.apache.xmlbeans.impl.values.XmlListImpl;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument;
+
+import java.io.File;
+import java.util.*;
+import java.net.URI;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+
+public class SchemaCompiler
+{
+ public static void main(String[] args)
+ {
+ if (args.length == 0)
+ {
+ System.out.println("Compiles a schema into XML Bean classes and metadata.");
+ System.out.println("Usage: scomp [opts] [dirs]* [schema.xsd]* [service.wsdl]* [config.xsdconfig]*");
+ System.out.println("Options include:");
+ System.out.println(" -cp [a;b;c] - classpath");
+ System.out.println(" -d [dir] - target binary directory for .class and .xsb files");
+ System.out.println(" -src [dir] - target directory for generated .java files");
+ System.out.println(" -srconly - do not compile .java files or jar the output.");
+ System.out.println(" -out [result.jar] - the name of the output jar");
+ System.out.println(" -dl - permit network downloads for imports and includes (default is off)");
+ System.out.println(" -noupa - do not enforce the unique particle attribution rule");
+ System.out.println(" -nopvr - do not enforce the particle valid (restriction) rule");
+ System.out.println(" -compiler - path to external java compiler");
+ System.out.println(" -jar - path to jar utility");
+ System.out.println(" -ms - initial memory for external java compiler (default '" + CodeGenUtil.DEFAULT_MEM_START + "')");
+ System.out.println(" -mx - maximum memory for external java compiler (default '" + CodeGenUtil.DEFAULT_MEM_MAX + "')");
+ System.out.println(" -debug - compile with debug symbols");
+ System.out.println(" -quiet - print fewer informational messages");
+ System.out.println(" -verbose - print more informational messages");
+ System.out.println(" -license - prints license information");
+ System.out.println(" -allowmdef \"[ns] [ns] [ns]\" - ignores multiple defs in given namespaces");
+ /* Undocumented feature - pass in one schema compiler extension and related parameters
+ System.out.println(" -repackage - repackage specification");
+ System.out.println(" -extension - registers a schema compiler extension");
+ System.out.println(" -extensionParms - specify parameters for the compiler extension");
+ */
+ System.out.println();
+ System.out.println("If you require a different java compiler, use the XMLBean Ant task instead.");
+ System.exit(0);
+ return;
+ }
+
+ Set opts = new HashSet();
+ opts.add("out");
+ opts.add("name");
+ opts.add("src");
+ opts.add("d");
+ opts.add("cp");
+ opts.add("compiler");
+ opts.add("jar");
+ opts.add("ms");
+ opts.add("mx");
+ opts.add("repackage");
+ opts.add("extension");
+ opts.add("extensionParms");
+ opts.add("allowmdef");
+ CommandLine cl = new CommandLine(args, opts);
+
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+
+ args = cl.args();
+ boolean verbose = (cl.getOpt("verbose") != null);
+ boolean quiet = (cl.getOpt("quiet") != null);
+ if (verbose)
+ quiet = false;
+
+ String outputfilename = cl.getOpt("out");
+
+ String repackage = cl.getOpt("repackage");
+
+ String name = cl.getOpt("name");
+
+ boolean download = (cl.getOpt("dl") != null);
+ boolean noUpa = (cl.getOpt("noupa") != null);
+ boolean noPvr = (cl.getOpt("nopvr") != null);
+ boolean nojavac = (cl.getOpt("srconly") != null);
+ boolean debug = (cl.getOpt("debug") != null);
+ boolean jaxb = (cl.getOpt("jaxb") != null);
+
+ String allowmdef = cl.getOpt("allowmdef");
+ Set mdefNamespaces = (allowmdef == null ? Collections.EMPTY_SET :
+ new HashSet(Arrays.asList(XmlListImpl.split_list(allowmdef))));
+
+ List extensions = new ArrayList();
+ if (cl.getOpt("extension") != null) {
+ try {
+ Extension e = new Extension();
+ e.setClassName(Class.forName(cl.getOpt("extension"), false, Thread.currentThread().getContextClassLoader()));
+ extensions.add(e);
+ } catch (ClassNotFoundException e) {
+ System.err.println("Could not find extension class: " + cl.getOpt("extension") + " Is it on your classpath?");
+ System.exit(1);
+ }
+ }
+
+ if (extensions.size() > 0)
+ {
+ // example: -extensionParms typeMappingFileLocation=d:\types
+ if (cl.getOpt("extensionParms") != null) {
+ Extension e = (Extension) extensions.get(0);
+ // extensionParms are delimited by ';'
+ StringTokenizer parmTokens = new StringTokenizer(cl.getOpt("extensionParms"), ";");
+ while (parmTokens.hasMoreTokens()) {
+ // get name value pair for each extension parms and stick into extension parms
+ String nvPair = parmTokens.nextToken();
+ int index = nvPair.indexOf('=');
+ if (index < 0)
+ {
+ System.err.println("extensionParms should be name=value;name=value");
+ System.exit(1);
+ }
+ String n = nvPair.substring(0, index);
+ String v = nvPair.substring(index + 1);
+ Extension.Param param = e.createParam();
+ param.setName(n);
+ param.setValue(v);
+ }
+ }
+ }
+
+ String classesdir = cl.getOpt("d");
+ File classes = null;
+ if (classesdir != null)
+ classes = new File(classesdir);
+
+ String srcdir = cl.getOpt("src");
+ File src = null;
+ if (srcdir != null)
+ src = new File(srcdir);
+ if (nojavac && srcdir == null && classes != null)
+ src = classes;
+
+ // create temp directory
+ File tempdir = null;
+ if (src == null || classes == null)
+ {
+ try
+ {
+ tempdir = SchemaCodeGenerator.createTempDir();
+ }
+ catch (java.io.IOException e)
+ {
+ System.err.println("Error creating temp dir " + e);
+ System.exit(1);
+ }
+ }
+
+ File jarfile = null;
+ if (outputfilename == null && classes == null && !nojavac)
+ outputfilename = "xmltypes.jar";
+ if (outputfilename != null)
+ jarfile = new File(outputfilename);
+
+ if (src == null)
+ src = SchemaCodeGenerator.createDir(tempdir, "src");
+ if (classes == null)
+ classes = SchemaCodeGenerator.createDir(tempdir, "classes");
+
+ File[] classpath = null;
+ String cpString = cl.getOpt("cp");
+ if (cpString != null)
+ {
+ String[] cpparts = cpString.split(File.pathSeparator);
+ List cpList = new ArrayList();
+ for (int i = 0; i < cpparts.length; i++)
+ cpList.add(new File(cpparts[i]));
+ classpath = (File[])cpList.toArray(new File[cpList.size()]);
+ }
+ else
+ {
+ classpath = CodeGenUtil.systemClasspath();
+ }
+
+ String compiler = cl.getOpt("compiler");
+ String jar = cl.getOpt("jar");
+
+ String memoryInitialSize = cl.getOpt("ms");
+ String memoryMaximumSize = cl.getOpt("mx");
+
+ File[] xsdFiles = cl.filesEndingWith(".xsd");
+ File[] wsdlFiles = cl.filesEndingWith(".wsdl");
+ File[] javaFiles = cl.filesEndingWith(".java");
+ File[] configFiles = cl.filesEndingWith(".xsdconfig");
+
+ if (xsdFiles.length + wsdlFiles.length == 0)
+ {
+ System.err.println("Could not find any xsd or wsdl files to process.");
+ System.exit(1);
+ }
+ File baseDir = cl.getBaseDir();
+ URI baseURI = baseDir == null ? null : baseDir.toURI();
+
+ XmlErrorPrinter err = new XmlErrorPrinter(verbose, baseURI);
+
+ Parameters params = new Parameters();
+ params.setBaseDir(baseDir);
+ params.setXsdFiles(xsdFiles);
+ params.setWsdlFiles(wsdlFiles);
+ params.setJavaFiles(javaFiles);
+ params.setConfigFiles(configFiles);
+ params.setClasspath(classpath);
+ params.setOutputJar(jarfile);
+ params.setName(name);
+ params.setSrcDir(src);
+ params.setClassesDir(classes);
+ params.setCompiler(compiler);
+ params.setJar(jar);
+ params.setMemoryInitialSize(memoryInitialSize);
+ params.setMemoryMaximumSize(memoryMaximumSize);
+ params.setNojavac(nojavac);
+ params.setQuiet(quiet);
+ params.setVerbose(verbose);
+ params.setDownload(download);
+ params.setNoUpa(noUpa);
+ params.setNoPvr(noPvr);
+ params.setDebug(debug);
+ params.setErrorListener(err);
+ params.setRepackage(repackage);
+ params.setExtensions(extensions);
+ params.setJaxb(jaxb);
+ params.setMdefNamespaces(mdefNamespaces);
+
+ boolean result = compile(params);
+
+ if (tempdir != null)
+ SchemaCodeGenerator.tryHardToDelete(tempdir);
+
+ if (!result)
+ System.exit(1);
+
+ System.exit(0);
+ }
+
+ public static class Parameters
+ {
+ private File baseDir;
+ private File[] xsdFiles;
+ private File[] wsdlFiles;
+ private File[] javaFiles;
+ private File[] configFiles;
+ private File[] classpath;
+ private File outputJar;
+ private String name;
+ private File srcDir;
+ private File classesDir;
+ private String memoryInitialSize;
+ private String memoryMaximumSize;
+ private String compiler;
+ private String jar;
+ private boolean nojavac;
+ private boolean quiet;
+ private boolean verbose;
+ private boolean download;
+ private Collection errorListener;
+ private boolean noUpa;
+ private boolean noPvr;
+ private boolean debug;
+ private String repackage;
+ private List extensions = Collections.EMPTY_LIST;
+ private boolean jaxb;
+ private Set mdefNamespaces = Collections.EMPTY_SET;
+
+ public File getBaseDir()
+ {
+ return baseDir;
+ }
+
+ public void setBaseDir(File baseDir)
+ {
+ this.baseDir = baseDir;
+ }
+
+ public File[] getXsdFiles()
+ {
+ return xsdFiles;
+ }
+
+ public void setXsdFiles(File[] xsdFiles)
+ {
+ this.xsdFiles = xsdFiles;
+ }
+
+ public File[] getWsdlFiles()
+ {
+ return wsdlFiles;
+ }
+
+ public void setWsdlFiles(File[] wsdlFiles)
+ {
+ this.wsdlFiles = wsdlFiles;
+ }
+
+ public File[] getJavaFiles()
+ {
+ return javaFiles;
+ }
+
+ public void setJavaFiles(File[] javaFiles)
+ {
+ this.javaFiles = javaFiles;
+ }
+
+ public File[] getConfigFiles()
+ {
+ return configFiles;
+ }
+
+ public void setConfigFiles(File[] configFiles)
+ {
+ this.configFiles = configFiles;
+ }
+
+ public File[] getClasspath()
+ {
+ return classpath;
+ }
+
+ public void setClasspath(File[] classpath)
+ {
+ this.classpath = classpath;
+ }
+
+ public File getOutputJar()
+ {
+ return outputJar;
+ }
+
+ public void setOutputJar(File outputJar)
+ {
+ this.outputJar = outputJar;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public File getSrcDir()
+ {
+ return srcDir;
+ }
+
+ public void setSrcDir(File srcDir)
+ {
+ this.srcDir = srcDir;
+ }
+
+ public File getClassesDir()
+ {
+ return classesDir;
+ }
+
+ public void setClassesDir(File classesDir)
+ {
+ this.classesDir = classesDir;
+ }
+
+ public boolean isNojavac()
+ {
+ return nojavac;
+ }
+
+ public void setNojavac(boolean nojavac)
+ {
+ this.nojavac = nojavac;
+ }
+
+ public boolean isQuiet()
+ {
+ return quiet;
+ }
+
+ public void setQuiet(boolean quiet)
+ {
+ this.quiet = quiet;
+ }
+
+ public boolean isVerbose()
+ {
+ return verbose;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public boolean isDownload()
+ {
+ return download;
+ }
+
+ public void setDownload(boolean download)
+ {
+ this.download = download;
+ }
+
+ public boolean isNoUpa()
+ {
+ return noUpa;
+ }
+
+ public void setNoUpa(boolean noUpa)
+ {
+ this.noUpa = noUpa;
+ }
+
+ public boolean isNoPvr()
+ {
+ return noPvr;
+ }
+
+ public void setNoPvr(boolean noPvr)
+ {
+ this.noPvr = noPvr;
+ }
+
+ public boolean isDebug()
+ {
+ return debug;
+ }
+
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public String getMemoryInitialSize()
+ {
+ return memoryInitialSize;
+ }
+
+ public void setMemoryInitialSize(String memoryInitialSize)
+ {
+ this.memoryInitialSize = memoryInitialSize;
+ }
+
+ public String getMemoryMaximumSize()
+ {
+ return memoryMaximumSize;
+ }
+
+ public void setMemoryMaximumSize(String memoryMaximumSize)
+ {
+ this.memoryMaximumSize = memoryMaximumSize;
+ }
+
+ public String getCompiler()
+ {
+ return compiler;
+ }
+
+ public void setCompiler(String compiler)
+ {
+ this.compiler = compiler;
+ }
+
+ public String getJar()
+ {
+ return jar;
+ }
+
+ public void setJar(String jar)
+ {
+ this.jar = jar;
+ }
+
+
+ public void setJaxb(boolean jaxb)
+ {
+ this.jaxb = jaxb;
+ }
+
+ public boolean getJaxb()
+ {
+ return this.jaxb;
+ }
+
+ public Collection getErrorListener()
+ {
+ return errorListener;
+ }
+
+ public void setErrorListener(Collection errorListener)
+ {
+ this.errorListener = errorListener;
+ }
+
+ public String getRepackage()
+ {
+ return repackage;
+ }
+
+ public void setRepackage(String newRepackage)
+ {
+ repackage = newRepackage;
+ }
+
+ public List getExtensions() {
+ return extensions;
+ }
+
+ public void setExtensions(List extensions) {
+ this.extensions = extensions;
+ }
+
+ public Set getMdefNamespaces()
+ {
+ return mdefNamespaces;
+ }
+
+ public void setMdefNamespaces(Set mdefNamespaces)
+ {
+ this.mdefNamespaces = mdefNamespaces;
+ }
+
+ }
+
+ private static SchemaTypeSystem loadTypeSystem(
+ String name, File[] xsdFiles,
+ File[] wsdlFiles, File[] configFiles, ResourceLoader cpResourceLoader,
+ boolean download, boolean noUpa, boolean noPvr, Set mdefNamespaces,
+ File baseDir, Map sourcesToCopyMap, Collection outerErrorListener)
+ {
+ XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
+
+ // For parsing XSD and WSDL files, we should use the SchemaDocument
+ // classloader rather than the thread context classloader. This is
+ // because in some situations (such as when being invoked by ant
+ // underneath the ide) the context classloader is potentially weird
+ // (because of the design of ant).
+
+ SchemaTypeLoader loader = XmlBeans.typeLoaderForClassLoader(SchemaDocument.class.getClassLoader());
+
+ // step 1, parse all the XSD files.
+ ArrayList scontentlist = new ArrayList();
+ if (xsdFiles != null)
+ {
+ for (int i = 0; i < xsdFiles.length; i++)
+ {
+ try
+ {
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setLoadMessageDigest();
+ options.setLoadSubstituteNamespaces(MAP_COMPATIBILITY_CONFIG_URIS);
+
+ XmlObject schemadoc = loader.parse(xsdFiles[i], null, options);
+ if (!(schemadoc instanceof SchemaDocument))
+ {
+ StscState.addError(errorListener, "Document " + xsdFiles[i] + " is not a schema file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, schemadoc);
+ }
+ else
+ {
+ StscState.addInfo(errorListener, "Loading schema file " + xsdFiles[i]);
+ XmlOptions opts = new XmlOptions().setErrorListener(errorListener);
+ if (schemadoc.validate(opts))
+ scontentlist.add(((SchemaDocument)schemadoc).getSchema());
+ }
+ }
+ catch (XmlException e)
+ {
+ errorListener.add(e.getError());
+ }
+ catch (Exception e)
+ {
+ StscState.addError(errorListener, "Cannot load file " + xsdFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_FILE, xsdFiles[i]);
+ }
+ }
+ }
+
+ // step 2, parse all WSDL files
+ if (wsdlFiles != null)
+ {
+ for (int i = 0; i < wsdlFiles.length; i++)
+ {
+ try
+ {
+ XmlOptions options = new XmlOptions();
+ options.setLoadLineNumbers();
+ options.setLoadSubstituteNamespaces(Collections.singletonMap(
+ "http://schemas.xmlsoap.org/wsdl/", "http://www.apache.org/internal/xmlbeans/wsdlsubst"
+ ));
+
+
+ XmlObject wsdldoc = loader.parse(wsdlFiles[i], null, options);
+
+ if (!(wsdldoc instanceof org.apache.internal.xmlbeans.wsdlsubst.DefinitionsDocument))
+ StscState.addError(errorListener, "Document " + wsdlFiles[i] + " is not a wsdl file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdldoc);
+ else
+ {
+ if (wsdlContainsEncoded(wsdldoc))
+ StscState.addWarning(errorListener, "The WSDL " + wsdlFiles[i] + " uses SOAP encoding. SOAP encoding is not compatible with literal XML Schema.", XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdldoc);
+ StscState.addInfo(errorListener, "Loading wsdl file " + wsdlFiles[i]);
+ XmlObject[] types = ((org.apache.internal.xmlbeans.wsdlsubst.DefinitionsDocument)wsdldoc).getDefinitions().getTypesArray();
+ int count = 0;
+ for (int j = 0; j < types.length; j++)
+ {
+ XmlObject[] schemas = types[j].selectPath("declare namespace xs=\"http://www.w3.org/2001/XMLSchema\" xs:schema");
+ if (schemas.length == 0)
+ {
+ StscState.addWarning(errorListener, "The WSDL " + wsdlFiles[i] + " did not have any schema documents in namespace 'http://www.w3.org/2001/XMLSchema'", XmlErrorContext.GENERIC_ERROR, wsdldoc);
+ continue;
+ }
+
+ for (int k = 0; k < schemas.length; k++)
+ {
+ if (schemas[k] instanceof SchemaDocument.Schema &&
+ schemas[k].validate(new XmlOptions().setErrorListener(errorListener)))
+ {
+ count++;
+ scontentlist.add(schemas[k]);
+ }
+ }
+ }
+ StscState.addInfo(errorListener, "Processing " + count + " schema(s) in " + wsdlFiles[i].toString());
+ }
+ }
+ catch (XmlException e)
+ {
+ errorListener.add(e.getError());
+ }
+ catch (Exception e)
+ {
+ StscState.addError(errorListener, "Cannot load file " + wsdlFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdlFiles[i]);
+ }
+ }
+ }
+
+ SchemaDocument.Schema[] sdocs = (SchemaDocument.Schema[])scontentlist.toArray(new SchemaDocument.Schema[scontentlist.size()]);
+
+ // now the config files.
+ ArrayList cdoclist = new ArrayList();
+ if (configFiles != null)
+ {
+ for (int i = 0; i < configFiles.length; i++)
+ {
+ try
+ {
+ XmlOptions options = new XmlOptions();
+ options.put( XmlOptions.LOAD_LINE_NUMBERS );
+ options.setLoadSubstituteNamespaces(MAP_COMPATIBILITY_CONFIG_URIS);
+
+ XmlObject configdoc = loader.parse(configFiles[i], null, options);
+ if (!(configdoc instanceof ConfigDocument))
+ StscState.addError(errorListener, "Document " + configFiles[i] + " is not an xsd config file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, configdoc);
+ else
+ {
+ StscState.addInfo(errorListener, "Loading config file " + configFiles[i]);
+ if (configdoc.validate(new XmlOptions().setErrorListener(errorListener)))
+ cdoclist.add(((ConfigDocument)configdoc).getConfig());
+ }
+ }
+ catch (XmlException e)
+ {
+ errorListener.add(e.getError());
+ }
+ catch (Exception e)
+ {
+ StscState.addError(errorListener, "Cannot load xsd config file " + configFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_CONFIG_FILE, configFiles[i]);
+ }
+ }
+ }
+ ConfigDocument.Config[] cdocs = (ConfigDocument.Config[])cdoclist.toArray(new ConfigDocument.Config[cdoclist.size()]);
+
+ SchemaTypeLoader linkTo = SchemaTypeLoaderImpl.build(null, cpResourceLoader, null);
+
+ URI baseURI = null;
+ if (baseDir != null)
+ baseURI = baseDir.toURI();
+
+ XmlOptions opts = new XmlOptions();
+ if (download)
+ opts.setCompileDownloadUrls();
+ if (noUpa)
+ opts.setCompileNoUpaRule();
+ if (noPvr)
+ opts.setCompileNoPvrRule();
+ if (mdefNamespaces != null)
+ opts.setCompileMdefNamespaces(mdefNamespaces);
+ opts.setCompileNoValidation(); // already validated here
+
+ // now pass it to the main compile function
+ SchemaTypeSystemCompiler.Parameters params = new SchemaTypeSystemCompiler.Parameters();
+ params.setName(name);
+ params.setSchemas(sdocs);
+ params.setConfigs(cdocs);
+ params.setLinkTo(linkTo);
+ params.setOptions(opts);
+ params.setErrorListener(errorListener);
+ params.setJavaize(true);
+ params.setBaseURI(baseURI);
+ params.setSourcesToCopyMap(sourcesToCopyMap);
+ return SchemaTypeSystemCompiler.compile(params);
+ }
+
+ public static boolean compile(Parameters params)
+ {
+ File baseDir = params.getBaseDir();
+ File[] xsdFiles = params.getXsdFiles();
+ File[] wsdlFiles = params.getWsdlFiles();
+ File[] javaFiles = params.getJavaFiles();
+ File[] configFiles = params.getConfigFiles();
+ File[] classpath = params.getClasspath();
+ File outputJar = params.getOutputJar();
+ String name = params.getName();
+ File srcDir = params.getSrcDir();
+ File classesDir = params.getClassesDir();
+ String compiler = params.getCompiler();
+ String jar = params.getJar();
+ String memoryInitialSize = params.getMemoryInitialSize();
+ String memoryMaximumSize = params.getMemoryMaximumSize();
+ boolean nojavac = params.isNojavac();
+ boolean debug = params.isDebug();
+ boolean verbose = params.isVerbose();
+ boolean quiet = params.isQuiet();
+ boolean download = params.isDownload();
+ boolean noUpa = params.isNoUpa();
+ boolean noPvr = params.isNoPvr();
+ Collection outerErrorListener = params.getErrorListener();
+ String repackage = params.getRepackage();
+ List extensions = params.getExtensions();
+ boolean jaxb = params.getJaxb();
+ Set mdefNamespaces = params.getMdefNamespaces();
+
+ if (srcDir == null || classesDir == null)
+ throw new IllegalArgumentException("src and class gen directories may not be null.");
+
+ long start = System.currentTimeMillis();
+
+ // Calculate the usenames based on the relativized filenames on the filesystem
+ if (baseDir == null)
+ baseDir = new File(System.getProperty("user.dir"));
+
+ ResourceLoader cpResourceLoader = null;
+
+ Map sourcesToCopyMap = new HashMap();
+
+ if (classpath != null)
+ cpResourceLoader = new PathResourceLoader(classpath);
+
+ boolean result = true;
+
+ // build the in-memory type system
+ XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
+ SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, configFiles, cpResourceLoader, download, noUpa, noPvr, mdefNamespaces, baseDir, sourcesToCopyMap, errorListener);
+ if (errorListener.hasError())
+ result = false;
+ long finish = System.currentTimeMillis();
+ if (!quiet)
+ System.out.println("Time to build schema type system: " + ((double)(finish - start) / 1000.0) + " seconds" );
+
+ // now code generate and compile the JAR
+ if (result && system != null) // todo: don't check "result" here if we want to compile anyway, ignoring invalid schemas
+ {
+ start = System.currentTimeMillis();
+
+ // generate source and .xsb
+ List sourcefiles = new ArrayList();
+ result &= SchemaCodeGenerator.compileTypeSystem(system, srcDir, javaFiles, sourcesToCopyMap, classpath, classesDir, outputJar, nojavac, jaxb, errorListener, repackage, verbose, sourcefiles);
+ result &= !errorListener.hasError();
+
+ if (result)
+ {
+ finish = System.currentTimeMillis();
+ if (!quiet)
+ System.out.println("Time to generate code: " + ((double)(finish - start) / 1000.0) + " seconds" );
+ }
+
+ // compile source
+ if (result && !nojavac)
+ {
+ start = System.currentTimeMillis();
+
+ if (javaFiles != null)
+ sourcefiles.addAll(java.util.Arrays.asList(javaFiles));
+ if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, memoryInitialSize, memoryMaximumSize, quiet, verbose))
+ result = false;
+
+ finish = System.currentTimeMillis();
+ if (result && !params.isQuiet())
+ System.out.println("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds" );
+
+ // jar classes and .xsb
+ if (result && outputJar != null)
+ {
+ if (!CodeGenUtil.externalJar(classesDir, outputJar, jar, quiet, verbose))
+ result = false;
+
+ if (result && !params.isQuiet())
+ System.out.println("Compiled types to: " + outputJar);
+ }
+ }
+ }
+
+ if (!result && !quiet)
+ {
+ System.out.println("BUILD FAILED");
+ }
+ else {
+ // call schema compiler extension if registered
+ runExtensions(extensions, system, classesDir);
+ }
+
+ if (cpResourceLoader != null)
+ cpResourceLoader.close();
+ return result;
+ }
+
+ private static void runExtensions(List extensions, SchemaTypeSystem system, File classesDir)
+ {
+ if (extensions != null && extensions.size() > 0)
+ {
+ SchemaCompilerExtension sce = null;
+ Iterator i = extensions.iterator();
+ Map extensionParms = null;
+ String classesDirName = null;
+ try
+ {
+ classesDirName = classesDir.getCanonicalPath();
+ }
+ catch(java.io.IOException e)
+ {
+ System.out.println("WARNING: Unable to get the path for schema jar file");
+ classesDirName = classesDir.getAbsolutePath();
+ }
+
+ while (i.hasNext())
+ {
+ Extension extension = (Extension) i.next();
+ try
+ {
+ sce = (SchemaCompilerExtension) extension.getClassName().newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ System.out.println("UNABLE to instantiate schema compiler extension:" + extension.getClassName().getName());
+ System.out.println("EXTENSION Class was not run");
+ break;
+ }
+ catch (IllegalAccessException e)
+ {
+ System.out.println("ILLEGAL ACCESS Exception when attempting to instantiate schema compiler extension: " + extension.getClassName().getName());
+ System.out.println("EXTENSION Class was not run");
+ break;
+ }
+
+ System.out.println("Running Extension: " + sce.getExtensionName());
+ extensionParms = new HashMap();
+ Iterator parmsi = extension.getParams().iterator();
+ while (parmsi.hasNext())
+ {
+ Extension.Param p = (Extension.Param) parmsi.next();
+ extensionParms.put(p.getName(), p.getValue());
+ }
+ extensionParms.put("classesDir", classesDirName);
+ sce.schemaCompilerExtension(system, extensionParms);
+ }
+ }
+ }
+
+
+ private static boolean wsdlContainsEncoded(XmlObject wsdldoc)
+ {
+ // search for any <soap:body use="encoded"/> etc.
+ XmlObject[] useAttrs = wsdldoc.selectPath(
+ "declare namespace soap='http://schemas.xmlsoap.org/wsdl/soap/' " +
+ ".//soap:body/@use|.//soap:header/@use|.//soap:fault/@use");
+ for (int i = 0; i < useAttrs.length; i++)
+ {
+ if ("encoded".equals(((SimpleValue)useAttrs[i]).getStringValue()))
+ return true;
+ }
+ return false;
+ }
+
+ private static final String CONFIG_URI = "http://xml.apache.org/xmlbeans/2004/02/xbean/config";
+ private static final String COMPATIBILITY_CONFIG_URI = "http://www.bea.com/2002/09/xbean/config";
+ private static final Map MAP_COMPATIBILITY_CONFIG_URIS;
+ static
+ {
+ MAP_COMPATIBILITY_CONFIG_URIS = new HashMap();
+ MAP_COMPATIBILITY_CONFIG_URIS.put(COMPATIBILITY_CONFIG_URI, CONFIG_URI);
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompilerExtension.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompilerExtension.java
new file mode 100644
index 0000000..0641576
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompilerExtension.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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.SchemaTypeSystem;
+
+import java.util.Map;
+
+
+/**
+ * This interface is implemented by Schema Compiler Extensions. By implementing this class
+ * you can then pass this class via the command line param <i>extension</i> to the SchemaCompiler class
+ * which will then in turn call this class back once the compilation is complete with the resulting
+ * SchemaTypeSystem.
+ */
+public interface SchemaCompilerExtension {
+ /**
+ * Implement this function to be called back by the XmlBeans Schema Compiler with
+ * the Schema Type System that has been created as a result of the compile.
+ * @param schemaTypeSystem - The schema type systems that has been created by the compiler just prior to calling
+ * this extension class.
+ * @param parms - name value pairs of options to this schema compiler extension
+ */
+ public void schemaCompilerExtension(SchemaTypeSystem schemaTypeSystem, Map parms);
+ public String getExtensionName();
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCopy.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCopy.java
new file mode 100644
index 0000000..d78cbce
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCopy.java
@@ -0,0 +1,244 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.impl.common.IOUtil;
+import org.apache.internal.xmlbeans.wsdlsubst.DefinitionsDocument;
+import org.apache.internal.xmlbeans.wsdlsubst.TImport;
+
+import java.net.URI;
+import java.net.URL;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.io.File;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.w3.x2001.xmlSchema.ImportDocument;
+import org.w3.x2001.xmlSchema.IncludeDocument;
+
+public class SchemaCopy
+{
+
+ public static void main(String[] args)
+ {
+ if (args.length < 1 || args.length > 2)
+ {
+ System.out.println("Usage: schemacopy sourceurl [targetfile]");
+ return;
+ }
+
+ URI source = null;
+ URI target = null;
+
+ try
+ {
+ source = new URI(args[0]);
+ source.toURL(); // to trigger exception
+ }
+ catch (Exception e)
+ {
+ System.err.println("Badly formed URL " + source);
+ return;
+ }
+
+ if (args.length < 2)
+ {
+ try
+ {
+ URI dir = new File(".").getCanonicalFile().toURI();
+ String lastPart = source.getPath();
+ lastPart = lastPart.substring(lastPart.lastIndexOf('/') + 1);
+ target = CodeGenUtil.resolve(dir, URI.create(lastPart));
+ }
+ catch (Exception e)
+ {
+ System.err.println("Cannot canonicalize current directory");
+ return;
+ }
+ }
+ else
+ {
+ try
+ {
+ target = new URI(args[1]);
+ if (!target.isAbsolute())
+ target = null;
+ else if (!target.getScheme().equals("file"))
+ target = null;
+ }
+ catch (Exception e)
+ {
+ target = null;
+ }
+
+ if (target == null)
+ {
+ try
+ {
+ target = new File(target).getCanonicalFile().toURI();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Cannot canonicalize current directory");
+ return;
+ }
+ }
+ }
+
+ Map thingsToCopy = findAllRelative(source, target);
+ copyAll(thingsToCopy, true);
+ }
+
+ private static void copyAll(Map uriMap, boolean stdout)
+ {
+ for (Iterator i = uriMap.keySet().iterator(); i.hasNext(); )
+ {
+ URI source = (URI)i.next();
+ URI target = (URI)uriMap.get(source);
+ try
+ {
+ IOUtil.copyCompletely(source, target);
+ }
+ catch (Exception e)
+ {
+ if (stdout)
+ System.out.println("Could not copy " + source + " -> " + target);
+ continue;
+ }
+ if (stdout)
+ System.out.println("Copied " + source + " -> " + target);
+ }
+ }
+
+
+ /**
+ * Copies the schema or wsdl at the source URI to the target URI, along
+ * with any relative references. The target URI should be a file URI.
+ * If doCopy is false, the file copies are not actually done; the map
+ * returned just describes the copies that would have been done.
+ *
+ * @param source an arbitrary URI describing a source Schema or WSDL
+ * @param target a file URI describing a target filename
+ * @return a map of all the source/target URIs needed to copy
+ * the file along with all its relative referents.
+ */
+ public static Map findAllRelative(URI source, URI target)
+ {
+ Map result = new LinkedHashMap();
+ result.put(source, target);
+
+ LinkedList process = new LinkedList();
+ process.add(source);
+
+ while (!process.isEmpty())
+ {
+ URI nextSource = (URI)process.removeFirst();
+ URI nextTarget = (URI)result.get(nextSource);
+ Map nextResults = findRelativeInOne(nextSource, nextTarget);
+ for (Iterator i = nextResults.keySet().iterator(); i.hasNext(); )
+ {
+ URI newSource = (URI)i.next();
+ if (result.containsKey(newSource))
+ continue;
+ result.put(newSource, nextResults.get(newSource));
+ process.add(newSource);
+ }
+ }
+
+ return result;
+ }
+
+ private static final XmlOptions loadOptions = new XmlOptions().
+ setLoadSubstituteNamespaces(Collections.singletonMap(
+ "http://schemas.xmlsoap.org/wsdl/", "http://www.apache.org/internal/xmlbeans/wsdlsubst"
+ ));
+
+ private static Map findRelativeInOne(URI source, URI target)
+ {
+ try
+ {
+ URL sourceURL = source.toURL();
+ XmlObject xobj = XmlObject.Factory.parse(sourceURL, loadOptions);
+ XmlCursor xcur = xobj.newCursor();
+ xcur.toFirstChild();
+
+ Map result = new LinkedHashMap();
+
+ if (xobj instanceof SchemaDocument)
+ putMappingsFromSchema(result, source, target, ((SchemaDocument)xobj).getSchema());
+ else if (xobj instanceof DefinitionsDocument)
+ putMappingsFromWsdl(result, source, target, ((DefinitionsDocument)xobj).getDefinitions());
+ return result;
+ }
+ catch (Exception e)
+ {
+ // any exceptions parsing the given URL? Then skip this file silently
+ }
+ return Collections.EMPTY_MAP;
+ }
+
+ private static void putNewMapping(Map result, URI origSource, URI origTarget, String literalURI)
+ {
+ try
+ {
+ if (literalURI == null)
+ return;
+ URI newRelative = new URI(literalURI);
+ if (newRelative.isAbsolute())
+ return;
+ URI newSource = CodeGenUtil.resolve(origSource, newRelative);
+ URI newTarget = CodeGenUtil.resolve(origTarget, newRelative);
+ result.put(newSource, newTarget);
+ }
+ catch (URISyntaxException e)
+ {
+ // uri syntax problem? do nothing silently.
+ }
+ }
+
+ private static void putMappingsFromSchema(Map result, URI source, URI target, SchemaDocument.Schema schema)
+ {
+ ImportDocument.Import[] imports = schema.getImportArray();
+ for (int i = 0; i < imports.length; i++)
+ putNewMapping(result, source, target, imports[i].getSchemaLocation());
+
+ IncludeDocument.Include[] includes = schema.getIncludeArray();
+ for (int i = 0; i < includes.length; i++)
+ putNewMapping(result, source, target, includes[i].getSchemaLocation());
+ }
+
+ private static void putMappingsFromWsdl(Map result, URI source, URI target, DefinitionsDocument.Definitions wdoc)
+ {
+ XmlObject[] types = wdoc.getTypesArray();
+ for (int i = 0; i < types.length; i++)
+ {
+ SchemaDocument.Schema[] schemas = (SchemaDocument.Schema[])types[i].selectPath("declare namespace xs='http://www.w3.org/2001/XMLSchema' xs:schema");
+ for (int j = 0; j < schemas.length; j++)
+ putMappingsFromSchema(result, source, target, schemas[j]);
+ }
+
+ TImport[] imports = wdoc.getImportArray();
+ for (int i = 0; i < imports.length; i++)
+ putNewMapping(result, source, target, imports[i].getLocation());
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaImportResolver.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaImportResolver.java
new file mode 100644
index 0000000..3b8e0c2
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaImportResolver.java
@@ -0,0 +1,147 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+import org.w3.x2001.xmlSchema.ImportDocument.Import;
+import org.w3.x2001.xmlSchema.IncludeDocument.Include;
+
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+public abstract class SchemaImportResolver
+{
+ /**
+ * Called when the ImportLoader wishes to resolve the
+ * given import. Should return a SchemaResource whose
+ * "equals" relationship reveals when a SchemaResource is
+ * duplicated and shouldn't be examined again.
+ *
+ * Returns null if the resource reference should be ignored.
+ */
+ public abstract SchemaResource lookupResource(String nsURI, String URL);
+
+ /**
+ * Called to notify that the expected namespace is different from the
+ * actual namespace, or if no namespace is known, to report the
+ * discovered namespace.
+ */
+ public abstract void reportActualNamespace(SchemaResource resource, String actualNamespace);
+
+ /**
+ * Used to supply a schema resource with an optional associated
+ * expected-namespace-URI and original-location-URL.
+ *
+ * The equals (and hashCode) implementations of the SchemaResource
+ * objects will be used to avoid examining the same resource twice;
+ * these must be implemented according to the desired rules for
+ * determining that two resources are the same.
+ */
+ public interface SchemaResource
+ {
+ /**
+ * Returns a parsed schema object.
+ */
+
+ public Schema getSchema();
+
+ public String getNamespace();
+ public String getSchemaLocation();
+ }
+
+ protected final void resolveImports(SchemaResource[] resources)
+ {
+ LinkedList queueOfResources = new LinkedList(Arrays.asList(resources));
+ LinkedList queueOfLocators = new LinkedList();
+ Set seenResources = new HashSet();
+
+ for (;;)
+ {
+ SchemaResource nextResource;
+
+ // fetch next resource.
+ if (!queueOfResources.isEmpty())
+ {
+ // either off the initial queue
+ nextResource = (SchemaResource)queueOfResources.removeFirst();
+ }
+ else if (!queueOfLocators.isEmpty())
+ {
+ // or off the list of locators
+ SchemaLocator locator = (SchemaLocator)queueOfLocators.removeFirst();
+ nextResource = lookupResource(locator.namespace, locator.schemaLocation);
+ if (nextResource == null)
+ continue;
+ }
+ else
+ {
+ // if no more, then terminate loop
+ break;
+ }
+
+ // track and skip duplicates
+ if (seenResources.contains(nextResource))
+ continue;
+ seenResources.add(nextResource);
+
+ // get resource contents
+ Schema schema = nextResource.getSchema();
+ if (schema == null)
+ continue;
+
+ // check actual namespace
+ String actualTargetNamespace = schema.getTargetNamespace();
+ if (actualTargetNamespace == null)
+ actualTargetNamespace = "";
+
+ // report actual namespace
+ String expectedTargetNamespace = nextResource.getNamespace();
+ if (expectedTargetNamespace == null ||
+ !actualTargetNamespace.equals(expectedTargetNamespace))
+ {
+ reportActualNamespace(nextResource, actualTargetNamespace);
+ }
+
+ // now go through and record all the imports
+ Import[] schemaImports = schema.getImportArray();
+ for (int i = 0; i < schemaImports.length; i++)
+ {
+ queueOfLocators.add(new SchemaLocator(schemaImports[i].getNamespace() == null ? "" : schemaImports[i].getNamespace(), schemaImports[i].getSchemaLocation()));
+ }
+
+ // and record all the includes too
+ Include[] schemaIncludes = schema.getIncludeArray();
+ for (int i = 0; i < schemaIncludes.length; i++)
+ {
+ queueOfLocators.add(new SchemaLocator(null, schemaIncludes[i].getSchemaLocation()));
+ }
+ }
+ }
+
+ private static class SchemaLocator
+ {
+ public SchemaLocator(String namespace, String schemaLocation)
+ {
+ this.namespace = namespace;
+ this.schemaLocation = schemaLocation;
+ }
+
+ public final String namespace;
+ public final String schemaLocation;
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaResourceManager.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaResourceManager.java
new file mode 100644
index 0000000..6c9cb32
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaResourceManager.java
@@ -0,0 +1,269 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.impl.common.IOUtil;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.FileFilter;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.Set;
+
+public class SchemaResourceManager extends BaseSchemaResourceManager
+{
+ public static void main(String[] args) throws IOException
+ {
+ if (args.length == 0)
+ {
+ System.out.println("Maintains \"xsdownload.xml\", an index of locally downloaded .xsd files");
+ System.out.println("usage: sdownload [-dir directory] [-refresh] [-recurse] [-sync] [url/file...]");
+ System.out.println("");
+ System.out.println("URLs that are specified are downloaded if they aren't already cached.");
+ System.out.println("In addition:");
+ System.out.println(" -dir specifies the directory for the xsdownload.xml file (default .).");
+ System.out.println(" -sync synchronizes the index to any local .xsd files in the tree.");
+ System.out.println(" -recurse recursively downloads imported and included .xsd files.");
+ System.out.println(" -refresh redownloads all indexed .xsd files.");
+ System.out.println("If no files or URLs are specified, all indexed files are relevant.");
+ System.exit(0);
+ return;
+ }
+
+ Set opts = new HashSet();
+ opts.add("dir");
+ CommandLine cl = new CommandLine(args, opts);
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+
+ args = cl.args();
+
+ boolean sync = (cl.getOpt("sync") != null);
+ boolean refresh = (cl.getOpt("refresh") != null);
+ boolean imports = (cl.getOpt("recurse") != null);
+ String dir = cl.getOpt("dir");
+ if (dir == null)
+ dir = ".";
+ File directory = new File(dir);
+
+ SchemaResourceManager mgr;
+ try
+ {
+ mgr = new SchemaResourceManager(directory);
+ }
+ catch (IllegalStateException e)
+ {
+ if (e.getMessage() != null)
+ System.out.println(e.getMessage());
+ else
+ e.printStackTrace();
+ System.exit(1);
+ return;
+ }
+
+ List uriList = new ArrayList();
+ List fileList = new ArrayList();
+ for (int i = 0; i < args.length; i++)
+ {
+ if (looksLikeURL(args[i]))
+ {
+ uriList.add(args[i]);
+ }
+ else
+ {
+ fileList.add(new File(directory, args[i]));
+ }
+ }
+
+ // deal with files that are not in the proper directory
+ for (Iterator i = fileList.iterator(); i.hasNext(); )
+ {
+ File file = (File)i.next();
+ if (!isInDirectory(file, directory))
+ {
+ System.err.println("File not within directory: " + file);
+ i.remove();
+ }
+ }
+
+ // deal with directories
+ fileList = collectXSDFiles((File[])fileList.toArray(new File[0]));
+
+ String[] uris = (String[])uriList.toArray(new String[0]);
+ File[] files = (File[])fileList.toArray(new File[0]);
+ String[] filenames = relativeFilenames(files, directory);
+
+ if (uris.length + filenames.length > 0)
+ {
+ mgr.process(uris, filenames, sync, refresh, imports);
+ }
+ else
+ {
+ mgr.processAll(sync, refresh, imports);
+ }
+
+ mgr.writeCache();
+ System.exit(0);
+ }
+
+ private static boolean looksLikeURL(String str)
+ {
+ return str.startsWith("http:") || str.startsWith("https:") || str.startsWith("ftp:") || str.startsWith("file:");
+ }
+
+ private static String relativeFilename(File file, File directory)
+ {
+ if (file == null || file.equals(directory))
+ return ".";
+ return relativeFilename(file.getParentFile(), directory) + "/" + file.getName();
+ }
+
+ private static String[] relativeFilenames(File[] files, File directory)
+ {
+ String[] result = new String[files.length];
+ for (int i = 0; i < files.length; i++)
+ {
+ result[i] = relativeFilename(files[i], directory);
+ }
+ return result;
+ }
+
+ private static boolean isInDirectory(File file, File dir)
+ {
+ if (file == null)
+ return false;
+ if (file.equals(dir))
+ return true;
+ return isInDirectory(file.getParentFile(), dir);
+ }
+
+
+
+
+
+ public SchemaResourceManager(File directory)
+ {
+ _directory = directory;
+ init();
+ }
+
+ private File _directory;
+
+
+ // SOME METHODS TO OVERRIDE ============================
+
+ /**
+ * Sends messages to System.out.
+ */
+ protected void warning(String msg)
+ {
+ System.out.println(msg);
+ }
+
+ /**
+ * Returns true if the given filename exists. The filenames
+ * are of the form "/foo/bar/zee.xsd" and should be construed
+ * as rooted at the root of the project.
+ */
+ protected boolean fileExists(String filename)
+ {
+ return (new File(_directory, filename)).exists();
+ }
+
+ /**
+ * Gets the data in the given filename as an InputStream.
+ */
+ protected InputStream inputStreamForFile(String filename) throws IOException
+ {
+ return new FileInputStream(new File(_directory, filename));
+ }
+
+ /**
+ * Writes an entire file in one step. An InputStream is passed and
+ * copied to the file.
+ */
+ protected void writeInputStreamToFile(InputStream input, String filename) throws IOException
+ {
+ File targetFile = new File(_directory, filename);
+
+ File parent = targetFile.getParentFile();
+ if (!parent.exists())
+ parent.mkdirs();
+ OutputStream output = new FileOutputStream(targetFile);
+ IOUtil.copyCompletely(input, output);
+ }
+
+ /**
+ * Deletes a file. Sometimes immediately after writing a new file
+ * we notice that it's exactly the same as an existing file and
+ * we delete it. We never delete a file that was given to us
+ * by the user.
+ */
+ protected void deleteFile(String filename)
+ {
+ new File(_directory, filename).delete();
+ }
+
+ /**
+ * Returns a list of all the XSD filesnames in the project.
+ */
+ protected String[] getAllXSDFilenames()
+ {
+ File[] allFiles = (File[])collectXSDFiles(new File[] { _directory }).toArray(new File[0]);
+ return relativeFilenames(allFiles, _directory);
+ }
+
+ /**
+ * Simple recursive file filter to do the above.
+ */
+ private static List collectXSDFiles(File[] dirs)
+ {
+ List files = new ArrayList();
+ for (int i = 0; i < dirs.length; i++)
+ {
+ File f = dirs[i];
+ if (!f.isDirectory())
+ {
+ files.add(f);
+ }
+ else
+ {
+ files.addAll(collectXSDFiles(
+ f.listFiles(new FileFilter()
+ {
+ public boolean accept(File file)
+ { return file.isDirectory() ||
+ file.isFile() &&
+ file.getName().endsWith(".xsd"); }
+ }
+ )));
+ }
+ }
+ return files;
+ }
+
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
new file mode 100644
index 0000000..1df2514
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/TypeHierarchyPrinter.java
@@ -0,0 +1,220 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Arrays;
+import java.io.File;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+
+public class TypeHierarchyPrinter
+{
+ public static void main(String[] args) throws Exception
+ {
+ CommandLine cl = new CommandLine(args, Collections.EMPTY_SET);
+ if (cl.getOpt("license") != null)
+ {
+ CommandLine.printLicense();
+ System.exit(0);
+ return;
+ }
+ if (cl.args().length == 0)
+ {
+ System.out.println("Prints inheritance hierarchy of types defined in a schema.");
+ System.out.println("Usage: xsdtree [-noanon] [-nopvr] [-noupa] [-license] file1.xsd file2.xsd ...");
+ return;
+ }
+
+ boolean noanon = (cl.getOpt("noanon") != null);
+ boolean nopvr = (cl.getOpt("nopvr") != null);
+ boolean noupa = (cl.getOpt("noupa") != null);
+
+ File[] schemaFiles = cl.getFiles();
+
+ // step 1: load all the files
+ List sdocs = new ArrayList();
+ for (int i = 0; i < schemaFiles.length; i++)
+ {
+ try
+ {
+ sdocs.add(
+ SchemaDocument.Factory.parse(
+ schemaFiles[i], (new XmlOptions()).setLoadLineNumbers()));
+ }
+ catch (Exception e)
+ {
+ System.err.println( schemaFiles[i] + " not loadable: " + e );
+ }
+ }
+
+
+ XmlObject[] schemas = (XmlObject[])sdocs.toArray(new XmlObject[0]);
+
+ // step 2: compile all the schemas
+ SchemaTypeSystem typeSystem;
+ Collection compErrors = new ArrayList();
+ XmlOptions schemaOptions = new XmlOptions();
+ schemaOptions.setErrorListener(compErrors);
+ schemaOptions.setCompileDownloadUrls();
+ if (nopvr)
+ schemaOptions.setCompileNoPvrRule();
+ if (noupa)
+ schemaOptions.setCompileNoUpaRule();
+
+ try
+ {
+ typeSystem = XmlBeans.compileXsd(schemas, XmlBeans.getBuiltinTypeSystem(), schemaOptions);
+ }
+ catch (XmlException e)
+ {
+ System.out.println("Schema invalid");
+ if (compErrors.isEmpty())
+ System.out.println(e.getMessage());
+ else for (Iterator i = compErrors.iterator(); i.hasNext(); )
+ System.out.println(i.next());
+ return;
+ }
+
+ // step 3: go through all the types, and note their base types and namespaces
+ Map prefixes = new HashMap();
+ prefixes.put("http://www.w3.org/XML/1998/namespace", "xml");
+ prefixes.put("http://www.w3.org/2001/XMLSchema", "xs");
+ System.out.println("xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"");
+
+ // This will be a map of (base SchemaType -> Collection of directly dervied types)
+ Map childTypes = new HashMap();
+
+ // breadthfirst traversal of the type containment tree
+ List allSeenTypes = new ArrayList();
+ allSeenTypes.addAll(Arrays.asList(typeSystem.documentTypes()));
+ allSeenTypes.addAll(Arrays.asList(typeSystem.attributeTypes()));
+ allSeenTypes.addAll(Arrays.asList(typeSystem.globalTypes()));
+
+ for (int i = 0; i < allSeenTypes.size(); i++)
+ {
+ SchemaType sType = (SchemaType)allSeenTypes.get(i);
+
+ // recurse through nested anonymous types as well
+ if (!noanon)
+ allSeenTypes.addAll(Arrays.asList(sType.getAnonymousTypes()));
+
+ // we're not interested in document types, attribute types, or chasing the base type of anyType
+ if (sType.isDocumentType() || sType.isAttributeType() || sType == XmlObject.type)
+ continue;
+
+ // assign a prefix to the namespace of this type if needed
+ noteNamespace(prefixes, sType);
+
+ // enter this type in the list of children of its base type
+ Collection children = (Collection)childTypes.get(sType.getBaseType());
+ if (children == null)
+ {
+ children = new ArrayList();
+ childTypes.put(sType.getBaseType(), children);
+
+ // the first time a builtin type is seen, add it too (to get a complete tree up to anyType)
+ if (sType.getBaseType().isBuiltinType())
+ allSeenTypes.add(sType.getBaseType());
+ }
+ children.add(sType);
+ }
+
+ // step 4: print the tree, starting from xs:anyType (i.e., XmlObject.type)
+ List typesToPrint = new ArrayList();
+ typesToPrint.add(XmlObject.type);
+ StringBuffer spaces = new StringBuffer();
+ while (!typesToPrint.isEmpty())
+ {
+ SchemaType sType = (SchemaType)typesToPrint.remove(typesToPrint.size() - 1);
+ if (sType == null)
+ spaces.setLength(Math.max(0, spaces.length() - 2));
+ else
+ {
+ System.out.println(spaces + "+-" + QNameHelper.readable(sType, prefixes) + notes(sType));
+ Collection children = (Collection)childTypes.get(sType);
+ if (children != null && children.size() > 0)
+ {
+ spaces.append(typesToPrint.size() == 0 || typesToPrint.get(typesToPrint.size() - 1) == null ? " " : "| ");
+ typesToPrint.add(null);
+ typesToPrint.addAll(children);
+ }
+ }
+ }
+ }
+
+ private static String notes(SchemaType sType)
+ {
+ if (sType.isBuiltinType())
+ return " (builtin)";
+
+ if (sType.isSimpleType())
+ {
+ switch (sType.getSimpleVariety())
+ {
+ case SchemaType.LIST:
+ return " (list)";
+ case SchemaType.UNION:
+ return " (union)";
+ default:
+ if (sType.getEnumerationValues() != null)
+ return " (enumeration)";
+ return "";
+ }
+ }
+
+ switch (sType.getContentType())
+ {
+ case SchemaType.MIXED_CONTENT:
+ return " (mixed)";
+ case SchemaType.SIMPLE_CONTENT:
+ return " (complex)";
+ default:
+ return "";
+ }
+ }
+
+ private static void noteNamespace(Map prefixes, SchemaType sType)
+ {
+ String namespace = QNameHelper.namespace(sType);
+ if (namespace.equals("") || prefixes.containsKey(namespace))
+ return;
+
+ String base = QNameHelper.suggestPrefix(namespace);
+ String result = base;
+ for (int n = 0; prefixes.containsValue(result); n += 1)
+ {
+ result = base + n;
+ }
+
+ prefixes.put(namespace, result);
+ System.out.println("xmlns:" + result + "=\"" + namespace + "\"");
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java
new file mode 100644
index 0000000..90a5e07
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java
@@ -0,0 +1,727 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.taskdefs.Jar;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.FileScanner;
+import org.apache.tools.ant.Project;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+import java.util.*;
+import java.net.URI;
+
+import org.apache.xmlbeans.XmlError;
+
+/**
+ * Modeled after Ant's javac and zip tasks.
+ *
+ * Schema files to process, or directories of schema files, are set with the 'schema'
+ * attribute, and can be filtered with 'includes' and 'excludes'.
+ * Alternatively, one or more nested <fileset> elements can specify the
+ * files and directories to be used to generate this XMLBean.
+ * The include set can also define .java files that should be built as well.
+ * See the FileSet documentation at http://jakarta.apache.org/ant/manual/index.html
+ * for instructions on FileSets if you are unfamiliar with their usage.
+ */
+
+public class XMLBean extends MatchingTask
+{
+ private ArrayList schemas = new ArrayList();
+
+ private Set mdefnamespaces;
+
+ private Path classpath;
+
+ private File destfile,
+ schema,
+ srcgendir,
+ classgendir;
+
+ private boolean quiet,
+ verbose,
+ debug,
+ optimize,
+ download,
+ srconly,
+ failonerror = true,
+ fork = true,
+ includeAntRuntime = true,
+ includeJavaRuntime = false;
+
+ private String typesystemname,
+ forkedExecutable,
+ compiler,
+ debugLevel,
+ memoryInitialSize,
+ memoryMaximumSize;
+
+ private List extensions = new ArrayList();
+
+ private HashMap _extRouter = new HashMap(5);
+
+ private static final String XSD = ".xsd",
+ WSDL = ".wsdl",
+ JAVA = ".java",
+ XSDCONFIG = ".xsdconfig";
+
+
+ public void execute() throws BuildException
+ {
+ /* VALIDATION */
+ //required
+ if (schemas.size() == 0
+ && schema == null
+ && fileset.getDir(project) == null)
+ {
+ String msg = "The 'schema' or 'dir' attribute or a nested fileset is required.";
+ if (failonerror)
+ throw new BuildException(msg);
+ else
+ {
+ log(msg, Project.MSG_ERR);
+ return;
+ }
+ }
+
+ _extRouter.put(XSD, new HashSet());
+ _extRouter.put(WSDL, new HashSet());
+ _extRouter.put(JAVA, new HashSet());
+ _extRouter.put(XSDCONFIG, new HashSet());
+
+ File theBasedir = schema;
+
+ if (schema != null)
+ {
+ if (schema.isDirectory())
+ {
+ FileScanner scanner = getDirectoryScanner(schema);
+ String[] paths = scanner.getIncludedFiles();
+ processPaths(paths, scanner.getBasedir());
+ }
+ else
+ {
+ theBasedir = schema.getParentFile();
+ processPaths(new String[] { schema.getName() }, theBasedir);
+ }
+ }
+
+ if (fileset.getDir(project) != null)
+ schemas.add(fileset);
+
+ Iterator si = schemas.iterator();
+ while (si.hasNext())
+ {
+ FileSet fs = (FileSet) si.next();
+ FileScanner scanner = fs.getDirectoryScanner(project);
+ File basedir = scanner.getBasedir();
+ String[] paths = scanner.getIncludedFiles();
+
+ processPaths(paths, basedir);
+ }
+
+ Set xsdList = (Set) _extRouter.get(XSD);
+ Set wsdlList = (Set) _extRouter.get(WSDL);
+
+ if (xsdList.size() + wsdlList.size() == 0)
+ {
+ log("Could not find any xsd or wsdl files to process.", Project.MSG_WARN);
+ return;
+ }
+
+ //optional
+ Set javaList = (Set) _extRouter.get(JAVA);
+ Set xsdconfigList = (Set) _extRouter.get(XSDCONFIG);
+
+ if (srcgendir == null && srconly)
+ srcgendir = classgendir;
+
+ if (destfile == null && classgendir == null && ! srconly)
+ destfile = new File("xmltypes.jar");
+
+ if (verbose)
+ quiet = false;
+
+ /* EXECUTION */
+
+ File[] xsdArray = (File[]) xsdList.toArray(new File[xsdList.size()]);
+ File[] wsdlArray = (File[]) wsdlList.toArray(new File[wsdlList.size()]);
+ File[] javaArray = (File[]) javaList.toArray(new File[javaList.size()]);
+ File[] xsdconfigArray = (File[]) xsdconfigList.toArray(new File[xsdconfigList.size()]);
+ ErrorLogger err = new ErrorLogger(verbose);
+
+ boolean success = false;
+
+ try
+ {
+ // create a temp directory
+ File tmpdir = null;
+ if (srcgendir == null || classgendir == null)
+ {
+ tmpdir = SchemaCodeGenerator.createTempDir();
+ }
+ if (srcgendir == null)
+ srcgendir = SchemaCodeGenerator.createDir(tmpdir, "src");
+ if (classgendir == null)
+ classgendir = SchemaCodeGenerator.createDir(tmpdir, "classes");
+
+ // use the system classpath if user didn't provide any
+ if (classpath == null)
+ {
+ classpath = new Path(project);
+ classpath.concatSystemClasspath();
+ }
+
+ // prepend the output directory on the classpath
+ Path.PathElement pathElement = classpath.createPathElement();
+ pathElement.setLocation(classgendir);
+
+ String[] paths = classpath.list();
+ File[] cp = new File[paths.length];
+ for (int i = 0; i < paths.length; i++)
+ cp[i] = new File(paths[i]);
+
+ // generate the source
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setBaseDir(theBasedir);
+ params.setXsdFiles(xsdArray);
+ params.setWsdlFiles(wsdlArray);
+ params.setJavaFiles(javaArray);
+ params.setConfigFiles(xsdconfigArray);
+ params.setClasspath(cp);
+ //params.setOutputJar(destfile); // always use the jar task below
+ params.setName(typesystemname);
+ params.setSrcDir(srcgendir);
+ params.setClassesDir(classgendir);
+ params.setNojavac(true); // always compile using javac task below
+ params.setDebug(debug);
+ params.setVerbose(verbose);
+ params.setQuiet(quiet);
+ params.setDownload(download);
+ params.setExtensions(extensions);
+ params.setErrorListener(err);
+ params.setMdefNamespaces(mdefnamespaces);
+ success = SchemaCompiler.compile(params);
+
+ if (success && !srconly) {
+ long start = System.currentTimeMillis();
+
+ // compile the source
+ Javac javac = new Javac();
+ javac.setProject(project);
+ javac.setTaskName(getTaskName());
+ javac.setClasspath(classpath);
+ if (compiler != null) javac.setCompiler(compiler);
+ javac.setDebug(debug);
+ if (debugLevel != null) javac.setDebugLevel(debugLevel);
+ javac.setDestdir(classgendir);
+ javac.setExecutable(forkedExecutable);
+ javac.setFailonerror(failonerror);
+ javac.setFork(fork);
+ javac.setIncludeantruntime(includeAntRuntime);
+ javac.setIncludejavaruntime(includeJavaRuntime);
+ javac.setSrcdir(new Path(project, srcgendir.getAbsolutePath()));
+ if (memoryInitialSize != null) javac.setMemoryInitialSize(memoryInitialSize);
+ if (memoryMaximumSize != null) javac.setMemoryMaximumSize(memoryMaximumSize);
+ javac.setOptimize(optimize);
+ javac.setVerbose(verbose);
+ javac.execute();
+
+ long finish = System.currentTimeMillis();
+ if (!quiet)
+ log("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds");
+
+ if (destfile != null)
+ {
+ // jar the compiled classes
+ Jar jar = new Jar();
+ jar.setProject(project);
+ jar.setTaskName(getTaskName());
+ jar.setBasedir(classgendir);
+ jar.setDestFile(destfile);
+ jar.execute();
+ }
+ }
+
+ if (tmpdir != null) {
+ SchemaCodeGenerator.tryHardToDelete(tmpdir);
+ }
+ }
+ catch (Throwable e)
+ {
+ //interrupted means cancel
+ if (e instanceof InterruptedException)
+ throw new BuildException(e);
+
+ log("Exception while building schemas: " + e.getMessage(), Project.MSG_ERR);
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ log(sw.toString(), Project.MSG_VERBOSE);
+ }
+
+ if (!success && failonerror)
+ throw new BuildException(); //stop the build
+ }
+
+ private void processPaths(String[] paths, File baseDir)
+ {
+ for (int i = 0; i < paths.length; i++)
+ {
+ int dot = paths[i].lastIndexOf('.');
+ if (dot > -1)
+ {
+ String path = paths[i];
+ String possExt = path.substring(dot).toLowerCase();
+ Set set = (Set) _extRouter.get(possExt);
+
+ if (set != null)
+ set.add(new File(baseDir, path));
+ }
+ }
+ }
+
+ public void addFileset(FileSet fileset)
+ {
+ schemas.add(fileset);
+ }
+
+ /////////////////////////////
+ //Getter/Setters
+ public File getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * A file that points to either an individual schema file or a directory of files.
+ * It is optional only if one or more <fileset> elements are nested in this
+ * task.
+ * @param schema Required, unless a fileset element is nested.
+ */
+ public void setSchema(File schema)
+ {
+ this.schema = schema;
+ }
+
+ /**
+ * The classpath to use if schemas in the fileset import definitions that are
+ * supplied by other compiled xml beans JAR files, or if .java files are in the
+ * schema fileset.
+ * @param classpath Optional.
+ */
+ public void setClasspath(Path classpath)
+ {
+ if (this.classpath != null)
+ this.classpath.append(classpath);
+ else
+ this.classpath = classpath;
+ }
+
+ /**
+ * Adds a path to the classpath.
+ */
+ public Path createClasspath() {
+ if (classpath == null) {
+ classpath = new Path(project);
+ }
+ return classpath.createPath();
+ }
+
+ /**
+ * Adds a reference to a classpath defined elsewhere.
+ * @param classpathref Optional.
+ */
+ public void setClasspathRef(Reference classpathref)
+ {
+ if (classpath == null)
+ classpath = new Path(project);
+
+ classpath.createPath().setRefid(classpathref);
+ }
+
+ public Path getClasspath()
+ {
+ return classpath;
+ }
+
+ public File getDestfile()
+ {
+ return destfile;
+ }
+
+ /**
+ * Define the name of the jar file created. For instance, "myXMLBean.jar"
+ * will output the results of this task into a jar with the same name.
+ * Optional, defaults to "xmltypes.jar".
+ * @param destfile Optional.
+ */
+ public void setDestfile(File destfile)
+ {
+ this.destfile = destfile;
+ }
+
+ public File getSrcgendir()
+ {
+ return srcgendir;
+ }
+
+ /**
+ * Set a location to generate .java files into. Optional, defaults to
+ * a temp dir.
+ * @param srcgendir Optional.
+ */
+ public void setSrcgendir(File srcgendir)
+ {
+ this.srcgendir = srcgendir;
+ }
+
+ public File getClassgendir()
+ {
+ return classgendir;
+ }
+
+ /**
+ * Set a location to generate .class files into. Optional, defaults to
+ * a temp dir.
+ * @param classgendir Optional.
+ */
+ public void setClassgendir(File classgendir)
+ {
+ this.classgendir = classgendir;
+ }
+
+ /**
+ * Choose the implementation for this particular task.
+ *
+ * @since Ant 1.5
+ */
+ public void setCompiler(String compiler)
+ {
+ this.compiler = compiler;
+ }
+
+ public boolean isDownload()
+ {
+ return download;
+ }
+
+ /**
+ * Set to true to permit the compiler to download URLs for imports
+ * and includes. Defaults to false, meaning all imports and includes
+ * must be copied locally.
+ * @param download Optional.
+ */
+ public void setDownload(boolean download)
+ {
+ this.download = download;
+ }
+
+ /**
+ * If true, compiles with optimization enabled.
+ */
+ public void setOptimize(boolean optimize) {
+ this.optimize = optimize;
+ }
+
+ /** Gets the optimize flag. */
+ public boolean getOptimize() {
+ return optimize;
+ }
+
+ public boolean isVerbose()
+ {
+ return verbose;
+ }
+
+ /**
+ * Controls the amount of output. Defaults to true.
+ * @param verbose Optional.
+ */
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public boolean isQuiet()
+ {
+ return quiet;
+ }
+
+ /**
+ * Controls the amount of output. Defaults to false.
+ * @param quiet Optional.
+ */
+ public void setQuiet(boolean quiet)
+ {
+ this.quiet = quiet;
+ }
+
+ public boolean isDebug()
+ {
+ return debug;
+ }
+
+ /**
+ * Get the value of debugLevel.
+ * @return value of debugLevel.
+ */
+ public String getDebugLevel() {
+ return debugLevel;
+ }
+
+ /**
+ * Keyword list to be appended to the -g command-line switch.
+ *
+ * This will be ignored by all implementations except modern
+ * and classic(ver >= 1.2). Legal values are none or a
+ * comma-separated list of the following keywords: lines, vars,
+ * and source. If debuglevel is not specified, by default, :none
+ * will be appended to -g. If debug is not turned on, this attribute
+ * will be ignored.
+ *
+ * @param v Value to assign to debugLevel.
+ */
+ public void setDebugLevel(String v) {
+ this.debugLevel = v;
+ }
+
+ /**
+ * Generate debugging symbols.
+ * @param debug Optional.
+ */
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ /**
+ * If true, forks the javac compiler.
+ *
+ * @param f "true|false|on|off|yes|no"
+ */
+ public void setFork(boolean f) {
+ fork = f;
+ }
+
+ /**
+ * Sets the the name of the javac executable.
+ *
+ * <p>Ignored unless fork is true or extJavac has been specified
+ * as the compiler.</p>
+ */
+ public void setExecutable(String forkExec) {
+ forkedExecutable = forkExec;
+ }
+
+ public String getExecutable() {
+ return forkedExecutable;
+ }
+
+ public boolean isSrconly()
+ {
+ return srconly;
+ }
+
+ /**
+ * A value of true means that only source will be generated. Optional,
+ * default is false.
+ * @param srconly Optional.
+ */
+ public void setSrconly(boolean srconly)
+ {
+ this.srconly = srconly;
+ }
+
+ public String getTypesystemname()
+ {
+ return typesystemname;
+ }
+
+ /**
+ * One or more SchemaCompiler extensions can be passed in via the <extension> subelement.
+ * Schema Compiler extensions must implement the interface com.xbean.too.SchemaCompilerExtension
+ */
+ public Extension createExtension() {
+ Extension e = new Extension();
+ extensions.add(e);
+ return e;
+ }
+
+ /**
+ * One or more namespaces in which duplicate definitions are to be ignored
+ * can be passed in via the <ignoreDuplicatesInNamespaces> subelement.
+ */
+ public void setIgnoreDuplicatesInNamespaces(String namespaces) {
+ mdefnamespaces = new HashSet();
+ StringTokenizer st = new StringTokenizer(namespaces, ",");
+ while (st.hasMoreTokens())
+ {
+ String namespace = st.nextToken().trim();
+ mdefnamespaces.add(namespace);
+ }
+ }
+
+ public String getIgnoreDuplicatesInNamespaces() {
+ if (mdefnamespaces == null) {
+ return null;
+ }
+ StringBuffer buf = new StringBuffer();
+ Iterator i = mdefnamespaces.iterator();
+ while (i.hasNext()) {
+ buf.append((String)i.next());
+ if (i.hasNext()) {
+ buf.append(",");
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * The name of the package that the TypeSystemHolder class should be
+ * generated in. Normally this should be left unspecified. None of
+ * the xml beans are generated in this package.
+ * <BR><BR>Use .xsdconfig files to modify xml bean package or class names.
+ * @param typesystemname Optional.
+ */
+ public void setTypesystemname(String typesystemname)
+ {
+ this.typesystemname = typesystemname;
+ }
+
+ public boolean isFailonerror()
+ {
+ return failonerror;
+ }
+
+ /**
+ * Determines whether or not the ant target will continue if the XMLBean
+ * creation encounters a build error. Defaults to true. Optional.
+ * @param failonerror Optional.
+ */
+ public void setFailonerror(boolean failonerror)
+ {
+ this.failonerror = failonerror;
+ }
+
+ public boolean isIncludeAntRuntime()
+ {
+ return includeAntRuntime;
+ }
+
+ public void setIncludeAntRuntime(boolean includeAntRuntime)
+ {
+ this.includeAntRuntime = includeAntRuntime;
+ }
+
+ public boolean isIncludeJavaRuntime()
+ {
+ return includeJavaRuntime;
+ }
+
+ public void setIncludeJavaRuntime(boolean includeJavaRuntime)
+ {
+ this.includeJavaRuntime = includeJavaRuntime;
+ }
+
+ /**
+ * Set the initial memory size of the underlying javac process.
+ */
+ public String getMemoryInitialSize()
+ {
+ return memoryInitialSize;
+ }
+
+ public void setMemoryInitialSize(String memoryInitialSize)
+ {
+ this.memoryInitialSize = memoryInitialSize;
+ }
+
+ /**
+ * Set the maximum memory size of the underlying javac process.
+ */
+ public String getMemoryMaximumSize()
+ {
+ return memoryMaximumSize;
+ }
+
+ public void setMemoryMaximumSize(String memoryMaximumSize)
+ {
+ this.memoryMaximumSize = memoryMaximumSize;
+ }
+
+ private static URI uriFromFile(File f)
+ {
+ if (f == null)
+ return null;
+
+ try
+ {
+ return f.getCanonicalFile().toURI();
+ }
+ catch(java.io.IOException e)
+ {
+ // Don't spit out an exception here because on Windows you'll get one
+ // if the filename is "aux", "lpt1", etc. It's the caller's responsibility
+ // to deal with those cases correctly, usually by calling FileSvc.invalidPathCheck()
+ // MessageSvc.get().logException(e);
+ return f.getAbsoluteFile().toURI();
+ }
+ }
+
+ public class ErrorLogger extends AbstractCollection
+ {
+ private boolean _noisy;
+ private URI _baseURI;
+
+ public ErrorLogger(boolean noisy)
+ {
+ _noisy = noisy;
+ _baseURI = uriFromFile(project.getBaseDir());
+ }
+
+ public boolean add(Object o)
+ {
+ if (o instanceof XmlError)
+ {
+ XmlError err = (XmlError)o;
+ if (err.getSeverity() == XmlError.SEVERITY_ERROR)
+ log(err.toString(_baseURI), Project.MSG_ERR);
+ else if (err.getSeverity() == XmlError.SEVERITY_WARNING)
+ log(err.toString(_baseURI), Project.MSG_WARN);
+ else if (_noisy)
+ log(err.toString(_baseURI), Project.MSG_INFO);
+ }
+ return false;
+ }
+
+ public Iterator iterator()
+ {
+ return Collections.EMPTY_LIST.iterator();
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
new file mode 100644
index 0000000..bf87c72
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBeanXSTCHarness.java
@@ -0,0 +1,109 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlException;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class XMLBeanXSTCHarness implements XSTCTester.Harness
+{
+ public void runTestCase(XSTCTester.TestCaseResult result)
+ {
+ XSTCTester.TestCase testCase = result.getTestCase();
+
+ // System.out.println("Running case " + testCase.getDescription());
+
+ try
+ {
+ Collection errors = new ArrayList();
+ boolean schemaValid = true;
+ boolean instanceValid = true;
+
+ if (testCase.getSchemaFile() == null)
+ return;
+
+ // step 1, load schema file etc.
+ SchemaTypeLoader loader = null;
+ try
+ {
+ XmlObject schema = XmlObject.Factory.parse(testCase.getSchemaFile(), new XmlOptions().setErrorListener(errors).setLoadLineNumbers());
+ XmlObject schema2 = null;
+ if (testCase.getResourceFile() != null)
+ schema2 = XmlObject.Factory.parse(testCase.getResourceFile(), new XmlOptions().setErrorListener(errors).setLoadLineNumbers());
+ XmlObject[] schemas = schema2 == null ? new XmlObject[] { schema } : new XmlObject[] { schema, schema2 };
+ SchemaTypeSystem system = XmlBeans.compileXsd(schemas, XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setErrorListener(errors));
+ loader = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] { system, XmlBeans.getBuiltinTypeSystem() });
+ }
+ catch (Exception e)
+ {
+ schemaValid = false;
+ if (!(e instanceof XmlException) || errors.isEmpty())
+ {
+ result.setCrash(true);
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ result.addSvMessages(Collections.singleton(sw.toString()));
+ }
+ }
+
+ result.addSvMessages(errors);
+ result.setSvActual(schemaValid);
+ errors.clear();
+
+ if (loader == null)
+ return;
+
+ if (testCase.getInstanceFile() == null)
+ return;
+
+ // step 2, load instance file and validate
+ try
+ {
+ XmlObject instance = loader.parse(testCase.getInstanceFile(), null, new XmlOptions().setErrorListener(errors).setLoadLineNumbers());
+ if (!instance.validate(new XmlOptions().setErrorListener(errors)))
+ instanceValid = false;
+ }
+ catch (Exception e)
+ {
+ instanceValid = false;
+ if (!(e instanceof XmlException) || errors.isEmpty())
+ {
+ result.setCrash(true);
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ result.addIvMessages(Collections.singleton(sw.toString()));
+ }
+ }
+ result.addIvMessages(errors);
+ result.setIvActual(instanceValid);
+
+ }
+ finally
+ {
+ // System.out.println(result.succeeded() ? "Success.": "Failure.");
+ }
+ }
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XSTCTester.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XSTCTester.java
new file mode 100644
index 0000000..79dce9b
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XSTCTester.java
@@ -0,0 +1,415 @@
+/* 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.xmlbeans.impl.tool;
+
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlCalendar;
+import org.apache.xml.xmlbeans.x2004.x02.xmlbean.ltgfmt.TestsDocument;
+import org.apache.xml.xmlbeans.x2004.x02.xmlbean.ltgfmt.FileDesc;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Date;
+import java.util.regex.Pattern;
+import java.net.URI;
+
+public class XSTCTester
+{
+ public static void main(String[] args) throws IOException
+ {
+ long start = System.currentTimeMillis();
+
+ CommandLine cl = new CommandLine(args, Collections.EMPTY_SET);
+ boolean showpass = (cl.getOpt("showpass") != null);
+ File[] allFiles = cl.getFiles();
+ Collection ltgFiles = new ArrayList();
+ Harness harness = new XMLBeanXSTCHarness();
+
+ for (int i = 0; i < allFiles.length; i++)
+ {
+ if (allFiles[i].getName().indexOf("LTG") >= 0)
+ ltgFiles.add(allFiles[i]);
+ }
+
+ File resultsFile = new File("out.html");
+ PrintWriter writer = new PrintWriter(new FileWriter(resultsFile));
+ writer.println("<html>");
+ writer.println("<style>td {border-bottom: 1px solid black} xmp {white-space: normal; word-wrap: break-word; word-break: break-all} </style>");
+ writer.println("<body>");
+
+ writer.println("<script language='JavaScript' type='text/javascript'>");
+ writer.println("var w;");
+ writer.println("function openWindow(schema, instance) {");
+ writer.println(" if (w == null) {");
+ writer.println(" w = window.open('about:blank', 'xstc');");
+ writer.println(" }");
+ writer.println(" if (w.closed) {");
+ writer.println(" w = window.open('about:blank', 'xstc');");
+ writer.println(" }");
+ writer.println(" w.document.open();");
+ writer.println(" w.document.write(\"<frameset rows=*,*><frame src='\" + schema + \"'><frame src='\" + instance + \"'></frameset>\");");
+ writer.println(" w.document.close();");
+ writer.println(" w.focus();");
+ writer.println("}");
+ writer.println("</script>");
+
+ writer.println("<h1>XML Schema Test Collection Results</h1>");
+ writer.println("<p>Run on " + (new XmlCalendar(new Date())) + "</p>");
+ writer.println("<table style='border: 1px solid black' cellpadding=0 cellspacing=0>");
+ writer.println("<tr><td width=75%>Description</td><td width=12.5%>sch v</td><td width=12.5%>ins v</td></tr>");
+ int failures = 0;
+ int cases = 0;
+ for (Iterator i = ltgFiles.iterator(); i.hasNext(); )
+ {
+ File ltgFile = (File)i.next();
+ System.out.println("Processing test cases in " + ltgFile);
+ Collection ltgErrors = new ArrayList();
+ TestCase[] testCases = parseLTGFile(ltgFile, ltgErrors);
+ Collection results = new ArrayList();
+ if (testCases != null) for (int j = 0; j < testCases.length; j++)
+ {
+ TestCaseResult result = new TestCaseResult();
+ result.testCase = testCases[j];
+ harness.runTestCase(result);
+ cases += 1;
+ if (!result.succeeded())
+ failures += 1;
+ else if (!showpass)
+ continue;
+ results.add(result);
+ }
+ writer.println("<tr><td colspan=3 bgcolor=skyblue>" + ltgFile + "</td></tr>");
+ if (!ltgErrors.isEmpty())
+ {
+ writer.println("<tr><td>Errors within the LTG file:");
+ writer.println("<xmp>");
+ for (Iterator j = ltgErrors.iterator(); j.hasNext(); )
+ writer.println(j.next());
+ writer.println("</xmp>");
+ writer.println("</td></tr>");
+ }
+ else
+ {
+ if (results.size() == 0)
+ writer.println("<tr><td colspan=3 bgcolor=green>Nothing to report</td></tr>");
+ }
+ if (results == null)
+ continue;
+ for (Iterator j = results.iterator(); j.hasNext() ;)
+ {
+ summarizeResultAsHTMLTableRows((TestCaseResult)j.next(), writer);
+ }
+ }
+ writer.println("<tr><td colspan=3>Summary: " + failures + " failures out of " + cases + " cases run.</td></tr>");
+ writer.println("</table>");
+ writer.close();
+
+ long finish = System.currentTimeMillis();
+ System.out.println("Time run tests: " + ((double)(finish - start) / 1000.0) + " seconds" );
+
+ // Launch results
+ if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0)
+ Runtime.getRuntime().exec("cmd /c start iexplore \"" + resultsFile.getAbsolutePath() + "\"");
+ else
+ System.out.println("Results output to " + resultsFile);
+ }
+
+ public static class TestCase
+ {
+ private File ltgFile;
+ private String id;
+ private String origin;
+ private String description;
+ private File schemaFile;
+ private File instanceFile;
+ private File resourceFile;
+ private boolean svExpected;
+ private boolean ivExpected;
+ private boolean rvExpected;
+
+ public File getLtgFile()
+ {
+ return ltgFile;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getOrigin()
+ {
+ return origin;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public File getSchemaFile()
+ {
+ return schemaFile;
+ }
+
+ public File getInstanceFile()
+ {
+ return instanceFile;
+ }
+
+ public File getResourceFile()
+ {
+ return resourceFile;
+ }
+
+ public boolean isSvExpected()
+ {
+ return svExpected;
+ }
+
+ public boolean isIvExpected()
+ {
+ return ivExpected;
+ }
+
+ public boolean isRvExpected()
+ {
+ return rvExpected;
+ }
+ }
+
+ public static class TestCaseResult
+ {
+ private TestCase testCase;
+ private boolean svActual;
+ private Collection svMessages = new ArrayList();
+ private boolean ivActual;
+ private Collection ivMessages = new ArrayList();
+ private boolean crash;
+
+ public TestCase getTestCase()
+ {
+ return testCase;
+ }
+
+ public boolean isSvActual()
+ {
+ return svActual;
+ }
+
+ public void setSvActual(boolean svActual)
+ {
+ this.svActual = svActual;
+ }
+
+ public boolean isIvActual()
+ {
+ return ivActual;
+ }
+
+ public void setIvActual(boolean ivActual)
+ {
+ this.ivActual = ivActual;
+ }
+
+ public Collection getSvMessages()
+ {
+ return Collections.unmodifiableCollection(svMessages);
+ }
+
+ public void addSvMessages(Collection svMessages)
+ {
+ this.svMessages.addAll(svMessages);
+ }
+
+ public Collection getIvMessages()
+ {
+ return Collections.unmodifiableCollection(ivMessages);
+ }
+
+ public void addIvMessages(Collection ivMessages)
+ {
+ this.ivMessages.addAll(ivMessages);
+ }
+
+ public void setCrash(boolean crash)
+ {
+ this.crash = crash;
+ }
+
+ public boolean isCrash()
+ {
+ return crash;
+ }
+
+ public boolean succeeded()
+ {
+ return !crash && (isIvActual() == testCase.isIvExpected()) && (isSvActual() == testCase.isSvExpected());
+ }
+ }
+
+ public static interface Harness
+ {
+ public void runTestCase(TestCaseResult result);
+ }
+
+ public static String makeHTMLLink(File file, boolean value)
+ {
+ if (file == null)
+ return " ";
+ URI uri = file.getAbsoluteFile().toURI();
+ return "<a href=\"" + uri + "\" target=_blank>" + Boolean.toString(value) + "</a>";
+ }
+
+ private static final Pattern leadingSpace = Pattern.compile("^\\s+", Pattern.MULTILINE);
+
+ public static String makeHTMLDescription(TestCase testCase)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<a class=noline href='javascript:openWindow(\"");
+ if (testCase.getSchemaFile() == null)
+ sb.append("about:No schema");
+ else
+ sb.append(testCase.getSchemaFile().getAbsolutePath().replaceAll("\\\\", "\\\\\\\\"));
+
+ sb.append("\", \"");
+ if (testCase.getInstanceFile() == null)
+ sb.append("about:No instance");
+ else
+ sb.append(testCase.getInstanceFile().getAbsolutePath().replaceAll("\\\\", "\\\\\\\\"));
+ sb.append("\")'><xmp>");
+ sb.append(leadingSpace.matcher(testCase.getDescription()).replaceAll("") + "(" + testCase.getId() + ")");
+ sb.append("</xmp></a>");
+ return sb.toString();
+ }
+
+ public static void summarizeResultAsHTMLTableRows(TestCaseResult result, PrintWriter out)
+ {
+ TestCase testCase = result.getTestCase();
+ boolean sRight = testCase.getSchemaFile() == null || testCase.isSvExpected() == result.isSvActual();
+ boolean iRight = testCase.getInstanceFile() == null || testCase.isIvExpected() == result.isIvActual();
+
+ out.println(result.isCrash() ? "<tr bgcolor=black color=white>" : "<tr>");
+ out.println("<td valign=top>" + makeHTMLDescription(testCase) + "</td>");
+ String sLinks;
+ if (testCase.getResourceFile() == null)
+ sLinks = makeHTMLLink(testCase.getSchemaFile(), result.isSvActual());
+ else
+ sLinks = makeHTMLLink(testCase.getSchemaFile(), result.isSvActual()) + "<br>" + makeHTMLLink(testCase.getResourceFile(), result.isSvActual());
+
+ out.println((sRight ? "<td valign=top>" : result.isSvActual() ? "<td bgcolor=orange valign=top>" : "<td bgcolor=red valign=top>") + sLinks + "</td>");
+ out.println((iRight ? "<td valign=top>" : result.isIvActual() ? "<td bgcolor=orange valign=top>" : "<td bgcolor=red valign=top>") + makeHTMLLink(testCase.getInstanceFile(), result.isIvActual()) + "</td>");
+ out.println("</tr>");
+ if (!result.getIvMessages().isEmpty() || !result.getSvMessages().isEmpty())
+ {
+ if (!result.succeeded())
+ out.println("<tr><td colspan=3 bgcolor=yellow><xmp>");
+ else
+ out.println("<tr><td colspan=3><xmp>");
+ for (Iterator j = result.getSvMessages().iterator(); j.hasNext(); )
+ out.println(j.next());
+ for (Iterator j = result.getIvMessages().iterator(); j.hasNext(); )
+ out.println(j.next());
+ out.println("</xmp></tr></td>");
+ }
+ }
+
+ public static TestCase[] parseLTGFile(File ltgFile, Collection outerErrors)
+ {
+ Collection errors = new ArrayList();
+ try
+ {
+ XmlOptions ltgOptions = new XmlOptions();
+ ltgOptions.setLoadSubstituteNamespaces(Collections.singletonMap("", "http://xml.apache.org/xmlbeans/2004/02/xmlbean/ltgfmt"));
+ ltgOptions.setErrorListener(errors);
+ ltgOptions.setLoadLineNumbers();
+ TestsDocument doc = TestsDocument.Factory.parse(ltgFile, ltgOptions);
+ if (!doc.validate(ltgOptions))
+ throw new Exception("Document " + ltgFile + " not valid.");
+
+ org.apache.xml.xmlbeans.x2004.x02.xmlbean.ltgfmt.TestCase[] testCases = doc.getTests().getTestArray();
+
+ Collection result = new ArrayList();
+ for (int i = 0; i < testCases.length; i++)
+ {
+ TestCase newCase = new TestCase();
+ newCase.ltgFile = ltgFile;
+ newCase.id = testCases[i].getId();
+ newCase.origin = testCases[i].getOrigin();
+ newCase.description = testCases[i].getDescription();
+ FileDesc[] filedescs = testCases[i].getFiles().getFileArray();
+ testCases[i].getOrigin();
+ for (int j = 0; j < filedescs.length; j++)
+ {
+ String dir = filedescs[j].getFolder();
+ String filename = filedescs[j].getFileName();
+ File theFile = new File(ltgFile.getParentFile(), dir + "/" + filename);
+ if (!theFile.exists() || !theFile.isFile() || !theFile.canRead())
+ {
+ outerErrors.add(XmlError.forObject("Can't read file " + theFile, filedescs[j]).toString());
+ continue;
+ }
+
+ switch (filedescs[j].getRole().intValue())
+ {
+ case FileDesc.Role.INT_INSTANCE:
+ if (newCase.instanceFile != null)
+ outerErrors.add(XmlError.forObject("More than one instance file speicifed - ignoring all but last", filedescs[j]).toString());
+ newCase.instanceFile = theFile;
+ newCase.ivExpected = filedescs[j].getValidity();
+ break;
+
+ case FileDesc.Role.INT_SCHEMA:
+ if (newCase.schemaFile != null)
+ outerErrors.add(XmlError.forObject("More than one schema file speicifed - ignoring all but last", filedescs[j]).toString());
+ newCase.schemaFile = theFile;
+ newCase.svExpected = filedescs[j].getValidity();
+ break;
+
+ case FileDesc.Role.INT_RESOURCE:
+ if (newCase.resourceFile != null)
+ outerErrors.add(XmlError.forObject("More than one resource file speicifed - ignoring all but last", filedescs[j]).toString());
+ newCase.resourceFile = theFile;
+ newCase.rvExpected = filedescs[j].getValidity();
+ break;
+
+ default:
+ throw new XmlException(XmlError.forObject("Unexpected file role", filedescs[j]));
+ }
+ }
+ result.add(newCase);
+ }
+ return (TestCase[])result.toArray(new TestCase[result.size()]);
+ }
+ catch (Exception e)
+ {
+ if (errors.isEmpty())
+ outerErrors.add(e.getMessage());
+ else for (Iterator i = errors.iterator(); i.hasNext(); )
+ outerErrors.add(i.next().toString());
+ return null;
+ }
+ }
+
+}
diff --git a/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
new file mode 100644
index 0000000..0c8d5ca
--- /dev/null
+++ b/v1/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
@@ -0,0 +1,1228 @@
+/* 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.xmlbeans.impl.tool;
+
+import java.util.*;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.io.*;
+import java.math.BigInteger;
+
+
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.util.HexBin;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaLocalAttribute;
+import org.apache.xmlbeans.SchemaParticle;
+import org.apache.xmlbeans.SchemaProperty;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.soap.SOAPArrayType;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import javax.xml.namespace.QName;
+
+public class XsbDumper
+{
+ public static void main(String[] args)
+ {
+ for (int i = 0; i < args.length; i++)
+ {
+ dump(new File(args[i]), true);
+ }
+ }
+
+ private static void dump(File file, boolean force)
+ {
+ if (file.isDirectory())
+ {
+ File[] files = file.listFiles(
+ new FileFilter()
+ {
+ public boolean accept(File file)
+ { return file.isDirectory() || file.isFile() && file.getName().endsWith(".xsb"); }
+ }
+ );
+ for (int i = 0; i < files.length; i++)
+ {
+ dump(files[i], false);
+ }
+ }
+ else if (file.getName().endsWith(".jar") || file.getName().endsWith(".zip"))
+ {
+ dumpZip(file);
+ }
+ else if (force || file.getName().endsWith(".xsb"))
+ {
+ try
+ {
+ System.out.println(file.toString());
+ dump(new FileInputStream(file), " ");
+ System.out.println();
+ }
+ catch (FileNotFoundException e)
+ {
+ System.out.println(e.toString());
+ }
+ }
+ }
+
+ public static void dumpZip(File file)
+ {
+ try
+ {
+ ZipFile zipFile = new ZipFile(file);
+ Enumeration e = zipFile.entries();
+ while (e.hasMoreElements())
+ {
+ ZipEntry entry = (ZipEntry)e.nextElement();
+ if (entry.getName().endsWith(".xsb"))
+ {
+ System.out.println(entry.getName());
+ dump(zipFile.getInputStream(entry), " ");
+ System.out.println();
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ System.out.println(e.toString());
+ }
+ }
+
+ public static void dump(InputStream input)
+ {
+ dump(input, "");
+ }
+
+ public static void dump(InputStream input, String indent)
+ {
+ XsbDumper dumper = new XsbDumper(input, indent);
+ dumper.dumpAll();
+ }
+
+ private XsbDumper(InputStream stream, String indent)
+ {
+ _input = new DataInputStream(stream);
+ _indent = indent;
+ }
+
+ void flush() { System.out.flush(); }
+ void emit(String str) { System.out.println(_indent + str); flush(); }
+ void emit() { System.out.println(); flush(); }
+ void error(Exception e) { System.out.println(e.toString()); flush(); IllegalStateException e2 = new IllegalStateException( e.getMessage() ); e2.initCause( e ); throw e2; }
+ void error(String str) { System.out.println(str); flush(); IllegalStateException e2 = new IllegalStateException( str ); throw e2; }
+ private String _indent;
+ void indent() { _indent += " "; }
+ void outdent() { _indent = _indent.substring(0, _indent.length() - 2); }
+
+ public static final int DATA_BABE = 0xDA7ABABE;
+ public static final int MAJOR_VERSION = 2;
+ public static final int MINOR_VERSION = 18;
+
+ public static final int FILETYPE_SCHEMAINDEX = 1;
+ public static final int FILETYPE_SCHEMATYPE = 2;
+ public static final int FILETYPE_SCHEMAELEMENT = 3;
+ public static final int FILETYPE_SCHEMAATTRIBUTE = 4;
+ public static final int FILETYPE_SCHEMAPOINTER = 5;
+ public static final int FILETYPE_SCHEMAMODELGROUP = 6;
+ public static final int FILETYPE_SCHEMAATTRIBUTEGROUP = 7;
+
+ static String filetypeString(int code)
+ {
+ switch (code)
+ {
+ case FILETYPE_SCHEMAINDEX: return "FILETYPE_SCHEMAINDEX";
+ case FILETYPE_SCHEMATYPE: return "FILETYPE_SCHEMATYPE";
+ case FILETYPE_SCHEMAELEMENT: return "FILETYPE_SCHEMAELEMENT";
+ case FILETYPE_SCHEMAATTRIBUTE: return "FILETYPE_SCHEMAATTRIBUTE";
+ case FILETYPE_SCHEMAPOINTER: return "FILETYPE_SCHEMAPOINTER";
+ case FILETYPE_SCHEMAMODELGROUP: return "FILETYPE_SCHEMAMODELGROUP";
+ case FILETYPE_SCHEMAATTRIBUTEGROUP: return "FILETYPE_SCHEMAATTRIBUTEGROUP";
+ default:
+ return "Unknown FILETYPE (" + code + ")";
+ }
+ }
+
+ public static final int FLAG_PART_SKIPPABLE = 1;
+ public static final int FLAG_PART_FIXED = 4;
+ public static final int FLAG_PART_NILLABLE = 8;
+ public static final int FLAG_PART_BLOCKEXT = 16;
+ public static final int FLAG_PART_BLOCKREST = 32;
+ public static final int FLAG_PART_BLOCKSUBST = 64;
+ public static final int FLAG_PART_ABSTRACT = 128;
+ public static final int FLAG_PART_FINALEXT = 256;
+ public static final int FLAG_PART_FINALREST = 512;
+
+ static String particleflagsString(int flags)
+ {
+ StringBuffer result = new StringBuffer();
+ if ((flags & FLAG_PART_SKIPPABLE) != 0) result.append("FLAG_PART_SKIPPABLE | ");
+ if ((flags & FLAG_PART_FIXED) != 0) result.append("FLAG_PART_FIXED | ");
+ if ((flags & FLAG_PART_NILLABLE) != 0) result.append("FLAG_PART_NILLABLE | ");
+ if ((flags & FLAG_PART_BLOCKEXT) != 0) result.append("FLAG_PART_BLOCKEXT | ");
+ if ((flags & FLAG_PART_BLOCKREST) != 0) result.append("FLAG_PART_BLOCKREST | ");
+ if ((flags & FLAG_PART_BLOCKSUBST) != 0) result.append("FLAG_PART_BLOCKSUBST | ");
+ if ((flags & FLAG_PART_ABSTRACT) != 0) result.append("FLAG_PART_ABSTRACT | ");
+ if ((flags & FLAG_PART_FINALEXT) != 0) result.append("FLAG_PART_FINALEXT | ");
+ if ((flags & FLAG_PART_FINALREST) != 0) result.append("FLAG_PART_FINALREST | ");
+ if (result.length() == 0) result.append("0 | ");
+ return result.substring(0, result.length() - 3);
+ }
+
+ public static final int FLAG_PROP_ISATTR = 1;
+ public static final int FLAG_PROP_JAVASINGLETON = 2;
+ public static final int FLAG_PROP_JAVAOPTIONAL = 4;
+ public static final int FLAG_PROP_JAVAARRAY = 8;
+
+ static String propertyflagsString(int flags)
+ {
+ StringBuffer result = new StringBuffer();
+ if ((flags & FLAG_PROP_ISATTR) != 0) result.append("FLAG_PROP_ISATTR | ");
+ if ((flags & FLAG_PROP_JAVASINGLETON) != 0) result.append("FLAG_PROP_JAVASINGLETON | ");
+ if ((flags & FLAG_PROP_JAVAOPTIONAL) != 0) result.append("FLAG_PROP_JAVAOPTIONAL | ");
+ if ((flags & FLAG_PROP_JAVAARRAY) != 0) result.append("FLAG_PROP_JAVAARRAY | ");
+ if (result.length() == 0) result.append("0 | ");
+ return result.substring(0, result.length() - 3);
+ }
+
+ public static final int FIELD_NONE = 0;
+ public static final int FIELD_GLOBAL = 1;
+ public static final int FIELD_LOCALATTR = 2;
+ public static final int FIELD_LOCALELT = 3;
+
+ static String containerfieldTypeString(int code)
+ {
+ switch (code)
+ {
+ case FIELD_NONE: return "FIELD_NONE";
+ case FIELD_GLOBAL: return "FIELD_GLOBAL";
+ case FIELD_LOCALATTR: return "FIELD_LOCALATTR";
+ case FIELD_LOCALELT: return "FIELD_LOCALELT";
+ default:
+ return "Unknown container field type (" + code + ")";
+ }
+ }
+
+ // type flags
+ static final int FLAG_SIMPLE_TYPE = 0x1;
+ static final int FLAG_DOCUMENT_TYPE = 0x2;
+ static final int FLAG_ORDERED = 0x4;
+ static final int FLAG_BOUNDED = 0x8;
+ static final int FLAG_FINITE = 0x10;
+ static final int FLAG_NUMERIC = 0x20;
+ static final int FLAG_STRINGENUM = 0x40;
+ static final int FLAG_UNION_OF_LISTS = 0x80;
+ static final int FLAG_HAS_PATTERN = 0x100;
+ static final int FLAG_ORDER_SENSITIVE = 0x200;
+ static final int FLAG_TOTAL_ORDER = 0x400;
+ static final int FLAG_COMPILED = 0x800;
+ static final int FLAG_BLOCK_EXT = 0x1000;
+ static final int FLAG_BLOCK_REST = 0x2000;
+ static final int FLAG_FINAL_EXT = 0x4000;
+ static final int FLAG_FINAL_REST = 0x8000;
+ static final int FLAG_FINAL_UNION = 0x10000;
+ static final int FLAG_FINAL_LIST = 0x20000;
+ static final int FLAG_ABSTRACT = 0x40000;
+ static final int FLAG_ATTRIBUTE_TYPE = 0x80000;
+
+ static String typeflagsString(int flags)
+ {
+ StringBuffer result = new StringBuffer();
+ if ((flags & FLAG_SIMPLE_TYPE) != 0) result.append("FLAG_SIMPLE_TYPE | ");
+ if ((flags & FLAG_DOCUMENT_TYPE) != 0) result.append("FLAG_DOCUMENT_TYPE | ");
+ if ((flags & FLAG_ATTRIBUTE_TYPE) != 0) result.append("FLAG_ATTRIBUTE_TYPE | ");
+ if ((flags & FLAG_ORDERED) != 0) result.append("FLAG_ORDERED | ");
+ if ((flags & FLAG_BOUNDED) != 0) result.append("FLAG_BOUNDED | ");
+ if ((flags & FLAG_FINITE) != 0) result.append("FLAG_FINITE | ");
+ if ((flags & FLAG_NUMERIC) != 0) result.append("FLAG_NUMERIC | ");
+ if ((flags & FLAG_STRINGENUM) != 0) result.append("FLAG_STRINGENUM | ");
+ if ((flags & FLAG_UNION_OF_LISTS) != 0) result.append("FLAG_UNION_OF_LISTS | ");
+ if ((flags & FLAG_HAS_PATTERN) != 0) result.append("FLAG_HAS_PATTERN | ");
+ if ((flags & FLAG_TOTAL_ORDER) != 0) result.append("FLAG_TOTAL_ORDER | ");
+ if ((flags & FLAG_COMPILED) != 0) result.append("FLAG_COMPILED | ");
+ if ((flags & FLAG_BLOCK_EXT) != 0) result.append("FLAG_BLOCK_EXT | ");
+ if ((flags & FLAG_BLOCK_REST) != 0) result.append("FLAG_BLOCK_REST | ");
+ if ((flags & FLAG_FINAL_EXT) != 0) result.append("FLAG_FINAL_EXT | ");
+ if ((flags & FLAG_FINAL_REST) != 0) result.append("FLAG_FINAL_REST | ");
+ if ((flags & FLAG_FINAL_UNION) != 0) result.append("FLAG_FINAL_UNION | ");
+ if ((flags & FLAG_FINAL_LIST) != 0) result.append("FLAG_FINAL_LIST | ");
+ if ((flags & FLAG_ABSTRACT) != 0) result.append("FLAG_ABSTRACT | ");
+ if (result.length() == 0) result.append("0 | ");
+ return result.substring(0, result.length() - 3);
+ }
+
+ void dumpAll()
+ {
+ int filetype = dumpHeader();
+ switch (filetype)
+ {
+ case FILETYPE_SCHEMAINDEX:
+ dumpIndexData();
+ return;
+ case FILETYPE_SCHEMATYPE:
+ dumpTypeFileData();
+ break;
+ case FILETYPE_SCHEMAELEMENT:
+ dumpParticleData(true);
+ break;
+ case FILETYPE_SCHEMAATTRIBUTE:
+ dumpAttributeData(true);
+ break;
+ case FILETYPE_SCHEMAPOINTER:
+ dumpPointerData();
+ break;
+ case FILETYPE_SCHEMAMODELGROUP:
+ dumpModelGroupData();
+ break;
+ case FILETYPE_SCHEMAATTRIBUTEGROUP:
+ dumpAttributeGroupData();
+ break;
+ }
+ readEnd();
+ }
+
+ static String hex32String(int i)
+ {
+ return Integer.toHexString(i);
+ }
+
+ protected int dumpHeader()
+ {
+ int magic = readInt();
+ emit("Magic cookie: " + hex32String(magic));
+
+ if (magic != DATA_BABE)
+ {
+ emit("Wrong magic cookie.");
+ return 0;
+ }
+
+ _majorver = readShort();
+ _minorver = readShort();
+ if (atLeast(2, 18, 0))
+ _releaseno = readShort();
+
+ emit("Major version: " + _majorver);
+ emit("Minor version: " + _minorver);
+ emit("Release number: " + _releaseno);
+
+ if (_majorver != MAJOR_VERSION || _minorver > MINOR_VERSION)
+ {
+ emit("Incompatible version.");
+ return 0;
+ }
+
+ int actualfiletype = readShort();
+ emit("Filetype: " + filetypeString(actualfiletype));
+
+ _stringPool = new StringPool();
+ _stringPool.readFrom(_input);
+
+ return actualfiletype;
+ }
+
+ void dumpPointerData()
+ {
+ emit("Type system: " + readString());
+ }
+
+ protected void dumpIndexData()
+ {
+ // has a handle pool (count, handle/type, handle/type...)
+ int size = readShort();
+ emit("Handle pool (" + size + "):");
+ indent();
+ for (int i = 0; i < size; i++)
+ {
+ String handle = readString();
+ short code = readShort();
+ emit(handle + " (" + filetypeString(code) + ")");
+ }
+ outdent();
+
+ dumpQNameMap("Global elements");
+
+ // qname map of global attributes
+ dumpQNameMap("Global attributes");
+
+ // attr groups and model groups
+ dumpQNameMap("Model groups");
+ dumpQNameMap("Attribute groups");
+
+ dumpQNameMap("Identity constraints");
+
+ // qname map of global types
+ dumpQNameMap("Global types");
+
+ // qname map of document types, by the qname of the contained element
+ dumpQNameMap("Document types");
+
+ // qname map of attribute types, by the qname of the contained attribute
+ dumpQNameMap("Attribute types");
+
+ // all the types indexed by classname
+ dumpClassnameIndex("All types by classname");
+
+ // all the namespaces
+ dumpStringArray("Defined namespaces");
+
+ // version 15 stuff for redefines
+ if (atLeast(2, 15, 0))
+ {
+ dumpQNameMap("Redefined global types");
+ dumpQNameMap("Redfined model groups");
+ dumpQNameMap("Redfined attribute groups");
+ }
+
+ readEnd();
+ }
+
+
+ class StringPool
+ {
+ private List intsToStrings = new ArrayList();
+ private Map stringsToInts = new HashMap();
+
+ StringPool()
+ {
+ intsToStrings.add(null);
+ }
+
+ String stringForCode(int code)
+ {
+ if (code == 0)
+ return null;
+ return (String)intsToStrings.get(code);
+ }
+
+ int codeForString(String str)
+ {
+ if (str == null)
+ return 0;
+ Integer result = (Integer)stringsToInts.get(str);
+ if (result == null)
+ {
+ result = new Integer(intsToStrings.size());
+ intsToStrings.add(str);
+ stringsToInts.put(str, result);
+ }
+ return result.intValue();
+ }
+
+ void readFrom(DataInputStream input)
+ {
+ if (intsToStrings.size() != 1 || stringsToInts.size() != 0)
+ throw new IllegalStateException();
+
+ try
+ {
+ int size = input.readShort();
+ emit("String pool (" + size + "):");
+ indent();
+ for (int i = 1; i < size; i++)
+ {
+ String str = input.readUTF();
+ int code = codeForString(str);
+ if (code != i)
+ throw new IllegalStateException();
+ emit(code + " = \"" + str + "\"");
+ }
+ outdent();
+ }
+ catch (IOException e)
+ {
+ emit(e.toString());
+ }
+ }
+ }
+
+ // active while loading one type.
+ DataInputStream _input;
+ StringPool _stringPool;
+
+ short readShort()
+ {
+ try
+ {
+ return _input.readShort();
+ }
+ catch (IOException e)
+ {
+ error(e);
+ return 0;
+ }
+ }
+
+ int readInt()
+ {
+ try
+ {
+ return _input.readInt();
+ }
+ catch (IOException e)
+ {
+ error(e);
+ return 0;
+ }
+ }
+
+ String readString()
+ {
+ return _stringPool.stringForCode(readShort());
+ }
+
+ QName readQName()
+ {
+ String namespace = readString();
+ String localname = readString();
+ if (localname == null)
+ return null;
+ return new QName(namespace, localname);
+ }
+
+ String readHandle()
+ {
+ return readString();
+ }
+
+ String readType()
+ {
+ return readHandle();
+ }
+
+ static String qnameString(QName qname)
+ {
+ if (qname == null)
+ return "(null)";
+ if (qname.getNamespaceURI() != null)
+ return qname.getLocalPart() + "@" + qname.getNamespaceURI();
+ else
+ return qname.getLocalPart();
+ }
+
+ static String qnameSetString(QNameSet set)
+ {
+ return set.toString();
+ }
+
+ void dumpQNameMap(String fieldname)
+ {
+ int size = readShort();
+ emit(fieldname + " (" + size + "):");
+ indent();
+ for (int i = 0; i < size; i++)
+ {
+ emit(qnameString(readQName()) + " = " + readHandle());
+ }
+ outdent();
+ }
+
+ void dumpTypeArray(String fieldname)
+ {
+ int size = readShort();
+ emit(fieldname + " (" + size + "):");
+ indent();
+ for (int i = 0; i < size; i++)
+ {
+ emit(i + " = " + readType());
+ }
+ outdent();
+ }
+
+ void dumpClassnameIndex(String fieldname)
+ {
+ int size = readShort();
+ emit(fieldname + " (" + size + "):");
+ indent();
+ for (int i = 0; i < size; i++)
+ {
+ emit(readString() + " = " + readType());
+ }
+ outdent();
+ }
+
+ void dumpStringArray(String fieldname)
+ {
+ int size = readShort();
+ emit(fieldname + " (" + size + "):");
+ indent();
+ for (int i = 0; i < size; i++)
+ {
+ emit(readString());
+ }
+ outdent();
+ }
+
+ void readEnd()
+ {
+ try
+ {
+ _input.close();
+ }
+ catch (IOException e)
+ {
+ // oh, well.
+ }
+ _input = null;
+ _stringPool = null;
+ }
+
+ static String particleTypeString(int spt)
+ {
+ switch (spt)
+ {
+ case SchemaParticle.ALL: return "ALL";
+ case SchemaParticle.CHOICE: return "CHOICE";
+ case SchemaParticle.ELEMENT: return "ELEMENT";
+ case SchemaParticle.SEQUENCE: return "SEQUENCE";
+ case SchemaParticle.WILDCARD: return "WILDCARD";
+ default:
+ return "Unknown particle type (" + spt + ")";
+ }
+ }
+
+ static String bigIntegerString(BigInteger bigint)
+ {
+ if (bigint == null)
+ return "(null)";
+ return bigint.toString();
+ }
+
+ static String wcprocessString(int code)
+ {
+ switch (code)
+ {
+ case SchemaParticle.STRICT: return "STRICT";
+ case SchemaParticle.SKIP: return "SKIP";
+ case SchemaParticle.LAX: return "LAX";
+ case 0: return "NOT_WILDCARD";
+ default:
+ return "Unknown process type (" + code + ")";
+ }
+ }
+
+ void dumpParticleData(boolean global)
+ {
+ short particleType = readShort();
+ emit(particleTypeString(particleType) + ":");
+ indent();
+ short particleFlags = readShort();
+ emit("Flags: " + particleflagsString(particleFlags));
+
+ emit("MinOccurs: " + bigIntegerString(readBigInteger()));
+ emit("MaxOccurs: " + bigIntegerString(readBigInteger()));
+
+ emit("Transition: " + qnameSetString(readQNameSet()));
+
+ switch (particleType)
+ {
+ case SchemaParticle.WILDCARD:
+ emit("Wildcard set: " + qnameSetString(readQNameSet()));
+ emit("Wildcard process: " + wcprocessString(readShort()));
+ break;
+
+ case SchemaParticle.ELEMENT:
+ emit("Name: " + qnameString(readQName()));
+ emit("Type: " + readType());
+ emit("Default: " + readString());
+ if (atLeast(2, 16, 0))
+ emit("Default value: " + readXmlValueObject());
+ emit("WsdlArrayType: " + SOAPArrayTypeString(readSOAPArrayType()));
+ if (global)
+ {
+ if (atLeast(2, 17, 0))
+ emit("Substitution group head " + readHandle());
+
+ short substGroupCount = readShort();
+ emit("Substitution group members (" + substGroupCount + ")");
+ indent();
+ for (int i = 0; i < substGroupCount; i++)
+ {
+ emit(qnameString(readQName()));
+ }
+ outdent();
+ }
+ int count = readShort();
+ emit("Identity constraints (" + count + "):");
+ indent();
+ for (int i = 0; i < count; i++)
+ {
+ emit(readHandle());
+ }
+ outdent();
+ if (global)
+ emit("Filename: " + readString());
+ break;
+
+ case SchemaParticle.ALL:
+ case SchemaParticle.SEQUENCE:
+ case SchemaParticle.CHOICE:
+ dumpParticleArray("Particle children");
+ break;
+
+ default:
+ error("Unrecognized schema particle type");
+ }
+ outdent();
+ }
+
+ void dumpParticleArray(String fieldname)
+ {
+ int count = readShort();
+ emit(fieldname + "(" + count + "):");
+ indent();
+ for (int i = 0; i < count; i++)
+ dumpParticleData(false);
+ outdent();
+ }
+
+ static String complexVarietyString(int code)
+ {
+ switch (code)
+ {
+ case SchemaType.EMPTY_CONTENT: return "EMPTY_CONTENT";
+ case SchemaType.SIMPLE_CONTENT: return "SIMPLE_CONTENT";
+ case SchemaType.ELEMENT_CONTENT: return "ELEMENT_CONTENT";
+ case SchemaType.MIXED_CONTENT: return "MIXED_CONTENT";
+ default:
+ return "Unknown complex variety (" + code + ")";
+ }
+ }
+
+ static String simpleVarietyString(int code)
+ {
+ switch (code)
+ {
+ case SchemaType.ATOMIC: return "ATOMIC";
+ case SchemaType.LIST: return "LIST";
+ case SchemaType.UNION: return "UNION";
+ default:
+ return "Unknown simple variety (" + code + ")";
+ }
+ }
+
+ String facetCodeString(int code)
+ {
+ switch (code)
+ {
+ case SchemaType.FACET_LENGTH: return "FACET_LENGTH";
+ case SchemaType.FACET_MIN_LENGTH: return "FACET_MIN_LENGTH";
+ case SchemaType.FACET_MAX_LENGTH: return "FACET_MAX_LENGTH";
+ case SchemaType.FACET_MIN_EXCLUSIVE: return "FACET_MIN_EXCLUSIVE";
+ case SchemaType.FACET_MIN_INCLUSIVE: return "FACET_MIN_INCLUSIVE";
+ case SchemaType.FACET_MAX_INCLUSIVE: return "FACET_MAX_INCLUSIVE";
+ case SchemaType.FACET_MAX_EXCLUSIVE: return "FACET_MAX_EXCLUSIVE";
+ case SchemaType.FACET_TOTAL_DIGITS: return "FACET_TOTAL_DIGITS";
+ case SchemaType.FACET_FRACTION_DIGITS: return "FACET_FRACTION_DIGITS";
+ default:
+ return "Unknown facet code (" + code + ")";
+ }
+ }
+
+ String whitespaceCodeString(int code)
+ {
+ switch (code)
+ {
+ case SchemaType.WS_COLLAPSE: return "WS_COLLAPSE";
+ case SchemaType.WS_PRESERVE: return "WS_PRESERVE";
+ case SchemaType.WS_REPLACE: return "WS_REPLACE";
+ case SchemaType.WS_UNSPECIFIED: return "WS_UNSPECIFIED";
+ default:
+ return "Unknown whitespace code (" + code + ")";
+ }
+ }
+
+ String derivationTypeString(int code)
+ {
+ switch (code)
+ {
+ case SchemaType.DT_NOT_DERIVED: return "DT_NOT_DERIVED";
+ case SchemaType.DT_RESTRICTION: return "DT_RESTRICTION";
+ case SchemaType.DT_EXTENSION: return "DT_EXTENSION";
+ default:
+ return "Unknown derivation code (" + code + ")";
+ }
+ }
+
+ void dumpTypeFileData()
+ {
+ emit("Name: " + qnameString(readQName()));
+ emit("Outer type: " + readType());
+ emit("Depth: " + readShort());
+ emit("Base type: " + readType());
+ emit("Derivation type: " + derivationTypeString(readShort()));
+
+ emit("Container field:");
+ indent();
+ int containerfieldtype = readShort();
+ emit("Reftype: " + containerfieldTypeString(containerfieldtype));
+ switch (containerfieldtype)
+ {
+ case FIELD_GLOBAL:
+ emit("Handle: " + readHandle());
+ break;
+ case FIELD_LOCALATTR:
+ emit("Index: " + readShort());
+ break;
+ case FIELD_LOCALELT:
+ emit("Index: " + readShort());
+ break;
+ }
+ outdent();
+ emit("Java class name: " + readString());
+ emit("Java impl class name: " + readString());
+
+ dumpTypeArray("Anonymous types");
+
+ emit("Anonymous union member ordinal: " + readShort());
+
+ int flags;
+ flags = readInt();
+ emit("Flags: " + typeflagsString(flags));
+ boolean isComplexType = ((flags & FLAG_SIMPLE_TYPE) == 0);
+
+ short complexVariety = SchemaType.NOT_COMPLEX_TYPE;
+ if (isComplexType)
+ {
+ complexVariety = readShort();
+ emit("Complex variety: " + complexVarietyString(complexVariety));
+
+ short attrCount = readShort();
+ emit("Attribute model (" + attrCount + "):");
+ indent();
+ for (int i = 0; i < attrCount; i++)
+ dumpAttributeData(false);
+
+ emit("Wildcard set: " + qnameSetString(readQNameSet()));
+ emit("Wildcard process: " + wcprocessString(readShort()));
+ outdent();
+
+ // Attribute Property Table
+ short attrPropCount = readShort();
+ emit("Attribute properties (" + attrPropCount + "):");
+ indent();
+ for (int i = 0; i < attrPropCount; i++)
+ {
+ dumpPropertyData();
+ }
+ outdent();
+
+ if (complexVariety == SchemaType.ELEMENT_CONTENT || complexVariety == SchemaType.MIXED_CONTENT)
+ {
+ emit("IsAll: " + readShort());
+
+ // Content model tree
+ dumpParticleArray("Content model");
+
+ // Element Property Table
+ short elemPropCount = readShort();
+ emit("Element properties (" + elemPropCount + "):");
+ indent();
+ for (int i = 0; i < elemPropCount; i++)
+ {
+ dumpPropertyData();
+ }
+ outdent();
+ }
+ }
+
+ if (!isComplexType || complexVariety == SchemaType.SIMPLE_CONTENT)
+ {
+ short simpleVariety = readShort();
+ emit("Simple type variety: " + simpleVarietyString(simpleVariety));
+
+ boolean isStringEnum = ((flags & FLAG_STRINGENUM) != 0);
+
+ short facetCount = readShort();
+ emit("Facets (" + facetCount + "):");
+ indent();
+ for (int i = 0; i < facetCount; i++)
+ {
+ emit(facetCodeString(readShort()));
+ emit("Value: " + readXmlValueObject());
+ emit("Fixed: " + readShort());
+ }
+ outdent();
+
+ emit("Whitespace rule: " + whitespaceCodeString(readShort()));
+
+ short patternCount = readShort();
+ emit("Patterns (" + patternCount + "):");
+ indent();
+ for (int i = 0; i < patternCount; i++)
+ {
+ emit(readString());
+ }
+ outdent();
+
+ short enumCount = readShort();
+ emit("Enumeration values (" + enumCount + "):");
+ indent();
+ for (int i = 0; i < enumCount; i++)
+ {
+ emit(readXmlValueObject());
+ }
+ outdent();
+
+ emit("Base enum type: " + readType());
+ if (isStringEnum)
+ {
+ short seCount = readShort();
+ emit("String enum entries (" + seCount + "):");
+ indent();
+ for (int i = 0; i < seCount; i++)
+ {
+ emit("\"" + readString() + "\" -> " + readShort() + " = " + readString());
+ }
+ outdent();
+ }
+
+ switch (simpleVariety)
+ {
+ case SchemaType.ATOMIC:
+ emit("Primitive type: " + readType());
+ emit("Decimal size: " + readInt());
+ break;
+
+ case SchemaType.LIST:
+ emit("List item type: " + readType());
+ break;
+
+ case SchemaType.UNION:
+ dumpTypeArray("Union members");
+ break;
+
+ default:
+ error("Unknown simple type variety");
+ }
+ }
+
+ emit("Filename: " + readString());
+ }
+
+ static String attruseCodeString(int code)
+ {
+ switch (code)
+ {
+ case SchemaLocalAttribute.OPTIONAL: return "OPTIONAL";
+ case SchemaLocalAttribute.REQUIRED: return "REQUIRED";
+ case SchemaLocalAttribute.PROHIBITED: return "PROHIBITED";
+ default:
+ return "Unknown use code (" + code + ")";
+ }
+ }
+
+ void dumpAttributeData(boolean global)
+ {
+ emit("Name: " + qnameString(readQName()));
+ emit("Type: " + readType());
+ emit("Use: " + attruseCodeString(readShort()));
+ emit("Default: " + readString());
+ if (atLeast(2, 16, 0))
+ emit("Default value: " + readXmlValueObject());
+ emit("Fixed: " + readShort());
+ emit("WsdlArrayType: " + SOAPArrayTypeString(readSOAPArrayType()));
+ if (global)
+ emit("Filename: " + readString());
+ }
+
+ private static final XmlOptions prettyOptions =
+ new XmlOptions().setSavePrettyPrint();
+
+ void dumpXml()
+ {
+ String xml = readString();
+ try
+ {
+ emit( XmlObject.Factory.parse( xml ).xmlText( prettyOptions ) );
+ }
+ catch ( XmlException x )
+ {
+ emit( "!!!!!! BAD XML !!!!!" );
+ emit( xml );
+ }
+ }
+
+ void dumpModelGroupData()
+ {
+ emit("Name: " + qnameString(readQName()));
+ emit("Target namespace: " + readString());
+ emit("Chameleon: " + readShort());
+ if (atLeast(2, 15, 0))
+ emit("Redefine: " + readShort());
+ emit("Model Group Xml: ");
+ dumpXml();
+ }
+
+ void dumpAttributeGroupData()
+ {
+ emit("Name: " + qnameString(readQName()));
+ emit("Target namespace: " + readString());
+ emit("Chameleon: " + readShort());
+ if (atLeast(2, 15, 0))
+ emit("Redefine: " + readShort());
+ emit("Attribute Group Xml: ");
+ dumpXml();
+ }
+
+ static String alwaysString(int code)
+ {
+ switch (code)
+ {
+ case SchemaProperty.CONSISTENTLY: return "CONSISTENTLY";
+ case SchemaProperty.NEVER: return "NEVER";
+ case SchemaProperty.VARIABLE: return "VARIABLE";
+ default:
+ return "Unknown frequency code (" + code + ")";
+ }
+ }
+
+ static String jtcString(int code)
+ {
+ switch (code)
+ {
+ case SchemaProperty.XML_OBJECT: return "XML_OBJECT";
+ case SchemaProperty.JAVA_BOOLEAN: return "JAVA_BOOLEAN";
+ case SchemaProperty.JAVA_FLOAT: return "JAVA_FLOAT";
+ case SchemaProperty.JAVA_DOUBLE: return "JAVA_DOUBLE";
+ case SchemaProperty.JAVA_BYTE: return "JAVA_BYTE";
+ case SchemaProperty.JAVA_SHORT: return "JAVA_SHORT";
+ case SchemaProperty.JAVA_INT: return "JAVA_INT";
+ case SchemaProperty.JAVA_LONG: return "JAVA_LONG";
+
+ case SchemaProperty.JAVA_BIG_DECIMAL: return "JAVA_BIG_DECIMAL";
+ case SchemaProperty.JAVA_BIG_INTEGER: return "JAVA_BIG_INTEGER";
+ case SchemaProperty.JAVA_STRING: return "JAVA_STRING";
+ case SchemaProperty.JAVA_BYTE_ARRAY: return "JAVA_BYTE_ARRAY";
+ case SchemaProperty.JAVA_GDATE: return "JAVA_GDATE";
+ case SchemaProperty.JAVA_GDURATION: return "JAVA_GDURATION";
+ case SchemaProperty.JAVA_DATE: return "JAVA_DATE";
+ case SchemaProperty.JAVA_QNAME: return "JAVA_QNAME";
+ case SchemaProperty.JAVA_CALENDAR: return "JAVA_CALENDAR";
+ case SchemaProperty.JAVA_LIST: return "JAVA_LIST";
+
+ case SchemaProperty.JAVA_ENUM: return "JAVA_ENUM";
+ case SchemaProperty.JAVA_OBJECT: return "JAVA_OBJECT";
+
+ default:
+ return "Unknown java type code (" + code + ")";
+ }
+ }
+
+ void dumpPropertyData()
+ {
+ emit("Property");
+ indent();
+ emit("Name: " + qnameString(readQName()));
+ emit("Type: " + readType());
+ int propflags = readShort();
+ emit("Flags: " + propertyflagsString(propflags));
+ emit("Container type: " + readType());
+ emit("Min occurances: " + bigIntegerString(readBigInteger()));
+ emit("Max occurances: " + bigIntegerString(readBigInteger()));
+ emit("Nillable: " + alwaysString(readShort()));
+ emit("Default: " + alwaysString(readShort()));
+ emit("Fixed: " + alwaysString(readShort()));
+ emit("Default text: " + readString());
+ emit("Java prop name: " + readString());
+ emit("Java type code: " + jtcString(readShort()));
+ emit("Type for java signature: " + readType());
+ emit("Java setter delimiter: " + qnameSetString(readQNameSet()));
+ if (atLeast(2, 16, 0))
+ emit("Default value: " + readXmlValueObject());
+ if (((propflags & FLAG_PROP_ISATTR) == 0) && atLeast(2, 17, 0))
+ {
+ short size = readShort();
+ emit("Accepted substitutions (" + size + "):");
+ for (int i = 0 ; i < size ; i++)
+ emit(" Accepted name " + readQName());
+ }
+
+ outdent();
+ }
+
+ String readXmlValueObject()
+ {
+ String type = readType();
+ if (type == null)
+ return "null";
+
+ int btc = readShort();
+ String value;
+ switch (btc)
+ {
+ default:
+ assert(false);
+ case 0:
+ value = "nil";
+ break;
+
+ case SchemaType.BTC_ANY_SIMPLE:
+ case SchemaType.BTC_ANY_URI:
+ case SchemaType.BTC_STRING:
+ case SchemaType.BTC_DURATION:
+ case SchemaType.BTC_DATE_TIME:
+ case SchemaType.BTC_TIME:
+ case SchemaType.BTC_DATE:
+ case SchemaType.BTC_G_YEAR_MONTH:
+ case SchemaType.BTC_G_YEAR:
+ case SchemaType.BTC_G_MONTH_DAY:
+ case SchemaType.BTC_G_DAY:
+ case SchemaType.BTC_G_MONTH:
+ case SchemaType.BTC_DECIMAL:
+ case SchemaType.BTC_BOOLEAN:
+ value = readString();
+ break;
+
+ case SchemaType.BTC_BASE_64_BINARY:
+ case SchemaType.BTC_HEX_BINARY:
+ {
+ value = new String(HexBin.encode(readByteArray()));
+ if (value.length() > 19)
+ value = value.subSequence(0, 16) + "...";
+ break;
+ }
+
+ case SchemaType.BTC_QNAME:
+ case SchemaType.BTC_NOTATION:
+ value = QNameHelper.pretty(readQName());
+ break;
+
+ case SchemaType.BTC_FLOAT:
+ case SchemaType.BTC_DOUBLE:
+ value = Double.toString(readDouble());
+ break;
+ }
+ return value + " (" + type + ": " + btc +")";
+ }
+
+ double readDouble()
+ {
+ try
+ {
+ return _input.readDouble();
+ }
+ catch (IOException e)
+ {
+ error(e);
+ return 0.0;
+ }
+ }
+
+ String SOAPArrayTypeString(SOAPArrayType t)
+ {
+ if (t == null)
+ return "null";
+ return QNameHelper.pretty(t.getQName()) + t.soap11DimensionString();
+ }
+
+ SOAPArrayType readSOAPArrayType()
+ {
+ QName qName = readQName();
+ String dimensions = readString();
+ if (qName == null)
+ return null;
+ return new SOAPArrayType(qName, dimensions);
+ }
+
+ QNameSet readQNameSet()
+ {
+ short flag = readShort();
+
+ Set uriSet = new HashSet();
+ short uriCount = readShort();
+ for (int i = 0; i < uriCount; i++)
+ uriSet.add(readString());
+
+ Set qnameSet1 = new HashSet();
+ short qncount1 = readShort();
+ for (int i = 0; i < qncount1; i++)
+ qnameSet1.add(readQName());
+
+ Set qnameSet2 = new HashSet();
+ short qncount2 = readShort();
+ for (int i = 0; i < qncount2; i++)
+ qnameSet2.add(readQName());
+
+ if (flag == 1)
+ return QNameSet.forSets(uriSet, null, qnameSet1, qnameSet2);
+ else
+ return QNameSet.forSets(null, uriSet, qnameSet2, qnameSet1);
+ }
+
+ byte[] readByteArray()
+ {
+ try
+ {
+ short len = _input.readShort();
+ byte[] result = new byte[len];
+ _input.readFully(result);
+ return result;
+ }
+ catch (IOException e)
+ {
+ error(e);
+ return null;
+ }
+ }
+
+ BigInteger readBigInteger()
+ {
+ byte[] result = readByteArray();
+ if (result.length == 0)
+ return null;
+ if (result.length == 1 && result[0] == 0)
+ return BigInteger.ZERO;
+ if (result.length == 1 && result[0] == 1)
+ return BigInteger.ONE;
+ return new BigInteger(result);
+ }
+
+ static final byte[] SINGLE_ZERO_BYTE = new byte[] { (byte)0 };
+
+ private int _majorver;
+ private int _minorver;
+ private int _releaseno;
+
+
+ protected boolean atLeast(int majorver, int minorver, int releaseno)
+ {
+ if (_majorver > majorver)
+ return true;
+ if (_majorver < majorver)
+ return false;
+ if (_minorver > minorver)
+ return true;
+ if (_minorver < minorver)
+ return false;
+ return (_releaseno >= releaseno);
+ }
+
+ protected boolean atMost(int majorver, int minorver, int releaseno)
+ {
+ if (_majorver > majorver)
+ return false;
+ if (_majorver < majorver)
+ return true;
+ if (_minorver > minorver)
+ return false;
+ if (_minorver < minorver)
+ return true;
+ return (_releaseno <= releaseno);
+ }
+
+}
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/ExtensionHolder.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/ExtensionHolder.java
new file mode 100644
index 0000000..fb2b141
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/ExtensionHolder.java
@@ -0,0 +1,251 @@
+/* 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.
+ */
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+package org.apache.xmlbeans.impl.config;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.lang.reflect.Method;
+
+/**
+ * This class reprezents all the extensions for all xbean sets.
+ * This class is the root of the structure that reprezents all the extensions.
+ */
+public class ExtensionHolder
+{
+ // these lists are expected to be quite small
+ private List _interfaceExtensions;
+ private List _prePostExtensions;
+
+ ExtensionHolder()
+ {
+ _interfaceExtensions = new ArrayList();
+ _prePostExtensions = new ArrayList();
+ }
+
+ void addInterfaceExtension(InterfaceExtension ext)
+ {
+ if (ext==null)
+ return;
+
+ _interfaceExtensions.add(ext);
+ }
+
+ void addPrePostExtension(PrePostExtension ext)
+ {
+ if (ext==null)
+ return;
+
+ _prePostExtensions.add(ext);
+ }
+
+ // this is used only for detecting method colisions of extending interfaces
+ private static class MethodSignature
+ {
+ private String _intfName; // Stored only for error output, does not influence the equals or hashCode
+ private Method _method;
+
+ MethodSignature(String intfName, Method method)
+ {
+ if (intfName==null || method==null)
+ throw new IllegalArgumentException("Interface: " + intfName + " method: " + method);
+
+ _intfName = intfName;
+ _method = method;
+ }
+
+ String getInterfaceName()
+ {
+ return _intfName;
+ }
+
+ String getSignature()
+ {
+ String sig = "";
+ Class[] paramTypes = _method.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ sig += ( i==0 ? "" : " ," ) + paramType.getName();
+ }
+ return _method.getName() + "(" + sig + ")";
+ }
+
+ public boolean equals(Object o)
+ {
+ if ( !(o instanceof MethodSignature))
+ return false;
+
+ MethodSignature ms = (MethodSignature)o;
+
+ if (!ms._method.getName().equals(_method.getName()) )
+ return false;
+
+ Class[] paramTypes = _method.getParameterTypes();
+ Class[] msParamTypes = _method.getParameterTypes();
+
+ if (msParamTypes.length != paramTypes.length )
+ return false;
+
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ if (msParamTypes[i] != paramTypes[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int hash = _method.getName().hashCode();
+
+ Class[] paramTypes = _method.getParameterTypes();
+
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ hash *= 19;
+ hash += paramTypes[i].hashCode();
+ }
+
+ return hash;
+ }
+ }
+
+ void secondPhaseValidation()
+ {
+ // validate interface methods collisions
+ Map methodSignatures = new HashMap();
+
+ for (int i = 0; i < _interfaceExtensions.size(); i++)
+ {
+ InterfaceExtension interfaceExtension = (InterfaceExtension) _interfaceExtensions.get(i);
+ for (int j = 0; j < interfaceExtension.getInterfaceMethodCount(); j++)
+ {
+ MethodSignature ms = new MethodSignature(interfaceExtension.getInterfaceName(),
+ interfaceExtension.getInterfaceMethod(j));
+
+ if ( methodSignatures.containsKey(ms) )
+ {
+ MethodSignature ms2 = (MethodSignature) methodSignatures.get(ms);
+ SchemaConfig.error("Colliding methods '" + ms.getSignature() + "' in interfaces " +
+ ms.getInterfaceName() + " and " + ms2.getInterfaceName() + ".", null);
+
+ return;
+ }
+
+ // store it into hashmap
+ methodSignatures.put(ms, ms);
+ }
+ }
+
+ // validate that PrePostExtension-s do not intersect
+ for (int i = 0; i < _prePostExtensions.size() - 1; i++)
+ {
+ PrePostExtension a = (PrePostExtension) _prePostExtensions.get(i);
+ for (int j = 1; j < _prePostExtensions.size(); j++)
+ {
+ PrePostExtension b = (PrePostExtension) _prePostExtensions.get(j);
+ if (a.hasNameSetIntersection(b))
+ SchemaConfig.error("The applicable domain for handler '" + a.getHandlerNameForJavaSource() +
+ "' intersects with the one for '" + b.getHandlerNameForJavaSource() + "'.", null);
+ }
+ }
+ }
+
+ void normalize()
+ {
+ //todo: not yet used, useful for optimizing jar size in case of big interfaces and big schemas
+ throw new RuntimeException("NYI");
+ // this matters only for InterfaceExtension-s
+ }
+
+ public void verifyInterfaceNameCollisions(Set genedUsedNames)
+ {
+ for (int i = 0; i < _interfaceExtensions.size(); i++)
+ {
+ InterfaceExtension interfaceExtension = (InterfaceExtension) _interfaceExtensions.get(i);
+ if ( genedUsedNames.contains(interfaceExtension.getInterfaceNameForJavaSource().toLowerCase()) )
+ {
+ SchemaConfig.error("Extension interface '" + interfaceExtension.getInterfaceNameForJavaSource() + "' creates a name collision with one of the generated interfaces or classes.", null);
+ }
+ String handlerClassName = interfaceExtension.getHandlerNameForJavaSource();
+ if ( handlerClassName!=null &&
+ genedUsedNames.contains(handlerClassName.toLowerCase()) )
+ {
+ SchemaConfig.error("Handler class '" + handlerClassName + "' creates a name collision with one of the generated interfaces or classes.", null);
+ }
+ }
+
+ for (int i = 0; i < _prePostExtensions.size(); i++)
+ {
+ PrePostExtension prePostExtension = (PrePostExtension) _prePostExtensions.get(i);
+ String handlerClassName = prePostExtension.getHandlerNameForJavaSource();
+ if ( handlerClassName!=null &&
+ genedUsedNames.contains(handlerClassName.toLowerCase()) )
+ {
+ SchemaConfig.error("Handler class '" + prePostExtension.getHandlerNameForJavaSource() + "' creates a name collision with one of the generated interfaces or classes.", null);
+ }
+ }
+ }
+
+ ExtensionHolder extensionHolderFor(String javaName)
+ {
+ for (int i = 0; i < _interfaceExtensions.size(); i++)
+ {
+ InterfaceExtension interfaceExtension = (InterfaceExtension) _interfaceExtensions.get(i);
+ if (interfaceExtension.contains(javaName))
+ return this;
+ }
+
+ for (int i = 0; i < _prePostExtensions.size(); i++)
+ {
+ PrePostExtension prePostExtension = (PrePostExtension) _prePostExtensions.get(i);
+ if (prePostExtension.contains(javaName))
+ return this;
+ }
+
+ return null;
+ }
+
+ public List getInterfaceExtensionsFor(String fullJavaName)
+ {
+ List result = new ArrayList();
+ for (int i = 0; i < _interfaceExtensions.size(); i++)
+ {
+ InterfaceExtension intfExt = (InterfaceExtension) _interfaceExtensions.get(i);
+ if (intfExt.contains(fullJavaName))
+ result.add(intfExt);
+ }
+ return result;
+ }
+
+ public PrePostExtension getPrePostExtensionsFor(String fullJavaName)
+ {
+ for (int i = 0; i < _prePostExtensions.size(); i++)
+ {
+ PrePostExtension prePostExt = (PrePostExtension) _prePostExtensions.get(i);
+ if (prePostExt.contains(fullJavaName))
+ return prePostExt;
+ }
+ return null;
+ }
+}
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtension.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtension.java
new file mode 100644
index 0000000..2cf788c
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtension.java
@@ -0,0 +1,286 @@
+/* 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.
+ */
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Mar 25, 2004
+ */
+package org.apache.xmlbeans.impl.config;
+
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.Extensionconfig;
+import org.apache.xmlbeans.XmlObject;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class InterfaceExtension
+{
+ private NameSet _xbeanSet;
+ private Class _interface;
+ private Class _delegateToClass;
+ private String _delegateToClassName;
+ private Method[] _interfaceMethods;
+ private Method[] _delegateToMethods;
+
+ static InterfaceExtension newInstance(NameSet xbeanSet, Extensionconfig.Interface intfXO)
+ {
+ InterfaceExtension result = new InterfaceExtension();
+
+ result._xbeanSet = xbeanSet;
+ result._interface = validateInterface(intfXO.getName(), intfXO);
+
+ if (result._interface == null)
+ {
+ SchemaConfig.error("Interface '" + intfXO.getStaticHandler() + "' not found.", intfXO);
+ return null;
+ }
+
+ result._delegateToClassName = intfXO.getStaticHandler();
+ result._delegateToClass = validateClass(result._delegateToClassName, intfXO);
+
+ if ( result._delegateToClass==null ) // no HandlerClass
+ {
+ SchemaConfig.warning("Handler class '" + intfXO.getStaticHandler() + "' not found on classpath, skip validation.", intfXO);
+ return result;
+ }
+
+ if (!result.validateMethods(intfXO))
+ return null;
+
+ return result;
+ }
+
+ private static Class validateInterface(String intfStr, XmlObject loc)
+ {
+ return validateJava(intfStr, true, loc);
+ }
+
+ static Class validateClass(String clsStr, XmlObject loc)
+ {
+ return validateJava(clsStr, false, loc);
+ }
+
+ static Class validateJava(String clsStr, boolean isInterface, XmlObject loc)
+ {
+ final String ent = isInterface ? "Interface" : "Class";
+ try
+ {
+ Class cls = Class.forName(clsStr);
+ if ( (isInterface && !cls.isInterface()) ||
+ (!isInterface && cls.isInterface()))
+ {
+ SchemaConfig.error("'" + clsStr + "' must be " +
+ (isInterface ? "an interface" : "a class") + ".", loc);
+ }
+
+ if (!Modifier.isPublic(cls.getModifiers()))
+ {
+ SchemaConfig.error(ent + " '" + clsStr + "' is not public.", loc);
+ }
+
+ return cls;
+ }
+ catch (ClassNotFoundException e)
+ {
+ SchemaConfig.error(ent + " '" + clsStr + "' not found.", loc);
+ return null;
+ }
+ }
+
+ private boolean validateMethods(XmlObject loc)
+ {
+ assert _delegateToClass != null : "Delegate to class handler expected.";
+ boolean valid = true;
+
+ _interfaceMethods = _interface.getMethods();
+ _delegateToMethods = new Method[_interfaceMethods.length];
+
+ for (int i = 0; i < _interfaceMethods.length; i++)
+ {
+ valid &= validateMethod(i, _interfaceMethods[i], loc);
+ }
+
+ return valid;
+ }
+
+ private boolean validateMethod(int index, Method method, XmlObject loc)
+ {
+ String methodName = method.getName();
+ Class[] paramTypes = method.getParameterTypes();
+ Class returnType = method.getReturnType();
+
+ Class[] delegateParams = new Class[paramTypes.length+1];
+ delegateParams[0] = XmlObject.class;
+ for (int i = 1; i < delegateParams.length; i++)
+ {
+ delegateParams[i] = paramTypes[i-1];
+ }
+
+ Method handlerMethod = null;
+ try
+ {
+ handlerMethod = _delegateToClass.getMethod(methodName, delegateParams);
+
+ // check for throws exceptions
+ Class[] intfExceptions = method.getExceptionTypes();
+ Class[] delegateExceptions = handlerMethod.getExceptionTypes();
+ if ( delegateExceptions.length!=intfExceptions.length )
+ {
+ SchemaConfig.error("Handler method '" + _delegateToClass.getName() + "." + methodName + "(" + listTypes(delegateParams) +
+ ")' must declare the same exceptions as the interface method '" + _interface.getName() + "." + methodName + "(" + listTypes(paramTypes), loc);
+ return false;
+ }
+
+ for (int i = 0; i < delegateExceptions.length; i++)
+ {
+ if ( delegateExceptions[i]!=intfExceptions[i] )
+ {
+ SchemaConfig.error("Handler method '" + _delegateToClass.getName() + "." + methodName + "(" + listTypes(delegateParams) +
+ ")' must declare the same exceptions as the interface method '" + _interface.getName() + "." + methodName + "(" + listTypes(paramTypes), loc);
+ return false;
+ }
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ SchemaConfig.error("Handler class '" + _delegateToClass.getName() + "' does not contain method " + methodName + "(" + listTypes(delegateParams) + ")", loc);
+ return false;
+ }
+ catch (SecurityException e)
+ {
+ SchemaConfig.error("Security violation for class '" + _interface.getName() + "' accesing method " + methodName + "(" + listTypes(delegateParams) + ")", loc);
+ return false;
+ }
+
+ if (!Modifier.isPublic(handlerMethod.getModifiers()) || !Modifier.isStatic(handlerMethod.getModifiers()))
+ {
+ SchemaConfig.error("Method '" + _delegateToClass.getName() + "." + methodName + "(" + listTypes(delegateParams) + ")' must be declared public and static.", loc);
+ return false;
+ }
+
+ if (!returnType.equals(handlerMethod.getReturnType()))
+ {
+ SchemaConfig.error("Return type for method '" + handlerMethod.getReturnType() + " " + _delegateToClass.getName() +
+ "." + methodName + "(" + listTypes(delegateParams) + ")' does not match the return type of the interface method :'" + returnType + "'.", loc);
+ return false;
+ }
+
+ _delegateToMethods[index] = method;
+
+ return true;
+ }
+
+ private static String listTypes(Class[] types)
+ {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < types.length; i++)
+ {
+ Class type = types[i];
+ if (i>0)
+ result.append(", ");
+ result.append(emitType(type));
+ }
+ return result.toString();
+ }
+
+ public static String emitType(Class cls)
+ {
+ if (cls.isArray())
+ return emitType(cls.getComponentType()) + "[]";
+ else
+ return cls.getName().replace('$', '.');
+ }
+
+ /* public getters */
+ public boolean contains(String fullJavaName)
+ {
+ return _xbeanSet.contains(fullJavaName);
+ }
+
+ public String getInterfaceName()
+ {
+ return _interface.getName();
+ }
+
+ public String getInterfaceNameForJavaSource()
+ {
+ return emitType(_interface);
+ }
+
+ // used only for validation
+ public String getHandlerNameForJavaSource()
+ {
+ if (_delegateToClass==null)
+ return null;
+
+ return emitType(_delegateToClass);
+ }
+
+ public int getInterfaceMethodCount()
+ {
+ return _interfaceMethods.length;
+ }
+
+ public String getInterfaceMethodName(int methodIndex)
+ {
+ return _interfaceMethods[methodIndex].getName();
+ }
+
+ public Method getInterfaceMethod(int methodIndex)
+ {
+ return _interfaceMethods[methodIndex];
+ }
+
+ public String getInterfaceMethodDecl(int methodIndex)
+ {
+ StringBuffer sb = new StringBuffer();
+ Method m = _interfaceMethods[methodIndex];
+ Class[] paramTypes = m.getParameterTypes();
+
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ sb.append( i==0 ? "" : ", " );
+ sb.append( emitType(paramType) + " p" + i);
+ }
+
+ StringBuffer exceptions = new StringBuffer();
+ Class[] excClasses = m.getExceptionTypes();
+
+ for (int i=0; i<excClasses.length; i++)
+ exceptions.append((i==0 ? " throws " : ", ") + emitType(excClasses[i]));
+
+ return "public " + emitType(m.getReturnType()) + " " + m.getName() + "(" + sb.toString() + ")" + exceptions.toString();
+ }
+
+ public String getInterfaceMethodImpl(int methodIndex)
+ {
+ // use the methods from the interface for gen the call to the handler
+ StringBuffer sb = new StringBuffer();
+
+ if (!void.class.equals(_interfaceMethods[methodIndex].getReturnType()))
+ sb.append("return ");
+
+ sb.append(_delegateToClassName + "." + _delegateToMethods[methodIndex].getName() + "(this");
+
+ int paramCount = _interfaceMethods[methodIndex].getParameterTypes().length;
+ for (int i=0; i<paramCount; i++)
+ {
+ sb.append(", p" + i);
+ }
+
+ sb.append(");");
+ return sb.toString();
+ }
+}
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSet.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSet.java
new file mode 100644
index 0000000..2b0b8d0
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSet.java
@@ -0,0 +1,224 @@
+/* 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.
+ */
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+package org.apache.xmlbeans.impl.config;
+
+import java.util.Set;
+import java.util.Collections;
+import java.util.HashSet;
+
+/**
+ * Reprezents a non finite set of names.
+ * @see NameSetBuilder
+ */
+public class NameSet
+{
+ /**
+ * An empty NameSet, it doesn't contain any name
+ */
+ public static NameSet EMPTY = new NameSet(true, Collections.EMPTY_SET);
+ /**
+ * The NameSet that contains any name
+ */
+ public static NameSet EVERYTHING = new NameSet(false, Collections.EMPTY_SET);
+
+ /*
+ There are two big cases:
+ 1) - it reprezents "*", ie all except a finite set of names: _isFinite==false
+ 2) - if reprezents only a finite set of names: _isFinite==true
+ */
+ private boolean _isFinite;
+ private Set _finiteSet;
+
+ private NameSet(boolean isFinite, Set finiteSet)
+ {
+ _isFinite = isFinite;
+ _finiteSet = finiteSet;
+ }
+
+ static NameSet newInstance(boolean isFinite, Set finiteSet)
+ {
+ if ( finiteSet.size()==0 )
+ if ( isFinite )
+ return NameSet.EMPTY;
+ else
+ return NameSet.EVERYTHING;
+ else
+ {
+ Set fs = new HashSet();
+ fs.addAll(finiteSet);
+ return new NameSet(isFinite, fs);
+ }
+ }
+
+ private static Set intersectFiniteSets(Set a, Set b)
+ {
+ Set intersection = new HashSet();
+ //compute the intersection of _finiteSet with withSet
+ while (a.iterator().hasNext())
+ {
+ String name = (String) a.iterator().next();
+ if (b.contains(name))
+ intersection.add(name);
+ }
+ return intersection;
+ }
+
+ /**
+ * Returns the union of this NameSet with the 'with' NameSet.
+ */
+ public NameSet union(NameSet with)
+ {
+ if (_isFinite)
+ {
+ if (with._isFinite)
+ {
+ Set union = new HashSet();
+ union.addAll(_finiteSet);
+ union.addAll(with._finiteSet);
+ return newInstance(true, union);
+ }
+ else
+ {
+ Set subst = new HashSet();
+ subst.addAll(with._finiteSet);
+ subst.removeAll(_finiteSet);
+ return newInstance(false, subst);
+ }
+ }
+ else
+ {
+ if (with._isFinite)
+ {
+ Set subst = new HashSet();
+ subst.addAll(_finiteSet);
+ subst.removeAll(with._finiteSet);
+ return newInstance(false, subst);
+ }
+ else
+ {
+ return newInstance(false, intersectFiniteSets(_finiteSet, with._finiteSet));
+ }
+ }
+ }
+
+ /**
+ * Returns the intersection of this NameSet with the 'with' NameSet
+ */
+ public NameSet intersect(NameSet with)
+ {
+ if (_isFinite)
+ {
+ if (with._isFinite)
+ {
+ return newInstance(true, intersectFiniteSets(_finiteSet, with._finiteSet));
+ }
+ else
+ {
+ Set subst = new HashSet();
+ subst.addAll(_finiteSet);
+ subst.removeAll(with._finiteSet);
+ return newInstance(false, subst);
+ }
+ }
+ else
+ {
+ if (with._isFinite)
+ {
+ Set subst = new HashSet();
+ subst.addAll(with._finiteSet);
+ subst.removeAll(_finiteSet);
+ return newInstance(true, subst);
+ }
+ else
+ {
+ Set union = new HashSet();
+ union.addAll(_finiteSet);
+ union.addAll(with._finiteSet);
+ return newInstance(false, union);
+ }
+ }
+ }
+
+ /**
+ * Returns the result of substracting this NameSet from 'from' NameSet
+ * @see NameSet#substract
+ */
+ public NameSet substractFrom(NameSet from)
+ {
+ return from.substract(this);
+ }
+
+ /**
+ * Returns the result of substracting 'what' NameSet from this NameSet
+ * @see NameSet#substractFrom
+ */
+ public NameSet substract(NameSet what)
+ {
+ if (_isFinite)
+ {
+ if ( what._isFinite )
+ {
+ // it's the subst of _finiteSet with what._finiteSet
+ Set subst = new HashSet();
+ subst.addAll(_finiteSet);
+ subst.removeAll(what._finiteSet);
+ return newInstance(true, subst);
+ }
+ else
+ {
+ return newInstance(true, intersectFiniteSets(_finiteSet, what._finiteSet));
+ }
+ }
+ else
+ {
+ if ( what._isFinite )
+ {
+ // it's the union of _finiteSet with what._finiteSet
+ Set union = new HashSet();
+ union.addAll(_finiteSet);
+ union.addAll(what._finiteSet);
+ return newInstance(false, union);
+ }
+ else
+ {
+ // what's in thisSet and it's not in whatSet
+ Set subst = new HashSet();
+ subst.addAll(what._finiteSet);
+ subst.removeAll(_finiteSet);
+ return newInstance(true, subst);
+ }
+ }
+ }
+
+ /**
+ * Returns an inversion of this NameSet
+ */
+ public NameSet invert()
+ {
+ return newInstance(!_isFinite, _finiteSet);
+ }
+
+ public boolean contains(String name)
+ {
+ if (_isFinite)
+ return _finiteSet.contains(name);
+ else
+ return !_finiteSet.contains(name);
+ }
+}
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSetBuilder.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSetBuilder.java
new file mode 100644
index 0000000..da61a08
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/NameSetBuilder.java
@@ -0,0 +1,75 @@
+/* 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.
+ */
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+package org.apache.xmlbeans.impl.config;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Used to build {@link NameSet NameSets}.
+ */
+public class NameSetBuilder
+{
+ private boolean _isFinite;
+ private Set _finiteSet;
+
+ /**
+ * Creates an empty builder for a NameSet.
+ */
+ public NameSetBuilder()
+ {
+ _isFinite = true;
+ _finiteSet = new HashSet();
+ }
+
+ /**
+ * Inverts the representing NameSet
+ */
+ public void invert()
+ {
+ _isFinite = !_isFinite;
+ }
+
+ /**
+ * Adds a name to the representing NameSet
+ * @param name
+ */
+ public void add(String name)
+ {
+ if (_isFinite )
+ _finiteSet.add(name);
+ else
+ _finiteSet.remove(name);
+ }
+
+ /**
+ * Creates a new NameSet with the current state.
+ * @return created NameSet
+ */
+ public NameSet toNameSet()
+ {
+ if ( _finiteSet.size()==0 )
+ if ( _isFinite )
+ return NameSet.EMPTY;
+ else
+ return NameSet.EVERYTHING;
+ else
+ return NameSet.newInstance(_isFinite, _finiteSet);
+ }
+}
\ No newline at end of file
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/PrePostExtension.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/PrePostExtension.java
new file mode 100644
index 0000000..6dc795e
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/PrePostExtension.java
@@ -0,0 +1,172 @@
+/* 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.
+ */
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 12, 2004
+ */
+package org.apache.xmlbeans.impl.config;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.Extensionconfig;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
+
+public class PrePostExtension
+{
+ public static int OPERATION_SET = 1;
+ public static int OPERATION_INSERT = 2;
+ public static int OPERATION_REMOVE = 3;
+
+ private static final Class[] PARAMTYPES_PREPOST = new Class[]{int.class, XmlObject.class, QName.class, boolean.class, int.class};
+ private static final String SIGNATURE = "(int, org.apache.xmlbeans.XmlObject, javax.xml.namespace.QName, boolean, int)";
+
+ private NameSet _xbeanSet;
+ private Class _delegateToClass;
+ private String _delegateToClassName;
+ private Method _preSet;
+ private Method _postSet;
+
+ static PrePostExtension newInstance(NameSet xbeanSet, Extensionconfig.PrePostSet prePostXO)
+ {
+ if (prePostXO==null)
+ return null;
+
+ PrePostExtension result = new PrePostExtension();
+
+ result._xbeanSet = xbeanSet;
+ result._delegateToClassName = prePostXO.getStaticHandler();
+ result._delegateToClass = InterfaceExtension.validateClass(result._delegateToClassName, prePostXO);
+
+ if ( result._delegateToClass==null ) // no HandlerClass
+ {
+ SchemaConfig.warning("Handler class '" + prePostXO.getStaticHandler() + "' not found on classpath, skip validation.", prePostXO);
+ return result;
+ }
+
+ if (!result.lookAfterPreAndPost(prePostXO))
+ return null;
+
+ return result;
+ }
+
+ private boolean lookAfterPreAndPost(XmlObject loc)
+ {
+ assert _delegateToClass!=null : "Delegate to class handler expected.";
+ boolean valid = true;
+
+ try
+ {
+ _preSet = _delegateToClass.getMethod("preSet", PARAMTYPES_PREPOST);
+
+ if (!_preSet.getReturnType().equals(boolean.class))
+ {
+ // just emit an warning and don't remember as a preSet
+ SchemaConfig.warning("Method '" + _delegateToClass.getName() +
+ ".preSet" + SIGNATURE + "' " +
+ "should return boolean to be considered for a preSet handler.", loc);
+ _preSet = null;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {} // not available is ok, _preSet will be null
+ catch (SecurityException e)
+ {
+ SchemaConfig.error("Security violation for class '" + _delegateToClass.getName() +
+ "' accesing method preSet" + SIGNATURE , loc);
+ valid = false;
+ }
+
+ try
+ {
+ _postSet = _delegateToClass.getMethod("postSet", PARAMTYPES_PREPOST);
+ }
+ catch (NoSuchMethodException e)
+ {} // not available is ok, _postSet will be null
+ catch (SecurityException e)
+ {
+ SchemaConfig.error("Security violation for class '" + _delegateToClass.getName() +
+ "' accesing method postSet" + SIGNATURE, loc);
+ valid = false;
+ }
+
+ if (_preSet==null && _postSet==null)
+ {
+ SchemaConfig.error("prePostSet handler specified '" + _delegateToClass.getName() +
+ "' but no preSet" + SIGNATURE + " or " +
+ "postSet" + SIGNATURE + " methods found.", loc);
+ valid = false;
+ }
+
+ return valid;
+ }
+
+ // public methods
+ public boolean contains(String fullJavaName)
+ {
+ return _xbeanSet.contains(fullJavaName);
+ }
+
+ public boolean hasPreCall()
+ {
+ return _preSet!=null;
+ }
+
+ public boolean hasPostCall()
+ {
+ return _postSet!=null;
+ }
+
+ /**
+ * Returns the name of the handler in a form that can be put in a java source.
+ */
+ public String getHandlerNameForJavaSource()
+ {
+ // used only in validation
+ if (_delegateToClass==null)
+ return null;
+
+ return InterfaceExtension.emitType(_delegateToClass);
+ }
+
+ /**
+ * Returns the gened code for makeing the preSet call
+ * @param identifier
+ * @param isAttr
+ * @param index usualy is 'i', or can be -1 for non array properties
+ * @return gened code
+ */
+ public String getPreCall(int opType, String identifier, boolean isAttr, String index)
+ {
+ return _delegateToClassName + ".preSet(" + opType + ", this, " + identifier + ", " + isAttr + ", " + index + ")";
+ }
+
+ /**
+ * Returns the gened code for makeing the preSet call
+ * @param identifier
+ * @param isAttr
+ * @param index usualy is 'i', or can be -1 for non array properties
+ * @return gened code
+ */
+ public String getPostCall(int opType, String identifier, boolean isAttr, String index)
+ {
+ return _delegateToClassName + ".postSet(" + opType + ", this, " + identifier + ", " + isAttr + ", " + index + ");";
+ }
+
+ public boolean hasNameSetIntersection(PrePostExtension ext)
+ {
+ return !NameSet.EMPTY.equals(_xbeanSet.intersect(ext._xbeanSet));
+ }
+}
diff --git a/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/SchemaConfig.java b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/SchemaConfig.java
new file mode 100644
index 0000000..b0aa805
--- /dev/null
+++ b/v1/src/xmlconfig/org/apache/xmlbeans/impl/config/SchemaConfig.java
@@ -0,0 +1,249 @@
+/* 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.xmlbeans.impl.config;
+
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument.Config;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.Extensionconfig;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.Nsconfig;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.Qnameconfig;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.impl.schema.StscState;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SchemaConfig
+{
+ private Map _packageMap;
+ private Map _prefixMap;
+ private Map _suffixMap;
+ private Map _packageMapByUriPrefix; // uri prefix -> package
+ private Map _prefixMapByUriPrefix; // uri prefix -> name prefix
+ private Map _suffixMapByUriPrefix; // uri prefix -> name suffix
+ private Map _qnameMap;
+ private ExtensionHolder _extensionHolder;
+
+ private SchemaConfig()
+ {
+ _packageMap = Collections.EMPTY_MAP;
+ _prefixMap = Collections.EMPTY_MAP;
+ _suffixMap = Collections.EMPTY_MAP;
+ _packageMapByUriPrefix = Collections.EMPTY_MAP;
+ _prefixMapByUriPrefix = Collections.EMPTY_MAP;
+ _suffixMapByUriPrefix = Collections.EMPTY_MAP;
+ _qnameMap = Collections.EMPTY_MAP;
+ _extensionHolder = null;
+ }
+
+ public static SchemaConfig forConfigDocuments(Config[] configs)
+ {
+ return new SchemaConfig(configs);
+ }
+
+ private SchemaConfig(Config[] configs)
+ {
+ _packageMap = new LinkedHashMap();
+ _prefixMap = new LinkedHashMap();
+ _suffixMap = new LinkedHashMap();
+ _packageMapByUriPrefix = new LinkedHashMap();
+ _prefixMapByUriPrefix = new LinkedHashMap();
+ _suffixMapByUriPrefix = new LinkedHashMap();
+ _qnameMap = new LinkedHashMap();
+ _extensionHolder = new ExtensionHolder();
+
+ for (int i = 0; i < configs.length; i++)
+ {
+ Config config = configs[i];
+ Nsconfig[] nsa = config.getNamespaceArray();
+ for (int j = 0; j < nsa.length; j++)
+ {
+ recordNamespaceSetting(nsa[j].getUri(), nsa[j].getPackage(), _packageMap);
+ recordNamespaceSetting(nsa[j].getUri(), nsa[j].getPrefix(), _prefixMap);
+ recordNamespaceSetting(nsa[j].getUri(), nsa[j].getSuffix(), _suffixMap);
+ recordNamespacePrefixSetting(nsa[j].getUriprefix(), nsa[j].getPackage(), _packageMapByUriPrefix);
+ recordNamespacePrefixSetting(nsa[j].getUriprefix(), nsa[j].getPrefix(), _prefixMapByUriPrefix);
+ recordNamespacePrefixSetting(nsa[j].getUriprefix(), nsa[j].getSuffix(), _suffixMapByUriPrefix);
+ }
+
+ Qnameconfig[] qnc = config.getQnameArray();
+ for (int j = 0; j < qnc.length; j++)
+ {
+ _qnameMap.put(qnc[j].getName(), qnc[j].getJavaname());
+ }
+
+ Extensionconfig[] ext = config.getExtensionArray();
+ for (int j = 0; j < ext.length; j++)
+ {
+ recordExtensionSetting(ext[j]);
+ }
+ }
+
+ _extensionHolder.secondPhaseValidation();
+ //todo _extensionHolder.normalize();
+ }
+
+ private static void recordNamespaceSetting(Object key, String value, Map result)
+ {
+ if (value == null)
+ return;
+ else if (key == null)
+ result.put("", value);
+ else if (key instanceof String && "##any".equals(key))
+ result.put(key, value);
+ else if (key instanceof List)
+ {
+ for (Iterator i = ((List)key).iterator(); i.hasNext(); )
+ {
+ String uri = (String)i.next();
+ if ("##local".equals(uri))
+ uri = "";
+ result.put(uri, value);
+ }
+ }
+ }
+
+ private static void recordNamespacePrefixSetting(List list, String value, Map result)
+ {
+ if (value == null)
+ return;
+ else if (list == null)
+ return;
+ for (Iterator i = list.iterator(); i.hasNext(); )
+ {
+ result.put(i.next(), value);
+ }
+ }
+
+ private void recordExtensionSetting(Extensionconfig ext)
+ {
+ NameSet xbeanSet = null;
+ Object key = ext.getFor();
+
+
+ if (key instanceof String && "*".equals(key))
+ xbeanSet = NameSet.EVERYTHING;
+ else if (key instanceof List)
+ {
+ NameSetBuilder xbeanSetBuilder = new NameSetBuilder();
+ for (Iterator i = ((List)key).iterator(); i.hasNext(); )
+ {
+ String xbeanName = (String)i.next();
+ xbeanSetBuilder.add(xbeanName);
+ }
+ xbeanSet = xbeanSetBuilder.toNameSet();
+ }
+
+ if (xbeanSet==null)
+ error("Invalid value of attribute 'for' : '" + key + "'.", ext);
+
+ Extensionconfig.Interface[] intfXO = ext.getInterfaceArray();
+
+ for (int i = 0; i < intfXO.length; i++)
+ {
+ _extensionHolder.addInterfaceExtension(InterfaceExtension.newInstance(xbeanSet, intfXO[i]));
+ }
+
+ _extensionHolder.addPrePostExtension(PrePostExtension.newInstance(xbeanSet, ext.getPrePostSet()));
+ }
+
+
+ private String lookup(Map map, Map mapByUriPrefix, String uri)
+ {
+ if (uri == null)
+ uri = "";
+ String result = (String)map.get(uri);
+ if (result != null)
+ return result;
+ if (mapByUriPrefix != null)
+ {
+ result = lookupByUriPrefix(mapByUriPrefix, uri);
+ if (result != null)
+ return result;
+ }
+
+ return (String)map.get("##any");
+ }
+
+ private String lookupByUriPrefix(Map mapByUriPrefix, String uri)
+ {
+ if (uri == null)
+ return null;
+ if (!mapByUriPrefix.isEmpty())
+ {
+ String uriprefix = null;
+ Iterator i = mapByUriPrefix.keySet().iterator();
+ while (i.hasNext())
+ {
+ String nextprefix = (String)i.next();
+ if (uriprefix != null && nextprefix.length() < uriprefix.length())
+ continue;
+ if (uri.startsWith(nextprefix))
+ uriprefix = nextprefix;
+ }
+
+ if (uriprefix != null)
+ return (String)mapByUriPrefix.get(uriprefix);
+ }
+ return null;
+ }
+
+ //package methods
+ static void warning(String s, XmlObject xo)
+ {
+ StscState.get().error(s, XmlError.SEVERITY_WARNING, xo);
+ }
+
+ static void error(String s, XmlObject xo)
+ {
+ StscState.get().error(s, XmlError.SEVERITY_ERROR, xo);
+ }
+
+ //public methods
+ public String lookupPackageForNamespace(String uri)
+ {
+ return lookup(_packageMap, _packageMapByUriPrefix, uri);
+ }
+
+ public String lookupPrefixForNamespace(String uri)
+ {
+ return lookup(_prefixMap, _prefixMapByUriPrefix, uri);
+ }
+
+ public String lookupSuffixForNamespace(String uri)
+ {
+ return lookup(_suffixMap, _suffixMapByUriPrefix, uri);
+ }
+
+ public String lookupJavanameForQName(QName qname)
+ {
+ return (String)_qnameMap.get(qname);
+ }
+
+ public ExtensionHolder extensionHolderFor(String fullJavaName)
+ {
+ return _extensionHolder.extensionHolderFor(fullJavaName);
+ }
+
+ public ExtensionHolder getExtensionHolder()
+ {
+ return _extensionHolder;
+ }
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Attribute.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Attribute.java
new file mode 100755
index 0000000..2a1763f
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Attribute.java
@@ -0,0 +1,47 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * An interface that contains information about an attribute
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ * @see org.apache.xmlbeans.xml.stream.Attribute
+ */
+public interface Attribute {
+ /**
+ * Get the XMLName of the current attribute.
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+ public XMLName getName();
+
+ /**
+ * Get the attribute value of the current attribute.
+ */
+ public String getValue();
+
+ /**
+ * Get the attribute type of the current attribute
+ */
+ public String getType();
+
+ /**
+ * Get the attribute type of the current attribute
+ */
+ public XMLName getSchemaType();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/AttributeIterator.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/AttributeIterator.java
new file mode 100755
index 0000000..be393f2
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/AttributeIterator.java
@@ -0,0 +1,48 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * This interface specifies methods for iterating over attributes.
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.Attribute
+*/
+
+public interface AttributeIterator {
+ /**
+ * Get the next Attribute on the stream
+ * @see org.apache.xmlbeans.xml.stream.Attribute
+ */
+ public Attribute next();
+
+ /**
+ * Check if there are any attributes on the stream
+ */
+ public boolean hasNext();
+
+ /**
+ * Return the next element on the stream without shifting it
+ */
+ public Attribute peek();
+
+
+ /**
+ * Skip the next element on the stream
+ */
+ public void skip();
+}
+
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/BufferedXMLInputStream.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/BufferedXMLInputStream.java
new file mode 100755
index 0000000..c1bf9bb
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/BufferedXMLInputStream.java
@@ -0,0 +1,48 @@
+/* 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.xmlbeans.xml.stream;
+
+import java.io.IOException;
+/**
+ * Extends the XMLInputStream to allow marking and reseting of the stream.
+ *
+ * @since XMLInputStream 1.0
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.ProcessingInstruction
+ * @see org.apache.xmlbeans.xml.stream.StartElement
+ * @see org.apache.xmlbeans.xml.stream.EndElement
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+public interface BufferedXMLInputStream extends XMLInputStream {
+ /**
+ * Sets the marks a point to return to in the stream,
+ * throws an exception if the stream does not support mark.
+ * This is only supported in BufferedStreams
+ */
+ public void mark() throws XMLStreamException;
+ /**
+ * Resets the stream to the previous mark.
+ * throws an exception if the stream does not support mark;
+ */
+ public void reset() throws XMLStreamException;
+}
+
+
+
+
+
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ChangePrefixMapping.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ChangePrefixMapping.java
new file mode 100755
index 0000000..3164394
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ChangePrefixMapping.java
@@ -0,0 +1,43 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * This event signals that a prefix mapping has changed from
+ * OldNamespaceName to the NewNamespaceName
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.StartPrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.EndPrefixMapping
+ */
+public interface ChangePrefixMapping extends XMLEvent {
+ /*
+ * returns the uri that the prefix was bound to
+ * @return String value of the uri
+ */
+ public String getOldNamespaceUri();
+ /*
+ * returns the new uri that the prefix is bound to
+ * @return String value of the uri
+ */
+ public String getNewNamespaceUri();
+ /*
+ * returns the prefix that is bound
+ * @return String value of the prefix
+ */
+ public String getPrefix();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/CharacterData.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/CharacterData.java
new file mode 100755
index 0000000..dbe9556
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/CharacterData.java
@@ -0,0 +1,37 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * A marker interface for character data
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+public interface CharacterData extends XMLEvent {
+ /**
+ * Get the content of this element,
+ * returns null if the element has no content
+ */
+ public String getContent();
+
+ /**
+ * Returns true if this element has content and false otherwise
+ */
+ public boolean hasContent();
+
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Comment.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Comment.java
new file mode 100755
index 0000000..99b364d
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Comment.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * A marker interface for comment data
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+
+public interface Comment extends CharacterData {
+ /**
+ * No methods are defined in this interface.
+ */
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ElementFilter.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ElementFilter.java
new file mode 100755
index 0000000..d179a5c
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ElementFilter.java
@@ -0,0 +1,28 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ *
+ * This interface defines a filter on elements
+ */
+
+public interface ElementFilter {
+ /**
+ * tests whether this event is part of this stream
+ */
+ boolean accept(XMLEvent element);
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndDocument.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndDocument.java
new file mode 100755
index 0000000..0d0402c
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndDocument.java
@@ -0,0 +1,29 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * A marker interface for the end of a document
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+public interface EndDocument extends XMLEvent {
+ /**
+ * No methods are defined in this interface.
+ */
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndElement.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndElement.java
new file mode 100755
index 0000000..c8e7cae
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndElement.java
@@ -0,0 +1,31 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * A marker interface for the end element event.
+ * The name is available in the getName method of
+ * org.apache.xmlbeans.xml.stream.XMLEvent interface.
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+public interface EndElement extends XMLEvent {
+ /**
+ * No methods are defined in this interface.
+ */
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndPrefixMapping.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndPrefixMapping.java
new file mode 100755
index 0000000..0d4ec67
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EndPrefixMapping.java
@@ -0,0 +1,33 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * This event signals that a prefix mapping has gone out of scope
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.StartPrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.ChangePrefixMapping
+ */
+
+public interface EndPrefixMapping extends XMLEvent {
+ /*
+ * Returns the prefix that has gone out of scope
+ * @return String value of the prefix
+ */
+ public String getPrefix();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EntityReference.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EntityReference.java
new file mode 100755
index 0000000..12c0c13
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/EntityReference.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * An interface for handling Entity Declarations
+ *
+ *
+ * @version 1.0
+ */
+
+public interface EntityReference extends XMLEvent {
+ /**
+ * Returns true if this entity was skipped
+ */
+ public boolean skipped();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Location.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Location.java
new file mode 100755
index 0000000..a83cea9
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Location.java
@@ -0,0 +1,54 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * Returns the document location of the event. This is not
+ * required to be exact and is informational only.
+ *
+ *
+ * @version 1.0
+ *
+ */
+public interface Location {
+ /*
+ * returns the current column number
+ *
+ * @return integer value of the current column number
+ */
+ public int getColumnNumber();
+ /*
+ * returns the current line
+ *
+ * @return integer value of the current line number
+ */
+ public int getLineNumber();
+ /*
+ * returns the String value of the public ID
+ *
+ * @return public ID or null if not set
+ */
+ public String getPublicId();
+ /*
+ * returns the String value of the system ID
+ *
+ * @return system ID or null if not set
+ */
+ public String getSystemId();
+}
+
+
+
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ProcessingInstruction.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ProcessingInstruction.java
new file mode 100755
index 0000000..14ba8c9
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ProcessingInstruction.java
@@ -0,0 +1,38 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * A marker interface for processing instructions
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+public interface ProcessingInstruction extends XMLEvent {
+ /*
+ * the target section of the processing instruction
+ *
+ * @return the String value of the PI or null
+ */
+ public String getTarget();
+ /*
+ * the data section of the processing instruction
+ *
+ * @return the String value of the PI's data or null
+ */
+ public String getData();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ReferenceResolver.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ReferenceResolver.java
new file mode 100755
index 0000000..36071f6
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/ReferenceResolver.java
@@ -0,0 +1,37 @@
+/* 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.xmlbeans.xml.stream;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+/**
+ * This interface can be implemented to allow resolution of references
+ * on a stream.
+ */
+public interface ReferenceResolver {
+ /**
+ * Returns the xml pointed to by this idref as an XMLInputStream
+ * @param idref
+ */
+ XMLInputStream resolve(String idref)
+ throws XMLStreamException;
+
+ /**
+ * Returns the id that corresponds to this idref
+ * @param idref
+ */
+ String getId(String idref);
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Space.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Space.java
new file mode 100755
index 0000000..a003129
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/Space.java
@@ -0,0 +1,30 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * This element returns whitespace characters to allow separate
+ * handling by the application
+ *
+ *
+ * @version 1.0
+ */
+public interface Space extends CharacterData {
+ /**
+ * Returns true if this is ignorable whitespace
+ */
+ public boolean ignorable();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartDocument.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartDocument.java
new file mode 100755
index 0000000..0c206c9
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartDocument.java
@@ -0,0 +1,46 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * An interface for the start document event
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+*/
+public interface StartDocument extends XMLEvent {
+ /*
+ * Returns the system id of the stream
+ * @return the system id, defaults to ""
+ */
+ public String getSystemId();
+ /*
+ * Returns the encoding style of this XML stream
+ * @return the character encoding, defaults to "UTF-8"
+ */
+ public String getCharacterEncodingScheme();
+ /*
+ * Returns if this XML is standalone
+ * @return the version of XML, defaults to "yes"
+ */
+ public boolean isStandalone();
+ /*
+ * Returns the version of XML of this XML stream
+ * @return the version of XML, defaults to "1.0"
+ */
+ public String getVersion();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartElement.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartElement.java
new file mode 100755
index 0000000..1e72569
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartElement.java
@@ -0,0 +1,56 @@
+/* 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.xmlbeans.xml.stream;
+
+import java.util.Map;
+/**
+ * The StartElement interface provides access to information about
+ * start elements
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.AttributeIterator
+ */
+
+public interface StartElement extends XMLEvent {
+ /**
+ * Returns an AttributeIterator of non-namespace declared attributes
+ */
+ public AttributeIterator getAttributes();
+ /**
+ * Returns an AttributeIterator of namespaces declared in this element
+ */
+ public AttributeIterator getNamespaces();
+ /**
+ * Returns the union of declared attributes and namespaces
+ */
+ public AttributeIterator getAttributesAndNamespaces();
+ /**
+ * Returns the attribute referred to by this name
+ */
+ public Attribute getAttributeByName(XMLName name);
+ /**
+ * Gets the value that the prefix is bound to in the
+ * context of this element. Returns null if
+ * the prefix is not bound in this context
+ */
+ public String getNamespaceUri(String prefix);
+ /**
+ * Gets a java.util.Map from prefixes to URIs in scope for this
+ * element.
+ */
+ public Map getNamespaceMap();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartPrefixMapping.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartPrefixMapping.java
new file mode 100755
index 0000000..2f36871
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/StartPrefixMapping.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.xmlbeans.xml.stream;
+
+/**
+ * This event signals that a prefix mapping has begun scope
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.EndPrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.ChangePrefixMapping
+ */
+
+public interface StartPrefixMapping extends XMLEvent {
+ /*
+ * Returns the uri of the prefix that is in scope for the following
+ * element
+ * @return String value of the uri
+ */
+ public String getNamespaceUri();
+ /*
+ * Returns the prefix that is now in scope
+ * @return String value of the prefix
+ */
+ public String getPrefix();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLEvent.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLEvent.java
new file mode 100755
index 0000000..5818620
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLEvent.java
@@ -0,0 +1,149 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * This is the base element interface for handling markup events.
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.ProcessingInstruction
+ * @see org.apache.xmlbeans.xml.stream.StartElement
+ * @see org.apache.xmlbeans.xml.stream.EndElement
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ * @see org.apache.xmlbeans.xml.stream.StartDocument
+ */
+
+public interface XMLEvent {
+ /**
+ * A constant which identifies an XMLEvent
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+ public static final int XML_EVENT=0x00000001;
+ /**
+ * A constant which identifies a StartElement
+ * @see org.apache.xmlbeans.xml.stream.StartElement
+ */
+ public static final int START_ELEMENT=0x00000002;
+ /**
+ * A constant which identifies an EndElement
+ * @see org.apache.xmlbeans.xml.stream.EndElement
+ */
+ public static final int END_ELEMENT=0x00000004;
+ /**
+ * A constant which identifies a ProcessingInstruction
+ * @see org.apache.xmlbeans.xml.stream.ProcessingInstruction
+ */
+ public static final int PROCESSING_INSTRUCTION=0x00000008;
+ /**
+ * A constant which identifies a CharacterData Event
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ */
+ public static final int CHARACTER_DATA=0x00000010;
+ /**
+ * A constant which identifies a Comment
+ * @see org.apache.xmlbeans.xml.stream.Comment
+ */
+ public static final int COMMENT=0x00000020;
+ /**
+ * A constant which identifies a Space
+ * @see org.apache.xmlbeans.xml.stream.Space
+ */
+ public static final int SPACE=0x00000040;
+ /**
+ * A constant which identifies a NullElement
+ */
+ public static final int NULL_ELEMENT=0x00000080;
+ /**
+ * A constant which identifies a StartDocument
+ * @see org.apache.xmlbeans.xml.stream.StartDocument
+ */
+ public static final int START_DOCUMENT=0x00000100;
+ /**
+ * A constant which identifies an EndDocument
+ * @see org.apache.xmlbeans.xml.stream.EndDocument
+ */
+ public static final int END_DOCUMENT=0x00000200;
+ /**
+ * A constant which identifies a StartPrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.StartPrefixMapping
+ */
+ public static final int START_PREFIX_MAPPING=0x00000400;
+ /**
+ * A constant which identifies a EndPrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.EndPrefixMapping
+ */
+ public static final int END_PREFIX_MAPPING=0x00000800;
+ /**
+ * A constant which identifies a ChangePrefixMapping
+ * @see org.apache.xmlbeans.xml.stream.ChangePrefixMapping
+ */
+ public static final int CHANGE_PREFIX_MAPPING=0x00001000;
+ /**
+ * A constant which identifies an EntityReference
+ * @see org.apache.xmlbeans.xml.stream.EntityReference
+ */
+ public static final int ENTITY_REFERENCE=0x00002000;
+ /**
+ * Get the event type of the current element,
+ * returns an integer so that switch statements
+ * can be written on the result
+ */
+ public int getType();
+ /**
+ * Get the event type of the current element,
+ * returns an integer so that switch statements
+ * can be written on the result
+ */
+ public XMLName getSchemaType();
+ /**
+ * Get the string value of the type name
+ */
+ public String getTypeAsString();
+ /**
+ * Get the XMLName of the current element
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+ public XMLName getName();
+
+ /**
+ * Check if this Element has a name
+ */
+ public boolean hasName();
+
+ /**
+ * Return the location of this Element
+ */
+ public Location getLocation();
+
+ /**
+ * Method access to the elements type
+ */
+ public boolean isStartElement();
+ public boolean isEndElement();
+ public boolean isEntityReference();
+ public boolean isStartPrefixMapping();
+ public boolean isEndPrefixMapping();
+ public boolean isChangePrefixMapping();
+ public boolean isProcessingInstruction();
+ public boolean isCharacterData();
+ public boolean isSpace();
+ public boolean isNull();
+ public boolean isStartDocument();
+ public boolean isEndDocument();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLInputStream.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLInputStream.java
new file mode 100755
index 0000000..cbc2090
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLInputStream.java
@@ -0,0 +1,141 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ *
+ * This is the top level interface for iterating over XML Events
+ * in an XML document.
+ *
+ * <p> Difference from SAX </p>
+ * <p> An event stream can be thought of encapsulating SAX
+ * events. It applies an iterator/pull metaphor to the parser
+ * allowing procedural, stream-based, handling of input XML rather than
+ * having to write chained event handlers to handle complex XML
+ * documents.
+ * <p> Difference from DOM </p>
+ * <p>The pull metaphor allows single-pass, stream-based parsing of the document rather
+ * than tree based manipulation.</p>
+ *
+ * @since XMLInputStream 1.0
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.ProcessingInstruction
+ * @see org.apache.xmlbeans.xml.stream.StartElement
+ * @see org.apache.xmlbeans.xml.stream.EndElement
+ * @see org.apache.xmlbeans.xml.stream.CharacterData
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+
+// REVIEW pdapkus@bea.com 2002-Sep-13 -- while I like the convenience
+// of many of these methods, it strikes me that many of these methods
+// could implemented as static methods in a utility class. the down
+// side to having them in this base interface is that it makes the
+// contract for implementers unnecessarily steap and results in
+// duplicated code in methods that can't extend one of the common base
+// classes.
+
+public interface XMLInputStream {
+ /**
+ * Get the next XMLEvent on the stream
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+ public XMLEvent next() throws XMLStreamException;
+ /**
+ * Check if there are more events to pull of the stream
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+ public boolean hasNext() throws XMLStreamException;
+ /**
+ * Skip the next stream event
+ */
+ public void skip() throws XMLStreamException;
+ /**
+ * Skips the entire next start tag / end tag pair.
+ */
+ public void skipElement() throws XMLStreamException;
+ /**
+ * Check the next XMLEvent without reading it from the stream.
+ * Returns null if the stream is at EOF or has no more XMLEvents.
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+ public XMLEvent peek() throws XMLStreamException;
+ /**
+ * Position the stream at the next XMLEvent of this type. The method
+ * returns true if the stream contains another XMLEvent of this type
+ * and false otherwise.
+ * @param eventType An integer code that indicates the element type.
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+ public boolean skip(int eventType) throws XMLStreamException;
+ /**
+ * Position the stream at the next element of this name. The method
+ * returns true if the stream contains another element with this name
+ * and false otherwise. Skip is a forward operator only. It does
+ * not look backward in the stream.
+ * @param name An object that defines an XML name.
+ * If the XMLName.getNameSpaceName() method on the XMLName argument returns
+ * null the XMLName will match just the local name. Prefixes are
+ * not checked for equality.
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+ public boolean skip(XMLName name) throws XMLStreamException;
+ /**
+ * Position the stream at the next element of this name and this type.
+ * The method returns true if the stream contains another element
+ * with this name of this type and false otherwise.
+ * @param name An object that defines an XML name.
+ * If the XMLName.getNameSpaceName() method on the XMLName argument returns
+ * null the XMLName will match just the local name. Prefixes are
+ * not checked for equality.
+ * @param eventType An integer code that indicates the element type.
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ * @see org.apache.xmlbeans.xml.stream.XMLName
+ */
+ public boolean skip(XMLName name, int eventType) throws XMLStreamException;
+ /**
+ * getSubStream() returns a stream which points to the entire next element in the
+ * current stream. For example: take a document that has a root node A, where the children
+ * of A are B, C, and D. If the stream is pointing to the start element of A, getSubStream() will return
+ * A, B, C and D including the start element of A and the end element of A. The position of the parent
+ * stream is not changed and the events read by the substream are written back to its parent.
+ */
+ public XMLInputStream getSubStream() throws XMLStreamException;
+ /**
+ * Closes this input stream and releases any system resources associated with the stream.
+ */
+ public void close() throws XMLStreamException;
+
+ /**
+ * Returns the reference resolver that was set for this stream,
+ * returns null if no ReferenceResolver has been set.
+ * @see org.apache.xmlbeans.xml.stream.ReferenceResolver
+ */
+ public ReferenceResolver getReferenceResolver();
+ /**
+ * Provides a way to set the ReferenceResolver of the stream,
+ * this is mostly needed for handle references to other parts of the
+ * document.
+ * @see org.apache.xmlbeans.xml.stream.ReferenceResolver
+ */
+ public void setReferenceResolver(ReferenceResolver resolver);
+}
+
+
+
+
+
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLName.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLName.java
new file mode 100755
index 0000000..7c2c7d9
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLName.java
@@ -0,0 +1,57 @@
+/* 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.xmlbeans.xml.stream;
+
+/**
+ * Encapsulates information about the Qualified Name of an XML event.
+ *
+ *
+ * @version 1.0
+ * @see org.apache.xmlbeans.xml.stream.StartElement
+ * @see org.apache.xmlbeans.xml.stream.XMLEvent
+ */
+
+public interface XMLName {
+ /*
+ * returns the uri of the prefix of this name
+ *
+ * @return returns the uri,
+ * empty string if the default namespace is bound to empty string
+ * or null if the name does not have a namespace
+ */
+ public String getNamespaceUri();
+ /*
+ * returns the localname of the xml name
+ *
+ * @return the localname, cannot be null
+ */
+ public String getLocalName();
+ /*
+ * returns the prefix of the xml name
+ *
+ * @return the prefix of the xml name or null
+ */
+ public String getPrefix();
+
+ /*
+ * returns the prefix of the xml name + ':' + the local name
+ * if the prefix is not null
+ * returns the local name otherwise
+ *
+ * @return the prefix plus the local name
+ */
+ public String getQualifiedName();
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLStreamException.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLStreamException.java
new file mode 100755
index 0000000..bc7151d
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/XMLStreamException.java
@@ -0,0 +1,141 @@
+/* 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.xmlbeans.xml.stream;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+import org.apache.xmlbeans.xml.stream.utils.NestedThrowable;
+
+/**
+ * The base exception for unexpected input during XML handling
+ *
+ *
+ * @version 1.0
+ */
+
+public class XMLStreamException
+ extends IOException
+ implements NestedThrowable
+{
+ protected Throwable th;
+
+ public XMLStreamException() {}
+
+ public XMLStreamException(String msg) {
+ super(msg);
+ }
+
+ public XMLStreamException(Throwable th) {
+ this.th = th;
+
+ }
+
+ public XMLStreamException(String msg, Throwable th) {
+ super(msg);
+ this.th = th;
+ }
+
+ /**
+ * Gets the nested exception.
+ *
+ * @return Nested exception
+ */
+ public Throwable getNestedException() {
+ return getNested();
+ }
+
+ //try to do someting useful
+ public String getMessage() {
+ String msg = super.getMessage();
+
+ if (msg == null && th != null) {
+ return th.getMessage();
+ } else {
+ return msg;
+ }
+ }
+
+
+ // =================================================================
+ // NestedThrowable implementation.
+
+ /**
+ * Gets the nested Throwable.
+ *
+ * @return Nested exception
+ */
+ public Throwable getNested() {
+ return th;
+ }
+
+ public String superToString() {
+ return super.toString();
+ }
+
+ public void superPrintStackTrace(PrintStream ps) {
+ super.printStackTrace(ps);
+ }
+
+ public void superPrintStackTrace(PrintWriter pw) {
+ super.printStackTrace(pw);
+ }
+
+ // End NestedThrowable implementation.
+ // =================================================================
+
+ /**
+ * Prints the exception message and its nested exception message.
+ *
+ * @return String representation of the exception
+ */
+ public String toString() {
+ return NestedThrowable.Util.toString(this);
+ }
+
+ /**
+ * Prints the stack trace associated with this exception and
+ * its nested exception.
+ *
+ * @param s PrintStream
+ */
+ public void printStackTrace(PrintStream s) {
+ NestedThrowable.Util.printStackTrace(this, s);
+ }
+
+ /**
+ * Prints the stack trace associated with this exception and
+ * its nested exception.
+ *
+ * @param s PrintStream
+ */
+ public void printStackTrace(PrintWriter w) {
+ NestedThrowable.Util.printStackTrace(this, w);
+ }
+
+ /**
+ * Prints the stack trace associated with this exception and
+ * its nested exception to System.err.
+ *
+ * @param s PrintStream
+ */
+ public void printStackTrace() {
+ printStackTrace(System.err);
+ }
+}
+
+
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/events/ElementTypeNames.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/events/ElementTypeNames.java
new file mode 100755
index 0000000..a465537
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/events/ElementTypeNames.java
@@ -0,0 +1,71 @@
+/* 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.xmlbeans.xml.stream.events;
+
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+
+public class ElementTypeNames {
+ public static String getName(int val) {
+ switch(val) {
+ case XMLEvent.XML_EVENT: return ("XML_EVENT");
+ case XMLEvent.START_ELEMENT: return ("START_ELEMENT");
+ case XMLEvent.END_ELEMENT: return ("END_ELEMENT");
+ case XMLEvent.PROCESSING_INSTRUCTION: return ("PROCESSING_INSTRUCTION");
+ case XMLEvent.CHARACTER_DATA: return ("CHARACTER_DATA");
+ case XMLEvent.COMMENT: return ("COMMENT");
+ case XMLEvent.SPACE: return ("SPACE");
+ case XMLEvent.NULL_ELEMENT: return ("NULL_ELEMENT");
+ case XMLEvent.START_DOCUMENT: return ("START_DOCUMENT");
+ case XMLEvent.END_DOCUMENT: return ("END_DOCUMENT");
+ case XMLEvent.START_PREFIX_MAPPING: return ("START_PREFIX_MAPPING");
+ case XMLEvent.CHANGE_PREFIX_MAPPING: return ("CHANGE_PREFIX_MAPPING");
+ case XMLEvent.END_PREFIX_MAPPING: return ("END_PREFIX_MAPPING");
+ case XMLEvent.ENTITY_REFERENCE: return ("ENTITY_REFERENCE");
+ default: return "";
+ }
+ }
+ public static int getType(String val) {
+ if (val.equals("XML_EVENT"))
+ return XMLEvent.XML_EVENT;
+ if (val.equals ("START_ELEMENT")) return
+ XMLEvent.START_ELEMENT;
+ if (val.equals ("END_ELEMENT")) return XMLEvent.END_ELEMENT;
+ if (val.equals ("PROCESSING_INSTRUCTION"))
+ return XMLEvent.PROCESSING_INSTRUCTION;
+ if (val.equals ("CHARACTER_DATA"))
+ return XMLEvent.CHARACTER_DATA;
+ if (val.equals ("COMMENT"))
+ return XMLEvent.COMMENT;
+ if (val.equals ("SPACE"))
+ return XMLEvent.SPACE;
+ if (val.equals ("NULL_ELEMENT"))
+ return XMLEvent.NULL_ELEMENT;
+ if (val.equals ("START_DOCUMENT"))
+ return XMLEvent.START_DOCUMENT;
+ if (val.equals ("END_DOCUMENT"))
+ return XMLEvent.END_DOCUMENT;
+ if (val.equals ("START_PREFIX_MAPPING"))
+ return XMLEvent.START_PREFIX_MAPPING;
+ if (val.equals ("CHANGE_PREFIX_MAPPING"))
+ return XMLEvent.CHANGE_PREFIX_MAPPING;
+ if (val.equals ("ENTITY_REFERENCE"))
+ return XMLEvent.ENTITY_REFERENCE;
+ if (val.equals ("END_PREFIX_MAPPING"))
+ return XMLEvent.END_PREFIX_MAPPING;
+
+ return XMLEvent.NULL_ELEMENT;
+ }
+}
diff --git a/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/utils/NestedThrowable.java b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/utils/NestedThrowable.java
new file mode 100755
index 0000000..3e8dbe3
--- /dev/null
+++ b/v1/src/xmlinputstream/org/apache/xmlbeans/xml/stream/utils/NestedThrowable.java
@@ -0,0 +1,104 @@
+/* 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.xmlbeans.xml.stream.utils;
+
+/**
+ * The interface implemented by NestedException, NestedError, and
+ * NestedRuntimeException largely so Util can provide a standard
+ * implementation of toString() and printStackTrace()
+ *
+ * @deprecated use JDK 1.4 style nested throwables where possible.
+ */
+
+import java.io.PrintWriter;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+
+public interface NestedThrowable {
+
+ /** Get the nested Throwable. */
+ Throwable getNested();
+
+ /** Call super.toString(). [Kludge but necessary.] */
+ String superToString();
+
+ /** Call super.printStackTrace(). [Kludge but necessary.] */
+ void superPrintStackTrace(PrintStream ps);
+
+ /** Call super.printStackTrace(). [Kludge but necessary.] */
+ void superPrintStackTrace(PrintWriter po);
+
+ static class Util {
+
+ private static String EOL = System.getProperty("line.separator");
+
+ /**
+ * Prints the exception message and its nested exception message.
+ *
+ * @return String representation of the exception
+ */
+ public static String toString(NestedThrowable nt) {
+ Throwable nested = nt.getNested();
+ if (nested == null) {
+ return nt.superToString();
+ } else {
+ return nt.superToString() + " - with nested exception:" +
+ EOL + "[" + nestedToString(nested) + "]";
+ }
+ }
+
+ private static String nestedToString(Throwable nested) {
+ if (nested instanceof InvocationTargetException) {
+ InvocationTargetException ite = (InvocationTargetException) nested;
+ return nested.toString() + " - with target exception:" +
+ EOL + "[" + ite.getTargetException().toString() +
+ "]";
+ }
+ return nested.toString();
+ }
+
+ /**
+ * Prints the stack trace associated with this exception and
+ * its nested exception.
+ *
+ * @param s PrintStream
+ */
+ public static void printStackTrace(NestedThrowable nt, PrintStream s) {
+ Throwable nested = nt.getNested();
+ if (nested != null) {
+ nested.printStackTrace(s);
+ s.println("--------------- nested within: ------------------");
+ }
+ nt.superPrintStackTrace(s);
+ }
+
+ /**
+ * Prints the stack trace associated with this exception and
+ * its nested exception.
+ *
+ * @param w PrintWriter
+ */
+ public static void printStackTrace(NestedThrowable nt, PrintWriter w) {
+ Throwable nested = nt.getNested();
+ if (nested != null) {
+ nested.printStackTrace(w);
+ w.println("--------------- nested within: ------------------");
+ }
+ nt.superPrintStackTrace(w);
+ }
+ }
+
+}
diff --git a/v1/src/xmlpublic/javax/xml/namespace/QName.java b/v1/src/xmlpublic/javax/xml/namespace/QName.java
new file mode 100644
index 0000000..cfde9f9
--- /dev/null
+++ b/v1/src/xmlpublic/javax/xml/namespace/QName.java
@@ -0,0 +1,229 @@
+/* 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 javax.xml.namespace;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * <code>QName</code> class represents the value of a qualified name
+ * as specified in <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML
+ * Schema Part2: Datatypes specification</a>.
+ * <p>
+ * The value of a QName contains a <b>namespaceURI</b>, a <b>localPart</b> and a <b>prefix</b>.
+ * The localPart provides the local part of the qualified name. The
+ * namespaceURI is a URI reference identifying the namespace.
+ *
+ * @version 1.1
+ */
+public class QName implements Serializable {
+
+ /** comment/shared empty string */
+ private static final String emptyString = "".intern();
+
+ /** Field namespaceURI */
+ private String namespaceURI;
+
+ /** Field localPart */
+ private String localPart;
+
+ /** Field prefix */
+ private String prefix;
+
+ /**
+ * Constructor for the QName.
+ *
+ * @param localPart Local part of the QName
+ */
+ public QName(String localPart) {
+ this(emptyString, localPart, emptyString);
+ }
+
+ /**
+ * Constructor for the QName.
+ *
+ * @param namespaceURI Namespace URI for the QName
+ * @param localPart Local part of the QName.
+ */
+ public QName(String namespaceURI, String localPart) {
+ this(namespaceURI, localPart, emptyString);
+ }
+
+ /**
+ * Constructor for the QName.
+ *
+ * @param namespaceURI Namespace URI for the QName
+ * @param localPart Local part of the QName.
+ * @param prefix Prefix of the QName.
+ */
+ public QName(String namespaceURI, String localPart, String prefix) {
+ this.namespaceURI = (namespaceURI == null)
+ ? emptyString
+ : namespaceURI.intern();
+ if (localPart == null) {
+ throw new IllegalArgumentException("invalid QName local part");
+ } else {
+ this.localPart = localPart.intern();
+ }
+
+ if (prefix == null) {
+ throw new IllegalArgumentException("invalid QName prefix");
+ } else {
+ this.prefix = prefix.intern();
+ }
+ }
+
+ /**
+ * Gets the Namespace URI for this QName
+ *
+ * @return Namespace URI
+ */
+ public String getNamespaceURI() {
+ return namespaceURI;
+ }
+
+ /**
+ * Gets the Local part for this QName
+ *
+ * @return Local part
+ */
+ public String getLocalPart() {
+ return localPart;
+ }
+
+ /**
+ * Gets the Prefix for this QName
+ *
+ * @return Prefix
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * Returns a string representation of this QName
+ *
+ * @return a string representation of the QName
+ */
+ public String toString() {
+
+ return ((namespaceURI == emptyString)
+ ? localPart
+ : '{' + namespaceURI + '}' + localPart);
+ }
+
+ /**
+ * Tests this QName for equality with another object.
+ * <p>
+ * If the given object is not a QName or is null then this method
+ * returns <tt>false</tt>.
+ * <p>
+ * For two QNames to be considered equal requires that both
+ * localPart and namespaceURI must be equal. This method uses
+ * <code>String.equals</code> to check equality of localPart
+ * and namespaceURI. Any class that extends QName is required
+ * to satisfy this equality contract.
+ * <p>
+ * This method satisfies the general contract of the <code>Object.equals</code> method.
+ *
+ * @param obj the reference object with which to compare
+ *
+ * @return <code>true</code> if the given object is identical to this
+ * QName: <code>false</code> otherwise.
+ */
+ public final boolean equals(Object obj) {
+
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof QName)) {
+ return false;
+ }
+
+ if ((namespaceURI == ((QName) obj).namespaceURI)
+ && (localPart == ((QName) obj).localPart)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns a QName holding the value of the specified String.
+ * <p>
+ * The string must be in the form returned by the QName.toString()
+ * method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}"
+ * part being optional.
+ * <p>
+ * This method doesn't do a full validation of the resulting QName.
+ * In particular, it doesn't check that the resulting namespace URI
+ * is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting
+ * local part is a legal NCName per the XML Namespaces specification.
+ *
+ * @param s the string to be parsed
+ * @throws java.lang.IllegalArgumentException If the specified String cannot be parsed as a QName
+ * @return QName corresponding to the given String
+ */
+ public static QName valueOf(String s) {
+
+ if ((s == null) || s.equals("")) {
+ throw new IllegalArgumentException("invalid QName literal");
+ }
+
+ if (s.charAt(0) == '{') {
+ int i = s.indexOf('}');
+
+ if (i == -1) {
+ throw new IllegalArgumentException("invalid QName literal");
+ }
+
+ if (i == s.length() - 1) {
+ throw new IllegalArgumentException("invalid QName literal");
+ } else {
+ return new QName(s.substring(1, i), s.substring(i + 1));
+ }
+ } else {
+ return new QName(s);
+ }
+ }
+
+ /**
+ * Returns a hash code value for this QName object. The hash code
+ * is based on both the localPart and namespaceURI parts of the
+ * QName. This method satisfies the general contract of the
+ * <code>Object.hashCode</code> method.
+ *
+ * @return a hash code value for this Qname object
+ */
+ public final int hashCode() {
+ return namespaceURI.hashCode() ^ localPart.hashCode();
+ }
+
+ /**
+ * Ensure that deserialization properly interns the results.
+ * @param in the ObjectInputStream to be read
+ */
+ private void readObject(ObjectInputStream in) throws
+ IOException, ClassNotFoundException {
+ in.defaultReadObject();
+
+ namespaceURI = namespaceURI.intern();
+ localPart = localPart.intern();
+ prefix = prefix.intern();
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/DelegateXmlObject.java b/v1/src/xmlpublic/org/apache/xmlbeans/DelegateXmlObject.java
new file mode 100644
index 0000000..78d0b5a
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/DelegateXmlObject.java
@@ -0,0 +1,13 @@
+package org.apache.xmlbeans;
+
+/**
+ * See {@link FilterXmlObject}
+ */
+public interface DelegateXmlObject
+{
+ /**
+ * This method is called to obtain the underlying XmlObject.
+ * Implement this method to supply or compute the wrapped object.
+ */
+ XmlObject underlyingXmlObject();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/FilterXmlObject.java b/v1/src/xmlpublic/org/apache/xmlbeans/FilterXmlObject.java
new file mode 100644
index 0000000..657d82f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/FilterXmlObject.java
@@ -0,0 +1,644 @@
+/* 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.xmlbeans;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.math.BigInteger;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A FilterXmlObject delegates to some other XmlObject, which it can use as
+ * its basic source of data, possibly transforming the data along the way or
+ * providing additional functionality. The class FilterXmlObject itself
+ * simply overrides all methods of XmlObject with versions that pass all
+ * requests to the underlying XmlObject. Subclasses of FilterXmlObject may
+ * further override some of these methods and may also provide additional
+ * methods and fields.
+ * <p>
+ * Note: it is important that FilterXmlObject has no storage (i.e., no
+ * non-transient fields), because subclasses may be serializable and
+ * adding storage would break the serialization format.
+ */
+public abstract class FilterXmlObject implements XmlObject, SimpleValue, DelegateXmlObject
+{
+ public SchemaType schemaType()
+ {
+ return underlyingXmlObject().schemaType();
+ }
+
+ public boolean validate()
+ {
+ return underlyingXmlObject().validate();
+ }
+
+ public boolean validate(XmlOptions options)
+ {
+ return underlyingXmlObject().validate(options);
+ }
+
+ public XmlObject[] selectPath(String path)
+ {
+ return underlyingXmlObject().selectPath(path);
+ }
+
+ public XmlObject[] selectPath(String path, XmlOptions options)
+ {
+ return underlyingXmlObject().selectPath(path, options);
+ }
+
+ public XmlObject[] execQuery(String query)
+ {
+ return underlyingXmlObject().execQuery(query);
+ }
+
+ public XmlObject[] execQuery(String query, XmlOptions options)
+ {
+ return underlyingXmlObject().execQuery(query, options);
+ }
+
+ public XmlObject changeType(SchemaType newType)
+ {
+ return underlyingXmlObject().changeType(newType);
+ }
+
+ public boolean isNil()
+ {
+ return underlyingXmlObject().isNil();
+ }
+
+ public void setNil()
+ {
+ underlyingXmlObject().setNil();
+ }
+
+ public boolean isImmutable()
+ {
+ return underlyingXmlObject().isImmutable();
+ }
+
+ public XmlObject set(XmlObject srcObj)
+ {
+ return underlyingXmlObject().set(srcObj);
+ }
+
+ public XmlObject copy()
+ {
+ return underlyingXmlObject().copy();
+ }
+
+ public boolean valueEquals(XmlObject obj)
+ {
+ return underlyingXmlObject().valueEquals(obj);
+ }
+
+ public int valueHashCode()
+ {
+ return underlyingXmlObject().valueHashCode();
+ }
+
+ public int compareTo(Object obj)
+ {
+ return underlyingXmlObject().compareTo(obj);
+ }
+
+ public int compareValue(XmlObject obj)
+ {
+ return underlyingXmlObject().compareValue(obj);
+ }
+
+ public Object monitor()
+ {
+ return underlyingXmlObject().monitor();
+ }
+
+ public XmlDocumentProperties documentProperties()
+ {
+ return underlyingXmlObject().documentProperties();
+ }
+
+ public XmlCursor newCursor()
+ {
+ return underlyingXmlObject().newCursor();
+ }
+
+ /**
+ * @deprecated Superceded by JSR 173
+ */
+ public XMLInputStream newXMLInputStream()
+ {
+ return underlyingXmlObject().newXMLInputStream();
+ }
+
+ public String xmlText()
+ {
+ return underlyingXmlObject().xmlText();
+ }
+
+ public InputStream newInputStream()
+ {
+ return underlyingXmlObject().newInputStream();
+ }
+
+ public Reader newReader()
+ {
+ return underlyingXmlObject().newReader();
+ }
+
+ public Node newDomNode()
+ {
+ return underlyingXmlObject().newDomNode();
+ }
+
+ public void save(ContentHandler ch, LexicalHandler lh) throws SAXException
+ {
+ underlyingXmlObject().save(ch, lh);
+ }
+
+ public void save(File file) throws IOException
+ {
+ underlyingXmlObject().save(file);
+ }
+
+ public void save(OutputStream os) throws IOException
+ {
+ underlyingXmlObject().save(os);
+ }
+
+ public void save(Writer w) throws IOException
+ {
+ underlyingXmlObject().save(w);
+ }
+
+ /**
+ * @deprecated Superceded by JSR 173
+ */
+ public XMLInputStream newXMLInputStream(XmlOptions options)
+ {
+ return underlyingXmlObject().newXMLInputStream(options);
+ }
+
+ public String xmlText(XmlOptions options)
+ {
+ return underlyingXmlObject().xmlText(options);
+ }
+
+ public InputStream newInputStream(XmlOptions options)
+ {
+ return underlyingXmlObject().newInputStream(options);
+ }
+
+ public Reader newReader(XmlOptions options)
+ {
+ return underlyingXmlObject().newReader(options);
+ }
+
+ public Node newDomNode(XmlOptions options)
+ {
+ return underlyingXmlObject().newDomNode(options);
+ }
+
+ public void save(ContentHandler ch, LexicalHandler lh, XmlOptions options) throws SAXException
+ {
+ underlyingXmlObject().save(ch, lh, options);
+ }
+
+ public void save(File file, XmlOptions options) throws IOException
+ {
+ underlyingXmlObject().save(file, options);
+ }
+
+ public void save(OutputStream os, XmlOptions options) throws IOException
+ {
+ underlyingXmlObject().save(os, options);
+ }
+
+ public void save(Writer w, XmlOptions options) throws IOException
+ {
+ underlyingXmlObject().save(w, options);
+ }
+
+ public SchemaType instanceType()
+ {
+ return ((SimpleValue)underlyingXmlObject()).instanceType();
+ }
+
+ public String stringValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).stringValue();
+ }
+
+ public boolean booleanValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).booleanValue();
+ }
+
+ public byte byteValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).byteValue();
+ }
+
+ public short shortValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).shortValue();
+ }
+
+ public int intValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).intValue();
+ }
+
+ public long longValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).longValue();
+ }
+
+ public BigInteger bigIntegerValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).bigIntegerValue();
+ }
+
+ public BigDecimal bigDecimalValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).bigDecimalValue();
+ }
+
+ public float floatValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).floatValue();
+ }
+
+ public double doubleValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).doubleValue();
+ }
+
+ public byte[] byteArrayValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).byteArrayValue();
+ }
+
+ public StringEnumAbstractBase enumValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).enumValue();
+ }
+
+ public Calendar calendarValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).calendarValue();
+ }
+
+ public Date dateValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).dateValue();
+ }
+
+ public GDate gDateValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).gDateValue();
+ }
+
+ public GDuration gDurationValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).gDurationValue();
+ }
+
+ public QName qNameValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).qNameValue();
+ }
+
+ public List listValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).listValue();
+ }
+
+ public List xlistValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).xlistValue();
+ }
+
+ public Object objectValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).objectValue();
+ }
+
+ public void set(String obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(boolean v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(byte v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(short v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(int v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(long v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(BigInteger obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(BigDecimal obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(float v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(double v)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(v);
+ }
+
+ public void set(byte[] obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(StringEnumAbstractBase obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(Calendar obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(Date obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(GDateSpecification obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(GDurationSpecification obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(QName obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public void set(List obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).set(obj);
+ }
+
+ public String getStringValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getStringValue();
+ }
+
+ public boolean getBooleanValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getBooleanValue();
+ }
+
+ public byte getByteValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getByteValue();
+ }
+
+ public short getShortValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getShortValue();
+ }
+
+ public int getIntValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getIntValue();
+ }
+
+ public long getLongValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getLongValue();
+ }
+
+ public BigInteger getBigIntegerValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getBigIntegerValue();
+ }
+
+ public BigDecimal getBigDecimalValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getBigDecimalValue();
+ }
+
+ public float getFloatValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getFloatValue();
+ }
+
+ public double getDoubleValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getDoubleValue();
+ }
+
+ public byte[] getByteArrayValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getByteArrayValue();
+ }
+
+ public StringEnumAbstractBase getEnumValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getEnumValue();
+ }
+
+ public Calendar getCalendarValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getCalendarValue();
+ }
+
+ public Date getDateValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getDateValue();
+ }
+
+ public GDate getGDateValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getGDateValue();
+ }
+
+ public GDuration getGDurationValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getGDurationValue();
+ }
+
+ public QName getQNameValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getQNameValue();
+ }
+
+ public List getListValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getListValue();
+ }
+
+ public List xgetListValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).xgetListValue();
+ }
+
+ public Object getObjectValue()
+ {
+ return ((SimpleValue)underlyingXmlObject()).getObjectValue();
+ }
+
+ public void setStringValue(String obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setStringValue(obj);
+ }
+
+ public void setBooleanValue(boolean v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setBooleanValue(v);
+ }
+
+ public void setByteValue(byte v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setByteValue(v);
+ }
+
+ public void setShortValue(short v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setShortValue(v);
+ }
+
+ public void setIntValue(int v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setIntValue(v);
+ }
+
+ public void setLongValue(long v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setLongValue(v);
+ }
+
+ public void setBigIntegerValue(BigInteger obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setBigIntegerValue(obj);
+ }
+
+ public void setBigDecimalValue(BigDecimal obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setBigDecimalValue(obj);
+ }
+
+ public void setFloatValue(float v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setFloatValue(v);
+ }
+
+ public void setDoubleValue(double v)
+ {
+ ((SimpleValue)underlyingXmlObject()).setDoubleValue(v);
+ }
+
+ public void setByteArrayValue(byte[] obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setByteArrayValue(obj);
+ }
+
+ public void setEnumValue(StringEnumAbstractBase obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setEnumValue(obj);
+ }
+
+ public void setCalendarValue(Calendar obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setCalendarValue(obj);
+ }
+
+ public void setDateValue(Date obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setDateValue(obj);
+ }
+
+ public void setGDateValue(GDate obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setGDateValue(obj);
+ }
+
+ public void setGDurationValue(GDuration obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setGDurationValue(obj);
+ }
+
+ public void setQNameValue(QName obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setQNameValue(obj);
+ }
+
+ public void setListValue(List obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setListValue(obj);
+ }
+
+ public void setObjectValue(Object obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).setObjectValue(obj);
+ }
+
+ public void objectSet(Object obj)
+ {
+ ((SimpleValue)underlyingXmlObject()).objectSet(obj);
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDate.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDate.java
new file mode 100644
index 0000000..57f9620
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDate.java
@@ -0,0 +1,1063 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+/**
+ * Represents an XML Schema-compatible Gregorian date.
+ * <p>
+ * There are many date types in XML Schema, and this type
+ * represents the natural union of all those types. A GDate
+ * can hold any subset of date fields (Year, Month, Day, Time,
+ * Timezone, or some combination). Wherever the specification
+ * provides guidance, the guidelines in the
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/">XML Schema 1.0 specification</a>
+ * (plus <a target="_blank" href="http://www.w3.org/2001/05/xmlschema-errata">published errata</a>) are followed.
+ * <p>
+ * Instances may separately have values or no values for
+ * the year, month, day-of-month, and time-of-day. Not all
+ * operations are meaningful on all combinations.
+ */
+public final class GDate implements GDateSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ // for fast equality comparison, hashing, and serialization
+ private transient String _canonicalString;
+ private transient String _string;
+
+ private int _bits;
+ private int _CY;
+ private int _M;
+ private int _D;
+ private int _h;
+ private int _m;
+ private int _s;
+ private BigDecimal _fs;
+ private int _tzsign;
+ private int _tzh;
+ private int _tzm;
+
+
+ /* package */ static final BigDecimal _zero = BigDecimal.valueOf(0);
+ /* package */ static final BigDecimal _one = BigDecimal.valueOf(1);
+
+ /**
+ * Constructs a GDate based on a lexical representation.
+ */
+ public GDate(CharSequence string)
+ {
+ // first trim XML whitespace
+ int len = string.length();
+ int start = 0;
+ while (len > 0 && isSpace(string.charAt(len - 1)))
+ len -= 1;
+ while (start < len && isSpace(string.charAt(start)))
+ start += 1;
+
+ // pick optional timezone off the end
+ if (len - start >= 1 && string.charAt(len - 1) == 'Z')
+ {
+ _bits |= HAS_TIMEZONE;
+ len -= 1;
+ }
+ else if (len - start >= 6)
+ timezone: {
+ int tzsign;
+ int tzhour;
+ int tzminute;
+
+ if (string.charAt(len - 3) != ':')
+ break timezone;
+
+ switch (string.charAt(len - 6))
+ {
+ case '-':
+ tzsign = -1; break;
+ case '+':
+ tzsign = 1; break;
+ default:
+ break timezone;
+ }
+
+ tzhour = twoDigit(string, len - 5);
+ tzminute = twoDigit(string, len - 2);
+ if (tzhour > 14)
+ throw new IllegalArgumentException("time zone hour must be two digits between -14 and +14");
+ if (tzminute > 59)
+ throw new IllegalArgumentException("time zone minute must be two digits between 00 and 59");
+ _bits |= HAS_TIMEZONE;
+ _tzsign = tzsign;
+ _tzh = tzhour;
+ _tzm = tzminute;
+ len -= 6;
+ }
+
+ // pick date fields off the beginning if it doesn't look like a time
+ if (start < len && (start + 2 >= len || string.charAt(start + 2) != ':'))
+ scandate:
+ {
+ // parse year sign
+ boolean negyear = false;
+ if (start < len && string.charAt(start) == '-')
+ {
+ negyear = true;
+ start += 1;
+ }
+
+ // scan year digits
+ int value = 0;
+ int digits = -start;
+ char ch;
+ for (;;)
+ {
+ ch = start < len ? string.charAt(start) : '\0';
+ if (!isDigit(ch))
+ break;
+ value = value * 10 + digitVal(ch);
+ start += 1;
+ }
+ digits += start;
+ if (digits > 6)
+ throw new IllegalArgumentException("year too long (up to 6 digits)");
+ else if (digits >= 4)
+ {
+ _bits |= HAS_YEAR;
+ _CY = negyear ? -value : value;
+ }
+ else if (digits > 0)
+ throw new IllegalArgumentException("year must be four digits (may pad with zeroes, e.g., 0560)");
+
+ // hyphen introduces a month
+ if (ch != '-')
+ {
+ if (negyear && !hasYear())
+ throw new IllegalArgumentException(); // a single minus
+ else
+ break scandate;
+ }
+ start += 1;
+
+ // two-digit month
+ if (len - start >= 2)
+ {
+ value = twoDigit(string, start);
+ if (value >= 1 && value <= 12)
+ {
+ _bits |= HAS_MONTH;
+ _M = value;
+ start += 2;
+ }
+ }
+
+ // hyphen introduces a day
+ ch = start < len ? string.charAt(start) : '\0';
+ if (ch != '-')
+ {
+ if (!hasMonth())
+ throw new IllegalArgumentException(); // minus after a year
+ else
+ break scandate;
+ }
+ start += 1;
+
+ // two-digit day
+ if (len - start >= 2)
+ {
+ value = twoDigit(string, start);
+ if (value >= 1 && value <= 31)
+ {
+ _bits |= HAS_DAY;
+ _D = value;
+ start += 2;
+ }
+ }
+
+ if (!hasDay())
+ {
+ // error in the original schema spec permits an extra '-' here
+ if (hasMonth() && !hasYear())
+ {
+ ch = start < len ? string.charAt(start) : '\0';
+ if (ch == '-')
+ {
+ start += 1;
+ break scandate;
+ }
+ }
+ throw new IllegalArgumentException(); // minus after a month
+ }
+ }
+
+ // time
+ if (start < len)
+ {
+ if (hasYear() || hasMonth() || hasDay())
+ {
+ if (string.charAt(start) != 'T')
+ throw new IllegalArgumentException("date and time must be separated by 'T'");
+ start += 1;
+ }
+
+ if (len < start + 8 || string.charAt(start + 2) != ':' || string.charAt(start + 5) != ':')
+ throw new IllegalArgumentException();
+
+ int h = twoDigit(string, start);
+ if (h >= 24)
+ throw new IllegalArgumentException("hour must be between 00 and 23");
+ int m = twoDigit(string, start + 3);
+ if (m >= 60)
+ throw new IllegalArgumentException("minute must be between 00 and 59");
+ int s = twoDigit(string, start + 6);
+ if (s >= 60)
+ throw new IllegalArgumentException("second must be between 00 and 59");
+
+ start += 8;
+
+ BigDecimal fs = _zero;
+ if (start < len)
+ {
+ if (string.charAt(start) != '.')
+ throw new IllegalArgumentException();
+ if (start + 1 < len)
+ {
+ for (int i = start + 1; i < len; i++)
+ {
+ if (!isDigit(string.charAt(i)))
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ fs = new BigDecimal(string.subSequence(start, len).toString());
+ }
+ catch (Throwable e)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ _bits |= HAS_TIME;
+ _h = h;
+ _m = m;
+ _s = s;
+ _fs = fs;
+ }
+
+ if (!isValid())
+ throw new IllegalArgumentException("invalid date");
+ }
+
+ /**
+ * Constructs a GDate with the specified year, month, day,
+ * hours, minutes, seconds, and optional fractional seconds, in
+ * an unspecified timezone.
+ * <p>
+ * Note that by not specifying the timezone the GDate
+ * becomes partially unordered with respect to times that
+ * do have a specified timezone.
+ */
+ public GDate(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction)
+ {
+ _bits = HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME;
+
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? _zero : fraction;
+
+ if (!isValid())
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Constructs an absolute GDate with the specified year,
+ * month, day, hours, minutes, seconds, and optional fractional
+ * seconds, and in the timezone specified.
+ * <p>
+ * If you wish to have a time or date that isn't in a specified timezone,
+ * then use the constructor that does not include the timezone arguments.
+ */
+ public GDate(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction,
+ int tzSign,
+ int tzHour,
+ int tzMinute)
+ {
+ _bits = HAS_TIMEZONE | HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME;
+
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? _zero : fraction;
+ _tzsign = tzSign;
+ _tzh = tzHour;
+ _tzm = tzMinute;
+
+ if (!isValid())
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Constructs a GDate based on a java.util.Date.
+ * <p>
+ * The current offset of the default timezone is used as the timezone.
+ * <p>
+ * For example, if eastern daylight time is in effect at the given
+ * date, the timezone on the east coast of the united states
+ * translates to GMT-05:00 (EST) + 1:00 (DT offset) == GMT-04:00.
+ */
+ public GDate(Date date)
+ {
+ // requires some date math, so ctor lives on GDateBuilder
+ this(new GDateBuilder(date));
+ }
+
+ /**
+ * Constructs a GDate based on a java.util.Calendar.
+ * <p>
+ * If the calendar does not have some fields set, the same absence
+ * of information is reflected in the GDate. Note that
+ * java.util.GregorianCalendar fills in all fields as soon as any
+ * are fetched, so constructing a GDate with the same calendar object
+ * twice may result in a different GDate because of a changed calendar.
+ * Note that org.apache.xmlbeans.XmlCalendar is stable if you re-get a set field,
+ * so it does not have the same problem.
+ */
+ public GDate(Calendar calendar)
+ {
+ // we must scrape the "isSet" information out before accessing anything
+ boolean isSetYear = calendar.isSet(Calendar.YEAR);
+ boolean isSetEra = calendar.isSet(Calendar.ERA);
+ boolean isSetMonth = calendar.isSet(Calendar.MONTH);
+ boolean isSetDay = calendar.isSet(Calendar.DAY_OF_MONTH);
+ boolean isSetHourOfDay = calendar.isSet(Calendar.HOUR_OF_DAY);
+ boolean isSetHour = calendar.isSet(Calendar.HOUR);
+ boolean isSetAmPm = calendar.isSet(Calendar.AM_PM);
+ boolean isSetMinute = calendar.isSet(Calendar.MINUTE);
+ boolean isSetSecond = calendar.isSet(Calendar.SECOND);
+ boolean isSetMillis = calendar.isSet(Calendar.MILLISECOND);
+ boolean isSetZone = calendar.isSet(Calendar.ZONE_OFFSET);
+ boolean isSetDst = calendar.isSet(Calendar.DST_OFFSET);
+
+ if (isSetYear)
+ {
+ int y = calendar.get(Calendar.YEAR);
+ if (isSetEra && calendar instanceof GregorianCalendar)
+ if (calendar.get(Calendar.ERA) == GregorianCalendar.BC)
+ y = 1 - y;
+ _bits |= HAS_YEAR;
+ _CY = y;
+ }
+ if (isSetMonth)
+ {
+ _bits |= HAS_MONTH;
+ _M = calendar.get(Calendar.MONTH) + 1; // !!note
+ }
+ if (isSetDay)
+ {
+ _bits |= HAS_DAY;
+ _D = calendar.get(Calendar.DAY_OF_MONTH);
+ }
+ boolean gotTime = false;
+
+ int h = 0;
+ int m = 0;
+ int s = 0;
+ BigDecimal fs = _zero;
+
+ if (isSetHourOfDay)
+ {
+ h = calendar.get(Calendar.HOUR_OF_DAY);
+ gotTime = true;
+ }
+ else if (isSetHour && isSetAmPm)
+ {
+ h = calendar.get(Calendar.HOUR) + calendar.get(Calendar.AM_PM) * 12;
+ gotTime = true;
+ }
+
+ if (isSetMinute)
+ {
+ m = calendar.get(Calendar.MINUTE);
+ gotTime = true;
+ }
+
+ if (isSetSecond)
+ {
+ s = calendar.get(Calendar.SECOND);
+ gotTime = true;
+ }
+
+ if (isSetMillis)
+ {
+ fs = BigDecimal.valueOf(calendar.get(Calendar.MILLISECOND), 3);
+ gotTime = true;
+ }
+
+ if (gotTime)
+ {
+ _bits |= HAS_TIME;
+ _h = h;
+ _m = m;
+ _s = s;
+ _fs = fs;
+ }
+
+ if (isSetZone)
+ {
+ int zoneOffsetInMilliseconds = calendar.get(Calendar.ZONE_OFFSET);
+ if (isSetDst)
+ zoneOffsetInMilliseconds += calendar.get(Calendar.DST_OFFSET);
+
+ _bits |= HAS_TIMEZONE;
+ if (zoneOffsetInMilliseconds == 0)
+ {
+ _tzsign = 0;
+ _tzh = 0;
+ _tzm = 0;
+ TimeZone zone = calendar.getTimeZone();
+ String id = zone.getID();
+ if (id != null && id.length() > 3) switch (id.charAt(3))
+ {
+ case '+': _tzsign = 1; break; // GMT+00:00
+ case '-': _tzsign = -1; break; // GMT-00:00
+ }
+ }
+ else
+ {
+ _tzsign = (zoneOffsetInMilliseconds < 0 ? -1 : +1);
+ zoneOffsetInMilliseconds = zoneOffsetInMilliseconds * _tzsign;
+ _tzh = zoneOffsetInMilliseconds / 3600000;
+ _tzm = (zoneOffsetInMilliseconds - _tzh * 3600000) / 60000;
+ }
+ }
+ }
+
+ /**
+ * Constructs a GDate based on another GDateSpecification.
+ */
+ public GDate(GDateSpecification gdate)
+ {
+ if (gdate.hasTimeZone())
+ {
+ _bits |= HAS_TIMEZONE;
+ _tzsign = gdate.getTimeZoneSign();
+ _tzh = gdate.getTimeZoneHour();
+ _tzm = gdate.getTimeZoneMinute();
+ }
+
+ if (gdate.hasTime())
+ {
+ _bits |= HAS_TIME;
+ _h = gdate.getHour();
+ _m = gdate.getMinute();
+ _s = gdate.getSecond();
+ _fs = gdate.getFraction();
+ }
+
+ if (gdate.hasDay())
+ {
+ _bits |= HAS_DAY;
+ _D = gdate.getDay();
+ }
+
+ if (gdate.hasMonth())
+ {
+ _bits |= HAS_MONTH;
+ _M = gdate.getMonth();
+ }
+
+ if (gdate.hasYear())
+ {
+ _bits |= HAS_YEAR;
+ _CY = gdate.getYear();
+ }
+ }
+
+ /* package */ static final boolean isDigit(char ch)
+ {
+ return ((char)(ch - '0') <= '9' - '0'); // char is unsigned
+ }
+
+ /* package */ static final boolean isSpace(char ch)
+ {
+ switch (ch)
+ {
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /* package */ static final int digitVal(char ch)
+ {
+ return (ch - '0');
+ }
+
+ private static final int twoDigit(CharSequence str, int index)
+ {
+ char ch1 = str.charAt(index);
+ char ch2 = str.charAt(index + 1);
+ if (!isDigit(ch1) || !isDigit(ch2))
+ return 100; // not two digits
+ return digitVal(ch1) * 10 + digitVal(ch2);
+ }
+
+ /**
+ * Returns true: all GDate instances are immutable.
+ */
+ public final boolean isImmutable()
+ {
+ return true;
+ }
+
+ /**
+ * Returns a combination of flags indicating the information
+ * contained by this GDate. The five flags are
+ * HAS_TIMEZONE, HAS_YEAR, HAS_MONTH, HAS_DAY, and HAS_TIME.
+ */
+ public int getFlags()
+ {
+ return _bits;
+ }
+
+ /**
+ * True if this date/time specification specifies a timezone.
+ */
+ public final boolean hasTimeZone()
+ { return ((_bits & HAS_TIMEZONE) != 0); }
+
+ /**
+ * True if this date/time specification specifies a year.
+ */
+ public final boolean hasYear()
+ { return ((_bits & HAS_YEAR) != 0); }
+
+ /**
+ * True if this date/time specification specifies a month-of-year.
+ */
+ public final boolean hasMonth()
+ { return ((_bits & HAS_MONTH) != 0); }
+
+ /**
+ * True if this date/time specification specifies a day-of-month.
+ */
+ public final boolean hasDay()
+ { return ((_bits & HAS_DAY) != 0); }
+
+ /**
+ * True if this date/time specification specifies a time-of-day.
+ */
+ public final boolean hasTime()
+ { return ((_bits & HAS_TIME) != 0); }
+
+ /**
+ * True if this date/time specification specifies a full date (year, month, day)
+ */
+ public final boolean hasDate()
+ { return ((_bits & (HAS_DAY | HAS_MONTH | HAS_YEAR)) == (HAS_DAY | HAS_MONTH | HAS_YEAR)); }
+
+ /**
+ * Gets the year. Should be a four-digit year specification.
+ */
+ public final int getYear()
+ { return _CY; }
+
+ /**
+ * Gets the month-of-year. January is 1.
+ */
+ public final int getMonth()
+ { return _M; }
+
+ /**
+ * Gets the day-of-month. The first day of each month is 1.
+ */
+ public final int getDay()
+ { return _D; }
+
+ /**
+ * Gets the hour-of-day. Midnight is 0, and 11PM is 23.
+ */
+ public final int getHour()
+ { return _h; }
+
+ /**
+ * Gets the minute-of-hour. Range from 0 to 59.
+ */
+ public final int getMinute()
+ { return _m; }
+
+ /**
+ * Gets the second-of-minute. Range from 0 to 59.
+ */
+ public final int getSecond()
+ { return _s; }
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ public final BigDecimal getFraction()
+ { return _fs; }
+
+ /**
+ * Gets the time zone sign. For time zones east of GMT,
+ * this is positive; for time zones west, this is negative.
+ */
+ public final int getTimeZoneSign()
+ { return _tzsign; }
+
+ /**
+ * Gets the time zone hour.
+ *
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ public final int getTimeZoneHour()
+ { return _tzh; }
+
+ /**
+ * Gets the time zone minutes.
+ *
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ public final int getTimeZoneMinute()
+ { return _tzm; }
+
+ /**
+ * Gets the rounded millisecond value. Range from 0 to 999
+ */
+ public int getMillisecond()
+ {
+ if (_fs == null)
+ return 0;
+ return _fs.setScale(3, BigDecimal.ROUND_HALF_UP).unscaledValue().intValue();
+ }
+
+ /**
+ * The canonical string representation. Specific moments or
+ * times-of-day in a specified timezone are normalized to
+ * UTC time to produce a canonical string form for them.
+ * Other recurring time specifications keep their timezone
+ * information.
+ */
+ public String canonicalString()
+ {
+ ensureCanonicalString();
+ return _canonicalString;
+ }
+
+ /**
+ * True if this GDate corresponds to a valid gregorian date value
+ * in XML schema.
+ */
+ public boolean isValid()
+ {
+ return GDateBuilder.isValidGDate(this);
+ }
+
+ /**
+ * Returns the Julian date corresponding to this Gregorian date.
+ * The Julian date (JD) is a continuous count of days from
+ * 1 January 4713 BC (= -4712 January 1).
+ */
+ public int getJulianDate()
+ {
+ return GDateBuilder.julianDateForGDate(this);
+ }
+
+ /**
+ * Retrieves the value of the current time as an {@link XmlCalendar}.
+ * <p>
+ * {@link XmlCalendar} is a subclass of {@link java.util.GregorianCalendar}
+ * which is slightly customized to match XML schema date rules.
+ * <p>
+ * The returned {@link XmlCalendar} has only those time and date fields
+ * set that are reflected in the GDate object. Because of the way the
+ * {@link java.util.Calendar} contract works, any information in the isSet() vanishes
+ * as soon as you view any unset field using get() methods.
+ * This means that if it is important to understand which date fields
+ * are set, you must call isSet() first before get().
+ */
+ public XmlCalendar getCalendar()
+ {
+ return new XmlCalendar(this);
+ }
+
+
+ /**
+ * Retrieves the value of the current time as a java.util.Date
+ * instance.
+ */
+ public Date getDate()
+ {
+ return GDateBuilder.dateForGDate(this);
+ }
+
+ /**
+ * Comparison to another GDate.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ */
+ public int compareToGDate(GDateSpecification datespec)
+ {
+ return GDateBuilder.compareGDate(this, datespec);
+ }
+
+ /**
+ * Returns the builtin type code for the shape of the information
+ * contained in this instance, or 0 if the
+ * instance doesn't contain information corresponding to a
+ * Schema type.
+ * <p>
+ * Value will be equal to
+ * {@link SchemaType#BTC_NOT_BUILTIN},
+ * {@link SchemaType#BTC_G_YEAR},
+ * {@link SchemaType#BTC_G_YEAR_MONTH},
+ * {@link SchemaType#BTC_G_MONTH},
+ * {@link SchemaType#BTC_G_MONTH_DAY},
+ * {@link SchemaType#BTC_G_DAY},
+ * {@link SchemaType#BTC_DATE},
+ * {@link SchemaType#BTC_DATE_TIME}, or
+ * {@link SchemaType#BTC_TIME}.
+ */
+ public int getBuiltinTypeCode()
+ {
+ return GDateBuilder.btcForFlags(_bits);
+ }
+
+ /**
+ * Adds a duration to this GDate, and returns a new GDate.
+ */
+ public GDate add(GDurationSpecification duration)
+ {
+ GDateBuilder builder = new GDateBuilder(this);
+ builder.addGDuration(duration);
+ return builder.toGDate();
+ }
+
+ /**
+ * Adds a duration to this GDate, and returns a new GDate.
+ */
+ public GDate subtract(GDurationSpecification duration)
+ {
+ GDateBuilder builder = new GDateBuilder(this);
+ builder.subtractGDuration(duration);
+ return builder.toGDate();
+ }
+
+ /**
+ * GDate is an immutable class, and equality is computed based
+ * on its canonical value.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (!(obj instanceof GDate))
+ return false;
+
+ ensureCanonicalString();
+ return _canonicalString.equals(((GDate)obj).canonicalString());
+ }
+
+ /**
+ * Returns a hash code for this GDate.
+ */
+ public int hashCode()
+ {
+ ensureCanonicalString();
+ return _canonicalString.hashCode();
+ }
+
+ /**
+ * The canonical string representation. Specific moments or
+ * times-of-day in a specified timezone are normalized to
+ * UTC time to produce a canonical string form for them.
+ * Other recurring time specifications keep their timezone
+ * information.
+ */
+ private void ensureCanonicalString()
+ {
+ if (_canonicalString != null)
+ return;
+
+ boolean needNormalize =
+ (hasTimeZone() && getTimeZoneSign() != 0 && hasTime() &&
+ ((hasDay() == hasMonth() && hasDay() == hasYear())));
+
+ if (!needNormalize && getFraction() != null && getFraction().scale() > 0)
+ {
+ BigInteger bi = getFraction().unscaledValue();
+ needNormalize = (bi.mod(GDateBuilder.TEN).signum() == 0);
+ }
+
+ if (!needNormalize)
+ _canonicalString = toString();
+ else
+ {
+ GDateBuilder gdb = new GDateBuilder(this);
+ gdb.normalize();
+ _canonicalString = gdb.toString();
+ }
+ }
+
+ /**
+ * The natural string representation. This represents the information
+ * that is available, including timezone. For types that correspond
+ * to defined schema types (schemaBuiltinTypeCode() > 0),
+ * this provides the natural lexical representation.
+ * <p>
+ * When both time and timezone are specified, this string is not
+ * the canonical representation unless the timezone is UTC (Z)
+ * (since the same moment in time can be expressed in different
+ * timezones). To get a canonical string, use the canonicalString()
+ * method.
+ */
+ public String toString()
+ {
+ if (_string == null)
+ _string = formatGDate(this);
+ return _string;
+ }
+
+ private final static char[] _tensDigit =
+ {
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
+ '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
+ '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
+ '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
+ '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
+ '6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
+ '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
+ '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
+ '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
+ };
+ private final static char[] _onesDigit =
+ {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ };
+
+ private static final int _padTwoAppend(char[] b, int i, int n)
+ {
+ assert(n >= 0 && n < 100);
+ b[i] = _tensDigit[n];
+ b[i + 1] = _onesDigit[n];
+ return i + 2;
+ }
+
+ private static final int _padFourAppend(char[] b, int i, int n)
+ {
+ if (n < 0)
+ {
+ b[i++] = '-';
+ n = -n;
+ }
+ if (n >= 10000)
+ {
+ String s = Integer.toString(n);
+ s.getChars(0, s.length(), b, i);
+ return i + s.length();
+ }
+ int q = n / 100;
+ int r = n - q * 100;
+ b[i] = _tensDigit[q];
+ b[i + 1] = _onesDigit[q];
+ b[i + 2] = _tensDigit[r];
+ b[i + 3] = _onesDigit[r];
+ return i + 4;
+ }
+
+ private static final TimeZone GMTZONE = TimeZone.getTimeZone("GMT");
+ private static final TimeZone[] MINUSZONE =
+ {
+ TimeZone.getTimeZone("GMT-00:00"),
+ TimeZone.getTimeZone("GMT-01:00"),
+ TimeZone.getTimeZone("GMT-02:00"),
+ TimeZone.getTimeZone("GMT-03:00"),
+ TimeZone.getTimeZone("GMT-04:00"),
+ TimeZone.getTimeZone("GMT-05:00"),
+ TimeZone.getTimeZone("GMT-06:00"),
+ TimeZone.getTimeZone("GMT-07:00"),
+ TimeZone.getTimeZone("GMT-08:00"),
+ TimeZone.getTimeZone("GMT-09:00"),
+ TimeZone.getTimeZone("GMT-10:00"),
+ TimeZone.getTimeZone("GMT-11:00"),
+ TimeZone.getTimeZone("GMT-12:00"),
+ TimeZone.getTimeZone("GMT-13:00"),
+ TimeZone.getTimeZone("GMT-14:00"),
+ };
+ private static final TimeZone[] PLUSZONE =
+ {
+ TimeZone.getTimeZone("GMT+00:00"),
+ TimeZone.getTimeZone("GMT+01:00"),
+ TimeZone.getTimeZone("GMT+02:00"),
+ TimeZone.getTimeZone("GMT+03:00"),
+ TimeZone.getTimeZone("GMT+04:00"),
+ TimeZone.getTimeZone("GMT+05:00"),
+ TimeZone.getTimeZone("GMT+06:00"),
+ TimeZone.getTimeZone("GMT+07:00"),
+ TimeZone.getTimeZone("GMT+08:00"),
+ TimeZone.getTimeZone("GMT+09:00"),
+ TimeZone.getTimeZone("GMT+10:00"),
+ TimeZone.getTimeZone("GMT+11:00"),
+ TimeZone.getTimeZone("GMT+12:00"),
+ TimeZone.getTimeZone("GMT+13:00"),
+ TimeZone.getTimeZone("GMT+14:00"),
+ };
+
+ /* package */ static final TimeZone timeZoneForGDate(GDateSpecification date)
+ {
+ // use a cached timezone if integral; otherwise make a new one.
+ if (!date.hasTimeZone())
+ return TimeZone.getDefault();
+ if (date.getTimeZoneSign() == 0)
+ return GMTZONE;
+ if (date.getTimeZoneMinute() == 0 && date.getTimeZoneHour() <= 14 && date.getTimeZoneHour() >= 0)
+ return date.getTimeZoneSign() < 0 ? MINUSZONE[date.getTimeZoneHour()] : PLUSZONE[date.getTimeZoneHour()];
+
+ char[] zb = new char[9];
+ zb[0] = 'G';
+ zb[1] = 'M';
+ zb[2] = 'T';
+ zb[3] = (date.getTimeZoneSign() < 0) ? '-' : '+';
+ GDate._padTwoAppend(zb, 4, date.getTimeZoneHour());
+ zb[6] = ':';
+ GDate._padTwoAppend(zb, 7, date.getTimeZoneMinute());
+ return TimeZone.getTimeZone(new String(zb));
+ }
+
+ /* package */ static String formatGDate(GDateSpecification spec)
+ {
+ // We've used a char[] rather than a StringBuffer for a 4x speedup
+ // -YY(10)YY-MM-DDTHH:MM:SS.FFFFFF+ZH:ZM
+ // 1 + 10 + 3+ 3+ 3+ 3+ 3+1 + s + 3+ 3 = 33 + s
+ BigDecimal fs = spec.getFraction();
+ char[] message = new char[33 + (fs == null ? 0 : fs.scale())];
+ int i = 0;
+
+ if (spec.hasYear() || spec.hasMonth() || spec.hasDay())
+ {
+ dmy: {
+ if (spec.hasYear())
+ i = _padFourAppend(message, 0, spec.getYear());
+ else
+ message[i++] = '-';
+
+ if (!(spec.hasMonth() || spec.hasDay()))
+ break dmy;
+
+ message[i++] = '-';
+ if (spec.hasMonth())
+ i = _padTwoAppend(message, i, spec.getMonth());
+
+ if (!spec.hasDay())
+ break dmy;
+
+ message[i++] = '-';
+ i = _padTwoAppend(message, i, spec.getDay());
+ break dmy;
+ }
+ if (spec.hasTime())
+ message[i++] = 'T';
+ }
+
+ if (spec.hasTime())
+ {
+ i = _padTwoAppend(message, i, spec.getHour());
+ message[i++] = ':';
+ i = _padTwoAppend(message, i, spec.getMinute());
+ message[i++] = ':';
+ i = _padTwoAppend(message, i, spec.getSecond());
+ if (fs != _zero) // (optimization ~3%)
+ {
+ String frac = spec.getFraction().toString();
+ int point = frac.indexOf('.');
+ if (point >= 0)
+ {
+ frac.getChars(point, frac.length(), message, i);
+ i += frac.length() - point;
+ }
+ }
+ }
+
+ if (spec.hasTimeZone())
+ {
+ if (spec.getTimeZoneSign() == 0)
+ {
+ message[i++] = 'Z';
+ }
+ else
+ {
+ message[i++] = spec.getTimeZoneSign() > 0 ? '+' : '-';
+ i = _padTwoAppend(message, i, spec.getTimeZoneHour());
+ message[i++] = ':';
+ i = _padTwoAppend(message, i, spec.getTimeZoneMinute());
+ }
+ }
+
+ // it would be nice to use (0, i, message) ctor instead
+ return new String(message, 0, i);
+ }
+
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDateBuilder.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDateBuilder.java
new file mode 100644
index 0000000..f564c80
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDateBuilder.java
@@ -0,0 +1,1456 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * Used to build {@link GDate GDates}.
+ * <p>
+ * Like GDate, a GDateBuilder represents an Gregorian Date, Time,
+ * and Timezone, or subset of information (Year, Month, Day,
+ * Time, Timezone, or some combination). Wherever it provides
+ * guidance, the XML Schema 1.0 specification (plus published
+ * errata) is followed.
+ * <p>
+ * Instances may separately set or clear the year, month,
+ * day-of-month, and time-of-day. Not all operations are
+ * meaningful on all combinations. In particular, timezone
+ * normalization is only possible if there is a time, or
+ * a time together with a full date.
+ */
+public final class GDateBuilder implements GDateSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private int _bits;
+ private int _CY;
+ private int _M;
+ private int _D;
+ private int _h;
+ private int _m;
+ private int _s;
+ private BigDecimal _fs;
+ private int _tzsign;
+ private int _tzh;
+ private int _tzm;
+
+ /**
+ * Constructs a GDateBuilder specifying no date or time
+ */
+ public GDateBuilder()
+ {
+ }
+
+ /**
+ * Builds another GDateBuilder with the same value
+ * as this one.
+ */
+ public Object clone()
+ {
+ return new GDateBuilder(this);
+ }
+
+ /**
+ * Builds a GDate from this GDateBuilder.
+ */
+ public GDate toGDate()
+ {
+ return new GDate(this);
+ }
+
+ /**
+ * Construts a GDateBuilder by copying another GDateSpecificaiton.
+ */
+ public GDateBuilder(GDateSpecification gdate)
+ {
+ if (gdate.hasTimeZone())
+ setTimeZone(gdate.getTimeZoneSign(), gdate.getTimeZoneHour(), gdate.getTimeZoneMinute());
+
+ if (gdate.hasTime())
+ setTime(gdate.getHour(), gdate.getMinute(), gdate.getSecond(), gdate.getFraction());
+
+ if (gdate.hasDay())
+ setDay(gdate.getDay());
+
+ if (gdate.hasMonth())
+ setMonth(gdate.getMonth());
+
+ if (gdate.hasYear())
+ setYear(gdate.getYear());
+ }
+
+ // Forms:
+
+ // Date part:
+ // Year: (-?\d{4,})
+ // YearMonth: (-?\d{4,})-(\d{2})
+ // Date: (-?\d{4,})-(\d{2})-(\d{2})
+ // Month: --(\d{2})(--)? //errata R-48
+ // MonthDay: --(\d{2})-(\d{2})
+ // Day: ---(\d{2})
+
+ // Time part:
+ // Time: (\d{2}):(\d{2}):(\d{2})(.\d*)?
+
+ // Timezone part:
+ // TZ: (Z)|([+-]\d{2}):(\d{2})
+
+ /**
+ * Constructs a GDateBuilder from a lexical
+ * representation. The lexical space contains the
+ * union of the lexical spaces of all the schema
+ * date/time types (except for duration).
+ */
+ public GDateBuilder(CharSequence string)
+ {
+ this(new GDate(string));
+ }
+
+
+ public GDateBuilder(Calendar calendar)
+ {
+ this(new GDate(calendar));
+ }
+
+ /**
+ * Constructs a GDateBuilder with the specified year, month, day,
+ * hours, minutes, seconds, and optional fractional seconds, in
+ * an unspecified timezone.
+ * <p>
+ * Note that by not specifying the timezone the GDateBuilder
+ * becomes partially unordered with respect to timesthat do have a
+ * specified timezone.
+ *
+ * @param year The year
+ * @param month The month, from 1-12
+ * @param day The day of month, from 1-31
+ * @param hour The hour of day, from 0-23
+ * @param minute The minute of hour, from 0-59
+ * @param second The second of minute, from 0-59
+ * @param fraction The fraction of second, 0.0 to 0.999... (may be null)
+ */
+ public GDateBuilder(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction)
+ {
+ _bits = HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME;
+
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? GDate._zero : fraction;
+
+ if (!isValid())
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Constructs an absolute GDateBuilder with the specified year,
+ * month, day, hours, minutes, seconds, and optional fractional
+ * seconds, and in the timezone specified.
+ * <p>
+ * Note that you can reexpress the GDateBuilder in any timezone using
+ * normalizeToTimeZone(). The normalize() method normalizes to UTC.
+ * <p>
+ * If you wish to have a time or date that isn't in a specified timezone,
+ * then use the constructor that does not include the timezone arguments.
+ *
+ * @param year the year
+ * @param month the month, from 1-12
+ * @param day the day of month, from 1-31
+ * @param hour the hour of day, from 0-23
+ * @param minute the minute of hour, from 0-59
+ * @param second the second of minute, from 0-59
+ * @param fraction the fraction of second, 0.0 to 0.999... (may be null)
+ * @param tzSign the timezone offset sign, either +1, 0, or -1
+ * @param tzHour the timezone offset hour
+ * @param tzMinute the timezone offset minute
+ */
+ public GDateBuilder(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction,
+ int tzSign,
+ int tzHour,
+ int tzMinute)
+ {
+ _bits = HAS_TIMEZONE | HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME;
+
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? GDate._zero : fraction;
+ _tzsign = tzSign;
+ _tzh = tzHour;
+ _tzm = tzMinute;
+
+ if (!isValid())
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Constructs a GDateBuilder based on a java.util.Date.
+ * <p>
+ * The current offset of the default timezone is used as the timezone.
+ * <p>
+ * For example, if eastern daylight time is in effect at the given
+ * date, the timezone on the east coast of the united states
+ * translates to GMT-05:00 (EST) + 1:00 (DT offset) == GMT-04:00.
+ *
+ * @param date the date object to copy
+ */
+ public GDateBuilder(Date date)
+ {
+ setDate(date);
+ }
+
+ /**
+ * True if the instance is immutable.
+ */
+ public boolean isImmutable()
+ {
+ return false;
+ }
+
+ /**
+ * Returns a combination of flags indicating the information
+ * contained by this GDate. The five flags are
+ * HAS_TIMEZONE, HAS_YEAR, HAS_MONTH, HAS_DAY, and HAS_TIME.
+ */
+ public int getFlags()
+ {
+ return _bits;
+ }
+
+ /**
+ * True if this date/time specification specifies a timezone.
+ */
+ public final boolean hasTimeZone()
+ { return ((_bits & HAS_TIMEZONE) != 0); }
+
+ /**
+ * True if this date/time specification specifies a year.
+ */
+ public final boolean hasYear()
+ { return ((_bits & HAS_YEAR) != 0); }
+
+ /**
+ * True if this date/time specification specifies a month-of-year.
+ */
+ public final boolean hasMonth()
+ { return ((_bits & HAS_MONTH) != 0); }
+
+ /**
+ * True if this date/time specification specifies a day-of-month.
+ */
+ public final boolean hasDay()
+ { return ((_bits & HAS_DAY) != 0); }
+
+ /**
+ * True if this date/time specification specifies a time-of-day.
+ */
+ public final boolean hasTime()
+ { return ((_bits & HAS_TIME) != 0); }
+
+ /**
+ * True if this date/time specification specifies a full date (year, month, day)
+ */
+ public final boolean hasDate()
+ { return ((_bits & (HAS_DAY | HAS_MONTH | HAS_YEAR)) == (HAS_DAY | HAS_MONTH | HAS_YEAR)); }
+
+ /**
+ * Gets the year. Should be a four-digit year specification.
+ */
+ public final int getYear()
+ { return _CY; }
+
+ /**
+ * Gets the month-of-year. January is 1.
+ */
+ public final int getMonth()
+ { return _M; }
+
+ /**
+ * Gets the day-of-month. The first day of each month is 1.
+ */
+ public final int getDay()
+ { return _D; }
+
+ /**
+ * Gets the hour-of-day. Midnight is 0, and 11PM is 23.
+ */
+ public final int getHour()
+ { return _h; }
+
+ /**
+ * Gets the minute-of-hour. Range from 0 to 59.
+ */
+ public final int getMinute()
+ { return _m; }
+
+ /**
+ * Gets the second-of-minute. Range from 0 to 59.
+ */
+ public final int getSecond()
+ { return _s; }
+
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ public final BigDecimal getFraction()
+ { return _fs; }
+
+
+ /**
+ * Gets the rounded millisecond value. Range from 0 to 999
+ */
+ public final int getMillisecond()
+ {
+ if (_fs == null || _fs == GDate._zero)
+ return 0;
+ return _fs.setScale(3, BigDecimal.ROUND_HALF_UP).unscaledValue().intValue();
+ }
+
+ /**
+ * Gets the time zone sign. For time zones east of GMT,
+ * this is positive; for time zones west, this is negative.
+ */
+ public final int getTimeZoneSign()
+ { return _tzsign; }
+
+ /**
+ * Gets the time zone hour.
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ public final int getTimeZoneHour()
+ { return _tzh; }
+
+ /**
+ * Gets the time zone minutes.
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ public final int getTimeZoneMinute()
+ { return _tzm; }
+
+ /**
+ * Sets the year. Should be a four-digit year specification.
+ * @param year the year
+ */
+ public void setYear(int year)
+ {
+ if (year < -4712 || year > 999999)
+ throw new IllegalArgumentException("year out of range");
+ _bits |= HAS_YEAR; _CY = year;
+ }
+
+ /**
+ * Sets the month-of-year. January is 1.
+ * @param month the month, from 1-12
+ */
+ public void setMonth(int month)
+ {
+ if (month < 1 || month > 12)
+ throw new IllegalArgumentException("month out of range");
+ _bits |= HAS_MONTH; _M = month;
+ }
+
+ /**
+ * Sets the day-of-month. The first day of each month is 1.
+ * @param day the day of month, from 1-31
+ */
+ public void setDay(int day)
+ {
+ if (day < 1 || day > 31)
+ throw new IllegalArgumentException("day out of range");
+ _bits |= HAS_DAY; _D = day;
+ }
+
+ /**
+ * Sets the time. Hours in the day range from 0 to 23;
+ * minutes and seconds range from 0 to 59; and fractional
+ * seconds range from 0 (inclusive) to 1 (exclusive).
+ * The fraction can be null and is assumed to be zero.
+ * @param hour the hour of day, from 0-23
+ * @param minute the minute of hour, from 0-59
+ * @param second the second of minute, from 0-59
+ * @param fraction the fraction of second, 0.0 to 0.999... (may be null)
+ */
+ public void setTime(int hour, int minute, int second, BigDecimal fraction)
+ {
+ if (hour < 0 || hour > 23)
+ throw new IllegalArgumentException("hour out of range");
+ if (minute < 0 || minute > 59)
+ throw new IllegalArgumentException("minute out of range");
+ if (second < 0 || second > 59)
+ throw new IllegalArgumentException("second out of range");
+ if (fraction != null && (fraction.signum() < 0 || fraction.compareTo(GDate._one) > 1))
+ throw new IllegalArgumentException("fraction out of range");
+ _bits |= HAS_TIME;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? GDate._zero : fraction;
+ }
+
+ /**
+ * Sets the time zone without changing the other time
+ * fields. If you with to adjust other time fields to express
+ * the same actual moment in time in a different time zone,
+ * use normalizeToTimeZone.
+ * <p>
+ * Timezones must be between -14:00 and +14:00. Sign
+ * must be -1 or 1 (or 0 for UTC only), and the offset hours
+ * and minute arguments must be nonnegative.
+ *
+ * @param tzSign the timezone offset sign, either +1, 0, or -1
+ * @param tzHour the timezone offset hour
+ * @param tzMinute the timezone offset minute
+ */
+ public void setTimeZone(int tzSign, int tzHour, int tzMinute)
+ {
+ if (!((tzSign == 0 && tzHour == 0 && tzMinute == 0) ||
+ ((tzSign == -1 || tzSign == 1) &&
+ (tzHour >= 0 && tzMinute >= 0) &&
+ (tzHour == 14 && tzMinute == 0 || tzHour < 14 && tzMinute < 60))))
+ throw new IllegalArgumentException("time zone out of range (-14:00 to +14:00). (" +
+ (tzSign<0 ? "-" : "+") + tzHour + ":" + tzMinute + ")");
+
+ _bits |= HAS_TIMEZONE;
+ _tzsign = tzSign;
+ _tzh = tzHour;
+ _tzm = tzMinute;
+ }
+
+ /**
+ * Sets the time zone based on a number of offset minutes rather
+ * than sign/hour/minute; for example, setTimeZone(-60) is the
+ * same as setTimeZone(-1, 1, 0).
+ */
+ public void setTimeZone(int tzTotalMinutes)
+ {
+ if (tzTotalMinutes < -14 * 60 || tzTotalMinutes > 14 * 60)
+ throw new IllegalArgumentException("time zone out of range (-840 to 840 minutes). (" + tzTotalMinutes + ")");
+
+ int tzSign = tzTotalMinutes < 0 ? -1 : tzTotalMinutes > 0 ? 1 : 0;
+ tzTotalMinutes *= tzSign;
+ int tzH = tzTotalMinutes / 60;
+ int tzM = tzTotalMinutes - tzH * 60;
+
+ setTimeZone(tzSign, tzH, tzM);
+ }
+
+ /**
+ * Clears the year. After clearing, hasYear returns false and the
+ * value of getYear is undefined.
+ */
+ public void clearYear()
+ { _bits &= ~HAS_YEAR; _CY = 0; }
+
+ /**
+ * Clears the month-of-year. After clearing. hasMonth returns false and
+ * the value of getMonth is undefined.
+ */
+ public void clearMonth()
+ { _bits &= ~HAS_MONTH; _M = 0; }
+
+ /**
+ * Clears the day-of-month. After clearing. hasDay returns false and
+ * the value of getDay is undefined.
+ */
+ public void clearDay()
+ { _bits &= ~HAS_DAY; _D = 0; }
+
+ /**
+ * Clears the time-of-day.
+ * After clearing. hasTime returns false and
+ * the value of getTime is undefined.
+ */
+ public void clearTime()
+ {
+ _bits &= ~HAS_TIME;
+ _h = 0;
+ _m = 0;
+ _s = 0;
+ _fs = null;
+ }
+
+ /**
+ * Clears the timezone. After clearing. hasTimeZone returns false and
+ * the value of getTimeZoneHour and getTimeZoneMinute are undefined.
+ * Does not change the other time fields.
+ */
+ public void clearTimeZone()
+ {
+ _bits &= ~HAS_TIMEZONE;
+ _tzsign = 0;
+ _tzh = 0;
+ _tzm = 0;
+ }
+
+ /**
+ * True if all date fields lie within their legal ranges. A GDateBuilder
+ * can be invalid, for example, if you change the month to February
+ * and the day-of-month is 31.
+ */
+ public boolean isValid()
+ {
+ return isValidGDate(this);
+ }
+
+ /* package */ static final boolean isValidGDate(GDateSpecification date)
+ {
+ if (date.hasMonth() && (date.getMonth() < 1 || date.getMonth() > 12))
+ return false;
+
+ if (date.hasDay() && (date.getDay() < 1 || date.getDay() > 31 ||
+ date.getDay() > 28 && date.hasMonth() &&
+ (date.hasYear() ? date.getDay() > _maxDayInMonthFor(date.getYear(), date.getMonth()) :
+ date.getDay() > _maxDayInMonth(date.getMonth()))))
+ return false;
+
+ if (date.hasTime() && (date.getHour() < 0 || date.getHour() > 23 ||
+ date.getMinute() < 0 || date.getMinute() > 59 ||
+ date.getSecond() < 0 || date.getSecond() > 59 ||
+ date.getFraction().signum() < 0 || date.getFraction().compareTo(GDate._one) >= 0))
+ return false;
+
+ if (date.hasTimeZone() &&
+ (!((date.getTimeZoneSign() == 0 && date.getTimeZoneHour() == 0 && date.getTimeZoneMinute() == 0) ||
+ ((date.getTimeZoneSign() == -1 || date.getTimeZoneSign() == +1) &&
+ // NB: allow +00:00 and -00:00
+ // (date.getTimeZoneHour() == 0 && date.getTimeZoneMinute() > 0 || date.getTimeZoneHour() > 0 && date.getTimeZoneMinute() >= 0) &&
+ (date.getTimeZoneHour() >= 0 && date.getTimeZoneMinute() >= 0) &&
+ (date.getTimeZoneHour() == 14 && date.getTimeZoneMinute() == 0 || date.getTimeZoneHour() < 14 && date.getTimeZoneMinute() < 60)))))
+ return false;
+
+ // everyting looks kosher
+ return true;
+ }
+
+
+ /**
+ * Normalizes the instance, ensuring date and time fields are within
+ * their normal ranges.
+ * <p>
+ * If no timezone or no time is specified, or if a partial date is specified, this
+ * method does nothing, and leaves the timezone information as-is.
+ * <p>
+ * If a time or time and date is specified, this method normalizes the timezone
+ * to UTC.
+ */
+ public void normalize()
+ {
+ // DateTime or Time, with TimeZone: normalize to UTC.
+ // In the process all the fields will be normalized.
+ if (hasDay() == hasMonth() && hasDay() == hasYear() &&
+ hasTimeZone() && hasTime())
+ {
+ normalizeToTimeZone(0, 0, 0);
+ }
+ else
+ {
+ // No timezone, or incomplete date.
+ long carry = 0;
+
+ if (hasTime())
+ carry = _normalizeTime();
+
+ if (hasDay())
+ _D += carry;
+
+ if (hasDate())
+ {
+ _normalizeDate();
+ }
+ else if (hasMonth())
+ {
+ // with incomplete dates, just months can be normalized:
+ // days stay denormalized.
+ if (_M < 1 || _M > 12)
+ {
+ int temp = _M;
+ _M = _modulo(temp, 1, 13);
+ if (hasYear())
+ _CY = _CY + (int)_fQuotient(temp, 1, 13);
+ }
+ }
+ }
+
+ // remove trailing zeros from fractional seconds
+ if (hasTime() && _fs != null && _fs.scale() > 0)
+ {
+ if (_fs.signum() == 0)
+ _fs = GDate._zero;
+ else
+ {
+ BigInteger bi = _fs.unscaledValue();
+ String str = bi.toString();
+ int lastzero;
+ for (lastzero = str.length(); lastzero > 0; lastzero -= 1)
+ if (str.charAt(lastzero - 1) != '0')
+ break;
+ if (lastzero < str.length())
+ _fs = _fs.setScale(_fs.scale() - str.length() + lastzero);
+ }
+ }
+ }
+
+ /**
+ * If the time and timezone are known, this method changes the timezone to the
+ * specified UTC offset, altering minutes, hours, day, month, and year as
+ * necessary to ensure that the actual described moment in time is the same.
+ * <p>
+ * It is an error to operate on instances without a time or timezone, or
+ * with a partially specified date.
+ *
+ * @param tzSign the timezone offset sign, either +1, 0, or -1
+ * @param tzHour the timezone offset hour
+ * @param tzMinute the timezone offset minute
+ */
+ public void normalizeToTimeZone(int tzSign, int tzHour, int tzMinute)
+ {
+ if (!((tzSign == 0 && tzHour == 0 && tzMinute == 0) ||
+ ((tzSign == -1 || tzSign == 1) &&
+ (tzHour >= 0 && tzMinute >= 0) &&
+ (tzHour == 14 && tzMinute == 0 || tzHour < 14 && tzMinute < 60))))
+ throw new IllegalArgumentException("time zone must be between -14:00 and +14:00");
+
+ if (!hasTimeZone() || !hasTime())
+ throw new IllegalStateException("cannot normalize time zone without both time and timezone");
+
+ if (!(hasDay() == hasMonth() && hasDay() == hasYear()))
+ throw new IllegalStateException("cannot do date math without a complete date");
+
+ int hshift = tzSign * tzHour - _tzsign * _tzh;
+ int mshift = tzSign * tzMinute - _tzsign * _tzm;
+
+ _tzsign = tzSign;
+ _tzh = tzHour;
+ _tzm = tzMinute;
+ addDuration(1, 0, 0, 0, hshift, mshift, 0, null);
+ }
+
+ /**
+ * Normalizes to a time zone specified by a number of offset minutes rather
+ * than sign/hour/minute; for example, normalizeToTimeZone(-60) is the
+ * same as normalizeToTimeZone(-1, 1, 0).
+ */
+ public void normalizeToTimeZone(int tzTotalMinutes)
+ {
+ if (tzTotalMinutes < -14 * 60 || tzTotalMinutes > 14 * 60)
+ throw new IllegalArgumentException("time zone out of range (-840 to 840 minutes). (" + tzTotalMinutes + ")");
+
+ int tzSign = tzTotalMinutes < 0 ? -1 : tzTotalMinutes > 0 ? 1 : 0;
+ tzTotalMinutes *= tzSign;
+ int tzH = tzTotalMinutes / 60;
+ int tzM = tzTotalMinutes - tzH * 60;
+
+ normalizeToTimeZone(tzSign, tzH, tzM);
+ }
+
+
+ /**
+ * Adds a given duration to the date/time.
+ *
+ * @param duration the duration to add
+ */
+ public void addGDuration(GDurationSpecification duration)
+ {
+ addDuration(duration.getSign(), duration.getYear(), duration.getMonth(), duration.getDay(),
+ duration.getHour(), duration.getMinute(), duration.getSecond(), duration.getFraction());
+ }
+
+ /**
+ * Subtracts a given duration from the date/time.
+ *
+ * @param duration the duration to subtract
+ */
+ public void subtractGDuration(GDurationSpecification duration)
+ {
+ addDuration(-duration.getSign(), duration.getYear(), duration.getMonth(), duration.getDay(),
+ duration.getHour(), duration.getMinute(), duration.getSecond(), duration.getFraction());
+ }
+
+
+ /**
+ * Normalizes the date by carrying over to the year any months outside 1..12
+ * and carrying over to the month any days outside 1..(days-in-month).
+ */
+ private void _normalizeDate()
+ {
+ if (_M < 1 || _M > 12 || _D < 1 || _D > _maxDayInMonthFor(_CY, _M))
+ {
+ // fix months first
+ int temp = _M;
+ _M = _modulo(temp, 1, 13);
+ _CY = _CY + (int)_fQuotient(temp, 1, 13);
+
+ // then pull days out
+ int extradays = _D - 1;
+ _D = 1;
+
+ // then use the julian date function to fix
+ setJulianDate(getJulianDate() + extradays);
+ }
+ }
+
+ /**
+ * Normalizes time so that fractions are 0..1(exc), seconds/minutes 0..59,
+ * and hours 0..24. Returns the number of days to carry over from normalizing
+ * away more than 24 hours.
+ */
+ private long _normalizeTime()
+ {
+ long carry = 0;
+ long temp;
+
+ // fractions
+ if (_fs != null && (_fs.signum() < 0 || _fs.compareTo(GDate._one) >= 0))
+ {
+ BigDecimal bdcarry = _fs.setScale(0, BigDecimal.ROUND_FLOOR);
+ _fs = _fs.subtract(bdcarry);
+ carry = bdcarry.longValue();
+ }
+
+ if (carry != 0 || _s < 0 || _s > 59 || _m < 0 || _m > 50 || _h < 0 || _h > 23)
+ {
+ // seconds
+ temp = _s + carry;
+ carry = _fQuotient(temp, 60);
+ _s = _mod(temp, 60, carry);
+
+ // minutes
+ temp = _m + carry;
+ carry = _fQuotient(temp, 60);
+ _m = _mod(temp, 60, carry);
+
+ // hours
+ temp = _h + carry;
+ carry = _fQuotient(temp, 24);
+ _h = _mod(temp, 24, carry);
+ }
+
+ return carry;
+ }
+
+ /**
+ * Adds a given duration to the date/time.
+ *
+ * @param sign +1 to add, -1 to subtract
+ * @param year the number of years to add
+ * @param month the number of months to add
+ * @param day the number of days to add
+ * @param hour the number of hours to add
+ * @param minute the number of minutes to add
+ * @param second the number of seconds to add
+ * @param fraction the number of fractional seconds to add (may be null)
+ */
+ public void addDuration(int sign, int year, int month, int day,
+ int hour, int minute, int second, BigDecimal fraction)
+ {
+ boolean timemath = hour != 0 || minute != 0 || second != 0 || fraction != null && fraction.signum() != 0;
+ if (timemath && !hasTime())
+ throw new IllegalStateException("cannot do time math without a complete time");
+ boolean datemath = hasDay() && (day != 0 || timemath);
+ if (datemath && !hasDate())
+ throw new IllegalStateException("cannot do date math without a complete date");
+
+ int temp;
+
+ // months + years are easy
+ if (month != 0 || year != 0)
+ {
+ // Prepare the _D to be pegged before changing month
+ if (hasDay())
+ _normalizeDate();
+
+ // Add months and years
+ temp = _M + sign * month;
+ _M = _modulo(temp, 1, 13);
+ _CY = _CY + sign * year + (int)_fQuotient(temp, 1, 13);
+
+ // In new month, day may need to be pegged before proceeding
+ if (hasDay())
+ {
+ assert(_D >= 1);
+ temp = _maxDayInMonthFor(_CY, _M);
+ if (_D > temp)
+ _D = temp;
+ }
+ }
+
+ long carry = 0;
+
+ if (timemath)
+ {
+ // fractions
+ if (fraction != null && fraction.signum() != 0)
+ {
+ if (_fs.signum() == 0 && sign == 1)
+ _fs = fraction;
+ else
+ _fs = (sign == 1) ? _fs.add(fraction) : _fs.subtract(fraction);
+ }
+
+ // seconds, minutes, hours
+ _s += sign * second;
+ _m += sign * minute;
+ _h += sign * hour;
+
+ // normalize time
+ carry = _normalizeTime();
+ }
+
+ if (datemath)
+ {
+ // days: may require renormalization
+ _D += sign * day + carry;
+ _normalizeDate();
+ }
+ }
+
+ /**
+ * Given {year,month} computes maximum
+ * number of days for given month
+ */
+ private static int _maxDayInMonthFor(int year, int month)
+ {
+ if (month == 4 || month == 6 || month == 9 || month == 11)
+ return 30;
+
+ if (month == 2)
+ return (_isLeapYear(year) ? 29 : 28);
+
+ return 31;
+ }
+
+ /**
+ * Given {year,month} computes maximum
+ * number of days for given month
+ */
+ private static int _maxDayInMonth(int month)
+ {
+ if (month == 4 || month == 6 || month == 9 || month == 11)
+ return 30;
+
+ if (month == 2)
+ return 29;
+
+ return 31;
+ }
+
+ /**
+ * Returns the Julian date corresponding to this Gregorian date.
+ * The Julian date (JD) is a continuous count of days from
+ * 1 January 4713 BC (= -4712 January 1).
+ */
+ public final int getJulianDate()
+ {
+ return julianDateForGDate(this);
+ }
+
+
+ /**
+ * Sets the Gregorian date based on the given Julian date.
+ * The Julian date (JD) is a continuous count of days from
+ * 1 January 4713 BC (= -4712 January 1).
+ *
+ * @param julianday the julian day number
+ */
+ public void setJulianDate(int julianday)
+ {
+ if (julianday < 0)
+ throw new IllegalArgumentException("date before year -4712");
+
+ int temp;
+ int qepoc;
+
+ // from http://aa.usno.navy.mil/faq/docs/JD_Formula.html
+ temp = julianday + 68569;
+ qepoc = 4 * temp / 146097;
+ temp = temp - (146097 * qepoc + 3) / 4;
+ _CY = 4000 * (temp + 1) / 1461001;
+ temp = temp - 1461 * _CY / 4 + 31;
+ _M = 80 * temp / 2447;
+ _D = temp - 2447 * _M / 80;
+ temp = _M / 11;
+ _M = _M + 2 - 12 * temp;
+ _CY = 100 * (qepoc - 49) + _CY + temp;
+
+ _bits |= HAS_DAY | HAS_MONTH | HAS_YEAR;
+ }
+
+
+ /**
+ * Sets the current time and date based on a java.util.Date instance.
+ * <p>
+ * The timezone offset used is based on the default TimeZone. (The
+ * default TimeZone is consulted to incorporate daylight savings offsets
+ * if applicable for the current date as well as the base timezone offset.)
+ * <p>
+ * If you wish to normalize the timezone, e.g., to UTC, follow this with
+ * a call to normalizeToTimeZone.
+ *
+ * @param date the Date object to copy
+ */
+ public void setDate(Date date)
+ {
+ // Default timezone
+ TimeZone dtz = TimeZone.getDefault();
+ int offset = dtz.getOffset(date.getTime());
+ int offsetsign = 1;
+ if (offset < 0)
+ {
+ offsetsign = -1;
+ offset = -offset;
+ }
+ int offsetmin = offset / (1000 * 60);
+ int offsethr = offsetmin / 60;
+ offsetmin = offsetmin - offsethr * 60;
+
+ setTimeZone(offsetsign, offsethr, offsetmin);
+
+ // paranoia: tz.getOffset can return fractions of minutes, but we must round
+ int roundedoffset = offsetsign * (offsethr * 60 + offsetmin) * 60 * 1000;
+
+ // midnight
+ setTime(0, 0, 0, GDate._zero);
+
+ // Set to January 1, 1970.
+ // setJulianDate(2440588);
+ _bits |= HAS_DAY | HAS_MONTH | HAS_YEAR;
+ _CY = 1970;
+ _M = 1;
+ _D = 1;
+
+ // Add a duration representing the number of milliseconds
+ addGDuration(new GDuration(1, 0, 0, 0, 0, 0, 0,
+ BigDecimal.valueOf(date.getTime() + roundedoffset, 3)));
+
+ // special case: ss.000 -> ss
+ if (_fs.signum() == 0)
+ _fs = GDate._zero;
+ }
+
+ /**
+ * Copies a GDateSpecification, completely replacing the current
+ * information in this GDateBuilder.
+ *
+ * @param gdate the GDateSpecification to copy
+ */
+ public void setGDate(GDateSpecification gdate)
+ {
+ _bits = gdate.getFlags() & (HAS_TIMEZONE | HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME);
+ _CY = gdate.getYear();
+ _M = gdate.getMonth();
+ _D = gdate.getDay();
+ _h = gdate.getHour();
+ _m = gdate.getMinute();
+ _s = gdate.getSecond();
+ _fs = gdate.getFraction();
+ _tzsign = gdate.getTimeZoneSign();
+ _tzh = gdate.getTimeZoneHour();
+ _tzm = gdate.getTimeZoneMinute();
+ }
+
+
+ /**
+ * Retrieves the value of the current time as an {@link XmlCalendar}.
+ * <p>
+ * {@link XmlCalendar} is a subclass of {@link java.util.GregorianCalendar}
+ * which is slightly customized to match XML schema date rules.
+ * <p>
+ * The returned {@link XmlCalendar} has only those time and date fields
+ * set that are reflected in the GDate object. Because of the way the
+ * {@link java.util.Calendar} contract works, any information in the isSet() vanishes
+ * as soon as you view any unset field using get() methods.
+ * This means that if it is important to understand which date fields
+ * are set, you must call isSet() first before get().
+ */
+ public XmlCalendar getCalendar()
+ {
+ return new XmlCalendar(this);
+ }
+
+ /**
+ * Retrieves the value of the current time as a java.util.Date
+ * instance.
+ */
+ public Date getDate()
+ {
+ return dateForGDate(this);
+ }
+
+ /* package */ static int julianDateForGDate(GDateSpecification date)
+ {
+ if (!date.hasDate())
+ throw new IllegalStateException("cannot do date math without a complete date");
+
+ // from http://aa.usno.navy.mil/faq/docs/JD_Formula.html
+ int result = date.getDay()-32075+1461*(date.getYear()+4800+(date.getMonth()-14)/12)/4+
+ 367*(date.getMonth()-2-(date.getMonth()-14)/12*12)/12-3*((date.getYear()+4900+(date.getMonth()-14)/12)/100)/4;
+
+ if (result < 0)
+ throw new IllegalStateException("date too far in the past (year allowed to -4712)");
+
+ return result;
+ }
+
+ /* package */ static Date dateForGDate(GDateSpecification date)
+ {
+ long jDate = julianDateForGDate(date);
+ long to1970Date = jDate - 2440588;
+ long to1970Ms = 1000 * 60 * 60 * 24 * to1970Date;
+
+ to1970Ms += date.getMillisecond();
+ to1970Ms += date.getSecond() * 1000;
+ to1970Ms += date.getMinute() * 60 * 1000;
+ to1970Ms += date.getHour() * 60 * 60 * 1000;
+ if (date.hasTimeZone())
+ {
+ to1970Ms -= (date.getTimeZoneMinute() * date.getTimeZoneSign()) * 60 * 1000;
+ to1970Ms -= (date.getTimeZoneHour() * date.getTimeZoneSign()) * 60 * 60 * 1000;
+ }
+ else
+ {
+ TimeZone def = TimeZone.getDefault();
+ int offset = def.getOffset(to1970Ms);
+ to1970Ms -= offset;
+ }
+
+ return new Date(to1970Ms);
+ }
+
+ /**
+ * True for leap years.
+ */
+ private static boolean _isLeapYear(int year)
+ {
+ // BUGBUG: Julian calendar?
+ return ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)));
+ }
+
+ /**
+ * fQuotient(a, b) = the greatest integer less than or equal to a/b
+ */
+ private static final long _fQuotient(long a, int b)
+ {
+ if ((a < 0) == (b < 0))
+ return a / b;
+
+ return -((b - a - 1) / b);
+ }
+
+ /**
+ * modulo(a, b) = a - fQuotient(a,b)*b
+ */
+ private static int _mod(long a, int b, long quotient)
+ {
+ return (int)(a - quotient*b) ;
+ }
+
+ /**
+ * modulo(a - low, high - low) + low
+ */
+ private static final int _modulo(long temp, int low, int high)
+ {
+ long a = temp - low;
+ int b = high - low;
+ return (_mod(a, b, _fQuotient(a, b)) + low) ;
+ }
+
+ /**
+ * Quotient(a - low, high - low)
+ */
+ private static final long _fQuotient(long temp, int low, int high)
+ {
+ return _fQuotient(temp - low, high - low);
+ }
+
+ /**
+ * Sets to the first possible moment that matches the given
+ * specification.
+ */
+ private void _setToFirstMoment()
+ {
+ // 1584 was the first leap year during which the Gregorian
+ // calendar was in use: seems like the most reasonable "first"
+ // year to use in absence of a year.
+
+ if (!hasYear())
+ setYear(1584);
+
+ if (!hasMonth())
+ setMonth(1);
+
+ if (!hasDay())
+ setDay(1);
+
+ if (!hasTime())
+ setTime(0, 0, 0, GDate._zero);
+ }
+
+ /**
+ * Comparison to another GDate.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ *
+ * @param datespec the date to compare against
+ */
+ public final int compareToGDate(GDateSpecification datespec)
+ {
+ return compareGDate(this, datespec);
+ }
+
+
+ /* package */ static final int compareGDate(GDateSpecification tdate, GDateSpecification datespec)
+ {
+ // same amount of information: looks good
+ int bitdiff = tdate.getFlags() ^ datespec.getFlags();
+
+ easy: if ((bitdiff & (HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME | HAS_TIMEZONE)) == 0)
+ {
+ // If the other date needs to be normalized to
+ // our timezone, make a clone and do so if possible
+ if (tdate.hasTimeZone() &&
+ (datespec.getTimeZoneHour() != tdate.getTimeZoneHour() ||
+ datespec.getTimeZoneMinute() != tdate.getTimeZoneMinute() ||
+ datespec.getTimeZoneSign() != tdate.getTimeZoneSign()))
+ {
+ datespec = new GDateBuilder(datespec);
+
+ int flags = tdate.getFlags() & (HAS_YEAR | HAS_MONTH | HAS_DAY);
+ if (flags != 0 && flags != (HAS_YEAR | HAS_MONTH | HAS_DAY) || !tdate.hasTime())
+ {
+ // in these cases we'll need to fill in fields
+ ((GDateBuilder)datespec)._setToFirstMoment();
+ tdate = new GDateBuilder(tdate);
+ ((GDateBuilder)tdate)._setToFirstMoment();
+ }
+
+ ((GDateBuilder)datespec).normalizeToTimeZone(tdate.getTimeZoneSign(), tdate.getTimeZoneHour(), tdate.getTimeZoneMinute());
+ }
+
+ // compare by field
+ return fieldwiseCompare(tdate, datespec);
+ }
+
+ // different amounts of information (except timezone): not comparable
+ if ((bitdiff & (HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME)) != 0)
+ return 2;
+
+ // The schema spec says we should try to compare with-timezone and
+ // without-timezone specifications... Well, OK, sure, if they say so.
+
+ // We don't have a timezone but the other does: reverse the call
+ if (!tdate.hasTimeZone())
+ {
+ int result = compareGDate(datespec, tdate);
+ return result == 2 ? 2 : -result;
+ }
+
+ // Now tdate is guaranteed to have a timezone and datespec not.
+
+ // To muck with the times, make clones
+ GDateBuilder pdate = new GDateBuilder(tdate);
+
+ // To cover the one uncovered case: if one date is 02/28 and the
+ // other date is 03/01, shift days closer by one to simulate being
+ // the last day of the month within a leap year
+ if ((tdate.getFlags() & (HAS_YEAR | HAS_MONTH | HAS_DAY)) == (HAS_MONTH | HAS_DAY))
+ {
+ if (tdate.getDay() == 28 && tdate.getMonth() == 2)
+ {
+ if (datespec.getDay() == 01 && datespec.getMonth() == 3)
+ {
+ pdate.setDay(29);
+ }
+ }
+ else if (datespec.getDay() == 28 && datespec.getMonth() == 2)
+ {
+ if (tdate.getDay() == 01 && tdate.getMonth() == 3)
+ {
+ pdate.setMonth(02);
+ pdate.setDay(29);
+ }
+ }
+ }
+
+ // For timespans, compare by first instant of time
+ // possible. Therefore, fill in Midnight, January 1, 1584 (a leap year)
+ // in absence of other information.
+ pdate._setToFirstMoment();
+
+ // P < Q if P < (Q with time zone +14:00)
+ GDateBuilder qplusdate = new GDateBuilder(datespec);
+ qplusdate._setToFirstMoment();
+ qplusdate.setTimeZone(1, 14, 0);
+ qplusdate.normalizeToTimeZone(tdate.getTimeZoneSign(), tdate.getTimeZoneHour(), tdate.getTimeZoneMinute());
+ if (fieldwiseCompare(pdate, qplusdate) == -1)
+ return -1;
+
+ // P > Q if P > (Q with time zone -14:00)
+ GDateBuilder qminusdate = qplusdate;
+ qminusdate.setGDate(datespec);
+ qminusdate._setToFirstMoment();
+ qminusdate.setTimeZone(-1, 14, 0);
+ qminusdate.normalizeToTimeZone(tdate.getTimeZoneSign(), tdate.getTimeZoneHour(), tdate.getTimeZoneMinute());
+ if (fieldwiseCompare(pdate, qminusdate) == 1)
+ return 1;
+
+ // P <> Q otherwise
+ return 2;
+ }
+
+ /**
+ * Does a simple most-significant-digit-first comparison,
+ * ignoring any timezone or has/doesn't have issues.
+ * The data must have been digested first.
+ */
+ private static int fieldwiseCompare(GDateSpecification tdate, GDateSpecification date)
+ {
+ if (tdate.hasYear())
+ {
+ int CY = date.getYear();
+ int TCY = tdate.getYear();
+ if (TCY < CY) return -1;
+ if (TCY > CY) return 1;
+ }
+ if (tdate.hasMonth())
+ {
+ int M = date.getMonth();
+ int TM = tdate.getMonth();
+ if (TM < M) return -1;
+ if (TM > M) return 1;
+ }
+ if (tdate.hasDay())
+ {
+ int D = date.getDay();
+ int TD = tdate.getDay();
+ if (TD < D) return -1;
+ if (TD > D) return 1;
+ }
+ if (tdate.hasTime())
+ {
+ int h = date.getHour();
+ int th = tdate.getHour();
+ if (th < h) return -1;
+ if (th > h) return 1;
+ int m = date.getMinute();
+ int tm = tdate.getMinute();
+ if (tm < m) return -1;
+ if (tm > m) return 1;
+ int s = date.getSecond();
+ int ts = tdate.getSecond();
+ if (ts < s) return -1;
+ if (ts > s) return 1;
+ BigDecimal fs = date.getFraction();
+ BigDecimal tfs = tdate.getFraction();
+ if (tfs == null && fs == null) return 0;
+ return (tfs == null ? GDate._zero : tfs).compareTo(fs == null ? GDate._zero : fs);
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns the builtin type code for the shape of the information
+ * contained in this instance, or 0 if the
+ * instance doesn't contain information corresponding to a
+ * Schema type.
+ * <p>
+ * Value will be equal to
+ * {@link SchemaType#BTC_NOT_BUILTIN},
+ * {@link SchemaType#BTC_G_YEAR},
+ * {@link SchemaType#BTC_G_YEAR_MONTH},
+ * {@link SchemaType#BTC_G_MONTH},
+ * {@link SchemaType#BTC_G_MONTH_DAY},
+ * {@link SchemaType#BTC_G_DAY},
+ * {@link SchemaType#BTC_DATE},
+ * {@link SchemaType#BTC_DATE_TIME}, or
+ * {@link SchemaType#BTC_TIME}.
+ */
+ public final int getBuiltinTypeCode()
+ {
+ return btcForFlags(_bits);
+ }
+
+ /* package */ static int btcForFlags(int flags)
+ {
+ switch (flags & (HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME))
+ {
+ case HAS_YEAR:
+ return SchemaType.BTC_G_YEAR;
+ case HAS_YEAR | HAS_MONTH:
+ return SchemaType.BTC_G_YEAR_MONTH;
+ case HAS_MONTH:
+ return SchemaType.BTC_G_MONTH;
+ case HAS_MONTH | HAS_DAY:
+ return SchemaType.BTC_G_MONTH_DAY;
+ case HAS_DAY:
+ return SchemaType.BTC_G_DAY;
+ case HAS_YEAR | HAS_MONTH | HAS_DAY:
+ return SchemaType.BTC_DATE;
+ case HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME:
+ return SchemaType.BTC_DATE_TIME;
+ case HAS_TIME:
+ return SchemaType.BTC_TIME;
+ default:
+ return SchemaType.BTC_NOT_BUILTIN;
+ }
+ }
+
+ /**
+ * Clears the fields in this GDateBuilder that are not applicable
+ * for the given SchemaType date code. The code should be
+ * {@link SchemaType#BTC_G_YEAR},
+ * {@link SchemaType#BTC_G_YEAR_MONTH},
+ * {@link SchemaType#BTC_G_MONTH},
+ * {@link SchemaType#BTC_G_MONTH_DAY},
+ * {@link SchemaType#BTC_G_DAY},
+ * {@link SchemaType#BTC_DATE},
+ * {@link SchemaType#BTC_DATE_TIME}, or
+ * {@link SchemaType#BTC_TIME}.
+ *
+ * @param typeCode the type code to apply
+ */
+ public void setBuiltinTypeCode(int typeCode)
+ {
+ switch (typeCode)
+ {
+ case SchemaType.BTC_G_YEAR:
+ //HAS_YEAR
+ clearMonth();
+ clearDay();
+ clearTime();
+ return;
+ case SchemaType.BTC_G_YEAR_MONTH:
+ //HAS_YEAR | HAS_MONTH
+ clearDay();
+ clearTime();
+ return;
+ case SchemaType.BTC_G_MONTH:
+ //HAS_MONTH
+ clearYear();
+ clearDay();
+ clearTime();
+ return;
+ case SchemaType.BTC_G_MONTH_DAY:
+ //HAS_MONTH | HAS_DAY
+ clearYear();
+ clearTime();
+ return;
+ case SchemaType.BTC_G_DAY:
+ //HAS_DAY
+ clearYear();
+ clearMonth();
+ clearTime();
+ return;
+ case SchemaType.BTC_DATE:
+ //HAS_YEAR | HAS_MONTH | HAS_DAY
+ clearTime();
+ return;
+ case SchemaType.BTC_DATE_TIME:
+ //HAS_YEAR | HAS_MONTH | HAS_DAY | HAS_TIME
+ return;
+ case SchemaType.BTC_TIME:
+ //HAS_TIME
+ clearYear();
+ clearMonth();
+ clearDay();
+ return;
+ default:
+ throw new IllegalArgumentException("codeType must be one of SchemaType BTC_ DATE TIME related types.");
+ }
+ }
+
+
+ /* package */ static final BigInteger TEN = BigInteger.valueOf(10);
+
+ /**
+ * The canonical string representation. Specific moments or
+ * times-of-day in a specified timezone are normalized to
+ * UTC time to produce a canonical string form for them.
+ * Other recurring time specifications keep their timezone
+ * information.
+ */
+ public String canonicalString()
+ {
+ boolean needNormalize =
+ (hasTimeZone() && getTimeZoneSign() != 0 && hasTime() &&
+ ((hasDay() == hasMonth() && hasDay() == hasYear())));
+
+ if (!needNormalize && getFraction().scale() > 0)
+ {
+ BigInteger bi = getFraction().unscaledValue();
+ needNormalize = (bi.mod(TEN).signum() == 0);
+ }
+
+ if (!needNormalize)
+ return toString();
+
+ GDateBuilder cdate = new GDateBuilder(this);
+ cdate.normalize();
+ return cdate.toString();
+ }
+
+ /**
+ * The natural string representation. This represents the information
+ * that is available, including timezone. For types that correspond
+ * to defined schema types (schemaBuiltinTypeCode() > 0),
+ * this provides the natural lexical representation.
+ * <p>
+ * When both time and timezone are specified, this string is not
+ * the canonical representation unless the timezone is UTC (Z)
+ * (since the same moment in time can be expressed in different
+ * timezones). To get a canonical string, use the canonicalString()
+ * method.
+ */
+ public final String toString()
+ {
+ return GDate.formatGDate(this);
+ }
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDateSpecification.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDateSpecification.java
new file mode 100644
index 0000000..5caf61e
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDateSpecification.java
@@ -0,0 +1,239 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * Represents an XML Schema-compatible Gregorian date.
+ * <p>
+ * Both the immutable GDate and the mutable GDateBuilder are
+ * GDateSpecifications. Use this interface where you want to
+ * allow callers to pass any implementation of a GDate.
+ *
+ * @see GDate
+ * @see XmlCalendar
+ */
+public interface GDateSpecification
+{
+ /**
+ * Returns a combination of flags indicating the information
+ * contained by this GDate. The five flags are
+ * {@link #HAS_TIMEZONE}, {@link #HAS_YEAR}, {@link #HAS_MONTH},
+ * {@link #HAS_DAY}, and {@link #HAS_TIME}.
+ */
+ int getFlags();
+
+ /** Timezone is specified. See {@link #getFlags}. */
+ public final int HAS_TIMEZONE = 1;
+ /** Year is specified. See {@link #getFlags}. */
+ public final int HAS_YEAR = 2;
+ /** Month of year is specified. See {@link #getFlags}. */
+ public final int HAS_MONTH = 4;
+ /** Day of month is specified. See {@link #getFlags}. */
+ public final int HAS_DAY = 8;
+ /** Time of day is specified. See {@link #getFlags}. */
+ public final int HAS_TIME = 16;
+
+ /**
+ * True if this GDate specification is immutable. GDate returns true,
+ * and GDateBuilder returns false.
+ */
+ boolean isImmutable();
+
+ /**
+ * True if this GDate corresponds to a valid gregorian date value
+ * in XML schema.
+ */
+ boolean isValid();
+
+ /**
+ * True if this date/time specification specifies a timezone.
+ */
+ boolean hasTimeZone();
+
+ /**
+ * True if this date/time specification specifies a year.
+ */
+ boolean hasYear();
+
+ /**
+ * True if this date/time specification specifies a month-of-year.
+ */
+ boolean hasMonth();
+
+ /**
+ * True if this date/time specification specifies a day-of-month.
+ */
+ boolean hasDay();
+
+ /**
+ * True if this date/time specification specifies a time-of-day.
+ */
+ boolean hasTime();
+
+ /**
+ * True if this date/time specification specifies a full date (year, month, day)
+ */
+ boolean hasDate();
+
+ /**
+ * Gets the year. Should be a four-digit year specification.
+ */
+ int getYear();
+
+ /**
+ * Gets the month-of-year. January is 1.
+ */
+ int getMonth();
+
+ /**
+ * Gets the day-of-month. The first day of each month is 1.
+ */
+ int getDay();
+
+ /**
+ * Gets the hour-of-day. Midnight is 0, and 11PM is 23.
+ */
+ int getHour();
+
+ /**
+ * Gets the minute-of-hour. Range from 0 to 59.
+ */
+ int getMinute();
+
+ /**
+ * Gets the second-of-minute. Range from 0 to 59.
+ */
+ int getSecond();
+
+ /**
+ * Gets the time zone sign. For time zones east of GMT,
+ * this is positive; for time zones west, this is negative.
+ */
+ int getTimeZoneSign();
+
+ /**
+ * Gets the time zone hour.
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ int getTimeZoneHour();
+
+ /**
+ * Gets the time zone minutes.
+ * This is always positive: for the sign, look at
+ * getTimeZoneSign().
+ */
+ int getTimeZoneMinute();
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ BigDecimal getFraction();
+
+ /**
+ * Gets the rounded millisecond value. Range from 0 to 999
+ */
+ int getMillisecond();
+
+ /**
+ * Returns the Julian date corresponding to this Gregorian date.
+ * The Julian date (JD) is a continuous count of days from
+ * 1 January 4713 BC (= -4712 January 1).
+ */
+ int getJulianDate();
+
+ /**
+ * Retrieves the value of the current time as an {@link XmlCalendar}.
+ * <p>
+ * {@link XmlCalendar} is a subclass of {@link java.util.GregorianCalendar}
+ * which is slightly customized to match XML schema date rules.
+ * <p>
+ * The returned {@link XmlCalendar} has only those time and date fields
+ * set that are reflected in the GDate object. Because of the way the
+ * {@link java.util.Calendar} contract works, any information in the isSet() vanishes
+ * as soon as you view any unset field using get() methods.
+ * This means that if it is important to understand which date fields
+ * are set, you must call isSet() first before get().
+ */
+ XmlCalendar getCalendar();
+
+ /**
+ * Retrieves the value of the current time as a java.util.Date
+ * instance.
+ */
+ Date getDate();
+
+ /**
+ * Comparison to another GDate.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ *
+ * @param gdatespec the date to compare against.
+ */
+ int compareToGDate(GDateSpecification gdatespec);
+
+ /**
+ * Returns the builtin type code for the shape of the information
+ * contained in this instance, or 0 if the
+ * instance doesn't contain information corresponding to a
+ * Schema type.
+ * <p>
+ * Value will be equal to
+ * {@link SchemaType#BTC_NOT_BUILTIN},
+ * {@link SchemaType#BTC_G_YEAR},
+ * {@link SchemaType#BTC_G_YEAR_MONTH},
+ * {@link SchemaType#BTC_G_MONTH},
+ * {@link SchemaType#BTC_G_MONTH_DAY},
+ * {@link SchemaType#BTC_G_DAY},
+ * {@link SchemaType#BTC_DATE},
+ * {@link SchemaType#BTC_DATE_TIME}, or
+ * {@link SchemaType#BTC_TIME}.
+ */
+ int getBuiltinTypeCode();
+
+ /**
+ * The canonical string representation. Specific moments or
+ * times-of-day in a specified timezone are normalized to
+ * UTC time to produce a canonical string form for them.
+ * Other recurring time specifications keep their timezone
+ * information.
+ */
+ String canonicalString();
+
+ /**
+ * The natural string representation. This represents the information
+ * that is available, including timezone. For types that correspond
+ * to defined schema types (schemaBuiltinTypeCode() > 0),
+ * this provides the natural lexical representation.
+ *
+ * When both time and timezone are specified, this string is not
+ * the canonical representation unless the timezone is UTC (Z)
+ * (since the same moment in time can be expressed in different
+ * timezones). To get a canonical string, use the canonicalString()
+ * method.
+ */
+ String toString();
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDuration.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDuration.java
new file mode 100644
index 0000000..2e2094d
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDuration.java
@@ -0,0 +1,424 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+
+/**
+ * Represents an XML Schema-compatible duration.
+ * <p>
+ * A duration is made up of a number of years, months, days, hours,
+ * minutes, seconds, and fractions of seconds. See the
+ * XML Schema specification
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#duration">section on xs:duration</a>
+ * for details on the rules for
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#duration-order">comparing durations</a> and
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#adding-durations-to-dateTimes">adding durations to dates</a>.
+ */
+public final class GDuration implements GDurationSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private int _sign;
+ private int _CY;
+ private int _M;
+ private int _D;
+ private int _h;
+ private int _m;
+ private int _s;
+ private BigDecimal _fs;
+
+ /**
+ * Constructs an empty GDuration representing zero seconds.
+ */
+ public GDuration()
+ {
+ _sign = +1;
+ }
+
+ private static final int SEEN_NOTHING = 0;
+ private static final int SEEN_YEAR = 1;
+ private static final int SEEN_MONTH = 2;
+ private static final int SEEN_DAY = 3;
+ private static final int SEEN_HOUR = 4;
+ private static final int SEEN_MINUTE = 5;
+ private static final int SEEN_SECOND = 6;
+
+ /**
+ * Constructs a GDuration from a lexical
+ * representation. The lexical space contains the
+ * union of the lexical spaces of all the schema
+ * date/time types (except for duration).
+ */
+ public GDuration(CharSequence str)
+ {
+ // Form: -PnYnMnDTnHnMnS
+ // (where each n may be preceded by a - for us, and the whole may be -)
+
+ // first trim XML whitespace
+ int len = str.length();
+ int start = 0;
+ while (len > 0 && GDate.isSpace(str.charAt(len - 1)))
+ len -= 1;
+ while (start < len && GDate.isSpace(str.charAt(start)))
+ start += 1;
+
+ _sign = 1;
+ boolean tmark = false;
+
+ if (start < len && str.charAt(start) == '-')
+ {
+ _sign = -1;
+ start += 1;
+ }
+
+ if (start >= len || str.charAt(start) != 'P')
+ throw new IllegalArgumentException("duration must begin with P");
+
+ start += 1;
+
+ int seen = SEEN_NOTHING;
+ _fs = GDate._zero;
+
+ for (;start < len; start += 1)
+ {
+ boolean negval = false;
+ char ch = str.charAt(start);
+ if (ch == 'T')
+ {
+ if (tmark)
+ throw new IllegalArgumentException("duration must have no more than one T'");
+ if (seen > SEEN_DAY)
+ throw new IllegalArgumentException("T in duration must precede time fields");
+ seen = SEEN_DAY;
+ tmark = true;
+ start += 1;
+ if (start >= len)
+ throw new IllegalArgumentException("illegal duration");
+ ch = str.charAt(start);
+ }
+ if (ch == '-')
+ {
+ negval = true;
+ if (start == len)
+ throw new IllegalArgumentException("illegal duration");
+ start += 1;
+ ch = str.charAt(start);
+ }
+ if (!GDate.isDigit(ch))
+ throw new IllegalArgumentException("illegal duration");
+ int value = GDate.digitVal(ch);
+ for (;;)
+ {
+ start += 1;
+ ch = (start < len) ? str.charAt(start) : '\0';
+ if (!GDate.isDigit(ch))
+ break;
+ value = value * 10 + GDate.digitVal(ch);
+ }
+ if (ch == '.')
+ {
+ int i = start;
+ do i += 1;
+ while (i < len && GDate.isDigit(ch = str.charAt(i)));
+ _fs = new BigDecimal(str.subSequence(start, i).toString());
+ if (i >= len || ch != 'S')
+ throw new IllegalArgumentException("illegal duration");
+ start = i;
+ }
+ if (negval)
+ value = -value;
+ switch (seen)
+ {
+ case SEEN_NOTHING:
+ if (ch == 'Y')
+ {
+ seen = SEEN_YEAR;
+ _CY = value;
+ break;
+ } // fallthrough
+ case SEEN_YEAR:
+ if (ch == 'M')
+ {
+ seen = SEEN_MONTH;
+ _M = value;
+ break;
+ } // fallthrough
+ case SEEN_MONTH:
+ if (ch == 'D')
+ {
+ seen = SEEN_DAY;
+ _D = value;
+ break;
+ } // fallthrough
+ case SEEN_DAY:
+ if (ch == 'H')
+ {
+ if (!tmark)
+ throw new IllegalArgumentException("time in duration must follow T");
+ seen = SEEN_HOUR;
+ _h = value;
+ break;
+ } // fallthrough
+ case SEEN_HOUR:
+ if (ch == 'M')
+ {
+ if (!tmark)
+ throw new IllegalArgumentException("time in duration must follow T");
+ seen = SEEN_MINUTE;
+ _m = value;
+ break;
+ } // fallthrough
+ case SEEN_MINUTE:
+ if (ch == 'S')
+ {
+ if (!tmark)
+ throw new IllegalArgumentException("time in duration must follow T");
+ seen = SEEN_SECOND;
+ _s = value;
+ break;
+ } // fallthrough
+ default:
+ throw new IllegalArgumentException("duration must specify Y M D T H M S in order");
+ }
+ }
+ }
+
+ /**
+ * Constructs a GDuration with the specified sign,
+ * year, month, day, hours, minutes, seconds, and optional
+ * fractional seconds.
+ */
+ public GDuration(
+ int sign,
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction)
+ {
+ if (sign != 1 && sign != -1)
+ throw new IllegalArgumentException();
+ _sign = sign;
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? GDate._zero : fraction;
+ }
+
+ /**
+ * Constructs a GDuration from another GDurationSpecification.
+ */
+ public GDuration(GDurationSpecification gDuration)
+ {
+ _sign = gDuration.getSign();
+ _CY = gDuration.getYear();
+ _M = gDuration.getMonth();
+ _D = gDuration.getDay();
+ _h = gDuration.getHour();
+ _m = gDuration.getMinute();
+ _s = gDuration.getSecond();
+ _fs = gDuration.getFraction();
+ }
+
+ /**
+ * Builds another GDate with the same value
+ * as this one.
+ */
+ public Object clone()
+ {
+ return new GDuration(this);
+ }
+
+ /**
+ * All GDuration instances return true.
+ */
+ public final boolean isImmutable()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the sign of the duration: +1 is forwards
+ * and -1 is backwards in time.
+ */
+ public final int getSign()
+ { return _sign; }
+
+ /**
+ * Gets the year component.
+ */
+ public final int getYear()
+ { return _CY; }
+
+ /**
+ * Gets the month-of-year component.
+ */
+ public final int getMonth()
+ { return _M; }
+
+ /**
+ * Gets the day-of-month component.
+ */
+ public final int getDay()
+ { return _D; }
+
+ /**
+ * Gets the hour-of-day component.
+ */
+ public final int getHour()
+ { return _h; }
+
+ /**
+ * Gets the minute-of-hour component.
+ */
+ public final int getMinute()
+ { return _m; }
+
+ /**
+ * Gets the second-of-minute component.
+ */
+ public final int getSecond()
+ { return _s; }
+
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ public BigDecimal getFraction()
+ { return _fs; }
+
+ /**
+ * Returns true if all of the individual components
+ * of the duration are nonnegative.
+ */
+ public boolean isValid()
+ {
+ return GDurationBuilder.isValidDuration(this);
+ }
+
+ /**
+ * Comparison to another GDuration.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ */
+ public final int compareToGDuration(GDurationSpecification duration)
+ {
+ return GDurationBuilder.compareDurations(this, duration);
+ }
+
+ /**
+ * The natural string representation of the duration.
+ * <p>
+ * Any components that are zero are omitted. Note that if the duration
+ * is invalid, i.e., it has negative components, those negative
+ * components are serialized out here. To check for validity, use
+ * the isValid() method; and to normalize most durations to a valid
+ * form use the normalize() method.
+ */
+ public String toString()
+ {
+ return GDurationBuilder.formatDuration(this);
+ }
+
+ /**
+ * Returns a new GDuration which is the sum of this one and the
+ * supplied duration. Does a fieldwise addition, with no normalization.
+ */
+ public GDuration add(GDurationSpecification duration)
+ {
+ int sign = _sign * duration.getSign();
+ return _add(duration, sign);
+ }
+
+ /**
+ * Returns a new GDuration which is the result of subtracting
+ * the supplied duration from this one. Does a fieldwise
+ * subtraction, with no normalization.
+ */
+ public GDuration subtract(GDurationSpecification duration)
+ {
+ int sign = -_sign * duration.getSign();
+ return _add(duration, sign);
+ }
+
+ private GDuration _add(GDurationSpecification duration, int sign)
+ {
+ GDuration result = new GDuration(this);
+ result._CY += sign * duration.getYear();
+ result._M += sign * duration.getMonth();
+ result._D += sign * duration.getDay();
+ result._h += sign * duration.getHour();
+ result._m += sign * duration.getMinute();
+ result._s += sign * duration.getSecond();
+
+ if (duration.getFraction().signum() == 0)
+ return result;
+
+ if (result._fs.signum() == 0 && sign == 1)
+ result._fs = duration.getFraction();
+ else
+ result._fs = sign > 0 ?
+ result._fs.add(duration.getFraction()) :
+ result._fs.subtract(duration.getFraction());
+ return result;
+ }
+
+ /**
+ * Two GDurations are equal if all their fields are equal.
+ * The equals function does not apply normalizatin.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (!(obj instanceof GDuration))
+ return false;
+
+ GDuration duration = (GDuration)obj;
+ return (_sign == duration.getSign() &&
+ _CY == duration.getYear() &&
+ _M == duration.getMonth() &&
+ _D == duration.getDay() &&
+ _h == duration.getHour() &&
+ _m == duration.getMinute() &&
+ _s == duration.getSecond() &&
+ _fs.equals(duration.getFraction()));
+ }
+
+ public int hashCode()
+ {
+ return (_s +
+ _m * (60 + 7) +
+ _h * (60 * 60 + 7) +
+ _D * (60 * 60 * 24 + 7) +
+ _M * (60 * 60 * 24 * 31 + 7) +
+ _CY *(60 * 60 * 24 * 372 + 7) +
+ _sign * 11917049);
+ }
+
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java
new file mode 100644
index 0000000..fc0e4df
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java
@@ -0,0 +1,594 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+
+/**
+ * Used to build {@link GDuration GDurations}.
+ */
+public class GDurationBuilder implements GDurationSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private int _sign;
+ private int _CY;
+ private int _M;
+ private int _D;
+ private int _h;
+ private int _m;
+ private int _s;
+ private BigDecimal _fs;
+
+ /**
+ * Constructs an empty GDurationBuilder representing zero seconds.
+ */
+ public GDurationBuilder()
+ {
+ _sign = +1;
+ _fs = GDate._zero;
+ }
+
+ /**
+ * Constructs a GDuration from a lexical
+ * representation.
+ */
+ public GDurationBuilder(String s)
+ {
+ this(new GDuration(s));
+ }
+
+ /**
+ * Constructs a GDurationBuilder with the specified sign,
+ * year, month, day, hours, minutes, seconds, and optional
+ * fractional seconds.
+ */
+ public GDurationBuilder(
+ int sign,
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction)
+ {
+ if (sign != 1 && sign != -1)
+ throw new IllegalArgumentException();
+ _sign = sign;
+ _CY = year;
+ _M = month;
+ _D = day;
+ _h = hour;
+ _m = minute;
+ _s = second;
+ _fs = fraction == null ? GDate._zero : fraction;
+ }
+
+ /**
+ * Constructs a GDurationBuilder from another GDurationBuilderSpecification.
+ */
+ public GDurationBuilder(GDurationSpecification gDuration)
+ {
+ _sign = gDuration.getSign();
+ _CY = gDuration.getYear();
+ _M = gDuration.getMonth();
+ _D = gDuration.getDay();
+ _h = gDuration.getHour();
+ _m = gDuration.getMinute();
+ _s = gDuration.getSecond();
+ _fs = gDuration.getFraction();
+ }
+
+ /**
+ * Builds another GDurationBuilder with the same value
+ * as this one.
+ */
+ public Object clone()
+ {
+ return new GDurationBuilder(this);
+ }
+
+ /**
+ * Builds a GDuration from this GDurationBuilder.
+ */
+ public GDuration toGDuration()
+ {
+ return new GDuration(this);
+ }
+
+ /**
+ * Adds to this duration. Does a fieldwise add, with no
+ * normalization.
+ */
+ public void addGDuration(GDurationSpecification duration)
+ {
+ int sign = _sign * duration.getSign();
+ _add(duration, sign);
+ }
+
+ /**
+ * Subtracts from this duration. Does a fieldwise subtraction,
+ * with no normalization.
+ */
+ public void subtractGDuration(GDurationSpecification duration)
+ {
+ int sign = -_sign * duration.getSign();
+ _add(duration, sign);
+ }
+
+ private void _add(GDurationSpecification duration, int sign)
+ {
+ _CY += sign * duration.getYear();
+ _M += sign * duration.getMonth();
+ _D += sign * duration.getDay();
+ _h += sign * duration.getHour();
+ _m += sign * duration.getMinute();
+ _s += sign * duration.getSecond();
+
+ if (duration.getFraction().signum() == 0)
+ return;
+
+ if (_fs.signum() == 0 && sign == 1)
+ _fs = duration.getFraction();
+ else
+ _fs = sign > 0 ?
+ _fs.add(duration.getFraction()) :
+ _fs.subtract(duration.getFraction());
+ }
+
+ /**
+ * Sets the sign.
+ */
+ public final void setSign(int sign)
+ {
+ if (sign != 1 && sign != -1)
+ throw new IllegalArgumentException();
+ _sign = sign;
+ }
+
+ /**
+ * Sets the year component.
+ */
+ public void setYear(int year)
+ { _CY = year; }
+
+ /**
+ * Sets the month component.
+ */
+ public void setMonth(int month)
+ { _M = month; }
+
+ /**
+ * Sets the day component.
+ */
+ public void setDay(int day)
+ { _D = day; }
+
+ /**
+ * Sets the hour component.
+ */
+ public void setHour(int hour)
+ { _h = hour; }
+
+ /**
+ * Sets the minute component.
+ */
+ public void setMinute(int minute)
+ { _m = minute; }
+
+ /**
+ * Sets the second component.
+ */
+ public void setSecond(int second)
+ { _s = second; }
+
+ /**
+ * Sets the fraction-of-second component.
+ */
+ public void setFraction(BigDecimal fraction)
+ { _fs = fraction == null ? GDate._zero : fraction; }
+
+ /**
+ * All GDuration instances return true.
+ */
+ public final boolean isImmutable()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the sign of the duration: +1 is forwards
+ * and -1 is backwards in time.
+ * This value does not necessarily reflect the
+ * true direction of the duration if the duration
+ * is not normalized or not normalizable.
+ */
+ public final int getSign()
+ { return _sign; }
+
+ /**
+ * Gets the year component.
+ */
+ public final int getYear()
+ { return _CY; }
+
+ /**
+ * Gets the month-of-year component.
+ */
+ public final int getMonth()
+ { return _M; }
+
+ /**
+ * Gets the day-of-month component.
+ */
+ public final int getDay()
+ { return _D; }
+
+ /**
+ * Gets the hour-of-day component.
+ */
+ public final int getHour()
+ { return _h; }
+
+ /**
+ * Gets the minute-of-hour component.
+ */
+ public final int getMinute()
+ { return _m; }
+
+ /**
+ * Gets the second-of-minute component.
+ */
+ public final int getSecond()
+ { return _s; }
+
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ public BigDecimal getFraction()
+ { return _fs; }
+
+ /**
+ * Returns true if all of the individual components
+ * of the duration are nonnegative.
+ */
+ public boolean isValid()
+ {
+ return GDurationBuilder.isValidDuration(this);
+ }
+
+
+ /**
+ * Normalize a duration value. This ensures that months,
+ * hours, minutes, seconds, and fractions are positive and
+ * within the ranges 0..11, 0..23, 0..59, etc. Negative
+ * durations are indicated by a negative sign rather
+ * than negative components.
+ * <p>
+ * Most duration specifications can be normalized to
+ * valid durations with all positive components, but
+ * not all of them can.
+ * <p>
+ * The only situations which cannot be normalized are
+ * where the year/month and the day/hour/minute/second
+ * offsets are of opposite sign. Days cannot be carried
+ * into months since the length of a Gregorian month is
+ * variable depending on when the duration is applied.
+ * In these cases, this method normalizes the components
+ * so that "day" is the only negative component.
+ */
+ public void normalize()
+ {
+ _normalizeImpl(true);
+ }
+
+ /**
+ * fQuotient(a, b) = the greatest integer less than or equal to a/b
+ */
+ private static final long _fQuotient(long a, int b)
+ {
+ if ((a < 0) == (b < 0))
+ return a / b;
+
+ return -((b - a - 1) / b);
+ }
+
+ /**
+ * modulo(a, b) = a - fQuotient(a,b)*b
+ */
+ private static final int _mod(long a, int b, long quotient)
+ {
+ return (int)(a - quotient*b) ;
+ }
+
+
+ /**
+ * Private implemenation of normalize. The flag is
+ * to facilitate this method calling itself without
+ * danger of infinite recursion.
+ */
+ private void _normalizeImpl(boolean adjustSign)
+ {
+ long temp;
+
+ // months to years
+ if (_M < 0 || _M > 11)
+ {
+ temp = _M;
+ long ycarry = _fQuotient(temp, 12);
+ _M = _mod(temp, 12, ycarry);
+ _CY += ycarry;
+ }
+
+ long carry = 0;
+
+ // fractions to seconds
+ if (_fs != null && (_fs.signum() < 0 || _fs.compareTo(GDate._one) >= 0))
+ {
+ BigDecimal bdcarry = _fs.setScale(0, BigDecimal.ROUND_FLOOR);
+ _fs = _fs.subtract(bdcarry);
+ carry = bdcarry.intValue();
+ }
+
+ if (carry != 0 || _s < 0 || _s > 59 || _m < 0 || _m > 50 || _h < 0 || _h > 23)
+ {
+ // seconds
+ temp = _s + carry;
+ carry = _fQuotient(temp, 60);
+ _s = _mod(temp, 60, carry);
+
+ // minutes
+ temp = _m + carry;
+ carry = _fQuotient(temp, 60);
+ _m = _mod(temp, 60, carry);
+
+ // hours
+ temp = _h + carry;
+ carry = _fQuotient(temp, 24);
+ _h = _mod(temp, 24, carry);
+ _D += carry;
+ }
+
+ if (_CY == 0 && _M == 0 && _D == 0 && _h == 0 && _m == 0 && _s == 0 && (_fs == null || _fs.signum() == 0))
+ _sign = 1;
+
+ if (adjustSign && (_D < 0 || _CY < 0))
+ {
+ int sign = (_D <= 0 && (_CY < 0 || _CY == 0 && _M == 0)) ? -_sign : _getTotalSignSlowly();
+ if (sign == 2)
+ sign = (_CY < 0) ? -_sign : _sign;
+ if (sign == 0)
+ sign = 1;
+ if (sign != _sign)
+ {
+ _sign = sign;
+ _CY = -_CY;
+ _M = -_M;
+ _D = -_D;
+ _h = -_h;
+ _m = -_m;
+ _s = -_s;
+ if (_fs != null)
+ _fs = _fs.negate();
+ }
+ _normalizeImpl(false);
+ }
+ }
+
+
+ /* package */ static boolean isValidDuration(GDurationSpecification spec)
+ {
+ if (!(spec.getSign() == 1 || spec.getSign() == -1))
+ return false;
+
+ return (spec.getYear() >= 0 && spec.getMonth() >= 0 && spec.getDay() >= 0 &&
+ spec.getHour() >= 0 && spec.getMinute() >= 0 && spec.getSecond() >= 0 &&
+ spec.getFraction().signum() >= 0);
+ }
+
+ /**
+ * Comparison to another GDuration.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ */
+ public final int compareToGDuration(GDurationSpecification duration)
+ {
+ return GDurationBuilder.compareDurations(this, duration);
+ }
+
+ /**
+ * The natural string representation of the duration.
+ * <p>
+ * Any components that are zero are omitted. Note that if the duration
+ * is invalid, i.e., it has negative components, those negative
+ * components are serialized out here. To check for validity, use
+ * the isValid() method; and to normalize most durations to a valid
+ * form use the normalize() method.
+ */
+ public String toString()
+ {
+ return GDurationBuilder.formatDuration(this);
+ }
+
+ /* package */ static int compareDurations(GDurationSpecification d1, GDurationSpecification d2)
+ {
+ // first do an all-fields check
+ if (d1.getFraction().signum() == 0 && d2.getFraction().signum() == 0)
+ {
+ int s1 = d1.getSign();
+ int s2 = d2.getSign();
+ long month1 = s1 * ((long)d1.getYear() * 12 + d1.getMonth());
+ long month2 = s2 * ((long)d2.getYear() * 12 + d2.getMonth());
+ long sec1 = s1 * ((((long)d1.getDay() * 24 + d1.getHour()) * 60 + d1.getMinute()) * 60 + d1.getSecond());
+ long sec2 = s2 * ((((long)d2.getDay() * 24 + d2.getHour()) * 60 + d2.getMinute()) * 60 + d2.getSecond());
+ if (month1 == month2)
+ {
+ if (sec1 == sec2)
+ return 0;
+ if (sec1 < sec2)
+ return -1;
+ if (sec1 > sec2)
+ return 1;
+ }
+ if (month1 < month2 && sec1 - sec2 < 28 * 24 * 60 * 60)
+ return -1;
+ if (month1 > month2 && sec2 - sec1 < 28 * 24 * 60 * 60)
+ return 1;
+ }
+
+ // the answer isn't obvious, so then do a total-sign check
+ GDurationBuilder diff = new GDurationBuilder(d1);
+ diff.subtractGDuration(d2);
+ return diff._getTotalSignSlowly();
+ }
+
+ /**
+ * Per schema spec, comparison of durations is simply done
+ * by calculating adding the duration to these four dates and
+ * comparing the results. If the results are ambiguous, the
+ * answer is "incomparable".
+ */
+ private static final GDate[] _compDate = new GDate[]
+ {
+ new GDate(1696, 9, 1, 0, 0, 0, null, 0, 0, 0),
+ new GDate(1697, 2, 1, 0, 0, 0, null, 0, 0, 0),
+ new GDate(1903, 3, 1, 0, 0, 0, null, 0, 0, 0),
+ new GDate(1903, 7, 1, 0, 0, 0, null, 0, 0, 0)
+ };
+
+
+ /**
+ * This returns the total sign of the duration, +1
+ * if the duration moves forward in time, -1 if the
+ * duration moves backwards in time, 0 if the duration
+ * is zero-length, and 2 if the duration may be positive
+ * or negative depending on the date.
+ *
+ * (For example, one month minus 30 days is indeterminate).
+ */
+ private int _getTotalSignSlowly()
+ {
+ int pos = 0;
+ int neg = 0;
+ int zer = 0;
+
+ GDateBuilder enddate = new GDateBuilder();
+ for (int i = 0; i < _compDate.length; i++)
+ {
+ enddate.setGDate(_compDate[i]);
+ enddate.addGDuration(this);
+ switch (enddate.compareToGDate(_compDate[i]))
+ {
+ case -1:
+ neg++; break;
+ case 0:
+ zer++; break;
+ case 1:
+ pos++; break;
+ }
+ }
+
+ if (pos == _compDate.length)
+ return +1;
+ if (neg == _compDate.length)
+ return -1;
+ if (zer == _compDate.length)
+ return 0;
+ return 2;
+ }
+
+ /* package */ static String formatDuration(GDurationSpecification duration)
+ {
+ // Sign+P: (-)?P
+ // Year: (?:(\d+)Y)?
+ // Month: (?:(\d+)M)?
+ // Day: (?:(\d+)D)?
+ // Time: (?:(T)
+ // Hours: (?:(\d+)H)?
+ // Minutes: (?:(\d+)M)?
+ // Seconds: (?:(\d+(?:\.\d*)?|(?:.\d+)S)?
+
+ StringBuffer message = new StringBuffer(30);
+
+ if (duration.getSign() < 0)
+ message.append('-');
+
+ message.append('P');
+
+ if (duration.getYear() != 0)
+ {
+ message.append(duration.getYear());
+ message.append('Y');
+ }
+
+ if (duration.getMonth() != 0)
+ {
+ message.append(duration.getMonth());
+ message.append('M');
+ }
+
+ if (duration.getDay() != 0)
+ {
+ message.append(duration.getDay());
+ message.append('D');
+ }
+
+ if (duration.getHour() != 0 || duration.getMinute() != 0 || duration.getSecond() != 0 ||
+ (duration.getFraction().signum() != 0))
+ {
+ message.append('T');
+ }
+
+ if (duration.getHour() != 0)
+ {
+ message.append(duration.getHour());
+ message.append('H');
+ }
+
+ if (duration.getMinute() != 0)
+ {
+ message.append(duration.getMinute());
+ message.append('M');
+ }
+
+ if (duration.getFraction().signum() != 0)
+ {
+ BigDecimal s = duration.getFraction();
+ if (duration.getSecond() != 0)
+ s = s.add(BigDecimal.valueOf(duration.getSecond()));
+ message.append(s);
+ message.append('S');
+ }
+ else if (duration.getSecond() != 0)
+ {
+ message.append(duration.getSecond());
+ message.append('S');
+ }
+ else if (message.length() <= 2)
+ // Specify zero seconds if everything was 0
+ message.append("T0S");
+
+ return message.toString();
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/GDurationSpecification.java b/v1/src/xmlpublic/org/apache/xmlbeans/GDurationSpecification.java
new file mode 100644
index 0000000..dcc5cff
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/GDurationSpecification.java
@@ -0,0 +1,95 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+
+/**
+ * Represents an XML Schema-compatible duration.
+ * <p>
+ * Both the immutable GDuration and the mutable GDurationBuilder are
+ * GDurationSpecifications. Use this interface where you want to
+ * allow callers to pass any implementation of a GDuration.
+ *
+ * @see GDuration
+ */
+public interface GDurationSpecification
+{
+ /**
+ * True if this instance is immutable.
+ */
+ boolean isImmutable();
+
+ /**
+ * Returns the sign of the duration: +1 is forwards
+ * and -1 is backwards in time.
+ */
+ int getSign();
+
+ /**
+ * Gets the year component.
+ */
+ int getYear();
+
+ /**
+ * Gets the month-of-year component.
+ */
+ int getMonth();
+
+ /**
+ * Gets the day-of-month component.
+ */
+ int getDay();
+
+ /**
+ * Gets the hour-of-day component.
+ */
+ int getHour();
+
+ /**
+ * Gets the minute-of-hour component.
+ */
+ int getMinute();
+
+ /**
+ * Gets the second-of-minute component.
+ */
+ int getSecond();
+
+ /**
+ * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
+ */
+ BigDecimal getFraction();
+
+ /**
+ * Returns true if all of the individual components
+ * of the duration are nonnegative.
+ */
+ boolean isValid();
+
+ /**
+ * Comparison to another GDuration.
+ * <ul>
+ * <li>Returns -1 if this < date. (less-than)
+ * <li>Returns 0 if this == date. (equal)
+ * <li>Returns 1 if this > date. (greater-than)
+ * <li>Returns 2 if this <> date. (incomparable)
+ * </ul>
+ * Two instances are incomparable if they have different amounts
+ * of information.
+ */
+ int compareToGDuration(GDurationSpecification duration);
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/QNameCache.java b/v1/src/xmlpublic/org/apache/xmlbeans/QNameCache.java
new file mode 100644
index 0000000..ad55f59
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/QNameCache.java
@@ -0,0 +1,130 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A cache that can be used to pool QName instances. Each thread has one.
+ */
+public final class QNameCache
+{
+ private static final float DEFAULT_LOAD = 0.70f;
+ private final float loadFactor;
+ private int numEntries = 0;
+ private int threshold;
+ private int hashmask;
+ private QName[] table;
+
+ /**
+ * Creates a QNameCache with the given initialCapacity and loadFactor.
+ *
+ * @param initialCapacity the number of entries to initially make space for
+ * @param loadFactor a number to control the density of the hashtable
+ */
+ public QNameCache(int initialCapacity, float loadFactor)
+ {
+ assert initialCapacity > 0;
+ assert loadFactor > 0 && loadFactor < 1;
+
+ // Find a power of 2 >= initialCapacity
+ int capacity = 16;
+ while (capacity < initialCapacity)
+ capacity <<= 1;
+
+ this.loadFactor = loadFactor;
+ this.hashmask = capacity - 1;
+ threshold = (int)(capacity * loadFactor);
+ table = new QName[capacity];
+ }
+
+ /**
+ * Creates a QNameCache with the given initialCapacity.
+ *
+ * @param initialCapacity the number of entries to initially make space for
+ */
+ public QNameCache(int initialCapacity)
+ {
+ this(initialCapacity, DEFAULT_LOAD);
+ }
+
+ /**
+ * Fetches a QName with the given namespace and localname.
+ * Creates one if one is not found in the cache.
+ *
+ * @param uri the namespace
+ * @param localName the localname
+ * @return the cached QName
+ */
+ public QName getName(String uri, String localName)
+ {
+ /*
+ return new QName(uri, localName);
+ */
+ assert localName != null;
+
+ if (uri == null) uri = "";
+
+ int index = hash(uri, localName) & hashmask;
+ while (true) {
+ QName q = table[index];
+ if (q == null)
+ {
+ numEntries++;
+ if (numEntries >= threshold)
+ rehash();
+
+ return table[index] = new QName(uri, localName);
+ }
+ else if (equals(q, uri, localName))
+ return q;
+ else
+ index = (index-1) & hashmask;
+ }
+ }
+
+ private void rehash()
+ {
+ int newLength = table.length * 2;
+ QName[] newTable = new QName[newLength];
+ int newHashmask = newLength - 1;
+
+ for (int i = 0 ; i < table.length ; i++)
+ {
+ QName q = table[i];
+ if (q != null)
+ {
+ int newIndex = hash(q.getNamespaceURI(), q.getLocalPart()) & newHashmask;
+ while (newTable[newIndex] != null)
+ newIndex = (newIndex - 1) & newHashmask;
+ newTable[newIndex] = q;
+ }
+ }
+
+ table = newTable;
+ hashmask = newHashmask;
+ threshold = (int)(newLength * loadFactor);
+ }
+ private static int hash(String uri, String localName)
+ {
+ return (uri.hashCode() << 5) + localName.hashCode();
+ }
+
+ private static boolean equals(QName q, String uri, String localName)
+ {
+ return q.getLocalPart().equals(localName) && q.getNamespaceURI().equals(uri);
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/QNameSet.java b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSet.java
new file mode 100644
index 0000000..95fc533
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSet.java
@@ -0,0 +1,446 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Collections;
+import java.util.Arrays;
+
+/**
+ * This interface represents a lattice of finite and infinite sets of QNames.
+ * The lattice the minimal one that is closed under union, intersection, and
+ * inverse, and contains individual QNames as well as entire namespaces.
+ * Here is a summary of the two kinds of QNameSets:
+ * <ul>
+ * <li>A QNameSet can cover a finite set of namespaces, additionally including a finite
+ * set of QNames outside those namespaces, and with the exception of
+ * a finite set of QNames excluded from those namespaes:
+ * <ul>
+ * <li>excludedQNamesInIncludedURIs == the set of excluded QNames from coveredURIs namespaces
+ * <li>excludedURIs == null
+ * <li>includedURIs == the set of covered namespace URIs
+ * <li>includedQNamesInExcludedURIs == set of additional QNames outside coveredURIs namespaces
+ * </ul>
+ * </li>
+ * <li>A QNameSet can cover all namespaces except for a finite number of excluded ones,
+ * additionally including a finite set of QNames within the excluded namespaces,
+ * and with the exception of a finite set of QNames outside the excluded namespaces:
+ * <ul>
+ * <li>excludedQNamesInIncludedURIs == the set of excluded QNames outside uncoveredURIs namespaces
+ * <li>excludedURIs == the set of uncovered namespace URIs
+ * <li>includedURIs == null
+ * <li>includedQNamesInExcludedURIs == set of additional QNames from uncoveredURIs namespaces
+ * </ul>
+ * </li>
+ * </ul>
+ * <p>
+ * Notice that a finite set of QNames is a degenerate case of the first
+ * category outlined above:
+ * <ul>
+ * <li>A QnameSet can contain a finite number of QNames:
+ * <ul>
+ * <li>excludedQNamesInIncludedURIs == null
+ * <li>excludedURIs == null
+ * <li>includedURIs == empty set
+ * <li>includedQNamesInExcludedURIs == set of included QNames
+ * </ul>
+ * </li>
+ * </ul>
+ */
+public final class QNameSet implements QNameSetSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private final boolean _inverted;
+ private final Set _includedURIs;
+ private final Set _excludedQNames;
+ private final Set _includedQNames;
+
+ /**
+ * The empty QNameSet.
+ */
+ public static final QNameSet EMPTY = new QNameSet(null, Collections.EMPTY_SET, Collections.EMPTY_SET, Collections.EMPTY_SET);
+
+ /**
+ * The QNameSet containing all QNames.
+ */
+ public static final QNameSet ALL = new QNameSet(Collections.EMPTY_SET, null, Collections.EMPTY_SET, Collections.EMPTY_SET);
+
+ /**
+ * The QNameSet containing all QNames in the local (no-)namespace.
+ */
+ public static final QNameSet LOCAL = new QNameSet(null, Collections.singleton(""), Collections.EMPTY_SET, Collections.EMPTY_SET);
+
+ /**
+ * The QNameSet containing all QNames except for those in the local (no-)namespace.
+ */
+ public static final QNameSet NONLOCAL = new QNameSet(Collections.singleton(""), null, Collections.EMPTY_SET, Collections.EMPTY_SET);
+
+ /**
+ * Private function to minimize object creation when copying sets.
+ */
+ private static Set minSetCopy(Set original)
+ {
+ if (original == null)
+ return null;
+ if (original.isEmpty())
+ return Collections.EMPTY_SET;
+ if (original.size() == 1)
+ return Collections.singleton(original.iterator().next());
+ return new HashSet(original);
+ }
+
+ /**
+ * Returns a QNameSet based on the given sets of excluded URIs,
+ * included URIs, excluded QNames in included namespaces, and included
+ * QNames in excluded namespaces.
+ *
+ * @param excludedURIs the finite set of namespace URI strings to exclude from the set, or null if this set is infinite
+ * @param includedURIs the finite set of namespace URI strings to include in the set, or null if this set is infinite
+ * @param excludedQNamesInIncludedURIs the finite set of exceptional QNames to exclude from the included namespaces
+ * @param excludedQNamesInIncludedURIs the finite set of exceptional QNames to include that are in the excluded namespaces
+ *
+ * @return the constructed QNameSet
+ */
+ public static QNameSet forSets(Set excludedURIs, Set includedURIs, Set excludedQNamesInIncludedURIs, Set includedQNamesInExcludedURIs)
+ {
+ if ((excludedURIs != null) == (includedURIs != null))
+ throw new IllegalArgumentException("Exactly one of excludedURIs and includedURIs must be null");
+
+ if (excludedURIs == null && includedURIs.isEmpty() && includedQNamesInExcludedURIs.isEmpty())
+ return EMPTY;
+ if (includedURIs == null && excludedURIs.isEmpty() && excludedQNamesInIncludedURIs.isEmpty())
+ return ALL;
+ if (excludedURIs == null && includedURIs.size() == 1 && includedURIs.contains("") &&
+ includedQNamesInExcludedURIs.isEmpty() && excludedQNamesInIncludedURIs.isEmpty())
+ return LOCAL;
+ if (includedURIs == null && excludedURIs.size() == 1 && excludedURIs.contains("") &&
+ excludedQNamesInIncludedURIs.isEmpty() && includedQNamesInExcludedURIs.isEmpty())
+ return NONLOCAL;
+
+ return new QNameSet(
+ minSetCopy(excludedURIs),
+ minSetCopy(includedURIs),
+ minSetCopy(excludedQNamesInIncludedURIs),
+ minSetCopy(includedQNamesInExcludedURIs));
+ }
+
+ /**
+ * Returns a QNameSet based on the given array of included QNames
+ *
+ * @param includedQNames the array of included QNames
+ */
+ public static QNameSet forArray(QName[] includedQNames)
+ {
+ if (includedQNames == null)
+ throw new IllegalArgumentException("includedQNames cannot be null");
+
+ return new QNameSet(null, new HashSet(), null, new HashSet(Arrays.asList(includedQNames)));
+ }
+
+ /**
+ * Returns a QNameSet with the same contents as the given
+ * QNameSetSpecification.
+ * @return the copied QNameSet
+ */
+ public static QNameSet forSpecification(QNameSetSpecification spec)
+ {
+ if (spec instanceof QNameSet)
+ return (QNameSet)spec;
+ return QNameSet.forSets(spec.excludedURIs(), spec.includedURIs(), spec.excludedQNamesInIncludedURIs(), spec.includedQNamesInExcludedURIs());
+ }
+
+ /**
+ * Returns a QNameSet corresponding to the given wildcard namespace string.
+ * This is a space-separated list of URIs, plus special tokens as specified
+ * in the XML Schema specification (##any, ##other, ##targetNamespace, ##local).
+ * @return the constructed QNameSet
+ */
+ public static QNameSet forWildcardNamespaceString(String wildcard, String targetURI)
+ {
+ return QNameSet.forSpecification(new QNameSetBuilder(wildcard, targetURI));
+ }
+
+ /**
+ * Returns a QNameSet containing only the given QName.
+ * @return the constructed QNameSet
+ */
+ public static QNameSet singleton(QName name)
+ {
+ return new QNameSet(null, Collections.EMPTY_SET, Collections.EMPTY_SET, Collections.singleton(name));
+ }
+
+
+ /**
+ * Constructs a QNameSetBuilder whose contents are given by
+ * the four sets.
+ *
+ * This constuctor is PRIVATE because it uses the given
+ * sets directly, and it trusts its callers to set only immutable values.
+ * This constructor is is only called by the static builder methods on
+ * QNameSet: those methods are all careful assign only unchanging sets.
+ */
+ private QNameSet(Set excludedURIs, Set includedURIs, Set excludedQNamesInIncludedURIs, Set includedQNamesInExcludedURIs)
+ {
+ if (includedURIs != null && excludedURIs == null)
+ {
+ _inverted = false;
+ _includedURIs = includedURIs;
+ _excludedQNames = excludedQNamesInIncludedURIs;
+ _includedQNames = includedQNamesInExcludedURIs;
+ }
+ else if (excludedURIs != null && includedURIs == null)
+ {
+ _inverted = true;
+ _includedURIs = excludedURIs;
+ _excludedQNames = includedQNamesInExcludedURIs;
+ _includedQNames = excludedQNamesInIncludedURIs;
+ }
+ else
+ throw new IllegalArgumentException("Exactly one of excludedURIs and includedURIs must be null");
+ }
+
+ /**
+ * Local xml names are hased using "" as the namespace.
+ */
+ private static String nsFromName(QName xmlName)
+ {
+ String ns = xmlName.getNamespaceURI();
+ return ns == null ? "" : ns;
+ }
+
+ /**
+ * True if this ModelTransitionSet contains the given qname.
+ */
+ public boolean contains(QName name)
+ {
+ boolean in = _includedURIs.contains(nsFromName(name)) ?
+ !_excludedQNames.contains(name) :
+ _includedQNames.contains(name);
+ return _inverted ^ in;
+ }
+
+ /**
+ * True if this ModelTransitionSet contains all QNames.
+ */
+ public boolean isAll()
+ {
+ return _inverted && _includedURIs.isEmpty() && _includedQNames.isEmpty();
+ }
+
+ /**
+ * True if this ModelTransitionSet contains no QNames.
+ */
+ public boolean isEmpty()
+ {
+ return !_inverted && _includedURIs.isEmpty() && _includedQNames.isEmpty();
+ }
+
+ /**
+ * Returns a new QNameSet that is the intersection of this one and another.
+ * @param set the set to insersect with
+ * @return the intersection
+ */
+ public QNameSet intersect(QNameSetSpecification set)
+ {
+ QNameSetBuilder result = new QNameSetBuilder(this);
+ result.restrict(set);
+ return result.toQNameSet();
+ }
+
+ /**
+ * Returns a new QNameSet that is the union of this one and another.
+ * @param set the set to union with
+ * @return the union
+ */
+ public QNameSet union(QNameSetSpecification set)
+ {
+ QNameSetBuilder result = new QNameSetBuilder(this);
+ result.addAll(set);
+ return result.toQNameSet();
+ }
+
+ /**
+ * Returns a new QNameSet that is the inverse of this one.
+ */
+ public QNameSet inverse()
+ {
+ if (this == EMPTY)
+ return ALL;
+ if (this == ALL)
+ return EMPTY;
+ if (this == LOCAL)
+ return NONLOCAL;
+ if (this == NONLOCAL)
+ return LOCAL;
+ return new QNameSet(includedURIs(), excludedURIs(), includedQNamesInExcludedURIs(), excludedQNamesInIncludedURIs());
+ }
+
+ /**
+ * True if the given set is a subset of this one.
+ * @param set the set to test
+ * @return true if this contains all QNames contained by the given set
+ */
+ public boolean containsAll(QNameSetSpecification set)
+ {
+ // a.contains(b) == a.inverse.isDisjoint(b)
+ if (!_inverted && set.excludedURIs() != null)
+ return false;
+
+ return inverse().isDisjoint(set);
+ }
+
+ /**
+ * True if the given set is disjoint from this one.
+ * @param set the set to test
+ * @return true if the set is disjoint from this set
+ */
+ public boolean isDisjoint(QNameSetSpecification set)
+ {
+ if (_inverted && set.excludedURIs() != null)
+ return false;
+
+ if (_inverted)
+ return isDisjointImpl(set, this);
+ else
+ return isDisjointImpl(this, set);
+ }
+
+ private boolean isDisjointImpl(QNameSetSpecification set1, QNameSetSpecification set2)
+ {
+ Set includeURIs = set1.includedURIs();
+ Set otherIncludeURIs = set2.includedURIs();
+ if (otherIncludeURIs != null)
+ {
+ for (Iterator i = includeURIs.iterator(); i.hasNext(); )
+ {
+ if (otherIncludeURIs.contains(i.next()))
+ return false;
+ }
+ }
+ else
+ {
+ Set otherExcludeURIs = set2.excludedURIs();
+ for (Iterator i = includeURIs.iterator(); i.hasNext(); )
+ {
+ if (!otherExcludeURIs.contains(i.next()))
+ return false;
+ }
+ }
+
+ for (Iterator i = set1.includedQNamesInExcludedURIs().iterator(); i.hasNext(); )
+ {
+ if (set2.contains((QName)i.next()))
+ return false;
+ }
+
+ if (includeURIs.size() > 0)
+ for (Iterator i = set2.includedQNamesInExcludedURIs().iterator(); i.hasNext(); )
+ {
+ if (set1.contains((QName)i.next()))
+ return false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Namespaces that are fully excluded from the set except for a finite
+ * number of individual QName exceptions. Returns null if this set is infinite.
+ * @return the set of excluded namespace URI strings
+ */
+ public Set excludedURIs()
+ {
+ if (_inverted) return Collections.unmodifiableSet(_includedURIs);
+ return null;
+ }
+
+ /**
+ * Namespaces that are fully included in set except for a finite
+ * number of individual QName exceptions. Returns null if this set is infinite.
+ * @return the set of included namespace URI strings
+ */
+ public Set includedURIs()
+ {
+ if (!_inverted) return _includedURIs;
+ return null;
+ }
+
+ /**
+ * The set of QNames excluded from the set even though they are within
+ * a namespace that is otherwise fully included in the set.
+ * @return the set of excluded QNames from within includedURI namespaces
+ */
+ public Set excludedQNamesInIncludedURIs()
+ {
+ return Collections.unmodifiableSet(_inverted ? _includedQNames : _excludedQNames);
+ }
+
+ /**
+ * The set of QNames included in the set even though they are within
+ * a namespace that is otherwise fully included in the set.
+ * @return the set of included QNames from within excludedURI namespaces
+ */
+ public Set includedQNamesInExcludedURIs()
+ {
+ return Collections.unmodifiableSet(_inverted ? _excludedQNames : _includedQNames);
+ }
+
+ private String prettyQName(QName name)
+ {
+ if (name.getNamespaceURI() == null)
+ return name.getLocalPart();
+ return name.getLocalPart() + "@" + name.getNamespaceURI();
+ }
+
+ /**
+ * Returns a string representation useful for debugging, subject to change.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("QNameSet");
+ sb.append(_inverted ? "-(" : "+(");
+ for (Iterator i = _includedURIs.iterator(); i.hasNext(); )
+ {
+ sb.append("+*@");
+ sb.append(i.next());
+ sb.append(", ");
+ }
+ for (Iterator i = _excludedQNames.iterator(); i.hasNext(); )
+ {
+ sb.append("-");
+ sb.append(prettyQName((QName)i.next()));
+ sb.append(", ");
+ }
+ for (Iterator i = _includedQNames.iterator(); i.hasNext(); )
+ {
+ sb.append("+");
+ sb.append(prettyQName((QName)i.next()));
+ sb.append(", ");
+ }
+ int index = sb.lastIndexOf(", ");
+ if (index > 0)
+ sb.setLength(index);
+ sb.append(')');
+ return sb.toString();
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetBuilder.java b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetBuilder.java
new file mode 100644
index 0000000..714ddf6
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetBuilder.java
@@ -0,0 +1,725 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Used to build {@link QNameSet QNameSets}.
+ */
+public class QNameSetBuilder implements QNameSetSpecification, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private boolean _inverted;
+ private Set _includedURIs;
+ private Set _excludedQNames;
+ private Set _includedQNames;
+
+ /**
+ * Constructs an empty QNameSetBuilder.
+ */
+ public QNameSetBuilder()
+ {
+ _inverted = false;
+ _includedURIs = new HashSet();
+ _excludedQNames = new HashSet();
+ _includedQNames = new HashSet();
+ }
+
+ /**
+ * Constructs a QNameSetBuilder whose initial contents are given by
+ * another QNameSetSpecification.
+ * @param set the QNameSetSpecificaiton to copy
+ */
+ public QNameSetBuilder(QNameSetSpecification set)
+ {
+ Set includedURIs = set.includedURIs();
+ if (includedURIs != null)
+ {
+ _inverted = false;
+ _includedURIs = new HashSet(includedURIs);
+ _excludedQNames = new HashSet(set.excludedQNamesInIncludedURIs());
+ _includedQNames = new HashSet(set.includedQNamesInExcludedURIs());
+ }
+ else
+ {
+ _inverted = true;
+ _includedURIs = new HashSet(set.excludedURIs());
+ _excludedQNames = new HashSet(set.includedQNamesInExcludedURIs());
+ _includedQNames = new HashSet(set.excludedQNamesInIncludedURIs());
+ }
+ }
+
+ /**
+ * Constructs a QNameSetBuilder whose inital contents are given by
+ * the four sets. Exactly one of either excludedURIs or includedURIs must
+ * be non-null.
+ *
+ * @param excludedURIs the finite set of namespace URI strings to exclude from the set, or null if this set is infinite
+ * @param includedURIs the finite set of namespace URI strings to include in the set, or null if this set is infinite
+ * @param excludedQNamesInIncludedURIs the finite set of exceptional QNames to exclude from the included namespaces
+ * @param excludedQNamesInIncludedURIs the finite set of exceptional QNames to include that are in the excluded namespaces
+ */
+ public QNameSetBuilder(Set excludedURIs, Set includedURIs, Set excludedQNamesInIncludedURIs, Set includedQNamesInExcludedURIs)
+ {
+ if (includedURIs != null && excludedURIs == null)
+ {
+ _inverted = false;
+ _includedURIs = new HashSet(includedURIs);
+ _excludedQNames = new HashSet(excludedQNamesInIncludedURIs);
+ _includedQNames = new HashSet(includedQNamesInExcludedURIs);
+ }
+ else if (excludedURIs != null && includedURIs == null)
+ {
+ _inverted = true;
+ _includedURIs = new HashSet(excludedURIs);
+ _excludedQNames = new HashSet(includedQNamesInExcludedURIs);
+ _includedQNames = new HashSet(excludedQNamesInIncludedURIs);
+ }
+ else
+ throw new IllegalArgumentException("Exactly one of excludedURIs and includedURIs must be null");
+ }
+
+
+ /**
+ * Constructs a QNameSetBuilder whose initial contents are given
+ * as a list of namespace URIs, using the same format used by wildcards
+ * in XSD files.
+ *
+ * @param str a wildcard namespace specification string such as "##any",
+ * "##other", "##local", "##targetNamespace", or a space-separated
+ * list of URIs.
+ * @param targetURI the current targetNamespace
+ */
+ public QNameSetBuilder(String str, String targetURI)
+ {
+ this();
+
+ if (str == null)
+ str = "##any";
+
+ String[] uri = splitList(str);
+ for (int i = 0; i < uri.length; i++)
+ {
+ String adduri = uri[i];
+ if (adduri.startsWith("##"))
+ {
+ if (adduri.equals("##other"))
+ {
+ if (targetURI == null)
+ throw new IllegalArgumentException();
+ QNameSetBuilder temp = new QNameSetBuilder();
+ temp.addNamespace(targetURI);
+ temp.addNamespace("");
+ temp.invert();
+ addAll(temp);
+ continue;
+ }
+ else if (adduri.equals("##any"))
+ {
+ clear();
+ invert();
+ continue;
+ }
+ else if (uri[i].equals("##targetNamespace"))
+ {
+ if (targetURI == null)
+ throw new IllegalArgumentException();
+ adduri = targetURI;
+ }
+ else if (uri[i].equals("##local"))
+ {
+ adduri = "";
+ }
+ }
+ addNamespace(adduri);
+ }
+ }
+
+ /**
+ * Local xml names are hased using "" as the namespace.
+ */
+ private static String nsFromName(QName QName)
+ {
+ String ns = QName.getNamespaceURI();
+ return ns == null ? "" : ns;
+ }
+
+ private static final String[] EMPTY_STRINGARRAY = new String[0];
+
+ private static boolean isSpace(char ch)
+ {
+ switch (ch)
+ {
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private static String[] splitList(String s)
+ {
+ if (s.length() == 0)
+ return EMPTY_STRINGARRAY;
+
+ List result = new ArrayList();
+ int i = 0;
+ int start = 0;
+ for (;;)
+ {
+ while (i < s.length() && isSpace(s.charAt(i)))
+ i += 1;
+ if (i >= s.length())
+ {
+ if (result.size()==0)
+ return EMPTY_STRINGARRAY;
+ return (String[])result.toArray(new String[result.size()]);
+ }
+ start = i;
+ while (i < s.length() && !isSpace(s.charAt(i)))
+ i += 1;
+ result.add(s.substring(start, i));
+ }
+ }
+
+ /**
+ * Remove all xml names from qnameset whose namespace matches the uri.
+ */
+ private static void removeAllMatchingNs(String uri, Set qnameset)
+ {
+ for (Iterator i = qnameset.iterator(); i.hasNext(); )
+ {
+ if (uri.equals(nsFromName((QName)i.next())))
+ i.remove();
+ }
+ }
+
+ /**
+ * Remove all xml names from qnameset whose namespace is in the
+ * first set of uris but not the second.
+ */
+ private static void removeAllMatchingFirstOnly(Set setFirst, Set setSecond, Set qnameset)
+ {
+ for (Iterator i = qnameset.iterator(); i.hasNext(); )
+ {
+ String ns = nsFromName((QName)i.next());
+ if (setFirst.contains(ns) && !setSecond.contains(ns))
+ i.remove();
+ }
+ }
+
+ /**
+ * Remove all xml names from qnameset whose namespace is in both
+ * sets of uris.
+ */
+ private static void removeAllMatchingBoth(Set setFirst, Set setSecond, Set qnameset)
+ {
+ for (Iterator i = qnameset.iterator(); i.hasNext(); )
+ {
+ String ns = nsFromName((QName)i.next());
+ if (setFirst.contains(ns) && setSecond.contains(ns))
+ i.remove();
+ }
+ }
+
+ /**
+ * Remove all xml names from qnameset whose namespace is in neither
+ * set of uris.
+ */
+ private static void removeAllMatchingNeither(Set setFirst, Set setSecond, Set qnameset)
+ {
+ for (Iterator i = qnameset.iterator(); i.hasNext(); )
+ {
+ String ns = nsFromName((QName)i.next());
+ if (!setFirst.contains(ns) && !setSecond.contains(ns))
+ i.remove();
+ }
+ }
+
+ /**
+ * True if this ModelTransitionSet contains the given qname.
+ */
+ public boolean contains(QName name)
+ {
+ boolean in = _includedURIs.contains(nsFromName(name)) ?
+ !_excludedQNames.contains(name) :
+ _includedQNames.contains(name);
+ return _inverted ^ in;
+ }
+
+ /**
+ * True if this ModelTransitionSet contains all QNames.
+ */
+ public boolean isAll()
+ {
+ return _inverted && _includedURIs.size() == 0 && _includedQNames.size() == 0;
+ }
+
+ /**
+ * True if this ModelTransitionSet contains no QNames.
+ */
+ public boolean isEmpty()
+ {
+ return !_inverted && _includedURIs.size() == 0 && _includedQNames.size() == 0;
+ }
+
+ /**
+ * Returns a new QNameSet that is the intersection of this one and another.
+ */
+ public QNameSet intersect(QNameSetSpecification set)
+ {
+ QNameSetBuilder result = new QNameSetBuilder(this);
+ result.restrict(set);
+ return result.toQNameSet();
+ }
+
+ /**
+ * Returns a new QNameSet that is the union of this one and another.
+ */
+ public QNameSet union(QNameSetSpecification set)
+ {
+ QNameSetBuilder result = new QNameSetBuilder(this);
+ result.addAll(set);
+ return result.toQNameSet();
+ }
+
+ /**
+ * Returns a new QNameSet that is the inverse of this one.
+ */
+ public QNameSet inverse()
+ {
+ return QNameSet.forSets(includedURIs(), excludedURIs(), includedQNamesInExcludedURIs(), excludedQNamesInIncludedURIs());
+ }
+
+ /**
+ * True if the parameter is a subset of this set.
+ */
+ public boolean containsAll(QNameSetSpecification set)
+ {
+ if (!_inverted && set.excludedURIs() != null)
+ return false;
+
+ return inverse().isDisjoint(set);
+ }
+
+ /**
+ * True if the given set is disjoint from this one.
+ */
+ public boolean isDisjoint(QNameSetSpecification set)
+ {
+ if (_inverted && set.excludedURIs() != null)
+ return false;
+
+ if (_inverted)
+ return isDisjointImpl(set, this);
+ else
+ return isDisjointImpl(this, set);
+ }
+
+ private boolean isDisjointImpl(QNameSetSpecification set1, QNameSetSpecification set2)
+ {
+ Set includeURIs = set1.includedURIs();
+ Set otherIncludeURIs = set2.includedURIs();
+ if (otherIncludeURIs != null)
+ {
+ for (Iterator i = includeURIs.iterator(); i.hasNext(); )
+ {
+ if (otherIncludeURIs.contains(i.next()))
+ return false;
+ }
+ }
+ else
+ {
+ Set otherExcludeURIs = set2.excludedURIs();
+ for (Iterator i = includeURIs.iterator(); i.hasNext(); )
+ {
+ if (!otherExcludeURIs.contains(i.next()))
+ return false;
+ }
+ }
+
+ for (Iterator i = set1.includedQNamesInExcludedURIs().iterator(); i.hasNext(); )
+ {
+ if (set2.contains((QName)i.next()))
+ return false;
+ }
+
+ if (includeURIs.size() > 0)
+ for (Iterator i = set2.includedQNamesInExcludedURIs().iterator(); i.hasNext(); )
+ {
+ if (set1.contains((QName)i.next()))
+ return false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Clears this QNameSetBuilder
+ */
+ public void clear()
+ {
+ _inverted = false;
+ _includedURIs.clear();
+ _excludedQNames.clear();
+ _includedQNames.clear();
+ }
+
+ /**
+ * Inverts this QNameSetBuilder.
+ */
+ public void invert()
+ {
+ _inverted = !_inverted;
+ }
+
+ /**
+ * Adds a single QName to this QNameSetBuilder.
+ */
+ public void add(QName qname)
+ {
+ if (!_inverted)
+ addImpl(qname);
+ else
+ removeImpl(qname);
+ }
+
+ /**
+ * Adds an entire namespace URI of QNames to this QNameSetBuilder.
+ * The empty string is used to signifiy the (local) no-namespace.
+ */
+ public void addNamespace(String uri)
+ {
+ if (!_inverted)
+ addNamespaceImpl(uri);
+ else
+ removeNamespaceImpl(uri);
+ }
+
+ /**
+ * Adds the contents of another QNameSet to this QNameSetBuilder.
+ */
+ public void addAll(QNameSetSpecification set)
+ {
+ if (_inverted)
+ removeAllImpl(set.includedURIs(), set.excludedURIs(), set.includedQNamesInExcludedURIs(), set.excludedQNamesInIncludedURIs());
+ else
+ addAllImpl(set.includedURIs(), set.excludedURIs(), set.includedQNamesInExcludedURIs(), set.excludedQNamesInIncludedURIs());
+ }
+
+ /**
+ * Removes the given qname from this QNameSetBuilder.
+ */
+ public void remove(QName qname)
+ {
+ if (_inverted)
+ addImpl(qname);
+ else
+ removeImpl(qname);
+ }
+
+ /**
+ * Removes an entire namespace URI from this QNameSetBuilder.
+ */
+ public void removeNamespace(String uri)
+ {
+ if (_inverted)
+ addNamespaceImpl(uri);
+ else
+ removeNamespaceImpl(uri);
+ }
+
+ /**
+ * Removes all contents of a given QNameSet from this QNameSetBuilder.
+ */
+ public void removeAll(QNameSetSpecification set)
+ {
+ if (_inverted)
+ addAllImpl(set.includedURIs(), set.excludedURIs(), set.includedQNamesInExcludedURIs(), set.excludedQNamesInIncludedURIs());
+ else
+ removeAllImpl(set.includedURIs(), set.excludedURIs(), set.includedQNamesInExcludedURIs(), set.excludedQNamesInIncludedURIs());
+ }
+
+ /**
+ * Restricts the contents of this QNameSetBuilder to be a subset of the
+ * given QNameSet. In other words, computes an intersection.
+ */
+ public void restrict(QNameSetSpecification set)
+ {
+ if (_inverted)
+ addAllImpl(set.excludedURIs(), set.includedURIs(), set.excludedQNamesInIncludedURIs(), set.includedQNamesInExcludedURIs());
+ else
+ removeAllImpl(set.excludedURIs(), set.includedURIs(), set.excludedQNamesInIncludedURIs(), set.includedQNamesInExcludedURIs());
+ }
+
+ /**
+ * Implementation of add(qname) that ignores inversion.
+ */
+ private void addImpl(QName qname)
+ {
+ if (_includedURIs.contains(nsFromName(qname)))
+ _excludedQNames.remove(qname);
+ else
+ _includedQNames.add(qname);
+ }
+
+ /**
+ * Implementation of add(ns) that ignores inversion.
+ */
+ private void addNamespaceImpl(String uri)
+ {
+ if (_includedURIs.contains(uri))
+ {
+ removeAllMatchingNs(uri, _excludedQNames);
+ }
+ else
+ {
+ removeAllMatchingNs(uri, _includedQNames);
+ _includedURIs.add(uri);
+ }
+ }
+
+ /**
+ * Implementation of add(set) that ignores inversion.
+ */
+ private void addAllImpl(Set includedURIs, Set excludedURIs, Set includedQNames, Set excludedQNames)
+ {
+ boolean exclude = (excludedURIs != null);
+ Set specialURIs = exclude ? excludedURIs : includedURIs;
+
+ for (Iterator i = _excludedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if ((exclude ^ specialURIs.contains(uri)) && !excludedQNames.contains(name))
+ i.remove();
+ }
+
+ for (Iterator i = excludedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if (!_includedURIs.contains(uri) && !_includedQNames.contains(name))
+ _excludedQNames.add(name);
+ }
+
+ for (Iterator i = includedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if (!_includedURIs.contains(uri))
+ _includedQNames.add(name);
+ else
+ _excludedQNames.remove(name);
+ }
+
+ if (!exclude)
+ {
+ removeAllMatchingFirstOnly(includedURIs, _includedURIs, _includedQNames);
+ _includedURIs.addAll(includedURIs);
+ }
+ else
+ {
+ removeAllMatchingNeither(excludedURIs, _includedURIs, _includedQNames);
+ for (Iterator i = _includedURIs.iterator(); i.hasNext(); )
+ {
+ String uri = (String)i.next();
+ if (!excludedURIs.contains(uri))
+ i.remove();
+ }
+
+ for (Iterator i = excludedURIs.iterator(); i.hasNext(); )
+ {
+ String uri = (String)i.next();
+ if (!_includedURIs.contains(uri))
+ _includedURIs.add(uri);
+ else
+ _includedURIs.remove(uri);
+ }
+ Set temp = _excludedQNames;
+ _excludedQNames = _includedQNames;
+ _includedQNames = temp;
+ _inverted = !_inverted;
+ }
+ }
+
+ /**
+ * Implementation of remove(qname) that ignores inversion.
+ */
+ private void removeImpl(QName qname)
+ {
+ if (_includedURIs.contains(nsFromName(qname)))
+ _excludedQNames.add(qname);
+ else
+ _includedQNames.remove(qname);
+ }
+
+ /**
+ * Implementation of remove(ns) that ignores inversion.
+ */
+ private void removeNamespaceImpl(String uri)
+ {
+ if (_includedURIs.contains(uri))
+ {
+ removeAllMatchingNs(uri, _excludedQNames);
+ _includedURIs.remove(uri);
+ }
+ else
+ {
+ removeAllMatchingNs(uri, _includedQNames);
+ }
+ }
+
+ /**
+ * Implementation of remove(set) that ignores inversion.
+ */
+ private void removeAllImpl(Set includedURIs, Set excludedURIs, Set includedQNames, Set excludedQNames)
+ {
+ boolean exclude = (excludedURIs != null);
+ Set specialURIs = exclude ? excludedURIs : includedURIs;
+
+ for (Iterator i = _includedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if (exclude ^ specialURIs.contains(uri))
+ {
+ if (!excludedQNames.contains(name))
+ i.remove();
+ }
+ else
+ {
+ if (includedQNames.contains(name))
+ i.remove();
+ }
+ }
+
+ for (Iterator i = includedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if (_includedURIs.contains(uri))
+ _excludedQNames.add(name);
+ }
+
+ for (Iterator i = excludedQNames.iterator(); i.hasNext(); )
+ {
+ QName name = (QName)i.next();
+ String uri = nsFromName(name);
+ if (_includedURIs.contains(uri) && !_excludedQNames.contains(name))
+ _includedQNames.add(name);
+ }
+
+ if (exclude)
+ {
+ removeAllMatchingFirstOnly(_includedURIs, excludedURIs, _excludedQNames);
+ }
+ else
+ {
+ removeAllMatchingBoth(_includedURIs, includedURIs, _excludedQNames);
+ }
+
+ for (Iterator i = _includedURIs.iterator(); i.hasNext(); )
+ {
+ if (exclude ^ specialURIs.contains(i.next()))
+ i.remove();
+ }
+ }
+
+ public Set excludedURIs()
+ {
+ if (_inverted) return Collections.unmodifiableSet(_includedURIs);
+ return null;
+ }
+
+ public Set includedURIs()
+ {
+ if (!_inverted) return _includedURIs;
+ return null;
+ }
+
+ public Set excludedQNamesInIncludedURIs()
+ {
+ return Collections.unmodifiableSet(_inverted ? _includedQNames : _excludedQNames);
+ }
+
+ public Set includedQNamesInExcludedURIs()
+ {
+ return Collections.unmodifiableSet(_inverted ? _excludedQNames : _includedQNames);
+ }
+
+ private String prettyQName(QName name)
+ {
+ if (name.getNamespaceURI() == null)
+ return name.getLocalPart();
+ return name.getLocalPart() + "@" + name.getNamespaceURI();
+ }
+
+ /**
+ * Returns a string representation useful for debugging, subject to change.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("QNameSetBuilder");
+ sb.append(_inverted ? "-(" : "+(");
+ for (Iterator i = _includedURIs.iterator(); i.hasNext(); )
+ {
+ sb.append("+*@");
+ sb.append(i.next());
+ sb.append(", ");
+ }
+ for (Iterator i = _excludedQNames.iterator(); i.hasNext(); )
+ {
+ sb.append("-");
+ sb.append(prettyQName((QName)i.next()));
+ sb.append(", ");
+ }
+ for (Iterator i = _includedQNames.iterator(); i.hasNext(); )
+ {
+ sb.append("+");
+ sb.append(prettyQName((QName)i.next()));
+ sb.append(", ");
+ }
+ int index = sb.lastIndexOf(", ");
+ if (index > 0)
+ sb.setLength(index);
+ sb.append(')');
+ return sb.toString();
+ }
+
+ /**
+ * Returns a {@link QNameSet} equivalent to the current state of this
+ * QNameSetBuilder.
+ */
+ public QNameSet toQNameSet()
+ {
+ return QNameSet.forSpecification(this);
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetSpecification.java b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetSpecification.java
new file mode 100644
index 0000000..49d2f10
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/QNameSetSpecification.java
@@ -0,0 +1,129 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import java.util.Set;
+
+/**
+ * Represents a lattice of finite and infinite sets of QNames.
+ *
+ * @see QNameSet
+ */
+public interface QNameSetSpecification
+{
+ /**
+ * True if the set contains the given QName.
+ *
+ * Roughly equivalent to:
+ * (includedURIs() == null ?
+ * excludedURIs().contains(namespace) :
+ * includedURIs().contains(namespace)
+ * ) ?
+ * !excludedQNamesInIncludedURIs().contains(name) :
+ * includedQNamesInExcludedURIs().contains(name)
+ */
+ boolean contains(QName name);
+
+ /**
+ * True if the set is the set of all QNames.
+ */
+ boolean isAll();
+
+ /**
+ * True if the set is empty.
+ */
+ boolean isEmpty();
+
+ /**
+ * True if the parameter is a subset of this set.
+ */
+ boolean containsAll(QNameSetSpecification set);
+
+ /**
+ * True if is disjoint from the specified set.
+ */
+ boolean isDisjoint(QNameSetSpecification set);
+
+ /**
+ * Returns the intersection with another QNameSet.
+ */
+ QNameSet intersect(QNameSetSpecification set);
+
+ /**
+ * Returns the union with another QNameSet.
+ */
+ QNameSet union(QNameSetSpecification set);
+
+ /**
+ * Return the inverse of this QNameSet. That is the QNameSet which
+ * contains all the QNames not contained in this set. In other words
+ * for which set.contains(name) != set.inverse().contains(name) for
+ * all names.
+ */
+ QNameSet inverse();
+
+ /**
+ * The finite set of namespace URIs that are almost completely excluded from
+ * the set (that is, each namespace URI that included in the set with with
+ * a finite number of QName exceptions). Null if the set of namespaceURIs
+ * that are almost completely included is infinite.
+ * <p>
+ * Null (meaning almost all URIs excluded) if includedURIs() is non-null;
+ * non-null otherwise.
+ * <p>
+ * The same set as inverse().includedURIs().
+ */
+ Set excludedURIs();
+
+ /**
+ * The finite set of namespace URIs that are almost completely included in
+ * the set (that is, each namespace URI that included in the set with with
+ * a finite number of QName exceptions). Null if the set of namespaceURIs
+ * that are almost completely included is infinite.
+ * <p>
+ * Null (meaning almost all URIs included) if excludedURIs() is non-null;
+ * non-null otherwise.
+ * <p>
+ * The same as inverse.excludedURIs().
+ */
+ Set includedURIs();
+
+ /**
+ * The finite set of QNames that are excluded from the set within namespaces
+ * that are otherwise included. Should only contain QNames within namespace
+ * that are within the set includedURIs() (or any URI, if includedURIs()
+ * is null, which means that all URIs are almost completely included).
+ * <p>
+ * Never null.
+ * <p>
+ * The same set as inverse().includedQNames().
+ */
+ Set excludedQNamesInIncludedURIs();
+
+ /**
+ * The finite set of QNames that are included in the set within namespaces
+ * that are otherwise excluded. Should only contain QNames within namespace
+ * that are within the set excludedURIs() (or any URI, if excludedURIs()
+ * is null, which means that all URIs are almost completely excluded).
+ * <p>
+ * Never null.
+ * <p>
+ * The same as inverse().excludedQNames().
+ */
+ Set includedQNamesInExcludedURIs();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeGroup.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeGroup.java
new file mode 100644
index 0000000..3c7d0fb
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeGroup.java
@@ -0,0 +1,64 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents an attribute group.
+ * <p>
+ * An attribute group is a syntactic construct, not a part
+ * of the logical model. For example, types declared within an
+ * attribute group become local to the type that uses the group -
+ * they're not local to the attribute group itself. Therefore
+ * in the logical model of a schema type system, an attribute
+ * group doesn't represent anything. Its contents are merged
+ * into the logical model at parse time.
+ *
+ * @see SchemaTypeLoader#findAttributeGroup
+ */
+public interface SchemaAttributeGroup extends SchemaComponent
+{
+ /**
+ * Returns SchemaComponent.ATTRIBUTE_GROUP.
+ */
+ int getComponentType();
+
+ /**
+ * The name of the model group.
+ */
+ QName getName();
+
+ /**
+ * Used to allow on-demand loading of attribute groups.
+ *
+ * @exclude
+ */
+ public final static class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaAttributeGroup attributeGroup)
+ { super(attributeGroup); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.ATTRIBUTE_GROUP; }
+
+ public final SchemaAttributeGroup get()
+ { return (SchemaAttributeGroup)getComponent(); }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeModel.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeModel.java
new file mode 100644
index 0000000..94fc61f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeModel.java
@@ -0,0 +1,56 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents the attribute structure allowed on a complex type.
+ *
+ * @see SchemaType#getAttributeModel
+ */
+public interface SchemaAttributeModel
+{
+ /**
+ * Returns an array containing all the attributes in the model.
+ */
+ SchemaLocalAttribute[] getAttributes();
+
+ /**
+ * Returns the attribute with the given name.
+ */
+ SchemaLocalAttribute getAttribute(QName name);
+
+ /**
+ * QNameSet representing the attribute wildcard specification.
+ */
+ QNameSet getWildcardSet();
+
+ /**
+ * Returns the processing code ({@link #STRICT}, {@link #LAX}, {@link #SKIP}).
+ * Returns 0 ({@link #NONE}) if no wildcard specified.
+ */
+ int getWildcardProcess();
+
+ /** See {@link #getWildcardProcess} */
+ static final int NONE = 0;
+ /** Strict wildcard processing. See {@link #getWildcardProcess} */
+ static final int STRICT = 1;
+ /** Lax wildcard processing. See {@link #getWildcardProcess} */
+ static final int LAX = 2;
+ /** Skip wildcard processing. See {@link #getWildcardProcess} */
+ static final int SKIP = 3;
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java
new file mode 100644
index 0000000..8c544d3
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaComponent.java
@@ -0,0 +1,106 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a global Schema Component. That is, a type, element, attribute,
+ * model group, attribute group, or identity constraint.
+ * <p>
+ * Note that not all types, elements, and attributes are global; local
+ * types, element, and attributes do not appear in the global lookup table.
+ * Also note that other information items such as particles, facets, and
+ * so on are not globally indexed, so are not SchemaComponents.
+ *
+ * @see SchemaType
+ * @see SchemaGlobalElement
+ * @see SchemaGlobalAttribute
+ * @see SchemaAttributeGroup
+ * @see SchemaModelGroup
+ * @see SchemaIdentityConstraint
+ */
+public interface SchemaComponent
+{
+ /** A type definition. See {@link #getComponentType} */
+ static final int TYPE = 0;
+ /** An element definition. See {@link #getComponentType} */
+ static final int ELEMENT = 1;
+ /** An attribute definition. See {@link #getComponentType} */
+ static final int ATTRIBUTE = 3;
+ /** An attribute group definition. See {@link #getComponentType} */
+ static final int ATTRIBUTE_GROUP = 4;
+ /** An identity constraint definition. See {@link #getComponentType} */
+ static final int IDENTITY_CONSTRAINT = 5;
+ /** A model group definition. See {@link #getComponentType} */
+ static final int MODEL_GROUP = 6;
+ /** A notation definition. See {@link #getComponentType} */
+ static final int NOTATION = 7;
+
+ /**
+ * Returns the type code for the schema object, either {@link #TYPE},
+ * {@link #ELEMENT}, {@link #ATTRIBUTE}, {@link #ATTRIBUTE_GROUP},
+ * {@link #MODEL_GROUP}, {@link #IDENTITY_CONSTRAINT}, or {@link #NOTATION}.
+ */
+ int getComponentType();
+
+ /**
+ * Returns the typesystem within which this component definition resides
+ */
+ SchemaTypeSystem getTypeSystem();
+
+ /**
+ * The name of the schema component
+ */
+ QName getName();
+
+ /**
+ * A lazy reference to a component. Used by SchemaTypeLoaders to
+ * avoid loading components until they are actually needed.
+ *
+ * @exclude
+ */
+ public static abstract class Ref
+ {
+ protected Ref(SchemaComponent schemaComponent)
+ { _schemaComponent = schemaComponent; }
+
+ protected Ref(SchemaTypeSystem schemaTypeSystem, String handle)
+ { assert(handle != null); _schemaTypeSystem = schemaTypeSystem; _handle = handle; }
+
+ private SchemaComponent _schemaComponent;
+ private SchemaTypeSystem _schemaTypeSystem;
+ public String _handle;
+
+ public abstract int getComponentType();
+
+ public final SchemaTypeSystem getTypeSystem()
+ { return _schemaTypeSystem; }
+
+ public final SchemaComponent getComponent()
+ {
+ if (_schemaComponent == null && _handle != null)
+ _schemaComponent = _schemaTypeSystem.resolveHandle(_handle);
+
+ return _schemaComponent;
+ }
+ }
+
+ /**
+ * Used for on-demand loading of schema components.
+ */
+ public Ref getComponentRef();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaField.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaField.java
new file mode 100644
index 0000000..481e4ef
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaField.java
@@ -0,0 +1,83 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import java.math.BigInteger;
+
+/**
+ * Represents an element or an attribute declaration.
+ *
+ * @see SchemaType#getContainerField
+ * @see SchemaLocalElement
+ * @see SchemaLocalAttribute
+ */
+public interface SchemaField
+{
+ /**
+ * Returns the form-unqualified-or-qualified name.
+ */
+ QName getName();
+
+ /**
+ * True if this use is an attribute
+ */
+ boolean isAttribute();
+
+ /**
+ * True if nillable; always false for attributes.
+ */
+ boolean isNillable();
+
+ /**
+ * Returns the type of this use.
+ */
+ SchemaType getType();
+
+ /**
+ * Returns the minOccurs value for this particle.
+ * If it is not specified explicitly, this defaults to BigInteger.ONE.
+ */
+ BigInteger getMinOccurs();
+
+ /**
+ * Returns the maxOccurs value for this particle, or null if it
+ * is unbounded.
+ * If it is not specified explicitly, this defaults to BigInteger.ONE.
+ */
+ BigInteger getMaxOccurs();
+
+ /**
+ * The default value as plain text. See {@link #isDefault} and {@link #isFixed}.
+ */
+ String getDefaultText();
+
+ /**
+ * The default value as a strongly-typed value. See {@link #isDefault} and {@link #isFixed}.
+ */
+ XmlAnySimpleType getDefaultValue();
+
+ /**
+ * True if a default is supplied. If {@link #isFixed}, then isDefault is always true.
+ */
+ boolean isDefault();
+
+ /**
+ * True if the value is fixed.
+ */
+ boolean isFixed();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalAttribute.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalAttribute.java
new file mode 100644
index 0000000..25d932b
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalAttribute.java
@@ -0,0 +1,55 @@
+/* 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.xmlbeans;
+
+/**
+ * Represents a global attribute definition
+ *
+ * @see SchemaTypeLoader#findAttribute
+ */
+public interface SchemaGlobalAttribute extends SchemaLocalAttribute, SchemaComponent
+{
+ /**
+ * The name of the source .xsd file within which this attribute was defined
+ */
+ String getSourceName();
+
+ /**
+ * Used to allow on-demand loading of elements.
+ *
+ * @exclude
+ */
+ public final static class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaGlobalAttribute element)
+ { super(element); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.ATTRIBUTE; }
+
+ public final SchemaGlobalAttribute get()
+ { return (SchemaGlobalAttribute)getComponent(); }
+ }
+
+ /**
+ * Retruns a SchemaGlobalElement.Ref pointing to this element itself.
+ */
+ public Ref getRef();
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalElement.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalElement.java
new file mode 100644
index 0000000..e316052
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaGlobalElement.java
@@ -0,0 +1,90 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a global element definition.
+ *
+ * @see SchemaTypeLoader#findElement
+ */
+public interface SchemaGlobalElement extends SchemaLocalElement, SchemaComponent
+{
+ /**
+ * The name of the source .xsd file within which this attribute was defined
+ */
+ String getSourceName();
+
+ /**
+ * Set of QNames for elements that are the members of the
+ * substitution group for which this element is the head,
+ * not including this element.
+ */
+ QName[] substitutionGroupMembers();
+
+ /**
+ * The element that is the head of this element's substitution
+ * group, or <code>null</code> if this element is not a member
+ * of a substitution group.
+ */
+ SchemaGlobalElement substitutionGroup();
+
+ /**
+ * True if using this element as the head of a substitution
+ * group for a substitution via type extension is prohibited.
+ * If both finalExtension and finalRestriction are true, this
+ * element cannot be head of a substitution group.
+ * Sensible only for global elements.
+ */
+ public boolean finalExtension();
+
+ /**
+ * True if using this element as the head of a substitution
+ * group for a substitution via type restriction is prohibited.
+ * If both finalExtension and finalRestriction are true, this
+ * element cannot be head of a substitution group.
+ * Sensible only for global elements.
+ */
+ public boolean finalRestriction();
+
+ /**
+ * Used to allow on-demand loading of elements.
+ *
+ * @exclude
+ */
+ public final static class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaGlobalElement element)
+ { super(element); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.ELEMENT; }
+
+ public final SchemaGlobalElement get()
+ { return (SchemaGlobalElement)getComponent(); }
+ }
+
+ /**
+ * Retruns a SchemaGlobalElement.Ref pointing to this element itself.
+ */
+ public Ref getRef();
+
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaIdentityConstraint.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaIdentityConstraint.java
new file mode 100644
index 0000000..fdcb08d
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaIdentityConstraint.java
@@ -0,0 +1,91 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * Represents an identity constraint definition.
+ */
+public interface SchemaIdentityConstraint extends SchemaComponent
+{
+ /**
+ * Return the selector xpath as a string.
+ */
+ String getSelector();
+
+ /**
+ * Return a compiled xpath object for the selector.
+ */
+ Object getSelectorPath();
+
+ /**
+ * Return (a copy of) the xpaths for all the fields.
+ */
+ String[] getFields();
+
+ /**
+ * Return a compiled xpath object for the field.
+ */
+ Object getFieldPath(int index);
+
+ /**
+ * Return a read-only copy of the namespace map. This is the
+ * set of prefix to URI mappings that were in scope in the
+ * schema at the point at which this constraint was declared
+ */
+ Map getNSMap();
+
+ /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:key</a> constraint. See {@link #getConstraintCategory}. */
+ public static final int CC_KEY = 1;
+ /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:keyRef</a> constraint. See {@link #getConstraintCategory}. */
+ public static final int CC_KEYREF = 2;
+ /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:unique</a> constraint. See {@link #getConstraintCategory}. */
+ public static final int CC_UNIQUE = 3;
+
+ /**
+ * Return the constraint category. Either {@link #CC_KEY}, {@link #CC_KEYREF},
+ * or {@link #CC_UNIQUE}.
+ */
+ int getConstraintCategory();
+
+ /**
+ * Returns the key that a key ref refers to. Only valid for
+ * keyrefs.
+ */
+ SchemaIdentityConstraint getReferencedKey();
+
+ /**
+ * Used to allow on-demand loading of identity constraints.
+ *
+ * @exclude
+ */
+ public static final class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaIdentityConstraint idc)
+ { super(idc); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.IDENTITY_CONSTRAINT; }
+
+ public final SchemaIdentityConstraint get()
+ { return (SchemaIdentityConstraint)getComponent(); }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalAttribute.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalAttribute.java
new file mode 100644
index 0000000..a832775
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalAttribute.java
@@ -0,0 +1,38 @@
+/* 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.xmlbeans;
+
+/**
+ * Represents a local or global attribute definition.
+ */
+public interface SchemaLocalAttribute extends SchemaField
+{
+ /**
+ * Returns {@link #PROHIBITED}, {@link #OPTIONAL}, or {@link #REQUIRED}.
+ * (Actually, never returns PROHIBITED because the schema specificaion
+ * states that a prohibited attribute is equivalent to no attribute
+ * at all, so a prohibited attribute will never be present in the compiled
+ * model.)
+ */
+ int getUse();
+
+ /** A prohibited attribute. See {@link #getUse}. */
+ static final int PROHIBITED = 1;
+ /** An optional attribute. See {@link #getUse}. */
+ static final int OPTIONAL = 2;
+ /** A required attribute. See {@link #getUse}. */
+ static final int REQUIRED = 3;
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalElement.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalElement.java
new file mode 100644
index 0000000..53feb40
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaLocalElement.java
@@ -0,0 +1,53 @@
+/* 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.xmlbeans;
+
+/**
+ * Represents a local or global element definition.
+ */
+public interface SchemaLocalElement extends SchemaField
+{
+ /**
+ * True if extension is blocked.
+ */
+ boolean blockExtension();
+ /**
+ * True if restriction is blocked.
+ */
+ boolean blockRestriction();
+ /**
+ * True if element substitution is blocked.
+ */
+ boolean blockSubstitution();
+
+ /**
+ * True if this element is prohibited in content. Only
+ * sensible if this is the head of a substitution group;
+ * then only substitution group members can appear.<P>
+ *
+ * Although local elements cannot be abstract, if an element
+ * use is a ref to a global element, then the flag from the
+ * global element is copied in to the local element where the
+ * use occurs.
+ */
+ boolean isAbstract();
+
+ /**
+ * Returns all the Key, KeyRef, and Unique constraints
+ * on this element.
+ */
+ SchemaIdentityConstraint[] getIdentityConstraints();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaModelGroup.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaModelGroup.java
new file mode 100644
index 0000000..b0ef661
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaModelGroup.java
@@ -0,0 +1,62 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a model group.
+ * <p>
+ * A model group is a syntactic construct, not a part of
+ * the logical model. For example, types declared within a
+ * model group become local to the type that uses the group -
+ * they're not local to the model group itself. Therefore in
+ * the logical model of a schema type system, a model group
+ * doesn't represent anything. Its contents are merged into
+ * the logical model at parse time.
+ */
+public interface SchemaModelGroup extends SchemaComponent
+{
+ /**
+ * Returns SchemaComponent.GROUP.
+ */
+ int getComponentType();
+
+ /**
+ * The name of the model group.
+ */
+ QName getName();
+
+ /**
+ * Used to allow on-demand loading of model groups.
+ *
+ * @exclude
+ */
+ public final static class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaModelGroup modelGroup)
+ { super(modelGroup); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.MODEL_GROUP; }
+
+ public final SchemaModelGroup get()
+ { return (SchemaModelGroup)getComponent(); }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaParticle.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaParticle.java
new file mode 100644
index 0000000..22dbd21
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaParticle.java
@@ -0,0 +1,197 @@
+/* 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.xmlbeans;
+
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a Schema particle definition.
+ * <p>
+ * The content model of a complex type is a tree of particles. Each
+ * particle is either an {@link #ALL}, {@link #CHOICE}, {@link #SEQUENCE},
+ * {@link #ELEMENT}, or {@link #WILDCARD}.
+ * All, choice and sequence particles are groups that can have child
+ * particles; elements and wildcards are always leaves of the particle tree.
+ * <p>
+ * The tree of particles available on a schema type is minimized, that
+ * is, it already has removed "pointless" particles such as empty
+ * sequences, nonrepeating sequences with only one item, and so on.
+ * (<a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict">Pointless particles</a>
+ * are defined precisely in the XML Schema specification.)
+ *
+ * @see SchemaType#getContentModel
+ */
+public interface SchemaParticle
+{
+ /**
+ * Returns the particle type ({@link #ALL}, {@link #CHOICE},
+ * {@link #SEQUENCE}, {@link #ELEMENT}, or {@link #WILDCARD}).
+ */
+ int getParticleType();
+
+ /**
+ * An <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-contentModel">xs:all</a> group.
+ * See {@link #getParticleType}.
+ */
+ static final int ALL = 1;
+ /**
+ * A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-contentModel">xs:choice</a> group.
+ * See {@link #getParticleType}.
+ */
+ static final int CHOICE = 2;
+ /**
+ * A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-contentModel">xs:sequence</a> group.
+ * See {@link #getParticleType}.
+ */
+ static final int SEQUENCE = 3;
+ /**
+ * An <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-element">xs:element</a> particle.
+ * This code means the particle can be coerced to {@link SchemaLocalElement}.
+ * See {@link #getParticleType}.
+ */
+ static final int ELEMENT = 4;
+ /**
+ * An <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-openness">xs:any</a> particle,
+ * also known as an element wildcard.
+ * See {@link #getParticleType}.
+ */
+ static final int WILDCARD = 5;
+
+ /**
+ * Returns the minOccurs value for this particle.
+ * If it's not specified explicitly, this returns BigInteger.ONE.
+ */
+ BigInteger getMinOccurs();
+
+ /**
+ * Returns the maxOccurs value for this particle, or null if it
+ * is unbounded.
+ * If it's not specified explicitly, this returns BigInteger.ONE.
+ */
+ BigInteger getMaxOccurs();
+
+ /**
+ * Returns the minOccurs value, pegged to a 32-bit int for
+ * convenience of a validating state machine that doesn't count
+ * higher than MAX_INT anyway.
+ */
+ public int getIntMinOccurs();
+
+ /**
+ * Returns the maxOccurs value, pegged to a 32-bit int for
+ * convenience of a validating state machine that doesn't count
+ * higher than MAX_INT anyway. Unbounded is given as MAX_INT.
+ */
+ public int getIntMaxOccurs();
+
+
+ /**
+ * One if minOccurs == maxOccurs == 1.
+ */
+ boolean isSingleton();
+
+ /**
+ * Applies to sequence, choice, and all particles only: returns an array
+ * of all the particle children in order.
+ */
+ SchemaParticle[] getParticleChildren();
+
+ /**
+ * Another way to access the particle children.
+ */
+ SchemaParticle getParticleChild(int i);
+
+ /**
+ * The number of children.
+ */
+ int countOfParticleChild();
+
+ /**
+ * True if this particle can start with the given element
+ * (taking into account the structure of all child particles
+ * of course).
+ */
+ boolean canStartWithElement(QName name);
+
+ /**
+ * Returns the QNameSet of element names that can be
+ * accepted at the beginning of this particle.
+ */
+ QNameSet acceptedStartNames();
+
+ /**
+ * True if this particle can be skipped (taking into account
+ * both the minOcurs as well as the structure of all the
+ * child particles)
+ */
+ boolean isSkippable();
+
+ /**
+ * For wildcards, returns a QNameSet representing the wildcard.
+ */
+ QNameSet getWildcardSet();
+
+ /**
+ * For wildcards, returns the processing code ({@link #STRICT}, {@link #LAX}, {@link #SKIP}).
+ */
+ int getWildcardProcess();
+
+ /** <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#Wildcard_details">Strict wildcard</a> processing. See {@link #getWildcardProcess} */
+ static final int STRICT = 1;
+ /** <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#Wildcard_details">Lax wildcard</a> processing. See {@link #getWildcardProcess} */
+ static final int LAX = 2;
+ /** <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#Wildcard_details">Skip wildcard</a> processing. See {@link #getWildcardProcess} */
+ static final int SKIP = 3;
+
+ /**
+ * For elements only: the QName for the element use.
+ * May be unqualified version of referenced element's name.
+ */
+ QName getName();
+
+ /**
+ * For elements only: returns the type of the element.
+ */
+ SchemaType getType();
+
+ /**
+ * For elements only: true if nillable.
+ */
+ boolean isNillable();
+
+ /**
+ * For elements only: returns the default (or fixed) text value
+ */
+ String getDefaultText();
+
+ /**
+ * For elements only: returns the default (or fixed) strongly-typed value
+ */
+ XmlAnySimpleType getDefaultValue();
+
+ /**
+ * For elements only: True if has default. If isFixed, then isDefault is always true.
+ */
+ boolean isDefault();
+
+ /**
+ * For elements only: true if is fixed value.
+ */
+ boolean isFixed();
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaProperty.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaProperty.java
new file mode 100644
index 0000000..3471261
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaProperty.java
@@ -0,0 +1,229 @@
+/* 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.xmlbeans;
+
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a summary of similar SchemaFields in a complex type.
+ * <p>
+ * In a schema type, every element with the same name must have the
+ * same type. Therefore, all together, elements with the same name
+ * form a coherent collection of similar elements. Similarly, attributes
+ * can only be defined once, so each attribute obviously is a coherent
+ * group on its own.
+ * <p>
+ * A SchemaProperty represents a summary of the the elements with a
+ * given name or the attribute with a given name. It represents the
+ * summary cardinality of the fields, the summary default and fixed
+ * values, and so on. When inferring information about an element
+ * or attribute, it is typically easier to consult then SchemaProperty
+ * than to hunt for the exact SchemaField in the particle tree or
+ * attribute model.
+ *
+ * @see SchemaType#getProperties
+ * @see SchemaType#getAttributeProperties
+ * @see SchemaType#getElementProperties
+ * @see SchemaType#getAttributeProperty
+ * @see SchemaType#getElementProperty
+ */
+public interface SchemaProperty
+{
+ /**
+ * The type within which this property appears
+ */
+ SchemaType getContainerType();
+
+ /**
+ * The name of this element or attribute
+ */
+ QName getName();
+
+ /**
+ * For element properties the set of names that are accepted for this property
+ * if this element is the head of a substitution group. This will always
+ * have at least one element, ie, the property's name.
+ */
+ QName[] acceptedNames();
+
+ /**
+ * The Java name for this property. For example, if the method to
+ * access this property is called getFirstName, then this method
+ * returns the string "FirstName". May be null if the schema type
+ * has not been compiled to Java.
+ */
+ String getJavaPropertyName();
+
+ /**
+ * True for read-only properties.
+ */
+ boolean isReadOnly();
+
+ /**
+ * True for attributes.
+ */
+ boolean isAttribute();
+
+ /**
+ * The schema type for the property.
+ */
+ SchemaType getType();
+
+ // note that in the inheritance hierarchy, if the array getter shows up first,
+ // then the singelton getter is never allowed to show up.
+
+ /**
+ * The schema type returned from the Java getter for this property.
+ * Applies only to types that have been code generated to Java; may
+ * be a base type of getType().
+ */
+ public SchemaType javaBasedOnType(); // Java property type based on this base type
+
+ /**
+ * True if there is a Java getter that returns a singleton.
+ */
+ boolean extendsJavaSingleton(); // has singleton getter
+
+ /**
+ * True if there is an Java isSet method that tests for presence.
+ */
+ boolean extendsJavaOption(); // has isSet tester
+
+ /**
+ * True if there is a Java getter that returns an array.
+ */
+ boolean extendsJavaArray(); // has array getter (called -Array, if singleton is present)
+
+ /**
+ * Returns the natural Java type for this property. Returns either
+ * XML_OBJECT (for complex types) or one of the JAVA_* constants described
+ * in this interface.
+ */
+ int getJavaTypeCode();
+
+ /**
+ * Returns the set of element names which should appear strictly after all
+ * occurences of the elements described by this property. For element properties only.
+ */
+ QNameSet getJavaSetterDelimiter();
+
+ /**
+ * Returns a summarized minimum occurrance number.
+ * For example, a sequence containing a nonoptional singleton element repeated twice will
+ * result in a property getMinOccurs() of 2.
+ */
+ BigInteger getMinOccurs();
+
+ /**
+ * Returns a summarized minimum occurrance number.
+ * For example, a sequence containing a nonoptional singleton element repeated twice will
+ * result in a property getMaxOccurs() of 2.
+ */
+ BigInteger getMaxOccurs();
+
+ /**
+ * Returns {@link #NEVER}, {@link #VARIABLE}, or {@link #CONSISTENTLY} nillable, depending on the
+ * nillability of the elements in this property.
+ */
+ int hasNillable();
+
+ /**
+ * Returns {@link #NEVER}, {@link #VARIABLE}, or {@link #CONSISTENTLY} defaulted, depending on the
+ * defaults present in the elements in this property.
+ */
+ int hasDefault();
+
+ /**
+ * Returns {@link #NEVER}, {@link #VARIABLE}, or {@link #CONSISTENTLY} fixed, depending on the
+ * fixed constraints present in the elements in this property.
+ */
+ int hasFixed();
+
+ /** Applies to no elements for this property. See {@link #hasNillable}, {@link #hasDefault}, {@link #hasFixed} */
+ static final int NEVER = 0;
+ /** Applies to some, but not other elements for this property. See {@link #hasNillable}, {@link #hasDefault}, {@link #hasFixed} */
+ static final int VARIABLE = 1;
+ /** Applies to all elements for this property. See {@link #hasNillable}, {@link #hasDefault}, {@link #hasFixed} */
+ static final int CONSISTENTLY = 2;
+
+ /** An XML Bean type that inherits from {@link XmlObject}. See {@link #getJavaTypeCode}. */
+ static final int XML_OBJECT = 0;
+
+ /** Java primitive type codes (for non-nullable Java types) are between JAVA_FIRST_PRIMITIVE and JAVA_LAST_PRIMITIVE, inclusive. */
+ static final int JAVA_FIRST_PRIMITIVE = 1;
+
+ /** A Java boolean. See {@link #getJavaTypeCode}. */
+ static final int JAVA_BOOLEAN = 1;
+ /** A Java float. See {@link #getJavaTypeCode}. */
+ static final int JAVA_FLOAT = 2;
+ /** A Java double. See {@link #getJavaTypeCode}. */
+ static final int JAVA_DOUBLE = 3;
+ /** A Java byte. See {@link #getJavaTypeCode}. */
+ static final int JAVA_BYTE = 4;
+ /** A Java short. See {@link #getJavaTypeCode}. */
+ static final int JAVA_SHORT = 5;
+ /** A Java int. See {@link #getJavaTypeCode}. */
+ static final int JAVA_INT = 6;
+ /** A Java long. See {@link #getJavaTypeCode}. */
+ static final int JAVA_LONG = 7;
+
+ /** Java primitive type codes (for non-nullable Java types) are between JAVA_FIRST_PRIMITIVE and JAVA_LAST_PRIMITIVE, inclusive. */
+ static final int JAVA_LAST_PRIMITIVE = 7;
+
+ /** A {@link java.math.BigDecimal}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_BIG_DECIMAL = 8;
+ /** A {@link java.math.BigInteger}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_BIG_INTEGER = 9;
+ /** A {@link String}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_STRING = 10;
+ /** A byte[]. See {@link #getJavaTypeCode}. */
+ static final int JAVA_BYTE_ARRAY = 11;
+ /** A {@link GDate}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_GDATE = 12;
+ /** A {@link GDuration}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_GDURATION = 13;
+ /** A {@link java.util.Date}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_DATE = 14;
+ /** A {@link javax.xml.namespace.QName}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_QNAME = 15;
+ /** A {@link java.util.List}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_LIST = 16;
+ /** A {@link java.util.Calendar}. See {@link #getJavaTypeCode}. */
+ static final int JAVA_CALENDAR = 17;
+
+ /** A generated {@link StringEnumAbstractBase} subclass. See {@link #getJavaTypeCode}. */
+ static final int JAVA_ENUM = 18;
+ /** A {@link java.lang.Object}, used for some simple type unions. See {@link #getJavaTypeCode}. */
+ static final int JAVA_OBJECT = 19; // for some unions
+
+ /**
+ * Returns the default or fixed value,
+ * if it is consistent. If it is not consistent,
+ * then returns null.
+ * See {@link #hasDefault} and {@link #hasFixed}.
+ */
+ String getDefaultText();
+
+ /**
+ * Returns the default or fixed value as a strongly-typed value,
+ * if it is consistent. If it is not consistent,
+ * then returns null.
+ * See {@link #hasDefault} and {@link #hasFixed}.
+ */
+ XmlAnySimpleType getDefaultValue();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaStringEnumEntry.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaStringEnumEntry.java
new file mode 100644
index 0000000..710ff56
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaStringEnumEntry.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.xmlbeans;
+
+/**
+ * Describes a code-generated string enumeration
+ *
+ * @see SchemaType#getStringEnumEntries
+ */
+public interface SchemaStringEnumEntry
+{
+ /**
+ * The enumerated string value
+ */
+ public String getString();
+
+ /**
+ * An integer to represent this choice in the enumeration
+ */
+ public int getIntValue();
+
+ /**
+ * A capitalized name to use for the enumeration constant name
+ */
+ public String getEnumName();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaType.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaType.java
new file mode 100644
index 0000000..bfd716f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaType.java
@@ -0,0 +1,872 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a schema type.
+ * <p>
+ * SchemaType is the metadata "type" class for {@link XmlObject}, and it plays the
+ * analogous role for {@link XmlObject} that {@link java.lang.Class} plays for
+ * {@link java.lang.Object}.
+ * <p>
+ * Every XML Bean class corresponds to a singleton SchemaType object
+ * obtainable by ClassName.type (e.g., {@link XmlNonPositiveInteger#type}), and
+ * every XML Bean instance has an actual SchemaType, obtainable by
+ * {@link XmlObject#schemaType}. The ClassName.type and schemaType() mechanisms are
+ * analogous to the ordinary Java ClassName.class and obj.getClass() mechanisms.
+ * <p>
+ * All schema types are represented by a SchemaType, this includes all types
+ * regardless of whether they are built-in or user-defined, compiled or
+ * uncompiled, simple or complex.
+ * <p>
+ * In addition, a compiled XML Bean type system includes special "document" schema types
+ * each representing a document containing nothing but a single element for each
+ * global element, and special "attribute" schema types each representing
+ * a fragment containing nothing but a single global attribute for global
+ * attribute.
+ * <p>
+ * Do not confuse Schema Types with other types of Schema Components such as
+ * {@link SchemaGlobalElement Global Elements}, {@link SchemaGlobalAttribute Global Attributes},
+ * {@link SchemaModelGroup Named Model Groups}, or {@link SchemaAttributeGroup Attribute Groups}.
+ * SchemaType represents a Type component, not any of the other kinds of components.
+ * There are different kinds of metadata objects for the different Schema components.
+ * <p>
+ * The space of SchemaTypes is divided as follows:
+ *
+ * <ul>
+ * <li>First, there is the universal base type and the universal
+ * subtype. These are {@link XmlObject#type}
+ * (corresponding to xs:anyType) and {@link XmlBeans#NO_TYPE},
+ * respectively. The first type is a base type of all other
+ * types. The other type indicates the absence of type information
+ * and, at least in set-theoretic terms, is a subtype of all other types.
+ * <li>There is another universal base type that is the base type
+ * for all simple types. This is the {@link XmlAnySimpleType#type},
+ * corresponding to xs:anySimpleType. Only XmlObject.type and
+ * XmlAnySimpleType.type return <code>true</code> for {@link #isURType}, and
+ * only XmlBeans.NO_TYPE returns <code>true</code> for {@link #isNoType}.
+ * <li>The two "special" kinds of types that are generated that
+ * do not formally exist in the actual Schema specification are
+ * document types and global attribute types (corresponding to
+ * documents that contain a global element, or fragments that
+ * contain a global attribute). They can be detected using
+ * {@link #isDocumentType} and {@link #isAttributeType}. Other
+ * than their anonymity (lack of a type name) and their appearance
+ * only at the root of an instance, they are otherwise just like
+ * ordinary complex types.
+ * <li>Simple types can be detected using {@link #isSimpleType}.
+ * Complex types are consdered to be all the types that are
+ * not simple.
+ * <li>Simple types are divided into three varieties: atomic types,
+ * list types, and union types. Which variety of simple type
+ * you have can be discoverd using {@link #getSimpleVariety}.
+ * It will return either {@link #ATOMIC}, {@link #LIST}, or
+ * {@link #UNION}.
+ * <li>An {@link #ATOMIC} simple type is always based on one of the
+ * 20 built-in primitive schema types. You can determine
+ * the underlying primitive type for an atomic simple type
+ * by calling {@link #getPrimitiveType}. An atomic type
+ * may add facet restrictions on top of the primitive type,
+ * and these facets can be explored using {@link #getFacet},
+ * {@link #getWhiteSpaceRule}, {@link #matchPatternFacet},
+ * {@link #getEnumerationValues}, and related methods.
+ * <li>A {@link #LIST} simple type is always based on another non-list
+ * simple type. The underlying list item type can be obtained
+ * by using {@link #getListItemType}.
+ * <li>A {@link #UNION} simple type is always composed out of a number of
+ * other simple types. The direct members of the union can
+ * be obtained by {@link #getUnionMemberTypes}. When unions
+ * consist of other unions, it is useful to know useful to know
+ * the "leaves of the union tree", so the
+ * set of non-union types making up the union can be obtained
+ * by {@link #getUnionConstituentTypes}. The closure of the
+ * entire "union tree" is {@link #getUnionSubTypes} (this includes
+ * the type itself). For
+ * simple unions that do not consist of other unions, all three
+ * of these sets are the same.
+ * <li>Complex types have nested structure. They are divided into
+ * four content types: empty content, simple content, element-only
+ * content, and mixed content. All kinds of complex types may
+ * have attributes. The content type for a complex type can
+ * be dermined using {@link #getContentType}. This will return
+ * {@link #EMPTY_CONTENT}, {@link #SIMPLE_CONTENT},
+ * {@link #ELEMENT_CONTENT}, or {@link #MIXED_CONTENT}.
+ * <li>If a complex type has {@link #EMPTY_CONTENT}, the content model will be null.
+ * <li>If a complex type has {@link #SIMPLE_CONTENT}, then it will extend the
+ * simple type that describes the content. In addition, the type
+ * may impose additional simple type facet restrictions; these can
+ * be determined in the same way they are for a simple type.
+ * <li>If a complex type has {@link #ELEMENT_CONTENT} or {@link #MIXED_CONTENT}, then
+ * the detailed content model can be determined by examining
+ * the particle tree (which may be null for MIXED_CONTENT).
+ * The particle tree can be obtained via {@link #getContentModel}.
+ * <li>When working with a complex type, most users will find it
+ * sufficient to discover the summarized shape of the content model
+ * and attribute model using {@link #getElementProperties},
+ * {@link #getAttributeProperties}, and related methods rather than
+ * examining the particle tree and attribute model directly.
+ * </ul>
+ *
+ * @see SchemaTypeLoader
+ * @see XmlObject#schemaType
+ * @see SimpleValue#instanceType
+ */
+public interface SchemaType extends SchemaComponent
+{
+ /**
+ * The name used to describe the type in the schema.
+ * Null if the type is anonymous (nested), or if it is a document type.
+ */
+ public abstract QName getName();
+
+ /**
+ * The parent schema element.
+ * Null for top-level (named) types and document types.
+ */
+ public abstract SchemaField getContainerField();
+
+ /**
+ * True if this is a document type.
+ * <p>
+ * Document types are generated for every global element. A document
+ * type is an unnamed complex type that contains exactly one element:
+ * we define these types, because they are the types of the "documents"
+ * which contain the defined global elements, and they all turn into
+ * Java types. (Named ElementnameDocument.)
+ */
+ public boolean isDocumentType();
+
+ /**
+ * True if this is a attribute type.
+ * <p>
+ * Attribute types are generated for every global attribute. An attribute
+ * type is an unnamed complex type that contains exactly one attribute:
+ * we define these types, because they are the types of the "attribute documents"
+ * which contain the defined global attribute, and they all turn into
+ * Java types. (Named AttributenameAttribute.)
+ */
+ public boolean isAttributeType();
+
+
+ /**
+ * Returns the document element name if this is a document type,
+ * or null otherwise.
+ */
+ public QName getDocumentElementName();
+
+ /**
+ * Returns the attribute qname if this is a attribute type,
+ * or null otherwise.
+ */
+ public QName getAttributeTypeAttributeName();
+
+ /**
+ * The outer schema type.
+ * Null for top-level (named) types.
+ */
+ public abstract SchemaType getOuterType();
+
+ /**
+ * True if this anonymous type has no corresponding Java type. True for
+ * anonymous types nested within simple type restrictions.
+ */
+ public abstract boolean isSkippedAnonymousType();
+
+ /**
+ * True if this schema type was compiled to have a corresponding
+ * Java class.
+ */
+ public abstract boolean isCompiled();
+
+ /**
+ * The fully-qualified Java type name of the class.
+ */
+ public abstract String getFullJavaName();
+
+ /**
+ * The short unqualfiied Java name for the class.
+ */
+ public abstract String getShortJavaName();
+
+ /**
+ * The fully-qualified Java type name of the implementation class.
+ */
+ public abstract String getFullJavaImplName();
+
+ /**
+ * The short unqualfiied Java name for the implementation class.
+ */
+ public abstract String getShortJavaImplName();
+
+ /**
+ * The Java class corresponding to this schema type.
+ */
+ public abstract Class getJavaClass();
+
+ /**
+ * The Java class corresponding to the enumeration type for this schema type,
+ * if applicable (or null if not an enumeration).
+ */
+ public abstract Class getEnumJavaClass();
+
+ /**
+ * True if the Xsd type is anonymous (i.e., not top-level).
+ */
+ public abstract boolean isAnonymousType();
+
+ /**
+ * True for any of the 40+ built-in types.
+ */
+ public abstract boolean isBuiltinType();
+
+ /**
+ * True for the anySimpleType and any restrictions/unions/lists.
+ */
+ public abstract boolean isSimpleType();
+
+ /**
+ * Returns base restriction or extension type. Unions and lists
+ * return the anySimpleType.
+ */
+ public abstract SchemaType getBaseType();
+
+ /**
+ * Returns common base type with the given type. The returned
+ * type is the most specific declared base type of both types.
+ */
+ public abstract SchemaType getCommonBaseType(SchemaType type);
+
+ /**
+ * True if the specified type derives from this type (or if
+ * it is the same type).
+ *
+ * Note that XmlObject.type (the anyType) is assignable
+ * from all type, and the XmlBeans.noType (the absence of
+ * a type) is assignable to all types.
+ */
+ public abstract boolean isAssignableFrom(SchemaType type);
+
+ /**
+ * Returns an integer for the derivation type, either
+ * {@link #DT_EXTENSION}, {@link #DT_RESTRICTION}, {@link #DT_NOT_DERIVED}.
+ */
+ public int getDerivationType();
+
+ /** Not derived. True for XmlObject.type only. See {@link #getDerivationType}. */
+ public static final int DT_NOT_DERIVED = 0;
+ /** Derived by restriction. See {@link #getDerivationType}. */
+ public static final int DT_RESTRICTION = 1;
+ /** Derived by extension. See {@link #getDerivationType}. */
+ public static final int DT_EXTENSION = 2;
+
+ /**
+ * Returns an integer for builtin types that can be used
+ * for quick comparison.
+ */
+ public abstract int getBuiltinTypeCode();
+
+ /** Not a builtin type */
+ public static final int BTC_NOT_BUILTIN = 0;
+ /** xs:anyType, aka {@link XmlObject#type} */
+ public static final int BTC_ANY_TYPE = 1;
+
+ /** The primitive types have codes between BTC_FIRST_PRIMITIVE and BTC_LAST_PRIMITIVE inclusive */
+ public static final int BTC_FIRST_PRIMITIVE = 2;
+
+ /** xs:anySimpleType, aka {@link XmlAnySimpleType#type} */
+ public static final int BTC_ANY_SIMPLE = 2;
+
+ /** xs:boolean, aka {@link XmlBoolean#type} */
+ public static final int BTC_BOOLEAN = 3;
+ /** xs:base64Binary, aka {@link XmlBase64Binary#type} */
+ public static final int BTC_BASE_64_BINARY = 4;
+ /** xs:hexBinary, aka {@link XmlBase64Binary#type} */
+ public static final int BTC_HEX_BINARY = 5;
+ /** xs:anyURI, aka {@link XmlAnyURI#type} */
+ public static final int BTC_ANY_URI = 6;
+ /** xs:QName, aka {@link XmlQName#type} */
+ public static final int BTC_QNAME = 7;
+ /** xs:NOTATION, aka {@link XmlNOTATION#type} */
+ public static final int BTC_NOTATION = 8;
+ /** xs:float, aka {@link XmlFloat#type} */
+ public static final int BTC_FLOAT = 9;
+ /** xs:double, aka {@link XmlDouble#type} */
+ public static final int BTC_DOUBLE = 10;
+ /** xs:decimal, aka {@link XmlDecimal#type} */
+ public static final int BTC_DECIMAL = 11;
+ /** xs:string, aka {@link XmlString#type} */
+ public static final int BTC_STRING = 12;
+
+ /** xs:duration, aka {@link XmlDuration#type} */
+ public static final int BTC_DURATION = 13;
+ /** xs:dateTime, aka {@link XmlDateTime#type} */
+ public static final int BTC_DATE_TIME = 14;
+ /** xs:time, aka {@link XmlTime#type} */
+ public static final int BTC_TIME = 15;
+ /** xs:date, aka {@link XmlDate#type} */
+ public static final int BTC_DATE = 16;
+ /** xs:gYearMonth, aka {@link XmlGYearMonth#type} */
+ public static final int BTC_G_YEAR_MONTH = 17;
+ /** xs:gYear, aka {@link XmlGYear#type} */
+ public static final int BTC_G_YEAR = 18;
+ /** xs:gMonthDay, aka {@link XmlGMonthDay#type} */
+ public static final int BTC_G_MONTH_DAY = 19;
+ /** xs:gDay, aka {@link XmlGDay#type} */
+ public static final int BTC_G_DAY = 20;
+ /** xs:gMonth, aka {@link XmlGMonth#type} */
+ public static final int BTC_G_MONTH = 21;
+
+ /** The primitive types have codes between BTC_FIRST_PRIMITIVE and BTC_LAST_PRIMITIVE inclusive */
+ public static final int BTC_LAST_PRIMITIVE = 21;
+
+ // derived numerics
+ /** xs:integer, aka {@link XmlInteger#type} */
+ public static final int BTC_INTEGER = 22;
+ /** xs:long, aka {@link XmlLong#type} */
+ public static final int BTC_LONG = 23;
+ /** xs:int, aka {@link XmlInt#type} */
+ public static final int BTC_INT = 24;
+ /** xs:short, aka {@link XmlShort#type} */
+ public static final int BTC_SHORT = 25;
+ /** xs:byte, aka {@link XmlByte#type} */
+ public static final int BTC_BYTE = 26;
+ /** xs:nonPositiveInteger, aka {@link XmlNonPositiveInteger#type} */
+ public static final int BTC_NON_POSITIVE_INTEGER = 27;
+ /** xs:NegativeInteger, aka {@link XmlNegativeInteger#type} */
+ public static final int BTC_NEGATIVE_INTEGER = 28;
+ /** xs:nonNegativeInteger, aka {@link XmlNonNegativeInteger#type} */
+ public static final int BTC_NON_NEGATIVE_INTEGER = 29;
+ /** xs:positiveInteger, aka {@link XmlPositiveInteger#type} */
+ public static final int BTC_POSITIVE_INTEGER = 30;
+ /** xs:unsignedLong, aka {@link XmlUnsignedLong#type} */
+ public static final int BTC_UNSIGNED_LONG = 31;
+ /** xs:unsignedInt, aka {@link XmlUnsignedInt#type} */
+ public static final int BTC_UNSIGNED_INT = 32;
+ /** xs:unsignedShort, aka {@link XmlUnsignedShort#type} */
+ public static final int BTC_UNSIGNED_SHORT = 33;
+ /** xs:unsignedByte, aka {@link XmlUnsignedByte#type} */
+ public static final int BTC_UNSIGNED_BYTE = 34;
+
+ // derived strings
+ /** xs:normalizedString, aka {@link XmlNormalizedString#type} */
+ public static final int BTC_NORMALIZED_STRING = 35;
+ /** xs:token, aka {@link XmlToken#type} */
+ public static final int BTC_TOKEN = 36;
+ /** xs:Name, aka {@link XmlName#type} */
+ public static final int BTC_NAME = 37;
+ /** xs:NCName, aka {@link XmlNCName#type} */
+ public static final int BTC_NCNAME = 38;
+ /** xs:language, aka {@link XmlLanguage#type} */
+ public static final int BTC_LANGUAGE = 39;
+ /** xs:ID, aka {@link XmlID#type} */
+ public static final int BTC_ID = 40;
+ /** xs:IDREF, aka {@link XmlIDREF#type} */
+ public static final int BTC_IDREF = 41;
+ /** xs:IDREFS, aka {@link XmlIDREFS#type} */
+ public static final int BTC_IDREFS = 42;
+ /** xs:ENTITY, aka {@link XmlENTITY#type} */
+ public static final int BTC_ENTITY = 43;
+ /** xs:ENTITIES, aka {@link XmlENTITIES#type} */
+ public static final int BTC_ENTITIES = 44;
+ /** xs:NMTOKEN, aka {@link XmlNMTOKEN#type} */
+ public static final int BTC_NMTOKEN = 45;
+ /** xs:NMTOKENS, aka {@link XmlNMTOKENS#type} */
+ public static final int BTC_NMTOKENS = 46;
+
+ public static final int BTC_LAST_BUILTIN = 46;
+
+ /**
+ * True for anyType and anySimpleType.
+ */
+ public boolean isURType();
+
+ /**
+ * True for the type object that represents a the absence of a determined type.
+ * XML Objects whose type isNoType() are never valid.
+ */
+ public boolean isNoType();
+
+ /**
+ * Returns the SchemaTypeLoader in which this type was defined.
+ * Complex types are defined and used in exactly one schema type
+ * system, but simple types are defined in one type system and can
+ * be used in any number of type systems. The most common case is
+ * the builtin types, which are defined in the builtin type system
+ * and used elsewhere.
+ */
+ public SchemaTypeSystem getTypeSystem();
+
+ /**
+ * Returns the filename for the XSD file from which this type
+ * was loaded. Intended for use when debugging.
+ */
+ public String getSourceName();
+
+ /** True if this type cannot be used directly in instances */
+ public boolean isAbstract();
+
+ /** True if other types cannot extend this type (only for complex types) */
+ public boolean finalExtension();
+
+ /** True if other types cannot restrict this type */
+ public boolean finalRestriction();
+
+ /** True if list derivation of this type is prohibited (only for simple types) */
+ public boolean finalList();
+
+ /** True if union derivation of this type is prohibited (only for simple types) */
+ public boolean finalUnion();
+
+ /** True if extensions of this type cannot be substituted for this type */
+ public boolean blockExtension();
+
+ /** True if restrictions of this type cannot be substituted for this type */
+ public boolean blockRestriction();
+
+ /**
+ * Returns {@link #EMPTY_CONTENT}, {@link #SIMPLE_CONTENT}, {@link #ELEMENT_CONTENT}, or
+ * {@link #MIXED_CONTENT} for complex types. For noncomplex types, returns
+ * {@link #NOT_COMPLEX_TYPE}.
+ */
+ public abstract int getContentType();
+
+ /** Not a complex type. See {@link #getContentType()}. */
+ public static final int NOT_COMPLEX_TYPE = 0;
+ /** Empty content. See {@link #getContentType()}. */
+ public static final int EMPTY_CONTENT = 1;
+ /** Simple content. See {@link #getContentType()}. */
+ public static final int SIMPLE_CONTENT = 2;
+ /** Element-only content. See {@link #getContentType()}. */
+ public static final int ELEMENT_CONTENT = 3;
+ /** Mixed content. See {@link #getContentType()}. */
+ public static final int MIXED_CONTENT = 4;
+
+
+ /**
+ * Returns a {@link SchemaTypeElementSequencer} object, which can then
+ * be used to validate complex content inside this element. This is useful
+ * for example for trying out different names and see which one would be
+ * valid as a child of this element.
+ */
+ SchemaTypeElementSequencer getElementSequencer();
+
+ /**
+ * The array of inner (anonymous) types defined
+ * within this type.
+ */
+ public abstract SchemaType[] getAnonymousTypes();
+
+ /**
+ * Returns a SchemaProperty corresponding to an element within this
+ * complex type by looking up the element name.
+ */
+ public abstract SchemaProperty getElementProperty(QName eltName);
+
+ /**
+ * Returns all the SchemaProperties corresponding to elements.
+ */
+ public abstract SchemaProperty[] getElementProperties();
+
+ /**
+ * Returns a SchemaProperty corresponding to an attribute within this
+ * complex type by looking up the attribute name.
+ */
+ public abstract SchemaProperty getAttributeProperty(QName attrName);
+
+ /**
+ * Returns all the SchemaProperties corresponding to attributes.
+ */
+ public abstract SchemaProperty[] getAttributeProperties();
+
+ /**
+ * Returns all the SchemaProperties within this complex type,
+ * elements followed by attributes.
+ */
+ public abstract SchemaProperty[] getProperties();
+
+ /**
+ * Returns the SchemaProperties defined by this complex type,
+ * exclusive of the base type (if any).
+ */
+ SchemaProperty[] getDerivedProperties();
+
+ /**
+ * Returns the attribute model for this complex type (with simple or complex content).
+ */
+ public abstract SchemaAttributeModel getAttributeModel();
+
+ /**
+ * True if this type permits wildcard attributes. See the attribute model for
+ * more information about which wildcards are allowed.
+ */
+ public abstract boolean hasAttributeWildcards();
+
+ /**
+ * Returns the complex content model for this complex type (with complex content).
+ */
+ public abstract SchemaParticle getContentModel();
+
+ /**
+ * True if this type permits element wildcards. See the content model for
+ * more information about which wildcards are allowed, and where.
+ */
+ public abstract boolean hasElementWildcards();
+
+ /**
+ * For document types, true if the given name can be substituted for the
+ * document element name.
+ */
+ public boolean isValidSubstitution(QName name);
+
+ /**
+ * True if the complex content model for this complex type is an "all" group.
+ */
+ public abstract boolean hasAllContent();
+
+ /**
+ * True if particles have same defaults, nillability, etc, that are
+ * invariant when order changes. Computed only for Javaized types.
+ */
+ public abstract boolean isOrderSensitive();
+
+ /**
+ * Returns the type of a child element based on the element name and
+ * an xsi:type attribute (and the type system within which names are
+ * resolved).
+ */
+ public abstract SchemaType getElementType(QName eltName, QName xsiType, SchemaTypeLoader wildcardTypeLoader);
+
+ /**
+ * Returns the type of an attribute based on the attribute name and
+ * the type system within which (wildcard) names are resolved.
+ */
+ public abstract SchemaType getAttributeType(QName eltName, SchemaTypeLoader wildcardTypeLoader);
+
+ /*************************************************************/
+ /* SIMPLE TYPE MODEL BELOW */
+ /*************************************************************/
+
+ /** xs:length facet */
+ public static final int FACET_LENGTH = 0;
+ /** xs:minLength facet */
+ public static final int FACET_MIN_LENGTH = 1;
+ /** xs:maxLength facet */
+ public static final int FACET_MAX_LENGTH = 2;
+ /** xs:minExclusive facet */
+ public static final int FACET_MIN_EXCLUSIVE = 3;
+ /** xs:minInclusive facet */
+ public static final int FACET_MIN_INCLUSIVE = 4;
+ /** xs:maxInclusive facet */
+ public static final int FACET_MAX_INCLUSIVE = 5;
+ /** xs:maxExclusive facet */
+ public static final int FACET_MAX_EXCLUSIVE = 6;
+ /** xs:totalDigits facet */
+ public static final int FACET_TOTAL_DIGITS = 7;
+ /** xs:fractionDigits facet */
+ public static final int FACET_FRACTION_DIGITS = 8;
+
+ public static final int LAST_BASIC_FACET = 8;
+
+ /** xs:whiteSpace facet - use {@link #getWhiteSpaceRule} instead */
+ public static final int FACET_WHITE_SPACE = 9;
+ /** xs:pattern facet - use {@link #matchPatternFacet} instead */
+ public static final int FACET_PATTERN = 10;
+ /** xs:enumeration facet - use {@link #getEnumerationValues} instead */
+ public static final int FACET_ENUMERATION = 11;
+
+ /** The last ordinary facet code */
+ public static final int LAST_FACET = 11;
+
+ /** @see #ordered */
+ public static final int PROPERTY_ORDERED = 12;
+ /** @see #isBounded */
+ public static final int PROPERTY_BOUNDED = 13;
+ /** @see #isFinite */
+ public static final int PROPERTY_CARDINALITY = 14;
+ /** @see #isNumeric */
+ public static final int PROPERTY_NUMERIC = 15;
+
+ /** The last property code */
+ public static final int LAST_PROPERTY = 15;
+
+
+ /**
+ * Returns the value of the given facet, or null if
+ * none is set.
+ */
+ public abstract XmlAnySimpleType getFacet(int facetCode);
+
+ /**
+ * True if the given facet is fixed.
+ */
+ public abstract boolean isFacetFixed(int facetCode);
+
+ /**
+ * True if ordered. Returns either {@link #UNORDERED},
+ * {@link #PARTIAL_ORDER}, or {@link #TOTAL_ORDER}.
+ */
+ public abstract int ordered();
+
+ /** Unordered. See {@link #ordered}. */
+ public static int UNORDERED = 0;
+ /** Partially ordered. See {@link #ordered}. */
+ public static int PARTIAL_ORDER = 1;
+ /** Totally ordered. See {@link #ordered}. */
+ public static int TOTAL_ORDER = 2;
+
+ /**
+ * True if bounded.
+ */
+ public abstract boolean isBounded();
+
+ /**
+ * True if finite.
+ */
+ public abstract boolean isFinite();
+
+ /**
+ * True if numeric.
+ */
+ public abstract boolean isNumeric();
+
+ /**
+ * True if there are regex pattern facents
+ */
+ public abstract boolean hasPatternFacet();
+
+ /**
+ * True
+ */
+ public abstract String[] getPatterns();
+
+ /**
+ * True if the given string matches the pattern facets.
+ * Always true if there are no pattern facets.
+ */
+ public abstract boolean matchPatternFacet(String s);
+
+ /**
+ * Returns the array of valid objects from the
+ * enumeration facet, null if no enumeration defined.
+ */
+ public abstract XmlAnySimpleType[] getEnumerationValues();
+
+ /**
+ * True if this is a string enum where an integer
+ * is assigned to each enumerated value.
+ */
+ public abstract boolean hasStringEnumValues();
+
+ /**
+ * If this is a string enumeration, returns the most basic base schema
+ * type that this enuemration is based on. Otherwise returns null.
+ */
+ public abstract SchemaType getBaseEnumType();
+
+ /**
+ * Returns the array of SchemaStringEnumEntries for this type: this
+ * array includes information about the java constant names used for
+ * each string enum entry.
+ */
+ public SchemaStringEnumEntry[] getStringEnumEntries();
+
+ /**
+ * Returns the string enum entry corresponding to the given enumerated
+ * string, or null if there is no match or this type is not
+ * a string enumeration.
+ */
+ public SchemaStringEnumEntry enumEntryForString(String s);
+
+ /**
+ * Returns the string enum value corresponding to the given enumerated
+ * string, or null if there is no match or this type is not
+ * a string enumeration.
+ */
+ public abstract StringEnumAbstractBase enumForString(String s);
+
+ /**
+ * Returns the string enum value corresponding to the given enumerated
+ * string, or null if there is no match or this type is not
+ * a string enumeration.
+ */
+ public abstract StringEnumAbstractBase enumForInt(int i);
+
+ /**
+ * True for any of the 20 primitive types (plus anySimpleType)
+ */
+ public abstract boolean isPrimitiveType();
+
+ /**
+ * Returns whether the simple type is ATOMIC, UNION, or LIST.
+ * Returns {@link #NOT_SIMPLE}, {@link #ATOMIC}, {@link #UNION},
+ * or {@link #LIST}.
+ */
+ public abstract int getSimpleVariety();
+
+ /** Not a simple type or simple content. See {@link #getSimpleVariety}. */
+ public static final int NOT_SIMPLE = 0;
+ /** Atomic type. See {@link #getSimpleVariety} */
+ public static final int ATOMIC = 1;
+ /** Union type. See {@link #getSimpleVariety} */
+ public static final int UNION = 2;
+ /** Simple list type. See {@link #getSimpleVariety} */
+ public static final int LIST = 3;
+
+
+ /**
+ * For atomic types only: get the primitive type underlying this one.
+ * <p>
+ * Returns null if this is not an atomic type.
+ */
+ public abstract SchemaType getPrimitiveType();
+
+ /**
+ * For atomic numeric restrictions of decimal only: the
+ * numeric size category. Takes into account min and max
+ * restrictions as well as totalDigits and fractionDigits
+ * facets.
+ * <p>
+ * Returns either {@link #NOT_DECIMAL},
+ * {@link #SIZE_BYTE}, {@link #SIZE_SHORT}, {@link #SIZE_INT},
+ * {@link #SIZE_LONG}, {@link #SIZE_BIG_INTEGER}, or
+ * {@link #SIZE_BIG_DECIMAL}.
+ */
+ public abstract int getDecimalSize();
+
+ /** Not a decimal restriction. See {@link #getDecimalSize}. */
+ public static final int NOT_DECIMAL = 0;
+ /** Fits in a byte. See {@link #getDecimalSize}. */
+ public static final int SIZE_BYTE = 8;
+ /** Fits in a short. See {@link #getDecimalSize}. */
+ public static final int SIZE_SHORT = 16;
+ /** Fits in an int. See {@link #getDecimalSize}. */
+ public static final int SIZE_INT = 32;
+ /** Fits in a long. See {@link #getDecimalSize}. */
+ public static final int SIZE_LONG = 64;
+ /** Fits in a {@link java.math.BigInteger}. See {@link #getDecimalSize}. */
+ public static final int SIZE_BIG_INTEGER = 1000000; // "millions"
+ /** Fits in a {@link java.math.BigDecimal}. See {@link #getDecimalSize}. */
+ public static final int SIZE_BIG_DECIMAL = 1000001; // "even more"
+
+ /**
+ * For union types only: get the shallow member types. This
+ * returns the declared member types of the union, so, for
+ * example if the type contains another union, the nested
+ * members of that union are NOT returned here.
+ * <p>
+ * Returns null if this type is not a union.
+ */
+ public abstract SchemaType[] getUnionMemberTypes();
+
+ /**
+ * For union types only: gets the full tree of member types.
+ * This computes the closure of the set returned by
+ * getUnionMemberTypes(), so, for example, it returns
+ * all the types nested within unions of unions as well
+ * as the top-level members; the set also includes the
+ * type itself. If you are seeking only the basic
+ * non-union consituents, use getUnionConstituentTypes.
+ * <p>
+ * Returns null if this type is not a union.
+ */
+ public abstract SchemaType[] getUnionSubTypes();
+
+ /**
+ * For union types only: get the constituent member types. This
+ * returns only non-union types, so, for example, for unions of
+ * unions, this returns the flattened list of individual member
+ * types within the innermost unions.
+ * <p>
+ * Returns null if this type is not a union.
+ */
+ public abstract SchemaType[] getUnionConstituentTypes();
+
+ /**
+ * For union types only: get the most specific common base
+ * type of the constituent member types. May return a UR type.
+ * <p>
+ * Returns null if this type is not a union.
+ */
+ public abstract SchemaType getUnionCommonBaseType();
+
+ /**
+ * For anonymous types defined inside a union only: gets
+ * the integer indicating the declaration order of this
+ * type within the outer union type, or zero if this is
+ * not applicable. The first anonymous union member within
+ * a union type is numbered "1". Used to differentiate
+ * between different anonymous types.
+ */
+ public abstract int getAnonymousUnionMemberOrdinal();
+
+ /**
+ * For list types only: get the item type. This is the atomic
+ * or union type that is the type of every entry in the list.
+ * <p>
+ * Returns null if this type is not a list.
+ */
+ public abstract SchemaType getListItemType();
+
+ /**
+ * For nonunion simple types: get the whitespace rule. This is
+ * either {@link #WS_PRESERVE}, {@link #WS_REPLACE}, or
+ * {@link #WS_COLLAPSE}. Returns {@link #WS_UNSPECIFIED}
+ * for unions and complex types.
+ */
+ public abstract int getWhiteSpaceRule();
+
+ /** Whitespace rule unspecified. See {@link #getWhiteSpaceRule}. */
+ public static final int WS_UNSPECIFIED = 0;
+ /** Whitespace preserved. See {@link #getWhiteSpaceRule}. */
+ public static final int WS_PRESERVE = 1;
+ /** Whitespace replaced by ordinary space. See {@link #getWhiteSpaceRule}. */
+ public static final int WS_REPLACE = 2;
+ /** Whitespace collapsed and trimmed. See {@link #getWhiteSpaceRule}. */
+ public static final int WS_COLLAPSE = 3;
+
+ /**
+ * Creates an immutable simple type value that does not reside in a tree.
+ */
+ public abstract XmlAnySimpleType newValue(Object v);
+
+
+ /**
+ * Used to allow on-demand loading of types.
+ *
+ * @exclude
+ */
+ public final static class Ref extends SchemaComponent.Ref
+ {
+ public Ref(SchemaType type)
+ { super(type); }
+
+ public Ref(SchemaTypeSystem system, String handle)
+ { super(system, handle); }
+
+ public final int getComponentType()
+ { return SchemaComponent.TYPE; }
+
+ public final SchemaType get()
+ { return (SchemaType)getComponent(); }
+ }
+
+ /**
+ * Retruns a SchemaType.Ref pointing to this schema type itself.
+ */
+ public Ref getRef();
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeElementSequencer.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeElementSequencer.java
new file mode 100644
index 0000000..6e19347
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeElementSequencer.java
@@ -0,0 +1,43 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class is used to programatically validate the contents of an
+ * XML element.Call to both {@link #next} and {@link #peek}
+ * will return true if the element
+ * with the provided name is allowed at the current position in the element
+ * content, the difference being that {@link #next} will advance
+ * the current position, while {@link #peek} won't.
+ *
+ * @see SchemaType#getElementSequencer
+ */
+public interface SchemaTypeElementSequencer
+{
+ /**
+ * Returns true if the element with the given name is valid at the
+ * current position. Advances the current position.
+ */
+ boolean next(QName elementName);
+
+ /**
+ * Return true if the element with the given name is valid at the
+ * current position. Does not advance the current position.
+ */
+ boolean peek(QName elementName);
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoader.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoader.java
new file mode 100644
index 0000000..347ee50
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoader.java
@@ -0,0 +1,158 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.URL;
+
+import org.w3c.dom.Node;
+
+/**
+ * Represents a searchable set of XML Schema component definitions.
+ * <p>
+ * SchemaTypeLoader is somewhat analogous to {@link java.lang.ClassLoader},
+ * because it is responsible for finding {@link SchemaComponent} definitions
+ * by name, yet it is not responsible for being able to enumerate all the
+ * component definitons available. (If you wish to enumerate component
+ * definitions, see {@link SchemaTypeSystem}.) There are some ways in which
+ * SchemaTypeSystems are dissimilar from ClassLoaders, however.
+ * Since XML Schema has a number of instance-oriented typing mechanisms
+ * (such as wildcards) that do not exist in Java, a SchemaTypeLoader is
+ * not associated with a type; instead, a SchemaTypeLoader is associated
+ * with each XML instance.
+ * <p>
+ * Every XML instance is loaded within the context of a SchemaTypeLoader;
+ * the SchemaTypeLoader for an instance is used to resolve all type definitions
+ * within the instance and for applying type-sensitive methods such as
+ * {@link XmlObject#validate}.
+ * <p>
+ * Normally the SchemaTypeLoader being used for all instances is the
+ * context type loader (that is, the SchemaTypeLoader returned from
+ * {@link XmlBeans#getContextTypeLoader()}). The context type loader
+ * consults the thread's context ClassLoader (see {@link Thread#getContextClassLoader()})
+ * to find schema type defintions that are available on the classpath.
+ * The net result is that you can use schema types simply by putting
+ * their compiled schema JARs on your classpath.
+ * If you wish to load instances using a different SchemaTypeLoader, then you must
+ * call {@link #parse} methods on the SchemaTypeLoader instance explicitly
+ * rather than using the normal convenient Factory methods.
+ * <p>
+ * A SchemaTypeLoader can be obtained by dynamically loading XSD files
+ * using {@link XmlBeans#loadXsd}, or by assembling other SchemaTypeLoaders
+ * or SchemaTypeSystems on a path using {@link XmlBeans#typeLoaderUnion}.
+ *
+ * @see XmlBeans#loadXsd
+ * @see XmlBeans#getContextTypeLoader
+ * @see XmlBeans#typeLoaderUnion
+ * @see SchemaTypeSystem
+ */
+public interface SchemaTypeLoader
+{
+ /** Returns the type with the given name, or null if none. */
+ public SchemaType findType(QName name);
+
+ /** Returns the document type rooted at the given element name, or null if none. */
+ public SchemaType findDocumentType(QName name);
+
+ /** Returns the attribute type containing the given attribute name, or null if none. */
+ public SchemaType findAttributeType(QName name);
+
+ /** Returns the global element defintion with the given name, or null if none. */
+ public SchemaGlobalElement findElement(QName name);
+
+ /** Returns the global attribute defintion with the given name, or null if none. */
+ public SchemaGlobalAttribute findAttribute(QName name);
+
+ /** Returns the model group defintion with the given name, or null if none. */
+ public SchemaModelGroup findModelGroup(QName name);
+
+ /** Returns the attribute group defintion with the given name, or null if none. */
+ public SchemaAttributeGroup findAttributeGroup(QName name);
+
+ /** True if the typeloader contains any definitions in the given namespace. */
+ public boolean isNamespaceDefined(String namespace);
+
+ /** Used for on-demand loading. */
+ public SchemaType.Ref findTypeRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaType.Ref findDocumentTypeRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaType.Ref findAttributeTypeRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaGlobalElement.Ref findElementRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaGlobalAttribute.Ref findAttributeRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaModelGroup.Ref findModelGroupRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaAttributeGroup.Ref findAttributeGroupRef(QName name);
+
+ /** Used for on-demand loading. */
+ public SchemaIdentityConstraint.Ref findIdentityConstraintRef(QName name);
+
+ /** Finds a type for a given signature string */
+ public SchemaType typeForSignature(String signature);
+
+ /** Finds a type for a given fully-qualified XML Bean classname */
+ public SchemaType typeForClassname(String classname);
+
+ /** Loads original XSD source as a stream. See {@link SchemaType#getSourceName}. */
+ public InputStream getSourceAsStream(String sourceName);
+
+ /** Compiles an XPath */
+ public String compilePath(String pathExpr, XmlOptions options) throws XmlException;
+
+ /** Compiles an XQuery */
+ public String compileQuery(String queryExpr, XmlOptions options) throws XmlException;
+
+ /** Creates an instance of the given type. */
+ public XmlObject newInstance ( SchemaType type, XmlOptions options );
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( String xmlText, SchemaType type, XmlOptions options ) throws XmlException;
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( File file, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( URL file, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( InputStream jiois, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( Reader jior, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Parses an instance of the given type. */
+ public XmlObject parse ( Node node, SchemaType type, XmlOptions options ) throws XmlException;
+ /** Parses an instance of the given type.
+ * @deprecated Superceded by JSR 173
+ */
+ public XmlObject parse ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException;
+ /** Returns an XmlSaxHandler that can parse an instance of the given type. */
+ public XmlSaxHandler newXmlSaxHandler ( SchemaType type, XmlOptions options );
+ /** Returns a validating XMLInputStream that will throw an exception if the XML is not valid
+ * @deprecated Superceded by JSR 173
+ */
+ public XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException;
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoaderException.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoaderException.java
new file mode 100644
index 0000000..0cb6e3e
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeLoaderException.java
@@ -0,0 +1,78 @@
+/* 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.xmlbeans;
+
+/**
+ * An exception that is thrown if there is corruption or a version mismatch
+ * in a compiled schema type system.
+ */
+public class SchemaTypeLoaderException extends XmlRuntimeException
+{
+ private int _code;
+
+ /** Constructs an exception with the given message, filename, extension, and code */
+ public SchemaTypeLoaderException(String message, String name, String handle, int code)
+ {
+ super(message + " (" + name + "." + handle + ") - code " + code);
+ _code = code;
+ }
+
+ /** Constructs an exception with the given message, filename, extension, code, and cause */
+ public SchemaTypeLoaderException(String message, String name, String handle, int code, Exception cause)
+ {
+ super(message + " (" + name + "." + handle + ") - code " + code);
+ _code = code;
+ initCause(cause);
+ }
+
+ /** Returns the reason for the failure, given by one of the numeric constants in this class */
+ public int getCode()
+ {
+ return _code;
+ }
+
+ /* See {@link #getCode}. */
+ public static final int NO_RESOURCE = 0;
+ /* See {@link #getCode}. */
+ public static final int WRONG_MAGIC_COOKIE = 1;
+ /* See {@link #getCode}. */
+ public static final int WRONG_MAJOR_VERSION = 2;
+ /* See {@link #getCode}. */
+ public static final int WRONG_MINOR_VERSION = 3;
+ /* See {@link #getCode}. */
+ public static final int WRONG_FILE_TYPE = 4;
+ /* See {@link #getCode}. */
+ public static final int UNRECOGNIZED_INDEX_ENTRY = 5;
+ /* See {@link #getCode}. */
+ public static final int WRONG_PROPERTY_TYPE = 6;
+ /* See {@link #getCode}. */
+ public static final int MALFORMED_CONTENT_MODEL = 7;
+ /* See {@link #getCode}. */
+ public static final int WRONG_SIMPLE_VARIETY = 8;
+ /* See {@link #getCode}. */
+ public static final int IO_EXCEPTION = 9;
+ /* See {@link #getCode}. */
+ public static final int INT_TOO_LARGE = 10;
+ /* See {@link #getCode}. */
+ public static final int BAD_PARTICLE_TYPE = 11;
+ /* See {@link #getCode}. */
+ public static final int NOT_WRITEABLE = 12;
+ /* See {@link #getCode}. */
+ public static final int BAD_HANDLE = 13;
+ /* See {@link #getCode}. */
+ public static final int NESTED_EXCEPTION = 14;
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeSystem.java b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeSystem.java
new file mode 100644
index 0000000..a127b95
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SchemaTypeSystem.java
@@ -0,0 +1,199 @@
+/* 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.xmlbeans;
+
+import java.io.File;
+
+/**
+ * A finite set of XML Schema component definitions.
+ * <p>
+ * Every {@link SchemaComponent} such as a {@link SchemaType},
+ * {@link SchemaGlobalElement}, {@link SchemaGlobalAttribute},
+ * {@link SchemaModelGroup}, {@link SchemaAttributeGroup}, or
+ * {@link SchemaIdentityConstraint}, is defined in exactly one
+ * SchemaTypeSystem. (See {@link SchemaComponent#getTypeSystem()}.)
+ * A single SchemaTypeSystem can include definitions
+ * from any number of namespaces; one SchemaTypeSystem consists simply
+ * of a set of component definitions that were compiled together.
+ * <p>
+ * Since every component is defined in a single SchemaTypeSystem, no
+ * SchemaTypeSystem other than {@link XmlBeans#getBuiltinTypeSystem()}
+ * includes any of the the built-in types. That means
+ * you cannot ordinarily load instances using a single
+ * SchemaTypeSystem by itself. Instead, you will want to combine a path of
+ * SchemaTypeSystems together using {@link XmlBeans#typeLoaderUnion}
+ * to form a SchemaTypeLoader that can be used for loading instances.
+ * <p>
+ * For example, the following code compiles the schema in myXSDFile
+ * in the presence of only the minimal builtin type system.
+ * The resulting SchemaTypeSystem <code>sts</code> contains only the definitions
+ * from myXSD file. In order to load and validate an instance within
+ * the context of those types, we must next construct a
+ * {@link SchemaTypeLoader} <code>stl</code> that contains both
+ * the builtin type system and the types defined within the myXSD file.
+ * <pre>
+ * SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]
+ * { XmlObject.Factory.parse(myXSDFile) },
+ * XmlBeans.getBuiltinTypeSystem(),
+ * null);
+ * SchemaTypeLoader stl = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[]
+ * { sts, XmlBeans.getBuiltinTypeSystem() });
+ * XmlObject mydoc = stl.parse(instanceFile, null, null);
+ * System.out.println("Document valid: " + mydoc.validate());
+ * </pre>
+ * <p>
+ * As you can see, for working with instances, you typically want to
+ * work with a SchemaTypeLoader constructed from a path rather than
+ * a solitary SchemaTypeSystem. See {@link XmlBeans#loadXsd} for
+ * a convenient alternative to {@link XmlBeans#compileXsd}.
+ * <p>
+ * A SchemaTypeSystem is useful when you need to enumerate the exact set
+ * of component definitions derived from a set of XSD files, for example,
+ * when you are analyzing the contents of the XSD files themselves.
+ * Here is how to use a SchemaTypeSystem to inspect a set of schema
+ * definitions:
+ * <ol>
+ * <li>First, use {@link XmlBeans#compileXsd} to compile any number
+ * of schema files. If the schema files are valid, result will
+ * be a SchemaTypeSystem that contains all the component definitions
+ * from those files. It will contain no other component definitions.
+ * <li>Alternatively, call {@link SchemaComponent#getTypeSystem} on
+ * a precompiled schema component to discover the SchemaTypeSystem
+ * within which that component was originally compiled.
+ * <li>Once you have a SchemaTypeSystem, call:
+ * <ul>
+ * <li> {@link #globalTypes()} for all the global type definitions.
+ * <li> {@link #globalElements()} for all the global element definitions.
+ * <li> {@link #globalAttributes()} for all the global attribute definitions.
+ * <li> {@link #modelGroups()} for all the named model group definitions.
+ * <li> {@link #attributeGroups()} for all the attribute group definitions.
+ * </ul>
+ * <li>In addition, there are special types generated for XML Beans thare
+ * are not formally part of the Schema specification:
+ * <ul>
+ * <li> {@link #documentTypes()} returns all the document types.
+ * <li> {@link #attributeTypes()} returns all the attribute types.
+ * </ul>
+ * </ol>
+ *
+ * <p>
+ * A document type is a type that contains a single global element; there
+ * is one document type for each global element definition in a
+ * SchemaTypeSystem. In an instance document, only the root XmlObject
+ * can have a document type as its type.
+ * <p>
+ * Similarly, an attribute type is a type that contains a single global
+ * attribute, and there is one attribute type for each global attribute
+ * definition in a SchemaTypeSystem. It is possible to have a root
+ * XmlObject representing a fragment whose type is an attribute type,
+ * but attribute types are present mainly for symmetry and to simplify
+ * code such as the type-tree-walking code below.
+ * <p>
+ * The global component methods above only provide a view of the top-level
+ * components of a SchemaTypeSystem and do not include any nested
+ * definitions. To view all the nested definitions, you will want to
+ * traverse the entire tree of {@link SchemaType} defintions within a
+ * SchemaTypeSystem by examining the {@link SchemaType#getAnonymousTypes()}
+ * within each {@link SchemaType} recursively.
+ * <p>The following code is a standard treewalk that visits every
+ * {@link SchemaType} in the SchemaTypeSystem once, including nested
+ * definitions.
+ * <pre>
+ * List allSeenTypes = new ArrayList();
+ * allSeenTypes.addAll(Arrays.asList(typeSystem.documentTypes()));
+ * allSeenTypes.addAll(Arrays.asList(typeSystem.attributeTypes()));
+ * allSeenTypes.addAll(Arrays.asList(typeSystem.globalTypes()));
+ * for (int i = 0; i < allSeenTypes.size(); i++)
+ * {
+ * SchemaType sType = (SchemaType)allSeenTypes.get(i);
+ * System.out.prinlnt("Visiting " + sType.toString());
+ * allSeenTypes.addAll(Arrays.asList(sType.getAnonymousTypes()));
+ * }
+ * </pre>
+ *
+ * @see SchemaType
+ * @see SchemaTypeLoader
+ * @see XmlBeans#compileXsd
+ * @see XmlBeans#typeLoaderUnion
+ * @see XmlBeans#getBuiltinTypeSystem
+ */
+public interface SchemaTypeSystem extends SchemaTypeLoader
+{
+ /**
+ * Returns the name of this loader.
+ */
+ public String getName();
+
+ /**
+ * Returns the global types defined in this loader.
+ */
+ public org.apache.xmlbeans.SchemaType[] globalTypes();
+
+ /**
+ * Returns the document types defined in this loader.
+ */
+ public org.apache.xmlbeans.SchemaType[] documentTypes();
+
+ /**
+ * Returns the attribute types defined in this loader.
+ */
+ public org.apache.xmlbeans.SchemaType[] attributeTypes();
+
+ /**
+ * Returns the global elements defined in this loader.
+ */
+ public SchemaGlobalElement[] globalElements();
+
+ /**
+ * Returns the global attributes defined in this loader.
+ */
+ public SchemaGlobalAttribute[] globalAttributes();
+
+ /**
+ * Returns the model groups defined in this loader.
+ */
+ public SchemaModelGroup[] modelGroups();
+
+ /**
+ * Returns the attribute groups defined in this loader.
+ */
+ public SchemaAttributeGroup[] attributeGroups();
+
+ /**
+ * Initializes a type system (resolves all handles within the type system).
+ */
+ public void resolve();
+
+ /**
+ * Locates a type, element, or attribute using the handle.
+ */
+ public SchemaComponent resolveHandle(String handle);
+
+ /**
+ * Locates a type, element, or attribute using the handle.
+ */
+ public SchemaType typeForHandle(String handle);
+
+ /**
+ * Returns the classloader used by this loader for resolving types.
+ */
+ public ClassLoader getClassLoader();
+
+ /**
+ * Saves this type to a directory.
+ */
+ public void saveToDirectory(File classDir);
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/SimpleValue.java b/v1/src/xmlpublic/org/apache/xmlbeans/SimpleValue.java
new file mode 100644
index 0000000..8b5494a
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/SimpleValue.java
@@ -0,0 +1,333 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.Date;
+import java.util.Calendar;
+import java.math.BigInteger;
+import java.math.BigDecimal;
+
+/**
+ * All XmlObject implementations can be coerced to SimpleValue.
+ * For any given schema type, only a subset of the conversion
+ * methods will work. Others will throw an exception.
+ * <p>
+ * SimpleValue is useful for declaring variables which can hold
+ * more than one similar schema type that may not happen to
+ * have a common XML base type, for example, two list types,
+ * or two unrelated integer restrictions that happen to fit
+ * into an int.
+ */
+public interface SimpleValue extends XmlObject
+{
+ /**
+ * The same as getSchemaType unless this is a union instance
+ * or nil value.
+ * <p>
+ * For unions, this returns the non-union consituent type of
+ * this instance. This type may change if setters are called
+ * that cause the instance to change to another constituent
+ * type of the union.
+ * <p>
+ * For nil values, this returns null.
+ */
+ SchemaType instanceType();
+
+ /** Returns the value as a {@link String}. */
+ String getStringValue();
+ /** Returns the value as a boolean. */
+ boolean getBooleanValue();
+ /** Returns the value as a byte. */
+ public byte getByteValue();
+ /** Returns the value as a short. */
+ public short getShortValue();
+ /** Returns the value as an int. */
+ public int getIntValue();
+ /** Returns the value as a long. */
+ public long getLongValue();
+ /** Returns the value as a {@link BigInteger}. */
+ public BigInteger getBigIntegerValue();
+ /** Returns the value as a {@link BigDecimal}. */
+ public BigDecimal getBigDecimalValue();
+ /** Returns the value as a float. */
+ public float getFloatValue();
+ /** Returns the value as a double. */
+ public double getDoubleValue();
+ /** Returns the value as a byte array. */
+ byte[] getByteArrayValue();
+ /** Returns the value as a {@link StringEnumAbstractBase}. */
+ StringEnumAbstractBase getEnumValue();
+ /** Returns the value as a {@link Calendar}. */
+ Calendar getCalendarValue();
+ /** Returns the value as a {@link Date}. */
+ Date getDateValue();
+ /** Returns the value as a {@link GDate}. */
+ GDate getGDateValue();
+ /** Returns the value as a {@link GDuration}. */
+ GDuration getGDurationValue();
+ /** Returns the value as a {@link QName}. */
+ QName getQNameValue();
+ /** Returns the value as a {@link List} of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). */
+ List getListValue();
+ /** Returns the value as a {@link List} of XmlAnySimpleType objects. */
+ List xgetListValue();
+
+ /** Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). */
+ Object getObjectValue();
+
+ // following are simple type value setters
+
+ /** Sets the value as a {@link String}. */
+ void setStringValue(String obj);
+ /** Sets the value as a boolean. */
+ void setBooleanValue(boolean v);
+ /** Sets the value as a byte. */
+ void setByteValue(byte v);
+ /** Sets the value as a short. */
+ void setShortValue(short v);
+ /** Sets the value as an int. */
+ void setIntValue(int v);
+ /** Sets the value as a long. */
+ void setLongValue(long v);
+ /** Sets the value as a {@link BigInteger}. */
+ void setBigIntegerValue(BigInteger obj);
+ /** Sets the value as a {@link BigDecimal}. */
+ void setBigDecimalValue(BigDecimal obj);
+ /** Sets the value as a float. */
+ void setFloatValue(float v);
+ /** Sets the value as a double. */
+ void setDoubleValue(double v);
+ /** Sets the value as a byte array. */
+ void setByteArrayValue(byte[] obj);
+ /** Sets the value as a {@link StringEnumAbstractBase}. */
+ void setEnumValue(StringEnumAbstractBase obj);
+ /** Sets the value as a {@link Calendar}. */
+ void setCalendarValue(Calendar obj);
+ /** Sets the value as a {@link Date}. */
+ void setDateValue(Date obj);
+ /** Sets the value as a {@link GDate}. */
+ void setGDateValue(GDate obj);
+ /** Sets the value as a {@link GDuration}. */
+ void setGDurationValue(GDuration obj);
+ /** Sets the value as a {@link QName}. */
+ void setQNameValue(QName obj);
+ /** Sets the value as a {@link List}. */
+ void setListValue(List obj);
+ /** Sets the value as an arbitrary {@link Object}. */
+ void setObjectValue(Object obj);
+
+ /**
+ * Returns the value as a {@link String}. *
+ * @deprecated replaced with {@link #getStringValue}
+ */
+ String stringValue();
+ /**
+ * Returns the value as a boolean. *
+ * @deprecated replaced with {@link #getBooleanValue}
+ */
+ boolean booleanValue();
+ /**
+ * Returns the value as a byte. *
+ * @deprecated replaced with {@link #getByteValue}
+ */
+ public byte byteValue();
+ /**
+ * Returns the value as a short. *
+ * @deprecated replaced with {@link #getShortValue}
+ */
+ public short shortValue();
+ /**
+ * Returns the value as an int. *
+ * @deprecated replaced with {@link #getIntValue}
+ */
+ public int intValue();
+ /**
+ * Returns the value as a long. *
+ * @deprecated replaced with {@link #getLongValue}
+ */
+ public long longValue();
+ /**
+ * Returns the value as a {@link BigInteger}. *
+ * @deprecated replaced with {@link #getBigIntegerValue}
+ */
+ public BigInteger bigIntegerValue();
+ /**
+ * Returns the value as a {@link BigDecimal}. *
+ * @deprecated replaced with {@link #getBigDecimalValue}
+ */
+ public BigDecimal bigDecimalValue();
+ /**
+ * Returns the value as a float. *
+ * @deprecated replaced with {@link #getFloatValue}
+ */
+ public float floatValue();
+ /**
+ * Returns the value as a double. *
+ * @deprecated replaced with {@link #getDoubleValue}
+ */
+ public double doubleValue();
+ /**
+ * Returns the value as a byte array. *
+ * @deprecated replaced with {@link #getByteArrayValue}
+ */
+ byte[] byteArrayValue();
+ /**
+ * Returns the value as a {@link StringEnumAbstractBase}. *
+ * @deprecated replaced with {@link #getEnumValue}
+ */
+ StringEnumAbstractBase enumValue();
+ /**
+ * Returns the value as a {@link Calendar}. *
+ * @deprecated replaced with {@link #getCalendarValue}
+ */
+ Calendar calendarValue();
+ /**
+ * Returns the value as a {@link Date}. *
+ * @deprecated replaced with {@link #getDateValue}
+ */
+ Date dateValue();
+ /**
+ * Returns the value as a {@link GDate}. *
+ * @deprecated replaced with {@link #getGDateValue}
+ */
+ GDate gDateValue();
+ /**
+ * Returns the value as a {@link GDuration}. *
+ * @deprecated replaced with {@link #getGDurationValue}
+ */
+ GDuration gDurationValue();
+ /**
+ * Returns the value as a {@link QName}. *
+ * @deprecated replaced with {@link #getQNameValue}
+ */
+ QName qNameValue();
+ /**
+ * Returns the value as a {@link List} of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
+ * @deprecated replaced with {@link #getListValue}
+ */
+ List listValue();
+ /**
+ * Returns the value as a {@link List} of XmlAnySimpleType objects. *
+ * @deprecated replaced with {@link #getListValue}
+ */
+ List xlistValue();
+
+ /**
+ * Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
+ * @deprecated replaced with {@link #getObjectValue}
+ */
+ Object objectValue();
+
+ // following are simple type value setters
+
+ /**
+ * Sets the value as a {@link String}. *
+ * @deprecated replaced with {@link #setStringValue}
+ */
+ void set(String obj);
+ /**
+ * Sets the value as a boolean. *
+ * @deprecated replaced with {@link #setBooleanValue}
+ */
+ void set(boolean v);
+ /**
+ * Sets the value as a byte.
+ * @deprecated replaced with {@link #setByteValue}
+ **/
+ void set(byte v);
+ /**
+ * Sets the value as a short.
+ * @deprecated replaced with {@link #setShortValue}
+ **/
+ void set(short v);
+ /**
+ * Sets the value as an int.
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+ /**
+ * Sets the value as a long.
+ * @deprecated replaced with {@link #setLongValue}
+ **/
+ void set(long v);
+ /**
+ * Sets the value as a {@link BigInteger}.
+ * @deprecated replaced with {@link #setBigIntegerValue}
+ **/
+ void set(BigInteger obj);
+ /**
+ * Sets the value as a {@link BigDecimal}
+ * @deprecated replaced with {@link #setBigDecimalValue}
+ **/
+ void set(BigDecimal obj);
+ /**
+ * Sets the value as a float.
+ * @deprecated replaced with {@link #setFloatValue}
+ **/
+ void set(float v);
+ /**
+ * Sets the value as a double.
+ * @deprecated replaced with {@link #setDoubleValue}
+ **/
+ void set(double v);
+ /**
+ * Sets the value as a byte array.
+ * @deprecated replaced with {@link #setByteArrayValue}
+ **/
+ void set(byte[] obj);
+ /**
+ * Sets the value as a {@link StringEnumAbstractBase}.
+ * @deprecated replaced with {@link #setEnumValue}
+ **/
+ void set(StringEnumAbstractBase obj);
+ /**
+ * Sets the value as a {@link Calendar}.
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar obj);
+ /**
+ * Sets the value as a {@link Date}.
+ * @deprecated replaced with {@link #setDateValue}
+ **/
+ void set(Date obj);
+ /**
+ * Sets the value as a {@link GDate}.
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification obj);
+ /**
+ * Sets the value as a {@link GDuration}.
+ * @deprecated replaced with {@link #setGDurationValue}
+ **/
+ void set(GDurationSpecification obj);
+ /**
+ * Sets the value as a {@link QName}.
+ * @deprecated replaced with {@link #setQNameValue}
+ **/
+ void set(QName obj);
+ /**
+ * Sets the value as a {@link List}.
+ * @deprecated replaced with {@link #setListValue}
+ **/
+ void set(List obj);
+ /**
+ * Sets the value as an arbitrary {@link Object}.
+ * @deprecated replaced with {@link #setObjectValue}
+ **/
+ void objectSet(Object obj);
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/StringEnumAbstractBase.java b/v1/src/xmlpublic/org/apache/xmlbeans/StringEnumAbstractBase.java
new file mode 100644
index 0000000..f3bad8b
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/StringEnumAbstractBase.java
@@ -0,0 +1,99 @@
+/* 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.xmlbeans;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * The base class for code-generated string enumeration value classes.
+ * <p>
+ * Subclasses are intended to be final types with a finite set of
+ * singleton instances. Each instance has a string value, which
+ * it returns via {@link #toString}, and an int value for the purpose
+ * of switching in case statements, returned via {@link #intValue}.
+ * <p>
+ * Each subclass manages an instance of {@link StringEnumAbstractBase.Table},
+ * which holds all the singleton instances for the subclass. A Table
+ * can return a singleton instance given a String or an integer code.
+ */
+public class StringEnumAbstractBase implements java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String _string;
+ private int _int;
+
+ /**
+ * Singleton instances should only be created by subclasses.
+ */
+ protected StringEnumAbstractBase(String s, int i)
+ { _string = s; _int = i; }
+
+ /** Returns the underlying string value */
+ public final String toString()
+ { return _string; }
+ /** Returns an int code that can be used for switch statements */
+ public final int intValue()
+ { return _int; }
+ /** Returns the hash code of the underlying string */
+ public final int hashCode()
+ { return _string.hashCode(); }
+
+ /**
+ * Used to manage singleton instances of enumerations.
+ * Each subclass of StringEnumAbstractBase has an instance
+ * of a table to hold the singleton instances.
+ */
+ public static final class Table
+ {
+ private Map _map;
+ private List _list;
+ public Table(StringEnumAbstractBase[] array)
+ {
+ _map = new HashMap(array.length);
+ _list = new ArrayList(array.length + 1);
+ for (int i = 0; i < array.length; i++)
+ {
+ _map.put(array[i].toString(), array[i]);
+ int j = array[i].intValue();
+ while (_list.size() <= j)
+ _list.add(null);
+ _list.set(j, array[i]);
+ }
+ }
+
+ /** Returns the singleton for a {@link String}, or null if none. */
+ public StringEnumAbstractBase forString(String s)
+ {
+ return (StringEnumAbstractBase)_map.get(s);
+ }
+ /** Returns the singleton for an int code, or null if none. */
+ public StringEnumAbstractBase forInt(int i)
+ {
+ if (i < 0 || i > _list.size())
+ return null;
+ return (StringEnumAbstractBase)_list.get(i);
+ }
+ /** Returns the last valid int code (the first is 1; zero is not used). */
+ public int lastInt()
+ {
+ return _list.size() - 1;
+ }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XMLStreamValidationException.java b/v1/src/xmlpublic/org/apache/xmlbeans/XMLStreamValidationException.java
new file mode 100644
index 0000000..6517e04
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XMLStreamValidationException.java
@@ -0,0 +1,42 @@
+/* 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.xmlbeans;
+
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+/**
+ * An exception thrown from a validating XMLInputStream.
+ *
+ * @see XmlObject.Factory#newValidatingXMLInputStream
+ * @see SchemaTypeLoader#newValidatingXMLInputStream
+ * @deprecated Superceded by JSR 173
+ */
+public class XMLStreamValidationException extends XMLStreamException
+{
+ public XMLStreamValidationException ( XmlError xmlError )
+ {
+ super( xmlError.toString() );
+
+ _xmlError = xmlError;
+ }
+
+ public XmlError getXmlError ( )
+ {
+ return _xmlError;
+ }
+
+ private XmlError _xmlError;
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnySimpleType.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnySimpleType.java
new file mode 100644
index 0000000..b4ae6ea
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnySimpleType.java
@@ -0,0 +1,139 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definition">xs:anySimpleType</a> type.
+ * <p>
+ * All simple types are convertible to {@link String}.
+ */
+public interface XmlAnySimpleType extends XmlObject
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anySimpleType");
+
+ /**
+ * Returns the value as a {@link String}
+ * @deprecated replaced by {@link #getStringValue}
+ **/
+ String stringValue();
+ /**
+ * Sets the value as a {@link String}
+ * @deprecated replaced by {@link #setStringValue}
+ **/
+ void set(String s);
+
+ /**
+ * Returns the value as a {@link String}
+ **/
+ String getStringValue();
+
+ /**
+ * Sets the value as a {@link String}
+ **/
+ void setStringValue(String s);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlAnySimpleType}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlAnySimpleType} */
+ public static XmlAnySimpleType newInstance() {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlAnySimpleType} */
+ public static XmlAnySimpleType newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlAnySimpleType} value */
+ public static XmlAnySimpleType newValue(Object obj) {
+ return type.newValue( obj ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a String. For example: "<code><xml-fragment>anything</xml-fragment></code>". */
+ public static XmlAnySimpleType parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a String. For example: "<code><xml-fragment>anything</xml-fragment></code>". */
+ public static XmlAnySimpleType parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a File. */
+ public static XmlAnySimpleType parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a File. */
+ public static XmlAnySimpleType parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a URL. */
+ public static XmlAnySimpleType parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a URL. */
+ public static XmlAnySimpleType parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from an InputStream. */
+ public static XmlAnySimpleType parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from an InputStream. */
+ public static XmlAnySimpleType parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a Reader. */
+ public static XmlAnySimpleType parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a Reader. */
+ public static XmlAnySimpleType parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a DOM Node. */
+ public static XmlAnySimpleType parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from a DOM Node. */
+ public static XmlAnySimpleType parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlAnySimpleType parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlAnySimpleType} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlAnySimpleType parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlAnySimpleType) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnyURI.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnyURI.java
new file mode 100644
index 0000000..672343f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlAnyURI.java
@@ -0,0 +1,118 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#anyURI">xs:anyURI</a> type.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlAnyURI extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anyURI");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlAnyURI}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlAnyURI} */
+ public static XmlAnyURI newInstance() {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlAnyURI} */
+ public static XmlAnyURI newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlAnyURI} value */
+ public static XmlAnyURI newValue(Object obj) {
+ return (XmlAnyURI) type.newValue( obj ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a String. For example: "<code><xml-fragment>http://www.w3.org/</xml-fragment></code>". */
+ public static XmlAnyURI parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a String. For example: "<code><xml-fragment>http://www.w3.org/</xml-fragment></code>". */
+ public static XmlAnyURI parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a File. */
+ public static XmlAnyURI parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a File. */
+ public static XmlAnyURI parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a URL. */
+ public static XmlAnyURI parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a URL. */
+ public static XmlAnyURI parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from an InputStream. */
+ public static XmlAnyURI parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from an InputStream. */
+ public static XmlAnyURI parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a Reader. */
+ public static XmlAnyURI parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a Reader. */
+ public static XmlAnyURI parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a DOM Node. */
+ public static XmlAnyURI parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from a DOM Node. */
+ public static XmlAnyURI parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlAnyURI parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlAnyURI} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlAnyURI parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlAnyURI) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlBase64Binary.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBase64Binary.java
new file mode 100644
index 0000000..e5a4e3f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBase64Binary.java
@@ -0,0 +1,136 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#base64Binary">xs:base64Binary</a> type.
+ * <p>
+ * Convertible to a byte array.
+ */
+public interface XmlBase64Binary extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_base64Binary");
+
+ /**
+ * Returns this value as a byte array.
+ * @deprecated replaced by {@link #getByteArrayValue}
+ **/
+ byte[] byteArrayValue();
+
+ /**
+ * Sets this value as a byte array.
+ * @deprecated replaced by {@link #setByteArrayValue}
+ **/
+ void set(byte[] ba);
+
+ /** Returns this value as a byte array. **/
+ byte[] getByteArrayValue();
+ /** Sets this value as a byte array. */
+ void setByteArrayValue(byte[] ba);
+
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlBase64Binary}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlBase64Binary} */
+ public static XmlBase64Binary newInstance() {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlBase64Binary} */
+ public static XmlBase64Binary newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlBase64Binary} value */
+ public static XmlBase64Binary newValue(Object obj) {
+ return (XmlBase64Binary) type.newValue( obj ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a String. For example: "<code><xml-fragment>VGhpcyBzdHJp</xml-fragment></code>". */
+ public static XmlBase64Binary parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a String. For example: "<code><xml-fragment>VGhpcyBzdHJp</xml-fragment></code>". */
+ public static XmlBase64Binary parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a File. */
+ public static XmlBase64Binary parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a File. */
+ public static XmlBase64Binary parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a URL. */
+ public static XmlBase64Binary parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a URL. */
+ public static XmlBase64Binary parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from an InputStream. */
+ public static XmlBase64Binary parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from an InputStream. */
+ public static XmlBase64Binary parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a Reader. */
+ public static XmlBase64Binary parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a Reader. */
+ public static XmlBase64Binary parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a DOM Node. */
+ public static XmlBase64Binary parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from a DOM Node. */
+ public static XmlBase64Binary parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlBase64Binary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlBase64Binary} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlBase64Binary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlBase64Binary) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
new file mode 100644
index 0000000..d27f78a
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBeans.java
@@ -0,0 +1,455 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Provides an assortment of utilities
+ * for managing XML Bean types, type systems, QNames, paths,
+ * and queries.
+ */
+public final class XmlBeans
+{
+ /**
+ * Thread local QName cache for general use
+ */
+ private static final ThreadLocal _threadLocalLoaderQNameCache =
+ new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ return new QNameCache( 32 );
+ }
+ };
+
+ /**
+ * Returns a thread local QNameCache
+ */
+ public static QNameCache getQNameCache ( )
+ {
+ return (QNameCache) _threadLocalLoaderQNameCache.get();
+ }
+
+ /**
+ * Obtains a name from the thread local QNameCache
+ */
+ public static QName getQName ( String localPart )
+ {
+ return getQNameCache().getName( "", localPart );
+ }
+
+ /**
+ * Obtains a name from the thread local QNameCache
+ */
+
+ public static QName getQName ( String namespaceUri, String localPart )
+ {
+ return getQNameCache().getName( namespaceUri, localPart );
+ }
+
+ private static final Method _getContextTypeLoaderMethod = buildGetContextTypeLoaderMethod();
+ private static final Method _getBuiltinSchemaTypeSystemMethod = buildGetBuiltinSchemaTypeSystemMethod();
+ private static final Method _getNoTypeMethod = buildGetNoTypeMethod();
+ private static final Method _typeLoaderBuilderMethod = buildTypeLoaderBuilderMethod();
+ private static final Method _compilationMethod = buildCompilationMethod();
+
+ private static RuntimeException causedException(RuntimeException e, Throwable cause)
+ {
+ e.initCause(cause);
+ return e;
+ }
+
+ private static XmlException wrappedException(Throwable e)
+ {
+ if (e instanceof XmlException)
+ return (XmlException) e;
+
+ return new XmlException( e.getMessage(), e );
+ }
+
+ private static Method buildGetContextTypeLoaderMethod()
+ {
+ try
+ {
+ return Class.forName("org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl", false, XmlBeans.class.getClassLoader()).getMethod("getContextTypeLoader", new Class[0]);
+ }
+ catch (Exception e)
+ {
+ throw causedException(new IllegalStateException("Cannot load SchemaTypeLoaderImpl: verify that xbean.jar is on the classpath"), e);
+ }
+ }
+
+
+ private static final Method buildGetBuiltinSchemaTypeSystemMethod()
+ {
+ try
+ {
+ return Class.forName("org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem", false, XmlBeans.class.getClassLoader()).getMethod("get", new Class[0]);
+ }
+ catch (Exception e)
+ {
+ throw causedException(new IllegalStateException("Cannot load BuiltinSchemaTypeSystem: verify that xbean.jar is on the classpath"), e);
+ }
+ }
+
+ private static final Method buildGetNoTypeMethod()
+ {
+ try
+ {
+ return Class.forName("org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem", false, XmlBeans.class.getClassLoader()).getMethod("getNoType", new Class[0]);
+ }
+ catch (Exception e)
+ {
+ throw causedException(new IllegalStateException("Cannot load BuiltinSchemaTypeSystem: verify that xbean.jar is on the classpath"), e);
+ }
+ }
+
+
+ private static final Method buildTypeLoaderBuilderMethod()
+ {
+ try
+ {
+ Class resourceLoaderClass = Class.forName("org.apache.xmlbeans.impl.schema.ResourceLoader", false, XmlBeans.class.getClassLoader());
+ return Class.forName("org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl", false, XmlBeans.class.getClassLoader()).getMethod("build", new Class[] { SchemaTypeLoader[].class, resourceLoaderClass, ClassLoader.class });
+ }
+ catch (Exception e)
+ {
+ throw causedException(new IllegalStateException("Cannot load SchemaTypeLoaderImpl: verify that xbean.jar is on the classpath"), e);
+ }
+ }
+
+
+ private static final Method buildCompilationMethod()
+ {
+ try
+ {
+ return Class.forName("org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl", false, XmlBeans.class.getClassLoader()).getMethod("forSchemaXml", new Class[] { XmlObject[].class, SchemaTypeLoader.class, XmlOptions.class });
+ }
+ catch (Exception e)
+ {
+ throw causedException(new IllegalStateException("Cannot load SchemaTypeSystemImpl: verify that xbean.jar is on the classpath"), e);
+ }
+ }
+
+ /**
+ * Compiles an XPath, returning a String equal to that which was passed,
+ * but whose identity is that of one which has been precompiled and cached.
+ */
+ public static String compilePath ( String pathExpr ) throws XmlException
+ {
+ return compilePath( pathExpr, null );
+ }
+
+ /**
+ * Compiles an XPath, returning a String equal to that which was passed,
+ * but whose identity is that of one which has been precompiled and cached;
+ * takes an option for specifying text that indicates the name of context node.
+ * The default is "this", as in "$this".
+ *
+ * @param options Options for the path. For example, you can call
+ * the {@link XmlOptions#setXqueryCurrentNodeVar(String) XmlOptions.setXqueryCurrentNodeVar(String)}
+ * method to specify a particular name for the expression
+ * variable that indicates the context node.
+ */
+ public static String compilePath ( String pathExpr, XmlOptions options )
+ throws XmlException
+ {
+ return getContextTypeLoader().compilePath( pathExpr, options );
+ }
+
+ /**
+ * Compiles an XQuery, returning a String equal to that which was passed,
+ * but whose identity is that of one which has been precompiled and cached.
+ */
+ public static String compileQuery ( String queryExpr ) throws XmlException
+ {
+ return compileQuery( queryExpr, null );
+ }
+
+ /**
+ * Compiles an XQuery, returning a String equal to that which was passed,
+ * but whose identity is that of one which has been precompiled and cached;
+ * takes an option for specifying text that indicates the context node.
+ *
+ * @param options Options for the query. For example, you can call
+ * the {@link XmlOptions#setXqueryCurrentNodeVar(String) XmlOptions.setXqueryCurrentNodeVar(String)}
+ * method to specify a particular name for the expression
+ * variable that indicates the context node and the
+ * {@link XmlOptions#setXqueryVariables(Map) XmlOptions.setXqueryVariables(Map)}
+ * method to map external variable names to values.
+ */
+ public static String compileQuery ( String queryExpr, XmlOptions options )
+ throws XmlException
+ {
+ return getContextTypeLoader().compileQuery( queryExpr, options );
+ }
+
+ /**
+ * Gets the SchemaTypeLoader based on the current thread's context
+ * ClassLoader. This is the SchemaTypeLoader that is used to assign
+ * schema types to XML documents by default. The SchemaTypeLoader is
+ * also consulted to resolve wildcards and xsi:type attributes.
+ * <p>
+ * The "parse" methods of XmlBeans all delegate to the
+ * "parseInstance" methods of the context type loader.
+ */
+ public static SchemaTypeLoader getContextTypeLoader()
+ {
+ try
+ {
+ return (SchemaTypeLoader)_getContextTypeLoaderMethod.invoke(null, null);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl.getContextTypeLoader(): verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw causedException(new IllegalStateException(e.getMessage()), e.getCause());
+ }
+ }
+
+ /**
+ * Returns the builtin type system. This SchemaTypeSystem contains
+ * only the 46 builtin types defined by the XML Schema specification.
+ */
+ public static SchemaTypeSystem getBuiltinTypeSystem()
+ {
+ try
+ {
+ return (SchemaTypeSystem)_getBuiltinSchemaTypeSystemMethod.invoke(null, null);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to BuiltinSchemaTypeSystem.get(): verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw causedException(new IllegalStateException(e.getMessage()), e.getCause());
+ }
+ }
+
+ /**
+ * Returns the SchemaTypeSystem that results from compiling the XML
+ * schema definitions passed.
+ * <p>
+ * Just like compileTypeSystem, but uses the context type loader for
+ * linking, and returns a unioned typeloader that is suitable for
+ * creating instances.
+ */
+ public static SchemaTypeLoader loadXsd(XmlObject[] schemas) throws XmlException
+ {
+ return loadXsd(schemas, null);
+ }
+
+ /**
+ * <p>Returns the SchemaTypeSystem that results from compiling the XML
+ * schema definitions passed in <em>schemas</em>.</p>
+ *
+ * <p>This is just like compileTypeSystem, but uses the context type loader for
+ * linking, and returns a unioned typeloader that is suitable for
+ * creating instances.</p>
+ *
+ * <p>Use the <em>options</em> parameter to specify one or both of the following:</p>
+ *
+ * <ul>
+ * <li>A collection instance that should be used as an error listener during
+ * compilation, as described in {@link XmlOptions#setErrorListener}.</li>
+ * <li>Whether validation should not be done when building the SchemaTypeSystem,
+ * as described in {@link XmlOptions#setCompileNoValidation}.</li>
+ * </ul>
+ *
+ * @param schemas The schema definitions from which to build the schema type system.
+ * @param options Options specifying an error listener and/or validation behavior.
+ */
+ public static SchemaTypeLoader loadXsd(XmlObject[] schemas, XmlOptions options) throws XmlException
+ {
+ try
+ {
+ SchemaTypeSystem sts =
+ (SchemaTypeSystem)
+ _compilationMethod.invoke(
+ null, new Object[] { schemas, getContextTypeLoader(), options });
+
+ if (sts == null)
+ return null;
+
+ return
+ typeLoaderUnion(
+ new SchemaTypeLoader[] { sts, getContextTypeLoader() } );
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl.forSchemaXml(): verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw wrappedException(e.getCause());
+ }
+ }
+
+ /**
+ * <p>Returns the SchemaTypeSystem that results from compiling the XML
+ * schema definitions passed.</p>
+ *
+ * <p>The XmlObjects passed in should be w3c <schema> elements whose type
+ * is org.w3c.x2001.xmlSchema.Schema. (That is, schema elements in
+ * the XML namespace http://www.w3c.org/2001/XMLSchema.) Also
+ * org.w3c.x2001.xmlSchema.SchemaDocument is permitted.</p>
+ *
+ * <p>The optional second argument is a SchemaTypeLoader which will be
+ * consulted for already-compiled schema types which may be linked
+ * while processing the given schemas.</p>
+ *
+ * <p>The SchemaTypeSystem that is returned should be combined
+ * (via {@link #typeLoaderUnion}) with the typepath typeloader in order
+ * to create a typeloader that can be used for creating and validating
+ * instances.</p>
+ *
+ * <p>Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <ul>
+ * <li>A collection instance that should be used as an error listener during
+ * compilation, as described in {@link XmlOptions#setErrorListener}.</li>
+ * <li>Whether validation should not be done when building the SchemaTypeSystem,
+ * as described in {@link XmlOptions#setCompileNoValidation}.</li>
+ * </ul>
+ *
+ * @param schemas The schema definitions from which to build the schema type system.
+ * @param typepath The path to already-compiled schema types for linking while processing.
+ * @param options Options specifying an error listener and/or validation behavior.
+ */
+ public static SchemaTypeSystem compileXsd(XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options) throws XmlException
+ {
+ if (typepath == null)
+ throw new IllegalArgumentException("Must supply a SchemaTypeLoader for compiletime linking");
+
+ try
+ {
+ return (SchemaTypeSystem)_compilationMethod.invoke(null, new Object[] { schemas, typepath, options });
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalStateException("No access to SchemaTypeLoaderImpl.forSchemaXml(): verify that version of xbean.jar is correct");
+ }
+ catch (InvocationTargetException e)
+ {
+ throw wrappedException(e.getCause());
+ }
+ }
+
+ /**
+ * Returns the union of a list of typeLoaders. The returned
+ * SchemaTypeLoader searches the given list of SchemaTypeLoaders
+ * in order from first to last.
+ */
+ public static SchemaTypeLoader typeLoaderUnion(SchemaTypeLoader[] typeLoaders)
+ {
+ try
+ {
+ if (typeLoaders.length == 1)
+ return typeLoaders[0];
+
+ return (SchemaTypeLoader)_typeLoaderBuilderMethod.invoke(null, new Object[] {typeLoaders, null, null});
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw causedException(new IllegalStateException(e.getMessage()), e.getCause());
+ }
+ }
+
+ /**
+ * Returns a SchemaTypeLoader that searches for compiled schema types
+ * in the given ClassLoader.
+ */
+ public static SchemaTypeLoader typeLoaderForClassLoader(ClassLoader loader)
+ {
+ try
+ {
+ return (SchemaTypeLoader)_typeLoaderBuilderMethod.invoke(null, new Object[] {null, null, loader});
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl: verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw causedException( new IllegalStateException(e.getMessage()), e );
+ }
+ }
+
+ /**
+ * Returns the SchemaType from a corresponding XmlObject subclass,
+ * or null if none.
+ */
+ public static SchemaType typeForClass(Class c)
+ {
+ if (c == null || !XmlObject.class.isAssignableFrom(c))
+ return null;
+
+ try
+ {
+ Field typeField = c.getField("type");
+
+ if (typeField == null)
+ return null;
+
+ return (SchemaType)typeField.get(null);
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+ private static SchemaType getNoType()
+ {
+ try
+ {
+ return (SchemaType)_getNoTypeMethod.invoke(null, null);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw causedException(new IllegalStateException("No access to SchemaTypeLoaderImpl.getContextTypeLoader(): verify that version of xbean.jar is correct"), e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw causedException(new IllegalStateException(e.getMessage()), e.getCause());
+ }
+ }
+
+ /**
+ * The SchemaType object given to an XmlObject instance when
+ * no type can be determined.
+ * <p>
+ * The NO_TYPE is the universal derived type. That is, it is
+ * derived from all other schema types, and no instances of the
+ * NO_TYPE are valid. (It is not to be confused with the anyType,
+ * which is the universal base type from which all other types
+ * can be derived, and of which all instances are valid.)
+ */
+ public static SchemaType NO_TYPE = getNoType();
+
+ private XmlBeans ( ) { }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlBoolean.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBoolean.java
new file mode 100644
index 0000000..19ec919
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlBoolean.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#boolean">xs:boolean</a> type.
+ * <p>
+ * Naturally, convertible to Java boolean.
+ */
+public interface XmlBoolean extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_boolean");
+
+ /**
+ * Returns this value as a boolean
+ * @deprecated replaced by {@link #getBooleanValue}
+ **/
+ boolean booleanValue();
+ /**
+ * Sets this value as a boolean
+ * @deprecated replaced by {@link #setBooleanValue}
+ **/
+ void set(boolean v);
+
+ /** Returns this value as a boolean */
+ boolean getBooleanValue();
+ /** Sets this value as a boolean */
+ void setBooleanValue(boolean v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlBoolean}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlBoolean} */
+ public static XmlBoolean newInstance() {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlBoolean} */
+ public static XmlBoolean newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlBoolean} value */
+ public static XmlBoolean newValue(Object obj) {
+ return (XmlBoolean) type.newValue( obj ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a String. For example: "<code><xml-fragment>true</xml-fragment></code>". */
+ public static XmlBoolean parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a String. For example: "<code><xml-fragment>true</xml-fragment></code>". */
+ public static XmlBoolean parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a File. */
+ public static XmlBoolean parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a File. */
+ public static XmlBoolean parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a URL. */
+ public static XmlBoolean parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a URL. */
+ public static XmlBoolean parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from an InputStream. */
+ public static XmlBoolean parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from an InputStream. */
+ public static XmlBoolean parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a Reader. */
+ public static XmlBoolean parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a Reader. */
+ public static XmlBoolean parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a DOM Node. */
+ public static XmlBoolean parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from a DOM Node. */
+ public static XmlBoolean parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlBoolean} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlBoolean parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlBoolean} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlBoolean parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlBoolean) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlByte.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlByte.java
new file mode 100644
index 0000000..0beb961
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlByte.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#byte">xs:byte</a> type.
+ * <p>
+ * Naturally, convertible to Java byte.
+ */
+public interface XmlByte extends XmlShort
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_byte");
+
+ /**
+ * Returns this value as a byte
+ * @deprecated replaced by {@link #getByteValue}
+ **/
+ public byte byteValue();
+ /**
+ * Sets this value as a byte
+ * @deprecated replaced by {@link #setByteValue}
+ **/
+ public void set(byte s);
+
+ /** Returns this value as a byte */
+ public byte getByteValue();
+ /** Sets this value as a byte */
+ public void setByteValue(byte s);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlByte}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlByte} */
+ public static XmlByte newInstance() {
+ return (XmlByte) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlByte} */
+ public static XmlByte newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlByte) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlByte} value */
+ public static XmlByte newValue(Object obj) {
+ return (XmlByte) type.newValue( obj ); }
+
+ /** Parses a {@link XmlByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>". */
+ public static XmlByte parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>". */
+ public static XmlByte parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from a File. */
+ public static XmlByte parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from a File. */
+ public static XmlByte parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from a URL. */
+ public static XmlByte parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from a URL. */
+ public static XmlByte parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from an InputStream. */
+ public static XmlByte parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from an InputStream. */
+ public static XmlByte parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from a Reader. */
+ public static XmlByte parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from a Reader. */
+ public static XmlByte parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from a DOM Node. */
+ public static XmlByte parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from a DOM Node. */
+ public static XmlByte parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlByte} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlByte parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlByte} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlByte parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlByte) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlCalendar.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlCalendar.java
new file mode 100644
index 0000000..392ce28
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlCalendar.java
@@ -0,0 +1,317 @@
+/* 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.xmlbeans;
+
+import java.util.GregorianCalendar;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+import java.math.BigDecimal;
+
+/**
+ * An XML Schema compatible subclass of {@link java.util.GregorianCalendar GregorianCalendar}.
+ * XmlCalendar modifies several key details in the behavior of
+ * GregorianCalendar to make it more useful when dealing with XML dates.
+ * <p>
+ * It is easy to convert between XmlCalendar and {@link GDate}, or to
+ * parse or emit an XmlCalendar using a standard XML Schema
+ * lexical representation.
+ * <ol>
+ * <li>
+ * To match XML Schema dates, this XmlCalendar is a fully proleptic
+ * Gregorian calendar by default, which means that Gregorian calendar
+ * rules are applied backwards in time as if they had always been in
+ * effect, actual historical circumstances concerning the observance
+ * of the 1582 decree of Pope Gregory XIII notwithstanding.
+ * </li>
+ * <li>
+ * In order to better support partially-specified dates for XML Schema,
+ * this implementation provides a stable get(field) method
+ * that does not modify the instance if you are acessing a field right
+ * after it was explicitly set: a set followed by a get will always
+ * return the same thing and will not fill in any other fields. However,
+ * if you get a field that was not explicitly set, then all the fields
+ * are still automatically filled and normalized for you, just like a
+ * regular GregorianCalendar. If you wish to force the completion and
+ * defaulting of all the fields (without hunting to get one that happens
+ * to be unset), you can always do so by calling getTime().
+ * </li>
+ * <li>
+ * When a year is unspecified and needs to be filled in automatically
+ * (for example when using a .get or .getTime method as discussed above),
+ * the year is defaulted to year 0 (also known as 1 BC). This is different
+ * from {@link GregorianCalendar}, which chooses 1970. The reason 0 is preferable
+ * is that it is a leap year and so it permits the date --2-29 to be specified
+ * stably. A different default year can be chosen via the static method
+ * {@link #setDefaultYear(int) XmlCalendar.setDefaultYear()}, or by setting the
+ * system property "user.defaultyear". If you do change this value, you should
+ * pick another leap year such as 2000 and avoid non-leap years such as 1900.
+ * </li>
+ * <li>
+ * When constructing an XmlCalendar from an XML Schema
+ * formatted date or time string or GDate object, the timezone
+ * for the calendar is taken from the string if it is present, or
+ * taken to be {@link java.util.TimeZone#getDefault() TimeZone.getDefault()} if not.
+ * <p>
+ * For example, the XML timezone "Z" is translated to "GMT";
+ * the XML timezone "+05:00" is translated to "GMT+05:00".
+ * </p>
+ * </li>
+ * <li>
+ * Finally, this implementation provides a String constructor and a
+ * toString() method that comply with the XML Schema conventions
+ * for formatting a date. If only a subset of fields have been
+ * explicitly set, toString() produces a string with the proper subset
+ * of information.
+ * </li>
+ * </ol>
+ */
+public class XmlCalendar extends GregorianCalendar
+{
+ /**
+ * Constructs an XmlCalendar for a standard XML
+ * schema formatted date string.
+ *
+ * The parser accepts any of the following formats:
+ *
+ * YYYY-MM-DDThh:mm:ss - dateTime
+ * YYYY-MM-DD - date
+ * hh:mm:ss - time
+ * YYYY - gYear
+ * --MM - gMonth
+ * ---DD - gDay
+ *
+ * The parser actually accepts all 16 combinations of subsets of
+ * fields (Y, M, D, T) using the same scheme, even for combinations
+ * that are not defined as types in the schema spec, such as
+ * year, day, and time:
+ *
+ * YYYY--DDThh:mm:ss - [everything but month specified]
+ *
+ * In the string, each field must be padded to its full width, for
+ * example, January must be --01, not just --1.
+ *
+ * In particular, a year must be padded to at least four digits, so
+ * "98" is not a valid year, although "1998" and "0098" are both valid
+ * years, unambiguously 19 centuries separated from each other. A year
+ * may also be preceded by a minus symbol: 0000 is 1 BC and -0001 is
+ * 2 BC.
+ *
+ * Finally a timezone is always allowed (yet optional) at the end.
+ * Timezones must be either "Z" (UTC, which we translate to GMT),
+ * or simple offsets from UTC in the range "-14:00" to "+14:00",
+ * for example: "14:30:00-05:00" specifies 2:30 PM in the
+ * afternoon at UTC-05:00, which is the same as EST.
+ *
+ * If a timezone is not specified, the default TimeZone is used.
+ */
+ public XmlCalendar(String xmlSchemaDateString)
+ {
+ this(new GDate(xmlSchemaDateString)); // use GDate to parse
+ }
+
+ /**
+ * Constructs an XmlCalendar from a GDate.
+ *
+ * If the instance is not completed, you can round-trip to an
+ * equivalent GDate by writing "new GDate(new XmlCalendar(gdate))".
+ * However, if you access any of the unset fields of the calendar, all
+ * the fields will be automatically filled in, so partial dates
+ * without timezones or other fields will not round-trip after access.
+ */
+ public XmlCalendar(GDateSpecification date)
+ {
+ this(GDate.timeZoneForGDate(date), date);
+ }
+
+ private XmlCalendar(TimeZone tz, GDateSpecification date)
+ {
+ super(tz);
+ setGregorianChange(_beginningOfTime); // proleptic
+ clear();
+
+ if (date.hasYear())
+ {
+ int y = date.getYear();
+ if (y > 0)
+ {
+ set(Calendar.ERA, GregorianCalendar.AD);
+ }
+ else
+ {
+ set(Calendar.ERA, GregorianCalendar.BC);
+ y = 1 - y;
+ }
+ set(Calendar.YEAR, y);
+ }
+ if (date.hasMonth())
+ set(Calendar.MONTH, date.getMonth() - 1); // note!!
+ if (date.hasDay())
+ set(Calendar.DAY_OF_MONTH, date.getDay());
+ if (date.hasTime())
+ {
+ set(Calendar.HOUR_OF_DAY, date.getHour());
+ set(Calendar.MINUTE, date.getMinute());
+ set(Calendar.SECOND, date.getSecond());
+ if (date.getFraction().scale() > 0)
+ set(Calendar.MILLISECOND, date.getMillisecond());
+ }
+ if (date.hasTimeZone())
+ {
+ set(Calendar.ZONE_OFFSET, date.getTimeZoneSign() * 1000 * 60 * (date.getTimeZoneHour() * 60 + date.getTimeZoneMinute()));
+ set(Calendar.DST_OFFSET, 0); // note!! if we don't do this, then GregorianCalendar will pick up DST from the time zone
+ }
+ }
+
+ /**
+ * Constructs an XmlCalendar from a Date.
+ *
+ * The default TimeZone is used for computing the various fields.
+ */
+ public XmlCalendar(Date date)
+ {
+ this(TimeZone.getDefault(), new GDate(date));
+ complete();
+ }
+
+ /**
+ * Constructs an XmlCalendar with the specified year, month, day,
+ * hours, minutes, seconds, and optional fractional seconds, in
+ * the default timezone.
+ */
+ public XmlCalendar(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction)
+ {
+ this(TimeZone.getDefault(), new GDate(year, month, day, hour, minute, second, fraction));
+ }
+
+ /**
+ * Constructs an XmlCalendar with the specified year, month, day,
+ * hours, minutes, seconds, and optional fractional seconds, in
+ * the specified timezone.
+ */
+ public XmlCalendar(
+ int year,
+ int month,
+ int day,
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fraction,
+ int tzSign,
+ int tzHour,
+ int tzMinute)
+ {
+ this(new GDate(year, month, day, hour, minute, second, fraction, tzSign, tzHour, tzMinute));
+ }
+
+
+ /**
+ * Gets the value for a given time field.
+ *
+ * Unlike the GregorianCalendar implementation, the get() does not
+ * force a complete of all fields. If you wish to force a completion
+ * of all the fields, call getTime() first.
+ */
+ public int get(int field)
+ {
+ if (!isSet(field) || isTimeSet)
+ return super.get(field); // forces a complete
+ else
+ return internalGet(field); // does not force a complete.
+ }
+
+ /**
+ * Constructs an empty instance with no fields set.
+ */
+ public XmlCalendar()
+ {
+ setGregorianChange(_beginningOfTime); // proleptic
+ clear();
+ }
+
+ private static int defaultYear = Integer.MIN_VALUE;
+ private static final int DEFAULT_DEFAULT_YEAR = 0;
+
+ /**
+ * Returns the default year that is used when no year is specified.
+ */
+ public static int getDefaultYear()
+ {
+ if (defaultYear == Integer.MIN_VALUE)
+ {
+ try
+ {
+ String yearstring = System.getProperty("user.defaultyear");
+ if (yearstring != null)
+ defaultYear = Integer.parseInt(yearstring);
+ else
+ defaultYear = DEFAULT_DEFAULT_YEAR;
+ }
+ catch (Throwable t)
+ {
+ defaultYear = DEFAULT_DEFAULT_YEAR;
+ }
+ }
+ return defaultYear;
+ }
+
+ /**
+ * Sets the default year to be used when no year is specified.
+ */
+ public static void setDefaultYear(int year)
+ {
+ defaultYear = year;
+ }
+
+ /**
+ * Overrides GregorianCalendar.computeTime to apply a different
+ * default year. (It must be a leap year.)
+ */
+ protected void computeTime()
+ {
+ boolean unsetYear = !isSet(YEAR);
+ if (unsetYear)
+ set(YEAR, getDefaultYear());
+ try
+ {
+ super.computeTime();
+ }
+ finally
+ {
+ if (unsetYear)
+ clear(YEAR);
+ }
+ }
+
+ private static Date _beginningOfTime = new Date(Long.MIN_VALUE);
+
+ /**
+ * Prints the XmlCalendar using a standard XML Schema
+ * format, as described in XmlCalendar(String s).
+ */
+ public String toString()
+ {
+ return (new GDate(this)).toString(); // use GDate to print
+ }
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlCursor.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlCursor.java
new file mode 100644
index 0000000..ec4da34
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlCursor.java
@@ -0,0 +1,1772 @@
+/* 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.xmlbeans;
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a position between two logical tokens in an XML document.
+ *
+ * The tokens themselves are not exposed as objects, but their type and properties
+ * are discoverable through methods on the cursor. In particular, the general
+ * category of token is represented by a {@link XmlCursor.TokenType TokenType}.<br/><br/>
+ *
+ * You use an XmlCursor instance to navigate through and manipulate an XML
+ * instance document.
+ * Once you obtain an XML document, you can create a cursor to represent
+ * a specific place in the XML. Because you can use a cursor with or
+ * without a schema corresponding to the XML, cursors are an ideal
+ * way to handle XML without a schema. You can create a new cursor by
+ * calling the {@link XmlTokenSource#newCursor() newCursor} method
+ * exposed by an object representing
+ * the XML, whether it was parsed into a strong type compiled from
+ * schema or an {@link XmlObject XmlObject} (as in the no-schema case).<br/><br/>
+ *
+ * With an XmlCursor, you can also: <br/><br/>
+ *
+ * <ul>
+ * <li>Execute XQuery and XPath expressions against the XML with the
+ * execQuery and selectPath methods.</li>
+ *
+ * <li>Edit and reshape the document by inserting, moving, copying, and removing
+ * XML.</li>
+ *
+ * <li>Insert bookmarks that "stick" to the XML at the cursor's
+ * position even if the cursor or XML moves.</li>
+
+ * <li>Get and set values for containers (elements and whole documents),
+ * attributes, processing instructions, and comments.</li>
+ * </ul>
+ *
+ * A cursor moves through XML by moving past tokens. A
+ * token represents a category of XML markup, such as the start of an element,
+ * its end, an attribute, comment, and so on. XmlCursor methods such as
+ * toNextToken, toNextSibling, toParent, and so on move the cursor
+ * among tokens. Each token's category is of a particular <em>type</em>, represented
+ * by one of the nine types defined by the {@link XmlCursor.TokenType TokenType} class. <br/><br/>
+ *
+ * When you get a new cursor for a whole instance document, the cursor is
+ * intially located before the STARTDOC token. This token, which has no analogy
+ * in the XML specification, is present in this logical model of XML
+ * so that you may distinguish between the document as a whole
+ * and the content of the document. Terminating the document is an ENDDOC
+ * token. This token is also not part of the XML specification. A cursor
+ * located immediately before this token is at the very end of the document.
+ * It is not possible to position the cursor after the ENDDOC token.
+ * Thus, the STARTDOC and ENDDOC tokens are effectively "bookends" for the content of
+ * the document.<br/><br/>
+ *
+ * For example, for the following XML, if you were the navigate a cursor
+ * through the XML document using toNextToken(), the list of token types that
+ * follows represents the token sequence you would encounter. <br/><br/>
+ *
+ * <pre>
+ * <sample x='y'>
+ * <value>foo</value>
+ * </sample>
+ * </pre>
+ *
+ * STARTDOC <br/>
+ * START (sample) <br/>
+ * ATTR (x='y') <br/>
+ * TEXT ("\n ") <br/>
+ * START (value) <br/>
+ * TEXT ("foo") <br/>
+ * END (value) <br/>
+ * TEXT ("\n") <br/>
+ * END (sample)<br/>
+ * ENDDOC <br/><br/>
+ *
+ * When there are no more tokens available, hasNextToken() returns
+ * false and toNextToken() returns the special token type NONE and does not move
+ * the cursor.
+ * <br/><br/>
+ *
+ * The {@link #currentTokenType() currentTokenType()} method
+ * will return the type of the token that is immediately after the cursor.
+ * You can also use a number of convenience methods that test for a particular
+ * token type. These include the methods isStart(),
+ * isStartdoc(), isText(), isAttr(), and so on. Each returns a boolean
+ * value indicating whether the token that follows the cursor is the type
+ * in question.
+ * <br/><br/>
+ *
+ * A few other methods determine whether the token is of a kind that may include
+ * multiple token types. The isAnyAttr() method, for example, returns true if
+ * the token immediately following the cursor is any kind of attribute,
+ * including those of the ATTR token type and xmlns attributes.
+ * <br/><br/>
+ *
+ * Legitimate sequences of tokens for an XML document are described
+ * by the following Backus-Naur Form (BNF): <br/>
+ *
+ * <pre>
+ * <doc> ::= STARTDOC <attributes> <content> ENDDOC
+ * <element> ::= START <attributes> <content> END
+ * <attributes> ::= ( ATTR | NAMESPACE ) *
+ * <content> ::= ( COMMENT | PROCINST | TEXT | <element> ) *
+ * </pre>
+ *
+ * Note that a legitimate sequence is STARTDOC ENDDOC, the result of
+ * creating a brand new instance of an empty document. Also note that
+ * attributes may only follow container tokens (STARTDOC or START)
+ */
+public interface XmlCursor extends XmlTokenSource
+{
+ /**
+ * An enumeration that identifies the type of an XML token.
+ */
+ public static final class TokenType
+ {
+ public String toString ( ) { return _name; }
+
+ /**
+ * Returns one of the INT_ values defined in this class.
+ */
+ public int intValue ( ) { return _value; }
+
+ /** No token. See {@link #intValue}. */
+ public static final int INT_NONE = 0;
+ /** The start-document token. See {@link #intValue}. */
+ public static final int INT_STARTDOC = 1;
+ /** The end-document token. See {@link #intValue}. */
+ public static final int INT_ENDDOC = 2;
+ /** The start-element token. See {@link #intValue}. */
+ public static final int INT_START = 3;
+ /** The end-element token. See {@link #intValue}. */
+ public static final int INT_END = 4;
+ /** The text token. See {@link #intValue}. */
+ public static final int INT_TEXT = 5;
+ /** The attribute token. See {@link #intValue}. */
+ public static final int INT_ATTR = 6;
+ /** The namespace declaration token. See {@link #intValue}. */
+ public static final int INT_NAMESPACE = 7;
+ /** The comment token. See {@link #intValue}. */
+ public static final int INT_COMMENT = 8;
+ /** The processing instruction token. See {@link #intValue}. */
+ public static final int INT_PROCINST = 9;
+
+ /** True if no token. */
+ public boolean isNone ( ) { return this == NONE; }
+ /** True if is start-document token. */
+ public boolean isStartdoc ( ) { return this == STARTDOC; }
+ /** True if is end-document token. */
+ public boolean isEnddoc ( ) { return this == ENDDOC; }
+ /** True if is start-element token. */
+ public boolean isStart ( ) { return this == START; }
+ /** True if is end-element token. */
+ public boolean isEnd ( ) { return this == END; }
+ /** True if is text token. */
+ public boolean isText ( ) { return this == TEXT; }
+ /** True if is attribute token. */
+ public boolean isAttr ( ) { return this == ATTR; }
+ /** True if is namespace declaration token. */
+ public boolean isNamespace ( ) { return this == NAMESPACE; }
+ /** True if is comment token. */
+ public boolean isComment ( ) { return this == COMMENT; }
+ /** True if is processing instruction token. */
+ public boolean isProcinst ( ) { return this == PROCINST; }
+
+ /** True if is start-document or start-element token */
+ public boolean isContainer ( ) { return this == STARTDOC || this == START; }
+ /** True if is end-document or end-element token */
+ public boolean isFinish ( ) { return this == ENDDOC || this == END; }
+ /** True if is attribute or namespace declaration token */
+ public boolean isAnyAttr ( ) { return this == NAMESPACE || this == ATTR; }
+
+ /** The singleton no-token type */
+ public static final TokenType NONE = new TokenType( "NONE", INT_NONE );
+ /** The singleton start-document token type */
+ public static final TokenType STARTDOC = new TokenType( "STARTDOC", INT_STARTDOC );
+ /** The singleton start-document token type */
+ public static final TokenType ENDDOC = new TokenType( "ENDDOC", INT_ENDDOC );
+ /** The singleton start-element token type */
+ public static final TokenType START = new TokenType( "START", INT_START );
+ /** The singleton end-element token type */
+ public static final TokenType END = new TokenType( "END", INT_END );
+ /** The singleton text token type */
+ public static final TokenType TEXT = new TokenType( "TEXT", INT_TEXT );
+ /** The singleton attribute token type */
+ public static final TokenType ATTR = new TokenType( "ATTR", INT_ATTR );
+ /** The singleton namespace declaration token type */
+ public static final TokenType NAMESPACE = new TokenType( "NAMESPACE", INT_NAMESPACE );
+ /** The singleton comment token type */
+ public static final TokenType COMMENT = new TokenType( "COMMENT", INT_COMMENT );
+ /** The singleton processing instruction token type */
+ public static final TokenType PROCINST = new TokenType( "PROCINST", INT_PROCINST );
+
+ private TokenType ( String name, int value )
+ {
+ _name = name;
+ _value = value;
+ }
+
+ private String _name;
+ private int _value;
+ }
+
+ /**
+ * Deallocates resources needed to manage the cursor, rendering this cursor
+ * inoperable. Because cursors are managed by a mechanism which stores the
+ * XML, simply letting a cursor go out of scope and having the garbage collector
+ * attempt to reclaim it may not produce desirable performance.<br/><br/>
+ *
+ * So, explicitly disposing a cursor allows the underlying implementation
+ * to release its responsibility of maintaining its position.<br/><br/>
+ *
+ * After a cursor has been disposed, it may not be used again. It can
+ * throw IllegalStateException or NullPointerException if used after
+ * disposal.<br/><br/>
+ */
+
+ void dispose ( );
+
+ /**
+ * Moves this cursor to the same position as the moveTo cursor. if the
+ * moveTo cursor is in a different document from this cursor, this cursor
+ * will not be moved, and false returned.
+ *
+ * @param moveTo The cursor at the location to which this cursor
+ * should be moved.
+ * @return true if the cursor moved; otherwise, false.
+ */
+
+ boolean toCursor ( XmlCursor moveTo );
+
+ /**
+ * Saves the current location of this cursor on an internal stack of saved
+ * positions (independent of selection). This location may be restored
+ * later by calling the pop() method.
+ */
+
+ void push ( );
+
+ /**
+ * Restores the cursor location most recently saved with the push() method.
+ *
+ * @return true if there was a location to restore; otherwise, false.
+ */
+
+ boolean pop ( );
+
+ /**
+ * Executes the specified XPath expression against the XML that this
+ * cursor is in. The cursors position does not change. To navigate to the
+ * selections, use hasNextSelection and toNextSelection (similar to
+ * java.util.Iterator).<br/><br/>
+ *
+ * The root referred to by the expression should be given as
+ * a dot. The following is an example path expression:
+ * <pre>
+ * cursor.selectPath("./purchase-order/line-item[price <= 20.00]");
+ * </pre>
+ *
+ * @param path The path expression to execute.
+ * @throws XmlRuntimeException If the query expression is invalid.
+ */
+ void selectPath ( String path );
+
+ /**
+ * Executes the specified XPath expression against the XML that this
+ * cursor is in. The cursor's position does not change. To navigate to the
+ * selections, use hasNextSelection and toNextSelection (similar to
+ * java.util.Iterator).<br/><br/>
+ *
+ * The root referred to by the expression should be given as
+ * a dot. The following is an example path expression:
+ * <pre>
+ * cursor.selectPath("./purchase-order/line-item[price <= 20.00]");
+ * </pre>
+ *
+ * @param path The path expression to execute.
+ * @param options Options for the query. For example, you can call
+ * the {@link XmlOptions#setXqueryCurrentNodeVar(String) XmlOptions.setXqueryCurrentNodeVar(String)}
+ * method to specify a particular name for the query expression
+ * variable that indicates the context node.
+ * @throws XmlRuntimeException If the query expression is invalid.
+ */
+ void selectPath ( String path, XmlOptions options );
+
+ /**
+ * Returns whether or not there is a next selection.
+ *
+ * @return true if there is a next selection; otherwise, false.
+ */
+
+ boolean hasNextSelection ( );
+
+ /**
+ * Moves this cursor to the next location in the selection,
+ * if any. See the selectPath() and addToSelection() methods.
+ *
+ * @return true if the cursor moved; otherwise, false.
+ */
+
+ boolean toNextSelection ( );
+
+ /**
+ * Moves this cursor to the specified location in the selection.
+ * If i is less than zero or greater than or equal to the selection
+ * count, this method returns false.
+ *
+ * See also the selectPath() and addToSelection() methods.
+ *
+ * @param i The index of the desired location.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toSelection ( int i );
+
+ /**
+ * Returns the count of the current selection. See also the selectPath()
+ * and addToSelection() methods.
+ *
+ * You may experience better performance if you use the iteration
+ * model using the toNextSelection method, rather than
+ * the indexing model using the getSelectionCount and
+ * toSelection methods.
+ *
+ * @return A number indicating the size of the current selection.
+ */
+
+ int getSelectionCount ( );
+
+
+ /**
+ * Appends the current location of the cursor to the selection.
+ * See also the selectPath() method. You can use this as an
+ * alternative to calling the selectPath method when you want
+ * to define your own selection.
+ */
+
+ void addToSelection ( );
+
+ /**
+ * Clears this cursor's selection, but does not modify the document.
+ */
+ void clearSelections ( );
+
+ /**
+ * Moves this cursor to the same position as the bookmark. If the
+ * bookmark is in a different document from this cursor or if the
+ * bookmark is orphaned, this cursor
+ * will not be moved, and false will be returned.
+ *
+ * @param bookmark The bookmark at the location to which this
+ * cursor should be moved.
+ * @return true if the cursor moved; otherwise, false.
+ */
+
+ boolean toBookmark ( XmlBookmark bookmark );
+
+ /**
+ * Moves this cursor to the location after its current position
+ * where a bookmark with the given key exists. Returns false if no
+ * such bookmark exists.
+ *
+ * @param key The key held by the next bookmark at the location to
+ * which this cursor should be moved.
+ * @return The next corresponding bookmark, if it exists; null if there
+ * is no next bookmark with the specified key.
+ */
+
+ XmlBookmark toNextBookmark ( Object key );
+
+ /**
+ * Moves this cursor to the location before its current position
+ * where a bookmark with the given key exists. Returns false if no
+ * such bookmark exists.
+ *
+ * @param key The key held by the previous bookmark at the location to
+ * which this cursor should be moved.
+ * @return The previous corresponding bookmark, if it exists; null if
+ * there is no previous bookmark with the specified key.
+ */
+
+ XmlBookmark toPrevBookmark ( Object key );
+
+ /**
+ * Returns the name of the current token. Names may be associated with
+ * START, ATTR, NAMESPACE or PROCINST. Returns null if there is no
+ * name associated with the current token. For START and ATTR, the
+ * name returned identifies the name of the element or attribute.
+ * For NAMESPACE, the local part of the name is the prefix, while
+ * the URI is the namespace defined. For PROCINST, the local part
+ * is the target and the uri is "".
+ *
+ * @return The name of the XML at this cursor's location; null if there
+ * is no name.
+ */
+
+ QName getName ( );
+
+ /**
+ * Sets the name of the current token. This token can be START, NAMESPACE,
+ * ATTR or PROCINST.
+ *
+ * @param name The new name for the current token.
+ */
+
+ void setName ( QName name );
+
+ /**
+ * Returns the namespace URI indicated by the given prefix. The current
+ * context must be at a START or STARTDOC. Namespace prefix mappings
+ * are queried for the mappings defined at the current container first,
+ * then parents are queried. The prefix can be "" or null to indicate
+ * a search for the default namespace. To conform with the
+ * XML spec, the default namespace will return the no-namespace ("")
+ * if it is not mapped.<br/><br/>
+ *
+ * Note that this queries the current state of the document. When the
+ * document is persisted, the saving mechanism may synthesize namespaces
+ * (ns1, ns2, and so on) for the purposes of persistence. These namepaces are
+ * only present in the serialized form, and are not reflected back into
+ * the document being saved.
+ *
+ * @param prefix The namespace prefix for the requested namespace.
+ * @return The URI for corresponding to the specified prefix if it
+ * exists; otherwise, null.
+ */
+ String namespaceForPrefix ( String prefix );
+
+ /**
+ * Returns a prefix that can be used to indicate a namespace URI. The
+ * current context must be at a START or STARTDOC. If there is an
+ * existing prefix that indicates the URI in the current context, that
+ * prefix may be returned. Otherwise, a new prefix for the URI will be
+ * defined by adding an xmlns attribute to the current container or a
+ * parent container.
+ *
+ * Note that this queries the current state of the document. When the
+ * document is persisted, the saving mechanism may synthesize namespaces
+ * (ns1, ns2, and so on) for the purposes of persistence. These namepaces are
+ * only present in the serialized form, and are not reflected back into
+ * the document being saved.
+ *
+ * @param namespaceURI The namespace URI corresponding to the requested
+ * prefix.
+ * @return The prefix corresponding to the specified URI if it exists;
+ * otherwise, a newly generated prefix.
+ */
+ String prefixForNamespace ( String namespaceURI );
+
+ /**
+ * Adds to the specified map, all the namespaces in scope at the container
+ * where this cursor is positioned. This method is useful for
+ * container tokens only.
+ *
+ * @param addToThis The Map to add the namespaces to.
+ */
+
+ void getAllNamespaces ( Map addToThis );
+
+ /**
+ * Returns the strongly-typed XmlObject at the current START,
+ * STARTDOC, or ATTR. <br/><br/>
+ *
+ * The strongly-typed object can be cast to the strongly-typed
+ * XBean interface corresponding to the XML Schema Type given
+ * by result.getSchemaType().<br/><br/>
+ *
+ * If a more specific type cannot be determined, an XmlObject
+ * whose schema type is anyType will be returned.
+ *
+ * @return The strongly-typed object at the cursor's current location;
+ * null if the current location is not a START, STARTDOC, or ATTR.
+ */
+
+ XmlObject getObject ( );
+
+ /**
+ * Returns the type of the current token. By definition, the current
+ * token is the token immediately to the right of the cursor.
+ * If you're in the middle of text, before a character, you get TEXT.
+ * You can't dive into the text of an ATTR, COMMENT or PROCINST.<br/><br/>
+ *
+ * As an alternative, it may be more convenient for you to use one of the
+ * methods that test for a particular token type. These include the methods
+ * isStart(), isStartdoc(), isText(), isAttr(), and so on. Each returns a boolean
+ * value indicating whether the token that follows the cursor is the type
+ * in question.
+ * <br/><br/>
+ *
+ * @return The TokenType instance for the token at the cursor's current
+ * location.
+ */
+
+ TokenType currentTokenType ( );
+
+ /**
+ * True if the current token is a STARTDOC token type, meaning
+ * at the very root of the document.
+ *
+ * @return true if this token is a STARTDOC token type;
+ * otherwise, false.
+ */
+
+ boolean isStartdoc ( );
+
+ /**
+ * True if this token is an ENDDOC token type, meaning
+ * at the very end of the document.
+ *
+ * @return true if this token is an ENDDOC token type;
+ * otherwise, false.
+ */
+
+ boolean isEnddoc ( );
+
+ /**
+ * True if this token is a START token type, meaning
+ * just before an element's start.
+ *
+ * @return true if this token is a START token type;
+ * otherwise, false.
+ */
+
+ boolean isStart ( );
+
+ /**
+ * True if this token is an END token type, meaning
+ * just before an element's end.
+ *
+ * @return true if this token is an END token type;
+ * otherwise, false.
+ */
+
+ boolean isEnd ( );
+
+ /**
+ * True if the this token is a TEXT token type, meaning
+ * just before or inside text.
+ *
+ * @return true if this token is a TEXT token type;
+ * otherwise, false.
+ */
+
+ boolean isText ( );
+
+ /**
+ * True if this token is an ATTR token type, meaning
+ * just before an attribute.
+ *
+ * @return true if this token is an ATTR token type;
+ * otherwise, false.
+ */
+
+ boolean isAttr ( );
+
+ /**
+ * True if this token is a NAMESPACE token type, meaning
+ * just before a namespace declaration.
+ *
+ * @return true if this token is a NAMESPACE token type;
+ * otherwise, false.
+ */
+
+ boolean isNamespace ( );
+
+ /**
+ * True if this token is a COMMENT token type, meaning
+ * just before a comment.
+ *
+ * @return true if this token is a COMMENT token type;
+ * otherwise, false.
+ */
+
+ boolean isComment ( );
+
+ /**
+ * True if this token is a PROCINST token type, meaning
+ * just before a processing instruction.
+ *
+ * @return true if this token is a PROCINST token type;
+ * otherwise, false.
+ */
+
+ boolean isProcinst ( );
+
+ /**
+ * True if this token is a container token. The STARTDOC and START
+ * token types are containers. Containers, including documents and elements,
+ * have the same content model. In other words, a document and an element
+ * may have the same contents. For example, a document may contain attributes
+ * or text, without any child elements.
+ *
+ * @return true if this token is a container token; otherwise, false.
+ */
+
+ boolean isContainer ( );
+
+ /**
+ * True if this token is a finish token. A finish token can be an ENDDOC
+ * or END token type.
+
+ * @return true if this token is a finish token; otherwise, false.
+ */
+
+ boolean isFinish ( );
+
+ /**
+ * True if this token is any attribute. This includes an ATTR token type and
+ * the NAMESPACE token type attribute.
+ *
+ * @return true if the current cursor is at any attribute; otherwise, false.
+ */
+
+ boolean isAnyAttr ( );
+
+ /**
+ * Returns the type of the previous token. By definition, the previous
+ * token is the token immediately to the left of the cursor.<br/><br/>
+ *
+ * If you're in the middle of text, after a character, you get TEXT.
+ *
+ * @return The TokenType instance for the token immediately before the
+ * token at the cursor's current location.
+ */
+
+ TokenType prevTokenType ( );
+
+ /**
+ * True if there is a next token. When this is false, as when the cursor is
+ * at the ENDDOC token, the toNextToken() method returns NONE and does not
+ * move the cursor.
+ *
+ * @return true if there is a next token; otherwise, false.
+ */
+
+ boolean hasNextToken ( );
+
+
+ /**
+ * True if there is a previous token. When this is false, toPrevToken
+ * returns NONE and does not move the cursor.
+ *
+ * @return true if there is a previous token; otherwise, false.
+ */
+
+ boolean hasPrevToken ( );
+
+ /**
+ * Moves the cursor to the next token. When there are no more tokens
+ * available, hasNextToken returns false and toNextToken() returns
+ * NONE and does not move the cursor. Returns the token type
+ * of the token to the right of the cursor upon a successful move.
+ *
+ * @return The token type for the next token if the cursor was moved;
+ * otherwise, NONE.
+ */
+
+ TokenType toNextToken ( );
+
+ /**
+ * Moves the cursor to the previous token. When there is no
+ * previous token, returns NONE, otherwise returns the token
+ * to the left of the new position of the cursor.
+ *
+ * @return The token type for the previous token if the cursor was moved;
+ * otherwise, NONE.
+ */
+
+ TokenType toPrevToken ( );
+
+ /**
+ * Moves the cursor to the first token in the content of the current
+ * START or STARTDOC. That is, the first token after all ATTR and NAMESPACE
+ * tokens associated with this START.<br/><br/>
+ *
+ * If the current token is not a START or STARTDOC, the cursor is not
+ * moved and NONE is returned. If the current START or STARTDOC
+ * has no content, the cursor is moved to the END or ENDDOC token.<br/><br/>
+ *
+ * @return The new current token type.
+ */
+
+ TokenType toFirstContentToken ( );
+
+
+ /**
+ * Moves the cursor to the END or ENDDOC token corresponding to the
+ * current START or STARTDOC, and returns END or ENDDOC. <br/><br/>
+ *
+ * If the current token is not a START or STARTDOC, the cursor is not
+ * moved and NONE is returned.
+ *
+ * @return The new current token type.
+ */
+
+ TokenType toEndToken ( );
+
+ /**
+ * Moves the cursor forward by the specified number of characters, and
+ * stops at the next non-TEXT token. Returns the number of characters
+ * actually moved across, which is guaranteed to be less than or equal to
+ * <em>maxCharacterCount</em>. If there is no further text, or if
+ * there is no text at all, returns zero.<br/><br/>
+ *
+ * Note this does not dive into attribute values, comment contents,
+ * processing instruction contents, etc., but only content text.<br/><br/>
+ *
+ * You can pass maxCharacterCount < 0 to move over all the text to the
+ * right. This has the same effect as toNextToken, but returns the amount
+ * of text moved over.
+ *
+ * @param maxCharacterCount The maximum number of characters by which
+ * the cursor should be moved.
+ * @return The actual number of characters by which the cursor was moved;
+ * 0 if the cursor was not moved.
+ */
+
+ int toNextChar ( int maxCharacterCount );
+
+ /**
+ * Moves the cursor backwards by the number of characters given. Has
+ * similar characteristics to the {@link #toNextChar(int) toNextChar} method.
+ *
+ * @param maxCharacterCount The maximum number of characters by which
+ * the cursor should be moved.
+ * @return The actual number of characters by which the cursor was moved;
+ * 0 if the cursor was not moved.
+ */
+
+ int toPrevChar ( int maxCharacterCount );
+
+ /**
+ * Moves the cursor to the next sibling element, or returns
+ * false and does not move the cursor if there is no next sibling
+ * element. (By definition the position of an element is the same
+ * as the position of its START token.)
+ *
+ * If the current token is not s START, the cursor will be
+ * moved to the next START without moving out of the scope of the
+ * current element.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toNextSibling ( );
+
+ /**
+ * Moves the cursor to the previous sibling element, or returns
+ * false and does not move the cursor if there is no previous sibling
+ * element. (By definition the position of an element is the same
+ * as the position of its START token.)
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toPrevSibling ( );
+
+ /**
+ * Moves the cursor to the parent element or STARTDOC, or returns
+ * false and does not move the cursor if there is no parent.<br/><br/>
+ *
+ * Works if you're in attributes or content. Returns false only if at
+ * STARTDOC. Note that the parent of an END token is the corresponding
+ * START token.
+ *
+ * @return true if the cursor was moved; false if the cursor is at the STARTDOC
+ * token.
+ */
+
+ boolean toParent ( );
+
+ /**
+ * Moves the cursor to the first child element, or returns false and
+ * does not move the cursor if there are no element children. <br/><br/>
+ *
+ * If the cursor is not currently in an element, it moves into the
+ * first child element of the next element.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toFirstChild ( );
+
+ /**
+ * Moves the cursor to the last element child, or returns false and
+ * does not move the cursor if there are no element children.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toLastChild ( );
+
+ /**
+ * Moves the cursor to the first child element of the specified name in
+ * no namespace.
+ *
+ * @param name The name of the element to move the cursor to.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toChild ( String name );
+
+ /**
+ * Moves the cursor to the first child element of the specified name in the
+ * specified namespace.
+ *
+ * @param namespace The namespace URI for the element to move the cursor
+ * to.
+ * @param name The name of the element to move to.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toChild ( String namespace, String name );
+
+ /**
+ * Moves the cursor to the first child element of the specified qualified name.
+ *
+ * @param name The name of the element to move the cursor to.
+ */
+
+ boolean toChild ( QName name );
+
+ /**
+ * Moves the cursor to the child element specified by <em>index</em>.
+ *
+ * @param index The position of the element in the sequence of child
+ * elements.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toChild ( int index );
+
+ /**
+ * Moves the cursor to the specified <em>index</em> child element of the
+ * specified name, where that element is the .
+ *
+ * @param name The name of the child element to move the cursor to.
+ * @param index The position of the element in the sequence of child
+ * elements.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toChild ( QName name, int index );
+
+ /**
+ * Moves the cursor to the next sibling element of the specified name in no
+ * namespace.
+ *
+ * @param name The name of the element to move the cursor to.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toNextSibling ( String name );
+
+ /**
+ * Moves the cursor to the next sibling element of the specified name
+ * in the specified namespace.
+ *
+ * @param namespace The namespace URI for the element to move the cursor
+ * to.
+ * @param name The name of the element to move the cursor to.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toNextSibling ( String namespace, String name );
+
+
+ /**
+ * Moves the cursor to the next sibling element of the specified
+ * qualified name.
+ *
+ * @param name The name of the element to move the cursor to.
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toNextSibling ( QName name );
+
+ /**
+ * Moves the cursor to the first attribute of this element, or
+ * returns false and does not move the cursor if there are no
+ * attributes. The order of attributes is arbitrary, but stable.<br/><br/>
+ *
+ * xmlns attributes (namespace declarations) are not considered
+ * attributes by this function.<br/><br/>
+ *
+ * The cursor must be on a START or STARTDOC for this method to
+ * succeed.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toFirstAttribute ( );
+
+ /**
+ * Moves the cursor to the last attribute of this element, or
+ * returns false and does not move the cursor if there are no
+ * attributes. The order of attributes is arbitrary, but stable.<br/><br/>
+ *
+ * xmlns attributes (namespace declarations) are not considered
+ * attributes by this function.<br/><br/>
+ *
+ * The cursor must be on a START or STARTDOC for this method
+ * to succeed.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toLastAttribute ( );
+
+ /**
+ * Moves the cursor to the next sibling attribute, or returns
+ * false and does not move the cursor if there is no next
+ * sibling attribute. The order of attributes is arbitrary, but stable.<br/><br/>
+ *
+ * xmlns attributes (namespace declarations) are not considered
+ * attributes by this function.<br/><br/>
+ *
+ * The cursor must be on an attribute for this method to succeed.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toNextAttribute ( );
+
+ /**
+ * Moves the cursor to the previous sibling attribute, or returns
+ * false and does not move the cursor if there is no previous
+ * sibling attribute. The order of attributes is arbitrary, but stable.<br/><br/>
+ *
+ * xmlns attributes (namespace declarations) are not considered
+ * attributes by this function.<br/><br/>
+ *
+ * The cursor must be on an attribute for this method to succeed.
+ *
+ * @return true if the cursor was moved; otherwise, false.
+ */
+
+ boolean toPrevAttribute ( );
+
+ /**
+ * When at a START or STARTDOC, returns the attribute text for the given
+ * attribute. When not at a START or STARTDOC or the attribute does not
+ * exist, returns null.
+ *
+ * @param attrName The name of the attribute whose value is requested.
+ * @return The attribute's value if it has one; otherwise, null.
+ */
+
+ String getAttributeText ( QName attrName );
+
+ /**
+ * When at a START or STARTDOC, sets the attribute text for the given
+ * attribute. When not at a START or STARTDOC returns false.
+ * If the attribute does not exist, one is created.
+ *
+ * @param attrName The name of the attribute whose value is being set.
+ * @param value The new value for the attribute.
+ * @return true if the new value was set; otherwise, false.
+ */
+
+ boolean setAttributeText ( QName attrName, String value );
+
+ /**
+ * When at a START or STARTDOC, removes the attribute with the given name.
+ *
+ * @param attrName The name of the attribute that should be removed.
+ * @return true if the attribute was removed; otherwise, false.
+ */
+
+ boolean removeAttribute ( QName attrName );
+
+ /**
+ * Gets the text value of the current document, element, attribute,
+ * comment, procinst or text token. <br/><br/>
+ *
+ * When getting the text value of an element, non-text content such
+ * as comments and processing instructions are ignored and text is concatenated.
+ * For elements that have nested element children, this
+ * returns the concatenated text of all mixed content and the
+ * text of all the element children, recursing in first-to-last
+ * depthfirst order.<br/><br/>
+ *
+ * For attributes, this returns the attribute value.<br/><br/>
+ *
+ * For comments and processing instructions, this returns the text contents
+ * of the comment or PI, not including the delimiting sequences <!-- -->, <? ?>.
+ *<br/><br/>
+ * If the current token is not a START, STARTDOC, TEXT, ATTR, COMMENT, or
+ * PROCINST, this returns null. The value of an empty tag is the
+ * empty string.
+ *
+ * @return The text value of the current token, if the token's type is
+ * START, STARTDOC, TEXT, ATTR, COMMENT, or PROCINST; null if the type is
+ * END, ENDDOC, NONE, or NAMESPACE.
+ */
+
+ String getTextValue ( );
+
+ /**
+ * Copies the text value of the current document, element, attribute,
+ * comment, processing instruction or text token, counting right from
+ * this cursor's location up to <em>maxCharacterCount</em>,
+ * and copies the returned text into <em>returnedChars</em>. <br/><br/>
+ *
+ * When getting the text value of an element, non-text content such
+ * as comments and processing instructions are ignored and text is concatenated.
+ * For elements that have nested element children, this
+ * returns the concatenated text of all mixed content and the
+ * text of all the element children, recursing in first-to-last
+ * depthfirst order.<br/><br/>
+ *
+ * For attributes, this returns the attribute value.<br/><br/>
+ *
+ * For comments and processing instructions, this returns the text contents
+ * of the comment or PI, not including the delimiting sequences <!-- -->, <? ?>.
+ * <br/><br/>
+ *
+ * If the current token is END, ENDDOC, or NAMESPACE, this returns 0.
+ * The value of an empty tag is the empty string.
+ *
+ * @param returnedChars A character array to hold the returned characters.
+ * @param offset The position within returnedChars to which the first of the
+ * returned characters should be copied.
+ * @param maxCharacterCount The maximum number of characters after this cursor's
+ * location to copy.
+ * @return The actual number of characters copied; 0 if no characters
+ * were copied.
+ */
+
+ int getTextValue ( char[] returnedChars, int offset, int maxCharacterCount );
+
+ /**
+ * Returns the characters of the current TEXT token. If the current token
+ * is not TEXT, returns "". If in the middle of a TEXT token, returns
+ * those chars to the right of the cursor of the TEXT token.
+ *
+ * @return The requested text; an empty string if the current token type is
+ * not TEXT.
+ */
+
+ /**
+ * Sets the text value of the XML at this cursor's location if that XML's
+ * token type is START, STARTDOC, ATTR, COMMENT or PROCINST. <br/><br/>
+ *
+ * For elements that have nested children this first removes all
+ * the content of the element and replaces it with the given text.
+ *
+ * @param text The text to use as a new value.
+ * @throws java.lang.IllegalStateException If the token type at this
+ * cursor's location is not START, STARTDOC, ATTR, COMMENT or
+ * PROCINST.
+ */
+ void setTextValue ( String text );
+
+ /**
+ * Sets the text value of the XML at this cursor's location (if that XML's
+ * token type is START, STARTDOC, ATTR, COMMENT or PROCINST) to the
+ * contents of the specified character array. <br/><br/>
+ *
+ * For elements that have nested children this first removes all
+ * the content of the element and replaces it with the given text.
+ *
+ * @param sourceChars A character array containing the XML's new value.
+ * @param offset The position within sourceChars from which the first of
+ * the source characters should be copied.
+ * @param length The maximum number of characters to set as the XML's new
+ * value.
+ * @throws java.lang.IllegalArgumentException If the token type at this
+ * cursor's location is not START, STARTDOC, ATTR, COMMENT or
+ * PROCINST.
+ */
+ void setTextValue ( char[] sourceChars, int offset, int length );
+
+ /**
+ * Returns characters to the right of the cursor up to the next token.
+ */
+ String getChars ( );
+
+ /**
+ * Copies characters up to the specified maximum number, counting right from
+ * this cursor's location to the character at <em>maxCharacterCount</em>. The
+ * returned characters are added to <em>returnedChars</em>, with the first
+ * character copied to the <em>offset</em> position. The <em>maxCharacterCount</em>
+ * parameter should be less than or equal to the length of <em>returnedChars</em>
+ * minus <em>offset</em>. Copies a number of characters, which is
+ * either <em>maxCharacterCount</em> or the number of characters up to the next token,
+ * whichever is less.
+ *
+ * @param returnedChars A character array to hold the returned characters.
+ * @param offset The position within returnedChars at which the first of the
+ * returned characters should be added.
+ * @param maxCharacterCount The maximum number of characters after this cursor's
+ * location to return.
+ * @return The actual number of characters returned; 0 if no characters
+ * were returned or if the current token is not TEXT.
+ */
+
+ int getChars ( char[] returnedChars, int offset, int maxCharacterCount );
+
+ /**
+ * Moves the cursor to the STARTDOC token, which is the
+ * root of the document.
+ */
+
+ void toStartDoc ( );
+
+ /**
+ * Moves the cursor to the ENDDOC token, which is the end
+ * of the document.
+ */
+
+ void toEndDoc ( );
+
+ /**
+ * Determines if the specified cursor is in the same document as
+ * this cursor.
+ *
+ * @param cursor The cursor that may be in the same document
+ * as this cursor.
+ * @return true if the specified cursor is in the same document;
+ * otherwise, false.
+ */
+
+ boolean isInSameDocument ( XmlCursor cursor );
+
+ /**
+ * Returns an integer indicating whether this cursor is before,
+ * after, or at the same position as the specified cursor. <br/><br/>
+ *
+ * <code>a.comparePosition(b) < 0</code> means a is to the left of b.<br/>
+ * <code>a.comparePosition(b) == 0</code> means a is at the same position as b.<br/>
+ * <code>a.comparePosition(b) > 0</code> means a is to the right of b.<br/><br/>
+ *
+ * The sort order of cursors in the document is the token order.
+ * For example, if cursor "a" is at a START token and the cursor "b"
+ * is at a token within the contents of the same element, then
+ * a.comparePosition(b) will return -1, meaning that the position
+ * of a is before b.
+ *
+ * @param cursor The cursor whose position should be compared
+ * with this cursor.
+ * @return 1 if this cursor is after the specified cursor; 0 if
+ * this cursor is at the same position as the specified cursor;
+ * -1 if this cursor is before the specified cursor.
+ * @throws java.lang.IllegalArgumentException If the specified
+ * cursor is not in the same document as this cursor.
+ */
+
+ int comparePosition ( XmlCursor cursor );
+
+ /**
+ * Determines if this cursor is to the left of (or before)
+ * the specified cursor. Note that this is the same as
+ * <code>a.comparePosition(b) < 0 </code>
+ *
+ * @param cursor The cursor whose position should be compared
+ * with this cursor.
+ * @return true if this cursor is to the left of the specified
+ * cursor; otherwise, false.
+ */
+
+ boolean isLeftOf ( XmlCursor cursor );
+
+ /**
+ * Determines if this cursor is at the same position as
+ * the specified cursor. Note that this is the same as
+ * <code>a.comparePosition(b) == 0 </code>
+ *
+ * @param cursor The cursor whose position should be compared
+ * with this cursor.
+ * @return true if this cursor is at the same position as
+ * the specified cursor; otherwise, false.
+ */
+
+ boolean isAtSamePositionAs ( XmlCursor cursor );
+
+ /**
+ * Determines if this cursor is to the right of (or after)
+ * the specified cursor. Note that this is the same as
+ * <code>a.comparePosition(b) > 0 </code>
+ *
+ * @param cursor The cursor whose position should be compared
+ * with this cursor.
+ * @return true if this cursor is to the right of the specified
+ * cursor; otherwise, false.
+ */
+
+ boolean isRightOf ( XmlCursor cursor );
+
+ /**
+ * Executes the specified XQuery expression against the XML this
+ * cursor is in. <br/><br/>
+ *
+ * The query may be a String or a compiled query. You can precompile
+ * an XQuery expression using the XmlBeans.compileQuery method. <br/><br>
+ *
+ * The root referred to by the expression should be given as
+ * a dot. The following is an example path expression:
+ * <pre>
+ * XmlCursor results = cursor.execQuery("purchase-order/line-item[price <= 20.00]");
+ * </pre>
+ *
+ * @param query The XQuery expression to execute.
+ * @return A cursor containing the results of the query.
+ * @throws XmlRuntimeException If the query expression is invalid.
+ */
+
+ XmlCursor execQuery ( String query );
+
+ /**
+ * Executes the specified XQuery expression against the XML this
+ * cursor is in, and using the specified options. <br/><br/>
+ *
+ * @param query The XQuery expression to execute.
+ * @param options Options for the query. For example, you can call
+ * the {@link XmlOptions#setXqueryCurrentNodeVar(String) XmlOptions.setXqueryCurrentNodeVar(String)}
+ * method to specify a particular name for the query expression
+ * variable that indicates the context node.
+ * @throws XmlRuntimeException If the query expression is invalid.
+ */
+
+ XmlCursor execQuery ( String query, XmlOptions options );
+
+ /**
+ * Represents the state of a dcoument at a particular point
+ * in time. It is used to determine if a document has been changed
+ * since that point in time.
+ */
+ interface ChangeStamp
+ {
+ /**
+ * Returns whether or not the document assoiated with this ChangeStamp
+ * has been altered since the ChangeStamp had been created.
+ */
+ public boolean hasChanged ( );
+ }
+
+ /**
+ * Returns the current change stamp for the document the current cursor is in.
+ * This change stamp can be queried at a later point in time to find out
+ * if the document has changed.
+ *
+ * @return The change stamp for the document the current cursor is in.
+ */
+ ChangeStamp getDocChangeStamp ( );
+
+ /**
+ * Subclasses of XmlBookmark can be used to annotate an XML document.
+ * This class is abstract to prevent parties from inadvertently
+ * interfering with each others' bookmarks without explicitly
+ * sharing a bookmark class.
+ */
+
+ abstract class XmlBookmark
+ {
+ /**
+ * Constructs a strongly-referenced bookmark.
+ */
+ public XmlBookmark ( ) { this( false ); }
+
+ /**
+ * Constructs a bookmark.
+ * @param weak true if the document's reference to the bookmark should be a WeakReference
+ */
+ public XmlBookmark ( boolean weak )
+ {
+ _ref = weak ? new WeakReference( this ) : null;
+ }
+
+ /**
+ * Call the createCursor method to create a new cursor which is
+ * positioned at the same splace as the bookmark. It is much more
+ * efficient to call toBookmark on an existing cursor than it
+ * is to create a new cursor. However, toBookmark may fail if the
+ * bookmark is in a different document than the cursor. It is
+ * under these circumstances where createCursor needs to be called
+ * on the bookmark. Subsequent navigations to bookmark
+ * positions should attempt to reuse the last cursor to
+ * improve performace.
+ */
+ public final XmlCursor createCursor ( )
+ {
+ return _currentMark == null ? null : _currentMark.createCursor();
+ }
+
+ /**
+ * Moves the given cursor to this bookmark, and returns it.
+ */
+ public final XmlCursor toBookmark ( XmlCursor c )
+ {
+ return c == null || !c.toBookmark( this ) ? createCursor() : c;
+ }
+
+ /**
+ * The default key for bookmarks is the class which implements
+ * them. This way, multiple parties using bookmarks in the
+ * same instance document will not interfere with eachother.
+ * One can, however, override getKey() to use a key other than
+ * the class.
+ */
+ public Object getKey ( )
+ {
+ return this.getClass();
+ }
+
+ /**
+ * The mark is set by the host document; it is capable of
+ * returning an XmlCursor implementation at the location of
+ * the bookmark.
+ */
+ public XmlMark _currentMark;
+
+ /**
+ * If non-null, the ref is used by the host document
+ * to maintain a reference to the bookmark. If it is a weak
+ * reference, the host document will not prevent the Bookmark
+ * from being garbage collected.
+ */
+ public final Reference _ref;
+ }
+
+ /**
+ * An abstract {@link XmlCursor} factory.
+ * Implementations of XmlCursor implement XmlMark to be able to
+ * reconstitute a cursor from a bookmark. When content moves between
+ * implementations, the XmlMark is set to the implmentation's which
+ * recieves the new content.
+ */
+
+ interface XmlMark
+ {
+ XmlCursor createCursor ( );
+ }
+
+ /**
+ * Sets a bookmark to the document at this cursor's location.
+ *
+ * The bookmark is attached to the token in the tree immediately
+ * after the cursor. If the tree is manipulated to move
+ * that object to a different place, the bookmark moves with it.
+ * If the tree is manipulated to delete that token from the
+ * tree, the bookmark is orphaned. Copy operations do not copy
+ * bookmarks.
+ *
+ * @param bookmark The bookmark to set.
+ */
+
+ void setBookmark ( XmlBookmark bookmark );
+
+ /**
+ * Retrieves the bookmark with the specified key
+ * at this cursor's location. If there is no bookmark whose key is
+ * given by the specified key at the current position, null is returned.
+ * If the {@link XmlCursor.XmlBookmark#getKey() getKey} method is not overridden on
+ * the bookmark, then the bookmark's class is used as the key.
+ *
+ * @param key The key for the bookmark to retrieve.
+ * @return The requested bookmark; null if there is no bookmark
+ * corresponding to the specified key.
+ */
+
+ XmlBookmark getBookmark ( Object key );
+
+ /**
+ * Clears the bookmark whose key is specified, if the bookmark
+ * exists at this cursor's location.
+ *
+ * @param key The for the bookmark to clear.
+ */
+
+ void clearBookmark ( Object key );
+
+ /**
+ * Retrieves all the bookmarks at this location, adding them to
+ * the specified collection. Bookmarks held by weak references are
+ * added to this collection as Weak referenced objects pointing to the
+ * bookmark.
+ *
+ * @param listToFill The collection that will contain bookmarks
+ * returned by this method.
+ */
+
+ void getAllBookmarkRefs ( Collection listToFill );
+
+ /**
+ * Removes the XML that is immediately after this cursor.
+ *
+ * For the TEXT, ATTR, NAMESPACE, COMMENT and PROCINST tokens, a single
+ * token is removed. For a START token, the corresponding element and all
+ * of its contents are removed. For all other tokens, this is a no-op.
+ * You cannot remove a STARTDOC.
+ *
+ * The cursors located in the XML that was removed all collapse to the
+ * same location. All bookmarks in this XML will be orphaned.
+ *
+ * @return true if anything was removed; false only if the cursor is
+ * just before END or ENDDOC token.
+ * @throws java.lang.IllegalArgumentException If the cursor is at a
+ * STARTDOC token.
+ */
+
+ boolean removeXml ( );
+
+ /**
+ * Moves the XML immediately after this cursor to the location
+ * specified by the <em>toHere</em> cursor, shifting XML at that location
+ * to the right to make room. For the TEXT, ATTR, NAMESPACE,
+ * COMMENT and PROCINST tokens, a single token is moved. For a start token, the
+ * element and all of its contents are moved. For all other tokens, this
+ * is a no-op.
+ *
+ * The bookmarks located in the XML that was moved also move to the
+ * new location; the cursors don't move with the content.
+ *
+ * @param toHere The cursor at the location to which the XML should
+ * be moved.
+ * @return true if anything was moved; false only if the cursor is
+ * just before END or ENDDOC token.
+ * @throws java.lang.IllegalArgumentException If the operation is not allowed
+ * at the cursor's location.
+ */
+
+ boolean moveXml ( XmlCursor toHere );
+
+ /**
+ * Copies the XML immediately after this cursor to the location
+ * specified by the <em>toHere</em> cursor. For the TEXT, ATTR, NAMESPACE,
+ * COMMENT and PROCINST tokens, a single token is copied. For a start token,
+ * the element and all of its contents are copied. For all other tokens, this
+ * is a no-op.
+ *
+ * The cursors and bookmarks located in the XML that was copied are also copied
+ * to the new location.
+ *
+ * @param toHere The cursor at the location to which the XML should
+ * be copied.
+ * @return true if anything was copied; false if the token supports the operation,
+ * but nothing was copied.
+ * @throws java.lang.IllegalArgumentException If the operation is not allowed
+ * at the cursor's location.
+ */
+
+ boolean copyXml ( XmlCursor toHere );
+
+ /**
+ * Removes the contents of the container (STARTDOC OR START) immediately after
+ * this cursor. For all other situations, returns false. Does
+ * not remove attributes or namspaces.
+ *
+ * @return true if anything was copied; otherwise, false.
+ */
+
+ boolean removeXmlContents ( );
+
+ /**
+ * Moves the contents of the container (STARTDOC OR START) immediately after
+ * this cursor to the location specified by the <em>toHere</em> cursor.
+ * For all other situations, returns false. Does not move attributes or
+ * namespaces.
+ *
+ * @param toHere The cursor at the location to which the XML should be moved.
+ * @return true if anything was moved; otherwise, false.
+ */
+ boolean moveXmlContents ( XmlCursor toHere );
+
+ /**
+ * Copies the contents of the container (STARTDOC OR START) immediately to
+ * the right of the cursor to the location specified by the <em>toHere</em> cursor.
+ * For all other situations, returns false. Does not copy attributes or
+ * namespaces.
+ *
+ * @param toHere The cursor at the location to which the XML should
+ * be copied.
+ * @return true if anything was copied; otherwise, false.
+ */
+ boolean copyXmlContents ( XmlCursor toHere );
+
+ /**
+ * Removes characters up to the specified maximum number, counting right from
+ * this cursor's location to the character at <em>maxCharacterCount</em>. The
+ * space remaining from removing the characters collapses up to this cursor.
+ *
+ * @param maxCharacterCount The maximum number of characters after this cursor's
+ * location to remove.
+ * @return The actual number of characters removed.
+ * @throws java.lang.IllegalArgumentException If the operation is not allowed
+ * at the cursor's location.
+ */
+
+ int removeChars ( int maxCharacterCount );
+
+ /**
+ * Moves characters immediately after this cursor to the position immediately
+ * after the specified cursor. Characters are counted to the right up to the
+ * specified maximum number. XML after the destination cursor is
+ * shifted to the right to make room. The space remaining from moving the
+ * characters collapses up to this cursor.
+ *
+ * @param maxCharacterCount The maximum number of characters after this cursor's
+ * location to move.
+ * @param toHere The cursor to which the characters should be moved.
+ * @return The actual number of characters moved.
+ * @throws java.lang.IllegalArgumentException If the operation is not allowed
+ * at the cursor's location.
+ */
+
+ int moveChars ( int maxCharacterCount, XmlCursor toHere );
+
+ /**
+ * Copies characters to the position immediately after the specified cursor.
+ * Characters are counted to the right up to the specified maximum number.
+ * XML after the destination cursor is shifted to the right to make room.
+ *
+ * @param maxCharacterCount The maximum number of characters after this cursor's
+ * location to copy.
+ * @param toHere The cursor to which the characters should be copied.
+ * @return The actual number of characters copied.
+ * @throws java.lang.IllegalArgumentException If the operation is not allowed
+ * at the cursor's location.
+ */
+
+ int copyChars ( int maxCharacterCount, XmlCursor toHere );
+
+ /**
+ * Inserts the specified text immediately before this cursor's location.
+ *
+ * @param text The text to insert.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertChars ( String text );
+
+ /**
+ * Inserts an element immediately before this cursor's location, giving
+ * the element the specified qualified name.
+ *
+ * @param name The qualified name for the element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElement ( QName name );
+
+ /**
+ * Inserts an element immediately before this cursor's location, giving
+ * the element the specified local name.
+ *
+ * @param localName The local name for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElement ( String localName );
+
+ /**
+ * Inserts a new element immediately before this cursor's location, giving the
+ * element the specified local name and associating it with specified namespace
+ *
+ * @param localName The local name for the new element.
+ * @param uri The URI for the new element's namespace.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElement ( String localName, String uri );
+
+ /**
+ * Inserts a new element around this cursor, giving the element the specified
+ * qualified name. After the element is inserted, this cursor is between its start
+ * and end. This cursor can then be used to insert additional XML into
+ * the new element.
+ *
+ * @param name The qualified name for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void beginElement ( QName name );
+
+ /**
+ * Inserts a new element around this cursor, giving the element the specified
+ * local name. After the element is inserted, this cursor is between its start
+ * and end. This cursor can then be used to insert additional XML into
+ * the new element.
+ *
+ * @param localName The local name for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void beginElement ( String localName );
+
+ /**
+ * Inserts a new element around this cursor, giving the element the specified
+ * local name and associating it with the specified namespace. After the element
+ * is inserted, this cursor is between its start and end. This cursor
+ * can then be used to insert additional XML into the new element.
+ *
+ * @param localName The local name for the new element.
+ * @param uri The URI for the new element's namespace.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void beginElement ( String localName, String uri );
+
+ /**
+ * Inserts a new element immediately before this cursor's location, giving the
+ * element the specified qualified name and content.
+ *
+ * @param name The qualified name for the new element.
+ * @param text The content for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElementWithText ( QName name, String text );
+
+ /**
+ * Inserts a new element immediately before this cursor's location, giving the
+ * element the specified local name and content.
+ *
+ * @param localName The local name for the new element.
+ * @param text The content for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElementWithText ( String localName, String text );
+
+ /**
+ * Inserts a new element immediately before this cursor's location, giving the
+ * element the specified local name, associating it with the specified namespace,
+ * and giving it the specified content.
+ *
+ * @param localName The local name for the new element.
+ * @param uri The URI for the new element's namespace.
+ * @param text The content for the new element.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertElementWithText ( String localName, String uri, String text );
+
+ /**
+ * Inserts a new attribute immediately before this cursor's location, giving it
+ * the specified local name.
+ *
+ * @param localName The local name for the new attribute.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttribute ( String localName );
+
+ /**
+ * Inserts a new attribute immediately before this cursor's location, giving it
+ * the specified local name and associating it with the specified namespace.
+ *
+ * @param localName The local name for the new attribute.
+ * @param uri The URI for the new attribute's namespace.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttribute ( String localName, String uri );
+
+ /**
+ * Inserts a new attribute immediately before this cursor's location, giving it
+ * the specified name.
+ *
+ * @param name The local name for the new attribute.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttribute ( QName name );
+
+ /**
+ * Inserts a new attribute immediately before this cursor's location, giving it
+ * the specified value and name.
+ *
+ * @param Name The local name for the new attribute.
+ * @param value The value for the new attribute.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttributeWithValue ( String Name, String value );
+
+ /**
+ * Inserts an attribute immediately before the cursor's location, giving it
+ * the specified name and value, and associating it with the specified namespace.
+ *
+ * @param name The name for the new attribute.
+ * @param uri The URI for the new attribute's namespace.
+ * @param value The value for the new attribute.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttributeWithValue ( String name, String uri, String value );
+
+ /**
+ * Inserts an attribute immediately before the cursor's location, giving it
+ * the specified name and value.
+ *
+ * @param name The name for the new attribute.
+ * @param value The value for the new attribute.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertAttributeWithValue ( QName name, String value );
+
+ /**
+ * Inserts a namespace declaration immediately before the cursor's location,
+ * giving it the specified prefix and URI.
+ *
+ * @param prefix The prefix for the namespace.
+ * @param namespace The URI for the namespace.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertNamespace ( String prefix, String namespace );
+
+ /**
+ * Inserts an XML comment immediately before the cursor's location,
+ * giving it the specified content.
+ *
+ * @param text The new comment's content.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertComment ( String text );
+
+ /**
+ * Inserts an XML processing instruction immediately before the cursor's location,
+ * giving it the specified target and text.
+ *
+ * @param target The target for the processing instruction.
+ * @param text The new processing instruction's text.
+ * @throws java.lang.IllegalArgumentException If the insertion is not allowed
+ * at the cursor's location.
+ */
+
+ void insertProcInst ( String target, String text );
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDate.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDate.java
new file mode 100644
index 0000000..8cee6af
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDate.java
@@ -0,0 +1,170 @@
+/* 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.xmlbeans;
+
+import java.util.Date;
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#date">xs:date</a> type.
+ * <p>
+ * Convertible to {@link Calendar}, {@link Date}, and {@link GDate}.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlDate extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_date");
+
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+ /**
+ * Returns this value as a {@link Date}
+ * @deprecated replaced with {@link #getDateValue}
+ **/
+ Date dateValue();
+ /**
+ * Sets this value as a {@link Date}
+ * @deprecated replaced with {@link #setDateValue}
+ **/
+ void set(Date d);
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+ /** Returns this value as a {@link Date} */
+ Date getDateValue();
+ /** Sets this value as a {@link Date} */
+ void setDateValue(Date d);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlDate}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlDate} */
+ public static XmlDate newInstance() {
+ return (XmlDate) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlDate} */
+ public static XmlDate newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlDate) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlDate} value */
+ public static XmlDate newValue(Object obj) {
+ return (XmlDate) type.newValue( obj ); }
+
+ /** Parses a {@link XmlDate} fragment from a String. For example: "<code><xml-fragment>2003-06-14</xml-fragment></code>". */
+ public static XmlDate parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from a String. For example: "<code><xml-fragment>2003-06-14</xml-fragment></code>". */
+ public static XmlDate parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from a File. */
+ public static XmlDate parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from a File. */
+ public static XmlDate parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from a URL. */
+ public static XmlDate parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from a URL. */
+ public static XmlDate parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from an InputStream. */
+ public static XmlDate parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from an InputStream. */
+ public static XmlDate parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from a Reader. */
+ public static XmlDate parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from a Reader. */
+ public static XmlDate parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from a DOM Node. */
+ public static XmlDate parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from a DOM Node. */
+ public static XmlDate parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlDate} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDate parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlDate} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDate parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDate) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDateTime.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDateTime.java
new file mode 100644
index 0000000..a67aee0
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDateTime.java
@@ -0,0 +1,169 @@
+/* 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.xmlbeans;
+
+import java.util.Date;
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#dateTime">xs:dateTime</a> type.
+ * <p>
+ * Convertible to {@link Calendar}, {@link Date}, and {@link GDate}.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlDateTime extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_dateTime");
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+ /**
+ * Returns this value as a {@link Date}
+ * @deprecated replaced with {@link #getDateValue}
+ **/
+ Date dateValue();
+ /**
+ * Sets this value as a {@link Date}
+ * @deprecated replaced with {@link #setDateValue}
+ **/
+ void set(Date d);
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+ /** Returns this value as a {@link Date} */
+ Date getDateValue();
+ /** Sets this value as a {@link Date} */
+ void setDateValue(Date d);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlDateTime}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlDateTime} */
+ public static XmlDateTime newInstance() {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlDateTime} */
+ public static XmlDateTime newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlDateTime} value */
+ public static XmlDateTime newValue(Object obj) {
+ return (XmlDateTime) type.newValue( obj ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a String. For example: "<code><xml-fragment>2003-06-14T12:00:00</xml-fragment></code>". */
+ public static XmlDateTime parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a String. For example: "<code><xml-fragment>2003-06-14T12:00:00</xml-fragment></code>". */
+ public static XmlDateTime parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a File. */
+ public static XmlDateTime parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a File. */
+ public static XmlDateTime parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a URL. */
+ public static XmlDateTime parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a URL. */
+ public static XmlDateTime parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from an InputStream. */
+ public static XmlDateTime parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from an InputStream. */
+ public static XmlDateTime parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a Reader. */
+ public static XmlDateTime parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a Reader. */
+ public static XmlDateTime parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a DOM Node. */
+ public static XmlDateTime parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from a DOM Node. */
+ public static XmlDateTime parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlDateTime} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDateTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlDateTime} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDateTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDateTime) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDecimal.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDecimal.java
new file mode 100644
index 0000000..1f242c6
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDecimal.java
@@ -0,0 +1,136 @@
+/* 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.xmlbeans;
+
+import java.math.BigDecimal;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a> type.
+ * <p>
+ * Convertible to {@link BigDecimal}.
+ */
+public interface XmlDecimal extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_decimal");
+
+ /** Returns this value as a {@link BigDecimal} */
+ BigDecimal getBigDecimalValue();
+ /** Sets this value as a {@link BigDecimal} */
+ void setBigDecimalValue(BigDecimal bd);
+
+ /**
+ * Returns this value as a {@link BigDecimal}
+ * @deprecated replaced with {@link #getBigDecimalValue}
+ **/
+ BigDecimal bigDecimalValue();
+ /**
+ * Sets this value as a {@link BigDecimal}
+ * @deprecated replaced with {@link #setBigDecimalValue}
+ **/
+ void set(BigDecimal bd);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlDecimal}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlDecimal} */
+ public static XmlDecimal newInstance() {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlDecimal} */
+ public static XmlDecimal newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlDecimal} value */
+ public static XmlDecimal newValue(Object obj) {
+ return (XmlDecimal) type.newValue( obj ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a String. For example: "<code><xml-fragment>1234.56789</xml-fragment></code>". */
+ public static XmlDecimal parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a String. For example: "<code><xml-fragment>1234.56789</xml-fragment></code>". */
+ public static XmlDecimal parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a File. */
+ public static XmlDecimal parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a File. */
+ public static XmlDecimal parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a URL. */
+ public static XmlDecimal parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a URL. */
+ public static XmlDecimal parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from an InputStream. */
+ public static XmlDecimal parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from an InputStream. */
+ public static XmlDecimal parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a Reader. */
+ public static XmlDecimal parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a Reader. */
+ public static XmlDecimal parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a DOM Node. */
+ public static XmlDecimal parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from a DOM Node. */
+ public static XmlDecimal parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlDecimal} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDecimal parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlDecimal} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDecimal parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDecimal) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDocumentProperties.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDocumentProperties.java
new file mode 100644
index 0000000..75b2658
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDocumentProperties.java
@@ -0,0 +1,185 @@
+/* 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.xmlbeans;
+
+/**
+ * This class is used to attach arbitrary information to an XML
+ * document. It also defines several well-known types of
+ * information that can be attached or found on a document.
+ * <p>
+ * For example, suppose you wanted to associate a filename
+ * with the document containing an xml object "xobj". This
+ * could be done via the following code:
+ * <p>
+ * tokenSource.documentProperties().set(XmlDocumentProperties.NAME, "MyFilename.xml");
+ * <p>
+ * To fetch the filename later, given an xobj2 anywhere in the
+ * same document, you can write:
+ * <p>
+ * filename = (String)tokenSource.documentProperties().get(XmlDocumentProperties.NAME);
+ */
+public abstract class XmlDocumentProperties
+{
+ /**
+ * Sets the name of the XML document file. Typically a URL, but may
+ * be any String.
+ * @param sourceName the name to set
+ * @see XmlOptions#setDocumentSourceName
+ */
+ public void setSourceName ( String sourceName ) { put( SOURCE_NAME, sourceName ); }
+ /**
+ * Returns the name of the XML document file. Typically a URL, but may
+ * be any String.
+ * @see XmlOptions#setDocumentSourceName
+ */
+ public String getSourceName ( ) { return (String) get( SOURCE_NAME ); }
+
+ /**
+ * Sets the encoding to use for the XML document. Should be a valid
+ * XML encoding string.
+ * @param encoding the ISO encoding name
+ * @see XmlOptions#setCharacterEncoding
+ */
+ public void setEncoding ( String encoding ) { put( ENCODING, encoding ); }
+ /**
+ * Returns the encoding used for the XML document, as an ISO encoding name.
+ * @see XmlOptions#setCharacterEncoding
+ */
+ public String getEncoding ( ) { return (String) get( ENCODING ); }
+
+ /**
+ * Sets the XML version string to use in the <?xml?> declaration.
+ * (The XML specification is quite stable at "1.0".)
+ * @param version the XML version string
+ */
+ public void setVersion ( String version ) { put( VERSION, version ); }
+ /**
+ * Returns the XML version string used in the <?xml?> declaration.
+ */
+ public String getVersion ( ) { return (String) get( VERSION ); }
+
+ /**
+ * Sets the DOCTYPE name use in the <!DOCTYPE> declaration.
+ * @param doctypename the doctypename
+ */
+ public void setDoctypeName ( String doctypename ) { put( DOCTYPE_NAME, doctypename ); }
+ /**
+ * Returns the DOCTYPE name used in the <!DOCTYPE> declaration.
+ */
+ public String getDoctypeName ( ) { return (String) get( DOCTYPE_NAME ); }
+
+ /**
+ * Sets the DOCTYPE public ID to use in the <!DOCTYPE> declaration.
+ * @param publicid the public ID
+ */
+ public void setDoctypePublicId ( String publicid ) { put( DOCTYPE_PUBLIC_ID, publicid ); }
+ /**
+ * Returns the DOCTYPE public ID used in the <!DOCTYPE> declaration.
+ */
+ public String getDoctypePublicId ( ) { return (String) get( DOCTYPE_PUBLIC_ID ); }
+
+ /**
+ * Sets the DOCTYPE system ID to use in the <!DOCTYPE> declaration.
+ * @param systemid the system ID
+ */
+ public void setDoctypeSystemId ( String systemid ) { put( DOCTYPE_SYSTEM_ID, systemid ); }
+ /**
+ * Returns the DOCTYPE system ID used in the <!DOCTYPE> declaration.
+ */
+ public String getDoctypeSystemId ( ) { return (String) get( DOCTYPE_SYSTEM_ID ); }
+
+ /**
+ * Sets the message digest used to summarize the document.
+ * @param digest the bytes of the digest
+ *
+ * @see XmlOptions#setLoadMessageDigest
+ */
+ public void setMessageDigest( byte[] digest ) { put( MESSAGE_DIGEST, digest ); }
+ /**
+ * Returns the message digest used to summarize the document.
+ *
+ * @see XmlOptions#setLoadMessageDigest
+ */
+ public byte[] getMessageDigest( ) { return (byte[]) get( MESSAGE_DIGEST ); }
+
+ /**
+ * Used to store the original name (a String) for
+ * the source from which the XML document was loaded.
+ * This name, if present, is used to identify the
+ * document when reporting validation or comilation errors.
+ *
+ * XmlObject.Factory.parse(File) and SchemaTypeLoader.loadInstance(File)
+ * both automatically set this value to the filename.
+ */
+ public static final Object SOURCE_NAME = new Object();
+
+ /**
+ * Document encoding
+ */
+ public static final Object ENCODING = new Object();
+
+ /**
+ * Document version
+ */
+ public static final Object VERSION = new Object();
+
+ /**
+ * Doc type name
+ */
+ public static final Object DOCTYPE_NAME = new Object();
+
+ /**
+ * Doc type public id
+ */
+ public static final Object DOCTYPE_PUBLIC_ID = new Object();
+
+ /**
+ * Doc type system id
+ */
+ public static final Object DOCTYPE_SYSTEM_ID = new Object();
+
+ /**
+ * SHA message digest
+ */
+ public static final Object MESSAGE_DIGEST = new Object();
+
+ /**
+ * Attaches a value to the root of the document containing
+ * the given token source.
+ *
+ * @param key The key: there can be one value for each key.
+ * @param value The value to attach to the document.
+ */
+ public abstract Object put ( Object key, Object value );
+
+ /**
+ * Returns a value previously attached to a document using set.
+ *
+ * @param key The key: this is the key that was previously
+ * passed to set to store the value.
+ * @return The saved value, or null if none is found.
+ */
+ public abstract Object get ( Object key );
+
+ /**
+ * Removes a value previously attached to a document using set.
+ *
+ * @param key The key: this is the key that was previously
+ * passed to set to store the value.
+ */
+ public abstract Object remove ( Object key );
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDouble.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDouble.java
new file mode 100644
index 0000000..3067e1b
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDouble.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#double">xs:double</a> type.
+ * <p>
+ * Naturally, convertible to a Java double.
+ */
+public interface XmlDouble extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_double");
+
+ /** Returns this value as a double */
+ double getDoubleValue();
+ /** Sets this value as a double */
+ void setDoubleValue(double v);
+
+ /**
+ * Returns this value as a double
+ * @deprecated replaced with {@link #getDoubleValue}
+ **/
+ double doubleValue();
+ /**
+ * Sets this value as a double
+ * @deprecated replaced with {@link #setDoubleValue}
+ **/
+ void set(double v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlDouble}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlDouble} */
+ public static XmlDouble newInstance() {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlDouble} */
+ public static XmlDouble newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlDouble} value */
+ public static XmlDouble newValue(Object obj) {
+ return (XmlDouble) type.newValue( obj ); }
+
+ /** Parses a {@link XmlDouble} fragment from a String. For example: "<code><xml-fragment>123.34e+57</xml-fragment></code>". */
+ public static XmlDouble parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from a String. For example: "<code><xml-fragment>123.34e+57</xml-fragment></code>". */
+ public static XmlDouble parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from a File. */
+ public static XmlDouble parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from a File. */
+ public static XmlDouble parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from a URL. */
+ public static XmlDouble parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from a URL. */
+ public static XmlDouble parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from an InputStream. */
+ public static XmlDouble parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from an InputStream. */
+ public static XmlDouble parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from a Reader. */
+ public static XmlDouble parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from a Reader. */
+ public static XmlDouble parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from a DOM Node. */
+ public static XmlDouble parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from a DOM Node. */
+ public static XmlDouble parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlDouble} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDouble parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlDouble} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDouble parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDouble) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlDuration.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDuration.java
new file mode 100644
index 0000000..d4a53f7
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlDuration.java
@@ -0,0 +1,136 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#duration">xs:duration</a> type.
+ * <p>
+ * Convertible to a {@link GDuration}.
+ *
+ * @see GDuration
+ */
+public interface XmlDuration extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_duration");
+
+ /** Returns this value as a {@link GDuration} */
+ GDuration getGDurationValue();
+ /** Sets this value as a {@link GDuration} */
+ void setGDurationValue(GDuration gd);
+
+ /**
+ * Returns this value as a {@link GDuration}
+ * @deprecated replaced with {@link #getGDurationValue}
+ **/
+ GDuration gDurationValue();
+ /**
+ * Sets this value as a {@link GDuration}
+ * @deprecated replaced with {@link #setGDurationValue}
+ **/
+ void set(GDurationSpecification gd);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlDuration}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlDuration} */
+ public static XmlDuration newInstance() {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlDuration} */
+ public static XmlDuration newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlDuration} value */
+ public static XmlDuration newValue(Object obj) {
+ return (XmlDuration) type.newValue( obj ); }
+
+ /** Parses a {@link XmlDuration} fragment from a String. For example: "<code><xml-fragment>P1Y2MT2H</xml-fragment></code>". */
+ public static XmlDuration parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from a String. For example: "<code><xml-fragment>P1Y2MT2H</xml-fragment></code>". */
+ public static XmlDuration parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from a File. */
+ public static XmlDuration parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from a File. */
+ public static XmlDuration parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from a URL. */
+ public static XmlDuration parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from a URL. */
+ public static XmlDuration parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from an InputStream. */
+ public static XmlDuration parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from an InputStream. */
+ public static XmlDuration parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from a Reader. */
+ public static XmlDuration parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from a Reader. */
+ public static XmlDuration parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from a DOM Node. */
+ public static XmlDuration parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from a DOM Node. */
+ public static XmlDuration parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlDuration} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDuration parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlDuration} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlDuration parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlDuration) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITIES.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITIES.java
new file mode 100644
index 0000000..6d52993
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITIES.java
@@ -0,0 +1,145 @@
+/* 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.xmlbeans;
+
+import java.util.List;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#ENTITIES">xs:ENTITIES</a> type,
+ * a list type.
+ * <p>
+ * A list type.
+ */
+public interface XmlENTITIES extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ENTITIES");
+
+ /** Returns the value as a {@link List} of {@link String} values */
+ List getListValue();
+ /** Returns the value as a {@link List} of {@link XmlENTITY} values **/
+ List xgetListValue();
+ /** Sets the value as a {@link List} */
+ void setListValue(List l);
+
+ /**
+ * Returns the value as a {@link List} of {@link String} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List listValue();
+ /**
+ * Returns the value as a {@link List} of {@link XmlENTITY} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List xlistValue();
+ /**
+ * Sets the value as a {@link List}
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ void set(List l);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlENTITIES}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlENTITIES} */
+ public static XmlENTITIES newInstance() {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlENTITIES} */
+ public static XmlENTITIES newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlENTITIES} value */
+ public static XmlENTITIES newValue(Object obj) {
+ return (XmlENTITIES) type.newValue( obj ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a String. */
+ public static XmlENTITIES parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a String. */
+ public static XmlENTITIES parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a File. */
+ public static XmlENTITIES parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a File. */
+ public static XmlENTITIES parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a URL. */
+ public static XmlENTITIES parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a URL. */
+ public static XmlENTITIES parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from an InputStream. */
+ public static XmlENTITIES parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from an InputStream. */
+ public static XmlENTITIES parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a Reader. */
+ public static XmlENTITIES parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a Reader. */
+ public static XmlENTITIES parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a DOM Node. */
+ public static XmlENTITIES parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from a DOM Node. */
+ public static XmlENTITIES parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlENTITIES parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlENTITIES} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlENTITIES parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlENTITIES) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITY.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITY.java
new file mode 100644
index 0000000..51aad5d
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlENTITY.java
@@ -0,0 +1,118 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#ENTITY">xs:ENTITY</a> type.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlENTITY extends XmlNCName
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ENTITY");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlENTITY}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlENTITY} */
+ public static XmlENTITY newInstance() {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlENTITY} */
+ public static XmlENTITY newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlENTITY} value */
+ public static XmlENTITY newValue(Object obj) {
+ return (XmlENTITY) type.newValue( obj ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a String. */
+ public static XmlENTITY parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a String. */
+ public static XmlENTITY parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a File. */
+ public static XmlENTITY parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a File. */
+ public static XmlENTITY parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a URL. */
+ public static XmlENTITY parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a URL. */
+ public static XmlENTITY parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from an InputStream. */
+ public static XmlENTITY parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from an InputStream. */
+ public static XmlENTITY parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a Reader. */
+ public static XmlENTITY parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a Reader. */
+ public static XmlENTITY parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a DOM Node. */
+ public static XmlENTITY parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from a DOM Node. */
+ public static XmlENTITY parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlENTITY} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlENTITY parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlENTITY} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlENTITY parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlENTITY) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlError.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlError.java
new file mode 100644
index 0000000..0c2bb56
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlError.java
@@ -0,0 +1,412 @@
+/* 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.xmlbeans;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.io.File;
+
+/**
+ * Represents a message at a specific XML location.
+ * <p>
+ * The message can be an error, warning, or simple information, and
+ * it may optionally be associated with a specific location in
+ * an XML document. The class includes methods for extracting
+ * the location as a line number, XmlCursor, or XmlObject, as
+ * well as for obtaining and message and severity of the
+ * error.
+ *
+ * @see XmlOptions#setErrorListener
+ * @see XmlException
+ */
+public class XmlError implements java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String _message;
+ private String _source;
+ private int _severity = SEVERITY_ERROR;
+ private int _line = -1;
+ private int _column = -1;
+ private int _offset = -1;
+
+ private transient XmlCursor _cursor;
+
+ /**
+ * Copy constructor.
+ * @param src The original XmlError to copy.
+ */
+ public XmlError(XmlError src)
+ {
+ _message = src.getMessage();
+ _severity = src.getSeverity();
+ _source = src.getSourceName();
+ _line = src.getLine();
+ _column = src.getColumn();
+ _offset = src.getOffset();
+ _cursor = src.getCursorLocation();
+ }
+
+ /**
+ * The static factory methods should be used instead of
+ * this constructor.
+ */
+ private XmlError(String message, int severity, String source, int line, int column, int offset, XmlCursor cursor)
+ {
+ _message = message;
+ _severity = severity;
+ _source = source;
+ _line = line;
+ _column = column;
+ _offset = offset;
+ _cursor = cursor;
+ }
+
+ /**
+ * Returns an XmlError for the given message, with no location and {@link #SEVERITY_ERROR}.
+ * @param message the error message
+ */
+ public static XmlError forMessage(String message)
+ {
+ return forMessage(message, SEVERITY_ERROR);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with no location and the given severity.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ */
+ public static XmlError forMessage(String message, int severity)
+ {
+ return forSource(message, severity, null);
+ }
+
+ /**
+ * Returns an XmlError for the given message, located in the given file and {@link #SEVERITY_ERROR}.
+ * @param message the error message
+ * @param sourceName the URL or other name for the file
+ */
+ public static XmlError forSource(String message, String sourceName)
+ {
+ return forLocation(message, SEVERITY_ERROR, sourceName, -1, -1, -1);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with the given severity, located in the given file.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ * @param sourceName the URL or other name for the file
+ */
+ public static XmlError forSource(String message, int severity, String sourceName)
+ {
+ return forLocation(message, severity, sourceName, -1, -1, -1);
+ }
+
+ /**
+ * Returns an XmlError for the given message, located at a specific point in the given file and {@link #SEVERITY_ERROR}.
+ * @param message the error message
+ * @param sourceName the URL or other name for the file
+ * @param line the 1-based line number, or -1 if not known
+ * @param column the 1-based column number, or -1 if not known
+ * @param offset the 0-base file character offset, or -1 if not known
+ */
+ public static XmlError forLocation(String message, String sourceName, int line, int column, int offset)
+ {
+ return new XmlError(message, SEVERITY_ERROR, sourceName, line, column, offset, null);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with the given severity, located at a specific point in the given file.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ * @param sourceName the URL or other name for the file
+ * @param line the 1-based line number, or -1 if not known
+ * @param column the 1-based column number, or -1 if not known
+ * @param offset the 0-base file character offset, or -1 if not known
+ */
+ public static XmlError forLocation(String message, int severity, String sourceName, int line, int column, int offset)
+ {
+ return new XmlError(message, severity, sourceName, line, column, offset, null);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with the given severity, located at the given physcial location and XmlCursor.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ * @param sourceName the URL or other name for the file
+ * @param line the 1-based line number, or -1 if not known
+ * @param column the 1-based column number, or -1 if not known
+ * @param offset the 0-base file character offset, or -1 if not known
+ * @param cursor the XmlCursor representing the location of the error
+ */
+ public static XmlError forLocationAndCursor(String message, int severity, String sourceName, int line, int column, int offset, XmlCursor cursor)
+ {
+ return new XmlError(message, severity, sourceName, line, column, offset, cursor);
+ }
+
+ /**
+ * Returns an XmlError for the given message, located at the XmlObject, with {@link #SEVERITY_ERROR}.
+ * @param message the error message
+ * @param xobj the XmlObject representing the location of the error
+ */
+ public static XmlError forObject(String message, XmlObject xobj)
+ {
+ return forObject(message, SEVERITY_ERROR, xobj);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with the given severity, located at the XmlObject.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ * @param xobj the XmlObject representing the location of the error
+ */
+ public static XmlError forObject(String message, int severity, XmlObject xobj)
+ {
+ if (xobj == null)
+ return forMessage(message, severity);
+
+ XmlCursor cur = xobj.newCursor();
+ XmlError result = forCursor(message, severity, cur);
+ if (cur != null)
+ cur.dispose();
+ return result;
+ }
+
+ /**
+ * Returns an XmlError for the given message, located at the XmlCursor, with {@link #SEVERITY_ERROR}.
+ * @param message the error message
+ * @param cursor the XmlCursor representing the location of the error
+ */
+ public static XmlError forCursor(String message, XmlCursor cursor)
+ {
+ return forCursor(message, SEVERITY_ERROR, cursor);
+ }
+
+ /**
+ * Returns an XmlError for the given message, with the given severity, located at the XmlCursor.
+ * @param message the error message
+ * @param severity the severity ({@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO})
+ * @param cursor the XmlCursor representing the location of the error
+ */
+ public static XmlError forCursor(String message, int severity, XmlCursor cursor)
+ {
+ if (cursor == null)
+ return forMessage(message, severity);
+
+ // Hunt down the line/column/offset
+
+ int line = -1;
+ int column = -1;
+ int offset = -1;
+ String source = null;
+
+ source = cursor.documentProperties().getSourceName();
+
+ XmlCursor c = cursor.newCursor();
+
+ XmlLineNumber ln =
+ (XmlLineNumber) c.getBookmark( XmlLineNumber.class );
+
+ if (ln == null)
+ ln = (XmlLineNumber) c.toPrevBookmark( XmlLineNumber.class );
+
+ if (ln != null)
+ {
+ line = ln.getLine();
+ column = ln.getColumn();
+ offset = ln.getOffset();
+ }
+
+ c.dispose();
+
+ return new XmlError(message, severity, source, line, column, offset, cursor);
+ }
+
+ /**
+ * Tries to produce a nicely formatted filename from the given string.
+ */
+ protected static String formattedFileName(String rawString, URI base)
+ {
+ if (rawString == null)
+ return null;
+
+ URI uri = null;
+
+ try
+ {
+ // if it looks like an absolute URI, treat it as such
+ uri = new URI(rawString);
+
+ // otherwise, treat it like a filename
+ if (!uri.isAbsolute())
+ uri = null;
+ }
+ catch (URISyntaxException e)
+ {
+ uri = null;
+ }
+
+ // looks like a filename; convert it to uri for relativization
+ if (uri == null)
+ uri = new File(rawString).toURI();
+
+ if (base != null)
+ uri = base.relativize(uri);
+
+ // filenames get their file: stripped off and their /'s turned into \'s (MSDOS)
+ if (uri.isAbsolute() ? uri.getScheme().compareToIgnoreCase("file") == 0 :
+ base != null && base.isAbsolute() && base.getScheme().compareToIgnoreCase("file") == 0)
+ {
+ try
+ {
+ return (new File(uri)).toString();
+ }
+ catch (Exception e) {};
+ }
+
+ return uri.toString();
+ }
+
+ /**
+ * An error. See {@link #getSeverity}.
+ */
+ public static final int SEVERITY_ERROR = 0;
+ /**
+ * A warning. See {@link #getSeverity}.
+ */
+ public static final int SEVERITY_WARNING = 1;
+ /**
+ * An informational message. See {@link #getSeverity}.
+ */
+ public static final int SEVERITY_INFO = 2;
+
+ /**
+ * Returns the severity. Either {@link #SEVERITY_ERROR}, {@link #SEVERITY_WARNING}, or {@link #SEVERITY_INFO}.
+ */
+ public int getSeverity ( ) { return _severity; }
+
+ /**
+ * Returns the error message without location information.
+ */
+ public String getMessage ( ) { return _message; }
+
+ /**
+ * Returns the URL (or other name) of the file with the error, if available.
+ */
+ public String getSourceName ( ) { return _source; }
+
+ /**
+ * Returns the line number of the error, if available, -1 if not.
+ */
+ public int getLine ( ) { return _line; }
+
+ /**
+ * Returns the column number of the error, if available, -1 if not.
+ */
+ public int getColumn ( ) { return _column; }
+
+ /**
+ * Returns the file character offset of the error, if available, -1 if not.
+ */
+ public int getOffset ( ) { return _offset; }
+
+ /**
+ * Returns a location object of the given type. XmlCursor.class and
+ * XmlObject.class can be passed, for example. Null if not available.
+ */
+ public Object getLocation ( Object type )
+ {
+ if (type == XmlCursor.class)
+ return _cursor;
+ if (type == XmlObject.class && _cursor != null)
+ return _cursor.getObject();
+ return null;
+ }
+
+ /**
+ * Returns a location of the error as an {@link XmlCursor}, null if
+ * not available.
+ */
+ public XmlCursor getCursorLocation ( )
+ {
+ return (XmlCursor) getLocation( XmlCursor.class );
+ }
+
+ /**
+ * Returns a location of the error as an {@link XmlObject}, null if
+ * not available.
+ */
+ public XmlObject getObjectLocation ( )
+ {
+ return (XmlObject) getLocation( XmlObject.class );
+ }
+
+ /**
+ * Produces a standard string for the error message, complete with
+ * filename and location offsets if available.
+ */
+ public String toString ( )
+ {
+ return toString( null );
+ }
+
+ /**
+ * Produces a standard string with the error message. If a non-null
+ * URI is supplied, source names are relativized against the given
+ * URI.
+ */
+ public String toString ( URI base )
+ {
+ // modified to carefully match the IDE's
+ // workshop.workspace.ant.AntLogger regex
+ // which also matches javac (davidbau)
+
+ StringBuffer sb = new StringBuffer();
+
+ String source = formattedFileName(getSourceName(), base);
+
+ if ( source != null )
+ {
+ sb.append( source );
+ int line = getLine();
+ if ( line < 0 )
+ line = 0;
+
+ sb.append( ':' );
+ sb.append( line );
+ sb.append( ':' );
+ if (getColumn() > 0)
+ {
+ sb.append( getColumn() );
+ sb.append( ':' );
+ }
+ sb.append(" ");
+ }
+
+ switch ( getSeverity() )
+ {
+ case SEVERITY_ERROR : sb.append( "error: " ); break;
+ case SEVERITY_WARNING : sb.append( "warning: " ); break;
+ case SEVERITY_INFO : break;
+ }
+
+ String msg = getMessage();
+
+ sb.append( msg == null ? "<Unspecified message>" : msg );
+
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlException.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlException.java
new file mode 100644
index 0000000..de34748
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlException.java
@@ -0,0 +1,111 @@
+/* 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.xmlbeans;
+
+import java.util.List;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * A checked exception that can be thrown while processing,
+ * parsing, or compiling XML. May contain any number of {@link XmlError}
+ * objects.
+ * <p>
+ * @see XmlError
+ * @see XmlRuntimeException
+ */
+public class XmlException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs an XmlException from a message.
+ */
+ public XmlException ( String m ) { super( m ); }
+
+ /**
+ * Constructs an XmlException from a message and a cause.
+ */
+ public XmlException ( String m, Throwable t ) { super( m, t ); }
+
+ /**
+ * Constructs an XmlException from a cause.
+ */
+ public XmlException ( Throwable t ) { super( t ); }
+
+ /**
+ * Constructs an XmlException from an {@link XmlError}.
+ */
+ public XmlException ( XmlError error )
+ {
+ this( error.toString(), null, error );
+ }
+
+ /**
+ * Constructs an XmlException from a message, a cause, and an {@link XmlError}.
+ */
+ public XmlException ( String m, Throwable t, XmlError error )
+ {
+ this( m, t, Collections.singletonList( error ) );
+ }
+
+ /**
+ * Constructs an XmlException from a message, a cause, and a collection of {@link XmlError XmlErrors}.
+ */
+ public XmlException ( String m, Throwable t, Collection errors )
+ {
+ super( m, t );
+
+ if (errors != null)
+ _errors = Collections.unmodifiableList( new ArrayList( errors ) );
+ }
+
+ /**
+ * Constructs an XmlException from an {@link XmlRuntimeException}.
+ */
+ public XmlException ( XmlRuntimeException xmlRuntimeException )
+ {
+ super(
+ xmlRuntimeException.getMessage(), xmlRuntimeException.getCause() );
+
+ Collection errors = xmlRuntimeException.getErrors();
+
+ if (errors != null)
+ _errors = Collections.unmodifiableList( new ArrayList( errors ) );
+ }
+
+ /**
+ * Returns the first {@link XmlError XmlErrors} that caused the exception, if any.
+ */
+ public XmlError getError ( )
+ {
+ if (_errors == null || _errors.size() == 0)
+ return null;
+
+ return (XmlError) _errors.get( 0 );
+ }
+
+ /**
+ * Returns the collection of {@link XmlError XmlErrors} that caused the exception, if any.
+ */
+ public Collection getErrors ( )
+ {
+ return _errors;
+ }
+
+ private List _errors;
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlFactoryHook.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlFactoryHook.java
new file mode 100644
index 0000000..7050f97
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlFactoryHook.java
@@ -0,0 +1,106 @@
+/* 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.xmlbeans;
+
+import org.w3c.dom.Node;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+/**
+ * A hook for the XML Bean Factory mechanism.
+ * Provided for advanced users who wish to provide their own
+ * implementation of the Factory.parse methods. This is used, for example,
+ * to defer reading XML streams until needed.
+ * <p>
+ * To use the hook, call XmlFactoryHook.ThreadContext.setHook(), passing
+ * your own XmlFactoryHook implementation. Then every call to a Factory
+ * method will be delgated to your hook.
+ *
+ * <pre>
+ * MyHook hook = new MyHook();
+ * XmlFactoryHook.ThreadContext.setHook(hook);
+ * // this results in a call to hook.parse(...)
+ * XmlObject.Factory.parse(new File("test.xml"));
+ * </pre>
+ *
+ * If the hook needs to turn around and invoke the built-in parsers, then
+ * it should do so by calling the appropriate method on the passed
+ * SchemaTypeLoader. Since SchemaTypeLoader.parse() methods delegate
+ * to the registered hook, a hook that wishes to actually invoke the
+ * default parser without having itself called back again should
+ * unregister itself before calling loader.parse(), and then re-register
+ * itself again after the call.
+ * <pre>
+ * void parse(SchemaTypeLoader loader, ...)
+ * {
+ * XmlFactoryHook remember = XmlFactoryHook.ThreadContext.getHook();
+ * XmlFactoryHook.ThreadContext.setHook(null);
+ * loader.parse(...); // isn't hooked.
+ * XmlFactoryHook.ThreadContext.setHook(remember);
+ * }
+ * </pre>
+ */
+public interface XmlFactoryHook
+{
+ /** Hooks Factory.newInstance calls */
+ public XmlObject newInstance ( SchemaTypeLoader loader, SchemaType type, XmlOptions options );
+ /** Hooks Factory.parse calls */
+ public XmlObject parse ( SchemaTypeLoader loader, String xmlText, SchemaType type, XmlOptions options ) throws XmlException;
+ /** Hooks Factory.parse calls */
+ public XmlObject parse ( SchemaTypeLoader loader, InputStream jiois, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Hooks Factory.parse calls */
+ public XmlObject parse ( SchemaTypeLoader loader, Reader jior, SchemaType type, XmlOptions options ) throws XmlException, IOException;
+ /** Hooks Factory.parse calls */
+ public XmlObject parse ( SchemaTypeLoader loader, Node node, SchemaType type, XmlOptions options ) throws XmlException;
+ /** Hooks Factory.parse calls */
+ public XmlObject parse ( SchemaTypeLoader loader, XMLInputStream xis, SchemaType type, XmlOptions options ) throws XmlException, XMLStreamException;
+ /** Hooks Factory.newXmlSaxHandler calls */
+ public XmlSaxHandler newXmlSaxHandler ( SchemaTypeLoader loader, SchemaType type, XmlOptions options );
+
+ /**
+ * Used to manage the XmlFactoryHook for the current thread.
+ */
+ public final static class ThreadContext
+ {
+ private static ThreadLocal threadHook = new ThreadLocal();
+
+ /**
+ * Returns the current thread's hook, or null if none.
+ */
+ public static XmlFactoryHook getHook()
+ {
+ return (XmlFactoryHook)threadHook.get();
+ }
+
+ /**
+ * Sets the hook for the current thread.
+ */
+ public static void setHook(XmlFactoryHook hook)
+ {
+ threadHook.set(hook);
+ }
+
+ // provided to prevent unwanted construction
+ private ThreadContext()
+ {
+ }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlFloat.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlFloat.java
new file mode 100644
index 0000000..c1ae9a8
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlFloat.java
@@ -0,0 +1,134 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#float">xs:float</a> type.
+ * <p>
+ * Naturally, convertible to a Java float.
+ */
+public interface XmlFloat extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_float");
+
+ /** Returns this value as a float */
+ float getFloatValue();
+ /** Sets this value as a float */
+ void setFloatValue(float v);
+
+ /**
+ * Returns this value as a float
+ * @deprecated replaced by {@link #getFloatValue}
+ **/
+ float floatValue();
+ /**
+ * Sets this value as a float
+ * @deprecated replaced by {@link #setFloatValue}
+ **/
+ void set(float v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlFloat}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlFloat} */
+ public static XmlFloat newInstance() {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlFloat} */
+ public static XmlFloat newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlFloat} value */
+ public static XmlFloat newValue(Object obj) {
+ return (XmlFloat) type.newValue( obj ); }
+
+ /** Parses a {@link XmlFloat} fragment from a String. For example: "<code><xml-fragment>12.34e+5</xml-fragment></code>". */
+ public static XmlFloat parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from a String. For example: "<code><xml-fragment>12.34e+5</xml-fragment></code>". */
+ public static XmlFloat parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from a File. */
+ public static XmlFloat parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from a File. */
+ public static XmlFloat parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from a URL. */
+ public static XmlFloat parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from a URL. */
+ public static XmlFloat parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from an InputStream. */
+ public static XmlFloat parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from an InputStream. */
+ public static XmlFloat parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from a Reader. */
+ public static XmlFloat parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from a Reader. */
+ public static XmlFloat parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from a DOM Node. */
+ public static XmlFloat parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from a DOM Node. */
+ public static XmlFloat parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlFloat} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlFloat parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlFloat} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlFloat parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlFloat) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlGDay.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGDay.java
new file mode 100644
index 0000000..2281d3f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGDay.java
@@ -0,0 +1,169 @@
+/* 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.xmlbeans;
+
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gDay">xs:gDay</a> type.
+ * A gDay specifies only a day-of-month.
+ * <p>
+ * Convertible to {@link Calendar}, {@link GDate}, or an int.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlGDay extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gDay");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+ /** Returns this value as an int from 1-31 */
+ int getIntValue();
+ /** Sets this value as an int from 1-31 */
+ void setIntValue(int v);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+ /**
+ * Returns this value as an int from 1-31
+ * @deprecated replaced with {@link #getIntValue}
+ **/
+ int intValue();
+ /**
+ * Sets this value as an int from 1-31
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlGDay}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlGDay} */
+ public static XmlGDay newInstance() {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlGDay} */
+ public static XmlGDay newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlGDay} value */
+ public static XmlGDay newValue(Object obj) {
+ return (XmlGDay) type.newValue( obj ); }
+
+ /** Parses a {@link XmlGDay} fragment from a String. For example: "<code><xml-fragment>---14</xml-fragment></code>". */
+ public static XmlGDay parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from a String. For example: "<code><xml-fragment>---14</xml-fragment></code>". */
+ public static XmlGDay parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from a File. */
+ public static XmlGDay parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from a File. */
+ public static XmlGDay parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from a URL. */
+ public static XmlGDay parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from a URL. */
+ public static XmlGDay parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from an InputStream. */
+ public static XmlGDay parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from an InputStream. */
+ public static XmlGDay parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from a Reader. */
+ public static XmlGDay parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from a Reader. */
+ public static XmlGDay parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from a DOM Node. */
+ public static XmlGDay parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from a DOM Node. */
+ public static XmlGDay parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlGDay} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGDay parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlGDay} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGDay parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGDay) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonth.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonth.java
new file mode 100644
index 0000000..288b390
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonth.java
@@ -0,0 +1,169 @@
+/* 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.xmlbeans;
+
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gMonth">xs:gMonth</a> type.
+ * A gMonth specifies only a month-of-year.
+ * <p>
+ * Convertible to {@link Calendar}, {@link GDate}, or an int.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlGMonth extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gMonth");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+ /** Returns this value as an int from 1-12 */
+ int getIntValue();
+ /** Sets this value as an int from 1-12 */
+ void setIntValue(int v);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+ /**
+ * Returns this value as an int from 1-12
+ * @deprecated replaced with {@link #getIntValue}
+ **/
+ int intValue();
+ /**
+ * Sets this value as an int from 1-12
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlGMonth}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlGMonth} */
+ public static XmlGMonth newInstance() {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlGMonth} */
+ public static XmlGMonth newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlGMonth} value */
+ public static XmlGMonth newValue(Object obj) {
+ return (XmlGMonth) type.newValue( obj ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>". */
+ public static XmlGMonth parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a String. For example: "<code><xml-fragment>--06</xml-fragment></code>". */
+ public static XmlGMonth parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a File. */
+ public static XmlGMonth parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a File. */
+ public static XmlGMonth parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a URL. */
+ public static XmlGMonth parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a URL. */
+ public static XmlGMonth parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from an InputStream. */
+ public static XmlGMonth parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from an InputStream. */
+ public static XmlGMonth parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a Reader. */
+ public static XmlGMonth parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a Reader. */
+ public static XmlGMonth parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a DOM Node. */
+ public static XmlGMonth parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from a DOM Node. */
+ public static XmlGMonth parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlGMonth} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlGMonth} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGMonth) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonthDay.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonthDay.java
new file mode 100644
index 0000000..65ef27a
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGMonthDay.java
@@ -0,0 +1,155 @@
+/* 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.xmlbeans;
+
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gMonthDay">xs:gMonthDay</a> type.
+ * A gMonthDay specifies a day of a specific month without specifying the year.
+ * <p>
+ * Convertible to {@link Calendar} or {@link GDate}.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlGMonthDay extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gMonthDay");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlGMonthDay}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlGMonthDay} */
+ public static XmlGMonthDay newInstance() {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlGMonthDay} */
+ public static XmlGMonthDay newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlGMonthDay} value */
+ public static XmlGMonthDay newValue(Object obj) {
+ return (XmlGMonthDay) type.newValue( obj ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a String. For example: "<code><xml-fragment>--06-14</xml-fragment></code>". */
+ public static XmlGMonthDay parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a String. For example: "<code><xml-fragment>--06-14</xml-fragment></code>". */
+ public static XmlGMonthDay parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a File. */
+ public static XmlGMonthDay parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a File. */
+ public static XmlGMonthDay parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a URL. */
+ public static XmlGMonthDay parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a URL. */
+ public static XmlGMonthDay parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from an InputStream. */
+ public static XmlGMonthDay parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from an InputStream. */
+ public static XmlGMonthDay parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a Reader. */
+ public static XmlGMonthDay parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a Reader. */
+ public static XmlGMonthDay parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a DOM Node. */
+ public static XmlGMonthDay parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from a DOM Node. */
+ public static XmlGMonthDay parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGMonthDay parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlGMonthDay} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGMonthDay parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGMonthDay) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYear.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYear.java
new file mode 100644
index 0000000..3579774
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYear.java
@@ -0,0 +1,169 @@
+/* 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.xmlbeans;
+
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gYear">xs:gYear</a> type.
+ * A gYear specifies a Gregorian year (AD).
+ * <p>
+ * Convertible to {@link Calendar}, {@link GDate}, or an int.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlGYear extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gYear");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+ /** Returns this value as an int from 1-31 */
+ int getIntValue();
+ /** Sets this value as an int from 1-31 */
+ void setIntValue(int v);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+ /**
+ * Returns this value as an int from 1-31
+ * @deprecated replaced with {@link #getIntValue}
+ **/
+ int intValue();
+ /**
+ * Sets this value as an int from 1-31
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlGYear}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlGYear} */
+ public static XmlGYear newInstance() {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlGYear} */
+ public static XmlGYear newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlGYear} value */
+ public static XmlGYear newValue(Object obj) {
+ return (XmlGYear) type.newValue( obj ); }
+
+ /** Parses a {@link XmlGYear} fragment from a String. For example: "<code><xml-fragment>2003</xml-fragment></code>". */
+ public static XmlGYear parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from a String. For example: "<code><xml-fragment>2003</xml-fragment></code>". */
+ public static XmlGYear parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from a File. */
+ public static XmlGYear parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from a File. */
+ public static XmlGYear parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from a URL. */
+ public static XmlGYear parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from a URL. */
+ public static XmlGYear parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from an InputStream. */
+ public static XmlGYear parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from an InputStream. */
+ public static XmlGYear parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from a Reader. */
+ public static XmlGYear parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from a Reader. */
+ public static XmlGYear parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from a DOM Node. */
+ public static XmlGYear parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from a DOM Node. */
+ public static XmlGYear parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlGYear} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGYear parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlGYear} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGYear parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGYear) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYearMonth.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYearMonth.java
new file mode 100644
index 0000000..5fa4bb9
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlGYearMonth.java
@@ -0,0 +1,156 @@
+/* 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.xmlbeans;
+
+import java.util.Date;
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#gYearMonth">xs:gYearMonth</a> type.
+ * A gYearMonth specifies a month in a specific year.
+ * <p>
+ * Convertible to {@link Calendar}, {@link GDate}.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlGYearMonth extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_gYearMonth");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlGYearMonth}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlGYearMonth} */
+ public static XmlGYearMonth newInstance() {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlGYearMonth} */
+ public static XmlGYearMonth newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlGYearMonth} value */
+ public static XmlGYearMonth newValue(Object obj) {
+ return (XmlGYearMonth) type.newValue( obj ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a String. For example: "<code><xml-fragment>2003-06</xml-fragment></code>". */
+ public static XmlGYearMonth parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a String. For example: "<code><xml-fragment>2003-06</xml-fragment></code>". */
+ public static XmlGYearMonth parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a File. */
+ public static XmlGYearMonth parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a File. */
+ public static XmlGYearMonth parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a URL. */
+ public static XmlGYearMonth parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a URL. */
+ public static XmlGYearMonth parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from an InputStream. */
+ public static XmlGYearMonth parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from an InputStream. */
+ public static XmlGYearMonth parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a Reader. */
+ public static XmlGYearMonth parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a Reader. */
+ public static XmlGYearMonth parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a DOM Node. */
+ public static XmlGYearMonth parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from a DOM Node. */
+ public static XmlGYearMonth parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGYearMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlGYearMonth} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlGYearMonth parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlGYearMonth) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlHexBinary.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlHexBinary.java
new file mode 100644
index 0000000..320af6f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlHexBinary.java
@@ -0,0 +1,137 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#hexBinary">xs:hexBinary</a> type.
+ * <p>
+ * Convertible to a byte array.
+ */
+public interface XmlHexBinary extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_hexBinary");
+
+ /**
+ * Returns this value as a byte array.
+ * @deprecated replaced by {@link #getByteArrayValue}
+ **/
+ byte[] byteArrayValue();
+
+ /**
+ * Sets this value as a byte array.
+ * @deprecated replaced by {@link #setByteArrayValue}
+ **/
+ void set(byte[] ba);
+
+ /** Returns this value as a byte array. **/
+ byte[] getByteArrayValue();
+ /** Sets this value as a byte array. */
+ void setByteArrayValue(byte[] ba);
+
+
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlHexBinary}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlHexBinary} */
+ public static XmlHexBinary newInstance() {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlHexBinary} */
+ public static XmlHexBinary newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlHexBinary} value */
+ public static XmlHexBinary newValue(Object obj) {
+ return (XmlHexBinary) type.newValue( obj ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>". */
+ public static XmlHexBinary parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>". */
+ public static XmlHexBinary parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a File. */
+ public static XmlHexBinary parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a File. */
+ public static XmlHexBinary parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a URL. */
+ public static XmlHexBinary parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a URL. */
+ public static XmlHexBinary parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from an InputStream. */
+ public static XmlHexBinary parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from an InputStream. */
+ public static XmlHexBinary parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a Reader. */
+ public static XmlHexBinary parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a Reader. */
+ public static XmlHexBinary parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a DOM Node. */
+ public static XmlHexBinary parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from a DOM Node. */
+ public static XmlHexBinary parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlHexBinary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlHexBinary} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlHexBinary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlID.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlID.java
new file mode 100644
index 0000000..1371e01
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlID.java
@@ -0,0 +1,121 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#ID">xs:ID</a> type.
+ * <p>
+ * When validated, IDs must be unique within a document. An element
+ * may not have more than one attribute whose type is ID.
+ * <p>
+ * Convertible to a {@link String}.
+ */
+public interface XmlID extends XmlNCName
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_ID");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlID}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlID} */
+ public static XmlID newInstance() {
+ return (XmlID) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlID} */
+ public static XmlID newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlID) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlID} value */
+ public static XmlID newValue(Object obj) {
+ return (XmlID) type.newValue( obj ); }
+
+ /** Parses a {@link XmlID} fragment from a String. For example: "<code><xml-fragment>n1</xml-fragment></code>". */
+ public static XmlID parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from a String. For example: "<code><xml-fragment>n1</xml-fragment></code>". */
+ public static XmlID parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from a File. */
+ public static XmlID parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from a File. */
+ public static XmlID parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from a URL. */
+ public static XmlID parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from a URL. */
+ public static XmlID parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from an InputStream. */
+ public static XmlID parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from an InputStream. */
+ public static XmlID parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from a Reader. */
+ public static XmlID parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from a Reader. */
+ public static XmlID parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from a DOM Node. */
+ public static XmlID parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from a DOM Node. */
+ public static XmlID parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlID} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlID parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlID} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlID parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlID) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREF.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREF.java
new file mode 100644
index 0000000..f2fed8f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREF.java
@@ -0,0 +1,122 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#IDREF">xs:IDREF</a> type.
+ * <p>
+ * When validated, IDREF values must match an ID value that is present within
+ * the document. This rule is only verified when a whole document is validated
+ * at once.
+ * <p>
+ * Convertible to a {@link String}.
+ */
+public interface XmlIDREF extends XmlNCName
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_IDREF");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlIDREF}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlIDREF} */
+ public static XmlIDREF newInstance() {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlIDREF} */
+ public static XmlIDREF newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlIDREF} value */
+ public static XmlIDREF newValue(Object obj) {
+ return (XmlIDREF) type.newValue( obj ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a String. */
+ public static XmlIDREF parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a String. */
+ public static XmlIDREF parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a File. */
+ public static XmlIDREF parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a File. */
+ public static XmlIDREF parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a URL. */
+ public static XmlIDREF parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a URL. */
+ public static XmlIDREF parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from an InputStream. */
+ public static XmlIDREF parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from an InputStream. */
+ public static XmlIDREF parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a Reader. */
+ public static XmlIDREF parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a Reader. */
+ public static XmlIDREF parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a DOM Node. */
+ public static XmlIDREF parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from a DOM Node. */
+ public static XmlIDREF parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlIDREF} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlIDREF parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlIDREF} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlIDREF parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlIDREF) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREFS.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREFS.java
new file mode 100644
index 0000000..e1e1d16
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlIDREFS.java
@@ -0,0 +1,149 @@
+/* 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.xmlbeans;
+
+import java.util.List;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#IDREFS">xs:IDREFS</a> type,
+ * a list type.
+ * <p>
+ * When validated, IDREF values must match an ID value that is present within
+ * the document. This rule is only verified when a whole document is validated
+ * at once.
+ * <p>
+ * Convertible to a {@link List}.
+ */
+public interface XmlIDREFS extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_IDREFS");
+
+ /** Returns the value as a {@link List} of {@link String} values */
+ List getListValue();
+ /** Returns the value as a {@link List} of {@link XmlIDREF} values */
+ List xgetListValue();
+ /** Sets the value as a {@link List} */
+ void setListValue(List l);
+
+ /**
+ * Returns the value as a {@link List} of {@link String} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List listValue();
+ /**
+ * Returns the value as a {@link List} of {@link XmlIDREF} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List xlistValue();
+ /**
+ * Sets the value as a {@link List}
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ void set(List l);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlIDREFS}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlIDREFS} */
+ public static XmlIDREFS newInstance() {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlIDREFS} */
+ public static XmlIDREFS newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlIDREFS} value */
+ public static XmlIDREFS newValue(Object obj) {
+ return (XmlIDREFS) type.newValue( obj ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a String. */
+ public static XmlIDREFS parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a String. */
+ public static XmlIDREFS parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a File. */
+ public static XmlIDREFS parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a File. */
+ public static XmlIDREFS parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a URL. */
+ public static XmlIDREFS parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a URL. */
+ public static XmlIDREFS parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from an InputStream. */
+ public static XmlIDREFS parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from an InputStream. */
+ public static XmlIDREFS parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a Reader. */
+ public static XmlIDREFS parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a Reader. */
+ public static XmlIDREFS parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a DOM Node. */
+ public static XmlIDREFS parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from a DOM Node. */
+ public static XmlIDREFS parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlIDREFS parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlIDREFS} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlIDREFS parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlIDREFS) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlInt.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlInt.java
new file mode 100644
index 0000000..ea564f8
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlInt.java
@@ -0,0 +1,135 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#int">xs:int</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Naturally, convertible to a Java int.
+ */
+public interface XmlInt extends XmlLong
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_int");
+
+ /** Returns this value as an int */
+ int getIntValue();
+ /** Sets this value as an int */
+ void setIntValue(int v);
+
+ /**
+ * Returns this value as an int
+ * @deprecated replaced with {@link #getIntValue}
+ **/
+ int intValue();
+ /**
+ * Sets this value as an int
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlInt}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlInt} */
+ public static XmlInt newInstance() {
+ return (XmlInt) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlInt} */
+ public static XmlInt newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlInt) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlInt} value */
+ public static XmlInt newValue(Object obj) {
+ return (XmlInt) type.newValue( obj ); }
+
+ /** Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */
+ public static XmlInt parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */
+ public static XmlInt parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from a File. */
+ public static XmlInt parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from a File. */
+ public static XmlInt parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from a URL. */
+ public static XmlInt parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from a URL. */
+ public static XmlInt parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from an InputStream. */
+ public static XmlInt parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from an InputStream. */
+ public static XmlInt parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from a Reader. */
+ public static XmlInt parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from a Reader. */
+ public static XmlInt parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from a DOM Node. */
+ public static XmlInt parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from a DOM Node. */
+ public static XmlInt parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlInt} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlInt} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlInt) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlInteger.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlInteger.java
new file mode 100644
index 0000000..353863f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlInteger.java
@@ -0,0 +1,141 @@
+/* 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.xmlbeans;
+
+import java.math.BigInteger;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#integer">xs:integer</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * This type should not be confused with <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#int">xs:int</a>
+ * or Java {@link Integer}. This type represents an arbitrary-precision integer with
+ * any number of digits, while a Java int or an xs:int is a 32-bit finite-precision integer.
+ * <p>
+ * Convertible to a Java {@link BigInteger}.
+ */
+public interface XmlInteger extends XmlDecimal
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_integer");
+
+ /** Returns this value as a {@link BigInteger} */
+ BigInteger getBigIntegerValue();
+ /** Sets this value as a {@link BigInteger} */
+ void setBigIntegerValue(BigInteger bi);
+
+ /**
+ * Returns this value as a {@link BigInteger}
+ * @deprecated replaced with {@link #getBigIntegerValue}
+ **/
+ BigInteger bigIntegerValue();
+ /**
+ * Sets this value as a {@link BigInteger}
+ * @deprecated replaced with {@link #setBigIntegerValue}
+ **/
+ void set(BigInteger bi);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlInteger}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlInteger} */
+ public static XmlInteger newInstance() {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlInteger} */
+ public static XmlInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlInteger} value */
+ public static XmlInteger newValue(Object obj) {
+ return (XmlInteger) type.newValue( obj ); }
+
+ /** Parses a {@link XmlInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from a File. */
+ public static XmlInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from a File. */
+ public static XmlInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from a URL. */
+ public static XmlInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from a URL. */
+ public static XmlInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from an InputStream. */
+ public static XmlInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from an InputStream. */
+ public static XmlInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from a Reader. */
+ public static XmlInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from a Reader. */
+ public static XmlInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from a DOM Node. */
+ public static XmlInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from a DOM Node. */
+ public static XmlInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlLanguage.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLanguage.java
new file mode 100644
index 0000000..be239dd
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLanguage.java
@@ -0,0 +1,120 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#language">xs:language</a> type.
+ * <p>
+ * This type is intended to represent an standard ISO language code string.
+ * <p>
+ * Convertible to a Java {@link String}.
+ */
+public interface XmlLanguage extends XmlToken
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_language");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlLanguage}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlLanguage} */
+ public static XmlLanguage newInstance() {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlLanguage} */
+ public static XmlLanguage newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlLanguage} value */
+ public static XmlLanguage newValue(Object obj) {
+ return (XmlLanguage) type.newValue( obj ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a String. For example: "<code><xml-fragment>en-us</xml-fragment></code>". */
+ public static XmlLanguage parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a String. For example: "<code><xml-fragment>en-us</xml-fragment></code>". */
+ public static XmlLanguage parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a File. */
+ public static XmlLanguage parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a File. */
+ public static XmlLanguage parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a URL. */
+ public static XmlLanguage parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a URL. */
+ public static XmlLanguage parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from an InputStream. */
+ public static XmlLanguage parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from an InputStream. */
+ public static XmlLanguage parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a Reader. */
+ public static XmlLanguage parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a Reader. */
+ public static XmlLanguage parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a DOM Node. */
+ public static XmlLanguage parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from a DOM Node. */
+ public static XmlLanguage parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlLanguage} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlLanguage parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlLanguage} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlLanguage parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlLanguage) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlLineNumber.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLineNumber.java
new file mode 100644
index 0000000..fb22a4f
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLineNumber.java
@@ -0,0 +1,74 @@
+/* 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.xmlbeans;
+
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+
+/**
+ * A subclass of XmlBookmark that holds line number information.
+ * If a document is parsed with line numbers
+ * enabled, these bookmarks will be placed at appropriate locations
+ * within the document.
+ *
+ * @see XmlOptions#setLoadLineNumbers
+ */
+public class XmlLineNumber extends XmlBookmark
+{
+ /**
+ * Constructs a line number with no column or offset information.
+ * @param line the line number - the first line is 1
+ */
+ public XmlLineNumber ( int line ) { this( line, -1, -1 ); }
+
+ /**
+ * Constructs a line number and column with no file offset information.
+ * @param line the line number - the first line is 1
+ * @param line the column number - the first column is 1
+ */
+ public XmlLineNumber ( int line, int column ) { this( line, column, -1 ); }
+
+ /**
+ * Constructs a line number and column with no file offset information.
+ * @param line the line number - the first line is 1
+ * @param line the column number - the first column is 1
+ * @param line the file character offset - the first character in the file is 0
+ */
+ public XmlLineNumber ( int line, int column, int offset )
+ {
+ super( false );
+
+ _line = line;
+ _column = column;
+ _offset = offset;
+ }
+
+ /**
+ * Returns the 1-based line number, or -1 if not known.
+ */
+ public int getLine ( ) { return _line; }
+
+ /**
+ * Returns the 1-based column number, or -1 if not known.
+ */
+ public int getColumn ( ) { return _column; }
+
+ /**
+ * Returns the 0-based file offset number, or -1 if not known.
+ */
+ public int getOffset ( ) { return _offset; }
+
+ private int _line, _column, _offset;
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlLong.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLong.java
new file mode 100644
index 0000000..782d7c4
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlLong.java
@@ -0,0 +1,135 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#long">xs:long</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Naturally, convertible to a Java long.
+ */
+public interface XmlLong extends XmlInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_long");
+
+ /** Returns this value as a long */
+ long getLongValue();
+ /** Sets this value as a long */
+ void setLongValue(long v);
+
+ /**
+ * Returns this value as a long
+ * @deprecated replaced with {@link #getLongValue}
+ **/
+ long longValue();
+ /**
+ * Sets this value as a long
+ * @deprecated replaced with {@link #setLongValue}
+ **/
+ void set(long v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlLong}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlLong} */
+ public static XmlLong newInstance() {
+ return (XmlLong) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlLong} */
+ public static XmlLong newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlLong) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlLong} value */
+ public static XmlLong newValue(Object obj) {
+ return (XmlLong) type.newValue( obj ); }
+
+ /** Parses a {@link XmlLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>". */
+ public static XmlLong parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>". */
+ public static XmlLong parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from a File. */
+ public static XmlLong parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from a File. */
+ public static XmlLong parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from a URL. */
+ public static XmlLong parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from a URL. */
+ public static XmlLong parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from an InputStream. */
+ public static XmlLong parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from an InputStream. */
+ public static XmlLong parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from a Reader. */
+ public static XmlLong parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from a Reader. */
+ public static XmlLong parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from a DOM Node. */
+ public static XmlLong parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from a DOM Node. */
+ public static XmlLong parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlLong} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlLong parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlLong} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlLong parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlLong) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNCName.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNCName.java
new file mode 100644
index 0000000..c10131e
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNCName.java
@@ -0,0 +1,124 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#Name">xs:Name</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
+ * <p>
+ * This kind of string is the same as the non-colonized strings that are used
+ * for XML localnames and prefixes, "my-href.2". It is just a physical
+ * string, however, and it should NOT be confused with {@link XmlQName},
+ * which is a logical combination of localname and namespace URI.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlNCName extends XmlName
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NCName");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNCName}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNCName} */
+ public static XmlNCName newInstance() {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNCName} */
+ public static XmlNCName newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNCName} value */
+ public static XmlNCName newValue(Object obj) {
+ return (XmlNCName) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNCName} fragment from a String. For example: "<code><xml-fragment>My-Name</xml-fragment></code>". */
+ public static XmlNCName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from a String. For example: "<code><xml-fragment>My-Name</xml-fragment></code>". */
+ public static XmlNCName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from a File. */
+ public static XmlNCName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from a File. */
+ public static XmlNCName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from a URL. */
+ public static XmlNCName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from a URL. */
+ public static XmlNCName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from an InputStream. */
+ public static XmlNCName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from an InputStream. */
+ public static XmlNCName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from a Reader. */
+ public static XmlNCName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from a Reader. */
+ public static XmlNCName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from a DOM Node. */
+ public static XmlNCName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from a DOM Node. */
+ public static XmlNCName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNCName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNCName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNCName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNCName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNCName) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKEN.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKEN.java
new file mode 100644
index 0000000..d6092e5
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKEN.java
@@ -0,0 +1,123 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN">xs:NMTOKEN</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
+ * <p>
+ * An NMTOKEN is XML's closest concept to an "identifier"; for example,
+ * it does not permit spaces and only limited punctuation. So NMTOKEN is
+ * commonly used to describe a single token or enumerated string value.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlNMTOKEN extends XmlToken
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NMTOKEN");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNMTOKEN}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNMTOKEN} */
+ public static XmlNMTOKEN newInstance() {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNMTOKEN} */
+ public static XmlNMTOKEN newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNMTOKEN} value */
+ public static XmlNMTOKEN newValue(Object obj) {
+ return (XmlNMTOKEN) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a String. For example: "<code><xml-fragment>sample-1.2</xml-fragment></code>". */
+ public static XmlNMTOKEN parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a String. For example: "<code><xml-fragment>sample-1.2</xml-fragment></code>". */
+ public static XmlNMTOKEN parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a File. */
+ public static XmlNMTOKEN parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a File. */
+ public static XmlNMTOKEN parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a URL. */
+ public static XmlNMTOKEN parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a URL. */
+ public static XmlNMTOKEN parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from an InputStream. */
+ public static XmlNMTOKEN parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from an InputStream. */
+ public static XmlNMTOKEN parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a Reader. */
+ public static XmlNMTOKEN parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a Reader. */
+ public static XmlNMTOKEN parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a DOM Node. */
+ public static XmlNMTOKEN parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from a DOM Node. */
+ public static XmlNMTOKEN parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNMTOKEN parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNMTOKEN} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNMTOKEN parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNMTOKEN) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKENS.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKENS.java
new file mode 100644
index 0000000..726d163
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNMTOKENS.java
@@ -0,0 +1,146 @@
+/* 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.xmlbeans;
+
+import java.util.List;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NMTOKENS">xs:NMTOKENS</a> type,
+ * a list type.
+ * <p>
+ * Convertible to {@link List}.
+ */
+public interface XmlNMTOKENS extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NMTOKENS");
+
+ /** Returns the value as a {@link List} of {@link String} values */
+ List getListValue();
+ /** Returns the value as a {@link List} of {@link XmlNMTOKEN} values */
+ List xgetListValue();
+ /** Sets the value as a {@link List} */
+ void setListValue(List l);
+
+ /**
+ * Returns the value as a {@link List} of {@link String} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List listValue();
+ /**
+ * Returns the value as a {@link List} of {@link XmlNMTOKEN} values
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ List xlistValue();
+ /**
+ * Sets the value as a {@link List}
+ * @deprecated replaced by {@link #getListValue}
+ **/
+ void set(List l);
+
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNMTOKENS}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNMTOKENS} */
+ public static XmlNMTOKENS newInstance() {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNMTOKENS} */
+ public static XmlNMTOKENS newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNMTOKENS} value */
+ public static XmlNMTOKENS newValue(Object obj) {
+ return (XmlNMTOKENS) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a String. For example: "<code><xml-fragment>sample-1.1 sample-1.2 sample-1.3</xml-fragment></code>". */
+ public static XmlNMTOKENS parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a String. For example: "<code><xml-fragment>sample-1.1 sample-1.2 sample-1.3</xml-fragment></code>". */
+ public static XmlNMTOKENS parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a File. */
+ public static XmlNMTOKENS parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a File. */
+ public static XmlNMTOKENS parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a URL. */
+ public static XmlNMTOKENS parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a URL. */
+ public static XmlNMTOKENS parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from an InputStream. */
+ public static XmlNMTOKENS parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from an InputStream. */
+ public static XmlNMTOKENS parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a Reader. */
+ public static XmlNMTOKENS parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a Reader. */
+ public static XmlNMTOKENS parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a DOM Node. */
+ public static XmlNMTOKENS parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from a DOM Node. */
+ public static XmlNMTOKENS parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNMTOKENS parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNMTOKENS} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNMTOKENS parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNMTOKENS) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNOTATION.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNOTATION.java
new file mode 100644
index 0000000..58d5954
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNOTATION.java
@@ -0,0 +1,122 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NOTATION">xs:NOTATION</a> type.
+ * <p>
+ * NOTATIONs are a mechanism in XML Schema that is provided
+ * for partial backward compatibility with NOTATIONs in DTDs. XML Schema
+ * users should almost never have any reason to use this data type.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlNOTATION extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_NOTATION");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNOTATION}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNOTATION} */
+ public static XmlNOTATION newInstance() {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNOTATION} */
+ public static XmlNOTATION newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNOTATION} value */
+ public static XmlNOTATION newValue(Object obj) {
+ return (XmlNOTATION) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a String. */
+ public static XmlNOTATION parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a String. */
+ public static XmlNOTATION parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a File. */
+ public static XmlNOTATION parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a File. */
+ public static XmlNOTATION parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a URL. */
+ public static XmlNOTATION parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a URL. */
+ public static XmlNOTATION parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from an InputStream. */
+ public static XmlNOTATION parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from an InputStream. */
+ public static XmlNOTATION parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a Reader. */
+ public static XmlNOTATION parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a Reader. */
+ public static XmlNOTATION parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a DOM Node. */
+ public static XmlNOTATION parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from a DOM Node. */
+ public static XmlNOTATION parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNOTATION parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNOTATION} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNOTATION parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNOTATION) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlName.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlName.java
new file mode 100644
index 0000000..1a14f9b
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlName.java
@@ -0,0 +1,124 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#Name">xs:Name</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
+ * <p>
+ * This kind of string is the same as the lexical representation used for XML 1.0
+ * element and attribute names, e.g., "pre:a-b.cdef". It is just a physical
+ * string, however, and it should NOT be confused with {@link XmlQName},
+ * which is a logical combination of localname and namespace URI.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlName extends XmlToken
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_Name");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlName}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlName} */
+ public static XmlName newInstance() {
+ return (XmlName) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlName} */
+ public static XmlName newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlName) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlName} value */
+ public static XmlName newValue(Object obj) {
+ return (XmlName) type.newValue( obj ); }
+
+ /** Parses a {@link XmlName} fragment from a String. For example: "<code><xml-fragment>My:Name</xml-fragment></code>". */
+ public static XmlName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from a String. For example: "<code><xml-fragment>My:Name</xml-fragment></code>". */
+ public static XmlName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from a File. */
+ public static XmlName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from a File. */
+ public static XmlName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from a URL. */
+ public static XmlName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from a URL. */
+ public static XmlName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from an InputStream. */
+ public static XmlName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from an InputStream. */
+ public static XmlName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from a Reader. */
+ public static XmlName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from a Reader. */
+ public static XmlName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from a DOM Node. */
+ public static XmlName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from a DOM Node. */
+ public static XmlName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlName) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNegativeInteger.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNegativeInteger.java
new file mode 100644
index 0000000..e5bfe64
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNegativeInteger.java
@@ -0,0 +1,121 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#negativeInteger">xs:negativeInteger</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be negative when validating.
+ * <p>
+ * Convertible to {@link java.math.BigInteger}.
+ */
+public interface XmlNegativeInteger extends XmlNonPositiveInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_negativeInteger");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNegativeInteger}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNegativeInteger} */
+ public static XmlNegativeInteger newInstance() {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNegativeInteger} */
+ public static XmlNegativeInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNegativeInteger} value */
+ public static XmlNegativeInteger newValue(Object obj) {
+ return (XmlNegativeInteger) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>". */
+ public static XmlNegativeInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>". */
+ public static XmlNegativeInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a File. */
+ public static XmlNegativeInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a File. */
+ public static XmlNegativeInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a URL. */
+ public static XmlNegativeInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a URL. */
+ public static XmlNegativeInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from an InputStream. */
+ public static XmlNegativeInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from an InputStream. */
+ public static XmlNegativeInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a Reader. */
+ public static XmlNegativeInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a Reader. */
+ public static XmlNegativeInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a DOM Node. */
+ public static XmlNegativeInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from a DOM Node. */
+ public static XmlNegativeInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNegativeInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNegativeInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNegativeInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNegativeInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonNegativeInteger.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonNegativeInteger.java
new file mode 100644
index 0000000..41786ca
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonNegativeInteger.java
@@ -0,0 +1,121 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger">xs:nonNegativeInteger</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be zero or positive when validating.
+ * <p>
+ * Convertible to {@link java.math.BigInteger}.
+ */
+public interface XmlNonNegativeInteger extends XmlInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_nonNegativeInteger");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNonNegativeInteger}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNonNegativeInteger} */
+ public static XmlNonNegativeInteger newInstance() {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNonNegativeInteger} */
+ public static XmlNonNegativeInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNonNegativeInteger} value */
+ public static XmlNonNegativeInteger newValue(Object obj) {
+ return (XmlNonNegativeInteger) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlNonNegativeInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlNonNegativeInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a File. */
+ public static XmlNonNegativeInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a File. */
+ public static XmlNonNegativeInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a URL. */
+ public static XmlNonNegativeInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a URL. */
+ public static XmlNonNegativeInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from an InputStream. */
+ public static XmlNonNegativeInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from an InputStream. */
+ public static XmlNonNegativeInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a Reader. */
+ public static XmlNonNegativeInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a Reader. */
+ public static XmlNonNegativeInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a DOM Node. */
+ public static XmlNonNegativeInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from a DOM Node. */
+ public static XmlNonNegativeInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNonNegativeInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNonNegativeInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNonNegativeInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNonNegativeInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonPositiveInteger.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonPositiveInteger.java
new file mode 100644
index 0000000..c967f09
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNonPositiveInteger.java
@@ -0,0 +1,121 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger">xs:nonPositiveInteger</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be zero or negative when validating.
+ * <p>
+ * Convertible to {@link java.math.BigInteger}.
+ */
+public interface XmlNonPositiveInteger extends XmlInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_nonPositiveInteger");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNonPositiveInteger}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNonPositiveInteger} */
+ public static XmlNonPositiveInteger newInstance() {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNonPositiveInteger} */
+ public static XmlNonPositiveInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNonPositiveInteger} value */
+ public static XmlNonPositiveInteger newValue(Object obj) {
+ return (XmlNonPositiveInteger) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>". */
+ public static XmlNonPositiveInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a String. For example: "<code><xml-fragment>-1234567890</xml-fragment></code>". */
+ public static XmlNonPositiveInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a File. */
+ public static XmlNonPositiveInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a File. */
+ public static XmlNonPositiveInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a URL. */
+ public static XmlNonPositiveInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a URL. */
+ public static XmlNonPositiveInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from an InputStream. */
+ public static XmlNonPositiveInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from an InputStream. */
+ public static XmlNonPositiveInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a Reader. */
+ public static XmlNonPositiveInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a Reader. */
+ public static XmlNonPositiveInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a DOM Node. */
+ public static XmlNonPositiveInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from a DOM Node. */
+ public static XmlNonPositiveInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNonPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNonPositiveInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNonPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNonPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlNormalizedString.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNormalizedString.java
new file mode 100644
index 0000000..79debed
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlNormalizedString.java
@@ -0,0 +1,128 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#normalizedString">xs:normalizedString</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
+ * <p>
+ * An normalizedString simply is a string where all the carriage return,
+ * linefeed, and tab characters have been normalized (switched to) ordinary
+ * space characters. Use normalizedString for long strings to make them
+ * insensitive to line breaking. If you wish to often be insensitive to
+ * runs of whitespace (as is often the case), use
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a>
+ * (aka {@link XmlToken}) instead.
+ * <p>
+ * Convertible to {@link String}. When obtaining the stringValue, the
+ * whitespace-normalized value is returned.
+ */
+public interface XmlNormalizedString extends XmlString
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_normalizedString");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlNormalizedString}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlNormalizedString} */
+ public static XmlNormalizedString newInstance() {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlNormalizedString} */
+ public static XmlNormalizedString newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlNormalizedString} value */
+ public static XmlNormalizedString newValue(Object obj) {
+ return (XmlNormalizedString) type.newValue( obj ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>". */
+ public static XmlNormalizedString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a String. For example: "<code><xml-fragment> string to normalize </xml-fragment></code>". */
+ public static XmlNormalizedString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a File. */
+ public static XmlNormalizedString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a File. */
+ public static XmlNormalizedString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a URL. */
+ public static XmlNormalizedString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a URL. */
+ public static XmlNormalizedString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from an InputStream. */
+ public static XmlNormalizedString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from an InputStream. */
+ public static XmlNormalizedString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a Reader. */
+ public static XmlNormalizedString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a Reader. */
+ public static XmlNormalizedString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a DOM Node. */
+ public static XmlNormalizedString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from a DOM Node. */
+ public static XmlNormalizedString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNormalizedString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlNormalizedString} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlNormalizedString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlNormalizedString) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlObject.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlObject.java
new file mode 100644
index 0000000..b428d18
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlObject.java
@@ -0,0 +1,725 @@
+/* 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.xmlbeans;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+import org.w3c.dom.Node;
+
+import java.io.InputStream;
+import java.io.File;
+import java.io.Reader;
+import java.io.IOException;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#key-urType">xs:anyType</a>,
+ * the base type for all XML Beans.
+ * <p>
+ * Since all XML Schema types are translated into corresponding XML Bean
+ * classes, and all Schema type derivation corresponds to Java class
+ * inheritance, the fact that all Schema types derive from xs:anyType means
+ * that all XML Bean classes derive from XmlObject.
+ * <p>
+ * On this base class you will find a number of common facilities that
+ * all XML Bean classes provide:
+ * <p>
+ * <ul>
+ * <li>Every XML Bean class has an inner Factory class for creating and parsing
+ * instances, including XmlObject. Use {@link XmlObject.Factory} itself
+ * to produce untyped XML trees or XML trees that implement specific
+ * subtypes of XmlObject depending on a recognized root document element.
+ * If you depend on the automatic type inference, you will want to understand
+ * the type inference issues described below.
+ * <li>To write out an accurate XML file for the XML tree under this
+ * XmlObject, use one of the {@link #save} methods,
+ * or {@link #newInputStream} or {@link #newReader}.
+ * Use {@link #toString} to produce a pretty-printed representation of the
+ * XML subtree under this XML Object. If you save interior portions of
+ * an XML document, you will want to understand the inner contents
+ * versus outer container issues described below.
+ * <li>It is also simple to copy an XmlObject instance to or from a standard
+ * DOM tree or SAX stream. Use {@link XmlObject.Factory#parse(Node)},
+ * for example, to load from DOM; use {@link XmlObject.Factory#newXmlSaxHandler}
+ * to load from SAX; use {@link #newDomNode()} to save to DOM; and use
+ * {@link #save(org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler)}
+ * to save to SAX.
+ * <li>Use {@link #validate} to validate the subtree of XML under this
+ * XML Object. If you wish to get information about the location
+ * and reason for validation errors, see {@link XmlOptions#setErrorListener},
+ * and use {@link #validate(XmlOptions)}.
+ * <li>Use {@link #newCursor} to access the full XML infoset, for example,
+ * if you need to determine interleaved element order or manipulate
+ * annotations, comments, or mixed content. See {@link XmlCursor}.
+ * <li>Use {@link #selectPath} to find other XmlObjects in the subtree underneath
+ * this XmlObject using relative XPaths. (In selectPath, "." indicates
+ * the current element or attribute.)
+ * </ul>
+ * <p>
+ * Type inference. When using {@link XmlObject.Factory} to parse XML documents,
+ * the actual document type is not {@link XmlObject#type} itself, but a subtype
+ * based on the contents of the parsed document. If the parsed document
+ * contains a recognized root document element, then the actual type of the
+ * loaded instance will be the matching Document type. For example:
+ * <pre>
+ * XmlObject xobj = XmlObject.Factory.parse(myDocument);
+ * if (xobj instanceof MyOrderDocument) // starts w/ <my-order>
+ * {
+ * MyOrderDocument mydoc = (MyOrderDocument)xobj;
+ * if (!xobj.validate())
+ * System.out.println("Not a valid my-order document");
+ * }
+ * else
+ * {
+ * System.out.println("Not a my-order document");
+ * }
+ * </pre>
+ * Every XML Bean class has its own inner Factory class,
+ * so if you actually know exactly which XML Bean document type
+ * you want to load as in the example above, you should use the
+ * the specific XML Bean Factory class instead. For example:
+ * <pre>
+ * MyOrderDocument mydoc = MyOrderDocument.Factory.parse(myDocument);
+ * </pre>
+ * The code above will throw an exception if the parsed document
+ * does not begin with the proper (my-order) element.
+ * <p>
+ * Inner versus outer. An XmlObject represents the
+ * <em>contents</em> of an element or attribute, <em>not</em> the element
+ * or attribute itself. So when you validate or save an XmlObject, you
+ * are validating or saving its contents, not its container. For example,
+ * if the XmlObject represents the contents of an element which happens
+ * to itself be in the wrong order relative to its siblings, validate will
+ * not complain about the misplacement of the element itself. On the other hand, if
+ * elements <em>within</em> the XmlObject are in the wrong order, validate
+ * will complain. Similarly, when saving the contents of an interior
+ * XmlObject, it is the contents of an element, not the element itself,
+ * which is saved by default.
+ * <p>
+ * Reading and writing fragments. When reading or writing the contents of a
+ * whole XML document, the standard XML reprentation for a document is used.
+ * However, there is no standard concrete XML representation for "just the
+ * contents" of an interior element or attribute. So when one is needed,
+ * the tag <xml-fragment> is used to wrap the contents. This tag is used
+ * can also be used to load just the contents for an XmlObject document fragment
+ * of arbitrary type. If you wish to save out the XmlObject's container element
+ * along with its contents, use {@link XmlOptions#setSaveOuter}.
+ * <p>
+ * Implementing XmlObject. The XMLBeans library does not support arbitrary
+ * implementations of XmlObject - in almost all cases, you should only use
+ * the implementations of XmlObject provided by the XMLBeans compiler itself.
+ * If you need to implement XmlObject yourself, you should subclass
+ * FilterXmlObject in order to delegate to another underlying XmlObject
+ * implementation. This technique will allow you to use your code unchanged
+ * with future versions of XMLBeans that add additional methods on XmlObject.
+ */
+public interface XmlObject extends XmlTokenSource
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_anyType");
+
+ /**
+ * The schema type for this instance. This is a permanent,
+ * unchanging property of the instance.
+ */
+ SchemaType schemaType();
+
+ /**
+ * Returns true if the contents of this object are valid
+ * accoring to schemaType().
+ * <p>
+ * Does a deep validation of the entire subtree under the
+ * object, but does not validate the parents or siblings
+ * of the object if the object is in the interior of an xml
+ * tree.
+ */
+ boolean validate();
+
+ /**
+ * <p>Just like validate(), but with options.</p>
+ * <p>If you wish to collect error messages and locations while validating,
+ * use the {@link XmlOptions#setErrorListener} method. With that method,
+ * you can specify an object in which to store messages related to validation.
+ * The following is a simple example.</p>
+ *
+ * <pre>
+ * // Create an XmlOptions instance and set the error listener.
+ * XmlOptions validateOptions = new XmlOptions();
+ * ArrayList errorList = new ArrayList();
+ * validateOptions.setErrorListener(errorList);
+ *
+ * // Validate the XML.
+ * boolean isValid = newEmp.validate(validateOptions);
+ *
+ * // If the XML isn't valid, loop through the listener's contents,
+ * // printing contained messages.
+ * if (!isValid)
+ * {
+ * for (int i = 0; i < errorList.size(); i++)
+ * {
+ * XmlError error = (XmlError)errorList.get(i);
+ *
+ * System.out.println("\n");
+ * System.out.println("Message: " + error.getMessage() + "\n");
+ * System.out.println("Location of invalid XML: " +
+ * error.getCursorLocation().xmlText() + "\n");
+ * }
+ * }
+ * </pre>
+ *
+ * @param options An object that implements the {@link java.util.Collection
+ * Collection} interface.
+ */
+ boolean validate(XmlOptions options);
+
+ /**
+ * Selects a path. Path can be a string or precompiled path String.
+ * <p>
+ * The path must be a relative path, where "." represents the
+ * element or attribute containg this XmlObject, and it must select
+ * only other elements or attributes. If a non-element or non-attribute
+ * is selected, an unchecked exception is thrown.
+ * <p>
+ * The array that is returned contains all the selected
+ * XmlObjects, within the same document, listed in document
+ * order. The actual array type of the result is inferred
+ * from the closest common base type of selected results.
+ * <p>
+ * Here is an example of usage. Suppose we have a global
+ * element definition for "owner" whose type is "person":
+ * <pre>
+ * <schema targetNamespace="http://openuri.org/sample">
+ * <element name="owner" type="person"/>
+ * <complexType name="person">
+ * [...]
+ * </complexType>
+ * </schema>
+ * </pre>
+ * and suppose "owner" tags can be scattered throughout the
+ * document. Then we can write the following code to find
+ * them all:
+ * <pre>
+ * import org.openuri.sample.Person;
+ * import org.apache.xmlbeans.*;
+ * [...]
+ * XmlObject xobj = XmlObject.Factory.parse(myFile);
+ * Person[] results;
+ * results = (Person[])xobj.selectPath(
+ * "declare namespace s='http://www.openuri.org/sample' " +
+ * ".//s:owner");
+ * </pre>
+ * Notice the way in which namespace declarations are done in XPath 2.0.
+ * Since XPath can only navigate within an XML document - it cannot
+ * construct new XML - the resulting XmlObjects all reside in
+ * the same XML document as this XmlObject itself.
+ */
+ XmlObject[] selectPath ( String path );
+
+ /**
+ * Selects a path, applying options.
+ *
+ * @see #selectPath(String)
+ */
+ XmlObject[] selectPath ( String path, XmlOptions options );
+
+
+ /**
+ * Executes a query. Query can be a string or precompiled query String.
+ * <p>
+ * An XQuery is very similar to an XPath, except that it also permits
+ * construction of new XML. As a result, the XmlObjects that are
+ * returned from execQuery are in newly created documents, separate
+ * from the XmlObject on which the query is executed.
+ * <p>
+ * Syntax and usage is otherwise similar to selectPath.
+ * <p>
+ * @see #selectPath(String)
+ */
+ XmlObject[] execQuery ( String query );
+
+ /**
+ * Executes a query with options.
+ *
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>To replace the document element with the specified QName when constructing the
+ * resulting document.</td>
+ * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all insignificant whitespace when constructing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all comments when constructing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripComments}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all processing instructions when constructing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
+ * </tr>
+ * <tr>
+ * <td>A map of namespace URI substitutions to use when constructing a document.</td>
+ * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Additional namespace mappings to be added when constructing a document.</td>
+ * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>To trim the underlying XML text buffer immediately after constructing
+ * a document, resulting in a smaller memory footprint.</td>
+ * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
+ * </tr>
+ * <tr>
+ * <td>Whether value facets should be checked as they are set.</td>
+ * <td>{@link XmlOptions#setValidateOnSet}</td>
+ * </tr>
+ * </table>
+ *
+ * @param query The XQuery expression.
+ * @param options Options as described.
+ *
+ * @see #execQuery(String)
+ */
+ XmlObject[] execQuery ( String query, XmlOptions options );
+
+
+ /**
+ * Changes the schema type associated with this data and
+ * returns a new XmlObject instance whose schemaType is the
+ * new type.
+ * <p>
+ * Returns null if the type change is not allowed. Certain
+ * type changes may be prohibited on the interior of an xml
+ * tree due to schema type system constraints (that is, due
+ * to a parent container within which the newly specified
+ * type is not permissible), but there are no constraints
+ * at the roottype changes are never
+ * prohibited at the root of an xml tree.
+ * <p>
+ * If the type change is allowed, then the new XmlObject should
+ * be used rather than the old one. The old XmlObject instance and
+ * any other XmlObject instances in the subtree are permanently
+ * invalidated and should not be used. (They will return
+ * InvalidStateException if you try to use them.)
+ *
+ * If a type change is done on the interior of an Xml
+ * tree, then xsi:type attributes are updated as needed.
+ */
+ XmlObject changeType(SchemaType newType);
+
+
+ /**
+ * True if the value is nil. Note that in order to be nil,
+ * the value must be in an element, and the element containing
+ * the value must be marked as nillable in the schema.
+ */
+ boolean isNil();
+
+ /**
+ * Sets the value to nil. The element containing the value must
+ * be marked as nillable in the schema.
+ */
+ void setNil();
+
+
+ /**
+ * Returns an XML string for this XML object.
+ * <p>
+ * The string is pretty-printed. If you want a non-pretty-printed
+ * string, or if you want to control options precisely, use the
+ * xmlText() methods.
+ * <p>
+ * Note that when producing XML any object other than very root of the
+ * document, then you are guaranteed to be looking at only a fragment
+ * of XML, i.e., just the contents of an element or attribute, and
+ * and we will produce a string that starts with an <code><xml-fragment></code> tag.
+ * The XmlOptions.setSaveOuter() option on xmlText can be used to produce
+ * the actual element name above the object if you wish.
+ */
+ String toString();
+
+ /**
+ * True if the value is an immutable value. Immutable values do not
+ * have a position in a tree; rather, they are stand-alone simple type
+ * values. If the object is immutable, the equals() methods tests for
+ * value equality, and the object can be used as the key for a hash.
+ */
+ boolean isImmutable();
+
+ /**
+ * Set the value/type of this XmlObject to be a copy of the source
+ * XmlObject. Because the type of the source may be different than this
+ * target, this XmlObject may become defunct. In this case the new
+ * XmlObject is returned. If no type change happens, the same this will be
+ * returned.
+ */
+ XmlObject set(XmlObject srcObj);
+
+ /**
+ * Returns a deep copy of this XmlObject. The returned object has the
+ * same type as the current object, and has all the content of
+ * the XML document underneath the current object. Note that
+ * any parts of the XML document above or outside this XmlObject are
+ * not copied.
+ */
+ XmlObject copy();
+
+ /**
+ * True if the xml values are equal. Two different objects
+ * (which are distinguished by equals(obj) == false) may of
+ * course have equal values (valueEquals(obj) == true).
+ * <p>
+ * Usually this method can be treated as an ordinary equvalence
+ * relation, but actually it is not is not transitive.
+ * Here is a precise specification:
+ * <p>
+ * There are two categories of XML object: objects with a known
+ * instance type, and objects whose only known type is one of the
+ * ur-types (either AnyType or AnySimpleType). The first category
+ * is compared in terms of logical value spaces, and the second
+ * category is compared lexically.
+ * <p>
+ * Within each of these two categories, valueEquals is a well-behaved
+ * equivalence relation. However, when comparing an object of known
+ * type with an object with ur-type, the comparison is done by attempting
+ * to convert the lexical form of the ur-typed object into the other
+ * type, and then comparing the results. Ur-typed objects are therefore
+ * treated as lexical wildcards and may be equal to objects in different
+ * value spaces, even though the objects in different value spaces are
+ * not equal to each other.
+ * <p>
+ * For example, the anySimpleType value "1" will compare as an
+ * equalValue to the string "1", the float value "1.0", the double
+ * value "1.0", the decimal "1", and the GYear "1", even though
+ * all these objects will compare unequal to each other since they
+ * lie in different value spaces.
+ */
+ boolean valueEquals(XmlObject obj);
+
+ int valueHashCode();
+
+ /**
+ * Impelements the Comparable interface by comparing two simple
+ * xml values based on their standard XML schema ordering.
+ * Throws a ClassCastException if no standard ordering applies,
+ * or if the two values are incomparable within a partial order.
+ */
+ int compareTo(Object obj);
+
+ /**
+ * This comparison method is similar to compareTo, but rather
+ * than throwing a ClassCastException when two values are incomparable,
+ * it returns the number 2. The result codes are -1 if this object
+ * is less than obj, 1 if this object is greater than obj, zero if
+ * the objects are equal, and 2 if the objects are incomparable.
+ */
+ int compareValue(XmlObject obj);
+
+ /** LESS_THAN is -1. See {@link #compareValue}. */
+ static final int LESS_THAN = -1;
+ /** EQUAL is 0. See {@link #compareValue}. */
+ static final int EQUAL = 0;
+ /** GREATER_THAN is 1. See {@link #compareValue}. */
+ static final int GREATER_THAN = 1;
+ /** NOT_EQUAL is 2. See {@link #compareValue}. */
+ static final int NOT_EQUAL = 2;
+
+ /**
+ * Static factory class for creating new instances. Note that if
+ * a type can be inferred from the XML being loaded (for example,
+ * by recognizing the document element QName), then the instance
+ * returned by a factory will have the inferred type. Otherwise
+ * the Factory will returned an untyped document.
+ */
+ public static final class Factory
+ {
+ /**
+ * Creates a new, completely empty instance.
+ */
+ public static XmlObject newInstance ( ) {
+ return XmlBeans.getContextTypeLoader().newInstance( null, null ); }
+
+ /**
+ * <p>Creates a new, completely empty instance, specifying options
+ * for the root element's document type and/or whether to validate
+ * value facets as they are set.</p>
+ *
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>Whether value facets should be checked as they are set.</td>
+ * <td>{@link XmlOptions#setValidateOnSet}</td>
+ * </tr>
+ * </table>
+ *
+ * @param options Options specifying root document type and/or value facet
+ * checking.
+ * @return A new, empty instance of XmlObject.</li>
+ */
+ public static XmlObject newInstance ( XmlOptions options ) {
+ return XmlBeans.getContextTypeLoader().newInstance( null, options ); }
+
+ /**
+ * Creates a new immutable value.
+ */
+ /** Creates an immutable {@link XmlObject} value */
+ public static XmlObject newValue ( Object obj ) {
+ return type.newValue( obj ); }
+
+ /**
+ * Parses the given {@link String} as XML.
+ */
+ public static XmlObject parse ( String s ) throws XmlException {
+ return XmlBeans.getContextTypeLoader().parse( s, null, null ); }
+
+ /**
+ * Parses the given {@link String} as XML.
+ *
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>To place line number annotations in the store when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadLineNumbers}</td>
+ * </tr>
+ * <tr>
+ * <td>To replace the document element with the specified QName when parsing.</td>
+ * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all insignificant whitespace when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all comments when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripComments}</td>
+ * </tr>
+ * <tr>
+ * <td>To strip all processing instructions when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
+ * </tr>
+ * <tr>
+ * <td>A map of namespace URI substitutions to use when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Additional namespace mappings to be added when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>To trim the underlying XML text buffer immediately after parsing
+ * a document, resulting in a smaller memory footprint.</td>
+ * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
+ * </tr>
+ * </table>
+ *
+ * @param s The string to parse.
+ * @param options Options as specified.
+ * @return A new instance containing the specified XML.
+ */
+ public static XmlObject parse ( String s, XmlOptions options ) throws XmlException {
+ return XmlBeans.getContextTypeLoader().parse( s, null, options ); }
+
+ /**
+ * Parses the given {@link File} as XML.
+ */
+ public static XmlObject parse ( File f ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( f, null, null ); }
+
+ /**
+ * Parses the given {@link File} as XML.
+ */
+ public static XmlObject parse ( File f, XmlOptions options ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( f, null, options ); }
+
+ /**
+ * Downloads the given {@link java.net.URL} as XML.
+ */
+ public static XmlObject parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return XmlBeans.getContextTypeLoader().parse( u, null, null ); }
+
+ /**
+ * Downloads the given {@link java.net.URL} as XML.
+ */
+ public static XmlObject parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return XmlBeans.getContextTypeLoader().parse( u, null, options ); }
+
+ /**
+ * Decodes and parses the given {@link InputStream} as XML.
+ */
+ public static XmlObject parse ( InputStream is ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( is, null, null ); }
+
+ /**
+ * Decodes and parses the given {@link InputStream} as XML.
+ *
+ * Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The character encoding to use when parsing or writing a document.</td>
+ * <td>{@link XmlOptions#setCharacterEncoding}</td>
+ * </tr>
+ * <tr>
+ * <td>The document type for the root element.</td>
+ * <td>{@link XmlOptions#setDocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>Place line number annotations in the store when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadLineNumbers}</td>
+ * </tr>
+ * <tr>
+ * <td>Replace the document element with the specified QName when parsing.</td>
+ * <td>{@link XmlOptions#setLoadReplaceDocumentElement}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all insignificant whitespace when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripWhitespace}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all comments when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripComments}</td>
+ * </tr>
+ * <tr>
+ * <td>Strip all processing instructions when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadStripProcinsts}</td>
+ * </tr>
+ * <tr>
+ * <td>Set a map of namespace URI substitutions to use when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadSubstituteNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Set additional namespace mappings to be added when parsing a document.</td>
+ * <td>{@link XmlOptions#setLoadAdditionalNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Trim the underlying XML text buffer immediately after parsing
+ * a document, resulting in a smaller memory footprint.</td>
+ * <td>{@link XmlOptions#setLoadTrimTextBuffer}</td>
+ * </tr>
+ * </table>
+ */
+ public static XmlObject parse ( InputStream is, XmlOptions options ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( is, null, options ); }
+
+ /**
+ * Parses the given {@link Reader} as XML.
+ */
+ public static XmlObject parse ( Reader r ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( r, null, null ); }
+
+ /**
+ * Parses the given {@link Reader} as XML.
+ */
+ public static XmlObject parse ( Reader r, XmlOptions options ) throws XmlException, IOException {
+ return XmlBeans.getContextTypeLoader().parse( r, null, options ); }
+
+ /**
+ * Converts the given DOM {@link Node} into an XmlObject.
+ */
+ public static XmlObject parse ( Node node ) throws XmlException {
+ return XmlBeans.getContextTypeLoader().parse( node, null, null ); }
+
+ /**
+ * Converts the given DOM {@link Node} into an XmlObject.
+ */
+ public static XmlObject parse ( Node node, XmlOptions options ) throws XmlException {
+ return XmlBeans.getContextTypeLoader().parse( node, null, options ); }
+
+ /**
+ * Loads the given {@link XMLInputStream} into an XmlObject.
+ * @deprecated Superceded by JSR 173
+ */
+ public static XmlObject parse ( XMLInputStream xis ) throws XmlException, XMLStreamException {
+ return XmlBeans.getContextTypeLoader().parse( xis, null, null ); }
+
+ /**
+ * Loads the given {@link XMLInputStream} into an XmlObject.
+ * @deprecated Superceded by JSR 173
+ */
+ public static XmlObject parse ( XMLInputStream xis, XmlOptions options ) throws XmlException, XMLStreamException {
+ return XmlBeans.getContextTypeLoader().parse( xis, null, options ); }
+
+ /**
+ * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
+ */
+ public static XmlSaxHandler newXmlSaxHandler ( ) {
+ return XmlBeans.getContextTypeLoader().newXmlSaxHandler( null, null ); }
+
+ /**
+ * Returns an {@link XmlSaxHandler} that can load an XmlObject from SAX events.
+ */
+ public static XmlSaxHandler newXmlSaxHandler ( XmlOptions options ) {
+ return XmlBeans.getContextTypeLoader().newXmlSaxHandler( null, options ); }
+
+ /**
+ * Returns a new validating {@link XMLInputStream} that throws exceptions when the input is not valid.
+ * @deprecated Superceded by JSR 173
+ */
+ public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis ) throws XmlException, XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, null, null ); }
+
+ /**
+ * Returns a new validating {@link XMLInputStream} that throws exceptions
+ * when the input is not valid, specifying options
+ * for the root element's document type and/or the collection object to use
+ * as an error listener while validating.</p>
+ *
+ * <p>Use the <em>options</em> parameter to specify the following:</p>
+ *
+ * <ul>
+ * <li>A collection instance that should be used as an error listener during
+ * compilation, as described in {@link XmlOptions#setErrorListener}.</li>
+ * <li>The document type for the root element, as described in
+ * {@link XmlOptions#setDocumentType(SchemaType)}.</li>
+ * </ul>
+ *
+ * @param xis The basis for the new XMLInputStream.
+ * @param options Options specifying root document type and/or an error listener.
+ * @return A new validating XMLInputStream.
+ * @deprecated Superceded by JSR 173
+ */
+ public static XMLInputStream newValidatingXMLInputStream ( XMLInputStream xis, XmlOptions options ) throws XmlException, XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, null, options ); }
+
+ /**
+ * Instances cannot be created.
+ */
+ private Factory() { }
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
new file mode 100644
index 0000000..06f1920
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlOptions.java
@@ -0,0 +1,676 @@
+/* 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.xmlbeans;
+
+import org.xml.sax.EntityResolver;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import javax.xml.namespace.QName;
+
+/**
+ * Used to supply options for loading, saving, and compiling, and validating.
+ * <p>
+ * There are two styles for using XmlOptions: multiline setup, and single-line use.
+ * Here are two examples. First, multiline style:
+ * <pre>
+ * XmlOptions opts = new XmlOptions();
+ * opts.setSavePrettyPrint();
+ * opts.setSavePrettyPrintIndent(4);
+ * System.out.println(xobj.xmlText(opts));
+ * </pre>
+ *
+ * The alternative is single-line usage:
+ * <pre>
+ * System.out.println(xobj.xmlText(
+ * new XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(4)));
+ * </pre>
+ */
+public class XmlOptions implements java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private Map _map = new HashMap();
+
+
+ /**
+ * Construct a new blank XmlOptions.
+ */
+ public XmlOptions ( ) { }
+
+ /**
+ * Construct a new XmlOptions, copying the options.
+ */
+ public XmlOptions (XmlOptions other) {
+ if (other != null) _map.putAll(other._map);
+ }
+
+ //
+ // Handy-dandy helper methods for setting some options
+ //
+
+ /**
+ * This option will cause the saver to save namespace attributes first.
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveNamespacesFirst() {
+ return set( SAVE_NAMESPACES_FIRST );
+ }
+ /**
+ * This option will cause the saver to reformat white space for easier reading.
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSavePrettyPrint() {
+ return set( SAVE_PRETTY_PRINT );
+ }
+
+ /**
+ * When used with <code>setSavePrettyPrint</code> this sets the indent
+ * amount to use.
+ *
+ * @param indent the indent amount to use
+ * @see #setSavePrettyPrint
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSavePrettyPrintIndent(int indent) {
+ return set( SAVE_PRETTY_PRINT_INDENT, indent );
+ }
+
+ /**
+ * When used with <code>setSavePrettyPrint</code> this sets the offset
+ * amount to use.
+ *
+ * @param offset the offset amount to use
+ * @see #setSavePrettyPrint
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSavePrettyPrintOffset(int offset) {
+ return set( SAVE_PRETTY_PRINT_OFFSET, offset );
+ }
+
+ /**
+ * When parsing or writing a document, this sets the character
+ * encoding to use.
+ *
+ * @param encoding the character encoding
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ */
+ public XmlOptions setCharacterEncoding(String encoding) {
+ return set( CHARACTER_ENCODING, encoding );
+ }
+
+ /**
+ * When parsing a document, this sets the type of the root
+ * element. If this is set, the parser will not try to guess
+ * the type based on the document's <code>QName</code>.
+ *
+ * @param type The root element's document type.
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setDocumentType(SchemaType type) {
+ return set( DOCUMENT_TYPE, type );
+ }
+
+ /**
+ * <p>Sets a collection object for collecting {@link XmlError} objects
+ * during parsing, validation, and compilation. When set, the collection
+ * will contain all the errors after the operation takes place. Notice that
+ * the errors will only have line numbers if the document was
+ * loaded with line numbers enabled.</p>
+ *
+ * <p>The following simple example illustrates using an error listener
+ * during validation.</p>
+ *
+ * <pre>
+ * // Create an XmlOptions instance and set the error listener.
+ * XmlOptions validateOptions = new XmlOptions();
+ * ArrayList errorList = new ArrayList();
+ * validateOptions.setErrorListener(errorList);
+ *
+ * // Validate the XML.
+ * boolean isValid = newEmp.validate(validateOptions);
+ *
+ * // If the XML isn't valid, loop through the listener's contents,
+ * // printing contained messages.
+ * if (!isValid)
+ * {
+ * for (int i = 0; i < errorList.size(); i++)
+ * {
+ * XmlError error = (XmlError)errorList.get(i);
+ *
+ * System.out.println("\n");
+ * System.out.println("Message: " + error.getMessage() + "\n");
+ * System.out.println("Location of invalid XML: " +
+ * error.getCursorLocation().xmlText() + "\n");
+ * }
+ * }
+ * </pre>
+ *
+ * @param c A collection that will be filled with {@link XmlError} objects
+ * via {@link Collection#add}
+ *
+ * @see XmlError
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ * @see XmlObject#validate(XmlOptions)
+ * @see XmlBeans#compileXsd
+ * @see XmlOptions#setLoadLineNumbers
+ */
+ public XmlOptions setErrorListener (Collection c) {
+ return set( ERROR_LISTENER, c );
+ }
+
+ /**
+ * Causes the saver to reduce the number of namespace prefix declarations.
+ * The saver will do this by passing over the document twice, first to
+ * collect the set of needed namespace declarations, and then second
+ * to actually save the document with the declarations collected
+ * at the root.
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveAggresiveNamespaces() {
+ return set( SAVE_AGGRESSIVE_NAMESPACES );
+ }
+
+ /**
+ * This option causes the saver to wrap the current fragment in
+ * an element with the given name.
+ *
+ * @param name the name to use for the top level element
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveSyntheticDocumentElement (QName name) {
+ return set( SAVE_SYNTHETIC_DOCUMENT_ELEMENT, name );
+ }
+
+ /**
+ * If this option is set, the saver will try to use the default
+ * namespace for the most commonly used URI. If it is not set
+ * the saver will always created named prefixes.
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setUseDefaultNamespace () {
+ return set( SAVE_USE_DEFAULT_NAMESPACE );
+ }
+
+ /**
+ * If namespaces have already been declared outside the scope of the
+ * fragment being saved, this allows those mappings to be passed
+ * down to the saver, so the prefixes are not re-declared.
+ *
+ * @param implicitNamespaces a map of prefixes to uris that can be
+ * used by the saver without being declared
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveImplicitNamespaces (Map implicitNamespaces) {
+ return set( SAVE_IMPLICIT_NAMESPACES, implicitNamespaces );
+ }
+
+ /**
+ * A map of hints to pass to the saver for which prefixes to use
+ * for which namespace URI.
+ *
+ * @param suggestedPrefixes a map from URIs to prefixes
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveSuggestedPrefixes (Map suggestedPrefixes) {
+ return set( SAVE_SUGGESTED_PREFIXES, suggestedPrefixes );
+ }
+
+ /**
+ * This option causes the saver to filter a Processing Instruction
+ * with the given target
+ *
+ * @param filterProcinst the name of a Processing Instruction to filter
+ * on save
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveFilterProcinst (String filterProcinst) {
+ return set( SAVE_FILTER_PROCINST, filterProcinst );
+ }
+
+ /**
+ * When saving a fragment, this option changes the qname of the synthesized
+ * root element. Normally <xml-fragment> is used.
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveUseOpenFrag () {
+ return set( SAVE_USE_OPEN_FRAGMENT );
+ }
+
+ /**
+ * This option controls whether saving begins on the element or its contents
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveOuter () {
+ return set( SAVE_OUTER );
+ }
+
+ /**
+ * This option controls whether saving begins on the element or its contents
+ *
+ * @see XmlTokenSource#save(java.io.File, XmlOptions)
+ * @see XmlTokenSource#xmlText(XmlOptions)
+ */
+ public XmlOptions setSaveInner () {
+ return set( SAVE_INNER );
+ }
+
+ /**
+ * If this option is set, the document element is replaced with the
+ * given QName when parsing. If null is supplied, the document element
+ * is removed.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadReplaceDocumentElement ( QName replacement ) {
+ return set( LOAD_REPLACE_DOCUMENT_ELEMENT, replacement );
+ }
+
+ /**
+ * If this option is set, all insignificant whitespace is stripped
+ * when parsing a document. Can be used to save memory on large
+ * documents when you know there is no mixed content.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadStripWhitespace () {
+ return set( LOAD_STRIP_WHITESPACE);
+ }
+
+ /**
+ * If this option is set, all comments are stripped when parsing
+ * a document.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadStripComments() {
+ return set( LOAD_STRIP_COMMENTS );
+ }
+
+ /**
+ * If this option is set, all processing instructions
+ * are stripped when parsing a document.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadStripProcinsts () {
+ return set( LOAD_STRIP_PROCINSTS );
+ }
+
+ /**
+ * If this option is set, line number annotations are placed
+ * in the store when parsing a document. This is particularly
+ * useful when you want {@link XmlError} objects to contain
+ * line numbers.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ * @see XmlError
+ */
+ public XmlOptions setLoadLineNumbers () {
+ return set( LOAD_LINE_NUMBERS );
+ }
+
+ /**
+ * This option sets a map of namespace uri substitutions that happen
+ * when parsing a document.
+ * <p>
+ * This is particularly useful if you
+ * have documents that use no namespace, but you wish to avoid
+ * the name collision problems that occur when you introduce
+ * schema definitions without a target namespace.
+ * <p>
+ * By mapping the empty string "" (the absence of a URI) to a specific
+ * namespace, you can force the parser to behave as if a no-namespace
+ * document were actually in the specified namespace. This allows you
+ * to type the instance according to a schema in a nonempty namespace,
+ * and therefore avoid the problematic practice of using schema
+ * definitions without a target namespace.
+ *
+ * @param substNamespaces a map of document URIs to replacement URIs
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadSubstituteNamespaces (Map substNamespaces) {
+ return set( LOAD_SUBSTITUTE_NAMESPACES, substNamespaces );
+ }
+
+ /**
+ * If this option is set, the underlying xml text buffer is trimmed
+ * immediately after parsing a document resulting in a smaller memory
+ * footprint. Use this option if you are loading a large number
+ * of unchanging documents that will stay in memory for some time.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadTrimTextBuffer () {
+ return set( LOAD_TRIM_TEXT_BUFFER );
+ }
+
+ /**
+ * Set additional namespace mappings to be added when parsing
+ * a document.
+ *
+ * @param nses additional namespace mappings
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadAdditionalNamespaces (Map nses) {
+ return set( LOAD_ADDITIONAL_NAMESPACES, nses );
+ }
+
+ /**
+ * If this option is set when loading from an InputStream or File, then
+ * the loader will compute a 160-bit SHA-1 message digest of the XML
+ * file while loading it and make it available via
+ * XmlObject.documentProperties().getMessageDigest();
+ * <br>
+ * The schema compiler uses message digests to detect and eliminate
+ * duplicate imported xsd files.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setLoadMessageDigest () {
+ return set( LOAD_MESSAGE_DIGEST );
+ }
+
+ /**
+ * Sets the name of the variable that represents
+ * the current node in a query expression.
+ *
+ * @param varName The new variable name to use for the query.
+ *
+ * @see XmlObject#execQuery
+ * @see XmlCursor#execQuery
+ */
+ public XmlOptions setXqueryCurrentNodeVar (String varName) {
+ return set( XQUERY_CURRENT_NODE_VAR, varName );
+ }
+
+ /**
+ * Map the names and values of external variables in an xquery
+ * expression. The keys of the map are the variable names
+ * in the query without the '$' prefix. The values of the map
+ * are objects and can be any of the primitive wrapper classes,
+ * String, XmlObject, or XmlCursor. The mapping only applies to
+ * xquery and has no effect on xpath expressions.
+ *
+ * @param varMap a map from <code>String</code>s to variable instances.
+ *
+ * @see XmlObject#execQuery
+ * @see XmlCursor#execQuery
+ */
+ public XmlOptions setXqueryVariables (Map varMap) {
+ return set( XQUERY_VARIABLE_MAP, varMap );
+ }
+
+ /**
+ * This option sets the document source name into the xml store
+ * when parsing a document. If a document is parsed from a
+ * File or URI, it is automatically set to the URI of the
+ * source; otherwise, for example, when parsing a String,
+ * you can use this option to specify the source name yourself.
+ *
+ * @see XmlObject.Factory#parse(java.lang.String, XmlOptions)
+ */
+ public XmlOptions setDocumentSourceName (String documentSourceName) {
+ return set( DOCUMENT_SOURCE_NAME, documentSourceName );
+ }
+
+ /**
+ * This option allows for <code>QName</code> substitution during schema compilation.
+ *
+ * @param nameMap a map from <code>QName</code>s to substitute <code>QName</code>s.
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileSubstituteNames (Map nameMap) {
+ return set( COMPILE_SUBSTITUTE_NAMES, nameMap );
+ }
+
+ /**
+ * If this option is set, validation is not done on the Schema XmlBeans
+ * when building a <code>SchemaTypeSystem</code>
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileNoValidation () {
+ return set( COMPILE_NO_VALIDATION );
+ }
+
+ /**
+ * If this option is set, the unique particle attribution rule is not
+ * enforced when building a <code>SchemaTypeSystem</code>. See
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#non-ambig">Appendix H of the XML Schema specification</a>
+ * for information on the UPA rule.
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileNoUpaRule () {
+ return set( COMPILE_NO_UPA_RULE );
+ }
+
+ /**
+ * If this option is set, the particle valid (restriciton) rule is not
+ * enforced when building a <code>SchemaTypeSystem</code>. See
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict">Section 3.9.6 of the XML Schema specification</a>
+ * for information on the PVR rule.
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileNoPvrRule () {
+ return set( COMPILE_NO_PVR_RULE );
+ }
+
+ /**
+ * If this option is set, then the schema compiler will try to download
+ * schemas that appear in imports and includes from network based URLs.
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileDownloadUrls () {
+ return set( COMPILE_DOWNLOAD_URLS);
+ }
+
+ /**
+ * If this option is set, then the schema compiler will permit and
+ * ignore multiple definitions of the same component (element, attribute,
+ * type, etc) names in the given namespaces. If multiple definitions
+ * with the same name appear, the definitions that happen to be processed
+ * last will be ignored.
+ *
+ * @param mdefNamespaces a set of namespace URIs as Strings
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setCompileMdefNamespaces(Set mdefNamespaces)
+ {
+ return set( COMPILE_MDEF_NAMESPACES, mdefNamespaces );
+ }
+
+ /**
+ * If this option is set when an instance is created, then value
+ * facets will be checked on each call to a setter or getter
+ * method on instances of XmlObject within the instance document.
+ * If the facets are not satisfied, then an unchecked exception is
+ * thrown immediately. This option is useful for finding code that
+ * is introducing invalid values in an XML document, but it
+ * slows performance.
+ *
+ * @see XmlObject.Factory#parse(java.io.File, XmlOptions)
+ */
+ public XmlOptions setValidateOnSet() {
+ return set( VALIDATE_ON_SET );
+ }
+
+ /**
+ * If this option is set when compiling a schema, then the given
+ * EntityResolver will be consulted in order to resolve any
+ * URIs while downloading imported schemas.
+ *
+ * EntityResolvers are currently only used by compileXsd; they
+ * are not consulted by other functions, for example, parse.
+ * This will likely change in the future.
+ *
+ * @see XmlBeans#compileXsd
+ */
+ public XmlOptions setEntityResolver(EntityResolver resolver) {
+ return set( ENTITY_RESOLVER, resolver );
+ }
+
+
+ //
+ // Complete set of XmlOption's
+ //
+
+ // TODO - Add selectPath option to track the seletion (deault is to clean selections fast).
+
+ /** @exclude */
+ public static final String SAVE_NAMESPACES_FIRST = "SAVE_NAMESPACES_FIRST";
+ /** @exclude */
+ public static final String SAVE_SYNTHETIC_DOCUMENT_ELEMENT = "SAVE_SYNTHETIC_DOCUMENT_ELEMENT";
+ /** @exclude */
+ public static final String SAVE_PRETTY_PRINT = "SAVE_PRETTY_PRINT";
+ /** @exclude */
+ public static final String SAVE_PRETTY_PRINT_INDENT = "SAVE_PRETTY_PRINT_INDENT";
+ /** @exclude */
+ public static final String SAVE_PRETTY_PRINT_OFFSET = "SAVE_PRETTY_PRINT_OFFSET";
+ /** @exclude */
+ public static final String SAVE_AGGRESSIVE_NAMESPACES = "SAVE_AGGRESSIVE_NAMESPACES";
+ /** @exclude */
+ public static final String SAVE_USE_DEFAULT_NAMESPACE = "SAVE_USE_DEFAULT_NAMESPACE";
+ /** @exclude */
+ public static final String SAVE_IMPLICIT_NAMESPACES = "SAVE_IMPLICIT_NAMESPACES";
+ /** @exclude */
+ public static final String SAVE_SUGGESTED_PREFIXES = "SAVE_SUGGESTED_PREFIXES";
+ /** @exclude */
+ public static final String SAVE_FILTER_PROCINST = "SAVE_FILTER_PROCINST";
+ /** @exclude */
+ public static final String SAVE_USE_OPEN_FRAGMENT = "SAVE_USE_OPEN_FRAGMENT";
+ /** @exclude */
+ public static final String SAVE_OUTER = "SAVE_OUTER";
+ /** @exclude */
+ public static final String SAVE_INNER = "SAVE_INNER";
+
+ /** @exclude */
+ public static final String LOAD_REPLACE_DOCUMENT_ELEMENT = "LOAD_REPLACE_DOCUMENT_ELEMENT";
+ /** @exclude */
+ public static final String LOAD_STRIP_WHITESPACE = "LOAD_STRIP_WHITESPACE";
+ /** @exclude */
+ public static final String LOAD_STRIP_COMMENTS = "LOAD_STRIP_COMMENTS";
+ /** @exclude */
+ public static final String LOAD_STRIP_PROCINSTS = "LOAD_STRIP_PROCINSTS";
+ /** @exclude */
+ public static final String LOAD_LINE_NUMBERS = "LOAD_LINE_NUMBERS";
+ /** @exclude */
+ public static final String LOAD_SUBSTITUTE_NAMESPACES = "LOAD_SUBSTITUTE_NAMESPACES";
+ /** @exclude */
+ public static final String LOAD_TRIM_TEXT_BUFFER = "LOAD_TRIM_TEXT_BUFFER";
+ /** @exclude */
+ public static final String LOAD_ADDITIONAL_NAMESPACES = "LOAD_ADDITIONAL_NAMESPACES";
+ /** @exclude */
+ public static final String LOAD_MESSAGE_DIGEST = "LOAD_MESSAGE_DIGEST";
+
+ /** @exclude */
+ public static final String XQUERY_CURRENT_NODE_VAR = "XQUERY_CURRENT_NODE_VAR";
+ /** @exclude */
+ public static final String XQUERY_VARIABLE_MAP = "XQUERY_VARIABLE_MAP";
+
+ /** @exclude */
+ public static final String CHARACTER_ENCODING = "CHARACTER_ENCODING";
+ /** @exclude */
+ public static final String ERROR_LISTENER = "ERROR_LISTENER";
+ /** @exclude */
+ public static final String DOCUMENT_TYPE = "DOCUMENT_TYPE";
+ /** @exclude */
+ public static final String DOCUMENT_SOURCE_NAME = "DOCUMENT_SOURCE_NAME";
+ /** @exclude */
+ public static final String COMPILE_SUBSTITUTE_NAMES = "COMPILE_SUBSTITUTE_NAMES";
+ /** @exclude */
+ public static final String COMPILE_NO_VALIDATION = "COMPILE_NO_VALIDATION";
+ /** @exclude */
+ public static final String COMPILE_NO_UPA_RULE = "COMPILE_NO_UPA_RULE";
+ /** @exclude */
+ public static final String COMPILE_NO_PVR_RULE = "COMPILE_NO_PVR_RULE";
+ /** @exclude */
+ public static final String COMPILE_DOWNLOAD_URLS = "COMPILE_DOWNLOAD_URLS";
+ /** @exclude */
+ public static final String COMPILE_MDEF_NAMESPACES = "COMPILE_MDEF_NAMESPACES";
+ /** @exclude */
+ public static final String VALIDATE_ON_SET = "VALIDATE_ON_SET";
+ /** @exclude */
+ public static final String ENTITY_RESOLVER = "ENTITY_RESOLVER";
+
+
+ private static final XmlOptions EMPTY_OPTIONS;
+ static {
+ EMPTY_OPTIONS = new XmlOptions();
+ EMPTY_OPTIONS._map = Collections.unmodifiableMap(EMPTY_OPTIONS._map);
+ }
+
+ /** If passed null, returns an empty options object. Otherwise, returns its argument. */
+ public static XmlOptions maskNull(XmlOptions o) {
+ return (o == null) ? EMPTY_OPTIONS : o;
+ }
+
+
+ /** Used to set a generic option */
+ public void put ( Object option ) { put( option, null ); }
+ /** Used to set a generic option */
+ public void put ( Object option, Object value ) { _map.put(option, value); }
+ /** Used to set a generic option */
+ public void put ( Object option, int value ) { put( option, new Integer( value ) ); }
+
+ private XmlOptions set(Object option) { return set(option, null); }
+ private XmlOptions set(Object option, Object value) { _map.put(option, value); return this;}
+ private XmlOptions set(Object option, int value) { return set(option, new Integer(value)); }
+
+ /** Used to test a generic option */
+ public boolean hasOption ( Object option ) { return _map.containsKey( option ); }
+ /** Used to get a generic option */
+ public Object get ( Object option ) { return _map.get( option ); }
+
+ /** Used to test a generic option on an options object that may be null */
+ public static Object safeGet(XmlOptions o, Object option) {
+ return o == null ? null : o.get(option);
+ }
+
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlPositiveInteger.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlPositiveInteger.java
new file mode 100644
index 0000000..1bd1348
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlPositiveInteger.java
@@ -0,0 +1,121 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#positiveInteger">xs:positiveInteger</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be positive when validating.
+ * <p>
+ * Convertible to {@link java.math.BigInteger}.
+ */
+public interface XmlPositiveInteger extends XmlNonNegativeInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_positiveInteger");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlPositiveInteger}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlPositiveInteger} */
+ public static XmlPositiveInteger newInstance() {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlPositiveInteger} */
+ public static XmlPositiveInteger newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlPositiveInteger} value */
+ public static XmlPositiveInteger newValue(Object obj) {
+ return (XmlPositiveInteger) type.newValue( obj ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlPositiveInteger parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a String. For example: "<code><xml-fragment>1234567890</xml-fragment></code>". */
+ public static XmlPositiveInteger parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a File. */
+ public static XmlPositiveInteger parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a File. */
+ public static XmlPositiveInteger parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a URL. */
+ public static XmlPositiveInteger parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a URL. */
+ public static XmlPositiveInteger parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from an InputStream. */
+ public static XmlPositiveInteger parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from an InputStream. */
+ public static XmlPositiveInteger parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a Reader. */
+ public static XmlPositiveInteger parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a Reader. */
+ public static XmlPositiveInteger parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a DOM Node. */
+ public static XmlPositiveInteger parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from a DOM Node. */
+ public static XmlPositiveInteger parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlPositiveInteger} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlPositiveInteger parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlPositiveInteger) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlQName.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlQName.java
new file mode 100644
index 0000000..70aadcb
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlQName.java
@@ -0,0 +1,144 @@
+/* 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.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#QName">xs:QName</a> type.
+ * <p>
+ * A QName is the logical combination of an XML namespace URI and a localName.
+ * Although in an XML instance document, a QName appears as "prefix:localName",
+ * the logical value of a QName does NOT contain any information about the
+ * prefix, only the namespace URI to which the prefix maps. For example,
+ * two QNames "a:hello" and "b:hello" are perfectly equivalent if "a:" in
+ * the first instance maps to the same URI as "b:" in the second instance.
+ * <p>
+ * Convertible to {@link javax.xml.namespace.QName}.
+ */
+public interface XmlQName extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_QName");
+
+ /** Returns this value as a {@link QName} */
+ QName getQNameValue();
+ /** Sets this value as a {@link QName} */
+ void setQNameValue(QName name);
+
+ /**
+ * Returns this value as a {@link QName}
+ * @deprecated replaced with {@link #getQNameValue}
+ **/
+ QName qNameValue();
+ /**
+ * Sets this value as a {@link QName}
+ * @deprecated replaced with {@link #setQNameValue}
+ **/
+ void set(QName name);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlQName}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlQName} */
+ public static XmlQName newInstance() {
+ return (XmlQName) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlQName} */
+ public static XmlQName newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlQName) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlQName} value */
+ public static XmlQName newValue(Object obj) {
+ return (XmlQName) type.newValue( obj ); }
+
+ /** Parses a {@link XmlQName} fragment from a String. For example: "<code><xml-fragment xmlns:x="http://openuri.org/">x:sample</xml-fragment></code>". */
+ public static XmlQName parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from a String. For example: "<code><xml-fragment xmlns:x="http://openuri.org/">x:sample</xml-fragment></code>". */
+ public static XmlQName parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from a File. */
+ public static XmlQName parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from a File. */
+ public static XmlQName parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from a URL. */
+ public static XmlQName parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from a URL. */
+ public static XmlQName parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from an InputStream. */
+ public static XmlQName parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from an InputStream. */
+ public static XmlQName parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from a Reader. */
+ public static XmlQName parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from a Reader. */
+ public static XmlQName parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from a DOM Node. */
+ public static XmlQName parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from a DOM Node. */
+ public static XmlQName parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlQName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlQName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlQName} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlQName parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlQName) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlRuntimeException.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlRuntimeException.java
new file mode 100644
index 0000000..dcaf4cb
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlRuntimeException.java
@@ -0,0 +1,109 @@
+/* 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.xmlbeans;
+
+import java.util.List;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * An unchecked XML exception.
+ * May contain any number of {@link XmlError} objects.
+ *
+ * @see XmlError
+ * @see XmlException
+ */
+public class XmlRuntimeException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs an XmlRuntimeException from a message.
+ */
+ public XmlRuntimeException ( String m ) { super( m ); }
+
+ /**
+ * Constructs an XmlRuntimeException from a message and a cause.
+ */
+ public XmlRuntimeException ( String m, Throwable t ) { super( m, t ); }
+
+ /**
+ * Constructs an XmlRuntimeException from a cause.
+ */
+ public XmlRuntimeException ( Throwable t ) { super( t ); }
+
+ /**
+ * Constructs an XmlRuntimeException from a message, a cause, and a collection of XmlErrors.
+ */
+ public XmlRuntimeException ( String m, Throwable t, Collection errors )
+ {
+ super( m, t );
+
+ if (errors != null)
+ _errors = Collections.unmodifiableList( new ArrayList(errors) );
+ }
+
+ /**
+ * Constructs an XmlRuntimeException from an XmlError.
+ */
+ public XmlRuntimeException ( XmlError error )
+ {
+ this( error.toString(), null, error );
+ }
+
+ /**
+ * Constructs an XmlRuntimeException from a message, a cause, and an XmlError.
+ */
+ public XmlRuntimeException ( String m, Throwable t, XmlError error )
+ {
+ this( m, t, Collections.singletonList( error ) );
+ }
+
+ /**
+ * Constructs an XmlRuntimeException from an {@link XmlException}.
+ */
+ public XmlRuntimeException ( XmlException xmlException )
+ {
+ super( xmlException.getMessage(), xmlException.getCause() );
+
+ Collection errors = xmlException.getErrors();
+
+ if (errors != null)
+ _errors = Collections.unmodifiableList( new ArrayList( errors ) );
+ }
+
+ /**
+ * Returns the first {@link XmlError} that caused this exception, if any.
+ */
+ public XmlError getError ( )
+ {
+ if (_errors == null || _errors.size() == 0)
+ return null;
+
+ return (XmlError) _errors.get( 0 );
+ }
+
+ /**
+ * Returns the collection of {@link XmlError XmlErrors} that caused this exception, if any.
+ */
+ public Collection getErrors ( )
+ {
+ return _errors;
+ }
+
+ private List _errors;
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlSaxHandler.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlSaxHandler.java
new file mode 100644
index 0000000..eea45fc
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlSaxHandler.java
@@ -0,0 +1,44 @@
+/* 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.xmlbeans;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * A holder for a SAX {@link ContentHandler} and {@link LexicalHandler} that are
+ * capable of loading an {@link XmlObject} instance. Once all the SAX events are pushed
+ * to the handlers, call {@link #getObject()} to get the loaded XmlObject.
+ *
+ * @see XmlObject.Factory#newXmlSaxHandler
+ * @see SchemaTypeLoader#newXmlSaxHandler
+ */
+public interface XmlSaxHandler
+{
+ /**
+ * The ContentHandler expecting SAX content events.
+ * @see ContentHandler
+ */
+ ContentHandler getContentHandler ( );
+ /**
+ * The LexicalHandler expecting SAX lexical events.
+ * @see LexicalHandler
+ */
+ LexicalHandler getLexicalHandler ( );
+
+ /** Returns the loaded XmlObject after all the SAX events have been finished */
+ XmlObject getObject ( ) throws XmlException;
+}
\ No newline at end of file
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlShort.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlShort.java
new file mode 100644
index 0000000..7833c7b
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlShort.java
@@ -0,0 +1,135 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#short">xs:short</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Naturally, convertible to a Java short.
+ */
+public interface XmlShort extends XmlInt
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_short");
+
+ /** Returns this value as a short */
+ public short getShortValue();
+ /** Sets this value as a short */
+ public void setShortValue(short s);
+
+ /**
+ * Returns this value as a short
+ * @deprecated replaced with {@link #getShortValue}
+ **/
+ public short shortValue();
+ /**
+ * Sets this value as a short
+ * @deprecated replaced with {@link #setShortValue}
+ **/
+ public void set(short s);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlShort}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlShort} */
+ public static XmlShort newInstance() {
+ return (XmlShort) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlShort} */
+ public static XmlShort newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlShort) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlShort} value */
+ public static XmlShort newValue(Object obj) {
+ return (XmlShort) type.newValue( obj ); }
+
+ /** Parses a {@link XmlShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>". */
+ public static XmlShort parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>". */
+ public static XmlShort parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from a File. */
+ public static XmlShort parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from a File. */
+ public static XmlShort parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from a URL. */
+ public static XmlShort parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from a URL. */
+ public static XmlShort parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from an InputStream. */
+ public static XmlShort parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from an InputStream. */
+ public static XmlShort parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from a Reader. */
+ public static XmlShort parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from a Reader. */
+ public static XmlShort parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from a DOM Node. */
+ public static XmlShort parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from a DOM Node. */
+ public static XmlShort parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlShort} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlShort} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlShort) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java
new file mode 100644
index 0000000..cde96f8
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java
@@ -0,0 +1,188 @@
+/* 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.xmlbeans;
+
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * The immutable {@link List} returned for XML simple list values.
+ *
+ * XmlSimpleList implements an equals() and hashCode() that compare list
+ * contents, so two XmlSimpleLists are the same if they have the same
+ * values in the same order.
+ */
+public class XmlSimpleList implements List, java.io.Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private List underlying;
+
+ /**
+ * Constructs an immutable XmlSimpleList that wraps (does not copy)
+ * the given {@link List}. All non-mutating methods delegate to
+ * the underlying List instance.
+ */
+ public XmlSimpleList(List list) { this.underlying = list; }
+
+ /** Returns the number of elements in this list. */
+ public int size() { return underlying.size(); }
+ /** True if the list is empty. */
+ public boolean isEmpty() { return underlying.isEmpty(); }
+ /** True if the list is contains an object equal to o. */
+ public boolean contains(Object o) { return underlying.contains(o); }
+ /** True if the list is contains all the objects in the given collection. */
+ public boolean containsAll(Collection coll) { return underlying.containsAll(coll); }
+ /** Copies the collection to an array. */
+ public Object[] toArray() { return underlying.toArray(); }
+ /** Copies the collection to an array of a specified type. */
+ public Object[] toArray(Object[] a) { return underlying.toArray(a); }
+
+ /** Unsupported because this list is immutable. */
+ public boolean add(Object o) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public boolean addAll(Collection coll) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public boolean remove(Object o) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public boolean removeAll(Collection coll) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public boolean retainAll(Collection coll) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public void clear() { throw new UnsupportedOperationException(); }
+
+ /** Returns the object at the specified position in this list. */
+ public Object get(int index) { return underlying.get(index); }
+ /** Unsupported because this list is immutable. */
+ public Object set(int index, Object element) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public void add(int index, Object element) { throw new UnsupportedOperationException(); }
+ /** Unsupported because this list is immutable. */
+ public Object remove(int index) { throw new UnsupportedOperationException(); }
+ /** Returns index of the first occurance of an object equal to o. */
+ public int indexOf(Object o) { return underlying.indexOf(o); }
+ /** Returns index of the last occurance of an object equal to o. */
+ public int lastIndexOf(Object o) { return underlying.lastIndexOf(o); }
+ /** Unsupported because this list is immutable. */
+ public boolean addAll(int index, Collection c) { throw new UnsupportedOperationException(); }
+ /** Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. */
+ public List subList(int from, int to) { return new XmlSimpleList(underlying.subList(from, to)); }
+
+ /** Returns an iterator over the elements in this list in proper sequence. */
+ public Iterator iterator()
+ {
+ return new Iterator()
+ {
+ Iterator i = underlying.iterator();
+ public boolean hasNext() { return i.hasNext(); }
+ public Object next() { return i.next(); }
+ public void remove() { throw new UnsupportedOperationException(); }
+ };
+ }
+
+ /** Returns a list iterator of the elements in this list in proper sequence. */
+ public ListIterator listIterator() { return listIterator(0); }
+ /** Returns a list iterator of the elements in this list in proper sequence, starting at the specified position in this list. */
+ public ListIterator listIterator(final int index)
+ {
+ return new ListIterator()
+ {
+ ListIterator i = underlying.listIterator(index);
+
+ public boolean hasNext() { return i.hasNext(); }
+ public Object next() { return i.next(); }
+ public boolean hasPrevious(){ return i.hasPrevious(); }
+ public Object previous() { return i.previous(); }
+ public int nextIndex() { return i.nextIndex(); }
+ public int previousIndex() { return i.previousIndex(); }
+
+ public void remove() { throw new UnsupportedOperationException(); }
+ public void set(Object o) { throw new UnsupportedOperationException(); }
+ public void add(Object o) { throw new UnsupportedOperationException(); }
+ };
+ }
+
+ private String stringValue(Object o)
+ {
+ if (o instanceof SimpleValue)
+ return ((SimpleValue)o).stringValue();
+ return o.toString();
+ }
+
+ /**
+ * Returns a space-separated list of the string representations of all
+ * the items in the list. For most lists, this is a valid xml lexical
+ * value for the list. (The notable exception is a list of QNames.)
+ */
+ public String toString()
+ {
+ int size = underlying.size();
+ if (size == 0)
+ return "";
+ String first = stringValue(underlying.get(0));
+ if (size == 1)
+ return first;
+ StringBuffer result = new StringBuffer(first);
+ for (int i = 1; i < size; i++)
+ {
+ result.append(' ');
+ result.append(stringValue(underlying.get(i)));
+ }
+ return result.toString();
+ }
+
+ /**
+ * Two XmlSimpleLists are equal if all their items are equal.
+ * (They must have the same number of items, and the items must be in
+ * the same order.)
+ */
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof XmlSimpleList)) return false;
+ final XmlSimpleList xmlSimpleList = (XmlSimpleList)o;
+ List underlying2 = xmlSimpleList.underlying;
+ int size = underlying.size();
+ if (size != underlying2.size())
+ return false;
+ for (int i = 0; i < size; i++)
+ {
+ Object item = underlying.get(i);
+ Object item2 = underlying2.get(i);
+ if (item == null ? item2 != null : !item.equals(item2))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Combines the hash codes of all the list items.
+ */
+ public int hashCode()
+ {
+ int size = underlying.size();
+ int hash = 0;
+ for (int i = 0; i < size; i++)
+ {
+ Object item = underlying.get(i);
+ hash *= 19;
+ hash += item.hashCode();
+ }
+ return hash;
+ }
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlString.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlString.java
new file mode 100644
index 0000000..8726ab2
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlString.java
@@ -0,0 +1,128 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a> type.
+ * <p>
+ * A basic string in XML schema is not whitespace normalized. If you
+ * want your string type to be insensitive to variations in runs of
+ * whitespace, consider using
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a>
+ * (aka {@link XmlToken}) instead.
+ * To forbid whitespace and permit just alphanumeric and other
+ * common identifier characters consider
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#NMTOKEN">xs:NMTOKEN</a>
+ * (aka {@link XmlNMTOKEN}) instead.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlString extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_string");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlString}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlString} */
+ public static XmlString newInstance() {
+ return (XmlString) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlString} */
+ public static XmlString newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlString) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlString} value */
+ public static XmlString newValue(Object obj) {
+ return (XmlString) type.newValue( obj ); }
+
+ /** Parses a {@link XmlString} fragment from a String. For example: "<code><xml-fragment> arbitrary string </xml-fragment></code>". */
+ public static XmlString parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from a String. For example: "<code><xml-fragment> arbitrary string </xml-fragment></code>". */
+ public static XmlString parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from a File. */
+ public static XmlString parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from a File. */
+ public static XmlString parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from a URL. */
+ public static XmlString parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from a URL. */
+ public static XmlString parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from an InputStream. */
+ public static XmlString parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from an InputStream. */
+ public static XmlString parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from a Reader. */
+ public static XmlString parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from a Reader. */
+ public static XmlString parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from a DOM Node. */
+ public static XmlString parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from a DOM Node. */
+ public static XmlString parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlString} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlString} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlString parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlString) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlTime.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlTime.java
new file mode 100644
index 0000000..b281792
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlTime.java
@@ -0,0 +1,156 @@
+/* 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.xmlbeans;
+
+import java.util.Calendar;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#time">xs:time</a> type.
+ * A gDay specifies only a day-of-month.
+ * <p>
+ * Convertible to {@link Calendar} or {@link GDate}.
+ *
+ * @see XmlCalendar
+ * @see GDate
+ */
+public interface XmlTime extends XmlAnySimpleType
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_time");
+
+ /** Returns this value as a {@link Calendar} */
+ Calendar getCalendarValue();
+ /** Sets this value as a {@link Calendar} */
+ void setCalendarValue(Calendar c);
+ /** Returns this value as a {@link GDate} */
+ GDate getGDateValue();
+ /** Sets this value as a {@link GDateSpecification} */
+ void setGDateValue(GDate gd);
+
+ /**
+ * Returns this value as a {@link Calendar}
+ * @deprecated replaced with {@link #getCalendarValue}
+ **/
+ Calendar calendarValue();
+ /**
+ * Sets this value as a {@link Calendar}
+ * @deprecated replaced with {@link #setCalendarValue}
+ **/
+ void set(Calendar c);
+ /**
+ * Returns this value as a {@link GDate}
+ * @deprecated replaced with {@link #getGDateValue}
+ **/
+ GDate gDateValue();
+ /**
+ * Sets this value as a {@link GDateSpecification}
+ * @deprecated replaced with {@link #setGDateValue}
+ **/
+ void set(GDateSpecification gd);
+
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlTime}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlTime} */
+ public static XmlTime newInstance() {
+ return (XmlTime) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlTime} */
+ public static XmlTime newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlTime) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlTime} value */
+ public static XmlTime newValue(Object obj) {
+ return (XmlTime) type.newValue( obj ); }
+
+ /** Parses a {@link XmlTime} fragment from a String. For example: "<code><xml-fragment>12:00:00</xml-fragment></code>". */
+ public static XmlTime parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from a String. For example: "<code><xml-fragment>12:00:00</xml-fragment></code>". */
+ public static XmlTime parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from a File. */
+ public static XmlTime parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from a File. */
+ public static XmlTime parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from a URL. */
+ public static XmlTime parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from a URL. */
+ public static XmlTime parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from an InputStream. */
+ public static XmlTime parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from an InputStream. */
+ public static XmlTime parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from a Reader. */
+ public static XmlTime parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from a Reader. */
+ public static XmlTime parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from a DOM Node. */
+ public static XmlTime parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from a DOM Node. */
+ public static XmlTime parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlTime} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlTime} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlTime parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlTime) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlToken.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlToken.java
new file mode 100644
index 0000000..f5b8905
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlToken.java
@@ -0,0 +1,132 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#token">xs:token</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#string">xs:string</a>.
+ * <p>
+ * A token is XML's best representation for a "whitespace insensitive string."
+ * All carriage returns, linefeeds, and tabs are converted to ordinary space
+ * characters (as with <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#normalizedString">xs:normalizedString</a>),
+ * and furthermore, all contiguous runs of space are collapsed to single spaces,
+ * and leading and trailing spaces are trimmed.
+ * <p>
+ * If you want <code>" high priority "</code>
+ * to be equivalent to <code>"high priority"</code>, you should consider
+ * using xs:token or a subtype of xs:token.
+ * <p>
+ * When the {@link #stringValue} is obtained from an XmlToken, the normalized,
+ * trimmed, whitespace collapsed value is returned.
+ * <p>
+ * Convertible to {@link String}.
+ */
+public interface XmlToken extends XmlNormalizedString
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_token");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlToken}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlToken} */
+ public static XmlToken newInstance() {
+ return (XmlToken) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlToken} */
+ public static XmlToken newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlToken) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlToken} value */
+ public static XmlToken newValue(Object obj) {
+ return (XmlToken) type.newValue( obj ); }
+
+ /** Parses a {@link XmlToken} fragment from a String. For example: "<code><xml-fragment>string to collapse</xml-fragment></code>". */
+ public static XmlToken parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from a String. For example: "<code><xml-fragment>string to collapse</xml-fragment></code>". */
+ public static XmlToken parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from a File. */
+ public static XmlToken parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from a File. */
+ public static XmlToken parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from a URL. */
+ public static XmlToken parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from a URL. */
+ public static XmlToken parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from an InputStream. */
+ public static XmlToken parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from an InputStream. */
+ public static XmlToken parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from a Reader. */
+ public static XmlToken parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from a Reader. */
+ public static XmlToken parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from a DOM Node. */
+ public static XmlToken parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from a DOM Node. */
+ public static XmlToken parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlToken} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlToken parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlToken} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlToken parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlToken) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlTokenSource.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlTokenSource.java
new file mode 100644
index 0000000..7d8cb37
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlTokenSource.java
@@ -0,0 +1,319 @@
+/* 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.xmlbeans;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.File;
+import java.io.IOException;
+
+import org.w3c.dom.Node;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * Represents a holder of XML that can return an {@link XmlCursor}
+ * or copy itself to various media such as
+ * {@link Writer Writers} or {@link File Files}.
+ * Both {@link XmlObject}
+ * (and thus all XML Beans) and {@link XmlCursor} are
+ * XmlTokenSource implementations.
+ *
+ * @see XmlObject
+ * @see XmlCursor
+ */
+public interface XmlTokenSource
+{
+ /**
+ * Returns the synchronization object for the document. If concurrent
+ * multithreaded access to a document is required, the access should should
+ * be protected by synchronizing on this monitor() object. There is one
+ * monitor per XML document tree.
+ */
+ Object monitor();
+
+ /**
+ * Returns the XmlDocumentProperties object for the document this token
+ * source is associated with.
+ */
+ XmlDocumentProperties documentProperties();
+
+ /**
+ * Returns a new XML cursor.
+ *
+ * A cursor provides random access to all the tokens in the XML
+ * data, plus the ability to extract strongly-typed XmlObjects
+ * for the data. If the data is not read-only, the XML cursor
+ * also allows modifications to the data.
+ *
+ * Using a cursor for the first time typically forces the XML
+ * document into memory.
+ */
+ XmlCursor newCursor();
+
+ /**
+ * Returns a new XmlInputStream.
+ *
+ * The stream starts at the current begin-tag or begin-document
+ * position and ends at the matching end-tag or end-document.
+ *
+ * This is a fail-fast stream, so if the underlying data is changed
+ * while the stream is being read, the stream throws a
+ * ConcurrentModificationException.
+ *
+ * Throws an IllegalStateException if the XmlTokenSource is not
+ * positioned at begin-tag or begin-document (e.g., if it is at
+ * an attribute).
+ * @deprecated Superceded by JSR 173
+ */
+ XMLInputStream newXMLInputStream();
+
+ /**
+ * Returns standard XML text.
+ *
+ * The text returned represents the document contents starting at
+ * the current begin-tag or begin-document and ending at the matching
+ * end-tag or end-document. This is same content as newReader, but
+ * it is returned as a single string.
+ *
+ * Throws an IllegalStateException if the XmlTokenSource is not
+ * positioned at begin-tag or begin-document (e.g., if it is at
+ * an attribute).
+ */
+ String xmlText();
+
+ /**
+ * Returns a new stream containing standard XML text, encoded
+ * according to the given encoding.
+ *
+ * The byte stream contains contents starting at the current
+ * begin-tag or begin-document and ending at the matching
+ * end-tag or end-document. The specified encoding is used
+ * and also emitted in a PI at the beginning of the stream.
+ *
+ * This is a fail-fast stream, so if the underlying data is changed
+ * while the stream is being read, the stream throws a
+ * ConcurrentModificationException.
+ *
+ * Throws an IllegalStateException if the XmlTokenSource is not
+ * positioned at begin-tag or begin-document (e.g., if it is at
+ * an attribute).
+ */
+ InputStream newInputStream();
+
+ /**
+ * Returns a new character reader containing XML text.
+ *
+ * The contents of the reader represents the document contents
+ * starting at the current begin-tag or begin-document and ending at
+ * the matching end-tag or end-document. No encoding annotation
+ * will be made in the text itself.
+ *
+ * This is a fail-fast reader, so if the underlying data is changed
+ * while the reader is being read, the reader throws a
+ * ConcurrentModificationException.
+ *
+ * Throws an IllegalStateException if the XmlTokenSource is not
+ * positioned at begin-tag or begin-document (e.g., if it is at
+ * an attribute).
+ */
+ Reader newReader();
+
+ /**
+ * Returns a W3C DOM Node containing the XML
+ * represented by this source. This is a copy of the XML, it is
+ * not a live with the underlying store of this token source.
+ * If this is the document node, then a Document is returned, else
+ * a DocumentFragment is returned.
+ */
+ Node newDomNode();
+
+// /**
+// * Returns a W3C DOM Node containing the XML represented by this source.
+// * This is a live DOM node, not a copy. Any changes made through this node
+// * are immediately reflected in the document associated with this token
+// * source. Depending on the kind of token this XmlTokenSource represents,
+// * an appropriate node will be returned.
+// */
+// Node getDomNode();
+
+ /**
+ * Writes the XML represented by this source to the given SAX content and
+ * lexical handlers.
+ */
+ void save ( ContentHandler ch, LexicalHandler lh ) throws SAXException;
+
+ /**
+ * Writes the XML represented by this source to the given File.
+ */
+ void save ( File file ) throws IOException;
+
+ /**
+ * Writes the XML represented by this source to the given output stream.
+ */
+ void save ( OutputStream os ) throws IOException;
+
+ /**
+ * Writes the XML represented by this source to the given writer.
+ */
+ void save ( Writer w ) throws IOException;
+
+ /**
+ * <p>Just like newXMLInputStream() but with any of a number of options. Use the
+ * <em>options</em> parameter to specify the following:</p>
+ *
+ * <table>
+ * <tr><th>To specify this</th><th>Use this method</th></tr>
+ * <tr>
+ * <td>The character encoding to use when converting the character
+ * data in the XML to bytess.</td>
+ * <td>{@link XmlOptions#setCharacterEncoding}</td>
+ * </tr>
+ * <tr>
+ * <td>Prefix-to-namespace mappings that should be assumed
+ * when saving this XML. This is useful when the resulting
+ * XML will be part of a larger XML document, ensuring that this
+ * inner document will take advantage of namespaces defined in
+ * the outer document.</td>
+ * <td>{@link XmlOptions#setSaveImplicitNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>Suggested namespace prefixes to use when saving. Used only
+ * when a namespace attribute needs to be synthesized.</td>
+ * <td>{@link XmlOptions#setSaveSuggestedPrefixes}</td>
+ * </tr>
+ * <tr>
+ * <td>That namespace attributes should occur first in elements when
+ * the XML is saved. By default, they occur last.</td>
+ * <td>{@link XmlOptions#setSaveNamespacesFirst}</td>
+ * </tr>
+ * <tr>
+ * <td>The XML should be pretty printed when saved. Note that this
+ * should only be used for debugging.</td>
+ * <td>{@link XmlOptions#setSavePrettyPrint}</td>
+ * </tr>
+ * <tr>
+ * <td>The number of spaces to use when indenting for pretty printing.
+ * The default is 2.</td>
+ * <td>{@link XmlOptions#setSavePrettyPrintIndent}</td>
+ * </tr>
+ * <tr>
+ * <td>The additional number of spaces indented from the left
+ * for pretty printed XML.</td>
+ * <td>{@link XmlOptions#setSavePrettyPrintOffset}</td>
+ * </tr>
+ * <tr>
+ * <td>To minimize the number of namespace attributes generated for the
+ * saved XML. Note that this can reduce performance significantly.</td>
+ * <td>{@link XmlOptions#setSaveAggresiveNamespaces}</td>
+ * </tr>
+ * <tr>
+ * <td>To reduce the size of the saved document
+ * by allowing the use of the default namespace. Note that this can
+ * potentially change the semantic meaning of the XML if unprefixed QNames are
+ * present as the value of an attribute or element.</td>
+ * <td>{@link XmlOptions#setUseDefaultNamespace}</td>
+ * </tr>
+ * <tr>
+ * <td>To filter out processing instructions with the specified target name.</td>
+ * <td>{@link XmlOptions#setSaveFilterProcinst}</td>
+ * </tr>
+ * <tr>
+ * <td>Change the QName of the synthesized root element when saving. This
+ * replaces "xml-fragment" with "fragment" in the namespace
+ * http://www.openuri.org/fragment</td>
+ * <td>{@link XmlOptions#setSaveUseOpenFrag}</td>
+ * </tr>
+ * <tr>
+ * <td>Saving should begin on the element's contents.</td>
+ * <td>{@link XmlOptions#setSaveInner}</td>
+ * </tr>
+ * <tr>
+ * <td>Saving should begin on the element, rather than its contents.</td>
+ * <td>{@link XmlOptions#setSaveOuter}</td>
+ * </tr>
+ * <tr>
+ * <td>To rename the document element, or to specify the document element
+ * for this XML.</td>
+ * <td>{@link XmlOptions#setSaveSyntheticDocumentElement}</td>
+ * </tr>
+ * </table>
+ *
+ * @see XmlOptions
+ *
+ * @param options Any of the described options.
+ * @return A new validating XMLInputStream.
+ * @deprecated Superceded by JSR 173
+ */
+ XMLInputStream newXMLInputStream(XmlOptions options);
+
+ /**
+ * Just like xmlText() but with options.
+ * Options map may be null.
+ * @see XmlOptions
+ */
+ String xmlText(XmlOptions options);
+
+ /**
+ *
+ * Just like newInputStream(String encoding) but with options.
+ * Options map may be null.
+ * @see XmlOptions
+ */
+ InputStream newInputStream(XmlOptions options);
+
+ /**
+ * Just like newReader() but with options.
+ * Options map may be null.
+ * @see XmlOptions
+ */
+ Reader newReader(XmlOptions options);
+
+ /**
+ * Just like newDomNode() but with options.
+ * Options map may be null.
+ * @see XmlOptions
+ */
+
+ Node newDomNode(XmlOptions options);
+
+ /**
+ * Writes the XML represented by this source to the given SAX content and
+ * lexical handlers.
+ */
+ void save ( ContentHandler ch, LexicalHandler lh, XmlOptions options ) throws SAXException;
+
+ /**
+ * Writes the XML represented by this source to the given File.
+ */
+ void save ( File file, XmlOptions options ) throws IOException;
+
+ /**
+ * Writes the XML represented by this source to the given output stream.
+ */
+ void save ( OutputStream os, XmlOptions options ) throws IOException;
+
+ /**
+ * Writes the XML represented by this source to the given writer.
+ */
+ void save ( Writer w, XmlOptions options ) throws IOException;
+}
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedByte.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedByte.java
new file mode 100644
index 0000000..127a7c5
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedByte.java
@@ -0,0 +1,137 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedByte">xs:unsignedByte</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be in the range 0..255 when validating.
+ * <p>
+ * As suggested by JAXB, convertible to Java short.
+ */
+public interface XmlUnsignedByte extends XmlUnsignedShort
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedByte");
+
+ /** Returns this value as a short */
+ public short getShortValue();
+ /** Sets this value as a short */
+ public void setShortValue(short s);
+
+ /**
+ * Returns this value as a short
+ * @deprecated replaced with {@link #getShortValue}
+ **/
+ public short shortValue();
+ /**
+ * Sets this value as a short
+ * @deprecated replaced with {@link #setShortValue}
+ **/
+ public void set(short s);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlUnsignedByte}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlUnsignedByte} */
+ public static XmlUnsignedByte newInstance() {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlUnsignedByte} */
+ public static XmlUnsignedByte newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlUnsignedByte} value */
+ public static XmlUnsignedByte newValue(Object obj) {
+ return (XmlUnsignedByte) type.newValue( obj ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>". */
+ public static XmlUnsignedByte parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a String. For example: "<code><xml-fragment>123</xml-fragment></code>". */
+ public static XmlUnsignedByte parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a File. */
+ public static XmlUnsignedByte parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a File. */
+ public static XmlUnsignedByte parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a URL. */
+ public static XmlUnsignedByte parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a URL. */
+ public static XmlUnsignedByte parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from an InputStream. */
+ public static XmlUnsignedByte parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from an InputStream. */
+ public static XmlUnsignedByte parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a Reader. */
+ public static XmlUnsignedByte parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a Reader. */
+ public static XmlUnsignedByte parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a DOM Node. */
+ public static XmlUnsignedByte parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from a DOM Node. */
+ public static XmlUnsignedByte parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedByte parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlUnsignedByte} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedByte parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedByte) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedInt.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedInt.java
new file mode 100644
index 0000000..9eb1e22
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedInt.java
@@ -0,0 +1,137 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedInt">xs:unsignedInt</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be in the range 0..4294967295 when validating.
+ * <p>
+ * Convertible to Java long.
+ */
+public interface XmlUnsignedInt extends XmlUnsignedLong
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedInt");
+
+ /** Returns this value as a long */
+ long getLongValue();
+ /** Sets this value as a long */
+ void setLongValue(long v);
+
+ /**
+ * Returns this value as a long
+ * @deprecated replaced with {@link #getLongValue}
+ **/
+ long longValue();
+ /**
+ * Sets this value as a long
+ * @deprecated replaced with {@link #setLongValue}
+ **/
+ void set(long v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlUnsignedInt}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlUnsignedInt} */
+ public static XmlUnsignedInt newInstance() {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlUnsignedInt} */
+ public static XmlUnsignedInt newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlUnsignedInt} value */
+ public static XmlUnsignedInt newValue(Object obj) {
+ return (XmlUnsignedInt) type.newValue( obj ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */
+ public static XmlUnsignedInt parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a String. For example: "<code><xml-fragment>1234567</xml-fragment></code>". */
+ public static XmlUnsignedInt parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a File. */
+ public static XmlUnsignedInt parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a File. */
+ public static XmlUnsignedInt parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a URL. */
+ public static XmlUnsignedInt parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a URL. */
+ public static XmlUnsignedInt parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from an InputStream. */
+ public static XmlUnsignedInt parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from an InputStream. */
+ public static XmlUnsignedInt parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a Reader. */
+ public static XmlUnsignedInt parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a Reader. */
+ public static XmlUnsignedInt parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a DOM Node. */
+ public static XmlUnsignedInt parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from a DOM Node. */
+ public static XmlUnsignedInt parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlUnsignedInt} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedInt parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedInt) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedLong.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedLong.java
new file mode 100644
index 0000000..c8ad942
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedLong.java
@@ -0,0 +1,124 @@
+/* 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.xmlbeans;
+
+import java.math.BigInteger;
+
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedLong">xs:unsignedLong</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be in the range 0..2<super>64</super>-1 when validating.
+ * <p>
+ * Convertible to {@link BigInteger}.
+ */
+public interface XmlUnsignedLong extends XmlNonNegativeInteger
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedLong");
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlUnsignedLong}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlUnsignedLong} */
+ public static XmlUnsignedLong newInstance() {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlUnsignedLong} */
+ public static XmlUnsignedLong newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlUnsignedLong} value */
+ public static XmlUnsignedLong newValue(Object obj) {
+ return (XmlUnsignedLong) type.newValue( obj ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>". */
+ public static XmlUnsignedLong parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a String. For example: "<code><xml-fragment>123456789</xml-fragment></code>". */
+ public static XmlUnsignedLong parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a File. */
+ public static XmlUnsignedLong parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a File. */
+ public static XmlUnsignedLong parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a URL. */
+ public static XmlUnsignedLong parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a URL. */
+ public static XmlUnsignedLong parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from an InputStream. */
+ public static XmlUnsignedLong parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from an InputStream. */
+ public static XmlUnsignedLong parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a Reader. */
+ public static XmlUnsignedLong parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a Reader. */
+ public static XmlUnsignedLong parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a DOM Node. */
+ public static XmlUnsignedLong parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from a DOM Node. */
+ public static XmlUnsignedLong parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedLong parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlUnsignedLong} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedLong parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedLong) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedShort.java b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedShort.java
new file mode 100644
index 0000000..694e48e
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/XmlUnsignedShort.java
@@ -0,0 +1,137 @@
+/* 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.xmlbeans;
+
+/**
+ * Corresponds to the XML Schema
+ * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#unsignedShort">xs:unsignedShort</a> type.
+ * One of the derived types based on <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#decimal">xs:decimal</a>.
+ * <p>
+ * Verified to be in the range 0..65535 when validating.
+ * <p>
+ * Convertible to a Java int.
+ */
+public interface XmlUnsignedShort extends XmlUnsignedInt
+{
+ /** The constant {@link SchemaType} object representing this schema type. */
+ public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_unsignedShort");
+
+ /** Returns this value as an int */
+ int getIntValue();
+ /** Sets this value as an int */
+ void setIntValue(int v);
+
+ /**
+ * Returns this value as an int
+ * @deprecated replaced with {@link #getIntValue}
+ **/
+ int intValue();
+ /**
+ * Sets this value as an int
+ * @deprecated replaced with {@link #setIntValue}
+ **/
+ void set(int v);
+
+ /**
+ * A class with methods for creating instances
+ * of {@link XmlUnsignedShort}.
+ */
+ public static final class Factory
+ {
+ /** Creates an empty instance of {@link XmlUnsignedShort} */
+ public static XmlUnsignedShort newInstance() {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().newInstance( type, null ); }
+
+ /** Creates an empty instance of {@link XmlUnsignedShort} */
+ public static XmlUnsignedShort newInstance(org.apache.xmlbeans.XmlOptions options) {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().newInstance( type, options ); }
+
+ /** Creates an immutable {@link XmlUnsignedShort} value */
+ public static XmlUnsignedShort newValue(Object obj) {
+ return (XmlUnsignedShort) type.newValue( obj ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>". */
+ public static XmlUnsignedShort parse(java.lang.String s) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( s, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a String. For example: "<code><xml-fragment>12345</xml-fragment></code>". */
+ public static XmlUnsignedShort parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( s, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a File. */
+ public static XmlUnsignedShort parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( f, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a File. */
+ public static XmlUnsignedShort parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( f, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a URL. */
+ public static XmlUnsignedShort parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( u, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a URL. */
+ public static XmlUnsignedShort parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( u, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from an InputStream. */
+ public static XmlUnsignedShort parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( is, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from an InputStream. */
+ public static XmlUnsignedShort parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( is, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a Reader. */
+ public static XmlUnsignedShort parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( r, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a Reader. */
+ public static XmlUnsignedShort parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( r, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a DOM Node. */
+ public static XmlUnsignedShort parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( node, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from a DOM Node. */
+ public static XmlUnsignedShort parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( node, type, options ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
+
+ /** Parses a {@link XmlUnsignedShort} fragment from an XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static XmlUnsignedShort parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return (XmlUnsignedShort) XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
+
+ /** Returns a validating XMLInputStream.
+ * @deprecated Superceded by JSR 173 */
+ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
+ return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
+
+ private Factory() { } // No instance of this class allowed
+ }
+}
+
diff --git a/v1/src/xmlpublic/org/apache/xmlbeans/package.html b/v1/src/xmlpublic/org/apache/xmlbeans/package.html
new file mode 100644
index 0000000..472f78c
--- /dev/null
+++ b/v1/src/xmlpublic/org/apache/xmlbeans/package.html
@@ -0,0 +1,60 @@
+<!-- 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. -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+Provides classes for XML Beans schema, infoset, xpath, and xquery handling.
+
+<p>
+The XML Beans API is designed to work with the XML Beans <em>schema compiler</em>.
+The schema compiler produces XML Bean classes that extend and interact
+with the basic XML Bean classes and interfaces in this package. It is
+also possible to use XML Beans without the schema compiler to manipulate
+and validate XML in a late-bound way (with no types, or with
+runtime-loaded types only).
+
+<p>
+This package contains:
+<ol>
+<li>All the built-in XML Bean classes
+such as {@link org.apache.xmlbeans.XmlObject}, {@link org.apache.xmlbeans.XmlAnySimpleType}, and
+{@link org.apache.xmlbeans.XmlInt}
+(one for each of the
+<a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#built-in-datatypes">46 built-in XML Schema types</a>).
+<li>Support for full XML infoset, XPath, and XQuery
+(via {@link org.apache.xmlbeans.XmlCursor}, {@link org.apache.xmlbeans.XmlObject#selectPath} and related methods).
+<li>Support for computation using XML Schema data types (via datatype
+classes such as {@link org.apache.xmlbeans.GDuration}).
+<li>Support for working with XML Schema type metadata itself
+(via {@link org.apache.xmlbeans.SchemaType}, {@link org.apache.xmlbeans.SchemaTypeSystem}, and related classes).
+</ol>
+
+<p>
+The place to begin when working with the XML Beans API is the following
+fundamental classes:
+
+<ol>
+<li>{@link org.apache.xmlbeans.XmlObject} is the base class for all XML Beans.
+<li>{@link org.apache.xmlbeans.XmlObject.Factory} is used to load and create XML Bean instances.
+Each XML Bean class has its own nested factory class.
+<li>{@link org.apache.xmlbeans.XmlCursor} is an efficient treewalking API for the full XML infoset.
+<li>{@link org.apache.xmlbeans.SchemaType} is the type metadata interface for XML Schema types
+<li>{@link org.apache.xmlbeans.XmlBeans} provides a collection of utility functions.
+</ol>
+
+</body>
+</html>
diff --git a/v1/src/xmlschema/schema/XML.xsd b/v1/src/xmlschema/schema/XML.xsd
new file mode 100644
index 0000000..9a6537c
--- /dev/null
+++ b/v1/src/xmlschema/schema/XML.xsd
@@ -0,0 +1,81 @@
+<?xml version='1.0'?>
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ See http://www.w3.org/XML/1998/namespace.html and
+ http://www.w3.org/TR/REC-xml for information about this namespace.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>This schema defines attributes and an attribute group
+ suitable for use by
+ schemas wishing to allow xml:base, xml:lang or xml:space attributes
+ on elements they define.
+
+ To enable this, such a schema must import this schema
+ for the XML namespace, e.g. as follows:
+ <schema . . .>
+ . . .
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
+
+ Subsequently, qualified reference to any of the attributes
+ or the group defined below will have the desired effect, e.g.
+
+ <type . . .>
+ . . .
+ <attributeGroup ref="xml:specialAttrs"/>
+
+ will define a type which will schema-validate an instance
+ element with any of those attributes</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ http://www.w3.org/2001/03/xml.xsd.
+ At the date of issue it can also be found at
+ http://www.w3.org/2001/xml.xsd.
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML Schema
+ itself. In other words, if the XML Schema namespace changes, the version
+ of this document at
+ http://www.w3.org/2001/xml.xsd will change
+ accordingly; the version at
+ http://www.w3.org/2001/03/xml.xsd will not change.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang" type="xs:language">
+ <xs:annotation>
+ <xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values . . .</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="space" default="preserve">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
+ information about this attribute.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ </xs:attributeGroup>
+
+</xs:schema>
diff --git a/v1/src/xmlschema/schema/w3c-xml-license.html b/v1/src/xmlschema/schema/w3c-xml-license.html
new file mode 100644
index 0000000..3c8d31a
--- /dev/null
+++ b/v1/src/xmlschema/schema/w3c-xml-license.html
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>W3C Software License</title>
+ <link rel="stylesheet" type="text/css" href="/StyleSheets/base.css" />
+ <style type="text/css">
+ <!--
+h3#version { margin-top: -0.8em;}
+-->
+ </style>
+</head>
+
+<body text="#000000" bgcolor="#FFFFFF">
+
+<h1>W3C XML Namespace Schema: <a href="http://www.w3.org/2001/03/xml.xsd">http://www.w3.org/2001/03/xml.xsd</a></h1>
+<dl>
+ <dd><a href="http://www.w3.org/Consortium/Legal/ipr-notice">Copyright</a>
+ © 2001 <a href="http://www.w3.org/">World Wide Web
+ Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
+ Institute of Technology</a>, <a href="http://www.ercim.org/">European
+ Research Consortium for Informatics and Mathematics</a>, <a
+ href="http://www.keio.ac.jp/">Keio University</a>). All Rights
+ Reserved. This work is distributed under the <a
+ href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C<sup>®</sup>
+ Software License</a> [1] in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ <p>[1] <a
+ href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html">http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</a></p>
+ </dd>
+</dl>
+
+
+<hr/>
+
+<h1>W3C<sup>®</sup> SOFTWARE NOTICE AND LICENSE</h1>
+
+<h3 id="version"><a
+href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</a></h3>
+
+<p>This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following
+terms and conditions.</p>
+
+<p>Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without
+fee or royalty is hereby granted, provided that you include the following on
+ALL copies of the software and documentation or portions thereof, including
+modifications:</p>
+<ol>
+ <li>The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.</li>
+ <li>Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the <a
+ href="copyright-software-short-notice-20021231.html">W3C Software Short
+ Notice</a> should be included (hypertext is preferred, text is permitted)
+ within the body of any redistributed or derivative code.</li>
+ <li>Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)</li>
+</ol>
+
+<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
+ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
+
+<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION.</p>
+
+<p>The name and trademarks of copyright holders may NOT be used in
+advertising or publicity pertaining to the software without specific, written
+prior permission. Title to copyright in this software and any associated
+documentation will at all times remain with copyright holders.</p>
+
+<p></p>
+
+<p>____________________________________</p>
+
+<p>This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C,
+reflects that ERCIM is now a host of the W3C, includes references to this
+specific dated version of the license, and removes the ambiguous grant of
+"use". Otherwise, this version is the same as the <a
+href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">previous
+version</a> and is written so as to preserve the <a
+href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">Free
+Software Foundation's assessment of GPL compatibility</a> and <a
+href="http://www.opensource.org/licenses/W3C.php">OSI's certification</a>
+under the <a href="http://www.opensource.org/docs/definition.php">Open Source
+Definition</a>. Please see our <a
+href="http://www.w3.org/Consortium/Legal/IPR-FAQ">Copyright FAQ</a> for
+common questions about using materials from our site, including specific
+terms and conditions for packages like libwww, Amaya, and Jigsaw. Other
+questions about this notice can be directed to <a
+href="mailto:site-policy@w3.org">site-policy@w3.org</a>.<br />
+ </p>
+<address>
+ Joseph Reagle <<a
+ href="mailto:site-policy@w3.org">site-policy@w3.org></a>
+</address>
+
+<p>Last revised by Reagle $Date$</p>
+</body>
+</html>
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java
new file mode 100644
index 0000000..ca119c4
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java
@@ -0,0 +1,3312 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.common.XMLChar;
+import org.apache.xmlbeans.impl.common.GlobalLock;
+import org.apache.xmlbeans.impl.store.Root.ChangeListener;
+import org.apache.xmlbeans.impl.store.Saver.XmlInputStreamImpl;
+import org.apache.xmlbeans.impl.store.Splay.Annotation;
+import org.apache.xmlbeans.impl.store.Splay.Attr;
+import org.apache.xmlbeans.impl.store.Splay.Begin;
+import org.apache.xmlbeans.impl.store.Splay.Comment;
+import org.apache.xmlbeans.impl.store.Splay.CursorGoober;
+import org.apache.xmlbeans.impl.store.Splay.Goober;
+import org.apache.xmlbeans.impl.store.Splay.Procinst;
+import org.apache.xmlbeans.impl.store.Splay.Xmlns;
+import org.apache.xmlbeans.XmlCursor.ChangeStamp;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlDocumentProperties;
+import org.apache.xmlbeans.XmlRuntimeException;
+
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.File;
+import java.io.Writer;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.SAXException;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+public final class Cursor implements XmlCursor, ChangeListener
+{
+ Cursor ( Root r, Splay s ) { assert s != null; _data = CursorData.getOne( r ); set( s ); }
+ Cursor ( Root r, Splay s, int p ) { assert s != null; _data = CursorData.getOne( r ); set( s, p ); }
+
+ //
+ //
+ //
+
+ public Object monitor()
+ {
+ return getRoot();
+ }
+
+ Root getRoot ( ) { return _data._goober.getRoot(); }
+
+ Splay getSplay ( ) { return _data._goober.getSplay(); }
+ int getPos ( ) { return _data._goober.getPos(); }
+
+ void set ( Splay s, int p ) { _data._goober.set( s, p ); }
+ void set ( Splay s ) { _data._goober.set( s, 0 ); }
+ void set ( int p ) { _data._goober.set( p ); }
+ void set ( Goober g ) { _data._goober.set( g ); }
+
+ int getPostCch ( )
+ {
+ int p = getPos();
+
+ if (p == 0)
+ return 0;
+
+ Splay s = getSplay();
+
+ int pa = s.getPosAfter();
+
+ assert p >= pa || s.isLeaf();
+
+ return p >= pa ? s.getCchAfter() - p + pa : s.getPosLeafEnd() - p;
+ }
+
+ int getPreCch ( )
+ {
+ // TODO - quick and dirty impl, improve
+
+ Splay sOrig = getSplay();
+ int pOrig = getPos();
+
+ int n = toPrevChar( -1 );
+
+ set( sOrig, pOrig );
+
+ return n;
+ }
+
+ private void checkDisposed ( )
+ {
+ checkDisposed( this );
+ }
+
+ private static void checkDisposed ( Cursor c )
+ {
+ if (c.isDisposed())
+ throw new IllegalStateException( "Cursor has been disposed" );
+ }
+
+ boolean isDisposed ( )
+ {
+ return _data == null;
+ }
+
+ //
+ // XmlCursor Methods
+ //
+
+ public void dispose ( )
+ {
+ synchronized ( monitor() )
+ {
+ if (!isDisposed())
+ {
+ _data.release(true);
+ _data = null;
+ }
+ }
+ }
+
+ public XmlObject getObject ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Root r = getRoot();
+
+ if (getPos() > 0)
+ return null;
+
+ Splay s = getSplay();
+
+ if (!s.isTypeable())
+ return null;
+
+ Type t = s.getType( r );
+
+ assert t != null;
+
+ XmlObject result = t.getXmlObject();
+ assert result != null;
+ return result;
+ }
+ }
+
+ public boolean toCursor ( XmlCursor moveTo )
+ {
+ if (moveTo == null)
+ throw new IllegalArgumentException( "Invalid destination cursor" );
+
+ if (monitor() == moveTo.monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return toCursorImpl( moveTo );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (moveTo.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return toCursorImpl( moveTo );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private boolean toCursorImpl ( XmlCursor moveTo )
+ {
+ checkDisposed();
+
+ Cursor c = null;
+
+ if (moveTo instanceof Cursor)
+ {
+ c = (Cursor) moveTo;
+
+ checkDisposed( c );
+
+ if (c.getRoot() != getRoot())
+ c = null;
+ }
+
+ if (c == null)
+ return false;
+
+ set( c._data._goober );
+
+ return true;
+ }
+
+ public XmlDocumentProperties documentProperties ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return getRoot().documentProperties();
+ }
+ }
+
+ public XmlCursor newCursor ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+ return new Cursor( getRoot(), getSplay(), getPos() );
+ }
+ }
+
+ public boolean toBookmark ( XmlBookmark bm )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (bm == null)
+ return false;
+
+ if (!(bm._currentMark instanceof Annotation))
+ return false;
+
+ Annotation a = (Annotation) bm._currentMark;
+
+ if (a.getRoot() != getRoot())
+ return false;
+
+ assert a.getSplay() != null;
+
+ set( a );
+
+ return true;
+ }
+ }
+
+ public XmlBookmark toNextBookmark ( Object key )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (key == null)
+ return null;
+
+ Splay sOrig = getSplay();
+ int pOrig = getPos();
+
+ TokenType tt = currentTokenType();
+
+ // Advance the cursor past the current spot by the minimun amount
+
+ if (tt.isText())
+ {
+ toNextChar( 1 );
+ tt = currentTokenType();
+ }
+ else if ((tt = toNextToken()).isNone())
+ {
+ set( sOrig, pOrig );
+ return null;
+ }
+
+ for ( ; ; )
+ {
+ XmlBookmark bm = getBookmark( key );
+
+ if (bm != null)
+ return bm;
+
+ int postCch;
+
+ if (tt.isText() && (postCch = getPostCch()) > 1)
+ {
+ Splay s = getSplay();
+ int p = getPos();
+ int d = postCch;
+
+ for ( Goober g = s.firstGoober() ; g != null ;
+ g = s.nextGoober( g ) )
+ {
+ int dist;
+ XmlBookmark mark;
+
+ if (g.isAnnotation() && (dist = g.getPos() - p) > 1 &&
+ dist < d && (mark = g.getBookmark()) != null &&
+ mark.getKey().equals( key ))
+ {
+ bm = mark;
+ d = dist;
+ }
+ }
+
+ if (bm != null)
+ {
+ set( s, p + d );
+ return bm;
+ }
+ }
+
+ if ((tt = toNextToken()).isNone())
+ {
+ set( sOrig, pOrig );
+ return null;
+ }
+ }
+ }
+ }
+
+ public XmlBookmark toPrevBookmark ( Object key )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (key == null)
+ return null;
+
+ Splay sOrig = getSplay();
+ int pOrig = getPos();
+
+ TokenType tt = prevTokenType();
+
+ // Retreat the cursor past the current spot by the minimun amount
+
+ if (tt.isText())
+ {
+ toPrevChar( 1 );
+ tt = prevTokenType();
+ }
+ else if (toPrevToken().isNone())
+ {
+ set( sOrig, pOrig );
+ return null;
+ }
+ else
+ tt = prevTokenType();
+
+ for ( ; ; )
+ {
+ XmlBookmark bm = getBookmark( key );
+
+ if (bm != null)
+ return bm;
+
+ int preCch;
+
+ if (tt.isText() && (preCch = getPreCch()) > 1)
+ {
+ Splay s;
+ int p;
+
+ if (getPos() == 0)
+ {
+ s = getSplay().prevNonAttrSplay();
+ p = s.getEndPos();
+ }
+ else
+ {
+ s = getSplay();
+ p = getPos();
+ }
+
+ int d = preCch;
+
+ for ( Goober g = s.firstGoober() ; g != null ;
+ g = s.nextGoober( g ) )
+ {
+ int dist;
+ XmlBookmark mark;
+
+ if (g.isAnnotation() && (dist = p - g.getPos()) > 1 &&
+ dist < d && (mark = g.getBookmark()) != null &&
+ mark.getKey().equals( key ))
+ {
+ bm = mark;
+ d = dist;
+ }
+ }
+
+ if (bm != null)
+ {
+ set( s, p - d );
+ return bm;
+ }
+ }
+
+ if (tt.isText())
+ {
+ toPrevChar( -1 );
+ tt = prevTokenType();
+ }
+ else if (toPrevToken().isNone())
+ {
+ set( sOrig, pOrig );
+ return null;
+ }
+ else
+ tt = prevTokenType();
+ }
+ }
+ }
+
+ public TokenType currentTokenType ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return getSplay().getTokenType( getPos() );
+ }
+ }
+
+ public boolean isStartdoc ( ) { return currentTokenType().isStartdoc(); }
+ public boolean isEnddoc ( ) { return currentTokenType().isEnddoc(); }
+ public boolean isStart ( ) { return currentTokenType().isStart(); }
+ public boolean isEnd ( ) { return currentTokenType().isEnd(); }
+ public boolean isText ( ) { return currentTokenType().isText(); }
+ public boolean isAttr ( ) { return currentTokenType().isAttr(); }
+ public boolean isNamespace ( ) { return currentTokenType().isNamespace(); }
+ public boolean isComment ( ) { return currentTokenType().isComment(); }
+ public boolean isProcinst ( ) { return currentTokenType().isProcinst(); }
+ public boolean isContainer ( ) { return currentTokenType().isContainer(); }
+ public boolean isFinish ( ) { return currentTokenType().isFinish(); }
+ public boolean isAnyAttr ( ) { return currentTokenType().isAnyAttr(); }
+
+ public TokenType prevTokenType ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ // TODO - quick and dirty implementation, improve
+
+ Splay sOrig = getSplay();
+ int pOrig = getPos();
+
+ TokenType tt;
+
+ if (toPrevChar( 1 ) == 1)
+ tt = TokenType.TEXT;
+ else if (!(tt = toPrevToken()).isNone())
+ tt = currentTokenType();
+
+ set( sOrig, pOrig );
+
+ return tt;
+ }
+ }
+
+ public TokenType toNextToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay os = getSplay(); // Orignal splay
+ Splay s = os;
+ int p = getPos();
+
+ if (p == 0)
+ {
+ if (s.isRoot())
+ return TokenType.NONE;
+
+ //
+ // Look see if there is an attr we should visit before visiting
+ // any following content in this container.
+ //
+
+ if (s.isContainer())
+ {
+ Splay t = s.nextSplay();
+
+ if (t.isAttr())
+ {
+ set( t, 0 );
+ return currentTokenType();
+ }
+
+ //
+ // Now we're going into the content of this container. Flush
+ // out any cached type value.
+ //
+
+ s.ensureContentValid();
+ }
+
+ if (s.getMaxPos() > 0)
+ p = 1;
+ else
+ {
+ s = s.nextSplay();
+ p = 0;
+ }
+ }
+ else
+ {
+ assert p > 0;
+ assert !s.isRoot();
+
+ if (p >= s.getPosAfter() && s.getCchAfter() > 0)
+ {
+ s = s.nextSplay();
+ p = 0;
+ }
+ else
+ {
+ assert s.isLeaf();
+ assert p < s.getPosAfter();
+
+ if (p != s.getPosLeafEnd())
+ p = s.getPosLeafEnd();
+ else if (s.getCchAfter() > 0)
+ p = s.getPosAfter();
+ else
+ {
+ s = s.nextSplay();
+ p = 0;
+ }
+ }
+ }
+
+ //
+ // If we are transitioning from an attr to a non attr, see if there
+ // is content in a DOC or BEGIN which needs to be visited after
+ // the attributes.
+ //
+ // Also, if we are transitioning from an attr container (BEGIN or
+ // DOC) to an attr, where the attr container has interior content,
+ // we have already visited the attrs and must skip them now.
+ //
+ // Also, if we are transitioning from pos 0 to pos 1 on an attr
+ // container, we need to visit any attributes before visiting the
+ // interior content of the attr container.
+ //
+
+ if (p == 0)
+ {
+ if (!s.isAttr() && os.isAttr())
+ {
+ Splay t = os.prevNonAttrSplay();
+
+ assert t.isContainer();
+
+ //
+ // We're navigating to the content of a container. Flush
+ // out any cached type value.
+ //
+
+ t.ensureContentValid();
+
+ if (t.getMaxPos() > 0)
+ {
+ s = t;
+ p = 1;
+ }
+ }
+ else if (s.isAttr() && !os.isAttr() && os.getMaxPos() > 0)
+ {
+ assert os.isContainer();
+
+ s = s.nextNonAttrSplay();
+ }
+ }
+
+ set( s, p );
+
+ return currentTokenType();
+ }
+ }
+
+ public TokenType toPrevToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ // TODO - This code is not as compact as it can be, there is some redundancy
+ // -- rethink it later ...
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p == 1 && s.isInvalid())
+ {
+ assert s.isLeaf();
+ p += s.ensureContentValid();
+ }
+
+ if (p == 1 && s.isContainer())
+ {
+ Splay t = s.nextSplay();
+
+ if (t.isAttr())
+ {
+ s = t;
+
+ for ( t = t.nextSplay() ; t.isAttr() ; t = t.nextSplay() )
+ s = t;
+
+ set( s, 0 );
+
+ return currentTokenType();
+ }
+ }
+
+ if (p == 0 && !s.isAttr())
+ {
+ if (s.isDoc())
+ return TokenType.NONE;
+
+ Splay t = s.prevSplay();
+
+ if (t.isAttr())
+ {
+ t = t.prevNonAttrSplay();
+
+ assert t.isContainer();
+
+ if (t.isDoc())
+ t.ensureContentValid();
+
+ if (t.getMaxPos() > 0)
+ {
+ set(
+ t,
+ t.getCchAfter() > 0 ? t.getPosAfter() : t.getMaxPos() );
+
+ return currentTokenType();
+ }
+ }
+ }
+
+ if (s.isAttr())
+ {
+ assert p == 0;
+
+ Splay t = s.prevSplay();
+
+ if (!t.isAttr())
+ {
+ assert t.isContainer();
+
+ set( t, 0 );
+ return currentTokenType();
+ }
+ }
+
+ if (p == 0)
+ {
+ if (s.isDoc())
+ return TokenType.NONE;
+
+ s = s.prevSplay();
+
+ if (s.isDoc())
+ s.ensureContentValid();
+
+ p = s.getCchAfter() > 0 ? s.getPosAfter() : s.getMaxPos();
+ }
+ else
+ {
+ assert p > 0;
+ assert !s.isRoot();
+
+ int posAfter = s.getPosAfter();
+
+ if (p >= posAfter)
+ {
+ assert s.getCchAfter() > 0;
+ p = posAfter - 1;
+ }
+ else
+ {
+ assert s.isValid();
+ assert s.isLeaf();
+
+ p = p > 1 && p == posAfter - 1 ? 1 : 0;
+ }
+ }
+
+ set( s, p );
+
+ return currentTokenType();
+ }
+ }
+
+ public void insertChars ( String text )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p == 0)
+ {
+ if (s.isDoc() || s.isAttr())
+ throw new IllegalStateException( "Invalid location for text" );
+
+ s = s.prevNonAttrSplay();
+ p = s.getEndPos();
+ }
+
+ if (text == null)
+ return;
+
+ int cch = text.length();
+
+ if (cch > 0)
+ s.insertChars( p, getRoot(), text, 0, cch );
+ }
+ }
+
+ private static void validateLocalName ( QName name )
+ {
+ if (name == null)
+ throw new IllegalArgumentException( "QName is null" );
+
+ validateLocalName( name.getLocalPart() );
+ }
+
+ private static void validateLocalName ( String name )
+ {
+ if (name == null)
+ throw new IllegalArgumentException( "Name is null" );
+
+ if (name.length() == 0)
+ throw new IllegalArgumentException( "Name is empty" );
+
+ if (!XMLChar.isValidNCName( name ))
+ throw new IllegalArgumentException( "Name is not valid" );
+ }
+
+ private static void validatePrefix ( String name )
+ {
+ if (name == null)
+ throw new IllegalArgumentException( "Prefix is null" );
+
+ if (name.length() == 0)
+ throw new IllegalArgumentException( "Prefix is empty" );
+
+ if (Splay.beginsWithXml( name ))
+ throw new IllegalArgumentException( "Prefix begins with 'xml'" );
+
+ if (!XMLChar.isValidNCName( name ))
+ throw new IllegalArgumentException( "Prefix is not valid" );
+ }
+
+ private void insertAttribute ( QName name, String value )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ insert( new Attr( name ), value );
+ }
+ }
+
+ public void insertAttribute ( String name )
+ {
+ insertAttributeWithValue( name, null, null );
+ }
+
+ public void insertAttribute ( String name, String uri )
+ {
+ insertAttributeWithValue( name, uri, null );
+ }
+
+ public void insertAttributeWithValue ( String name, String value )
+ {
+ insertAttributeWithValue( name, null, value );
+ }
+
+ public void insertAttributeWithValue (
+ String name, String uri, String value )
+ {
+ validateLocalName( name );
+
+ insertAttribute( new QName( uri, name ), value );
+ }
+
+ public void insertAttribute ( QName name )
+ {
+ validateLocalName( name );
+
+ insertAttribute( name, null );
+ }
+
+ public void insertAttributeWithValue ( QName name, String value )
+ {
+ validateLocalName( name );
+
+ insertAttribute( name, value );
+ }
+
+ public void insertNamespace ( String prefix, String namespace )
+ {
+ synchronized ( monitor() )
+ {
+ if (prefix == null)
+ prefix = "";
+ else if (prefix.length() > 0)
+ validatePrefix( prefix );
+
+ if (namespace == null)
+ namespace = "";
+
+ if (namespace.length() == 0 && prefix.length() > 0)
+ {
+ throw
+ new IllegalArgumentException(
+ "Can't map a prefix to no namespace" );
+ }
+
+ insert( new Xmlns( new QName( namespace, prefix ) ), null );
+ }
+ }
+
+ public void insertComment ( String value )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ insert( new Comment(), value );
+ }
+ }
+
+ public void insertProcInst ( String target, String value )
+ {
+ validateLocalName( target ); // used becuase "<?xml...?> is disallowed
+
+ if (Splay.beginsWithXml( target ) && target.length() == 3)
+ throw new IllegalArgumentException( "Target begins with 'xml'" );
+
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ insert( new Procinst( target ), value );
+ }
+ }
+
+ public void insertElement ( String name )
+ {
+ insertElementWithText( name, null, null );
+ }
+
+ public void insertElementWithText ( String name, String text )
+ {
+ insertElementWithText( name, null, text );
+ }
+
+ public void insertElement ( String name, String uri )
+ {
+ insertElementWithText( name, uri, null );
+ }
+
+ public void insertElement ( QName name )
+ {
+ insertElementWithText( name, null );
+ }
+
+ public void beginElement ( QName name )
+ {
+ insertElement( name );
+ toPrevToken();
+ }
+
+ public void beginElement ( String name )
+ {
+ insertElement( name );
+ toPrevToken();
+ }
+
+ public void beginElement ( String name, String uri )
+ {
+ insertElement( name, uri );
+ toPrevToken();
+ }
+
+ public void insertElementWithText ( QName name, String text )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ validateLocalName( name.getLocalPart() );
+
+ Begin b = new Begin( name, null );
+
+ b.toggleIsLeaf();
+
+ insert( b, text );
+ }
+ }
+
+ public void insertElementWithText ( String name, String uri, String text )
+ {
+ insertElementWithText( new QName( uri, name ), text );
+ }
+
+ void insert ( Splay sInsert, String value )
+ {
+ assert !isDisposed();
+ assert Root.dv > 0 || sInsert.getRootSlow() == null;
+ assert sInsert.getCch() == 0;
+
+ if (value != null)
+ sInsert.adjustCch( value.length() );
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ sInsert.checkInsertionValidity( 0, s, p, false );
+
+ if (value != null)
+ s.insert( getRoot(), p, sInsert, value, 0, value.length(), true );
+ else
+ s.insert( getRoot(), p, sInsert, null, 0, 0, true );
+
+ assert validate();
+ }
+
+ public String getTextValue ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || s.isFinish() || s.isXmlns())
+ {
+ throw new IllegalStateException(
+ "Can't get text value, current token can have no text value" );
+ }
+
+ return getSplay().getText( getRoot() );
+ }
+ }
+
+ public int getTextValue ( char[] buf, int off, int cch )
+ {
+// synchronized ( monitor() )
+// {
+// checkDisposed();
+//
+// Splay s = getSplay();
+//
+// if (getPos() > 0 || s.isFinish() || s.isXmlns())
+// {
+// throw new IllegalStateException(
+// "Can't get text value, current token can have no text value" );
+// }
+//
+// return getSplay().getText( getRoot() );
+// }
+
+ // Hack impl for now
+
+ String s = getTextValue();
+
+ int n = s.length();
+
+ if (n > cch)
+ n = cch;
+
+ if (n <= 0)
+ return 0;
+
+ s.getChars( 0, n, buf, off );
+
+ return n;
+ }
+
+ public void setTextValue ( String text )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p > 0 || s.isXmlns() || s.isFinish())
+ {
+ throw new IllegalStateException(
+ "Can't set text value, current token can have no text value" );
+ }
+
+
+ s.setText( getRoot(), text, 0, text == null ? 0 : text.length() );
+ }
+ }
+
+ public void setTextValue ( char[] buf, int off, int len )
+ {
+ setTextValue( String.copyValueOf( buf, off, len ) );
+ }
+
+ public String getChars ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ int cch = -1;
+
+ int postCch = getPostCch();
+
+ if (cch < 0 || cch > postCch)
+ cch = postCch;
+
+ return
+ getRoot()._text.fetch(
+ getSplay().getCpForPos( getRoot(), getPos() ), cch );
+ }
+ }
+
+ public int getChars ( char[] buf, int off, int cch )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ int postCch = getPostCch();
+
+ if (cch < 0 || cch > postCch)
+ cch = postCch;
+
+ if (buf == null || off >= buf.length)
+ return 0;
+
+ if (buf.length - off < cch)
+ cch = buf.length - off;
+
+ getRoot()._text.fetch(
+ buf, off, getSplay().getCpForPos( getRoot(), getPos() ), cch );
+
+ return cch;
+ }
+ }
+
+ public void setBookmark ( XmlBookmark annotation )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (annotation == null)
+ return;
+
+ clearBookmark( annotation.getKey() );
+
+ Annotation a = new Annotation( getRoot(), annotation );
+
+ if (a._key == null)
+ throw new IllegalArgumentException( "Annotation key is null" );
+
+ a.set( _data._goober );
+ annotation._currentMark = a;
+ }
+ }
+
+ public XmlBookmark getBookmark ( Object key )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (key == null)
+ return null;
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
+ {
+ if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
+ {
+ Annotation a = (Annotation) g;
+
+ XmlBookmark xa = a.getXmlBookmark();
+
+ if (xa != null && a._key.equals( key ))
+ return xa;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public void clearBookmark ( Object key )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (key == null)
+ return;
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
+ {
+ if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
+ {
+ Annotation a = (Annotation) g;
+
+ XmlBookmark xa = a.getXmlBookmark();
+
+ if (xa != null && a._key.equals( key ))
+ {
+ g.set( null, 0 );
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public void getAllBookmarkRefs ( Collection listToFill )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (listToFill == null)
+ return;
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
+ {
+ if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
+ listToFill.add( ((Annotation) g).getXmlBookmark() );
+ }
+ }
+ }
+
+ public boolean hasNextToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ assert !getSplay().isRoot() || getPos() == 0;
+ return !getSplay().isRoot();
+ }
+ }
+
+ public boolean hasPrevToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return !getSplay().isDoc() || getPos() > 0;
+ }
+ }
+
+ public QName getName ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (getPos() > 0)
+ return null;
+
+ Splay s = getSplay();
+
+ switch ( s.getKind() )
+ {
+ case Splay.BEGIN :
+ case Splay.ATTR :
+ case Splay.PROCINST :
+ return s.getName();
+ }
+
+ return null;
+ }
+ }
+
+ public void setName ( QName name )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (name == null)
+ throw new IllegalArgumentException( "Name is null" );
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !(s.isBegin() || s.isAttr() || s.isProcinst()))
+ {
+ throw
+ new IllegalStateException(
+ "Can't set name here: " + currentTokenType() );
+ }
+
+ if (s.isProcinst())
+ {
+ validatePrefix( name.getLocalPart() );
+
+ if (name.getNamespaceURI().length() > 0)
+ {
+ throw
+ new IllegalArgumentException(
+ "Procinst name must have no URI" );
+ }
+ }
+ else if (s.isXmlns())
+ {
+ if (name.getLocalPart().length() > 0)
+ validatePrefix( name.getLocalPart() );
+ }
+ else
+ validateLocalName( name.getLocalPart() );
+
+ s.setName( getRoot(), name );
+ }
+ }
+
+ public int toNextChar ( int cch )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ int maxCch = getPostCch();
+
+ if (maxCch == 0 || cch == 0)
+ return 0;
+
+ if (cch < 0 || cch > maxCch)
+ cch = maxCch;
+
+ assert p + cch <= s.getEndPos();
+
+ if (p + cch == s.getEndPos())
+ toNextToken();
+ else
+ set( p + cch );
+
+ return cch;
+ }
+ }
+
+ public int toPrevChar ( int cch )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ Splay sText = s; // The splay and pos where the text exists
+ int pText = p;
+ int maxCch = 0; // Max chars to move over
+
+ if (p == 0)
+ {
+ if (!s.isDoc() && !s.isAttr())
+ {
+ sText = s.prevNonAttrSplay();
+ pText = sText.getEndPos();
+ maxCch = sText.getCchAfter();
+ }
+ }
+ else if (s.isLeaf() && p <= s.getPosLeafEnd())
+ {
+ int dCch = s.ensureContentValid();
+ p += dCch;
+ pText = p;
+ maxCch = p - 1;
+ }
+ else
+ maxCch = p - s.getPosAfter();
+
+ assert pText <= sText.getEndPos();
+
+ if (maxCch == 0 || cch == 0)
+ return 0;
+
+ if (cch < 0 || cch > maxCch)
+ cch = maxCch;
+
+ set( sText, pText - cch );
+
+ return cch;
+ }
+ }
+
+ public void toEndDoc ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ set( getRoot(), 0 );
+ }
+ }
+
+ public void toStartDoc ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ set( getRoot()._doc, 0 );
+ }
+ }
+
+ public TokenType toFirstContentToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !s.isContainer())
+ return TokenType.NONE;
+
+ s.ensureContentValid();
+
+ if (s.getCch() > 0 || s.isLeaf())
+ set( 1 );
+ else
+ set( s.nextNonAttrSplay(), 0 );
+
+ return currentTokenType();
+ }
+ }
+
+ public TokenType toEndToken ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !s.isContainer())
+ return TokenType.NONE;
+
+ if (s.isLeaf())
+ set( s.getPosLeafEnd() );
+ else
+ set( s.getFinishSplay() );
+
+ return currentTokenType();
+ }
+ }
+
+ public boolean toParent ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p == 0 && s.isDoc())
+ return false;
+
+ set( s.getContainer( p ), 0 );
+
+ return true;
+ }
+ }
+
+ public boolean toNextSibling ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p == 0)
+ {
+ if (s.isDoc())
+ return false;
+
+ if (s.isBegin())
+ s = s.getFinishSplay().nextSplay();
+ }
+ else
+ {
+ if (s.isLeaf() && p <= s.getPosLeafEnd())
+ return false;
+
+ s = s.nextSplay();
+ }
+
+ for ( ; !s.isBegin() ; s = s.nextSplay() )
+ {
+ if (s.isFinish())
+ return false;
+ }
+
+ set( s, 0 );
+
+ return true;
+ }
+ }
+
+ public boolean toNextSibling ( String name )
+ {
+ return toNextSibling( new QName( name ) );
+ }
+
+ public boolean toNextSibling ( String namespace, String name )
+ {
+ return toNextSibling( new QName( namespace, name ) );
+ }
+
+ public boolean toNextSibling ( QName name )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay sOriginal = getSplay();
+ int pOriginal = getPos();
+
+ for ( ; ; )
+ {
+ if (!toNextSibling())
+ break;
+
+ if (getName().equals( name ))
+ return true;
+ }
+
+ set( sOriginal, pOriginal );
+
+ return false;
+ }
+ }
+
+ public boolean toPrevSibling ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (p == 0)
+ {
+ if (s.isDoc() || s.isAttr())
+ return false;
+
+ s = s.prevSplay();
+ }
+ else
+ {
+ assert p > 0;
+
+ if (s.isContainer())
+ {
+ if (s.isLeaf())
+ {
+ if (p <= s.getPosLeafEnd())
+ return false;
+
+ set( 0 );
+
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ for ( ; ; )
+ {
+ if (s.isEnd())
+ {
+ s = s.getContainer();
+ break;
+ }
+
+ if (s.isLeaf())
+ break;
+
+ if (s.isContainer())
+ return false;
+
+ s = s.prevSplay();
+ }
+
+ set( s, 0 );
+
+ return true;
+ }
+ }
+
+ private Splay getStart ( )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (!s.isContainer() || getPos() != 0)
+ {
+ push();
+
+ if (toNextSibling())
+ s = getSplay();
+ else
+ s = null;
+
+ pop();
+ }
+
+ return s;
+ }
+
+ public boolean toFirstChild ( )
+ {
+ return toChild( (QName) null );
+ }
+
+ public boolean toChild ( String name )
+ {
+ return toChild( new QName( name ) );
+ }
+
+ public boolean toChild ( String namespace, String name )
+ {
+ return toChild( new QName( namespace, name ) );
+ }
+
+ public boolean toChild ( QName name )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getRoot().findNthBegin( getStart(), name, null, 0 );
+
+ if (s == null)
+ return false;
+
+ set( s, 0 );
+
+ return true;
+ }
+ }
+
+ public boolean toChild ( int n )
+ {
+ return toChild( null, n );
+ }
+
+ public boolean toChild ( QName name, int n )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getRoot().findNthBegin( getStart(), name, null, n );
+
+ if (s == null)
+ return false;
+
+ set( s, 0 );
+
+ return true;
+ }
+ }
+
+ public boolean toLastChild ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay sOriginal = getSplay();
+ int pOriginal = getPos();
+
+ if (!sOriginal.isContainer() || pOriginal != 0)
+ {
+ if (!toNextSibling())
+ return false;
+ }
+
+ if (!toEndToken().isNone() && toPrevSibling())
+ return true;
+
+ set( sOriginal, pOriginal );
+
+ return false;
+ }
+ }
+
+ public boolean toFirstAttribute ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay sOriginal = getSplay();
+ int pOriginal = getPos();
+
+ if (!sOriginal.isContainer() || pOriginal != 0)
+ return false;
+
+ for ( Splay s = sOriginal.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr())
+ {
+ set( s, 0 );
+ return true;
+ }
+ }
+
+ set( sOriginal, pOriginal );
+ return false;
+ }
+ }
+
+ public boolean toLastAttribute ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay sOriginal = getSplay();
+ int pOriginal = getPos();
+
+ if (!sOriginal.isContainer() || pOriginal != 0)
+ return false;
+
+ Splay lastNormalAttr = null;
+
+ for ( Splay s = sOriginal.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr())
+ lastNormalAttr = s;
+ }
+
+ if (lastNormalAttr != null)
+ {
+ set( lastNormalAttr, 0 );
+ return true;
+ }
+
+ set( sOriginal, pOriginal );
+ return false;
+ }
+ }
+
+ public boolean toNextAttribute ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (!s.isAttr())
+ return false;
+
+ for ( s = s.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr())
+ {
+ set( s, 0 );
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public boolean toPrevAttribute ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (!s.isAttr())
+ return false;
+
+ for ( s = s.prevSplay() ; s.isAttr() ; s = s.prevSplay() )
+ {
+ if (s.isNormalAttr())
+ {
+ set( s, 0 );
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public String getAttributeText ( QName attrName )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (attrName == null)
+ throw new IllegalArgumentException( "Attr name is null" );
+
+ if (getPos() > 0)
+ return null;
+
+ Splay s = getSplay().getAttr( attrName );
+
+ return s == null ? null : s.getText( getRoot() );
+ }
+ }
+
+ public boolean setAttributeText ( QName attrName, String value )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (attrName == null)
+ throw new IllegalArgumentException( "Attr name is null" );
+
+ validateLocalName( attrName.getLocalPart() );
+
+ if (getPos() > 0)
+ return false;
+
+ Splay s = getSplay();
+
+ if (!s.isContainer())
+ return false;
+
+ if (value == null)
+ value = "";
+
+ s = getSplay().getAttr( attrName );
+
+ if (s == null)
+ {
+ XmlCursor c = newCursor();
+
+ try
+ {
+ // Insert the new attr at the end
+
+ do {
+ c.toNextToken();
+ } while ( c.isAnyAttr() );
+
+ c.insertAttributeWithValue( attrName, value );
+ }
+ finally
+ {
+ c.dispose();
+ }
+ }
+ else
+ s.setText( getRoot(), value, 0, value.length() );
+
+ return true;
+ }
+ }
+
+ public boolean removeAttribute ( QName attrName )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (attrName == null)
+ throw new IllegalArgumentException( "Attr name is null" );
+
+ if (getPos() > 0)
+ return false;
+
+ boolean removed = false;
+
+ for ( ; ; )
+ {
+ Splay s = getSplay().getAttr( attrName );
+
+ if (s == null)
+ break;
+
+ s.remove( getRoot(), true );
+
+ removed = true;
+ }
+
+ return removed;
+ }
+ }
+
+ public int removeChars ( int cch )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ int postCch = getPostCch();
+
+ if (postCch == 0 || cch == 0)
+ return 0;
+
+ if (cch < 0 || cch > postCch)
+ cch = postCch;
+
+ return getSplay().removeChars( getRoot(), getPos(), cch );
+ }
+ }
+
+ public int moveChars ( int cch, XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (monitor() == dst.monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return moveCharsImpl( cch, dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return moveCharsImpl( cch, dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private int moveCharsImpl ( int cch, XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (dst == null || !(dst instanceof Cursor))
+ throw new IllegalArgumentException( "Invalid destination cursor" );
+
+ Cursor cDst = (Cursor) dst;
+
+ checkDisposed( cDst );
+
+ Root rDst = cDst.getRoot();
+ Splay sDst = cDst.getSplay();
+ int pDst = cDst.getPos();
+
+ if (pDst == 0 && (sDst.isDoc() || sDst.isAttr()))
+ throw new IllegalArgumentException( "Invalid destination" );
+
+ return
+ getSplay().moveChars(
+ getRoot(), getPos(), cch, rDst, sDst, pDst, false );
+ }
+
+ public int copyChars ( int cch, XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (dst.monitor() == monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return copyCharsImpl( cch, dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return copyCharsImpl( cch, dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private int copyCharsImpl ( int cch, XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (dst == null || !(dst instanceof Cursor))
+ throw new IllegalArgumentException( "Invalid destination cursor" );
+
+ Cursor cDst = (Cursor) dst;
+
+ checkDisposed( cDst );
+
+ Root rDst = cDst.getRoot();
+ Splay sDst = cDst.getSplay();
+ int pDst = cDst.getPos();
+
+ if (pDst == 0)
+ {
+ if (sDst.isDoc() || sDst.isAttr())
+ throw new IllegalArgumentException( "Invalid destination" );
+
+ sDst = sDst.prevNonAttrSplay();
+ pDst = sDst.getEndPos();
+ }
+
+ return
+ getSplay().copyChars( getRoot(), getPos(), cch, rDst, sDst, pDst );
+ }
+
+ public String namespaceForPrefix ( String prefix )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !s.isContainer())
+ throw new IllegalStateException( "Not on a container" );
+
+ return s.namespaceForPrefix( prefix, true );
+ }
+ }
+
+ public String prefixForNamespace ( String ns )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (ns == null || ns.length() == 0)
+ throw new IllegalArgumentException( "Must specify a namespace" );
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !s.isContainer())
+ throw new IllegalStateException( "Not on a container" );
+
+ String result = s.prefixForNamespace( getRoot(), ns, null, true);
+
+ assert result != null;
+
+ return result;
+ }
+ }
+
+ public void getAllNamespaces ( Map addToThis )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+
+ if (getPos() > 0 || !s.isContainer())
+ throw new IllegalStateException( "Not on a container" );
+
+ // Do this with cursor for now...
+
+ XmlCursor c = newCursor();
+
+ do
+ {
+ assert c.isContainer();
+
+ QName cName = c.getName();
+
+ while ( !c.toNextToken().isNone() && c.isAnyAttr() )
+ {
+ if (c.isNamespace())
+ {
+ String prefix = c.getName().getLocalPart();
+ String uri = c.getName().getNamespaceURI();
+
+ // Here I check to see if there is a default namespace
+ // mapping which is not empty on a non root container which
+ // is in a namespace. This this case, I do not want to add
+ // this mapping because it could not be persisted out this
+ // way.
+
+ if (prefix.length() == 0 && uri.length() > 0 &&
+ cName != null && cName.getNamespaceURI().length()>0)
+ {
+ continue;
+ }
+
+ if (!addToThis.containsKey( prefix ))
+ addToThis.put( prefix, uri );
+ }
+ }
+
+ c.toParent();
+ }
+ while ( c.toParent() );
+
+ c.dispose();
+ }
+ }
+
+ /**
+ * Returns:
+ *
+ * -1 is this is left of that
+ * 0 is this is left is at same position as that
+ * 1 is this is right of that
+ */
+
+ public int comparePosition ( XmlCursor xthat )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (xthat == null || !(xthat instanceof Cursor))
+ throw new IllegalArgumentException( "Invalid that cursor" );
+
+ Cursor that = (Cursor) xthat;
+
+ Root r = getRoot();
+
+ if (r != that.getRoot())
+ throw new IllegalArgumentException( "Cursors not in same document" );
+
+ checkDisposed( that );
+
+ return
+ getSplay().compare( r, getPos(), that.getSplay(), that.getPos() );
+ }
+ }
+
+ public boolean isLeftOf ( XmlCursor that )
+ {
+ return comparePosition( that ) < 0;
+ }
+
+ public boolean isAtSamePositionAs ( XmlCursor that )
+ {
+ return comparePosition( that ) == 0;
+ }
+
+ public boolean isRightOf ( XmlCursor that )
+ {
+ return comparePosition( that ) > 0;
+ }
+
+ public InputStream newInputStream ( XmlOptions options )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return
+ new Saver.InputStreamSaver(
+ getRoot(), getSplay(), getPos(), options );
+ }
+ }
+
+ public InputStream newInputStream ( )
+ {
+ return newInputStream( null );
+ }
+
+ public Reader newReader ( )
+ {
+ return newReader( null );
+ }
+
+ public Reader newReader ( XmlOptions options )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return new Saver.TextReader( getRoot(), getSplay(), getPos(), options );
+ }
+ }
+
+ public XMLInputStream newXMLInputStream ( XmlOptions options )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return
+ new XmlInputStreamImpl( getRoot(), getSplay(), getPos(), options );
+ }
+ }
+
+ public XMLInputStream newXMLInputStream ( )
+ {
+ return newXMLInputStream( null );
+ }
+
+ private static final XmlOptions _toStringOptions =
+ buildPrettyOptions();
+
+ static final XmlOptions buildPrettyOptions ( )
+ {
+ XmlOptions options = new XmlOptions();
+ options.put( XmlOptions.SAVE_PRETTY_PRINT );
+ options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
+ options.put( XmlOptions.SAVE_USE_DEFAULT_NAMESPACE );
+ return options;
+ }
+
+ public String toString ( )
+ {
+ return xmlText( _toStringOptions );
+ }
+
+ public String xmlText ( )
+ {
+ return xmlText( null );
+ }
+
+ public String xmlText ( XmlOptions options )
+ {
+ Saver.TextSaver saver;
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ saver = new Saver.TextSaver(
+ getRoot(), getSplay(), getPos(), options, null );
+ }
+ return saver.saveToString();
+ }
+
+ static class ChangeStampImpl implements ChangeStamp
+ {
+ ChangeStampImpl ( Root r )
+ {
+ _root = r;
+ _versionStamp = _root.getVersion();
+ }
+
+ public boolean hasChanged ( )
+ {
+ return _versionStamp != _root.getVersion();
+ }
+
+ private final Root _root;
+ private final long _versionStamp;
+ }
+
+ public ChangeStamp getDocChangeStamp ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return new ChangeStampImpl( getRoot() );
+ }
+ }
+
+ public boolean removeXml ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ assert p < s.getEndPos();
+
+ if (p > 0)
+ {
+ if (s.isLeaf() && p == s.getPosLeafEnd())
+ return false;
+
+ int cchRemove = removeChars( getPostCch() );
+
+ assert cchRemove > 0;
+
+ return true;
+ }
+ else if (s.isDoc())
+ {
+ throw
+ new IllegalStateException(
+ "Can't remove a whole document." );
+ }
+ else if (s.isFinish())
+ return false;
+
+ s.remove( getRoot(), true );
+
+ return true;
+ }
+ }
+
+ public boolean moveXml ( XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (dst.monitor() == monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return moveXmlImpl( dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return moveXmlImpl ( dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private boolean moveXmlImpl ( XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (dst == null || !(dst instanceof Cursor))
+ {
+ throw
+ new IllegalArgumentException(
+ "Can't move to a foreign document" );
+ }
+
+ Cursor cDst = (Cursor) dst;
+
+ checkDisposed( cDst );
+
+ Root rDst = cDst.getRoot();
+ Splay sDst = cDst.getSplay();
+ int pDst = cDst.getPos();
+
+ Root rSrc = getRoot();
+ Splay sSrc = getSplay();
+ int pSrc = getPos();
+
+ if (sSrc.checkInsertionValidity( pSrc, sDst, pDst, true ))
+ {
+ return
+ sSrc.moveChars(
+ rSrc, pSrc, getPostCch(), rDst, sDst, pDst, false ) > 0;
+ }
+
+ assert pSrc == 0;
+
+ // Check for a movement of stuff into itself! This case is basically
+ // a no-op
+
+ if (rSrc == rDst && sDst.between( rDst, pDst, sSrc ))
+ {
+// TODO - I might have to orphan types in the range here ....
+ return false;
+ }
+
+ assert pSrc == 0;
+
+ sSrc.move( rSrc, cDst.getRoot(), cDst.getSplay(), cDst.getPos(), true );
+
+ return true;
+ }
+
+ public boolean copyXml ( XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (dst.monitor() == monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return copyXmlImpl( dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return copyXmlImpl( dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private boolean copyXmlImpl ( XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (dst == null || !(dst instanceof Cursor))
+ {
+ throw
+ new IllegalArgumentException( "Can't copy to a foreign document" );
+ }
+
+ Cursor cDst = (Cursor) dst;
+
+ checkDisposed( cDst );
+
+ Splay sDst = cDst.getSplay();
+ int pDst = cDst.getPos();
+
+ Splay s = getSplay();
+ int p = getPos();
+
+ if (s.checkInsertionValidity( p, sDst, pDst, true ))
+ return copyCharsImpl( getPostCch(), dst ) > 0;
+
+ assert p == 0;
+
+ // Need to make a splay copy before getting the text because the copy
+ // will validate invalid contents/values
+
+ Root r = getRoot();
+ Root rDst = cDst.getRoot();
+
+ Splay copy = s.copySplay();
+
+ Object txt = r._text;
+ int cp = r.getCp( s );
+ int cch = copy.getCchLeft() + copy.getCch();
+
+ //
+ // Remove text after which might be between leaf value and first attr value
+ //
+
+ if (s.isLeaf() && s.getCchAfter() > 0)
+ {
+ int cchValue = s.getCchValue();
+ int cchAfter = s.getCchAfter();
+
+ if (cchValue == 0)
+ cp += cchAfter;
+ else if (s.nextSplay().isAttr())
+ {
+ char[] buf = new char [ cch ];
+ r._text.fetch( buf, 0, cp, cchValue );
+ r._text.fetch( buf, cchValue, cp + cchValue + cchAfter, cch - cchValue );
+
+ txt = buf;
+ cp = 0;
+ }
+ }
+
+ sDst.insert( rDst, pDst, copy, txt, cp, cch, true );
+
+ return true;
+ }
+
+ public boolean removeXmlContents ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ // TODO - should implement this with internals
+
+ if (!isContainer())
+ return false;
+
+ TokenType tt = toFirstContentToken();
+ assert !tt.isNone();
+
+ boolean removed = !isFinish();
+
+ try
+ {
+ while ( !isFinish() )
+ {
+ boolean b = removeXml();
+ assert b;
+ }
+ }
+ finally
+ {
+ toParent();
+ }
+
+ return removed;
+ }
+ }
+
+ private boolean contains ( XmlCursor dst )
+ {
+ if (isInSameDocument( dst ))
+ {
+ dst.push();
+
+ for ( ; ; )
+ {
+ if (dst.isAtSamePositionAs( this ))
+ {
+ dst.pop();
+ return true;
+ }
+
+ if (!dst.toParent())
+ break;
+ }
+
+ dst.pop();
+ }
+
+ return false;
+ }
+
+ public boolean moveXmlContents ( XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (dst.monitor() == monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return moveXmlContentsImpl( dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return moveXmlContentsImpl( dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private boolean moveXmlContentsImpl ( XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (!isContainer())
+ return false;
+
+ // Check to see if dst is in src! In this case, there is nothing to
+ // do.
+
+ if (contains( dst ))
+ return false;
+
+ TokenType tt = toFirstContentToken();
+ assert !tt.isNone();
+
+ boolean moved = !isFinish();
+
+ try
+ {
+ if (!moveXmlImpl( dst ))
+ return false;
+
+ while ( !isFinish() )
+ {
+ boolean b = moveXmlImpl( dst );
+ assert b;
+ }
+ }
+ finally
+ {
+ toParent();
+ }
+
+ return moved;
+ }
+
+ public boolean copyXmlContents ( XmlCursor dst )
+ {
+ if (dst == null)
+ throw new IllegalArgumentException( "Destination is null" );
+
+ if (dst.monitor() == monitor())
+ {
+ synchronized ( monitor() )
+ {
+ return copyXmlContentsImpl( dst );
+ }
+ }
+ else
+ {
+ boolean acquired = false;
+ try
+ {
+ GlobalLock.acquire();
+ acquired = true;
+ synchronized ( monitor() )
+ {
+ synchronized (dst.monitor())
+ {
+ GlobalLock.release();
+ acquired = false;
+
+ return copyXmlContentsImpl( dst );
+ }
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new XmlRuntimeException(e.getMessage(), e);
+ }
+ finally
+ {
+ if (acquired)
+ GlobalLock.release();
+ }
+ }
+ }
+
+ private boolean copyXmlContentsImpl ( XmlCursor dst )
+ {
+ checkDisposed();
+
+ if (!isContainer())
+ return false;
+
+ // Check to see if dst is in src! In this case, copy the src to a new
+ // document and then move the copied contents to the destination.
+
+ if (contains( dst ))
+ {
+ XmlCursor cTmp = XmlObject.Factory.newInstance().newCursor();
+
+ cTmp.toNextToken();
+
+ if (!copyXmlContentsImpl( cTmp ))
+ {
+ cTmp.dispose();
+ return false;
+ }
+
+ cTmp.toStartDoc();
+ ((Cursor)cTmp).moveXmlContentsImpl( dst );
+ cTmp.dispose();
+ return true;
+ }
+
+ TokenType tt = toFirstContentToken();
+ assert !tt.isNone();
+
+ boolean copied = !isFinish();
+
+ try
+ {
+ if (!copyXmlImpl( dst ))
+ return false;
+
+ for ( ; ; )
+ {
+ if (isStart())
+ toEndToken();
+
+ toNextToken();
+
+ if (isFinish())
+ break;
+
+ boolean b = copyXmlImpl( dst );
+ assert b;
+ }
+ }
+ finally
+ {
+ toParent();
+ }
+
+ return copied;
+ }
+
+ public boolean isInSameDocument ( XmlCursor xthat )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (xthat == null || !(xthat instanceof Cursor))
+ return false;
+
+ Cursor that = (Cursor) xthat;
+
+ checkDisposed( that );
+
+ return getRoot() == that.getRoot();
+ }
+ }
+
+ public void push ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._stack == null)
+ _data._stack = new Selections();
+
+ _data._stack.add( getRoot(), getSplay(), getPos() );
+
+ getRoot().registerForChange( this );
+ }
+ }
+
+ public boolean pop ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._stack == null || _data._stack.size() == 0)
+ return false;
+
+ _data._stack.setCursor( this, _data._stack.size() - 1 );
+
+ _data._stack.pop();
+
+ return true;
+ }
+ }
+
+ public int getSelectionCount ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return _data._selections == null ? 0 : _data._selections.size();
+ }
+ }
+
+ public boolean toSelection ( int i )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._selections != null && i >= 0 && _data._selections.setCursor( this, i ))
+ {
+ _data._currentSelection = i;
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public boolean hasNextSelection ( )
+ {
+ synchronized ( monitor() )
+ {
+ push();
+ int currentSelection = _data._currentSelection;
+
+ try
+ {
+ return toNextSelection();
+ }
+ finally
+ {
+ pop();
+ _data._currentSelection = currentSelection;
+ }
+ }
+ }
+
+ public boolean toNextSelection ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._selections == null || _data._currentSelection < -1)
+ return false;
+
+ int nextSelection = _data._currentSelection + 1;
+
+ if (!_data._selections.setCursor( this, nextSelection ))
+ {
+ _data._currentSelection = -2;
+ return false;
+ }
+
+ _data._currentSelection = nextSelection;
+
+ return true;
+ }
+ }
+
+ public void clearSelections ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+ _data.clearSelections();
+ }
+ }
+
+ public void addToSelection ( )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._selections == null)
+ _data._selections = Path.newSelections();
+
+ // Force any selection engine to search all...
+ _data._selections.size();
+
+ _data._selections.add( getRoot(), getSplay(), getPos() );
+
+ getRoot().registerForChange( this );
+ }
+ }
+
+ public void changeNotification ( )
+ {
+ if (!isDisposed())
+ {
+ if (_data._selections != null)
+ {
+ _data._selections.size(); // Force a full selection
+ _data._selections.cursify( getRoot() );
+ }
+
+ if (_data._stack != null)
+ _data._stack.cursify( getRoot() );
+ }
+ }
+
+ public void selectPath ( String path, XmlOptions options )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ if (_data._selections == null)
+ _data._selections = Path.newSelections();
+ else
+ _data._selections.dispose();
+
+ _data._selections.init(
+ Path.select( getRoot(), getSplay(), getPos(), path, options ) );
+
+ push();
+
+ if (_data._selections.setCursor( this, 0 ))
+ {
+ getRoot().registerForChange( this );
+ _data._currentSelection = -1;
+ }
+ else
+ _data._currentSelection = -2;
+
+ pop();
+ }
+ }
+
+ public void selectPath ( String path )
+ {
+ selectPath( path, null );
+ }
+
+ public XmlCursor execQuery ( String queryExpr, XmlOptions options )
+ {
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ return Path.query( this, queryExpr, options );
+ }
+ }
+
+ public XmlCursor execQuery ( String query )
+ {
+ return execQuery( query, null );
+ }
+
+ public Node newDomNode ( )
+ {
+ return newDomNode( null );
+ }
+
+ public Node newDomNode ( XmlOptions options )
+ {
+ try
+ {
+ Saver.DomSaver saver;
+
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ saver = new Saver.DomSaver(
+ getRoot(), getSplay(), getPos(), !isFragment(), options );
+ }
+
+ return saver.exportDom();
+ }
+ catch ( Exception e )
+ {
+ if (e instanceof RuntimeException)
+ throw (RuntimeException) e;
+
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ private boolean isFragment()
+ {
+ if (! isStartdoc())
+ return true;
+
+ boolean seenElement = false;
+
+ XmlCursor c = newCursor();
+ int token = c.toNextToken().intValue();
+
+ try {
+
+ LOOP:
+ while (true)
+ {
+ SWITCH:
+ switch (token)
+ {
+ case TokenType.INT_START:
+ if (seenElement) return true;
+ seenElement = true;
+ token = c.toEndToken().intValue();
+ break SWITCH;
+
+ case TokenType.INT_TEXT:
+ if (! Splay.isWhiteSpace(c.getChars()))
+ return true;
+ token = c.toNextToken().intValue();
+ break SWITCH;
+
+
+ case TokenType.INT_NONE:
+ case TokenType.INT_ENDDOC:
+ break LOOP;
+
+
+ case TokenType.INT_ATTR:
+ case TokenType.INT_NAMESPACE:
+ return true;
+
+ case TokenType.INT_END:
+ case TokenType.INT_COMMENT:
+ case TokenType.INT_PROCINST:
+ token = c.toNextToken().intValue();
+ break SWITCH;
+
+ case TokenType.INT_STARTDOC:
+ assert false;
+ break LOOP;
+
+ }
+
+ }
+ }
+
+ finally {
+ c.dispose();
+ }
+
+ return ! seenElement;
+
+ }
+
+ public void save ( ContentHandler ch, LexicalHandler lh )
+ throws SAXException
+ {
+ save( ch, lh, null );
+ }
+
+ public void save ( File file ) throws IOException
+ {
+ save( file, null );
+ }
+
+ public void save ( OutputStream os ) throws IOException
+ {
+ save( os, null );
+ }
+
+ public void save ( Writer w ) throws IOException
+ {
+ save( w, null );
+ }
+
+ public void save ( ContentHandler ch, LexicalHandler lh, XmlOptions options)
+ throws SAXException
+ {
+ // todo: don't hold the monitor all this long.
+ // Ideally, we'd release the monitor each time we're about to call the
+ // ch or lh objects. However, the saver code isn't _quite_ structure
+ // just right to do that. So instead, the current version will hold
+ // the monitor for the duration of the entire SAX save.
+ synchronized ( monitor() )
+ {
+ checkDisposed();
+
+ new Saver.SaxSaver( getRoot(), getSplay(), getPos(), options, ch, lh );
+ }
+ }
+
+ public void save ( File file, XmlOptions options ) throws IOException
+ {
+ OutputStream os = new FileOutputStream( file );
+
+ try
+ {
+ save( os, options );
+ }
+ finally
+ {
+ os.close();
+ }
+ }
+
+ public void save ( OutputStream os, XmlOptions options ) throws IOException
+ {
+ // note that we do not hold the monitor for the duration of a save.
+ // Instead, a concurrent modification exception is thrown if the
+ // document is modified while the save is in progress. If the user
+ // wishes to protect against this, he can synchronize on the monitor
+ // himself.
+ InputStream is = newInputStream( options );
+
+ try
+ {
+ byte[] bytes = new byte[ 8192 ];
+
+ for ( ; ; )
+ {
+ int n = is.read( bytes );
+
+ if (n < 0)
+ break;
+
+ os.write( bytes, 0, n );
+ }
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+
+ public void save ( Writer w, XmlOptions options ) throws IOException
+ {
+ Reader r = newReader( options );
+
+ try
+ {
+ char[] chars = new char[ 8192 ];
+
+ for ( ; ; )
+ {
+ int n = r.read( chars );
+
+ if (n < 0)
+ break;
+
+ w.write( chars, 0, n );
+ }
+ }
+ finally
+ {
+ r.close();
+ }
+ }
+
+ //
+ //
+ //
+
+ private boolean validate ( )
+ {
+ assert _data._goober.getRoot().validate();
+ return true;
+ }
+
+ public void dump ( ) { _data._goober.getRoot().dump(); }
+ public void dump ( boolean verbose ) { _data._goober.getRoot().dump( verbose ); }
+
+ interface PathEngine
+ {
+ boolean next ( Selections selections );
+ }
+
+ static class Selections
+ {
+ void init ( PathEngine pathEngine )
+ {
+ dispose();
+
+ _pathEngine = pathEngine;
+ }
+
+ void add ( Root r, Splay s )
+ {
+ add( r, s, 0 );
+ }
+
+ void add ( Root r, Splay s, int p )
+ {
+ assert s.getRootSlow() == r;
+
+ if (_cursors != null)
+ {
+ CursorGoober g = new CursorGoober( r );
+
+ g.set( s, p );
+
+ _cursors.add( g );
+
+ return;
+ }
+
+ if (_splays == null)
+ {
+ assert _count == 0;
+ _splays = new Splay [ 16 ];
+ _positions = new int [ 16 ];
+ }
+ else if (_count == _splays.length)
+ {
+ Splay[] newSplays = new Splay [ _count * 2 ];
+ int[] newPositions = new int [ _count * 2 ];
+
+ System.arraycopy( _splays, 0, newSplays, 0, _count );
+ System.arraycopy( _positions, 0, newPositions, 0, _count );
+
+ _splays = newSplays;
+ _positions = newPositions;
+ }
+
+ _splays[ _count ] = s;
+ _positions[ _count ] = p;
+
+ _count++;
+ }
+
+ void pop ( )
+ {
+ assert size() > 0;
+
+ if (_cursors != null)
+ {
+ int i = _cursors.size() - 1;
+ ((CursorGoober) _cursors.get( i )).set( null, 0 );
+ _cursors.remove( i );
+ }
+ else
+ _count--;
+ }
+
+ void cursify ( Root r )
+ {
+ if (_cursors != null || _count <= 0)
+ return;
+
+ _cursors = new ArrayList();
+
+ for ( int i = 0 ; i < _count ; i++ )
+ {
+ CursorGoober g = new CursorGoober( r );
+
+ g.set( _splays[ i ], _positions[ i ] );
+
+ _cursors.add( g );
+ }
+
+ _count = 0;
+ }
+
+ int size ( )
+ {
+ if (_pathEngine != null)
+ {
+ while ( _pathEngine.next( this ) )
+ ;
+
+ _pathEngine = null;
+ }
+
+ return currentSize();
+ }
+
+ int currentSize ( )
+ {
+ return _cursors != null ? _cursors.size() : _count;
+ }
+
+ boolean setCursor ( Cursor c, int i )
+ {
+ assert i >= 0;
+
+ while ( _pathEngine != null && currentSize() <= i )
+ {
+ if (!_pathEngine.next( this ))
+ _pathEngine = null;
+ }
+
+ if (i >= currentSize())
+ return false;
+
+ if (_cursors != null)
+ {
+ assert i < _cursors.size();
+ c.set( (CursorGoober) _cursors.get( i ) );
+ }
+ else
+ {
+ assert i < _count;
+ c.set( _splays[ i ], _positions[ i ] );
+ }
+
+ return true;
+ }
+
+ void dispose ( )
+ {
+ if (_cursors != null)
+ {
+ for ( int i = 0 ; i < _cursors.size() ; i++ )
+ ((CursorGoober) _cursors.get( i )).set( null, 0 );
+
+ _cursors.clear();
+
+ _cursors = null;
+ }
+
+ _count = 0;
+
+ // TODO - cache unused Seleciton objects for later reuse
+ }
+
+ private Splay[] _splays;
+ private int[] _positions;
+ private int _count;
+
+ private ArrayList _cursors;
+
+ private PathEngine _pathEngine;
+ }
+
+ //
+ //
+ //
+
+ CursorData _data;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/CursorData.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/CursorData.java
new file mode 100644
index 0000000..ce5bd08
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/CursorData.java
@@ -0,0 +1,97 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.store.Splay.CursorGoober;
+
+import java.util.ArrayList;
+
+public final class CursorData
+{
+ public static CursorData getOne ( Root r )
+ {
+ ArrayList dataCache = (ArrayList) tl_CachedCursorData.get();
+
+ CursorData cd;
+
+ if (dataCache.size() == 0)
+ cd = new CursorData( r );
+ else
+ {
+ cd = (CursorData) dataCache.remove( dataCache.size() - 1 );
+ cd._goober.set( r );
+ }
+
+ return cd;
+ }
+
+ private CursorData ( Root r )
+ {
+ _goober = new CursorGoober( r );
+ }
+
+ private static ThreadLocal tl_CachedCursorData =
+ new ThreadLocal() { protected Object initialValue() { return new ArrayList(); } };
+
+ protected void release ( boolean cache )
+ {
+ if (_goober.getSplay() != null)
+ {
+ clearSelections();
+
+ if (_stack != null)
+ _stack.dispose();
+
+ _goober.release();
+
+ if (cache)
+ {
+ ArrayList dataCache = (ArrayList) tl_CachedCursorData.get();
+
+ if (dataCache.size() < 128)
+ dataCache.add( this );
+ }
+ }
+ }
+
+ protected void finalize ( )
+ {
+ Splay s = _goober.getSplay();
+
+ if (s != null)
+ {
+ synchronized ( _goober.getRoot() )
+ {
+ release(false);
+ }
+ }
+ }
+
+ protected void clearSelections ( )
+ {
+ if (_selections != null)
+ _selections.dispose();
+
+ _currentSelection = -2;
+ }
+
+ public final CursorGoober _goober;
+
+ protected Cursor.Selections _stack;
+
+ protected Cursor.Selections _selections;
+ protected int _currentSelection;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Goobers.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Goobers.java
new file mode 100644
index 0000000..d316d1e
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Goobers.java
@@ -0,0 +1,23 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.store.Splay.Goober;
+
+public class Goobers
+{
+ Goober _goobers;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/JaxenXBeansDelegate.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/JaxenXBeansDelegate.java
new file mode 100644
index 0000000..85df54a
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/JaxenXBeansDelegate.java
@@ -0,0 +1,92 @@
+/* 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.xmlbeans.impl.store;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Nov 6, 2003
+ *
+ * Help class to decouple from xbean_xpath.jar and jaxen.jar (version v1.1 beta2)
+ */
+public final class JaxenXBeansDelegate
+{
+ private JaxenXBeansDelegate()
+ {}
+
+ static SelectPathInterface createInstance(String xpath)
+ {
+ if (_constructor==null)
+ return null;
+
+ try
+ {
+ return (JaxenXBeansDelegate.SelectPathInterface)_constructor.newInstance(new Object[] {xpath});
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ // Loose coupling functionality with xqrl.jar
+
+ private static Constructor _constructor;
+
+ static
+ {
+ boolean hasTheJars = false;
+ Class jaxenXPathImpl = null;
+ try
+ {
+ // from jaxen.jar
+ Class.forName( "org.jaxen.BaseXPath" );
+ // from xbean_xpath.jar
+ jaxenXPathImpl = Class.forName( "org.apache.xmlbeans.impl.xpath.jaxen.XBeansXPathAdv" );
+
+ hasTheJars = true;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ hasTheJars = false;
+ }
+ catch ( NoClassDefFoundError e )
+ {
+ hasTheJars = false;
+ }
+
+ if (hasTheJars)
+ {
+ try
+ {
+ _constructor =
+ jaxenXPathImpl.getConstructor( new Class[] { String.class } );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ }
+
+ public static interface SelectPathInterface
+ {
+ public List selectPath(Object node);
+ }
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Path.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Path.java
new file mode 100644
index 0000000..ac54b1a
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Path.java
@@ -0,0 +1,565 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlRuntimeException;
+import org.apache.xmlbeans.impl.common.XPath;
+import org.apache.xmlbeans.impl.store.Cursor.PathEngine;
+import org.apache.xmlbeans.impl.store.Cursor.Selections;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Represents a precompiled path expression
+ */
+
+public abstract class Path
+{
+ static Selections newSelections ( )
+ {
+ return new Selections();
+ }
+
+ static PathEngine select (
+ Root r, Splay s, int p, String pathExpr, XmlOptions options )
+ {
+ Path path = getPath( pathExpr, options );
+ return (path == null) ? null : path.execute( r, s, p, options );
+ }
+
+ public static String _useXqrlForXpath = "use xqrl for xpath";
+
+ public static String _useXbeanForXpath = "use xbean for xpath";
+
+ public static Path getPath ( String pathExpr )
+ {
+ return getPath( pathExpr, false, null );
+ }
+
+ public static Path getPath ( String pathExpr, XmlOptions options )
+ {
+ return
+ getPath(
+ pathExpr,
+ XmlOptions.maskNull( options ).hasOption( _useXqrlForXpath ),
+ options );
+ }
+
+ public static Path getPath ( String pathExpr, boolean xqrl, XmlOptions options )
+ {
+ Object path = null;
+
+ synchronized ( _xbeanPathCache )
+ {
+ if (!xqrl)
+ {
+ path = _xbeanPathCache.get( pathExpr );
+ }
+
+ if (path == null)
+ path = _xqrlPathCache.get( pathExpr );
+
+ if (path == null)
+ {
+ String pathStr = getCompiledPath( pathExpr, xqrl, options );
+
+ path =
+ (pathStr == null)
+ ? null
+ : getPath( pathExpr, xqrl, options );
+ }
+ }
+
+ return (Path) path;
+ }
+
+ public static String getCompiledPath ( String pathExpr, XmlOptions options )
+ {
+ return getCompiledPath( pathExpr, false, options );
+ }
+
+ private static String getCurrentNodeVar ( XmlOptions options )
+ {
+ String currentNodeVar = "this";
+
+ options = XmlOptions.maskNull( options );
+
+ if (options.hasOption( XmlOptions.XQUERY_CURRENT_NODE_VAR ))
+ {
+ currentNodeVar = (String) options.get( XmlOptions.XQUERY_CURRENT_NODE_VAR );
+
+ if (currentNodeVar.startsWith( "$" ))
+ {
+ throw
+ new IllegalArgumentException(
+ "Omit the '$' prefix for the current node variable" );
+ }
+ }
+
+ return currentNodeVar;
+ }
+
+ public static String getCompiledPath ( String pathExpr, boolean xqrl, XmlOptions options )
+ {
+ Path path = null;
+
+ options = XmlOptions.maskNull( options );
+
+ // ensure options doesn't contain XQuery variable mapping.
+ // someday we should implement this in all the pathing engines
+ // but for now it only applies to the xqrl.
+ if (options.hasOption( XmlOptions.XQUERY_VARIABLE_MAP ))
+ {
+ throw
+ new XmlRuntimeException(
+ "XmlOptions.XQUERY_VARIABLE_MAP is not allowed in XPath expressions.");
+ }
+
+ String currentNodeVar = getCurrentNodeVar( options );
+
+ synchronized ( _xbeanPathCache )
+ {
+ assert (xqrl |= options.hasOption( _useXqrlForXpath )) || true;
+
+ if (!xqrl || options.hasOption( _useXbeanForXpath ))
+ {
+ path = (Path) _xbeanPathCache.get( pathExpr );
+
+ if (path == null)
+ {
+ path = XbeanPathImpl.create( pathExpr, currentNodeVar );
+
+ if (path != null)
+ _xbeanPathCache.put( path.getPathExpr(), path );
+ }
+ if (path == null)
+ {
+ path = JaxenPathImpl.create( pathExpr, currentNodeVar );
+
+ if (path != null)
+ _xbeanPathCache.put( path.getPathExpr(), path );
+ }
+ }
+
+ if (path == null)
+ {
+ assert ! options.hasOption( _useXbeanForXpath );
+
+ path = (Path) _xqrlPathCache.get( pathExpr );
+
+ if (path == null)
+ {
+ path = XqrlPathImpl.create( pathExpr, options );
+
+ if (path != null)
+ _xqrlPathCache.put( path.getPathExpr(), path );
+ }
+ }
+ }
+
+ return path == null ? null : path.getPathExpr();
+ }
+
+ public interface Query
+ {
+ PathEngine executePath ( Root r, Splay s, int p, XmlOptions options );
+ XmlCursor executeQuery ( Cursor c, XmlOptions options );
+ XmlObject[] executeQuery ( Type type, XmlOptions options );
+ String getQueryExpr ( );
+ }
+
+// public static Query getQuery ( String queryExpr )
+// {
+// return getQuery( queryExpr, null );
+// }
+
+ public static Query getQuery ( String queryExpr, XmlOptions options )
+ {
+ Object query = null;
+
+ synchronized ( _xqrlQueryCache )
+ {
+ query = _xqrlQueryCache.get( queryExpr );
+
+ if (query == null)
+ {
+ String queryStr = getCompiledQuery( queryExpr, options );
+
+ query =
+ (queryStr == null) ? null : getQuery( queryExpr, options );
+ }
+ }
+
+ return (Query) query;
+ }
+
+ public static String getCompiledQuery ( String queryExpr, XmlOptions options )
+ {
+ Query query = null;
+
+ synchronized ( _xqrlQueryCache )
+ {
+ query = (Query) _xqrlQueryCache.get( queryExpr );
+
+ if (query == null)
+ {
+ query = XqrlDelegate.compileQuery( queryExpr, options );
+
+ if (query != null)
+ _xqrlQueryCache.put( query.getQueryExpr(), query );
+ }
+ }
+
+ return query == null ? null : query.getQueryExpr();
+ }
+
+ public static XmlCursor query (
+ Cursor c, String queryExpr, XmlOptions options )
+ {
+ Query query = getQuery( queryExpr, options );
+ return (query == null) ? null : query.executeQuery( c, options );
+ }
+
+ public static XmlObject[] query (
+ Type type, String queryExpr, XmlOptions options )
+ {
+ Query query = getQuery( queryExpr, options );
+ return (query == null) ? null : query.executeQuery( type, options );
+ }
+
+ protected abstract PathEngine execute (
+ Root r, Splay s, int p, XmlOptions options );
+
+ protected abstract String getPathExpr ( );
+
+ private static class XqrlPathImpl extends Path
+ {
+ private XqrlPathImpl ( String pathExpr, Query compiledPath )
+ {
+ _pathExpr = pathExpr;
+ _compiledPath = compiledPath;
+ }
+
+ private String _pathExpr;
+ private Query _compiledPath;
+
+ static Path create ( String pathExpr, XmlOptions options )
+ {
+ return new XqrlPathImpl(
+ pathExpr,
+ XqrlDelegate.compilePath( pathExpr, options ) );
+ }
+
+ protected PathEngine execute (
+ Root r, Splay s, int p, XmlOptions options )
+ {
+ return _compiledPath.executePath( r, s, p, options );
+ }
+
+ protected String getPathExpr ( ) { return _pathExpr; }
+ }
+
+ //
+ //
+ //
+
+ private static final class XbeanPathImpl extends Path
+ {
+ private XbeanPathImpl (
+ XPath xpath, String pathExpr, String currentNodeVar )
+ {
+ _pathExpr = pathExpr;
+ _xpath = xpath;
+ _currentNodeVar = currentNodeVar;
+ }
+
+// try
+// {
+// String currentNodeVar = "this";
+//
+// if (XmlOptions.XQUERY_CURRENT_NODE_VAR.has( options ))
+// {
+// currentNodeVar =
+// "$" + XmlOptions.XQUERY_CURRENT_NODE_VAR.get( options );
+//
+// if (currentNodeVar.startsWith( "$$" ))
+// {
+// throw
+// new IllegalArgumentException(
+// "Omit the '$p' refix for the current " +
+// "node variable" );
+// }
+// }
+
+ static Path create ( String pathExpr, String currentNodeVar )
+ {
+ assert !currentNodeVar.startsWith( "$" );
+
+ try
+ {
+ return
+ new XbeanPathImpl(
+ XPath.compileXPath( pathExpr, currentNodeVar ),
+ pathExpr, currentNodeVar );
+ }
+ catch ( XPath.XPathCompileException e )
+ {
+ return null;
+ }
+ }
+
+ protected String getPathExpr ( ) { return _pathExpr; }
+
+ protected PathEngine execute (
+ Root r, Splay s, int p, XmlOptions options )
+ {
+ // The builtin XPath engine works only on containers. Delegate to
+ // xqrl otherwise. Also, if the path had a //. at the end, the
+ // simple xpath engine can't do the generate case, it only handles
+ // attrs and elements.
+
+ if (p != 0 || !s.isContainer() || _xpath.sawDeepDot())
+ {
+ // If the xbean path compiler could could handle the path, then
+ // the xqrl compiler better be able to!
+
+ try
+ {
+ return
+ getPath( _pathExpr, true, null ).
+ execute( r, s, p, options );
+ }
+ catch ( Throwable e )
+ {
+ throw new RuntimeException( "Can't compile path", e );
+ }
+ }
+
+ return new XBeanPathEngine( _xpath, r, s );
+ }
+
+// TODO - because this xpath engine does not use a saver, any attributes in the
+// path which refer to namesapce attributes will require us to run the XQRL
+// path engine which is based on the saver.
+
+ private static class XBeanPathEngine
+ extends XPath.ExecutionContext implements PathEngine
+ {
+ XBeanPathEngine ( XPath xpath, Root r, Splay s )
+ {
+ assert s.isContainer();
+
+ _root = r;
+ _curr = _top = s;
+ _version = r.getVersion();
+
+ init( xpath );
+ }
+
+ public boolean next ( Selections selections )
+ {
+ int initialSize = selections.currentSize();
+
+ for ( ; ; )
+ {
+ if (_root.getVersion() != _version)
+ throw new IllegalStateException( "Document changed" );
+
+ if (_curr == null)
+ return false;
+
+ advance( selections );
+
+ if (initialSize < selections.currentSize())
+ return true;
+ }
+ }
+
+ private Splay doAttrs ( int ret, Splay s, Selections selections )
+ {
+ if ((ret & ATTRS) == 0)
+ return null;
+
+ for ( s = _curr.nextSplay() ; s.isAttr() ;
+ s = s.nextSplay() )
+ {
+ if (s.isNormalAttr() && attr( s.getName() ))
+ selections.add( _root, s );
+ }
+
+ return s;
+ }
+
+ private void advance ( Selections selections )
+ {
+ if (_curr == _top)
+ {
+ int ret = start();
+
+ if ((ret & HIT) != 0)
+ selections.add( _root, _curr );
+
+ Splay s = doAttrs( ret, _curr, selections );
+
+ if ((ret & DESCEND) == 0 || _curr.isLeaf())
+ _curr = null;
+ else
+ _curr = s == null ? _curr.nextNonAttrSplay() : s;
+
+ return;
+ }
+
+ for ( ; ; )
+ {
+ if (_curr.isFinish())
+ {
+ if (_curr.getContainer() == _top)
+ _curr = null;
+ else
+ {
+ end();
+ _curr = _curr.nextSplay();
+ }
+
+ return;
+ }
+
+ if (_curr.isBegin())
+ {
+ int ret = element( _curr.getName() );
+
+ if ((ret & HIT) != 0)
+ selections.add( _root, _curr );
+
+ Splay s = doAttrs( ret, _curr, selections );
+
+ if (_curr.isLeaf())
+ {
+ end();
+ _curr = s == null ? _curr.nextNonAttrSplay() : s;
+ }
+ else if ((ret & DESCEND) == 0)
+ _curr = ((Splay.Container) _curr).getFinish();
+ else
+ _curr = s == null ? _curr.nextNonAttrSplay() : s;
+
+ return;
+ }
+
+ _curr = _curr.nextSplay();
+ }
+ }
+
+ private Root _root;
+ private long _version;
+ private Splay _top;
+ private Splay _curr;
+ }
+
+ private String _pathExpr;
+ private XPath _xpath;
+ private String _currentNodeVar;
+ }
+
+
+ private static final class JaxenPathImpl extends Path
+ {
+ private String _pathExpr;
+ private JaxenXBeansDelegate.SelectPathInterface _xpathImpl;
+
+ private JaxenPathImpl (
+ JaxenXBeansDelegate.SelectPathInterface xpathImpl, String pathExpr )
+ {
+ _xpathImpl = xpathImpl;
+ _pathExpr = pathExpr;
+ }
+
+ static Path create ( String pathExpr, String currentNodeVar )
+ {
+ assert !currentNodeVar.startsWith( "$" ); // cezar review with ericvas
+
+ JaxenXBeansDelegate.SelectPathInterface impl = JaxenXBeansDelegate.createInstance( pathExpr );
+ if (impl == null)
+ return null;
+
+ return new JaxenPathImpl( impl , pathExpr );
+ }
+
+ protected String getPathExpr ( ) { return _pathExpr; }
+
+ protected PathEngine execute ( Root r, Splay s, int p, XmlOptions options )
+ {
+ return new JaxenPathEngine( _xpathImpl, r, s, p);
+ }
+
+ private static class JaxenPathEngine
+ extends XPath.ExecutionContext implements PathEngine
+ {
+ JaxenPathEngine( JaxenXBeansDelegate.SelectPathInterface xpathImpl, Root r, Splay s, int p )
+ {
+ _jaxenXpathImpl = xpathImpl;
+ _root = r;
+ _splay = s;
+ _p = p;
+ _version = r.getVersion();
+ }
+
+ public boolean next ( Selections selections )
+ {
+ if (!_firstCall)
+ return false;
+
+ _firstCall = false;
+
+ if (_root.getVersion() != _version)
+ throw new IllegalStateException( "Document changed" );
+
+ List resultsList;
+ Cursor cur = new Cursor(_root, _splay, _p);
+ resultsList = _jaxenXpathImpl.selectPath(cur);
+
+ int i;
+ for (i = 0; i<resultsList.size(); i++)
+ {
+ XmlCursor.XmlBookmark b = (XmlCursor.XmlBookmark)resultsList.get(i);
+ Splay.Annotation ann = ((Splay.Annotation)b._currentMark);
+ selections.add(_root, ann.getSplay(), ann.getPos());
+ }
+ cur.dispose();
+ _root = null;
+ _splay = null;
+ _jaxenXpathImpl = null;
+
+ return false;
+ }
+
+ private JaxenXBeansDelegate.SelectPathInterface _jaxenXpathImpl;
+ private Root _root;
+ private Splay _splay;
+ private int _p;
+ private long _version;
+ private boolean _firstCall = true;
+ }
+ }
+
+ private static HashMap _xqrlPathCache = new HashMap();
+ private static HashMap _xbeanPathCache = new HashMap();
+ private static HashMap _xqrlQueryCache = new HashMap();
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Root.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Root.java
new file mode 100644
index 0000000..81a00f7
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Root.java
@@ -0,0 +1,3439 @@
+/* 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.xmlbeans.impl.store;
+
+import java.lang.reflect.Method;
+
+import org.apache.xmlbeans.impl.common.EncodingMap;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XMLNameHelper;
+import org.apache.xmlbeans.impl.store.Splay.Finish;
+import org.apache.xmlbeans.impl.values.NamespaceManager;
+import org.apache.xmlbeans.impl.values.XmlStore;
+import org.apache.xmlbeans.impl.values.TypeStoreFactory;
+import org.apache.xmlbeans.QNameCache;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlDocumentProperties;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlLineNumber;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlRuntimeException;
+import org.apache.xmlbeans.XmlSaxHandler;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+import org.apache.xmlbeans.xml.stream.Attribute;
+import org.apache.xmlbeans.xml.stream.AttributeIterator;
+import org.apache.xmlbeans.xml.stream.CharacterData;
+import org.apache.xmlbeans.xml.stream.Location;
+import org.apache.xmlbeans.xml.stream.ProcessingInstruction;
+import org.apache.xmlbeans.xml.stream.Space;
+import org.apache.xmlbeans.xml.stream.StartDocument;
+import org.apache.xmlbeans.xml.stream.StartElement;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.SAXParser;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class Root extends Finish implements XmlStore
+{
+ public Root ( SchemaTypeLoader stl, SchemaType type, XmlOptions options )
+ {
+ super( ROOT );
+
+ assert stl != null;
+
+ _schemaTypeSystem = stl;
+
+ _leftOnly = true;
+
+ _props = new DocProps();
+
+ _doc = new Doc( this, null );
+
+ _leftSplay = _doc;
+ _doc._parentSplay = this;
+ adjustCdocBeginLeft( _doc.getCdocBegin() );
+
+ _text = new Text();
+
+ SchemaType sType = null;
+
+ options = XmlOptions.maskNull( options );
+
+ if (options.hasOption( XmlOptions.DOCUMENT_TYPE ))
+ sType = (SchemaType) options.get( XmlOptions.DOCUMENT_TYPE );
+
+ if (sType == null)
+ sType = type;
+
+ if (sType == null)
+ sType = XmlObject.type;
+
+ _validateOnSet = options.hasOption( XmlOptions.VALIDATE_ON_SET );
+
+ _factory = (TypeStoreFactory) options.get( TypeStoreFactory.KEY );
+
+ _doc.setType( this, sType );
+ }
+
+ public static XmlStore newStore ( SchemaTypeLoader stl, SchemaType type, XmlOptions options )
+ {
+ return new Root( stl, type, options );
+ }
+
+ public XmlDocumentProperties documentProperties ( )
+ {
+ return _props;
+ }
+
+ public XmlCursor createCursor ( )
+ {
+ assert validate();
+ return new Cursor( this, _doc );
+ }
+
+ Container getContainer ( ) { return _doc; }
+
+ boolean validateOnSet ( ) { return _validateOnSet; }
+
+ public XmlObject getObject ( )
+ {
+ Type t = _doc.peekType();
+
+ return t == null ? null : t.getXmlObject();
+ }
+
+ public SchemaTypeLoader getSchemaTypeLoader ( )
+ {
+ return _schemaTypeSystem;
+ }
+
+ boolean isEmpty ( )
+ {
+ return _leftSplay == _doc && _doc._rightSplay == null && _doc.isValid();
+ }
+
+ boolean isLeftOnly ( ) { return _leftOnly; }
+
+ void ensureEmpty ( )
+ {
+ if (!isEmpty())
+ _doc.removeContent( this, true );
+
+ assert isEmpty();
+ assert validate();
+ assert _leftOnly;
+ assert getCchLeft() == 0;
+ assert _text.length() == 0;
+ assert getCdocBeginLeft() == 1;
+ assert _doc != null && _leftSplay == _doc;
+ }
+
+ void updateCch ( Splay s, int deltaCch )
+ {
+ assert !s.isRoot();
+
+ if (deltaCch != 0)
+ {
+ s.splay( this, this );
+
+ s.adjustCch( deltaCch );
+ adjustCchLeft( deltaCch );
+ }
+ }
+
+ int getCp ( Splay s )
+ {
+ //
+ // A left only tree has the nice property that _cchLeft is
+ // also the cp!
+ //
+
+ if (!_leftOnly && s != this)
+ s.splay( this, this );
+
+ return s.getCchLeft();
+ }
+
+ int getDocBeginIndex ( Splay s )
+ {
+ //
+ // A left only tree has the nice property that cdocBeginLeft is
+ // also the pos!
+ //
+
+ if (!_leftOnly)
+ s.splay( this, this );
+
+ return s.getCdocBeginLeft();
+ }
+
+ Begin findNthBegin ( Splay parent, QName name, QNameSet set, int n )
+ {
+ // only one of (set or name) is not null
+ // or both are null for a wildcard
+ assert ( name == null || set == null );
+ assert n >= 0;
+
+ if (parent == null || parent.isLeaf())
+ return null;
+
+ int da = _nthCache_A.distance( parent, name, set, n );
+ int db = _nthCache_B.distance( parent, name, set, n );
+
+ Begin b =
+ da <= db
+ ? _nthCache_A.fetch( parent, name, set, n )
+ : _nthCache_B.fetch( parent, name, set, n );
+
+ if (da == db)
+ {
+ nthCache temp = _nthCache_A;
+ _nthCache_A = _nthCache_B;
+ _nthCache_B = temp;
+ }
+
+ return b;
+ }
+
+ int count ( Container parent, QName name, QNameSet set )
+ {
+ Splay s = findNthBegin( parent, name, set, 0 );
+
+ if (s == null)
+ return 0;
+
+ int n = 0;
+
+ for ( ; ; s = s.nextSplay() )
+ {
+ if (s.isFinish())
+ break;
+
+ if (!s.isBegin())
+ continue;
+
+ if (set == null)
+ {
+ if (s.getName().equals(name))
+ n++;
+ }
+ else
+ {
+ if (set.contains(s.getName()))
+ n++;
+ }
+
+ s = s.getFinishSplay();
+ }
+
+ return n;
+ }
+
+ /**
+ * Set up strong type information based on this schema type system.
+ */
+
+ private boolean namespacesSame ( QName n1, QName n2 )
+ {
+ if (n1 == n2)
+ return true;
+
+ if (n1 == null || n2 == null)
+ return false;
+
+ if (n1.getNamespaceURI() == n2.getNamespaceURI())
+ return true;
+
+ if (n1.getNamespaceURI() == null || n2.getNamespaceURI() == null)
+ return false;
+
+ return n1.getNamespaceURI().equals( n2.getNamespaceURI() );
+ }
+
+ private void addNamespace ( StringBuffer sb, QName name )
+ {
+ if (name.getNamespaceURI() == null)
+ sb.append( "<no namespace>" );
+ else
+ {
+ sb.append( "\"" );
+ sb.append( name.getNamespaceURI() );
+ sb.append( "\"" );
+ }
+ }
+
+ XmlObject autoTypedDocument (
+ SchemaType factoryType, XmlOptions options )
+ throws XmlException
+ {
+ // The type in the options has highest precidence because it is
+ // supplied by the user.
+
+ SchemaType overrideType =
+ (SchemaType) XmlOptions.safeGet( options, XmlOptions.DOCUMENT_TYPE );
+
+ // precedence is given to the override above all
+
+ SchemaType theType = overrideType;
+
+ // Document and attribute types have no name
+
+ if (theType == null &&
+ (factoryType == null ||
+ (!factoryType.isDocumentType() &&
+ !factoryType.isAttributeType())))
+ {
+ // infer type from xsi:type
+ QName typeName = _doc.getXsiTypeName( this );
+
+ SchemaType sniffedType =
+ typeName == null
+ ? null
+ : _schemaTypeSystem.findType( typeName );
+
+ if (factoryType == null ||
+ factoryType.isAssignableFrom( sniffedType ))
+ {
+ theType = sniffedType;
+ }
+ }
+
+ // todo:
+ // use the following when implementing subst groups:
+ // factoryType == null || expectedType.isDocumentType()
+
+ if (factoryType == null || factoryType.isDocumentType())
+ {
+ if (theType == null)
+ {
+ // infer type based on root elt
+
+ QName docElemName = null;
+
+ XmlCursor c = createCursor();
+
+ if (c.toFirstChild() && !c.toNextSibling())
+ docElemName = c.getName();
+
+ c.dispose();
+
+ if (docElemName != null)
+ theType = _schemaTypeSystem.findDocumentType( docElemName );
+
+ // verify elt inheritance when implementing subst groups
+ if (factoryType != null && theType != null)
+ {
+ QName factoryElemName = factoryType.getDocumentElementName();
+
+ if (!factoryElemName.equals(docElemName) &&
+ !factoryType.isValidSubstitution(docElemName))
+
+ throw new XmlException("Element " + QNameHelper.pretty(docElemName) +
+ " is not a valid " + QNameHelper.pretty(factoryElemName) +
+ " document or a valid substitution.");
+ }
+
+ }
+
+ if (theType == null)
+ {
+ // infer type based on root attr
+
+ QName attrName = null;
+
+ XmlCursor c = createCursor();
+
+ if (c.toFirstAttribute() && !c.toNextAttribute())
+ attrName = c.getName();
+
+ c.dispose();
+
+ if (attrName != null)
+ theType = _schemaTypeSystem.findAttributeType( attrName );
+ }
+ }
+
+ // sniffing doesn't say anything: assume the expected type
+ if (theType == null)
+ theType = factoryType;
+
+ // Still nothing: the no type.
+ if (theType == null)
+ theType = XmlBeans.NO_TYPE;
+
+ // assign type
+ _doc.setType( this, theType );
+
+ // todo: Have a similar attribute type check
+ if (factoryType != null)
+ {
+ if (theType.isDocumentType())
+ verifyDocumentType( theType.getDocumentElementName() );
+ else if (theType.isAttributeType())
+ verifyAttributeType( theType.getAttributeTypeAttributeName() );
+ }
+
+ //
+ // If a type was passed in, usually from generated code which needs the
+ // type to be something specific because of a pending cast, then check
+ // the resulting type and throw a nice exception.
+ //
+
+ if (factoryType != null && !factoryType.isAssignableFrom(theType))
+ {
+ /*
+ System.out.println("Factory type = " + factoryType);
+ System.out.println("The type = " + theType);
+ System.out.println("basetype of the type = " + theType.getBaseType());
+ */
+
+ throw
+ new XmlException( "XML object is not of type " + factoryType );
+ }
+
+ return getObject();
+ }
+
+ private void verifyDocumentType ( QName docElemName )
+ throws XmlException
+ {
+ XmlCursor c = createCursor();
+
+ try
+ {
+ StringBuffer sb = null;
+
+ if (!c.toFirstChild() || c.toNextSibling())
+ {
+ sb = new StringBuffer();
+
+ sb.append( "The document is not a " );
+ sb.append( QNameHelper.pretty( docElemName ) );
+
+ if (c.currentTokenType().isStartdoc())
+ sb.append( ": no document element" );
+ else
+ sb.append( ": multiple document elements" );
+ }
+ else
+ {
+ QName name = c.getName();
+
+ if (!name.equals( docElemName ))
+ {
+ sb = new StringBuffer();
+
+ sb.append( "The document is not a " );
+ sb.append( QNameHelper.pretty( docElemName ) );
+
+ if (docElemName.getLocalPart().equals( name.getLocalPart() ))
+ {
+ sb.append( ": document element namespace mismatch " );
+ sb.append( "expected " );
+ addNamespace( sb, docElemName );
+ sb.append( " got " );
+ addNamespace(sb, name );
+ }
+ else if (namespacesSame( docElemName, name ))
+ {
+ sb.append( ": document element local name mismatch " );
+ sb.append( "expected " + docElemName.getLocalPart() );
+ sb.append( " got " + name.getLocalPart() );
+ }
+ else
+ {
+ sb.append( ": document element mismatch " );
+ sb.append( "got " );
+ sb.append( QNameHelper.pretty( name ) );
+ }
+ }
+ }
+
+ if (sb != null)
+ {
+ XmlError err = XmlError.forCursor(sb.toString(), c.newCursor());
+ throw new XmlException( err.toString(), null, err );
+ }
+ }
+ finally
+ {
+ c.dispose();
+ }
+ }
+
+ private void verifyAttributeType ( QName attrName )
+ throws XmlException
+ {
+ XmlCursor c = createCursor();
+
+ try
+ {
+ StringBuffer sb = null;
+
+ if (!c.toFirstAttribute() || c.toNextAttribute())
+ {
+ sb = new StringBuffer();
+
+ sb.append( "The document is not a " );
+ sb.append( QNameHelper.pretty( attrName ) );
+
+ if (c.currentTokenType().isStartdoc())
+ sb.append( ": no attributes" );
+ else
+ sb.append( ": multiple attributes" );
+ }
+ else
+ {
+ QName name = c.getName();
+
+ if (!name.equals( attrName ))
+ {
+ sb = new StringBuffer();
+
+ sb.append( "The document is not a " );
+ sb.append( QNameHelper.pretty( attrName ) );
+
+ if (attrName.getLocalPart().equals( name.getLocalPart() ))
+ {
+ sb.append( ": attribute namespace mismatch " );
+ sb.append( "expected " );
+ addNamespace( sb, attrName );
+ sb.append( " got " );
+ addNamespace(sb, name );
+ }
+ else if (namespacesSame( attrName, name ))
+ {
+ sb.append( ": attribute local name mismatch " );
+ sb.append( "expected " + attrName.getLocalPart() );
+ sb.append( " got " + name.getLocalPart() );
+ }
+ else
+ {
+ sb.append( ": attribute element mismatch " );
+ sb.append( "got " );
+ sb.append( QNameHelper.pretty( name ) );
+ }
+ }
+ }
+
+ if (sb != null)
+ {
+ XmlError err = XmlError.forCursor(sb.toString(), c.newCursor());
+ throw new XmlException( err.toString(), null, err );
+ }
+ }
+ finally
+ {
+ c.dispose();
+ }
+ }
+
+ //
+ //
+ //
+
+ private static ThreadLocal tl_SaxLoaders =
+ new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ SaxLoader sl = PiccoloSaxLoader.newInstance();
+
+ if (sl == null)
+ sl = DefaultSaxLoader.newInstance();
+
+ if (sl == null)
+ throw new RuntimeException( "Can't find an XML parser" );
+
+ return sl;
+ }
+ };
+
+ private static SaxLoader getSaxLoader ( )
+ {
+ return (SaxLoader) tl_SaxLoaders.get();
+ }
+
+
+ private static class PiccoloSaxLoader extends SaxLoader
+ {
+ public static SaxLoader newInstance ( )
+ {
+ try
+ {
+ Class pc = Class.forName( "com.bluecast.xml.Piccolo" );
+
+ XMLReader xr = (XMLReader) pc.newInstance();
+
+ Method m_getEncoding = pc.getMethod( "getEncoding", null );
+ Method m_getVersion = pc.getMethod( "getVersion", null );
+ Method m_getStartLocator = pc.getMethod( "getStartLocator", null );
+
+ Locator startLocator =
+ (Locator) m_getStartLocator.invoke( xr, null );
+
+ return new PiccoloSaxLoader( xr, startLocator, m_getEncoding, m_getVersion );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ return null;
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ protected void postLoad ( Root r )
+ {
+ try
+ {
+ r._props.setEncoding( (String) _m_getEncoding.invoke( _xr, null ) );
+ r._props.setVersion ( (String) _m_getVersion .invoke( _xr, null ) );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ private PiccoloSaxLoader (
+ XMLReader xr, Locator startLocator, Method m_getEncoding, Method m_getVersion )
+ {
+ super( xr, startLocator );
+
+ _m_getEncoding = m_getEncoding;
+ _m_getVersion = m_getVersion;
+ }
+
+ private Method _m_getEncoding;
+ private Method _m_getVersion;
+ }
+
+ private static class DefaultSaxLoader extends SaxLoader
+ {
+ public static SaxLoader newInstance ( )
+ {
+ try
+ {
+ return
+ new DefaultSaxLoader(
+ SAXParserFactory.newInstance().newSAXParser().getXMLReader() );
+ }
+ catch ( Throwable e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+
+ private DefaultSaxLoader ( XMLReader xr )
+ {
+ super( xr, null );
+ }
+ }
+
+ private static class SaxLoader
+ implements ContentHandler, LexicalHandler, ErrorHandler, EntityResolver
+ {
+ protected SaxLoader ( XMLReader xr, Locator startLocator )
+ {
+ _xr = xr;
+ _startLocator = startLocator;
+
+ if (xr != null)
+ {
+ try
+ {
+ xr.setFeature( "http://xml.org/sax/features/namespace-prefixes", true );
+ xr.setFeature( "http://xml.org/sax/features/namespaces", true );
+ xr.setFeature( "http://xml.org/sax/features/validation", false );
+
+
+ xr.setProperty( "http://xml.org/sax/properties/lexical-handler", this );
+ xr.setContentHandler( this );
+ xr.setErrorHandler( this );
+ xr.setEntityResolver( this );
+ }
+ catch ( Throwable e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+ }
+
+ protected void setContext ( LoadContext context, XmlOptions options )
+ {
+ _context = context;
+
+ _wantLineNumbers =
+ XmlOptions.maskNull(
+ options ).hasOption( XmlOptions.LOAD_LINE_NUMBERS ) &&
+ _startLocator != null;
+ }
+
+ protected void postLoad ( Root r )
+ {
+ }
+
+ public void load ( Root r, InputSource inputSource, XmlOptions options )
+ throws IOException, XmlException
+ {
+ LoadContext context = new LoadContext( r, options );
+
+ setContext( context, options );
+
+ try
+ {
+ assert r.disableStoreValidation();
+
+ _xr.parse( inputSource );
+
+ postLoad( r );
+
+// // Piccolo specific access to encoding and version
+// _props.setEncoding( piccolo.getEncoding() );
+// _props.setVersion( piccolo.getVersion() );
+
+ context.finish();
+
+ r.associateSourceName( options );
+ }
+ catch ( XmlRuntimeException e )
+ {
+ context.abort();
+ throw new XmlException( e );
+ }
+ catch ( SAXParseException e )
+ {
+ context.abort();
+
+ XmlError err =
+ XmlError.forLocation(
+ e.getMessage(),
+ (String) XmlOptions.safeGet( options, XmlOptions.DOCUMENT_SOURCE_NAME ),
+ e.getLineNumber(), e.getColumnNumber(), -1 );
+
+ throw new XmlException( err.toString(), e, err );
+ }
+ catch ( SAXException e )
+ {
+ context.abort();
+
+ XmlError err = XmlError.forMessage( e.getMessage() );
+
+ throw new XmlException( err.toString(), e, err );
+ }
+ catch ( RuntimeException e )
+ {
+ context.abort();
+ throw e;
+ }
+ finally
+ {
+ assert r.enableStoreValidation();
+ }
+ }
+
+ // Sax ContentHandler
+
+ public void startDocument ( ) throws SAXException
+ {
+ }
+
+ public void endDocument ( ) throws SAXException
+ {
+ // Set context to null
+ // This prevents the handler (which is held in TLS from keeping
+ // the entire document in memory
+ _context = null;
+ }
+
+ public void startElement (
+ String namespaceURI, String localName,
+ String qName, Attributes atts )
+ throws SAXException
+ {
+ if (localName.length() == 0)
+ localName = qName;
+
+ // Out current parser (Piccolo) does not error when a
+ // namespace is used and not defined. Check for these here
+
+ if (qName.indexOf( ':' ) >= 0 && namespaceURI.length() == 0)
+ {
+ XmlError err =
+ XmlError.forMessage(
+ "Use of undefined namespace prefix: " +
+ qName.substring( 0, qName.indexOf( ':' ) ));
+
+ throw new XmlRuntimeException( err.toString(), null, err );
+ }
+
+ _context.begin( localName, namespaceURI );
+
+ // BUGBUG - do more of the following to get line number for
+ // as many parts of the XML as we can
+ if (_wantLineNumbers)
+ {
+ _context.lineNumberAnnotation(
+ _startLocator.getLineNumber(),
+ _startLocator.getColumnNumber(),
+ -1 );
+ }
+
+ for ( int i = 0, len = atts.getLength() ; i < len ; i++ )
+ {
+ String aqn = atts.getQName( i );
+
+ if (aqn.equals( "xmlns" ))
+ {
+ _context.xmlns( "", atts.getValue( i ) );
+ }
+ else if (aqn.startsWith( "xmlns:" ))
+ {
+ String prefix = aqn.substring( 6 );
+
+ if (prefix.length() == 0)
+ {
+ XmlError err =
+ XmlError.forMessage( "Prefix not specified", XmlError.SEVERITY_ERROR );
+
+ throw new XmlRuntimeException( err.toString(), null, err );
+ }
+
+ String uri = atts.getValue( i );
+
+ if (uri.length() == 0)
+ {
+ XmlError err =
+ XmlError.forMessage(
+ "Prefix can't be mapped to no namespace: " + prefix,
+ XmlError.SEVERITY_ERROR );
+
+ throw new XmlRuntimeException( err.toString(), null, err );
+ }
+
+ _context.xmlns( prefix, uri );
+ }
+ else
+ {
+ String attrUri = atts.getURI( i );
+ String attrLocal = atts.getLocalName( i );
+
+ if (attrLocal.length() == 0)
+ attrLocal = aqn;
+
+// given the doc <a x:y='z'/>, piccolo will report the uri of the y
+// attribute as 'x'! Bad Piccolo. Thus, I can't perform the undefined
+// prefix check here.
+//
+// if (aqn.indexOf( ':' ) >= 0 && attrUri.length() == 0)
+// {
+// XmlError err =
+// new CursorXmlError(
+// "Use of undefined namespace prefix: " +
+// aqn.substring( 0, aqn.indexOf( ':' ) ),
+// XmlError.SEVERITY_ERROR,
+// null );
+//
+// throw
+// new XmlRuntimeException(
+// err.toString(), null, err );
+// }
+
+ _context.attr( attrLocal, attrUri, atts.getValue( i ) );
+ }
+ }
+ }
+
+ public void endElement (
+ String namespaceURI, String localName, String qName )
+ throws SAXException
+ {
+ _context.end();
+ }
+ public void characters ( char ch[], int start, int length )
+
+ throws SAXException
+ {
+ _context.text( ch, start, length );
+ }
+
+ public void ignorableWhitespace ( char ch[], int start, int length )
+ throws SAXException
+ {
+ _context.text( ch, start, length );
+ }
+
+ public void comment ( char ch[], int start, int length )
+ throws SAXException
+ {
+ _context.comment( ch, start, length );
+ }
+
+ public void processingInstruction ( String target, String data )
+ throws SAXException
+ {
+ _context.procinst( target, data );
+ }
+
+ public void startDTD ( String name, String publicId, String systemId )
+ throws SAXException
+ {
+ _context.doctype( name, publicId, systemId );
+ }
+
+ public void endDTD ( ) throws SAXException
+ {
+ }
+
+ // Error Handling
+ public void fatalError ( SAXParseException e ) throws SAXException
+ {
+ throw e;
+ }
+
+ public void error ( SAXParseException e ) throws SAXException
+ {
+ XmlError err =
+ XmlError.forMessage( "Error: " + e.getMessage(), XmlError.SEVERITY_ERROR );
+
+ throw new XmlRuntimeException( err.toString(), null, err );
+ }
+
+ public void warning ( SAXParseException e ) throws SAXException
+ {
+ // Throw away warings for now
+ }
+
+ // Entity Resolver
+ public InputSource resolveEntity( String publicId, String systemId )
+ {
+ // System.out.println("public id = " + publicId);
+ // System.out.println("system id = " + systemId);
+
+ return new InputSource( new StringReader( "" ) );
+ }
+
+ public void setDocumentLocator ( Locator locator )
+ {
+ _locator = locator;
+ }
+
+ public void startPrefixMapping ( String prefix, String uri )
+ throws SAXException
+ {
+ if (beginsWithXml( prefix ) &&
+ ! ( "xml".equals( prefix ) && _xml1998Uri.equals( uri ) ))
+ {
+ XmlError err =
+ XmlError.forMessage(
+ "Prefix can't begin with XML: " + prefix,
+ XmlError.SEVERITY_ERROR );
+
+ throw
+ new XmlRuntimeException(
+ err.toString(), null, err );
+ }
+ }
+
+ // Ignored
+ public void endPrefixMapping ( String prefix ) throws SAXException {}
+ public void skippedEntity ( String name ) throws SAXException {}
+ public void startCDATA ( ) throws SAXException { }
+ public void endCDATA ( ) throws SAXException { }
+ public void startEntity ( String name ) throws SAXException { }
+ public void endEntity ( String name ) throws SAXException { }
+
+ protected XMLReader _xr;
+
+ private Locator _locator;
+ private LoadContext _context;
+ private boolean _wantLineNumbers;
+ private Locator _startLocator;
+ }
+
+ //
+ //
+ //
+
+ public XmlObject loadXml ( InputStream in, SchemaType type, XmlOptions options )
+ throws IOException, XmlException
+ {
+ String encodingOverride =
+ (String) XmlOptions.safeGet( options, XmlOptions.CHARACTER_ENCODING );
+
+ if (encodingOverride != null)
+ {
+ String javaEncoding = EncodingMap.getIANA2JavaMapping( encodingOverride );
+
+ if (javaEncoding == null)
+ javaEncoding = encodingOverride;
+
+ return loadXml( new InputStreamReader( in, javaEncoding ), type, options );
+ }
+
+ return loadXml( new InputSource( in ), type, options );
+ }
+
+ public XmlObject loadXml ( Reader r, SchemaType type, XmlOptions options )
+ throws IOException, XmlException
+ {
+ return loadXml( new InputSource( r ), type, options );
+ }
+
+ public XmlObject loadXml ( InputSource is, SchemaType type, XmlOptions options )
+ throws IOException, XmlException
+ {
+ is.setSystemId( "file://" );
+
+ getSaxLoader().load( this, is, options );
+
+ return autoTypedDocument( type, options );
+ }
+
+ public XmlObject loadXml ( String s, SchemaType type, XmlOptions options )
+ throws XmlException
+ {
+ Reader r = new StringReader( s );
+
+ try
+ {
+ return loadXml( r, type, options );
+ }
+ catch ( IOException e )
+ {
+ assert false: "StringReader should not throw IOException";
+ throw new XmlException( e.getMessage(), e );
+ }
+ finally
+ {
+ try { r.close(); } catch ( IOException e ) { }
+ }
+ }
+
+ private void associateSourceName ( XmlOptions options )
+ {
+ String sourceName =
+ (String) XmlOptions.safeGet(
+ options, XmlOptions.DOCUMENT_SOURCE_NAME );
+
+ if (sourceName != null)
+ _props.setSourceName( sourceName );
+ }
+
+ //
+ // XmlSaxHandler is returned to a user so that user may obtain the content
+ // and lexical handlers to push content and then get the XmlObject at the
+ // end of the parse push.
+ //
+
+ private class XmlSaxHandlerImpl extends SaxLoader implements XmlSaxHandler
+ {
+ XmlSaxHandlerImpl ( SchemaType type, XmlOptions options )
+ {
+ super( null, null );
+
+ assert isEmpty();
+
+ _options = options;
+ _type = type;
+
+ _context = new LoadContext( Root.this, options );
+
+ setContext( _context, options );
+ }
+
+ public ContentHandler getContentHandler ( )
+ {
+ return _context == null ? null : this;
+ }
+
+ public LexicalHandler getLexicalHandler ( )
+ {
+ return _context == null ? null : this;
+ }
+
+ public XmlObject getObject ( ) throws XmlException
+ {
+ if (_context == null)
+ return null;
+
+ _context.finish();
+
+ _context = null;
+
+ Root.this.associateSourceName( _options );
+
+ return Root.this.autoTypedDocument( _type, _options );
+ }
+
+ private LoadContext _context;
+ private SchemaType _type;
+ private XmlOptions _options;
+ }
+
+ public XmlSaxHandler newSaxHandler ( SchemaType type, XmlOptions options )
+ {
+ return new XmlSaxHandlerImpl( type, options );
+ }
+
+ //
+ //
+ //
+
+ private void newParseSax ( InputSource in, XmlOptions options )
+ {
+ LoadContext context = new LoadContext( this, options );
+ }
+
+ //
+ // Helper object for creating documents in a "load" kinda way
+ //
+
+ static final class LoadContext
+ {
+ LoadContext ( Root root, XmlOptions options )
+ {
+ assert root != null;
+
+ _options = options = XmlOptions.maskNull( options );
+
+ _qnameCache = XmlBeans.getQNameCache();
+
+ if (options.hasOption( XmlOptions.LOAD_REPLACE_DOCUMENT_ELEMENT ))
+ {
+ QName name = (QName) options.get( XmlOptions.LOAD_REPLACE_DOCUMENT_ELEMENT );
+
+ if (name != null && name.getLocalPart().length() == 0)
+ {
+ throw
+ new IllegalArgumentException(
+ "Load Replace Document Element: Invalid name, local part empty" );
+ }
+
+ _discardDocElem = true;
+ _replaceDocElem = name;
+ }
+
+ _stripWhitespace = options.hasOption(XmlOptions.LOAD_STRIP_WHITESPACE);
+ _stripComments = options.hasOption(XmlOptions.LOAD_STRIP_COMMENTS);
+ _stripProcinsts = options.hasOption(XmlOptions.LOAD_STRIP_PROCINSTS);
+
+ _substituteNamespaces =
+ (Map) options.get(XmlOptions.LOAD_SUBSTITUTE_NAMESPACES);
+
+ _additionalNamespaces =
+ (Map) options.get(XmlOptions.LOAD_ADDITIONAL_NAMESPACES);
+
+ _root = root;
+ _root.ensureEmpty();
+
+ _lastNonAttr = _root._doc;
+ _lastSplay = _root._doc;
+ _lastPos = 0;
+
+ _frontier = _root._doc;
+ }
+
+ private Root getRoot ( )
+ {
+ return _root;
+ }
+
+ private int getCp ( Splay s )
+ {
+ assert _root.isLeftOnly();
+ assert dv > 0 || s.getCpSlow() == s.getCchLeft();
+ return s.getCchLeft();
+ }
+
+ private void adjustCch ( Splay s, int delta )
+ {
+ assert _root.isLeftOnly();
+
+ s.adjustCch( delta );
+
+ // There may be attrs after this splay which need their cchLeft's
+ // to be updated. To avoid splaying, update them by hand.
+
+ for ( s = s.nextSplay() ; s != null ; s = s.nextSplay() )
+ {
+ assert s.isAttr() || s.isRoot();
+ s.adjustCchLeft( delta );
+ }
+ }
+
+ private void insert ( Splay s )
+ {
+ assert !_finished;
+ assert s.getCch() == 0;
+
+ _root.insertSplay( s, _root._leftSplay );
+
+ _lastSplay = s;
+ _lastPos = 0;
+
+ if (!s.isAttr())
+ _lastNonAttr = s;
+ }
+
+ private void insert ( Splay s, char[] buf, int off, int cch )
+ {
+ assert !_finished;
+ assert s.getCch() == 0;
+ insert( s );
+ _root._text.insert( getCp( s ), buf, off, cch );
+ adjustCch( s, cch );
+ }
+
+ private void insert ( Splay s, String text )
+ {
+ assert !_finished;
+ assert s.getCch() == 0;
+ insert( s );
+ _root._text.insert( getCp( s ), text );
+ adjustCch( s, text.length() );
+ }
+
+ private void stripLeadingWhitespace ( )
+ {
+ int cchAfter = _lastNonAttr.getCchAfter();
+
+ if (cchAfter > 0)
+ {
+ int cch = cchAfter;
+
+ int cpAfter =
+ _lastNonAttr.getCpForPos(
+ _root, _lastNonAttr.getPosAfter() );
+
+ int off = _root._text.unObscure( cpAfter, cch );
+
+ for ( ; cch > 0 ; cch-- )
+ {
+ if (!isWhiteSpace( _root._text._buf[ off + cch - 1 ]))
+ break;
+ }
+
+ int delta = cch - cchAfter;
+
+ if (delta < 0)
+ {
+ _root._text.remove( cpAfter + cchAfter + delta, - delta );
+ _lastNonAttr.adjustCchAfter( delta );
+ adjustCch( _lastNonAttr, delta );
+ }
+ }
+ }
+
+ void abort ( )
+ {
+ // The shit must have hit the fan ...
+
+ // Close all elements
+
+ while ( _frontier != _root._doc )
+ end();
+
+ try
+ {
+ finish();
+ }
+ catch ( XmlException e )
+ {
+ assert false;
+ }
+ }
+
+ void finish ( ) throws XmlException
+ {
+ if (_stripWhitespace)
+ stripLeadingWhitespace();
+
+ // TODO: deal with unterminated begins here
+
+ if (_frontier != _root._doc)
+ throw new XmlException( "Document not ended" );
+
+ assert _root._leftOnly;
+
+ _finished = true;
+
+ _lastSplay = _root;
+ _lastPos = 0;
+
+ if (_options.hasOption(XmlOptions.LOAD_TRIM_TEXT_BUFFER))
+ _root._text.trim();
+
+ // If we have additional namespaces, add them now, making sure we
+ // done over ride exisitng ones.
+
+ if (_additionalNamespaces != null)
+ {
+ Splay s = _root._doc;
+
+ while ( !s.isRoot() && !s.isBegin() )
+ s = s.nextSplay();
+
+ if (s.isBegin())
+ {
+ java.util.Iterator i =
+ _additionalNamespaces.keySet().iterator();
+
+ while ( i.hasNext() )
+ {
+ String prefix = (String) i.next();
+
+ // Usually, this is the predefined xml namespace
+ if (prefix.toLowerCase().startsWith( "xml" ))
+ continue;
+
+ String namespace =
+ (String) _additionalNamespaces.get( prefix );
+
+ if (s.namespaceForPrefix( prefix, false ) == null)
+ {
+ _root.insertSingleSplaySansSplayInLeftOnlyTree(
+ new Xmlns( new QName( namespace, prefix ) ),
+ s );
+
+ // The above insert should not splay the tree
+ assert _root.isLeftOnly();
+ }
+ }
+ }
+ }
+
+ // For most of loading, I don't invalidate the document
+ // version because nothing should be sensitive to it while
+ // loading. When finished loading, bump it.
+
+ _root.invalidateVersion();
+
+ assert _root.isLeftOnly();
+ }
+
+ private QName checkName ( String local, String uri )
+ {
+ if (_substituteNamespaces != null)
+ {
+ String substituteUri =
+ (String) _substituteNamespaces.get( uri );
+
+ if (substituteUri != null)
+ return _qnameCache.getName( substituteUri, local );
+ }
+
+ return _qnameCache.getName( uri, local );
+ }
+
+ private QName checkName ( QName name )
+ {
+ if (_substituteNamespaces != null)
+ {
+ String substituteUri =
+ (String)
+ _substituteNamespaces.get( name.getNamespaceURI() );
+
+ if (substituteUri != null)
+ {
+ name =
+ _qnameCache.getName(
+ substituteUri, name.getLocalPart() );
+ }
+ }
+
+ return name;
+ }
+
+ private QName checkNameAttr ( String local, String uri )
+ {
+ if (_substituteNamespaces != null && uri.length() > 0)
+ {
+ String substituteUri =
+ (String) _substituteNamespaces.get( uri );
+
+ if (substituteUri != null)
+ return _qnameCache.getName( substituteUri, local );
+ }
+
+ return _qnameCache.getName( uri, local );
+ }
+
+ private QName checkNameAttr ( QName name )
+ {
+ if (_substituteNamespaces != null && name.getNamespaceURI().length() > 0 )
+ {
+ String substituteUri =
+ (String)
+ _substituteNamespaces.get( name.getNamespaceURI() );
+
+ if (substituteUri != null)
+ {
+ name =
+ _qnameCache.getName(
+ substituteUri, name.getLocalPart() );
+ }
+ }
+
+ return name;
+ }
+
+ void doctype ( String name, String publicID, String systemID )
+ {
+ _root._props.setDoctypeName( name );
+ _root._props.setDoctypePublicId( publicID );
+ _root._props.setDoctypeSystemId( systemID );
+ }
+
+ private void insertBegin ( QName name )
+ {
+ if (_stripWhitespace)
+ stripLeadingWhitespace();
+
+ if (_frontier.isDoc() && !_docElemDiscarded &&
+ (_discardDocElem || isXmlFragment( name )))
+ {
+ _docElemDiscarded = true;
+
+ if (_replaceDocElem == null)
+ {
+ // Remove all content up to now because the
+ // document element is to be removed, and I dont
+ // want that content to mix with the real content.
+
+ _root.ensureEmpty();
+ _lastNonAttr = _root._doc;
+ _lastSplay = _root._doc;
+ _lastPos = 0;
+ _frontier = _root._doc;
+
+ return;
+ }
+
+ name = _replaceDocElem;
+ }
+
+ insert( _frontier = new Begin( name, _frontier ) );
+ }
+
+ void begin ( String local, String uri )
+ {
+ insertBegin( checkName( local, uri ) );
+ }
+
+ void begin ( QName name )
+ {
+ insertBegin( checkName( name ) );
+ }
+
+ void end ( )
+ {
+ if (_stripWhitespace)
+ stripLeadingWhitespace();
+
+ if (_frontier.isDoc())
+ {
+ if (!_docElemDiscarded)
+ throw new IllegalStateException( "Too many end elements" );
+ }
+ else
+ {
+ assert !_finished;
+ assert _frontier.isBegin();
+ assert !_frontier.isLeaf();
+
+ if (_lastNonAttr == _frontier)
+ {
+ _lastSplay = _frontier;
+ _lastPos = 1 + _frontier.getCch();
+ _frontier.toggleIsLeaf();
+ int cch = _frontier.getCchAfter();
+ _frontier.adjustCchAfter( - cch );
+ }
+ else
+ {
+ Begin b = (Begin) _frontier;
+ End e = new End( b );
+ b._end = e;
+ insert( e );
+ }
+
+ _frontier = _frontier.getContainer();
+ }
+ }
+
+ void attr ( QName name, char[] buf, int off, int cch )
+ {
+ insert( new Attr( checkNameAttr( name ) ), buf, off, cch );
+ }
+
+ void attr ( QName name, String value )
+ {
+ insert( new Attr( checkNameAttr( name ) ), value );
+ }
+
+ void attr ( String local, String uri, String value )
+ {
+ insert( new Attr( checkNameAttr( local, uri ) ), value );
+ }
+
+ private boolean discardXmlns ( QName name )
+ {
+ return
+ _docElemDiscarded && _frontier.isDoc() &&
+ name.getNamespaceURI().equals( _openFragUri );
+ }
+
+ void xmlns ( String prefix, String uri )
+ {
+ QName name = checkName( prefix, uri );
+
+ if (!discardXmlns( name ))
+ insert( new Xmlns( name ) );
+ }
+
+ void xmlns ( QName name )
+ {
+ name = checkName( name );
+
+ if (!discardXmlns( name ))
+ insert( new Xmlns( name ) );
+ }
+
+ void comment ( char[] buf, int off, int cch )
+ {
+ if (!_stripComments)
+ insert( new Comment(), buf, off, cch );
+ }
+
+ void comment ( String value )
+ {
+ if (!_stripComments)
+ insert( new Comment(), value );
+ }
+
+ void procinst ( String target, char[] buf, int off, int cch )
+ {
+ if (!_stripProcinsts)
+ insert( new Procinst( target ), buf, off, cch );
+ }
+
+ void procinst ( String target, String value )
+ {
+ if (!_stripProcinsts)
+ insert( new Procinst( target ), value );
+ }
+
+ //
+ // returns the cp where new text should go.
+ //
+
+ int preText ( )
+ {
+ assert !_finished;
+
+ return getCp( _lastNonAttr ) + _lastNonAttr.getCch();
+ }
+
+ //
+ // New text has been placed, adjust...
+ //
+
+ void postText ( int cp, int cch )
+ {
+ if (_stripWhitespace && _lastNonAttr.getCchAfter() == 0)
+ {
+ int off = _root._text.unObscure( cp, cch );
+
+ int i = 0;
+
+ while ( i < cch && isWhiteSpace( _root._text._buf[ off + i ] ) )
+ i++;
+
+ if (i > 0)
+ {
+ _root._text.remove( cp, i );
+ cch -= i;
+ }
+ }
+
+ if (cch > 0)
+ {
+ _lastSplay = _lastNonAttr;
+ _lastPos = _lastNonAttr.getEndPos();
+ _lastNonAttr.adjustCchAfter( cch );
+
+ adjustCch( _lastNonAttr, cch );
+ }
+ }
+
+ void text ( char[] buf, int off, int cch )
+ {
+ assert !_finished;
+
+ int start = off;
+ int end = off + cch;
+
+ if (_stripWhitespace && _lastNonAttr.getCchAfter() == 0)
+ {
+ while ( start < end && isWhiteSpace( buf[ start ] ) )
+ start++;
+ }
+
+ int cchText = end - start;
+
+ if (cchText > 0)
+ {
+ _lastSplay = _lastNonAttr;
+ _lastPos = _lastNonAttr.getEndPos();
+
+ _root._text.insert(
+ getCp( _lastNonAttr ) + _lastNonAttr.getCch(),
+ buf, start, cchText );
+
+ _lastNonAttr.adjustCchAfter( cchText );
+ adjustCch( _lastNonAttr, cchText );
+ }
+ }
+
+ void text ( String text )
+ {
+ assert !_finished;
+
+ int start = 0;
+ int end = text.length();
+
+ if (_stripWhitespace && _lastNonAttr.getCchAfter() == 0)
+ {
+ while ( start < end && isWhiteSpace( text.charAt( start ) ) )
+ start++;
+ }
+
+ int cchText = end - start;
+
+ if (cchText > 0)
+ {
+ _lastSplay = _lastNonAttr;
+ _lastPos = _lastNonAttr.getEndPos();
+
+ _root._text.insert(
+ getCp( _lastNonAttr ) + _lastNonAttr.getCch(),
+ text, start, cchText );
+
+ _lastNonAttr.adjustCchAfter( cchText );
+ adjustCch( _lastNonAttr, cchText );
+ }
+ }
+
+ // Annotates the last thing inserted
+ void annotate ( XmlBookmark xmlBookmark )
+ {
+ new Annotation( _root, xmlBookmark ).
+ set( _lastSplay, _lastPos );
+ }
+
+ void lineNumberAnnotation ( int line, int column, int offset )
+ {
+ annotate( new XmlLineNumber( line, column, offset ) );
+ }
+
+ void lineNumberAnnotation ( XMLEvent xe )
+ {
+ Location loc = xe.getLocation();
+
+ if (loc != null)
+ {
+ lineNumberAnnotation(
+ loc.getLineNumber(), loc.getColumnNumber(), -1 );
+ }
+ }
+
+ void javelinAnnotation ( XmlCursor.XmlBookmark ja )
+ {
+ if (ja != null)
+ annotate( ja );
+ }
+
+ private Root _root;
+ private Splay _lastNonAttr;
+ private Container _frontier;
+ private Splay _lastSplay;
+ private int _lastPos;
+ private boolean _finished;
+ private boolean _discardDocElem;
+ private QName _replaceDocElem;
+ private boolean _stripWhitespace;
+ private boolean _stripComments;
+ private boolean _stripProcinsts;
+ private boolean _docElemDiscarded;
+ private Map _substituteNamespaces;
+ private Map _additionalNamespaces;
+ private QNameCache _qnameCache;
+ private XmlOptions _options;
+ }
+
+ private void loadNodeChildren ( Node n, LoadContext context )
+ {
+ for ( Node c = n.getFirstChild() ; c != null ; c = c.getNextSibling() )
+ loadNode( c, context );
+ }
+
+ private void loadNode ( Node n, LoadContext context )
+ {
+ switch ( n.getNodeType() )
+ {
+ case Node.DOCUMENT_NODE :
+ case Node.DOCUMENT_FRAGMENT_NODE :
+ case Node.ENTITY_REFERENCE_NODE :
+ {
+ loadNodeChildren( n, context );
+
+ break;
+ }
+ case Node.ELEMENT_NODE :
+ {
+ String localName = n.getLocalName();
+
+ if (localName == null)
+ localName = n.getNodeName();
+
+ context.begin( localName, n.getNamespaceURI() );
+
+ NamedNodeMap attrs = n.getAttributes();
+
+ for ( int i = 0 ; i < attrs.getLength() ; i++ )
+ {
+ Node a = attrs.item( i );
+
+ String uri = a.getNamespaceURI();
+ String local = a.getLocalName();
+ String value = a.getNodeValue();
+
+ if (local == null)
+ local = a.getNodeName();
+
+ if (uri != null && uri.equals( _xmlnsUri ))
+ {
+ if (local.equals( "xmlns" ))
+ context.xmlns( "", value );
+ else
+ context.xmlns( local, value );
+ }
+ else
+ {
+ context.attr( local, uri, value );
+ }
+ }
+
+ loadNodeChildren( n, context );
+
+ context.end();
+
+ break;
+ }
+ case Node.TEXT_NODE :
+ case Node.CDATA_SECTION_NODE :
+ {
+ context.text( n.getNodeValue() );
+ break;
+ }
+ case Node.COMMENT_NODE :
+ {
+ context.comment( n.getNodeValue() );
+ break;
+ }
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ {
+ context.procinst( n.getNodeName(), n.getNodeValue() );
+ break;
+ }
+ case Node.DOCUMENT_TYPE_NODE :
+ case Node.ENTITY_NODE :
+ case Node.NOTATION_NODE :
+ case Node.ATTRIBUTE_NODE :
+ {
+ throw new RuntimeException( "Unexpected node" );
+ }
+ }
+ }
+
+ public XmlObject loadXml ( Node node, SchemaType type, XmlOptions options )
+ throws XmlException
+ {
+ LoadContext context = new LoadContext( this, options );
+
+ loadNode( node, context );
+
+ associateSourceName( options );
+
+ return autoTypedDocument( type, options );
+ }
+
+ public XmlObject loadXml (
+ XMLInputStream xis, SchemaType type, XmlOptions options )
+ throws XMLStreamException, XmlException
+ {
+ loadXmlInputStream( xis, options );
+
+ return autoTypedDocument( type, options );
+ }
+
+ public void loadXmlInputStream ( XMLInputStream xis, XmlOptions options )
+ throws XMLStreamException, XmlException
+ {
+ options = XmlOptions.maskNull( options );
+
+ XMLEvent x = xis.peek();
+
+ if (x != null && x.getType() == XMLEvent.START_ELEMENT)
+ {
+ Map nsMap = ((StartElement) x).getNamespaceMap();
+
+ if (nsMap != null && nsMap.size() > 0)
+ {
+ Map namespaces = new HashMap();
+
+ namespaces.putAll( nsMap );
+
+ options = new XmlOptions( options );
+
+ options.put( XmlOptions.LOAD_ADDITIONAL_NAMESPACES, namespaces );
+ }
+ }
+
+ LoadContext context = new LoadContext( this, options );
+
+ boolean lineNums = options.hasOption( XmlOptions.LOAD_LINE_NUMBERS );
+
+ events:
+ for ( XMLEvent xe = xis.next() ; xe != null ; xe = xis.next() )
+ {
+ switch ( xe.getType() )
+ {
+ case XMLEvent.START_DOCUMENT :
+ // BUGBUG (ericvas) 12258 - FIXED below
+ StartDocument doc = (StartDocument) xe;
+
+// context.doctype(
+// doc.getname().getLocalName(),
+// "", doc.getPublicId()
+
+ _props.setDoctypeSystemId( doc.getSystemId() );
+// _publicID = doc.getPublicId();
+ _props.setEncoding( doc.getCharacterEncodingScheme() );
+ _props.setVersion( doc.getVersion() );
+ _standAlone = doc.isStandalone();
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+
+ break;
+
+ case XMLEvent.END_DOCUMENT :
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+
+ break events;
+
+ case XMLEvent.NULL_ELEMENT :
+ if (!xis.hasNext())
+ break events;
+ break;
+
+ case XMLEvent.START_ELEMENT :
+ context.begin( XMLNameHelper.getQName( xe.getName() ) );
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+
+ for ( AttributeIterator ai = ((StartElement) xe).getAttributes()
+ ; ai.hasNext() ; )
+ {
+ Attribute attr = ai.next();
+
+ context.attr(
+ XMLNameHelper.getQName( attr.getName() ),
+ attr.getValue() );
+ }
+
+ for ( AttributeIterator ai = ((StartElement) xe).getNamespaces()
+ ; ai.hasNext() ; )
+ {
+ Attribute attr = ai.next();
+
+ XMLName name = attr.getName();
+ String local = name.getLocalName();
+
+ if (name.getPrefix() == null && local.equals( "xmlns" ))
+ local = "";
+
+ context.xmlns( local, attr.getValue() );
+ }
+
+ break;
+
+ case XMLEvent.END_ELEMENT :
+ context.end();
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+
+ break;
+
+ case XMLEvent.SPACE :
+ if (((Space) xe).ignorable())
+ break;
+
+ // Fall through
+
+ case XMLEvent.CHARACTER_DATA :
+ CharacterData cd = (CharacterData) xe;
+
+ if (cd.hasContent())
+ {
+ context.text( cd.getContent() );
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+ }
+
+ break;
+
+ case XMLEvent.COMMENT :
+ org.apache.xmlbeans.xml.stream.Comment comment =
+ (org.apache.xmlbeans.xml.stream.Comment) xe;
+
+ if (comment.hasContent())
+ {
+ context.comment( comment.getContent() );
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+ }
+
+ break;
+
+ case XMLEvent.PROCESSING_INSTRUCTION :
+ ProcessingInstruction procInstr = (ProcessingInstruction) xe;
+
+ context.procinst( procInstr.getTarget(), procInstr.getData() );
+
+ if (lineNums)
+ context.lineNumberAnnotation( xe );
+
+ break;
+
+ // These are ignored
+ case XMLEvent.ENTITY_REFERENCE :
+ case XMLEvent.START_PREFIX_MAPPING :
+ case XMLEvent.END_PREFIX_MAPPING :
+ case XMLEvent.CHANGE_PREFIX_MAPPING :
+ case XMLEvent.XML_EVENT :
+ break;
+
+ default :
+ throw new RuntimeException(
+ "Unhandled xml event type: " + xe.getTypeAsString() );
+ }
+ }
+
+ context.finish();
+
+ associateSourceName( options );
+
+ assert validate();
+ assert isLeftOnly();
+ }
+
+ public static void dump ( XmlObject x )
+ {
+ dump( x, System.out );
+ }
+
+ public static void dump ( XmlObject x, PrintStream ps )
+ {
+ XmlCursor xc = x.newCursor();
+ Root r = ((Cursor) xc).getRoot();
+ r.dump( ps, null, ((Cursor) xc).getSplay(), false );
+ xc.dispose();
+ }
+
+ public static void dump ( XmlCursor xc )
+ {
+ dump( xc, System.out );
+ }
+
+ public static void dump ( XmlCursor xc, PrintStream ps )
+ {
+ Root r = ((Cursor) xc).getRoot();
+ r.dump( ps, null, ((Cursor) xc).getSplay(), false );
+ }
+
+ //
+ //
+ //
+
+ private void dumpText ( PrintStream ps, int cp, int cch, Splay s, int p )
+ {
+ if (cp >= 0 && cp + cch <= _text.length())
+ dumpString( ps, _text.fetch( cp, cch ), s, p );
+ else
+ ps.print( "[string: cp=" + cp + ", cch=" + cch + " ]" );
+ }
+
+ private void dumpText ( PrintStream ps, int cp, int cch )
+ {
+ if (cp >= 0 && cp + cch <= _text.length())
+ dumpString( ps, _text.fetch( cp, cch ), null, 0 );
+ else
+ ps.print( "[string: cp=" + cp + ", cch=" + cch + " ]" );
+ }
+
+ private void dumpString ( PrintStream ps, String s )
+ {
+ dumpString( ps, s, null, 0 );
+ }
+
+ private void dumpGoobersInline ( PrintStream ps, Splay s, int p )
+ {
+ for ( Goober g = s.firstGoober() ; g != null ;
+ g = s.nextGoober( g ) )
+ {
+ if (g.getKind() == CURSOR && g.getPos() == p)
+ {
+ CursorGoober cg = (CursorGoober) g;
+
+ ps.print( "[" + ((CursorGoober) g).getDebugId() + "]" );
+ }
+ }
+ }
+
+ private void dumpString ( PrintStream ps, String str, Splay s, int p )
+ {
+ for ( int i = 0 ; i < str.length() ; i++ )
+ {
+ if (s != null)
+ dumpGoobersInline( ps, s, i + p );
+
+ if (i == 36)
+ {
+ ps.print( "..." );
+ break;
+ }
+
+ char ch = str.charAt( i );
+
+ if (ch == '\n')
+ ps.print( "\\n" );
+ else if (ch == '\r')
+ ps.print( "\\r" );
+ else if (ch == '\t')
+ ps.print( "\\t" );
+ else if (ch == '\"')
+ ps.print( "\\\"" );
+ else
+ ps.print( ch );
+ }
+ }
+
+ private void dumpGoobers ( PrintStream ps, Goober g )
+ {
+ if (g == null)
+ return;
+
+ if (g.getKind() == AGGREGATE)
+ {
+ ps.print( " {" );
+ dumpGoobers( ps, g._goobers );
+ ps.print( "}" );
+ }
+ else
+ ps.print( " - " + g.getKindName() + " pos: " + g.getPos() );
+
+ if (g.getKind() == CURSOR)
+ ps.print( " id: " + ((CursorGoober) g).getDebugId() );
+
+ if (g._next != g._parent._goobers)
+ dumpGoobers( ps, g._next );
+ }
+
+ private void dumpSplayTree( Splay s, PrintStream ps )
+ {
+ if (s == null)
+ return;
+
+ if (s._rightSplay != null)
+ dumpSplayTree( s._rightSplay, ps );
+
+ for ( Splay t = s._parentSplay ; t != null ; t = t._parentSplay )
+ ps.print( " " );
+
+ ps.print( "[" + s.getDebugId() );
+ ps.print( " c:" + s.getCchLeft() + "(" + s.getCch() + ")");
+ ps.print( " b:" + s.getCdocBeginLeft() + "(" + s.getCdocBegin() + ")");
+
+ if (s._parentSplay != null)
+ {
+ ps.print( " p:" + s._parentSplay.getDebugId() );
+ ps.print( s._parentSplay._leftSplay == s ? "L" : "R" );
+ }
+
+ ps.println( "]" );
+
+ if (s._leftSplay != null)
+ dumpSplayTree( s._leftSplay, ps );
+ }
+
+ public static void dump ( XmlCursor c, boolean verbose )
+ {
+ ((Cursor) c).dump( verbose );
+ }
+
+ public void dump ( )
+ {
+ dump( System.out, null, this, false );
+ }
+
+ public void dump ( boolean verbose )
+ {
+ dump( System.out, null, this, verbose );
+ }
+
+ public void dump ( PrintStream ps )
+ {
+ dump( ps, null, this, false );
+ }
+
+ public void dump ( PrintStream ps, String msg, Object src, boolean verbose )
+ {
+ // Under IntelliJ, if you call a function from the expression
+ // evaluator and it produces too much output, IntelliJ will not
+ // show you the output of the function. So, I dump to a file
+ // here as well and the given print stream!
+
+ File f = new File( "c:\\" );
+
+ if (f.exists())
+ {
+ f = new File( f, "xbean.dmp" );
+
+ OutputStream os = null;
+ PrintStream ps2 = null;
+
+ try
+ {
+ os = new FileOutputStream( f );
+ ps2 = new PrintStream( os );
+
+ doDump( ps2, msg, src, verbose );
+ }
+ catch ( Throwable t )
+ {
+ if (ps2 != null)
+ {
+ ps2.println( "Exception during dump." );
+ t.printStackTrace( ps2 );
+ }
+ }
+
+ if (os != null)
+ {
+ try { os.close(); } catch ( Exception e ) { }
+ }
+ }
+
+ try
+ {
+ doDump( ps, msg, src, verbose );
+ }
+ catch ( Throwable t )
+ {
+ System.out.println( "Exception during dump." );
+ t.printStackTrace( System.out );
+ }
+ }
+
+ static class DumpNsManager implements NamespaceManager
+ {
+ DumpNsManager ( PrintStream ps )
+ {
+ this.ps = ps;
+ }
+
+ public String find_prefix_for_nsuri ( String uri, String suggestion )
+ {
+ String prefix = "debug_prefix_" + i++;
+
+ ps.print( " [find_prefix_for_nsuri: " );
+ ps.print( "\"" + uri + "\" (" + suggestion + ") -> " + prefix );
+ ps.print( "]" );
+
+ return prefix;
+ }
+
+ public String getNamespaceForPrefix ( String prefix )
+ {
+ if (prefix != null && prefix.equals( "xml" ))
+ return _xml1998Uri;
+
+ String uri = "debug_ns_" + i++;
+
+ ps.print( " [lookup_nsuri_for_prefix: " );
+ ps.print( prefix + " -> \"" + uri + "\"" );
+ ps.print( "]" );
+
+ return uri;
+ }
+
+ PrintStream ps;
+
+ private int i = 1;
+ }
+
+ public void doDump (
+ PrintStream ps, String msg, Object src, boolean verbose )
+ {
+ if (!_assertEnabled)
+ {
+ ps.println( "No dump produced (assert needs to be enabled)" );
+ return;
+ }
+
+ NamespaceManager nsm = new DumpNsManager( ps );
+
+ if (msg != null)
+ ps.println( msg );
+ else
+ ps.println( "Dump:" );
+
+ if (src != null)
+ {
+ if (src instanceof Cursor)
+ {
+ ps.println(
+ " from cursor " + ((CursorGoober)((Cursor) src)._data._goober).getDebugId() );
+ }
+ else if (src instanceof Splay)
+ ps.println( " from splay " + ((Splay) src).getDebugId() );
+ else
+ ps.println( " from src " + src );
+ }
+
+ int depth = 0;
+
+ for ( Splay s = _doc ; s != null ; s = s.nextSplay() )
+ {
+ int kind = s.getKind();
+
+ String ids = "" + s.getDebugId();
+ ids = " ".substring( 0, 6 - ids.length() ) + ids;
+ ps.print( ids + ": " );
+
+ if (kind == END)
+ depth--;
+
+ if (!s.isRoot())
+ {
+ for ( int i = 0 ; i < depth ; i++ )
+ ps.print( " " );
+ }
+
+ dumpGoobersInline( ps, s, 0 );
+
+ switch ( kind )
+ {
+ case DOC :
+ ps.print( "DOC" );
+ break;
+
+ case BEGIN :
+ {
+ Begin b = (Begin) s;
+
+ if (!b.isLeaf())
+ depth++;
+
+ ps.print( "<" );
+ ps.print( s.getName().toString() );
+ ps.print( ">" );
+
+ if (b.isLeaf())
+ {
+ if (b.getCchValue() > 0)
+ {
+ ps.print( "\"" );
+ dumpText( ps, s.getCpSlow(), b.getCchValue(), s, 1 );
+ ps.print( "\"" );
+ }
+
+ dumpGoobersInline( ps, s, s.getPosLeafEnd() );
+
+ ps.print( "</" );
+ ps.print( s.getName().getLocalPart() );
+ ps.print( "/>" );
+ }
+
+ break;
+ }
+
+ case ATTR :
+ {
+ if (s.isXmlns())
+ {
+ ps.print( "#xmlns:" );
+ ps.print( s.getName().getLocalPart() );
+ ps.print( "=\"" );
+ ps.print( s.getName().getNamespaceURI() );
+ ps.print( "\"" );
+ }
+ else
+ {
+ ps.print( "@" );
+ ps.print( s.getName() );
+ ps.print( "=\"" );
+ dumpText( ps, s.getCpSlow(), s.getCchValue() );
+ ps.print( "\"" );
+ }
+
+ break;
+ }
+
+ case END :
+ {
+ End es = (End) s;
+ Begin b = es._begin;
+
+ ps.print( "</" );
+ ps.print( b.getName().getLocalPart() );
+ ps.print( "/>" );
+
+ break;
+ }
+
+ case COMMENT :
+ {
+ if (s.isFragment())
+ {
+ ps.print( "FRAG" );
+ }
+ else
+ {
+ ps.print( "<!--" );
+ dumpText( ps, s.getCpSlow(), s.getCchValue() );
+ ps.print( "-->" );
+ }
+ break;
+ }
+
+ case PROCINST :
+ {
+ ps.print( "<?" );
+ ps.print( s.getLocal() );
+ ps.print( " " );
+ dumpText( ps, s.getCpSlow(), s.getCchValue() );
+ ps.print( "?>" );
+ break;
+ }
+
+ case ROOT :
+ {
+ ps.print( "ROOT" );
+ break;
+ }
+
+ default:
+ throw new RuntimeException( "Unknown splay kind" );
+ }
+
+ if (s.getCchAfter() > 0)
+ {
+ ps.print( "\"" );
+
+ dumpText(
+ ps, s.getCpSlow() + s.getCchValue(), s.getCchAfter(),
+ s, s.getPosAfter() );
+
+ ps.print( "\"" );
+ }
+
+ dumpGoobersInline( ps, s, s.getEndPos() );
+
+ if (s.isInvalid())
+ {
+ String value = s.peekType().build_text( nsm );
+
+ ps.print( " [invalid:" );
+ ps.print( "\"" );
+ dumpString( ps, value );
+ ps.print( "\"" );
+ ps.print( "]" );
+ }
+
+ dumpGoobers( ps, s._goobers );
+
+ if (verbose)
+ {
+ switch ( kind )
+ {
+ case BEGIN :
+ {
+ Begin b = (Begin) s;
+
+ if (b.getFinish() != null)
+ {
+ ps.print( " [end: " );
+ ps.print( b.getFinish().getDebugId() );
+ ps.print( "]" );
+ }
+
+ if (b.getContainer() != null)
+ {
+ ps.print(
+ " [container: " +
+ b.getContainer().getDebugId() + "]" );
+ }
+
+ break;
+ }
+
+ case END :
+ {
+ End es = (End) s;
+ Begin b = es._begin;
+
+ ps.print( " [begin: " + b.getDebugId() + "]" );
+
+ break;
+ }
+ }
+ }
+
+ ps.println();
+ }
+
+ ps.println();
+
+ if (getCchLeft() > _text.length())
+ {
+ ps.println(
+ "Text buffer has too few characters (" +
+ (getCchLeft() - _text.length()) + ")" );
+ }
+ else if (getCchLeft() < _text.length())
+ {
+ ps.println(
+ "Text buffer has too many characters (" +
+ (_text.length() - getCchLeft()) + "): " );
+
+ dumpString(
+ ps,
+ _text.fetch( getCchLeft(), _text.length() - getCchLeft() ) );
+ }
+
+ if (verbose)
+ {
+ ps.println( "Splay tree:" );
+
+ ps.println( " isLeftOnly: " + _leftOnly );
+ ps.println( " version: " + getVersion() );
+ ps.println( " first: " + _doc.getDebugId() );
+
+ ps.println();
+ dumpSplayTree( this, ps );
+ ps.println();
+ ps.println();
+ }
+
+ ps.println();
+ }
+
+ /**
+ * Insert a splay (or splays) into the tree. This is a low level
+ * operation, and operates only on the splay aspect of the tree.
+ * Any invalidation maintenance must be handled by callers.
+ */
+
+ void insertSplay ( Splay s, Splay a )
+ {
+ assert s != null;
+ assert !s.isRoot();
+ assert a != null;
+ assert Root.dv > 0 || validateSplayTree();
+ assert !a.isRoot();
+ assert Root.dv > 0 || a.getRootSlow() == this;
+ assert s._parentSplay == null;
+ assert s._rightSplay == null;
+ assert s._leftSplay != null || s.getCchLeft() == 0;
+ assert s._leftSplay != null || s.getCdocBeginLeft() == 0;
+
+ int cch = s.getCch();
+ int cbegin = s.getCdocBegin();
+
+ if (s._leftSplay != null)
+ {
+ cch += s.getCchLeft();
+ cbegin += s.getCdocBeginLeft();
+ _leftOnly = false;
+ }
+
+ if (_leftOnly && a == _leftSplay)
+ {
+ s._leftSplay = _leftSplay;
+ s._parentSplay = this;
+
+ assert s.getCchLeft() == 0;
+ s.adjustCchLeft(
+ _leftSplay.getCchLeft() + _leftSplay.getCch() );
+
+ assert s.getCdocBeginLeft() == 0;
+ s.adjustCdocBeginLeft(
+ _leftSplay.getCdocBeginLeft() + _leftSplay.getCdocBegin() );
+
+ _leftSplay._parentSplay = s;
+ _leftSplay = s;
+
+ adjustCchLeft( cch );
+ adjustCdocBeginLeft( cbegin );
+ }
+ else if (_leftOnly && cch == 0 && cbegin == 0)
+ {
+ //
+ // If the splay to insert has no cch or cbegin, then when
+ // the tree is left only children, I need not splay.
+ //
+
+ s._parentSplay = a._parentSplay;
+ s._leftSplay = a;
+ a._parentSplay = s;
+ s._parentSplay._leftSplay = s;
+
+ s.adjustCchLeft( a.getCchLeft() + a.getCch() );
+
+ s.adjustCdocBeginLeft(
+ a.getCdocBeginLeft() + a.getCdocBegin() );
+ }
+ else
+ {
+ Splay p;
+
+ if (a._rightSplay == null)
+ {
+ (p = a)._rightSplay = s;
+ _leftOnly = false;
+ }
+ else
+ {
+ for ( p = a._rightSplay ; p._leftSplay != null ; )
+ p = p._leftSplay;
+
+ p._leftSplay = s;
+ }
+
+ s._parentSplay = p;
+
+ for ( p = s ; ; )
+ {
+ Splay t = p._parentSplay;
+
+ if (t == null)
+ break;
+
+ if (t._leftSplay == p)
+ {
+ t.adjustCchLeft( cch );
+ t.adjustCdocBeginLeft( cbegin );
+ }
+
+ p = t;
+ }
+
+ s.splay( this, this );
+ }
+
+ assert validateSplayTree();
+ }
+
+ /**
+ * Special insert to insert a single splay into a leftonly tree without
+ * causing the tree to go non left only. Because this does not splay,
+ * doing this too many times can be very inefficient.
+ */
+
+ void insertSingleSplaySansSplayInLeftOnlyTree ( Splay s, Splay a )
+ {
+ assert _leftOnly;
+ assert s._rightSplay == null;
+ assert s._leftSplay == null;
+
+ s._leftSplay = a;
+ s._parentSplay = a._parentSplay;
+ a._parentSplay._leftSplay = s;
+ a._parentSplay = s;
+
+ s.adjustCchLeft( a.getCchLeft() + a.getCch() );
+ s.adjustCdocBeginLeft( a.getCdocBeginLeft() + a.getCdocBegin() );
+
+ int cch = s.getCch();
+ int cbegin = s.getCdocBegin();
+
+ for ( Splay p = s._parentSplay ; p != null ; p = p._parentSplay )
+ {
+ p.adjustCchLeft( cch );
+ p.adjustCdocBeginLeft( cbegin );
+ }
+ }
+
+ /**
+ * Remove [ first, last ) splays from total sequence:
+ *
+ * A - first - B - x - last - C
+ *
+ * where first, last and x are individual splays and A, B and C are
+ * multiple, intervening splays. Return the result with x at the top
+ * and first his left child. This allows x to have the splay
+ * characteristics for the whole removed tree.
+ */
+
+ Splay removeSplays ( Splay first, Splay last )
+ {
+ assert validateSplayTree();
+ assert first != last;;
+ assert !first.isRoot();
+ assert !first.isDoc();
+ assert Root.dv > 0 || first.getRootSlow() == this;
+ assert Root.dv > 0 || last.getRootSlow() == this;
+ assert Root.dv > 0 || first.compareSlow( last ) == -1;
+ assert !last.isRoot() || last == this;
+
+ Splay x = last.prevSplay();
+
+ if (x == first)
+ return x.removeSplay( this );
+
+ // Make the dog leg!
+
+ if (last != this)
+ last.splay( this, this );
+
+ x.splay( this, last );
+ first.splay( this, x );
+
+ assert this == last || this._leftSplay == last;
+ assert last._leftSplay == x;
+ assert x._leftSplay == first;
+ assert x._rightSplay == null;
+ assert first._leftSplay != null;
+
+ int firstCchLeft = first.getCchLeft();
+ int firstCbeginLeft = first.getCdocBeginLeft();
+
+ int deltaCchLeft = firstCchLeft - last.getCchLeft();
+ int deltaCbeginLeft = firstCbeginLeft - last.getCdocBeginLeft();
+
+ last.adjustCchLeft( deltaCchLeft );
+ last.adjustCdocBeginLeft( deltaCbeginLeft );
+
+ if (last != this)
+ {
+ adjustCchLeft( deltaCchLeft );
+ adjustCdocBeginLeft( deltaCbeginLeft );
+ }
+
+ x.adjustCchLeft( - firstCchLeft );
+ x.adjustCdocBeginLeft( - firstCbeginLeft );
+
+ first.adjustCchLeft( - firstCchLeft );
+ first.adjustCdocBeginLeft( - firstCbeginLeft );
+
+ assert first.getCchLeft() == 0;
+ assert first.getCdocBeginLeft() == 0;
+
+ assert x.getCchLeft() + deltaCchLeft + x.getCch() == 0;
+ assert x.getCdocBeginLeft() + deltaCbeginLeft + x.getCdocBegin() == 0;
+
+ first._leftSplay._parentSplay = last;
+ last._leftSplay = first._leftSplay;
+ x._parentSplay = null;
+
+ first._leftSplay = null;
+ first._parentSplay = null;
+
+ assert validateSplayTree();
+
+ return x;
+ }
+
+ public static synchronized boolean disableStoreValidation ( )
+ { dv++; return true; }
+
+ public static synchronized boolean enableStoreValidation ( )
+ { dv--; return true; }
+
+ public static int dv;
+
+ {
+ if (!"true".equals( System.getProperty( "treeasserts" )))
+ disableStoreValidation();
+ }
+
+ public boolean validate ( )
+ {
+ if (dv != 0)
+ return true;
+
+ try
+ {
+ return doValidate();
+ }
+ catch ( RuntimeException rte )
+ {
+ System.out.println( "Document invalid: " + rte.getMessage() );
+ rte.printStackTrace();
+ dump( true );
+ throw rte;
+ }
+ }
+
+ //
+ // Recursive descent validation of the content of the document
+ //
+ // Grammer for valid content of a document
+ //
+ // <doc> ::= DOC <attributes> <content> ROOT
+ // <attributes> ::= ( ATTR )*
+ // <content> ::= ( ( COMMENT | PROCINST | <element>) )*
+ // <element> ::= ( LEAF <attributes> ) |
+ // ( BEGIN <attributes> <content> END )
+ //
+
+ private Splay validateAttributes ( Splay s )
+ {
+ while ( s.getKind() == ATTR )
+ s = s.nextSplay();
+
+ return s;
+ }
+
+ private Splay validateContent ( Splay s )
+ {
+ for ( ; ; )
+ {
+ int k = s.getKind();
+
+ if (k == COMMENT || k == PROCINST)
+ s = s.nextSplay();
+ else
+ {
+ Splay q = s;
+ s = validateElement( s );
+
+ if (q == s)
+ break;
+ }
+ }
+
+ return s;
+ }
+
+ private Splay validateElement ( Splay s )
+ {
+ if (s.getKind() == BEGIN)
+ {
+ Splay b = s;
+
+ s = validateAttributes( s.nextSplay() );
+
+ if (!b.isLeaf())
+ {
+ s = validateContent( s );
+
+ assert s.isEnd(): "Missing END, splay: " + s.getDebugId();
+
+ s = s.nextSplay();
+ }
+ }
+
+ return s;
+ }
+
+ private boolean validateDoc ( )
+ {
+ Splay s = _doc.nextSplay();
+
+ s = validateAttributes( s );
+
+ s = validateContent( s );
+
+ assert s.isRoot(): "Expected root";
+
+ return true;
+ }
+
+ private static class ValidateContext
+ {
+ int _numSplayTypes;
+ int _cInvalidatableTypes;
+ int _cElemOrderSensitiveTypes;
+ }
+
+ private void validateGoober ( Goober g, Splay s, ValidateContext context )
+ {
+ if (g instanceof Type)
+ {
+ assert g.getKind() == TYPE;
+ assert s.isTypeable();
+
+ context._numSplayTypes++;
+
+ Type type = (Type) g;
+
+ if (type.uses_invalidate_value())
+ context._cInvalidatableTypes++;
+
+ if (type.is_child_element_order_sensitive())
+ context._cElemOrderSensitiveTypes++;
+ }
+ else
+ {
+ assert g.getKind() != TYPE;
+ }
+
+ assert g.getSplay() == s;
+ assert g.getRoot() == this;
+ assert g.getPos() >= 0;
+ assert g.getPos() <= s.getMaxPos();
+ }
+
+ private boolean doValidate ( )
+ {
+ assert validateDoc();
+ assert validateSplayTree();
+ assert getCchLeft() == _text.length();
+
+ validateChangeListenerState();
+
+// TODO: Validate that is the root type is null, there are no types in
+// tree at all
+
+// TODO: Check the invarient that if there is a Type anywhere
+// in the document, that there is an existing chain of types
+// all the way to the root and is_ok_element_user or is_ok_attribute_user,
+// depending on the case, returns ok.
+
+ ValidateContext context = new ValidateContext();
+
+ Container recentContainer = null;
+
+ for ( Splay s = _doc ; s != null ; s = s.nextSplay() )
+ {
+ if (s.isRoot())
+ {
+ assert s.getCchAfter() == 0;
+ }
+ else if (s.isBegin())
+ {
+ Begin b = (Begin) s;
+
+ assert b.getName() != null;
+
+ assert
+ b.getFinish() == null ||
+ b.getFinish().getContainer() == b;
+
+ if (b.isLeaf())
+ {
+ assert b.getFinish() == null;
+ }
+ else
+ {
+ assert b.getFinish() != null;
+ assert b.getFinish().getContainer() == b;
+ assert b.getCchValue() == 0;
+ }
+ }
+ else if (s.isAttr())
+ {
+ assert s.getName() != null;
+ assert s.getCchAfter() == 0;
+ }
+
+ if (s.isProcinst())
+ {
+ assert s.getName().getNamespaceURI() != null;
+ assert s.getName().getNamespaceURI().length() == 0;
+ }
+
+ if (s.isContainer())
+ {
+ assert s.getContainer() == recentContainer;
+
+ if (!s.isLeaf())
+ recentContainer = (Container) s;
+ }
+ else if (s.isFinish())
+ {
+ assert s.getContainer() == recentContainer;
+ recentContainer = recentContainer.getContainer();
+ }
+
+ context._numSplayTypes = 0;
+
+ for ( Goober g = s.firstGoober() ; g != null ;
+ g = s.nextGoober( g ) )
+ {
+ validateGoober( g, s, context );
+ }
+
+ if (isInvalid())
+ {
+ assert s.isTypeable();
+ assert s.peekType() != null;
+
+ assert context._numSplayTypes == 1;
+
+ if (s.isDoc())
+ {
+ assert s.getCchAfter() == 0;
+ Splay n = s.nextNonAttrSplay();
+
+ assert n.isRoot();
+ }
+ else if (s.isBegin())
+ {
+ assert s.isLeaf();
+ assert s.getCchValue() == 0;
+ }
+ else if (s.isAttr())
+ {
+ assert s.getCchValue() == 0;
+ }
+ }
+ else
+ {
+ assert context._numSplayTypes <= 1;
+ }
+ }
+
+ assert context._cInvalidatableTypes == _cInvalidatableTypes;
+ assert context._cElemOrderSensitiveTypes ==_cElemOrderSensitiveTypes;
+
+ // TODO: Validate indices
+
+ return true;
+ }
+
+ boolean validateSplayTree ( )
+ {
+ if (dv != 0)
+ return true;
+
+ try
+ {
+ return doValidateSplayTree();
+ }
+ catch ( RuntimeException rte )
+ {
+ System.out.println( "Splay tree invalid: " + rte );
+
+ dump( true );
+
+ throw rte;
+ }
+ }
+
+ private static class ValidateStats extends HashMap
+ {
+ int getCch ( Splay s )
+ {
+ return getStats( s )._cch;
+ }
+
+ void adjustCch ( Splay s, int cchDelta )
+ {
+ Stats stats = getStats( s );
+ stats._cch += cchDelta;
+ }
+
+ int getCbegin ( Splay s )
+ {
+ return getStats( s )._cbegin;
+ }
+
+ void adjustCbegin ( Splay s, int cbeginDelta )
+ {
+ Stats stats = getStats( s );
+ stats._cbegin += cbeginDelta;
+ }
+
+ private Stats getStats ( Splay s )
+ {
+ Stats stats = (Stats) get( s );
+
+ if (stats == null)
+ put( s, stats = new Stats() );
+
+ return stats;
+ }
+
+ private static class Stats
+ {
+ public int _cch;
+ public int _cbegin;
+ }
+ }
+
+ boolean doValidateSplayTree ( )
+ {
+ assertAssertEnabled();
+
+ ValidateStats stats = new ValidateStats();
+
+ assert _parentSplay == null;
+ assert _rightSplay == null;
+ assert _doc._leftSplay == null;
+
+ Splay s = this;
+
+ if (s._leftSplay != null)
+ {
+ s = s._leftSplay;
+
+ while ( s != null && s._leftSplay != null )
+ s = s._leftSplay;
+ }
+
+ assert s == _doc;
+
+ loop:
+ for ( ; ; )
+ {
+ if (s._leftSplay == null && s._rightSplay == null)
+ {
+ stats.adjustCch( s, s.getCch() );
+ stats.adjustCbegin( s, s.getCdocBegin() );
+ }
+
+ if (s._rightSplay != null)
+ {
+ for ( s = s._rightSplay ; s._leftSplay != null ; )
+ s = s._leftSplay;
+ }
+ else
+ {
+ for ( ; ; )
+ {
+ Splay p = s._parentSplay;
+
+ if (p == null)
+ break loop;
+
+ if (p._rightSplay == null || p._rightSplay == s)
+ {
+ s = p;
+
+ stats.adjustCch( s, s.getCch() );
+ stats.adjustCbegin( s, s.getCdocBegin() );
+
+ if (s._leftSplay != null)
+ {
+ stats.adjustCch( s, stats.getCch( s._leftSplay ) );
+
+ stats.adjustCbegin(
+ s, stats.getCbegin( s._leftSplay ) );
+ }
+
+ if (s._rightSplay != null)
+ {
+ stats.adjustCch( s, stats.getCch( s._rightSplay ) );
+
+ stats.adjustCbegin(
+ s, stats.getCbegin( s._rightSplay ) );
+ }
+ }
+ else
+ {
+ assert p._leftSplay == s;
+ assert p._rightSplay != null;
+
+ s = p._rightSplay;
+
+ while ( s._leftSplay != null )
+ s = s._leftSplay;
+
+ break;
+ }
+ }
+ }
+ }
+
+ for ( s = _doc ; s != null ; s = s.nextSplay() )
+ {
+ assert !_leftOnly || s._rightSplay == null: "" + s.getDebugId();
+ assert s._leftSplay == null || s._leftSplay ._parentSplay == s;
+ assert s._rightSplay == null || s._rightSplay._parentSplay == s;
+
+ if (s._leftSplay == null)
+ {
+ assert s.getCchLeft() == 0;
+ assert s.getCdocBeginLeft() == 0;
+ }
+ else
+ {
+ assert
+ s.getCchLeft() == stats.getCch( s._leftSplay ):
+ "" + s.getDebugId();
+
+ assert s.getCdocBeginLeft() == stats.getCbegin( s._leftSplay );
+ }
+ }
+
+ return true;
+ }
+
+ //
+ //
+ //
+
+ interface ChangeListener
+ {
+ void changeNotification ( );
+ }
+
+ private static class ChangeClient
+ {
+ ChangeListener _listener;
+ ChangeClient _next;
+ }
+
+ long getVersion ( )
+ {
+ return __version;
+ }
+
+ void invalidateVersion ( )
+ {
+ assert _changeClients == null;
+
+ __version++;
+
+ assert (_debugChangeVersion = __version) == 0 || true;
+ }
+
+ // Use this *only* if you know what you are doing!
+ void restoreVersion ( long oldVersion )
+ {
+ assert __version >= oldVersion;
+ __version = oldVersion;
+ assert (_debugChangeVersion = __version) == 0 || true;
+ }
+
+ boolean validateChangeStarted ( )
+ {
+ assert _changeClients == null;
+ return _changeClients == null;
+ }
+
+ boolean validateChangeListenerState ( )
+ {
+ assert _debugChangeVersion == __version;
+ return true;
+ }
+
+ void registerForChange ( ChangeListener listener )
+ {
+ assert validateChangeListenerState();
+
+ // See if this listener is the first one on the list. Easy but not
+ // totally complete optimization
+
+ if (_changeClients != null && _changeClients._listener == listener)
+ return;
+
+ ChangeClient client = new ChangeClient();
+
+ client._next = _changeClients;
+ client._listener = listener;
+ _changeClients = client;
+ }
+
+ void startChange ( )
+ {
+ assert validateChangeListenerState();
+
+ long currentVersion = 0;
+
+ assert (currentVersion = __version) == 0 || true;
+
+ while ( _changeClients != null )
+ {
+ _changeClients._listener.changeNotification();
+ _changeClients = _changeClients._next;
+ }
+
+ assert currentVersion == __version;
+ }
+
+ //
+ // Document properties
+ //
+
+ static class DocProps
+ extends XmlDocumentProperties
+ {
+ private HashMap _map = new HashMap();
+
+ public Object put ( Object key, Object value )
+ {
+ return _map.put( key, value );
+ }
+
+ public Object get ( Object key )
+ {
+ return _map.get( key );
+ }
+
+ public Object remove ( Object key )
+ {
+ return _map.remove( key );
+ }
+ }
+
+ class nthCache
+ {
+ private boolean namesSame ( QName pattern, QName name )
+ {
+ return pattern == null || pattern.equals( name );
+ }
+
+ private boolean setsSame ( QNameSet patternSet, QNameSet set)
+ {
+ // value equality is probably too expensive. Since the use case
+ // involves QNameSets that are generated by the compiler, we
+ // can use identity comparison.
+ return patternSet != null && patternSet == set;
+ }
+
+ private boolean nameHit(QName namePattern, QNameSet setPattern, QName name)
+ {
+ if (setPattern == null)
+ return namesSame(namePattern, name);
+ else
+ return setPattern.contains(name);
+ }
+
+ private boolean cacheSame (QName namePattern, QNameSet setPattern)
+ {
+ return setPattern == null ? namesSame(namePattern, _name) :
+ setsSame(setPattern, _set);
+ }
+
+ int distance ( Splay parent, QName name, QNameSet set, int n )
+ {
+ assert n >= 0;
+
+ if (_version != Root.this.getVersion())
+ return Integer.MAX_VALUE - 1;
+
+ if (parent != _parent || !cacheSame(name, set))
+ return Integer.MAX_VALUE;
+
+ return n > _n ? n - _n : _n - n;
+ }
+
+ Begin fetch ( Splay parent, QName name, QNameSet set, int n )
+ {
+ assert n >= 0;
+
+ if (_version != Root.this.getVersion() || _parent != parent ||
+ ! cacheSame(name, set) || n == 0)
+ {
+ _version = Root.this.getVersion();
+ _parent = parent;
+ _name = name;
+ _child = null;
+ _n = -1;
+
+ if (!parent.isLeaf())
+ {
+ loop:
+ for ( Splay s = parent.nextSplay() ; ; s = s.nextSplay() )
+ {
+ switch ( s.getKind() )
+ {
+ case END :
+ case ROOT : break loop;
+
+ case BEGIN :
+ if (nameHit( name, set, s.getName() ))
+ {
+ _child = s;
+ _n = 0;
+ break loop;
+ }
+
+ s = s.getFinishSplay();
+ break;
+ }
+ }
+ }
+ }
+
+ if (_n < 0)
+ return null;
+
+ if (n > _n)
+ {
+ while ( n > _n )
+ {
+ for ( Splay s = _child.getFinishSplay().nextSplay() ; ;
+ s = s.nextSplay() )
+ {
+ if (s.isFinish())
+ return null;
+
+ if (s.isBegin())
+ {
+ if (nameHit( name, set, s.getName() ))
+ {
+ _child = s;
+ _n++;
+ break;
+ }
+
+ s = s.getFinishSplay();
+ }
+ }
+ }
+ }
+ else if (n < _n)
+ {
+ while ( n < _n )
+ {
+ Splay s = _child;
+
+ for ( ; ; )
+ {
+ s = s.prevSplay();
+
+ if (s.isLeaf() || s.isEnd())
+ {
+ if (s.isEnd())
+ s = s.getContainer();
+
+ if (nameHit( name, set, s.getName() ))
+ {
+ _child = s;
+ _n--;
+ break;
+ }
+ }
+ else if (s.isContainer())
+ return null;
+ }
+ }
+ }
+
+ return (Begin) _child;
+ }
+
+ private long _version;
+ private Splay _parent;
+ private QName _name;
+ private QNameSet _set;
+
+ private Splay _child;
+ private int _n;
+ }
+
+ //
+ // Da fields. Da Bears. Ditka is God.
+ //
+
+ boolean _leftOnly;
+ Doc _doc;
+ Text _text;
+ boolean _validateOnSet;
+
+ //
+ // Document version. These numbers get incremented when the document
+ // changes in a variety of ways.
+ //
+
+ private long __version = 1;
+ private long _debugChangeVersion = 1; // Debug only
+
+ private ChangeClient _changeClients;
+
+ DocProps _props;
+
+ //
+ // XmlInputStream
+ //
+
+ boolean _standAlone;
+
+ //
+ //
+ //
+
+ final SchemaTypeLoader _schemaTypeSystem;
+
+ int _cInvalidatableTypes;
+ int _cElemOrderSensitiveTypes;
+
+ //
+ //
+ //
+
+ nthCache _nthCache_A = new nthCache();
+ nthCache _nthCache_B = new nthCache();
+ TypeStoreFactory _factory;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java
new file mode 100644
index 0000000..9867b48
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Saver.java
@@ -0,0 +1,4751 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.common.Chars;
+import org.apache.xmlbeans.impl.common.EncodingMap;
+import org.apache.xmlbeans.impl.common.GenericXmlInputStream;
+import org.apache.xmlbeans.impl.common.ValidatorListener;
+import org.apache.xmlbeans.impl.common.XmlEventBase;
+import org.apache.xmlbeans.impl.common.XmlNameImpl;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.store.Splay.Container;
+import org.apache.xmlbeans.impl.store.Splay.Xmlns;
+import org.apache.xmlbeans.impl.values.NamespaceManager;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlOptions;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.ConcurrentModificationException;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+import org.apache.xmlbeans.xml.stream.Attribute;
+import org.apache.xmlbeans.xml.stream.AttributeIterator;
+import org.apache.xmlbeans.xml.stream.ChangePrefixMapping;
+import org.apache.xmlbeans.xml.stream.CharacterData;
+import org.apache.xmlbeans.xml.stream.Comment;
+import org.apache.xmlbeans.xml.stream.EndDocument;
+import org.apache.xmlbeans.xml.stream.EndElement;
+import org.apache.xmlbeans.xml.stream.EndPrefixMapping;
+import org.apache.xmlbeans.xml.stream.Location;
+import org.apache.xmlbeans.xml.stream.ProcessingInstruction;
+import org.apache.xmlbeans.xml.stream.StartDocument;
+import org.apache.xmlbeans.xml.stream.StartElement;
+import org.apache.xmlbeans.xml.stream.StartPrefixMapping;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+
+public abstract class Saver implements NamespaceManager
+{
+ //
+ //
+ //
+
+ private final Object monitor()
+ {
+ return _root;
+ }
+
+ Saver ( Root r, Splay s, int p, XmlOptions options )
+ {
+ assert Root.dv > 0 || s.getRootSlow() == r;
+
+ // Input s and p must be normalized already
+ assert p < s.getEndPos();
+
+ _root = r;
+ _top = _splay = s;
+ _pos = p;
+ _version = r.getVersion();
+ _sb = new StringBuffer();
+ _attrs = new LinkedHashMap();
+ _attrNames = new HashSet();
+ _firstPush = true;
+
+
+ // Initialize the state of the namespaces
+ _namespaceStack = new ArrayList();
+ _uriMap = new HashMap();
+ _prefixMap = new HashMap();
+
+ // Stops the synthesis of this namspace and make for better
+ // roundtripping
+ addMapping( "xml", Splay._xml1998Uri );
+
+ // Check for implicit namespaces
+
+ options = XmlOptions.maskNull( options );
+
+ if (options.hasOption( XmlOptions.SAVE_IMPLICIT_NAMESPACES ))
+ {
+ Map m = (Map) options.get( XmlOptions.SAVE_IMPLICIT_NAMESPACES );
+
+ for ( Iterator i = m.keySet().iterator() ; i.hasNext() ; )
+ {
+ String prefix = (String) i.next();
+ addMapping( prefix, (String) m.get( prefix ) );
+ }
+ }
+
+ if (options.hasOption( XmlOptions.SAVE_SUGGESTED_PREFIXES ))
+ _suggestedPrefixes = (Map) options.get( XmlOptions.SAVE_SUGGESTED_PREFIXES);
+
+ // If the default prefix has not been mapped, do so now
+
+ if (getNamespaceForPrefix( "" ) == null)
+ {
+ _initialDefaultUri = new String( "" );
+ addMapping( "", _initialDefaultUri );
+ }
+
+ _saveNamespacesFirst = options.hasOption( XmlOptions.SAVE_NAMESPACES_FIRST );
+
+ if (_prettyPrint = options.hasOption( XmlOptions.SAVE_PRETTY_PRINT ))
+ {
+ _prettyIndent = 2;
+
+ if (options.hasOption( XmlOptions.SAVE_PRETTY_PRINT_INDENT ))
+ {
+ _prettyIndent =
+ ((Integer) options.get( XmlOptions.SAVE_PRETTY_PRINT_INDENT )).intValue();
+ }
+
+ if (options.hasOption( XmlOptions.SAVE_PRETTY_PRINT_OFFSET ))
+ {
+ _prettyOffset =
+ ((Integer) options.get( XmlOptions.SAVE_PRETTY_PRINT_OFFSET )).intValue();
+ }
+ }
+
+ if (options.hasOption( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES ) &&
+ !(this instanceof SynthNamespaceSaver))
+ {
+ SynthNamespaceSaver saver =
+ new SynthNamespaceSaver( r, s, p, options );
+
+ while ( saver.process() )
+ ;
+
+ if (!saver._synthNamespaces.isEmpty())
+ _preComputedNamespaces = saver._synthNamespaces;
+ }
+
+ _useDefaultNamespace =
+ options.hasOption( XmlOptions.SAVE_USE_DEFAULT_NAMESPACE );
+
+ if (options.hasOption( XmlOptions.SAVE_FILTER_PROCINST ))
+ {
+ _filterProcinst =
+ (String) options.get( XmlOptions.SAVE_FILTER_PROCINST );
+ }
+
+ if (options.hasOption( XmlOptions.SAVE_USE_OPEN_FRAGMENT ))
+ _fragment = Splay._openuriFragment;
+ else
+ _fragment = Splay._xmlFragment;
+
+ // Outer overrides inner
+
+ _inner =
+ options.hasOption( XmlOptions.SAVE_INNER ) &&
+ !options.hasOption( XmlOptions.SAVE_OUTER );
+
+ if (_inner && !_top.isDoc())
+ _synthElem = _fragment;
+
+ else if (options.hasOption( XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT ))
+ {
+ _fragment = _synthElem =
+ (QName) options.get( XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT );
+
+ if (_synthElem == null)
+ throw new IllegalArgumentException( "Null synthetic element" );
+ }
+
+ _preProcess = true;
+ }
+
+ protected final void checkVersion ( )
+ {
+ if (_version != _root.getVersion())
+ throw new ConcurrentModificationException( "Document changed during save" );
+ }
+
+ protected final Root getRoot ( ) { return _root; }
+ protected final Map getUriMap ( ) { return _uriMap; }
+ protected final Map getPrefixMap ( ) { return _prefixMap; }
+
+ // emitContainer will process leaf contents and the text after a
+ // start. All other text is processed with emitTextAfter.
+
+ protected abstract void emitXmlnsFragment ( Splay s );
+ protected abstract void emitAttrFragment ( Splay s );
+ protected abstract void emitTextFragment ( Splay s, int p, int cch );
+ protected abstract void emitCommentFragment ( Splay s );
+ protected abstract void emitProcinstFragment ( Splay s );
+
+ protected abstract void emitDocType(
+ String doctypeName, String publicID, String systemID );
+
+ protected abstract void emitComment ( Splay s );
+ protected abstract void emitTextAfter ( Splay s, int p, int cch );
+ protected abstract void emitEnd ( Splay s, QName name );
+ protected abstract void emitProcinst ( Splay s );
+ protected abstract void emitContainer ( Container c, QName name );
+
+ // Called when a synthetic prefix is created.
+
+ protected void syntheticNamespace (
+ String prefix, String uri, boolean considerCreatingDefault ) { }
+
+ /*
+ * It is vital that the saver does not modify the tree in the process of
+ * saving. So, when there is invalid content or attr values which need
+ * new namespace/prefix mappings, I compute the content/values by passing
+ * the NamespaceManager implemented by the saver which can cons up mappings
+ * just for the purposes of saving without modifying the tree by adding
+ * Xmlns splays.
+ *
+ * Thus, I must not, as a byproduct of saving, validate any content/values
+ * into the tree which call back for namespace mappings which need to be
+ * created.
+ *
+ * Also, I need to compute the valid text (if a splay is invalid) before
+ * I have closed the attribute list of the enclosing container because
+ * I will have to persist out these temporary meppings before they are
+ * referenced by the values which need them.
+ */
+
+ final String text ( )
+ {
+ assert _text != null;
+
+ return _text.toString();
+ }
+
+ final boolean noText ( )
+ {
+ assert _text != null || _sb.length() == 0;
+ assert _text == null || _text == _sb;
+
+ return _text == null;
+ }
+
+ final void clearText ( )
+ {
+ _text = null;
+ _sb.delete( 0, _sb.length() );
+ }
+
+ final static void spaces ( StringBuffer sb, int offset, int count )
+ {
+ while ( count-- > 0 )
+ sb.insert( offset, ' ' );
+ }
+
+ final static void trim ( StringBuffer sb )
+ {
+ int i;
+
+ for ( i = 0 ; i < sb.length() ; i++ )
+ if (!Splay.isWhiteSpace( sb.charAt( i ) ))
+ break;
+
+ sb.delete( 0, i );
+
+ for ( i = sb.length() ; i > 0 ; i-- )
+ if (!Splay.isWhiteSpace( sb.charAt( i - 1 ) ))
+ break;
+
+ sb.delete( i, sb.length() );
+ }
+
+ // Call process until it returns false to save everything.
+
+ protected final boolean process ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ if (_preProcess)
+ {
+ _preProcess = false;
+
+ Splay s = _splay;
+ int p = _pos;
+
+ _splay = null;
+ _pos = 0;
+
+ // Check for position right before end token. Effectively there
+ // is nothing to save here, so save out the empty fragment.
+
+ if ((p == 0 && s.isFinish()) ||
+ (s.isLeaf() && p == s.getPosLeafEnd()))
+ {
+ assert _splay == null;
+ processTextFragment( null, 0, 0 );
+ return true;
+ }
+
+ // Here, if p > 0, then we're saving some text
+
+ if (p > 0)
+ {
+ assert !s.isLeaf() || p != s.getPosLeafEnd();
+ processTextFragment( s, p, s.getPostCch( p ) );
+ assert _splay == null;
+ return true;
+ }
+
+ if (_inner && (s.isAttr() || s.isComment() || s.isProcinst()))
+ {
+ processTextFragment( s, 0, s.getCchValue() );
+ return true;
+ }
+
+ if (s.isXmlns())
+ {
+ processXmlnsFragment( s );
+ return true;
+ }
+
+ if (s.isAttr())
+ {
+ processAttrFragment( s );
+ return true;
+ }
+
+ if (s.isComment())
+ {
+ processCommentFragment( s );
+ return true;
+ }
+
+ if (s.isProcinst())
+ {
+ if (_filterProcinst != null &&
+ s.getLocal().equals( _filterProcinst ))
+ {
+ processTextFragment( null, 0, 0 );
+ return true;
+ }
+ else
+ processProcinstFragment( s );
+
+ return true;
+ }
+
+ assert s.isContainer();
+
+ _splay = s;
+ _endSplay = s.isContainer() ? s.getFinishSplay() : s;
+ }
+
+ // I need to break the processing of a splay into two parts. The
+ // first part is the processing of the splay and the second part is
+ // the post processing of the splay. In particular, the post
+ // processing, among other things, pops the mapping stack. This
+ // is done so stuff 'saved' during the first part (the pre-process)
+ // can use the mapping stack. When the next process comes around,
+ // the mapping stack will then be updated.
+
+ if (_postPop)
+ {
+ popMappings();
+ _postPop = false;
+ }
+
+ if (_postProcess)
+ {
+ assert _splay != null;
+
+ boolean emitted = false;
+
+ if (_splay == _endSplay)
+ _splay = null;
+ else
+ {
+ Splay s = _splay;
+
+ _splay = _splay.nextNonAttrSplay();
+
+ if (_skipContainerFinish)
+ {
+ assert s.isBegin() && !s.isLeaf() && s.getCchAfter() ==0;
+ assert _splay.isFinish();
+
+ _splay = _splay == _endSplay ? null : _splay.nextSplay();
+ }
+
+ if (_skipContainerFinish || s.isLeaf())
+ {
+ assert !_postPop;
+ _postPop = true;
+ }
+
+ if (!s.isDoc())
+ {
+ assert noText();
+
+ int cchAfter = s.getCchAfter();
+
+ if (_prettyPrint)
+ {
+ _text = _sb;
+
+ if (cchAfter > 0)
+ {
+ Root r = getRoot();
+
+ r._text.fetch(
+ _text,
+ s.getCpForPos( r, s.getPosAfter() ), cchAfter );
+
+ trim( _text );
+ }
+
+ Container stop = (Container) _top;
+
+ if (!stop.isDoc())
+ stop = stop.getContainer();
+
+ Container c = s.getContainer( s.getPosAfter() );
+
+ if (_text.length() > 0)
+ {
+ Container p = c;
+
+ for ( ; p != stop ; p = p.getContainer() )
+ spaces( _text, 0, _prettyIndent );
+
+ if (_prettyIndent >= 0)
+ {
+ _text.insert( 0, _newLine );
+ spaces( _text, 1, _prettyOffset );
+ }
+ }
+
+ if (_prettyIndent >= 0)
+ {
+ _text.append( _newLine );
+ spaces( _text, _text.length(), _prettyOffset );
+ }
+
+ Container p = c;
+
+ if (s.nextNonAttrSplay().isEnd())
+ p = p.getContainer();
+
+ for ( ; p != null && p != stop; p = p.getContainer() )
+ spaces( _text, _text.length(), _prettyIndent );
+ }
+
+ if (_text == null ? cchAfter > 0 : _text.length() > 0)
+ {
+ emitTextAfter( s, s.getPosAfter(), cchAfter );
+ emitted = true;
+ }
+
+ clearText();
+ }
+ }
+
+ _postProcess = false;
+
+ // Make sure I only return false if there is *really* nothing more
+ // to process
+
+ if (emitted)
+ return true;
+
+ if (_postPop)
+ {
+ popMappings();
+ _postPop = false;
+ }
+ }
+
+ if (_splay == null)
+ return false;
+
+ if (_version != getRoot().getVersion())
+ throw new IllegalStateException( "Document changed" );
+
+ _skipContainerFinish = false;
+
+ switch ( _splay.getKind() )
+ {
+ case Splay.DOC :
+ case Splay.BEGIN :
+ {
+ processContainer( (Container) _splay );
+ break;
+ }
+ case Splay.ROOT :
+ case Splay.END :
+ {
+ processEnd( _splay );
+ break;
+ }
+ case Splay.COMMENT :
+ {
+ emitComment( _splay );
+ break;
+ }
+ case Splay.PROCINST :
+ {
+ if (_filterProcinst == null ||
+ !_splay.getLocal().equals( _filterProcinst ))
+ {
+ emitProcinst( _splay );
+ }
+ break;
+ }
+ case Splay.ATTR :
+ default :
+ {
+ assert false: "Unexpected splay kind " + _splay.getKind();
+ return false;
+ }
+ }
+
+ _postProcess = true;
+
+ return true;
+ }
+ }
+
+ private final void processContainer ( Container c )
+ {
+ assert c.isDoc() || c.isBegin();
+
+ QName name =
+ _synthElem != null && c == _top
+ ? _synthElem
+ : c.isBegin() ? c.getName() : null;
+
+ String nameUri = name == null ? null : name.getNamespaceURI();
+
+ // See if there is a doctype to save out
+
+ if (c.isDoc() )
+ {
+ String systemId = _root._props.getDoctypeSystemId();
+ String docTypeName = _root._props.getDoctypeName();
+
+ if (systemId != null || docTypeName != null)
+ {
+ if (docTypeName == null && name != null)
+ docTypeName = name.getLocalPart();
+
+ if (docTypeName == null)
+ {
+ XmlCursor xc = _root.createCursor();
+
+ if (xc.toFirstChild())
+ docTypeName = xc.getName().getLocalPart();
+
+ xc.dispose();
+ }
+
+ if (docTypeName == null && _fragment != null)
+ docTypeName = _fragment.getLocalPart();
+
+ String publicId = _root._props.getDoctypePublicId();
+
+ emitDocType( docTypeName, publicId, systemId );
+ }
+ }
+
+ // Add a new entry to the frontier. If this element has a name
+ // which has no namespace, then we must make sure that pushing
+ // the mappings causes the default namespace to be empty
+
+ boolean ensureDefaultEmpty = name != null && nameUri.length() == 0;
+
+ pushMappings( c, ensureDefaultEmpty );
+
+ //
+ // There are four things which use mappings:
+ //
+ // 1) The element name
+ // 2) The element value (qname based)
+ // 3) Attribute names
+ // 4) The attribute values (qname based)
+ //
+
+ // 1) The element name (not for starts)
+
+ if (name != null)
+ ensureMapping( nameUri, null, !ensureDefaultEmpty, false );
+
+ assert noText();
+
+ if (c.isInvalid())
+ {
+ // 2) The element value
+ _text = _sb.append( c.peekType().build_text( this ) );
+ }
+
+ _attrs.clear();
+ _attrNames.clear();
+
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr() &&
+ (_wantDupAttrs || !_attrNames.contains( s.getName() )))
+ {
+ _attrNames.add( s.getName() );
+
+ // 3) Attribute name
+ ensureMapping( s.getUri(), null, false, true );
+
+ String invalidValue = null;
+
+ if (s.isInvalid())
+ invalidValue = s.peekType().build_text( this ); // #4
+
+ _attrs.put( s, invalidValue );
+ }
+ }
+
+ // emitContainer handles text only for leaves and starts
+
+ if (_prettyPrint && (c.isDoc() || c.isLeaf()))
+ {
+ if (_text == null)
+ {
+ Root r = getRoot();
+
+ r._text.fetch(
+ _text = _sb,
+ r.getCp( c ),
+ c.isLeaf() ? c.getCchValue() : c.getCch() );
+ }
+
+ trim( _text );
+
+ if (c.isDoc())
+ {
+ spaces( _text, 0, _prettyOffset );
+
+ if (_text.length() > _prettyOffset)
+ {
+ if (_prettyIndent >= 0)
+ {
+ _text.insert( 0, _newLine );
+ spaces( _text, 1, _prettyOffset );
+ _text.append( _newLine );
+ spaces( _text, _text.length(), _prettyOffset );
+ }
+ }
+ }
+ }
+
+ // derived savers may want to test the stuff being stored to
+ // see if is well formed or not in order to save out a
+ // fragment. Do this here when emitting the first container if
+ // that container is the root (if not the root, then we are
+ // well formed)
+
+ if (_wantFragTest && name == null)
+ {
+ if ((_text != null && !Splay.isWhiteSpace( _text )) ||
+ !c.isAfterWhiteSpace( getRoot() ))
+ {
+ _needsFrag = true;
+ }
+ else
+ {
+ assert !c.isLeaf();
+
+ Splay s = c.nextSplay();
+
+ // Check for leaf anyways -- sometimes it happens!
+ if (c.isLeaf() || s.isAttr() || hasMappings())
+ _needsFrag = true;
+ else
+ {
+ boolean sawBegin = false;
+ Splay cEnd = c.getFinishSplay();
+
+ for ( ; s != cEnd ; s = s.nextSplay() )
+ {
+ if (s.isBegin())
+ {
+ if (sawBegin)
+ {
+ _needsFrag = true;
+ break;
+ }
+
+ sawBegin = true;
+ s = s.getFinishSplay();
+ }
+
+ if (!s.isAfterWhiteSpace( getRoot() ))
+ {
+ _needsFrag = true;
+ break;
+ }
+ }
+
+ if (!sawBegin)
+ _needsFrag = true;
+ }
+ }
+ }
+
+ // If I am doing aggressive namespaces and we're emitting a
+ // container which can contain content, add the namespaces
+ // we've computed. Basically, I'm making sure the pre-computed
+ // namespaces are mapped on the first container which has a name.
+
+ if (_preComputedNamespaces != null && (name != null || _needsFrag))
+ {
+ for ( Iterator i = _preComputedNamespaces.keySet().iterator() ; i.hasNext() ; )
+ {
+ String uri = (String) i.next();
+
+ ensureMapping(
+ uri, null,
+ _preComputedNamespaces.get( uri ) != null && !ensureDefaultEmpty, false );
+ }
+
+ // Set to null so we do this once at the top
+ _preComputedNamespaces = null;
+ }
+
+ if (_wantFragTest)
+ {
+ // See if I need to gen a fragment for the document
+
+ assert name != null || (c.isDoc() && _synthElem == null);
+
+ if (name == null)
+ {
+ if (_needsFrag)
+ {
+ name = _fragment;
+ ensureFragmentNamespace();
+ _docElem = name;
+ }
+ }
+ else if (c.isDoc())
+ _docElem = name;
+ }
+
+ emitContainer( c, name );
+
+ clearText();
+ }
+
+ private void processEnd ( Splay s )
+ {
+ Container c = s.getContainer();
+
+ QName name =
+ _synthElem != null && c == _top
+ ? _synthElem
+ : c.isBegin() ? c.getName() : null;
+
+ if (_wantFragTest && name == null)
+ {
+ boolean isRoot = s.isRoot();
+
+ if (!isRoot || _docElem != null)
+ {
+ name =
+ isRoot
+ ? _docElem
+ : (s.isEnd() ? s.getContainer() : s ).getName();
+ }
+ }
+
+ emitEnd( _splay, name );
+
+ assert !_postPop;
+
+ _postPop = true;
+ }
+
+ private final void pushFragmentMappings ( Splay s )
+ {
+ // mask the initial frame to hide default mappings
+
+ pushMappings(
+ s == null ? null : s.getContainer(),
+ _fragment.getNamespaceURI().length() == 0 );
+
+ ensureFragmentNamespace();
+ }
+
+ private final void processXmlnsFragment ( Splay s )
+ {
+ // Saving a default xmlns mapping is dangerous, just spit out empty
+ // text
+
+ if (s.getLocal().length() == 0)
+ {
+ pushFragmentMappings( null );
+ _text = _sb;
+ emitTextFragment( s, 0, 0 );
+ }
+ else
+ {
+ pushFragmentMappings( null );
+ ensureMapping( s.getUri(), s.getLocal(), false, true );
+ emitXmlnsFragment( s );
+ }
+ }
+
+ private final void processCommentFragment ( Splay s )
+ {
+ pushFragmentMappings( null );
+ emitCommentFragment( s );
+ }
+
+ private final void processProcinstFragment ( Splay s )
+ {
+ pushFragmentMappings( null );
+ emitProcinstFragment( s );
+ }
+
+ /**
+ * This is called only when a single attr is being saved. It is not called
+ * as a consequence of saving out a container.
+ */
+
+ private final void processAttrFragment ( Splay s )
+ {
+ assert s.isNormalAttr();
+
+ pushFragmentMappings( s );
+
+ ensureMapping( s.getUri(), null, false, true );
+
+ assert noText();
+
+ if (s.isInvalid())
+ {
+ // TODO - pass StringBuffer to buildText to save object creation
+ _text = _sb.append( s.peekType().build_text( this ) );
+ }
+
+ emitAttrFragment( s );
+
+ clearText();
+ }
+
+ /**
+ * This is called only when a single chunk of text is to be saved.
+ * It is not called as a consequence of saving out a container.
+ */
+
+ private final void processTextFragment ( Splay s, int p, int cch )
+ {
+ // Only need to save ancestor namespace mappings if there could be a
+ // qname here. If the text is of length 0, then there is no qname.
+
+ Splay c = null;
+
+ if ((_text != null && _text.length() > 0) || (s != null && cch > 0))
+ c = s.getContainer( p );
+
+ pushFragmentMappings( c );
+
+ emitTextFragment( s, p, cch );
+ }
+
+ //
+ // Layout of namespace stack:
+ //
+ // URI Undo
+ // URI Rename
+ // Prefix Undo
+ // Mapping
+ //
+
+ boolean hasMappings ( )
+ {
+ int i = _namespaceStack.size();
+
+ return i > 0 && _namespaceStack.get( i - 1 ) != null;
+ }
+
+ void iterateMappings ( )
+ {
+ _currentMapping = _namespaceStack.size();
+
+ while ( _currentMapping > 0 &&
+ _namespaceStack.get( _currentMapping - 1 ) != null )
+ {
+ _currentMapping -= 8;
+ }
+ }
+
+ boolean hasMapping ( )
+ {
+ return _currentMapping < _namespaceStack.size();
+ }
+
+ void nextMapping ( )
+ {
+ _currentMapping += 8;
+ }
+
+ String mappingPrefix ( )
+ {
+ assert hasMapping();
+ return (String) _namespaceStack.get( _currentMapping + 6 );
+ }
+
+ String mappingUri ( )
+ {
+ assert hasMapping();
+ return (String) _namespaceStack.get( _currentMapping + 7 );
+ }
+
+ String mappingPrevPrefixUri ( )
+ {
+ assert hasMapping();
+ return (String) _namespaceStack.get( _currentMapping + 5 );
+ }
+
+ //
+ //
+ //
+
+ private final void pushMappings ( Container c, boolean ensureDefaultEmpty )
+ {
+ _namespaceStack.add( null );
+
+ for ( ; c != null ; c = c.getContainer() )
+ {
+ namespaces:
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns())
+ {
+ Xmlns x = (Xmlns) s;
+ String prefix = x.getLocal();
+ String uri = x.getUri();
+
+ if (ensureDefaultEmpty &&
+ prefix.length() == 0 && uri.length() > 0)
+ {
+ continue;
+ }
+
+ // Make sure the prefix is not already mapped in
+ // this frame
+
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ if (mappingPrefix().equals( prefix ))
+ continue namespaces;
+
+ addMapping( prefix, uri );
+ }
+ }
+
+ // Push all ancestors the first time
+
+ if (!_firstPush)
+ break;
+ }
+
+ if (ensureDefaultEmpty)
+ {
+ String defaultUri = (String) _prefixMap.get( "" );
+
+ // I map the default to "" at the very beginning
+ assert defaultUri != null;
+
+ if (defaultUri.length() > 0)
+ addMapping( "", "" );
+ }
+
+ _firstPush = false;
+ }
+
+ private final void dumpMappings ( )
+ {
+ for ( int i = _namespaceStack.size() ; i > 0 ; )
+ {
+ if (_namespaceStack.get( i - 1 ) == null)
+ {
+ System.out.println( "----------------" );
+ i--;
+ continue;
+ }
+
+ System.out.print( "Mapping: " );
+ System.out.print( _namespaceStack.get( i - 2 ) );
+ System.out.print( " -> " );
+ System.out.print( _namespaceStack.get( i - 1 ) );
+ System.out.println();
+
+ System.out.print( "Prefix Undo: " );
+ System.out.print( _namespaceStack.get( i - 4 ) );
+ System.out.print( " -> " );
+ System.out.print( _namespaceStack.get( i - 3 ) );
+ System.out.println();
+
+ System.out.print( "Uri Rename: " );
+ System.out.print( _namespaceStack.get( i - 5 ) );
+ System.out.print( " -> " );
+ System.out.print( _namespaceStack.get( i - 6 ) );
+ System.out.println();
+
+ System.out.print( "UriUndo: " );
+ System.out.print( _namespaceStack.get( i - 7 ) );
+ System.out.print( " -> " );
+ System.out.print( _namespaceStack.get( i - 8 ) );
+ System.out.println();
+
+ System.out.println();
+
+ i -= 8;
+ }
+ }
+
+ private final void addMapping ( String prefix, String uri )
+ {
+ assert uri != null;
+ assert prefix != null;
+
+ // If the prefix being mapped here is already mapped to a uri,
+ // that uri will either go out of scope or be mapped to another
+ // prefix.
+
+ String renameUri = (String) _prefixMap.get( prefix );
+ String renamePrefix = null;
+
+ if (renameUri != null)
+ {
+ // See if this prefix is already mapped to this uri. If
+ // so, then add to the stack, but there is nothing to rename
+
+ if (renameUri.equals( uri ))
+ renameUri = null;
+ else
+ {
+ int i = _namespaceStack.size();
+
+ while ( i > 0 )
+ {
+ if (_namespaceStack.get( i - 1 ) == null)
+ {
+ i--;
+ continue;
+ }
+
+ if (_namespaceStack.get( i - 7 ).equals( renameUri ))
+ {
+ renamePrefix = (String) _namespaceStack.get( i - 8 );
+
+ if (renamePrefix == null ||
+ !renamePrefix.equals( prefix ))
+ {
+ break;
+ }
+ }
+
+ i -= 8;
+ }
+
+ assert i > 0;
+ }
+ }
+
+ _namespaceStack.add( _uriMap.get( uri ) );
+ _namespaceStack.add( uri );
+
+ if (renameUri != null)
+ {
+ _namespaceStack.add( _uriMap.get( renameUri ) );
+ _namespaceStack.add( renameUri );
+ }
+ else
+ {
+ _namespaceStack.add( null );
+ _namespaceStack.add( null );
+ }
+
+ _namespaceStack.add( prefix );
+ _namespaceStack.add( _prefixMap.get( prefix ) );
+
+ _namespaceStack.add( prefix );
+ _namespaceStack.add( uri );
+
+ _uriMap.put( uri, prefix );
+ _prefixMap.put( prefix, uri );
+
+ if (renameUri != null)
+ _uriMap.put( renameUri, renamePrefix );
+ }
+
+ private final void popMappings ( )
+ {
+ for ( ; ; )
+ {
+ int i = _namespaceStack.size();
+
+ if (i == 0)
+ break;
+
+ if (_namespaceStack.get( i - 1 ) == null)
+ {
+ _namespaceStack.remove( i - 1 );
+ break;
+ }
+
+ Object oldUri = _namespaceStack.get( i - 7 );
+ Object oldPrefix = _namespaceStack.get( i - 8 );
+
+ if (oldPrefix == null)
+ _uriMap.remove( oldUri );
+ else
+ _uriMap.put( oldUri, oldPrefix );
+
+ oldPrefix = _namespaceStack.get( i - 4 );
+ oldUri = _namespaceStack.get( i - 3 );
+
+ if (oldUri == null)
+ _prefixMap.remove( oldPrefix );
+ else
+ _prefixMap.put( oldPrefix, oldUri );
+
+ String uri = (String) _namespaceStack.get( i - 5 );
+
+ if (uri != null)
+ _uriMap.put( uri, _namespaceStack.get( i - 6 ) );
+
+ // Hahahahahaha -- :-(
+ _namespaceStack.remove( i - 1 );
+ _namespaceStack.remove( i - 2 );
+ _namespaceStack.remove( i - 3 );
+ _namespaceStack.remove( i - 4 );
+ _namespaceStack.remove( i - 5 );
+ _namespaceStack.remove( i - 6 );
+ _namespaceStack.remove( i - 7 );
+ _namespaceStack.remove( i - 8 );
+ }
+ }
+
+ protected final String getUriMapping ( String uri )
+ {
+ assert _uriMap.get( uri ) != null;
+ return (String) _uriMap.get( uri );
+ }
+
+ protected final boolean tryPrefix ( String prefix )
+ {
+ if (prefix == null || Splay.beginsWithXml( prefix ))
+ return false;
+
+ String existingUri = (String) _prefixMap.get( prefix );
+
+ // If the prefix is currently mapped, then try another prefix. A
+ // special case is that of trying to map the default prefix ("").
+ // Here, there always exists a default mapping. If this is the
+ // mapping we found, then remap it anyways. I use != to compare
+ // strings because I want to test for the specific initial default
+ // uri I added when I initialized the saver.
+
+ if (existingUri != null &&
+ (prefix.length() > 0 || existingUri != _initialDefaultUri))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected final String ensureMapping (
+ String uri, String candidatePrefix,
+ boolean considerCreatingDefault, boolean mustHavePrefix )
+ {
+ assert uri != null;
+ assert candidatePrefix == null || candidatePrefix.length() > 0;
+
+ // Can be called for no-namespaced things
+
+ if (uri.length() == 0)
+ return null;
+
+ String prefix = (String) _uriMap.get( uri );
+
+ if (prefix != null && (prefix.length() > 0 || !mustHavePrefix))
+ return prefix;
+
+ //
+ // I try prefixes from a number of places, in order:
+ //
+ // 1) What was passed in
+ // 2) The optional suggestions (for uri's)
+ // 3) The default mapping is allowed
+ // 4) ns#++
+ //
+
+ if (candidatePrefix == null || !tryPrefix( candidatePrefix ))
+ {
+ if (_suggestedPrefixes != null &&
+ _suggestedPrefixes.containsKey( uri ) &&
+ tryPrefix( (String) _suggestedPrefixes.get( uri ) ))
+ {
+ candidatePrefix = (String) _suggestedPrefixes.get( uri );
+ }
+ else if (considerCreatingDefault && _useDefaultNamespace && tryPrefix( "" ))
+ candidatePrefix = "";
+ else
+ {
+ String basePrefix = QNameHelper.suggestPrefix( uri );
+ candidatePrefix = basePrefix;
+
+ for ( int i = 1 ; ; i++ )
+ {
+ if (tryPrefix( candidatePrefix ))
+ break;
+
+ candidatePrefix = basePrefix + i;
+ }
+ }
+ }
+
+ assert candidatePrefix != null;
+
+ syntheticNamespace( candidatePrefix, uri, considerCreatingDefault );
+
+ addMapping( candidatePrefix, uri );
+
+ return candidatePrefix;
+ }
+
+ public final String find_prefix_for_nsuri ( String uri, String prefix )
+ {
+ assert uri != null;
+ assert prefix == null || prefix.length() > 0;
+
+ boolean emptyUri = uri.length() == 0;
+
+ return ensureMapping( uri, prefix, emptyUri, !emptyUri );
+ }
+
+ public final String getNamespaceForPrefix ( String prefix )
+ {
+ if (prefix != null && prefix.equals( "xml" ))
+ return Splay._xml1998Uri;
+
+ return (String) _prefixMap.get( prefix );
+ }
+
+ protected final String ensureFragmentNamespace ( )
+ {
+ if (_fragment.getNamespaceURI().length() == 0)
+ return "";
+
+ return ensureMapping( _fragment.getNamespaceURI(), "frag", false, false );
+ }
+
+ /**
+ * A Saver which records synthetic namespaces
+ */
+
+ static final class SynthNamespaceSaver extends Saver
+ {
+ LinkedHashMap _synthNamespaces = new LinkedHashMap();
+
+ SynthNamespaceSaver ( Root r, Splay s, int p, XmlOptions options )
+ {
+ super( r, s, p, options );
+ }
+
+ protected void syntheticNamespace (
+ String prefix, String uri, boolean considerCreatingDefault )
+ {
+ _synthNamespaces.put( uri, considerCreatingDefault ? "useDefault" : null );
+ }
+
+ protected void emitXmlnsFragment ( Splay s ) { }
+ protected void emitAttrFragment ( Splay s ) { }
+ protected void emitTextFragment ( Splay s, int p, int cch ) { }
+ protected void emitCommentFragment ( Splay s ) { }
+ protected void emitProcinstFragment ( Splay s ) { }
+ protected void emitComment ( Splay s ) { }
+ protected void emitTextAfter ( Splay s, int p, int cch ) { }
+ protected void emitEnd ( Splay s, QName name ) { }
+ protected void emitProcinst ( Splay s ) { }
+ protected void emitContainer ( Container c, QName name ) { }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID ) { }
+ }
+
+ /**
+ * A Saver which generates characters.
+ */
+
+ static final class TextSaver extends Saver
+ {
+ TextSaver (
+ Root r, Splay s, int p, XmlOptions options, String encoding )
+ {
+ super( r, s, p, options );
+
+ _wantFragTest = true;
+
+ if (encoding != null)
+ {
+ String version = r._props.getVersion();
+
+ if (version == null)
+ version = "1.0";
+
+ emit( "<?xml version=\"" );
+ emit( version );
+ emit( "\" encoding=\"" + encoding + "\"?>" + _newLine );
+ }
+ }
+
+ protected void emitContainer ( Container c, QName name )
+ {
+ if (c.isBegin())
+ {
+ emitContainerHelper( c, name, null, null, false );
+
+ if (c.isLeaf())
+ {
+ int cch = _text == null ? c.getCchValue() : _text.length();
+
+ if (cch > 0)
+ {
+ emit( '>' );
+
+ if (_text == null)
+ emit( getRoot().getCp( c ), cch );
+ else
+ emit( _text );
+
+ entitizeContent();
+
+ emit( "</" );
+ emitName( name );
+ }
+ else
+ emit( '/' );
+ }
+ else
+ {
+ assert !c.isLeaf();
+
+ if (c.getCchAfter() == 0 && c.nextNonAttrSplay().isEnd())
+ {
+ emit( '/' );
+ _skipContainerFinish = true;
+ }
+ }
+
+ emit( '>' );
+ }
+ else
+ {
+ assert c.isDoc();
+
+ if (name != null)
+ emitContainerHelper( c, name, null, null, true );
+
+ if (_text == null)
+ emit( getRoot().getCp( c ), c.getCch() );
+ else
+ emit( _text );
+
+ entitizeContent();
+ }
+ }
+
+ private void emitAttrHelper ( Splay s, String invalidValue )
+ {
+ assert s.isNormalAttr();
+
+ emit( ' ' );
+ emitName( s.getName() );
+ emit( "=\"" );
+
+ if (invalidValue != null)
+ emit( invalidValue );
+ else
+ emit( getRoot().getCp( s ), s.getCch() );
+
+ entitizeAttrValue();
+
+ emit( '"' );
+ }
+
+ private void emitNamespacesHelper ( )
+ {
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ {
+ emit( ' ' );
+ emitXmlns( mappingPrefix(), mappingUri() );
+ }
+ }
+
+ private void emitContainerHelper (
+ Container c, QName name,
+ Splay extraAttr, StringBuffer extraAttrText,
+ boolean close )
+ {
+ assert name != null;
+
+ emit( '<' );
+ emitName( name );
+
+ if (_saveNamespacesFirst)
+ emitNamespacesHelper();
+
+ if (c != null)
+ {
+ for ( Iterator i = _attrs.keySet().iterator() ; i.hasNext() ; )
+ {
+ Splay s = (Splay) i.next();
+ emitAttrHelper( s, (String) _attrs.get( s ) );
+ }
+ }
+
+ if (extraAttr != null)
+ {
+ emitAttrHelper(
+ extraAttr,
+ extraAttrText == null ? null : extraAttrText.toString() );
+ }
+
+ if (!_saveNamespacesFirst)
+ emitNamespacesHelper();
+
+ if (close)
+ emit( '>' );
+ }
+
+ protected void emitText ( Splay s, int p, int cch )
+ {
+ emit( s.getCpForPos( getRoot(), p ), cch );
+ entitizeContent();
+ }
+
+ protected void emitTextAfter ( Splay s, int p, int cch )
+ {
+ if (_text == null)
+ emitText( s, p, cch );
+ else
+ {
+ emit( _text );
+ entitizeContent();
+ }
+ }
+
+ protected void emitTextFragment ( Splay s, int p, int cch )
+ {
+ emitContainerHelper( null, _fragment, null, null, false );
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ {
+ emit( ">" );
+ emit( _text );
+ emitEndHelper( _fragment );
+ return;
+ }
+ }
+ else if (s != null)
+ {
+ if (cch > 0)
+ {
+ emit( ">" );
+ emitText( s, p, cch );
+ emitEndHelper( _fragment );
+ return;
+ }
+ }
+
+ emit( "/>" );
+ }
+
+ protected void emitAttrFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, s, _text, false );
+ emit( "/>" );
+ }
+
+ protected void emitXmlnsFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null, false );
+ emit( "/>" );
+ }
+
+ protected void emitCommentFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null, true );
+ emitComment( s );
+ emitEndHelper( _fragment );
+ }
+
+ protected void emitProcinstFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null, true );
+ emitProcinst( s );
+ emitEndHelper( _fragment );
+ }
+
+ protected void emitXmlns ( String prefix, String uri )
+ {
+ assert prefix != null;
+ assert uri != null;
+
+ emit( "xmlns" );
+
+ if (prefix.length() > 0)
+ {
+ emit( ":" );
+ emit( prefix );
+ }
+
+ emit( "=\"" );
+
+ // TODO - must encode uri properly
+
+ emit( uri );
+ entitizeAttrValue();
+
+ emit( '"' );
+ }
+
+ protected void emitEndHelper ( QName name )
+ {
+ emit( "</" );
+ emitName( name );
+ emit( '>' );
+ }
+
+ protected void emitEnd ( Splay s, QName name )
+ {
+ if (name != null)
+ emitEndHelper( name );
+ }
+
+ private void emitLiteral ( String literal )
+ {
+ if (literal.indexOf( "\"" ) < 0)
+ {
+ emit( "\"" );
+ emit( literal );
+ emit( "\"" );
+ }
+ else
+ {
+ emit( "'" );
+ emit( literal );
+ emit( "'" );
+ }
+ }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID )
+ {
+ assert doctypeName != null;
+
+ emit( "<!DOCTYPE " );
+ emit( doctypeName );
+
+ if (publicID == null && systemID != null)
+ {
+ emit( " SYSTEM " );
+ emitLiteral( systemID );
+ }
+ else if (publicID != null)
+ {
+ emit( " PUBLIC " );
+ emitLiteral( publicID );
+ emit( " " );
+ emitLiteral( systemID );
+ }
+
+ emit( ">" + _newLine );
+ }
+
+ protected void emitComment ( Splay s )
+ {
+ assert s.isComment();
+ emit( "<!--" );
+ emit( getRoot().getCp( s ), s.getCchValue() );
+ entitizeComment();
+ emit( "-->" );
+ }
+
+ protected void emitProcinst ( Splay s )
+ {
+ assert s.isProcinst();
+ emit( "<?" );
+ // TODO - encoding issues here?
+ emit( s.getLocal() );
+
+ if (s.getCchValue() > 0)
+ {
+ emit( " " );
+ emit( getRoot().getCp( s ), s.getCchValue() );
+ entitizeProcinst();
+ }
+
+ emit( "?>" );
+ }
+
+ /**
+ * Ensure that there are at least cch chars available in the buffer.
+ * Return the actual number of characters available. If less than cch,
+ * then that's all which will ever become available.
+ */
+
+ private int ensure ( int cch )
+ {
+ // Even if we're asked to ensure nothing, still try to ensure
+ // atleast one character so we can determine if we're at the
+ // end of the stream.
+
+ if (cch <= 0)
+ cch = 1;
+
+ int available = getAvailable();
+
+ for ( ; available < cch ; available = getAvailable() )
+ if (!process())
+ break;
+
+ assert available == getAvailable();
+
+ if (available == 0)
+ return 0;
+
+ return available;
+ }
+
+ private void emitName ( QName name )
+ {
+ assert name != null;
+
+ String uri = name.getNamespaceURI();
+
+ assert uri != null;
+
+ if (uri.length() != 0)
+ {
+ String prefix = getUriMapping( uri );
+
+ if (prefix.length() > 0)
+ {
+ emit( prefix );
+ emit( ":" );
+ }
+ }
+
+ assert name.getLocalPart().length() > 0;
+
+ emit( name.getLocalPart() );
+ }
+
+ private boolean preEmit ( int cch )
+ {
+ assert cch >= 0;
+
+ _lastEmitCch = cch;
+
+ if (cch == 0)
+ return true;
+
+ if (_free < cch)
+ resize( cch, -1 );
+
+ assert cch <= _free;
+
+ int used = getAvailable();
+
+ // if we are about to emit and there is noting in the buffer, reset
+ // the buffer to be at the beginning so as to not grow it anymore
+ // than needed.
+
+ if (used == 0)
+ {
+ assert _in == _out;
+ assert _free == _buf.length;
+ _in = _out = 0;
+ }
+
+ _lastEmitIn = _in;
+
+ _free -= cch;
+
+ assert _free >= 0;
+
+ return false;
+ }
+
+ private void emit ( String s )
+ {
+ int cch = s == null ? 0 : s.length();
+
+ if (preEmit( cch ))
+ return;
+
+ int chunk;
+
+ if (_in <= _out || cch < (chunk = _buf.length - _in))
+ {
+ s.getChars( 0, cch, _buf, _in );
+ _in += cch;
+ }
+ else
+ {
+ s.getChars( 0, chunk, _buf, _in );
+ s.getChars( chunk, cch, _buf, 0 );
+ _in = (_in + cch) % _buf.length;
+ }
+ }
+
+ private void emit ( StringBuffer sb )
+ {
+ int cch = sb == null ? 0 : sb.length();
+
+ if (preEmit( cch ))
+ return;
+
+ int chunk;
+
+ if (_in <= _out || cch < (chunk = _buf.length - _in))
+ {
+ sb.getChars( 0, cch, _buf, _in );
+ _in += cch;
+ }
+ else
+ {
+ sb.getChars( 0, chunk, _buf, _in );
+ sb.getChars( chunk, cch, _buf, 0 );
+ _in = (_in + cch) % _buf.length;
+ }
+ }
+
+ private void emit ( int cp, int cch )
+ {
+ emit(
+ getRoot()._text._buf,
+ getRoot()._text.unObscure( cp, cch ),
+ cch );
+ }
+
+ private void emit ( char ch )
+ {
+ preEmit( 1 );
+
+ _buf[ _in ] = ch;
+
+ _in = (_in + 1) % _buf.length;
+ }
+
+ private void emit ( char[] buf, int off, int cch )
+ {
+ assert cch >= 0;
+
+ if (preEmit( cch ))
+ return;
+
+ int chunk;
+
+ if (_in <= _out || cch < (chunk = _buf.length - _in))
+ {
+ System.arraycopy( buf, off, _buf, _in, cch );
+ _in += cch;
+ }
+ else
+ {
+ System.arraycopy( buf, off, _buf, _in, chunk );
+ System.arraycopy( buf, off + chunk, _buf, 0, cch - chunk );
+ _in = (_in + cch) % _buf.length;
+ }
+ }
+
+ private void entitizeContent ( )
+ {
+ if (_lastEmitCch == 0)
+ return;
+
+ int i = _lastEmitIn;
+ final int n = _buf.length;
+
+ boolean hasOutOfRange = false;
+
+ int count = 0;
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (ch == '<' || ch == '&')
+ count++;
+ else if (isBadChar( ch ))
+ hasOutOfRange = true;
+
+ if (++i == n)
+ i = 0;
+ }
+
+ if (count == 0 && !hasOutOfRange)
+ return;
+
+ i = _lastEmitIn;
+
+ //
+ // Heuristic for knowing when to save out stuff as a CDATA.
+ //
+
+ if (_lastEmitCch > 32 && count > 5 &&
+ count * 100 / _lastEmitCch > 1)
+ {
+ boolean lastWasBracket = _buf[ i ] == ']';
+
+ i = replace( i, "<![CDATA[" + _buf[ i ] );
+
+ boolean secondToLastWasBracket = lastWasBracket;
+
+ lastWasBracket = _buf[ i ] == ']';
+
+ if (++i == _buf.length)
+ i = 0;
+
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (ch == '>' && secondToLastWasBracket && lastWasBracket)
+ i = replace( i, ">" );
+ else if (isBadChar( ch ))
+ i = replace( i, "?" );
+ else
+ i++;
+
+ secondToLastWasBracket = lastWasBracket;
+ lastWasBracket = ch == ']';
+
+ if (i == _buf.length)
+ i = 0;
+ }
+
+ emit( "]]>" );
+ }
+ else
+ {
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (ch == '<')
+ i = replace( i, "<" );
+ else if (ch == '&')
+ i = replace( i, "&" );
+ else if (isBadChar( ch ))
+ i = replace( i, "?" );
+ else
+ i++;
+
+ if (i == _buf.length)
+ i = 0;
+ }
+ }
+ }
+
+ private void entitizeAttrValue ( )
+ {
+ if (_lastEmitCch == 0)
+ return;
+
+ int i = _lastEmitIn;
+
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (ch == '<')
+ i = replace( i, "<" );
+ else if (ch == '&')
+ i = replace( i, "&" );
+ else if (ch == '"')
+ i = replace( i, """ );
+ else
+ i++;
+
+ if (i == _buf.length)
+ i = 0;
+ }
+ }
+
+ private void entitizeComment ( )
+ {
+ if (_lastEmitCch == 0)
+ return;
+
+ int i = _lastEmitIn;
+
+ boolean lastWasDash = false;
+
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (isBadChar( ch ))
+ i = replace( i, "?" );
+ else if (ch == '-')
+ {
+ if (lastWasDash)
+ {
+ // Replace "--" with "- " to make well formed
+ i = replace( i, " " );
+ lastWasDash = false;
+ }
+ else
+ {
+ lastWasDash = true;
+ i++;
+ }
+ }
+ else
+ {
+ lastWasDash = false;
+ i++;
+ }
+
+ if (i == _buf.length)
+ i = 0;
+ }
+
+ // Because I have only replaced chars with single chars,
+ // _lastEmitIn will still be ok
+
+ if (_buf[ _lastEmitIn + _lastEmitCch - 1 ] == '-')
+ i = replace( _lastEmitIn + _lastEmitCch - 1, " " );
+ }
+
+ private void entitizeProcinst ( )
+ {
+ if (_lastEmitCch == 0)
+ return;
+
+ int i = _lastEmitIn;
+
+ boolean lastWasQuestion = false;
+
+ for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+ {
+ char ch = _buf[ i ];
+
+ if (isBadChar( ch ))
+ i = replace( i, "?" );
+
+ if (ch == '>')
+ {
+ // TODO - Had to convert to a space here ... imples not well formed XML
+ if (lastWasQuestion)
+ i = replace( i, " " );
+ else
+ i++;
+
+ lastWasQuestion = false;
+ }
+ else
+ {
+ lastWasQuestion = ch == '?';
+ i++;
+ }
+
+ if (i == _buf.length)
+ i = 0;
+ }
+ }
+
+
+ /**
+ * Test if a character is valid in xml character content. See
+ * http://www.w3.org/TR/REC-xml#NT-Char
+ */
+
+ private boolean isBadChar ( char ch )
+ {
+ return ! (
+ (ch >= 0x20 && ch <= 0xD7FF ) ||
+ (ch >= 0xE000 && ch <= 0xFFFD) ||
+ (ch >= 0x10000 && ch <= 0x10FFFF) ||
+ (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
+ );
+ }
+
+ private int replace ( int i, String replacement )
+ {
+ assert replacement.length() > 0;
+
+ int dCch = replacement.length() - 1;
+
+ if (dCch == 0)
+ {
+ _buf[ i ] = replacement.charAt( 0 );
+ return i + 1;
+ }
+
+ assert _free >= 0;
+
+ if (dCch > _free)
+ i = resize( dCch, i );
+
+ assert _free >= 0;
+
+ assert _free >= dCch;
+ assert getAvailable() > 0;
+
+ if (_out > _in && i >= _out)
+ {
+ System.arraycopy( _buf, _out, _buf, _out - dCch, i - _out );
+ _out -= dCch;
+ i -= dCch;
+ }
+ else
+ {
+ assert i < _in;
+ System.arraycopy( _buf, i, _buf, i + dCch, _in - i );
+ _in += dCch;
+ }
+
+ replacement.getChars( 0, dCch + 1, _buf, i );
+
+ _free -= dCch;
+
+ assert _free >= 0;
+
+ return i + dCch + 1;
+ }
+
+ int getAvailable ( )
+ {
+ return _buf == null ? 0 : _buf.length - _free;
+ }
+
+ /**
+ * Make sure there is enough room for cch chars in the buffer
+ */
+
+ private int resize ( int cch, int i )
+ {
+ assert _free >= 0;
+ assert cch > 0;
+ assert cch > _free;
+
+ int newLen = _buf == null ? _initialBufSize : _buf.length * 2;
+ int used = getAvailable();
+
+ while ( newLen - used < cch )
+ newLen *= 2;
+
+ char[] newBuf = new char [ newLen ];
+
+ if (used > 0)
+ {
+ if (_in > _out)
+ {
+ assert i == -1 || (i >= _out && i < _in);
+ System.arraycopy( _buf, _out, newBuf, 0, used );
+ i -= _out;
+ }
+ else
+ {
+ assert i == -1 || (i >= _out || i < _in);
+ System.arraycopy( _buf, _out, newBuf, 0, used - _in );
+ System.arraycopy( _buf, 0, newBuf, used - _in, _in );
+ i = i >= _out ? i - _out : i + _out;
+ }
+
+ _out = 0;
+ _in = used;
+ _free += newBuf.length - _buf.length;
+ }
+ else
+ {
+ _free += newBuf.length;
+ assert _in == 0 && _out == 0;
+ assert i == -1;
+ }
+
+ _buf = newBuf;
+
+ assert _free >= 0;
+
+ return i;
+ }
+
+ public int read ( )
+ {
+ if (ensure( 1 ) == 0)
+ return -1;
+
+ assert getAvailable() > 0;
+
+ int ch = _buf[ _out ];
+
+ _out = (_out + 1) % _buf.length;
+ _free++;
+
+ return ch;
+ }
+
+ public int read ( char[] cbuf, int off, int len )
+ {
+ // Check for end of stream even if there is no way to return
+ // characters because the Reader doc says to return -1 at end of
+ // stream.
+
+ int n;
+
+ if ((n = ensure( len )) == 0)
+ return -1;
+
+ if (cbuf == null || len <= 0)
+ return 0;
+
+ if (n < len)
+ len = n;
+
+ if (_out < _in)
+ {
+ System.arraycopy( _buf, _out, cbuf, off, len );
+ }
+ else
+ {
+ int chunk = _buf.length - _out;
+
+ if (chunk >= len)
+ System.arraycopy( _buf, _out, cbuf, off, len );
+ else
+ {
+ System.arraycopy( _buf, _out, cbuf, off, chunk );
+ System.arraycopy( _buf, 0, cbuf, off + chunk, len - chunk );
+ }
+ }
+
+ _out = (_out + len) % _buf.length;
+ _free += len;
+
+ assert _free >= 0;
+
+ return len;
+ }
+
+ public int write ( Writer writer, int cchMin )
+ {
+ while ( getAvailable() < cchMin)
+ {
+ if (!process())
+ break;
+ }
+
+ int charsAvailable = getAvailable();
+
+ if (charsAvailable > 0)
+ {
+ // I don't want to deal with the circular cases
+
+ assert _out == 0;
+
+ try
+ {
+ writer.write( _buf, 0, charsAvailable );
+ writer.flush();
+ }
+ catch ( IOException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ _free += charsAvailable;
+
+ assert _free >= 0;
+
+ _in = 0;
+ }
+
+ return charsAvailable;
+ }
+
+ /**
+ * Ensure all text and return it as a string.
+ */
+
+ public String saveToString ( )
+ {
+ // We're gonna build a string. Instead of using StringBuffer, may
+ // as well use my buffer here. Fill the whole sucker up and
+ // create a String!
+
+ while ( process() )
+ ;
+
+ assert _out == 0;
+
+ int available = getAvailable();
+
+ return available == 0 ? "" : new String( _buf, _out, available );
+ }
+
+ private static final int _initialBufSize = 4096;
+
+ private int _lastEmitIn;
+ private int _lastEmitCch;
+
+ private int _free;
+ private int _in;
+ private int _out;
+ private char[] _buf;
+ }
+
+ /**
+ * A Reader which exposes the text of a part of the tree.
+ */
+
+ static final class TextReader extends Reader
+ {
+ TextReader ( Root r, Splay s, int p, XmlOptions options )
+ {
+ _textSaver = new TextSaver( r, s, p, options, null );
+ }
+
+ public void close ( ) throws IOException { }
+
+ public boolean ready ( ) throws IOException { return true; }
+
+ public int read ( ) throws IOException
+ {
+ return _textSaver.read();
+ }
+
+ public int read ( char[] cbuf ) throws IOException
+ {
+ return _textSaver.read( cbuf, 0, cbuf == null ? 0 : cbuf.length );
+ }
+
+ public int read ( char[] cbuf, int off, int len ) throws IOException
+ {
+ return _textSaver.read( cbuf, off, len );
+ }
+
+ private TextSaver _textSaver;
+ }
+
+ /**
+ *
+ */
+
+ static final class InputStreamSaver extends InputStream
+ {
+ InputStreamSaver (
+ Root r, Splay s, int p, XmlOptions options )
+ {
+ options = XmlOptions.maskNull(options);
+ _byteBuffer = new OutputStreamImpl();
+
+ String encoding = null;
+
+ if (r._props.getEncoding() != null)
+ {
+ encoding =
+ EncodingMap.getIANA2JavaMapping( r._props.getEncoding() );
+ }
+
+ if (options.hasOption(XmlOptions.CHARACTER_ENCODING))
+ {
+ encoding =
+ (String) options.get(XmlOptions.CHARACTER_ENCODING);
+ }
+
+ if (encoding != null)
+ {
+ String ianaEncoding =
+ EncodingMap.getJava2IANAMapping( encoding );
+
+ if (ianaEncoding != null)
+ encoding = ianaEncoding;
+ }
+
+ if (encoding == null)
+ encoding = EncodingMap.getJava2IANAMapping( "UTF8" );
+
+ String javaEncoding = EncodingMap.getIANA2JavaMapping( encoding );
+
+ if (javaEncoding == null)
+ {
+ throw
+ new IllegalStateException(
+ "Unknown encoding: " + encoding );
+ }
+
+ try
+ {
+ _converter = new OutputStreamWriter( _byteBuffer, javaEncoding);
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ _textSaver = new TextSaver( r, s, p, options, encoding );
+ }
+
+ public int read ( )
+ {
+ return _byteBuffer.read();
+ }
+
+ public int read ( byte[] bbuf, int off, int len )
+ {
+ return _byteBuffer.read ( bbuf, off, len );
+ }
+
+ private int ensure ( int cbyte )
+ {
+ // Even if we're asked to ensure nothing, still try to ensure
+ // atleast one byte so we can determine if we're at the
+ // end of the stream.
+
+ if (cbyte <= 0)
+ cbyte = 1;
+
+ int bytesAvailable = _byteBuffer.getAvailable();
+
+ for ( ; bytesAvailable < cbyte ;
+ bytesAvailable = _byteBuffer.getAvailable() )
+ {
+ if (_textSaver.write( _converter, 2048 ) < 2048)
+ break;
+ }
+
+ bytesAvailable = _byteBuffer.getAvailable();
+
+ if (bytesAvailable == 0)
+ return 0;
+
+ return bytesAvailable;
+ }
+
+ private final class OutputStreamImpl extends OutputStream
+ {
+ int read ( )
+ {
+ if (InputStreamSaver.this.ensure( 1 ) == 0)
+ return -1;
+
+ assert getAvailable() > 0;
+
+ int bite = _buf[ _out ];
+
+ _out = (_out + 1) % _buf.length;
+ _free++;
+
+ return bite;
+ }
+
+ int read ( byte[] bbuf, int off, int len )
+ {
+ // Check for end of stream even if there is no way to return
+ // characters because the Reader doc says to return -1 at end of
+ // stream.
+
+ int n;
+
+ if ((n = ensure( len )) == 0)
+ return -1;
+
+ if (bbuf == null || len <= 0)
+ return 0;
+
+ if (n < len)
+ len = n;
+
+ if (_out < _in)
+ {
+ System.arraycopy( _buf, _out, bbuf, off, len );
+ }
+ else
+ {
+ int chunk = _buf.length - _out;
+
+ if (chunk >= len)
+ System.arraycopy( _buf, _out, bbuf, off, len );
+ else
+ {
+ System.arraycopy( _buf, _out, bbuf, off, chunk );
+
+ System.arraycopy(
+ _buf, 0, bbuf, off + chunk, len - chunk );
+ }
+ }
+
+ _out = (_out + len) % _buf.length;
+ _free += len;
+
+ return len;
+ }
+
+ int getAvailable ( )
+ {
+ return _buf == null ? 0 : _buf.length - _free;
+ }
+
+ public void write ( int bite )
+ {
+ if (_free == 0)
+ resize( 1 );
+
+ assert _free > 0;
+
+ _buf[ _in ] = (byte) bite;
+
+ _in = (_in + 1) % _buf.length;
+ _free--;
+ }
+
+ public void write ( byte[] buf, int off, int cbyte )
+ {
+ assert cbyte >= 0;
+
+ if (cbyte == 0)
+ return;
+
+ if (_free < cbyte)
+ resize( cbyte );
+
+ if (_in == _out)
+ {
+ assert getAvailable() == 0;
+ assert _free == _buf.length - getAvailable();
+ _in = _out = 0;
+ }
+
+ int chunk;
+
+ if (_in <= _out || cbyte < (chunk = _buf.length - _in))
+ {
+ System.arraycopy( buf, off, _buf, _in, cbyte );
+ _in += cbyte;
+ }
+ else
+ {
+ System.arraycopy( buf, off, _buf, _in, chunk );
+
+ System.arraycopy(
+ buf, off + chunk, _buf, 0, cbyte - chunk );
+
+ _in = (_in + cbyte) % _buf.length;
+ }
+
+ _free -= cbyte;
+ }
+
+ void resize ( int cbyte )
+ {
+ assert cbyte > _free;
+
+ int newLen = _buf == null ? _initialBufSize : _buf.length * 2;
+ int used = getAvailable();
+
+ while ( newLen - used < cbyte )
+ newLen *= 2;
+
+ byte[] newBuf = new byte [ newLen ];
+
+ if (used > 0)
+ {
+ if (_out == _in)
+ System.arraycopy( _buf, 0, newBuf, 0, used );
+ else if (_in > _out)
+ System.arraycopy( _buf, _out, newBuf, 0, used );
+ else
+ {
+ System.arraycopy(
+ _buf, _out, newBuf, 0, used - _in );
+
+ System.arraycopy(
+ _buf, 0, newBuf, used - _in, _in );
+ }
+
+ _out = 0;
+ _in = used;
+ _free += newBuf.length - _buf.length;
+ }
+ else
+ {
+ _free += newBuf.length;
+ assert _in == 0 && _out == 0;
+ }
+
+ _buf = newBuf;
+ }
+
+ private static final int _initialBufSize = 4096;
+
+ int _free;
+ int _in;
+ int _out;
+ byte[] _buf;
+ }
+
+ private OutputStreamImpl _byteBuffer;
+ private TextSaver _textSaver;
+ private OutputStreamWriter _converter;
+ }
+
+ /**
+ *
+ */
+
+ static final class XmlInputStreamSaver extends Saver
+ {
+ XmlInputStreamSaver ( Root r, Splay s, int p, XmlOptions options )
+ {
+ super( r, s, p, options );
+ }
+
+ XMLEvent dequeue ( ) throws XMLStreamException
+ {
+ if (_out == null && !process())
+ return null;
+
+ if (_out == null)
+ return null;
+
+ XmlEventImpl e = _out;
+
+ if ((_out = _out._next) == null)
+ _in = null;
+
+ return e;
+ }
+
+ private void enqueue ( XmlEventImpl e )
+ {
+ assert e._next == null;
+
+ if (_in == null)
+ {
+ assert _out == null;
+ _out = _in = e;
+ }
+ else
+ {
+ _in._next = e;
+ _in = e;
+ }
+ }
+
+ //
+ //
+ //
+
+ protected void emitXmlnsFragment ( Splay s )
+ {
+ throw new IllegalStateException( "Can't stream an attribute" );
+ }
+
+ protected void emitText ( Splay s, int p, int cch )
+ {
+ assert cch > 0;
+ enqueue( new CharacterDataImpl( getRoot(), s, p, null ) );
+ }
+
+ protected void emitTextFragment ( Splay s, int p, int cch )
+ {
+ // BUGBUG - there could be namespaces pushed for this text, not
+ // sure how to communicate those, however
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ emitText( s, p, cch );
+
+ return;
+ }
+
+ if (s != null && cch > 0)
+ emitText( s, p, cch );
+ }
+
+ protected void emitTextAfter ( Splay s, int p, int cch )
+ {
+ if (_text == null)
+ emitText( s, p, cch );
+ else
+ enqueue( new CharacterDataImpl( getRoot(), s, -1, text() ) );
+ }
+
+ protected void emitEndPrefixMappings ( )
+ {
+ Root r = getRoot();
+
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ {
+ String prevPrefixUri = mappingPrevPrefixUri();
+
+ if (prevPrefixUri == null)
+ enqueue( new EndPrefixMappingImpl( r, mappingPrefix() ) );
+ else
+ {
+ enqueue(
+ new ChangePrefixMappingImpl(
+ r, mappingPrefix(), mappingUri(), prevPrefixUri ) );
+ }
+ }
+ }
+
+ protected void emitEnd ( Splay s, QName name )
+ {
+ Root r = getRoot();
+
+ if (s.isRoot())
+ enqueue( new EndDocumentImpl( r, s ) );
+ else if (s.isEnd())
+ enqueue( new EndElementImpl( r, s, name, getUriMap() ) );
+ else
+ {
+ assert s.isLeaf();
+ enqueue( new EndElementImpl( r, s, name, getUriMap() ) );
+ }
+
+ emitEndPrefixMappings();
+ }
+
+ protected void emitCommentFragment ( Splay s )
+ {
+ emitComment( s );
+ }
+
+ protected void emitProcinstFragment ( Splay s )
+ {
+ emitProcinst( s );
+ }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID )
+ {
+ }
+
+ protected void emitComment ( Splay s )
+ {
+ enqueue( new CommentImpl( getRoot(), s ) );
+ }
+
+ protected void emitProcinst ( Splay s )
+ {
+ enqueue( new ProcessingInstructionImpl( getRoot(), s ) );
+ }
+
+ protected void emitAttrFragment ( Splay s )
+ {
+ throw new IllegalStateException( "Can't stream an attribute" );
+ }
+
+ protected void emitContainer ( Container c, QName name )
+ {
+ Root r = getRoot();
+
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ {
+ enqueue(
+ new StartPrefixMappingImpl(
+ r, mappingPrefix(), mappingUri() ) );
+ }
+
+ if (c.isDoc())
+ enqueue( new StartDocumentImpl( r, c ) );
+
+ if (name != null)
+ {
+ enqueue(
+ new StartElementImpl( r, c, name, this ) );
+ }
+
+ if (c.isDoc())
+ {
+ assert c.isDoc();
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ enqueue( new CharacterDataImpl( r, c, -1, text() ) );
+ }
+ else if (c.getCch() > 0)
+ enqueue( new CharacterDataImpl( r, c, 1, null ) );
+ }
+ else if (c.isLeaf())
+ {
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ enqueue( new CharacterDataImpl( r, c, -1, text() ));
+ }
+ else if (c.getCchValue() > 0)
+ enqueue( new CharacterDataImpl( r, c, 1, null ) );
+
+ enqueue( new EndElementImpl( r, c, name, getUriMap() ) );
+
+ emitEndPrefixMappings();
+ }
+ }
+
+
+ //
+ //
+ //
+
+ private static XMLName computeName ( QName n, Map uriMap )
+ {
+ String uri = n.getNamespaceURI();
+
+ if (uri.length() == 0)
+ uri = null;
+
+ assert n.getLocalPart().length() > 0;
+
+ // The following assert may fire if someone computes a name
+ // of an element/attr too late (after other events have been
+ // enqueued and the uri map has been updated. I check later
+ // to make sure we don't crash, however.
+
+ assert uri == null || uriMap.containsKey( uri ) : "Problem uri " + uri;
+
+ String prefix = null;
+
+ if (uri != null)
+ {
+ prefix = (String) uriMap.get( uri );
+
+ if (prefix != null && prefix.length() == 0)
+ prefix = null;
+ }
+
+ return new XmlNameImpl( uri, n.getLocalPart(), prefix );
+ }
+
+ private static abstract class XmlEventImpl extends XmlEventBase
+ {
+ public Object monitor()
+ {
+ return _root;
+ }
+
+ XmlEventImpl ( int type, Root r, Splay s )
+ {
+ super( type );
+ _root = r;
+ _splay = s;
+ _version = _root.getVersion();
+ }
+
+ public XMLName getName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return null;
+ }
+ }
+
+ public XMLName getSchemaType ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ throw new RuntimeException( "NYI" );
+ }
+ }
+
+ public boolean hasName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return false;
+ }
+ }
+
+ public final Location getLocation ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ // TODO - perhaps I can save a location goober sometimes?
+ return null;
+ }
+ }
+
+ protected final void checkVersion ( )
+ {
+ if (_version != _root.getVersion())
+ throw new ConcurrentModificationException( "Document changed" );
+ }
+
+ protected final Root getRoot ( )
+ {
+ return _root;
+ }
+
+ protected final Splay getSplay ( )
+ {
+ return _splay;
+ }
+
+ private Root _root;
+ private Splay _splay;
+ private long _version;
+
+ XmlEventImpl _next;
+ }
+
+ private static class StartDocumentImpl
+ extends XmlEventImpl implements StartDocument
+ {
+ StartDocumentImpl ( Root r, Splay s )
+ {
+ super( XMLEvent.START_DOCUMENT, r, s );
+ }
+
+ public String getSystemId ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return getRoot()._props.getDoctypeSystemId();
+ }
+ }
+
+ public String getCharacterEncodingScheme ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return getRoot()._props.getEncoding();
+ }
+ }
+
+ public boolean isStandalone ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return getRoot()._standAlone;
+ }
+ }
+
+ public String getVersion ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return getRoot()._props.getVersion();
+ }
+ }
+ }
+
+ private static class StartElementImpl
+ extends XmlEventImpl implements StartElement
+ {
+ StartElementImpl ( Root r, Splay s, QName name, Saver saver )
+ {
+ super( XMLEvent.START_ELEMENT, r, s );
+
+ _name = computeName( name, saver.getUriMap() );
+
+ _prefixMap = saver.getPrefixMap();
+
+ AttributeImpl lastAttr = null;
+
+ for ( Iterator i = saver._attrs.keySet().iterator() ;
+ i.hasNext() ; )
+ {
+ Splay a = (Splay) i.next();
+
+ AttributeImpl attr =
+ new NormalAttributeImpl(
+ r, a, (String) saver._attrs.get( a ),
+ saver.getUriMap() );
+
+ if (_attributes == null)
+ _attributes = attr;
+ else
+ lastAttr._next = attr;
+
+ lastAttr = attr;
+ }
+
+ lastAttr = null;
+
+ for ( saver.iterateMappings() ;
+ saver.hasMapping() ; saver.nextMapping() )
+ {
+ AttributeImpl attr =
+ new XmlnsAttributeImpl(
+ r, saver.mappingPrefix(), saver.mappingUri(),
+ saver.getUriMap() );
+
+ if (_namespaces == null)
+ _namespaces = attr;
+ else
+ lastAttr._next = attr;
+
+ lastAttr = attr;
+ }
+ }
+
+ public boolean hasName()
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return true;
+ }
+ }
+
+ public XMLName getName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _name;
+ }
+ }
+
+ public AttributeIterator getAttributes ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return
+ new AttributeIteratorImpl( getRoot(), _attributes, null );
+ }
+ }
+
+ public AttributeIterator getNamespaces ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return
+ new AttributeIteratorImpl( getRoot(), null, _namespaces );
+ }
+ }
+
+ public AttributeIterator getAttributesAndNamespaces ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return
+ new AttributeIteratorImpl(
+ getRoot(), _attributes, _namespaces );
+ }
+ }
+
+ public Attribute getAttributeByName ( XMLName xmlName )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ for ( AttributeImpl a = _attributes ; a != null ; a = a._next )
+ {
+ if (xmlName.equals( a.getName() ))
+ return a;
+ }
+
+ return null;
+ }
+ }
+
+ public String getNamespaceUri ( String prefix )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return
+ (String) _prefixMap.get( prefix == null ? "" : prefix );
+ }
+ }
+
+ public Map getNamespaceMap ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return _prefixMap;
+ }
+ }
+
+ private static class AttributeIteratorImpl
+ implements AttributeIterator
+ {
+ public Object monitor()
+ {
+ return _root;
+ }
+
+ AttributeIteratorImpl (
+ Root r, AttributeImpl attributes, AttributeImpl namespaces )
+ {
+ _root = r;
+ _version = r.getVersion();
+ _attributes = attributes;
+ _namespaces = namespaces;
+ }
+
+ public Attribute next ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ AttributeImpl attr = null;
+
+ if (_attributes != null)
+ {
+ attr = _attributes;
+ _attributes = attr._next;
+ }
+ else if (_namespaces != null)
+ {
+ attr = _namespaces;
+ _namespaces = attr._next;
+ }
+
+ return attr;
+ }
+ }
+
+ public boolean hasNext ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return _attributes != null || _namespaces != null;
+ }
+ }
+
+ public Attribute peek ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ if (_attributes != null)
+ return _attributes;
+ else if (_namespaces != null)
+ return _namespaces;
+
+ return null;
+ }
+ }
+
+ public void skip ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ if (_attributes != null)
+ _attributes = _attributes._next;
+ else if (_namespaces != null)
+ _namespaces = _namespaces._next;
+ }
+ }
+
+ private final void checkVersion ( )
+ {
+ if (_version != _root.getVersion())
+ throw new IllegalStateException( "Document changed" );
+ }
+
+ private Root _root;
+ private long _version;
+ private AttributeImpl _attributes;
+ private AttributeImpl _namespaces;
+ }
+
+ private static abstract class AttributeImpl implements Attribute
+ {
+ public Object monitor()
+ {
+ return _root;
+ }
+
+ AttributeImpl ( Root r )
+ {
+ _root = r;
+ _version = r.getVersion();
+ }
+
+ public XMLName getName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _name;
+ }
+ }
+
+ public String getType ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ // TODO - Make sure throwing away this DTD info is ok.
+ // Is there schema info which can return more useful info?
+ return "CDATA";
+ }
+ }
+
+ public XMLName getSchemaType ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ // TODO - Can I return something reasonable here?
+ return null;
+ }
+ }
+
+ protected final void checkVersion ( )
+ {
+ if (_version != _root.getVersion())
+ throw new IllegalStateException( "Document changed" );
+ }
+
+ AttributeImpl _next;
+
+ protected XMLName _name;
+
+ protected Root _root;
+ private long _version;
+ }
+
+ private static class XmlnsAttributeImpl extends AttributeImpl
+ {
+ XmlnsAttributeImpl (
+ Root r, String prefix, String uri, Map uriMap )
+ {
+ super( r );
+
+ _uri = uri;
+
+ String local;
+
+ if (prefix.length() == 0)
+ {
+ prefix = null;
+ local = "xmlns";
+ }
+ else
+ {
+ local = prefix;
+ prefix = "xmlns";
+ }
+
+ _name = new XmlNameImpl( null, local, prefix );
+ }
+
+ public String getValue ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _uri;
+ }
+ }
+
+ private String _uri;
+ }
+
+ private static class NormalAttributeImpl extends AttributeImpl
+ {
+ NormalAttributeImpl (
+ Root r, Splay s, String value, Map uriMap )
+ {
+ super( r );
+ assert s.isNormalAttr();
+ _splay = s;
+ _value = value;
+ _name = computeName( s.getName(), uriMap );
+ }
+
+ public String getValue ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return _value != null ? _value : _splay.getText( _root );
+ }
+ }
+
+ private String _value; // If invalid in the store
+ private Splay _splay;
+ }
+
+ private XMLName _name;
+ private Map _prefixMap;
+
+ private AttributeImpl _attributes;
+ private AttributeImpl _namespaces;
+ }
+
+ private static class StartPrefixMappingImpl
+ extends XmlEventImpl implements StartPrefixMapping
+ {
+ StartPrefixMappingImpl ( Root r, String prefix, String uri )
+ {
+ super( XMLEvent.START_PREFIX_MAPPING, r, null );
+
+ _prefix = prefix;
+ _uri = uri;
+ }
+
+ public String getNamespaceUri ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _uri;
+ }
+ }
+
+ public String getPrefix ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _prefix;
+ }
+ }
+
+ private String _prefix, _uri;
+ }
+
+ private static class ChangePrefixMappingImpl
+ extends XmlEventImpl implements ChangePrefixMapping
+ {
+ ChangePrefixMappingImpl (
+ Root r, String prefix, String oldUri, String newUri )
+ {
+ super( XMLEvent.CHANGE_PREFIX_MAPPING, r, null );
+
+ _oldUri = oldUri;
+ _newUri = newUri;
+ _prefix = prefix;
+ }
+
+ public String getOldNamespaceUri ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _oldUri;
+ }
+ }
+
+ public String getNewNamespaceUri ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _newUri;
+ }
+ }
+
+ public String getPrefix ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _prefix;
+ }
+ }
+
+ private String _oldUri, _newUri, _prefix;
+ }
+
+ private static class EndPrefixMappingImpl
+ extends XmlEventImpl implements EndPrefixMapping
+ {
+ EndPrefixMappingImpl ( Root r, String prefix )
+ {
+ super( XMLEvent.END_PREFIX_MAPPING, r, null );
+ _prefix = prefix;
+ }
+
+ public String getPrefix ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _prefix;
+ }
+ }
+
+ private String _prefix;
+ }
+
+ private static class CharacterDataImpl
+ extends XmlEventImpl implements CharacterData
+ {
+ CharacterDataImpl ( Root r, Splay s, int p, String charData )
+ {
+ super( XMLEvent.CHARACTER_DATA, r, s );
+
+ assert p > 0 || (charData != null && charData.length() > 0);
+
+ _pos = p;
+ _charData = charData;
+ }
+
+ public String getContent ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ Splay s = getSplay();
+
+ if (_pos == -1)
+ return _charData;
+
+ Root r = getRoot();
+
+ return
+ r._text.fetch(
+ s.getCpForPos( r, _pos ), s.getPostCch( _pos ) );
+ }
+ }
+
+ public boolean hasContent ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return true;
+ }
+ }
+
+ private int _pos;
+ private String _charData;
+ }
+
+ private static class EndElementImpl
+ extends XmlEventImpl implements EndElement
+ {
+ EndElementImpl ( Root r, Splay s, QName name, Map uriMap )
+ {
+ super( XMLEvent.END_ELEMENT, r, s );
+
+ assert s.isLeaf() || s.isEnd();
+
+ if (name == null)
+ {
+ if (s.isEnd())
+ s = s.getContainer();
+
+ name = s.getName();
+ }
+
+ _name = computeName( name, uriMap );
+ }
+
+ public boolean hasName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return true;
+ }
+ }
+
+ public XMLName getName ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return _name;
+ }
+ }
+
+ private XMLName _name;
+ }
+
+ private static class EndDocumentImpl
+ extends XmlEventImpl implements EndDocument
+ {
+ EndDocumentImpl ( Root r, Splay s )
+ {
+ super( XMLEvent.END_DOCUMENT, r, s );
+ }
+ }
+
+ private static class CommentImpl
+ extends XmlEventImpl implements Comment
+ {
+ CommentImpl ( Root r, Splay s )
+ {
+ super( XMLEvent.COMMENT, r, s );
+ assert s.isComment();
+ }
+
+ public String getContent ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ Splay s = getSplay();
+ return s.getCch() == 0 ? null : s.getText( getRoot() );
+ }
+ }
+
+ public boolean hasContent ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+
+ return getSplay().getCch() > 0;
+ }
+ }
+ }
+
+ private static class ProcessingInstructionImpl
+ extends XmlEventImpl implements ProcessingInstruction
+ {
+ ProcessingInstructionImpl ( Root r, Splay s )
+ {
+ super( XMLEvent.PROCESSING_INSTRUCTION, r, s );
+ assert s.isProcinst();
+ }
+
+ public String getTarget ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ return getSplay().getLocal();
+ }
+ }
+
+ public String getData ( )
+ {
+ synchronized (monitor())
+ {
+ checkVersion();
+ Splay s = getSplay();
+ return s.getCch() == 0 ? null : s.getText( getRoot() );
+ }
+ }
+ }
+
+ private XmlEventImpl _in, _out;
+ }
+
+ static final class XmlInputStreamImpl extends GenericXmlInputStream
+ {
+ XmlInputStreamImpl ( Root r, Splay s, int p, XmlOptions options )
+ {
+ _xmlInputStreamSaver =
+ new XmlInputStreamSaver( r, s, p, options );
+
+ // Make the saver grind away just a bit to throw any exceptions
+ // related to the inability to create a stream on this xml
+
+ _xmlInputStreamSaver.process();
+ }
+
+ protected XMLEvent nextEvent ( ) throws XMLStreamException
+ {
+ return _xmlInputStreamSaver.dequeue();
+ }
+
+ private XmlInputStreamSaver _xmlInputStreamSaver;
+ }
+
+ //
+ //
+ //
+
+ static final class ValidatorSaver
+ extends Saver implements ValidatorListener.Event
+ {
+ ValidatorSaver (
+ Root r, Splay s, int p,
+ XmlOptions options, ValidatorListener vEventSink )
+ {
+ super( r, s, p, options );
+
+ _wantDupAttrs = true;
+
+ assert p == 0;
+
+ _startSplay = s;
+ _vEventSink = vEventSink;
+
+ while ( process() )
+ ; // Empty
+ }
+
+ protected void emitXmlnsFragment ( Splay s )
+ {
+ throw new IllegalStateException();
+ }
+
+ protected void emitTextFragment ( Splay s, int p, int cch )
+ {
+ throw new IllegalStateException();
+ }
+
+ protected void emitCommentFragment ( Splay s )
+ {
+ throw new IllegalStateException();
+ }
+
+ protected void emitProcinstFragment ( Splay s )
+ {
+ throw new IllegalStateException();
+ }
+
+ protected void emitTextAfter ( Splay s, int p, int cch )
+ {
+ if (_text == null)
+ {
+ assert cch > 0;
+ emitEvent( ValidatorListener.TEXT, s, p, null, s, p );
+ }
+ else
+ emitEvent( ValidatorListener.TEXT, s, p, null, text() );
+ }
+
+ protected void emitEnd ( Splay s, QName name )
+ {
+ emitEvent( ValidatorListener.END, s, 0 );
+ }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID )
+ {
+ }
+
+ protected void emitComment ( Splay s )
+ {
+ if (s.getCchAfter() > 0)
+ emitEvent( ValidatorListener.TEXT, s, 0, null, s, 1 );
+ }
+
+ protected void emitProcinst ( Splay s )
+ {
+ if (s.getCchAfter() > 0)
+ emitEvent( ValidatorListener.TEXT, s, 0, null, s, 1 );
+ }
+
+ protected void emitAttrFragment ( Splay s )
+ {
+ emitEvent( ValidatorListener.BEGIN, s, 0, null );
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ emitEvent( ValidatorListener.TEXT, s, 0, null, text() );
+ }
+ else if (s.getCch() > 0)
+ emitEvent( ValidatorListener.TEXT, s, 0, null, s, 0 );
+
+ emitEvent( ValidatorListener.END, s, 0 );
+ }
+
+ protected void emitContainer ( Container c, QName name )
+ {
+ assert _xsiNoLoc == null;
+ assert _xsiLoc == null;
+ assert _xsiType == null;
+ assert _xsiNil == null;
+
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXsiAttr())
+ {
+ String local = s.getLocal();
+
+ if (local.equals( "type" ))
+ _xsiType = s;
+ else if (local.equals( "nil" ))
+ _xsiNil = s;
+ else if (local.equals( "schemaLocation" ))
+ _xsiLoc = s;
+ else if (local.equals( "noNamespaceSchemaLocation" ))
+ _xsiNoLoc = s;
+ }
+ }
+
+ emitEvent(
+ ValidatorListener.BEGIN, c, 0,
+ c == _startSplay ? null : name );
+
+ _xsiNoLoc = _xsiLoc = _xsiType = _xsiNil = null;
+
+ for ( Iterator i = _attrs.keySet().iterator() ; i.hasNext() ; )
+ {
+ Splay s = (Splay) i.next();
+
+ if (s.isXsiAttr())
+ {
+ String local = s.getLocal();
+
+ if (local.equals( "type" ) ||
+ local.equals( "nil" ) ||
+ local.equals( "schemaLocation" ) ||
+ local.equals( "noNamespaceSchemaLocation" ))
+ {
+ continue;
+ }
+ }
+
+ String invalidAttrValue = (String) _attrs.get( s );
+
+ if (invalidAttrValue == null)
+ {
+ emitEvent(
+ ValidatorListener.ATTR, s, 0, s.getName(), s, 0 );
+ }
+ else
+ {
+ emitEvent(
+ ValidatorListener.ATTR, s, 0, s.getName(),
+ invalidAttrValue );
+ }
+ }
+
+ emitEvent( ValidatorListener.ENDATTRS, c, 0 );
+
+ if (c.isDoc())
+ {
+ assert c.isDoc();
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ emitEvent( ValidatorListener.TEXT, c, 1, null, text() );
+ }
+ else if (c.getCch() > 0)
+ emitEvent( ValidatorListener.TEXT, c, 1, null, c, 1 );
+ }
+ else if (c.isLeaf())
+ {
+ int cch = _text != null ? _text.length() : c.getCchValue();
+
+ if (cch > 0)
+ {
+ if (_text != null)
+ {
+ emitEvent(
+ ValidatorListener.TEXT, c, 1, null, text() );
+ }
+ else
+ {
+ emitEvent(
+ ValidatorListener.TEXT, c, 1, null, c, 1 );
+ }
+ }
+
+ emitEvent( ValidatorListener.END, c, c.getPosLeafEnd() );
+ }
+ }
+
+ protected void emitEvent ( int kind, Splay sLoc, int pLoc )
+ { emitEvent( kind, sLoc, pLoc, null, null, 0, null ); }
+
+ protected void emitEvent ( int kind, Splay sLoc, int pLoc, QName name )
+ { emitEvent( kind, sLoc, pLoc, name, null, 0, null ); }
+
+ protected void emitEvent (
+ int kind, Splay sLoc, int pLoc, QName name, String text )
+ { emitEvent ( kind, sLoc, pLoc, name, null, 0, text ); }
+
+ protected void emitEvent (
+ int kind, Splay sLoc, int pLoc, QName name, Splay sText, int pText )
+ { emitEvent ( kind, sLoc, pLoc, name, sText, pText, null ); }
+
+ protected void emitEvent (
+ int kind, Splay sLoc, int pLoc, QName name,
+ Splay sText, int pText, String text )
+ {
+ if (kind == ValidatorListener.TEXT && _emittedText)
+ return;
+
+ boolean hasText = text != null || sText != null;
+
+ assert
+ !hasText ||
+ (kind == ValidatorListener.ATTR ||
+ kind == ValidatorListener.TEXT);
+
+ assert kind != ValidatorListener.ATTR || hasText;
+ assert kind != ValidatorListener.TEXT || hasText;
+
+ assert kind != ValidatorListener.ATTR || name != null;
+
+ _name = name;
+ _sText = sText;
+ _pText = pText;
+ _eventText = text;
+ _hasText = hasText;
+ _sLoc = sLoc;
+ _pLoc = pLoc;
+
+ _vEventSink.nextEvent( kind, this );
+
+ _emittedText = kind == ValidatorListener.TEXT;
+ }
+
+ //
+ //
+ //
+
+ public XmlCursor getLocationAsCursor ( )
+ {
+ checkVersion();
+ return new Cursor( getRoot(), _sLoc, _pLoc );
+ }
+
+ public boolean getXsiType ( Chars chars )
+ {
+ if (_xsiType == null)
+ return false;
+
+ setChars( chars, PRESERVE, null, _xsiType, 0 );
+
+ return true;
+ }
+
+ public boolean getXsiNil ( Chars chars )
+ {
+ if (_xsiNil == null)
+ return false;
+
+
+ setChars( chars, PRESERVE, null, _xsiNil, 0 );
+
+ return true;
+ }
+
+ public boolean getXsiLoc ( Chars chars )
+ {
+ if (_xsiLoc == null)
+ return false;
+
+ setChars( chars, PRESERVE, null, _xsiLoc, 0 );
+
+ return true;
+ }
+
+ public boolean getXsiNoLoc ( Chars chars )
+ {
+ if (_xsiNoLoc == null)
+ return false;
+
+ setChars( chars, PRESERVE, null, _xsiNoLoc, 0 );
+
+ return true;
+ }
+
+ public QName getName ( )
+ {
+ return _name;
+ }
+
+ private void setChars (
+ Chars chars, int wsr, String string, Splay sText, int pText )
+ {
+ assert string != null || sText != null;
+
+ checkVersion();
+
+ Root r = getRoot();
+
+ chars.buffer = null;
+ chars.string = null;
+
+ if (string != null)
+ {
+ chars.string = string;
+ }
+ else if (pText == 0)
+ {
+ chars.buffer = r._text._buf;
+ chars.length = sText.getCch();
+
+ chars.offset =
+ r._text.unObscure(
+ r.getCp( sText ), chars.length );
+ }
+ else if (pText == 1 && sText.isLeaf())
+ {
+ chars.buffer = r._text._buf;
+ chars.length = sText.getCchValue();
+
+ chars.offset =
+ r._text.unObscure(
+ r.getCp( sText ), chars.length );
+ }
+ else
+ {
+ assert pText == sText.getPosAfter();
+
+ boolean moreText = false;
+
+ for ( Splay t = sText.nextNonAttrSplay() ; ;
+ t = t.nextSplay() )
+ {
+ if (!t.isComment() && !t.isProcinst())
+ break;
+
+ if (t.getCchAfter() > 0)
+ {
+ moreText = true;
+ break;
+ }
+ }
+
+ if (!moreText)
+ {
+ chars.buffer = r._text._buf;
+ chars.length = sText.getCchAfter();
+
+ chars.offset =
+ r._text.unObscure(
+ sText.getCpForPos( r, pText ),
+ chars.length );
+ }
+ else
+ {
+ StringBuffer sb = new StringBuffer();
+
+ int cch = sText.getCchAfter();
+
+ int off =
+ r._text.unObscure(
+ sText.getCpForPos( r, pText ), cch );
+
+ sb.append( r._text._buf, off, cch );
+
+ for ( Splay t = sText.nextNonAttrSplay() ; ;
+ t = t.nextSplay() )
+ {
+ if (!t.isComment() && !t.isProcinst())
+ break;
+
+ if (t.getCchAfter() > 0)
+ {
+ cch = t.getCchAfter();
+
+ off =
+ r._text.unObscure(
+ t.getCpForPos( r, 1 ), cch );
+
+ sb.append( r._text._buf, off, cch );
+ }
+ }
+
+ chars.length = sb.length();
+ chars.buffer = new char [ chars.length ];
+ chars.offset = 0;
+
+ sb.getChars( 0, chars.length, chars.buffer, 0 );
+ }
+ }
+
+ if (wsr != PRESERVE)
+ {
+ // TODO - this is quick, dirty and very inefficient
+ // make it faster!
+
+ String str = chars.asString();
+ StringBuffer sb = new StringBuffer();
+ int state = -1, nSpaces = 0, cch = str.length();
+
+ for ( int i = 0 ; i < cch ; i++ )
+ {
+ char ch = str.charAt( i );
+
+ if (ch == '\n' || ch == '\r' || ch == '\t')
+ ch = ' ';
+
+ if (wsr == COLLAPSE)
+ {
+ if (ch == ' ')
+ {
+ if (state == -1)
+ continue;
+
+ nSpaces++;
+
+ continue;
+ }
+
+ if (nSpaces > 1)
+ nSpaces = 1;
+
+ for ( ; nSpaces > 0 ; nSpaces-- )
+ sb.append( ' ' );
+
+ state = 0;
+ }
+
+ sb.append( ch );
+ }
+
+ chars.string = sb.toString();
+ chars.buffer = null;
+ }
+ }
+
+ public void getText ( Chars chars )
+ {
+ getText( chars, PRESERVE );
+ }
+
+ public void getText ( Chars chars, int wsr )
+ {
+ if (!_hasText)
+ throw new RuntimeException( "No text for this event");
+
+ setChars( chars, wsr, _eventText, _sText, _pText );
+ }
+
+ // TODO - rather expensive to make Chars and getText and get
+ // String
+ public boolean textIsWhitespace ( )
+ {
+ Chars chars = new Chars();
+ getText( chars );
+ String s = chars.asString();
+
+ for ( int i = 0 ; i < s.length() ; i++ )
+ {
+ switch ( s.charAt( i ) )
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ case '\t':
+ break;
+
+ default :
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private ValidatorListener _vEventSink;
+ private Splay _startSplay;
+ private boolean _emittedText;
+
+ private QName _name;
+ private Splay _xsiType;
+ private Splay _xsiNil;
+ private Splay _xsiLoc;
+ private Splay _xsiNoLoc;
+ private String _eventText;
+ private Splay _sText;
+ private int _pText;
+ private Splay _sLoc;
+ private int _pLoc;
+ private boolean _hasText;
+ }
+
+ //
+ //
+ //
+
+ static final class SaxSaver extends Saver
+ {
+ SaxSaver (
+ Root r, Splay s, int p, XmlOptions options,
+ ContentHandler contentHandler, LexicalHandler lexicalhandler )
+ throws SAXException
+ {
+ super( r, s, p, options );
+
+ _attributes = new AttributesImpl();
+
+ _wantFragTest = true;
+
+ _contentHandler = contentHandler;
+ _lexicalhandler = lexicalhandler;
+
+// _contentHandler.setDocumentLocator( hhmmmm );
+
+ _contentHandler.startDocument();
+
+ try
+ {
+ while ( process() )
+ ;
+ }
+ catch ( SaverSAXException e )
+ {
+ throw e._saxException;
+ }
+
+ _contentHandler.endDocument();
+ }
+
+ private class SaverSAXException extends RuntimeException
+ {
+ SaverSAXException ( SAXException e )
+ {
+ _saxException = e;
+ }
+
+ SAXException _saxException;
+ }
+
+ private void throwSaxException ( SAXException e )
+ {
+ throw new SaverSAXException( e );
+ }
+
+ protected void emitContainer ( Container c, QName name )
+ {
+ if (c.isBegin())
+ {
+ emitContainerHelper( c, name, null, null );
+
+ if (c.isLeaf())
+ {
+ int cch = _text == null ? c.getCchValue() : _text.length();
+
+ if (cch > 0)
+ {
+ if (_text == null)
+ emitCharacters( c, 0, cch );
+ else
+ emitCharacters( _text );
+ }
+
+ emitEndElement( c.getName() );
+ }
+ }
+ else
+ {
+ assert c.isDoc();
+
+ if (name != null)
+ emitContainerHelper( c, name, null, null );
+
+ if (_text == null)
+ emitCharacters( c, 0, c.getCch() );
+ else
+ emitCharacters( _text );
+ }
+ }
+
+ private void emitAttrHelper ( Splay s, String value )
+ {
+ assert s.isNormalAttr();
+
+ String local = s.getLocal();
+ String uri = s.getUri();
+
+ _attributes.addAttribute(
+ s.getUri(), s.getLocal(),
+ getPrefixedName( s.getName() ),
+ "CDATA",
+ value == null ? s.getText( getRoot() ) : value );
+ }
+
+ private void addNamespaceAttr ( String prefix, String uri )
+ {
+ try
+ {
+ _contentHandler.startPrefixMapping( prefix, uri );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+
+ if (prefix.length() == 0)
+ _attributes.addAttribute( "", "", "xmlns", "CDATA", uri );
+ else
+ {
+ _attributes.addAttribute(
+ "", "", "xmlns:" + prefix, "CDATA", uri );
+ }
+ }
+
+ private void emitNamespacesHelper ( )
+ {
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ addNamespaceAttr( mappingPrefix(), mappingUri() );
+ }
+
+ private void emitContainerHelper (
+ Container c, QName name,
+ Splay extraAttr, StringBuffer extraAttrText )
+ {
+ assert name != null;
+
+ _attributes.clear();
+
+ if (_saveNamespacesFirst)
+ emitNamespacesHelper();
+
+ for ( Iterator i = _attrs.keySet().iterator() ; i.hasNext() ; )
+ {
+ Splay s = (Splay) i.next();
+ emitAttrHelper( s, (String) _attrs.get( s ) );
+ }
+
+ if (extraAttr != null)
+ {
+ emitAttrHelper(
+ extraAttr,
+ extraAttrText == null ? null : extraAttrText.toString() );
+ }
+
+ if (!_saveNamespacesFirst)
+ emitNamespacesHelper();
+
+ emitElement( name, getPrefixedName( name ) );
+ }
+
+ private void emitCharacters ( char[] buf, int off, int cch )
+ {
+ try
+ {
+ _contentHandler.characters( buf, off, cch );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+
+ private void emitCharacters ( Splay s, int p, int cch )
+ {
+ emitCharacters( s.getCpForPos( getRoot(), p ), cch );
+ }
+
+ private void emitCharacters ( int cp, int cch )
+ {
+ if (cch == 0)
+ return;
+
+ emitCharacters(
+ getRoot()._text._buf, getRoot()._text.unObscure( cp, cch ),
+ cch );
+ }
+
+ private void emitCharacters ( StringBuffer sb )
+ {
+ if (sb.length() == 0)
+ return;
+
+ String text = sb.toString(); // Inefficient, use a shared char[]
+
+ emitCharacters( text.toCharArray(), 0, text.length() );
+ }
+
+ private void emitEndElement ( QName name )
+ {
+ try
+ {
+ _contentHandler.endElement(
+ name.getNamespaceURI(), name.getLocalPart(),
+ getPrefixedName( name ) );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ {
+ try
+ {
+ _contentHandler.endPrefixMapping( mappingPrefix() );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+ }
+
+ private void endNamespaces ( )
+ {
+ try
+ {
+ for ( int i = 0 ; i < _attributes.getLength() ; i ++ )
+ {
+ String qn = _attributes.getQName( i );
+
+ if (!qn.startsWith( "xmlns" ))
+ continue;
+
+ int j = qn.indexOf( ':' );
+
+ if (j >= 0)
+ {
+ _contentHandler.endPrefixMapping(
+ qn.substring( j + 1 ) );
+ }
+ else
+ _contentHandler.endPrefixMapping( "" );
+ }
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+
+ private String getPrefixedName ( QName name )
+ {
+ String ns = name.getNamespaceURI();
+ String lp = name.getLocalPart();
+
+ if (ns.length() == 0)
+ return lp;
+
+ String prefix = getUriMapping( ns );
+
+ if (prefix.length() == 0)
+ return lp;
+
+ return prefix + ":" + lp;
+ }
+
+ private void emitElement ( QName name, String prefixedName )
+ {
+ try
+ {
+ _contentHandler.startElement(
+ name.getNamespaceURI(), name.getLocalPart(),
+ getPrefixedName( name ), _attributes );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+
+ protected void emitEnd ( Splay s, QName name )
+ {
+ if (name != null)
+ emitEndElement( name );
+ }
+
+ protected void emitTextAfter ( Splay s, int p, int cch )
+ {
+ if (_text == null)
+ emitCharacters( s, p, cch );
+ else
+ emitCharacters( _text );
+ }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID )
+ {
+ if (_lexicalhandler != null)
+ {
+ try
+ {
+ _lexicalhandler.startDTD( doctypeName, publicID, systemID );
+ _lexicalhandler.endDTD();
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+ }
+
+ protected void emitComment ( Splay s )
+ {
+ if (_lexicalhandler != null)
+ {
+ int cp = getRoot().getCp( s );
+ int cch = s.getCchValue();
+
+ try
+ {
+ _lexicalhandler.comment(
+ getRoot()._text._buf,
+ getRoot()._text.unObscure( cp, cch ),
+ cch );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+ }
+
+ protected void emitProcinst ( Splay s )
+ {
+ try
+ {
+ _contentHandler.processingInstruction(
+ s.getLocal(), s.getText( getRoot() ) );
+ }
+ catch ( SAXException e )
+ {
+ throwSaxException( e );
+ }
+ }
+
+ protected void emitTextFragment ( Splay s, int p, int cch )
+ {
+ emitContainerHelper( null, _fragment, null, null );
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ emitCharacters( _text );
+ }
+ else if (s != null && cch > 0)
+ emitCharacters( s, p, cch );
+
+ emitEndElement( _fragment );
+ }
+
+ protected void emitXmlnsFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null );
+ emitEndElement( _fragment );
+ }
+
+ protected void emitAttrFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, s, _text );
+ emitEndElement( _fragment );
+ }
+
+ protected void emitCommentFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null );
+ emitComment( s );
+ emitEndElement( _fragment );
+ }
+
+ protected void emitProcinstFragment ( Splay s )
+ {
+ emitContainerHelper( null, _fragment, null, null );
+ emitProcinst( s );
+ emitEndElement( _fragment );
+ }
+
+ private AttributesImpl _attributes;
+
+ private SAXException _saxException;
+
+ private ContentHandler _contentHandler;
+ private LexicalHandler _lexicalhandler;
+ }
+
+
+ //
+ //
+ //
+
+ private static ThreadLocal _threadDocumentBuilderFactory =
+ new ThreadLocal()
+ {
+ protected Object initialValue()
+ {
+ try
+ {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ }
+ catch ( ParserConfigurationException e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+ };
+
+ static final class DomSaver extends Saver
+ {
+ DomSaver ( Root r, Splay s, int p, boolean createDoc, XmlOptions options )
+ {
+ super( r, s, p, options );
+ _createDoc = createDoc;
+ }
+
+ Node exportDom ( )
+ throws Exception
+ {
+ // TODO - add an options which specifies a Document with which
+ // to create the fragment
+
+ _doc = ((DocumentBuilder) _threadDocumentBuilderFactory.get()).newDocument();
+
+ Node result;
+
+ if (_createDoc)
+ {
+ result = _currentNode = _doc;
+ }
+ else
+ {
+ DocumentFragment frag = _doc.createDocumentFragment();
+ result = _currentNode = frag;
+ }
+
+ while ( process() )
+ ;
+
+ return result;
+ }
+
+ protected void emitContainer ( Container c, QName name )
+ {
+ Root r = getRoot();
+
+ if (c.isDoc())
+ {
+ if (hasMappings())
+ {
+ throw new IllegalStateException(
+ "Namespace attribute not associated with an element" );
+ }
+
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr())
+ {
+ throw new IllegalStateException(
+ "Attribute not associated with an element" );
+ }
+ }
+
+ String text = null;
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ text = text();
+ }
+ else if (c.getCch() > 0)
+ text = r._text.fetch( 0, c.getCch() );
+
+ if (text != null && _currentNode != _doc)
+ {
+ _currentNode.insertBefore(
+ _doc.createTextNode( text ), null );
+ }
+ }
+ else
+ {
+ assert c.isBegin();
+
+ String qname = c.getLocal();
+
+ if (c.getUri().length() > 0)
+ {
+ String prefix = getUriMapping( c.getUri() );
+
+ if (prefix.length() > 0)
+ qname = prefix + ":" + qname;
+ }
+
+ Element e = _doc.createElementNS( c.getUri(), qname );
+
+ _currentNode.insertBefore( e, null );
+
+ for ( iterateMappings() ; hasMapping() ; nextMapping() )
+ {
+ String prefix = mappingPrefix();
+
+ if (prefix.length() == 0)
+ qname = "xmlns";
+ else
+ qname = "xmlns:" + prefix;
+
+ e.setAttributeNS( Splay._xmlnsUri, qname, mappingUri() );
+ }
+
+ for ( Iterator i = _attrs.keySet().iterator() ; i.hasNext() ; )
+ {
+ Splay s = (Splay) i.next();
+
+ qname = s.getLocal();
+
+ if (s.getUri().length() > 0)
+ {
+ String prefix = getUriMapping( s.getUri() );
+
+ if (prefix.length() > 0)
+ qname = prefix + ":" + qname;
+ }
+
+ String invalidAttrValue = (String) _attrs.get( s );
+
+ e.setAttributeNS(
+ s.getUri(), qname,
+ invalidAttrValue == null
+ ? s.getText( r )
+ : invalidAttrValue );
+ }
+
+ if (c.isLeaf())
+ {
+ String text = null;
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ text = text();
+ }
+ else if (c.getCchValue() > 0)
+ {
+ text =
+ r._text.fetch(
+ c.getCpForPos( r, 1 ), c.getCchValue() );
+ }
+
+ if (text != null)
+ e.insertBefore( _doc.createTextNode( text ), null );
+ }
+ else
+ {
+ _currentNode = e;
+ }
+ }
+ }
+
+ protected void emitEnd ( Splay s, QName name )
+ {
+ _currentNode = _currentNode.getParentNode();
+ }
+
+ protected void emitTextAfter ( Splay s, int p, int cch )
+ {
+ assert cch > 0;
+
+ Root r = getRoot();
+
+ String text = null;
+
+ if (_text != null)
+ {
+ if (_text.length() > 0)
+ text = text();
+ }
+ else if (cch > 0)
+ text = r._text.fetch( s.getCpForPos( r, p ), cch );
+
+ if (_currentNode != _doc)
+ _currentNode.insertBefore( _doc.createTextNode( text ), null );
+ }
+
+ protected void emitDocType(
+ String doctypeName, String publicID, String systemID )
+ {
+ }
+
+ protected void emitComment ( Splay s )
+ {
+ Root r = getRoot();
+
+ _currentNode.insertBefore(
+ _doc.createComment(
+ r._text.fetch(
+ s.getCpForPos( r, 0 ), s.getCchValue() ) ), null );
+ }
+
+ protected void emitProcinst ( Splay s )
+ {
+ Root r = getRoot();
+
+ _currentNode.insertBefore(
+ _doc.createProcessingInstruction(
+ s.getLocal(),
+ r._text.fetch(
+ s.getCpForPos( r, 0 ), s.getCchValue() ) ), null );
+ }
+
+ protected void emitXmlnsFragment ( Splay s )
+ {
+ throw new IllegalStateException(
+ "Cannot create a node for a namespace attribute" );
+ }
+
+ protected void emitAttrFragment ( Splay s )
+ {
+ throw new IllegalStateException(
+ "Cannot create a node for a attribute" );
+ }
+
+ protected void emitTextFragment ( Splay s, int p, int cch )
+ {
+ // BUGBUG - there could be namespaces pushed for this text, but not
+ // sure how to represent them here.... I should really put the
+ // fragment logic in the base saver and have the base saver
+ // synthesize well formed output...
+
+ if (s != null)
+ {
+ Root r = getRoot();
+
+ _currentNode.insertBefore(
+ _doc.createTextNode(
+ _text != null
+ ? _text.toString()
+ : s != null
+ ? r._text.fetch( s.getCpForPos( r, p ), cch )
+ : "" ),
+ null );
+ }
+ }
+
+ protected void emitCommentFragment ( Splay s )
+ {
+ Root r = getRoot();
+
+ _currentNode.insertBefore(
+ _doc.createComment(
+ r._text.fetch(
+ s.getCpForPos( r, 0 ), s.getCchValue() ) ), null );
+ }
+
+ protected void emitProcinstFragment ( Splay s )
+ {
+ Root r = getRoot();
+
+ _currentNode.insertBefore(
+ _doc.createProcessingInstruction(
+ s.getLocal(),
+ r._text.fetch(
+ s.getCpForPos( r, 0 ), s.getCchValue() ) ), null );
+ }
+
+ Document _doc;
+ Node _currentNode;
+ boolean _createDoc;
+ }
+
+ //
+ //
+ //
+
+ protected StringBuffer _text;
+ protected StringBuffer _sb;
+ protected boolean _skipContainerFinish;
+ protected LinkedHashMap _attrs;
+
+ private HashSet _attrNames;
+
+ private final boolean _inner;
+ private final Root _root;
+ private final Splay _top;
+ private final long _version;
+
+ protected boolean _wantDupAttrs;
+ protected boolean _wantFragTest;
+ protected boolean _needsFrag;
+ protected QName _fragment;
+ protected QName _docElem;
+
+ protected QName _synthElem;
+
+ protected boolean _saveNamespacesFirst;
+ protected boolean _useDefaultNamespace;
+
+ private boolean _prettyPrint;
+ private int _prettyIndent;
+ private int _prettyOffset;
+
+ private Splay _splay;
+ private int _pos;
+ private boolean _preProcess;
+ private boolean _postProcess;
+ private boolean _postPop;
+ private Splay _endSplay;
+
+ private ArrayList _namespaceStack;
+ private int _currentMapping;
+ private HashMap _uriMap;
+ private HashMap _prefixMap;
+ private boolean _firstPush;
+ private String _initialDefaultUri;
+
+ private HashMap _preComputedNamespaces;
+ private String _filterProcinst;
+ private Map _suggestedPrefixes;
+
+ protected static String _newLine;
+
+ static
+ {
+ _newLine = System.getProperty( "line.separator" );
+ if (_newLine == null)
+ _newLine = "\n";
+ }
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java
new file mode 100644
index 0000000..0cb9d78
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java
@@ -0,0 +1,4219 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.values.TypeStore;
+import org.apache.xmlbeans.impl.values.TypeStoreUser;
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlCursor.XmlMark;
+import org.apache.xmlbeans.XmlCursor;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+
+public abstract class Splay extends Goobers
+{
+ //
+ // Can't change the kind of a base token
+ //
+
+ Splay ( int kind, boolean is )
+ {
+ _bits = kind;
+
+ if (is)
+ _bits += 0x8;
+ }
+
+ //
+ // Splay kinds
+ //
+
+ static final int DOC = 0; // DOC must be 0
+ static final int BEGIN = 1; // BEGIN must be 1
+ static final int ATTR = 2;
+ static final int COMMENT = 3;
+ static final int PROCINST = 4;
+ static final int ROOT = 5; // ROOT must be second to last
+ static final int END = 6; // END must be last
+
+ //
+ //
+ //
+
+ final int getKind ( ) { return _bits & 0x7; }
+
+ final boolean isDoc ( ) { return getKind() == DOC; }
+ final boolean isRoot ( ) { return getKind() == ROOT; }
+ final boolean isBegin ( ) { return getKind() == BEGIN; }
+ final boolean isEnd ( ) { return getKind() == END; }
+ final boolean isAttr ( ) { return getKind() == ATTR; }
+ final boolean isComment ( ) { return getKind() == COMMENT; }
+ final boolean isProcinst ( ) { return getKind() == PROCINST; }
+ final boolean isContainer ( ) { return getKind() <= BEGIN; }
+ final boolean isFinish ( ) { return getKind() >= ROOT; }
+
+ final int getCch ( ) { return _cch; }
+
+ final int getCdocBegin ( ) { return 1; }
+ final int getCchLeft ( ) { return _cchLeft; }
+ final int getCdocBeginLeft ( ) { return _bits >> 5; }
+ final int getCchAfter ( ) { return _cchAfter; }
+ final int getCchValue ( ) { return _cch - _cchAfter; }
+
+ QName getName ( ) { throw new IllegalStateException(); }
+ String getUri ( ) { throw new IllegalStateException(); }
+ String getLocal ( ) { throw new IllegalStateException(); }
+
+ // Fourth bit in _bits has several meanings, depending on splay kind
+
+ final boolean isNormalAttr ( ) { return (_bits & 0xF) == (0x0 + ATTR); }
+ final boolean isXmlns ( ) { return (_bits & 0xF) == (0x8 + ATTR); }
+ final boolean isLeaf ( ) { return (_bits & 0xF) == (0x8 + BEGIN); }
+ final boolean isFragment ( ) { return (_bits & 0xF) == (0x8 + COMMENT); }
+ final boolean isXsiAttr ( ) { return isNormalAttr() && getUri().equals( _xsi ); }
+ final boolean isXsiNil ( ) { return isNormalAttr() && getName().equals(_xsiNil ); }
+ final boolean isXsiType ( ) { return isNormalAttr() && getName().equals( _xsiType ); }
+ final boolean isTypeable ( ) { return isContainer() || isNormalAttr(); }
+
+ final void toggleIsLeaf ( )
+ {
+ assert isBegin();
+ _bits ^= 0x8;
+ }
+
+ final boolean isValid ( )
+ {
+ assert ((_bits & 0x10) == 0) || isTypeable();
+ return (_bits & 0x10) == 0;
+ }
+
+ final boolean isInvalid ( )
+ {
+ assert ((_bits & 0x10) == 0) || isTypeable();
+ return (_bits & 0x10) != 0;
+ }
+
+ final void toggleIsInvalid ( )
+ {
+ assert isTypeable();
+ _bits ^= 0x10;
+ }
+
+ final void adjustCch ( int delta )
+ {
+ _cch += delta;
+ assert _cch >= 0;
+ }
+
+ final void adjustCchAfter ( int delta )
+ {
+ _cchAfter += delta;
+ assert _cchAfter >= 0;
+ }
+
+ final void adjustCchLeft ( int delta )
+ {
+ _cchLeft += delta;
+ assert _cchLeft >= 0;
+ }
+
+ final void adjustCdocBeginLeft ( int d )
+ {
+ _bits += d * 32;
+ assert getCdocBeginLeft() >= 0;
+ }
+
+ final Splay getFinishSplay ( )
+ {
+ assert isContainer();
+ return isLeaf() ? this : ((Container) this).getFinish();
+ }
+
+ final int getPosAfter ( )
+ {
+ return getEndPos() - getCchAfter();
+ }
+
+ final int getPosLeafEnd ( )
+ {
+ assert isLeaf();
+ return 1 + getCchValue();
+ }
+
+ final int getCpForPos ( Root r, int p )
+ {
+ int cp = r.getCp( this );
+
+ if (p == 0)
+ return cp;
+
+ return
+ isLeaf()
+ ? p - (p <= getPosLeafEnd() ? 1 : 2) + cp
+ : p - 1 + getCchValue() + cp;
+ }
+
+ final int getPostCch ( int p )
+ {
+ assert p >= 0 && p <= getEndPos();
+
+ return
+ isLeaf() && p <= getPosLeafEnd()
+ ? getPosLeafEnd() - p
+ : getEndPos() - p;
+ }
+
+ static final String _xsi =
+ "http://www.w3.org/2001/XMLSchema-instance";
+
+ static final String _schema =
+ "http://www.w3.org/2001/XMLSchema";
+
+ static final String _openFragUri =
+ "http://www.openuri.org/fragment";
+
+ static final String _xml1998Uri =
+ "http://www.w3.org/XML/1998/namespace";
+
+ static final String _xmlnsUri =
+ "http://www.w3.org/2000/xmlns/";
+
+ static final QName _xsiNil = new QName( _xsi, "nil" );
+ static final QName _xsiType = new QName( _xsi, "type" );
+ static final QName _openuriFragment = new QName( _openFragUri, "fragment" );
+ static final QName _xmlFragment = new QName( "", "xml-fragment" );
+
+ static final boolean isXmlFragment ( QName name )
+ {
+ return _openuriFragment.equals( name ) || _xmlFragment.equals( name );
+ }
+
+ static boolean beginsWithXml ( String name )
+ {
+ if (name.length() < 3)
+ return false;
+
+ char ch;
+
+ if (((ch = name.charAt( 0 )) == 'x' || ch == 'X') &&
+ ((ch = name.charAt( 1 )) == 'm' || ch == 'M') &&
+ ((ch = name.charAt( 2 )) == 'l' || ch == 'L'))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * This returns the pos of the very end of the splay. This is not
+ * generally a valid position to exist because in these cases, I
+ * force the position to be 0 on the next splay.
+ */
+
+ final int getEndPos ( )
+ {
+ return getMaxPos() + 1;
+ }
+
+ /**
+ * This returns the largest pos possible without actually being at
+ * the end of the splay.
+ */
+
+ final int getMaxPos ( )
+ {
+ switch ( getKind() )
+ {
+ case ATTR :
+ case ROOT : return 0;
+ case BEGIN : return (isLeaf() ? 1 : 0) + getCch();
+ case DOC :
+ case COMMENT :
+ case PROCINST :
+ case END : return getCchAfter();
+
+ default :
+ assert false: "Unexpected splay kind " +getKind();
+ return 0;
+ }
+ }
+
+ static final boolean isWhiteSpace ( char ch )
+ {
+ switch ( ch )
+ {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ static final boolean isWhiteSpace ( String s )
+ {
+ int l = s.length();
+
+ while ( l-- > 0)
+ if (!isWhiteSpace( s.charAt( l )))
+ return false;
+
+ return true;
+ }
+
+ static final boolean isWhiteSpace ( StringBuffer sb )
+ {
+ int l = sb.length();
+
+ while ( l-- > 0)
+ if (!isWhiteSpace( sb.charAt( l )))
+ return false;
+
+ return true;
+ }
+
+ final boolean isAfterWhiteSpace ( Root r )
+ {
+ int cchAfter = getCchAfter();
+
+ if (cchAfter == 0)
+ return true;
+
+ int off =
+ r._text.unObscure(
+ r.getCp( this ) + getCch() - cchAfter, cchAfter );
+
+ while ( cchAfter-- > 0 )
+ if (!isWhiteSpace( r._text._buf[ off + cchAfter ] ))
+ return false;
+
+ return true;
+ }
+
+ final void setName ( Root r, QName newName )
+ {
+ assert isBegin() || isAttr() || isProcinst();
+
+ // BUGBUG - deal with xsi:nil here too
+
+ QName oldName = getName();
+
+ if (!newName.equals( oldName ))
+ {
+ r.startChange();
+
+ ((QNameSplay) this).changeName( newName );
+
+ if (!isProcinst() && !isXmlns())
+ {
+ assert isAttr() || isBegin();
+
+ if (isBegin())
+ disconnectTypes( r );
+
+ if (_xsiType.equals( oldName ) || _xsiType.equals( newName ))
+ getContainer().disconnectTypes( r );
+ else if (_xsiNil.equals( oldName ) || _xsiNil.equals( newName ))
+ getContainer().invalidateNil();
+ else
+ disconnectTypes( r );
+ }
+
+ r.invalidateVersion();
+ }
+ }
+
+ /**
+ * If this is an invalid leaf, then refresh it's value and return the
+ * number of characters added.
+ */
+
+ final int ensureContentValid ( )
+ {
+ assert isContainer();
+
+ if (isValid())
+ return 0;
+
+ Type t = peekType();
+
+ return t.validateContent( this, t );
+ }
+
+ /**
+ * Ensure that the value (ATTR, COMMENT and PROCINST) is valid. Really
+ * only does anything for attrs.
+ */
+
+ final void ensureValueValid ( )
+ {
+ assert isNormalAttr();
+
+ if (isInvalid())
+ {
+ Type t = peekType();
+ t.validateValue( this, t );
+ }
+ }
+
+ /**
+ * Given a position in this splay, return the TokenType associated with
+ * the content to the left of the position.
+ */
+
+ final TokenType getTokenType ( int p )
+ {
+ assert p >= 0 && p <= getMaxPos();
+
+ // No need to revalidate text value here because there can be no pos
+ // which could exists when this splay is invalid which could be on
+ // text.
+
+ // First, see if we're in/at the text after the splay
+
+ if (p >= getPosAfter())
+ return TokenType.TEXT;
+
+ switch ( getKind() )
+ {
+ case ATTR :
+ return isXmlns() ? TokenType.NAMESPACE : TokenType.ATTR;
+
+ case BEGIN :
+ if (p == 0)
+ return TokenType.START;
+
+ assert isLeaf();
+
+ return p == getPosLeafEnd() ? TokenType.END : TokenType.TEXT;
+
+ case ROOT : return TokenType.ENDDOC;
+ case DOC : return TokenType.STARTDOC;
+ case COMMENT : return TokenType.COMMENT;
+ case PROCINST : return TokenType.PROCINST;
+ case END : return TokenType.END;
+
+ default :
+ assert false: "Unexpected splay kind " + getKind();
+ return null;
+ }
+ }
+
+ /**
+ * Cause this splay to become a leaf. This does not logically
+ * alter the document, but does alter the physical splay tree which
+ * demands that I issue a change notice.
+ */
+
+ final void foliate ( Root r )
+ {
+ assert isBegin();
+ assert !isLeaf();
+
+ Begin b = (Begin) this;
+ Splay e = b.getFinish();
+
+ assert b.nextNonAttrSplay() == e;
+ assert b._end == e;
+ assert e.isEnd();
+ assert !b.isLeaf();
+
+ // Caller must initiate change
+ assert r.validateChangeStarted();
+
+ int cchBefore = getCch();
+
+ e.saveTextAfter( r );
+
+ b._end = null;
+ b.toggleIsLeaf();
+
+ b.adjustCchAfter( - cchBefore );
+
+ // Move the goobers from the end to the begin
+
+ Goober nextGoober;
+ for ( Goober g = e.firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = e.nextGoober( g );
+
+ assert g.getPos() == 0;
+ g.set( this, cchBefore + 1 );
+ }
+
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int gp = g.getPos();
+
+ if (gp > cchBefore + 1)
+ g.set( this, gp + 1 );
+ }
+
+ e.removeSplay( r );
+ }
+
+ final void defoliate ( Root r )
+ {
+ assert isLeaf();
+
+ // Caller must initiate change
+ assert r.validateChangeStarted();
+
+ // Caller must ensure leaf is valid
+ assert isValid();
+
+ Begin b = (Begin) this;
+
+ int posLeafEnd = getPosLeafEnd();
+ int cchAfter = getCchAfter();
+ int cchValue = getCchValue();
+
+ Splay a = this;
+
+ int cchAttr = 0;
+
+ for ( Splay t = nextSplay() ; t.isAttr() ; t = t.nextSplay() )
+ {
+ cchAttr += t.getCch();
+ a = t;
+ }
+
+ r.insertSplay( b._end = new End( (Begin) this ), a );
+
+ b.toggleIsLeaf();
+
+ b.adjustCchAfter( cchValue - cchAfter );
+ b._end.adjustCchAfter( cchAfter );
+
+ r.updateCch( b, - cchAfter );
+ r.updateCch( b._end, cchAfter );
+
+ if (cchAttr > 0)
+ {
+ int cp = r.getCp( b );
+
+ r._text.move(
+ cp + cchValue + cchAfter + cchAttr,
+ r._text, cp + cchValue, cchAfter );
+ }
+
+ Goober nextGoober;
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int gp = g.getPos();
+
+ if (gp >= posLeafEnd)
+ g.set( b._end, gp - posLeafEnd );
+ }
+
+ assert validate();
+ }
+
+ /**
+ * Remove the text after *this* splay.
+ * No validation is done, caller must do that
+ */
+
+ private final void removeTextAfter ( Root r )
+ {
+ assert r != null;
+ assert Root.dv > 0 || getRootSlow() == r;
+ assert !isRoot() && !isAttr();
+
+ // Caller must initiate change
+ assert r.validateChangeStarted();
+
+ int cchTextAfter = getCchAfter();
+
+ if (cchTextAfter == 0)
+ return;
+
+ int cpTextAfter = r.getCp( this ) + getCch() - cchTextAfter;
+ int posTextAfter = getPosAfter();
+
+ adjustCchAfter( - cchTextAfter );
+
+ r.updateCch( this, - cchTextAfter );
+
+ r._text.remove( cpTextAfter, cchTextAfter );
+
+ Goober nextGoober;
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int k = g.getKind();
+
+ if (g.getPos() >= posTextAfter)
+ {
+ if (k == ANNOTATION)
+ g.disconnect( r );
+ else if (k == CURSOR)
+ g.set( nextSplay(), 0 );
+ }
+ }
+
+ assert validate();
+ }
+
+ /**
+ * Transfers the text after this "node" to be after the "node" before it.
+ * No type invalidation is done here. No checking for isInvalid is needed
+ * either. No validation is done, caller must do that.
+ */
+
+ private final int saveTextAfter ( Root r )
+ {
+ assert r != null;
+ assert Root.dv > 0 || getRootSlow() == r;
+
+ // Caller must initiate change
+ assert r.validateChangeStarted();
+
+ Splay endText = this;
+
+ if (isBegin() && !isLeaf())
+ endText = getFinishSplay();
+
+ int cchEndText = endText.getCchAfter();
+
+ if (cchEndText == 0)
+ return 0;
+
+ assert !isRoot() && !isDoc() && !isAttr();
+
+ Splay getsText = prevNonAttrSplay();
+ int getsTextLastPos = getsText.getEndPos();
+
+ int cpGetsText = r.getCp( getsText ) + getsText.getCch();
+ int cpEndText = r.getCp( endText ) + endText.getCch() - cchEndText;
+
+ getsText.adjustCchAfter( cchEndText );
+ endText.adjustCchAfter( - cchEndText );
+
+ r.updateCch( getsText, cchEndText );
+ r.updateCch( endText, - cchEndText );
+
+ assert cpGetsText <= cpEndText;
+
+ if (cpGetsText != cpEndText)
+ {
+ r._text.insert( cpGetsText, r._text, cpEndText, cchEndText );
+ r._text.remove( cpEndText + cchEndText, cchEndText );
+ }
+
+ int posEndText = endText.getPosAfter();
+
+ Goober nextGoober;
+ for ( Goober g = endText.firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = endText.nextGoober( g );
+
+ int gp = g.getPos();
+
+ if (gp >= posEndText)
+ g.set( getsText, getsTextLastPos + gp - posEndText );
+ }
+
+ assert validate();
+
+ return cchEndText;
+ }
+
+ /**
+ * Moves this splay, all of its content and attributes. If no destination
+ * is provided, then only a removal is performed.
+ */
+
+ final void move (
+ Root r, Root rDst, Splay sDst, int pDst, boolean invalidate )
+ {
+ assert r != null;
+ assert Root.dv > 0 || getRootSlow() == r;
+ assert !isDoc() && !isFinish();
+
+ assert rDst == null || (r != rDst || !sDst.between( r, pDst, this ) );
+ assert rDst == null || sDst != null;
+ assert rDst == null || Root.dv > 0 || sDst.getRootSlow() == rDst;
+ assert rDst == null || pDst >= 0 && pDst < sDst.getEndPos();
+
+ assert
+ rDst == null ||
+ (true || checkInsertionValidity( 0, sDst, pDst, false ));
+
+ r.startChange();
+
+ if (rDst != null)
+ rDst.startChange();
+
+ // The text after the logical entity to move/remove is not part of
+ // this operation. Transfer it to a previous splay. No need to
+ // fret about invalidity here, because it's text *after*.
+
+ int cchSaved = saveTextAfter( r );
+
+ // If any text was saved, I need to move the cursors at the beginning
+ // of this splay to where the text was saved. I do this because this
+ // content is going away and cursors need to collapse to the right
+ // location which, in this case, is before the after text.
+ //
+ // No need to deal with goobers other than cursor because annotations
+ // and types will be dealt with appropriately later.
+ //
+ // Also, update the target if it was in the moved text!
+ //
+ // TODO - if moving xsi:type or xsi:nil must do stuff
+
+ if (cchSaved > 0)
+ {
+ Splay gotText = prevNonAttrSplay();
+
+ Goober nextGoober;
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ if (g.getKind() == CURSOR)
+ g.set( gotText, gotText.getEndPos() - cchSaved );
+ }
+
+ if (rDst != null)
+ {
+ Splay hadText =
+ isBegin() && !isLeaf() ? getFinishSplay() : this;
+
+ if (sDst == hadText && pDst >= hadText.getEndPos())
+ {
+ sDst = gotText;
+
+ pDst =
+ gotText.getEndPos() -
+ (cchSaved - (pDst - hadText.getEndPos()));
+ }
+ }
+ }
+
+ assert sDst != this;
+
+ // Compute the splay, up to which, I will remove
+
+ Splay last =
+ isBegin() ? getFinishSplay().nextNonAttrSplay() : nextSplay();
+
+ //
+ //
+ //
+
+ Container container = getContainer();
+
+ int cp = r.getCp( this );
+ int cch = 0;
+
+ for ( Splay s = this ; s != last ; s = s.nextSplay() )
+ {
+ // I'm going to blow away the Types here, make sure I have
+ // all the text.
+
+ if (s.isInvalid())
+ {
+ assert s.isLeaf() || s.isNormalAttr();
+
+ if (s.isNormalAttr())
+ s.ensureValueValid();
+ else if (s.isLeaf())
+ s.ensureContentValid();
+ }
+
+ cch += s.getCch();
+
+ Goober nextGoober;
+ for ( Goober g = s.firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = s.nextGoober( g );
+
+ switch ( g.getKind() )
+ {
+ case TYPE :
+ g.disconnect( r );
+ break;
+
+ case ANNOTATION :
+ if (rDst == null)
+ g.disconnect( r );
+ else
+ g.set( rDst ); // Potential move to a new tree
+ break;
+
+ case CURSOR :
+ g.set( last, 0 );
+ break;
+ }
+ }
+ }
+
+ // Remove the splays and the text. Unfortunately, I need to remove
+ // the text here. I can't think of a way to keep the tree valid and
+ // have the text moved in one copy .... Can you?
+
+ Splay sRemoved = r.removeSplays( this, last );
+
+ Splay first =
+ sRemoved._leftSplay == null ? sRemoved : sRemoved._leftSplay;
+
+ if (first.isBegin())
+ ((Begin) first)._container = null;
+
+ char[] textRemoved = rDst == null || cch == 0 ? null : new char [ cch ];
+
+ r._text.remove( cp, cch, textRemoved, 0 );
+
+ r.invalidateVersion();
+
+ if (rDst != null)
+ {
+ sDst.insert(
+ rDst, pDst, sRemoved, textRemoved, 0, cch, invalidate );
+ }
+
+ if (invalidate)
+ {
+ Type parentType = container.peekType();
+
+ if (parentType != null)
+ {
+ if (isBegin())
+ parentType.invalidateElement( container, last );
+ else if (isAttr() && isXsiNil())
+ parentType.invalidateNil();
+ }
+ }
+
+ assert r.validate();
+ assert rDst == null || rDst.validate();
+ }
+
+ /**
+ * Removes this splay, all of its content and attributes.
+ */
+
+ final void remove ( Root r, boolean invalidate )
+ {
+ move( r, null, null, 0, invalidate );
+ }
+
+ private final void complain ( String msg )
+ {
+ throw new IllegalArgumentException( msg );
+ }
+
+ /**
+ * Check to if the insertion of a "node" into the destination is allowed.
+ * This assumes that the source is a single piece of contents (like a node).
+ * Fragments are strings of content, not contained, and must not be
+ * validated by this function.
+ *
+ * Returns true if the src to copy is characters (potentially 0 chars too)
+ */
+
+ final boolean checkInsertionValidity (
+ int p, Splay sDst, int pDst, boolean endOk )
+ {
+ assert p >= 0;
+ assert p < getEndPos();
+ assert pDst >= 0;
+ assert pDst < sDst.getEndPos();
+
+ boolean srcChars = false;
+
+ if (p > 0)
+ {
+ if (!endOk && isLeaf() && p == getPosLeafEnd())
+ complain( "Can't move/copy/insert an end token." );
+
+ srcChars = true;
+
+ // valid text target will be tested for further down
+ }
+ else
+ {
+ if (isDoc())
+ complain( "Can't move/copy/insert a whole document." );
+
+ if (isFinish())
+ {
+ if (!endOk)
+ complain( "Can't move/copy/insert an end token." );
+
+ srcChars = true;
+ }
+ else if (isFragment())
+ srcChars = true;
+ }
+
+ if (pDst == 0 && sDst.isDoc())
+ complain( "Can't insert before the start of the document." );
+
+ if (p > 0 && sDst.isAttr())
+ complain( "Can't insert text before an attribute." );
+
+ if (isAttr() && pDst > 0 && (!sDst.isContainer() || pDst != 1))
+ complain( "Can't insert an attribute in text." );
+
+ if (p <= 0 && pDst <= 0)
+ {
+ if (isAttr())
+ {
+ boolean isOk = sDst.isAttr();
+
+ if (!isOk)
+ {
+ Splay t = sDst.prevNonAttrSplay();
+
+ if (t.isContainer() && t.getCchAfter() == 0)
+ isOk = true;
+ }
+
+ if (!isOk)
+ {
+ complain(
+ "Can only move/copy/insert attribute after another " +
+ "attribute or start token." );
+ }
+ }
+ else if (sDst.isAttr())
+ {
+ complain(
+ "Can't move/copy/insert a non-attribute before " +
+ "an attribute." );
+ }
+ }
+
+ return srcChars;
+ }
+
+ /**
+ * Insert in this splay at position p whose root is r the splays rootInsert
+ * with text txt at offset cpTxt and length cchTxt
+ */
+
+ final void insert (
+ Root r, int p, Splay rootInsert,
+ Object txt, int offTxt, int cchTxt,
+ boolean invalidate )
+ {
+// BUGBUG - what is a new xsitype attr is inserted? -- must disconnect types
+
+ assert p < getEndPos();
+ assert cchTxt >= 0;
+ assert rootInsert != null;
+ assert rootInsert._parentSplay == null;
+ assert rootInsert.getCchLeft() + rootInsert.getCch() == cchTxt;
+
+ // We are inserting a tree here. Get the first splay in the tree
+ // It must either be at the root or just to the left of the root.
+ // This is the "classic" dog leg pattern I use to pass splay trees.
+
+ assert
+ rootInsert._leftSplay == null ||
+ rootInsert._leftSplay._leftSplay == null;
+
+ r.startChange();
+
+ Splay sInsert =
+ rootInsert._leftSplay == null ? rootInsert : rootInsert._leftSplay;
+
+ assert !sInsert.isDoc() && !sInsert.isFinish();
+ assert Root.dv > 0 || getRootSlow() == r;
+
+ // When this member is called, we better be able to do the insert.
+
+ assert true || sInsert.checkInsertionValidity( 0, this, p, false );
+
+ // If there is a fragment, there better be text in it
+
+ assert !sInsert.isFragment() || sInsert.getCch() > 0;
+
+ //
+
+ Splay s = this;
+
+ assert Root.dv > 0 || sInsert.getRootSlow() == null;
+
+ Splay sOrig = null;
+ int pOrig = 0;
+ int cchBypassed = 0;
+
+ // Prepare for inserting into the middle of a splay
+
+ if (p > 0)
+ {
+ int ple;
+
+ if (s.isLeaf() && p <= (ple = s.getPosLeafEnd()))
+ {
+ if (s.isInvalid())
+ {
+ assert ple == 1;
+ assert p == 1;
+
+ int cchValid = s.ensureContentValid();
+
+ p += cchValid;
+ ple += cchValid;
+ }
+
+ assert s.getFinishSplay() == s;
+
+ defoliate( r );
+
+ assert s.getFinishSplay() != s;
+
+ if (p == ple)
+ {
+ s = getFinishSplay();
+ p = 0;
+ }
+
+ s.insert( r, p, rootInsert, txt, offTxt, cchTxt, invalidate );
+
+ return;
+ }
+
+ // You can copy an attr to a dst where it is the first attr, or
+ // after all pre-exisitng attrs. This these cases, p == 1 on
+ // the begin. In this case, there is no need to move text later.
+
+ assert !sInsert.isAttr() || (p == 1 && s.isContainer());
+
+ sOrig = s;
+ pOrig = p;
+ cchBypassed = getEndPos() - p;
+
+ s = s.nextNonAttrSplay();
+ p = 0;
+ }
+
+ assert p == 0;
+ assert !s.isDoc();
+
+ // Get the container receiving all of this
+
+ Container c = s.getContainer();
+
+ // Run over the top level content, parenting any BEGINS. Also,
+ // characterize the content being inserted for future invalidation.
+ // Only fragments will have multiple top level begins.
+
+ boolean insertingElements = false;
+ boolean insertingText = false;
+ boolean insertingNilAttr = false;
+ Splay insertingFragment = null;
+
+ for ( Splay t = sInsert ; t != null ; t = t.nextSplay() )
+ {
+ if (t.isBegin())
+ {
+ insertingElements = true;
+
+ Begin b = (Begin) t;
+
+ assert b._container == null;
+
+ b._container = c;
+
+ t = t.getFinishSplay();
+ }
+ else if (t.isFragment())
+ {
+ assert insertingFragment == null;
+ insertingFragment = t;
+ }
+
+ if (t.isXsiNil())
+ insertingNilAttr = true;
+
+ if (t.getCchAfter() > 0)
+ insertingText = true;
+ }
+
+ // Now, insert the text (if any)
+
+ r._text.insert( r.getCp( s ), txt, offTxt, cchTxt );
+
+ // Insert the tree
+
+ r.insertSplay( rootInsert, s.prevSplay() );
+
+ // If the first splay to isnert was a fragment, remove it, leaving
+ // the text it carried in the tree. Don't perform invalidation.
+
+ if (insertingFragment != null)
+ insertingFragment.remove( r, false );
+
+ // Invalidate the parent if requested
+
+ if (invalidate)
+ {
+ Type cType = c.peekType();
+
+ if (cType != null)
+ {
+ if (insertingElements)
+ {
+ cType.invalidateElement( c, s );
+ insertingText = true;
+ }
+
+ if (insertingText)
+ cType.invalidateText();
+
+ if (insertingNilAttr)
+ cType.invalidateNil();
+ }
+ }
+
+ // If there is post text to move, move it to the end of the stuff
+ // inserted. Don't do this is if an attr was inserted because in this
+ // case, the attr is logically after the text to be moved anyways.
+
+ if (sOrig != null && !sInsert.isAttr())
+ {
+ int cchMoved = sOrig.moveChars( r, pOrig, -1, r, s, 0, true );
+ assert cchMoved > 0;
+ assert cchMoved == cchBypassed;
+ }
+
+ // build a leaf if possible
+
+ if (s.isEnd() && s.getContainer().nextNonAttrSplay() == s)
+ s.getContainer().foliate( r );
+
+ r.invalidateVersion();
+
+ assert r.validate();
+ }
+
+ /**
+ * Replaces the contents of this (attributes as well) with a copy of the
+ * contents of sSrc. If preserveType is true, then the xsi:type attr
+ * of the source is not copied, and the xsi:type of the target (this)
+ * is not altered.
+ */
+
+ final void replaceContents (
+ Root r, Splay sSrc, Root rSrc,
+ boolean preserveType, boolean preserveNamespaces )
+ {
+ assert !isFinish() && !sSrc.isFinish();
+ assert Root.dv > 0 || getRootSlow() == r;
+ assert Root.dv > 0 || sSrc.getRootSlow() == rSrc;
+
+ // If the src and dst are the same splay, then there is nothing to do
+
+ if (this == sSrc)
+ return;
+
+ // If we are to preserve namespace mappings, make a copy of the
+ // namspaces in scope here
+
+ Map sourceNamespaces =
+ preserveNamespaces ? sSrc.lookupAllPrefixMappings() : null;
+
+ // If the destination is a simple container of text, then the content
+ // model is limited to text. Handle this specially.
+
+ if (isAttr() || isComment() || isProcinst())
+ {
+ // TODO - Do this without creating a string?
+ String str = sSrc.getText( rSrc );
+ setText( r, str, 0, str.length() );
+ }
+ else
+ {
+ // No need to startChange() here, fcns I call will do it for me
+
+ assert isContainer();
+
+ // Make copy of source
+
+ CopyContext copyContext = sSrc.copySplayContents( rSrc );
+
+ // If we need to preserve the xsi:type attribute, then fetch it.
+ // If there is more than one, the first one wins.
+
+ String targetXsiType = null;
+
+ if (preserveType)
+ {
+ for ( Splay s = nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXsiType())
+ {
+ targetXsiType = s.getText( r );
+ break;
+ }
+ }
+ }
+
+ // Because I have removed the entire contents of the target, I can
+ // insert fragment or node.
+
+ removeContent( r, true );
+
+ assert isLeaf() || getFinishSplay() == nextSplay();
+ assert getCchValue() == 0;
+
+ Splay copy = copyContext.getTree();
+
+ if (copy != null)
+ {
+ // Need to compute a normalized splay/pos to insert at. Only
+ // two cases, either we're inserting in a leaf or a
+ // container/finish pair.
+
+ Splay insertSplay = this;
+ int insertPos = 1;
+
+ if (!isLeaf())
+ {
+ insertSplay = nextSplay();
+ insertPos = 0;
+ }
+
+ char[] textCopy = copyContext.getText();
+
+ insertSplay.insert(
+ r, insertPos, copy,
+ textCopy, 0, textCopy == null ? 0 : textCopy.length, true );
+
+ // Now, go thorugh all the attrs, removing types and place the
+ // original back in.
+
+ if (preserveType)
+ {
+ Splay next = nextSplay();
+
+ for ( Splay s = next ; s.isAttr() ; s = next )
+ {
+ next = s.nextSplay();
+
+ if (s.isXsiType())
+ s.remove( r, true );
+ }
+
+ if (targetXsiType != null)
+ {
+ Attr a = new Attr( _xsiType );
+
+ int cchType = targetXsiType.length();
+
+ a.adjustCch( cchType );
+
+ if (getEndPos() > 1)
+ insert( r, 1, a, targetXsiType, 0, cchType, true );
+ else
+ {
+ nextNonAttrSplay().insert(
+ r, 0, a, targetXsiType, 0, cchType, true );
+ }
+ }
+ }
+ }
+ }
+
+ if (sourceNamespaces != null)
+ applyNamespaces( r, sourceNamespaces );
+ }
+
+ static final class CopyContext
+ {
+ void copyText ( char[] text )
+ {
+ _text = text;
+ }
+
+ void copySplay ( Splay s, boolean copyTextAfter )
+ {
+ assert !s.isDoc() && !s.isRoot();
+
+ Splay t;
+
+ switch ( s.getKind() )
+ {
+ case BEGIN :
+ {
+ s.ensureContentValid();
+
+ t = _frontier = new Begin( s.getName(), _frontier );
+
+ if (s.isLeaf())
+ {
+ t.toggleIsLeaf();
+ _frontier = _frontier.getContainer();
+ }
+
+ break;
+ }
+ case ATTR :
+ {
+ if (s.isXmlns())
+ t = new Xmlns( s.getName() );
+ else
+ {
+ s.ensureValueValid();
+ t = new Attr( s.getName() );
+ }
+ break;
+ }
+ case COMMENT :
+ {
+ t = new Comment();
+ break;
+ }
+ case PROCINST :
+ {
+ t = new Procinst( s.getName() );
+ break;
+ }
+ case END :
+ {
+ Begin b = (Begin) _frontier;
+ t = b._end = new End( b );
+ _frontier = _frontier.getContainer();
+ break;
+ }
+ default :
+ throw new IllegalStateException();
+ }
+
+ assert s.isValid();
+
+ int cch = s.getCchValue();
+
+ if (copyTextAfter)
+ {
+ int cchAfter = s.getCchAfter();
+ cch += cchAfter;
+ t.adjustCchAfter( cchAfter );
+ }
+
+ if (cch > 0)
+ t.adjustCch( cch );
+
+ copy( t );
+ }
+
+ /**
+ * May be called once before any other copy
+ */
+
+ void copyFragment ( int cch )
+ {
+ assert cch > 0;
+
+ Splay s = new Fragment();
+
+ s.adjustCchAfter( cch );
+ s.adjustCch( cch );
+
+ copy( s );
+ }
+
+ Splay getTree ( )
+ {
+ assert _frontier == null;
+
+ if (_last == null)
+ return null;
+
+ if (_first != null)
+ {
+ _last.adjustCchLeft( _first.getCchLeft() + _first.getCch() );
+
+ _last.adjustCdocBeginLeft(
+ _first.getCdocBeginLeft() + _first.getCdocBegin() );
+
+ _last._leftSplay = _first;
+ _first._parentSplay = _last;
+
+ if (_tail != null)
+ {
+ _last.adjustCchLeft( _tail.getCchLeft() + _tail.getCch() );
+
+ _last.adjustCdocBeginLeft(
+ _tail.getCdocBeginLeft() + _tail.getCdocBegin() );
+
+ _first._rightSplay = _tail;
+ _tail._parentSplay = _first;
+ }
+ }
+
+ return _last;
+ }
+
+ char[] getText ( )
+ {
+ return _text;
+ }
+
+ private void copy ( Splay s )
+ {
+ //
+ // Here I make sure that the structure of the splay tree returned
+ // by the copy is such that the last splay copied is at the root,
+ // the first splay copied is the left child of the last copied,
+ // the second to last splay copied is the right child of the first,
+ // and the third through the second to last are a left only list
+ // off of the left child of the second!
+ //
+ // You may be asking your self, "Self, why all this madness?"
+ //
+ // Several reasons. First, by making the first hang off the
+ // left child of the last and have the right child of last be null,
+ // the root will have the total splay statistics for the whole
+ // tree. Second, you have quick access to the first splay copied.
+ // Third, building the third through the second to last do
+ // not require walking to update statictics.
+ //
+ // Ultimately, I do this to be consistent with the format of the
+ // tree when a range of splays are removed from a tree. To avoid
+ // an additional splay, the removal of a sub tree is shaped like
+ // this.
+ //
+
+ if (_last != null)
+ {
+ if (_first == null)
+ _first = _last;
+ else if (_tail == null)
+ _tail = _last;
+ else
+ {
+ _last.adjustCchLeft( _tail.getCchLeft() + _tail.getCch() );
+
+ _last.adjustCdocBeginLeft(
+ _tail.getCdocBeginLeft() + _tail.getCdocBegin() );
+
+ _last._leftSplay = _tail;
+ _tail._parentSplay = _last;
+ _tail = _last;
+ }
+ }
+
+ _last = s;
+ }
+
+ private char[] _text;
+ private Splay _first;
+ private Splay _tail;
+ private Splay _last;
+ private Container _frontier;
+ }
+
+ /**
+ * Copies the contents of this splay (deeply).
+ * This will update any invalid content.
+ *
+ * Because this can return only text, if there is text at the beginning
+ * of the contents, I will create a FRAG as the first splay (after any
+ * attributes).
+ */
+
+ final CopyContext copySplayContents ( Root r )
+ {
+ assert !isFinish() && !isXmlns();
+
+ if (isContainer())
+ ensureContentValid();
+ else if (isNormalAttr())
+ ensureValueValid();
+
+ CopyContext copyContext = new CopyContext();
+
+ if (isContainer())
+ {
+ int cchAttrs = 0;
+
+ Splay t = nextSplay(), s = t;
+
+ for ( ; s.isAttr() ; s = s.nextSplay() )
+ {
+ copyContext.copySplay( s, false );
+ cchAttrs += s.getCch();
+ }
+
+ int cchValue = isLeaf() ? getCchValue() : getCchAfter();
+
+ if (cchValue > 0)
+ copyContext.copyFragment( cchValue );
+
+ int cchContents = 0;
+
+ if (!isLeaf())
+ {
+ Splay finish = getFinishSplay();
+
+ for ( Splay u = s ; u != finish ; u = u.nextSplay() )
+ {
+ copyContext.copySplay( u, true );
+ cchContents += u.getCch();
+ }
+ }
+
+ int cchAll = cchAttrs + cchValue + cchContents;
+
+ if (cchAll > 0)
+ {
+ char[] text = new char [ cchAll ];
+
+ int cp = r.getCp( this );
+ int cch = getCch();
+
+ if (cchAttrs > 0)
+ r._text.fetch( text, 0, cp + cch, cchAttrs );
+
+ if (cchValue > 0)
+ r._text.fetch( text, cchAttrs, cp, cchValue );
+
+ if (cchContents > 0)
+ {
+ r._text.fetch(
+ text, cchAttrs + cchValue,
+ cp + cch + cchAttrs, cchContents );
+ }
+
+ copyContext.copyText( text );
+ }
+ }
+ else
+ {
+ assert isNormalAttr() || isComment() || isProcinst();
+
+ int cchValue = getCchValue();
+
+ if (cchValue > 0)
+ {
+ copyContext.copyFragment( cchValue );
+
+ char[] text = new char [ cchValue ];
+
+ r._text.fetch( text, 0, r.getCp( this ), cchValue );
+
+ copyContext.copyText( text );
+ }
+ }
+
+ return copyContext;
+ }
+
+ /**
+ * Copies this splay (deeply). Also copies attributes after a begin
+ * This will update any invalid content.
+ */
+
+ final Splay copySplay ( )
+ {
+ assert !isDoc() && !isFinish();
+
+ // Compute splay to stop at (does not get copied). Also compute
+ // a splay, to be copied, which should not have it's text after copied.
+
+ Splay stopHere, noTextAfter;
+
+ if (isBegin())
+ {
+ noTextAfter = getFinishSplay();
+ stopHere = noTextAfter.nextNonAttrSplay();
+ }
+ else
+ {
+ noTextAfter = null;
+ stopHere = nextSplay();
+ }
+
+ // Make the copy
+
+ CopyContext copyContext = new CopyContext();
+
+ for ( Splay next, s = this ; s != stopHere ; s = next )
+ {
+ next = s.nextSplay();
+
+ copyContext.copySplay( s, s != noTextAfter );
+ }
+
+ return copyContext.getTree();
+ }
+
+ final void removeAttributes ( Root r )
+ {
+ assert isContainer();
+
+ for ( ; ; )
+ {
+ Splay s = nextSplay();
+
+ if (!s.isAttr())
+ break;
+
+ s.remove( r, true );
+ }
+ }
+
+ /**
+ * Removes all content from splay.
+ * Begin will be a leaf upon exit.
+ */
+
+ final void removeContent ( Root r, boolean removeAttrs )
+ {
+ assert Root.dv > 0 || getRootSlow() == r;
+
+ r.startChange();
+
+ if (isInvalid())
+ {
+ toggleIsInvalid();
+
+ r.invalidateVersion();
+
+ if (isContainer() && removeAttrs)
+ removeAttributes( r );
+
+ return;
+ }
+
+ switch ( getKind() )
+ {
+ case DOC :
+ break;
+
+ case BEGIN :
+ {
+ if (isLeaf())
+ {
+ removeChars( r, 1, getCchValue() );
+
+ if (removeAttrs)
+ removeAttributes( r );
+
+ return;
+ }
+
+ break;
+ }
+
+ case ATTR :
+ {
+ if (isXmlns())
+ {
+ assert false: "Unexpected kind for removeContent";
+ }
+
+ // Fall through
+ }
+
+ case COMMENT :
+ case PROCINST :
+ {
+ int cchValue = getCchValue();
+
+ if (cchValue == 0)
+ return;
+
+ r._text.remove( r.getCp( this ), cchValue );
+
+ r.updateCch( this, - cchValue );
+
+ if (getKind() == ATTR)
+ {
+ invalidateText();
+
+ if (isXsiType())
+ getContainer().disconnectTypes( r );
+ }
+
+ r.invalidateVersion();
+
+ return;
+ }
+
+ default :
+ assert false: "Unexpected kind for removeContent";
+ }
+
+ assert isDoc() || (isBegin() && !isLeaf());
+
+ Splay s = nextNonAttrSplay();
+
+ if (s.isRoot())
+ {
+ assert isDoc();
+ }
+ else
+ {
+ //
+ // Remove all the splays. Inhibit invalidation on each remove to
+ // prevent a flood of invalidations to the parent type (if there).
+ //
+
+ Splay next;
+ for ( s = nextNonAttrSplay() ; !s.isFinish() ; s = next )
+ {
+ assert !s.isAttr();
+
+ if (s.isLeaf())
+ next = s.nextNonAttrSplay();
+ else if (s.isBegin())
+ next = s.getFinishSplay().nextSplay();
+ else
+ next = s.nextSplay();
+
+ s.remove( r, false );
+ }
+
+ //
+ // Have to remove the text after this here because the above
+ // removes could have suuffled text to after this.
+ //
+
+ assert !isLeaf();
+
+ if (getCchAfter() > 0)
+ removeTextAfter( r );
+
+ //
+ // Tricky code. Merge the END and the BEGIN to form a leaf.
+ //
+
+ if (isBegin())
+ foliate( r );
+
+ invalidateText();
+
+ r.invalidateVersion();
+ }
+
+// TODO - if removing text from xsi:type or nil must do stuff
+// TODO - if removing text from xsi:type or nil must do stuff
+// TODO - if removing text from xsi:type or nil must do stuff
+// TODO - if removing text from xsi:type or nil must do stuff
+// TODO - if removing text from xsi:type or nil must do stuff
+
+
+// TODO - if removing attribute xsi:type or xsi:nil, must do stuiff
+// TODO - if removing attribute xsi:type or xsi:nil, must do stuiff
+// TODO - if removing attribute xsi:type or xsi:nil, must do stuiff
+// TODO - if removing attribute xsi:type or xsi:nil, must do stuiff
+// TODO - if removing attribute xsi:type or xsi:nil, must do stuiff
+
+ if (removeAttrs)
+ removeAttributes( r );
+
+ // If the tree became empty, reset _leftOnly
+
+ if (r._leftSplay == r._doc && r._doc._rightSplay == null)
+ r._leftOnly = true;
+
+ assert validate();
+ }
+
+ final int copyChars (
+ Root r, int p, int cch, Root rDst, Splay sDst, int pDst )
+ {
+ assert pDst > 0 && pDst <= sDst.getEndPos();
+
+ int postCch = getPostCch( p );
+
+ if (p == 0 || cch == 0 || postCch == 0)
+ return 0;
+
+ if (cch < 0 || cch > postCch)
+ cch = postCch;
+
+ assert cch > 0;
+
+// TODO - uses string to avoid problems with source and dest from same buffer
+// rewrite to not create string object
+
+ char[] chars = new char [ cch ];
+
+ r._text.fetch( chars, 0, getCpForPos( r, p ), cch );
+
+ sDst.insertChars( pDst, rDst, chars, 0, cch );
+
+ return cch;
+ }
+
+ /**
+ * Move cch chars from pos p on this splay to pos pDst on sDst.
+ * Source and destination can be different documents. Normally cursors
+ * stay put when their char is moved, but moveCursors can cause cursors
+ * tomove with the chars (used internally).
+ */
+
+ final int moveChars (
+ Root r, int p, int cch, Root rDst, Splay sDst, int pDst,
+ boolean moveCursors )
+ {
+ if (p == 0)
+ return 0;
+
+ int postCch = getPostCch( p );
+
+ if (cch == 0 || postCch == 0)
+ return 0;
+
+ if (cch < 0 || cch > postCch)
+ cch = postCch;
+
+ r.startChange();
+ rDst.startChange();
+
+ assert cch > 0;
+
+ // I don't have to check the invalidity of the source because the
+ // only invalid text I would have to deal with is that in a leaf, and
+ // If the source is in a leaf here, then it must be positioned at the
+ // end (1) which is not sensitive to the invalidity.
+ //
+ // However, I much check the destination for validity because I may
+ // be appending text to an existing value.
+
+ if (sDst.isContainer() && pDst == 1)
+ {
+ int cchValid = sDst.ensureContentValid();
+
+ pDst += cchValid;
+
+ if (sDst == this && p == 1)
+ p += cchValid;
+ }
+
+ //
+
+ if (pDst == 0)
+ {
+ sDst = sDst.prevNonAttrSplay();
+ pDst = sDst.getEndPos();
+ }
+
+ // If the destination if in the range of the source, then this is
+ // effectively a no-op.
+
+// TODO - Probably should disconnect Types in the range
+
+ if (sDst == this && pDst >= p && pDst <= p + cch)
+ return cch;
+
+ assert pDst > 0;
+
+ Container cDst = sDst.getContainer( pDst );
+ Container c = getContainer( p );
+
+ // Move the text
+
+ rDst._text.move(
+ sDst.getCpForPos( rDst, pDst ), r._text, getCpForPos( r, p ), cch );
+
+ // Perform the "insertion" first
+
+ if (!sDst.isLeaf() || pDst > sDst.getPosLeafEnd())
+ sDst.adjustCchAfter( cch );
+
+ rDst.updateCch( sDst, cch );
+
+ for ( Goober g = sDst.firstGoober() ; g != null ;
+ g = sDst.nextGoober( g ) )
+ {
+ int gp = g.getPos();
+
+ if (gp >= pDst)
+ g.set( gp + cch );
+ }
+
+ assert sDst != this || pDst < p || pDst > p + cch;
+
+ if (sDst == this)
+ {
+ int pDstSave = pDst;
+
+ if (pDst > p + cch)
+ pDst -= cch;
+
+ if (p >= pDstSave)
+ p += cch;
+ }
+
+ // Then perform the "removal"
+
+ if (!isLeaf() || p > getPosLeafEnd())
+ adjustCchAfter( - cch );
+
+ r.updateCch( this, - cch );
+
+ Goober nextGoober;
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int gp = g.getPos();
+
+ if (gp >= p + cch)
+ {
+ g.set( gp - cch );
+ }
+ else if (gp >= p)
+ {
+ if (!moveCursors && g.getKind() == CURSOR)
+ {
+ if (p == getEndPos())
+ g.set( nextSplay(), 0 );
+ else
+ g.set( p );
+ }
+ else
+ g.set( rDst, sDst, pDst + gp - p );
+ }
+ }
+
+ cDst.invalidateText();
+ c.invalidateText();
+
+ r.invalidateVersion();
+ rDst.invalidateVersion();
+
+ return cch;
+ }
+
+ /**
+ * Remove cch chars starting at position p on this splay.
+ */
+
+ final int removeChars ( Root r, int p, int cch )
+ {
+ int maxPos = getMaxPos();
+
+ assert p > 0 && p <= maxPos;
+
+ if (p == 0)
+ return 0;
+
+ r.startChange();
+
+// TODO - merge the two following chunks of code??????
+
+ if (isLeaf())
+ {
+ int ple = getPosLeafEnd();
+
+ if (p <= ple)
+ {
+ if (cch < 0 || ple - p < cch)
+ cch = ple - p;
+
+ if (cch == 0)
+ return 0;
+
+ r._text.remove( r.getCp( this ) + p - 1, cch );
+
+ r.updateCch( this, - cch );
+
+ Goober nextGoober;
+
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int k = g.getKind();
+ int gp = g.getPos();
+
+ if (gp >= p + cch)
+ g.set( gp - cch );
+ else if (gp >= p)
+ {
+ if (k == CURSOR)
+ g.set( p );
+ else
+ {
+ assert k == ANNOTATION;
+ g.disconnect( r );
+ }
+ }
+ }
+
+ invalidateText();
+
+ r.invalidateVersion();
+
+ return cch;
+ }
+ }
+
+ int posAfter = getPosAfter();
+
+ assert p >= posAfter;
+
+ int maxCch = maxPos - p + 1;
+
+ assert maxCch >= 0;
+
+ if (cch < 0 || cch > maxCch)
+ cch = maxCch;
+
+ if (cch <= 0)
+ return 0;
+
+ Container c = getContainer( p );
+
+ r._text.remove( getCpForPos( r, p ), cch );
+
+ adjustCchAfter( - cch );
+
+ r.updateCch( this, - cch );
+
+ Goober nextGoober;
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober )
+ {
+ nextGoober = nextGoober( g );
+
+ int k = g.getKind();
+ int gp = g.getPos();
+
+ if (gp >= p)
+ {
+ if (k == CURSOR)
+ g.set( nextNonAttrSplay(), 0 );
+ else
+ g.disconnect( r );
+ }
+ }
+
+ c.invalidateText();
+
+ r.invalidateVersion();
+
+ assert validate();
+
+ return cch;
+ }
+
+ /**
+ * Insert text a position p in this splay
+ */
+
+ final void insertChars ( int p, Root r, Object txt, int off, int cch )
+ {
+ assert p > 0 && p <= getEndPos();
+
+ if (cch == 0)
+ return;
+
+ r.startChange();
+
+ Container container = getContainer( p );
+
+ if (isContainer() && p == 1)
+ p += ensureContentValid();
+
+ r._text.insert( getCpForPos( r, p ), txt, off, cch );
+
+ if (p >= getPosAfter())
+ adjustCchAfter( cch );
+
+ r.updateCch( this, cch );
+
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober( g ) )
+ {
+ int gp = g.getPos();
+
+ if (gp >= p)
+ g.set( gp + cch );
+ }
+
+ container.invalidateText();
+
+ r.invalidateVersion();
+
+ assert validate();
+ }
+
+ private static final int START_STATE = 0;
+ private static final int SPACE_SEEN_STATE = 1;
+ private static final int NOSPACE_STATE = 2;
+
+ public final int scrubText(
+ Text text, int ws, int cp, int cch, StringBuffer sb, int state )
+ {
+ assert text != null;
+
+ if (text._buf == null)
+ {
+ assert cch == 0;
+ assert cp == 0;
+ return state;
+ }
+
+ if (cch == 0)
+ return state;
+
+ boolean replace = false;
+ boolean collapse = false;
+
+ switch ( ws )
+ {
+ case TypeStore.WS_UNSPECIFIED : break;
+ case TypeStore.WS_PRESERVE : break;
+ case TypeStore.WS_REPLACE : replace = true; break;
+ case TypeStore.WS_COLLAPSE : collapse = replace = true; break;
+
+ default : assert false: "Unknown white space rule " +ws;
+ }
+
+ if (!replace && !collapse)
+ {
+ text.fetch(sb, cp, cch);
+ return state;
+ }
+
+ int off = text.unObscure( cp, cch );
+ int startpt = 0;
+
+ for ( int i = 0 ; i < cch ; i++ )
+ {
+ char ch = text._buf[ off + i ];
+
+ if (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t')
+ {
+ sb.append(text._buf, off + startpt, i - startpt);
+ startpt = i + 1;
+
+ if (collapse)
+ {
+ if (state == NOSPACE_STATE)
+ state = SPACE_SEEN_STATE;
+ }
+ else
+ sb.append(' ');
+ }
+ else
+ {
+ if (state == SPACE_SEEN_STATE)
+ sb.append( ' ' );
+
+ state = NOSPACE_STATE;
+ }
+ }
+
+ sb.append( text._buf, off + startpt, cch - startpt );
+
+ return state;
+ }
+
+ final String getText ( Root r )
+ {
+ return getText( r, TypeStore.WS_PRESERVE );
+ }
+
+// final int getText ( Root r, char[] buf, int off, int len )
+// {
+// if (len <= 0)
+// return 0;
+//
+// if (isInvalid())
+// {
+// if (isNormalAttr())
+// ensureValueValid();
+// else if (isLeaf())
+// ensureContentValid();
+// }
+//
+// int cp = r.getCp( this );
+//
+// if (isNormalAttr() || isComment() || isProcinst() || isLeaf())
+// {
+// int cch = getCchValue();
+//
+// if (cch == 0)
+// return 0;
+//
+// if (cch > len)
+// cch = len;
+//
+// r._text.fetch( buf, off, pos, cch );
+//
+// return cch;
+// }
+//
+// if (!isContainer())
+// return 0;
+//
+// int originalLen = len;
+// Splay last = getFinishSplay();
+//
+// for ( Splay s = this ; len > 0 && s != last ; s = s.nextSplay() )
+// {
+// int srcCp, srcCch;
+//
+// if (s.isBegin())
+// {
+// if (s.isInvalid())
+// s.ensureContentValid();
+//
+// srcCp = cp;
+// srcCch = s.getCch();
+// }
+// else
+// {
+// // It's ok for an attr to be invalid here, gets text after
+//
+// srcCp = cp + s.getCchValue();
+// srcCch = s.getCchAfter();
+// }
+//
+// if (srcCch > 0)
+// {
+// if (srcCch > len)
+// srcCch = len;
+//
+// int srcOff = r._text.unObscure( srcCp, srcCch );
+//
+// System.arrayCopy( r._text._buf, srcOff, buf, off, srcCch );
+//
+// len -= srcCch;
+// off += srcCch;
+// }
+//
+// cp += s.getCch();
+// }
+//
+// return sb.toString();
+// }
+
+ final String getText ( Root r, int ws )
+ {
+ if (isInvalid())
+ {
+ if (isNormalAttr())
+ ensureValueValid();
+ else if (isLeaf())
+ ensureContentValid();
+ }
+
+ int cp = r.getCp( this );
+
+ if (isNormalAttr() || isComment() || isProcinst() || isLeaf())
+ {
+ int cch = getCchValue();
+
+ if (cch == 0)
+ return "";
+
+ if (ws == TypeStore.WS_PRESERVE || ws == TypeStore.WS_UNSPECIFIED)
+ return r._text.fetch( cp, cch );
+
+ StringBuffer sb = new StringBuffer();
+
+ scrubText( r._text, ws, cp, getCchValue(), sb, START_STATE );
+
+ return sb.toString();
+ }
+
+ if (!isContainer())
+ return null;
+
+ Splay last = getFinishSplay();
+
+ int scrubState = START_STATE;
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( Splay s = this ; s != last ; s = s.nextSplay() )
+ {
+ if (s.isBegin())
+ {
+ if (s.isInvalid())
+ s.ensureContentValid();
+
+ scrubState =
+ scrubText(
+ r._text, ws, cp, s.getCch(), sb, scrubState );
+ }
+ else
+ {
+ // It's ok for an attr to be invalid here, gets text after
+
+ int cchAfter = s.getCchAfter();
+
+ if (cchAfter > 0)
+ {
+ scrubState =
+ scrubText(
+ r._text, ws, cp + s.getCchValue(),
+ cchAfter, sb, scrubState );
+ }
+ }
+
+ cp += s.getCch();
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Gets an attr splay for a given container, null otherwise.
+ */
+
+ Splay getAttr ( QName name )
+ {
+ assert name != null;
+
+ if (!isContainer())
+ return null;
+
+ for ( Splay s = nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isNormalAttr() && s.getName().equals( name ))
+ return s;
+ }
+
+ return null;
+ }
+
+ void setXsiNil ( Root r, boolean nil )
+ {
+ assert isContainer();
+
+ if (getXsiNil( r ) == nil)
+ return;
+
+ setAttr( r, _xsiNil, "true" );
+ }
+
+ boolean getXsiNil ( Root r )
+ {
+ assert isContainer();
+
+ Splay s;
+
+ for ( s = nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXsiNil())
+ break;
+ }
+
+ if (!s.isAttr())
+ return false;
+
+ String value = s.getText( r, TypeStore.WS_COLLAPSE );
+
+ return value.equals( "true" ) ||value.equals( "1" );
+ }
+
+ QName getXsiTypeName ( Root r )
+ {
+ assert isContainer();
+
+ Splay s;
+
+ for ( s = nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXsiType())
+ break;
+ }
+
+ if (!s.isAttr())
+ return null;
+
+ assert s.isXsiType();
+
+ String value = s.getText( r, TypeStore.WS_COLLAPSE );
+
+// TODO - unobscure the underlying text and use it directly
+// TODO - should I make sure the prefix is wqell formed? ie. just text
+
+ String prefix, localname;
+
+ int firstcolon = value.indexOf( ':' );
+
+ if (firstcolon >= 0)
+ {
+ prefix = value.substring( 0, firstcolon );
+ localname = value.substring( firstcolon + 1 );
+ }
+ else
+ {
+ prefix = "";
+ localname = value;
+ }
+
+ String uri = namespaceForPrefix( prefix, true );
+
+ if (uri == null)
+ return null; // no prefix definition found - that's illegal
+
+ return new QName( uri, localname );
+ }
+
+ void setXsiType ( Root r, QName typeName )
+ {
+ assert isContainer();
+
+ if (typeName == null)
+ {
+ removeAttr( r, _xsiType );
+ return;
+ }
+
+ String value = typeName.getLocalPart();
+
+ String ns = typeName.getNamespaceURI();
+
+ String prefix = prefixForNamespace( r, ns, null, true);
+
+ assert prefix != null : "Cannot establish prefix for " + ns;
+
+ if (prefix.length() > 0)
+ value = prefix + ":" + value;
+
+ boolean set = false;
+
+ setAttr( r, _xsiType, value );
+ }
+
+ void removeAttr ( Root r, QName attrName )
+ {
+ Splay next;
+ for ( Splay s = nextSplay() ; s.isAttr() ; s = next )
+ {
+ next = s.nextSplay();
+
+ if (s.getName().equals( attrName ))
+ s.remove( r, true );
+ }
+ }
+
+ void setAttr ( Root r, QName attrName, String value )
+ {
+ assert isContainer();
+ assert attrName != null;
+ assert value != null;
+
+ boolean set = false;
+
+ Splay next;
+ for ( Splay s = nextSplay() ; s.isAttr() ; s = next )
+ {
+ next = s.nextSplay();
+
+ if (s.getName().equals( attrName ))
+ {
+ if (set)
+ s.remove( r, true );
+ else
+ {
+ s.setText( r, value, 0, value.length() );
+ set = true;
+ }
+ }
+ }
+
+ if (!set)
+ {
+ Splay sInsert = this;
+ int pInsert = 1;
+
+ if (!isLeaf() && getCch() == 0)
+ {
+ sInsert = nextSplay();
+ pInsert = 0;
+ }
+
+ int cchValue = value.length();
+
+ Attr attr = new Attr( attrName );
+ attr.adjustCch( cchValue );
+
+ sInsert.insert( r, pInsert, attr, value, 0, cchValue, false );
+ }
+ }
+
+
+ /**
+ * Sets the content/value of this splay to the given text.
+ */
+
+ final void setText ( Root r, Object txt, int off, int cch )
+ {
+ removeContent( r, false );
+
+ if (txt == null || cch == 0)
+ return;
+
+ switch ( getKind() )
+ {
+ case DOC :
+ case BEGIN :
+ {
+ assert !isBegin() || isLeaf();
+ insertChars( 1, r, txt, off, cch );
+ break;
+ }
+ case ATTR :
+ {
+ if (isXmlns())
+ {
+ assert false: "Unexpected kind for setText";
+ }
+// TODO - if setting text of xsi:type or xsi:nil must do stuff
+// TODO - if setting text of xsi:type or xsi:nil must do stuff
+// TODO - if setting text of xsi:type or xsi:nil must do stuff
+// TODO - if setting text of xsi:type or xsi:nil must do stuff
+
+ // Fall through
+ }
+ case COMMENT :
+ case PROCINST :
+ {
+ r.startChange();
+
+ assert getCchValue() == 0;
+
+ r._text.insert( r.getCp( this ), txt, off, cch );
+ r.updateCch( this, cch );
+
+ if (getKind() == ATTR)
+ {
+ invalidateText();
+
+ if (isXsiType())
+ getContainer().disconnectTypes( r );
+ }
+
+ r.invalidateVersion();
+
+ break;
+ }
+ default :
+ assert false: "Unexpected kind for setText";
+ }
+
+ assert validate();
+ }
+
+ final Map lookupAllPrefixMappings ( )
+ {
+ Map mappings = null;
+
+ Splay container = this.isContainer() ? this : getContainer();
+
+ for ( ; container != null ; container = container.getContainer() )
+ {
+ for ( Splay s = container.nextSplay() ; s.isAttr() ;
+ s = s.nextSplay() )
+ {
+ if (s.isXmlns())
+ {
+ if (mappings == null)
+ mappings = new HashMap();
+ else if (mappings.containsKey( s.getLocal() ))
+ continue;
+
+ mappings.put( s.getLocal(), s.getUri() );
+ }
+ }
+ }
+
+ return mappings;
+ }
+
+ final void applyNamespaces ( Root r, Map namespaces )
+ {
+ if (namespaces == null)
+ return;
+
+ Splay container = this.isContainer() ? this : getContainer();
+
+ namespace_loop:
+ for ( Iterator i = namespaces.keySet().iterator() ; i.hasNext() ; )
+ {
+ String prefix = (String) i.next();
+
+ // Usually, this is the predefined xml namespace
+ if (prefix.toLowerCase().startsWith( "xml" ))
+ continue;
+
+ String namespace = (String) namespaces.get( prefix );
+
+ Splay candidate = container;
+
+ candidate_loop:
+ for ( Splay c = container.getContainer() ; c != null && !c.isDoc() ;
+ c = c.getContainer() )
+ {
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() && prefix.equals( s.getLocal() ))
+ {
+ if (namespace.equals( s.getUri()))
+ continue namespace_loop;
+
+ break candidate_loop;
+ }
+ }
+
+ candidate = c;
+ }
+
+ // Insert the new namespace at the end of the attr list after
+ // makeing sure all previous mappings are gone
+ QName qname = new QName( namespace, prefix );
+
+ removeAttr( r, qname );
+
+ candidate.nextNonAttrSplay().insert(
+ r, 0, new Xmlns( qname ), null, 0, 0, false );
+ }
+ }
+
+ /**
+ * Returns the prefix associated with this attr/element.
+ */
+ final String getPrefix ( Root r )
+ {
+ assert isBegin() || isAttr();
+
+ if (isXmlns())
+ return "xmlns";
+
+ // TODO - have a prefix goober to override the mapping on the frontier.
+ // Parser will add this when the natural prefix is not the real prefix.
+
+ Splay c = isBegin() ? this : getContainer();
+
+ // special case
+ String ns = getUri();
+
+ // last argument is false, which means, don't modify the tree
+ return prefixForNamespace( r, ns, null, false );
+ }
+
+ /**
+ * Given a prefix, returns the namespace corresponding to
+ * the prefix at this location, or null if there is no mapping
+ * for this prefix.
+ * <p>
+ * prefix="" indicates the absence of a prefix. A return value
+ * of "" indicates the no-namespace, and should not be confused
+ * with a return value of null, which indicates an illegal
+ * state, where there is no mapping for the given prefix.
+ * <p>
+ * If the the default namespace is not explicitly mapped in the xml,
+ * the xml spec says that it should be mapped to the no-namespace.
+ * When the 'defaultAlwaysMapped' parameter is true, the default namepsace
+ * will return the no-namespace even if it is not explicity
+ * mapped, otherwise the default namespace will return null.
+ * <p>
+ * This function intercepts the built-in prefixes "xml" and
+ * "xmlns" and returns their well-known namespace URIs.
+ *
+ * @param prefix The prefix to look up.
+ * @param mapDefault If true, return the no-namespace for the default namespace if not set.
+ * @return The mapped namespace URI ("" if no-namespace), or null if no mapping.
+ */
+ final String namespaceForPrefix ( String prefix, boolean defaultAlwaysMapped )
+ {
+ // null same as "", means look up the default namespace
+ if (prefix == null)
+ prefix = "";
+
+ // handle built-in prefixes
+ if ("xml".equals(prefix))
+ return _xml1998Uri;
+ if ("xmlns".equals(prefix))
+ return _xmlnsUri;
+
+ assert isContainer();
+
+ // find an xmlns decl
+ for ( Container c = (Container) this ; c != null ; c = c.getContainer())
+ {
+ for ( Splay s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() && prefix.equals( s.getLocal() ))
+ return s.getUri();
+ }
+ }
+
+ // CR135193: if defaultAlwaysMapped, return no-namespace when no default namespace is found
+ // otherwise, return null to indicate no default namespace was found.
+ if (defaultAlwaysMapped && prefix.length() == 0) {
+ return "";
+ }
+
+ // no namespace defn found: return null
+ return null;
+ }
+
+
+ /**
+ * Returns the prefix to use for a given namespace URI. Can either
+ * be allowed to modify the tree to ensure such a mapping (if r
+ * is non-null), or can be told to return null if there is no
+ * existing mapping (if r is null).
+ * <p>
+ * For the case where the tree may be modified, a suggested prefix
+ * can be supplied. The suggestion may be ignored for any reason,
+ * for example, if the prefix is already in-use.
+ * <p>
+ * Returns "xml" and "xmlns" for the well-known namespace URIs
+ * corresponding to those built-in prefixes.
+ *
+ * @param r should be null if you don't want to modify the tree.
+ * if a prefix can't be found, null will be returned
+ * rather than introducing an xmlns.
+ * @param ns the namespace to look for or introduce a mapping for.
+ * careful with "", because it may have nonlocal effects
+ * if somebody has overridden the default namespace.
+ * @param suggestion a suggested prefix to try first; may be null.
+ *
+ * @param createIfMissing true (normally it's true) if you want to create
+ * an xmlns declaration when one doesn't already exist for
+ * your requested URI. If you don't want to modify the tree,
+ * pass false.
+ */
+ final String prefixForNamespace ( Root r, String ns, String suggestion,
+ boolean createIfMissing )
+ {
+ // null same as empty string, means no-namespace
+ if (ns == null)
+ ns = "";
+
+ // special cases
+ if (_xml1998Uri.equals( ns ))
+ return "xml";
+ if (_xmlnsUri.equals( ns ))
+ return "xmlns";
+
+ assert isContainer();
+
+ Container c;
+ Splay s;
+
+ //
+ // Special handling is ns is not specified (no namespace)
+ //
+
+ if (ns.length() == 0)
+ {
+ loop:
+ for ( c = (Container) this ; c != null ; c = c.getContainer() )
+ {
+ for ( s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() && s.getLocal().length() == 0)
+ {
+ if (s.getUri().length() == 0)
+ return s.getLocal();
+
+ break loop;
+ }
+ }
+ }
+
+ //
+ // If there is no overridden default namespace in scope,
+ // return "" - the default default namespace is the no-namepsace.
+ //
+
+ if ( c == null )
+ return "";
+
+ //
+ // If we found a problematic default namespace but cannot modify
+ // the tree, return null - no prefix available.
+ //
+
+ if ( !createIfMissing )
+ return null;
+
+ //
+ // There is a default namespace which maps to a 'real' namespace,
+ // create a default namespace on this container which is "". This
+ // can screw attributes and such, but, oh well.
+ //
+
+ for ( s = nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() && s.getLocal().length() == 0)
+ {
+ s.setName( r, new QName( "", "" ) );
+ return s.getLocal();
+ }
+ }
+
+ // this is an xmlns="" declaration
+
+ Attr a = new Xmlns( new QName( "", "" ) );
+
+ r.startChange();
+
+ r.insertSplay( a, this );
+
+ r.invalidateVersion();
+
+ return a.getLocal();
+ }
+
+ //
+ // the ordinary not-a-no-namespace case
+ //
+
+ assert ns != null && ns.length() > 0;
+
+ //
+ // look for an existing prefix for the requested URI
+ //
+
+ for ( c = (Container) this ; c != null ; c = c.getContainer() )
+ {
+ findxmlns: for ( s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() && s.getUri().equals( ns ))
+ {
+ String result = s.getLocal();
+
+ // now check to verify that the prefix isn't masked
+ for ( Container c2 = (Container) this ; c2 != c ; c2 = c2.getContainer() )
+ {
+ for ( Splay s2 = c2.nextSplay() ; s2.isAttr() ; s2 = s2.nextSplay() )
+ {
+ if (s2.isXmlns() && s2.getLocal().equals(result))
+ continue findxmlns;
+ }
+ }
+
+ // not masked: OK.
+ return result;
+ }
+ }
+ }
+
+ //
+ // We could not find an existing prefix in-scope that works.
+ // If !createIfMissing, don't modify the tree - return null instead.
+ //
+
+ if (!createIfMissing)
+ return null;
+
+ //
+ // We must add an xmlns:something="uri", so we must pick a prefix.
+ // We will use the suggestion if it's not already in scope and if
+ // it's not the empty string or an illegal prefix.
+ //
+
+ if (suggestion != null)
+ {
+ if (suggestion.length() == 0 || suggestion.toLowerCase().startsWith( "xml" ))
+ suggestion = null; // bad suggestion
+ else
+ {
+ for ( c = (Container) this ; c != null ; c = c.getContainer() )
+ {
+ for ( s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() &&
+ s.getLocal().equals( suggestion ))
+ {
+ suggestion = null;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // If no suggestion, come up with a safe prefix to use
+ //
+
+ if (suggestion == null)
+ {
+ String base = QNameHelper.suggestPrefix(ns);
+ suggestion = base;
+ for ( int i = 1 ; ; i++ )
+ {
+ loop:
+ for ( c = (Container) this ; c != null ; c = c.getContainer() )
+ {
+ for ( s = c.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
+ {
+ if (s.isXmlns() &&
+ s.getLocal().equals( suggestion ))
+ {
+ suggestion = null;
+ break loop;
+ }
+ }
+ }
+
+ if (suggestion != null)
+ break;
+
+ suggestion = base + i;
+ }
+ }
+
+ Container target = null;
+ Container lastContainer = null;
+
+ for ( c = (Container) this ; c != null ; c = c.getContainer() )
+ {
+ lastContainer = c;
+
+ if (c.isBegin())
+ target = c;
+ }
+
+ if (target == null)
+ target = lastContainer;
+
+ Attr a = new Xmlns( new QName( ns, suggestion ) );
+
+ r.startChange();
+
+ r.insertSplay( a, target );
+
+ r.invalidateVersion();
+
+ return a.getLocal();
+ }
+
+ /**
+ * Gets the container associated with the content at pos in this
+ * splay.
+ */
+
+ final Container getContainer ( int p )
+ {
+ assert p >= 0 && p <= getEndPos();
+ assert p > 0 || !isDoc();
+
+ if (p == 0)
+ return getContainer();
+
+ if (isLeaf())
+ return p < getPosAfter() ? (Container) this : getContainer();
+
+ if (isContainer())
+ return (Container) this;
+
+ if (isFinish())
+ return getContainer().getContainer();
+
+ return getContainer();
+ }
+
+ /**
+ * Gets the splay which contains this splay.
+ */
+
+ abstract Container getContainer ( );
+
+ /**
+ * Helper fcn to locate the container this splay is container in.
+ * Should only be called by implementations of getContainer in
+ * cases where the container is not obviously computable.
+ */
+
+ Container findContainer ( )
+ {
+ assert !isContainer();
+ assert !isFinish();
+
+ Splay s = nextSplay();
+
+ while ( !s.isFinish() && !s.isBegin() )
+ s = s.nextSplay();
+
+ return s.getContainer();
+ }
+
+ final void invalidateText ( )
+ {
+ assert isValid();
+
+ Type t = peekType();
+
+ if (t != null)
+ {
+ assert isTypeable();
+
+ t.invalidateText();
+ }
+ }
+
+ final void invalidateNil ( )
+ {
+ assert isTypeable();
+
+ if (!isAttr())
+ {
+ Type t = peekType();
+
+ if (t != null)
+ t.invalidateNil();
+ }
+ }
+
+ protected final void disconnectTypes ( Root r )
+ {
+ disconnectTypes( r, false );
+ }
+
+ protected final void disconnectTypes ( Root r, boolean disconnectDoc )
+ {
+ assert isTypeable();
+
+ Splay last = isAttr() ? this : getFinishSplay();
+
+ Splay s = this;
+
+ for ( ; ; )
+ {
+ Type t = null;
+
+ if (s.isNormalAttr() || s.isLeaf())
+ {
+ t = s.peekType();
+ }
+ else if (s.isFinish())
+ {
+ Container c = s.getContainer();
+
+ if (!c.isDoc() || disconnectDoc)
+ t = c.peekType();
+ }
+
+ if (t != null)
+ {
+ Splay u = t.getSplay();
+
+ if (u.isInvalid())
+ {
+ if (u.isAttr())
+ t.validateValue( u, t );
+ else
+ {
+ // The finish splay might get whacked
+ Splay f = u.getFinishSplay();
+
+ t.validateContent( u, t );
+
+ if (f == last)
+ last = f;
+ }
+ }
+
+ t.disconnect( r );
+ }
+
+ if (s == last)
+ break;
+
+ if (s.isContainer() && !s.isLeaf() && s.peekType() == null)
+ s = s.getFinishSplay();
+ else
+ s = s.nextSplay();
+ }
+ }
+
+ /**
+ * Sets the type of of this
+ */
+
+ final void setType ( Root r, SchemaType sType )
+ {
+ setType( r, sType, true );
+ }
+
+ final void setType ( Root r, SchemaType sType, boolean complain )
+ {
+ assert isTypeable();
+ assert sType != null;
+
+ //
+ // Is the current type already this type?
+ //
+
+ Type t = peekType();
+
+ if (t != null && t.get_schema_type() == sType)
+ return;
+
+ //
+ // Can always set an arbitrary type at the doc level
+ //
+
+ if (isDoc())
+ {
+ disconnectTypes( r, true );
+
+ assert peekType() == null;
+
+ new Type( r, sType, this );
+
+ assert validate();
+
+ return;
+ }
+
+ //
+ // Gotta get the parent type to do anything further. If it
+ // can't be found, then barf
+ //
+
+ Type parentType = getContainer().getType( r );
+
+ assert parentType != null;
+
+ //
+ // You can set the attribute type, as long as it is the natural
+ // type. Attributes cannot have xsi:type
+ //
+
+ if (isAttr())
+ {
+ if (parentType.get_attribute_type( getName() ) != sType && complain)
+ {
+ throw new IllegalArgumentException(
+ "Can't set type of attribute to " + sType.toString() );
+ }
+
+ return;
+ }
+
+ assert isBegin();
+
+ //
+ // Now, for interior types, I have to deal with xsi:type and
+ // whether or not the type is allowed at this point.
+ //
+
+ // First check to see if this type can be here sans xsi:type.
+ // If so, make sure there is no xsi:type
+
+ if (parentType.get_element_type( getName(), null ) == sType)
+ {
+ setXsiType( r, null );
+
+ disconnectTypes( r );
+
+ assert validate();
+
+ return;
+ }
+
+ // If the desired type has no name, then it cannot be
+ // referenced via xsi:type
+
+ QName typeName = sType.getName();
+
+ if (typeName == null)
+ {
+ if (complain)
+ {
+ throw new IllegalArgumentException(
+ "Can't set type of element, type is un-named" );
+ }
+
+ return;
+ }
+
+ if (parentType.get_element_type( getName(), typeName ) != sType)
+ {
+ if (complain)
+ {
+ throw new IllegalArgumentException(
+ "Can't set type of element, invalid type" );
+ }
+
+ return;
+ }
+
+ setXsiType( r, typeName );
+
+ disconnectTypes( r );
+
+ assert validate();
+ }
+
+ /**
+ * Get the Type associated with this splay. It does not attempt to create
+ * one and will return null is non exists.
+ */
+
+ final Type peekType ( )
+ {
+ assert isTypeable();
+
+ Type type = null;
+
+ if (_goobers != null)
+ {
+ for ( Goober g = firstGoober() ; g != null ; g = nextGoober( g ) )
+ if (g.getKind() == TYPE)
+ return (Type) g;
+ }
+
+ assert type != null || isValid();
+
+ return type;
+ }
+
+ /**
+ * Get the Type associated with this splay. If non exists, it attempts
+ * to create one. Returns null if one could not be created.
+ */
+
+ final Type getType ( Root r )
+ {
+ assert isTypeable();
+
+ Type type = peekType();
+
+ if (!isDoc() && type == null)
+ {
+ Type parentType = getContainer().getType( r );
+
+ assert parentType != null;
+
+ // Defensive
+ if (parentType == null)
+ return null;
+
+ TypeStoreUser newUser;
+
+ if (isBegin())
+ {
+ newUser =
+ parentType.create_element_user(
+ getName(), getXsiTypeName( r ) );
+ }
+ else
+ {
+ assert isNormalAttr();
+
+ newUser = parentType.create_attribute_user( getName() );
+ }
+
+ assert newUser != null;
+
+ // Defensive
+ if (newUser == null)
+ return null;
+
+ type = new Type( r, newUser, this );
+ }
+
+ assert type != null;
+
+ return type;
+ }
+
+ /**
+ * Is this inside of the content of sRange? Does an inclusive check.
+ */
+
+ final boolean between ( Root r, int pThis, Splay sRange )
+ {
+ assert Root.dv > 0 || getRootSlow() == r;
+ assert Root.dv > 0 || getRootSlow() == sRange.getRootSlow();
+
+ if (sRange.isDoc())
+ return true;
+
+ if (compare( r, pThis, sRange, 0 ) < 0)
+ return false;
+
+ Splay sEnd;
+ int pEnd;
+
+ assert !sRange.isDoc();
+
+ if (sRange.isLeaf())
+ {
+ sEnd = sRange;
+ pEnd = sRange.getPosLeafEnd() + 1;
+ }
+ else if (sRange.isBegin())
+ {
+ sEnd = sRange.getFinishSplay();
+ pEnd = 1;
+ }
+ else
+ {
+ sEnd = sRange.nextSplay();
+ pEnd = 0;
+ }
+
+ return compare( r, pThis, sEnd, pEnd ) <= 0;
+ }
+
+ /**
+ * Compare two positions. Attributes are a bitch.
+ */
+
+ final int compare ( Root r, int pThis, Splay sThat, int pThat )
+ {
+ Splay sThis = this;
+
+ assert Root.dv > 0 || sThis.getRootSlow() == r;
+ assert Root.dv > 0 || sThat.getRootSlow() == r;
+ assert pThis >= 0 && pThis <= sThis.getEndPos();
+ assert pThat >= 0 && pThat <= sThat.getEndPos();
+
+ // Normalize positions
+
+ if (pThis == sThis.getEndPos())
+ {
+ if (sThis.isAttr())
+ {
+ if ((sThis = sThis.nextSplay()).isAttr())
+ pThis = 0;
+ else
+ {
+ sThis = sThis.prevNonAttrSplay();
+ pThis = 1;
+ }
+ }
+ else
+ {
+ sThis = sThis.nextNonAttrSplay();
+ pThis = 0;
+ }
+ }
+
+ if (pThat == sThat.getEndPos())
+ {
+ if (sThat.isAttr())
+ {
+ if ((sThat = sThat.nextSplay()).isAttr())
+ pThat = 0;
+ else
+ {
+ sThat = sThat.prevNonAttrSplay();
+ pThat = 1;
+ }
+ }
+ else
+ {
+ sThat = sThat.nextNonAttrSplay();
+ pThat = 0;
+ }
+ }
+
+ assert pThis < sThis.getEndPos();
+ assert pThat < sThat.getEndPos();
+
+ if (sThis == sThat)
+ return pThis < pThat ? -1 : pThis > pThat ? 1 : 0;
+
+ //
+
+ if (sThis.isAttr())
+ {
+ if (sThat.isAttr())
+ return compare( r, sThat );
+
+ if (sThis.prevNonAttrSplay() != sThat)
+ return compare( r, sThat );
+
+ return pThat == 0 ? 1 : -1;
+ }
+ else if (sThat.isAttr())
+ {
+ assert !sThis.isAttr();
+
+ if (sThat.prevNonAttrSplay() != sThis)
+ return compare( r, sThat );
+
+ return pThis == 0 ? -1 : 1;
+ }
+ else
+ {
+ return compare( r, sThat );
+ }
+ }
+
+ private int compare ( Root r, Splay sThat )
+ {
+ Splay sThis = this;
+
+ if (sThis == sThat)
+ return 0;
+
+ if (r.isLeftOnly())
+ {
+ if (sThis.getCchLeft() < sThat.getCchLeft())
+ return -1;
+
+ if (sThis.getCchLeft() > sThat.getCchLeft())
+ return 1;
+
+ if (sThis.getCdocBeginLeft() < sThat.getCdocBeginLeft())
+ return -1;
+
+ if (sThis.getCdocBeginLeft() > sThat.getCdocBeginLeft())
+ return 1;
+
+ while ( sThis != r )
+ {
+ sThis = sThis.nextSplay();
+
+ if (sThis == sThat)
+ return -1;
+
+ if (sThis.getCch() > 0 || sThis.getCdocBegin() > 0)
+ break;
+ }
+
+ return 1;
+ }
+
+ if (sThat.isRoot())
+ return -1;
+
+ if (sThis.isRoot())
+ return 1;
+
+ sThis.splay( r, r );
+ sThat.splay( r, sThis );
+
+ assert sThis._leftSplay == sThat || sThis._rightSplay == sThat;
+
+ return sThis._leftSplay == sThat ? 1 : -1;
+ }
+
+ final Splay nextNonAttrSplay ( )
+ {
+ Splay s = nextSplay();
+
+ while ( s != null && s.isAttr() )
+ s = s.nextSplay();
+
+ return s;
+ }
+
+ final Splay prevNonAttrSplay ( )
+ {
+ Splay s = prevSplay();
+
+ while ( s != null && s.isAttr() )
+ s = s.prevSplay();
+
+ return s;
+ }
+
+ final Splay nextSplay ( )
+ {
+ Splay s = this;
+ Splay r = s._rightSplay;
+
+ if (r != null)
+ {
+ for ( Splay l = s = r ; (l = l._leftSplay) != null ; )
+ s = l;
+
+ return s;
+ }
+
+ for ( Splay p = s._parentSplay ; ; p = (s = p)._parentSplay )
+ if (p == null || p._leftSplay == s)
+ return p;
+ }
+
+ final Splay prevSplay ( )
+ {
+ Splay s = this;
+ Splay l = s._leftSplay;
+
+ if (l != null)
+ {
+ for ( Splay r = s = l ; (r = r._rightSplay) != null ; )
+ s = r;
+
+ return s;
+ }
+
+ for ( Splay p = s._parentSplay ; ; p = (s = p)._parentSplay )
+ if (p == null || p._rightSplay == s)
+ return p;
+ }
+
+ final void rotateRight ( )
+ {
+ assert _parentSplay._leftSplay == this;
+
+ Splay p = _parentSplay;
+ Splay g = p._parentSplay;
+
+ assert p != null;
+
+ p._leftSplay = _rightSplay;
+
+ if (_rightSplay != null)
+ _rightSplay._parentSplay = p;
+
+ _rightSplay = p;
+ p._parentSplay = this;
+ _parentSplay = g;
+
+ if (g != null)
+ {
+ if (g._leftSplay == p)
+ g._leftSplay = this;
+ else
+ g._rightSplay = this;
+ }
+
+ p.adjustCchLeft( - getCchLeft() - getCch() );
+ p.adjustCdocBeginLeft( - getCdocBeginLeft() - getCdocBegin() );
+ }
+
+ final void rotateLeft ( )
+ {
+ assert _parentSplay._rightSplay == this;
+
+ Splay p = _parentSplay;
+ Splay g = p._parentSplay;
+
+ assert p != null;
+
+ p._rightSplay = _leftSplay;
+
+ if (_leftSplay != null)
+ _leftSplay._parentSplay = p;
+
+ _leftSplay = p;
+ p._parentSplay = this;
+ _parentSplay = g;
+
+ if (g != null)
+ {
+ if (g._leftSplay == p)
+ g._leftSplay = this;
+ else
+ g._rightSplay = this;
+ }
+
+ adjustCchLeft( p.getCchLeft() + p.getCch() );
+ adjustCdocBeginLeft( p.getCdocBeginLeft() + p.getCdocBegin() );
+ }
+
+ //
+ // Splay this so that it's parent is pStop.
+ //
+ // This version of splay is capable of splaying this to the top. There
+ // are two cases. One is there r is this and this is splayed to be
+ // the left child of r. The other case is where r is null. In this case
+ // the tree this is in is detached from the main document, and this will be
+ // splayed to the top of that subtree such that it's parent will be null.
+ //
+
+ final void splay ( Root r, Splay pStop )
+ {
+ assert pStop != null;
+ assert this != pStop;
+ assert Root.dv > 0 || r == null || getRootSlow() == r;
+ assert Root.dv > 0 || r == null || pStop.getRootSlow() == r;
+ assert r == null || r.validateSplayTree();
+ assert !isRoot();
+
+ boolean rotated = false;
+
+ for ( ; ; )
+ {
+ assert _parentSplay != null;
+
+ Splay p = _parentSplay;
+
+ assert p != null;
+
+ // If this is a child of the stopper, then we are done
+
+ if (p == pStop)
+ break;
+
+ Splay g = p._parentSplay;
+
+ // If this is child of root, then simple rotate
+
+ rotated = true;
+
+ if (g == pStop)
+ {
+ if (p._leftSplay == this)
+ rotateRight();
+ else
+ rotateLeft();
+
+ break;
+ }
+
+ // Fancy splays
+
+ if (g._leftSplay == p)
+ {
+ if (p._leftSplay == this)
+ p.rotateRight();
+ else
+ rotateLeft();
+
+ rotateRight();
+ }
+ else
+ {
+ if (p._rightSplay == this)
+ p.rotateLeft();
+ else
+ rotateRight();
+
+ rotateLeft();
+ }
+ }
+
+ if (rotated && r != null)
+ r._leftOnly = false;
+
+ assert r == null || r.validateSplayTree();
+ }
+
+ /**
+ * Remove this splay where root is the splay root of the tree this splay.
+ * This may be a ROOT splay
+ */
+
+ final Splay removeSplay ( Splay r )
+ {
+ Root root = r.isRoot() ? (Root) r : null;
+
+ assert r._parentSplay == null;
+ assert root == null || root.validateSplayTree();
+ assert !isRoot();
+ assert !isDoc();
+ assert Root.dv > 0 || getSplayRootSlow() == r;
+
+ // If the splay to be removed has no cch or cbegin, then when the
+ // tree is left only children, we need not splay.
+
+ int cch = getCch();
+ int cbegin = getCdocBegin();
+
+ if (root != null && root._leftOnly && cch == 0 && cbegin == 0)
+ {
+ assert _rightSplay == null;
+ assert _parentSplay != null;
+
+ if ((_parentSplay._leftSplay = _leftSplay) != null)
+ _leftSplay._parentSplay = _parentSplay;
+ }
+ else
+ {
+ splay( root, r );
+
+ if (_leftSplay == null)
+ {
+ r.adjustCchLeft( - cch );
+ r.adjustCdocBeginLeft( - cbegin );
+
+ if ((r._leftSplay = _rightSplay) != null)
+ _rightSplay._parentSplay = r;
+ }
+ else
+ {
+ Splay p = prevSplay();
+
+ p.splay( root, this );
+
+ assert p._rightSplay == null;
+
+ r._leftSplay = p;
+ p._parentSplay = r;
+ r.adjustCchLeft( - cch );
+ r.adjustCdocBeginLeft( - cbegin );
+ p._rightSplay = _rightSplay;
+
+ if (p._rightSplay != null)
+ p._rightSplay._parentSplay = p;
+ }
+ }
+
+ _leftSplay = _rightSplay = _parentSplay = null;
+ adjustCchLeft( - getCchLeft() );
+ adjustCdocBeginLeft( - getCdocBeginLeft() );
+
+ assert root == null || root.validateSplayTree();
+
+ return this;
+ }
+
+ //
+ // The Zoo (more like a petting zoo now)
+ //
+
+ static abstract class QNameSplay extends Splay
+ {
+ QNameSplay ( int kind, boolean is, QName name )
+ {
+ super( kind, is );
+ _name = name;
+ }
+
+ final QName getName ( ) { return _name; }
+ final void changeName ( QName name ) { _name = name; }
+
+ final String getUri ( ) { return _name.getNamespaceURI(); }
+ final String getLocal ( ) { return _name.getLocalPart(); }
+
+ private QName _name;
+ }
+
+ static abstract class Container extends QNameSplay
+ {
+ Container ( int kind, boolean is, QName name )
+ { super( kind, is, name ); }
+
+ abstract Finish getFinish ( );
+ }
+
+ static final class Doc extends Container
+ {
+ Doc ( Root r, QName name )
+ { super( DOC, false, name ); _root = r; }
+
+ Container getContainer ( ) { return null; }
+ Finish getFinish ( ) { return _root; }
+
+ Root _root;
+ }
+
+ static class Begin extends Container
+ {
+ Begin ( QName name, Container container )
+ { super( BEGIN, false, name ); _container = container; }
+
+ final Container getContainer ( ) { return _container; }
+ final Finish getFinish ( ) { return _end; }
+
+ End _end;
+ Container _container;
+ }
+
+ static abstract class Finish extends Splay
+ {
+ Finish ( int kind ) { super( kind, false ); }
+ }
+
+ static final class End extends Finish
+ {
+ End ( Begin begin ) { super( END ); _begin = begin; }
+
+ Container getContainer ( ) { return _begin; }
+
+ final Begin _begin;
+ }
+
+ static final class Comment extends Splay
+ {
+ Comment ( ) { super( COMMENT, false ); }
+
+ Container getContainer ( ) { return findContainer(); }
+ }
+
+ static final class Fragment extends Splay
+ {
+ Fragment ( ) { super( COMMENT, true ); }
+
+ Container getContainer ( ) { return null; }
+ }
+
+ static class Attr extends QNameSplay
+ {
+ Attr ( QName name ) { super( ATTR, false, name ); }
+
+ Attr ( QName name, boolean isXmlns )
+ {
+ super( ATTR, true, name );
+ assert isXmlns;
+ }
+
+ Container getContainer ( )
+ {
+ for ( Splay s = prevSplay() ; ; s = s.prevSplay() )
+ if (!s.isAttr())
+ return (Container) s;
+ }
+ }
+
+ static final class Xmlns extends Attr
+ {
+ Xmlns ( QName name ) { super( name, true ); }
+ }
+
+ static final class Procinst extends QNameSplay
+ {
+ Procinst ( QName target )
+ {
+ super( PROCINST, false, target );
+ }
+
+ Procinst ( String target )
+ {
+ super( PROCINST, false, new QName( "", target ) );
+ }
+
+ Container getContainer ( ) { return findContainer(); }
+ }
+
+ /**
+ * Every splay points to a collection of goobers. Goobers can be
+ * aggregated into groups which share the same state (kind and position).
+ */
+
+ static final int CURSOR = 0;
+ static final int TYPE = 1;
+ static final int ANNOTATION = 2;
+ static final int AGGREGATE = 3;
+
+ static abstract class Goober extends Goobers
+ {
+ Goober ( Root r, int kind )
+ {
+ _root = r;
+ _state = kind;
+ }
+
+ final int getKind ( ) { return _state & 7; }
+ final Root getRoot ( ) { return _root; }
+ final Splay getSplay ( ) { return _splay; }
+ final int getPos ( ) { return _state >> 3; }
+ final int getState ( ) { return _state; }
+
+ final boolean isAnnotation ( ) { return getKind() == ANNOTATION; }
+
+ final void set ( Root r, Splay s, int p )
+ {
+ assert s != null;
+ doSet( r, s, p );
+ }
+
+ private final void doSet ( Root r, Splay s, int p )
+ {
+ assert s != null || p == 0;
+ assert Root.dv > 0 || s == null || r == s.getRootSlow();
+ assert Root.dv > 0 || _splay == null || _root == _splay.getRootSlow();
+// assert Root.dv > 0 || _root == r || _splay.getRootSlow() != s.getRootSlow();
+
+ _root = r;
+
+ if (_splay != s)
+ {
+ if (_splay != null)
+ remove();
+
+ if (s != null)
+ append( s );
+ }
+
+ assert p >= 0;
+ assert _splay == null || p <= _splay.getMaxPos();
+ _state = p * 8 + (_state & 7);
+ }
+
+ final void set ( Root r )
+ {
+ assert r != null;
+ _root = r;
+ }
+
+ final void set ( Splay s, int p ) { doSet( getRoot(), s, p ); }
+ final void set ( int p ) { doSet( getRoot(), getSplay(), p ); }
+
+ final void set ( Goober g )
+ { doSet( g.getRoot(), g.getSplay(), g.getPos() ); }
+
+ void disconnect ( Root r )
+ {
+ doSet( r, null, 0 );
+ }
+
+ void release ( )
+ {
+ set( null, 0);
+ _root = null;
+ }
+
+ private final void append ( Splay s )
+ {
+ assert s != null;
+ assert Root.dv > 0 || s.getRootSlow() == _root;
+ assert _splay == null;
+ assert _parent == null;
+ assert _next == null && _prev == null;
+
+ if (s._goobers == null)
+ {
+ s._goobers = this;
+ _next = _prev = this;
+ }
+ else
+ {
+ _next = s._goobers;
+ _prev = _next._prev;
+ _next._prev = this;
+ _prev._next = this;
+ }
+
+ _splay = s;
+ _parent = s;
+ }
+
+ private final void remove ( )
+ {
+ assert _splay != null;
+ assert _goobers == null;
+
+ if (_next == this)
+ {
+ assert _parent._goobers == this;
+
+ _parent._goobers = null;
+
+ // If parent is an aggregate goober, remove it too
+
+ if (_parent != _splay)
+ {
+ Goober g = (Goober) _parent;
+ assert g.getKind() == AGGREGATE;
+ g.remove();
+ }
+ }
+ else
+ {
+ _prev._next = _next;
+ _next._prev = _prev;
+
+ if (_parent._goobers == this)
+ _parent._goobers = _next;
+ }
+
+ _next = _prev = null;
+
+ _parent = null;
+ _splay = null;
+ }
+
+ XmlBookmark getBookmark ( )
+ {
+ return
+ getKind() == ANNOTATION
+ ? ((Annotation) this).getXmlBookmark()
+ : null;
+ }
+
+ String getKindName ( )
+ {
+ switch ( getKind() )
+ {
+ case CURSOR : return "CURSOR";
+ case TYPE : return "TYPE";
+ case ANNOTATION : return "ANNOTATION";
+ default : return "<unknow goober kind>";
+ }
+ }
+
+ private Root _root;
+
+ private Splay _splay;
+
+ private int _state; // pos and kind
+
+ Goober _next;
+ Goober _prev;
+ Goobers _parent;
+ }
+
+ static final class CursorGoober extends Goober
+ {
+ CursorGoober ( Root r )
+ {
+ super( r, CURSOR );
+ }
+
+ private static final HashMap createDebugIdMap ( )
+ {
+ // Creepy way to discover is assert is enabled.
+ HashMap map = null;
+ assert (map = new HashMap()) != null;
+ return map;
+ }
+
+ public int getDebugId ( )
+ {
+ if (_debugIds == null)
+ return -1;
+
+ synchronized ( _debugIds )
+ {
+ if (!_debugIds.containsKey( this ))
+ _debugIds.put( this, new Integer( _nextDebugId++ ) );
+
+ return ((Integer) _debugIds.get( this )).intValue();
+ }
+ }
+
+ private static final HashMap _debugIds = createDebugIdMap();
+ private static int _nextDebugId = 1;
+ }
+
+ static class Annotation extends Goober implements XmlMark
+ {
+ public Object monitor()
+ {
+ return getRoot();
+ }
+
+ Annotation ( Root r )
+ {
+ super( r, ANNOTATION );
+ }
+
+ Annotation ( Root r, XmlBookmark a )
+ {
+ this( r );
+
+ if (a._ref == null)
+ _annotation = a;
+ else
+ _ref = a._ref;
+
+ _key = a.getKey();
+ }
+
+ void setKey ( Object key )
+ {
+ _key = key;
+ }
+
+ // called via bookmark (public via XmlMark)
+ public final XmlCursor createCursor ( )
+ {
+ synchronized (monitor())
+ {
+ if (getSplay() == null)
+ {
+ throw new IllegalStateException(
+ "Attempting to create a cursor on a bookmark that " +
+ "has been cleared or replaced.");
+ }
+
+ return new Cursor( getRoot(), getSplay(), getPos() );
+ }
+ }
+
+ public XmlBookmark getXmlBookmark ( )
+ {
+ if (_annotation != null)
+ return _annotation;
+
+ if (_ref != null)
+ return (XmlBookmark) _ref.get();
+
+ return null;
+ }
+
+ void disconnect ( Root r )
+ {
+ super.disconnect( r );
+
+ XmlBookmark xa = getXmlBookmark();
+
+ if (xa != null)
+ xa._currentMark = null;
+ }
+
+ XmlBookmark _annotation;
+ Reference _ref;
+
+ Object _key;
+ }
+
+ final Goober firstGoober ( )
+ {
+ if (_goobers == null || _goobers.getKind() != AGGREGATE)
+ return _goobers;
+
+ assert _goobers._goobers != null;
+ assert _goobers._goobers.getKind() != AGGREGATE;
+
+ return _goobers._goobers;
+ }
+
+ final Goober nextGoober ( Goober g )
+ {
+ assert g != null;
+
+ if ((g = g._next) != g._parent._goobers)
+ return g;
+
+ return g._parent == g._splay ? null : nextGoober( (Goober) g._parent );
+ }
+
+ static final boolean _assertEnabled = getAssertEnabled();
+
+ private static boolean getAssertEnabled ( )
+ {
+ // Creepy way to discover is assert is enabled.
+ boolean enabled = false;
+ assert (enabled = true) || true;
+ return enabled;
+ }
+
+ static void assertAssertEnabled ( )
+ {
+ if (!_assertEnabled)
+ {
+ throw
+ new RuntimeException(
+ "Assert needs to be enabled for this operation" );
+ }
+ }
+
+ // Associate id's with splays when asserts are enabled
+
+ private static final HashMap _debugIds =
+ _assertEnabled ? new HashMap() : null;
+
+ private static int _nextDebugId = 1;
+
+ public int getDebugId ( )
+ {
+ if (_debugIds == null)
+ return -1;
+
+ synchronized ( _debugIds )
+ {
+ if (!_debugIds.containsKey( this ))
+ _debugIds.put( this, new Integer( _nextDebugId++ ) );
+
+ return ((Integer) _debugIds.get( this )).intValue();
+ }
+ }
+
+ void dump ( ) { getRootSlow().dump(); }
+ void dump ( boolean verbose ) { getRootSlow().dump( verbose ); }
+
+ public Splay getSplayRootSlow ( )
+ {
+ assertAssertEnabled();
+
+ Splay s = this;
+
+ while ( s._parentSplay != null )
+ s = s._parentSplay;
+
+ return s;
+ }
+
+ public Root getRootSlow ( )
+ {
+ assertAssertEnabled();
+
+ Splay s = getSplayRootSlow();
+
+ return s.isRoot() ? (Root) s : null;
+ }
+
+ int getCpSlow ( )
+ {
+ assertAssertEnabled();
+
+ int cch = 0;
+
+ for ( Splay s = this ; (s = s.prevSplay()) != null ; )
+ cch += s.getCch();
+
+ return cch;
+ }
+
+ int compareSlow ( Splay sThat )
+ {
+ assertAssertEnabled();
+
+ assert Root.dv > 0 || getRootSlow() == sThat.getRootSlow();
+
+ if (this == sThat)
+ return 0;
+
+ for ( Splay s = this ; s != null ; s = s.nextSplay() )
+ if (s == sThat)
+ return -1;
+
+ for ( Splay s = this ; s != null ; s = s.prevSplay() )
+ if (s == sThat)
+ return 1;
+
+ assert false: "Yikes!";
+
+ return 0;
+ }
+
+ boolean validate ( )
+ {
+ assertAssertEnabled();
+
+ return getRootSlow().validate();
+ }
+
+ //
+ // Document splay tree members
+ //
+
+ Splay _leftSplay;
+ Splay _rightSplay;
+ Splay _parentSplay;
+
+ private int _bits; // 27: cDocbeginLeft, 1: invalid, 1: multi, 3: kind
+ private int _cch;
+ private int _cchAfter;
+ private int _cchLeft;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Text.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Text.java
new file mode 100644
index 0000000..c4744b2
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Text.java
@@ -0,0 +1,309 @@
+/* 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.xmlbeans.impl.store;
+
+//import org.apache.xmlbeans.impl.store.Root.WriteContext;
+//import org.apache.xmlbeans.impl.store.Root.ReadContext;
+import java.io.IOException;
+
+public final class Text
+{
+ char[] _buf;
+ int _gap; // Where the gap starts
+ int _gapLen; // The length of the gap
+
+ int length ( )
+ {
+ return bufLen() - _gapLen;
+ }
+
+ private int bufLen ( )
+ {
+ return _buf == null ? 0 : _buf.length;
+ }
+
+ private void copy ( char[] newBuf )
+ {
+ assert _buf != null && newBuf.length >= length();
+
+ System.arraycopy( _buf, 0, newBuf, 0, _gap );
+
+ int lenAfterGap = _buf.length - _gap - _gapLen;
+
+ System.arraycopy(
+ _buf, _gap + _gapLen,
+ newBuf, newBuf.length - (lenAfterGap), lenAfterGap );
+ }
+
+ void resize ( int cch )
+ {
+ assert cch > _gapLen;
+
+ int newSize = length() + cch;
+ int newLen = _buf == null ? 1024 : _buf.length * 2;
+
+ while ( newLen < newSize )
+ newLen *= 2;
+
+ char[] newBuf = new char [ newLen ];
+
+ if (_buf != null)
+ {
+ copy( newBuf );
+ _gapLen += newBuf.length - _buf.length;
+ }
+ else
+ _gapLen += newBuf.length;
+
+ _buf = newBuf;
+ }
+
+ void trim ( )
+ {
+ if (_buf != null && _gapLen != 0)
+ {
+ char[] newBuf = new char [ length() ];
+
+ copy( newBuf );
+
+ _buf = newBuf;
+ _gap = 0;
+ _gapLen = 0;
+ }
+ }
+
+ void move ( int pos, Text src, int srcPos, int cch )
+ {
+ insert( pos, src, srcPos, cch );
+
+ if (src == this && srcPos >= pos)
+ srcPos += cch;
+
+ src.remove( srcPos, cch );
+ }
+
+ void insert ( int pos, Object txt, int off, int cch )
+ {
+ if (txt != null)
+ {
+ if (txt instanceof String)
+ insert( pos, (String) txt, off, cch );
+ else if (txt instanceof Text)
+ insert( pos, (Text) txt, off, cch );
+ else
+ {
+ assert txt instanceof char[];
+ insert( pos, (char[]) txt, off, cch );
+ }
+ }
+ }
+
+ void insert ( int pos, Text src, int srcPos, int cch )
+ {
+ //
+ // This can deal with copying from itself
+ //
+
+ if (cch > 0)
+ {
+ if (cch > _gapLen)
+ resize( cch );
+
+ moveGap( pos );
+
+ if (srcPos + cch < src._gap)
+ System.arraycopy( src._buf, srcPos, _buf, _gap, cch );
+ else if (srcPos >= src._gap)
+ {
+ System.arraycopy(
+ src._buf, srcPos + src._gapLen, _buf, _gap, cch );
+ }
+ else
+ {
+ int leftLen = src._gap - srcPos;
+
+ System.arraycopy( src._buf, srcPos, _buf, _gap, leftLen );
+
+ System.arraycopy(
+ src._buf, src._gap + src._gapLen,
+ _buf, _gap + leftLen, cch - leftLen );
+ }
+
+ _gap += cch;
+ _gapLen -= cch;
+ }
+ }
+
+ void insert ( int pos, char[] chars, int off, int cch )
+ {
+ assert chars != _buf;
+ assert pos >= 0 && pos <= length();
+
+ if (cch > 0)
+ {
+ if (cch > _gapLen)
+ resize( cch );
+
+ moveGap( pos );
+
+ System.arraycopy( chars, off, _buf, _gap, cch );
+
+ _gap += cch;
+ _gapLen -= cch;
+ }
+ }
+
+ void insert ( int pos, String s )
+ {
+ insert( pos, s, 0, s.length() );
+ }
+
+ void insert ( int pos, String s, int off, int cch )
+ {
+ assert pos >= 0 && pos <= length();
+
+ if (cch > 0)
+ {
+ assert off >= 0 && off < s.length();
+ assert cch <= s.length() - off;
+
+ if (cch > _gapLen)
+ resize( cch );
+
+ moveGap( pos );
+
+ s.getChars( off, off + cch, _buf, _gap );
+
+ _gap += cch;
+ _gapLen -= cch;
+ }
+ }
+
+ void remove ( int pos, int cch )
+ {
+ remove( pos, cch, null, 0 );
+ }
+
+ void remove ( int pos, int cch, char[] retBuf, int off )
+ {
+ assert pos >= 0 && pos + cch <= length();
+
+ moveGap( pos );
+
+ assert retBuf == null || retBuf.length - off >= cch;
+
+ if (cch > 0 && retBuf != null)
+ System.arraycopy( _buf, _gap + _gapLen, retBuf, off, cch );
+
+ _gapLen += cch;
+ }
+
+ void moveGap( int pos )
+ {
+ if (pos < _gap)
+ System.arraycopy( _buf, pos, _buf, pos + _gapLen, _gap - pos );
+ else if (pos > _gap)
+ System.arraycopy( _buf, _gap + _gapLen, _buf, _gap, pos - _gap);
+
+ _gap = pos;
+ }
+
+ int unObscure ( int pos, int cch )
+ {
+ assert cch >= 0;
+ assert pos >= 0 && pos + cch <= length();
+
+ if (cch > 0 && (pos < _gap && pos + cch > _gap))
+ moveGap( pos + cch );
+
+ return pos < _gap ? pos : pos + _gapLen;
+ }
+
+ void fetch ( StringBuffer sb, int pos, int cch )
+ {
+ assert pos >= 0 && pos + cch <= length();
+
+ if (cch == 0)
+ return;
+
+ if (pos + cch <= _gap)
+ {
+ sb.append( _buf, pos, cch );
+ }
+ else
+ {
+ if (pos >= _gap)
+ {
+ sb.append( _buf, pos + _gapLen, cch );
+ }
+ else
+ {
+ sb.append( _buf, pos, _gap - pos );
+ sb.append( _buf, _gap + _gapLen, cch - _gap + pos );
+ }
+ }
+ }
+
+ String fetch ( int pos, int cch )
+ {
+ assert pos >= 0 && pos + cch <= length();
+
+ if (cch == 0)
+ return "";
+
+ if (pos + cch <= _gap)
+ return new String( _buf, pos, cch );
+
+ if (pos >= _gap)
+ return new String( _buf, pos + _gapLen, cch );
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( _buf, pos, _gap - pos );
+ sb.append( _buf, _gap + _gapLen, cch - _gap + pos );
+
+ return sb.toString();
+ }
+
+ void fetch ( char[] buf, int off, int pos, int cch )
+ {
+ assert off >= 0;
+ assert pos >= 0 && pos + cch <= length();
+ assert buf.length - off >= cch;
+
+ if (cch == 0)
+ return;
+
+ if (pos + cch <= _gap)
+ System.arraycopy( _buf, pos, buf, off, cch );
+ else if (pos >= _gap)
+ System.arraycopy( _buf, pos + _gapLen, buf, off, cch );
+ else
+ {
+ int chunk = _gap - pos;
+
+ System.arraycopy( _buf, pos, buf, off, chunk );
+
+ System.arraycopy(
+ _buf, _gap + _gapLen, buf, off + chunk, cch - chunk );
+ }
+ }
+
+ public String toString ( )
+ {
+ return fetch( 0, length() );
+ }
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Type.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Type.java
new file mode 100644
index 0000000..7535d7d
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/Type.java
@@ -0,0 +1,1039 @@
+/* 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.xmlbeans.impl.store;
+
+import org.apache.xmlbeans.impl.common.ValidatorListener;
+import org.apache.xmlbeans.impl.store.Splay.Attr;
+import org.apache.xmlbeans.impl.store.Splay.Begin;
+import org.apache.xmlbeans.impl.store.Splay.Container;
+import org.apache.xmlbeans.impl.store.Splay.CopyContext;
+import org.apache.xmlbeans.impl.store.Splay.Goober;
+import org.apache.xmlbeans.impl.values.NamespaceManager;
+import org.apache.xmlbeans.impl.values.TypeStore;
+import org.apache.xmlbeans.impl.values.TypeStoreUser;
+import org.apache.xmlbeans.impl.values.TypeStoreUserFactory;
+import org.apache.xmlbeans.impl.values.TypeStoreVisitor;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.SchemaField;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+public final class Type extends Goober implements TypeStore
+{
+ Type ( Root r, SchemaType sType, Splay s )
+ {
+ this( r, ((TypeStoreUserFactory) sType).createTypeStoreUser(), s );
+ }
+
+ Type ( Root r, TypeStoreUser user, Splay s )
+ {
+ super( r, Splay.TYPE );
+
+ assert s.peekType() == null;
+ assert user != null;
+ assert s.isTypeable();
+
+ _user = user;
+
+ set( s, 0 );
+
+ if (user.uses_invalidate_value())
+ r._cInvalidatableTypes++;
+
+ if (user.is_child_element_order_sensitive())
+ r._cElemOrderSensitiveTypes++;
+
+ user.attach_store( this );
+ }
+
+ void disconnect ( Root r )
+ {
+ super.disconnect( r );
+
+ if (_user.uses_invalidate_value())
+ r._cInvalidatableTypes--;
+
+ if (_user.is_child_element_order_sensitive())
+ r._cElemOrderSensitiveTypes--;
+
+ _user.disconnect_store();
+ }
+
+ //
+ //
+ //
+
+ SchemaType get_schema_type ( )
+ {
+ return _user.get_schema_type();
+ }
+
+ SchemaType get_element_type ( QName eltName, QName xsiType )
+ {
+ return _user.get_element_type( eltName, xsiType );
+ }
+
+ SchemaType get_attribute_type ( QName attrName )
+ {
+ return _user.get_attribute_type( attrName );
+ }
+
+ TypeStoreUser create_element_user ( QName eltName, QName xsiType )
+ {
+ TypeStoreUser ret = null;
+ if (getRoot()._factory != null)
+ ret = getRoot()._factory.createElementUser(get_schema_type(), eltName, xsiType);
+
+ if (ret == null)
+ ret = _user.create_element_user( eltName, xsiType );
+
+ return ret;
+ }
+
+ TypeStoreUser create_attribute_user( QName attrName )
+ {
+ TypeStoreUser ret = null;
+
+ if (getRoot()._factory != null)
+ ret = getRoot()._factory.createAttributeUser(get_schema_type(), attrName);
+
+ if (ret == null)
+ ret = _user.create_attribute_user( attrName );
+
+ return ret;
+ }
+
+ XmlObject getXmlObject ( )
+ {
+ return (XmlObject) _user;
+ }
+
+ boolean uses_invalidate_value ( )
+ {
+ return _user.uses_invalidate_value();
+ }
+
+ boolean is_child_element_order_sensitive ( )
+ {
+ return _user.is_child_element_order_sensitive();
+ }
+
+ void invalidateText ( )
+ {
+ if (_inhibitUserInvalidate == 0)
+ _user.invalidate_value();
+ }
+
+ void invalidateNil ( )
+ {
+ if (_inhibitUserInvalidate == 0)
+ _user.invalidate_nilvalue();
+ }
+
+ void invalidateElement ( Container container, Splay s )
+ {
+ assert s.getContainer() == container;
+
+ if (_inhibitUserInvalidate > 0)
+ return;
+
+ Type containerType = container.peekType();
+
+ if (containerType == null)
+ return;
+
+ if (!containerType.is_child_element_order_sensitive())
+ return;
+
+ containerType._user.invalidate_value();
+
+ for ( ; ; s = s.nextSplay() )
+ {
+ if (s.isFinish())
+ {
+ assert s.getContainer() == container;
+ return;
+ }
+
+ if (s.isBegin())
+ {
+ Type childType = s.peekType();
+
+ if (childType != null)
+ childType._user.invalidate_element_order();
+
+ s = s.getFinishSplay();
+ }
+
+ break;
+ }
+ }
+
+ String build_text ( NamespaceManager nsm )
+ {
+ return _user.build_text( nsm );
+ }
+
+ boolean build_nil ( )
+ {
+ return _user.build_nil();
+ }
+
+ int validateContent ( Splay s, NamespaceManager nsm )
+ {
+ Root r = getRoot();
+
+ assert s.isInvalid();
+ assert s.isLeaf() || s.isDoc();
+
+ String text = build_text( nsm );
+
+ assert text != null;
+
+ _inhibitUserInvalidate++;
+
+ // Validating does not logically change the doc
+ long oldVersion = r.getVersion();
+
+ s.toggleIsInvalid(); // Prevents infinite recursion
+
+ s.insertChars( 1, r, text, 0, text.length() );
+
+ r.restoreVersion( oldVersion );
+
+ _inhibitUserInvalidate--;
+
+ return text.length();
+ }
+
+ void validateValue ( Splay s, NamespaceManager nsm )
+ {
+ Root r = getRoot();
+
+ assert s.isInvalid();
+ assert s.isNormalAttr();
+
+ String text = build_text( nsm );
+
+ assert text != null;
+
+ // Validating does not logically change the doc
+ long oldVersion = r.getVersion();
+
+ _inhibitUserInvalidate++;
+
+ s.toggleIsInvalid(); // Prevents infinite recursion
+
+ s.setText( r, text, 0, text.length() );
+
+ r.restoreVersion( oldVersion );
+
+ _inhibitUserInvalidate--;
+ }
+
+ QNameSet get_element_ending_delimiters( QName qname )
+ {
+ return _user.get_element_ending_delimiters( qname );
+ }
+
+ //
+ //
+ //
+
+ public boolean is_attribute ( )
+ {
+ return getSplay().isAttr();
+ }
+
+ public boolean validate_on_set()
+ {
+ return getRoot().validateOnSet();
+ }
+
+ public XmlCursor new_cursor ( )
+ {
+ return new Cursor( getRoot(), getSplay() );
+ }
+
+ public void validate ( ValidatorListener vEventSink )
+ {
+ new Saver.ValidatorSaver( getRoot(), getSplay(), 0, null, vEventSink );
+ }
+
+ public SchemaTypeLoader get_schematypeloader ( )
+ {
+ return getRoot().getSchemaTypeLoader();
+ }
+
+ public QName get_xsi_type ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer() || s.isNormalAttr();
+
+ if (s.isNormalAttr())
+ return null;
+
+ return s.getXsiTypeName( getRoot() );
+ }
+
+ public TypeStoreUser change_type ( SchemaType sType )
+ {
+ Splay s = getSplay();
+
+ s.setType( getRoot(), sType, false );
+
+ Type t = s.getType( getRoot() );
+
+ assert t != null;
+
+ return t._user;
+ }
+
+ public void invalidate_text ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ if (s.isInvalid())
+ return;
+
+ _inhibitUserInvalidate++;
+
+ s.removeContent( getRoot(), false );
+
+ s.toggleIsInvalid();
+ assert s.isInvalid();
+
+ _inhibitUserInvalidate--;
+ }
+
+ public String fetch_text ( int whitespaceRule )
+ {
+ Splay s = getSplay();
+
+ assert !s.isInvalid();
+
+ if (s.isInvalid())
+ throw new RuntimeException( "Can't fetch text when invalid" );
+
+ return s.getText( getRoot(), whitespaceRule );
+ }
+
+ public void store_text ( String text )
+ {
+ _inhibitUserInvalidate++;
+ getSplay().setText( getRoot(), text, 0, text.length() );
+ _inhibitUserInvalidate--;
+ }
+
+ public int compute_flags ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ if (s.isDoc())
+ return 0;
+
+ Container parentContainer = s.getContainer();
+
+ Type parentType = parentContainer.getType( getRoot() );
+
+ assert parentType != null;
+
+ TypeStoreUser parentUser = parentType._user;
+
+ if (s.isAttr())
+ return parentUser.get_attributeflags( s.getName() );
+
+ int f = parentUser.get_elementflags( s.getName() );
+
+ if (f != -1)
+ return f;
+
+ TypeStoreVisitor visitor = parentUser.new_visitor();
+
+ if (visitor == null)
+ return 0;
+
+ assert !parentContainer.isLeaf();
+
+ for ( Splay t = parentContainer.nextSplay() ; ; t = t.nextSplay() )
+ {
+ switch ( t.getKind() )
+ {
+ case Splay.END :
+ assert false;
+ break;
+
+ case Splay.BEGIN :
+ visitor.visit( t.getName() );
+
+ if (t == s)
+ return visitor.get_elementflags();
+
+ t = t.getFinishSplay();
+
+ break;
+ }
+ }
+ }
+
+ public SchemaField get_schema_field ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ if (s.isDoc())
+ return null;
+
+ Container parentContainer = s.getContainer();
+
+ TypeStoreUser parentUser = parentContainer.getType( getRoot() )._user;
+
+ if (s.isAttr())
+ return parentUser.get_attribute_field( s.getName() );
+
+ assert s.isBegin();
+
+ assert !parentContainer.isLeaf();
+
+ TypeStoreVisitor visitor = parentUser.new_visitor();
+
+ if (visitor == null)
+ return null;
+
+ for ( Splay t = parentContainer.nextSplay() ; ; t = t.nextSplay() )
+ {
+ switch ( t.getKind() )
+ {
+ case Splay.END :
+ assert false;
+ break;
+
+ case Splay.BEGIN :
+ visitor.visit( t.getName() );
+
+ if (t == s)
+ return visitor.get_schema_field();
+
+ t = t.getFinishSplay();
+
+ break;
+ }
+ }
+ }
+
+ public int count_elements ( QName name )
+ {
+ return getRoot().count( (Container) getSplay(), name, null );
+ }
+
+ public int count_elements(QNameSet names)
+ {
+ return getRoot().count((Container)getSplay(), null, names);
+ }
+
+ public TypeStoreUser find_element_user ( QName name, int i )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ Begin nthBegin = getRoot().findNthBegin( s, name, null, i );
+
+ if (nthBegin == null)
+ return null;
+
+ Type t = nthBegin.getType( getRoot() );
+
+ assert t != null;
+
+ return t._user;
+ }
+
+ public TypeStoreUser find_element_user ( QNameSet names, int i )
+ {
+ Splay s = getSplay();
+ assert s.isContainer();
+
+ Begin nthBegin = getRoot().findNthBegin(s, null, names, i);
+ if (nthBegin == null) return null;
+
+ Type t = nthBegin.getType(getRoot());
+ assert t != null;
+
+ return t._user;
+ }
+
+ private void findAllElementTypes ( QName name, QNameSet set, List fillMeUp )
+ {
+ assert getSplay().isContainer();
+
+ Splay s = getSplay();
+
+ if (s.isLeaf())
+ return;
+
+ loop:
+ for ( s = s.nextSplay() ; ; s = s.nextSplay() )
+ {
+ switch ( s.getKind() )
+ {
+ case Splay.END :
+ case Splay.ROOT :
+ {
+ break loop;
+ }
+ case Splay.BEGIN :
+ {
+ if (set == null)
+ {
+ if (s.getName().equals( name ))
+ {
+ Type type = s.getType( getRoot() );
+
+ assert type != null;
+
+ fillMeUp.add( type );
+ }
+ }
+ else
+ {
+ if (set.contains(s.getName()))
+ {
+ Type type = s.getType(getRoot());
+ assert type != null;
+ fillMeUp.add(type);
+ }
+ }
+
+ s = s.getFinishSplay();
+ break;
+ }
+ }
+ }
+ }
+
+ public void find_all_element_users ( QName name, List fillMeUp )
+ {
+ int i = fillMeUp.size();
+
+ findAllElementTypes( name, null, fillMeUp );
+
+ for ( int j = i ; j < fillMeUp.size() ; j++ )
+ fillMeUp.set( j, ((Type) fillMeUp.get( j ))._user );
+ }
+
+ public void find_all_element_users (QNameSet names, List fillMeUp)
+ {
+ int i = fillMeUp.size();
+ findAllElementTypes(null, names, fillMeUp);
+
+ for ( int j = i ; j < fillMeUp.size() ; j++ )
+ fillMeUp.set( j, ((Type) fillMeUp.get( j ))._user );
+ }
+
+ public TypeStoreUser find_attribute_user ( QName name )
+ {
+ assert getSplay().isContainer();
+
+ Splay a = getSplay().getAttr( name );
+
+ if (a == null)
+ return null;
+
+ Type t = a.getType( getRoot() );
+
+ assert t != null;
+
+ return t._user;
+ }
+
+ public String compute_default_text ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ if (s.isDoc())
+ return null;
+
+ Container parentContainer = s.getContainer();
+
+ Type parentType = parentContainer.getType( getRoot() );
+
+ assert parentType != null;
+
+ TypeStoreUser parentUser = parentType._user;
+
+ if (s.isAttr())
+ return parentUser.get_default_attribute_text( s.getName() );
+
+ String result = parentUser.get_default_element_text( s.getName() );
+
+ if (result != null)
+ return result;
+
+ TypeStoreVisitor visitor = parentUser.new_visitor();
+
+ if (visitor == null)
+ return null;
+
+ assert !parentContainer.isLeaf();
+
+ for ( Splay t = parentContainer.nextSplay() ; ; t = t.nextSplay() )
+ {
+ switch ( t.getKind() )
+ {
+ case Splay.END :
+ assert false;
+ break;
+
+ case Splay.BEGIN :
+ visitor.visit( t.getName() );
+
+ if (t == s)
+ return visitor.get_default_text();
+
+ t = t.getFinishSplay();
+
+ break;
+ }
+ }
+ }
+
+ public void invalidate_nil ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ if (!s.isAttr())
+ s.setXsiNil( getRoot(), build_nil() );
+ }
+
+ public boolean find_nil ( )
+ {
+ Splay s = getSplay();
+
+ assert s.isTypeable();
+
+ return s.isAttr() ? false : s.getXsiNil( getRoot() );
+ }
+
+ public String find_prefix_for_nsuri (
+ String nsuri, String suggested_prefix )
+ {
+ Splay s = getSplay();
+
+ if (s.isAttr())
+ s = s.getContainer();
+
+ String result = s.prefixForNamespace( getRoot(), nsuri, suggested_prefix, true);
+
+ assert result != null;
+
+ return result;
+ }
+
+ public String getNamespaceForPrefix ( String prefix )
+ {
+ Splay s = getSplay();
+
+ if (s.isAttr())
+ s = s.getContainer();
+
+ return s.namespaceForPrefix( prefix, true );
+ }
+
+ public TypeStoreUser insert_element_user ( QName name, int i )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ if (i < 0)
+ throw new IndexOutOfBoundsException();
+
+ Root r = getRoot();
+ Container c = (Container) s;
+
+ Begin nthBegin = r.findNthBegin( c, name, null, i );
+
+ if (nthBegin == null)
+ {
+ if (i > r.count( c, name, null ) + 1)
+ throw new IndexOutOfBoundsException();
+
+ return add_element_user( name );
+ }
+
+ return insertElement( name, nthBegin, 0 );
+ }
+
+ public TypeStoreUser insert_element_user(QNameSet set, QName name, int i)
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ if (i < 0)
+ throw new IllegalStateException();
+
+ Root r = getRoot();
+ Container c = (Splay.Container) s;
+
+ Begin nthBegin = r.findNthBegin(c, null, set, i);
+
+ if (nthBegin == null)
+ {
+ if (i > r.count(c, null, set))
+ throw new IndexOutOfBoundsException();
+
+ return add_element_user(name);
+ }
+
+ return insertElement(name, nthBegin, 0);
+ }
+
+// TODO - consolidate names, this fcn is very expensive in creating names
+ public TypeStoreUser add_element_user ( QName qname )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ Splay candidateSplay;
+ int candidatePos;
+
+ if (s.isLeaf())
+ {
+ candidateSplay = s;
+ candidatePos = s.getPosLeafEnd();
+ }
+ else
+ {
+ candidateSplay = s.getFinishSplay();
+ candidatePos = 0;
+
+ QNameSet endSet = null;
+
+ loop:
+ for ( Splay t = candidateSplay ; ; )
+ {
+ for ( ; ; )
+ {
+ t = t.prevSplay();
+
+ if (t == s)
+ break loop;
+
+ if (t.isContainer())
+ break;
+
+ if (t.isEnd())
+ {
+ t = t.getContainer();
+ break;
+ }
+ }
+
+ assert t.isContainer();
+
+ if (t.getName().equals( qname ))
+ break;
+
+ if (endSet == null)
+ endSet = get_element_ending_delimiters( qname );
+
+ if (endSet.contains( t.getName() ))
+ candidateSplay = t;
+ }
+ }
+
+ return insertElement( qname, candidateSplay, candidatePos );
+ }
+
+ private TypeStoreUser insertElement ( QName name, Splay s, int p )
+ {
+ Root r = getRoot();
+
+ Begin b = new Begin( name, null );
+ b.toggleIsLeaf();
+
+ s.insert( r, p, b, null, 0, 0, true );
+
+ Type t = b.getType( r );
+
+ assert t != null;
+
+ return t._user;
+ }
+
+ public void remove_element ( QName qname, int i )
+ {
+ if (i < 0)
+ throw new IndexOutOfBoundsException();
+
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ if (s.isLeaf())
+ throw new IndexOutOfBoundsException();
+
+ Begin b = getRoot().findNthBegin( s, qname, null, i );
+
+ if (b == null)
+ throw new IndexOutOfBoundsException();
+
+ b.remove( getRoot(), true );
+ }
+
+ public void remove_element(QNameSet names, int i)
+ {
+ if (i < 0)
+ throw new IndexOutOfBoundsException();
+
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ if (s.isLeaf())
+ throw new IndexOutOfBoundsException();
+
+ Begin b = getRoot().findNthBegin(s, null, names, i);
+
+ if (b == null)
+ throw new IndexOutOfBoundsException();
+
+ b.remove(getRoot(), true);
+
+ }
+
+ public TypeStoreUser add_attribute_user ( QName qname )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ Splay a = s.getAttr( qname );
+
+ if (a != null)
+ throw new IndexOutOfBoundsException();
+
+ s.nextSplay().insert(
+ getRoot(), 0, a = new Attr( qname ), null, 0, 0, true );
+
+ Type t = a.getType( getRoot() );
+
+ assert t != null;
+
+ return t._user;
+ }
+
+ public void remove_attribute ( QName qname )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ Splay a = s.getAttr( qname );
+
+ if (a == null)
+ throw new IndexOutOfBoundsException();
+
+ a.remove( getRoot(), true );
+ }
+
+ public TypeStoreUser copy_contents_from ( TypeStore source )
+ {
+ assert source instanceof Type;
+
+ Type sourceType = (Type) source;
+
+ Splay s = getSplay();
+
+ s.replaceContents( getRoot(), sourceType.getSplay(), sourceType.getRoot(), true, true );
+
+ return s.getType( getRoot() )._user;
+ }
+
+ public void array_setter ( XmlObject[] sources, QName elementName )
+ {
+ // TODO - this is the quick and dirty implementation, make this faster
+
+ int m = sources.length;
+
+ ArrayList copies = new ArrayList();
+ ArrayList types = new ArrayList();
+
+ for ( int i = 0 ; i < m ; i++ )
+ {
+// TODO - deal with null sources[ i ] here -- what to do?
+
+ if (sources[ i ] == null)
+ throw new IllegalArgumentException( "Array element null" );
+
+ else if (sources[ i ].isImmutable())
+ {
+ copies.add( null );
+ types.add( null );
+ }
+ else
+ {
+ Type type = (Type) ((TypeStoreUser) sources[ i ]).get_store();
+
+ copies.add( type.getSplay().copySplayContents( type.getRoot()));
+
+ types.add( sources[ i ].schemaType() );
+ }
+ }
+
+ int n = count_elements( elementName );
+
+ for ( ; n > m ; n-- )
+ remove_element( elementName, m );
+
+ for ( ; m > n ; n++ )
+ add_element_user( elementName );
+
+ assert m == n;
+
+ ArrayList elements = new ArrayList();
+
+ findAllElementTypes( elementName, null, elements );
+
+ Root r = getRoot();
+
+ assert elements.size() == n;
+
+ for ( int i = 0 ; i < n ; i++ )
+ {
+ Type type = (Type) elements.get( i );
+
+ if (sources[ i ].isImmutable())
+ type.getXmlObject().set( sources[ i ] );
+ else
+ {
+ Splay s = type.getSplay();
+
+ assert r == type.getRoot();
+
+ assert s.isContainer();
+
+ s.removeContent( r, true );
+
+ CopyContext copyContext = (CopyContext) copies.get( i );
+
+ Splay copyTree = copyContext.getTree();
+
+ if (copyTree != null)
+ {
+ char[] textCopy = copyContext.getText();
+
+ s.insert(
+ r, 1, copyTree, textCopy, 0, textCopy == null ? 0 : textCopy.length, true );
+ }
+
+ type.change_type( (SchemaType) types.get( i ) );
+ }
+ }
+ }
+
+ public void visit_elements ( TypeStoreVisitor visitor )
+ {
+ Splay s = getSplay();
+
+ assert s.isContainer();
+
+ if (!s.isContainer())
+ throw new IllegalStateException();
+
+ if (s.isLeaf())
+ return;
+
+ for ( s = s.nextSplay() ; ; s = s.nextSplay() )
+ {
+ switch ( s.getKind() )
+ {
+ case Splay.END :
+ break;
+
+ case Splay.BEGIN :
+ visitor.visit( s.getName() );
+ s = s.getFinishSplay();
+ break;
+ }
+ }
+ }
+
+ public XmlObject[] exec_query ( String queryExpr, XmlOptions options )
+ throws XmlException
+ {
+ return Path.query( this, queryExpr, options );
+ }
+
+ //
+ //
+ //
+
+ /**
+ * Returns the monitor object, used for synchronizing access to the doc.
+ */
+ public Object get_root_object()
+ {
+ return getRoot();
+ }
+
+ private final TypeStoreUser _user;
+ private int _inhibitUserInvalidate;
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XmlObjectList.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XmlObjectList.java
new file mode 100644
index 0000000..f322326
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XmlObjectList.java
@@ -0,0 +1,174 @@
+/* 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.xmlbeans.impl.store;
+
+// BUGBUG: ***TLL*** Why isn't this exposed in org.apache.xmlbeans????
+
+import org.apache.xmlbeans.XmlObject;
+import java.util.Iterator;
+
+
+/**
+ * Interface to represent lists of XmlObject instances returned
+ * from a query. Used also as a convenient typed way of collecting
+ * XmlObject instances.
+ */
+public interface XmlObjectList {
+
+ /**
+ * Adds a XmlObject to the end of the list.
+ *
+ * @param xml the XmlObject instance to add to the list
+ */
+ void add(XmlObject xml);
+
+ /**
+ * Appends the contents of another list to this list.
+ *
+ * @param xmlList the list which is to be appended to this list.
+ */
+ void addAll(XmlObjectList xmlList);
+
+ /**
+ * Appends an array of XmlObject instances to this list.
+ *
+ * @param xmlArray the array which is to be appended to this list.
+ */
+ void addAll(XmlObject[] xmlArray);
+
+ /**
+ * Clears out the contents of this list. After this operation,
+ * {@link #isEmpty() isEmpty()} will return <code>true</code>.
+ */
+ void clear();
+
+ /**
+ * Gets the XmlObject at a specified position in the list.
+ *
+ * @param index the specified position
+ * @return the XmlObject at the position in this list.
+ *
+ * @throws IndexOutOfBoundsException if
+ * <code>(index < 0) || (index >= size())</code>
+ */
+ XmlObject get(int index);
+
+ /**
+ * Tests if this XmlList is empty. This is equivalent to
+ * <code>{@link #size() size()} == 0</code>.
+ *
+ * @return boolean indicating if this list is empty.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns an Iterator over all the XmlObject instances contained in this
+ * list. This iterator will throw an UnsupportedOperationException in
+ * response to its remove method.
+ *
+ * @return Iterator over the contents of this list
+ */
+ Iterator iterator();
+
+ /**
+ * Returns the number of XmlObject instances contained in this list.
+ *
+ * @return int size of the list.
+ */
+ int size();
+
+ /**
+ * Returns a copy of the contents of the XmlList in a newly created array of
+ * XmlObjects.
+ *
+ * @return array of XmlObject instances which is a copy of the contents of
+ * the list.
+ */
+ XmlObject[] toArray();
+
+
+
+ /**
+ * Static factory class for creating new instances of XmlObjectList
+ */
+ public static final class Factory
+ {
+ // the class to instantiate
+ private static final Class CLASS;
+ static {
+ try {
+ CLASS = Class.forName("com.bea.wli.variables.XmlObjectListImpl");
+ } catch (Throwable t) {
+ IllegalStateException ise = new IllegalStateException("Cannot load XmlObjectListImpl.");
+ ise.initCause(t);
+ throw ise;
+ }
+ }
+
+
+ /**
+ * creates a new empty XmlObjectList instance.
+ *
+ * @return a new empty XmlObjectList instance
+ */
+ public static XmlObjectList newInstance() {
+ try {
+ return (XmlObjectList)CLASS.newInstance();
+ } catch (InstantiationException ie) {
+ throw new RuntimeException(ie);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ }
+
+
+ /**
+ * creates a new XmlObjectList instance, filled with the elements
+ * of the given list
+ *
+ * @return a new XmlObjectList instance.
+ */
+ public static XmlObjectList newInstance(XmlObjectList list) {
+ try {
+ XmlObjectList newList = (XmlObjectList)CLASS.newInstance();
+ newList.addAll(list);
+ return newList;
+ } catch (InstantiationException ie) {
+ throw new RuntimeException(ie);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ }
+
+
+ /**
+ * creates a new XmlObjectList instance given an array of XmlObjects.
+ *
+ * @return a new XmlObjectList instance.
+ */
+ public static XmlObjectList newInstance(XmlObject[] xmlObjects) {
+ try {
+ XmlObjectList newList = (XmlObjectList) CLASS.newInstance();
+ newList.addAll(xmlObjects);
+ return newList;
+ } catch (InstantiationException ie) {
+ throw new RuntimeException(ie);
+ } catch (IllegalAccessException iae) {
+ throw new RuntimeException(iae);
+ }
+ }
+ }
+}
diff --git a/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XqrlDelegate.java b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XqrlDelegate.java
new file mode 100644
index 0000000..f51f32f
--- /dev/null
+++ b/v1/src/xmlstore/org/apache/xmlbeans/impl/store/XqrlDelegate.java
@@ -0,0 +1,131 @@
+/* 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.xmlbeans.impl.store;
+
+import java.lang.reflect.Method;
+import org.apache.xmlbeans.XmlOptions;
+
+public final class XqrlDelegate
+{
+ private XqrlDelegate ( )
+ {
+ }
+
+ static void check ( Object o )
+ {
+ if (o == null)
+ {
+ throw
+ new UnsupportedOperationException(
+ "This query is too complex to be processed." );
+ }
+ }
+
+ static Path.Query compilePath ( String path, XmlOptions options )
+ {
+ return
+ (Path.Query)
+ invoke( _compilePath, new Object[] { path, options } );
+ }
+
+ static Path.Query compileQuery ( String queryExpr, XmlOptions options )
+ {
+ return
+ (Path.Query)
+ invoke(
+ _compileQuery, new Object[] { queryExpr, options, new Boolean(true) } );
+ }
+
+ private static void throwRuntimeException ( Throwable e )
+ {
+ if (e instanceof RuntimeException)
+ throw (RuntimeException) e;
+
+ Throwable cause = e.getCause();
+
+ RuntimeException rte = new RuntimeException( cause.getMessage() );
+
+ rte.initCause( cause );
+
+ throw rte;
+ }
+
+ private static Object invoke ( Method method, Object[] params )
+ {
+ if (method == null)
+ {
+ throw
+ new UnsupportedOperationException(
+ "This query is too complex to be processed." );
+ }
+
+ try
+ {
+ return method.invoke( null, params );
+ }
+ catch ( Throwable e )
+ {
+ throwRuntimeException( e );
+
+ return null; // Unreachable
+ }
+ }
+
+ // Loose coupling functionality with xqrl.jar
+
+ private static Method _compilePath;
+ private static Method _compileQuery;
+
+ static
+ {
+ boolean hasXqrl;
+
+ try
+ {
+ Class.forName( "org.apache.xmlbeans.impl.store.XqrlImpl" );
+
+ hasXqrl = true;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ hasXqrl = false;
+ }
+
+ if (hasXqrl)
+ {
+ try
+ {
+ Class xqrlImpl =
+ Class.forName( "org.apache.xmlbeans.impl.store.XqrlImpl" );
+
+ _compilePath =
+ xqrlImpl.getDeclaredMethod(
+ "compilePath",
+ new Class[] { String.class, XmlOptions.class } );
+
+ _compileQuery =
+ xqrlImpl.getDeclaredMethod(
+ "compileQuery",
+ new Class[] { String.class, XmlOptions.class, Boolean.class } );
+
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ }
+}
diff --git a/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansNavigator.java b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansNavigator.java
new file mode 100644
index 0000000..bc2d7c9
--- /dev/null
+++ b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansNavigator.java
@@ -0,0 +1,814 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+import org.jaxen.XPath;
+import org.jaxen.Navigator;
+import org.jaxen.DefaultNavigator;
+import org.jaxen.FunctionCallException;
+import org.jaxen.UnsupportedAxisException;
+//import org.jaxen.NamedAccessNavigator;
+import org.jaxen.util.AncestorAxisIterator;
+import org.jaxen.util.FollowingSiblingAxisIterator;
+import org.jaxen.util.PrecedingSiblingAxisIterator;
+import org.jaxen.util.FollowingAxisIterator;
+import org.jaxen.util.PrecedingAxisIterator;
+import org.jaxen.util.SelfAxisIterator;
+import org.jaxen.util.DescendantOrSelfAxisIterator;
+import org.jaxen.util.AncestorOrSelfAxisIterator;
+import org.jaxen.util.SingleObjectIterator;
+import org.jaxen.util.DescendantAxisIterator;
+import org.jaxen.saxpath.SAXPathException;
+
+import org.apache.xmlbeans.XmlCursor;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class XBeansNavigator
+ extends DefaultNavigator
+// implements NamedAccessNavigator
+{
+ private XmlCursor _xc;
+
+ private XBeansNavigator()
+ {}
+
+ /** Retrieve an instance of this <code>DocumentNavigator</code>.
+ */
+ public static Navigator getInstance()
+ {
+ return new XBeansNavigator();
+ }
+
+
+ static class JaxenNode
+ extends XmlCursor.XmlBookmark
+ {
+ public String toString()
+ {
+ XmlCursor xc = this.createCursor();
+ return "{Node:" + xc.currentTokenType().toString() + " " + xc.toString() + "}";
+ }
+ }
+
+
+ //
+ // DefaultNavigator implementation
+ //
+
+ /** Retrieve the namespace URI of the given element node.
+ *
+ * @param element The context element node.
+ *
+ * @return The namespace URI of the element node.
+ */
+ public String getElementNamespaceUri(Object element)
+ {
+ ((JaxenNode)element).toBookmark(_xc);
+ return _xc.getName().getNamespaceURI();
+ }
+
+ /** Retrieve the name of the given element node.
+ *
+ * @param element The context element node.
+ *
+ * @return The name of the element node.
+ */
+ public String getElementName(Object element)
+ {
+ ((JaxenNode)element).toBookmark(_xc);
+ return _xc.getName().getLocalPart();
+ }
+
+ /** Retrieve the QName of the given element node.
+ *
+ * @param element The context element node.
+ *
+ * @return The QName of the element node.
+ */
+ public String getElementQName(Object element)
+ {
+ ((JaxenNode)element).toBookmark(_xc);
+ String prefix = _xc.getName().getPrefix();
+ return ( !"".equals(prefix) ? prefix + ":" : "" ) + _xc.getName().getLocalPart();
+ }
+
+ /** Retrieve the namespace URI of the given attribute node.
+ *
+ * @param attr The context attribute node.
+ *
+ * @return The namespace URI of the attribute node.
+ */
+ public String getAttributeNamespaceUri(Object attr)
+ {
+ ((JaxenNode)attr).toBookmark(_xc);
+ return _xc.getName().getNamespaceURI();
+ }
+
+ /** Retrieve the name of the given attribute node.
+ *
+ * @param attr The context attribute node.
+ *
+ * @return The name of the attribute node.
+ */
+ public String getAttributeName(Object attr)
+ {
+ ((JaxenNode)attr).toBookmark(_xc);
+ return _xc.getName().getLocalPart();
+ }
+
+ /** Retrieve the QName of the given attribute node.
+ *
+ * @param attr The context attribute node.
+ *
+ * @return The QName of the attribute node.
+ */
+ public String getAttributeQName(Object attr)
+ {
+ ((JaxenNode)attr).toBookmark(_xc);
+ String uri = _xc.getName().getNamespaceURI();
+ String prefix = _xc.prefixForNamespace(uri);
+ return ( !"".equals(prefix) ? prefix + ":" : "" ) + _xc.getName().getLocalPart();
+ }
+
+ /** 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 <code>true</code> if the object is a document node,
+ * else <code>false</code>
+ */
+ public boolean isDocument(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isStartdoc();
+ }
+
+ /** Returns whether the given object is an element node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is an element node,
+ * else <code>false</code>
+ */
+ public boolean isElement(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isStart();
+ }
+
+ /** Returns whether the given object is an attribute node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is an attribute node,
+ * else <code>false</code>
+ */
+ public boolean isAttribute(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isAttr();
+ }
+
+ /** Returns whether the given object is a namespace node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is a namespace node,
+ * else <code>false</code>
+ */
+ public boolean isNamespace(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isNamespace();
+ }
+
+ /** Returns whether the given object is a comment node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is a comment node,
+ * else <code>false</code>
+ */
+ public boolean isComment(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isComment();
+ }
+
+ /** Returns whether the given object is a text node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is a text node,
+ * else <code>false</code>
+ */
+ public boolean isText(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isText();
+ }
+
+ /** Returns whether the given object is a processing-instruction node.
+ *
+ * @param object The object to test.
+ *
+ * @return <code>true</code> if the object is a processing-instruction node,
+ * else <code>false</code>
+ */
+ public boolean isProcessingInstruction(Object object)
+ {
+ ((JaxenNode)object).toBookmark(_xc);
+ return _xc.isProcinst();
+ }
+
+ /** Retrieve the string-value of a comment node.
+ *
+ * @param comment The comment node.
+ *
+ * @return The string-value of the node.
+ */
+ public String getCommentStringValue(Object comment)
+ {
+ ((JaxenNode)comment).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+ /** Retrieve the string-value of an element node.
+ *
+ * @param element The comment node.
+ *
+ * @return The string-value of the node.
+ */
+ public String getElementStringValue(Object element)
+ {
+ ((JaxenNode)element).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+ /** Retrieve the string-value of an attribute node.
+ *
+ * @param attr The attribute node.
+ *
+ * @return The string-value of the node.
+ */
+ public String getAttributeStringValue(Object attr)
+ {
+ ((JaxenNode)attr).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+ /** Retrieve the string-value of a namespace node.
+ *
+ * @param ns The namespace node.
+ *
+ * @return The string-value of the node.
+ */
+ public String getNamespaceStringValue(Object ns)
+ {
+ ((JaxenNode)ns).toBookmark(_xc);
+ return _xc.getName().getNamespaceURI();
+ }
+
+ /** Retrieve the string-value of a text node.
+ *
+ * @param txt The text node.
+ *
+ * @return The string-value of the node.
+ */
+ public String getTextStringValue(Object txt)
+ {
+ ((JaxenNode)txt).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+ /** Retrieve the namespace prefix of a namespace node.
+ *
+ * @param ns The namespace node.
+ *
+ * @return The prefix associated with the node.
+ */
+ public String getNamespacePrefix(Object ns)
+ {
+ ((JaxenNode)ns).toBookmark(_xc);
+ return _xc.getName().getLocalPart();
+ }
+
+ /** 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.
+ *
+ * @see org.jaxen.XPath
+ *
+ * @param xpath The xpath expression.
+ *
+ * @return A new XPath expression object.
+ *
+ * @throws org.jaxen.saxpath.SAXPathException If an error occurs while parsing the
+ * xpath expression.
+ */
+ public XPath parseXPath(String xpath)
+ throws SAXPathException
+ {
+ return new XBeansXPath(xpath);
+ }
+
+ //
+ // Overwritten methods
+ //
+
+ public static class ChildIterator implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private XmlCursor _xc = null;
+
+ ChildIterator(XmlCursor xc)
+ {
+ _xc = xc;
+ XmlCursor.TokenType tk = _xc.toFirstContentToken(); //not including atts and ns-es
+ if (tk.isFinish())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+
+ res.toBookmark(_xc);
+
+ if (_xc.currentTokenType() == XmlCursor.TokenType.START)
+ {
+ _xc.toEndToken();
+ }
+
+ if (_xc.toNextToken().isFinish())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+
+ return res;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new ChildIterator(_xc);
+ }
+
+ public Iterator getDescendantAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new DescendantAxisIterator( contextNode, this );
+ /*
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new DescendantIterator(_xc);
+ */
+ }
+
+ public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ if (_xc.toParent())
+ return new SingleObjectIterator(getBookmarkInThisPlace(_xc));
+ else
+ return null;
+ }
+
+ public Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new AncestorAxisIterator( contextNode, this );
+ }
+
+ public Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new FollowingSiblingAxisIterator( contextNode, this );
+ }
+
+ public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new PrecedingSiblingAxisIterator( contextNode, this );
+ }
+
+ public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new FollowingAxisIterator( contextNode, this );
+ }
+
+ public Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new PrecedingAxisIterator( contextNode, this );
+ }
+
+ public static class AttributeIterator implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private XmlCursor _xc = null;
+
+ AttributeIterator(XmlCursor xc)
+ {
+ _xc = xc;
+ if (!_xc.toFirstAttribute())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+
+ res.toBookmark(_xc);
+
+ if (!_xc.toNextAttribute())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+
+ return res;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new AttributeIterator(_xc);
+ }
+
+ public static class NamespaceIterator implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private XmlCursor _xc = null;
+
+ NamespaceIterator(XmlCursor xc)
+ {
+ _xc = xc;
+ while (true)
+ {
+ XmlCursor.TokenType tk = _xc.toNextToken();
+ if (tk == XmlCursor.TokenType.ATTR)
+ continue;
+ if (tk == XmlCursor.TokenType.NAMESPACE)
+ {
+ _nextNode = getBookmarkInThisPlace(_xc);
+ break;
+ }
+
+ _nextNode = null;
+ return;
+ }
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+ res.toBookmark(_xc);
+
+ if (_xc.toNextToken().isNamespace())
+ _nextNode = getBookmarkInThisPlace(_xc);
+ else
+ _nextNode = null;
+
+ return res;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new NamespaceIterator(_xc);
+ }
+
+ public Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new SelfAxisIterator( contextNode );
+ }
+
+ public static class DescendantOrSelfAxisItr implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private XmlCursor _xc = null;
+
+ DescendantOrSelfAxisItr(XmlCursor xc)
+ {
+ _xc = xc;
+ XmlCursor.TokenType tk = _xc.toFirstContentToken(); //not including atts and ns-es
+ if (tk.isFinish())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+
+ res.toBookmark(_xc);
+
+ if (_xc.currentTokenType() == XmlCursor.TokenType.START)
+ {
+ _xc.toEndToken();
+ }
+
+ if (_xc.toNextToken().isFinish())
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+
+ return res;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new DescendantOrSelfAxisIterator( contextNode, this );
+ //((JaxenNode)contextNode).toBookmark(_xc);
+ //return new DescendantOrSelfAxisIterator(_xc);
+ }
+
+ public Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
+ {
+ return new AncestorOrSelfAxisIterator( contextNode, this );
+ //((JaxenNode)contextNode).toBookmark(_xc);
+ //return new AncestorOrSelfAxisIterator(_xc);
+ }
+
+ public Object getDocumentNode(Object contextNode)
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ _xc.toStartDoc();
+ return getBookmarkInThisPlace(_xc);
+ }
+
+ public String translateNamespacePrefixToUri(String prefix, Object element)
+ {
+ ((JaxenNode)element).toBookmark(_xc);
+ return _xc.namespaceForPrefix(prefix);
+ }
+
+ public String getProcessingInstructionTarget(Object obj)
+ {
+ ((JaxenNode)obj).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+ public String getProcessingInstructionData(Object obj)
+ {
+ ((JaxenNode)obj).toBookmark(_xc);
+ return _xc.getTextValue();
+ }
+
+
+ public Object getDocument(String url) throws FunctionCallException
+ {
+ return null;
+ }
+
+ /**
+ * Default implementation that can not find elements. Override in subclass
+ * if subclass does know about attribute types.
+ *
+ * @param object a node from the document in which to look for the
+ * id
+ * @param elementId id to look for
+ *
+ * @return null
+ */
+ public Object getElementById(Object object, String elementId)
+ {
+ return null;
+ }
+
+ public static class NamedChildIterator implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private QName _qname;
+ private XmlCursor _xc = null;
+
+ NamedChildIterator(XmlCursor xc, String localName, String namespaceURI)
+ {
+ _xc = xc;
+ _qname = new QName( (namespaceURI==null ? "" : namespaceURI), localName);
+
+ if (!_xc.toFirstChild())
+ {
+ _nextNode = null;
+ return;
+ }
+ if (!(_xc.currentTokenType()==XmlCursor.TokenType.START &&
+ _xc.getName().equals(_qname)
+ ))
+ {
+ if (!_xc.toNextSibling(_qname))
+ {
+ _nextNode = null;
+ return;
+ }
+ }
+ _nextNode = getBookmarkInThisPlace(_xc);
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+ res.toBookmark(_xc);
+
+ if (!_xc.toNextSibling(_qname))
+ _nextNode = null;
+ else
+ _nextNode = getBookmarkInThisPlace(_xc);
+
+ return res;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getChildAxisIterator(
+ Object contextNode,
+ String localName, String namespacePrefix, String namespaceURI)
+ throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new NamedChildIterator(_xc, localName, namespaceURI);
+ }
+
+ public static class NamedAttributeIterator implements Iterator
+ {
+ private JaxenNode _nextNode = null;
+ private QName _qname;
+ private XmlCursor _xc;
+
+ NamedAttributeIterator(XmlCursor xc, String local, String uri)
+ {
+ _xc = xc;
+ _qname = new QName(( uri==null ? "" : uri), local);
+
+ XmlCursor.TokenType tk = _xc.toNextToken();
+ if (tk!=XmlCursor.TokenType.ATTR)
+ {
+ _nextNode = null;
+ return;
+ }
+
+ if ( _xc.getName().equals(_qname) )
+ {
+ _nextNode = getBookmarkInThisPlace(_xc);
+ return;
+ }
+ _nextNode = move(_xc);
+ return;
+ }
+
+ public boolean hasNext()
+ {
+ if (_nextNode == null)
+ return false;
+
+ return true;
+ }
+
+ public Object next()
+ {
+ if (_nextNode == null)
+ return null;
+
+ JaxenNode res = _nextNode;
+ res.toBookmark(_xc);
+
+ _nextNode = move(_xc);
+ return res;
+ }
+
+ private JaxenNode move(XmlCursor xc)
+ {
+ if (xc.currentTokenType() != XmlCursor.TokenType.ATTR )
+ {
+ return null;
+ }
+
+ while(xc.toNextToken()==XmlCursor.TokenType.ATTR)
+ {
+ if ( xc.getName().equals(_qname) )
+ {
+ return getBookmarkInThisPlace(xc);
+ }
+ }
+ return null;
+ }
+
+ public void remove() { throw new RuntimeException("optional method not implemented"); }
+ }
+
+ public Iterator getAttributeAxisIterator(
+ Object contextNode,
+ String localName, String namespacePrefix, String namespaceURI)
+ throws UnsupportedAxisException
+ {
+ ((JaxenNode)contextNode).toBookmark(_xc);
+ return new NamedAttributeIterator(_xc, localName, namespaceURI);
+ }
+
+ static JaxenNode getBookmarkInThisPlace(XmlCursor xc)
+ {
+ JaxenNode rez = (JaxenNode)xc.getBookmark(JaxenNode.class);
+ if (rez==null)
+ {
+ rez = new JaxenNode();
+ xc.setBookmark(rez);
+ }
+
+ return rez;
+ }
+
+ XmlCursor getCursor()
+ {
+ return _xc;
+ }
+
+ void setCursor(XmlCursor xc)
+ {
+ this._xc = xc;
+ }
+}
diff --git a/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPath.java b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPath.java
new file mode 100644
index 0000000..a40f12b
--- /dev/null
+++ b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPath.java
@@ -0,0 +1,103 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+
+import org.jaxen.BaseXPath;
+import org.jaxen.JaxenException;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+
+import java.util.List;
+import java.util.AbstractList;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class XBeansXPath extends BaseXPath
+{
+ /** 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 XBeansXPath(String xpathExpr) throws JaxenException
+ {
+ super( xpathExpr, XBeansNavigator.getInstance() );
+ }
+
+ /** Select all nodes that are selectable by this XPath
+ * expression. If multiple nodes match, multiple nodes
+ * will be returned.
+ *
+ * <p>
+ * <b>NOTE:</b> In most cases, nodes will be returned
+ * in document-order, as defined by the XML Canonicalization
+ * specification. The exception occurs when using XPath
+ * expressions involving the <code>union</code> operator
+ * (denoted with the pipe '|' character).
+ * </p>
+ *
+ * @param node The node, nodeset or Context object for evaluation. This value can be null.
+ *
+ * @return The <code>node-set</code> of all items selected
+ * by this XPath expression.
+ *
+ * @see #selectSingleNode
+ */
+ public List selectNodes(Object node) throws JaxenException
+ {
+ XmlCursor xc;
+ if (node instanceof XmlObject)
+ {
+ xc = ((XmlObject)node).newCursor();
+ }
+ else if (node instanceof XmlCursor)
+ {
+ xc = ((XmlCursor)node).newCursor();
+ }
+ else
+ throw new IllegalArgumentException("node must be an XmlObject or an XmlCursor, found: " + node.getClass());
+
+ ((XBeansNavigator)getNavigator()).setCursor(xc);
+ return new ListImpl(super.selectNodes( XBeansNavigator.getBookmarkInThisPlace(xc) ));
+ }
+
+ private static class ListImpl extends AbstractList
+ {
+ private List _results;
+
+ private ListImpl(List results)
+ {
+ _results = results;
+ }
+
+ public Object get(int index)
+ {
+ if (_results==null)
+ return null;
+
+ return ((XBeansNavigator.JaxenNode)_results.get(index)).createCursor();
+ }
+
+ public int size()
+ {
+ return (_results==null ? 0 : _results.size());
+ }
+ }
+}
diff --git a/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPathAdv.java b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPathAdv.java
new file mode 100644
index 0000000..608b619
--- /dev/null
+++ b/v1/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansXPathAdv.java
@@ -0,0 +1,90 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+
+import org.jaxen.BaseXPath;
+import org.jaxen.JaxenException;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.impl.store.JaxenXBeansDelegate;
+
+import java.util.List;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class XBeansXPathAdv
+ extends BaseXPath
+ implements JaxenXBeansDelegate.SelectPathInterface
+{
+ /** 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 XBeansXPathAdv(String xpathExpr) throws JaxenException
+ {
+ super( xpathExpr, XBeansNavigator.getInstance() );
+ }
+
+ /** Select all nodes that are selectable by this XPath
+ * expression. If multiple nodes match, multiple nodes
+ * will be returned.
+ *
+ * <p>
+ * <b>NOTE:</b> In most cases, nodes will be returned
+ * in document-order, as defined by the XML Canonicalization
+ * specification. The exception occurs when using XPath
+ * expressions involving the <code>union</code> operator
+ * (denoted with the pipe '|' character).
+ * </p>
+ *
+ * <p>
+ * <b>NOTE:</b> Param node must be an XmlCursor, which will be used during the xpath
+ * execution and iteration through the results. A call of node.dispose() must be done
+ * after reading all results.
+ * </p>
+ *
+ * @param node The node, nodeset or Context object for evaluation. This value can be null.
+ *
+ * @return The <code>node-set</code> of all items selected
+ * by this XPath expression.
+ *
+ * @see #selectSingleNode
+ */
+ public List selectNodes(Object node) throws JaxenException
+ {
+ XmlCursor xc;
+ xc = ((XmlCursor)node);
+
+ ((XBeansNavigator)getNavigator()).setCursor(xc);
+ return super.selectNodes( XBeansNavigator.getBookmarkInThisPlace(xc) );
+ }
+
+ public List selectPath(Object node)
+ {
+ try
+ {
+ return selectNodes(node);
+ }
+ catch (JaxenException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/v1/src/xsdschema/schema/XMLSchema.xsd b/v1/src/xsdschema/schema/XMLSchema.xsd
new file mode 100644
index 0000000..04e03ac
--- /dev/null
+++ b/v1/src/xsdschema/schema/XMLSchema.xsd
@@ -0,0 +1,2549 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+
+<!-- The prose copy in the structures REC is the normative -->
+
+<!-- version (which shouldn't differ from this one except for -->
+
+<!-- this comment and entity expansions, but just in case -->
+
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [
+
+<!-- provide ID type information even for parsers which only read the
+ internal subset -->
+<!ATTLIST xs:schema id ID #IMPLIED>
+<!ATTLIST xs:complexType id ID #IMPLIED>
+<!ATTLIST xs:complexContent id ID #IMPLIED>
+<!ATTLIST xs:simpleContent id ID #IMPLIED>
+<!ATTLIST xs:extension id ID #IMPLIED>
+<!ATTLIST xs:element id ID #IMPLIED>
+<!ATTLIST xs:group id ID #IMPLIED>
+<!ATTLIST xs:all id ID #IMPLIED>
+<!ATTLIST xs:choice id ID #IMPLIED>
+<!ATTLIST xs:sequence id ID #IMPLIED>
+<!ATTLIST xs:any id ID #IMPLIED>
+<!ATTLIST xs:anyAttribute id ID #IMPLIED>
+<!ATTLIST xs:attribute id ID #IMPLIED>
+<!ATTLIST xs:attributeGroup id ID #IMPLIED>
+<!ATTLIST xs:unique id ID #IMPLIED>
+<!ATTLIST xs:key id ID #IMPLIED>
+<!ATTLIST xs:keyref id ID #IMPLIED>
+<!ATTLIST xs:selector id ID #IMPLIED>
+<!ATTLIST xs:field id ID #IMPLIED>
+<!ATTLIST xs:include id ID #IMPLIED>
+<!ATTLIST xs:import id ID #IMPLIED>
+<!ATTLIST xs:redefine id ID #IMPLIED>
+<!ATTLIST xs:notation id ID #IMPLIED>
+<!--
+ keep this schema XML1.0 DTD valid
+ -->
+ <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'>
+
+ <!ELEMENT hfp:hasFacet EMPTY>
+ <!ATTLIST hfp:hasFacet
+ name NMTOKEN #REQUIRED>
+
+ <!ELEMENT hfp:hasProperty EMPTY>
+ <!ATTLIST hfp:hasProperty
+ name NMTOKEN #REQUIRED
+ value CDATA #REQUIRED>
+<!--
+ Make sure that processors that do not read the external
+ subset will know about the various IDs we declare
+ -->
+ <!ATTLIST xs:simpleType id ID #IMPLIED>
+ <!ATTLIST xs:maxExclusive id ID #IMPLIED>
+ <!ATTLIST xs:minExclusive id ID #IMPLIED>
+ <!ATTLIST xs:maxInclusive id ID #IMPLIED>
+ <!ATTLIST xs:minInclusive id ID #IMPLIED>
+ <!ATTLIST xs:totalDigits id ID #IMPLIED>
+ <!ATTLIST xs:fractionDigits id ID #IMPLIED>
+ <!ATTLIST xs:length id ID #IMPLIED>
+ <!ATTLIST xs:minLength id ID #IMPLIED>
+ <!ATTLIST xs:maxLength id ID #IMPLIED>
+ <!ATTLIST xs:enumeration id ID #IMPLIED>
+ <!ATTLIST xs:pattern id ID #IMPLIED>
+ <!ATTLIST xs:appinfo id ID #IMPLIED>
+ <!ATTLIST xs:documentation id ID #IMPLIED>
+ <!ATTLIST xs:list id ID #IMPLIED>
+ <!ATTLIST xs:union id ID #IMPLIED>
+ ]>
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+ <xs:documentation>
+ Part 1 version: Id: XMLSchema.xsd,v 1.53 2003/02/24 17:40:07 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.60 2003/04/05 11:02:30 ht Exp
+ </xs:documentation>
+ <xs:documentation>
+ Apache XMLBean changes:
+
+ 2003/05/14: The regular expressions that describe integrity constraint
+ xpaths has been modified to permit whitespaces in certain places, as
+ discussed in one of the errata.
+
+ 2003/05/28: the type of the <element> element in an <all> group has
+ been given a name so that it is legal to use the type in both a base type
+ and a restriction when using the allModel (otherwise it breaks one of the
+ particle-valid (restriction) rules).
+
+ 2003/09/15: finalDefault has been changed to permit "list" and "union"
+
+ </xs:documentation>
+ </xs:annotation>
+
+
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/XML/Group/2002/09/xmlschema-1/structures-with-errata.html">
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ The simpleType element and all of its members are defined
+ towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+ <xs:annotation>
+ <xs:documentation>
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+ </xs:documentation>
+ </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:anyType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+ <xs:annotation>
+ <xs:documentation>
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:group ref="xs:redefinable"/>
+ <xs:element ref="xs:element"/>
+ <xs:element ref="xs:attribute"/>
+ <xs:element ref="xs:notation"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="redefinable">
+ <xs:annotation>
+ <xs:documentation>
+ This group is for the
+ elements which can self-redefine (see <redefine> below).</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:simpleType"/>
+ <xs:element ref="xs:complexType"/>
+ <xs:element ref="xs:group"/>
+ <xs:element ref="xs:attributeGroup"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="qualified"/>
+ <xs:enumeration value="unqualified"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="defaultDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="defaultDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:defaultDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list itemType="xs:reducedDerivationControl"/>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:include"/>
+ <xs:element ref="xs:import"/>
+ <xs:element ref="xs:redefine"/>
+ <xs:element ref="xs:annotation"/>
+ </xs:choice>
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="xs:schemaTop"/>
+ <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+ <xs:attribute name="version" type="xs:normalizedString"/>
+ <xs:attribute name="finalDefault" type="xs:defaultDerivationSet" use="optional" default=""/>
+ <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+ <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:key name="element">
+ <xs:selector xpath="xs:element"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attribute">
+ <xs:selector xpath="xs:attribute"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="type">
+ <xs:selector xpath="xs:complexType|xs:simpleType"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="group">
+ <xs:selector xpath="xs:group"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="attributeGroup">
+ <xs:selector xpath="xs:attributeGroup"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="notation">
+ <xs:selector xpath="xs:notation"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ <xs:key name="identityConstraint">
+ <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+ <xs:annotation><xs:documentation>
+ for maxOccurs</xs:documentation></xs:annotation>
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+ <xs:annotation><xs:documentation>
+ for all particles</xs:documentation></xs:annotation>
+ <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+ <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+ <xs:annotation><xs:documentation>
+ for element, group and attributeGroup,
+ which both define and reference</xs:documentation></xs:annotation>
+ <xs:attribute name="name" type="xs:NCName"/>
+ <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+ <xs:annotation>
+ <xs:documentation>
+ 'complexType' uses this</xs:documentation></xs:annotation>
+ <xs:choice>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:group>
+
+
+
+ <xs:group name="nestedParticle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="particle">
+ <xs:choice>
+ <xs:element name="element" type="xs:localElement"/>
+ <xs:element name="group" type="xs:groupRef"/>
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ <xs:element ref="xs:any"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="attribute">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="use" use="optional" default="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="prohibited"/>
+ <xs:enumeration value="optional"/>
+ <xs:enumeration value="required"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelAttribute">
+ <xs:complexContent>
+ <xs:restriction base="xs:attribute">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="use" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="attribute" type="xs:attribute"/>
+ <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ </xs:choice>
+ <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+ <xs:choice>
+ <xs:element ref="xs:simpleContent"/>
+ <xs:element ref="xs:complexContent"/>
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent></xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:complexTypeModel"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Will be restricted to required or forbidden</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:derivationSet"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localComplexType">
+ <xs:complexContent>
+ <xs:restriction base="xs:complexType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:complexTypeModel"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="block" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="restrictionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:group ref="xs:typeDefParticle"/>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:typeDefParticle"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="base" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:complexRestrictionType"/>
+ <xs:element name="extension" type="xs:extensionType"/>
+ </xs:choice>
+ <xs:attribute name="mixed" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Overrides any setting on complexType parent.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:restrictionType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>This choice is added simply to
+ make this a valid restriction per the REC</xs:documentation>
+ </xs:annotation>
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ </xs:choice>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+ <xs:complexContent>
+ <xs:restriction base="xs:extensionType">
+ <xs:sequence>
+ <xs:annotation>
+ <xs:documentation>
+ No typeDefParticle group reference</xs:documentation>
+ </xs:annotation>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:choice>
+ <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+ <xs:element name="extension" type="xs:simpleExtensionType"/>
+ </xs:choice>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+ </xs:annotation>
+ </xs:element>
+
+
+ <xs:simpleType name="blockSet">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="substitution"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attribute name="type" type="xs:QName"/>
+ <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ <xs:attribute name="default" type="xs:string"/>
+ <xs:attribute name="fixed" type="xs:string"/>
+ <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="final" type="xs:derivationSet"/>
+ <xs:attribute name="block" type="xs:blockSet"/>
+ <xs:attribute name="form" type="xs:formChoice"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="form" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localElement">
+ <xs:complexContent>
+ <xs:restriction base="xs:element">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="substitutionGroup" use="prohibited"/>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:attribute name="abstract" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+ <xs:annotation>
+ <xs:documentation>
+ group type for explicit groups, named top-level groups and
+ group references</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="realGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="xs:all"/>
+ <xs:element ref="xs:choice"/>
+ <xs:element ref="xs:sequence"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="1" maxOccurs="1">
+ <xs:element name="all">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:all">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+ <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:realGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+ <xs:annotation>
+ <xs:documentation>
+ group type for the three kinds of group</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:group">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExplicitGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="prohibited"/>
+ <xs:attribute name="maxOccurs" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="allModel">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint</xs:documentation>
+ </xs:annotation>
+ <xs:element name="element" type="xs:elementInAll"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:complexType name="elementInAll">
+ <xs:annotation>
+ <xs:documentation>restricted max/min</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:localElement">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="simpleType" type="xs:localSimpleType"/>
+ <xs:element name="complexType" type="xs:localComplexType"/>
+ </xs:choice>
+ <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="all">
+ <xs:annotation>
+ <xs:documentation>
+ Only elements allowed inside</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:restriction base="xs:explicitGroup">
+ <xs:group ref="xs:allModel"/>
+ <xs:attribute name="minOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="maxOccurs" use="optional" default="1">
+ <xs:simpleType>
+ <xs:restriction base="xs:allNNI">
+ <xs:enumeration value="1"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+ <xs:attribute name="processContents" use="optional" default="strict">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="skip"/>
+ <xs:enumeration value="lax"/>
+ <xs:enumeration value="strict"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:wildcard">
+ <xs:attributeGroup ref="xs:occurs"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'</xs:documentation>
+ </xs:annotation>
+ <xs:annotation>
+ <xs:documentation>
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively</xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##any"/>
+ <xs:enumeration value="##other"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:list>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:anyURI">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="##targetNamespace"/>
+ <xs:enumeration value="##local"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:list>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:attrDecls"/>
+ <xs:attributeGroup ref="xs:defRef"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedAttributeGroup">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:attrDecls"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:NCName"/>
+ <xs:attribute name="ref" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+ <xs:complexContent>
+ <xs:restriction base="xs:attributeGroup">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="ref" use="required" type="xs:QName"/>
+ <xs:attribute name="name" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:annotation"/>
+ <xs:group ref="xs:redefinable"/>
+ </xs:choice>
+ <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="namespace" type="xs:anyURI"/>
+ <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+ </xs:documentation>
+ </xs:annotation>
+ <!-- TSH modified to allow white space -->
+ <xs:pattern
+ value="(\.\s*//\s*)?(((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)(\s*/\s*(((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.))*(\s*\|\s*(\.\s*//\s*)?(((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)(\s*/\s*(((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="xpath" use="required">
+ <xs:simpleType>
+ <xs:annotation>
+ <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+ <xs:documentation>A utility type, not for public
+use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:annotation>
+ <xs:documentation>The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+ </xs:documentation>
+ </xs:annotation>
+ <!-- TSH modified to allow white space -->
+ <xs:pattern value="(\.\s*//\s*)?((((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)\s*/\s*)*((((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute\s*::\s*|@\s*)((\i\c*:)?(\i\c*|\*))))(\s*\|\s*(\s*\.//\s*)?((((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child\s*::\s*)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute\s*::\s*|@\s*)((\i\c*:)?(\i\c*|\*)))))*">
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element ref="xs:selector"/>
+ <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+ <xs:annotation>
+ <xs:documentation>The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:unique"/>
+ <xs:element ref="xs:key"/>
+ <xs:element ref="xs:keyref"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:keybase">
+ <xs:attribute name="refer" type="xs:QName" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attribute name="public" type="xs:public"/>
+ <xs:attribute name="system" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ <xs:documentation>
+ A public identifier, per ISO 8879</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
+ <xs:any processContents="lax"/>
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:anyURI"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+ <xs:annotation>
+ <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="xs:openAttrs">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="xs:appinfo"/>
+ <xs:element ref="xs:documentation"/>
+ </xs:choice>
+ <xs:attribute name="id" type="xs:ID"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+ <xs:documentation>
+ notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+
+ <xs:complexType name="anyType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+ <xs:annotation>
+ <xs:documentation>
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+ </xs:documentation>
+
+ <xs:documentation>
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="string" id="string">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#string"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="preserve" id="string.preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="boolean" id="boolean">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="boolean.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="float" id="float">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#float"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="float.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="double" id="double">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#double"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="double.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="decimal" id="decimal">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="totalDigits"/>
+ <hfp:hasFacet name="fractionDigits"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="total"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="true"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="decimal.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="duration" id="duration">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="duration.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="dateTime.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="time" id="time">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#time"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="time.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="date" id="date">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#date"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="date.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYearMonth" id="gYearMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYearMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gYear" id="gYear">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gYear.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonthDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gDay" id="gDay">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gDay.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasFacet name="maxInclusive"/>
+ <hfp:hasFacet name="maxExclusive"/>
+ <hfp:hasFacet name="minInclusive"/>
+ <hfp:hasFacet name="minExclusive"/>
+ <hfp:hasProperty name="ordered" value="partial"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="gMonth.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="hexBinary" id="hexBinary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="hexBinary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="base64Binary.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="anyURI" id="anyURI">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="anyURI.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="QName" id="QName">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="QName.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NOTATION" id="NOTATION">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="pattern"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+ <xs:documentation>
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:anySimpleType">
+ <xs:whiteSpace value="collapse" fixed="true"
+ id="NOTATION.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:annotation>
+ <xs:documentation>
+ Now the derived primitive types
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:simpleType name="normalizedString" id="normalizedString">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="replace"
+ id="normalizedString.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="token" id="token">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#token"/>
+ </xs:annotation>
+ <xs:restriction base="xs:normalizedString">
+ <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="language" id="language">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#language"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern
+ value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+ id="language.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-LanguageID">
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREFS" id="IDREFS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:IDREF"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="IDREFS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITIES" id="ENTITIES">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:ENTITY"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="ENTITIES.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\c+" id="NMTOKEN.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+ pattern matches production 7 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasFacet name="length"/>
+ <hfp:hasFacet name="minLength"/>
+ <hfp:hasFacet name="maxLength"/>
+ <hfp:hasFacet name="enumeration"/>
+ <hfp:hasFacet name="whiteSpace"/>
+ <hfp:hasProperty name="ordered" value="false"/>
+ <hfp:hasProperty name="bounded" value="false"/>
+ <hfp:hasProperty name="cardinality"
+ value="countably infinite"/>
+ <hfp:hasProperty name="numeric" value="false"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+ </xs:annotation>
+ <xs:restriction>
+ <xs:simpleType>
+ <xs:list itemType="xs:NMTOKEN"/>
+ </xs:simpleType>
+ <xs:minLength value="1" id="NMTOKENS.minLength"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="Name" id="Name">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+ </xs:annotation>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="\i\c*" id="Name.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml#NT-Name">
+ pattern matches production 5 from the XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="NCName" id="NCName">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+ </xs:annotation>
+ <xs:restriction base="xs:Name">
+ <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+ pattern matches production 4 from the Namespaces in XML spec
+ </xs:documentation>
+ </xs:annotation>
+ </xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ID" id="ID">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="IDREF" id="IDREF">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="ENTITY" id="ENTITY">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+ </xs:annotation>
+ <xs:restriction base="xs:NCName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="integer" id="integer">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+ </xs:annotation>
+ <xs:restriction base="xs:decimal">
+ <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+ <xs:pattern value="[\-+]?[0-9]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="negativeInteger" id="negativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonPositiveInteger">
+ <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="long" id="long">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#long"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+ <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="int" id="int">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#int"/>
+ </xs:annotation>
+ <xs:restriction base="xs:long">
+ <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+ <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="short" id="short">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#short"/>
+ </xs:annotation>
+ <xs:restriction base="xs:int">
+ <xs:minInclusive value="-32768" id="short.minInclusive"/>
+ <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="byte" id="byte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="-128" id="byte.minInclusive"/>
+ <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedLong" id="unsignedLong">
+ <xs:annotation>
+ <xs:appinfo>
+ <hfp:hasProperty name="bounded" value="true"/>
+ <hfp:hasProperty name="cardinality" value="finite"/>
+ </xs:appinfo>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="18446744073709551615"
+ id="unsignedLong.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedInt" id="unsignedInt">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedLong">
+ <xs:maxInclusive value="4294967295"
+ id="unsignedInt.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedShort" id="unsignedShort">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedInt">
+ <xs:maxInclusive value="65535"
+ id="unsignedShort.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="unsignedByte" id="unsignedByte">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+ </xs:annotation>
+ <xs:restriction base="xs:unsignedShort">
+ <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger" id="positiveInteger">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+ </xs:annotation>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+ <xs:annotation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="substitution"/>
+ <xs:enumeration value="extension"/>
+ <xs:enumeration value="restriction"/>
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+ <xs:choice>
+ <xs:element ref="xs:restriction"/>
+ <xs:element ref="xs:list"/>
+ <xs:element ref="xs:union"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+ <xs:annotation>
+ <xs:documentation>
+ #all or (possibly empty) subset of {restriction, union, list}
+ </xs:documentation>
+ <xs:documentation>
+ A utility type, not for public use</xs:documentation>
+ </xs:annotation>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="#all"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="xs:derivationControl">
+ <xs:enumeration value="list"/>
+ <xs:enumeration value="union"/>
+ <xs:enumeration value="restriction"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:complexType name="simpleType" abstract="true">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleDerivation"/>
+ <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+ <xs:attribute name="name" type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Can be restricted to required or forbidden
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="topLevelSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required"
+ type="xs:NCName">
+ <xs:annotation>
+ <xs:documentation>
+ Required at the top level
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="localSimpleType">
+ <xs:complexContent>
+ <xs:restriction base="xs:simpleType">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ <xs:group ref="xs:simpleDerivation"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="prohibited">
+ <xs:annotation>
+ <xs:documentation>
+ Forbidden when nested
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="final" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:group name="facets">
+ <xs:annotation>
+ <xs:documentation>
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element ref="xs:minExclusive"/>
+ <xs:element ref="xs:minInclusive"/>
+ <xs:element ref="xs:maxExclusive"/>
+ <xs:element ref="xs:maxInclusive"/>
+ <xs:element ref="xs:totalDigits"/>
+ <xs:element ref="xs:fractionDigits"/>
+ <xs:element ref="xs:length"/>
+ <xs:element ref="xs:minLength"/>
+ <xs:element ref="xs:maxLength"/>
+ <xs:element ref="xs:enumeration"/>
+ <xs:element ref="xs:whiteSpace"/>
+ <xs:element ref="xs:pattern"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="simpleRestrictionModel">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+ <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:element name="restriction" id="restriction">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:group ref="xs:simpleRestrictionModel"/>
+ <xs:attribute name="base" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="list" id="list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-list">
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="union" id="union">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-union">
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:sequence>
+ <xs:element name="simpleType" type="xs:localSimpleType"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="memberTypes" use="optional">
+ <xs:simpleType>
+ <xs:list itemType="xs:QName"/>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="facet">
+ <xs:complexContent>
+ <xs:extension base="xs:annotated">
+ <xs:attribute name="value" use="required"/>
+ <xs:attribute name="fixed" type="xs:boolean" use="optional"
+ default="false"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="fixed" use="prohibited"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="numFacet">
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="totalDigits" id="totalDigits">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:numFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="length" id="length" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="minLength" id="minLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+ </xs:annotation>
+ </xs:element>
+
+ <xs:element name="whiteSpace" id="whiteSpace">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:facet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="preserve"/>
+ <xs:enumeration value="replace"/>
+ <xs:enumeration value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="pattern" id="pattern">
+ <xs:annotation>
+ <xs:documentation
+ source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:restriction base="xs:noFixedFacet">
+ <xs:sequence>
+ <xs:element ref="xs:annotation" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:restriction>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/v1/src/xsdschema/schema/w3c-schema-license.html b/v1/src/xsdschema/schema/w3c-schema-license.html
new file mode 100644
index 0000000..a8e8bcb
--- /dev/null
+++ b/v1/src/xsdschema/schema/w3c-schema-license.html
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>W3C Software License</title>
+ <link rel="stylesheet" type="text/css" href="/StyleSheets/base.css" />
+ <style type="text/css">
+ <!--
+h3#version { margin-top: -0.8em;}
+-->
+ </style>
+</head>
+
+<body text="#000000" bgcolor="#FFFFFF">
+
+<h1>W3C XML Schema, Schema for Schemas: <a href="http://www.w3.org/2001/XMLSchema.xsd">http://www.w3.org/2001/XMLSchema.xsd</a></h1>
+<dl>
+ <dd><a href="http://www.w3.org/Consortium/Legal/ipr-notice">Copyright</a>
+ © 2001-2003 <a href="http://www.w3.org/">World Wide Web
+ Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
+ Institute of Technology</a>, <a href="http://www.ercim.org/">European
+ Research Consortium for Informatics and Mathematics</a>, <a
+ href="http://www.keio.ac.jp/">Keio University</a>). All Rights
+ Reserved. This work is distributed under the <a
+ href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C<sup>®</sup>
+ Software License</a> [1] in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ <p>[1] <a
+ href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html">http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</a></p>
+ </dd>
+</dl>
+
+
+<hr/>
+
+<h1>W3C<sup>®</sup> SOFTWARE NOTICE AND LICENSE</h1>
+
+<h3 id="version"><a
+href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</a></h3>
+
+<p>This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following
+terms and conditions.</p>
+
+<p>Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without
+fee or royalty is hereby granted, provided that you include the following on
+ALL copies of the software and documentation or portions thereof, including
+modifications:</p>
+<ol>
+ <li>The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.</li>
+ <li>Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the <a
+ href="copyright-software-short-notice-20021231.html">W3C Software Short
+ Notice</a> should be included (hypertext is preferred, text is permitted)
+ within the body of any redistributed or derivative code.</li>
+ <li>Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)</li>
+</ol>
+
+<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
+ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
+
+<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION.</p>
+
+<p>The name and trademarks of copyright holders may NOT be used in
+advertising or publicity pertaining to the software without specific, written
+prior permission. Title to copyright in this software and any associated
+documentation will at all times remain with copyright holders.</p>
+
+<p></p>
+
+<p>____________________________________</p>
+
+<p>This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C,
+reflects that ERCIM is now a host of the W3C, includes references to this
+specific dated version of the license, and removes the ambiguous grant of
+"use". Otherwise, this version is the same as the <a
+href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">previous
+version</a> and is written so as to preserve the <a
+href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">Free
+Software Foundation's assessment of GPL compatibility</a> and <a
+href="http://www.opensource.org/licenses/W3C.php">OSI's certification</a>
+under the <a href="http://www.opensource.org/docs/definition.php">Open Source
+Definition</a>. Please see our <a
+href="http://www.w3.org/Consortium/Legal/IPR-FAQ">Copyright FAQ</a> for
+common questions about using materials from our site, including specific
+terms and conditions for packages like libwww, Amaya, and Jigsaw. Other
+questions about this notice can be directed to <a
+href="mailto:site-policy@w3.org">site-policy@w3.org</a>.<br />
+ </p>
+<address>
+ Joseph Reagle <<a
+ href="mailto:site-policy@w3.org">site-policy@w3.org></a>
+</address>
+
+<p>Last revised by Reagle $Date$</p>
+</body>
+</html>
diff --git a/v1/src/zipcompare/zipcompare/ZipCompare.java b/v1/src/zipcompare/zipcompare/ZipCompare.java
new file mode 100644
index 0000000..27f902b
--- /dev/null
+++ b/v1/src/zipcompare/zipcompare/ZipCompare.java
@@ -0,0 +1,143 @@
+/* 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 zipcompare;
+
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.util.*;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ZipCompare
+{
+ public static void main(String[] args)
+ {
+ if (args.length != 2)
+ {
+ System.out.println("Usage: zipcompare [file1] [file2]");
+ System.exit(1);
+ }
+
+ ZipFile file1;
+ try { file1 = new ZipFile(args[0]); }
+ catch (IOException e) { System.out.println("Could not open zip file " + args[0] + ": " + e); System.exit(1); return; }
+
+ ZipFile file2;
+ try { file2 = new ZipFile(args[1]); }
+ catch (IOException e) { System.out.println("Could not open zip file " + args[0] + ": " + e); System.exit(1); return; }
+
+ System.out.println("Comparing " + args[0] + " with " + args[1] + ":");
+
+ Set set1 = new LinkedHashSet();
+ for (Enumeration e = file1.entries(); e.hasMoreElements(); )
+ set1.add(((ZipEntry)e.nextElement()).getName());
+
+ Set set2 = new LinkedHashSet();
+ for (Enumeration e = file2.entries(); e.hasMoreElements(); )
+ set2.add(((ZipEntry)e.nextElement()).getName());
+
+ int errcount = 0;
+ int filecount = 0;
+ for (Iterator i = set1.iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ if (!set2.contains(name))
+ {
+ System.out.println(name + " not found in " + args[1]);
+ errcount += 1;
+ continue;
+ }
+ try
+ {
+ set2.remove(name);
+ if (!streamsEqual(file1.getInputStream(file1.getEntry(name)), file2.getInputStream(file2.getEntry(name))))
+ {
+ System.out.println(name + " does not match");
+ errcount += 1;
+ continue;
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println(name + ": IO Error " + e);
+ e.printStackTrace();
+ errcount += 1;
+ continue;
+ }
+ filecount += 1;
+ }
+ for (Iterator i = set2.iterator(); i.hasNext(); )
+ {
+ String name = (String)i.next();
+ System.out.println(name + " not found in " + args[0]);
+ errcount += 1;
+ }
+ System.out.println(filecount + " entries matched");
+ if (errcount > 0)
+ {
+ System.out.println(errcount + " entries did not match");
+ System.exit(1);
+ }
+ System.exit(0);
+ }
+
+ static boolean streamsEqual(InputStream stream1, InputStream stream2) throws IOException
+ {
+ byte[] buf1 = new byte[4096];
+ byte[] buf2 = new byte[4096];
+ boolean done1 = false;
+ boolean done2 = false;
+
+ try
+ {
+ while (!done1)
+ {
+ int off1 = 0;
+ int off2 = 0;
+
+ while (off1 < buf1.length)
+ {
+ int count = stream1.read(buf1, off1, buf1.length - off1);
+ if (count < 0)
+ {
+ done1 = true;
+ break;
+ }
+ off1 += count;
+ }
+ while (off2 < buf2.length)
+ {
+ int count = stream2.read(buf2, off2, buf2.length - off2);
+ if (count < 0)
+ {
+ done2 = true;
+ break;
+ }
+ off2 += count;
+ }
+ if (off1 != off2 || done1 != done2)
+ return false;
+ for (int i = 0; i < off1; i++)
+ {
+ if (buf1[i] != buf2[i])
+ return false;
+ }
+ }
+ return true;
+ }
+ finally { stream1.close(); stream2.close(); }
+ }
+}
diff --git a/v1/test/cases/enumtest/report1.xml b/v1/test/cases/enumtest/report1.xml
new file mode 100644
index 0000000..dc6c1b8
--- /dev/null
+++ b/v1/test/cases/enumtest/report1.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<statusreport xmlns="http://openuri.org/enumtest">
+ <status name="first" target="all">all</status>
+ <status name="second" target="all">few</status>
+ <status name="third" target="none">most</status>
+ <status name="first" target="none">none</status>
+</statusreport>
diff --git a/v1/test/cases/nameworld/world1.xml b/v1/test/cases/nameworld/world1.xml
new file mode 100644
index 0000000..291c507
--- /dev/null
+++ b/v1/test/cases/nameworld/world1.xml
@@ -0,0 +1,47 @@
+<!-- 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. -->
+<nw:nameworld xmlns:nw="http://openuri.org/nameworld"
+ xmlns:foo="http://foo.com/"
+ xmlns:bar="http://bar.com/">
+
+ <nw:island targetNamespace="http://foo.com/">
+ <nw:location name="foocity">
+ <nw:reference to="bar:barcity"/>
+ <nw:reference to="foo:footown"/>
+ <nw:reference to="bar:barvillage"/>
+ </nw:location>
+ <nw:location name="footown">
+ <nw:reference to="bar:bartown"/>
+ <nw:reference to="foo:foovillage"/>
+ </nw:location>
+ <nw:location name="foovillage">
+ <nw:reference to="bar:barvillage"/>
+ </nw:location>
+ </nw:island>
+
+ <nw:island targetNamespace="http://bar.com/">
+ <nw:location name="barcity">
+ <nw:reference to="foo:foocity"/>
+ <nw:reference to="bar:bartown"/>
+ <nw:reference to="foo:foovillage"/>
+ </nw:location>
+ <nw:location name="bartown">
+ <nw:reference to="foo:footown"/>
+ <nw:reference to="bar:barvillage"/>
+ </nw:location>
+ <nw:location name="barvillage">
+ <nw:reference to="foo:foovillage"/>
+ </nw:location>
+ </nw:island>
+</nw:nameworld>
\ No newline at end of file
diff --git a/v1/test/cases/schema/XmlSignature/signature-example-dsa.xml b/v1/test/cases/schema/XmlSignature/signature-example-dsa.xml
new file mode 100644
index 0000000..994954e
--- /dev/null
+++ b/v1/test/cases/schema/XmlSignature/signature-example-dsa.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
+ <SignedInfo>
+ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
+ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1" />
+ <Reference URI="http://www.w3.org/TR/xml-stylesheet">
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+ <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>
+ </Reference>
+ </SignedInfo>
+ <SignatureValue>
+ qUADDMHZkyebvRdLs+6Dv7RvgMLRlUaDB4Q9yn9XoJA79a2882ffTg==
+ </SignatureValue>
+ <KeyInfo>
+ <KeyValue>
+ <DSAKeyValue>
+ <P>
+ 2iY3w062sDB3/DIlLWOeG9+4UpmDZ0dyqRk9dLlNQ6qaXI7tOrjdIhm6n/eOw45A
+ QtuYSp6spCt9cQcNBAj22KvygvfJIIXX9sSQrugfGqifeSvY3VX5Sd1j+z0MSZ/n
+ 5jNt88uh2C11SAqX6nrXTY/1RwkoWRN23SYhOlaG0hU=
+ </P>
+ <Q>
+ 9B5ypLY9pMOmtxCeTDHgwdNFeGs=
+ </Q>
+ <G>
+ MuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooB
+ yrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27
+ wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMY=
+ </G>
+ <Y>
+ ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZ
+ AygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7z
+ Vk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ0=
+ </Y>
+ </DSAKeyValue>
+ </KeyValue>
+ <X509Data>
+ <X509SubjectName>
+ CN=Merlin Hughes,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
+ </X509SubjectName>
+ <X509IssuerSerial>
+ <X509IssuerName>
+ CN=Test DSA CA,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
+ </X509IssuerName>
+ <X509SerialNumber>970849936</X509SerialNumber>
+ </X509IssuerSerial>
+ <X509Certificate>
+ MIIDNzCCAvWgAwIBAgIEOd3+kDAJBgcqhkjOOAQDMFsxCzAJBgNVBAYTAklFMQ8w
+ DQYDVQQIEwZEdWJsaW4xJTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMs
+ IEx0ZC4xFDASBgNVBAMTC1Rlc3QgRFNBIENBMB4XDTAwMTAwNjE2MzIxNVoXDTAx
+ MTAwNjE2MzIxNFowXTELMAkGA1UEBhMCSUUxDzANBgNVBAgTBkR1YmxpbjElMCMG
+ A1UEChMcQmFsdGltb3JlIFRlY2hub2xvZ2llcywgTHRkLjEWMBQGA1UEAxMNTWVy
+ bGluIEh1Z2hlczCCAbYwggErBgcqhkjOOAQBMIIBHgKBgQDaJjfDTrawMHf8MiUt
+ Y54b37hSmYNnR3KpGT10uU1Dqppcju06uN0iGbqf947DjkBC25hKnqykK31xBw0E
+ CPbYq/KC98kghdf2xJCu6B8aqJ95K9jdVflJ3WP7PQxJn+fmM23zy6HYLXVICpfq
+ etdNj/VHCShZE3bdJiE6VobSFQIVAPQecqS2PaTDprcQnkwx4MHTRXhrAoGAMuGA
+ lqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0
+ t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcW
+ othx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMYDgYQAAoGActA8YGxrtngg/zKV
+ vqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJ
+ tgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LV
+ lMdwZNFNNJoqMcT2ZfCPrfvYvQ2jRzBFMB4GA1UdEQQXMBWBE21lcmxpbkBiYWx0
+ aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqACEJZQG0KwRbPMAkG
+ ByqGSM44BAMDMQAwLgIVAK4skWEFYgrggaJA8vYAwSjg12+KAhUAwHTo7wd4tENw
+ 9LAKPklQ/74fH18=
+ </X509Certificate>
+ </X509Data>
+ </KeyInfo>
+</Signature>
+
diff --git a/v1/test/cases/schema/XmlSignature/signature-example-rsa.xml b/v1/test/cases/schema/XmlSignature/signature-example-rsa.xml
new file mode 100644
index 0000000..0f68d77
--- /dev/null
+++ b/v1/test/cases/schema/XmlSignature/signature-example-rsa.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
+ <SignedInfo>
+ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
+ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+ <Reference URI="http://www.w3.org/TR/xml-stylesheet">
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
+ <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>
+ </Reference>
+ </SignedInfo>
+ <SignatureValue>
+ juS5RhJ884qoFR8flVXd/rbrSDVGn40CapgB7qeQiT+rr0NekEQ6BHhUA8dT3+BC
+ TBUQI0dBjlml9lwzENXvS83zRECjzXbMRTUtVZiPZG2pqKPnL2YU3A9645UCjTXU
+ +jgFumv7k78hieAGDzNci+PQ9KRmm//icT7JaYztgt4=
+ </SignatureValue>
+ <KeyInfo>
+ <KeyValue>
+ <RSAKeyValue>
+ <Modulus>
+ uCiukpgOaOmrq1fPUTH3CAXxuFmPjsmS4jnTKxrv0w1JKcXtJ2M3akaV1d/karvJ
+ lmeao20jNy9r+/vKwibjM77F+3bIkeMEGmAIUnFciJkR+ihO7b4cTuYnEi8xHtu4
+ iMn6GODBoEzqFQYdd8p4vrZBsvs44nTrS8qyyhba648=
+ </Modulus>
+ <Exponent>
+ AQAB
+ </Exponent>
+ </RSAKeyValue>
+ </KeyValue>
+ <X509Data>
+ <X509SubjectName>
+ CN=Merlin Hughes,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
+ </X509SubjectName>
+ <X509IssuerSerial>
+ <X509IssuerName>
+ CN=Test RSA CA,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
+ </X509IssuerName>
+ <X509SerialNumber>970849928</X509SerialNumber>
+ </X509IssuerSerial>
+ <X509Certificate>
+ MIICeDCCAeGgAwIBAgIEOd3+iDANBgkqhkiG9w0BAQQFADBbMQswCQYDVQQGEwJJ
+ RTEPMA0GA1UECBMGRHVibGluMSUwIwYDVQQKExxCYWx0aW1vcmUgVGVjaG5vbG9n
+ aWVzLCBMdGQuMRQwEgYDVQQDEwtUZXN0IFJTQSBDQTAeFw0wMDEwMDYxNjMyMDda
+ Fw0wMTEwMDYxNjMyMDRaMF0xCzAJBgNVBAYTAklFMQ8wDQYDVQQIEwZEdWJsaW4x
+ JTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMsIEx0ZC4xFjAUBgNVBAMT
+ DU1lcmxpbiBIdWdoZXMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALgorpKY
+ Dmjpq6tXz1Ex9wgF8bhZj47JkuI50ysa79MNSSnF7SdjN2pGldXf5Gq7yZZnmqNt
+ Izcva/v7ysIm4zO+xft2yJHjBBpgCFJxXIiZEfooTu2+HE7mJxIvMR7buIjJ+hjg
+ waBM6hUGHXfKeL62QbL7OOJ060vKssoW2uuPAgMBAAGjRzBFMB4GA1UdEQQXMBWB
+ E21lcmxpbkBiYWx0aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqA
+ CEngrZIVgu03MA0GCSqGSIb3DQEBBAUAA4GBAHJu4JVq/WnXK2oqqfLWqes5vHOt
+ fX/ZhCjFyDMhzslI8am62gZedwZ9IIZIwlNRMvEDQB2zds/eEBnIAQPl/yRLCLOf
+ ZnbA8PXrbFP5igs3qQWScBUjZVjik748HU2sUVZOa90c0mJl2vJs/RwyLW7/uCAf
+ C/I/k9xGr7fneoIW
+ </X509Certificate>
+ </X509Data>
+ </KeyInfo>
+</Signature>
+
diff --git a/v1/test/cases/schema/XmlSignature/signature-example.xml b/v1/test/cases/schema/XmlSignature/signature-example.xml
new file mode 100644
index 0000000..f14b130
--- /dev/null
+++ b/v1/test/cases/schema/XmlSignature/signature-example.xml
@@ -0,0 +1,68 @@
+<?xml version='1.0'?>
+<!-- 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. -->
+<!DOCTYPE Signature SYSTEM "xmldsig-core-schema.dtd" [
+<!ENTITY dsig "http://www.w3.org/2000/09/xmldsig#">
+ <!ENTITY % SignatureProperty.ANY '| ts:timestamp'>
+ <!ELEMENT ts:timestamp (#PCDATA)>
+ <!ATTLIST ts:timestamp
+ xmlns:ts CDATA #FIXED 'http://www.example.org/rfc/rfcxxxx.txt'>
+ <!ATTLIST Signature
+ xmlns:xsi CDATA #FIXED 'http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation CDATA #REQUIRED>
+]>
+<Signature Id="MyFirstSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2000/09/xmldsig#
+ xmldsig-core-schema.xsd">
+ <SignedInfo>
+ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2000/WD-xml-c14n-20000710">
+ </CanonicalizationMethod>
+ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa">
+ </SignatureMethod>
+ <Reference URI="http://www.w3.org/TR/xml-stylesheet/">
+ <Transforms>
+ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/>
+ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#null"/>
+ </Transforms>
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
+ </DigestMethod>
+ <DigestValue>j6lwx3rvEPO0vKtMup4NbeVu8nk=</DigestValue>
+ </Reference>
+ <Reference URI="http://www.w3.org/TR/REC-xml-names/">
+ <Transforms>
+ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/>
+ </Transforms>
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
+ </DigestMethod>
+ <DigestValue>UrXLDLBIta6skoV5/A8Q38GEw44=</DigestValue>
+ </Reference>
+ </SignedInfo>
+ <SignatureValue>MC0CFFrVLtRlkMc3Daon4BqqnkhCOlEaAhUAk8pH1iRNK+q1I+sisDTz2TFEALE=</SignatureValue>
+ <KeyInfo>
+ <KeyValue>
+ <DSAKeyValue>
+ <P>...</P><Q>...</Q><G>...</G><Y>...</Y>
+ </DSAKeyValue>
+ </KeyValue>
+ </KeyInfo>
+ <Object>
+ <SignatureProperties>
+ <SignatureProperty Target="#MyFirstSignature">
+ <ts:timestamp xmlns:ts="http://www.example.org/rfc/rfcxxxx.txt">
+ this is a test of the mixed content model</ts:timestamp>
+ </SignatureProperty>
+ </SignatureProperties>
+ </Object>
+</Signature>
diff --git a/v1/test/cases/schema/XmlSignature/xkms-1.0.wsdl b/v1/test/cases/schema/XmlSignature/xkms-1.0.wsdl
new file mode 100644
index 0000000..a8ca05f
--- /dev/null
+++ b/v1/test/cases/schema/XmlSignature/xkms-1.0.wsdl
@@ -0,0 +1,694 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<definitions name="XMLKeyManagement" xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:s="http://www.w3.org/2000/10/XMLSchema"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:xkms="http://www.xkms.org/schema/xkms-2001-01-20"
+ xmlns:tns="http://www.xkms.org/schema/xkms-2001-01-20"
+ targetNamespace="http://www.xkms.org/schema/xkms-2001-01-20">
+
+ <types>
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+ targetNamespace="http://www.w3.org/2000/09/xmldsig#"
+ version="0.1" elementFormDefault="qualified">
+
+<!-- Basic Types Defined for Signatures -->
+
+<simpleType name="CryptoBinary">
+ <restriction base="base64Binary">
+ </restriction>
+</simpleType>
+
+<!-- Start Signature -->
+
+<element name="Signature" type="ds:SignatureType"/>
+<complexType name="SignatureType">
+ <sequence>
+ <element ref="ds:SignedInfo"/>
+ <element ref="ds:SignatureValue"/>
+ <element ref="ds:KeyInfo" minOccurs="0"/>
+ <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureValue" type="ds:SignatureValueType"/>
+ <complexType name="SignatureValueType">
+ <simpleContent>
+ <extension base="base64Binary">
+ <attribute name="Id" type="ID" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+<!-- Start SignedInfo -->
+
+<element name="SignedInfo" type="ds:SignedInfoType"/>
+<complexType name="SignedInfoType">
+ <sequence>
+ <element ref="ds:CanonicalizationMethod"/>
+ <element ref="ds:SignatureMethod"/>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
+ <complexType name="CanonicalizationMethodType" mixed="true">
+ <sequence>
+ <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+ <element name="SignatureMethod" type="ds:SignatureMethodType"/>
+ <complexType name="SignatureMethodType" mixed="true">
+ <sequence>
+ <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
+ <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) external namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- Start Reference -->
+
+<element name="Reference" type="ds:ReferenceType"/>
+<complexType name="ReferenceType">
+ <sequence>
+ <element ref="ds:Transforms" minOccurs="0"/>
+ <element ref="ds:DigestMethod"/>
+ <element ref="ds:DigestValue"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="URI" type="anyURI" use="optional"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+</complexType>
+
+ <element name="Transforms" type="ds:TransformsType"/>
+ <complexType name="TransformsType">
+ <sequence>
+ <element ref="ds:Transform" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="Transform" type="ds:TransformType"/>
+ <complexType name="TransformType" mixed="true">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ <element name="XPath" type="string"/>
+ </choice>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- End Reference -->
+
+<element name="DigestMethod" type="ds:DigestMethodType"/>
+<complexType name="DigestMethodType" mixed="true">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+</complexType>
+
+<element name="DigestValue" type="ds:DigestValueType"/>
+<simpleType name="DigestValueType">
+ <restriction base="base64Binary"/>
+</simpleType>
+
+<!-- End SignedInfo -->
+
+<!-- Start KeyInfo -->
+
+<element name="KeyInfo" type="ds:KeyInfoType"/>
+
+<complexType name="KeyInfoType" mixed="true">
+ <sequence>
+<!-- <element ref="ds:KeyName"/> -->
+ <element ref="ds:KeyName"/>
+ <element ref="ds:KeyValue"/>
+ <element ref="ds:RetrievalMethod"/>
+ <element ref="ds:X509Data"/>
+ <element ref="ds:PGPData"/>
+ <element ref="ds:SPKIData"/>
+ <element ref="ds:MgmtData"/>
+ <any processContents="lax" namespace="##other"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="KeyName" type="string"/>
+ <element name="MgmtData" type="string"/>
+
+ <element name="KeyValue" type="ds:KeyValueType"/>
+ <complexType name="KeyValueType" mixed="true">
+ <choice>
+ <element ref="ds:DSAKeyValue"/>
+ <element ref="ds:RSAKeyValue"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </complexType>
+
+ <element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
+ <complexType name="RetrievalMethodType">
+ <sequence>
+ <element name="Transforms" type="ds:TransformsType" minOccurs="0"/>
+ </sequence>
+ <attribute name="URI" type="anyURI"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+ </complexType>
+
+<!-- Start X509Data -->
+
+<element name="X509Data" type="ds:X509DataType"/>
+<complexType name="X509DataType">
+ <sequence maxOccurs="unbounded">
+ <choice>
+ <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
+ <element name="X509SKI" type="base64Binary"/>
+ <element name="X509SubjectName" type="string"/>
+ <element name="X509Certificate" type="base64Binary"/>
+ <element name="X509CRL" type="base64Binary"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+</complexType>
+
+<complexType name="X509IssuerSerialType">
+ <sequence>
+ <element name="X509IssuerName" type="string"/>
+ <element name="X509SerialNumber" type="integer"/>
+ </sequence>
+</complexType>
+
+<!-- End X509Data -->
+
+<!-- Begin PGPData -->
+
+<element name="PGPData" type="ds:PGPDataType"/>
+<complexType name="PGPDataType">
+ <choice>
+ <sequence>
+ <element name="PGPKeyID" type="base64Binary"/>
+ <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </choice>
+</complexType>
+
+<!-- End PGPData -->
+
+<!-- Begin SPKIData -->
+
+<element name="SPKIData" type="ds:SPKIDataType"/>
+<complexType name="SPKIDataType">
+ <sequence maxOccurs="unbounded">
+ <element name="SPKISexp" type="base64Binary"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"/>
+ </sequence>
+</complexType>
+
+<!-- End SPKIData -->
+
+<!-- End KeyInfo -->
+
+<!-- Start Object (Manifest, SignatureProperty) -->
+
+<element name="Object" type="ds:ObjectType"/>
+<complexType name="ObjectType" mixed="true">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##any" processContents="lax"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet -->
+ <attribute name="Encoding" type="anyURI" use="optional"/>
+</complexType>
+
+<element name="Manifest" type="ds:ManifestType"/>
+<complexType name="ManifestType">
+ <sequence>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+<element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
+<complexType name="SignaturePropertiesType">
+ <sequence>
+ <element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureProperty" type="ds:SignaturePropertyType"/>
+ <complexType name="SignaturePropertyType" mixed="true">
+ <choice maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (1,unbounded) namespaces -->
+ </choice>
+ <attribute name="Target" type="anyURI" use="required"/>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+
+<!-- End Object (Manifest, SignatureProperty) -->
+
+<!-- Start Algorithm Parameters -->
+
+<simpleType name="HMACOutputLengthType">
+ <restriction base="integer"/>
+</simpleType>
+
+<!-- Start KeyValue Element-types -->
+
+<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+<complexType name="DSAKeyValueType">
+ <sequence>
+ <sequence minOccurs="0">
+ <element name="P" type="ds:CryptoBinary"/>
+ <element name="Q" type="ds:CryptoBinary"/>
+ </sequence>
+ <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
+ <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ <element name="Y" type="ds:CryptoBinary"/>
+ <sequence minOccurs="0">
+ <element name="Seed" type="ds:CryptoBinary"/>
+ <element name="PgenCounter" type="ds:CryptoBinary"/>
+ </sequence>
+ </sequence>
+</complexType>
+
+
+<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
+<complexType name="RSAKeyValueType">
+ <sequence>
+ <element name="Modulus" type="ds:CryptoBinary"/>
+ <element name="Exponent" type="ds:CryptoBinary"/>
+ </sequence>
+</complexType>
+
+<!-- End KeyValue Element-types -->
+
+<!-- End Signature -->
+
+</schema>
+
+<schema attributeFormDefault="qualified" elementFormDefault="qualified"
+ targetNamespace="http://www.xkms.org/schema/xkms-2001-01-20"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://www.w3.org/2000/09/xmldsig#"/>
+ <element name="Recover" type="xkms:RecoverType"/>
+ <element name="Revoke" type="xkms:RevokeType"/>
+ <element name="Locate" type="xkms:LocateType"/>
+ <element name="Register" type="xkms:RegisterType"/>
+ <element name="Validate" type="xkms:ValidateType"/>
+ <element name="RegisterResult" type="xkms:RegisterResultType"/>
+ <element name="RecoverResult" type="xkms:RecoverResultType"/>
+ <element name="RevokeResult" type="xkms:RevokeResultType"/>
+ <element name="LocateResult" type="xkms:LocateResultType"/>
+ <element name="ValidateResult" type="xkms:ValidateResultType"/>
+ <complexType name="LocateType">
+ <sequence>
+ <element minOccurs="0" name="TransactionID" type="string"/>
+ <element name="Query" type="xkms:KeyInfoType"/>
+ <element minOccurs="0" name="Respond" type="xkms:RespondType"/>
+ </sequence>
+ </complexType>
+ <complexType name="LocateResultType">
+ <sequence>
+ <element minOccurs="0" name="TransactionID" type="string"/>
+ <element name="Result" type="xkms:ResultCodeType"/>
+ <element minOccurs="0" name="Answer" type="xkms:LocateResultAnswerType"/>
+ <element minOccurs="0" name="ErrorInfo" type="xkms:ErrorInfoType"/>
+ <element maxOccurs="1" minOccurs="0" ref="ds:Signature"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+ <complexType name="ValidateType">
+ <sequence>
+ <element name="Query" type="xkms:KeyBindingType"/>
+ <element minOccurs="0" name="Respond" type="xkms:RespondType"/>
+ </sequence>
+ </complexType>
+ <complexType name="ValidateResultType">
+ <sequence>
+ <element name="Result" type="xkms:ResultCodeType"/>
+ <element minOccurs="0" name="Answer" type="xkms:ValidateResultAnswerType"/>
+ <element minOccurs="0" name="ErrorInfo" type="xkms:ErrorInfoType"/>
+ <element maxOccurs="1" minOccurs="0" ref="ds:Signature"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+ <complexType name="ValidateResultAnswerType">
+ <sequence>
+ <element name="KeyBinding" type="xkms:KeyBindingType"/>
+ </sequence>
+ </complexType>
+ <complexType name="RegisterType">
+ <sequence>
+ <element name="Prototype" type="xkms:KeyBindingType"/>
+ <element name="AuthInfo" type="xkms:AuthInfoType"/>
+ <element name="Respond" type="xkms:RespondType"/>
+ </sequence>
+ </complexType>
+ <complexType name="RegisterResultType">
+ <sequence>
+ <element name="Result" type="xkms:ResultCodeType"/>
+ <element minOccurs="0" name="Answer" type="xkms:RegisterResultAnswerType"/>
+ <element minOccurs="0" name="Private" type="xkms:PrivateType"/>
+ <element minOccurs="0" name="ErrorInfo" type="xkms:ErrorInfoType"/>
+ <element maxOccurs="1" minOccurs="0" ref="ds:Signature"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+ <complexType name="RegisterResultAnswerType">
+ <sequence>
+ <element name="KeyBinding" type="xkms:KeyBindingType"/>
+ </sequence>
+ </complexType>
+ <complexType name="RecoverType">
+ <sequence>
+ <element ref="xkms:Register"/>
+ </sequence>
+ </complexType>
+ <complexType name="RecoverResultType">
+ <sequence>
+ <element ref="xkms:RegisterResult"/>
+ </sequence>
+ </complexType>
+ <complexType name="RevokeType">
+ <sequence>
+ <element ref="xkms:Register"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="PrivateType">
+ <sequence>
+ <any maxOccurs="unbounded" processContents="lax"
+ minOccurs="0" namespace="##any"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="RevokeResultType">
+ <sequence>
+ <element ref="xkms:RegisterResult"/>
+ </sequence>
+ </complexType>
+ <complexType name="ErrorInfoType">
+ <sequence>
+ <element name="ErrorDescription" type="string"/>
+ <element minOccurs="0" name="ErrorActor" type="string"/>
+ <element minOccurs="0" name="ErrorDetail" type="xkms:ErrorDetailType"/>
+ </sequence>
+ <attribute name="errorCode" type="string" use="required"/>
+ </complexType>
+ <complexType name="ErrorDetailType">
+ <sequence>
+ <any namespace="##other" processContents="strict"/>
+ </sequence>
+ <anyAttribute namespace="##other" processContents="strict"/>
+ </complexType>
+ <simpleType name="ErrorCodeType">
+ <restriction base="string">
+ <enumeration value="Client"/>
+ <enumeration value="Server"/>
+ <enumeration value="Client.MalformedKeyNamePassed"/>
+ <enumeration value="Client.InvalidPassPhraseAuth"/>
+ <enumeration value="*"/>
+ </restriction>
+ </simpleType>
+ <complexType name="KeyBindingType">
+ <sequence>
+ <element minOccurs="0" name="TransactionID" type="string"/>
+ <element name="Status" type="xkms:AssertionStatusType"/>
+ <element maxOccurs="unbounded" minOccurs="0" name="KeyID" type="string"/>
+ <element minOccurs="0" ref="ds:KeyInfo"/>
+ <element minOccurs="0" name="PassPhrase" type="string"/>
+ <element minOccurs="0" name="ProcessInfo" type="xkms:ProcessInfoType"/>
+ <element minOccurs="0" name="ValidityInterval" type="xkms:ValidityIntervalType"/>
+ <element maxOccurs="unbounded" minOccurs="0" name="KeyUsage" type="xkms:KeyUsageType"/>
+ <element minOccurs="0" name="Private" type="xkms:PrivateType"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+ <complexType name="KeyInfoType">
+ <sequence>
+ <element ref="ds:KeyInfo"/>
+ </sequence>
+ </complexType>
+ <complexType name="RespondType">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" name="string" type="xkms:RespondEnum"/>
+ </sequence>
+ </complexType>
+ <simpleType name="RespondEnum">
+ <restriction base="string">
+ <enumeration value="KeyName"/>
+ <enumeration value="KeyValue"/>
+ <enumeration value="X509Cert"/>
+ <enumeration value="X509Chain"/>
+ <enumeration value="X509CRL"/>
+ <enumeration value="OCSP"/>
+ <enumeration value="RetrievalMethod"/>
+ <enumeration value="MgmtData"/>
+ <enumeration value="PGPData"/>
+ <enumeration value="PGPWeb"/>
+ <enumeration value="SPKIData"/>
+ <enumeration value="Multiple"/>
+ <enumeration value="Private"/>
+ <enumeration value="ValidityInterval"/>
+ <enumeration value="KeyUsage"/>
+ <enumeration value="Status"/>
+ <enumeration value="SignedResult"/>
+ </restriction>
+ </simpleType>
+ <complexType name="LocateResultAnswerType">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" ref="ds:KeyInfo"/>
+ </sequence>
+ </complexType>
+ <simpleType name="ResultCodeType">
+ <restriction base="string">
+ <enumeration value="Success"/>
+ <enumeration value="NoMatch"/>
+ <enumeration value="NotFound"/>
+ <enumeration value="Incomplete"/>
+ <enumeration value="Failure"/>
+ <enumeration value="Refused"/>
+ <enumeration value="Pending"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="AssertionStatusType">
+ <restriction base="string">
+ <enumeration value="Valid"/>
+ <enumeration value="Invalid"/>
+ <enumeration value="Indeterminate"/>
+ </restriction>
+ </simpleType>
+ <complexType name="ProcessInfoType">
+ <sequence maxOccurs="unbounded" minOccurs="0">
+ <any namespace="##other"/>
+ </sequence>
+ </complexType>
+ <complexType name="ValidityIntervalType">
+ <sequence>
+ <element minOccurs="0" name="NotBefore" type="timeInstant"/>
+ <element minOccurs="0" name="NotAfter" type="timeInstant"/>
+ </sequence>
+ </complexType>
+ <simpleType name="KeyUsageType">
+ <restriction base="string">
+ <enumeration value="Encryption"/>
+ <enumeration value="Signature"/>
+ <enumeration value="Exchange"/>
+ </restriction>
+ </simpleType>
+ <complexType name="AuthInfoType">
+ <choice>
+ <element name="AuthUserInfo" type="xkms:AuthUserInfoType"/>
+ <element name="AuthServerInfo" type="xkms:AuthServerInfoType"/>
+ </choice>
+ </complexType>
+ <complexType name="ProofOfPossessionType">
+ <sequence>
+ <element minOccurs="0" ref="ds:Signature"/>
+ </sequence>
+ </complexType>
+ <complexType name="KeyBindingAuthType">
+ <sequence>
+ <element minOccurs="0" ref="ds:Signature"/>
+ </sequence>
+ </complexType>
+ <complexType name="AuthUserInfoType">
+ <sequence>
+ <element minOccurs="0" name="ProofOfPossession" type="xkms:ProofOfPossessionType"/>
+ <element minOccurs="0" name="KeyBindingAuth" type="xkms:KeyBindingAuthType"/>
+ <element minOccurs="0" name="PassPhraseAuth" type="string"/>
+ </sequence>
+ </complexType>
+ <complexType name="AuthServerInfoType">
+ <sequence>
+ <element minOccurs="0" name="KeyBindingAuth" type="xkms:KeyBindingAuthType"/>
+ <element minOccurs="0" name="PassPhraseAuth" type="string"/>
+ </sequence>
+ </complexType>
+</schema>
+ </types>
+
+ <message name="Register">
+ <part name="body" element="xkms:Register"/>
+ </message>
+
+ <message name="RegisterResult">
+ <part name="body" element="xkms:RegisterResult"/>
+ </message>
+
+ <message name="Validate">
+ <part name="body" element="xkms:Validate"/>
+ </message>
+
+ <message name="ValidateResult">
+ <part name="body" element="xkms:ValidateResult"/>
+ </message>
+
+ <message name="Locate">
+ <part name="body" element="xkms:Locate"/>
+ </message>
+
+ <message name="LocateResult">
+ <part name="body" element="xkms:LocateResult"/>
+ </message>
+
+ <portType name="KeyServicePortType">
+ <operation name="Register">
+ <input message="tns:Register"/>
+ <output message="tns:RegisterResult"/>
+ <fault message="tns:RegisterResult"/>
+ </operation>
+
+ <operation name="Validate">
+ <input message="tns:Validate"/>
+ <output message="tns:ValidateResult"/>
+ <fault message="tns:ValidateResult"/>
+ </operation>
+
+ <operation name="Locate">
+ <input message="tns:Locate"/>
+ <output message="tns:LocateResult"/>
+ <fault message="tns:LocateResult"/>
+ </operation>
+ </portType>
+
+ <binding name="KeyServiceSoapBinding" type="tns:KeyServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+
+ <operation name="Register">
+ <soap:operation soapAction="http://www.xkms.org/schema/xkms-2001-01-20#Register" style="document"/>
+ <input message="tns:Register">
+ <soap:body parts="body" use="literal"/>
+ </input>
+ <output message="tns:RegisterResult">
+ <soap:body parts="body" use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="Validate">
+ <soap:operation soapAction="http://www.xkms.org/schema/xkms-2001-01-20#Validate" style="document"/>
+ <input message="tns:Validate">
+ <soap:body parts="body" use="literal"/>
+ </input>
+ <output message="tns:ValidateResult">
+ <soap:body parts="body" use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="Locate">
+ <soap:operation soapAction="http://www.xkms.org/schema/xkms-2001-01-20#Locate" style="document"/>
+ <input message="tns:Locate">
+ <soap:body parts="body" use="literal"/>
+ </input>
+ <output message="tns:LocateResult">
+ <soap:body parts="body" use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <binding name="KeyServiceHttpPostBinding" type="tns:KeyServicePortType">
+ <http:binding verb="POST"/>
+
+ <operation name="Register">
+ <http:operation location="xkms/Acceptor.nano"/>
+ <input message="tns:Register">
+ <mime:content parts="body" type="text/xml"/>
+ </input>
+ <output message="tns:RegisterResult">
+ <mime:content parts="body" type="text/xml"/>
+ </output>
+ </operation>
+
+ <operation name="Validate">
+ <http:operation location="xkms/Acceptor.nano"/>
+ <input message="tns:Validate">
+ <mime:content parts="body" type="text/xml"/>
+ </input>
+ <output message="tns:ValidateResult">
+ <mime:content parts="body" type="text/xml"/>
+ </output>
+ </operation>
+
+ <operation name="Locate">
+ <http:operation location="xkms/Acceptor.nano"/>
+ <input message="tns:Locate">
+ <mime:content parts="body" type="text/xml"/>
+ </input>
+ <output message="tns:LocateResult">
+ <mime:content parts="body" type="text/xml"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="XMLKeyManagementService">
+ <documentation>Verisign's XML Key Management Service (XKMS)</documentation>
+
+ <port name="KeyServiceSoapPort" binding="tns:KeyServiceSoapBinding">
+ <soap:address location="http://xkms.verisign.com/xkms/Acceptor.nano"/>
+ </port>
+
+ <port name="KeyServiceHttpPostPort" binding="tns:KeyServiceHttpPostBinding">
+ <http:address location="http://xkms.verisign.com/"/>
+ </port>
+ </service>
+
+ <service name="PilotXMLKeyManagementService">
+ <documentation>Verisign's Pilot XML Key Management Service (XKMS)</documentation>
+
+ <port name="KeyServiceSoapPort" binding="tns:KeyServiceSoapBinding">
+ <soap:address location="http://pilot-xkms.verisign.com/xkms/Acceptor.nano"/>
+ </port>
+
+ <port name="KeyServiceHttpPostPort" binding="tns:KeyServiceHttpPostBinding">
+ <http:address location="http://pilot-xkms.verisign.com/"/>
+ </port>
+ </service>
+</definitions>
diff --git a/v1/test/cases/schema/XmlSignature/xmldsig-core-schema.xsd b/v1/test/cases/schema/XmlSignature/xmldsig-core-schema.xsd
new file mode 100644
index 0000000..9252442
--- /dev/null
+++ b/v1/test/cases/schema/XmlSignature/xmldsig-core-schema.xsd
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE schema
+ PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"
+ [
+ <!ATTLIST schema
+ xmlns:ds CDATA #FIXED "http://www.w3.org/2000/09/xmldsig#">
+ <!ENTITY dsig 'http://www.w3.org/2000/09/xmldsig#'>
+ <!ENTITY % p ''>
+ <!ENTITY % s ''>
+ ]>
+
+<!-- Schema for XML Signatures
+ http://www.w3.org/2000/09/xmldsig#
+ $Revision$ on $Date$ by $Author$
+
+ Copyright 2001 The Internet Society and W3C (Massachusetts Institute
+ of Technology, Institut National de Recherche en Informatique et en
+ Automatique, Keio University). All Rights Reserved.
+ http://www.w3.org/Consortium/Legal/
+
+ This document is governed by the W3C Software License [1] as described
+ in the FAQ [2].
+
+ [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
+ [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+ targetNamespace="http://www.w3.org/2000/09/xmldsig#"
+ version="0.1" elementFormDefault="qualified">
+
+<!-- Basic Types Defined for Signatures -->
+
+<simpleType name="CryptoBinary">
+ <restriction base="base64Binary">
+ </restriction>
+</simpleType>
+
+<!-- Start Signature -->
+
+<element name="Signature" type="ds:SignatureType"/>
+<complexType name="SignatureType">
+ <sequence>
+ <element ref="ds:SignedInfo"/>
+ <element ref="ds:SignatureValue"/>
+ <element ref="ds:KeyInfo" minOccurs="0"/>
+ <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureValue" type="ds:SignatureValueType"/>
+ <complexType name="SignatureValueType">
+ <simpleContent>
+ <extension base="base64Binary">
+ <attribute name="Id" type="ID" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+<!-- Start SignedInfo -->
+
+<element name="SignedInfo" type="ds:SignedInfoType"/>
+<complexType name="SignedInfoType">
+ <sequence>
+ <element ref="ds:CanonicalizationMethod"/>
+ <element ref="ds:SignatureMethod"/>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
+ <complexType name="CanonicalizationMethodType" mixed="true">
+ <sequence>
+ <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+ <element name="SignatureMethod" type="ds:SignatureMethodType"/>
+ <complexType name="SignatureMethodType" mixed="true">
+ <sequence>
+ <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
+ <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (0,unbounded) elements from (1,1) external namespace -->
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- Start Reference -->
+
+<element name="Reference" type="ds:ReferenceType"/>
+<complexType name="ReferenceType">
+ <sequence>
+ <element ref="ds:Transforms" minOccurs="0"/>
+ <element ref="ds:DigestMethod"/>
+ <element ref="ds:DigestValue"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="URI" type="anyURI" use="optional"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+</complexType>
+
+ <element name="Transforms" type="ds:TransformsType"/>
+ <complexType name="TransformsType">
+ <sequence>
+ <element ref="ds:Transform" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="Transform" type="ds:TransformType"/>
+ <complexType name="TransformType" mixed="true">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ <element name="XPath" type="string"/>
+ </choice>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+ </complexType>
+
+<!-- End Reference -->
+
+<element name="DigestMethod" type="ds:DigestMethodType"/>
+<complexType name="DigestMethodType" mixed="true">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Algorithm" type="anyURI" use="required"/>
+</complexType>
+
+<element name="DigestValue" type="ds:DigestValueType"/>
+<simpleType name="DigestValueType">
+ <restriction base="base64Binary"/>
+</simpleType>
+
+<!-- End SignedInfo -->
+
+<!-- Start KeyInfo -->
+
+<element name="KeyInfo" type="ds:KeyInfoType"/>
+<complexType name="KeyInfoType" mixed="true">
+ <choice maxOccurs="unbounded">
+ <element ref="ds:KeyName"/>
+ <element ref="ds:KeyValue"/>
+ <element ref="ds:RetrievalMethod"/>
+ <element ref="ds:X509Data"/>
+ <element ref="ds:PGPData"/>
+ <element ref="ds:SPKIData"/>
+ <element ref="ds:MgmtData"/>
+ <any processContents="lax" namespace="##other"/>
+ <!-- (1,1) elements from (0,unbounded) namespaces -->
+ </choice>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="KeyName" type="string"/>
+ <element name="MgmtData" type="string"/>
+
+ <element name="KeyValue" type="ds:KeyValueType"/>
+ <complexType name="KeyValueType" mixed="true">
+ <choice>
+ <element ref="ds:DSAKeyValue"/>
+ <element ref="ds:RSAKeyValue"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </complexType>
+
+ <element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
+ <complexType name="RetrievalMethodType">
+ <sequence>
+ <element ref="ds:Transforms" minOccurs="0"/>
+ </sequence>
+ <attribute name="URI" type="anyURI"/>
+ <attribute name="Type" type="anyURI" use="optional"/>
+ </complexType>
+
+<!-- Start X509Data -->
+
+<element name="X509Data" type="ds:X509DataType"/>
+<complexType name="X509DataType">
+ <sequence maxOccurs="unbounded">
+ <choice>
+ <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
+ <element name="X509SKI" type="base64Binary"/>
+ <element name="X509SubjectName" type="string"/>
+ <element name="X509Certificate" type="base64Binary"/>
+ <element name="X509CRL" type="base64Binary"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+</complexType>
+
+<complexType name="X509IssuerSerialType">
+ <sequence>
+ <element name="X509IssuerName" type="string"/>
+ <element name="X509SerialNumber" type="integer"/>
+ </sequence>
+</complexType>
+
+<!-- End X509Data -->
+
+<!-- Begin PGPData -->
+
+<element name="PGPData" type="ds:PGPDataType"/>
+<complexType name="PGPDataType">
+ <choice>
+ <sequence>
+ <element name="PGPKeyID" type="base64Binary"/>
+ <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <sequence>
+ <element name="PGPKeyPacket" type="base64Binary"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </choice>
+</complexType>
+
+<!-- End PGPData -->
+
+<!-- Begin SPKIData -->
+
+<element name="SPKIData" type="ds:SPKIDataType"/>
+<complexType name="SPKIDataType">
+ <sequence maxOccurs="unbounded">
+ <element name="SPKISexp" type="base64Binary"/>
+ <any namespace="##other" processContents="lax" minOccurs="0"/>
+ </sequence>
+</complexType>
+
+<!-- End SPKIData -->
+
+<!-- End KeyInfo -->
+
+<!-- Start Object (Manifest, SignatureProperty) -->
+
+<element name="Object" type="ds:ObjectType"/>
+<complexType name="ObjectType" mixed="true">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##any" processContents="lax"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+ <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet -->
+ <attribute name="Encoding" type="anyURI" use="optional"/>
+</complexType>
+
+<element name="Manifest" type="ds:ManifestType"/>
+<complexType name="ManifestType">
+ <sequence>
+ <element ref="ds:Reference" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+<element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
+<complexType name="SignaturePropertiesType">
+ <sequence>
+ <element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="ID" use="optional"/>
+</complexType>
+
+ <element name="SignatureProperty" type="ds:SignaturePropertyType"/>
+ <complexType name="SignaturePropertyType" mixed="true">
+ <choice maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax"/>
+ <!-- (1,1) elements from (1,unbounded) namespaces -->
+ </choice>
+ <attribute name="Target" type="anyURI" use="required"/>
+ <attribute name="Id" type="ID" use="optional"/>
+ </complexType>
+
+<!-- End Object (Manifest, SignatureProperty) -->
+
+<!-- Start Algorithm Parameters -->
+
+<simpleType name="HMACOutputLengthType">
+ <restriction base="integer"/>
+</simpleType>
+
+<!-- Start KeyValue Element-types -->
+
+<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
+<complexType name="DSAKeyValueType">
+ <sequence>
+ <sequence minOccurs="0">
+ <element name="P" type="ds:CryptoBinary"/>
+ <element name="Q" type="ds:CryptoBinary"/>
+ </sequence>
+ <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
+ <element name="Y" type="ds:CryptoBinary"/>
+ <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
+ <sequence minOccurs="0">
+ <element name="Seed" type="ds:CryptoBinary"/>
+ <element name="PgenCounter" type="ds:CryptoBinary"/>
+ </sequence>
+ </sequence>
+</complexType>
+
+<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
+<complexType name="RSAKeyValueType">
+ <sequence>
+ <element name="Modulus" type="ds:CryptoBinary"/>
+ <element name="Exponent" type="ds:CryptoBinary"/>
+ </sequence>
+</complexType>
+
+<!-- End KeyValue Element-types -->
+
+<!-- End Signature -->
+
+</schema>
diff --git a/v1/test/cases/schema/appview/Add_AcctSiebel7.xml b/v1/test/cases/schema/appview/Add_AcctSiebel7.xml
new file mode 100644
index 0000000..5e027c5
--- /dev/null
+++ b/v1/test/cases/schema/appview/Add_AcctSiebel7.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) -->
+<?Siebel-Property-Set EscapeNames="false"?>
+<SiebelMessage MessageId="1-N" IntObjectFormat="Siebel Hierarchical" MessageType="Integration Object" IntObjectName="Sample Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="F:\Adapters\siebel\Add_AcctSiebel7_1.xsd">
+ <ListOfSampleAccount>
+ <Account>
+ <Culture/>
+ <CurrencyCode>USD</CurrencyCode>
+ <Description/>
+ <Division/>
+ <HomePage/>
+ <IntegrationId/>
+ <LineofBusiness/>
+ <Location/>
+ <Name>Demo</Name>
+ <ProjectName/>
+ <Type>Commercial</Type>
+ <ListOfAccount_Organization>
+ <Account_Organization IsPrimaryMVG="Y">
+ <IntegrationId/>
+ <Organization>Default Organization</Organization>
+ </Account_Organization>
+ </ListOfAccount_Organization>
+ <ListOfAccountAttachment/>
+ <ListOfBusinessAddress>
+ <BusinessAddress>
+ <AddressName>NY</AddressName>
+ <City>NY</City>
+ <Country>USA</Country>
+ <FaxNumber>9876543211</FaxNumber>
+ <IntegrationId/>
+ <PhoneNumber>1234567890</PhoneNumber>
+ <PostalCode>07301</PostalCode>
+ <Province/>
+ <State>NY</State>
+ <StreetAddress>2 Madision Square</StreetAddress>
+ </BusinessAddress>
+ </ListOfBusinessAddress>
+ <ListOfContact/>
+ </Account>
+ </ListOfSampleAccount>
+</SiebelMessage>
diff --git a/v1/test/cases/schema/appview/Add_AcctSiebel7.xsd b/v1/test/cases/schema/appview/Add_AcctSiebel7.xsd
new file mode 100644
index 0000000..6466b6f
--- /dev/null
+++ b/v1/test/cases/schema/appview/Add_AcctSiebel7.xsd
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xsd:element name="SiebelMessage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ListOfSampleAccount" type="ListOfSampleAccount_type" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="MessageId" type="xsd:string"/>
+ <xsd:attribute name="MessageType" type="xsd:string"/>
+ <xsd:attribute name="IntObjectName" type="xsd:string" fixed="Sample Account"/>
+ <xsd:attribute name="IntObjectFormat" type="xsd:string"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="ListOfSampleAccount_type">
+ <xsd:sequence>
+ <xsd:element name="Account" type="Account_type" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Account_type">
+ <xsd:sequence>
+ <!--xsd:element name="System" type="xsd:string" minOccurs="0"/-->
+ <xsd:element name="Culture" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="CurrencyCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Division" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="HomePage" type="xsd:string" minOccurs="0"/>
+
+ <xsd:element name="IntegrationId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="LineofBusiness" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Location" type="xsd:string" minOccurs="0"/>
+
+ <xsd:element name="Name" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ProjectName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Type" type="xsd:string" minOccurs="0"/>
+
+ <xsd:element name="ListOfAccount_Organization" type="ListOfAccount_Organization_type" minOccurs="0"/>
+
+ <xsd:element name="ListOfAccountAttachment" type="ListOfAccountAttachment_type" minOccurs="0"/>
+ <!--xsd:element name="ListOfAccountAttachment" type="xsd:string" minOccurs="0"/-->
+
+ <xsd:element name="ListOfBusinessAddress" type="ListOfBusinessAddress_type" minOccurs="0"/>
+
+ <xsd:element name="ListOfContact" type="ListOfContact_type" minOccurs="0"/>
+ <!--xsd:element name="ListOfContact" type="xsd:string" minOccurs="0"/-->
+
+ <xsd:element name="ListOfSubAccount" type="ListOfSubAccount_type" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfAccount_Organization_type">
+ <xsd:sequence>
+ <xsd:element name="Account_Organization" type="Account_Organization_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfAccountAttachment_type">
+ <xsd:sequence>
+ <xsd:element name="AccountAttachment" type="AccountAttachment_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfBusinessAddress_type">
+ <xsd:sequence>
+ <xsd:element name="BusinessAddress" type="BusinessAddress_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfContact_type">
+ <xsd:sequence>
+ <xsd:element name="Contact" type="Contact_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfContact_BusinessAddress_type">
+ <xsd:sequence>
+ <xsd:element name="Contact_BusinessAddress" type="Contact_BusinessAddress_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ListOfSubAccount_type">
+ <xsd:sequence>
+ <xsd:element name="SubAccount" type="SubAccount_type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountAttachment_type" >
+ <xsd:sequence>
+ <xsd:element name="AccntFileExt" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AccntFileName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Comment" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AttachmentId" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="Account_Organization_type">
+ <xsd:sequence>
+ <xsd:element name="IntegrationId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Organization" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="IsPrimaryMVG" type="xsd:string"/>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="BusinessAddress_type">
+ <xsd:sequence>
+ <xsd:element name="AddressName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="City" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Country" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="FaxNumber" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="IntegrationId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PhoneNumber" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Province" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="State" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="StreetAddress" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="Contact_type">
+ <xsd:sequence>
+ <xsd:element name="CellularPhone" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Comment2" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="FirstName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="HomePhone" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="IntegrationId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="JobTitle" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="LastName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="MiddleName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Organization" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PersonalContact" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ListOfContact_BusinessAddress" type="ListOfContact_BusinessAddress_type" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Contact_BusinessAddress_type">
+ <xsd:sequence>
+ <xsd:element name="City" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Country" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="State" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="StreetAddress" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="StreetAddress2" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AddressName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="IntegrationId" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="IsPrimaryMVG" type="xsd:string"/>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SubAccount_type">
+ <xsd:sequence>
+ <xsd:element name="Id" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Created" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Updated" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ConflictId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ModId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AccountStatus2" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Alias2" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AssignmentAreaCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="AssignmentCountryCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="CSN2" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Competitor" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="CurrencyCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Description" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Division" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="GroupTypeCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="InternalOrgFlag" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Location" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="LocationLevel" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="MainFaxNumber" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="MainPhoneNumber" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Name" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountDivision" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountLocation" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountLocationLevel" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="ParentAccountRegion" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PartyName" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PartyTypeCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PartyUId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PrimaryIndustryId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PrimaryOrganizationId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PrimaryPositionId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PrimaryServiceAgreementId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PrimarySynonymId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Region" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="S-SInstance" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="S-SInstanceId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="S-SKeyId" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="Type" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="operation" type="xsd:string"/>
+ <xsd:attribute name="searchspec" type="xsd:string"/>
+ </xsd:complexType>
+
+
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/DBMS1_AddCustomer_request.xsd b/v1/test/cases/schema/appview/DBMS1_AddCustomer_request.xsd
new file mode 100644
index 0000000..b8b5af9
--- /dev/null
+++ b/v1/test/cases/schema/appview/DBMS1_AddCustomer_request.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+ <xsd:element name="Input">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="FIRSTNAME" type="xsd:string"/>
+ <xsd:element name="LASTNAME" type="xsd:string"/>
+ <xsd:element name="DOB" type="xsd:dateTime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/DBMS1_AddCustomer_response.xsd b/v1/test/cases/schema/appview/DBMS1_AddCustomer_response.xsd
new file mode 100644
index 0000000..b8b4fce
--- /dev/null
+++ b/v1/test/cases/schema/appview/DBMS1_AddCustomer_response.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+ <xsd:element name="RowsAffected" type="xsd:int"/>
+
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/DBMS1_GetAllCustomers_response.xsd b/v1/test/cases/schema/appview/DBMS1_GetAllCustomers_response.xsd
new file mode 100644
index 0000000..543e3de
--- /dev/null
+++ b/v1/test/cases/schema/appview/DBMS1_GetAllCustomers_response.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+ <xsd:element name="Rows">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Row" maxOccurs="unbounded" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ADDRESS1" type="xsd:string"/>
+ <xsd:element name="ADDRESS2" type="xsd:string"/>
+ <xsd:element name="ADDRESS3" type="xsd:string"/>
+ <xsd:element name="CITY" type="xsd:string"/>
+ <xsd:element name="COUNTRY" type="xsd:string"/>
+ <xsd:element name="DOB" type="xsd:dateTime"/>
+ <xsd:element name="EMAIL" type="xsd:string"/>
+ <xsd:element name="FAX" type="xsd:string"/>
+ <xsd:element name="FIRSTNAME" type="xsd:string"/>
+ <xsd:element name="LASTNAME" type="xsd:string"/>
+ <xsd:element name="MIDDLENAME" type="xsd:string"/>
+ <xsd:element name="PHONE" type="xsd:string"/>
+ <xsd:element name="POSTALCODE" type="xsd:string"/>
+ <xsd:element name="STATE" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/HIPAA270.xml b/v1/test/cases/schema/appview/HIPAA270.xml
new file mode 100644
index 0000000..21cdc5c
--- /dev/null
+++ b/v1/test/cases/schema/appview/HIPAA270.xml
@@ -0,0 +1,260 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<!DOCTYPE HIPAA270>
+<HIPAA270>
+ <ISA>
+ <_01_Authorization_Information_Qualifier_>00</_01_Authorization_Information_Qualifier_>
+ <_02_Authorization_Information_>1234567890</_02_Authorization_Information_>
+ <_03_Security_Information_Qualifier_>00</_03_Security_Information_Qualifier_>
+ <_04_Security_Information_>1234567890</_04_Security_Information_>
+ <_05_Interchange_ID_Qualifier_>ZZ</_05_Interchange_ID_Qualifier_>
+ <_06_Interchange_Sender_ID_>SUBMITTERS ID12</_06_Interchange_Sender_ID_>
+ <_07_Interchange_ID_Qualifier_>ZZ</_07_Interchange_ID_Qualifier_>
+ <_08_Interchange_Receiver_ID_>RECEIVERS ID123</_08_Interchange_Receiver_ID_>
+ <_09_Interchange_Date_>010122</_09_Interchange_Date_>
+ <_10_Interchange_Time_>1253</_10_Interchange_Time_>
+ <_11_Repetition_Separator_>U</_11_Repetition_Separator_>
+ <_12_Interchange_Control_Version_Number_>00401</_12_Interchange_Control_Version_Number_>
+ <_13_Interchange_Control_Number_>000000905</_13_Interchange_Control_Number_>
+ <_14_Acknowledgement_Requested_>1</_14_Acknowledgement_Requested_>
+ <_15_Usage_Indicator_>T</_15_Usage_Indicator_>
+ <_16_Component_Element_Separator_>:</_16_Component_Element_Separator_>
+ </ISA>
+ <GS>
+ <_01_Functional_Identifier_Code_>HS</_01_Functional_Identifier_Code_>
+ <_02_Application_Senders_Code_>SenderID</_02_Application_Senders_Code_>
+ <_03_Application_Receivers_Code_>ReceiverID</_03_Application_Receivers_Code_>
+ <_04_Date_>20010122</_04_Date_>
+ <_05_Time_>1310</_05_Time_>
+ <_06_Group_Control_Number_>1</_06_Group_Control_Number_>
+ <_07_Responsible_Agency_Code_>X</_07_Responsible_Agency_Code_>
+ <_08_Version__Release__Industry_Identifier_Code_>004010X092</_08_Version__Release__Industry_Identifier_Code_>
+ </GS>
+ <_270>
+ <ST>
+ <_01_Transaction_Set_Identifier_Code_>270</_01_Transaction_Set_Identifier_Code_>
+ <_02_Transaction_Set_Control_Number_>1234</_02_Transaction_Set_Control_Number_>
+ </ST>
+ <BHT>
+ <_01_Hierarchical_Structure_Code_>0022</_01_Hierarchical_Structure_Code_>
+ <_02_Transaction_Set_Purpose_Code_>13</_02_Transaction_Set_Purpose_Code_>
+ <_03_Reference_Identification_>10001234</_03_Reference_Identification_>
+ <_04_Date_>19990501</_04_Date_>
+ <_05_Time_>1319</_05_Time_>
+ <_06_Transaction_Type_Code_/>
+ </BHT>
+ <_2000A>
+ <HL>
+ <_01_Hierarchical_ID_Number_>1</_01_Hierarchical_ID_Number_>
+ <_02_Hierarchical_Parent_ID_Number_/>
+ <_03_Hierarchical_Level_Code_>20</_03_Hierarchical_Level_Code_>
+ <_04_Hierarchical_Child_Code_>1</_04_Hierarchical_Child_Code_>
+ </HL>
+ <_2100A>
+ <NM1>
+ <_01_Entity_Identifier_Code_>PR</_01_Entity_Identifier_Code_>
+ <_02_Entity_Type_Qualifier_>2</_02_Entity_Type_Qualifier_>
+ <_03_Name_Last_or_Organization_Name_>ABCCOMPANY</_03_Name_Last_or_Organization_Name_>
+ <_04_Name_First_/>
+ <_05_Name_Middle_/>
+ <_06_Name_Prefix_/>
+ <_07_Name_Suffix_/>
+ <_08_Identification_Code_Qualifier_>PI</_08_Identification_Code_Qualifier_>
+ <_09_Identification_Code_>842610001</_09_Identification_Code_>
+ </NM1>
+ </_2100A>
+ <_2000B>
+ <HL>
+ <_01_Hierarchical_ID_Number_>2</_01_Hierarchical_ID_Number_>
+ <_02_Hierarchical_Parent_ID_Number_>1</_02_Hierarchical_Parent_ID_Number_>
+ <_03_Hierarchical_Level_Code_>21</_03_Hierarchical_Level_Code_>
+ <_04_Hierarchical_Child_Code_>1</_04_Hierarchical_Child_Code_>
+ </HL>
+ <_2100B>
+ <NM1>
+ <_01_Entity_Identifier_Code_>1P</_01_Entity_Identifier_Code_>
+ <_02_Entity_Type_Qualifier_>1</_02_Entity_Type_Qualifier_>
+ <_03_Name_Last_or_Organization_Name_>JONES</_03_Name_Last_or_Organization_Name_>
+ <_04_Name_First_>MARCUS</_04_Name_First_>
+ <_05_Name_Middle_/>
+ <_06_Name_Prefix_/>
+ <_07_Name_Suffix_/>
+ <_08_Identification_Code_Qualifier_>SV</_08_Identification_Code_Qualifier_>
+ <_09_Identification_Code_>0202034</_09_Identification_Code_>
+ </NM1>
+ <REF>
+ <_01_Reference_Identification_Qualifier_>N5</_01_Reference_Identification_Qualifier_>
+ <_02_Reference_Identification_>129</_02_Reference_Identification_>
+ <_03_Description_/>
+ </REF>
+ <N3>
+ <_01_Address_Information_>55 HIGH STREET</_01_Address_Information_>
+ <_02_Address_Information_/>
+ </N3>
+ <N4>
+ <_01_City_Name_>SEATTLE</_01_City_Name_>
+ <_02_State_or_Province_Code_>WA</_02_State_or_Province_Code_>
+ <_03_Postal_Code_>98123</_03_Postal_Code_>
+ <_04_Country_Code_/>
+ </N4>
+ <PER>
+ <_01_Contact_Function_Code_>IC</_01_Contact_Function_Code_>
+ <_02_Name_>MARYMURPHY</_02_Name_>
+ <_03_Communication_Number_Qualifier_>TE</_03_Communication_Number_Qualifier_>
+ <_04_Communication_Number_>2065551212</_04_Communication_Number_>
+ <_05_Communication_Number_Qualifier_>EX</_05_Communication_Number_Qualifier_>
+ <_06_Communication_Number_>3694</_06_Communication_Number_>
+ <_07_Communication_Number_Qualifier_>FX</_07_Communication_Number_Qualifier_>
+ <_08_Communication_Number_>2065551214</_08_Communication_Number_>
+ </PER>
+ </_2100B>
+ <_2000C>
+ <HL>
+ <_01_Hierarchical_ID_Number_>3</_01_Hierarchical_ID_Number_>
+ <_02_Hierarchical_Parent_ID_Number_>2</_02_Hierarchical_Parent_ID_Number_>
+ <_03_Hierarchical_Level_Code_>22</_03_Hierarchical_Level_Code_>
+ <_04_Hierarchical_Child_Code_>1</_04_Hierarchical_Child_Code_>
+ </HL>
+ <TRN>
+ <_01_Trace_Type_Code_>1</_01_Trace_Type_Code_>
+ <_02_Reference_Identification_>93175-012547</_02_Reference_Identification_>
+ <_03_Originating_Company_Identifier_>9877281234</_03_Originating_Company_Identifier_>
+ <_04_Reference_Identification_/>
+ </TRN>
+ <_2100C>
+ <NM1>
+ <_01_Entity_Identifier_Code_>IL</_01_Entity_Identifier_Code_>
+ <_02_Entity_Type_Qualifier_>1</_02_Entity_Type_Qualifier_>
+ <_03_Name_Last_or_Organization_Name_>SMITH</_03_Name_Last_or_Organization_Name_>
+ <_04_Name_First_>ROBERT</_04_Name_First_>
+ <_05_Name_Middle_>B</_05_Name_Middle_>
+ <_06_Name_Prefix_/>
+ <_07_Name_Suffix_/>
+ <_08_Identification_Code_Qualifier_>MI</_08_Identification_Code_Qualifier_>
+ <_09_Identification_Code_>11122333301</_09_Identification_Code_>
+ </NM1>
+ <REF>
+ <_01_Reference_Identification_Qualifier_>1L</_01_Reference_Identification_Qualifier_>
+ <_02_Reference_Identification_>599119</_02_Reference_Identification_>
+ </REF>
+ <N3>
+ <_01_Address_Information_>29 FREMONT ST</_01_Address_Information_>
+ <_02_Address_Information_>APT# 1</_02_Address_Information_>
+ </N3>
+ <N4>
+ <_01_City_Name_>PEACE</_01_City_Name_>
+ <_02_State_or_Province_Code_>NY</_02_State_or_Province_Code_>
+ <_03_Postal_Code_>10023</_03_Postal_Code_>
+ <_04_Country_Code_/>
+ </N4>
+ <DMG>
+ <_01_Date_Time_Period_Format_Qualifier_>D8</_01_Date_Time_Period_Format_Qualifier_>
+ <_02_Date_Time_Period_>19430519</_02_Date_Time_Period_>
+ <_03_Gender_Code_>M</_03_Gender_Code_>
+ </DMG>
+ </_2100C>
+ <_2000D>
+ <HL>
+ <_01_Hierarchical_ID_Number_>4</_01_Hierarchical_ID_Number_>
+ <_02_Hierarchical_Parent_ID_Number_>3</_02_Hierarchical_Parent_ID_Number_>
+ <_03_Hierarchical_Level_Code_>23</_03_Hierarchical_Level_Code_>
+ <_04_Hierarchical_Child_Code_>0</_04_Hierarchical_Child_Code_>
+ </HL>
+ <TRN>
+ <_01_Trace_Type_Code_>1</_01_Trace_Type_Code_>
+ <_02_Reference_Identification_>93175-012547</_02_Reference_Identification_>
+ <_03_Originating_Company_Identifier_>9877281234</_03_Originating_Company_Identifier_>
+ <_04_Reference_Identification_>RADIOLOGY</_04_Reference_Identification_>
+ </TRN>
+ <_2100D>
+ <NM1>
+ <_01_Entity_Identifier_Code_>03</_01_Entity_Identifier_Code_>
+ <_02_Entity_Type_Qualifier_>1</_02_Entity_Type_Qualifier_>
+ <_03_Name_Last_or_Organization_Name_>SMITH</_03_Name_Last_or_Organization_Name_>
+ <_04_Name_First_>MARYLOU</_04_Name_First_>
+ <_05_Name_Middle_/>
+ <_06_Name_Prefix_/>
+ <_07_Name_Suffix_/>
+ </NM1>
+ <REF>
+ <_01_Reference_Identification_Qualifier_>SY</_01_Reference_Identification_Qualifier_>
+ <_02_Reference_Identification_>003221234</_02_Reference_Identification_>
+ </REF>
+ <N3>
+ <_01_Address_Information_>29 FREMONT ST</_01_Address_Information_>
+ <_02_Address_Information_>APT# 1</_02_Address_Information_>
+ </N3>
+ <N4>
+ <_01_City_Name_>PEACE</_01_City_Name_>
+ <_02_State_or_Province_Code_>NY</_02_State_or_Province_Code_>
+ <_03_Postal_Code_>10023</_03_Postal_Code_>
+ <_04_Country_Code_/>
+ </N4>
+ <DMG>
+ <_01_Date_Time_Period_Format_Qualifier_>D8</_01_Date_Time_Period_Format_Qualifier_>
+ <_02_Date_Time_Period_>19781014</_02_Date_Time_Period_>
+ <_03_Gender_Code_>F</_03_Gender_Code_>
+ </DMG>
+ <INS>
+ <_01_Yes_No_Condition_or_Response_Code_>N</_01_Yes_No_Condition_or_Response_Code_>
+ <_02_Individual_Relationship_Code_>19</_02_Individual_Relationship_Code_>
+ <_03_Maintenance_Type_Code_/>
+ <_04_Maintenance_Reason_Code_/>
+ <_05_Benefit_Status_Code_/>
+ <_06_Medicare_Status_Code_/>
+ <_07_Consolidated_Omnibus_Budget_Reconciliation_Act__COBRA__Qualifying_Event_Code_/>
+ <_08_Employment_Status_Code_/>
+ <_09_Student_Status_Code_/>
+ <_10_Yes_No_Condition_or_Response_Code_/>
+ <_11_Date_Time_Period_Format_Qualifier_/>
+ <_12_Date_Time_Period_/>
+ <_13_Confidentiality_Code_/>
+ <_14_City_Name_/>
+ <_15_State_or_Province_Code_/>
+ <_16_Country_Code_/>
+ <_17_Number_/>
+ </INS>
+ <DTP>
+ <_01_Date_Time_Qualifier_>472</_01_Date_Time_Qualifier_>
+ <_02_Date_Time_Period_Format_Qualifier_>D8</_02_Date_Time_Period_Format_Qualifier_>
+ <_03_Date_Time_Period_>19990501</_03_Date_Time_Period_>
+ </DTP>
+ <_2110D>
+ <EQ>
+ <_01_Service_Type_Code_>81</_01_Service_Type_Code_>
+ <_02_Composite_Medical_Procedure_Identifier_/>
+ <_03_Coverage_Level_Code_>FAM</_03_Coverage_Level_Code_>
+ <_04_Insurance_Type_Code_/>
+ </EQ>
+ </_2110D>
+ </_2100D>
+ </_2000D>
+ </_2000C>
+ </_2000B>
+ </_2000A>
+ <SE>
+ <_01_Number_of_Included_Segments_>28</_01_Number_of_Included_Segments_>
+ <_02_Transaction_Set_Control_Number_>1234</_02_Transaction_Set_Control_Number_>
+ </SE>
+ </_270>
+ <GE>
+ <_01_Number_of_Transaction_Sets_Included_>1</_01_Number_of_Transaction_Sets_Included_>
+ <_02_Group_Control_Number_>1</_02_Group_Control_Number_>
+ </GE>
+ <IEA>
+ <_01_Number_of_Included_Functional_Groups_>1</_01_Number_of_Included_Functional_Groups_>
+ <_02_Interchange_Control_Number_>000000905</_02_Interchange_Control_Number_>
+ </IEA>
+</HIPAA270>
\ No newline at end of file
diff --git a/v1/test/cases/schema/appview/HIPAA270.xsd b/v1/test/cases/schema/appview/HIPAA270.xsd
new file mode 100644
index 0000000..dbc78ce
--- /dev/null
+++ b/v1/test/cases/schema/appview/HIPAA270.xsd
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+
+
+<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xsd:complexType name="DMGType">
+ <xsd:sequence>
+ <xsd:element name="_01_Date_Time_Period_Format_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Date_Time_Period_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Gender_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DTPType">
+ <xsd:sequence>
+ <xsd:element name="_01_Date_Time_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Date_Time_Period_Format_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Date_Time_Period_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="EQType">
+ <xsd:sequence>
+ <xsd:element name="_01_Service_Type_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Composite_Medical_Procedure_Identifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Coverage_Level_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Insurance_Type_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="GE">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Number_of_Transaction_Sets_Included_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Group_Control_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="GS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Functional_Identifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Application_Senders_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Application_Receivers_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_04_Date_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_05_Time_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Group_Control_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_07_Responsible_Agency_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_08_Version__Release__Industry_Identifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="HIPAA270">
+ <xsd:complexType mixed="true">
+ <xsd:sequence>
+ <xsd:element ref="ISA"/>
+ <xsd:element ref="GS"/>
+ <xsd:element ref="_270"/>
+ <xsd:element ref="GE"/>
+ <xsd:element ref="IEA"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="HLType">
+ <xsd:sequence>
+ <xsd:element name="_01_Hierarchical_ID_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Hierarchical_Parent_ID_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Hierarchical_Level_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Hierarchical_Child_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="IEA">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Number_of_Included_Functional_Groups_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Interchange_Control_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="IIIType">
+ <xsd:sequence>
+ <xsd:element name="_01_Code_List_Qualifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Industry_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="INSType">
+ <xsd:sequence>
+ <xsd:element name="_01_Yes_No_Condition_or_Response_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Individual_Relationship_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Maintenance_Type_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Maintenance_Reason_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_05_Benefit_Status_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Medicare_Status_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_07_Consolidated_Omnibus_Budget_Reconciliation_Act__COBRA__Qualifying_Event_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_08_Employment_Status_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_09_Student_Status_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_10_Yes_No_Condition_or_Response_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_11_Date_Time_Period_Format_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_12_Date_Time_Period_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_13_Confidentiality_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_14_City_Name_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_15_State_or_Province_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_16_Country_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_17_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ISA">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Authorization_Information_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Authorization_Information_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Security_Information_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Security_Information_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_05_Interchange_ID_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Interchange_Sender_ID_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_07_Interchange_ID_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_08_Interchange_Receiver_ID_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_09_Interchange_Date_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_10_Interchange_Time_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_11_Repetition_Separator_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_12_Interchange_Control_Version_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_13_Interchange_Control_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_14_Acknowledgement_Requested_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_15_Usage_Indicator_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_16_Component_Element_Separator_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="N3Type">
+ <xsd:sequence>
+ <xsd:element name="_01_Address_Information_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Address_Information_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="N4Type">
+ <xsd:sequence>
+ <xsd:element name="_01_City_Name_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_State_or_Province_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Postal_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Country_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="NM1Type">
+ <xsd:sequence>
+ <xsd:element name="_01_Entity_Identifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Entity_Type_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Name_Last_or_Organization_Name_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Name_First_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_05_Name_Middle_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Name_Prefix_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_07_Name_Suffix_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_08_Identification_Code_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_09_Identification_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PRVType">
+ <xsd:sequence>
+ <xsd:element name="_01_Provider_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Reference_Identification_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_03_Reference_Identification_" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="REFType">
+ <xsd:sequence>
+ <xsd:element name="_01_Reference_Identification_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_02_Reference_Identification_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Description_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TRNType">
+ <xsd:sequence>
+ <xsd:element name="_01_Trace_Type_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_02_Reference_Identification_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Originating_Company_Identifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Reference_Identification_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="_02_Reference_Identification_" type="xsd:string"/>
+ <xsd:element name="_02_Transaction_Set_Control_Number_" type="xsd:string"/>
+ <xsd:element name="_03_Reference_Identification_" type="xsd:string"/>
+ <xsd:element name="_04_Date_" type="xsd:string"/>
+ <xsd:element name="_05_Time_" type="xsd:string"/>
+ <xsd:element name="_270">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ST" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Transaction_Set_Identifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_02_Transaction_Set_Control_Number_" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="BHT" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Hierarchical_Structure_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Transaction_Set_Purpose_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_03_Reference_Identification_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_04_Date_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_05_Time_" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Transaction_Type_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="_2000A" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HL" type="HLType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2100A" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NM1" type="NM1Type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="_2000B" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HL" type="HLType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2100B" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NM1" type="NM1Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="REF" type="REFType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N3" type="N3Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N4" type="N4Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="PER" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Contact_Function_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Name_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_03_Communication_Number_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_04_Communication_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_05_Communication_Number_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_06_Communication_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_07_Communication_Number_Qualifier_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_08_Communication_Number_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRV" type="PRVType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="_2000C" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HL" type="HLType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="TRN" type="TRNType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2100C" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NM1" type="NM1Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="REF" type="REFType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N3" type="N3Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N4" type="N4Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="PRV" type="PRVType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DMG" type="DMGType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="INS" type="INSType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DTP" type="DTPType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2110C" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EQ" type="EQType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="AMT" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Amount_Qualifier_Code_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_02_Monetary_Amount_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="III" type="IIIType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="REF" type="REFType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DTP" type="DTPType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="_2000D" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HL" type="HLType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="TRN" type="TRNType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2100D" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NM1" type="NM1Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="REF" type="REFType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N3" type="N3Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="N4" type="N4Type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="PRV" type="PRVType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DMG" type="DMGType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="INS" type="INSType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DTP" type="DTPType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="_2110D" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EQ" type="EQType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="III" type="IIIType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="REF" type="REFType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="DTP" type="DTPType" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SE" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="_01_Number_of_Included_Segments_" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="_02_Transaction_Set_Control_Number_" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/Headers.xml b/v1/test/cases/schema/appview/Headers.xml
new file mode 100644
index 0000000..c7ce0af
--- /dev/null
+++ b/v1/test/cases/schema/appview/Headers.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- 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. -->
+<workbook>
+ <Sheet1>
+ <row>
+ <col1>FIRST NAME</col1>
+ <col2>LAST NAME</col2>
+ <col3>TITLE</col3>
+ <col4>ADDRESS</col4>
+ <col5>CITY</col5>
+ <col6>STATE</col6>
+ <col7>COUNTRY</col7>
+ </row>
+ <row>
+ <col1>Paul</col1>
+ <col2>Fearon</col2>
+ <col3>Mr</col3>
+ <col4>2 Penn Plaza</col4>
+ <col5>New York</col5>
+ <col6>New York</col6>
+ <col7>USA</col7>
+ </row>
+ <row>
+ <col1>Jeff</col1>
+ <col2>Paoletti</col2>
+ <col3>Sir</col3>
+ <col4>2 Penn Plaza</col4>
+ <col5>New York</col5>
+ <col6>New York</col6>
+ <col7>USA</col7>
+ </row>
+ <row>
+ <col1>Jonathon</col1>
+ <col2>Platt</col2>
+ <col3>Lord</col3>
+ <col4>Wembley Point, Harrow Road</col4>
+ <col5>London</col5>
+ <col6>MIDDX</col6>
+ <col7>UK</col7>
+ </row>
+ <row>
+ <col1>Eileen</col1>
+ <col2>Anderson</col2>
+ <col3>Mrs</col3>
+ <col4>Belle Plain</col4>
+ <col5>Maypen</col5>
+ <col6>Clarendon</col6>
+ <col7>Jamaica</col7>
+ </row>
+ </Sheet1>
+</workbook>
+
diff --git a/v1/test/cases/schema/appview/Headers.xsd b/v1/test/cases/schema/appview/Headers.xsd
new file mode 100644
index 0000000..4e1c67f
--- /dev/null
+++ b/v1/test/cases/schema/appview/Headers.xsd
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!--W3C Schema generated by XML Spy v4.3 U (http://www.xmlspy.com)-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xsd:element name="Sheet1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="row" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="col1" type="xsd:string"/>
+ <xsd:element name="col2" type="xsd:string"/>
+ <xsd:element name="col3">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Lord"/>
+ <xsd:enumeration value="Mr"/>
+ <xsd:enumeration value="Mrs"/>
+ <xsd:enumeration value="Sir"/>
+ <xsd:enumeration value="TITLE"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="col4" type="xsd:string"/>
+ <xsd:element name="col5" type="xsd:string"/>
+ <xsd:element name="col6" type="xsd:string"/>
+ <xsd:element name="col7">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="COUNTRY"/>
+ <xsd:enumeration value="Jamaica"/>
+ <xsd:enumeration value="UK"/>
+ <xsd:enumeration value="USA"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="row">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="col1"/>
+ <xsd:element ref="col2"/>
+ <xsd:element ref="col3"/>
+ <xsd:element ref="col4"/>
+ <xsd:element ref="col5"/>
+ <xsd:element ref="col6"/>
+ <xsd:element ref="col7"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="workbook">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Sheet1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
diff --git a/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xml b/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xml
new file mode 100644
index 0000000..fa92a75
--- /dev/null
+++ b/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<doc:RFC_CUSTOMER_GET xmlns:doc="urn:sap-com:document:sap:business:rfc">
+<KUNNR>*</KUNNR>
+<NAME1>A*</NAME1>
+<CUSTOMER_T>
+<item>
+<KUNNR></KUNNR>
+<ANRED></ANRED>
+<NAME1></NAME1>
+<PFACH></PFACH>
+<STRAS></STRAS>
+<PSTLZ></PSTLZ>
+<ORT01></ORT01>
+<TELF1></TELF1>
+<TELFX></TELFX>
+</item>
+</CUSTOMER_T>
+</doc:RFC_CUSTOMER_GET>
diff --git a/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xsd b/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xsd
new file mode 100644
index 0000000..baf6f69
--- /dev/null
+++ b/v1/test/cases/schema/appview/RFC_CUSTOMER_GET.xsd
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:doc="urn:sap-com:document
+:sap:business:rfc" elementFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:
+business:rfc">
+ <xsd:complexType name="BRFCKNA1">
+ <xsd:sequence>
+ <xsd:element name="KUNNR">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="10"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="ANRED">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="15"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="NAME1">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="35"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="PFACH">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="10"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="STRAS">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="35"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="PSTLZ">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="10"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="ORT01">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="35"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="TELF1">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="16"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="TELFX">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="31"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="RFC_CUSTOMER_GET">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="KUNNR" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="10"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="NAME1" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="35"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="CUSTOMER_T" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="item" maxOccurs="unbounded" type="doc:BRFCKNA1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
\ No newline at end of file
diff --git a/v1/test/cases/schema/appview/event_DEBMAS01.xml b/v1/test/cases/schema/appview/event_DEBMAS01.xml
new file mode 100644
index 0000000..433e013
--- /dev/null
+++ b/v1/test/cases/schema/appview/event_DEBMAS01.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!-- 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. -->
+<DEBMAS01><IDOC BEGIN="1"><EDI_DC40 SEGMENT="1"><TABNAM>EDI_DC40</TABNAM><MANDT>800</MANDT><DOCNUM>0000000000232904</DOCNUM><DOCREL>40B</DOCREL><STATUS>30</STATUS><DIRECT>1</DIRECT><OUTMOD>2</OUTMOD><EXPRSS/><TEST/><IDOCTYP>DEBMAS01</IDOCTYP><CIMTYP/><MESTYP>DEBMAS</MESTYP><MESCOD/><MESFCT/><STD/><STDVRS/><STDMES/><SNDPOR>SAPI4B</SNDPOR><SNDPRT>LS</SNDPRT><SNDPFC/><SNDPRN>I4B_CLI800</SNDPRN><SNDSAD/><SNDLAD/><RCVPOR>A000000031</RCVPOR><RCVPRT>LS</RCVPRT><RCVPFC/><RCVPRN>NON_JXA</RCVPRN><RCVSAD/><RCVLAD/><CREDAT>20020722</CREDAT><CRETIM>182939</CRETIM><REFINT/><REFGRP/><REFMES/><ARCKEY/><SERIAL>20020722182939</SERIAL>
+ </EDI_DC40><E1KNA1M SEGMENT="1"><MSGFN>005</MSGFN><KUNNR>0000000100</KUNNR><ANRED/><AUFSD/><BAHNE/><BAHNS>Düsseldorf HBF</BAHNS><BBBNR>0000000</BBBNR><BBSNR>00000</BBSNR><BEGRU/><BRSCH/><BUBKZ>0</BUBKZ><DATLT/><FAKSD/><FISKN/><KNRZA/><KONZS/><KTOKD>0001</KTOKD><KUKLA/><LAND1>DE</LAND1><LIFNR/><LIFSD/><LOCCO/><LOEVM/><NAME1>IBI Quality Assurance</NAME1><NAME2/><NAME3/><NAME4/><NIELS/><ORT01>New York</ORT01><ORT02/><PFACH/><PSTL2/><PSTLZ>10121</PSTLZ><REGIO>05</REGIO><COUNC/><CITYC/><RPMKR/><SORTL>AM</SORTL><SPERR/><SPRAS>D</SPRAS><STCD1/><STCD2/><STKZA/><STKZU/><STRAS>2 Pennsylvania Plaza</STRAS><TELBX/><TELF1>212-736-4433</TELF1><TELF2/><TELFX>212-736-4434</TELFX><TELTX/><TELX1/><LZONE>D000040000</LZONE><XZEMP/><VBUND/><STCEG>DE-12345679</STCEG><GFORM/><BRAN1/><BRAN2/><BRAN3/><BRAN4/><BRAN5/><UMJAH>0000</UMJAH><UWAER/><JMZAH>000000</JMZAH><JMJAH>0000</JMJAH><KATR1/><KATR2/><KATR3/><KATR4/><KATR5/><KATR6/><KATR7/><KATR8/><KATR9/><KATR10/><STKZN/><UMSA1>0</UMSA1><TXJCD/><PERIV/><KTOCD/><PFORT/><DTAMS/><DTAWS/><HZUOR>00</HZUOR><CIVVE>X</CIVVE><MILVE/><SPRAS_ISO>DE</SPRAS_ISO><FITYP/><STCDT/><STCD3/><STCD4/><XICMS/><XXIPI/><XSUBT/><CFOPC/><TXLW1/><TXLW2/><CCC01/><CCC02/><CCC03/><CCC04/><CASSD/><KDKG1/><KDKG2/><KDKG3/><KDKG4/><KDKG5/><E1KNB1M SEGMENT="1"><MSGFN>005</MSGFN><BUKRS>GL1000</BUKRS><SPERR/><LOEVM/><ZUAWA>002</ZUAWA><BUSAB/><AKONT>0000140000</AKONT><BEGRU/><KNRZE/><KNRZB/><ZAMIM/><ZAMIV/><ZAMIR/><ZAMIB/><ZAMIO/><ZWELS/><XVERR/><ZAHLS/><ZTERM>ZB01</ZTERM><WAKON/><VZSKZ/><ZINDT>00000000</ZINDT><ZINRT>00</ZINRT><EIKTO>0000000100</EIKTO><ZSABE/><KVERM/><FDGRV>E2</FDGRV><VRBKZ/><VLIBB>0</VLIBB><VRSZL>0</VRSZL><VRSPR>0</VRSPR><VRSNR/><VERDT>00000000</VERDT><PERKZ/><XDEZV/><XAUSZ/><WEBTR>0</WEBTR><REMIT/><DATLZ>00000000</DATLZ><XZVER>X</XZVER><TOGRU/><KULTG>0</KULTG><HBKID/><XPORE/><BLNKZ/><ALTKN/><ZGRUP/><URLID/><MGRUP/><LOCKB/><UZAWE/><EKVBD/><SREGL/><XEDIP/><FRGRP/><VRSDG/><TLFXS/><PERNR>00000000</PERNR><INTAD/><GUZTE/><GRICD/><GRIDT/><E1KNB5M SEGMENT="1"><MSGFN>005</MSGFN><MABER/><MAHNA>0001</MAHNA><MANSP/><MADAT>00000000</MADAT><MAHNS>0</MAHNS><KNRMA/><GMVDT>00000000</GMVDT><BUSAB/></E1KNB5M></E1KNB1M></E1KNA1M></IDOC></DEBMAS01>
\ No newline at end of file
diff --git a/v1/test/cases/schema/appview/event_DEBMAS01.xsd b/v1/test/cases/schema/appview/event_DEBMAS01.xsd
new file mode 100644
index 0000000..5b9e6d0
--- /dev/null
+++ b/v1/test/cases/schema/appview/event_DEBMAS01.xsd
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"><xsd:element name="DEBMAS01"><xsd:complexType><xsd:sequence><xsd:element name="IDOC"><xsd:complexType><xsd:sequence><xsd:element name="EDI_DC40" minOccurs="0" maxOccurs="1"><xsd:complexType><xsd:sequence><xsd:element name="TABNAM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MANDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOCNUM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOCREL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STATUS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIRECT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="OUTMOD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="EXPRSS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TEST" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="IDOCTYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CIMTYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MESTYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MESCOD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MESFCT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STDVRS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STDMES" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDPOR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDPRT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDPFC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDPRN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDSAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="21"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SNDLAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="70"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVPOR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVPRT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVPFC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVPRN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVSAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="21"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RCVLAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="70"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CREDAT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:date"/></xsd:simpleType></xsd:element><xsd:element name="CRETIM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:time"/></xsd:simpleType></xsd:element><xsd:element name="REFINT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="REFGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="REFMES" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ARCKEY" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="70"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SERIAL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="20"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNA1M" minOccurs="0" maxOccurs="1"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KUNNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ANRED" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AUFSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BAHNE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="25"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BAHNS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="25"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BBBNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="7"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BBSNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BEGRU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRSCH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BUBKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DATLT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FAKSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FISKN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNRZA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KONZS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KTOKD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KUKLA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LAND1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LIFNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LIFSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LOCCO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LOEVM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NIELS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ORT01" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ORT02" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PFACH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PSTL2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PSTLZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="REGIO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="COUNC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CITYC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RPMKR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SORTL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPERR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPRAS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCD1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCD2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="11"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STKZA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STKZU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STRAS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELBX" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELF1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELF2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELFX" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="31"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELTX" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELX1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LZONE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XZEMP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VBUND" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCEG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="20"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GFORM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRAN1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRAN2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRAN3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRAN4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRAN5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="UMJAH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="UWAER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="JMZAH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="JMJAH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR6" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR7" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR8" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR9" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KATR10" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STKZN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="UMSA1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TXJCD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PERIV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KTOCD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PFORT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DTAMS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DTAWS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="HZUOR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CIVVE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MILVE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPRAS_ISO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FITYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCD3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="18"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STCD4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="18"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XICMS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XXIPI" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XSUBT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CFOPC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TXLW1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TXLW2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CCC01" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CCC02" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CCC03" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CCC04" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CASSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDKG1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDKG2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDKG3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDKG4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDKG5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="E1KNVVM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VKORG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VTWEG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPART" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BEGRU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LOEVM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VERSG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AUFSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KALKS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BZIRK" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KONDA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PLTYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AWAHR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="INCO1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="INCO2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="28"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LIFSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AUTLF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ANTLF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KZTLF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KZAZU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CHSPL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LPRIO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="EIKTO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="12"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VSBED" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FAKSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MRNKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PERFK" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PERRL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="WAERS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KTGRD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZTERM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VWERK" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VKGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VKBUR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VSORT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVGR1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVGR2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVGR3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVGR4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVGR5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BOKRE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KURST" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PRFRE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KLABC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KABSS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KKBER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CASSD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="RDOFF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="E1KNVPM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARVW" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KUNN2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DEFPA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNREF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNVDM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOCTP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPRAS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOANZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOVER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NACHA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPRAS_ISO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNVIM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ALAND" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TATYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TAXKD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNVLM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ALAND" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TATYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LICNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DATAB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DATBI" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BELIC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNB1M" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BUKRS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPERR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LOEVM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZUAWA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BUSAB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AKONT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BEGRU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNRZE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNRZB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAMIM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAMIV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAMIR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAMIB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAMIO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZWELS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XVERR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZAHLS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZTERM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="WAKON" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VZSKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZINDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZINRT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="EIKTO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="12"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZSABE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KVERM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FDGRV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRBKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VLIBB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRSZL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRSPR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRSNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VERDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PERKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XDEZV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XAUSZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="WEBTR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="14"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="REMIT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DATLZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XZVER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TOGRU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KULTG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="HBKID" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XPORE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BLNKZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ALTKN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ZGRUP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="URLID" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MGRUP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="LOCKB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="7"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="UZAWE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="EKVBD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SREGL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XEDIP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRSDG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TLFXS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="31"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PERNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="INTAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="130"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GUZTE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GRICD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GRIDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="E1KNB5M" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MABER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MAHNA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MANSP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MADAT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MAHNS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNRMA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GMVDT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BUSAB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNBKM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BANKS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BANKL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BANKN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="18"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BKONT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BVTYP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XEZER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BKREF" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="20"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BANKA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="60"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STRAS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ORT01" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SWIFT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="11"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BGRUP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="XPGRO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BNKLZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PSKTO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRNCH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="40"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PROVZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KOINH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNVAM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ABLAD" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="25"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNFAK" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="WANID" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SAAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SABI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SAAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SABI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DEFAB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNVKM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAMEV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ABTPA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="12"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ABTNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="UEPAR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELF1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ANRED" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="30"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAFKT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARVO" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAVIP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARGE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARLA" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GBDAT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="VRTNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="BRYTH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="AKVER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NMAIL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARAU" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="40"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARH1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARH2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARH3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARH4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PARH5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DIBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="MIBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FRBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SAAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SABI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SAAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SABI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOAB1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOBI1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOAB2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SOBI2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="6"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAKN1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAKN2" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAKN3" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAKN4" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAKN5" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SORTL" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="FAMST" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SPNAM" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TITEL_AP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNKAM" minOccurs="0" maxOccurs="1"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KLIMG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KLIME" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="WAERS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DLAUS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element><xsd:element name="E1KNKKM" minOccurs="0" maxOccurs="9999"><xsd:complexType><xsd:sequence><xsd:element name="MSGFN" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KKBER" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KLIMK" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KNKLI" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CTLPC" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DTREV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="CRBLB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="1"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SBGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NXTRV" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KRAUS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="11"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PAYDB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="2"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBRAT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="REVDB" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="GRUPP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="4"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="SBDAT" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="KDGRP" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBPAY" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBRTG" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="5"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBEKR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="17"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBWAE" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="3"/></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="DBMON" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="8"/></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="SEGMENT" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="BEGIN" use="required"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:enumeration value="1"/></xsd:restriction></xsd:simpleType></xsd:attribute></xsd:complexType></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
\ No newline at end of file
diff --git a/v1/test/cases/schema/dynamic/dyntest.xml b/v1/test/cases/schema/dynamic/dyntest.xml
new file mode 100644
index 0000000..877e2d5
--- /dev/null
+++ b/v1/test/cases/schema/dynamic/dyntest.xml
@@ -0,0 +1,21 @@
+<!-- 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. -->
+<dt:wrappedinstance xmlns:dt="http://openuri.org/test/dyntest">
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://openuri.org/test/quant">
+ <xs:element name="quantity" type="xs:int"/>
+ </xs:schema>
+ <qt:quantity xmlns:qt="http://openuri.org/test/quant">
+ 42
+ </qt:quantity>
+</dt:wrappedinstance>
\ No newline at end of file
diff --git a/v1/test/cases/schema/dynamic/dyntest.xsd b/v1/test/cases/schema/dynamic/dyntest.xsd
new file mode 100644
index 0000000..e7a7f81
--- /dev/null
+++ b/v1/test/cases/schema/dynamic/dyntest.xsd
@@ -0,0 +1,31 @@
+<!-- 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. -->
+<xs:schema targetNamespace="http://openuri.org/test/dyntest"
+ blockDefault="#all"
+ elementFormDefault="qualified"
+ version="1.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xml:lang="EN">
+
+ <xs:element name="wrappedinstance">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="xs:schema"/>
+ <xs:any namespace="##any" processContents="lax"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
diff --git a/v1/test/cases/schema/dynamic/dyntest2.xml b/v1/test/cases/schema/dynamic/dyntest2.xml
new file mode 100644
index 0000000..77987b6
--- /dev/null
+++ b/v1/test/cases/schema/dynamic/dyntest2.xml
@@ -0,0 +1,18 @@
+<!-- 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. -->
+<dt:wrappedwildcard xmlns:dt="http://openuri.org/test/dyntest">
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://openuri.org/test/quant">
+ <xs:element name="quantity" type="xs:int"/>
+ </xs:schema>
+</dt:wrappedwildcard>
\ No newline at end of file
diff --git a/v1/test/cases/schema/dynamic/dyntest2.xsd b/v1/test/cases/schema/dynamic/dyntest2.xsd
new file mode 100644
index 0000000..3497cb2
--- /dev/null
+++ b/v1/test/cases/schema/dynamic/dyntest2.xsd
@@ -0,0 +1,30 @@
+<!-- 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. -->
+<xs:schema targetNamespace="http://openuri.org/test/dyntest"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ blockDefault="#all"
+ elementFormDefault="qualified"
+ version="1.0"
+ xml:lang="EN">
+
+ <xs:element name="wrappedwildcard">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
diff --git a/v1/test/cases/schema/pricequote/PriceQuote.xsd b/v1/test/cases/schema/pricequote/PriceQuote.xsd
new file mode 100644
index 0000000..64efe83
--- /dev/null
+++ b/v1/test/cases/schema/pricequote/PriceQuote.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xsd:element name="price-quote">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="stock-symbol" minOccurs="1" maxOccurs="1"/>
+ <xsd:element ref="stock-price" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- XXXSJM change following to use refined datatypes -->
+ <xsd:element name="stock-symbol" type="xsd:string"/>
+ <xsd:element name="stock-price" type="xsd:string"/>
+</xsd:schema>
+
diff --git a/v1/test/cases/schema/ra/ra.xsd b/v1/test/cases/schema/ra/ra.xsd
new file mode 100644
index 0000000..21e2ff9
--- /dev/null
+++ b/v1/test/cases/schema/ra/ra.xsd
@@ -0,0 +1,25 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mt="http://openuri.org/mytest/rowsaffected"
+ targetNamespace="http://openuri.org/mytest/rowsaffected"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+>
+
+ <xs:element name="rowsAffected" type="xs:int"/>
+
+</xs:schema>
+
diff --git a/v1/test/cases/schema/simple/javasrc/SimplePersonTest.java b/v1/test/cases/schema/simple/javasrc/SimplePersonTest.java
new file mode 100644
index 0000000..1d2f2f5
--- /dev/null
+++ b/v1/test/cases/schema/simple/javasrc/SimplePersonTest.java
@@ -0,0 +1,110 @@
+/* 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.
+ */
+
+import org.openuri.mytest.Person;
+import org.openuri.mytest.CustomerDocument;
+
+import java.util.Date;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlCursor;
+import drtcases.TestEnv;
+import junit.framework.Assert;
+
+import org.apache.xmlbeans.impl.store.Root;
+
+public class SimplePersonTest
+{
+ public static void main(String args[]) throws Exception
+ {
+ test();
+ }
+
+ public static void test() throws Exception
+ {
+ CustomerDocument doc =
+ CustomerDocument.Factory.parse(
+ TestEnv.xbeanCase("schema/simple/person.xml"), null);
+
+ // Move from the root to the root customer element
+ Person person = doc.getCustomer();
+ Assert.assertEquals("Howdy", person.getFirstname());
+ Assert.assertEquals(4, person.sizeOfNumberArray());
+ Assert.assertEquals(436, person.getNumberArray(0));
+ Assert.assertEquals(123, person.getNumberArray(1));
+ Assert.assertEquals(44, person.getNumberArray(2));
+ Assert.assertEquals(933, person.getNumberArray(3));
+ Assert.assertEquals(2, person.sizeOfBirthdayArray());
+ Assert.assertEquals(new Date("Tue Aug 25 17:00:00 PDT 1998"), person.getBirthdayArray(0));
+
+ Person.Gender.Enum g = person.getGender();
+ Assert.assertEquals(Person.Gender.MALE, g);
+
+ Assert.assertEquals("EGIQTWYZJ", new String(person.getHex()));
+ Assert.assertEquals("This string is base64Binary encoded!",
+ new String(person.getBase64()));
+
+ Assert.assertEquals("GGIQTWYGG", new String(person.getHexAtt()));
+ Assert.assertEquals("This string is base64Binary encoded!",
+ new String(person.getBase64Att()));
+
+ person.setFirstname("George");
+ Assert.assertEquals("George", person.getFirstname());
+
+ person.setHex("hex encoding".getBytes());
+ Assert.assertEquals("hex encoding", new String(person.getHex()));
+
+ person.setBase64("base64 encoded".getBytes());
+ Assert.assertEquals("base64 encoded",
+ new String(person.getBase64()));
+
+ //person.setHexAtt("hex encoding in attributes".getBytes());
+ //Assert.assertEquals("hex encoding in attributes",
+ // new String(person.getHexAtt()));
+
+ //person.setBase64Att("base64 encoded in attributes".getBytes());
+ //Assert.assertEquals("base64 encoded in attributes",
+ // new String(person.getBase64Att()));
+//
+// XmlCursor cp = person.newXmlCursor();
+// Root.dump( cp );
+
+// XmlCursor c = person.xgetBirthdayArray(0).newXmlCursor();
+
+// Root.dump( c );
+
+// person.setBirthday(0,new Date("Tue Aug 25 16:00:00 PDT 2001"));
+
+// Root.dump( c );
+
+// c.toNextToken();
+
+// System.out.println( "---" + c.getText() + "---" );
+
+// Root.dump( c );
+
+// Assert.assertEquals(person.getBirthdayArray(0), new Date("Tue Aug 25 16:00:00 PDT 2002"));
+//
+// person.setFirstname("George");
+// Assert.assertEquals(person.getFirstname(), "George");
+//
+// person.addNumber( (short) 69 );
+// Assert.assertEquals(person.countNumber(), 5);
+// Assert.assertEquals(person.getNumberArray(4), 69);
+//
+//
+// while ( c.hasNextToken() )
+// c.toNextToken();
+ }
+}
diff --git a/v1/test/cases/schema/simple/person.xml b/v1/test/cases/schema/simple/person.xml
new file mode 100644
index 0000000..a4354d2
--- /dev/null
+++ b/v1/test/cases/schema/simple/person.xml
@@ -0,0 +1,29 @@
+<!-- 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. -->
+<customer xmlns="http://openuri.org/mytest"
+ gender="male"
+ hexAtt="474749515457594747"
+ base64Att="
+ VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh
+ ">
+ <firstname>Howdy</firstname>
+ <number>436</number>
+ <number>123</number>
+ <birthday>1998-08-26Z</birthday>
+ <number>44</number>
+ <number>933</number>
+ <birthday>2000-08-06-08:00</birthday>
+ <hex>454749515457595A4A</hex>
+ <base64>VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh</base64>
+</customer>
diff --git a/v1/test/cases/schema/simple/person.xsd b/v1/test/cases/schema/simple/person.xsd
new file mode 100644
index 0000000..d412e86
--- /dev/null
+++ b/v1/test/cases/schema/simple/person.xsd
@@ -0,0 +1,78 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mt="http://openuri.org/mytest"
+ targetNamespace="http://openuri.org/mytest"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified" >
+
+ <xs:complexType name="person">
+ <xs:sequence>
+ <xs:element name="firstname" type="xs:string"/>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="number">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="1000"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="birthday" type="xs:date"/>
+ </xs:choice>
+ <xs:element name="hex" type="xs:hexBinary"/>
+ <xs:element name="base64" type="xs:base64Binary"/>
+ </xs:sequence>
+ <xs:attribute name="gender">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="male"/>
+ <xs:enumeration value="female"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="hexAtt">
+ <xs:simpleType>
+ <xs:restriction base="xs:hexBinary">
+ <xs:pattern value="([45][0-9A-F])*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="base64Att">
+ <xs:simpleType>
+ <xs:restriction base="xs:base64Binary">
+ <xs:whiteSpace value="collapse"/>
+ <xs:enumeration value="VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:element name="customer" type="mt:person"/>
+
+ <xs:element name="employee">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="mt:person">
+ <xs:sequence>
+ <xs:element name="eid" type="xs:int"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
diff --git a/v1/test/cases/schema/simple/simplec.xsd b/v1/test/cases/schema/simple/simplec.xsd
new file mode 100644
index 0000000..442cdeb
--- /dev/null
+++ b/v1/test/cases/schema/simple/simplec.xsd
@@ -0,0 +1,40 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mt="http://openuri.org/mytest"
+ targetNamespace="http://openuri.org/mytest"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+>
+
+ <xs:complexType name="simplicity">
+ <xs:simpleContent>
+ <xs:extension base="mt:thousand">
+ <xs:attribute name="note" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="thousand">
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="1000"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="simple" type="mt:simplicity"/>
+
+</xs:schema>
+
diff --git a/v1/test/cases/schema/wli/003_process_po_007.xsd b/v1/test/cases/schema/wli/003_process_po_007.xsd
new file mode 100644
index 0000000..57e1f5c
--- /dev/null
+++ b/v1/test/cases/schema/wli/003_process_po_007.xsd
@@ -0,0 +1,220 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<!-- ====================================================
+ License information for this file is provided in LICENSE.TXT, as published
+ on the Open Applications Group web site. www.openapplications.org
+
+ For support, more information, or to report implementation bugs,
+ please contact the Open Applications Group at xml@openapplications.org
+
+ $Revision$
+ $Date$
+ Open Applications Group XSD
+ Copyright 1998-2001, All Rights Reserved
+
+ $Name: $
+
+cmk 6.2.0 11/22/1999 Initial Release - update from version 003
+ Add POLNSTATUS, DATETIME.NEEDDELV to POORDERLIN
+ Fix processing note rules
+rjj 7.0.0 10/15/2000 Special Revision Update
+rjj 7.0.2 11/24/2000 Allow multiple instances of NOTES.
+mlr 7.1 04/16/2001 Add ATTCHREF to BOD.
+ajw 7.2.1 10/31/2001 W3C Schema Release
+
+Structure Overview
+
+ PROCESS_PO (POORDERHDR, POORDERLIN+)
+ POORDERHDR (PARTNER+, ATTCHREF*, CHARGE*, POTERM*)
+ POTERM ()
+ POORDERLIN (ATTCHREF*, CHARGE*, DISTRIBUTN*, PARTNER*, POTERM*,
+ POBSUBLINE*, POLINESCHD*)
+ POTERM ()
+ POSUBLINE ()
+ POLINESCHD ()
+
+Notes:
+
+-->
+<xs:schema targetNamespace="http://www.openapplications.org/003_process_po_007" xmlns:os="http://www.openapplications.org/oagis_segments" xmlns:of="http://www.openapplications.org/oagis_fields" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.openapplications.org/003_process_po_007">
+ <xs:import namespace="http://www.openapplications.org/oagis_segments" schemaLocation="oagis_segments.xsd"/>
+ <xs:import namespace="http://www.openapplications.org/oagis_fields" schemaLocation="oagis_fields.xsd"/>
+ <xs:element name="PROCESS_PO_007">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:CNTROLAREA"/>
+ <xs:element ref="DATAAREA" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DATAAREA">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="PROCESS_PO"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PROCESS_PO">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="POORDERHDR"/>
+ <xs:element ref="POORDERLIN" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POORDERHDR">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:POID"/>
+ <xs:element ref="of:POTYPE"/>
+ <xs:element ref="of:ACKREQUEST" minOccurs="0"/>
+ <xs:element ref="of:CONTRACTB" minOccurs="0"/>
+ <xs:element ref="of:CONTRACTS" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:OPRAMTAUTH" minOccurs="0"/>
+ <xs:element ref="of:PORELEASE" minOccurs="0"/>
+ <xs:element ref="of:TAXWHEXMPT" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="os:PARTNER" maxOccurs="unbounded"/>
+ <xs:element ref="os:ATTCHREF" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:CHARGE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POTERM" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (%DATETIME.DOCUMENT;)? -->
+ <!-- (%OPERAMT.EXTENDED.T;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POTERM">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:TERMID" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DAYOFMONTH"/>
+ <xs:element ref="of:PROXMONTH"/>
+ </xs:sequence>
+ <xs:element ref="of:DAYSNUM"/>
+ </xs:choice>
+ <xs:choice>
+ <xs:element ref="os:OPERAMT"/>
+ <xs:element ref="os:QUANTITY"/>
+ <!-- (%OPERAMT.EXTENDED.T;)? -->
+ <!-- (%QUANTITY.PERCENT;) -->
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- ((DAYOFMONTH, PROXMONTH) | DAYSNUM), ((%OPERAMT.EXTENDED.T;) | (%QUANTITY.PERCENT;)) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POORDERLIN">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:POLINENUM"/>
+ <xs:element ref="of:DRAWING" minOccurs="0"/>
+ <xs:element ref="of:HAZRDMATL" minOccurs="0"/>
+ <xs:element ref="of:ITEMRV" minOccurs="0"/>
+ <xs:element ref="of:ITEMRVX" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:PACKING" minOccurs="0"/>
+ <xs:element ref="of:POLNSTATUS" minOccurs="0"/>
+ <xs:element ref="of:TAXWHEXMPT" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN"/>
+ <xs:element ref="of:ITEM" minOccurs="0"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEM"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEMX"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:UPC"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="os:ATTCHREF" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:CHARGE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:DISTRIBUTN" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:PARTNER" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POTERM" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POSUBLINE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POLINESCHD" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (%QUANTITY.PERCENT;)) -->
+ <!-- (%DATETIME.NEEDDELV;)? -->
+ <!-- (%OPERAMT.UNIT.T;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POSUBLINE">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="of:DRAWING" minOccurs="0"/>
+ <xs:element ref="of:ITEMRV" minOccurs="0"/>
+ <xs:element ref="of:ITEMRVX" minOccurs="0"/>
+ <xs:element ref="of:PSBLINENUM" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN"/>
+ <xs:element ref="of:ITEM" minOccurs="0"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEM"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEMX"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:UPC"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%QUANTITY.ITEM;) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POLINESCHD">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:PSCLINENUM" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%DATETIME.NEEDDELV;) -->
+ <!-- (%QUANTITY.ORDERED;) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/v1/test/cases/schema/wli/004_acknowledge_po_008.xsd b/v1/test/cases/schema/wli/004_acknowledge_po_008.xsd
new file mode 100644
index 0000000..bcde8b7
--- /dev/null
+++ b/v1/test/cases/schema/wli/004_acknowledge_po_008.xsd
@@ -0,0 +1,260 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<!-- ====================================================
+ License information for this file is provided in LICENSE.TXT, as published
+ on the Open Applications Group web site. www.openapplications.org
+
+ For support, more information, or to report implementation bugs,
+ please contact the Open Applications Group at xml@openapplications.org
+
+ $Revision$
+ $Date$
+ Open Applications Group XSD
+ Copyright 1998-2001, All Rights Reserved
+
+ $Name: $
+
+ cmk 6.2.0 11/22/1999 Initial Release - Update from version 003
+ Add POLNSTATUS, DATETIME.NEEDDELV to POORDERLIN
+ Fix processing note rules
+ rjj 7.0.0 10/15/2000 Special Revision Update
+ rjj 7.0.2 11/24/2000 Allow multiple instances of NOTES.
+ mlr 7.1 04/16/2001 Add ATTCHREF to BOD.
+ ajw 7.2 09/30/2001 Made ACKLINE segment '0 to many' times
+ ajw 7.2.1 09/01/00 W3C Schema Release
+
+ Structure Overview
+
+ ACKNOWLEDGE_PO (POORDERHDR, POORDERLIN*)
+ POORDERHDR (ACKHEADER, ATTCHREF*, CHARGE*, PARTNER*, POTERM*)
+ ACKHEADER ()
+ POTERM ()
+ POORDERLIN (ACKLINE*, ATTCHREF*, CHARGE*, DISTRIBUTN*, PARTNER*,
+ POLINESCHD*, POSUBLINE*, POTERM*)
+ ACKLINE ()
+ PARTNER ()
+ POLINESCHD ()
+ POSUBLINE ()
+ POTERM ()
+
+Notes:
+
+-->
+<xs:schema targetNamespace="http://www.openapplications.org/004_acknowledge_po_008" xmlns="http://www.openapplications.org/004_acknowledge_po_008" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:of="http://www.openapplications.org/oagis_fields" xmlns:os="http://www.openapplications.org/oagis_segments">
+ <xs:import namespace="http://www.openapplications.org/oagis_segments" schemaLocation="oagis_segments.xsd"/>
+ <xs:import namespace="http://www.openapplications.org/oagis_fields" schemaLocation="oagis_fields.xsd"/>
+ <xs:element name="ACKNOWLEDGE_PO_008">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:CNTROLAREA"/>
+ <xs:element ref="DATAAREA" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DATAAREA">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ACKNOWLEDGE_PO"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ACKNOWLEDGE_PO">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="POORDERHDR"/>
+ <xs:element ref="POORDERLIN" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POORDERHDR">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:POID"/>
+ <xs:element ref="of:POTYPE"/>
+ <xs:element ref="of:ACKREQUEST" minOccurs="0"/>
+ <xs:element ref="of:CONTRACTB" minOccurs="0"/>
+ <xs:element ref="of:CONTRACTS" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:OPRAMTAUTH" minOccurs="0"/>
+ <xs:element ref="of:PORELEASE" minOccurs="0"/>
+ <xs:element ref="of:TAXWHEXMPT" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="ACKHEADER"/>
+ <xs:element ref="os:ATTCHREF" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:CHARGE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:PARTNER" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POTERM" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (%DATETIME.DOCUMENT;)? -->
+ <!-- (%OPERAMT.EXTENDED.T;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ACKHEADER">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:SENDER"/>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="of:ACKCODE"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:SALESORDID" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%DATETIME.PROMDELV;)? -->
+ <!-- (%DATETIME.PROMSHIP;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POTERM">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:TERMID" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DAYOFMONTH"/>
+ <xs:element ref="of:PROXMONTH"/>
+ </xs:sequence>
+ <xs:element ref="of:DAYSNUM"/>
+ </xs:choice>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="os:OPERAMT"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="os:QUANTITY"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- ((DAYOFMONTH, PROXMONTH) | DAYSNUM), ((%OPERAMT.EXTENDED.T;) | (%QUANTITY.PERCENT;)) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POORDERLIN">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:POLINENUM"/>
+ <xs:element ref="of:DRAWING" minOccurs="0"/>
+ <xs:element ref="of:HAZRDMATL" minOccurs="0"/>
+ <xs:element ref="of:ITEMRV" minOccurs="0"/>
+ <xs:element ref="of:ITEMRVX" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:PACKING" minOccurs="0"/>
+ <xs:element ref="of:POLNSTATUS" minOccurs="0"/>
+ <xs:element ref="of:TAXWHEXMPT" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN"/>
+ <xs:element ref="of:ITEM" minOccurs="0"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEM"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEMX"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:UPC"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="ACKLINE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:ATTCHREF" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:CHARGE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:DISTRIBUTN" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="os:PARTNER" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POTERM" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POSUBLINE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="POLINESCHD" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- (%QUANTITY.PERCENT;)) -->
+ <!-- (%DATETIME.NEEDDELV;)? -->
+ <!-- (%OPERAMT.UNIT.T;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ACKLINE">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:QUANTITY" minOccurs="0"/>
+ <xs:element ref="of:ACKCODE"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:SALESORDID" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%DATETIME.PROMDELV;)? -->
+ <!-- (%DATETIME.PROMSHIP;)? -->
+ <!-- (%QUANTITY.ORDERED;)? -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POSUBLINE">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="of:DRAWING" minOccurs="0"/>
+ <xs:element ref="of:ITEMRV" minOccurs="0"/>
+ <xs:element ref="of:ITEMRVX" minOccurs="0"/>
+ <xs:element ref="of:PSBLINENUM" minOccurs="0"/>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element ref="of:DESCRIPTN"/>
+ <xs:element ref="of:ITEM" minOccurs="0"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEM"/>
+ <xs:element ref="of:ITEMX" minOccurs="0"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:ITEMX"/>
+ <xs:element ref="of:UPC" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="of:UPC"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%QUANTITY.ITEM;) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="POLINESCHD">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="os:DATETIMEANY" minOccurs="0"/>
+ <xs:element ref="os:QUANTITY"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:PSCLINENUM" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <!-- (%DATETIME.NEEDDELV;) -->
+ <!-- (%QUANTITY.ORDERED;) -->
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/v1/test/cases/schema/wli/Order.xsd b/v1/test/cases/schema/wli/Order.xsd
new file mode 100644
index 0000000..083cd27
--- /dev/null
+++ b/v1/test/cases/schema/wli/Order.xsd
@@ -0,0 +1,20271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="publicid:org.xCBL:schemas/XCBL35/Order.xsd" targetNamespace="publicid:org.xCBL:schemas/XCBL35/Order.xsd" elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ XML Common Business Library 3.5
+ Copyright 2000 Commerce One, Inc.
+ Permission is granted to use, copy, modify and distribute the
+ DTD's, schemas and modules in the Commerce One XML Common Business
+ Library Version 3.5 subject to the terms and conditions specified
+ at http://www.xcbl.org/license.html
+ </xsd:documentation>
+ <xsd:documentation>
+ PLEASE NOTE: This schema, whilst it describes in entirety a valid, single,
+ xCBL 3.5 document, is defined to be in a namespace other than the main xCBL 3.5
+ namespace. Therefore it is recommended that the full xCBL 3.5 schema is used
+ for full production situations. Please see the notes at
+ <a href="http://www.xcbl.org/xcbl35/xsd/schemas.html">www.xCBL.org</a>.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType name="Order">
+ <xsd:sequence>
+ <xsd:element ref="OrderHeader"/>
+ <xsd:element minOccurs="0" ref="OrderDetail"/>
+ <xsd:element minOccurs="0" ref="OrderSummary"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Order" type="Order"/>
+ <xsd:complexType name="OrderHeader">
+ <xsd:sequence>
+ <xsd:element ref="OrderNumber"/>
+ <xsd:element name="OrderIssueDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" ref="OrderReferences"/>
+ <xsd:element minOccurs="0" name="ReleaseNumber" type="xsd:string"/>
+ <xsd:element ref="Purpose"/>
+ <xsd:element minOccurs="0" ref="RequestedResponse"/>
+ <xsd:element minOccurs="0" ref="OrderType"/>
+ <xsd:element name="OrderCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TaxAccountingCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OrderLanguage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Language"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OrderTaxReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="TaxReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OrderInvoiceMediumTypeCoded" type="OrderInvoiceMediumTypeCode"/>
+ <xsd:element minOccurs="0" name="OrderInvoiceMediumTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="OrderDates"/>
+ <xsd:element minOccurs="0" name="PartialShipmentAllowed" type="xcblBoolean"/>
+ <xsd:element ref="OrderParty"/>
+ <xsd:element minOccurs="0" name="PartLocation" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfTransport"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="OrderTermsOfDelivery">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="TermsOfDelivery"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OrderHeaderPrice">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfPrice"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OrderPaymentInstructions">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PaymentInstructions"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OrderAllowancesOrCharges">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAllowOrCharge"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="RoundTripInformation"/>
+ <xsd:element minOccurs="0" name="OrderHeaderNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfStructuredNote"/>
+ <xsd:element minOccurs="0" ref="ListOfNameValueSet"/>
+ <xsd:element minOccurs="0" name="OrderHeaderAttachments">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAttachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderHeader" type="OrderHeader"/>
+ <xsd:complexType name="OrderNumber">
+ <xsd:sequence>
+ <xsd:element name="BuyerOrderNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SellerOrderNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfMessageID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderNumber" type="OrderNumber"/>
+ <xsd:complexType name="ListOfMessageID">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="MessageID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfMessageID" type="ListOfMessageID"/>
+ <xsd:complexType name="MessageID">
+ <xsd:sequence>
+ <xsd:element name="IDNumber" type="xsd:string"/>
+ <xsd:element ref="IDAssignedBy"/>
+ <xsd:element minOccurs="0" name="IDAssignedDate" type="xcblDatetime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MessageID" type="MessageID"/>
+ <xsd:complexType name="IDAssignedBy">
+ <xsd:sequence>
+ <xsd:element name="IDAssignedByCoded" type="PartyRoleCode"/>
+ <xsd:element minOccurs="0" name="IDAssignedByCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="IDAssignedBy" type="IDAssignedBy"/>
+ <xsd:simpleType name="PartyRoleCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceLocation"/>
+ <xsd:enumeration value="AcceptingParty"/>
+ <xsd:enumeration value="Accountant"/>
+ <xsd:enumeration value="AccountCoordinator"/>
+ <xsd:enumeration value="AccountingStation"/>
+ <xsd:enumeration value="AccountOf"/>
+ <xsd:enumeration value="AccountOfDestinationParty"/>
+ <xsd:enumeration value="AccountOf-OriginParty"/>
+ <xsd:enumeration value="AccountOwner"/>
+ <xsd:enumeration value="AccountOwnersServicingBankOnTheReceivingSide"/>
+ <xsd:enumeration value="AccountOwnersServicingBankOnTheSendingSide"/>
+ <xsd:enumeration value="AccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="AccountsPayableOffice"/>
+ <xsd:enumeration value="AcknowledgementRecipient"/>
+ <xsd:enumeration value="Acronym"/>
+ <xsd:enumeration value="ActionParty"/>
+ <xsd:enumeration value="ActualPurchasersCustomer"/>
+ <xsd:enumeration value="ActualReferredByOrganization"/>
+ <xsd:enumeration value="ActualReferredToOrganization"/>
+ <xsd:enumeration value="AcuteCareHospital"/>
+ <xsd:enumeration value="AdditionalAddress"/>
+ <xsd:enumeration value="AdditionalDebtor"/>
+ <xsd:enumeration value="AdditionalDeliveryAddress"/>
+ <xsd:enumeration value="AdditionalPickUpAddress"/>
+ <xsd:enumeration value="Adjuster"/>
+ <xsd:enumeration value="AdministrationCentre"/>
+ <xsd:enumeration value="Administrator"/>
+ <xsd:enumeration value="AdmittingHealthCareProvider"/>
+ <xsd:enumeration value="AdmittingServices"/>
+ <xsd:enumeration value="AdmittingSurgeon"/>
+ <xsd:enumeration value="AdultDayCareProgramFacility"/>
+ <xsd:enumeration value="Advertiser"/>
+ <xsd:enumeration value="AdvertisingGroup"/>
+ <xsd:enumeration value="AdviseThroughBank"/>
+ <xsd:enumeration value="AdvisingBank"/>
+ <xsd:enumeration value="Advisor"/>
+ <xsd:enumeration value="Affiant"/>
+ <xsd:enumeration value="Affiliate"/>
+ <xsd:enumeration value="AffiliatedCompany"/>
+ <xsd:enumeration value="AffiliatedParty"/>
+ <xsd:enumeration value="Agency"/>
+ <xsd:enumeration value="AgencyGrantingSecurityClearance"/>
+ <xsd:enumeration value="AgentOrRepresentative"/>
+ <xsd:enumeration value="AgentsBank"/>
+ <xsd:enumeration value="AIDSOrARCUnit"/>
+ <xsd:enumeration value="AirAmbulanceServices"/>
+ <xsd:enumeration value="AirCargoCompany"/>
+ <xsd:enumeration value="AirForceFacility"/>
+ <xsd:enumeration value="Airline"/>
+ <xsd:enumeration value="AirportAuthority"/>
+ <xsd:enumeration value="AlcoholBeverageDepartment"/>
+ <xsd:enumeration value="AlcoholismAndOtherChemicalDependencyFacility"/>
+ <xsd:enumeration value="AlcoholOrDrugAbuseOrDependencyInpatientUnit"/>
+ <xsd:enumeration value="AlcoholOrDrugAbuseOrDependencyOutpatientServices"/>
+ <xsd:enumeration value="Alias"/>
+ <xsd:enumeration value="AlienAffiliate"/>
+ <xsd:enumeration value="AllegedDebtor"/>
+ <xsd:enumeration value="Alliance"/>
+ <xsd:enumeration value="AlliedHealthProfessional"/>
+ <xsd:enumeration value="AllotmentCustomer"/>
+ <xsd:enumeration value="AllowableRecipient"/>
+ <xsd:enumeration value="AlternateReturnAddress"/>
+ <xsd:enumeration value="AlternativeAddressee"/>
+ <xsd:enumeration value="AlternativeManufacturer"/>
+ <xsd:enumeration value="AlzheimersDiagnosticOrAssessmentServices"/>
+ <xsd:enumeration value="AmendedName"/>
+ <xsd:enumeration value="AmericanIndian-OwnedBusiness"/>
+ <xsd:enumeration value="AmicusCuriae"/>
+ <xsd:enumeration value="AnesthesiologyServices"/>
+ <xsd:enumeration value="AngioplastyFacility"/>
+ <xsd:enumeration value="AnimalBeingInvestigated"/>
+ <xsd:enumeration value="AnimalSource"/>
+ <xsd:enumeration value="Annuitant"/>
+ <xsd:enumeration value="AnnuitantPayor"/>
+ <xsd:enumeration value="AntennaSite"/>
+ <xsd:enumeration value="Appellant"/>
+ <xsd:enumeration value="Appellee"/>
+ <xsd:enumeration value="Applicant"/>
+ <xsd:enumeration value="ApplicantComaker"/>
+ <xsd:enumeration value="ApplicantForJob"/>
+ <xsd:enumeration value="ApplicantsBank"/>
+ <xsd:enumeration value="ApplicantsCosigner"/>
+ <xsd:enumeration value="ApplicantsEmployer"/>
+ <xsd:enumeration value="ApplicantsReference"/>
+ <xsd:enumeration value="ApplicationParty"/>
+ <xsd:enumeration value="AppraisalCompany"/>
+ <xsd:enumeration value="AppraiserName"/>
+ <xsd:enumeration value="ApprovedConsignor"/>
+ <xsd:enumeration value="ApprovedImporter"/>
+ <xsd:enumeration value="Approver"/>
+ <xsd:enumeration value="Arbitrator"/>
+ <xsd:enumeration value="Architect"/>
+ <xsd:enumeration value="Architect-Designer"/>
+ <xsd:enumeration value="AreaOfOperation"/>
+ <xsd:enumeration value="ArmedServicesLocationDesignation"/>
+ <xsd:enumeration value="ArmyFacility"/>
+ <xsd:enumeration value="ArrestingOfficer"/>
+ <xsd:enumeration value="ArthritisTreatmentCenter"/>
+ <xsd:enumeration value="AssetAccountHolder"/>
+ <xsd:enumeration value="Assignee"/>
+ <xsd:enumeration value="Assigner"/>
+ <xsd:enumeration value="Assignor"/>
+ <xsd:enumeration value="AssistantSurgeon"/>
+ <xsd:enumeration value="AssistantUSTrustee"/>
+ <xsd:enumeration value="AssociateGeneralAgent"/>
+ <xsd:enumeration value="Association"/>
+ <xsd:enumeration value="AttendingPhysician"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AttorneyForDefendantPrivate"/>
+ <xsd:enumeration value="AttorneyForDefendantPublic"/>
+ <xsd:enumeration value="AttorneyForPlaintiff"/>
+ <xsd:enumeration value="AttorneyOfRecord"/>
+ <xsd:enumeration value="Auctioneer"/>
+ <xsd:enumeration value="AuditOffice"/>
+ <xsd:enumeration value="Auditor"/>
+ <xsd:enumeration value="AuthenticatingParty"/>
+ <xsd:enumeration value="Author"/>
+ <xsd:enumeration value="AuthorityForShipment"/>
+ <xsd:enumeration value="AuthorizationAssignedBy"/>
+ <xsd:enumeration value="AuthorizedAcceptingOfficial"/>
+ <xsd:enumeration value="AuthorizedEntity"/>
+ <xsd:enumeration value="AuthorizedExporter"/>
+ <xsd:enumeration value="AuthorizedFrom"/>
+ <xsd:enumeration value="AuthorizedImporter"/>
+ <xsd:enumeration value="AuthorizedMarketer"/>
+ <xsd:enumeration value="AuthorizedOfficial"/>
+ <xsd:enumeration value="AuthorizedTo"/>
+ <xsd:enumeration value="AuthorizedTrader"/>
+ <xsd:enumeration value="AuthorizingOfficial"/>
+ <xsd:enumeration value="AutomatedDataProcessingPoint"/>
+ <xsd:enumeration value="AutomatedUnderwritingSystem"/>
+ <xsd:enumeration value="AvailableWithBank"/>
+ <xsd:enumeration value="AvailabilityShipToParty"/>
+ <xsd:enumeration value="Bailiff"/>
+ <xsd:enumeration value="BailmentWarehouse"/>
+ <xsd:enumeration value="BailPayor"/>
+ <xsd:enumeration value="BakeryDepartment"/>
+ <xsd:enumeration value="Bank"/>
+ <xsd:enumeration value="Banker"/>
+ <xsd:enumeration value="BankruptcyReferee"/>
+ <xsd:enumeration value="BankruptcyTrustee"/>
+ <xsd:enumeration value="BaseJurisdiction"/>
+ <xsd:enumeration value="BasePeriodEmployer"/>
+ <xsd:enumeration value="Battery"/>
+ <xsd:enumeration value="BeneficialOwner"/>
+ <xsd:enumeration value="Beneficiary"/>
+ <xsd:enumeration value="BeneficiarysBank"/>
+ <xsd:enumeration value="Bidder"/>
+ <xsd:enumeration value="BidOpeningLocation"/>
+ <xsd:enumeration value="BillAndShipTo"/>
+ <xsd:enumeration value="BilledFrom"/>
+ <xsd:enumeration value="BillingProvider"/>
+ <xsd:enumeration value="BillingService"/>
+ <xsd:enumeration value="BillOfLadingRecipient"/>
+ <xsd:enumeration value="BillTo"/>
+ <xsd:enumeration value="Bill-ToPartyForDiversionCharges"/>
+ <xsd:enumeration value="BirthingRoomOrLDRPRoom"/>
+ <xsd:enumeration value="BirthName"/>
+ <xsd:enumeration value="Birthplace"/>
+ <xsd:enumeration value="BloodBank"/>
+ <xsd:enumeration value="BoardOfRealtors"/>
+ <xsd:enumeration value="BobtailServicePoint"/>
+ <xsd:enumeration value="Bondsman"/>
+ <xsd:enumeration value="BookingAgent"/>
+ <xsd:enumeration value="BookingOffice"/>
+ <xsd:enumeration value="Bookkeeper"/>
+ <xsd:enumeration value="BorderCrossing"/>
+ <xsd:enumeration value="Borrower"/>
+ <xsd:enumeration value="BorrowersEmployer"/>
+ <xsd:enumeration value="Bottler"/>
+ <xsd:enumeration value="Brakeman"/>
+ <xsd:enumeration value="Branch"/>
+ <xsd:enumeration value="BrandName"/>
+ <xsd:enumeration value="BreakBulkBerthOperator"/>
+ <xsd:enumeration value="BreakBulkPoint"/>
+ <xsd:enumeration value="Broadcaster"/>
+ <xsd:enumeration value="Broker"/>
+ <xsd:enumeration value="BrokerDealer"/>
+ <xsd:enumeration value="BrokerOpinionOrAnalysisRequester"/>
+ <xsd:enumeration value="BrokerOrSalesOffice"/>
+ <xsd:enumeration value="BrokersAssistant"/>
+ <xsd:enumeration value="BuilderName"/>
+ <xsd:enumeration value="BuildingInspectorate"/>
+ <xsd:enumeration value="BuildingSiteEngineer"/>
+ <xsd:enumeration value="BuildingSiteForwarder"/>
+ <xsd:enumeration value="BuildingSitePurchaser"/>
+ <xsd:enumeration value="BureauOfLandManagementPropertyUnit"/>
+ <xsd:enumeration value="BurnCareUnit"/>
+ <xsd:enumeration value="Business"/>
+ <xsd:enumeration value="BusinessArea"/>
+ <xsd:enumeration value="BusinessAssociate"/>
+ <xsd:enumeration value="BusinessEntity"/>
+ <xsd:enumeration value="BusinessPartner"/>
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="BuyerAsOfficiallyRegistered"/>
+ <xsd:enumeration value="BuyersAgentOrRepresentative"/>
+ <xsd:enumeration value="BuyersBank"/>
+ <xsd:enumeration value="BuyersCorporateOffice"/>
+ <xsd:enumeration value="BuyersFinancialInstitution"/>
+ <xsd:enumeration value="BuyersParentCompany"/>
+ <xsd:enumeration value="BuyersQualityReviewBoard"/>
+ <xsd:enumeration value="BuyingGroup"/>
+ <xsd:enumeration value="BuyingParty"/>
+ <xsd:enumeration value="CanadianCustomsBroker"/>
+ <xsd:enumeration value="Candidate"/>
+ <xsd:enumeration value="CandyAndConfectionsDepartment"/>
+ <xsd:enumeration value="CardiacCatherizationLaboratory"/>
+ <xsd:enumeration value="CardiacIntensiveCareUnit"/>
+ <xsd:enumeration value="CardiacRehabilitationProgramFacility"/>
+ <xsd:enumeration value="CardiacRehabilitationServices"/>
+ <xsd:enumeration value="CarnetIssuer"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CarriersAgent"/>
+ <xsd:enumeration value="CaseManager"/>
+ <xsd:enumeration value="CaseOfNeedParty"/>
+ <xsd:enumeration value="CashPoolLevelAccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CashPoolSub-AccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CashPoolTopAccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CedingCompany"/>
+ <xsd:enumeration value="CentralBankOrRegulatoryAuthority"/>
+ <xsd:enumeration value="CentralCatalogueParty"/>
+ <xsd:enumeration value="CertifiedAccountant"/>
+ <xsd:enumeration value="CertifyingParty"/>
+ <xsd:enumeration value="Chairperson"/>
+ <xsd:enumeration value="ChamberOfCommerce"/>
+ <xsd:enumeration value="ChangedAddress"/>
+ <xsd:enumeration value="ChargesPayerAtDestination"/>
+ <xsd:enumeration value="Charity"/>
+ <xsd:enumeration value="CharterSchool"/>
+ <xsd:enumeration value="ChassisProvider"/>
+ <xsd:enumeration value="CheckingParty"/>
+ <xsd:enumeration value="ChequeDrawnBank"/>
+ <xsd:enumeration value="ChequeOrder"/>
+ <xsd:enumeration value="ChiefDeputyClerkOfCourt"/>
+ <xsd:enumeration value="Child"/>
+ <xsd:enumeration value="ChildrensChronicDiseaseFacility"/>
+ <xsd:enumeration value="ChildrensDayCareCenter"/>
+ <xsd:enumeration value="ChildrensEyeEarNoseAndThroatFacility"/>
+ <xsd:enumeration value="ChildrensGeneralFacility"/>
+ <xsd:enumeration value="ChildrensHospitalUnitOfAnInstitution"/>
+ <xsd:enumeration value="ChildrensOrthopedicFacility"/>
+ <xsd:enumeration value="ChildrensOtherSpecialtyFacility"/>
+ <xsd:enumeration value="ChildrensPsychiatricFacility"/>
+ <xsd:enumeration value="ChildrensRehabilitationFacility"/>
+ <xsd:enumeration value="ChildrensTuberculosisAndOtherRespiratoryDiseasesFacility"/>
+ <xsd:enumeration value="Chiropractor"/>
+ <xsd:enumeration value="ChronicDiseaseFacility"/>
+ <xsd:enumeration value="ChronicObstructivePulmonaryDiseaseServiceFacility"/>
+ <xsd:enumeration value="ChurchOperatedFacility"/>
+ <xsd:enumeration value="CigarettesAndTobaccoDepartment"/>
+ <xsd:enumeration value="CircuitLocationIdentifier"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="ClaimAdministrator"/>
+ <xsd:enumeration value="Claimant"/>
+ <xsd:enumeration value="ClaimantAuthorizedRepresentative"/>
+ <xsd:enumeration value="ClaimRecipient"/>
+ <xsd:enumeration value="ClearingHouse"/>
+ <xsd:enumeration value="Clerk"/>
+ <xsd:enumeration value="ClerkOfCourt"/>
+ <xsd:enumeration value="Clinic"/>
+ <xsd:enumeration value="ClosedDoorPharmacy"/>
+ <xsd:enumeration value="ClosedSale"/>
+ <xsd:enumeration value="ClosingAgent"/>
+ <xsd:enumeration value="CoatingOrPaintSupplier"/>
+ <xsd:enumeration value="Co-Borrower"/>
+ <xsd:enumeration value="Co-Contractor"/>
+ <xsd:enumeration value="Co-Counsel"/>
+ <xsd:enumeration value="Co-Debtor"/>
+ <xsd:enumeration value="Co-Defendant"/>
+ <xsd:enumeration value="Co-Driver"/>
+ <xsd:enumeration value="Co-Investigator"/>
+ <xsd:enumeration value="CollateralAssignee"/>
+ <xsd:enumeration value="CollectingBank"/>
+ <xsd:enumeration value="CollectionPrincipal"/>
+ <xsd:enumeration value="CommercialInsurer"/>
+ <xsd:enumeration value="CommissionableAgent"/>
+ <xsd:enumeration value="CommissionProcessor"/>
+ <xsd:enumeration value="CommunityAgent"/>
+ <xsd:enumeration value="CommunityHealthPromotionFacility"/>
+ <xsd:enumeration value="CompanyAssignedWell"/>
+ <xsd:enumeration value="CompanyInterviewerWorksFor"/>
+ <xsd:enumeration value="CompanyInWhichInterestHeld"/>
+ <xsd:enumeration value="CompanyMergedWith"/>
+ <xsd:enumeration value="Company-OwnedOilField"/>
+ <xsd:enumeration value="CompanyWhichHoldsFinancialInterest"/>
+ <xsd:enumeration value="ComparableProperty"/>
+ <xsd:enumeration value="ComparablePropertyListing"/>
+ <xsd:enumeration value="ComparableRentals"/>
+ <xsd:enumeration value="CompetingProperty"/>
+ <xsd:enumeration value="CompetitivePropertyListing"/>
+ <xsd:enumeration value="CompilationAgency"/>
+ <xsd:enumeration value="Complainant"/>
+ <xsd:enumeration value="ComplainantsAttorney"/>
+ <xsd:enumeration value="ComponentManufacturer"/>
+ <xsd:enumeration value="ComprehensiveGeriatricAssessmentFacility"/>
+ <xsd:enumeration value="ConcurrentEmployer"/>
+ <xsd:enumeration value="Conductor"/>
+ <xsd:enumeration value="ConductorPilot"/>
+ <xsd:enumeration value="Conduit"/>
+ <xsd:enumeration value="ConnectingCarrier"/>
+ <xsd:enumeration value="Connection"/>
+ <xsd:enumeration value="Consignee"/>
+ <xsd:enumeration value="ConsigneeCourierTransferStation"/>
+ <xsd:enumeration value="ConsigneeOfVessel"/>
+ <xsd:enumeration value="ConsigneesAgent"/>
+ <xsd:enumeration value="ConsigneeToBeSpecified"/>
+ <xsd:enumeration value="Consignee-ToReceiveLargeParcelsAndFreight"/>
+ <xsd:enumeration value="Consignee-ToReceiveMailAndSmallParcels"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="ConsignorCourierTransferStation"/>
+ <xsd:enumeration value="ConsignorsRepresentative"/>
+ <xsd:enumeration value="ConsolidatedDebtor"/>
+ <xsd:enumeration value="Consolidator"/>
+ <xsd:enumeration value="ConstructionContractor"/>
+ <xsd:enumeration value="ConstructionFirm"/>
+ <xsd:enumeration value="ConsultantsOffice"/>
+ <xsd:enumeration value="ConsultingPhysician"/>
+ <xsd:enumeration value="ConsumerCreditAccountCompany"/>
+ <xsd:enumeration value="ConsumerReferralContact"/>
+ <xsd:enumeration value="ConsumerServiceProvider"/>
+ <xsd:enumeration value="ConsumerServiceProviderCustomer"/>
+ <xsd:enumeration value="Contact"/>
+ <xsd:enumeration value="ContactBank1"/>
+ <xsd:enumeration value="ContactBank2"/>
+ <xsd:enumeration value="ContactOffice"/>
+ <xsd:enumeration value="ContactParty"/>
+ <xsd:enumeration value="ContactParty1"/>
+ <xsd:enumeration value="ContactParty2"/>
+ <xsd:enumeration value="ContactParty3"/>
+ <xsd:enumeration value="ContactParty4"/>
+ <xsd:enumeration value="ContactPerson"/>
+ <xsd:enumeration value="ContainerLocation"/>
+ <xsd:enumeration value="ContainerLocationParty"/>
+ <xsd:enumeration value="ContainerOperatorOrLessee"/>
+ <xsd:enumeration value="ContainerReturnCompany"/>
+ <xsd:enumeration value="ContainerSurveyAgent"/>
+ <xsd:enumeration value="ContingentAnnuitant"/>
+ <xsd:enumeration value="ContingentBeneficiary"/>
+ <xsd:enumeration value="ContingentOwner"/>
+ <xsd:enumeration value="ContractAdministrationOffice"/>
+ <xsd:enumeration value="ContractedServiceProvider"/>
+ <xsd:enumeration value="ContractHolder"/>
+ <xsd:enumeration value="ContractingOfficerRepresentative"/>
+ <xsd:enumeration value="Contractor-General"/>
+ <xsd:enumeration value="ContractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="Contractor-Lead"/>
+ <xsd:enumeration value="Contractor-Main"/>
+ <xsd:enumeration value="ContractualDeliveryMeter"/>
+ <xsd:enumeration value="ContractualReceiptMeter"/>
+ <xsd:enumeration value="ControllerQuality"/>
+ <xsd:enumeration value="Converter"/>
+ <xsd:enumeration value="ConvoyingParty"/>
+ <xsd:enumeration value="Co-Occupant"/>
+ <xsd:enumeration value="Co-Operative"/>
+ <xsd:enumeration value="CooperativeBuyingGroup"/>
+ <xsd:enumeration value="Coordinator"/>
+ <xsd:enumeration value="Co-Owner"/>
+ <xsd:enumeration value="Co-Participant"/>
+ <xsd:enumeration value="Co-Producer"/>
+ <xsd:enumeration value="CopyMessageTo"/>
+ <xsd:enumeration value="CorporateOffice"/>
+ <xsd:enumeration value="Corporation"/>
+ <xsd:enumeration value="CorporationFor-ProfitFacility"/>
+ <xsd:enumeration value="CorrectedAddress"/>
+ <xsd:enumeration value="CorrectedInsured"/>
+ <xsd:enumeration value="CorrectedName"/>
+ <xsd:enumeration value="Cosigner"/>
+ <xsd:enumeration value="CosignersEmployer"/>
+ <xsd:enumeration value="CouncilOfGovernments"/>
+ <xsd:enumeration value="CounterClaimant"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CountryOfDestination"/>
+ <xsd:enumeration value="CountryOfExport"/>
+ <xsd:enumeration value="CountryOfOrigin"/>
+ <xsd:enumeration value="County"/>
+ <xsd:enumeration value="Court"/>
+ <xsd:enumeration value="CourtAppointedAttorney"/>
+ <xsd:enumeration value="CreditGrantor"/>
+ <xsd:enumeration value="Creditor"/>
+ <xsd:enumeration value="CreditorsAttorney"/>
+ <xsd:enumeration value="CreditRatingAgency"/>
+ <xsd:enumeration value="CreditReportingAgency"/>
+ <xsd:enumeration value="CrewMember"/>
+ <xsd:enumeration value="CrimeVictim"/>
+ <xsd:enumeration value="CrossClaimant"/>
+ <xsd:enumeration value="Cross-TownSwitch"/>
+ <xsd:enumeration value="CTScannerUnit"/>
+ <xsd:enumeration value="CurrentEmployer-Primary"/>
+ <xsd:enumeration value="CurrentEmployer-Secondary"/>
+ <xsd:enumeration value="CurrentReceiver"/>
+ <xsd:enumeration value="CurrentSender"/>
+ <xsd:enumeration value="CustodialParent"/>
+ <xsd:enumeration value="Custodian"/>
+ <xsd:enumeration value="Customer"/>
+ <xsd:enumeration value="CustomerFOrWhomSameOrSimilarWOrkWasPerFormed"/>
+ <xsd:enumeration value="CustomerIdentificationFileCustomerIdentifier"/>
+ <xsd:enumeration value="Customs"/>
+ <xsd:enumeration value="CustomsBroker"/>
+ <xsd:enumeration value="CustomsOfficeOfClearance"/>
+ <xsd:enumeration value="DairyDepartment"/>
+ <xsd:enumeration value="DataProcessingServiceBureau"/>
+ <xsd:enumeration value="Dealer"/>
+ <xsd:enumeration value="Debtor"/>
+ <xsd:enumeration value="DebtorCompany"/>
+ <xsd:enumeration value="DebtorIndividual"/>
+ <xsd:enumeration value="Debtor-In-Possession"/>
+ <xsd:enumeration value="DebtorsAttorney"/>
+ <xsd:enumeration value="DebtPaymentAuthorisationParty"/>
+ <xsd:enumeration value="DecisionMaker"/>
+ <xsd:enumeration value="Declarant"/>
+ <xsd:enumeration value="DeclarantsAgentOrRepresentative"/>
+ <xsd:enumeration value="Deconsolidator"/>
+ <xsd:enumeration value="DefaultOrForeclosureSpecialist"/>
+ <xsd:enumeration value="Defendant"/>
+ <xsd:enumeration value="DelicatessenDepartment"/>
+ <xsd:enumeration value="DeliveryAddress"/>
+ <xsd:enumeration value="DeliveryParty"/>
+ <xsd:enumeration value="DeliveryZone"/>
+ <xsd:enumeration value="Dentist"/>
+ <xsd:enumeration value="DepartmentOfJusticeFacility"/>
+ <xsd:enumeration value="Dependent"/>
+ <xsd:enumeration value="DependentInsured"/>
+ <xsd:enumeration value="DependentName"/>
+ <xsd:enumeration value="Depositor"/>
+ <xsd:enumeration value="DesignatedHazardousWasteFacility"/>
+ <xsd:enumeration value="DesignEngineering"/>
+ <xsd:enumeration value="Designer"/>
+ <xsd:enumeration value="DespatchChargePayer"/>
+ <xsd:enumeration value="DespatchParty"/>
+ <xsd:enumeration value="DestinationCarrier"/>
+ <xsd:enumeration value="DestinationDrayman"/>
+ <xsd:enumeration value="DestinationIntermodalRamp"/>
+ <xsd:enumeration value="DestinationMailFacility"/>
+ <xsd:enumeration value="DestinationTerminal"/>
+ <xsd:enumeration value="DiagnosticRadioisotopeFacility"/>
+ <xsd:enumeration value="DialysisCenters"/>
+ <xsd:enumeration value="DifferentPremiseAddress"/>
+ <xsd:enumeration value="Director"/>
+ <xsd:enumeration value="DisabledIndividual"/>
+ <xsd:enumeration value="DisbursingOfficer"/>
+ <xsd:enumeration value="DischargePoint"/>
+ <xsd:enumeration value="DisciplinaryContact"/>
+ <xsd:enumeration value="Dispatcher"/>
+ <xsd:enumeration value="Distiller"/>
+ <xsd:enumeration value="DistributionRecipient"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="DistributorBranch"/>
+ <xsd:enumeration value="District"/>
+ <xsd:enumeration value="DistrictAttorney"/>
+ <xsd:enumeration value="DistrictJustice"/>
+ <xsd:enumeration value="Division"/>
+ <xsd:enumeration value="DoctorOfOptometry"/>
+ <xsd:enumeration value="DoctorOfOsteopathy"/>
+ <xsd:enumeration value="DocumentaryCreditAccountParty"/>
+ <xsd:enumeration value="DocumentaryCreditAccountPartysBank"/>
+ <xsd:enumeration value="DocumentaryCreditApplicant"/>
+ <xsd:enumeration value="DocumentaryCreditBeneficiary"/>
+ <xsd:enumeration value="DocumentaryCreditBeneficiarysBank"/>
+ <xsd:enumeration value="DocumentaryCreditReimbursingBank"/>
+ <xsd:enumeration value="DocumentaryCreditSecondBeneficiary"/>
+ <xsd:enumeration value="DocumentCustodian"/>
+ <xsd:enumeration value="DocumentOrMessageIssuerOrSender"/>
+ <xsd:enumeration value="DocumentRecipient"/>
+ <xsd:enumeration value="DoingBusinessAs"/>
+ <xsd:enumeration value="DomesticFinancialInstitution"/>
+ <xsd:enumeration value="DownstreamFirstSupplier"/>
+ <xsd:enumeration value="DownstreamMeterLocation"/>
+ <xsd:enumeration value="DownstreamParty"/>
+ <xsd:enumeration value="Drawee"/>
+ <xsd:enumeration value="DrillingContractor"/>
+ <xsd:enumeration value="Driver"/>
+ <xsd:enumeration value="Drop-OffLocation"/>
+ <xsd:enumeration value="DryGroceryDepartment"/>
+ <xsd:enumeration value="DurableMedicalEquipmentSupplier"/>
+ <xsd:enumeration value="EconomicallyDisadvantagedIndividual"/>
+ <xsd:enumeration value="EducationalInstitution"/>
+ <xsd:enumeration value="ElectronicDataInterchangeCoordinatorPointAddress"/>
+ <xsd:enumeration value="ElectronicFiler"/>
+ <xsd:enumeration value="ElectronicRegistrationUtility"/>
+ <xsd:enumeration value="ElectronicReturnOriginator"/>
+ <xsd:enumeration value="ElementarySchool"/>
+ <xsd:enumeration value="EligiblePartyToTheContract"/>
+ <xsd:enumeration value="EligiblePartyToTheRate"/>
+ <xsd:enumeration value="EmergencyDepartment"/>
+ <xsd:enumeration value="EmergencyDepartmentSocialWorkServices"/>
+ <xsd:enumeration value="EmergencyMedicalTechnician"/>
+ <xsd:enumeration value="EmergencyProvider"/>
+ <xsd:enumeration value="EmergencyResponseUnit"/>
+ <xsd:enumeration value="EmergingSmallBusiness"/>
+ <xsd:enumeration value="Employee"/>
+ <xsd:enumeration value="EmployeeName"/>
+ <xsd:enumeration value="Employer"/>
+ <xsd:enumeration value="EmptyContainerResponsibleParty"/>
+ <xsd:enumeration value="EmptyContainerReturnAgent"/>
+ <xsd:enumeration value="EmptyEquipmentDespatchParty"/>
+ <xsd:enumeration value="EmptyEquipmentReturnParty"/>
+ <xsd:enumeration value="EndItemManufacturer"/>
+ <xsd:enumeration value="EndUser"/>
+ <xsd:enumeration value="EnergyInformationAdministration-OwnedOilField"/>
+ <xsd:enumeration value="Engineer"/>
+ <xsd:enumeration value="Engineer-Construction"/>
+ <xsd:enumeration value="Engineer-Consultant"/>
+ <xsd:enumeration value="Engineering"/>
+ <xsd:enumeration value="EngineerMeasurement"/>
+ <xsd:enumeration value="EngineerPilot"/>
+ <xsd:enumeration value="Engineer-ResidentConstruction"/>
+ <xsd:enumeration value="Enroller"/>
+ <xsd:enumeration value="EntityHoldingTheInformation"/>
+ <xsd:enumeration value="EntityInWhichAFinancialInterestIsHeld"/>
+ <xsd:enumeration value="EntityProvidingTheService"/>
+ <xsd:enumeration value="EntityResponsibleForFollow-Up"/>
+ <xsd:enumeration value="EntryPointTechnicalAssessmentGroup"/>
+ <xsd:enumeration value="EquipmentDrop-OffParty"/>
+ <xsd:enumeration value="EquipmentOwner"/>
+ <xsd:enumeration value="EquipmentRepairParty"/>
+ <xsd:enumeration value="EstablishedLocation"/>
+ <xsd:enumeration value="Estimator"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="Examiner"/>
+ <xsd:enumeration value="Exchanger"/>
+ <xsd:enumeration value="ExciseParty"/>
+ <xsd:enumeration value="ExcludedParty"/>
+ <xsd:enumeration value="ExecutiveCommitteeMember"/>
+ <xsd:enumeration value="ExecutorOfEstate"/>
+ <xsd:enumeration value="Exhibitor"/>
+ <xsd:enumeration value="ExpertWitness"/>
+ <xsd:enumeration value="Exporter"/>
+ <xsd:enumeration value="Ex-Spouse"/>
+ <xsd:enumeration value="ExtendedCareFacility"/>
+ <xsd:enumeration value="ExtracorporealShock-WaveLithotripterUnit"/>
+ <xsd:enumeration value="EyeEarNoseAndThroatFacility"/>
+ <xsd:enumeration value="Facility"/>
+ <xsd:enumeration value="Factor"/>
+ <xsd:enumeration value="Factor-Correspondent"/>
+ <xsd:enumeration value="FamilyMember"/>
+ <xsd:enumeration value="Father"/>
+ <xsd:enumeration value="FederalFacility"/>
+ <xsd:enumeration value="FederalGovernment"/>
+ <xsd:enumeration value="FederallyCharteredFacility"/>
+ <xsd:enumeration value="FederalStateCountyOrCityFacility"/>
+ <xsd:enumeration value="FellowshipInstitution"/>
+ <xsd:enumeration value="Felon"/>
+ <xsd:enumeration value="Field"/>
+ <xsd:enumeration value="FieldorBranchOffice"/>
+ <xsd:enumeration value="FilerName"/>
+ <xsd:enumeration value="FilingAddress"/>
+ <xsd:enumeration value="FilingLocation"/>
+ <xsd:enumeration value="FilingOffice"/>
+ <xsd:enumeration value="FinalCustomerOrganization"/>
+ <xsd:enumeration value="FinalMaintenanceOrganization"/>
+ <xsd:enumeration value="FinalMaintenancePeriodDesignatingOrganization"/>
+ <xsd:enumeration value="FinalMessageRecipient"/>
+ <xsd:enumeration value="FinalRecipient"/>
+ <xsd:enumeration value="FinalReferredToOrganization"/>
+ <xsd:enumeration value="FinalScheduledDestination"/>
+ <xsd:enumeration value="FinancialInstitution"/>
+ <xsd:enumeration value="FinancialPlanner"/>
+ <xsd:enumeration value="FinancialStatementRecipient"/>
+ <xsd:enumeration value="Fireman"/>
+ <xsd:enumeration value="FirstAppraiser"/>
+ <xsd:enumeration value="FirstBreakTerminal"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FirstSupplier"/>
+ <xsd:enumeration value="FitnessCenter"/>
+ <xsd:enumeration value="FloodCertifier"/>
+ <xsd:enumeration value="FloodDeterminationProvider"/>
+ <xsd:enumeration value="FloralDepartment"/>
+ <xsd:enumeration value="FoodServiceOperator"/>
+ <xsd:enumeration value="ForeclosingLender"/>
+ <xsd:enumeration value="ForeignDisclosureInformationOffice"/>
+ <xsd:enumeration value="ForeignLanguageSynonym"/>
+ <xsd:enumeration value="ForeignOffice"/>
+ <xsd:enumeration value="ForeignRegistrationLocation"/>
+ <xsd:enumeration value="ForeignSupplier"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FormerAddress"/>
+ <xsd:enumeration value="FormerlyDoingBusinessAs"/>
+ <xsd:enumeration value="FormerlyKnownAs"/>
+ <xsd:enumeration value="FormerPresident"/>
+ <xsd:enumeration value="FormerRegisteredAddress"/>
+ <xsd:enumeration value="FormerResidence"/>
+ <xsd:enumeration value="ForProfitHealthCareProvider"/>
+ <xsd:enumeration value="Forwarder"/>
+ <xsd:enumeration value="Foundation"/>
+ <xsd:enumeration value="Founder"/>
+ <xsd:enumeration value="Franchisee"/>
+ <xsd:enumeration value="Franchisor"/>
+ <xsd:enumeration value="FreeonBoardPoint"/>
+ <xsd:enumeration value="FreightForwarder"/>
+ <xsd:enumeration value="FreightManagementFacilitator"/>
+ <xsd:enumeration value="FreightOrChargesPayer"/>
+ <xsd:enumeration value="FreightPayerOnBehalfOfTheConsignee"/>
+ <xsd:enumeration value="FreightPayerOnBehalfOfTheConsignor"/>
+ <xsd:enumeration value="FrozenDepartment"/>
+ <xsd:enumeration value="FutureAddress"/>
+ <xsd:enumeration value="GainingInventoryManager"/>
+ <xsd:enumeration value="GaragedLocation"/>
+ <xsd:enumeration value="Garnishee"/>
+ <xsd:enumeration value="GasPlant"/>
+ <xsd:enumeration value="GasTransactionEndingPoint"/>
+ <xsd:enumeration value="GasTransactionPoint1"/>
+ <xsd:enumeration value="GasTransactionPoint2"/>
+ <xsd:enumeration value="GasTransactionStartingPoint"/>
+ <xsd:enumeration value="GatewayProvider"/>
+ <xsd:enumeration value="GeneralAgency"/>
+ <xsd:enumeration value="GeneralInpatientCareForAIDSOrARCFacility"/>
+ <xsd:enumeration value="GeneralMedicalAndSurgicalFacility"/>
+ <xsd:enumeration value="GeneralMerchandiseDepartment"/>
+ <xsd:enumeration value="GeneticCounselingOrScreeningServices"/>
+ <xsd:enumeration value="GeriatricAcuteCareUnit"/>
+ <xsd:enumeration value="GeriatricClinics"/>
+ <xsd:enumeration value="GiftRecipient"/>
+ <xsd:enumeration value="GoodsCollectionParty"/>
+ <xsd:enumeration value="GoodsCustodian"/>
+ <xsd:enumeration value="GoodsOwner"/>
+ <xsd:enumeration value="GoodsReleaser"/>
+ <xsd:enumeration value="Government"/>
+ <xsd:enumeration value="Government-CombinedControl"/>
+ <xsd:enumeration value="Government-Federal-Military"/>
+ <xsd:enumeration value="Government-Federal-Other"/>
+ <xsd:enumeration value="Government-Federal-Veterans"/>
+ <xsd:enumeration value="GovernmentFurnishedPropertyFOBPoint"/>
+ <xsd:enumeration value="GovernmentLoanAgencySponsorOrAgent"/>
+ <xsd:enumeration value="Government-Local"/>
+ <xsd:enumeration value="Grandparent"/>
+ <xsd:enumeration value="Grantor"/>
+ <xsd:enumeration value="GroundAmbulanceServices"/>
+ <xsd:enumeration value="Group"/>
+ <xsd:enumeration value="GroupAffiliate"/>
+ <xsd:enumeration value="GroupAffiliation"/>
+ <xsd:enumeration value="GroupingCentre"/>
+ <xsd:enumeration value="GroupPractice"/>
+ <xsd:enumeration value="GroupPurchasingOrganization"/>
+ <xsd:enumeration value="GuaranteeAgency"/>
+ <xsd:enumeration value="Guardian"/>
+ <xsd:enumeration value="HazardousMaterialOffice"/>
+ <xsd:enumeration value="HazardousWasteGenerator"/>
+ <xsd:enumeration value="HeadOffice"/>
+ <xsd:enumeration value="HealthAndBeautyDepartment"/>
+ <xsd:enumeration value="HealthcareProfessionalShortageAreaFacility"/>
+ <xsd:enumeration value="HealthMaintenanceOrganization"/>
+ <xsd:enumeration value="HealthMiscellaneous"/>
+ <xsd:enumeration value="HealthSciencesLibrary"/>
+ <xsd:enumeration value="HemodialysisFacility"/>
+ <xsd:enumeration value="HighSchool"/>
+ <xsd:enumeration value="HisopathologyLaboratory"/>
+ <xsd:enumeration value="HispanicServiceInstitute"/>
+ <xsd:enumeration value="HistoricallyBlackCollegeOrUniversity"/>
+ <xsd:enumeration value="HomeHealthAgency"/>
+ <xsd:enumeration value="HomeHealthCare"/>
+ <xsd:enumeration value="HomeHealthCorporation"/>
+ <xsd:enumeration value="HomeHealthServices"/>
+ <xsd:enumeration value="HomeOffice"/>
+ <xsd:enumeration value="HomeSchool"/>
+ <xsd:enumeration value="HomeStateName"/>
+ <xsd:enumeration value="Hospice"/>
+ <xsd:enumeration value="Hospital"/>
+ <xsd:enumeration value="HospitalAuxiliaryUnit"/>
+ <xsd:enumeration value="HospitalDistrictOrAuthority"/>
+ <xsd:enumeration value="HospitalUnitOfAnInstitution"/>
+ <xsd:enumeration value="HospitalUnitWithinAnInstitutionForTheMentallyRetarded"/>
+ <xsd:enumeration value="HostileWitness"/>
+ <xsd:enumeration value="ImportedFromLocation"/>
+ <xsd:enumeration value="Importer"/>
+ <xsd:enumeration value="InCareOfPartyNo1"/>
+ <xsd:enumeration value="InCareOfPartyNo2"/>
+ <xsd:enumeration value="IncorporatedBy"/>
+ <xsd:enumeration value="IncorporatedLocation"/>
+ <xsd:enumeration value="IncorporationJurisdiction"/>
+ <xsd:enumeration value="IncorporationStatePlaceOfBusiness"/>
+ <xsd:enumeration value="IncorporationStatePrincipalOffice"/>
+ <xsd:enumeration value="IndependentAdjuster"/>
+ <xsd:enumeration value="IndependentLab"/>
+ <xsd:enumeration value="IndependentPhysiciansAssociation"/>
+ <xsd:enumeration value="Individual"/>
+ <xsd:enumeration value="IndividualFor-ProfitFacility"/>
+ <xsd:enumeration value="IndustryAssociation"/>
+ <xsd:enumeration value="IndustryBureau"/>
+ <xsd:enumeration value="IneligibleParty"/>
+ <xsd:enumeration value="InformationDisseminationAgency"/>
+ <xsd:enumeration value="InformationMaintenanceAgency"/>
+ <xsd:enumeration value="InformationProvider"/>
+ <xsd:enumeration value="InformationReferenceAgency"/>
+ <xsd:enumeration value="InformationSource"/>
+ <xsd:enumeration value="InitialDealer"/>
+ <xsd:enumeration value="InitialMedicalProvider"/>
+ <xsd:enumeration value="InitialSubscriber"/>
+ <xsd:enumeration value="Initiating"/>
+ <xsd:enumeration value="InjectionPoint"/>
+ <xsd:enumeration value="In-PatientPharmacy"/>
+ <xsd:enumeration value="InquiringParty"/>
+ <xsd:enumeration value="InquiryAddress"/>
+ <xsd:enumeration value="In-ServiceSource"/>
+ <xsd:enumeration value="InspectionAddress"/>
+ <xsd:enumeration value="InspectionAndAcceptanceLocation"/>
+ <xsd:enumeration value="InspectionAndAcceptanceParty"/>
+ <xsd:enumeration value="InspectionCompany"/>
+ <xsd:enumeration value="InspectionLeader"/>
+ <xsd:enumeration value="InspectionLocation"/>
+ <xsd:enumeration value="Inspector"/>
+ <xsd:enumeration value="InstallationOnSite"/>
+ <xsd:enumeration value="InstalledAt"/>
+ <xsd:enumeration value="InstitutionalProvider"/>
+ <xsd:enumeration value="InstitutionForMentalRetardation"/>
+ <xsd:enumeration value="In-StoreBakeryDepartment"/>
+ <xsd:enumeration value="InsuranceBeneficiary"/>
+ <xsd:enumeration value="InsuranceClaimAdjuster"/>
+ <xsd:enumeration value="InsuranceCompany"/>
+ <xsd:enumeration value="InsuranceInstitute"/>
+ <xsd:enumeration value="Insured"/>
+ <xsd:enumeration value="InsuredLocation"/>
+ <xsd:enumeration value="InsuredOrSubscriber"/>
+ <xsd:enumeration value="Insurer"/>
+ <xsd:enumeration value="IntegratedMaterialManager"/>
+ <xsd:enumeration value="IntellectualPropertyOwner"/>
+ <xsd:enumeration value="InterestedParty"/>
+ <xsd:enumeration value="InterimFundingOrganization"/>
+ <xsd:enumeration value="InterimTrustee"/>
+ <xsd:enumeration value="InterlineServiceCommitmentCustomer"/>
+ <xsd:enumeration value="Intermediary"/>
+ <xsd:enumeration value="IntermediaryBank1"/>
+ <xsd:enumeration value="IntermediaryBank2"/>
+ <xsd:enumeration value="IntermediaryOrBroker"/>
+ <xsd:enumeration value="IntermediateCarrier"/>
+ <xsd:enumeration value="IntermediateConsignee"/>
+ <xsd:enumeration value="IntermediateLevelParentCompany"/>
+ <xsd:enumeration value="InternationalFreightForwarder"/>
+ <xsd:enumeration value="InternationalOrganization"/>
+ <xsd:enumeration value="InternshipEntity"/>
+ <xsd:enumeration value="Interpreter"/>
+ <xsd:enumeration value="Interviewee"/>
+ <xsd:enumeration value="Interviewer"/>
+ <xsd:enumeration value="Inventor"/>
+ <xsd:enumeration value="InventoryController"/>
+ <xsd:enumeration value="InventoryControlPoint"/>
+ <xsd:enumeration value="InventoryReportingParty"/>
+ <xsd:enumeration value="Investigator"/>
+ <xsd:enumeration value="InvestmentAdvisor"/>
+ <xsd:enumeration value="Investor"/>
+ <xsd:enumeration value="Invoicee"/>
+ <xsd:enumeration value="InvoicingDealer"/>
+ <xsd:enumeration value="InvolvedParty"/>
+ <xsd:enumeration value="IrrevocableBeneficiary"/>
+ <xsd:enumeration value="Issuer"/>
+ <xsd:enumeration value="IssuerOfDebitOrCreditMemo"/>
+ <xsd:enumeration value="IssuerOfInvoice"/>
+ <xsd:enumeration value="IssuerOfWaybill"/>
+ <xsd:enumeration value="IssuingBank"/>
+ <xsd:enumeration value="ItemManager"/>
+ <xsd:enumeration value="ItemShipTo"/>
+ <xsd:enumeration value="ItemShipFrom"/>
+ <xsd:enumeration value="JointAnnuitant"/>
+ <xsd:enumeration value="JointAnnuitantOwner"/>
+ <xsd:enumeration value="JointDebtor"/>
+ <xsd:enumeration value="JointDebtorAttorney"/>
+ <xsd:enumeration value="JointOwner"/>
+ <xsd:enumeration value="JointOwnerAnnuitant"/>
+ <xsd:enumeration value="JointOwnerAnnuitantPayor"/>
+ <xsd:enumeration value="JointOwnerJointAnnuitant"/>
+ <xsd:enumeration value="JointOwnerJointAnnuitantPayor"/>
+ <xsd:enumeration value="JointOwnerPayor"/>
+ <xsd:enumeration value="JointVenture"/>
+ <xsd:enumeration value="Judge"/>
+ <xsd:enumeration value="JuniorHighSchool"/>
+ <xsd:enumeration value="Jurisdiction"/>
+ <xsd:enumeration value="JuvenileDefendant"/>
+ <xsd:enumeration value="JuvenileOwner"/>
+ <xsd:enumeration value="JuvenileVictim"/>
+ <xsd:enumeration value="JuvenileWitness"/>
+ <xsd:enumeration value="KeyPerson"/>
+ <xsd:enumeration value="KidneyDialysisUnit"/>
+ <xsd:enumeration value="Labeler"/>
+ <xsd:enumeration value="Laboratory"/>
+ <xsd:enumeration value="LaborSurplusAreaFirm"/>
+ <xsd:enumeration value="Landlord"/>
+ <xsd:enumeration value="LargeBusiness"/>
+ <xsd:enumeration value="LastBreakTerminal"/>
+ <xsd:enumeration value="LastEmployer"/>
+ <xsd:enumeration value="LastKnownSourceOfSupply"/>
+ <xsd:enumeration value="LastSupplier"/>
+ <xsd:enumeration value="LawEnforcementAgency"/>
+ <xsd:enumeration value="LawFirm"/>
+ <xsd:enumeration value="LeaseLocation"/>
+ <xsd:enumeration value="LegalReceiver"/>
+ <xsd:enumeration value="LegalRepresentative"/>
+ <xsd:enumeration value="LegalTitleHolder"/>
+ <xsd:enumeration value="Lender"/>
+ <xsd:enumeration value="LendingInstitution"/>
+ <xsd:enumeration value="Lessee"/>
+ <xsd:enumeration value="LesseesSurveyor"/>
+ <xsd:enumeration value="Lessor"/>
+ <xsd:enumeration value="LiabilityHolder"/>
+ <xsd:enumeration value="Licensee"/>
+ <xsd:enumeration value="LienHolder"/>
+ <xsd:enumeration value="LimitedLiabilityCompany"/>
+ <xsd:enumeration value="LimitedLiabilityPartnership"/>
+ <xsd:enumeration value="LimitedPartner"/>
+ <xsd:enumeration value="Liquidator"/>
+ <xsd:enumeration value="ListingAgent"/>
+ <xsd:enumeration value="ListingCompany"/>
+ <xsd:enumeration value="ListingOffice"/>
+ <xsd:enumeration value="ListMailer"/>
+ <xsd:enumeration value="ListOwner"/>
+ <xsd:enumeration value="LiterallyTranslatedName"/>
+ <xsd:enumeration value="LoadingParty"/>
+ <xsd:enumeration value="LoanApplicant"/>
+ <xsd:enumeration value="LoanBroker"/>
+ <xsd:enumeration value="LoanCorrespondent"/>
+ <xsd:enumeration value="LoanHolderForRealEstateAsset"/>
+ <xsd:enumeration value="LoanOriginator"/>
+ <xsd:enumeration value="LoanServicer"/>
+ <xsd:enumeration value="LocalChain"/>
+ <xsd:enumeration value="LocalGovernmentSponsor"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationOfGoodsForCustomsExaminationBeforeClearance"/>
+ <xsd:enumeration value="LocationOfLoadExchange"/>
+ <xsd:enumeration value="LocationOfPrincipalAssets"/>
+ <xsd:enumeration value="LocationOfSpotForStorage"/>
+ <xsd:enumeration value="LongTermCareFacility"/>
+ <xsd:enumeration value="Long-TermDisabilityCarrier"/>
+ <xsd:enumeration value="LosingInventoryManager"/>
+ <xsd:enumeration value="LossPayee"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MagistrateJudge"/>
+ <xsd:enumeration value="MagneticResonanceImagingFacility"/>
+ <xsd:enumeration value="MaidenName"/>
+ <xsd:enumeration value="MailAddress"/>
+ <xsd:enumeration value="MailTo"/>
+ <xsd:enumeration value="Mainline"/>
+ <xsd:enumeration value="MaintenanceOrganizationUsedForEstimate"/>
+ <xsd:enumeration value="MammographyScreeningCenter"/>
+ <xsd:enumeration value="ManagedCare"/>
+ <xsd:enumeration value="ManagedCareOrganization"/>
+ <xsd:enumeration value="ManagementControlActivity"/>
+ <xsd:enumeration value="ManagementNon-Officer"/>
+ <xsd:enumeration value="Manager"/>
+ <xsd:enumeration value="ManagingAgent"/>
+ <xsd:enumeration value="ManagingGeneralAgent"/>
+ <xsd:enumeration value="ManufacturerOfGoods"/>
+ <xsd:enumeration value="ManufacturersRepresentative"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="ManufacturingPlant"/>
+ <xsd:enumeration value="MarineSurveyor"/>
+ <xsd:enumeration value="MarkerOwner"/>
+ <xsd:enumeration value="MarketTimer"/>
+ <xsd:enumeration value="Mark-ForParty"/>
+ <xsd:enumeration value="MasterAgent"/>
+ <xsd:enumeration value="MasterGeneralAgent"/>
+ <xsd:enumeration value="MasterProperty"/>
+ <xsd:enumeration value="Material"/>
+ <xsd:enumeration value="MaterialChangeNoticeAddress"/>
+ <xsd:enumeration value="MaterialDispositionAuthorizationLocation"/>
+ <xsd:enumeration value="MaterialIssuer"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetRecipient"/>
+ <xsd:enumeration value="MeansOfTransportCharterer"/>
+ <xsd:enumeration value="MeatDepartment"/>
+ <xsd:enumeration value="MedicalDoctor"/>
+ <xsd:enumeration value="MedicalInsuranceCarrier"/>
+ <xsd:enumeration value="MedicalNurse"/>
+ <xsd:enumeration value="MedicalSchool"/>
+ <xsd:enumeration value="MedicalSurgicalOrOtherIntensiveCareUnit"/>
+ <xsd:enumeration value="MedicalTreatmentExecutant"/>
+ <xsd:enumeration value="MedicalTreatmentPrescriber"/>
+ <xsd:enumeration value="MeetingLocation"/>
+ <xsd:enumeration value="MegavoltageRadiationTherapyUnit"/>
+ <xsd:enumeration value="Member"/>
+ <xsd:enumeration value="MerchantBanker"/>
+ <xsd:enumeration value="MergedCompany"/>
+ <xsd:enumeration value="MergedCompanyWithRetainedIdentity"/>
+ <xsd:enumeration value="MergedName"/>
+ <xsd:enumeration value="MessageFrom"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageTo"/>
+ <xsd:enumeration value="MeteringLocation"/>
+ <xsd:enumeration value="MexicanCustomsBroker"/>
+ <xsd:enumeration value="MiddleSchool"/>
+ <xsd:enumeration value="MigrantHealthClinic"/>
+ <xsd:enumeration value="MilitaryBranch"/>
+ <xsd:enumeration value="MilitaryFacility"/>
+ <xsd:enumeration value="MinimumRoyaltyPayor"/>
+ <xsd:enumeration value="Minister"/>
+ <xsd:enumeration value="MinorityInstitution"/>
+ <xsd:enumeration value="Minority-OwnedBusinessLarge"/>
+ <xsd:enumeration value="Minority-OwnedBusinessSmall"/>
+ <xsd:enumeration value="MiscellaneousHealthCareFacility"/>
+ <xsd:enumeration value="MonitoringParty"/>
+ <xsd:enumeration value="MortgageCompany"/>
+ <xsd:enumeration value="MortgageInsurer"/>
+ <xsd:enumeration value="MortgageLiabilityAccountHolder"/>
+ <xsd:enumeration value="MostRecentEmployer"/>
+ <xsd:enumeration value="Mother"/>
+ <xsd:enumeration value="MotorCarrier"/>
+ <xsd:enumeration value="MotorVehicleReportProviderCompany"/>
+ <xsd:enumeration value="MultipleListingService"/>
+ <xsd:enumeration value="Municipality"/>
+ <xsd:enumeration value="NameChangedTo"/>
+ <xsd:enumeration value="NameNotToBeConfusedWith"/>
+ <xsd:enumeration value="NameonCreditCard"/>
+ <xsd:enumeration value="NameUnderWhichFiled"/>
+ <xsd:enumeration value="NameVariationSynonym"/>
+ <xsd:enumeration value="NationalChain"/>
+ <xsd:enumeration value="NationalOrganization"/>
+ <xsd:enumeration value="NativeHawaiianOrganization"/>
+ <xsd:enumeration value="NavyFacility"/>
+ <xsd:enumeration value="NeglectedOrDelinquentInstitution"/>
+ <xsd:enumeration value="NegotiatingBank"/>
+ <xsd:enumeration value="Neighbor"/>
+ <xsd:enumeration value="Neighborhood"/>
+ <xsd:enumeration value="NeonatalIntensiveCareUnit"/>
+ <xsd:enumeration value="NetworkName"/>
+ <xsd:enumeration value="NewAddress"/>
+ <xsd:enumeration value="NewAssignee"/>
+ <xsd:enumeration value="NewDebtor"/>
+ <xsd:enumeration value="NewSecuredParty"/>
+ <xsd:enumeration value="NewServiceProvider"/>
+ <xsd:enumeration value="Newspaper"/>
+ <xsd:enumeration value="NewSupplySource"/>
+ <xsd:enumeration value="NextDestination"/>
+ <xsd:enumeration value="NextScheduledDestination"/>
+ <xsd:enumeration value="Nickname"/>
+ <xsd:enumeration value="NoHeading"/>
+ <xsd:enumeration value="NominatedBank"/>
+ <xsd:enumeration value="NominatedFreightCompany"/>
+ <xsd:enumeration value="Non-DomesticFinancialInstitution"/>
+ <xsd:enumeration value="NonemploymentIncomeSource"/>
+ <xsd:enumeration value="Non-HealthCareMiscellaneousFacility"/>
+ <xsd:enumeration value="Non-Insured"/>
+ <xsd:enumeration value="Non-InvasiveCardiacAssessmentServices"/>
+ <xsd:enumeration value="Non-MortgageLiabilityAccountHolder"/>
+ <xsd:enumeration value="Non-OccupantCo-Borrower"/>
+ <xsd:enumeration value="Non-ProductionSupplier"/>
+ <xsd:enumeration value="Non-ProfitHealthCareProvider"/>
+ <xsd:enumeration value="NonprofitInstitution"/>
+ <xsd:enumeration value="Non-RailroadEntity"/>
+ <xsd:enumeration value="NonRegisteredBusinessName"/>
+ <xsd:enumeration value="Non-RegisteredInvestmentAdvisor"/>
+ <xsd:enumeration value="Non-ResidentBeneficiary"/>
+ <xsd:enumeration value="Non-ResidentCreditor"/>
+ <xsd:enumeration value="Non-ResidentDebtor"/>
+ <xsd:enumeration value="Non-ResidentGroupCompanyWithWhomFinancialAccountIs"/>
+ <xsd:enumeration value="Non-ResidentInstructingParty"/>
+ <xsd:enumeration value="Non-ResidentThirdPartyCompanyWithWhomFinancial"/>
+ <xsd:enumeration value="Non-TemporaryStorageFacility"/>
+ <xsd:enumeration value="Notary"/>
+ <xsd:enumeration value="NotaryPublic"/>
+ <xsd:enumeration value="NoteCo-Signer"/>
+ <xsd:enumeration value="NotForProfitHealthCareProvider"/>
+ <xsd:enumeration value="NotifyParty"/>
+ <xsd:enumeration value="NotifyPartyForShippersOrder"/>
+ <xsd:enumeration value="NotifyPartyNo1"/>
+ <xsd:enumeration value="NotifyPartyNo2"/>
+ <xsd:enumeration value="NursingHome"/>
+ <xsd:enumeration value="NursingHomeChain"/>
+ <xsd:enumeration value="ObservationRoomServices"/>
+ <xsd:enumeration value="ObstetricsAndGynecologyFacility"/>
+ <xsd:enumeration value="ObstetricsUnit"/>
+ <xsd:enumeration value="Occupant"/>
+ <xsd:enumeration value="OccupationalHealthServices"/>
+ <xsd:enumeration value="OccupationalTherapyServices"/>
+ <xsd:enumeration value="OceanTariffConference"/>
+ <xsd:enumeration value="OfficeManager"/>
+ <xsd:enumeration value="Officer"/>
+ <xsd:enumeration value="OffsetOperator"/>
+ <xsd:enumeration value="OilAndGasCustodian"/>
+ <xsd:enumeration value="OilAndGasRegulatoryAgency"/>
+ <xsd:enumeration value="OldAssignee"/>
+ <xsd:enumeration value="OldDebtor"/>
+ <xsd:enumeration value="OldSecuredParty"/>
+ <xsd:enumeration value="OnBehalfOf"/>
+ <xsd:enumeration value="On-CallProvider"/>
+ <xsd:enumeration value="OncologyCenter"/>
+ <xsd:enumeration value="Open-HeartSurgeryFacility"/>
+ <xsd:enumeration value="OperatingPhysician"/>
+ <xsd:enumeration value="Operator-CommunicationChannel"/>
+ <xsd:enumeration value="Operator-EssentialServices"/>
+ <xsd:enumeration value="OperatorOfPropertyOrEquipment"/>
+ <xsd:enumeration value="OperatorOfPropertyOrUnit"/>
+ <xsd:enumeration value="OperatorOfTheSourceTransferPoint"/>
+ <xsd:enumeration value="OperatorOfTheTransferPoint"/>
+ <xsd:enumeration value="OrderedBank"/>
+ <xsd:enumeration value="OrderedBy"/>
+ <xsd:enumeration value="OrderingBank"/>
+ <xsd:enumeration value="OrderingCustomer"/>
+ <xsd:enumeration value="OrderingParty"/>
+ <xsd:enumeration value="OrderingPhysician"/>
+ <xsd:enumeration value="OrderOfShippersOrders-Transportation"/>
+ <xsd:enumeration value="OrderOfTheShipperParty"/>
+ <xsd:enumeration value="OrderWriter"/>
+ <xsd:enumeration value="Organization"/>
+ <xsd:enumeration value="OrganizationCompletingConfigurationChange"/>
+ <xsd:enumeration value="OrganizationGroup"/>
+ <xsd:enumeration value="OrganizationHavingSourceControl"/>
+ <xsd:enumeration value="OrganizedOutpatientServices"/>
+ <xsd:enumeration value="OrganizedSocialWorkServiceFacility"/>
+ <xsd:enumeration value="Organizer"/>
+ <xsd:enumeration value="OrganOrTissueTransplantUnit"/>
+ <xsd:enumeration value="OriginalClaimant"/>
+ <xsd:enumeration value="OriginalIntermodalRamp"/>
+ <xsd:enumeration value="OriginalJurisdiction"/>
+ <xsd:enumeration value="OriginalLocation"/>
+ <xsd:enumeration value="OriginalName"/>
+ <xsd:enumeration value="OriginalShipper"/>
+ <xsd:enumeration value="OriginatingBank"/>
+ <xsd:enumeration value="OriginatingCompany"/>
+ <xsd:enumeration value="OriginatorOfArticleNumber"/>
+ <xsd:enumeration value="OriginCarrier"/>
+ <xsd:enumeration value="OriginDrayman"/>
+ <xsd:enumeration value="OriginMailFacility"/>
+ <xsd:enumeration value="OriginSublocation"/>
+ <xsd:enumeration value="OriginTerminal"/>
+ <xsd:enumeration value="OrthopedicFacility"/>
+ <xsd:enumeration value="OrthopedicSurgeryFacility"/>
+ <xsd:enumeration value="OtherDepartments"/>
+ <xsd:enumeration value="OtherDisadvantagedBusiness"/>
+ <xsd:enumeration value="OtherIndividualDisabilityCarrier"/>
+ <xsd:enumeration value="OtherInsured"/>
+ <xsd:enumeration value="OtherNot-For-ProfitFacility"/>
+ <xsd:enumeration value="OtherPersonOrEntityAssociatedWithStudent"/>
+ <xsd:enumeration value="OtherPhysician"/>
+ <xsd:enumeration value="OtherRelatedParty"/>
+ <xsd:enumeration value="OtherSpecialtyFacility"/>
+ <xsd:enumeration value="OtherUnlistedTypeOfOrganizationalEntity"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaLocation"/>
+ <xsd:enumeration value="Out-Of-StatePrincipalOffice"/>
+ <xsd:enumeration value="OutpatientSocialWorkServices"/>
+ <xsd:enumeration value="OutpatientSurgeryServices"/>
+ <xsd:enumeration value="OutpatientSurgicenter"/>
+ <xsd:enumeration value="OutsideInspectionAgency"/>
+ <xsd:enumeration value="OutsideProcessor"/>
+ <xsd:enumeration value="OutsideTestAgency"/>
+ <xsd:enumeration value="OverrideInstitution"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnerAnnuitant"/>
+ <xsd:enumeration value="OwnerAnnuitantPayor"/>
+ <xsd:enumeration value="OwnerJointAnnuitantPayor"/>
+ <xsd:enumeration value="OwnerOfEquipment"/>
+ <xsd:enumeration value="OwnerOfMeansOfTransport"/>
+ <xsd:enumeration value="OwnerOfOperation"/>
+ <xsd:enumeration value="OwnerOfProperty"/>
+ <xsd:enumeration value="OwnerOfPropertyOrUnit"/>
+ <xsd:enumeration value="OwnerOfResidence"/>
+ <xsd:enumeration value="OwnerOfVehicle"/>
+ <xsd:enumeration value="OwnerOfVessel"/>
+ <xsd:enumeration value="OwnerOrLessorsSurveyor"/>
+ <xsd:enumeration value="OwnerPayor"/>
+ <xsd:enumeration value="OwnersAgent"/>
+ <xsd:enumeration value="OwnersRepresentative"/>
+ <xsd:enumeration value="OwningInventoryControlPoint"/>
+ <xsd:enumeration value="OxygenTherapyFacility"/>
+ <xsd:enumeration value="Packer"/>
+ <xsd:enumeration value="Paramedic"/>
+ <xsd:enumeration value="ParamedicalCompany"/>
+ <xsd:enumeration value="Parent"/>
+ <xsd:enumeration value="ParentCompany"/>
+ <xsd:enumeration value="Participant"/>
+ <xsd:enumeration value="ParticipatingArea"/>
+ <xsd:enumeration value="ParticipatingLaboratory"/>
+ <xsd:enumeration value="Partner"/>
+ <xsd:enumeration value="Partnership"/>
+ <xsd:enumeration value="PartnershipFor-ProfitFacility"/>
+ <xsd:enumeration value="PartRemanufacturer"/>
+ <xsd:enumeration value="PartsDistributor"/>
+ <xsd:enumeration value="PartSource"/>
+ <xsd:enumeration value="PartyAccordingToDocumentaryCreditTransaction"/>
+ <xsd:enumeration value="PartyAssigningAStatus"/>
+ <xsd:enumeration value="PartyAtFinalPlaceOfPositioning"/>
+ <xsd:enumeration value="PartyAtPick-UpLocation"/>
+ <xsd:enumeration value="PartyAuthorizedtoDefinitizeContractAction"/>
+ <xsd:enumeration value="PartyAuthorizedToMakeDefiniteAContractAction"/>
+ <xsd:enumeration value="PartyAuthorizingDisposition"/>
+ <xsd:enumeration value="PartyAuthorizingReleaseOfSecurityInformation"/>
+ <xsd:enumeration value="PartyDataResponsibleParty"/>
+ <xsd:enumeration value="PartyDeclaringTheValueAddedTax"/>
+ <xsd:enumeration value="PartyDesignatedToExecuteRe-Icing"/>
+ <xsd:enumeration value="PartyDesignatedToExecuteSanitaryProcedures"/>
+ <xsd:enumeration value="PartyDesignatedToProvideLivingAnimalCare"/>
+ <xsd:enumeration value="PartyExecutingAndVerifying"/>
+ <xsd:enumeration value="PartyFillingShippersOrder"/>
+ <xsd:enumeration value="PartyForWhomItemIsUltimatelyIntended"/>
+ <xsd:enumeration value="PartyFromWhomCustomsDocumentsAreToBePickedUp"/>
+ <xsd:enumeration value="PartyFromWhomNon-CustomsDocumentsAreToBePickedUp"/>
+ <xsd:enumeration value="PartyFulfillingAllOperations"/>
+ <xsd:enumeration value="PartyInPossession"/>
+ <xsd:enumeration value="PartyIssuingMutuallyAgreedCodes"/>
+ <xsd:enumeration value="PartyMaintainingTheCodesUsedInTheMessage"/>
+ <xsd:enumeration value="PartyMaintainingTheIdentifiersUsedInTheMessage"/>
+ <xsd:enumeration value="PartyMandatedToLiquidateAnEnterprise"/>
+ <xsd:enumeration value="PartyManufacturedFor"/>
+ <xsd:enumeration value="PartyNotToBeConfusedWith"/>
+ <xsd:enumeration value="PartyPassingTheTransaction"/>
+ <xsd:enumeration value="PartyPerformingCertification"/>
+ <xsd:enumeration value="PartyPerformingCount"/>
+ <xsd:enumeration value="PartyPerformingInspection"/>
+ <xsd:enumeration value="PartyPerformingTask"/>
+ <xsd:enumeration value="PartyPerformingVerification"/>
+ <xsd:enumeration value="PartyProvidingFinancing"/>
+ <xsd:enumeration value="PartyProvidingGovernmentFurnishedProperty"/>
+ <xsd:enumeration value="PartyRecoveringTheValueAddedTax"/>
+ <xsd:enumeration value="PartyRepresented"/>
+ <xsd:enumeration value="PartyResponsibleForDisinfection"/>
+ <xsd:enumeration value="PartyResponsibleForFinancialSettlement"/>
+ <xsd:enumeration value="PartyResponsibleForRefueling"/>
+ <xsd:enumeration value="PartySubmittingQuote"/>
+ <xsd:enumeration value="PartyThatReceivedDisclosureStatement"/>
+ <xsd:enumeration value="PartyThatRemitsPayment"/>
+ <xsd:enumeration value="PartytoAppearBefore"/>
+ <xsd:enumeration value="PartyToApproveSpecification"/>
+ <xsd:enumeration value="Partytobeadvised-WrittenOrders"/>
+ <xsd:enumeration value="PartyToBeBilled"/>
+ <xsd:enumeration value="PartyToBeBilledForOtherThanFreight"/>
+ <xsd:enumeration value="PartytoContract"/>
+ <xsd:enumeration value="PartyToFilePersonalPropertyTax"/>
+ <xsd:enumeration value="PartytoLease"/>
+ <xsd:enumeration value="PartytoPerformPackaging"/>
+ <xsd:enumeration value="PartyToPrintSomeDocument"/>
+ <xsd:enumeration value="PartytoProvideDiscount"/>
+ <xsd:enumeration value="PartyToReceiveAllDocuments"/>
+ <xsd:enumeration value="PartytoReceiveBillOfLading"/>
+ <xsd:enumeration value="PartyToReceiveCertificateOfCompliance"/>
+ <xsd:enumeration value="PartyToReceiveCertificateOfConformance"/>
+ <xsd:enumeration value="PartyToReceiveCertifiedInspectionReport"/>
+ <xsd:enumeration value="PartyToReceiveCertifiedTestResults"/>
+ <xsd:enumeration value="PartyToReceiveCommercialInvoiceRemittance"/>
+ <xsd:enumeration value="PartyToReceiveContractSecurityClassificationSpecification"/>
+ <xsd:enumeration value="PartyToReceiveCopy"/>
+ <xsd:enumeration value="PartyToReceiveCorrespondence"/>
+ <xsd:enumeration value="PartytoReceiveCredit"/>
+ <xsd:enumeration value="PartyToReceiveCustomsDocuments"/>
+ <xsd:enumeration value="PartyToReceiveElectronicMemoOfInvoice"/>
+ <xsd:enumeration value="PartyToReceiveEquipment"/>
+ <xsd:enumeration value="PartyToReceiveFreightBill"/>
+ <xsd:enumeration value="PartyToReceiveInspectionReport"/>
+ <xsd:enumeration value="PartyToReceiveInvitationToOffer"/>
+ <xsd:enumeration value="PartytoReceiveInvoiceFOrGoodsOrServices"/>
+ <xsd:enumeration value="PartyToReceiveInvoiceForLeasePayments"/>
+ <xsd:enumeration value="PartytoReceiveLimitationsOfHeavyElementsReport"/>
+ <xsd:enumeration value="PartytoReceiveMaterialRelease"/>
+ <xsd:enumeration value="PartyToReceiveNon-CustomsDocuments"/>
+ <xsd:enumeration value="PartyToReceiveOrderToSupply"/>
+ <xsd:enumeration value="PartyToReceivePackingCratingAndHandlingCredit"/>
+ <xsd:enumeration value="PartyToReceivePaperMemoOfInvoice"/>
+ <xsd:enumeration value="PartytoReceiveProposal"/>
+ <xsd:enumeration value="PartyToReceivePurchaseOrder"/>
+ <xsd:enumeration value="PartyToReceiveReports"/>
+ <xsd:enumeration value="PartytoReceiveScaleTicket"/>
+ <xsd:enumeration value="PartytoReceiveShippingManifest"/>
+ <xsd:enumeration value="PartyToReceiveShippingNotice"/>
+ <xsd:enumeration value="PartytoReceiveSolicitation"/>
+ <xsd:enumeration value="PartyToReceiveStatementOfAccount"/>
+ <xsd:enumeration value="PartyToReceiveStatementOfFeesDue"/>
+ <xsd:enumeration value="PartytoReceiveStatus"/>
+ <xsd:enumeration value="PartyToReceiveTechnicalDocumentation"/>
+ <xsd:enumeration value="PartyToReceiveTestReport"/>
+ <xsd:enumeration value="PartytoReceiveTransportationCredit"/>
+ <xsd:enumeration value="PartytoWhomAcknowledgmentShouldBeSent"/>
+ <xsd:enumeration value="PartyToWhomDocumentsAreToBePresented"/>
+ <xsd:enumeration value="PartytoWhomProtestSubmitted"/>
+ <xsd:enumeration value="PartyWaivingRequirements"/>
+ <xsd:enumeration value="PartyWhichDeliversConsignmentsToTheTerminal"/>
+ <xsd:enumeration value="PartyWhichPicksUpConsignmentsFromTheTerminal"/>
+ <xsd:enumeration value="PartyWhoSignedTheDeliveryReceipt"/>
+ <xsd:enumeration value="PartyWithKnowledgeOfAffairsOfTheCompany"/>
+ <xsd:enumeration value="PartyWithPowerToVoteSecurities"/>
+ <xsd:enumeration value="Passenger"/>
+ <xsd:enumeration value="Patient"/>
+ <xsd:enumeration value="PatientCompanion"/>
+ <xsd:enumeration value="PatientEducationUnit"/>
+ <xsd:enumeration value="PatientFacility"/>
+ <xsd:enumeration value="PatientRepresentativeServices"/>
+ <xsd:enumeration value="Payee"/>
+ <xsd:enumeration value="PayeesCompanyNameOrId"/>
+ <xsd:enumeration value="Payer"/>
+ <xsd:enumeration value="PayerOfLastResort"/>
+ <xsd:enumeration value="PayersCompanyNameOrId"/>
+ <xsd:enumeration value="PayersFinancialInstitution"/>
+ <xsd:enumeration value="PayingAgent"/>
+ <xsd:enumeration value="PayingBank"/>
+ <xsd:enumeration value="PayingFinancialInstitution"/>
+ <xsd:enumeration value="PaymentAddress"/>
+ <xsd:enumeration value="Payor"/>
+ <xsd:enumeration value="Pay-ToProvider"/>
+ <xsd:enumeration value="Pedestrian"/>
+ <xsd:enumeration value="PediatricAcuteInpatientUnit"/>
+ <xsd:enumeration value="PerformedAt"/>
+ <xsd:enumeration value="PermitHolder"/>
+ <xsd:enumeration value="PersonForWhoseBenefitPropertywasSeized"/>
+ <xsd:enumeration value="PersonnelOffice"/>
+ <xsd:enumeration value="PersonOnClaim"/>
+ <xsd:enumeration value="PersonOrOtherEntityLegallyResponsibleForAChild"/>
+ <xsd:enumeration value="PersonOrOtherEntityLegallyResponsibleForAndWithWhomAChildResides"/>
+ <xsd:enumeration value="PersonOrOtherEntityWithWhomAChildResides"/>
+ <xsd:enumeration value="PetitioningCreditor"/>
+ <xsd:enumeration value="PetitioningCreditorsAttorney"/>
+ <xsd:enumeration value="Pharmacist"/>
+ <xsd:enumeration value="Pharmacy"/>
+ <xsd:enumeration value="PharmacyDepartment"/>
+ <xsd:enumeration value="PhysicalAddress"/>
+ <xsd:enumeration value="PhysicalTherapyServices"/>
+ <xsd:enumeration value="Physician"/>
+ <xsd:enumeration value="PhysicianClinicOrGroupPractice"/>
+ <xsd:enumeration value="PhysicianHospitalOrganization"/>
+ <xsd:enumeration value="Physician-Specialists"/>
+ <xsd:enumeration value="PickUpAddress"/>
+ <xsd:enumeration value="PierName"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PipelineSegment"/>
+ <xsd:enumeration value="PipelineSegmentBoundary"/>
+ <xsd:enumeration value="PlaceOfBottling"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="PlaceOfDistilling"/>
+ <xsd:enumeration value="PlaceOfOccurrence"/>
+ <xsd:enumeration value="PlaceOfPerformanceCognizantSecurityOffice"/>
+ <xsd:enumeration value="Plaintiff"/>
+ <xsd:enumeration value="PlanAdministrator"/>
+ <xsd:enumeration value="PlanningOrMaintenanceOrganization"/>
+ <xsd:enumeration value="PlanningCommission"/>
+ <xsd:enumeration value="PlanningScheduleOrMaterialReleaseIssuer"/>
+ <xsd:enumeration value="PlanSponsor"/>
+ <xsd:enumeration value="Plant"/>
+ <xsd:enumeration value="PlantClearanceOfficer"/>
+ <xsd:enumeration value="Podiatrist"/>
+ <xsd:enumeration value="PointOfService"/>
+ <xsd:enumeration value="PolicyHolder"/>
+ <xsd:enumeration value="PolicyWritingAgent"/>
+ <xsd:enumeration value="PollingSite"/>
+ <xsd:enumeration value="PortAuthority"/>
+ <xsd:enumeration value="PostalMailingAddress"/>
+ <xsd:enumeration value="PostsecondaryEducationRecipient"/>
+ <xsd:enumeration value="PostsecondaryEducationSender"/>
+ <xsd:enumeration value="Post-SecondaryInstitution"/>
+ <xsd:enumeration value="PotentialSourceOfSupply"/>
+ <xsd:enumeration value="PowerOfAttorney"/>
+ <xsd:enumeration value="PreferredProviderOrganization"/>
+ <xsd:enumeration value="Pre-KDayCare"/>
+ <xsd:enumeration value="Pre-kindergartenToGrade12Recipient"/>
+ <xsd:enumeration value="Pre-kindergartenToGrade12Sender"/>
+ <xsd:enumeration value="PreliminaryCustomerOrganization"/>
+ <xsd:enumeration value="PreliminaryInspectionLocation"/>
+ <xsd:enumeration value="PreliminaryMaintenanceOrganization"/>
+ <xsd:enumeration value="PreliminaryMaintenancePeriodDesignatingOrganization"/>
+ <xsd:enumeration value="PreliminaryReferredToOrganization"/>
+ <xsd:enumeration value="Premises"/>
+ <xsd:enumeration value="Preparer"/>
+ <xsd:enumeration value="PresentAddress"/>
+ <xsd:enumeration value="PresentingBank"/>
+ <xsd:enumeration value="President"/>
+ <xsd:enumeration value="PreviousBusinessPartner"/>
+ <xsd:enumeration value="PreviousCreditGrantor"/>
+ <xsd:enumeration value="PreviousDebtHolder"/>
+ <xsd:enumeration value="PreviousDistributor"/>
+ <xsd:enumeration value="PreviousEmployer"/>
+ <xsd:enumeration value="PreviousGroup"/>
+ <xsd:enumeration value="PreviousInsured"/>
+ <xsd:enumeration value="PreviousMember"/>
+ <xsd:enumeration value="PreviousName"/>
+ <xsd:enumeration value="PreviousNameOfFirm"/>
+ <xsd:enumeration value="PreviousNeighbor"/>
+ <xsd:enumeration value="PreviousOccupant"/>
+ <xsd:enumeration value="PreviousOwner"/>
+ <xsd:enumeration value="PreviousResidence"/>
+ <xsd:enumeration value="PreviousStation"/>
+ <xsd:enumeration value="PreviousTitleCompany"/>
+ <xsd:enumeration value="PreviousTradeUnion"/>
+ <xsd:enumeration value="PriceAdministration"/>
+ <xsd:enumeration value="PrimaryBeneficiary"/>
+ <xsd:enumeration value="PrimaryCareProvider"/>
+ <xsd:enumeration value="PriceCheckShipTo"/>
+ <xsd:enumeration value="PrimaryControlPointLocation"/>
+ <xsd:enumeration value="PrimaryHealthCareProvider"/>
+ <xsd:enumeration value="PrimaryInsuredOrSubscriber"/>
+ <xsd:enumeration value="PrimaryInterexchangeCarrier"/>
+ <xsd:enumeration value="PrimaryInternationalTelecomCarrier"/>
+ <xsd:enumeration value="PrimaryIntra-LATACarrier"/>
+ <xsd:enumeration value="PrimaryInventoryControlActivity"/>
+ <xsd:enumeration value="PrimaryOwner"/>
+ <xsd:enumeration value="PrimaryPayer"/>
+ <xsd:enumeration value="PrimaryPhysician"/>
+ <xsd:enumeration value="PrimaryResidence"/>
+ <xsd:enumeration value="PrimarySupportOrganization"/>
+ <xsd:enumeration value="PrimarySurgeon"/>
+ <xsd:enumeration value="PrimaryTaxpayer"/>
+ <xsd:enumeration value="PrimeContractor"/>
+ <xsd:enumeration value="Principal"/>
+ <xsd:enumeration value="PrincipalBorrower"/>
+ <xsd:enumeration value="PrincipalExecutiveOffice"/>
+ <xsd:enumeration value="PrincipalPerson"/>
+ <xsd:enumeration value="Printer"/>
+ <xsd:enumeration value="PriorBaseJurisdiction"/>
+ <xsd:enumeration value="PriorIncorrectInsured"/>
+ <xsd:enumeration value="PriorInsuranceCarrier"/>
+ <xsd:enumeration value="PriorTitleEvidenceHolder"/>
+ <xsd:enumeration value="PrivatePre-KEducation"/>
+ <xsd:enumeration value="PrivateSchool"/>
+ <xsd:enumeration value="ProBonoAttorney"/>
+ <xsd:enumeration value="Processor"/>
+ <xsd:enumeration value="ProcurementResponsibilityForOrder"/>
+ <xsd:enumeration value="ProduceDepartment"/>
+ <xsd:enumeration value="Producer"/>
+ <xsd:enumeration value="Production"/>
+ <xsd:enumeration value="ProductionManager"/>
+ <xsd:enumeration value="ProductPositionHolder"/>
+ <xsd:enumeration value="ProductServicesAndRepairsCentre"/>
+ <xsd:enumeration value="ProfessionalOrganization"/>
+ <xsd:enumeration value="Project"/>
+ <xsd:enumeration value="ProjectCoordinationOffice"/>
+ <xsd:enumeration value="ProjectManagementOffice"/>
+ <xsd:enumeration value="ProjectManager"/>
+ <xsd:enumeration value="ProjectName"/>
+ <xsd:enumeration value="ProjectProperty"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="PropertyOrBuildingManager"/>
+ <xsd:enumeration value="ProposedInsured"/>
+ <xsd:enumeration value="Proposer"/>
+ <xsd:enumeration value="ProSeCounsel"/>
+ <xsd:enumeration value="PrototypeSupplier"/>
+ <xsd:enumeration value="Provider"/>
+ <xsd:enumeration value="PsychiatricChildOrAdolescentServices"/>
+ <xsd:enumeration value="PsychiatricConsultation-LiaisonServices"/>
+ <xsd:enumeration value="PsychiatricEducationServices"/>
+ <xsd:enumeration value="PsychiatricEmergencyServices"/>
+ <xsd:enumeration value="PsychiatricFacility"/>
+ <xsd:enumeration value="PsychiatricGeriatricServices"/>
+ <xsd:enumeration value="PsychiatricHealthFacility"/>
+ <xsd:enumeration value="PsychiatricInpatientUnit"/>
+ <xsd:enumeration value="PsychiatricOutpatientServices"/>
+ <xsd:enumeration value="PsychiatricPartialHospitalizationProgram"/>
+ <xsd:enumeration value="Psychiatrist"/>
+ <xsd:enumeration value="Psychologist"/>
+ <xsd:enumeration value="PublicAlternativeSchool"/>
+ <xsd:enumeration value="PublicHealthServiceFacility"/>
+ <xsd:enumeration value="PublicHealthServiceIndianServiceFacility"/>
+ <xsd:enumeration value="PublicorPrivateOrganizationForTheDisabled"/>
+ <xsd:enumeration value="PublicPre-KEducation"/>
+ <xsd:enumeration value="PublicSchool"/>
+ <xsd:enumeration value="Publisher"/>
+ <xsd:enumeration value="Pumper"/>
+ <xsd:enumeration value="PurchasedCompany"/>
+ <xsd:enumeration value="PurchasersDepartmentBuyer"/>
+ <xsd:enumeration value="PurchaseServiceProvider"/>
+ <xsd:enumeration value="QualifyingOfficer"/>
+ <xsd:enumeration value="QualityControl"/>
+ <xsd:enumeration value="QuotationRequestingParty"/>
+ <xsd:enumeration value="RadioactiveImplantsUnit"/>
+ <xsd:enumeration value="RadioControlStationLocation"/>
+ <xsd:enumeration value="RadioStation"/>
+ <xsd:enumeration value="RailCarrier"/>
+ <xsd:enumeration value="Railroad"/>
+ <xsd:enumeration value="RatingOrganization"/>
+ <xsd:enumeration value="ReceiptMeterLocation"/>
+ <xsd:enumeration value="ReceiptZone"/>
+ <xsd:enumeration value="ReceivedFrom"/>
+ <xsd:enumeration value="Receiver"/>
+ <xsd:enumeration value="ReceiverManager"/>
+ <xsd:enumeration value="ReceiverOfCheque"/>
+ <xsd:enumeration value="ReceiverOfFunds"/>
+ <xsd:enumeration value="ReceiversCorrespondentBank"/>
+ <xsd:enumeration value="ReceiverSite"/>
+ <xsd:enumeration value="ReceiversSub-Entity"/>
+ <xsd:enumeration value="ReceivingBank"/>
+ <xsd:enumeration value="ReceivingCompany"/>
+ <xsd:enumeration value="ReceivingFacilityScheduler"/>
+ <xsd:enumeration value="ReceivingFinancialInstitution"/>
+ <xsd:enumeration value="ReceivingLocation"/>
+ <xsd:enumeration value="ReceivingPointForCustomerSamples"/>
+ <xsd:enumeration value="ReceivingSub-Location"/>
+ <xsd:enumeration value="RecipientOfCivilorLegalLiabilityPayment"/>
+ <xsd:enumeration value="ReclamationCenter"/>
+ <xsd:enumeration value="Record-KeepingAddress"/>
+ <xsd:enumeration value="RecoveryRoom"/>
+ <xsd:enumeration value="RecreationalTherapyServices"/>
+ <xsd:enumeration value="Referee"/>
+ <xsd:enumeration value="Reference"/>
+ <xsd:enumeration value="ReferencesEmployer"/>
+ <xsd:enumeration value="ReferralProvider"/>
+ <xsd:enumeration value="ReferringHealthCareProvider"/>
+ <xsd:enumeration value="ReferringProvider"/>
+ <xsd:enumeration value="Refinery"/>
+ <xsd:enumeration value="RefineryOperator"/>
+ <xsd:enumeration value="RefusalParty"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegionalOffice"/>
+ <xsd:enumeration value="RegisteredBusinessName"/>
+ <xsd:enumeration value="RegisteredInvestmentAdvisor"/>
+ <xsd:enumeration value="RegisteredOffice"/>
+ <xsd:enumeration value="RegisteredOwner"/>
+ <xsd:enumeration value="RegisteredPrincipal"/>
+ <xsd:enumeration value="RegisteringNonparentParty"/>
+ <xsd:enumeration value="RegisteringParentParty"/>
+ <xsd:enumeration value="RegisteringParty"/>
+ <xsd:enumeration value="Registrar"/>
+ <xsd:enumeration value="RegistrationTribunal"/>
+ <xsd:enumeration value="RegularDealer"/>
+ <xsd:enumeration value="RegulatoryStateDistrict"/>
+ <xsd:enumeration value="RegulatoryStateEntity"/>
+ <xsd:enumeration value="RehabilitationFacility"/>
+ <xsd:enumeration value="RehabilitationInpatientUnit"/>
+ <xsd:enumeration value="RehabilitationOutpatientServices"/>
+ <xsd:enumeration value="ReimbursingBank"/>
+ <xsd:enumeration value="ReinsuranceIntermediaryOrBroker"/>
+ <xsd:enumeration value="Reinsurer"/>
+ <xsd:enumeration value="Relative"/>
+ <xsd:enumeration value="ReleaseDrayman"/>
+ <xsd:enumeration value="ReleaseToParty"/>
+ <xsd:enumeration value="RemittingBank"/>
+ <xsd:enumeration value="RemitTo"/>
+ <xsd:enumeration value="RenderingProvider"/>
+ <xsd:enumeration value="Renter"/>
+ <xsd:enumeration value="RentPayor"/>
+ <xsd:enumeration value="RepairingOutlet"/>
+ <xsd:enumeration value="RepairOrRefurbishLocation"/>
+ <xsd:enumeration value="ReplacingManufacturer"/>
+ <xsd:enumeration value="Reporter"/>
+ <xsd:enumeration value="ReportingCarrier"/>
+ <xsd:enumeration value="ReportingCarriersNominatedAgentOrRepresentative"/>
+ <xsd:enumeration value="ReportingLocation"/>
+ <xsd:enumeration value="ReportingOfficer"/>
+ <xsd:enumeration value="Representative"/>
+ <xsd:enumeration value="ReproductiveHealthServices"/>
+ <xsd:enumeration value="RequestedLender"/>
+ <xsd:enumeration value="Requestor"/>
+ <xsd:enumeration value="ResaleCustomer"/>
+ <xsd:enumeration value="ResaleDealer"/>
+ <xsd:enumeration value="ResearchInstitute"/>
+ <xsd:enumeration value="Reservoir"/>
+ <xsd:enumeration value="ResidenceOrDomicile"/>
+ <xsd:enumeration value="ResidencyInstitution"/>
+ <xsd:enumeration value="ResidentBeneficiary"/>
+ <xsd:enumeration value="ResidentInstructingParty"/>
+ <xsd:enumeration value="RespiratoryTherapyServices"/>
+ <xsd:enumeration value="RespiteCareFacility"/>
+ <xsd:enumeration value="ResponsibleExhibitor"/>
+ <xsd:enumeration value="ResponsibleGovernmentAgency"/>
+ <xsd:enumeration value="ResponsibleInstallationDestination"/>
+ <xsd:enumeration value="ResponsibleInstallationOrigin"/>
+ <xsd:enumeration value="ResponsibleParty"/>
+ <xsd:enumeration value="RetailAccount"/>
+ <xsd:enumeration value="RetailPharmacy"/>
+ <xsd:enumeration value="Retrocessionaire"/>
+ <xsd:enumeration value="ReturnedTo"/>
+ <xsd:enumeration value="RoadCarrier"/>
+ <xsd:enumeration value="RoutingParty"/>
+ <xsd:enumeration value="RoutingPoint"/>
+ <xsd:enumeration value="RoyaltyOwner"/>
+ <xsd:enumeration value="RuralHealthClinic"/>
+ <xsd:enumeration value="SalesAssistant"/>
+ <xsd:enumeration value="SalesOffice"/>
+ <xsd:enumeration value="Salesperson"/>
+ <xsd:enumeration value="SalesResponsibility"/>
+ <xsd:enumeration value="SalvageCarrier"/>
+ <xsd:enumeration value="SamplesToBeReturnedTo"/>
+ <xsd:enumeration value="SamplingLocation"/>
+ <xsd:enumeration value="School-BasedServiceProvider"/>
+ <xsd:enumeration value="SchoolDistrict"/>
+ <xsd:enumeration value="SCorporation"/>
+ <xsd:enumeration value="ScreeningPoint"/>
+ <xsd:enumeration value="SealingCompany"/>
+ <xsd:enumeration value="SecondaryInventoryControlActivity"/>
+ <xsd:enumeration value="SecondaryLocationAddress"/>
+ <xsd:enumeration value="SecondaryPayer"/>
+ <xsd:enumeration value="SecondaryTaxpayer"/>
+ <xsd:enumeration value="SecondaryWarranter"/>
+ <xsd:enumeration value="SecondContact"/>
+ <xsd:enumeration value="SecondContactOrganization"/>
+ <xsd:enumeration value="SecondHome"/>
+ <xsd:enumeration value="SecondLevelParentCompany"/>
+ <xsd:enumeration value="Secretariat"/>
+ <xsd:enumeration value="Section8AProgramParticipantFirm"/>
+ <xsd:enumeration value="SecuredParty"/>
+ <xsd:enumeration value="SecuredPartyCompany"/>
+ <xsd:enumeration value="SecuredPartyIndividual"/>
+ <xsd:enumeration value="SelfInsured"/>
+ <xsd:enumeration value="Seller"/>
+ <xsd:enumeration value="SellerAsOfficiallyRegistered"/>
+ <xsd:enumeration value="SellersAgentOrRepresentative"/>
+ <xsd:enumeration value="SellersFinancialInstitution"/>
+ <xsd:enumeration value="SellingAgent"/>
+ <xsd:enumeration value="SellingOffice"/>
+ <xsd:enumeration value="SellingParty"/>
+ <xsd:enumeration value="SenderOfFunds"/>
+ <xsd:enumeration value="SendersCorrespondentBank"/>
+ <xsd:enumeration value="SeniorMembershipProgram"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceLocation"/>
+ <xsd:enumeration value="ServiceManager"/>
+ <xsd:enumeration value="ServiceOrganization"/>
+ <xsd:enumeration value="ServicePerformanceSite"/>
+ <xsd:enumeration value="ServicePerformer"/>
+ <xsd:enumeration value="ServiceProvider"/>
+ <xsd:enumeration value="ServiceRequester"/>
+ <xsd:enumeration value="ServiceSupplier"/>
+ <xsd:enumeration value="ServicingAgent"/>
+ <xsd:enumeration value="ServicingBroker"/>
+ <xsd:enumeration value="ServicingDealer"/>
+ <xsd:enumeration value="ServicingOrganization"/>
+ <xsd:enumeration value="SharedService"/>
+ <xsd:enumeration value="Shareholder"/>
+ <xsd:enumeration value="ShelteredWorkshop"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="Shipper"/>
+ <xsd:enumeration value="ShippersAssociation"/>
+ <xsd:enumeration value="ShippingLineService"/>
+ <xsd:enumeration value="ShippingScheduleIssuer"/>
+ <xsd:enumeration value="ShipTo"/>
+ <xsd:enumeration value="ShowingAgent"/>
+ <xsd:enumeration value="Sibling"/>
+ <xsd:enumeration value="Signatory"/>
+ <xsd:enumeration value="Signer"/>
+ <xsd:enumeration value="SignificantOther"/>
+ <xsd:enumeration value="SinglePhotonEmissionComputerizedTomographyUnit"/>
+ <xsd:enumeration value="SiteOperator"/>
+ <xsd:enumeration value="SkilledNursingFacility"/>
+ <xsd:enumeration value="SkilledNursingorOtherLong-TermCareUnit"/>
+ <xsd:enumeration value="SkilledNursingServices"/>
+ <xsd:enumeration value="Slaughterer"/>
+ <xsd:enumeration value="SlotCharterParty"/>
+ <xsd:enumeration value="SmallBaseStationLocation"/>
+ <xsd:enumeration value="SmallBusiness"/>
+ <xsd:enumeration value="SmallControlStationLocation"/>
+ <xsd:enumeration value="SmallDisadvantagedBusiness"/>
+ <xsd:enumeration value="SociallyDisadvantagedBusiness"/>
+ <xsd:enumeration value="SociallyDisadvantagedIndividual"/>
+ <xsd:enumeration value="SociallyInsuredPerson"/>
+ <xsd:enumeration value="SocialSecuritiesCollectorsOffice"/>
+ <xsd:enumeration value="SocietyOfPropertyInformationCompilersAndAnalysts"/>
+ <xsd:enumeration value="SoldTo"/>
+ <xsd:enumeration value="SoldToAndShipTo"/>
+ <xsd:enumeration value="SoldToIfDifferentFromBillTo"/>
+ <xsd:enumeration value="SoleProprietor"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SourceMeterLocation"/>
+ <xsd:enumeration value="SourceOfInformation"/>
+ <xsd:enumeration value="SourcePartyOfInformation"/>
+ <xsd:enumeration value="SpecialAccount"/>
+ <xsd:enumeration value="SpecialCounsel"/>
+ <xsd:enumeration value="SpecializedMobileRadioServiceLicensee"/>
+ <xsd:enumeration value="SpecializedOutpatientProgramForAIDSOrARC"/>
+ <xsd:enumeration value="SpecifiedRepository"/>
+ <xsd:enumeration value="SpeechTherapyServices"/>
+ <xsd:enumeration value="SportsMedicineClinicOrServices"/>
+ <xsd:enumeration value="Spouse"/>
+ <xsd:enumeration value="SpouseInsured"/>
+ <xsd:enumeration value="SpudContractor"/>
+ <xsd:enumeration value="State"/>
+ <xsd:enumeration value="StateCharteredFacility"/>
+ <xsd:enumeration value="StateDivision"/>
+ <xsd:enumeration value="SteamshipCompany"/>
+ <xsd:enumeration value="Stockholder"/>
+ <xsd:enumeration value="StorageArea"/>
+ <xsd:enumeration value="StorageFacilityatDestination"/>
+ <xsd:enumeration value="StorageFacilityAtOrigin"/>
+ <xsd:enumeration value="Store"/>
+ <xsd:enumeration value="StoreClass"/>
+ <xsd:enumeration value="StoreGroup"/>
+ <xsd:enumeration value="StoreKeeper"/>
+ <xsd:enumeration value="StoreManager"/>
+ <xsd:enumeration value="Student"/>
+ <xsd:enumeration value="StudySubmitter"/>
+ <xsd:enumeration value="Sub-Account"/>
+ <xsd:enumeration value="Subcontractor"/>
+ <xsd:enumeration value="SubcontractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="Subcontractor-Nominated"/>
+ <xsd:enumeration value="SubcontractorWithDirectPayment"/>
+ <xsd:enumeration value="Sub-Entity"/>
+ <xsd:enumeration value="Subgroup"/>
+ <xsd:enumeration value="SubjectOfInquiry"/>
+ <xsd:enumeration value="SubjectProperty"/>
+ <xsd:enumeration value="Submitter"/>
+ <xsd:enumeration value="SubmitterOfSample"/>
+ <xsd:enumeration value="Sub-Office"/>
+ <xsd:enumeration value="Subscriber"/>
+ <xsd:enumeration value="SubscribersEmployer"/>
+ <xsd:enumeration value="SubscribersSchool"/>
+ <xsd:enumeration value="SubsequentOwner"/>
+ <xsd:enumeration value="Sub-Servicer"/>
+ <xsd:enumeration value="Subsidiary"/>
+ <xsd:enumeration value="SubsidiaryDivision"/>
+ <xsd:enumeration value="SubstituteSupplier"/>
+ <xsd:enumeration value="SuccessfulJobApplicant"/>
+ <xsd:enumeration value="SupervisingHealthCareProvider"/>
+ <xsd:enumeration value="SupervisingPhysician"/>
+ <xsd:enumeration value="Supervisor"/>
+ <xsd:enumeration value="SupervisoryAppraiserName"/>
+ <xsd:enumeration value="Supplier"/>
+ <xsd:enumeration value="SupplierOrManufacturer"/>
+ <xsd:enumeration value="SuppliersCorporateOffice"/>
+ <xsd:enumeration value="SupplierWorkTeam"/>
+ <xsd:enumeration value="SupplySource"/>
+ <xsd:enumeration value="SupportingPersonnel"/>
+ <xsd:enumeration value="SupportParty"/>
+ <xsd:enumeration value="Surety"/>
+ <xsd:enumeration value="SuretyForAdditions"/>
+ <xsd:enumeration value="SuretyForAntidumpingOrCountervailingDuty"/>
+ <xsd:enumeration value="SurfaceDischargeAgency"/>
+ <xsd:enumeration value="SurfaceManagementEntity"/>
+ <xsd:enumeration value="Surgeon"/>
+ <xsd:enumeration value="SurplusDealer"/>
+ <xsd:enumeration value="Surveyor-PofessionalQuantity"/>
+ <xsd:enumeration value="SurveyorQuantity"/>
+ <xsd:enumeration value="SurveyorTopographical"/>
+ <xsd:enumeration value="System"/>
+ <xsd:enumeration value="TankFarm"/>
+ <xsd:enumeration value="TankFarmOwner"/>
+ <xsd:enumeration value="TariffIssuer"/>
+ <xsd:enumeration value="TaxAddress"/>
+ <xsd:enumeration value="TaxAuthority"/>
+ <xsd:enumeration value="TaxCollectorsOffice"/>
+ <xsd:enumeration value="TaxExemptOrganization"/>
+ <xsd:enumeration value="Team"/>
+ <xsd:enumeration value="TechnicalOffice"/>
+ <xsd:enumeration value="TelephoneAnsweringServiceBureau"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="TenantManager"/>
+ <xsd:enumeration value="Tenderer"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="TerminalLocation"/>
+ <xsd:enumeration value="TerminalOperator"/>
+ <xsd:enumeration value="TertiaryPayer"/>
+ <xsd:enumeration value="TestingLaboratory"/>
+ <xsd:enumeration value="TestingService"/>
+ <xsd:enumeration value="TestSponsor"/>
+ <xsd:enumeration value="TheaterCircuit"/>
+ <xsd:enumeration value="Theatre"/>
+ <xsd:enumeration value="TherapeuticRadioisotopeFacility"/>
+ <xsd:enumeration value="ThirdParty"/>
+ <xsd:enumeration value="ThirdPartyAdministrator"/>
+ <xsd:enumeration value="ThirdPartyInvestmentAdvisor"/>
+ <xsd:enumeration value="ThirdPartyMarketer"/>
+ <xsd:enumeration value="ThirdPartyRepricingOrganization"/>
+ <xsd:enumeration value="ThirdPartyRepricingPreferredProviderOrganization"/>
+ <xsd:enumeration value="ThirdPartyReviewingOrganization"/>
+ <xsd:enumeration value="ThirdPartyReviewingPreferredProviderOrganization"/>
+ <xsd:enumeration value="Titleholder"/>
+ <xsd:enumeration value="TitleInsuranceServicesProvider"/>
+ <xsd:enumeration value="TitleUnderwriter"/>
+ <xsd:enumeration value="Tooling"/>
+ <xsd:enumeration value="ToolingDesign"/>
+ <xsd:enumeration value="ToolingFabrication"/>
+ <xsd:enumeration value="ToolSource"/>
+ <xsd:enumeration value="TopParentCompanyInSameCountry"/>
+ <xsd:enumeration value="TowingAgency"/>
+ <xsd:enumeration value="Tradename"/>
+ <xsd:enumeration value="TradeNameSynonym"/>
+ <xsd:enumeration value="TradeUnion"/>
+ <xsd:enumeration value="TrainingInstitution"/>
+ <xsd:enumeration value="TransferPoint"/>
+ <xsd:enumeration value="TransferringParty"/>
+ <xsd:enumeration value="TransferTo"/>
+ <xsd:enumeration value="TransitAuthority"/>
+ <xsd:enumeration value="TransitChargePayer"/>
+ <xsd:enumeration value="TransitFreightForwarder"/>
+ <xsd:enumeration value="TransitPrincipal"/>
+ <xsd:enumeration value="TransitPrincipalsAgentOrRepresentative"/>
+ <xsd:enumeration value="Transmitter"/>
+ <xsd:enumeration value="TransportationOffice"/>
+ <xsd:enumeration value="TransporterOfHazardousWaste"/>
+ <xsd:enumeration value="TransshipmentParty"/>
+ <xsd:enumeration value="TraumaCenter"/>
+ <xsd:enumeration value="TreatmentFacility"/>
+ <xsd:enumeration value="TribalGovernment"/>
+ <xsd:enumeration value="Trust"/>
+ <xsd:enumeration value="Trustee"/>
+ <xsd:enumeration value="TrusteesAttorney"/>
+ <xsd:enumeration value="TrustOfficer"/>
+ <xsd:enumeration value="TrustOrEstate"/>
+ <xsd:enumeration value="TuberculosisAndOTherRespiratoryDiseasesFacility"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomer"/>
+ <xsd:enumeration value="UltimateParentCompany"/>
+ <xsd:enumeration value="UltimateSameCountryParentCompany"/>
+ <xsd:enumeration value="UltrasoundUnit"/>
+ <xsd:enumeration value="UnassignedAgent"/>
+ <xsd:enumeration value="Underwriter"/>
+ <xsd:enumeration value="UnexpectedHandlingParty"/>
+ <xsd:enumeration value="Union"/>
+ <xsd:enumeration value="UnitedStatesCustomsBroker"/>
+ <xsd:enumeration value="UnitedStatesOverseasSecurityAdministrationOffice"/>
+ <xsd:enumeration value="UnitProperty"/>
+ <xsd:enumeration value="University-CollegeOrSchool"/>
+ <xsd:enumeration value="UnloadingParty"/>
+ <xsd:enumeration value="UnserviceableMaterialConsignee"/>
+ <xsd:enumeration value="UpstreamMeterLocation"/>
+ <xsd:enumeration value="UpstreamParty"/>
+ <xsd:enumeration value="USTrustee"/>
+ <xsd:enumeration value="UtilizationManagementOrganization"/>
+ <xsd:enumeration value="VacationHome"/>
+ <xsd:enumeration value="ValidatingParty"/>
+ <xsd:enumeration value="ValueAddedNetworkProvider"/>
+ <xsd:enumeration value="Vehicle"/>
+ <xsd:enumeration value="VehicleCustodian"/>
+ <xsd:enumeration value="VehicleSalvageAssignment"/>
+ <xsd:enumeration value="Vendor"/>
+ <xsd:enumeration value="VesselMaster"/>
+ <xsd:enumeration value="VesselName"/>
+ <xsd:enumeration value="Veteran-OwnedBusiness"/>
+ <xsd:enumeration value="VeteransAdministrationFacility"/>
+ <xsd:enumeration value="VeteransAdministrationLoanAuthorizedSupplier"/>
+ <xsd:enumeration value="VeteransAdministrationLoanGuarantyAuthority"/>
+ <xsd:enumeration value="Veterinarian"/>
+ <xsd:enumeration value="VeterinaryHospital"/>
+ <xsd:enumeration value="Victim"/>
+ <xsd:enumeration value="VideoDepartment"/>
+ <xsd:enumeration value="VolunteerServicesDepartment"/>
+ <xsd:enumeration value="Voter"/>
+ <xsd:enumeration value="WageEarner"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WarehouseDepositor"/>
+ <xsd:enumeration value="WarehouseKeeper"/>
+ <xsd:enumeration value="Warranter"/>
+ <xsd:enumeration value="WaterAmbulanceServices"/>
+ <xsd:enumeration value="WaterSystem"/>
+ <xsd:enumeration value="WeightingParty"/>
+ <xsd:enumeration value="WellCasingDepthAuthority"/>
+ <xsd:enumeration value="WellPadConstructionContractor"/>
+ <xsd:enumeration value="Wholesaler"/>
+ <xsd:enumeration value="Wholly-OwnedSubsidiary"/>
+ <xsd:enumeration value="Winner"/>
+ <xsd:enumeration value="WithdrawalPoint"/>
+ <xsd:enumeration value="Witness"/>
+ <xsd:enumeration value="WitnessForDefendant"/>
+ <xsd:enumeration value="WitnessForPlaintiff"/>
+ <xsd:enumeration value="WitnessForProsecution"/>
+ <xsd:enumeration value="Woman-OwnedBusiness"/>
+ <xsd:enumeration value="Woman-OwnedBusinessLarge"/>
+ <xsd:enumeration value="Woman-OwnedBusinessSmall"/>
+ <xsd:enumeration value="WomensHealthCenterOrServices"/>
+ <xsd:enumeration value="WorksiteHealthPromotionFacility"/>
+ <xsd:enumeration value="WorksManager"/>
+ <xsd:enumeration value="WorkTeam"/>
+ <xsd:enumeration value="WritingAgent"/>
+ <xsd:enumeration value="X-RayRadiationTherapyUnit"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderReferences">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="AccountCode">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ContractReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfContract"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="QuoteReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OtherOrderReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderReferences" type="OrderReferences"/>
+ <xsd:complexType name="Reference">
+ <xsd:sequence>
+ <xsd:element name="RefNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RefDate" type="xcblDatetime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Reference" type="Reference"/>
+ <xsd:complexType name="ListOfContract">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Contract"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContract" type="ListOfContract"/>
+ <xsd:complexType name="Contract">
+ <xsd:sequence>
+ <xsd:element name="ContractID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ContractType"/>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:element minOccurs="0" name="SystemID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Contract" type="Contract"/>
+ <xsd:complexType name="Identifier">
+ <xsd:sequence>
+ <xsd:element ref="Agency"/>
+ <xsd:element name="Ident" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Identifier" type="Identifier"/>
+ <xsd:complexType name="Agency">
+ <xsd:sequence>
+ <xsd:element name="AgencyCoded" type="AgencyCode"/>
+ <xsd:element minOccurs="0" name="AgencyCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AgencyDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeListIdentifierCoded" type="CodeListIdentifierCode"/>
+ <xsd:element minOccurs="0" name="CodeListIdentifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Agency" type="Agency"/>
+ <xsd:simpleType name="AgencyCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AAMVA"/>
+ <xsd:enumeration value="ABCD-TheMicrocomputerIndustryAssociation"/>
+ <xsd:enumeration value="ACGIH"/>
+ <xsd:enumeration value="ACORD"/>
+ <xsd:enumeration value="AdvertisingIndustry"/>
+ <xsd:enumeration value="AECMA"/>
+ <xsd:enumeration value="AIHA"/>
+ <xsd:enumeration value="AirTransportAssociationOfAmerica"/>
+ <xsd:enumeration value="Alabama"/>
+ <xsd:enumeration value="Alaska"/>
+ <xsd:enumeration value="AluminumAssociation"/>
+ <xsd:enumeration value="AmericanApparelManufacturersAssociation"/>
+ <xsd:enumeration value="AmericanFurnitureManufacturersAssociation"/>
+ <xsd:enumeration value="AmericanIronAndSteelInstitute"/>
+ <xsd:enumeration value="AmericanLandTitleAssociation"/>
+ <xsd:enumeration value="AmericanMedicalAssociation"/>
+ <xsd:enumeration value="AmericanPaperInstitute"/>
+ <xsd:enumeration value="AmericanPetroleumInstitute"/>
+ <xsd:enumeration value="APWAAndOCSI"/>
+ <xsd:enumeration value="AmericanSocietyForAutomationInPharmacy"/>
+ <xsd:enumeration value="AmericanTextileManufacturersInstitute"/>
+ <xsd:enumeration value="AmericanTruckingAssociations"/>
+ <xsd:enumeration value="ANSIAccreditedStandardsCommittee"/>
+ <xsd:enumeration value="Arizona"/>
+ <xsd:enumeration value="Arkansas"/>
+ <xsd:enumeration value="ASME"/>
+ <xsd:enumeration value="AssignedByBuyerOrBuyersAgent"/>
+ <xsd:enumeration value="AssignedByCarrier"/>
+ <xsd:enumeration value="AssignedByDistributor"/>
+ <xsd:enumeration value="AssignedByManufacturer"/>
+ <xsd:enumeration value="AssignedByMarketPlace"/>
+ <xsd:enumeration value="AssignedByNationalTradeAgency"/>
+ <xsd:enumeration value="AssignedByOwnerOfOperation"/>
+ <xsd:enumeration value="AssignedByPartyOriginatingTheMessage"/>
+ <xsd:enumeration value="AssignedBySellerOrSellersAgent"/>
+ <xsd:enumeration value="AssignedByTransportCompany"/>
+ <xsd:enumeration value="ASTM"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="AT-GeldausgabeautomatenServiceGesellschaftMBH"/>
+ <xsd:enumeration value="AT-AustrianCustoms"/>
+ <xsd:enumeration value="AT-AustrianPTT"/>
+ <xsd:enumeration value="AT-VerbandOesterreichischerBankenUndBankiers"/>
+ <xsd:enumeration value="AU-ACOS"/>
+ <xsd:enumeration value="AU-ADA"/>
+ <xsd:enumeration value="AU-AIHW"/>
+ <xsd:enumeration value="AU-APCA"/>
+ <xsd:enumeration value="AU-AQIS"/>
+ <xsd:enumeration value="AU-AustrianCustomsService"/>
+ <xsd:enumeration value="AU-DOH"/>
+ <xsd:enumeration value="AU-HIC"/>
+ <xsd:enumeration value="AU-LIFA"/>
+ <xsd:enumeration value="AU-NCCH"/>
+ <xsd:enumeration value="AU-ROA"/>
+ <xsd:enumeration value="AU-SAA"/>
+ <xsd:enumeration value="AU-Tradegate"/>
+ <xsd:enumeration value="AWS"/>
+ <xsd:enumeration value="AYSA"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BE-BelgianBankersAssociation"/>
+ <xsd:enumeration value="BE-BelgianCustoms"/>
+ <xsd:enumeration value="BE-BelgianMinistryOfFinance"/>
+ <xsd:enumeration value="Bellcore"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BIC"/>
+ <xsd:enumeration value="BookIndustrySystemsAdvisoryCommittee"/>
+ <xsd:enumeration value="BR-BancoCentralDoBrazil"/>
+ <xsd:enumeration value="BR-MAAndRAAAndLIMNETAndRINET"/>
+ <xsd:enumeration value="CA-CPA"/>
+ <xsd:enumeration value="CA-CSIO"/>
+ <xsd:enumeration value="California"/>
+ <xsd:enumeration value="CaliforniaLandTitleAssociation"/>
+ <xsd:enumeration value="CanadianFreightClassification"/>
+ <xsd:enumeration value="CarbideManufacturers"/>
+ <xsd:enumeration value="CA-RevenueCanadaCustomsAndExcise"/>
+ <xsd:enumeration value="CAS"/>
+ <xsd:enumeration value="CA-SCC"/>
+ <xsd:enumeration value="CCC"/>
+ <xsd:enumeration value="CEC"/>
+ <xsd:enumeration value="CECDGXIIID5"/>
+ <xsd:enumeration value="CECDGXXI01"/>
+ <xsd:enumeration value="CECDGXXIB1"/>
+ <xsd:enumeration value="CECDGXXXIV"/>
+ <xsd:enumeration value="CEFIC"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CH-AdministrationFederaleDesContributions"/>
+ <xsd:enumeration value="CH-AssociationSuisseCodeDesArticles"/>
+ <xsd:enumeration value="CH-Carbura"/>
+ <xsd:enumeration value="CH-CentraleSuissePourLImportationDuCharbon"/>
+ <xsd:enumeration value="CH-DirectionGeneraleDesDouanes"/>
+ <xsd:enumeration value="CH-DivisionDesImportationsEtExportations"/>
+ <xsd:enumeration value="CH-EntrepriseDesPTT"/>
+ <xsd:enumeration value="CH-MinistryOfTaxationCentralCustomsAndTaxAdministration"/>
+ <xsd:enumeration value="CH-OfficeFiduciaireDesImportateursDeDenreesAlimentaires"/>
+ <xsd:enumeration value="CH-SwissSecuritiesClearingCorporation"/>
+ <xsd:enumeration value="CH-TelekursAG"/>
+ <xsd:enumeration value="CIDX"/>
+ <xsd:enumeration value="CIECA"/>
+ <xsd:enumeration value="CodeAssignedByTheOrganizationThatIsTheUltimateDestinationOfTheTransactionSet"/>
+ <xsd:enumeration value="CO-DIAN"/>
+ <xsd:enumeration value="Colorado"/>
+ <xsd:enumeration value="CommanderRomeAirDevelopmentCenter"/>
+ <xsd:enumeration value="ConcordEDIGroup"/>
+ <xsd:enumeration value="Connecticut"/>
+ <xsd:enumeration value="ConventionsOnSADAndTransit"/>
+ <xsd:enumeration value="CopperAndBrassFabricatorsCouncil"/>
+ <xsd:enumeration value="CO-SBDC"/>
+ <xsd:enumeration value="CountyDesignatorCode"/>
+ <xsd:enumeration value="CSI"/>
+ <xsd:enumeration value="CSIExtended"/>
+ <xsd:enumeration value="CUSIP"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DE-ARE"/>
+ <xsd:enumeration value="DE-BDI"/>
+ <xsd:enumeration value="DE-BIA"/>
+ <xsd:enumeration value="DE-BRD"/>
+ <xsd:enumeration value="DE-DIN"/>
+ <xsd:enumeration value="DE-DTAG"/>
+ <xsd:enumeration value="DE-EDIBAU"/>
+ <xsd:enumeration value="DefenseLogisticsAgency"/>
+ <xsd:enumeration value="DE-GDV"/>
+ <xsd:enumeration value="DE-GermanBankersAssociation"/>
+ <xsd:enumeration value="DE-GermanCustoms"/>
+ <xsd:enumeration value="DE-GMBH"/>
+ <xsd:enumeration value="Delaware"/>
+ <xsd:enumeration value="DepartmentOfAirForce"/>
+ <xsd:enumeration value="DepartmentOfArmy"/>
+ <xsd:enumeration value="DepartmentOfDefense"/>
+ <xsd:enumeration value="DepartmentOfHealthAndHumanServices"/>
+ <xsd:enumeration value="DepartmentOfHousingAndUrbanDevelopment"/>
+ <xsd:enumeration value="DepartmentOfLabor"/>
+ <xsd:enumeration value="DepartmentOfTheNavy"/>
+ <xsd:enumeration value="DE-SiemensAG"/>
+ <xsd:enumeration value="DE-VDA"/>
+ <xsd:enumeration value="DFAS"/>
+ <xsd:enumeration value="DIN"/>
+ <xsd:enumeration value="DirectionGeneraleDesDouanesEtDroitsIndirects"/>
+ <xsd:enumeration value="DistrictOfColumbia"/>
+ <xsd:enumeration value="DK"/>
+ <xsd:enumeration value="DK-EAN"/>
+ <xsd:enumeration value="DK-MHA"/>
+ <xsd:enumeration value="DK-NBH"/>
+ <xsd:enumeration value="DK-PBS"/>
+ <xsd:enumeration value="DunAndBradstreet"/>
+ <xsd:enumeration value="EAN"/>
+ <xsd:enumeration value="Edibuild"/>
+ <xsd:enumeration value="EdielNordicForum"/>
+ <xsd:enumeration value="EDIFICE"/>
+ <xsd:enumeration value="EDITEUR"/>
+ <xsd:enumeration value="EDITEX"/>
+ <xsd:enumeration value="EEG7"/>
+ <xsd:enumeration value="EIDX"/>
+ <xsd:enumeration value="ElectricUtilities"/>
+ <xsd:enumeration value="ElectronicIndustriesAssociation"/>
+ <xsd:enumeration value="EPA"/>
+ <xsd:enumeration value="ES"/>
+ <xsd:enumeration value="ESDX"/>
+ <xsd:enumeration value="ES-ODETT"/>
+ <xsd:enumeration value="ES-SpanishCustoms"/>
+ <xsd:enumeration value="EU-EDIFICAS"/>
+ <xsd:enumeration value="EU-ETIS"/>
+ <xsd:enumeration value="EU-ROFER"/>
+ <xsd:enumeration value="FASLINC"/>
+ <xsd:enumeration value="FCC"/>
+ <xsd:enumeration value="FCI"/>
+ <xsd:enumeration value="FDA"/>
+ <xsd:enumeration value="FederalGovernment"/>
+ <xsd:enumeration value="FederalHighwayAdministration"/>
+ <xsd:enumeration value="FI"/>
+ <xsd:enumeration value="FI-ATA"/>
+ <xsd:enumeration value="FI-FinnishCustoms"/>
+ <xsd:enumeration value="FI-TB"/>
+ <xsd:enumeration value="FI-TheFinnishBankersAssociation"/>
+ <xsd:enumeration value="Florida"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="FR-AGF"/>
+ <xsd:enumeration value="FR-ArvA"/>
+ <xsd:enumeration value="FR-BanqueDeFrance"/>
+ <xsd:enumeration value="FR-CFONB"/>
+ <xsd:enumeration value="FR-CNAMTS"/>
+ <xsd:enumeration value="FR-DCP"/>
+ <xsd:enumeration value="FR-DGI"/>
+ <xsd:enumeration value="FR-EDIFCAS"/>
+ <xsd:enumeration value="FR-EDIFRANCE"/>
+ <xsd:enumeration value="FR-EDITRANSPORT"/>
+ <xsd:enumeration value="FR-GALIA"/>
+ <xsd:enumeration value="FR-GENCOD"/>
+ <xsd:enumeration value="FR-INSEE"/>
+ <xsd:enumeration value="FR-RC"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GB-ABI"/>
+ <xsd:enumeration value="GB-ABTA"/>
+ <xsd:enumeration value="GB-ArticleNumberAssociationLimited"/>
+ <xsd:enumeration value="GB-AssociationForPaymentClearingServices"/>
+ <xsd:enumeration value="GB-BACSLimited"/>
+ <xsd:enumeration value="GB-CHAPSAndTownClearingCompanyLimited"/>
+ <xsd:enumeration value="GB-FLEETNET"/>
+ <xsd:enumeration value="GB-HMCustomsAndExcise"/>
+ <xsd:enumeration value="GB-ODETTE"/>
+ <xsd:enumeration value="GB-TheClearingHouse"/>
+ <xsd:enumeration value="Georgia"/>
+ <xsd:enumeration value="GraphicsCommunicationsAssociation"/>
+ <xsd:enumeration value="GRE"/>
+ <xsd:enumeration value="GR-GreekCustoms"/>
+ <xsd:enumeration value="GSA"/>
+ <xsd:enumeration value="GTIN"/>
+ <xsd:enumeration value="Hawaii"/>
+ <xsd:enumeration value="HealthCareFinancingAdministration"/>
+ <xsd:enumeration value="HealthInsuranceAssociationOfAmerica"/>
+ <xsd:enumeration value="HK-HongKongCustoms"/>
+ <xsd:enumeration value="HU"/>
+ <xsd:enumeration value="IAPSO"/>
+ <xsd:enumeration value="IARC"/>
+ <xsd:enumeration value="IATA"/>
+ <xsd:enumeration value="ICAO"/>
+ <xsd:enumeration value="ICC"/>
+ <xsd:enumeration value="ICS"/>
+ <xsd:enumeration value="Idaho"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IE-RevenueCommissionersCustomsAEProject"/>
+ <xsd:enumeration value="IL-IsraelCustoms"/>
+ <xsd:enumeration value="Illinois"/>
+ <xsd:enumeration value="IMO"/>
+ <xsd:enumeration value="Indiana"/>
+ <xsd:enumeration value="InterContainerInterFrigo"/>
+ <xsd:enumeration value="InternationalAssociationOfCorporationAdministrators"/>
+ <xsd:enumeration value="InternationalAssociationOfIndustrialAccidentBoardsAndCommissions"/>
+ <xsd:enumeration value="InternationalStandardsOrganization"/>
+ <xsd:enumeration value="Iowa"/>
+ <xsd:enumeration value="IP"/>
+ <xsd:enumeration value="IronAndSteelStandardsCommitteeISM"/>
+ <xsd:enumeration value="IS-IcelandCustoms"/>
+ <xsd:enumeration value="ISO"/>
+ <xsd:enumeration value="InsuranceServicesOffice"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="IT-AssociazioneBancariaItaliana"/>
+ <xsd:enumeration value="IT-ItalianCustoms"/>
+ <xsd:enumeration value="IT-ODETTE"/>
+ <xsd:enumeration value="IT-SocieataInterbancariaPerLAutomazione"/>
+ <xsd:enumeration value="JapaneseStandardsAssociation"/>
+ <xsd:enumeration value="JP-JapanCustoms"/>
+ <xsd:enumeration value="JP-MOT"/>
+ <xsd:enumeration value="JP-MSA"/>
+ <xsd:enumeration value="JP-NACCS"/>
+ <xsd:enumeration value="Kansas"/>
+ <xsd:enumeration value="Kentucky"/>
+ <xsd:enumeration value="LeasingIndustry"/>
+ <xsd:enumeration value="LifeAndAnnuityIndustryCommittee"/>
+ <xsd:enumeration value="LI-LiechtensteinAuthority"/>
+ <xsd:enumeration value="LloydsRegisterOfShipping"/>
+ <xsd:enumeration value="Louisiana"/>
+ <xsd:enumeration value="LU"/>
+ <xsd:enumeration value="LU-LuxembourgCustoms"/>
+ <xsd:enumeration value="Maine"/>
+ <xsd:enumeration value="ManufacturingCompany"/>
+ <xsd:enumeration value="Maryland"/>
+ <xsd:enumeration value="Massachusetts"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetProvider"/>
+ <xsd:enumeration value="Michigan"/>
+ <xsd:enumeration value="MilitaryStandard"/>
+ <xsd:enumeration value="Minnesota"/>
+ <xsd:enumeration value="Mississippi"/>
+ <xsd:enumeration value="Missouri"/>
+ <xsd:enumeration value="Montana"/>
+ <xsd:enumeration value="MortgageBankersAssociationOfAmerica"/>
+ <xsd:enumeration value="MY-DagangNet"/>
+ <xsd:enumeration value="MY-MalaysiaCentralBank"/>
+ <xsd:enumeration value="MY-MalaysiaCustomsAndExcise"/>
+ <xsd:enumeration value="NACE"/>
+ <xsd:enumeration value="NAGS"/>
+ <xsd:enumeration value="NationalAlcoholBeverageControlAssociation"/>
+ <xsd:enumeration value="NationalAssociationOfBusinessAndEducationalRadio"/>
+ <xsd:enumeration value="NationalBusinessFormsAssociation"/>
+ <xsd:enumeration value="NationalCenterforStateCourts"/>
+ <xsd:enumeration value="NationalCottonCouncilOfAmerica"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsurance"/>
+ <xsd:enumeration value="NationalRetailMerchantsAssociation"/>
+ <xsd:enumeration value="NationalWholesaleDruggistsAssociation"/>
+ <xsd:enumeration value="NATO"/>
+ <xsd:enumeration value="NaturalGasUtilities"/>
+ <xsd:enumeration value="NCIC"/>
+ <xsd:enumeration value="Nebraska"/>
+ <xsd:enumeration value="NEMA"/>
+ <xsd:enumeration value="Nevada"/>
+ <xsd:enumeration value="NewHampshire"/>
+ <xsd:enumeration value="NewJersey"/>
+ <xsd:enumeration value="NewMexico"/>
+ <xsd:enumeration value="NewspaperAssociationOfAmerica"/>
+ <xsd:enumeration value="NewYork"/>
+ <xsd:enumeration value="NFPA"/>
+ <xsd:enumeration value="NICB"/>
+ <xsd:enumeration value="NIOSH"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NetherlandsRailways"/>
+ <xsd:enumeration value="NL-BankGirocentraleBV"/>
+ <xsd:enumeration value="NL-BEANETBV"/>
+ <xsd:enumeration value="NL-EAN"/>
+ <xsd:enumeration value="NL-InterpayCards"/>
+ <xsd:enumeration value="NL-InterpayGiraal"/>
+ <xsd:enumeration value="NL-NetherlandsCustoms"/>
+ <xsd:enumeration value="NL-ODETTE"/>
+ <xsd:enumeration value="NorweigianStateRailway"/>
+ <xsd:enumeration value="NO"/>
+ <xsd:enumeration value="NO-NORPRO"/>
+ <xsd:enumeration value="NO-NorwegianBankersAssociation"/>
+ <xsd:enumeration value="NO-NorwegianCustoms"/>
+ <xsd:enumeration value="NO-NorwegianInterbankResearchOrganization"/>
+ <xsd:enumeration value="NorthAmerica-TelecommunicationsIndustryForum"/>
+ <xsd:enumeration value="NorthCarolina"/>
+ <xsd:enumeration value="NorthDakota"/>
+ <xsd:enumeration value="NTP"/>
+ <xsd:enumeration value="NZ-NewZealandCustoms"/>
+ <xsd:enumeration value="ODETTE"/>
+ <xsd:enumeration value="OfficeOfManagementAndBudget"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationPrograms"/>
+ <xsd:enumeration value="OfficeProducts"/>
+ <xsd:enumeration value="Ohio"/>
+ <xsd:enumeration value="Oklahoma"/>
+ <xsd:enumeration value="OpticalIndustry"/>
+ <xsd:enumeration value="Oregon"/>
+ <xsd:enumeration value="OSHA"/>
+ <xsd:enumeration value="Pennsylvania"/>
+ <xsd:enumeration value="PennsylvaniaCourts"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PT-CB"/>
+ <xsd:enumeration value="PT-PortugueseCustoms"/>
+ <xsd:enumeration value="PT-SIBS"/>
+ <xsd:enumeration value="RealEstateInformationIndustry"/>
+ <xsd:enumeration value="RhodeIsland"/>
+ <xsd:enumeration value="RINET"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RU-BIC"/>
+ <xsd:enumeration value="RU-SFT"/>
+ <xsd:enumeration value="SAE"/>
+ <xsd:enumeration value="SA-SaudiArabiaCustoms"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SE-CentralBank"/>
+ <xsd:enumeration value="SE-ODETTE"/>
+ <xsd:enumeration value="SE-SvenskaBankfoereningen"/>
+ <xsd:enumeration value="SE-SwedishCustoms"/>
+ <xsd:enumeration value="ShippersAssociation"/>
+ <xsd:enumeration value="SISAC"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SouthCarolina"/>
+ <xsd:enumeration value="SouthDakota"/>
+ <xsd:enumeration value="StateAgencyAssigned"/>
+ <xsd:enumeration value="StudentLoanGuarantor"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="TALC"/>
+ <xsd:enumeration value="TelecommunicationsIndustry"/>
+ <xsd:enumeration value="TemporaryHelpIndustry"/>
+ <xsd:enumeration value="Tennessee"/>
+ <xsd:enumeration value="Texas"/>
+ <xsd:enumeration value="TexasLandTitleAssociation"/>
+ <xsd:enumeration value="TextileDistributorsAssociationInc"/>
+ <xsd:enumeration value="TDCC-EDIA"/>
+ <xsd:enumeration value="TW-ChineseTaipeiCustoms"/>
+ <xsd:enumeration value="TW-Trade-van"/>
+ <xsd:enumeration value="UCS"/>
+ <xsd:enumeration value="UIC"/>
+ <xsd:enumeration value="UN"/>
+ <xsd:enumeration value="UNECE"/>
+ <xsd:enumeration value="UNCTAD"/>
+ <xsd:enumeration value="UnitedStatesCourts"/>
+ <xsd:enumeration value="UnitedStatesMarineCorps"/>
+ <xsd:enumeration value="UnitedStatesNuclearRegulatoryCommission"/>
+ <xsd:enumeration value="UPU"/>
+ <xsd:enumeration value="US-AA"/>
+ <xsd:enumeration value="US-AAR"/>
+ <xsd:enumeration value="US-ABA"/>
+ <xsd:enumeration value="US-AIAG"/>
+ <xsd:enumeration value="US-AirTransportAssociationOfAmerica"/>
+ <xsd:enumeration value="US-AISI"/>
+ <xsd:enumeration value="US-AmericanPetroleumInstitute"/>
+ <xsd:enumeration value="US-ANSIASCX12"/>
+ <xsd:enumeration value="US-API"/>
+ <xsd:enumeration value="US-ASTM"/>
+ <xsd:enumeration value="US-ATF"/>
+ <xsd:enumeration value="US-BATF"/>
+ <xsd:enumeration value="US-BXA"/>
+ <xsd:enumeration value="US-CHIPS"/>
+ <xsd:enumeration value="US-CIDX"/>
+ <xsd:enumeration value="US-CM"/>
+ <xsd:enumeration value="US-COPAS"/>
+ <xsd:enumeration value="US-DAndB"/>
+ <xsd:enumeration value="US-DCI"/>
+ <xsd:enumeration value="US-DEA"/>
+ <xsd:enumeration value="US-DHHS"/>
+ <xsd:enumeration value="US-DISA"/>
+ <xsd:enumeration value="US-DISCUS"/>
+ <xsd:enumeration value="US-DLMSO"/>
+ <xsd:enumeration value="US-DOA"/>
+ <xsd:enumeration value="US-DOD"/>
+ <xsd:enumeration value="US-DODAAC"/>
+ <xsd:enumeration value="US-DOL"/>
+ <xsd:enumeration value="US-DOT"/>
+ <xsd:enumeration value="US-DSAA"/>
+ <xsd:enumeration value="US-EIA"/>
+ <xsd:enumeration value="US-FCC"/>
+ <xsd:enumeration value="US-FDA"/>
+ <xsd:enumeration value="US-FIPS"/>
+ <xsd:enumeration value="US-FMC"/>
+ <xsd:enumeration value="US-FWS"/>
+ <xsd:enumeration value="US-GSA"/>
+ <xsd:enumeration value="US-HBICC"/>
+ <xsd:enumeration value="US-HI"/>
+ <xsd:enumeration value="US-HL7"/>
+ <xsd:enumeration value="US-ISA"/>
+ <xsd:enumeration value="US-MARAD"/>
+ <xsd:enumeration value="US-NABCA"/>
+ <xsd:enumeration value="US-NAIC"/>
+ <xsd:enumeration value="USNationalCenterForHealthStatisticsCommissionOfProfessionalAndHospitalActivities"/>
+ <xsd:enumeration value="US-NationalMotorFreightClassificationAssociation"/>
+ <xsd:enumeration value="US-NationalRetailFederation"/>
+ <xsd:enumeration value="US-NCCMA"/>
+ <xsd:enumeration value="US-NIST"/>
+ <xsd:enumeration value="US-NRC"/>
+ <xsd:enumeration value="US-NWDA"/>
+ <xsd:enumeration value="US-ODTC"/>
+ <xsd:enumeration value="US-OFAC"/>
+ <xsd:enumeration value="US-OMB"/>
+ <xsd:enumeration value="US-StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="US-TDCC"/>
+ <xsd:enumeration value="US-UCC"/>
+ <xsd:enumeration value="US-UN-SPSC"/>
+ <xsd:enumeration value="US-UOP"/>
+ <xsd:enumeration value="US-USCensusBureau"/>
+ <xsd:enumeration value="US-USCustomsService"/>
+ <xsd:enumeration value="US-USPS"/>
+ <xsd:enumeration value="US-VA"/>
+ <xsd:enumeration value="US-VICS"/>
+ <xsd:enumeration value="US-WSSA"/>
+ <xsd:enumeration value="Utah"/>
+ <xsd:enumeration value="UtilityIndustryGroup"/>
+ <xsd:enumeration value="Vermont"/>
+ <xsd:enumeration value="VICS"/>
+ <xsd:enumeration value="Virginia"/>
+ <xsd:enumeration value="Washington"/>
+ <xsd:enumeration value="WestVirginia"/>
+ <xsd:enumeration value="WHMIS"/>
+ <xsd:enumeration value="Wisconsin"/>
+ <xsd:enumeration value="Wyoming"/>
+ <xsd:enumeration value="DirectorGeneralOfCanada"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="CodeListIdentifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceSiteCode"/>
+ <xsd:enumeration value="AccidentParameters"/>
+ <xsd:enumeration value="AccordEuropeenRelatifAuTransportInternationalDesMarchandises"/>
+ <xsd:enumeration value="AccountAnalysisCodes"/>
+ <xsd:enumeration value="AccountCharacteristicsCode"/>
+ <xsd:enumeration value="AccountingInformationIdentifier"/>
+ <xsd:enumeration value="AccountRating"/>
+ <xsd:enumeration value="AccountRelationshipType"/>
+ <xsd:enumeration value="AcquisitionAdviceCode"/>
+ <xsd:enumeration value="AcquisitionMethodCode"/>
+ <xsd:enumeration value="AcquisitionMethodSuffixCode"/>
+ <xsd:enumeration value="ActionCode"/>
+ <xsd:enumeration value="ActivitePrincipaleExerceeCode"/>
+ <xsd:enumeration value="Activity"/>
+ <xsd:enumeration value="AdmittingDiagnosis"/>
+ <xsd:enumeration value="AdverseEventCode"/>
+ <xsd:enumeration value="AdverseEventOutcomeCode"/>
+ <xsd:enumeration value="AdviceCode"/>
+ <xsd:enumeration value="AgentStatusCode"/>
+ <xsd:enumeration value="AidTypeCode"/>
+ <xsd:enumeration value="AirCarrier"/>
+ <xsd:enumeration value="AirCommodityAndSpecialHandlingCode"/>
+ <xsd:enumeration value="AircraftMissionDesignSeriesCode"/>
+ <xsd:enumeration value="AirDimensionCode"/>
+ <xsd:enumeration value="AirportOrCity"/>
+ <xsd:enumeration value="AirportTerminal"/>
+ <xsd:enumeration value="AirTerminalIdentifierCode"/>
+ <xsd:enumeration value="AllegationTypeCode"/>
+ <xsd:enumeration value="AllPatientDiagnosisRelatedGroups"/>
+ <xsd:enumeration value="AllPatientRefinedDiagnosisRelatedGroups"/>
+ <xsd:enumeration value="AlterationLookup"/>
+ <xsd:enumeration value="AmbulatoryPatientGroups"/>
+ <xsd:enumeration value="AmendmentCode-Customs"/>
+ <xsd:enumeration value="AmericanPsychiatricAssociationDiagnosticStatisticalManualOfMentalDisorders"/>
+ <xsd:enumeration value="AmericanSocietyForTestingAndMaterials"/>
+ <xsd:enumeration value="AntennaPolarization"/>
+ <xsd:enumeration value="AntennaStructureType"/>
+ <xsd:enumeration value="ApplicantClassificationType"/>
+ <xsd:enumeration value="ApplicantType"/>
+ <xsd:enumeration value="ApplicationAcknowledgementAndErrorCodes"/>
+ <xsd:enumeration value="ApplicationErrorCode"/>
+ <xsd:enumeration value="ApplicationQuestionIdentifier"/>
+ <xsd:enumeration value="ApplicationType"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="AreaOfOperation"/>
+ <xsd:enumeration value="ArrestReason"/>
+ <xsd:enumeration value="ArticleStatus"/>
+ <xsd:enumeration value="AssetDetails"/>
+ <xsd:enumeration value="AssetRecurrence"/>
+ <xsd:enumeration value="AssetStatusOrTransactionReportingCode"/>
+ <xsd:enumeration value="AssetTransferStatusCode"/>
+ <xsd:enumeration value="AssetType"/>
+ <xsd:enumeration value="AssignedByReceiver"/>
+ <xsd:enumeration value="AssignedBySender"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsDeprescriptionDistributionList"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsDeprescriptionExceptionList"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsRateEdiNetworkErrorCode"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsStandardTransportationCommodityCodeDescriptionQualifier"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsStandardTransportationCommodityCodeMasterDescriptionInformation"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsSwitchReleaseCodes"/>
+ <xsd:enumeration value="AssuredDeliveryIndicator"/>
+ <xsd:enumeration value="AuthorizationType"/>
+ <xsd:enumeration value="AutomatedClearingHouse"/>
+ <xsd:enumeration value="AutomatedDataProcessingEquipmentIdentificationCode"/>
+ <xsd:enumeration value="AwardSource"/>
+ <xsd:enumeration value="BalanceTypeCode"/>
+ <xsd:enumeration value="BankAdministrationInstitute"/>
+ <xsd:enumeration value="BankBranchSortingIdentification"/>
+ <xsd:enumeration value="BankIdentification"/>
+ <xsd:enumeration value="BankSecuritiesCode"/>
+ <xsd:enumeration value="BasisOfJurisdictionCode"/>
+ <xsd:enumeration value="BeneficiaryType"/>
+ <xsd:enumeration value="BidRejectionReason"/>
+ <xsd:enumeration value="BilledOfficeIndicatorCode"/>
+ <xsd:enumeration value="BillingAdviceCode"/>
+ <xsd:enumeration value="BillingStatusCode"/>
+ <xsd:enumeration value="BillOfLadingClauses"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyPartLookup"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyResponsibilityLookup"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyShipLookup"/>
+ <xsd:enumeration value="BusinessAccountNumber"/>
+ <xsd:enumeration value="BusinessChangeCode"/>
+ <xsd:enumeration value="BusinessClassification"/>
+ <xsd:enumeration value="BusinessCreditRating"/>
+ <xsd:enumeration value="BusinessEntityFilingDetailCode"/>
+ <xsd:enumeration value="BusinessEntityFilingLocationCode"/>
+ <xsd:enumeration value="BusinessEntityFilingReportTypeCode"/>
+ <xsd:enumeration value="BusinessEntityFilingSecuritiesInformationCode"/>
+ <xsd:enumeration value="BusinessEntityFilingStatusCode"/>
+ <xsd:enumeration value="BusinessEntityFinancialInformationCode"/>
+ <xsd:enumeration value="BusinessEntityStatusCode"/>
+ <xsd:enumeration value="BusinessFunction"/>
+ <xsd:enumeration value="BusinessLegalStructureType"/>
+ <xsd:enumeration value="BusinessSizeCode"/>
+ <xsd:enumeration value="BusinessType"/>
+ <xsd:enumeration value="CallSignDirectory"/>
+ <xsd:enumeration value="CanadianInterEdi"/>
+ <xsd:enumeration value="CancellationReason"/>
+ <xsd:enumeration value="Carriers"/>
+ <xsd:enumeration value="CaseDesignatorNumber"/>
+ <xsd:enumeration value="CaseOriginCode"/>
+ <xsd:enumeration value="CashDiscountStipulationCode"/>
+ <xsd:enumeration value="CauseLookup"/>
+ <xsd:enumeration value="CauseOfInjuryCode"/>
+ <xsd:enumeration value="CauseOfLossCode"/>
+ <xsd:enumeration value="CeilingTypeCode"/>
+ <xsd:enumeration value="CertificationRequirementsCode"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="CitizenIdentification"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="CitySubdivision"/>
+ <xsd:enumeration value="ClaimPaymentRemarkCodes"/>
+ <xsd:enumeration value="ClaimType"/>
+ <xsd:enumeration value="ClassOfOperation"/>
+ <xsd:enumeration value="ClassOfPitch"/>
+ <xsd:enumeration value="ClauseStatusType"/>
+ <xsd:enumeration value="ClearingCode"/>
+ <xsd:enumeration value="ClearingHouseAutomatedPayment"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemParticipantsId"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemUniversalId"/>
+ <xsd:enumeration value="CoastDesignationCode"/>
+ <xsd:enumeration value="CognizanceSymbol"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-Inspection"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-LossCategory"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-PointsOfImpact"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-Profile"/>
+ <xsd:enumeration value="Combiterms1990"/>
+ <xsd:enumeration value="CommercialAndGovernmentEntity"/>
+ <xsd:enumeration value="CommercialDriversLicense"/>
+ <xsd:enumeration value="CommercialVehicleOperationsCommodityCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsHazardousMaterialCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsInsurance"/>
+ <xsd:enumeration value="CommercialVehicleOperationsSafetyCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsStatusCode"/>
+ <xsd:enumeration value="CommercialVehicleRegistration"/>
+ <xsd:enumeration value="CommercialVehicleTax"/>
+ <xsd:enumeration value="CommercialVehicleTitle"/>
+ <xsd:enumeration value="CommercialVehicleType"/>
+ <xsd:enumeration value="Commodity"/>
+ <xsd:enumeration value="CommunicationsRoutingIdentifierCode"/>
+ <xsd:enumeration value="CompensationTypeCodes"/>
+ <xsd:enumeration value="CompetitiveCharacteristicsCode"/>
+ <xsd:enumeration value="ComplaintRequestCode"/>
+ <xsd:enumeration value="ComplianceReviewCode"/>
+ <xsd:enumeration value="ConclusionEvaluationCode"/>
+ <xsd:enumeration value="Condition"/>
+ <xsd:enumeration value="ConditionDetail"/>
+ <xsd:enumeration value="ConsigneesPremises"/>
+ <xsd:enumeration value="ConsignorsPremises"/>
+ <xsd:enumeration value="ConsolidationAndContainerizationPointCode"/>
+ <xsd:enumeration value="ConsolidationDetail"/>
+ <xsd:enumeration value="ConstructionMaterial"/>
+ <xsd:enumeration value="ContactorAlertListReason"/>
+ <xsd:enumeration value="ContactStatusCode"/>
+ <xsd:enumeration value="ContainerAndRoll-OnOrRoll-OffNumberCode"/>
+ <xsd:enumeration value="ContainerTerminal"/>
+ <xsd:enumeration value="ContentIndicatorCode"/>
+ <xsd:enumeration value="Continent"/>
+ <xsd:enumeration value="Contract"/>
+ <xsd:enumeration value="ContractClose-OutGroupCode"/>
+ <xsd:enumeration value="ContractDeliveryDateRevisionAgentCode"/>
+ <xsd:enumeration value="ContractFundReportingTransactionCode"/>
+ <xsd:enumeration value="ContractorAlertListStatus"/>
+ <xsd:enumeration value="ContractorReviewListStatus"/>
+ <xsd:enumeration value="ContractPaymentDeductionOrCollectionCode"/>
+ <xsd:enumeration value="ContractPaymentLineItemStatusCode"/>
+ <xsd:enumeration value="ContractShipmentAdviceCode"/>
+ <xsd:enumeration value="ControlledInventoryItemCode"/>
+ <xsd:enumeration value="ControlUnitDesignCode"/>
+ <xsd:enumeration value="ControvertCode"/>
+ <xsd:enumeration value="ConvictionOffenseType"/>
+ <xsd:enumeration value="CooperativeLogisticsProgramSupportCode"/>
+ <xsd:enumeration value="CorporateFinancialFilingCriteria"/>
+ <xsd:enumeration value="CorporateStatementFilingCode"/>
+ <xsd:enumeration value="CorrectionOrChangeForStorageItemRecordsCode"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CountryAndActivityCode"/>
+ <xsd:enumeration value="CountryCode-FinanceAndAcquisition"/>
+ <xsd:enumeration value="CountrySub-Entity"/>
+ <xsd:enumeration value="County"/>
+ <xsd:enumeration value="CountyDesignatorCode"/>
+ <xsd:enumeration value="CouponAdjustmentReasonCode"/>
+ <xsd:enumeration value="CourtAppearanceTypeCode"/>
+ <xsd:enumeration value="CourtCaseStatusCode"/>
+ <xsd:enumeration value="CourtDispositionCode"/>
+ <xsd:enumeration value="CourtDocumentTypeCode"/>
+ <xsd:enumeration value="CourtIssuedWarrantTypeCode"/>
+ <xsd:enumeration value="CourtOfLawEventType"/>
+ <xsd:enumeration value="CourtOfLawType"/>
+ <xsd:enumeration value="CourtPartyStatus"/>
+ <xsd:enumeration value="CourtPleadingTypeCode"/>
+ <xsd:enumeration value="CoverageCodeList"/>
+ <xsd:enumeration value="CoverageModifier"/>
+ <xsd:enumeration value="Cpa-CanadianPaymentsAssociation"/>
+ <xsd:enumeration value="CriminalCharge"/>
+ <xsd:enumeration value="CriminalChargeGrade"/>
+ <xsd:enumeration value="CriticalityDesignatorCode"/>
+ <xsd:enumeration value="CuisineTypeCode"/>
+ <xsd:enumeration value="CurrentAssetDetails"/>
+ <xsd:enumeration value="CurrentDentalTerminologyCode"/>
+ <xsd:enumeration value="CurrentLiabilityDetails"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCodes"/>
+ <xsd:enumeration value="CustomerMaintenanceLevelLookup"/>
+ <xsd:enumeration value="CustomerWithinCountryCode"/>
+ <xsd:enumeration value="CustomizedNoticeTypeCode"/>
+ <xsd:enumeration value="CustomsAreaOfTransaction"/>
+ <xsd:enumeration value="CustomsDeclarationType"/>
+ <xsd:enumeration value="CustomsDomesticPortLocationCodes-USScheduleD"/>
+ <xsd:enumeration value="CustomsForeignPortLocationCodes-USScheduleK"/>
+ <xsd:enumeration value="CustomsIndicator"/>
+ <xsd:enumeration value="CustomsInspectionType"/>
+ <xsd:enumeration value="CustomsOffice"/>
+ <xsd:enumeration value="CustomsPreference"/>
+ <xsd:enumeration value="CustomsProcedure"/>
+ <xsd:enumeration value="CustomsReleaseNotification"/>
+ <xsd:enumeration value="CustomsSimplifiedProcedure"/>
+ <xsd:enumeration value="CustomsSpecialCodes"/>
+ <xsd:enumeration value="CustomsStatusOfGoods"/>
+ <xsd:enumeration value="CustomsTransitGuarantee"/>
+ <xsd:enumeration value="CustomsTransitType"/>
+ <xsd:enumeration value="CustomsValuationMethod"/>
+ <xsd:enumeration value="CustomsWarehouse"/>
+ <xsd:enumeration value="DangerousGoodsPackingType"/>
+ <xsd:enumeration value="DataCategory"/>
+ <xsd:enumeration value="DateShippedOrReceivedCode"/>
+ <xsd:enumeration value="DebtorBusinessTypeCode"/>
+ <xsd:enumeration value="DebtorTypeCode"/>
+ <xsd:enumeration value="DefendantPleaTypeCode"/>
+ <xsd:enumeration value="DefensePrioritiesAndAllocationsSystemCode"/>
+ <xsd:enumeration value="DeferralLookup"/>
+ <xsd:enumeration value="DeficiencyCause"/>
+ <xsd:enumeration value="DeficiencyIndicator"/>
+ <xsd:enumeration value="DelinquencyIndicator"/>
+ <xsd:enumeration value="DeliverySourceCode"/>
+ <xsd:enumeration value="DeliveryTermCode"/>
+ <xsd:enumeration value="DemandCode"/>
+ <xsd:enumeration value="DemilitarizationCode"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DeviceAvailabilityCode"/>
+ <xsd:enumeration value="DeviceEvaluationCode"/>
+ <xsd:enumeration value="DeviceEventProblemCode"/>
+ <xsd:enumeration value="DeviceOperatorTypeCode"/>
+ <xsd:enumeration value="DeviceStatusCode"/>
+ <xsd:enumeration value="DeviceUsageCode"/>
+ <xsd:enumeration value="Diagnosis"/>
+ <xsd:enumeration value="DiagnosisEncounteredDuringExaminationAndInvestigationOfIndividualsAndPopulationsCode"/>
+ <xsd:enumeration value="DiagnosisRelatedGroup"/>
+ <xsd:enumeration value="DiagnosticAndStatisticalManualOfMentalDisorders"/>
+ <xsd:enumeration value="DirectNumericalControlSystemCode"/>
+ <xsd:enumeration value="DisbursementStatusCode"/>
+ <xsd:enumeration value="Discrepancy"/>
+ <xsd:enumeration value="DiscrepancyAdviceCode"/>
+ <xsd:enumeration value="DiscrepancyCode"/>
+ <xsd:enumeration value="DiscrepancyIndicatorCode"/>
+ <xsd:enumeration value="DiscrepancyStatusOrDispositionCode"/>
+ <xsd:enumeration value="DisposalAuthorityCode"/>
+ <xsd:enumeration value="DisposalConditionCode"/>
+ <xsd:enumeration value="DistributionCode"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="DocumentRequestedByCustoms"/>
+ <xsd:enumeration value="Dodaac-DepartmentOfDefenseActivityAddressCode"/>
+ <xsd:enumeration value="DomesticLineOfBusinessCode"/>
+ <xsd:enumeration value="DoseFormCode"/>
+ <xsd:enumeration value="DriverParameters"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalBasis"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalDueProcessStatus"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalExtent"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalReason"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalType"/>
+ <xsd:enumeration value="DrugDetailCode"/>
+ <xsd:enumeration value="DrugStatusAdverseEventCode"/>
+ <xsd:enumeration value="DrugStatusCode"/>
+ <xsd:enumeration value="DumpingOrCountervailingAssessmentMethod"/>
+ <xsd:enumeration value="DumpingSpecification"/>
+ <xsd:enumeration value="DunAndBradstreetCanadas8DigitStandardIndustrialClassificationCode"/>
+ <xsd:enumeration value="Duns-DunAndBradstreetPlus4"/>
+ <xsd:enumeration value="DunsStandardIndustrialClassification2Plus2DunAndBradstreet"/>
+ <xsd:enumeration value="DutyTaxOrFeePaymentMethod"/>
+ <xsd:enumeration value="DynamicGeneratorSetCode"/>
+ <xsd:enumeration value="DynamicLocomotiveTagCode"/>
+ <xsd:enumeration value="Edira-Id-EdiRegistrationAuthorityIdentification"/>
+ <xsd:enumeration value="EditErrorCode"/>
+ <xsd:enumeration value="EducationalInstitutionType"/>
+ <xsd:enumeration value="EducationalStudyArea"/>
+ <xsd:enumeration value="ElectromagneticTransmitterIdentification"/>
+ <xsd:enumeration value="EmployeeIdentification"/>
+ <xsd:enumeration value="EnhancedPartyIdentification"/>
+ <xsd:enumeration value="Entitlement"/>
+ <xsd:enumeration value="EntityRelationship"/>
+ <xsd:enumeration value="EquipmentStatusLookup"/>
+ <xsd:enumeration value="ErrorClassificationCode"/>
+ <xsd:enumeration value="EssentialityCode"/>
+ <xsd:enumeration value="EstimatedTimeOfArrivalCode"/>
+ <xsd:enumeration value="EstimateTypeLookup"/>
+ <xsd:enumeration value="EstimatingMethodStatusCode"/>
+ <xsd:enumeration value="Ethnicity"/>
+ <xsd:enumeration value="EvaluateWorkCandidateLookup"/>
+ <xsd:enumeration value="EvaluateWorkCandidateReasonLookup"/>
+ <xsd:enumeration value="EventAbatementCode"/>
+ <xsd:enumeration value="EventCodes"/>
+ <xsd:enumeration value="EventOrExposureCode"/>
+ <xsd:enumeration value="EventReappearanceCode"/>
+ <xsd:enumeration value="ExaminationFacility"/>
+ <xsd:enumeration value="ExcavationInformationCodeList"/>
+ <xsd:enumeration value="ExcessMaterialDispositionCode"/>
+ <xsd:enumeration value="ExciseDuty"/>
+ <xsd:enumeration value="ExportCommodityClassification-USScheduleB"/>
+ <xsd:enumeration value="ExportRequirements"/>
+ <xsd:enumeration value="ExtensionReason"/>
+ <xsd:enumeration value="EyeColorCode"/>
+ <xsd:enumeration value="FacilityIdentification"/>
+ <xsd:enumeration value="FacilitySecurityClearance"/>
+ <xsd:enumeration value="FailureToAwardReason"/>
+ <xsd:enumeration value="FannieMaeAdjustableRateMortgagePlanCodes"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-MortgageInsuranceCode"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-PoolFeatureCode"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-RemittancePrograms"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-SpecialFeatureCode"/>
+ <xsd:enumeration value="FannieMaeRefinancePlanCode"/>
+ <xsd:enumeration value="FederalFinanceCodeList1"/>
+ <xsd:enumeration value="FederalHealthCareCodeList1"/>
+ <xsd:enumeration value="FederalLogisticsCodeList1"/>
+ <xsd:enumeration value="FederalProcurementCodeList1"/>
+ <xsd:enumeration value="FederalTransportationCodeList1"/>
+ <xsd:enumeration value="FinancialAnalysisCategories"/>
+ <xsd:enumeration value="FinancialInformationType"/>
+ <xsd:enumeration value="FinancialItemAllocation"/>
+ <xsd:enumeration value="FinancialItemAttributedCode"/>
+ <xsd:enumeration value="FinancialItemReclassification"/>
+ <xsd:enumeration value="FinancialManagementServiceCash-LinkCode"/>
+ <xsd:enumeration value="FinancialRating"/>
+ <xsd:enumeration value="FinancialRegime"/>
+ <xsd:enumeration value="FinancialRouting"/>
+ <xsd:enumeration value="FinancialStatementFormat"/>
+ <xsd:enumeration value="FleetParameters"/>
+ <xsd:enumeration value="FlowOfTheGoods"/>
+ <xsd:enumeration value="Follow-UpCode"/>
+ <xsd:enumeration value="ForecastType"/>
+ <xsd:enumeration value="ForeignLineOfBusinessCode"/>
+ <xsd:enumeration value="ForeignMilitarySalesCountryCode"/>
+ <xsd:enumeration value="FormTypeCode"/>
+ <xsd:enumeration value="ForwardingRestrictions"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-MortgageInsuranceCode"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-RemittancePrograms"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-SpecialCharacterCode"/>
+ <xsd:enumeration value="FreddieMacRefinancePlanCode"/>
+ <xsd:enumeration value="FreeOnBoardSiteCode"/>
+ <xsd:enumeration value="FreeZone"/>
+ <xsd:enumeration value="FreightForwarder"/>
+ <xsd:enumeration value="Frequency"/>
+ <xsd:enumeration value="FrequencyBand"/>
+ <xsd:enumeration value="FunctionalArea"/>
+ <xsd:enumeration value="FunctionalGroup"/>
+ <xsd:enumeration value="FundCode"/>
+ <xsd:enumeration value="FundPurpose"/>
+ <xsd:enumeration value="GainOrLossIndicatorCode"/>
+ <xsd:enumeration value="Gate"/>
+ <xsd:enumeration value="GeneralServicesAdministrationCustomerSupplyCenterNumberCode"/>
+ <xsd:enumeration value="GeneralTerritoryType"/>
+ <xsd:enumeration value="GeneratorSetMountingCode"/>
+ <xsd:enumeration value="GeographicLocation"/>
+ <xsd:enumeration value="GlassActionCode"/>
+ <xsd:enumeration value="GoodsDescription"/>
+ <xsd:enumeration value="GovernmentAgencyProcedure"/>
+ <xsd:enumeration value="GradeOfDifficulty"/>
+ <xsd:enumeration value="GroupQualifierCode"/>
+ <xsd:enumeration value="HairColorCode"/>
+ <xsd:enumeration value="HandlingAction"/>
+ <xsd:enumeration value="HarmonizedSystem"/>
+ <xsd:enumeration value="HazardousMaterialCode"/>
+ <xsd:enumeration value="HazardousMaterialsCredential"/>
+ <xsd:enumeration value="HazardousResponseCodes"/>
+ <xsd:enumeration value="HealthCareClaimStatusCode"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationCommonProceduralCodingSystem"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationCommonProceduralCodingSystemPrincipalProcedure"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationDurableMedicalEquipmentRegionalCarrierCertificateOfMedicalNecessityForms"/>
+ <xsd:enumeration value="HealthcareProviderCharacteristicsAndResources"/>
+ <xsd:enumeration value="HealthcareProviderTaxonomy"/>
+ <xsd:enumeration value="HealthIndustryNumber"/>
+ <xsd:enumeration value="HealthIndustryOrganizationIdentification"/>
+ <xsd:enumeration value="Hobby"/>
+ <xsd:enumeration value="Icd10"/>
+ <xsd:enumeration value="IdentificationCode"/>
+ <xsd:enumeration value="IdentifyingCharacteristics"/>
+ <xsd:enumeration value="IdentityDisclosureCode"/>
+ <xsd:enumeration value="ImmunizationInjectionCode"/>
+ <xsd:enumeration value="ImpactAxisOrAnalogPortCode"/>
+ <xsd:enumeration value="ImpactRecorderCode"/>
+ <xsd:enumeration value="IncidentConditionCode"/>
+ <xsd:enumeration value="IncidentConsequenceCode"/>
+ <xsd:enumeration value="IncidentLocationCode"/>
+ <xsd:enumeration value="IncidentRelatedActionCode"/>
+ <xsd:enumeration value="Incoterms1980"/>
+ <xsd:enumeration value="IndicatorCode"/>
+ <xsd:enumeration value="IndividualInsuranceFinancialDetail"/>
+ <xsd:enumeration value="IndividualParticipationInCompany"/>
+ <xsd:enumeration value="IndividualSecurityClearance"/>
+ <xsd:enumeration value="IndustryRating"/>
+ <xsd:enumeration value="InformationIndicatorCode"/>
+ <xsd:enumeration value="InformationRequestResult"/>
+ <xsd:enumeration value="InformationRequestType"/>
+ <xsd:enumeration value="InformationType"/>
+ <xsd:enumeration value="InitialTreatmentCode"/>
+ <xsd:enumeration value="InquirySelection"/>
+ <xsd:enumeration value="InspectionParameters"/>
+ <xsd:enumeration value="InsuranceCoverageDetail"/>
+ <xsd:enumeration value="InsuranceInformationIndicator"/>
+ <xsd:enumeration value="InsurancePlanDescriptionCharacteristics"/>
+ <xsd:enumeration value="IntermediateContainerCode"/>
+ <xsd:enumeration value="IntermediateContainerQuantityCode"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModificationProcedure"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModificationPrincipalProcedure"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModification-Icd-9-CmCode"/>
+ <xsd:enumeration value="InternationalStandardDesignationSystemForTeethAndAreasOfTheOralCavity"/>
+ <xsd:enumeration value="InventoryCategoryCode"/>
+ <xsd:enumeration value="InventoryTypeCode"/>
+ <xsd:enumeration value="InvestigationStatusCode"/>
+ <xsd:enumeration value="InvestmentFundType"/>
+ <xsd:enumeration value="InvestmentType"/>
+ <xsd:enumeration value="IrsQualificationCode"/>
+ <xsd:enumeration value="ItemManagementCode"/>
+ <xsd:enumeration value="ItemSourcingCategory"/>
+ <xsd:enumeration value="ItemType"/>
+ <xsd:enumeration value="JobCharacteristicsLookup"/>
+ <xsd:enumeration value="JobOriginatorLookup"/>
+ <xsd:enumeration value="JointLifeInsuranceIndicator"/>
+ <xsd:enumeration value="JudicialHearingTypeCode"/>
+ <xsd:enumeration value="JudicialOrderTypeCode"/>
+ <xsd:enumeration value="JudicialSentenceTypeCode"/>
+ <xsd:enumeration value="JurisdictionType"/>
+ <xsd:enumeration value="KeyEventLookup"/>
+ <xsd:enumeration value="KindOfContractCode"/>
+ <xsd:enumeration value="KindOfModificationCode"/>
+ <xsd:enumeration value="LaboratoryResultsIdentificationCode"/>
+ <xsd:enumeration value="LaboratoryTestConditionCode"/>
+ <xsd:enumeration value="LegalCaseType"/>
+ <xsd:enumeration value="LegalEvent"/>
+ <xsd:enumeration value="LegalStructureCode"/>
+ <xsd:enumeration value="LetterOfRecommendationRatingCategory"/>
+ <xsd:enumeration value="LiabilityDetails"/>
+ <xsd:enumeration value="LiabilityType"/>
+ <xsd:enumeration value="LifeOrAnnuityProductCode"/>
+ <xsd:enumeration value="LifeOrAnnuityServiceFeatures"/>
+ <xsd:enumeration value="LifeOrAnnuityStatusCodes"/>
+ <xsd:enumeration value="LifeReinsuranceMessageType"/>
+ <xsd:enumeration value="LineItemConditionCode"/>
+ <xsd:enumeration value="LineOfAuthority"/>
+ <xsd:enumeration value="LineOfBusinessCode"/>
+ <xsd:enumeration value="LoanType"/>
+ <xsd:enumeration value="LocaleOfActivity"/>
+ <xsd:enumeration value="LocalSourceCode"/>
+ <xsd:enumeration value="LocationCode"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationsForTariffCalculations"/>
+ <xsd:enumeration value="LogicalObservationIdentifierNamesAndCodesCodes"/>
+ <xsd:enumeration value="LogisticsCodeList"/>
+ <xsd:enumeration value="LossDescriptionCode"/>
+ <xsd:enumeration value="LossSeverityCode"/>
+ <xsd:enumeration value="LotTypeCode"/>
+ <xsd:enumeration value="MajorForceProgramCode"/>
+ <xsd:enumeration value="ManagementCode"/>
+ <xsd:enumeration value="ManagementIndicatorCode-Petroleum"/>
+ <xsd:enumeration value="ManualClassCode"/>
+ <xsd:enumeration value="MarineBerth"/>
+ <xsd:enumeration value="MarineWharf"/>
+ <xsd:enumeration value="MarketPlaceOrganizationID"/>
+ <xsd:enumeration value="MarketPlaceTradingPartnerID"/>
+ <xsd:enumeration value="MaterialControlCode"/>
+ <xsd:enumeration value="Materials"/>
+ <xsd:enumeration value="MeansOfCommunicationsIdentifier"/>
+ <xsd:enumeration value="MeansOfTransportIdentification"/>
+ <xsd:enumeration value="MechanizationOfContractAdministrationServicesSystemErrorCode"/>
+ <xsd:enumeration value="MediaAndStatusCode"/>
+ <xsd:enumeration value="MedicaidProvider"/>
+ <xsd:enumeration value="MedicalBenefitsSchedule"/>
+ <xsd:enumeration value="MedicareProvider"/>
+ <xsd:enumeration value="MediumOfTransmissionCode"/>
+ <xsd:enumeration value="MemberOrganizations"/>
+ <xsd:enumeration value="MethodEvaluationCode"/>
+ <xsd:enumeration value="MethodsOfPayment"/>
+ <xsd:enumeration value="MilitaryAndCivilianGradeCode"/>
+ <xsd:enumeration value="MilitaryAssistanceProgramAddressCode"/>
+ <xsd:enumeration value="MinorityIndicator"/>
+ <xsd:enumeration value="MissionImpactStatementCode"/>
+ <xsd:enumeration value="MonetaryFunctionDetail"/>
+ <xsd:enumeration value="MortgageIndexSourceCode"/>
+ <xsd:enumeration value="Multi-MediaObject"/>
+ <xsd:enumeration value="Nacha-NationalAutomatedClearingHouseAssociation"/>
+ <xsd:enumeration value="NationalCouncilForPrescriptionDrugProgramsRejectOrPaymentCodes"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsuranceNatureOfInjuryCode"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsurancePartOfBodyCode"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsuranceSourceOfInjuryCode"/>
+ <xsd:enumeration value="NationalDrugCode"/>
+ <xsd:enumeration value="NationalMotorFreightClassificationCode"/>
+ <xsd:enumeration value="NationalStandardToothNumberingSystem"/>
+ <xsd:enumeration value="NatureOfBuy"/>
+ <xsd:enumeration value="NatureOfDebtCode"/>
+ <xsd:enumeration value="NatureOfEventCode"/>
+ <xsd:enumeration value="NatureOfInjuryCode"/>
+ <xsd:enumeration value="NatureOfSuit"/>
+ <xsd:enumeration value="NatureOfSuitCode"/>
+ <xsd:enumeration value="NatureOfTransaction"/>
+ <xsd:enumeration value="NoLongerConsideredForAwardReason"/>
+ <xsd:enumeration value="NomenclatureActivityClassificationEconomyCode"/>
+ <xsd:enumeration value="Non-PostalTown"/>
+ <xsd:enumeration value="NormeActiviteFrancaiseCode"/>
+ <xsd:enumeration value="NoticeType"/>
+ <xsd:enumeration value="NotificationIndicatorCode"/>
+ <xsd:enumeration value="ObligationVarianceCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationNatureOfInjuryCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationPartOfBodyCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationSourceOfInjuryCode"/>
+ <xsd:enumeration value="OccupationClassification"/>
+ <xsd:enumeration value="OccupationCode"/>
+ <xsd:enumeration value="Occurrence"/>
+ <xsd:enumeration value="OccurrenceSpan"/>
+ <xsd:enumeration value="OceanCarrierCode"/>
+ <xsd:enumeration value="OfferAndReleaseOptionCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsNatureOfInjuryCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsOccupationCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsPartOfBodyCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsSourceOfInjuryCode"/>
+ <xsd:enumeration value="OperatingStatus"/>
+ <xsd:enumeration value="OperationType"/>
+ <xsd:enumeration value="OversizeOrOverweightCredential"/>
+ <xsd:enumeration value="OwnershipCode"/>
+ <xsd:enumeration value="OwnershipRights"/>
+ <xsd:enumeration value="PackageFailureCode"/>
+ <xsd:enumeration value="PackingAndOrUnpackingFacility"/>
+ <xsd:enumeration value="PackingRequirementLevelACode"/>
+ <xsd:enumeration value="PackingRequirementLevelBCode"/>
+ <xsd:enumeration value="PackingRequirementLevelCCode"/>
+ <xsd:enumeration value="PartOfBodyAffected"/>
+ <xsd:enumeration value="PartOfBodyCode"/>
+ <xsd:enumeration value="PartyIdentification"/>
+ <xsd:enumeration value="PassportNumber"/>
+ <xsd:enumeration value="PatientEventProblemCode"/>
+ <xsd:enumeration value="PaymentBehaviourRating"/>
+ <xsd:enumeration value="PaymentTypeCode"/>
+ <xsd:enumeration value="PedestrianCode"/>
+ <xsd:enumeration value="PersonalPropertyAndContentsCode"/>
+ <xsd:enumeration value="PetroleumBillType"/>
+ <xsd:enumeration value="PetroleumLandCategory"/>
+ <xsd:enumeration value="PetroleumLeaseStatus"/>
+ <xsd:enumeration value="PetroleumProductDisposition"/>
+ <xsd:enumeration value="PetroleumProductPoint-Of-Sale"/>
+ <xsd:enumeration value="PetroleumProductSellingArrangement"/>
+ <xsd:enumeration value="PetroleumProductValueAdjustment"/>
+ <xsd:enumeration value="PetroleumRegulatoryReport"/>
+ <xsd:enumeration value="PetroleumRoyaltyAdjustment"/>
+ <xsd:enumeration value="PetroleumRoyaltyCalculationMethod"/>
+ <xsd:enumeration value="PetroleumRoyaltyTransaction"/>
+ <xsd:enumeration value="PetroleumUnitedStatesGeologicalSurveyFormationCode"/>
+ <xsd:enumeration value="PetroleumWellAction"/>
+ <xsd:enumeration value="PetroleumWellClassificationStatus"/>
+ <xsd:enumeration value="PetroleumWellInformation"/>
+ <xsd:enumeration value="PetroleumWellShut-InReason"/>
+ <xsd:enumeration value="PetroleumWellTestInformation"/>
+ <xsd:enumeration value="PhysicalCharacteristicsCode"/>
+ <xsd:enumeration value="PlantClearanceOfficeCode"/>
+ <xsd:enumeration value="PlusOrMinusIndicatorCode"/>
+ <xsd:enumeration value="PolicyOnClaimIndicator"/>
+ <xsd:enumeration value="PolicyReserveValuationType"/>
+ <xsd:enumeration value="PolicyType"/>
+ <xsd:enumeration value="Port"/>
+ <xsd:enumeration value="PortalID"/>
+ <xsd:enumeration value="PostalDistrict"/>
+ <xsd:enumeration value="PostalServiceCarrierRoute"/>
+ <xsd:enumeration value="PostcodeDirectory"/>
+ <xsd:enumeration value="PostMarketStudyStatusCode"/>
+ <xsd:enumeration value="PreciousMetalsIndicatorCode"/>
+ <xsd:enumeration value="PreservationDataCode"/>
+ <xsd:enumeration value="PreservationMaterialCode"/>
+ <xsd:enumeration value="PreventiveMeasure"/>
+ <xsd:enumeration value="PrimaryDiagnosis"/>
+ <xsd:enumeration value="PrincipalDiagnosis"/>
+ <xsd:enumeration value="PrincipalPartyCitizenshipCode"/>
+ <xsd:enumeration value="PriorityDesignatorCode"/>
+ <xsd:enumeration value="PriorityLookup"/>
+ <xsd:enumeration value="ProducerFinancialHistoryCodes"/>
+ <xsd:enumeration value="ProductCode"/>
+ <xsd:enumeration value="ProductQualityDeficiencyReportSummaryCode"/>
+ <xsd:enumeration value="ProductSupplyCondition"/>
+ <xsd:enumeration value="ProfessionalDesignation"/>
+ <xsd:enumeration value="ProfessionalStatusCode"/>
+ <xsd:enumeration value="ProfessionTypeCode"/>
+ <xsd:enumeration value="ProgramOriginatorCode"/>
+ <xsd:enumeration value="ProgramYearCode"/>
+ <xsd:enumeration value="ProjectCode"/>
+ <xsd:enumeration value="ProjectionType"/>
+ <xsd:enumeration value="PropertyOwnershipExtent"/>
+ <xsd:enumeration value="PropertyOwnershipTypeCode"/>
+ <xsd:enumeration value="PropertyRecordStatusCode"/>
+ <xsd:enumeration value="PropertySourceCode"/>
+ <xsd:enumeration value="PropertyType"/>
+ <xsd:enumeration value="PropertyUnderwritingConditionCode"/>
+ <xsd:enumeration value="Proprietary"/>
+ <xsd:enumeration value="PurchasingContractOfficerInstructionsCode"/>
+ <xsd:enumeration value="PurposeCode"/>
+ <xsd:enumeration value="QualityAlertListReason"/>
+ <xsd:enumeration value="QualityAssuranceSiteCode"/>
+ <xsd:enumeration value="QualityConformance"/>
+ <xsd:enumeration value="QualityControlCode"/>
+ <xsd:enumeration value="QuantityPerUnitPackCode"/>
+ <xsd:enumeration value="QueryOptions"/>
+ <xsd:enumeration value="QueryStatus"/>
+ <xsd:enumeration value="RadioFrequencyType"/>
+ <xsd:enumeration value="RadioServiceType"/>
+ <xsd:enumeration value="RadioSystemType"/>
+ <xsd:enumeration value="RailAdditionalCharges"/>
+ <xsd:enumeration value="RailcarLetterMarking"/>
+ <xsd:enumeration value="RailDocumentNames"/>
+ <xsd:enumeration value="RailHandlingRestrictionsAndInstructions"/>
+ <xsd:enumeration value="RailHarmonizedCodificationOfTariffs"/>
+ <xsd:enumeration value="RailHarmonizedEquipmentType"/>
+ <xsd:enumeration value="RailRoutes"/>
+ <xsd:enumeration value="RailUnifiedNomenclatureOfGoods"/>
+ <xsd:enumeration value="RailwayCompanyNetwork"/>
+ <xsd:enumeration value="RailwayCustomer"/>
+ <xsd:enumeration value="RailwayFrontierAndTransitPoint"/>
+ <xsd:enumeration value="RailwayLocations"/>
+ <xsd:enumeration value="RailwayServicesHarmonizedCode"/>
+ <xsd:enumeration value="RateClass"/>
+ <xsd:enumeration value="RatingSummaryValue"/>
+ <xsd:enumeration value="RealEstateAssetType"/>
+ <xsd:enumeration value="ReasonForContractDeliveryDateRevisionCode"/>
+ <xsd:enumeration value="ReasonForDelayedClosingOfContractFileCode"/>
+ <xsd:enumeration value="ReasonForDisposalCode"/>
+ <xsd:enumeration value="ReasonForFinancialItemDetailChange"/>
+ <xsd:enumeration value="ReasonForPublicRecordFiling"/>
+ <xsd:enumeration value="ReasonForRequisitioningCode"/>
+ <xsd:enumeration value="RecipientOfBillingStatusCode"/>
+ <xsd:enumeration value="RecommendationsRegardingDelayedDeliveriesCode"/>
+ <xsd:enumeration value="RecordControlNumber"/>
+ <xsd:enumeration value="RecordPrecedenceBasedOnItsCurrencyInTime"/>
+ <xsd:enumeration value="ReferenceAndStationCode"/>
+ <xsd:enumeration value="RefrigerationUnitOperatingModeCode"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegisteredContractorActivityCode"/>
+ <xsd:enumeration value="RegistrationType"/>
+ <xsd:enumeration value="ReinsuranceMonetaryType"/>
+ <xsd:enumeration value="ReinsurancePolicyAttributes"/>
+ <xsd:enumeration value="RejectAdviceCode"/>
+ <xsd:enumeration value="RejectIndicatorCode"/>
+ <xsd:enumeration value="RelatedDeviceApplicabilityCode"/>
+ <xsd:enumeration value="ReligiousAffiliationCode"/>
+ <xsd:enumeration value="RemedialActionCode"/>
+ <xsd:enumeration value="RemovableAccessoriesAndSpecialEquipmentOnRailcars"/>
+ <xsd:enumeration value="RentalCharge"/>
+ <xsd:enumeration value="RepairFacility"/>
+ <xsd:enumeration value="ReportableEventCode"/>
+ <xsd:enumeration value="ReportableEventStatusCode"/>
+ <xsd:enumeration value="ReportCode"/>
+ <xsd:enumeration value="ReportDistributionCode"/>
+ <xsd:enumeration value="ReportSourceCode"/>
+ <xsd:enumeration value="RepresentativeBuyIndicator"/>
+ <xsd:enumeration value="RequestCode"/>
+ <xsd:enumeration value="RequestType"/>
+ <xsd:enumeration value="RequirementCode"/>
+ <xsd:enumeration value="RequirementsIndicator"/>
+ <xsd:enumeration value="ResidencyIndicator"/>
+ <xsd:enumeration value="ResidentialAndCommercialRoomCode"/>
+ <xsd:enumeration value="ResponseStatusCode"/>
+ <xsd:enumeration value="RestrictionsAndProhibitionsPlacedOnTheRe-UseOf"/>
+ <xsd:enumeration value="ResultEvaluationCode"/>
+ <xsd:enumeration value="ReviewPeriodIndicatorCode"/>
+ <xsd:enumeration value="RiskClass"/>
+ <xsd:enumeration value="RoadCharacteristicCode"/>
+ <xsd:enumeration value="RoadwayDetail"/>
+ <xsd:enumeration value="RoadwayType"/>
+ <xsd:enumeration value="RouteCode"/>
+ <xsd:enumeration value="RunType"/>
+ <xsd:enumeration value="SafetyAndFitnessElectronicRecordSystemsErrorCode"/>
+ <xsd:enumeration value="SafetyAndFitnessElectronicRecordSystemsSubscriptionOption"/>
+ <xsd:enumeration value="SafetyHazardLookup"/>
+ <xsd:enumeration value="SafetyRegulation"/>
+ <xsd:enumeration value="SalesPriceConditionCode"/>
+ <xsd:enumeration value="SalvageDispositionCode"/>
+ <xsd:enumeration value="SampleExtractionLocation"/>
+ <xsd:enumeration value="SeavanOwnershipCode"/>
+ <xsd:enumeration value="SecondaryDiagnosis"/>
+ <xsd:enumeration value="SecondarySourceOfInjury"/>
+ <xsd:enumeration value="SecurityShareType"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="ServiceAndAgencyCode"/>
+ <xsd:enumeration value="ServiceContractActOccupationCategoryCode"/>
+ <xsd:enumeration value="ServiceContractActOccupationClassificationCode"/>
+ <xsd:enumeration value="ServiceContractActOperationCode"/>
+ <xsd:enumeration value="SettlementOrPayoutOptions"/>
+ <xsd:enumeration value="ShareTypeCode"/>
+ <xsd:enumeration value="ShelfLifeCode"/>
+ <xsd:enumeration value="ShipmentAcceptanceDiscrepancyExplanationCode"/>
+ <xsd:enumeration value="ShipmentDescription"/>
+ <xsd:enumeration value="ShipmentHoldCode"/>
+ <xsd:enumeration value="ShipmentReleaseCode"/>
+ <xsd:enumeration value="ShippingAgent"/>
+ <xsd:enumeration value="SignalCode"/>
+ <xsd:enumeration value="SingleStateRegistrationSystemAndOperatingAuthorityCredential"/>
+ <xsd:enumeration value="SingleUseLabelCode"/>
+ <xsd:enumeration value="SizeAndType"/>
+ <xsd:enumeration value="SkinToneCode"/>
+ <xsd:enumeration value="SmallArmsErrorTransactionRejectCode"/>
+ <xsd:enumeration value="SmallArmsTransactionCode"/>
+ <xsd:enumeration value="SocialSecurityIdentification"/>
+ <xsd:enumeration value="SolicitationCancellationReason"/>
+ <xsd:enumeration value="SolicitationMethod"/>
+ <xsd:enumeration value="SoundCode"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SourceMaintenanceAndRecoverabilityCode"/>
+ <xsd:enumeration value="SourceOfDepositCode"/>
+ <xsd:enumeration value="SourceOfDisclosure"/>
+ <xsd:enumeration value="SourceOfInjuryCode"/>
+ <xsd:enumeration value="SourceOfLeadCode"/>
+ <xsd:enumeration value="SourceOfLossCode"/>
+ <xsd:enumeration value="SpecialCategoryCode"/>
+ <xsd:enumeration value="SpecialContractProvisionCode"/>
+ <xsd:enumeration value="SpecialDating"/>
+ <xsd:enumeration value="SpecialHandling"/>
+ <xsd:enumeration value="SpecialMarketingTypeCode"/>
+ <xsd:enumeration value="SpecialMarkingCode"/>
+ <xsd:enumeration value="SpecialMaterialIdentificationCode"/>
+ <xsd:enumeration value="SpecialProgramRequirementStatusCode"/>
+ <xsd:enumeration value="SpecialReimbursableProvisionsCode"/>
+ <xsd:enumeration value="SpecialRequirementLookup"/>
+ <xsd:enumeration value="SpecialRequirementsCode"/>
+ <xsd:enumeration value="StandardIndustrialClassification"/>
+ <xsd:enumeration value="StandardOccupationClassificationCode"/>
+ <xsd:enumeration value="StandardTextAccordingUSEmbargoRegulations"/>
+ <xsd:enumeration value="StandardTextClauses"/>
+ <xsd:enumeration value="StandardTextForExportAccordingNationalPrescriptions"/>
+ <xsd:enumeration value="StateCode"/>
+ <xsd:enumeration value="StationClassification"/>
+ <xsd:enumeration value="StationClassificationType"/>
+ <xsd:enumeration value="StatisticalAdministrativeInformationCode"/>
+ <xsd:enumeration value="StatisticalNatureOfTransaction"/>
+ <xsd:enumeration value="StatisticalObject"/>
+ <xsd:enumeration value="StatisticalProcedures"/>
+ <xsd:enumeration value="StatisticBundesAmtCode"/>
+ <xsd:enumeration value="StatusCode"/>
+ <xsd:enumeration value="StockExchangeCode"/>
+ <xsd:enumeration value="StockExchangeDetail"/>
+ <xsd:enumeration value="StockFundOrNon-StockFundCode"/>
+ <xsd:enumeration value="StorageFacility"/>
+ <xsd:enumeration value="StudentActivityTypeCode"/>
+ <xsd:enumeration value="StudentAwardCode"/>
+ <xsd:enumeration value="SubcaseNumber"/>
+ <xsd:enumeration value="SubrogationActionCode"/>
+ <xsd:enumeration value="SubrogationPaymentOptions"/>
+ <xsd:enumeration value="SubrogationRequestCodes"/>
+ <xsd:enumeration value="SubrogationResponseCodes"/>
+ <xsd:enumeration value="SubsistenceTypeOfPackCode"/>
+ <xsd:enumeration value="SuffixCode"/>
+ <xsd:enumeration value="SuffixOrLimitCode"/>
+ <xsd:enumeration value="SummonsTypeCode"/>
+ <xsd:enumeration value="SupplementalData"/>
+ <xsd:enumeration value="SupplementaryAccountingClassificationCode"/>
+ <xsd:enumeration value="SuppliersStockTurnover"/>
+ <xsd:enumeration value="SupplyConditionCode"/>
+ <xsd:enumeration value="SurfaceDescriptorCode"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="SyntaxNotes"/>
+ <xsd:enumeration value="SystematizedNomenclatureOfHumanAndVeterinaryMedicine"/>
+ <xsd:enumeration value="SystemStatus"/>
+ <xsd:enumeration value="TariffSchedule"/>
+ <xsd:enumeration value="TaxAssessmentMethod"/>
+ <xsd:enumeration value="TaxOrFeeExemptionReasonCode"/>
+ <xsd:enumeration value="TaxPartyIdentification"/>
+ <xsd:enumeration value="TechnicalAssessmentChecklist"/>
+ <xsd:enumeration value="TelephoneDirectory"/>
+ <xsd:enumeration value="TemplateCharacteristicLookup"/>
+ <xsd:enumeration value="TemplateOwnerLookup"/>
+ <xsd:enumeration value="TemplateTypeLookup"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TermsOfDelivery"/>
+ <xsd:enumeration value="TertiaryDiagnosis"/>
+ <xsd:enumeration value="TestingDemographicCategoryCodeList"/>
+ <xsd:enumeration value="TestingServiceQuestionCodeList"/>
+ <xsd:enumeration value="TestingStatisticalCategoryCodeList"/>
+ <xsd:enumeration value="TestResultsCode"/>
+ <xsd:enumeration value="TitleDocumentCodeList"/>
+ <xsd:enumeration value="TitleExceptionAndRequirementCodeList"/>
+ <xsd:enumeration value="TradeCode"/>
+ <xsd:enumeration value="TrainIdentification"/>
+ <xsd:enumeration value="TransactionStatusIndicatorCode"/>
+ <xsd:enumeration value="TransportationBillCode"/>
+ <xsd:enumeration value="TransportationHoldingDelayCode"/>
+ <xsd:enumeration value="TransportationModeOrMethodCode"/>
+ <xsd:enumeration value="TransportationModeReasonCode"/>
+ <xsd:enumeration value="TransportationPriorityCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCodeAndBankServiceCode"/>
+ <xsd:enumeration value="TreasurySymbolCode"/>
+ <xsd:enumeration value="TreatmentCodes"/>
+ <xsd:enumeration value="TrendReason"/>
+ <xsd:enumeration value="TrialTypeCode"/>
+ <xsd:enumeration value="TypeAdjustmentCode"/>
+ <xsd:enumeration value="TypeAndCauseCode"/>
+ <xsd:enumeration value="TypeDue-InIndicator"/>
+ <xsd:enumeration value="TypeIdentityChangeCode"/>
+ <xsd:enumeration value="TypeInspectionCode"/>
+ <xsd:enumeration value="TypeNumericalControlSystemCode"/>
+ <xsd:enumeration value="TypeOfAssetsAndLiabilities"/>
+ <xsd:enumeration value="TypeOfAssistanceCode"/>
+ <xsd:enumeration value="TypeOfBillCode"/>
+ <xsd:enumeration value="TypeOfBusinessCode"/>
+ <xsd:enumeration value="TypeOfCargoCode"/>
+ <xsd:enumeration value="TypeOfContractCode"/>
+ <xsd:enumeration value="TypeOfContractorCode"/>
+ <xsd:enumeration value="TypeOfDelayCode"/>
+ <xsd:enumeration value="TypeOfFinancialAccount"/>
+ <xsd:enumeration value="TypeOfFirmCode"/>
+ <xsd:enumeration value="TypeOfIndustrialActivity"/>
+ <xsd:enumeration value="TypeOfInquiryCode"/>
+ <xsd:enumeration value="TypeOfInsured"/>
+ <xsd:enumeration value="TypeOfIssueCode"/>
+ <xsd:enumeration value="TypeOfLocationReconciliationRequest"/>
+ <xsd:enumeration value="TypeOfMediaCode"/>
+ <xsd:enumeration value="TypeOfPackage"/>
+ <xsd:enumeration value="TypeOfProcurement"/>
+ <xsd:enumeration value="TypeOfStorageCode"/>
+ <xsd:enumeration value="TypeOfSurveyQuestion"/>
+ <xsd:enumeration value="TypePackCode"/>
+ <xsd:enumeration value="TypePhysicalInventoryOrTransactionHistoryCode"/>
+ <xsd:enumeration value="UltimateRecipientCode"/>
+ <xsd:enumeration value="UnclaimedPropertyAdditionsDeletionsAndDeductionsCodes"/>
+ <xsd:enumeration value="UnclaimedPropertyTypeCode"/>
+ <xsd:enumeration value="UniformFreightClassificationCode"/>
+ <xsd:enumeration value="UniformResidentialAppraisalAttributesCode"/>
+ <xsd:enumeration value="UnitCode"/>
+ <xsd:enumeration value="UnitedNationsCommonCodingSystem"/>
+ <xsd:enumeration value="UnitedNationsStandardProductsAndServices"/>
+ <xsd:enumeration value="UnitedStatesDepartmentOfHealthAndHumanServicesOfficeOfVitalStatisticsE-Code"/>
+ <xsd:enumeration value="UnsolicitedProposalRejectionReason"/>
+ <xsd:enumeration value="UtilizationCode"/>
+ <xsd:enumeration value="VaccinationInnoculationOrIsolationCode"/>
+ <xsd:enumeration value="ValuationTypeCode"/>
+ <xsd:enumeration value="Value"/>
+ <xsd:enumeration value="ValueAddedTaxIdentification"/>
+ <xsd:enumeration value="VehicleClass"/>
+ <xsd:enumeration value="VehicleOccupantCode"/>
+ <xsd:enumeration value="VehicleParameters"/>
+ <xsd:enumeration value="VesselStatusAndTermsOfCarriageCode"/>
+ <xsd:enumeration value="VesselStowageLocationCode"/>
+ <xsd:enumeration value="VesselSustainingCode"/>
+ <xsd:enumeration value="ViewParameters"/>
+ <xsd:enumeration value="ViolationTypeCodeList"/>
+ <xsd:enumeration value="VoyageDocumentNumberCode"/>
+ <xsd:enumeration value="VoyageManifestReferenceCode"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WarReserveMaterialRequirementCode"/>
+ <xsd:enumeration value="WaterCommodityAndSpecialHandlingCode"/>
+ <xsd:enumeration value="WaterTerminalIdentifierCode"/>
+ <xsd:enumeration value="WeightOrFragilityCode"/>
+ <xsd:enumeration value="WhenDiscoveredLookup"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ContractType">
+ <xsd:sequence>
+ <xsd:element name="ContractTypeCoded" type="ContractTypeCode"/>
+ <xsd:element minOccurs="0" name="ContractTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractType" type="ContractType"/>
+ <xsd:simpleType name="ContractTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="DiagnosisRelatedGroup"/>
+ <xsd:enumeration value="PerDiem"/>
+ <xsd:enumeration value="VariablePerDiem"/>
+ <xsd:enumeration value="Flat"/>
+ <xsd:enumeration value="Capitated"/>
+ <xsd:enumeration value="Percent"/>
+ <xsd:enumeration value="NegotiatedGrowingEquityMortgage"/>
+ <xsd:enumeration value="AnticipatedContract"/>
+ <xsd:enumeration value="FederalHousingAuthorityAdjustableRateMortgage"/>
+ <xsd:enumeration value="FederalHousingAuthorityVeteransAffairsFixedRateMortgage"/>
+ <xsd:enumeration value="ConventionalSecondMortgages"/>
+ <xsd:enumeration value="ConventionalFixedRateMortgages"/>
+ <xsd:enumeration value="FederalHousingAuthorityVeteransAffairsGraduatedPaymentMortgage"/>
+ <xsd:enumeration value="NegotiatedConventionalGraduatedPaymentOrStepRateMortgage"/>
+ <xsd:enumeration value="ConventionalAdjustableRateMortgage"/>
+ <xsd:enumeration value="CostPlusIncentiveFee"/>
+ <xsd:enumeration value="CostSharing"/>
+ <xsd:enumeration value="CostPlus"/>
+ <xsd:enumeration value="Cost"/>
+ <xsd:enumeration value="CostPlusAwardFee"/>
+ <xsd:enumeration value="CostPlusFixedFee"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="ExclusiveAgency"/>
+ <xsd:enumeration value="ExclusiveRight"/>
+ <xsd:enumeration value="FirmorActualContract"/>
+ <xsd:enumeration value="FixedPriceIncentiveFirmTargetWithPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceIncentiveFirmTargetWithoutPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceRedetermination"/>
+ <xsd:enumeration value="FixedPricewithEscalation"/>
+ <xsd:enumeration value="FixedPriceIncentiveSuccessiveTargetWithPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceIncentiveSuccessiveTargetWithoutPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceAwardFee"/>
+ <xsd:enumeration value="FixedPriceIncentive"/>
+ <xsd:enumeration value="FixedPriceLevelofEffort"/>
+ <xsd:enumeration value="NoCost"/>
+ <xsd:enumeration value="FlatAmount"/>
+ <xsd:enumeration value="RetroactiveFixedPriceRedetermination"/>
+ <xsd:enumeration value="FirmFixedPrice"/>
+ <xsd:enumeration value="FixedPricewithEconomicPriceAdjustment"/>
+ <xsd:enumeration value="Labor"/>
+ <xsd:enumeration value="LevelofEffort"/>
+ <xsd:enumeration value="LaborHours"/>
+ <xsd:enumeration value="OtherContractType"/>
+ <xsd:enumeration value="ProspectReservation"/>
+ <xsd:enumeration value="SamePercentageasFilmRentalEarned"/>
+ <xsd:enumeration value="TimeandMaterials"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ValidityDates">
+ <xsd:sequence>
+ <xsd:element name="StartDate" type="xcblDatetime"/>
+ <xsd:element name="EndDate" type="xcblDatetime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ValidityDates" type="ValidityDates"/>
+ <xsd:complexType name="ListOfReferenceCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfReferenceCoded" type="ListOfReferenceCoded"/>
+ <xsd:complexType name="ReferenceCoded">
+ <xsd:sequence>
+ <xsd:element name="ReferenceTypeCoded" type="ReferenceTypeCode"/>
+ <xsd:element minOccurs="0" name="ReferenceTypeCodedOther" type="xsd:string"/>
+ <xsd:element name="PrimaryReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SupportingReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SupportingSubReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ReferenceDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ReferenceCoded" type="ReferenceCoded"/>
+ <xsd:simpleType name="ReferenceTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AbbreviatedNewDrugApplicationNumber"/>
+ <xsd:enumeration value="AcceptableSourceDUNSNumber"/>
+ <xsd:enumeration value="AcceptableSourcePurchaserID"/>
+ <xsd:enumeration value="AcceptableSourceSupplierID"/>
+ <xsd:enumeration value="AccessCode"/>
+ <xsd:enumeration value="AccessorialRailDiversionReferenceNumber"/>
+ <xsd:enumeration value="AccessorialStatusCode"/>
+ <xsd:enumeration value="AccidentReferenceNumber"/>
+ <xsd:enumeration value="AccountCategory"/>
+ <xsd:enumeration value="AccountingCode"/>
+ <xsd:enumeration value="AccountingEquipmentLocationNumber"/>
+ <xsd:enumeration value="AccountingFileReference"/>
+ <xsd:enumeration value="AccountingPeriodReference"/>
+ <xsd:enumeration value="AccountManagersCode"/>
+ <xsd:enumeration value="AccountNumber"/>
+ <xsd:enumeration value="AccountPartysBankReference"/>
+ <xsd:enumeration value="AccountPartysReference"/>
+ <xsd:enumeration value="AccountPayableNumber"/>
+ <xsd:enumeration value="AccountServicingBanksReferenceNumber"/>
+ <xsd:enumeration value="AccountsReceivableCustomerAccount"/>
+ <xsd:enumeration value="AccountsReceivableNumber"/>
+ <xsd:enumeration value="AccountsReceivableOpenItem"/>
+ <xsd:enumeration value="AccountsReceivableStatementNumber"/>
+ <xsd:enumeration value="AccountSuffixCode"/>
+ <xsd:enumeration value="AcknowledgementOfOrderNumber"/>
+ <xsd:enumeration value="ActionAuthorizationNumber"/>
+ <xsd:enumeration value="AdditionalReferenceNumber"/>
+ <xsd:enumeration value="AddOnSystemNumber"/>
+ <xsd:enumeration value="AddresseeReference"/>
+ <xsd:enumeration value="AdjustedRepricedClaimReferenceNumber"/>
+ <xsd:enumeration value="AdjustedRepricedLineItemReferenceNumber"/>
+ <xsd:enumeration value="AdjustmentControlNumber"/>
+ <xsd:enumeration value="AdjustmentMemoChargeBack"/>
+ <xsd:enumeration value="AdministratorsReferenceNumber"/>
+ <xsd:enumeration value="AdversaryCase"/>
+ <xsd:enumeration value="AdvertiserNumber"/>
+ <xsd:enumeration value="AdviceOfCollectionNumber"/>
+ <xsd:enumeration value="AdviseThroughBanksReference"/>
+ <xsd:enumeration value="AdvisingBanksReference"/>
+ <xsd:enumeration value="AeronauticalEquipmentReferenceNumber"/>
+ <xsd:enumeration value="AFE"/>
+ <xsd:enumeration value="AffectedSubsystemCode"/>
+ <xsd:enumeration value="AffiliationNumber"/>
+ <xsd:enumeration value="AgencyAssignedEmployeeID"/>
+ <xsd:enumeration value="AgencyAssignedNumber"/>
+ <xsd:enumeration value="AgencyCaseNumber"/>
+ <xsd:enumeration value="AgencyClaimNumber"/>
+ <xsd:enumeration value="AgencyClauseNumber"/>
+ <xsd:enumeration value="AIDAR"/>
+ <xsd:enumeration value="AgencyHierarchicalLevel"/>
+ <xsd:enumeration value="AgencyLocationCode"/>
+ <xsd:enumeration value="AgencysStudentNumber"/>
+ <xsd:enumeration value="AgentClaimNumber"/>
+ <xsd:enumeration value="AgentContractNumber"/>
+ <xsd:enumeration value="AgentNumber"/>
+ <xsd:enumeration value="AgentsBankReference"/>
+ <xsd:enumeration value="AgentsReference"/>
+ <xsd:enumeration value="AgentsShipmentNumber"/>
+ <xsd:enumeration value="AGERD"/>
+ <xsd:enumeration value="AgreementNumber"/>
+ <xsd:enumeration value="AgreementToPayNumber"/>
+ <xsd:enumeration value="AirCargoTransferManifest"/>
+ <xsd:enumeration value="AirDimensionCode"/>
+ <xsd:enumeration value="AirHandlingCode"/>
+ <xsd:enumeration value="AirlinesFlightIdentificationNumber"/>
+ <xsd:enumeration value="AirlineTicketNumber"/>
+ <xsd:enumeration value="AirWaybillNumber"/>
+ <xsd:enumeration value="AllotmentIdentification"/>
+ <xsd:enumeration value="AllowanceRecipientIdentification"/>
+ <xsd:enumeration value="AlterationNumber"/>
+ <xsd:enumeration value="AlternateClauseNumber"/>
+ <xsd:enumeration value="AmbulatoryPatientGroupNumber"/>
+ <xsd:enumeration value="AmendedUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="Amendment"/>
+ <xsd:enumeration value="AmendmentFiling"/>
+ <xsd:enumeration value="AmericanBankersAssociationTransitOrRoutingNumber"/>
+ <xsd:enumeration value="AmericanGasAssociationEquationNumber"/>
+ <xsd:enumeration value="AmericanOsteopathicAssociationCertificationNumber"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteDeductionCode"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteWell"/>
+ <xsd:enumeration value="AnalysisNumberOrTestNumber"/>
+ <xsd:enumeration value="AnesthesiaLicenseNumber"/>
+ <xsd:enumeration value="AnimalSpecies"/>
+ <xsd:enumeration value="AnimalStrain"/>
+ <xsd:enumeration value="AntiDumpingCaseNumber"/>
+ <xsd:enumeration value="APE"/>
+ <xsd:enumeration value="ApplicableCoefficientIdentificationNumber"/>
+ <xsd:enumeration value="ApplicableInstructionsOrStandards"/>
+ <xsd:enumeration value="ApplicantsBankReference"/>
+ <xsd:enumeration value="ApplicantsReference"/>
+ <xsd:enumeration value="ApplicationNumber"/>
+ <xsd:enumeration value="ApplicationReferenceNumber"/>
+ <xsd:enumeration value="ApplicationTransactionReferenceNumber"/>
+ <xsd:enumeration value="AppointmentNumber"/>
+ <xsd:enumeration value="AppraiserLicense"/>
+ <xsd:enumeration value="AppropriationNumber"/>
+ <xsd:enumeration value="ApprovalCode"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="ArrivalCode"/>
+ <xsd:enumeration value="ArticleNumber"/>
+ <xsd:enumeration value="AssemblyLineFeedLocation"/>
+ <xsd:enumeration value="AssemblyNumber"/>
+ <xsd:enumeration value="AssessmentNumber"/>
+ <xsd:enumeration value="AssignedByTransactionSetSender"/>
+ <xsd:enumeration value="AssignedContractNumber"/>
+ <xsd:enumeration value="AssignedSequenceNumber"/>
+ <xsd:enumeration value="AssignmentNumber"/>
+ <xsd:enumeration value="AssignmentRecordingNumber"/>
+ <xsd:enumeration value="AssociatedCaseControlNumber"/>
+ <xsd:enumeration value="AssociatedInvoices"/>
+ <xsd:enumeration value="AssociatedNumberForJoinedUnitNotResubdivided"/>
+ <xsd:enumeration value="AssociatedNumberForLimitedCommonElementParking"/>
+ <xsd:enumeration value="AssociatedNumberForUnitParking"/>
+ <xsd:enumeration value="AssociatedPolicyNumber"/>
+ <xsd:enumeration value="AssociatedProductNumber"/>
+ <xsd:enumeration value="AssociatedPropertyNumber"/>
+ <xsd:enumeration value="AssociatedPurchaseOrders"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsRailwayAccountingRules"/>
+ <xsd:enumeration value="AssumingCompany"/>
+ <xsd:enumeration value="AtaCarnetNumber"/>
+ <xsd:enumeration value="AtomicSafetyandLicensingBoardPanelNumber"/>
+ <xsd:enumeration value="AttachedTo"/>
+ <xsd:enumeration value="AttachmentCode"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AuthorisationForRepairReference"/>
+ <xsd:enumeration value="AuthorityIssuedEquipmentIdentification"/>
+ <xsd:enumeration value="AuthorizationNumber"/>
+ <xsd:enumeration value="AuthorizationNumberForExceptionToDangerousGoods"/>
+ <xsd:enumeration value="AuthorizationToMeetCompetitionNumber"/>
+ <xsd:enumeration value="AutoLossItemNumber"/>
+ <xsd:enumeration value="ACHReturnOrNotificationOfChangeCode"/>
+ <xsd:enumeration value="ACHEntryDescription"/>
+ <xsd:enumeration value="ACHStandardEntryClass"/>
+ <xsd:enumeration value="ACHTraceNumber"/>
+ <xsd:enumeration value="AutomatedUnderwritingReferenceNumber"/>
+ <xsd:enumeration value="AxleRatio"/>
+ <xsd:enumeration value="BackoutProcedureCode"/>
+ <xsd:enumeration value="BadgeNumber"/>
+ <xsd:enumeration value="BalanceDueReferenceNumber"/>
+ <xsd:enumeration value="BankAssignedBankersReferenceNumber"/>
+ <xsd:enumeration value="BankAssignedSecurityIdentifier"/>
+ <xsd:enumeration value="BankersAcceptance"/>
+ <xsd:enumeration value="BankReference"/>
+ <xsd:enumeration value="BankruptcyProcedureNumber"/>
+ <xsd:enumeration value="BanksCommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="BanksIndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="BankTelegraphicNumber"/>
+ <xsd:enumeration value="BankToBankInformation"/>
+ <xsd:enumeration value="BarCodedLabelSerialNumber"/>
+ <xsd:enumeration value="BarCodedSerialNumber"/>
+ <xsd:enumeration value="BargePermitNumber"/>
+ <xsd:enumeration value="BasicContractLineItemNumber"/>
+ <xsd:enumeration value="BatchNumberOrLotNumber"/>
+ <xsd:enumeration value="BatchSequenceNumber"/>
+ <xsd:enumeration value="BeamAssemblyCode"/>
+ <xsd:enumeration value="BeginMileMarker"/>
+ <xsd:enumeration value="BeginningJobSequenceNumber"/>
+ <xsd:enumeration value="BeginningKanbanSerialNumber"/>
+ <xsd:enumeration value="BeginningMeterReadingActual"/>
+ <xsd:enumeration value="BeginningMeterReadingEstimated"/>
+ <xsd:enumeration value="BeginningSerialNumber"/>
+ <xsd:enumeration value="BeneficiarysBankReference"/>
+ <xsd:enumeration value="BeneficiarysReference"/>
+ <xsd:enumeration value="BidNumber"/>
+ <xsd:enumeration value="BilateralCarServiceAgreements"/>
+ <xsd:enumeration value="BillAndHoldInvoiceNumber"/>
+ <xsd:enumeration value="BillingAccount"/>
+ <xsd:enumeration value="BillingCenterIdentification"/>
+ <xsd:enumeration value="BillingType"/>
+ <xsd:enumeration value="BillOfLadingNumber"/>
+ <xsd:enumeration value="BillofMaterialRevisionNumber"/>
+ <xsd:enumeration value="BillOfQuantitiesNumber"/>
+ <xsd:enumeration value="BinaryObjectIdentifier"/>
+ <xsd:enumeration value="BinLocationNumber"/>
+ <xsd:enumeration value="BlanketOrderNumber"/>
+ <xsd:enumeration value="BlendedWithBatchNumber"/>
+ <xsd:enumeration value="BlendedWithNumber"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="BlueCrossProviderNumber"/>
+ <xsd:enumeration value="BlueShieldProviderNumber"/>
+ <xsd:enumeration value="BondedCarrierInternalRevenueServiceIdentificationNumber"/>
+ <xsd:enumeration value="BookingReferenceNumber"/>
+ <xsd:enumeration value="BookNumber"/>
+ <xsd:enumeration value="BordereauNumber"/>
+ <xsd:enumeration value="BranchIdentifier"/>
+ <xsd:enumeration value="BrokerIdentification"/>
+ <xsd:enumeration value="BrokerOrSalesOfficeNumber"/>
+ <xsd:enumeration value="BrokerReference1"/>
+ <xsd:enumeration value="BrokerReference2"/>
+ <xsd:enumeration value="BrokersOrderNumber"/>
+ <xsd:enumeration value="BrokerReferenceNumber"/>
+ <xsd:enumeration value="BudgetChapter"/>
+ <xsd:enumeration value="BureauofLaborandStatisticsScheduleIdentifier"/>
+ <xsd:enumeration value="BureauSigningOR"/>
+ <xsd:enumeration value="BureauSigningSR"/>
+ <xsd:enumeration value="BusinessActivity"/>
+ <xsd:enumeration value="BusinessIdentificationNumber"/>
+ <xsd:enumeration value="BusinessTaxNumber"/>
+ <xsd:enumeration value="BuyerIdentification"/>
+ <xsd:enumeration value="BuyersApprovalMark"/>
+ <xsd:enumeration value="BuyersCatalogueNumber"/>
+ <xsd:enumeration value="BuyersContractNumber"/>
+ <xsd:enumeration value="BuyersCreditMemo"/>
+ <xsd:enumeration value="BuyersDebitMemo"/>
+ <xsd:enumeration value="BuyersDebtorNumber"/>
+ <xsd:enumeration value="BuyersItemNumber"/>
+ <xsd:enumeration value="BuyersOrderNumber"/>
+ <xsd:enumeration value="BuyersShipmentMarkNumber"/>
+ <xsd:enumeration value="CadFileLayerConvention"/>
+ <xsd:enumeration value="Calendar"/>
+ <xsd:enumeration value="CalendarNumber"/>
+ <xsd:enumeration value="CallOffOrderNumber"/>
+ <xsd:enumeration value="CallSign"/>
+ <xsd:enumeration value="CanadianExciseEntryNumber"/>
+ <xsd:enumeration value="CanadianFinancialInstitutionBranchAndInstitutionNumber"/>
+ <xsd:enumeration value="CanadianGoodsAndServicesorQuebecSalesTaxReferenceNumber"/>
+ <xsd:enumeration value="CanadianProvinceOperatingAuthorityNumber"/>
+ <xsd:enumeration value="CanadianSocialInsuranceNumber"/>
+ <xsd:enumeration value="CanadianWheatBoardPermitNumber"/>
+ <xsd:enumeration value="CanceledRevisionNumber"/>
+ <xsd:enumeration value="CardAccountReportingIdentifier"/>
+ <xsd:enumeration value="CardAccountReportingLevel"/>
+ <xsd:enumeration value="CardAccountStatusCode"/>
+ <xsd:enumeration value="CardAccountTypeCode"/>
+ <xsd:enumeration value="CardBillingTypeCode"/>
+ <xsd:enumeration value="CardIssuerTransactionCode"/>
+ <xsd:enumeration value="CargoAcceptanceOrderReferenceNumber"/>
+ <xsd:enumeration value="CargoControlNumber"/>
+ <xsd:enumeration value="CargoManifestNumber"/>
+ <xsd:enumeration value="CarnetNumber"/>
+ <xsd:enumeration value="CarrierAssignedCode"/>
+ <xsd:enumeration value="CarrierAssignedConsigneeNumber"/>
+ <xsd:enumeration value="CarrierAssignedPackageIdentificationNumber"/>
+ <xsd:enumeration value="CarrierAssignedReferenceNumber"/>
+ <xsd:enumeration value="CarrierAssignedShipperNumber"/>
+ <xsd:enumeration value="CarriersAgentReferenceNumber"/>
+ <xsd:enumeration value="CarriersCustomsBondNumber"/>
+ <xsd:enumeration value="CarriersReferenceNumber"/>
+ <xsd:enumeration value="CaseNumber"/>
+ <xsd:enumeration value="CaseOfNeedPartysReference"/>
+ <xsd:enumeration value="CasualtyReportNumber"/>
+ <xsd:enumeration value="CasualtyReportSerialNumber"/>
+ <xsd:enumeration value="Catalog"/>
+ <xsd:enumeration value="CatalogueSequenceNumber"/>
+ <xsd:enumeration value="CatastropheNumber"/>
+ <xsd:enumeration value="CategoryOfWorkReference"/>
+ <xsd:enumeration value="CedentsClaimNumber"/>
+ <xsd:enumeration value="CedingCompany"/>
+ <xsd:enumeration value="CeilingFormulaReferenceNumber"/>
+ <xsd:enumeration value="CensusAutomatedFilesID"/>
+ <xsd:enumeration value="CensusBlockGroup"/>
+ <xsd:enumeration value="CensusStateCode"/>
+ <xsd:enumeration value="CensusTract"/>
+ <xsd:enumeration value="CensusTractSuffix"/>
+ <xsd:enumeration value="CentralSecretariatLogNumber"/>
+ <xsd:enumeration value="CentralSecretariatLogNumberChildDataMaintenance"/>
+ <xsd:enumeration value="CentralSecretariatLogNumberParentDataMaintenance"/>
+ <xsd:enumeration value="CertificateNumber"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="CertificateofIncorporationNumber"/>
+ <xsd:enumeration value="CertificateofTransportation"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="CertifiedMailNumber"/>
+ <xsd:enumeration value="CRNA"/>
+ <xsd:enumeration value="ChamberOfCommerceNumber"/>
+ <xsd:enumeration value="ChamberOfCommerceRegistrationNumber"/>
+ <xsd:enumeration value="CHAMPUSIdentificationNumber"/>
+ <xsd:enumeration value="ChangeDocumentNumber"/>
+ <xsd:enumeration value="ChangeNumber"/>
+ <xsd:enumeration value="ChangeOrderAuthority"/>
+ <xsd:enumeration value="ChangeVerificationProcedureCode"/>
+ <xsd:enumeration value="ChargeCardAccountNumber"/>
+ <xsd:enumeration value="ChargeCardNumber"/>
+ <xsd:enumeration value="ChargeNoteReferenceNumber"/>
+ <xsd:enumeration value="ChargeNumber"/>
+ <xsd:enumeration value="CharterNumber"/>
+ <xsd:enumeration value="CheckingNumber"/>
+ <xsd:enumeration value="CheckListNumber"/>
+ <xsd:enumeration value="CheckNumber"/>
+ <xsd:enumeration value="ChemicalAbstractServiceRegistryNumber"/>
+ <xsd:enumeration value="ChequeNumber"/>
+ <xsd:enumeration value="CircuitNumber"/>
+ <xsd:enumeration value="Circular"/>
+ <xsd:enumeration value="CircularPublicationNumber"/>
+ <xsd:enumeration value="Citation"/>
+ <xsd:enumeration value="CitationOfOpinion"/>
+ <xsd:enumeration value="CitationOfStatute"/>
+ <xsd:enumeration value="CitizenshipDocumentNumber"/>
+ <xsd:enumeration value="CivilActionNumber"/>
+ <xsd:enumeration value="CivilLiabilitiesofOilCertificate"/>
+ <xsd:enumeration value="ClaimAdministratorClaimNumber"/>
+ <xsd:enumeration value="ClaimantNumber"/>
+ <xsd:enumeration value="ClaimantsClaimNumber"/>
+ <xsd:enumeration value="ClaimNumber"/>
+ <xsd:enumeration value="ClaimOfficeNumber"/>
+ <xsd:enumeration value="ClassCode"/>
+ <xsd:enumeration value="ClassOfContractCode"/>
+ <xsd:enumeration value="ClauseNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentsSystemSequenceNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemParticipantNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemUserIdentification"/>
+ <xsd:enumeration value="ClearingReference"/>
+ <xsd:enumeration value="ClearTextClause"/>
+ <xsd:enumeration value="ClientCompanyCode"/>
+ <xsd:enumeration value="ClientNumber"/>
+ <xsd:enumeration value="ClientReportingCategory"/>
+ <xsd:enumeration value="ClinicalLaboratoryImprovementAmendmentNumber"/>
+ <xsd:enumeration value="ClinicNumber"/>
+ <xsd:enumeration value="CoalAuthorityNumber"/>
+ <xsd:enumeration value="CodeOfFederalRegulations"/>
+ <xsd:enumeration value="CoilNumber"/>
+ <xsd:enumeration value="ColdRollNumber"/>
+ <xsd:enumeration value="CollectingBanksReference"/>
+ <xsd:enumeration value="CollectorIdentification"/>
+ <xsd:enumeration value="CollocationIndicator"/>
+ <xsd:enumeration value="CombinedShipment"/>
+ <xsd:enumeration value="CommercialOrPrivatePassengerVehicleQualifier"/>
+ <xsd:enumeration value="CommercialAccountSummaryReferenceNumber"/>
+ <xsd:enumeration value="CommercialandGovernmentEntityCode"/>
+ <xsd:enumeration value="CommercialDriversLicense"/>
+ <xsd:enumeration value="CommercialInvoiceNumber"/>
+ <xsd:enumeration value="CommercialRegistrationNumber"/>
+ <xsd:enumeration value="CommercialVehicleSafetyAssuranceNumber"/>
+ <xsd:enumeration value="CommitmentNumber"/>
+ <xsd:enumeration value="CommitteeOnUniformSecurityIdentificationProceduresNumber"/>
+ <xsd:enumeration value="CommodityNumber"/>
+ <xsd:enumeration value="CommonAccessReferenceNumber"/>
+ <xsd:enumeration value="CommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="CompanyAndPlaceRegistrationNumber"/>
+ <xsd:enumeration value="CompanyAndSyndicateReference1"/>
+ <xsd:enumeration value="CompanyAndSyndicateReference2"/>
+ <xsd:enumeration value="CompanyIssuedEquipmentId"/>
+ <xsd:enumeration value="CRO"/>
+ <xsd:enumeration value="ComparableProperty"/>
+ <xsd:enumeration value="ComparablePropertyPendingSaleReferenceNumber"/>
+ <xsd:enumeration value="ComparablePropertySaleReferenceNumber"/>
+ <xsd:enumeration value="ComparablePropertyVerificationSource"/>
+ <xsd:enumeration value="CompetentAuthority"/>
+ <xsd:enumeration value="Complaint"/>
+ <xsd:enumeration value="ComplaintCode"/>
+ <xsd:enumeration value="CompletedUnitsPaymentRequestReference"/>
+ <xsd:enumeration value="ComplianceCodeNumber"/>
+ <xsd:enumeration value="Component"/>
+ <xsd:enumeration value="ConditionOfPurchaseDocumentNumber"/>
+ <xsd:enumeration value="ConditionOfSaleDocumentNumber"/>
+ <xsd:enumeration value="CondominiumIdentificationNumber"/>
+ <xsd:enumeration value="CongressionalDistrict"/>
+ <xsd:enumeration value="ConnectingCarrier"/>
+ <xsd:enumeration value="ConsigneeReferenceNumber"/>
+ <xsd:enumeration value="ConsigneesFurtherOrder"/>
+ <xsd:enumeration value="ConsigneesInvoiceNumber"/>
+ <xsd:enumeration value="ConsigneesOrderNumber"/>
+ <xsd:enumeration value="ConsigneesReleaseNumber"/>
+ <xsd:enumeration value="ConsigneesShipmentReferenceNumber"/>
+ <xsd:enumeration value="ConsignmentClassificationID"/>
+ <xsd:enumeration value="ConsignorsFurtherOrder"/>
+ <xsd:enumeration value="ConsignorsReferenceNumber"/>
+ <xsd:enumeration value="ConsolidatedInvoiceNumber"/>
+ <xsd:enumeration value="ConsolidationShipmentNumber"/>
+ <xsd:enumeration value="ConsolidatorsReceiptNumber"/>
+ <xsd:enumeration value="ConstraintNotation"/>
+ <xsd:enumeration value="ConsumerIdentifier"/>
+ <xsd:enumeration value="ConsumptionDataRequestNumber"/>
+ <xsd:enumeration value="ContainerOrEquipmentReceiptNumber"/>
+ <xsd:enumeration value="ContainerOrPackagingSpecificationNumber"/>
+ <xsd:enumeration value="ContainerDispositionOrderReferenceNumber"/>
+ <xsd:enumeration value="ContainerOperatorsReferenceNumber"/>
+ <xsd:enumeration value="ContainerorEquipmentReceiptNumber"/>
+ <xsd:enumeration value="ContainerPrefix"/>
+ <xsd:enumeration value="ContainerSequenceNumber"/>
+ <xsd:enumeration value="ContainerWorkOrderReferenceNumber"/>
+ <xsd:enumeration value="ContinuationFiling"/>
+ <xsd:enumeration value="ContinuationUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="ContinuousMoveNumber"/>
+ <xsd:enumeration value="ContinuousTransferNumber"/>
+ <xsd:enumeration value="ContractAddendumNumber"/>
+ <xsd:enumeration value="ContractAuditorIDNumber"/>
+ <xsd:enumeration value="ContractBreakdownReference"/>
+ <xsd:enumeration value="ContractCoopNumber"/>
+ <xsd:enumeration value="ContractHolderClaimNumber"/>
+ <xsd:enumeration value="ContractLineItemNumber"/>
+ <xsd:enumeration value="ContractNumber"/>
+ <xsd:enumeration value="ContractOptionNumber"/>
+ <xsd:enumeration value="ContractorDataRequirementsList"/>
+ <xsd:enumeration value="ContractorEstablishmentCode"/>
+ <xsd:enumeration value="ContractorRequestReference"/>
+ <xsd:enumeration value="ContractPartyReferenceNumber"/>
+ <xsd:enumeration value="ContractReference"/>
+ <xsd:enumeration value="ContractRiderNumber"/>
+ <xsd:enumeration value="ConveyanceReferenceNumber"/>
+ <xsd:enumeration value="CooperationContractNumber"/>
+ <xsd:enumeration value="CornboreCertificationNumber"/>
+ <xsd:enumeration value="CorrectedBatchNumber"/>
+ <xsd:enumeration value="CorrectedContractNumber"/>
+ <xsd:enumeration value="CorrectedSocialSecurityNumber"/>
+ <xsd:enumeration value="CorrectionNumber"/>
+ <xsd:enumeration value="CostAccount"/>
+ <xsd:enumeration value="CostAllocationReference"/>
+ <xsd:enumeration value="CostaRicanJudicialNumber"/>
+ <xsd:enumeration value="CostCentre"/>
+ <xsd:enumeration value="CostElement"/>
+ <xsd:enumeration value="CountyBusinessRegistrationNumber"/>
+ <xsd:enumeration value="CountyCode"/>
+ <xsd:enumeration value="CountyLegislativeDistrict"/>
+ <xsd:enumeration value="CouponDistributionMethod"/>
+ <xsd:enumeration value="CouponRedemptionNumber"/>
+ <xsd:enumeration value="CoverageCode"/>
+ <xsd:enumeration value="CreditCard"/>
+ <xsd:enumeration value="CreditCounselingIdentificationNumber"/>
+ <xsd:enumeration value="CreditMemoNumber"/>
+ <xsd:enumeration value="CreditNoteNumber"/>
+ <xsd:enumeration value="Creditor"/>
+ <xsd:enumeration value="CreditorDebitAdjustmentNumber"/>
+ <xsd:enumeration value="CreditorsReferenceNumber"/>
+ <xsd:enumeration value="CreditRatingAgencysReferenceNumber"/>
+ <xsd:enumeration value="CreditReferenceNumber"/>
+ <xsd:enumeration value="CreditReportNumber"/>
+ <xsd:enumeration value="CreditRepositoryCode"/>
+ <xsd:enumeration value="CriticalApplication"/>
+ <xsd:enumeration value="CriticalityDesignator"/>
+ <xsd:enumeration value="CropYear"/>
+ <xsd:enumeration value="CrossListedCourseNumber"/>
+ <xsd:enumeration value="CrossReferenceNumber"/>
+ <xsd:enumeration value="CS54KeyTrainIndicatorCode"/>
+ <xsd:enumeration value="CS54KeyTrainIndicatorGroupName"/>
+ <xsd:enumeration value="CurrentCertificateNumber"/>
+ <xsd:enumeration value="CurrentInvoiceNumber"/>
+ <xsd:enumeration value="CurrentorLatestCourseNumber"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCode"/>
+ <xsd:enumeration value="CurrentRevisionNumber"/>
+ <xsd:enumeration value="CustomerCatalogNumber"/>
+ <xsd:enumeration value="CustomerMaintenancePeriodSequenceNumber"/>
+ <xsd:enumeration value="CustomerMaterialSpecificationNumber"/>
+ <xsd:enumeration value="CustomerOrderNumber"/>
+ <xsd:enumeration value="CustomerProcessSpecificationNumber"/>
+ <xsd:enumeration value="CustomerReferenceNumber"/>
+ <xsd:enumeration value="CustomerReferenceNumberAssignedToPreviousBalanceOf"/>
+ <xsd:enumeration value="CustomersCommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="CustomersIndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="CustomersPartNumber"/>
+ <xsd:enumeration value="CustomerSpecificationNumber"/>
+ <xsd:enumeration value="CustomersReleaseNumber"/>
+ <xsd:enumeration value="CustomersUnitInventoryNumber"/>
+ <xsd:enumeration value="CustomerTrackingNumberForLoanedMaterials"/>
+ <xsd:enumeration value="CustomsBarCodeNumber"/>
+ <xsd:enumeration value="CustomsBrokerReferenceNumber"/>
+ <xsd:enumeration value="CustomsDecisionRequestNumber"/>
+ <xsd:enumeration value="CustomsDeclarationNumber"/>
+ <xsd:enumeration value="CustomsDrawbackEntryNumber"/>
+ <xsd:enumeration value="CustomsGuaranteeNumber"/>
+ <xsd:enumeration value="CustomshouseBrokerLicenseNumber"/>
+ <xsd:enumeration value="CustomsItemNumber"/>
+ <xsd:enumeration value="CustomsPreferenceInquiryNumber"/>
+ <xsd:enumeration value="CustomsReleaseCode"/>
+ <xsd:enumeration value="CustomsTariffNumber"/>
+ <xsd:enumeration value="CustomsTranshipmentNumber"/>
+ <xsd:enumeration value="CustomsValuationDecisionNumber"/>
+ <xsd:enumeration value="CutNumber"/>
+ <xsd:enumeration value="DangerousGoodsSecurityNumber"/>
+ <xsd:enumeration value="DangerousGoodsTransportLicenceNumber"/>
+ <xsd:enumeration value="DataAuthenticationNumber"/>
+ <xsd:enumeration value="DataItemDescriptionReference"/>
+ <xsd:enumeration value="DataQualityRejectReason"/>
+ <xsd:enumeration value="DataReliabilityCode"/>
+ <xsd:enumeration value="DataSource"/>
+ <xsd:enumeration value="DataStructureTag"/>
+ <xsd:enumeration value="DealerIdentification"/>
+ <xsd:enumeration value="DealerNumber"/>
+ <xsd:enumeration value="DealerOrderNumber"/>
+ <xsd:enumeration value="Dealerpurchaseordernumber"/>
+ <xsd:enumeration value="DealerTypeIdentification"/>
+ <xsd:enumeration value="DebitAccountNumber"/>
+ <xsd:enumeration value="DebitNoteNumber"/>
+ <xsd:enumeration value="DebitReferenceNumber"/>
+ <xsd:enumeration value="Debtor"/>
+ <xsd:enumeration value="DebtorsAccount"/>
+ <xsd:enumeration value="DebtorsReferenceNumber"/>
+ <xsd:enumeration value="DeclarantsCustomsIdentityNumber"/>
+ <xsd:enumeration value="DeclarantsReferenceNumber"/>
+ <xsd:enumeration value="DefectCodeNumber"/>
+ <xsd:enumeration value="DefenseFederalAcquisitionRegulations"/>
+ <xsd:enumeration value="DefensePrioritiesAllocationSystemPriorityRating"/>
+ <xsd:enumeration value="DefermentApprovalNumber"/>
+ <xsd:enumeration value="DeferredPaymentReference"/>
+ <xsd:enumeration value="DeliveryNoteNumber"/>
+ <xsd:enumeration value="DeliveryNumber"/>
+ <xsd:enumeration value="DeliveryOrderNumber"/>
+ <xsd:enumeration value="DeliveryQuoteNumber"/>
+ <xsd:enumeration value="DeliveryReference"/>
+ <xsd:enumeration value="DeliveryRegion"/>
+ <xsd:enumeration value="DeliveryScheduleNumber"/>
+ <xsd:enumeration value="DeliveryTicketNumber"/>
+ <xsd:enumeration value="DeliveryTrailerManifest"/>
+ <xsd:enumeration value="DeliveryVerificationCertificate"/>
+ <xsd:enumeration value="DenialReasonIdentifier"/>
+ <xsd:enumeration value="DensityOrderNumber"/>
+ <xsd:enumeration value="DentalInsuranceAccountNumber"/>
+ <xsd:enumeration value="DentalInsurancePolicyNumber"/>
+ <xsd:enumeration value="DentistLicenseNumber"/>
+ <xsd:enumeration value="Department"/>
+ <xsd:enumeration value="DepartmentOrAgencyNumber"/>
+ <xsd:enumeration value="DepartmentNumber"/>
+ <xsd:enumeration value="DepartmentofAgricultureAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofCommerceAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentOfDefenseForm250RequirementCode"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DDTSCN"/>
+ <xsd:enumeration value="DepartmentofEducationAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofEnergyAcquisitionRegulation"/>
+ <xsd:enumeration value="HHSAR"/>
+ <xsd:enumeration value="HUDAR"/>
+ <xsd:enumeration value="DepartmentofInteriorAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofJusticeAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofLaborAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofStateAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentoftheTreasuryAcquisitionOrProcurementRegulation"/>
+ <xsd:enumeration value="DepartmentofTransportationAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentOfTransportationBondNumber"/>
+ <xsd:enumeration value="DepartmentofTransportationHazardousNumber"/>
+ <xsd:enumeration value="DepartmentofVeteransAffairsAcquisitionRegulations"/>
+ <xsd:enumeration value="DepartmentWhereInjuryOccurredIdentification"/>
+ <xsd:enumeration value="DeparturefromSpecificationClassCode"/>
+ <xsd:enumeration value="DeparturefromSpecificationNumber"/>
+ <xsd:enumeration value="DeparturefromSpecificationTypeCode"/>
+ <xsd:enumeration value="DependentsInformation"/>
+ <xsd:enumeration value="DepositAccountNumber"/>
+ <xsd:enumeration value="DepositNumber"/>
+ <xsd:enumeration value="DepositorNumber"/>
+ <xsd:enumeration value="DepositoryTrustCompanyIdentification"/>
+ <xsd:enumeration value="DepositSequenceNumber"/>
+ <xsd:enumeration value="DeratCertificate"/>
+ <xsd:enumeration value="DescriptionOfChangeCode"/>
+ <xsd:enumeration value="DespatchAdviceNumber"/>
+ <xsd:enumeration value="DespatchNotePostParcelsNumber"/>
+ <xsd:enumeration value="DespatchNoteNumber"/>
+ <xsd:enumeration value="DestinationofShipmentHarmonizedBasedCode"/>
+ <xsd:enumeration value="DiagnosisRelatedGroupNumber"/>
+ <xsd:enumeration value="DirectDebitReference"/>
+ <xsd:enumeration value="DirectoryNumber"/>
+ <xsd:enumeration value="DirectPaymentValuationNumber"/>
+ <xsd:enumeration value="DirectPaymentValuationRequestNumber"/>
+ <xsd:enumeration value="DisabilityInsuranceAccountNumber"/>
+ <xsd:enumeration value="DisabilityInsurancePolicyNumber"/>
+ <xsd:enumeration value="DiscounterRegistrationNumber"/>
+ <xsd:enumeration value="DispensationReference"/>
+ <xsd:enumeration value="DisposalTurnInDocumentNumber"/>
+ <xsd:enumeration value="DisputeNumber"/>
+ <xsd:enumeration value="DistributionCenterNumber"/>
+ <xsd:enumeration value="DistributionList"/>
+ <xsd:enumeration value="DistributionStatementCode"/>
+ <xsd:enumeration value="DistributorAssignedOrderNumber"/>
+ <xsd:enumeration value="DistributorAssignedTransactionNumber"/>
+ <xsd:enumeration value="DistributOrInvoiceNumber"/>
+ <xsd:enumeration value="DistributorsAccountIdentification"/>
+ <xsd:enumeration value="DistributorsAccountNumber"/>
+ <xsd:enumeration value="DistributorsRepresentativeIdentification"/>
+ <xsd:enumeration value="DistributorsSplitAgentNumber"/>
+ <xsd:enumeration value="DistrictNumber"/>
+ <xsd:enumeration value="DiversionAuthorityNumber"/>
+ <xsd:enumeration value="DivisionIdentifier"/>
+ <xsd:enumeration value="DocketNumber"/>
+ <xsd:enumeration value="DockNumber"/>
+ <xsd:enumeration value="DockReceiptNumber"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentNumber"/>
+ <xsd:enumeration value="DocumentaryCreditNumber"/>
+ <xsd:enumeration value="DocumentaryPaymentReference"/>
+ <xsd:enumeration value="DocumentationAffectedNumber"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="DocumentNumber"/>
+ <xsd:enumeration value="DocumentVolumeNumber"/>
+ <xsd:enumeration value="DomesticFlightNumber"/>
+ <xsd:enumeration value="DomesticInventoryManagementCode"/>
+ <xsd:enumeration value="DomicileBranchNumber"/>
+ <xsd:enumeration value="DominionOfCanadaCode"/>
+ <xsd:enumeration value="DownstreamShipperContractNumber"/>
+ <xsd:enumeration value="DraftNumber"/>
+ <xsd:enumeration value="DrainholeNumber"/>
+ <xsd:enumeration value="DraweesReference"/>
+ <xsd:enumeration value="DrawingListNumber"/>
+ <xsd:enumeration value="DrawingNumber"/>
+ <xsd:enumeration value="DrawingRevisionNumber"/>
+ <xsd:enumeration value="DrawingType"/>
+ <xsd:enumeration value="DriversLicense"/>
+ <xsd:enumeration value="DrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="DrugEnforcementAdministrationOrderBlankNumber"/>
+ <xsd:enumeration value="DrugFormularyNumber"/>
+ <xsd:enumeration value="DunAndBradstreetCanadas8DigitStandardIndustrial"/>
+ <xsd:enumeration value="DunAndBradstreetUS8DigitStandardIndustrial"/>
+ <xsd:enumeration value="DUNSNumberwithFourCharacterSuffix"/>
+ <xsd:enumeration value="DUNSNumberDunAndBradstreet"/>
+ <xsd:enumeration value="DuplicateBillNumber"/>
+ <xsd:enumeration value="DuplicateWaybillinRoute"/>
+ <xsd:enumeration value="DuplicateWaybillNotInRoute"/>
+ <xsd:enumeration value="DutyFreeProductsReceiptAuthorisationNumber"/>
+ <xsd:enumeration value="DutyFreeProductsSecurityNumber"/>
+ <xsd:enumeration value="DutyMemoNumber"/>
+ <xsd:enumeration value="DyeLotNumber"/>
+ <xsd:enumeration value="ECCN"/>
+ <xsd:enumeration value="EducationalInstitutionIdentificationNumber"/>
+ <xsd:enumeration value="ElectionDistrict"/>
+ <xsd:enumeration value="ElectronicDataInterchangeAgreementNumber"/>
+ <xsd:enumeration value="Electronicdevicepinnumber"/>
+ <xsd:enumeration value="ElectronicFundsTransferIDNumber"/>
+ <xsd:enumeration value="ElectronicPaymentReferenceNumber"/>
+ <xsd:enumeration value="Elevation"/>
+ <xsd:enumeration value="EmbargoNumber"/>
+ <xsd:enumeration value="EmbargoPermitNumber"/>
+ <xsd:enumeration value="EmergencyOrderNumber"/>
+ <xsd:enumeration value="EmissionDesignator"/>
+ <xsd:enumeration value="EmployeeOrNonEmployeeClassificationQualifier"/>
+ <xsd:enumeration value="EmployeeIdentificationNumber"/>
+ <xsd:enumeration value="EmployeeTaxFilingStatusCode"/>
+ <xsd:enumeration value="EmployerIdentificationNumberOfServiceBureau"/>
+ <xsd:enumeration value="EmployersIdentificationNumber"/>
+ <xsd:enumeration value="EmployersSocialSecurityNumber"/>
+ <xsd:enumeration value="EmploymentVisa"/>
+ <xsd:enumeration value="EmptyContainerBillNumber"/>
+ <xsd:enumeration value="EmptyRepositioningNumber"/>
+ <xsd:enumeration value="EndingJobSequenceNumber"/>
+ <xsd:enumeration value="EndingKanbanSerialNumber"/>
+ <xsd:enumeration value="EndingMeterReadingActual"/>
+ <xsd:enumeration value="EndingMeterReadingEstimated"/>
+ <xsd:enumeration value="EndingPackageNumber"/>
+ <xsd:enumeration value="EndingSerialNumber"/>
+ <xsd:enumeration value="EndItem"/>
+ <xsd:enumeration value="EndItemNumber"/>
+ <xsd:enumeration value="EndMileMarker"/>
+ <xsd:enumeration value="EndorsementNumber"/>
+ <xsd:enumeration value="EndUseAuthorizationNumber"/>
+ <xsd:enumeration value="EndUseNumber"/>
+ <xsd:enumeration value="EndUsersPurchaseOrderNumber"/>
+ <xsd:enumeration value="EngineeringChangeOrder"/>
+ <xsd:enumeration value="EngineeringChangeProposal"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="EngineeringSpecificationNumber"/>
+ <xsd:enumeration value="EnquiryNumber"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumber"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumberChildDmr"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumberParentDmr"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyAcquisitionRegulation"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyTestTypePurposeCode"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyTransporterIdentificationNumber"/>
+ <xsd:enumeration value="EquipmentInitial"/>
+ <xsd:enumeration value="EquipmentNumber"/>
+ <xsd:enumeration value="EquipmentOwnerReferenceNumber"/>
+ <xsd:enumeration value="EquipmentSequenceNumber"/>
+ <xsd:enumeration value="EquipmentTransportChargeNumber"/>
+ <xsd:enumeration value="EquivalentCourseNumberatRequestingInstitution"/>
+ <xsd:enumeration value="ErrorIdentificationCode"/>
+ <xsd:enumeration value="EscrowFileNumber"/>
+ <xsd:enumeration value="EstimateNumber"/>
+ <xsd:enumeration value="EstimateOrderReferenceNumber"/>
+ <xsd:enumeration value="EstimateSequenceNumber"/>
+ <xsd:enumeration value="EtermsReference"/>
+ <xsd:enumeration value="Eur1CertificateNumber"/>
+ <xsd:enumeration value="EventReferenceNumber"/>
+ <xsd:enumeration value="ExcessTransportationNumber"/>
+ <xsd:enumeration value="ExhibitDistributionList"/>
+ <xsd:enumeration value="ExhibitIdentifier"/>
+ <xsd:enumeration value="ExpansiononEffectofChangeNumber"/>
+ <xsd:enumeration value="ExportClearanceInstructionReferenceNumber"/>
+ <xsd:enumeration value="ExportDeclaration"/>
+ <xsd:enumeration value="ExportersReferenceNumber"/>
+ <xsd:enumeration value="ExportEstablishmentNumber"/>
+ <xsd:enumeration value="ExportLicenceNumber"/>
+ <xsd:enumeration value="ExportPermitNumber"/>
+ <xsd:enumeration value="ExportReferenceNumber"/>
+ <xsd:enumeration value="ExtendedOrExhibitLineItemNumber"/>
+ <xsd:enumeration value="FacilityCertificationNumber"/>
+ <xsd:enumeration value="FacilityIDNumber"/>
+ <xsd:enumeration value="FacilityMeasurementPointNumber"/>
+ <xsd:enumeration value="FacilityNetworkIdentificationNumber"/>
+ <xsd:enumeration value="FailureAnalysisReportNumber"/>
+ <xsd:enumeration value="Failuremechanismnumber"/>
+ <xsd:enumeration value="FamilyMemberIdentification"/>
+ <xsd:enumeration value="FamilyUnitNumber"/>
+ <xsd:enumeration value="FannieMaeSellerServicerNumber"/>
+ <xsd:enumeration value="FederalAcquisitionRegulations"/>
+ <xsd:enumeration value="FederalBureauOfInvestigationIndividualIdentification"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionConditionCode"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionIdentifier"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionTradeOrBrandIdentifier"/>
+ <xsd:enumeration value="FederalEnergyRegulatoryCommissionCertificateOfPublicConvenience"/>
+ <xsd:enumeration value="FHLMCD"/>
+ <xsd:enumeration value="FederalHomeLoanMortgageCorporationLoanNumber"/>
+ <xsd:enumeration value="FederalHousingAdministrationCaseNumber"/>
+ <xsd:enumeration value="CHUMS"/>
+ <xsd:enumeration value="FederalHousingAdministrationOriginatorIdentification"/>
+ <xsd:enumeration value="FederalInformationResourcesManagementRegulation"/>
+ <xsd:enumeration value="FederalMaritimeCommissionForwardersNumber"/>
+ <xsd:enumeration value="FederalMaritimeCommissionTariffNumber"/>
+ <xsd:enumeration value="FederalNationalMortgageAssociationLoanNumber"/>
+ <xsd:enumeration value="FederalRegulation"/>
+ <xsd:enumeration value="FederalSupplyClassificationCode"/>
+ <xsd:enumeration value="FederalSupplyScheduleItemNumber"/>
+ <xsd:enumeration value="FederalSupplyScheduleNumber"/>
+ <xsd:enumeration value="FederalTaxpayersIdentificationNumber"/>
+ <xsd:enumeration value="FederalWireTransfer"/>
+ <xsd:enumeration value="FEDWIREConfirmationNumber"/>
+ <xsd:enumeration value="FeeScheduleIdentifier"/>
+ <xsd:enumeration value="Field"/>
+ <xsd:enumeration value="FileConversionJournal"/>
+ <xsd:enumeration value="FileIdentificationNumber"/>
+ <xsd:enumeration value="FileIdentifier"/>
+ <xsd:enumeration value="FileLineIdentifier"/>
+ <xsd:enumeration value="FilerCodeIssuedbyBureauOfCensus"/>
+ <xsd:enumeration value="FilerCodeIssuedByCustoms"/>
+ <xsd:enumeration value="FileTransferFormNumber"/>
+ <xsd:enumeration value="FileTransferProtocolLocator"/>
+ <xsd:enumeration value="FileVersionNumber"/>
+ <xsd:enumeration value="FilmNumber"/>
+ <xsd:enumeration value="FinalSequenceNumber"/>
+ <xsd:enumeration value="FinalWorkCandidateNumber"/>
+ <xsd:enumeration value="FinancialClassificationCode"/>
+ <xsd:enumeration value="FinancialDetailCode"/>
+ <xsd:enumeration value="FinancialManagementReference"/>
+ <xsd:enumeration value="FinancialPhaseReference"/>
+ <xsd:enumeration value="FinancialSettlementPartysReferenceNumber"/>
+ <xsd:enumeration value="FinancialTransactionReferenceNumber"/>
+ <xsd:enumeration value="FinderNumber"/>
+ <xsd:enumeration value="FineLineClassification"/>
+ <xsd:enumeration value="FinishLotNumber"/>
+ <xsd:enumeration value="FirstTransferNumber"/>
+ <xsd:enumeration value="FiscalCode"/>
+ <xsd:enumeration value="FiscalNumber"/>
+ <xsd:enumeration value="FleetReferenceNumber"/>
+ <xsd:enumeration value="FlexibleSpendingAccountInsuranceAccountNumber"/>
+ <xsd:enumeration value="FlexibleSpendingAccountInsurancePolicyNumber"/>
+ <xsd:enumeration value="FloodDataIdentifier"/>
+ <xsd:enumeration value="FloodZone"/>
+ <xsd:enumeration value="FloorNumber"/>
+ <xsd:enumeration value="FloorPlanApprovalNumber"/>
+ <xsd:enumeration value="FlowReferenceNumber"/>
+ <xsd:enumeration value="FolderNumber"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationAccessionNumber"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationProductCode"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationProductType"/>
+ <xsd:enumeration value="ForeclosingStatus"/>
+ <xsd:enumeration value="ForeclosureAccountNumber"/>
+ <xsd:enumeration value="ForeignExchange"/>
+ <xsd:enumeration value="ForeignExchangeContractNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesCaseNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesNoticeNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesNumber"/>
+ <xsd:enumeration value="ForeignTradeZone"/>
+ <xsd:enumeration value="ForestryPermitNumber"/>
+ <xsd:enumeration value="FormalStatementReference"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FormationIdentifier"/>
+ <xsd:enumeration value="FormNumber"/>
+ <xsd:enumeration value="ForPickupLimitedFreightTariffNumber"/>
+ <xsd:enumeration value="ForwardersOrAgentsReferenceNumber"/>
+ <xsd:enumeration value="ForwardingOrderNumber"/>
+ <xsd:enumeration value="Frame"/>
+ <xsd:enumeration value="FranchiseTaxAccountNumber"/>
+ <xsd:enumeration value="FreddieMacSellerServicerNumber"/>
+ <xsd:enumeration value="FreeZoneIdentifier"/>
+ <xsd:enumeration value="FreightBillNumber"/>
+ <xsd:enumeration value="FreightForwarderNumber"/>
+ <xsd:enumeration value="FreightForwardersReferenceNumber"/>
+ <xsd:enumeration value="FreightPayorReferenceNumber"/>
+ <xsd:enumeration value="FullTimeOrPartTimeEmployeeClassificationQualifier"/>
+ <xsd:enumeration value="FunctionalCategory"/>
+ <xsd:enumeration value="FunctionalWorkGroup"/>
+ <xsd:enumeration value="FundCodeNumber"/>
+ <xsd:enumeration value="FundIdentificationNumber"/>
+ <xsd:enumeration value="FundManagersReferenceNumber"/>
+ <xsd:enumeration value="FundsAuthorization"/>
+ <xsd:enumeration value="GasAnalysisSourceMeterNumber"/>
+ <xsd:enumeration value="GasCustodianIdentification"/>
+ <xsd:enumeration value="GaugeTicketNumber"/>
+ <xsd:enumeration value="GeneralAgencyNumber"/>
+ <xsd:enumeration value="GeneralCargoConsignmentReferenceNumber"/>
+ <xsd:enumeration value="GeneralDeclarationNumber"/>
+ <xsd:enumeration value="GeneralLedgerAccount"/>
+ <xsd:enumeration value="GeneralOrderNumber"/>
+ <xsd:enumeration value="GeneralPurposeMessageReferenceNumber"/>
+ <xsd:enumeration value="GeneralServicesAdministrationRegulations"/>
+ <xsd:enumeration value="GeographicDestinationZoneNumber"/>
+ <xsd:enumeration value="GeographicIndex"/>
+ <xsd:enumeration value="GeographicKey"/>
+ <xsd:enumeration value="GeographicNumber"/>
+ <xsd:enumeration value="GeographicScore"/>
+ <xsd:enumeration value="GinnieMaePoolPackageNumber"/>
+ <xsd:enumeration value="GoodsAndServicesTaxIdentificationNumber"/>
+ <xsd:enumeration value="GoodsandServiceTaxRegistrationNumber"/>
+ <xsd:enumeration value="GoodsDeclarationNumber"/>
+ <xsd:enumeration value="GoverningClassCode"/>
+ <xsd:enumeration value="GovernmentAccountingClassReferenceNumber"/>
+ <xsd:enumeration value="GovernmentAdvanceProgress"/>
+ <xsd:enumeration value="GovernmentAgencyReferenceNumber"/>
+ <xsd:enumeration value="GovernmentBillOfLading"/>
+ <xsd:enumeration value="GovernmentBillofLadingOfficeCode"/>
+ <xsd:enumeration value="GovernmentContractNumber"/>
+ <xsd:enumeration value="GovernmentPriorityNumber"/>
+ <xsd:enumeration value="GovernmentQualityAssuranceAndControlLevelNumber"/>
+ <xsd:enumeration value="GovernmentReferenceNumber"/>
+ <xsd:enumeration value="GovernmentRegistrationNumber"/>
+ <xsd:enumeration value="GovernmentTransportationRequest"/>
+ <xsd:enumeration value="GrainBlockNumber"/>
+ <xsd:enumeration value="GrainOrderReferenceNumber"/>
+ <xsd:enumeration value="GravitySourceMeterNumber"/>
+ <xsd:enumeration value="GreenCard"/>
+ <xsd:enumeration value="GroupAccounting"/>
+ <xsd:enumeration value="GroupNumber"/>
+ <xsd:enumeration value="GroupOrPolicyNumber"/>
+ <xsd:enumeration value="GroupWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="GrowthFactorReference"/>
+ <xsd:enumeration value="GuarantorLoanNumber"/>
+ <xsd:enumeration value="GuarantorUse"/>
+ <xsd:enumeration value="HarmonisedSystemNumber"/>
+ <xsd:enumeration value="HarmonizedCodeSystem"/>
+ <xsd:enumeration value="HasteningNumber"/>
+ <xsd:enumeration value="HazardousCertificationNumber"/>
+ <xsd:enumeration value="HazardousExemptionNumber"/>
+ <xsd:enumeration value="HazardousWasteManifestDocumentNumber"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationNationalPayerIdentificationNumber"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationNationalProviderIdentifier"/>
+ <xsd:enumeration value="HealthcareManpowerShortageAreaFacilityIdentificationNumber"/>
+ <xsd:enumeration value="HealthCertificateNumber"/>
+ <xsd:enumeration value="HIBCCLabelerIdentificationCode"/>
+ <xsd:enumeration value="HealthIndustryNumber"/>
+ <xsd:enumeration value="HealthInsuranceAccountNumber"/>
+ <xsd:enumeration value="HealthInsuranceClaimNumber"/>
+ <xsd:enumeration value="HealthInsurancePolicyNumber"/>
+ <xsd:enumeration value="HealthInsuranceRatingAccountNumber"/>
+ <xsd:enumeration value="HealthInsuranceRatingSuffixCode"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationReferenceNumber"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationCodeNumber"/>
+ <xsd:enumeration value="HeatCode"/>
+ <xsd:enumeration value="HighOrWideFileNumber"/>
+ <xsd:enumeration value="HighFabricationAuthorizationNumber"/>
+ <xsd:enumeration value="HighRawMaterialAuthorizationNumber"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActCensusTract"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActBlockNumberArea"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActCountyCode"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActMetropolitanStatisticalArea"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActStateCode"/>
+ <xsd:enumeration value="HorizontalCoordinate"/>
+ <xsd:enumeration value="Horsepower"/>
+ <xsd:enumeration value="HotRollNumber"/>
+ <xsd:enumeration value="HouseBillOfLadingNumber"/>
+ <xsd:enumeration value="HouseWaybillNumber"/>
+ <xsd:enumeration value="IataCargoAgentCassAddressNumber"/>
+ <xsd:enumeration value="IataCargoAgentCodeNumber"/>
+ <xsd:enumeration value="ICD9CM"/>
+ <xsd:enumeration value="IdentificationCardSerialNumber"/>
+ <xsd:enumeration value="IdentityCardNumber"/>
+ <xsd:enumeration value="ImageIdentifier"/>
+ <xsd:enumeration value="ImmediateExportationNoForInBondMovement"/>
+ <xsd:enumeration value="ImmediateTransportationNoForInBondMovement"/>
+ <xsd:enumeration value="ImplementationVersionNumber"/>
+ <xsd:enumeration value="ImportClearanceInstructionReferenceNumber"/>
+ <xsd:enumeration value="ImporterReferenceNumber"/>
+ <xsd:enumeration value="ImportersReferenceNumberToLetterOfCredit"/>
+ <xsd:enumeration value="ImportLicenceNumber"/>
+ <xsd:enumeration value="ImportPermitNumber"/>
+ <xsd:enumeration value="ImputationAccount"/>
+ <xsd:enumeration value="InBondNumber"/>
+ <xsd:enumeration value="InboundToOrOutboundFromParty"/>
+ <xsd:enumeration value="InboundToParty"/>
+ <xsd:enumeration value="Incident"/>
+ <xsd:enumeration value="IncorporatedLegalReference"/>
+ <xsd:enumeration value="IndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="InitialDealerClaimNumber"/>
+ <xsd:enumeration value="InitialFailureClaim"/>
+ <xsd:enumeration value="InitialSampleInspectionReportNumber"/>
+ <xsd:enumeration value="InitialTroubleIndication"/>
+ <xsd:enumeration value="InlandTransportOrderNumber"/>
+ <xsd:enumeration value="InquiryRequestNumber"/>
+ <xsd:enumeration value="InspectionandSurveySequenceNumber"/>
+ <xsd:enumeration value="InspectionReportNumber"/>
+ <xsd:enumeration value="InspectorIdentificationNumber"/>
+ <xsd:enumeration value="InstituteOfSecurityAndFutureMarketDevelopmentSerialNumber"/>
+ <xsd:enumeration value="InstitutionLoanNumber"/>
+ <xsd:enumeration value="InstitutionNoteHolderIdentification"/>
+ <xsd:enumeration value="InstitutionNumber"/>
+ <xsd:enumeration value="InsuranceCertificateNumber"/>
+ <xsd:enumeration value="InsuranceCertificateReferenceNumber"/>
+ <xsd:enumeration value="InsuranceContractReferenceNumber"/>
+ <xsd:enumeration value="InsuranceLicenseNumber"/>
+ <xsd:enumeration value="InsurancePolicyNumber"/>
+ <xsd:enumeration value="InsuredLocationIdentifier"/>
+ <xsd:enumeration value="InsuredParcelPostNumber"/>
+ <xsd:enumeration value="InsuredsLoanNumber"/>
+ <xsd:enumeration value="InsurerAssignedReferenceNumber"/>
+ <xsd:enumeration value="InsurorPoolIdentificationNumber"/>
+ <xsd:enumeration value="IntegratedLogisticSupportCrossReferenceNumber"/>
+ <xsd:enumeration value="IntegratedMasterPlan"/>
+ <xsd:enumeration value="IntegratedMasterSchedule"/>
+ <xsd:enumeration value="InterchangeAgreementNumber"/>
+ <xsd:enumeration value="InterchangeNumberNew"/>
+ <xsd:enumeration value="InterchangeNumberOld"/>
+ <xsd:enumeration value="InterchangeTrainIdentification"/>
+ <xsd:enumeration value="IntergovernmentalMaritimeOrganizationNumber"/>
+ <xsd:enumeration value="InterimFundingOrganizationLoanNumber"/>
+ <xsd:enumeration value="IntermediaryBroker"/>
+ <xsd:enumeration value="InternalControlNumber"/>
+ <xsd:enumeration value="InternalCustomerNumber"/>
+ <xsd:enumeration value="InternalDataProcessNumber"/>
+ <xsd:enumeration value="InternalOrderNumber"/>
+ <xsd:enumeration value="InternalPurchaseOrderItemNumber"/>
+ <xsd:enumeration value="InternalPurchaseOrderReleaseNumber"/>
+ <xsd:enumeration value="InternalVendorNumber"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumber"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumberChildDataMaintenance"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumberParentDataMaintenance"/>
+ <xsd:enumeration value="InternationalFlightNumber"/>
+ <xsd:enumeration value="InternationalFuelTaxAgreementAccountNumber"/>
+ <xsd:enumeration value="InternationalRegistrationPlanAccountNumber"/>
+ <xsd:enumeration value="InternationalRegistrationPlanStickerNumber"/>
+ <xsd:enumeration value="InternationalStandardIndustrialClassificationDominionOfCanadaCode"/>
+ <xsd:enumeration value="InternationalStandardIndustryClassificationCode"/>
+ <xsd:enumeration value="InterstateCommerceCommissionAccountNumber"/>
+ <xsd:enumeration value="InterviewerID"/>
+ <xsd:enumeration value="IntraPlantRouting"/>
+ <xsd:enumeration value="InventoryReportReferenceNumber"/>
+ <xsd:enumeration value="InvestigatorialNewDrugNumber"/>
+ <xsd:enumeration value="InvestmentReferenceNumber"/>
+ <xsd:enumeration value="Investor"/>
+ <xsd:enumeration value="InvestorAssignedIdentificationNumber"/>
+ <xsd:enumeration value="InvestorLoanNumber"/>
+ <xsd:enumeration value="InvestorNoteHolderIdentification"/>
+ <xsd:enumeration value="InvoiceIdentification"/>
+ <xsd:enumeration value="InvoiceNumber"/>
+ <xsd:enumeration value="InvoiceNumberSuffix"/>
+ <xsd:enumeration value="InvoicingDataSheetReferenceNumber"/>
+ <xsd:enumeration value="IronChargeNumber"/>
+ <xsd:enumeration value="ISFMD"/>
+ <xsd:enumeration value="IssueNumber"/>
+ <xsd:enumeration value="IssuerNumber"/>
+ <xsd:enumeration value="IssuingBanksReference"/>
+ <xsd:enumeration value="ItemNumber"/>
+ <xsd:enumeration value="JobOrProjectNumber"/>
+ <xsd:enumeration value="JobOrderNumber"/>
+ <xsd:enumeration value="JobSequenceNumber"/>
+ <xsd:enumeration value="JointCreditSpecificationNumber"/>
+ <xsd:enumeration value="JointlyAdministeredCase"/>
+ <xsd:enumeration value="JointVentureReferenceNumber"/>
+ <xsd:enumeration value="Judge"/>
+ <xsd:enumeration value="JudgmentNumber"/>
+ <xsd:enumeration value="JudicialDistrict"/>
+ <xsd:enumeration value="JudicialNumber"/>
+ <xsd:enumeration value="JurisdictionalCommunityNameIdentifier"/>
+ <xsd:enumeration value="JurisdictionalCommunityNumber"/>
+ <xsd:enumeration value="LaboratoryNumber"/>
+ <xsd:enumeration value="LaboratoryRegistrationNumber"/>
+ <xsd:enumeration value="LaborOperationNumber"/>
+ <xsd:enumeration value="LabororAffiliationIdentification"/>
+ <xsd:enumeration value="LaneNumber"/>
+ <xsd:enumeration value="LastTransferNumber"/>
+ <xsd:enumeration value="LatitudeExpressedinDegreesMinutesandSeconds"/>
+ <xsd:enumeration value="LatitudeExpressedinSeconds"/>
+ <xsd:enumeration value="LeadCase"/>
+ <xsd:enumeration value="LeaseAgreementAmendmentNumberMaster"/>
+ <xsd:enumeration value="LeaseContractReference"/>
+ <xsd:enumeration value="LeaseNumber"/>
+ <xsd:enumeration value="LeaseRiderNumber"/>
+ <xsd:enumeration value="LeaseScheduleNumber"/>
+ <xsd:enumeration value="LeaseScheduleNumberBlanket"/>
+ <xsd:enumeration value="LeaseScheduleNumberPrior"/>
+ <xsd:enumeration value="LeaseScheduleNumberReplacement"/>
+ <xsd:enumeration value="LenderAccountNumber"/>
+ <xsd:enumeration value="LenderCaseNumber"/>
+ <xsd:enumeration value="LenderEntityNumber"/>
+ <xsd:enumeration value="LenderUse"/>
+ <xsd:enumeration value="LesseeBillCodeNumber"/>
+ <xsd:enumeration value="LesseeIdentification"/>
+ <xsd:enumeration value="LetterofCreditDraftNumber"/>
+ <xsd:enumeration value="LetterOfCreditNumber"/>
+ <xsd:enumeration value="LetterofCreditNumber"/>
+ <xsd:enumeration value="LettersorNotes"/>
+ <xsd:enumeration value="LevyingOfficerIdentification"/>
+ <xsd:enumeration value="LicensePlateNumber"/>
+ <xsd:enumeration value="LifeInsuranceBillingAccountNumber"/>
+ <xsd:enumeration value="LifeInsuranceBillingSuffixCode"/>
+ <xsd:enumeration value="LifeInsurancePolicyNumber"/>
+ <xsd:enumeration value="LimitedPartnershipIdentificationNumber"/>
+ <xsd:enumeration value="LineItemControlNumber"/>
+ <xsd:enumeration value="LineItemIdentifier"/>
+ <xsd:enumeration value="LineItemReferenceNumber"/>
+ <xsd:enumeration value="LineofBusiness"/>
+ <xsd:enumeration value="LineOfCreditCategory"/>
+ <xsd:enumeration value="LinkSequenceNumber"/>
+ <xsd:enumeration value="ListBillNumber"/>
+ <xsd:enumeration value="ListOfMaterials"/>
+ <xsd:enumeration value="LloydsClaimsOfficeReference"/>
+ <xsd:enumeration value="LoadingAuthorizationNumber"/>
+ <xsd:enumeration value="LoadLineCertificate"/>
+ <xsd:enumeration value="LoadPlanningNumber"/>
+ <xsd:enumeration value="LoanAcquisitionNumber"/>
+ <xsd:enumeration value="LoanFeatureCode"/>
+ <xsd:enumeration value="LoanNumber"/>
+ <xsd:enumeration value="LoanProspectorKeyNumber"/>
+ <xsd:enumeration value="LoanRequestNumber"/>
+ <xsd:enumeration value="LoanType"/>
+ <xsd:enumeration value="LocalJurisdiction"/>
+ <xsd:enumeration value="LocallyAssignedControlNumber"/>
+ <xsd:enumeration value="LocalMediaIdentifier"/>
+ <xsd:enumeration value="LocalSchoolCourseNumber"/>
+ <xsd:enumeration value="LocalSchoolDistrictCourseNumber"/>
+ <xsd:enumeration value="LocalStudentIdentificationNumber"/>
+ <xsd:enumeration value="LocationExceptionOrderNumber"/>
+ <xsd:enumeration value="LocationNumber"/>
+ <xsd:enumeration value="LocationonProductCode"/>
+ <xsd:enumeration value="LocationSpecificServicesReferenceNumber"/>
+ <xsd:enumeration value="LocationWithinEquipment"/>
+ <xsd:enumeration value="Lockbox"/>
+ <xsd:enumeration value="Log"/>
+ <xsd:enumeration value="LogicalObservationIdentifierNamesandCodes"/>
+ <xsd:enumeration value="LogisticsSupportDocumentationTypeCode"/>
+ <xsd:enumeration value="LongitudeExpressedInDegreesMinutesandSeconds"/>
+ <xsd:enumeration value="LongitudeExpressedinSeconds"/>
+ <xsd:enumeration value="LongTermDisabilityPolicyNumber"/>
+ <xsd:enumeration value="LossOrEventNumber"/>
+ <xsd:enumeration value="LossReportNumber"/>
+ <xsd:enumeration value="LotNumber"/>
+ <xsd:enumeration value="LowerArticleNumberOfRange"/>
+ <xsd:enumeration value="MagazineCode"/>
+ <xsd:enumeration value="Mailbox"/>
+ <xsd:enumeration value="MailingReferenceNumber"/>
+ <xsd:enumeration value="MailSlot"/>
+ <xsd:enumeration value="MaintenanceAvailabilityType"/>
+ <xsd:enumeration value="MaintenanceRequestNumber"/>
+ <xsd:enumeration value="MajorForceProgramNumber"/>
+ <xsd:enumeration value="MajorSystemAffectedCode"/>
+ <xsd:enumeration value="MakegoodCommercialLineNumber"/>
+ <xsd:enumeration value="MammographyCertificationNumber"/>
+ <xsd:enumeration value="ManagedCareOrganizationCode"/>
+ <xsd:enumeration value="ManagedCareOrganizationIdentificationNumber"/>
+ <xsd:enumeration value="ManifestKeyNumber"/>
+ <xsd:enumeration value="ManualProcessingAuthorityNumber"/>
+ <xsd:enumeration value="ManufacturerDefinedRepairRatesReference"/>
+ <xsd:enumeration value="ManufacturerNumber"/>
+ <xsd:enumeration value="ManufacturersMaterialSafetyDataSheetNumber"/>
+ <xsd:enumeration value="ManufacturersPartNumber"/>
+ <xsd:enumeration value="ManufacturingDirectiveNumber"/>
+ <xsd:enumeration value="ManufacturingOperationNumber"/>
+ <xsd:enumeration value="ManufacturingOrderNumber"/>
+ <xsd:enumeration value="MapNumber"/>
+ <xsd:enumeration value="MapReference"/>
+ <xsd:enumeration value="MaritimeDeclarationofHealth"/>
+ <xsd:enumeration value="MarketArea"/>
+ <xsd:enumeration value="MarkingOrLabelReference"/>
+ <xsd:enumeration value="MasterAccountNumber"/>
+ <xsd:enumeration value="MasterAirWaybillNumber"/>
+ <xsd:enumeration value="MasterBillOfLadingNumber"/>
+ <xsd:enumeration value="MasterContract"/>
+ <xsd:enumeration value="MasterLabelNumber"/>
+ <xsd:enumeration value="MasterLeaseAgreementNumber"/>
+ <xsd:enumeration value="MasterPolicyNumber"/>
+ <xsd:enumeration value="MasterPropertyNumber"/>
+ <xsd:enumeration value="MasterReferenceNumber"/>
+ <xsd:enumeration value="MasterSolicitationProceduresTermsAndConditionsNumber"/>
+ <xsd:enumeration value="MaterialChangeNoticeNumber"/>
+ <xsd:enumeration value="MaterialStorageLocation"/>
+ <xsd:enumeration value="MaturedCertificateOfDeposit"/>
+ <xsd:enumeration value="MeatProcessingEstablishmentRegistrationNumber"/>
+ <xsd:enumeration value="MedicaidProviderNumber"/>
+ <xsd:enumeration value="MedicaidRecipientIdentificationNumber"/>
+ <xsd:enumeration value="MedicalAssistanceCategory"/>
+ <xsd:enumeration value="MedicalRecordIdentificationNumber"/>
+ <xsd:enumeration value="MedicareProviderNumber"/>
+ <xsd:enumeration value="MedicareVersionCode"/>
+ <xsd:enumeration value="MemberIdentificationNumber"/>
+ <xsd:enumeration value="MemberNumber"/>
+ <xsd:enumeration value="MerchandiseTypeCode"/>
+ <xsd:enumeration value="MerchantCategoryCode"/>
+ <xsd:enumeration value="MessageAddressorID"/>
+ <xsd:enumeration value="MessageBatchNumber"/>
+ <xsd:enumeration value="MessageDesignGroupNumber"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageSender"/>
+ <xsd:enumeration value="MeterNumber"/>
+ <xsd:enumeration value="MeterProvingReportNumber"/>
+ <xsd:enumeration value="MeterReadingAtTheBeginningOfTheDelivery"/>
+ <xsd:enumeration value="MeterReadingAtTheEndOfDelivery"/>
+ <xsd:enumeration value="MeterTicketNumber"/>
+ <xsd:enumeration value="MeterUnitNumber"/>
+ <xsd:enumeration value="MICRNumber"/>
+ <xsd:enumeration value="MicrofilmNumber"/>
+ <xsd:enumeration value="MigrantNumber"/>
+ <xsd:enumeration value="Milestone"/>
+ <xsd:enumeration value="MilitaryCallNumber"/>
+ <xsd:enumeration value="MilitaryID"/>
+ <xsd:enumeration value="MilitaryInterdepartmentalPurchaseRequestNumber"/>
+ <xsd:enumeration value="MilitaryOrdnanceSecurityRiskNumber"/>
+ <xsd:enumeration value="MilitaryRankOrCivilianPayGradeNumber"/>
+ <xsd:enumeration value="MilitarySpecificationNumber"/>
+ <xsd:enumeration value="MilitaryStandardNumber"/>
+ <xsd:enumeration value="MillinginTransit"/>
+ <xsd:enumeration value="MillOrderNumber"/>
+ <xsd:enumeration value="MinimumRoyaltyPayorIdentification"/>
+ <xsd:enumeration value="MinisterialCertificateOfHomologation"/>
+ <xsd:enumeration value="Model"/>
+ <xsd:enumeration value="ModelNumber"/>
+ <xsd:enumeration value="Modelyearnumber"/>
+ <xsd:enumeration value="MORNETPlusCaseNumber"/>
+ <xsd:enumeration value="MORNETPlusInstitutionNumber"/>
+ <xsd:enumeration value="MORNETPlusUserIdentification"/>
+ <xsd:enumeration value="MortgageBackedSecurityLoanNumber"/>
+ <xsd:enumeration value="MortgageBackedSecurityPoolNumber"/>
+ <xsd:enumeration value="MortgageElectronicRegistrationSystemOrganizationIdentifier"/>
+ <xsd:enumeration value="MortgageeLoanNumber"/>
+ <xsd:enumeration value="MortgageIdentificationNumber"/>
+ <xsd:enumeration value="MortgageInsuranceCompanyNumber"/>
+ <xsd:enumeration value="MortgageInsuranceIndicatorNumber"/>
+ <xsd:enumeration value="MortgageNumber"/>
+ <xsd:enumeration value="MotorCarrierIdentificationNumber"/>
+ <xsd:enumeration value="MotorFuelCertificateNumber"/>
+ <xsd:enumeration value="MotorVehicleIDNumber"/>
+ <xsd:enumeration value="MultifamilyProjectNumber"/>
+ <xsd:enumeration value="MultipleListingNumber"/>
+ <xsd:enumeration value="MultipleListingServiceArea"/>
+ <xsd:enumeration value="MultipleListingServiceBookType"/>
+ <xsd:enumeration value="MultipleListingServiceMapXCoordinate"/>
+ <xsd:enumeration value="MultipleListingServiceMapYCoordinate"/>
+ <xsd:enumeration value="MultipleListingServiceSubArea"/>
+ <xsd:enumeration value="MultiplePOOfAnInvoice"/>
+ <xsd:enumeration value="MultipleZoneOrderNumber"/>
+ <xsd:enumeration value="MunicipalityAssignedBusinessRegistryNumber"/>
+ <xsd:enumeration value="NACE"/>
+ <xsd:enumeration value="NAF"/>
+ <xsd:enumeration value="NamedBanksReference"/>
+ <xsd:enumeration value="NationalAeronauticsandSpaceAdministrationFARSupplement"/>
+ <xsd:enumeration value="NationalAssociationOfBoardsOfPharmacyNumber"/>
+ <xsd:enumeration value="NationalAssociationOfInsuranceCommissionersCode"/>
+ <xsd:enumeration value="NationalBusinessIdentificationNumber"/>
+ <xsd:enumeration value="NationalCriminalInformationCenterOriginatingAgencyIdentification"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCommunityName"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCommunityNumber"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCounty"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramMapNumber"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramState"/>
+ <xsd:enumeration value="NationalGovernmentBusinessIdentificationNumber"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel1"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel2"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel3"/>
+ <xsd:enumeration value="NationalStockNumber"/>
+ <xsd:enumeration value="NaturalGasPolicyActCategoryCode"/>
+ <xsd:enumeration value="NewDrugApplicationNumber"/>
+ <xsd:enumeration value="NewHealthInsuranceClaimNumber"/>
+ <xsd:enumeration value="NewPartNumber"/>
+ <xsd:enumeration value="NextRentalAgreementNumber"/>
+ <xsd:enumeration value="NextRentalAgreementReasonNumber"/>
+ <xsd:enumeration value="NextShipmentIdentificationNumberContinuousMove"/>
+ <xsd:enumeration value="NIT"/>
+ <xsd:enumeration value="NominationNumber"/>
+ <xsd:enumeration value="NonAmericanIdentificationNumber"/>
+ <xsd:enumeration value="NonConformanceReportNumber"/>
+ <xsd:enumeration value="NonNegotiableMaritimeTransportDocumentNumber"/>
+ <xsd:enumeration value="NonOriginatingThirdPartyNumber"/>
+ <xsd:enumeration value="NonPickupLimitedTariffNumber"/>
+ <xsd:enumeration value="NonProvisionalPatentApplicationNumber"/>
+ <xsd:enumeration value="NonSpouseTie"/>
+ <xsd:enumeration value="NoOT5AuthorityZeroMileageRate"/>
+ <xsd:enumeration value="NorthAmericanDatumStandard"/>
+ <xsd:enumeration value="NorthAmericanFreeTradeAgreementComplianceNumber"/>
+ <xsd:enumeration value="NorthAmericanHazardousClassificationNumber"/>
+ <xsd:enumeration value="NorthAmericanHazardousGoodsClassificationNumber"/>
+ <xsd:enumeration value="NorthAmericanIndustrialClassificationSystemCode"/>
+ <xsd:enumeration value="NOTICOL"/>
+ <xsd:enumeration value="NumberOfTemporaryImportationDocument"/>
+ <xsd:enumeration value="NumerodeCeduladeIdentidadNumber"/>
+ <xsd:enumeration value="NumerodeIdentificacionTributaria"/>
+ <xsd:enumeration value="ObjectIdentifier"/>
+ <xsd:enumeration value="OccupationalSafetyandHealthAdministrationClaimNumber"/>
+ <xsd:enumeration value="OccupationClassificationCode"/>
+ <xsd:enumeration value="OccupationCode"/>
+ <xsd:enumeration value="OceanBillofLading"/>
+ <xsd:enumeration value="OceanContainerNumber"/>
+ <xsd:enumeration value="OceanManifest"/>
+ <xsd:enumeration value="OffenderTracking"/>
+ <xsd:enumeration value="OffenseTracking"/>
+ <xsd:enumeration value="OfferGroup"/>
+ <xsd:enumeration value="OfferNumber"/>
+ <xsd:enumeration value="OfficeNumber"/>
+ <xsd:enumeration value="OfficerLicenseNumber"/>
+ <xsd:enumeration value="OfficeSymbol"/>
+ <xsd:enumeration value="OldAccountNumber"/>
+ <xsd:enumeration value="OldMeterNumber"/>
+ <xsd:enumeration value="OldPartNumber"/>
+ <xsd:enumeration value="OneCallAgencyTicketNumber"/>
+ <xsd:enumeration value="OnlineProcurementandAccountingControlTransaction"/>
+ <xsd:enumeration value="OpenandPrepaidStationListNumber"/>
+ <xsd:enumeration value="OperationNumber"/>
+ <xsd:enumeration value="OperatorAssignedUnitNumber"/>
+ <xsd:enumeration value="OperatorIdentificationNumber"/>
+ <xsd:enumeration value="OperatorLeaseNumber"/>
+ <xsd:enumeration value="OptionPolicyNumber"/>
+ <xsd:enumeration value="OrderOrParagraphNumber"/>
+ <xsd:enumeration value="OrderingCustomerConsignmentReferenceNumber"/>
+ <xsd:enumeration value="OrderingCustomersSecondReferenceNumber"/>
+ <xsd:enumeration value="OrderNumber"/>
+ <xsd:enumeration value="PurchaseOrderNumber"/>
+ <xsd:enumeration value="VendorOrderNumber"/>
+ <xsd:enumeration value="OrganizationBreakdownStructure"/>
+ <xsd:enumeration value="OriginalCertificateNumber"/>
+ <xsd:enumeration value="OriginalFdoTransactionReference"/>
+ <xsd:enumeration value="OriginalFiling"/>
+ <xsd:enumeration value="OriginalFilingNumber"/>
+ <xsd:enumeration value="OriginalInvoiceNumber"/>
+ <xsd:enumeration value="OriginalPurchaseOrder"/>
+ <xsd:enumeration value="OriginalReferenceNumber"/>
+ <xsd:enumeration value="OriginalReturnRequestReferenceNumber"/>
+ <xsd:enumeration value="OriginalShippersBillOfLadingNumber"/>
+ <xsd:enumeration value="OriginalSubmitterChildDataMaintenanceRequestLog"/>
+ <xsd:enumeration value="OriginalSubmitterLogNumber"/>
+ <xsd:enumeration value="OriginalSubmitterParentDataMaintenanceRequest"/>
+ <xsd:enumeration value="OriginalUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="OriginalVoucherNumber"/>
+ <xsd:enumeration value="OriginatingCase"/>
+ <xsd:enumeration value="OriginatingCompanyIdentifier"/>
+ <xsd:enumeration value="OriginatingDepositoryFinancialInstitutionIdentifier"/>
+ <xsd:enumeration value="OriginatorsReference"/>
+ <xsd:enumeration value="OriginHouse"/>
+ <xsd:enumeration value="OriginOfShipmentHarmonizedBasedCode"/>
+ <xsd:enumeration value="OT5AuthorityConditionOrRestrictiononCarHireRate"/>
+ <xsd:enumeration value="OtherUnlistedTypeOfReferenceNumber"/>
+ <xsd:enumeration value="OutboundFromParty"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaCode"/>
+ <xsd:enumeration value="OuterContinentalShelfBlockNumber"/>
+ <xsd:enumeration value="OuterpackagingUnitIdentification"/>
+ <xsd:enumeration value="OutletNumber"/>
+ <xsd:enumeration value="OutofServiceNumber"/>
+ <xsd:enumeration value="OwningBureauIdentificationNumber"/>
+ <xsd:enumeration value="PackAndHoldInvoiceNumber"/>
+ <xsd:enumeration value="PackageNumber"/>
+ <xsd:enumeration value="PackagingGroupNumber"/>
+ <xsd:enumeration value="PackagingSpecificationNumber"/>
+ <xsd:enumeration value="PackagingUnitIdentification"/>
+ <xsd:enumeration value="PackerNumber"/>
+ <xsd:enumeration value="Packet"/>
+ <xsd:enumeration value="PackingGroupCode"/>
+ <xsd:enumeration value="PackingListNumber"/>
+ <xsd:enumeration value="PackingPlantNumber"/>
+ <xsd:enumeration value="PageNumber"/>
+ <xsd:enumeration value="Paragraph"/>
+ <xsd:enumeration value="ParagraphNumber"/>
+ <xsd:enumeration value="ParamedicalIDNumber"/>
+ <xsd:enumeration value="ParentFile"/>
+ <xsd:enumeration value="PartCausingRepairNumber"/>
+ <xsd:enumeration value="PartConsignmentNumber"/>
+ <xsd:enumeration value="PartialPaymentNumber"/>
+ <xsd:enumeration value="ParticipatingArea"/>
+ <xsd:enumeration value="PartInterchangeability"/>
+ <xsd:enumeration value="PartNumber"/>
+ <xsd:enumeration value="PartReferenceIndicatorInADrawing"/>
+ <xsd:enumeration value="PartyInformationMessageReference"/>
+ <xsd:enumeration value="PartySequenceNumber"/>
+ <xsd:enumeration value="Passport"/>
+ <xsd:enumeration value="PassportNumber"/>
+ <xsd:enumeration value="PatentCooperationTreatyApplicationNumber"/>
+ <xsd:enumeration value="PatentNumber"/>
+ <xsd:enumeration value="PatentType"/>
+ <xsd:enumeration value="PatientAccountNumber"/>
+ <xsd:enumeration value="PatronNumber"/>
+ <xsd:enumeration value="PayeeIdentification"/>
+ <xsd:enumeration value="PayeeLoanNumber"/>
+ <xsd:enumeration value="PayeesFinancialInstitutionAccountNumber"/>
+ <xsd:enumeration value="PayeesFinancialInstitutionTransitRoutingNo"/>
+ <xsd:enumeration value="PayeesReferenceNumber"/>
+ <xsd:enumeration value="PayerAssignedResubmissionReferenceNumber"/>
+ <xsd:enumeration value="PayerCategory"/>
+ <xsd:enumeration value="PayerIdentificationNumber"/>
+ <xsd:enumeration value="PayersFinancialInstitutionAccountNumber"/>
+ <xsd:enumeration value="PayersFinancialInstitutionTransitRoutingNo"/>
+ <xsd:enumeration value="PayersReferenceNumber"/>
+ <xsd:enumeration value="PayGrade"/>
+ <xsd:enumeration value="PaymentCategory"/>
+ <xsd:enumeration value="PaymentHistoryReferenceNumber"/>
+ <xsd:enumeration value="PaymentInAdvanceRequestReference"/>
+ <xsd:enumeration value="PaymentInstalmentReferenceNumber"/>
+ <xsd:enumeration value="PaymentLocation"/>
+ <xsd:enumeration value="PaymentOrderNumber"/>
+ <xsd:enumeration value="PaymentPlanReference"/>
+ <xsd:enumeration value="PaymentReference"/>
+ <xsd:enumeration value="PaymentValuationNumber"/>
+ <xsd:enumeration value="PayorsClaimNumber"/>
+ <xsd:enumeration value="PayrollAccountNumber"/>
+ <xsd:enumeration value="PayrollNumber"/>
+ <xsd:enumeration value="PcsCatastrophe"/>
+ <xsd:enumeration value="PeerReviewOrganizationApprovalNumber"/>
+ <xsd:enumeration value="PendingCase"/>
+ <xsd:enumeration value="PensionContract"/>
+ <xsd:enumeration value="PeriodicityCode"/>
+ <xsd:enumeration value="PermitNumber"/>
+ <xsd:enumeration value="PersonalIdentificationNumber"/>
+ <xsd:enumeration value="PersonalIdentityCardNumber"/>
+ <xsd:enumeration value="PersonalIDNumber"/>
+ <xsd:enumeration value="PetroleumPoolCode"/>
+ <xsd:enumeration value="PharmacyPrescriptionNumber"/>
+ <xsd:enumeration value="PhoneCalls"/>
+ <xsd:enumeration value="PhysicalInventoryRecountReferenceNumber"/>
+ <xsd:enumeration value="PickupReferenceNumber"/>
+ <xsd:enumeration value="PictureNumber"/>
+ <xsd:enumeration value="PictureOfActualProduct"/>
+ <xsd:enumeration value="PictureOfAGenericProduct"/>
+ <xsd:enumeration value="PierNumber"/>
+ <xsd:enumeration value="Piggyback"/>
+ <xsd:enumeration value="PilotLicenseNumber"/>
+ <xsd:enumeration value="PipelineNumber"/>
+ <xsd:enumeration value="PlanNetworkIdentificationNumber"/>
+ <xsd:enumeration value="PlanningPackage"/>
+ <xsd:enumeration value="PlanNumber"/>
+ <xsd:enumeration value="PlantNumber"/>
+ <xsd:enumeration value="PlateNumber"/>
+ <xsd:enumeration value="PlatformIdentificationNumber"/>
+ <xsd:enumeration value="PlotFile"/>
+ <xsd:enumeration value="PlugNumber"/>
+ <xsd:enumeration value="PolicyFormNumber"/>
+ <xsd:enumeration value="PolicyLinkNumber"/>
+ <xsd:enumeration value="PolicyNumber"/>
+ <xsd:enumeration value="PolicyType"/>
+ <xsd:enumeration value="Pollutant"/>
+ <xsd:enumeration value="PoolContractCode"/>
+ <xsd:enumeration value="PoolNumber"/>
+ <xsd:enumeration value="PoolSuffix"/>
+ <xsd:enumeration value="PositionCode"/>
+ <xsd:enumeration value="PostEntryReference"/>
+ <xsd:enumeration value="PreAwardSurvey"/>
+ <xsd:enumeration value="PrecinctNumber"/>
+ <xsd:enumeration value="PredecessorAccount"/>
+ <xsd:enumeration value="PredeterminationofBenefitsIdentificationNumber"/>
+ <xsd:enumeration value="PreferredCallSign"/>
+ <xsd:enumeration value="PreferredProviderOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="PreferredProviderOrganizationNumber"/>
+ <xsd:enumeration value="PreferredProviderOrganizationSiteNumber"/>
+ <xsd:enumeration value="PreliminaryWorkCandidateNumber"/>
+ <xsd:enumeration value="PremarketApplicationNumber"/>
+ <xsd:enumeration value="PremarketNotificationNumber"/>
+ <xsd:enumeration value="PremiumAuditPriorityIdentifier"/>
+ <xsd:enumeration value="PremiumAuditPurposeIdentifier"/>
+ <xsd:enumeration value="PremiumAuditTypeIdentifier"/>
+ <xsd:enumeration value="PremiumRateTable"/>
+ <xsd:enumeration value="PreparersVerificationNumber"/>
+ <xsd:enumeration value="PresentingBanksReference"/>
+ <xsd:enumeration value="PressFormIdentifier"/>
+ <xsd:enumeration value="PressIdentifier"/>
+ <xsd:enumeration value="PreviousBillofLadingNumber"/>
+ <xsd:enumeration value="PreviousCargoControlNumber"/>
+ <xsd:enumeration value="PreviousClaimHistoryIdentifier"/>
+ <xsd:enumeration value="PreviousContractNumber"/>
+ <xsd:enumeration value="PreviousCourseNumber"/>
+ <xsd:enumeration value="PreviousCreditOrDebitAdjustmentNumber"/>
+ <xsd:enumeration value="PreviousCreditAdviceReferenceNumber"/>
+ <xsd:enumeration value="PreviousCustomerReferenceNumber"/>
+ <xsd:enumeration value="PreviousDeliveryInstructionNumber"/>
+ <xsd:enumeration value="PreviousDeliveryScheduleNumber"/>
+ <xsd:enumeration value="PreviousDistributorNumber"/>
+ <xsd:enumeration value="PreviousDriversLicense"/>
+ <xsd:enumeration value="PreviousDrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="PreviousHighestScheduleNumber"/>
+ <xsd:enumeration value="PreviousInvoiceNumber"/>
+ <xsd:enumeration value="PreviouslyReportedSocialSecurityNumber"/>
+ <xsd:enumeration value="PreviousMemberNumber"/>
+ <xsd:enumeration value="PreviousPolicyNumber"/>
+ <xsd:enumeration value="PreviousRentalAgreementNumber"/>
+ <xsd:enumeration value="PreviousReportNumber"/>
+ <xsd:enumeration value="PreviousRequestForMeteredReadingReferenceNumber"/>
+ <xsd:enumeration value="PreviousSchemeOrPlanNumber"/>
+ <xsd:enumeration value="PreviousSequence"/>
+ <xsd:enumeration value="PreviousShipmentIdentificationNumberContinuousMove"/>
+ <xsd:enumeration value="PreviousTaxControlNumber"/>
+ <xsd:enumeration value="PreviousTicketNumber"/>
+ <xsd:enumeration value="PriceOrSalesCatalogueResponseReferenceNumber"/>
+ <xsd:enumeration value="PriceAreaNumber"/>
+ <xsd:enumeration value="PriceListChangeorIssueNumber"/>
+ <xsd:enumeration value="PriceListNumber"/>
+ <xsd:enumeration value="PriceListVersionNumber"/>
+ <xsd:enumeration value="PriceQuoteNumber"/>
+ <xsd:enumeration value="PriceVariationFormulaReferenceNumber"/>
+ <xsd:enumeration value="PrimaryReference"/>
+ <xsd:enumeration value="PrimeContractorContractNumber"/>
+ <xsd:enumeration value="PrincipalReferenceNumber"/>
+ <xsd:enumeration value="PrincipalsBankReference"/>
+ <xsd:enumeration value="PrincipalsReference"/>
+ <xsd:enumeration value="PriorAuthorizationNumber"/>
+ <xsd:enumeration value="PriorCase"/>
+ <xsd:enumeration value="PriorCertificateNumber"/>
+ <xsd:enumeration value="PriorContractNumber"/>
+ <xsd:enumeration value="PriorDataUniversalNumberSystemNumber"/>
+ <xsd:enumeration value="PriorHealthIndustryNumber"/>
+ <xsd:enumeration value="PriorIdentifierNumber"/>
+ <xsd:enumeration value="PriorIncorrectBatchNumber"/>
+ <xsd:enumeration value="PriorIncorrectSocialSecurityNumber"/>
+ <xsd:enumeration value="PriorityRating"/>
+ <xsd:enumeration value="PriorLoanNumber"/>
+ <xsd:enumeration value="PriorPhoneNumber"/>
+ <xsd:enumeration value="PriorPolicyNumber"/>
+ <xsd:enumeration value="PriorPostalZipCode"/>
+ <xsd:enumeration value="PriorPurchaseOrderNumber"/>
+ <xsd:enumeration value="Priorpurchaseordernumber"/>
+ <xsd:enumeration value="PriorTaxIdentificationNumber"/>
+ <xsd:enumeration value="PriorTradingPartnerIdentificationNumber"/>
+ <xsd:enumeration value="PriorUniversalProviderIdentificationNumber"/>
+ <xsd:enumeration value="Proceeding"/>
+ <xsd:enumeration value="ProcessHandlingCode"/>
+ <xsd:enumeration value="ProcessingArea"/>
+ <xsd:enumeration value="ProcessingPlantNumber"/>
+ <xsd:enumeration value="ProcessorIdentificationNumber"/>
+ <xsd:enumeration value="ProcessorsInvoiceNumber"/>
+ <xsd:enumeration value="ProcurementBudgetNumber"/>
+ <xsd:enumeration value="ProcurementRequestNumber"/>
+ <xsd:enumeration value="ProcuringAgency"/>
+ <xsd:enumeration value="ProductChangeAuthorityNumber"/>
+ <xsd:enumeration value="ProductChangeInformationNumber"/>
+ <xsd:enumeration value="ProductChangeNoticeNumber"/>
+ <xsd:enumeration value="ProductGroup"/>
+ <xsd:enumeration value="ProductionCode"/>
+ <xsd:enumeration value="ProductLicensingAgreementNumber"/>
+ <xsd:enumeration value="ProductLineNumber"/>
+ <xsd:enumeration value="ProductNumber"/>
+ <xsd:enumeration value="ProductPeriodForWhichLaborCostsAreFirm"/>
+ <xsd:enumeration value="ProductReservationNumber"/>
+ <xsd:enumeration value="ProductSourcingAgreementNumber"/>
+ <xsd:enumeration value="ProductSpecificationDocumentNumber"/>
+ <xsd:enumeration value="ProductType"/>
+ <xsd:enumeration value="ProfileNumber"/>
+ <xsd:enumeration value="ProformaInvoiceNumber"/>
+ <xsd:enumeration value="ProgramIdentificationNumber"/>
+ <xsd:enumeration value="ProgressPaymentNumber"/>
+ <xsd:enumeration value="ProjectCode"/>
+ <xsd:enumeration value="ProjectNumber"/>
+ <xsd:enumeration value="ProjectParagraphNumber"/>
+ <xsd:enumeration value="ProjectPropertyNumber"/>
+ <xsd:enumeration value="ProjectSpecificationNumber"/>
+ <xsd:enumeration value="PromotionOrDealNumber"/>
+ <xsd:enumeration value="ProofOfDeliveryReferenceNumber"/>
+ <xsd:enumeration value="PropertyComponentLocation"/>
+ <xsd:enumeration value="PropertyControlNumber"/>
+ <xsd:enumeration value="PropertyLossItemNumber"/>
+ <xsd:enumeration value="ProposalNumber"/>
+ <xsd:enumeration value="ProposalParagraphNumber"/>
+ <xsd:enumeration value="ProposedContractNumber"/>
+ <xsd:enumeration value="ProposedGroupWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="ProposedSequenceNumber"/>
+ <xsd:enumeration value="ProposedWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="ProtocolNumber"/>
+ <xsd:enumeration value="ProtractionNumber"/>
+ <xsd:enumeration value="ProviderClaimNumber"/>
+ <xsd:enumeration value="ProviderCommercialNumber"/>
+ <xsd:enumeration value="ProviderControlNumber"/>
+ <xsd:enumeration value="ProviderOrderTicketNumber"/>
+ <xsd:enumeration value="ProviderPlanNetworkIdentificationNumber"/>
+ <xsd:enumeration value="ProviderSiteNumber"/>
+ <xsd:enumeration value="ProviderUPINNumber"/>
+ <xsd:enumeration value="ProvincialCanadianSalesTaxExemptionNumber"/>
+ <xsd:enumeration value="ProvincialTaxIdentification"/>
+ <xsd:enumeration value="ProvisionalPatentApplicationNumber"/>
+ <xsd:enumeration value="PublicationIssueNumber"/>
+ <xsd:enumeration value="PublicDeedNumber"/>
+ <xsd:enumeration value="PublicFilingRegistrationNumber"/>
+ <xsd:enumeration value="PublicUtilitiesCommissionCertificateOfPublicConvenience"/>
+ <xsd:enumeration value="PurchaseDescription"/>
+ <xsd:enumeration value="PurchaseOptionAgreement"/>
+ <xsd:enumeration value="PurchaseOrderChangeNumber"/>
+ <xsd:enumeration value="PurchaseOrderLineItemIdentifierBuyer"/>
+ <xsd:enumeration value="PurchaseOrderNumberIncludedinOnOrderPosition"/>
+ <xsd:enumeration value="PurchaseOrderNumberOfOrderReceivedSinceLastReportingDate"/>
+ <xsd:enumeration value="PurchaseOrderNumberOfShipmentReceivedSinceLastReportingDate"/>
+ <xsd:enumeration value="PurchaseOrderNumberSuffix"/>
+ <xsd:enumeration value="PurchaseOrderResponseNumber"/>
+ <xsd:enumeration value="PurchaseOrderRevisionNumber"/>
+ <xsd:enumeration value="PurchaseRequisitionNumber"/>
+ <xsd:enumeration value="PurchasersRequestReference"/>
+ <xsd:enumeration value="PurchasingActivityClauseNumber"/>
+ <xsd:enumeration value="QualifiedMaterialsList"/>
+ <xsd:enumeration value="QualifiedProductsList"/>
+ <xsd:enumeration value="QualityClause"/>
+ <xsd:enumeration value="QualityDispositionAreaIdentifier"/>
+ <xsd:enumeration value="QualityInspectionAreaIdentifier"/>
+ <xsd:enumeration value="QualityReportNumber"/>
+ <xsd:enumeration value="QualityReviewMaterialCribIdentifier"/>
+ <xsd:enumeration value="QuantityValuationNumber"/>
+ <xsd:enumeration value="QuantityValuationRequestNumber"/>
+ <xsd:enumeration value="QuarantineOrTreatmentStatusReferenceNumber"/>
+ <xsd:enumeration value="QuarterQuarterSectionNumber"/>
+ <xsd:enumeration value="QuarterQuarterSpotNumber"/>
+ <xsd:enumeration value="QuestionNumber"/>
+ <xsd:enumeration value="QuotaNumber"/>
+ <xsd:enumeration value="QuoteOrShoppingCartID"/>
+ <xsd:enumeration value="RackTypeNumber"/>
+ <xsd:enumeration value="RailOrRoadRoutingCode"/>
+ <xsd:enumeration value="RailroadCommissionOilNumber"/>
+ <xsd:enumeration value="RailroadCommissionRecordNumber"/>
+ <xsd:enumeration value="RailRoutingCode"/>
+ <xsd:enumeration value="RailWayBillNumber"/>
+ <xsd:enumeration value="RailwayConsignmentNoteNumber"/>
+ <xsd:enumeration value="RailwayWagonNumber"/>
+ <xsd:enumeration value="RangeNumber"/>
+ <xsd:enumeration value="RateCardNumber"/>
+ <xsd:enumeration value="RateCodeNumber"/>
+ <xsd:enumeration value="RateConferenceIDCode"/>
+ <xsd:enumeration value="RateNoteNumber"/>
+ <xsd:enumeration value="RatingPeriod"/>
+ <xsd:enumeration value="RawmaterialSupplierDunAndBradstreetNumber"/>
+ <xsd:enumeration value="RealEstateOwnedPropertyIdentifier"/>
+ <xsd:enumeration value="ReasonForChange"/>
+ <xsd:enumeration value="ReasonNotLowestCostCode"/>
+ <xsd:enumeration value="RebateNumber"/>
+ <xsd:enumeration value="RecallNumber"/>
+ <xsd:enumeration value="ReceiptNumber"/>
+ <xsd:enumeration value="ReceivedNumber"/>
+ <xsd:enumeration value="ReceiverAssignedDropZone"/>
+ <xsd:enumeration value="ReceiverClaimNumber"/>
+ <xsd:enumeration value="ReceiverIdentificationNumber"/>
+ <xsd:enumeration value="ReceiverIDQualifier"/>
+ <xsd:enumeration value="ReceiversFileReferenceNumber"/>
+ <xsd:enumeration value="ReceiverSubIdentificationNumber"/>
+ <xsd:enumeration value="ReceivingAdviceNumber"/>
+ <xsd:enumeration value="ReceivingBanksAuthorizationNumber"/>
+ <xsd:enumeration value="ReceivingCompanyIdentifier"/>
+ <xsd:enumeration value="ReceivingDepositoryFinancialInstitutionIdentifier"/>
+ <xsd:enumeration value="ReceivingNumber"/>
+ <xsd:enumeration value="ReceivingPartysMemberIdentification"/>
+ <xsd:enumeration value="ReconciliationReportSectionIdentificationCode"/>
+ <xsd:enumeration value="RecordingNumber"/>
+ <xsd:enumeration value="ReducedEarningWeekIdentifier"/>
+ <xsd:enumeration value="ReelNumber"/>
+ <xsd:enumeration value="ReferencedBy"/>
+ <xsd:enumeration value="ReferencedPatternIdentification"/>
+ <xsd:enumeration value="ReferenceDrawingNumber"/>
+ <xsd:enumeration value="ReferenceNumberAssignedByThirdParty"/>
+ <xsd:enumeration value="ReferenceNumberOfARequestForMeteredReading"/>
+ <xsd:enumeration value="ReferenceNumberQuotedOnStatement"/>
+ <xsd:enumeration value="ReferenceNumberToPreviousMessage"/>
+ <xsd:enumeration value="ReferenceVersionNumber"/>
+ <xsd:enumeration value="ReferralNumber"/>
+ <xsd:enumeration value="ReferredProductForChemicalAnalysis"/>
+ <xsd:enumeration value="ReferredProductForMechanicalAnalysis"/>
+ <xsd:enumeration value="RefinerIdentification"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegionalAccountNumber"/>
+ <xsd:enumeration value="RegiristoFederalDeContribuyentes"/>
+ <xsd:enumeration value="RegiristoFederaldeContribuyentes"/>
+ <xsd:enumeration value="RegisteredCapitalReference"/>
+ <xsd:enumeration value="RegisteredContractorActivityType"/>
+ <xsd:enumeration value="RegisteredMailNumber"/>
+ <xsd:enumeration value="RegistrationNumber"/>
+ <xsd:enumeration value="RegistrationNumberOfPreviousCustomsDeclaration"/>
+ <xsd:enumeration value="RegistroInformacionFiscal"/>
+ <xsd:enumeration value="RegistroNacionaldeContribuyente"/>
+ <xsd:enumeration value="RegistroUnicodeContribuyente"/>
+ <xsd:enumeration value="RegulationPrimaryNumber"/>
+ <xsd:enumeration value="RegulationSecondaryNumber"/>
+ <xsd:enumeration value="RegulatoryGuidelineIdentifier"/>
+ <xsd:enumeration value="ReinsuranceReference"/>
+ <xsd:enumeration value="ReinsurersClaimNumber"/>
+ <xsd:enumeration value="ReissueCessionNumber"/>
+ <xsd:enumeration value="RejectionNumber"/>
+ <xsd:enumeration value="RelatedCase"/>
+ <xsd:enumeration value="RelatedContractLineItemNumber"/>
+ <xsd:enumeration value="RelatedDocumentNumber"/>
+ <xsd:enumeration value="RelatedNonconformanceNumber"/>
+ <xsd:enumeration value="RelatedObjectIdentificationNumber"/>
+ <xsd:enumeration value="RelatedTransactionReferenceNumber"/>
+ <xsd:enumeration value="RelatedVendorOrderNumber"/>
+ <xsd:enumeration value="RelativePriority"/>
+ <xsd:enumeration value="ReleaseInvoiceNumberForPriorBillAndHold"/>
+ <xsd:enumeration value="ReleaseNumber"/>
+ <xsd:enumeration value="RemittanceAdviceNumber"/>
+ <xsd:enumeration value="RemittingBanksReference"/>
+ <xsd:enumeration value="RemovalNumber"/>
+ <xsd:enumeration value="RentalAccountNumber"/>
+ <xsd:enumeration value="RentalAgreementNumber"/>
+ <xsd:enumeration value="RentPayorIdentification"/>
+ <xsd:enumeration value="RepairActionNumber"/>
+ <xsd:enumeration value="RepairCategoryNumber"/>
+ <xsd:enumeration value="RepairDataRequestNumber"/>
+ <xsd:enumeration value="RepairEstimateNumber"/>
+ <xsd:enumeration value="RepairOrderNumber"/>
+ <xsd:enumeration value="RepairPartNumber"/>
+ <xsd:enumeration value="RepeatLocation"/>
+ <xsd:enumeration value="RepetitiveBookingNumber"/>
+ <xsd:enumeration value="RepetitiveCargoShipmentNumber"/>
+ <xsd:enumeration value="RepetitivePatternCode"/>
+ <xsd:enumeration value="RepetitiveWaybillCode"/>
+ <xsd:enumeration value="ReplacementAssemblyModelNumber"/>
+ <xsd:enumeration value="ReplacementAssemblySerialNumber"/>
+ <xsd:enumeration value="ReplacementClaimNumber"/>
+ <xsd:enumeration value="ReplacementCustomerReferenceNumber"/>
+ <xsd:enumeration value="ReplacementDrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="ReplacingPartNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderRangeEndNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderRangeStartNumber"/>
+ <xsd:enumeration value="ReporterIdentification"/>
+ <xsd:enumeration value="ReportingFormNumber"/>
+ <xsd:enumeration value="ReportNumber"/>
+ <xsd:enumeration value="Representation"/>
+ <xsd:enumeration value="RepresentativeIdentificationNumber"/>
+ <xsd:enumeration value="RepricedClaimReferenceNumber"/>
+ <xsd:enumeration value="RepricedLineItemReferenceNumber"/>
+ <xsd:enumeration value="RequestForCancellationNumber"/>
+ <xsd:enumeration value="RequestforQuotationReference"/>
+ <xsd:enumeration value="RequestForQuoteNumber"/>
+ <xsd:enumeration value="RequestNumber"/>
+ <xsd:enumeration value="ReservationNumber"/>
+ <xsd:enumeration value="ReserveAssemblyLineFeedLocation"/>
+ <xsd:enumeration value="ResourceScreeningReference"/>
+ <xsd:enumeration value="ResourceUtilizationGroupNumber"/>
+ <xsd:enumeration value="ResponsetoaRequestforQuotationReference"/>
+ <xsd:enumeration value="RestrictedAvailabilityAuthorization"/>
+ <xsd:enumeration value="RestrictedAvailabilityNumber"/>
+ <xsd:enumeration value="ResubmissionNumber"/>
+ <xsd:enumeration value="ResubmissionReasonCode"/>
+ <xsd:enumeration value="Resubmitnumber"/>
+ <xsd:enumeration value="RetailMerchantsCertificationNumber"/>
+ <xsd:enumeration value="RetirementPlanAccountNumber"/>
+ <xsd:enumeration value="RetirementPlanPolicyNumber"/>
+ <xsd:enumeration value="ReturnableContainerReferenceNumber"/>
+ <xsd:enumeration value="ReturnableContainerSerialNumber"/>
+ <xsd:enumeration value="ReturnedGoodsAuthorizationNumber"/>
+ <xsd:enumeration value="ReturnGoodsBillOfLadingNumber"/>
+ <xsd:enumeration value="ReturnMaterialAuthorizationNumber"/>
+ <xsd:enumeration value="ReturnsNoticeNumber"/>
+ <xsd:enumeration value="RevenueSource"/>
+ <xsd:enumeration value="Review"/>
+ <xsd:enumeration value="ReviewerFileNumber"/>
+ <xsd:enumeration value="ReviewPeriodNumber"/>
+ <xsd:enumeration value="RevisionNumber"/>
+ <xsd:enumeration value="RIF"/>
+ <xsd:enumeration value="RigNumber"/>
+ <xsd:enumeration value="RoadConsignmentNoteNumber"/>
+ <xsd:enumeration value="RouteNumber"/>
+ <xsd:enumeration value="RouteOrderNumberDomestic"/>
+ <xsd:enumeration value="RouteOrderNumberEmergency"/>
+ <xsd:enumeration value="RouteOrderNumberExport"/>
+ <xsd:enumeration value="RoutingInstructionNumber"/>
+ <xsd:enumeration value="RUC"/>
+ <xsd:enumeration value="RuleSection"/>
+ <xsd:enumeration value="RunNumber"/>
+ <xsd:enumeration value="SafekeepingAccountNumber"/>
+ <xsd:enumeration value="SafetyEquipmentCertificate"/>
+ <xsd:enumeration value="SafetyofRadioCertificate"/>
+ <xsd:enumeration value="SafetyofShipCertificate"/>
+ <xsd:enumeration value="SalesOrTerritoryCode"/>
+ <xsd:enumeration value="SalesAllowanceNumber"/>
+ <xsd:enumeration value="SalesDepartmentNumber"/>
+ <xsd:enumeration value="SalesForecastNumber"/>
+ <xsd:enumeration value="SalesOfficeNumber"/>
+ <xsd:enumeration value="SalesPersonNumber"/>
+ <xsd:enumeration value="SalesProgramNumber"/>
+ <xsd:enumeration value="SalesRegionNumber"/>
+ <xsd:enumeration value="SalesReportNumber"/>
+ <xsd:enumeration value="SalesRepresentativeOrderNumber"/>
+ <xsd:enumeration value="SalesResponsibility"/>
+ <xsd:enumeration value="SampleNumber"/>
+ <xsd:enumeration value="Savings"/>
+ <xsd:enumeration value="SBA"/>
+ <xsd:enumeration value="ScaleNumber"/>
+ <xsd:enumeration value="ScanLine"/>
+ <xsd:enumeration value="ScheduleReferenceNumber"/>
+ <xsd:enumeration value="SchemeOrPlanNumber"/>
+ <xsd:enumeration value="SchoolLoanNumber"/>
+ <xsd:enumeration value="SchoolUse"/>
+ <xsd:enumeration value="SealNumber"/>
+ <xsd:enumeration value="SealOffNumber"/>
+ <xsd:enumeration value="SealOnNumber"/>
+ <xsd:enumeration value="SearchKey"/>
+ <xsd:enumeration value="SecondaryCoverageCertificateNumber"/>
+ <xsd:enumeration value="SecondaryCoverageCompanyNumber"/>
+ <xsd:enumeration value="SecondaryCustomsReference"/>
+ <xsd:enumeration value="SecondaryEmployeeIdentificationNumber"/>
+ <xsd:enumeration value="SecondaryHealthInsuranceIdentificationNumber"/>
+ <xsd:enumeration value="SecondaryPolicyNumber"/>
+ <xsd:enumeration value="SecondaryProviderNumber"/>
+ <xsd:enumeration value="SecondarySuffixCodeIndicator"/>
+ <xsd:enumeration value="SecondBeneficiarysReference"/>
+ <xsd:enumeration value="SecretariadeComerciayFamentaIndustrialNumber"/>
+ <xsd:enumeration value="SecretaryofStateAssignedIdentificationNumber"/>
+ <xsd:enumeration value="SectionNumber"/>
+ <xsd:enumeration value="SectionOfTheNationalHousingActCode"/>
+ <xsd:enumeration value="SecurityInstrumentNumber"/>
+ <xsd:enumeration value="SecurityType"/>
+ <xsd:enumeration value="SelfInsuranceIdentificationNumber"/>
+ <xsd:enumeration value="SelfInsurerAuthorizationTypeCode"/>
+ <xsd:enumeration value="SelfInsurerOrganizationType"/>
+ <xsd:enumeration value="SellerLoanNumber"/>
+ <xsd:enumeration value="SellersCatalogueNumber"/>
+ <xsd:enumeration value="SellersCreditMemo"/>
+ <xsd:enumeration value="SellersDebitMemo"/>
+ <xsd:enumeration value="SellersInvoiceNumber"/>
+ <xsd:enumeration value="SellersReferenceNumber"/>
+ <xsd:enumeration value="SellersSaleNumber"/>
+ <xsd:enumeration value="SellingArrangement"/>
+ <xsd:enumeration value="SenderDefinedClause"/>
+ <xsd:enumeration value="SendersClauseNumber"/>
+ <xsd:enumeration value="SendersFileReferenceNumber"/>
+ <xsd:enumeration value="SendersReferenceToTheOriginalMessage"/>
+ <xsd:enumeration value="SendingBankReferenceNumber"/>
+ <xsd:enumeration value="SendingCompanyAuditNumberAutomatedClearinghouseTransfers"/>
+ <xsd:enumeration value="SequenceNumber"/>
+ <xsd:enumeration value="SerialNumber"/>
+ <xsd:enumeration value="ServiceAuthorizationNumber"/>
+ <xsd:enumeration value="ServiceBulletinNumber"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceChangeNumber"/>
+ <xsd:enumeration value="ServiceChargeNumber"/>
+ <xsd:enumeration value="ServiceContractNumber"/>
+ <xsd:enumeration value="ServiceEstimateNumber"/>
+ <xsd:enumeration value="ServiceGroupIdentificationNumber"/>
+ <xsd:enumeration value="ServiceInterruptTrackingNumber"/>
+ <xsd:enumeration value="ServiceOrderNumber"/>
+ <xsd:enumeration value="ServicePerformedCode"/>
+ <xsd:enumeration value="Servicer"/>
+ <xsd:enumeration value="ServiceRequestNumber"/>
+ <xsd:enumeration value="ServicerLoanNumber"/>
+ <xsd:enumeration value="Session"/>
+ <xsd:enumeration value="SetNumber"/>
+ <xsd:enumeration value="Sheet"/>
+ <xsd:enumeration value="ShelfLifeIndicator"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="ShipmentDestinationCode"/>
+ <xsd:enumeration value="ShipmentOriginCode"/>
+ <xsd:enumeration value="ShipmentReferenceNumber"/>
+ <xsd:enumeration value="ShipNoticeOrManifestNumber"/>
+ <xsd:enumeration value="ShipownersAuthorizationNumber"/>
+ <xsd:enumeration value="ShipperCarOrderNumber"/>
+ <xsd:enumeration value="ShippersBondNumber"/>
+ <xsd:enumeration value="ShippersHazardousNumber"/>
+ <xsd:enumeration value="ShippersOrder"/>
+ <xsd:enumeration value="ShippingLabelSerialNumber"/>
+ <xsd:enumeration value="ShippingNoteNumber"/>
+ <xsd:enumeration value="ShippingUnitIdentification"/>
+ <xsd:enumeration value="ShippingZone"/>
+ <xsd:enumeration value="ShortTermDisabilityPolicyNumber"/>
+ <xsd:enumeration value="ShowIdentification"/>
+ <xsd:enumeration value="SIC"/>
+ <xsd:enumeration value="SID"/>
+ <xsd:enumeration value="SignalCode"/>
+ <xsd:enumeration value="SignalCodeNumber"/>
+ <xsd:enumeration value="SingleTransactionSequenceNumber"/>
+ <xsd:enumeration value="SIRENNumber"/>
+ <xsd:enumeration value="SIRETNumber"/>
+ <xsd:enumeration value="SiteSpecificProceduresTermsAndConditions"/>
+ <xsd:enumeration value="SituationNumber"/>
+ <xsd:enumeration value="SlaughterPlantNumber"/>
+ <xsd:enumeration value="SocialInsuranceNumber"/>
+ <xsd:enumeration value="SocialSecurityNumber"/>
+ <xsd:enumeration value="SocietyofPropertyInformationCompilersandAnalysts"/>
+ <xsd:enumeration value="SoftwareApplicationNumber"/>
+ <xsd:enumeration value="Solicitation"/>
+ <xsd:enumeration value="SortAndSegregate"/>
+ <xsd:enumeration value="SourceDocumentInternalReference"/>
+ <xsd:enumeration value="SpacingUnitOrderNumber"/>
+ <xsd:enumeration value="SpecialApproval"/>
+ <xsd:enumeration value="SpecialBudgetAccountNumber"/>
+ <xsd:enumeration value="SpecialChargeOrAllowanceCode"/>
+ <xsd:enumeration value="SpecialClause"/>
+ <xsd:enumeration value="SpecialGovernmentAccountingClassificationReferenceNumber"/>
+ <xsd:enumeration value="SpecialInstructionsNumber"/>
+ <xsd:enumeration value="SpecialMoveReferenceNumber"/>
+ <xsd:enumeration value="SpecialPackagingInstructionNumber"/>
+ <xsd:enumeration value="SpecialPaymentReferenceNumber"/>
+ <xsd:enumeration value="SpecialProcessingCode"/>
+ <xsd:enumeration value="SpecialQuoteNumber"/>
+ <xsd:enumeration value="SpecialtyLicenseNumber"/>
+ <xsd:enumeration value="SpecificationClassNumber"/>
+ <xsd:enumeration value="SpecificationNumber"/>
+ <xsd:enumeration value="SpecificationRevision"/>
+ <xsd:enumeration value="SpecimenIdentifier"/>
+ <xsd:enumeration value="SplitBookingNumber"/>
+ <xsd:enumeration value="SplitPremiumAuditChangeIdentifier"/>
+ <xsd:enumeration value="SplitShipmentNumber"/>
+ <xsd:enumeration value="SponsorsReferenceNumber"/>
+ <xsd:enumeration value="SpouseTie"/>
+ <xsd:enumeration value="StackTrainIdentification"/>
+ <xsd:enumeration value="Standard"/>
+ <xsd:enumeration value="StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="StandardClause"/>
+ <xsd:enumeration value="StandardIndustryClassificationCode"/>
+ <xsd:enumeration value="StandardNumberOfInspectionDocument"/>
+ <xsd:enumeration value="StandardPointLocationCode"/>
+ <xsd:enumeration value="StandardsCodeNumber"/>
+ <xsd:enumeration value="StandardsNumber"/>
+ <xsd:enumeration value="StandardsVersionNumber"/>
+ <xsd:enumeration value="StandardTransportationCommodityCodeBridgeNumber"/>
+ <xsd:enumeration value="StandardTransportationCommodityCodeReplacementCode"/>
+ <xsd:enumeration value="StartingPackageNumber"/>
+ <xsd:enumeration value="StateAssemblyDistrict"/>
+ <xsd:enumeration value="StateCharterNumber"/>
+ <xsd:enumeration value="StateControlledSubstanceLicenseNumber"/>
+ <xsd:enumeration value="StateCriminalHistoryRepositoryIndividualIdentification"/>
+ <xsd:enumeration value="StateDepartmentI20FormNumber"/>
+ <xsd:enumeration value="StateDepartmentIAP66FormNumber"/>
+ <xsd:enumeration value="StateHazardousWasteEntityIdentifier"/>
+ <xsd:enumeration value="StateIndustrialAccidentProviderNumber"/>
+ <xsd:enumeration value="StateLegislativeDistrict"/>
+ <xsd:enumeration value="StateLicenseIdentificationNumber"/>
+ <xsd:enumeration value="StateLicenseNumber"/>
+ <xsd:enumeration value="StatementNumber"/>
+ <xsd:enumeration value="StatementOfWork"/>
+ <xsd:enumeration value="StateNonResidentViolatorCompact"/>
+ <xsd:enumeration value="StateorProvinceAssignedBusinessRegistryNumber"/>
+ <xsd:enumeration value="StateOrProvinceAssignedEntityIdentification"/>
+ <xsd:enumeration value="StateSalesTaxIdentificationNumber"/>
+ <xsd:enumeration value="StateSenateDistrict"/>
+ <xsd:enumeration value="StateStudentIdentificationNumber"/>
+ <xsd:enumeration value="StateTaxIdentificationNumber"/>
+ <xsd:enumeration value="StatewideCourseNumber"/>
+ <xsd:enumeration value="StationReferenceNumber"/>
+ <xsd:enumeration value="Status"/>
+ <xsd:enumeration value="StatusReportNumber"/>
+ <xsd:enumeration value="StockCertificateNumber"/>
+ <xsd:enumeration value="StockExchangeCode"/>
+ <xsd:enumeration value="StockExchangeCompanyIdentifier"/>
+ <xsd:enumeration value="StockKeepingUnitNumber"/>
+ <xsd:enumeration value="StockNumber"/>
+ <xsd:enumeration value="StopSequenceNumber"/>
+ <xsd:enumeration value="StorageInformationCode"/>
+ <xsd:enumeration value="StoreNumber"/>
+ <xsd:enumeration value="Study"/>
+ <xsd:enumeration value="SubassemblyNumber"/>
+ <xsd:enumeration value="SubcontractLineItemNumber"/>
+ <xsd:enumeration value="SubcontractNumber"/>
+ <xsd:enumeration value="SubcontractorDataRequirements"/>
+ <xsd:enumeration value="SubdayNumber"/>
+ <xsd:enumeration value="SubdivisionIdentifier"/>
+ <xsd:enumeration value="SubexhibitLineItemNumber"/>
+ <xsd:enumeration value="SubFile"/>
+ <xsd:enumeration value="SubhouseBillOfLading"/>
+ <xsd:enumeration value="SubjectPropertyNonSaleReferenceNumber"/>
+ <xsd:enumeration value="SubjectPropertyReferenceNumber"/>
+ <xsd:enumeration value="SubjectPropertyVerificationSource"/>
+ <xsd:enumeration value="SublineofInsurance"/>
+ <xsd:enumeration value="SubmissionNumber"/>
+ <xsd:enumeration value="SubmitterIdentificationNumber"/>
+ <xsd:enumeration value="SubscriberAuthorizationNumber"/>
+ <xsd:enumeration value="SubscriberNumber"/>
+ <xsd:enumeration value="Subservicer"/>
+ <xsd:enumeration value="SubServicerLoanNumber"/>
+ <xsd:enumeration value="SubsistenceIdentificationNumber"/>
+ <xsd:enumeration value="SubstantivelyConsolidatedCase"/>
+ <xsd:enumeration value="SubstituteAirWaybillNumber"/>
+ <xsd:enumeration value="SubstituteManufacturersPartNumber"/>
+ <xsd:enumeration value="SubstituteNationalStockNumber"/>
+ <xsd:enumeration value="SubstitutePartNumber"/>
+ <xsd:enumeration value="SubSubhouseBillOfLading"/>
+ <xsd:enumeration value="SuccessorAccount"/>
+ <xsd:enumeration value="Suffix"/>
+ <xsd:enumeration value="SuperintendenciadeInversionesExtranjerasNumber"/>
+ <xsd:enumeration value="SupervisoryAppraiserCertificationNumber"/>
+ <xsd:enumeration value="SupplementalAccountNumber"/>
+ <xsd:enumeration value="SupplementalAgreementAuthority"/>
+ <xsd:enumeration value="SupplementalClaimNumber"/>
+ <xsd:enumeration value="SupplementNumber"/>
+ <xsd:enumeration value="Supplier"/>
+ <xsd:enumeration value="SupplierReplacement"/>
+ <xsd:enumeration value="SupplierDocumentIdentificationNumber"/>
+ <xsd:enumeration value="SuppliersControlNumber"/>
+ <xsd:enumeration value="SuppliersCreditClaimReferenceNumber"/>
+ <xsd:enumeration value="SupportingDocumentNumber"/>
+ <xsd:enumeration value="SuretyBondNumber"/>
+ <xsd:enumeration value="SuspensionIdentifier"/>
+ <xsd:enumeration value="SwapOrderNumber"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="SWIFTMT100"/>
+ <xsd:enumeration value="SWIFTMT202"/>
+ <xsd:enumeration value="SWIFTConfirmationNumber"/>
+ <xsd:enumeration value="SymbolNumber"/>
+ <xsd:enumeration value="SymbolNumberForMilestoneOrLOBReports"/>
+ <xsd:enumeration value="SystematizedNomenclatureofHumanandVeterinaryMedicine"/>
+ <xsd:enumeration value="SystemeInformatiquePourLeRepertoireDesEntreprises"/>
+ <xsd:enumeration value="SystemeInformatiquePourLeRepertoireDesEtablissements"/>
+ <xsd:enumeration value="SystemNumber"/>
+ <xsd:enumeration value="Tag"/>
+ <xsd:enumeration value="TankNumber"/>
+ <xsd:enumeration value="TariffNumber"/>
+ <xsd:enumeration value="TariffPageNumber"/>
+ <xsd:enumeration value="TariffRuleNumber"/>
+ <xsd:enumeration value="TariffSectionNumber"/>
+ <xsd:enumeration value="TariffSuffixNumber"/>
+ <xsd:enumeration value="TariffSupplementNumber"/>
+ <xsd:enumeration value="TaskOrder"/>
+ <xsd:enumeration value="TaxAgencyNumber"/>
+ <xsd:enumeration value="TaxExchangeCode"/>
+ <xsd:enumeration value="TaxExemptionLicenceNumber"/>
+ <xsd:enumeration value="TaxExemptNumber"/>
+ <xsd:enumeration value="TaxFiling"/>
+ <xsd:enumeration value="TaxFormCode"/>
+ <xsd:enumeration value="TaxingAuthorityIdentificationNumber"/>
+ <xsd:enumeration value="TaxLicenseExemption"/>
+ <xsd:enumeration value="TaxLienJurisdiction"/>
+ <xsd:enumeration value="TaxRegistrationNumber"/>
+ <xsd:enumeration value="TaxScheduleCode"/>
+ <xsd:enumeration value="TaxShelterNumber"/>
+ <xsd:enumeration value="TaxWorksheet"/>
+ <xsd:enumeration value="TCN"/>
+ <xsd:enumeration value="TeamAssignmentNumber"/>
+ <xsd:enumeration value="TechnicalDocumentationType"/>
+ <xsd:enumeration value="TechnicalDocumentNumber"/>
+ <xsd:enumeration value="TechnicalInformationPackage"/>
+ <xsd:enumeration value="TechnicalOrderNumber"/>
+ <xsd:enumeration value="TechnicalPhaseReference"/>
+ <xsd:enumeration value="TechnicalRegulation"/>
+ <xsd:enumeration value="TelecommunicationCircuitSupplementalID"/>
+ <xsd:enumeration value="TelexMessageNumber"/>
+ <xsd:enumeration value="TemplateSequenceNumber"/>
+ <xsd:enumeration value="Tenor"/>
+ <xsd:enumeration value="Term"/>
+ <xsd:enumeration value="TerminalCode"/>
+ <xsd:enumeration value="TerminalOperatorNumber"/>
+ <xsd:enumeration value="TerminalReleaseOrderNumber"/>
+ <xsd:enumeration value="TerminationFiling"/>
+ <xsd:enumeration value="TesterIdentification"/>
+ <xsd:enumeration value="TestReportNumber"/>
+ <xsd:enumeration value="TestSpecificationNumber"/>
+ <xsd:enumeration value="TextElementIdentifierDeletionReference"/>
+ <xsd:enumeration value="TheaterScreenNumber"/>
+ <xsd:enumeration value="ThirdBanksReferenceNumber"/>
+ <xsd:enumeration value="ThirdBanksReference"/>
+ <xsd:enumeration value="ThirdPartyAdministratorClaimNumber"/>
+ <xsd:enumeration value="ThirdPartyNoteHolderIdentification"/>
+ <xsd:enumeration value="ThirdPartyOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="ThirdPartyOriginatorNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderItemNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderReleaseNumber"/>
+ <xsd:enumeration value="ThirdPartyReferenceNumber"/>
+ <xsd:enumeration value="ThroughBillOfLadingNumber"/>
+ <xsd:enumeration value="TicketNumber"/>
+ <xsd:enumeration value="TimeFailure"/>
+ <xsd:enumeration value="TirCarnetNumber"/>
+ <xsd:enumeration value="TIRNumber"/>
+ <xsd:enumeration value="TitleCompanyCodeBookReference"/>
+ <xsd:enumeration value="TitleDocumentSchedule"/>
+ <xsd:enumeration value="TitlePolicyNumber"/>
+ <xsd:enumeration value="TitleReference"/>
+ <xsd:enumeration value="TitleXIXIdentifierNumber"/>
+ <xsd:enumeration value="TokyoShokoResearchBusinessIdentifier"/>
+ <xsd:enumeration value="TollBillingTelephoneReferenceNumber"/>
+ <xsd:enumeration value="TotalCycleNumber"/>
+ <xsd:enumeration value="TotalOrderCycleNumber"/>
+ <xsd:enumeration value="TownshipNumber"/>
+ <xsd:enumeration value="ToxicologyID"/>
+ <xsd:enumeration value="TracerActionRequestNumber"/>
+ <xsd:enumeration value="TrackingNumber"/>
+ <xsd:enumeration value="Tract"/>
+ <xsd:enumeration value="TraderAccountNumber"/>
+ <xsd:enumeration value="TradingPartnerIdentificationNumber"/>
+ <xsd:enumeration value="TrailerTypeQualifier"/>
+ <xsd:enumeration value="TrailerUseAgreements"/>
+ <xsd:enumeration value="TrainingFlightNumber"/>
+ <xsd:enumeration value="TransactionCategoryOrType"/>
+ <xsd:enumeration value="TransactionReferenceNumber"/>
+ <xsd:enumeration value="TransferNumber"/>
+ <xsd:enumeration value="TransitGuaranteeNumber"/>
+ <xsd:enumeration value="TransponderNumber"/>
+ <xsd:enumeration value="TransportationAccountCode"/>
+ <xsd:enumeration value="TransportationAccountNumber"/>
+ <xsd:enumeration value="TransportationControlNumber"/>
+ <xsd:enumeration value="TransportationExportationNoForInBondMovement"/>
+ <xsd:enumeration value="TransportationPriorityNumber"/>
+ <xsd:enumeration value="TransportContractReferenceNumber"/>
+ <xsd:enumeration value="TransportCostsReferenceNumber"/>
+ <xsd:enumeration value="TransportDocumentNumber"/>
+ <xsd:enumeration value="TransportEquipmentReturnReference"/>
+ <xsd:enumeration value="TransportEquipmentStrippingOrder"/>
+ <xsd:enumeration value="TransportEquipmentStuffingOrder"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReference"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReferenceNumber"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReportNumber"/>
+ <xsd:enumeration value="TransportRoute"/>
+ <xsd:enumeration value="TransportSectionReferenceNumber"/>
+ <xsd:enumeration value="TravelManifest"/>
+ <xsd:enumeration value="TreatyIdentifier"/>
+ <xsd:enumeration value="TreatyNumber"/>
+ <xsd:enumeration value="TrialLocationCode"/>
+ <xsd:enumeration value="Tripleback"/>
+ <xsd:enumeration value="TruckersBillOfLading"/>
+ <xsd:enumeration value="Trustee"/>
+ <xsd:enumeration value="TSRBusinessIdentifier"/>
+ <xsd:enumeration value="TypeOfComment"/>
+ <xsd:enumeration value="TypeOfEscrowNumber"/>
+ <xsd:enumeration value="TypeOfHouseholdGoodsCode"/>
+ <xsd:enumeration value="TypeOfLawSuit"/>
+ <xsd:enumeration value="TypeOfOutstandingJudgment"/>
+ <xsd:enumeration value="TypeOfScienceCode"/>
+ <xsd:enumeration value="U.S.DefenseFederalAcquisitionRegulationSupplement"/>
+ <xsd:enumeration value="U.S.DepartmentOfVeteransAffairsAcquisitionRegulation"/>
+ <xsd:enumeration value="U.S.GovernmentTransportationControlNumber"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomersOrderNumber"/>
+ <xsd:enumeration value="UltimateCustomersReferenceNumber"/>
+ <xsd:enumeration value="UnacceptableSourceDUNSNumber"/>
+ <xsd:enumeration value="UnacceptableSourcePurchaserID"/>
+ <xsd:enumeration value="UnacceptableSourceSupplierID"/>
+ <xsd:enumeration value="UnderwriterIdentificationNumber"/>
+ <xsd:enumeration value="UnderwritingAlertReferenceCode"/>
+ <xsd:enumeration value="UNDG"/>
+ <xsd:enumeration value="UnemploymentInsuranceNumber"/>
+ <xsd:enumeration value="UniformCommercialCodeFilingCollateralNumber"/>
+ <xsd:enumeration value="UniformResourceLocator"/>
+ <xsd:enumeration value="UnionNumber"/>
+ <xsd:enumeration value="UniqueClaimsReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueConsignmentIdentifier"/>
+ <xsd:enumeration value="UniqueConsignmentReferenceNumber"/>
+ <xsd:enumeration value="UniqueCurracReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueMarketReference"/>
+ <xsd:enumeration value="UniqueReinacReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueSupplierIdentificationNumber"/>
+ <xsd:enumeration value="UnitedNationsHazardousClassificationNumber"/>
+ <xsd:enumeration value="UnitedStatesGovernmentVisaNumber"/>
+ <xsd:enumeration value="UnitedStatesStandardMetropolitanStatisticalAreaCode"/>
+ <xsd:enumeration value="UnitLoadDeviceIdentificationNumber"/>
+ <xsd:enumeration value="UnitNumber"/>
+ <xsd:enumeration value="UnitPropertyNumber"/>
+ <xsd:enumeration value="UnitReliefNumber"/>
+ <xsd:enumeration value="UnitReportPeriod"/>
+ <xsd:enumeration value="UnitReportPeriodID"/>
+ <xsd:enumeration value="UnitTrain"/>
+ <xsd:enumeration value="UniversalRailroadRevenueWaybillIdentifiedNumber"/>
+ <xsd:enumeration value="UniversalTransverseMercatorEast"/>
+ <xsd:enumeration value="UniversalTransverseMercatorNorth"/>
+ <xsd:enumeration value="UniversalTransverseMercatorZone"/>
+ <xsd:enumeration value="UnpaidInstallmentReferenceNumber"/>
+ <xsd:enumeration value="UpperSerialNumberOfRange"/>
+ <xsd:enumeration value="UpstreamShipperContractNumber"/>
+ <xsd:enumeration value="USCFR"/>
+ <xsd:enumeration value="USCS"/>
+ <xsd:enumeration value="USCustomsServiceAntiDumpingDutyCaseNumber"/>
+ <xsd:enumeration value="USCustomsServiceBindingRulingNumber"/>
+ <xsd:enumeration value="USCustomsServiceCommercialDescription"/>
+ <xsd:enumeration value="USCustomsServiceCountervailingDutyCaseNumber"/>
+ <xsd:enumeration value="USCustomsServiceEntryNumber"/>
+ <xsd:enumeration value="USCustomsServiceEntryTypeCode"/>
+ <xsd:enumeration value="USCustomsServicePreApprovalRulingNumber"/>
+ <xsd:enumeration value="USCustomsServicePreClassificationRulingNumber"/>
+ <xsd:enumeration value="USCustomsServiceStatementNumber"/>
+ <xsd:enumeration value="USDOEAndNCES"/>
+ <xsd:enumeration value="USDOTBondSuretyCode"/>
+ <xsd:enumeration value="UserID"/>
+ <xsd:enumeration value="UserIdentification"/>
+ <xsd:enumeration value="USFCCImportCondition"/>
+ <xsd:enumeration value="USFederalAcquisitionRegulation"/>
+ <xsd:enumeration value="USFederalInformationResourcesManagementRegulation"/>
+ <xsd:enumeration value="USFoodAndDrugAdministrationEstablishmentIndicator"/>
+ <xsd:enumeration value="USGeneralServicesAdministrationRegulation"/>
+ <xsd:enumeration value="USGovernmentAgencyNumber"/>
+ <xsd:enumeration value="ValueAddedTaxRegistrationNumber"/>
+ <xsd:enumeration value="VatRegistrationNumber"/>
+ <xsd:enumeration value="VehicleBusinessUseQualifier"/>
+ <xsd:enumeration value="VehicleLicenceNumber"/>
+ <xsd:enumeration value="VehicleRadiusofOperationQualifier"/>
+ <xsd:enumeration value="VehicleRelatedServicesReferenceNumber"/>
+ <xsd:enumeration value="VehicleSizeClassQualifier"/>
+ <xsd:enumeration value="VendorAbbreviationCode"/>
+ <xsd:enumeration value="VendorChangeIdentificationCode"/>
+ <xsd:enumeration value="VendorChangeProcedureCode"/>
+ <xsd:enumeration value="VendorContractNumber"/>
+ <xsd:enumeration value="VendorIDNumber"/>
+ <xsd:enumeration value="VendorOrderNumberSuffix"/>
+ <xsd:enumeration value="VendorProductNumber"/>
+ <xsd:enumeration value="VendorsPreviousJobNumber"/>
+ <xsd:enumeration value="VendorTerms"/>
+ <xsd:enumeration value="VerificationSourceCode"/>
+ <xsd:enumeration value="Version"/>
+ <xsd:enumeration value="VersionCodeLocal"/>
+ <xsd:enumeration value="VersionCodeNational"/>
+ <xsd:enumeration value="VerticalCoordinate"/>
+ <xsd:enumeration value="Vessel"/>
+ <xsd:enumeration value="VesselAgentNumber"/>
+ <xsd:enumeration value="VesselIdentification"/>
+ <xsd:enumeration value="VesselName"/>
+ <xsd:enumeration value="VeteransAdministrationOriginatorIdentification"/>
+ <xsd:enumeration value="VeteransAffairsCaseNumber"/>
+ <xsd:enumeration value="VIN"/>
+ <xsd:enumeration value="VisaType"/>
+ <xsd:enumeration value="VolumeNumber"/>
+ <xsd:enumeration value="VolumePurchaseAgreementNumber"/>
+ <xsd:enumeration value="VoucherNumber"/>
+ <xsd:enumeration value="VoyageNumber"/>
+ <xsd:enumeration value="WageDetermination"/>
+ <xsd:enumeration value="Waiver"/>
+ <xsd:enumeration value="Ward"/>
+ <xsd:enumeration value="WarehouseEntryNumber"/>
+ <xsd:enumeration value="WarehousePickTicketNumber"/>
+ <xsd:enumeration value="WarehouseReceiptNumber"/>
+ <xsd:enumeration value="WarehouseStorageLocationNumber"/>
+ <xsd:enumeration value="Warrant"/>
+ <xsd:enumeration value="WarrantyCoverageCode"/>
+ <xsd:enumeration value="WarrantyRegistrationNumber"/>
+ <xsd:enumeration value="WaybillNumber"/>
+ <xsd:enumeration value="WeaponSystemNumber"/>
+ <xsd:enumeration value="WeightAgreementNumber"/>
+ <xsd:enumeration value="WellClassificationCode"/>
+ <xsd:enumeration value="WellNumber"/>
+ <xsd:enumeration value="WithdrawalAccountNumber"/>
+ <xsd:enumeration value="WithdrawalRecord"/>
+ <xsd:enumeration value="WoolIdentificationNumber"/>
+ <xsd:enumeration value="WoolTaxReferenceNumber"/>
+ <xsd:enumeration value="WorkBreakdownStructure"/>
+ <xsd:enumeration value="WorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="WorkCenter"/>
+ <xsd:enumeration value="WorkingShiftNumber"/>
+ <xsd:enumeration value="WorkItemQuantityDetermination"/>
+ <xsd:enumeration value="WorkOrderNumber"/>
+ <xsd:enumeration value="WorkPackage"/>
+ <xsd:enumeration value="WorkShift"/>
+ <xsd:enumeration value="WorksiteNumber"/>
+ <xsd:enumeration value="WorkTaskChargeNumber"/>
+ <xsd:enumeration value="WorkTeam"/>
+ <xsd:enumeration value="YardPosition"/>
+ <xsd:enumeration value="Zone"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Purpose">
+ <xsd:sequence>
+ <xsd:element name="PurposeCoded" type="PurposeCode"/>
+ <xsd:element minOccurs="0" name="PurposeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Purpose" type="Purpose"/>
+ <xsd:simpleType name="PurposeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Cancellation"/>
+ <xsd:enumeration value="Replace"/>
+ <xsd:enumeration value="Confirmation"/>
+ <xsd:enumeration value="Duplicate"/>
+ <xsd:enumeration value="Original"/>
+ <xsd:enumeration value="Change"/>
+ <xsd:enumeration value="InformationOnly"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="RequestedResponse">
+ <xsd:sequence>
+ <xsd:element name="RequestedResponseCoded" type="RequestedResponseCode"/>
+ <xsd:element minOccurs="0" name="RequestedResponseCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="RequestedResponse" type="RequestedResponse"/>
+ <xsd:simpleType name="RequestedResponseCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="DebitAdvice"/>
+ <xsd:enumeration value="AcknowledgeHoldStatus"/>
+ <xsd:enumeration value="AcknowledgementWhenError"/>
+ <xsd:enumeration value="AcknowledgeNoDetailOrChange"/>
+ <xsd:enumeration value="AcknowledgeOnlyChanges"/>
+ <xsd:enumeration value="AcknowledgeProductReplenishment"/>
+ <xsd:enumeration value="AcknowledgeWithDetailAndChange"/>
+ <xsd:enumeration value="AcknowledgeWithDetailNoChange"/>
+ <xsd:enumeration value="AdviceWithDetails"/>
+ <xsd:enumeration value="AdviceWithoutDetails"/>
+ <xsd:enumeration value="Authentication"/>
+ <xsd:enumeration value="CreditAdviceAndAcknowledgementForDirectDebit"/>
+ <xsd:enumeration value="CreditAdviceMessageAcknowledgement"/>
+ <xsd:enumeration value="CreditAdviceRequestedForDirectDebit"/>
+ <xsd:enumeration value="DebitAdviceForEachTransaction"/>
+ <xsd:enumeration value="DebitAdviceMessageAcknowledgement"/>
+ <xsd:enumeration value="DebitAdviceMessageAcknowledgementForEachTransaction"/>
+ <xsd:enumeration value="DebitAdviceRequested"/>
+ <xsd:enumeration value="MessageAcknowledgement"/>
+ <xsd:enumeration value="NoAcknowledgementNeeded"/>
+ <xsd:enumeration value="RequestAuthority"/>
+ <xsd:enumeration value="ResponseExpected"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderType">
+ <xsd:sequence>
+ <xsd:element name="OrderTypeCoded" type="OrderTypeCode"/>
+ <xsd:element minOccurs="0" name="OrderTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderType" type="OrderType"/>
+ <xsd:simpleType name="OrderTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcknowledgementMessage"/>
+ <xsd:enumeration value="AcknowledgementOfOrder"/>
+ <xsd:enumeration value="AClaimForPartsAndOrLabourCharges"/>
+ <xsd:enumeration value="AdviceOfAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="AdviceOfCollection"/>
+ <xsd:enumeration value="AdviceOfDistributionOfDocuments"/>
+ <xsd:enumeration value="AdvisingItemsToBeBookedToAFinancialAccount"/>
+ <xsd:enumeration value="Agreement"/>
+ <xsd:enumeration value="AgreementToPay"/>
+ <xsd:enumeration value="AirWaybill"/>
+ <xsd:enumeration value="AOGCritical"/>
+ <xsd:enumeration value="AOGService"/>
+ <xsd:enumeration value="ApplicationAcknowledgementAndErrorReport"/>
+ <xsd:enumeration value="ApplicationErrorAndAcknowledgement"/>
+ <xsd:enumeration value="ApplicationErrorMessage"/>
+ <xsd:enumeration value="ApplicationForBankersDraft"/>
+ <xsd:enumeration value="ApplicationForBankersGuarantee"/>
+ <xsd:enumeration value="ApplicationForDesignationOfBerthingPlaces"/>
+ <xsd:enumeration value="ApplicationForDocumentaryCredit"/>
+ <xsd:enumeration value="ApplicationForExchangeAllocation"/>
+ <xsd:enumeration value="ApplicationForGoodsControlCertificate"/>
+ <xsd:enumeration value="ApplicationForInspectionCertificate"/>
+ <xsd:enumeration value="ApplicationForPhytosanitaryCertificate"/>
+ <xsd:enumeration value="ApplicationForShiftingFromTheDesignatedPlaceInPort"/>
+ <xsd:enumeration value="ApplicationForUsageOfBerthOrMooringFacilities"/>
+ <xsd:enumeration value="ApplicationForVesselsEnteringIntoPortAreaInNight-Time"/>
+ <xsd:enumeration value="ApprovedUnpricedBillOfQuantity"/>
+ <xsd:enumeration value="ArrivalInformation"/>
+ <xsd:enumeration value="ArrivalNoticeGoods"/>
+ <xsd:enumeration value="AssortmentAgainstBlanket"/>
+ <xsd:enumeration value="AtaCarnet"/>
+ <xsd:enumeration value="AuthorizationToPlanAndShipOrders"/>
+ <xsd:enumeration value="AuthorizationToPlanAndSuggestOrders"/>
+ <xsd:enumeration value="AuthorityToProceed"/>
+ <xsd:enumeration value="Bailment"/>
+ <xsd:enumeration value="BailmentContract"/>
+ <xsd:enumeration value="BalanceConfirmation"/>
+ <xsd:enumeration value="BankersDraft"/>
+ <xsd:enumeration value="BankersGuarantee"/>
+ <xsd:enumeration value="BankingStatus"/>
+ <xsd:enumeration value="BankToBankFundsTransfer"/>
+ <xsd:enumeration value="BasicAgreement"/>
+ <xsd:enumeration value="BasicOrderingAgreement"/>
+ <xsd:enumeration value="Bidding"/>
+ <xsd:enumeration value="BillandHold"/>
+ <xsd:enumeration value="BillOfExchange"/>
+ <xsd:enumeration value="BillOfLading"/>
+ <xsd:enumeration value="BillOfLadingCopy"/>
+ <xsd:enumeration value="BillOfLadingOriginal"/>
+ <xsd:enumeration value="BlanketOrder"/>
+ <xsd:enumeration value="BlanketOrderEstimatedQuantities"/>
+ <xsd:enumeration value="BlanketPurchaseAgreement"/>
+ <xsd:enumeration value="BookingConfirmation"/>
+ <xsd:enumeration value="BookingRequest"/>
+ <xsd:enumeration value="Bordereau"/>
+ <xsd:enumeration value="BudgetaryQuote"/>
+ <xsd:enumeration value="BuyAmericaCertificateOfCompliance"/>
+ <xsd:enumeration value="Buying"/>
+ <xsd:enumeration value="CallingForwardNotice"/>
+ <xsd:enumeration value="CallOffDelivery"/>
+ <xsd:enumeration value="CallOffOrder"/>
+ <xsd:enumeration value="CampaignPriceSalesCatalogue"/>
+ <xsd:enumeration value="CargoAcceptanceOrder"/>
+ <xsd:enumeration value="CargoAnalysisVoyageReport"/>
+ <xsd:enumeration value="CargoDeclarationArrival"/>
+ <xsd:enumeration value="CargoDeclarationDeparture"/>
+ <xsd:enumeration value="CargoManifest"/>
+ <xsd:enumeration value="CargoMovementEventLog"/>
+ <xsd:enumeration value="CargoMovementVoyageSummary"/>
+ <xsd:enumeration value="CargoReleaseNotification"/>
+ <xsd:enumeration value="CargoStatus"/>
+ <xsd:enumeration value="CargoVesselDischargeOrder"/>
+ <xsd:enumeration value="CargoVesselLoadingOrder"/>
+ <xsd:enumeration value="CartageOrderLocalTransport"/>
+ <xsd:enumeration value="CashPoolFinancialStatement"/>
+ <xsd:enumeration value="CasingSanitaryCertificate"/>
+ <xsd:enumeration value="CatalogOrder"/>
+ <xsd:enumeration value="Certificate"/>
+ <xsd:enumeration value="CertificateOfAnalysis"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="CertificateOfOrigin"/>
+ <xsd:enumeration value="ApplicationForCertificateOfOrigin"/>
+ <xsd:enumeration value="CertificateOfOriginFormGsp"/>
+ <xsd:enumeration value="CertificateOfQuality"/>
+ <xsd:enumeration value="CertificateOfQuantity"/>
+ <xsd:enumeration value="CertificateOfRegistry"/>
+ <xsd:enumeration value="CertificateOfSealingOfExportMeatLockers"/>
+ <xsd:enumeration value="CertifiedCostAndPriceData"/>
+ <xsd:enumeration value="CertifiedInspectionAndTestResults"/>
+ <xsd:enumeration value="ChangeToContract"/>
+ <xsd:enumeration value="ChangeToPurchaseOrder"/>
+ <xsd:enumeration value="ChangeToRelease"/>
+ <xsd:enumeration value="Chargeback"/>
+ <xsd:enumeration value="ChargesNote"/>
+ <xsd:enumeration value="CivilLiabilityForOilCertificate"/>
+ <xsd:enumeration value="CloseOut"/>
+ <xsd:enumeration value="ClosingStatementOfAnAccount"/>
+ <xsd:enumeration value="CodeChangeRequest"/>
+ <xsd:enumeration value="Co-InsuranceCedingBordereau"/>
+ <xsd:enumeration value="CollateralAccount"/>
+ <xsd:enumeration value="CollectionOrder"/>
+ <xsd:enumeration value="CollectionPaymentAdvice"/>
+ <xsd:enumeration value="CombinedCertificateOfValueAndOrigin"/>
+ <xsd:enumeration value="CombinedTransportBillOfLadingMultimodalBillOfLading"/>
+ <xsd:enumeration value="CombinedTransportDocumentGeneric"/>
+ <xsd:enumeration value="CommercialAccountSummaryResponse"/>
+ <xsd:enumeration value="CommercialDispute"/>
+ <xsd:enumeration value="CommercialInvoice"/>
+ <xsd:enumeration value="CommercialInvoiceWhichIncludesAPackingList"/>
+ <xsd:enumeration value="CommissionNote"/>
+ <xsd:enumeration value="CompositeDataElementChangeRequest"/>
+ <xsd:enumeration value="CompositeDataElementRequest"/>
+ <xsd:enumeration value="Confirmation"/>
+ <xsd:enumeration value="ConsignmentInvoice"/>
+ <xsd:enumeration value="ConsignmentOrder"/>
+ <xsd:enumeration value="ConsignmentStatusReport"/>
+ <xsd:enumeration value="ConsignmentUnpackReport"/>
+ <xsd:enumeration value="ConsolidatedCreditNoteGoodsAndServices"/>
+ <xsd:enumeration value="ConsolidatedInvoice"/>
+ <xsd:enumeration value="ConsularInvoice"/>
+ <xsd:enumeration value="ContainerDischargeList"/>
+ <xsd:enumeration value="ContainerList"/>
+ <xsd:enumeration value="ContainerManifestUnitPackingList"/>
+ <xsd:enumeration value="ContainerOffHireNotice"/>
+ <xsd:enumeration value="ContainerStrippingOrder"/>
+ <xsd:enumeration value="ContainerStuffingOrder"/>
+ <xsd:enumeration value="Contract"/>
+ <xsd:enumeration value="ContractAwardNotification"/>
+ <xsd:enumeration value="ContractBillOfQuantities"/>
+ <xsd:enumeration value="ContractFundsStatusReport"/>
+ <xsd:enumeration value="ContractSecurityClassificationSpecification"/>
+ <xsd:enumeration value="ControlDocumentT5"/>
+ <xsd:enumeration value="ConveyanceDeclarationArrival"/>
+ <xsd:enumeration value="ConveyanceDeclarationCombined"/>
+ <xsd:enumeration value="ConveyanceDeclarationDeparture"/>
+ <xsd:enumeration value="CorporateSuperannuationContributionsAdvice"/>
+ <xsd:enumeration value="CorporateSuperannuationMemberMaintenanceMessage"/>
+ <xsd:enumeration value="CorrectedInvoice"/>
+ <xsd:enumeration value="CostDataSummary"/>
+ <xsd:enumeration value="CostPerformanceReport"/>
+ <xsd:enumeration value="CostPerformanceReportFormat1"/>
+ <xsd:enumeration value="CostPerformanceReportFormat2"/>
+ <xsd:enumeration value="CostPerformanceReportFormat3"/>
+ <xsd:enumeration value="CostPerformanceReportFormat4"/>
+ <xsd:enumeration value="CostPerformanceReportFormat5"/>
+ <xsd:enumeration value="CostScheduleStatusReport"/>
+ <xsd:enumeration value="CoverNote"/>
+ <xsd:enumeration value="CreditAdvice"/>
+ <xsd:enumeration value="CreditCover"/>
+ <xsd:enumeration value="CreditNote"/>
+ <xsd:enumeration value="CreditNoteForPriceVariation"/>
+ <xsd:enumeration value="CreditNoteRelatedToFinancialAdjustments"/>
+ <xsd:enumeration value="CreditNoteRelatedToGoodsOrServices"/>
+ <xsd:enumeration value="CrewListDeclaration"/>
+ <xsd:enumeration value="CrewsEffectsDeclaration"/>
+ <xsd:enumeration value="CrossDockingDespatchAdvice"/>
+ <xsd:enumeration value="CrossDockingOrder"/>
+ <xsd:enumeration value="CrossDockingServicesOrder"/>
+ <xsd:enumeration value="CurrentAccount"/>
+ <xsd:enumeration value="CustomerPaymentOrder"/>
+ <xsd:enumeration value="CustomsClearanceNotice"/>
+ <xsd:enumeration value="CustomsCrewAndConveyance"/>
+ <xsd:enumeration value="CustomsDeclarationPostParcels"/>
+ <xsd:enumeration value="CustomsDeclarationForCargoExamination"/>
+ <xsd:enumeration value="CustomsDeclarationForCargoExaminationAlternate"/>
+ <xsd:enumeration value="CustomsDeclarationWithCommercialAndItemDetail"/>
+ <xsd:enumeration value="CustomsDeclarationWithoutCommercialDetail"/>
+ <xsd:enumeration value="CustomsDeclarationWithoutItemDetail"/>
+ <xsd:enumeration value="CustomsDeliveryNote"/>
+ <xsd:enumeration value="CustomsDocumentsExpirationNotice"/>
+ <xsd:enumeration value="CustomsImmediateReleaseDeclaration"/>
+ <xsd:enumeration value="CustomsInvoice"/>
+ <xsd:enumeration value="CustomsManifest"/>
+ <xsd:enumeration value="CustomsSummaryDeclarationWithCommercialDetailAlternate"/>
+ <xsd:enumeration value="CustomsSummaryDeclarationWithoutCommercialDetailAlternate"/>
+ <xsd:enumeration value="DamageCertification"/>
+ <xsd:enumeration value="DangerousGoodsDeclaration"/>
+ <xsd:enumeration value="DangerousGoodsList"/>
+ <xsd:enumeration value="DebitAdvice"/>
+ <xsd:enumeration value="DebitNote"/>
+ <xsd:enumeration value="DebitNoteRelatedToFinancialAdjustments"/>
+ <xsd:enumeration value="DebitNoteRelatedToGoodsOrServices"/>
+ <xsd:enumeration value="DeclarationOfOrigin"/>
+ <xsd:enumeration value="DeclarationRegardingTheInwardAndOutwardMovementOfVessel"/>
+ <xsd:enumeration value="DelcredereCreditNote"/>
+ <xsd:enumeration value="DelcredereInvoice"/>
+ <xsd:enumeration value="DeliveryForecast"/>
+ <xsd:enumeration value="DeliveryInstructions"/>
+ <xsd:enumeration value="DeliveryJustInTime"/>
+ <xsd:enumeration value="DeliveryNote"/>
+ <xsd:enumeration value="DeliveryNoticeGoods"/>
+ <xsd:enumeration value="DeliveryNoticeRailTransport"/>
+ <xsd:enumeration value="DeliveryOrder"/>
+ <xsd:enumeration value="DeliveryRelease"/>
+ <xsd:enumeration value="DeliverySchedule"/>
+ <xsd:enumeration value="DeliveryScheduleResponse"/>
+ <xsd:enumeration value="DeliveryVerificationCertificate"/>
+ <xsd:enumeration value="DeratDocument"/>
+ <xsd:enumeration value="DespatchAdvice"/>
+ <xsd:enumeration value="DespatchNotePostParcels"/>
+ <xsd:enumeration value="DespatchNoteModelT"/>
+ <xsd:enumeration value="DespatchNoteModelT1"/>
+ <xsd:enumeration value="DespatchNoteModelT2"/>
+ <xsd:enumeration value="DespatchNoteModelT2L"/>
+ <xsd:enumeration value="DespatchOrder"/>
+ <xsd:enumeration value="DirectPaymentValuation"/>
+ <xsd:enumeration value="DirectPaymentValuationRequest"/>
+ <xsd:enumeration value="DirectShip"/>
+ <xsd:enumeration value="DocumentaryCredit"/>
+ <xsd:enumeration value="DocumentaryCreditAcceptanceAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditAmendment"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentInformation"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentNotification"/>
+ <xsd:enumeration value="DocumentaryCreditApplication"/>
+ <xsd:enumeration value="DocumentaryCreditCollectionInstruction"/>
+ <xsd:enumeration value="DocumentaryCreditIssuanceInformation"/>
+ <xsd:enumeration value="DocumentaryCreditLetterOfIndemnity"/>
+ <xsd:enumeration value="DocumentaryCreditNegotiationAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditNotification"/>
+ <xsd:enumeration value="DocumentaryCreditPaymentAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditTransferAdvice"/>
+ <xsd:enumeration value="DocumentResponseCustoms"/>
+ <xsd:enumeration value="DocumentsPresentationForm"/>
+ <xsd:enumeration value="DraftBillOfQuantity"/>
+ <xsd:enumeration value="Drawing"/>
+ <xsd:enumeration value="DrivingLicenceInternational"/>
+ <xsd:enumeration value="DrivingLicenceNational"/>
+ <xsd:enumeration value="Dropship"/>
+ <xsd:enumeration value="EcCarnet"/>
+ <xsd:enumeration value="EdiAssociatedObjectAdministrationMessage"/>
+ <xsd:enumeration value="EmbargoPermit"/>
+ <xsd:enumeration value="EmergencyOrder"/>
+ <xsd:enumeration value="EmptyContainerBill"/>
+ <xsd:enumeration value="EmptyContainerDispositionOrder"/>
+ <xsd:enumeration value="EndUseAuthorization"/>
+ <xsd:enumeration value="Enquiry"/>
+ <xsd:enumeration value="ErrorResponseCustoms"/>
+ <xsd:enumeration value="EscortOfficialRecognition"/>
+ <xsd:enumeration value="EstimatedPricedBillOfQuantity"/>
+ <xsd:enumeration value="Eur1CertificateOfOrigin"/>
+ <xsd:enumeration value="ExceptionalOrder"/>
+ <xsd:enumeration value="ExchangeControlDeclarationImport"/>
+ <xsd:enumeration value="ExchangeControlDeclarationExport"/>
+ <xsd:enumeration value="ExciseCertificate"/>
+ <xsd:enumeration value="ExportLicence"/>
+ <xsd:enumeration value="ApplicationForExportLicence"/>
+ <xsd:enumeration value="ExtendedCreditAdvice"/>
+ <xsd:enumeration value="ExtendedPaymentOrder"/>
+ <xsd:enumeration value="Extra-CommunityTradeStatisticalDeclaration"/>
+ <xsd:enumeration value="FabricateAndHold"/>
+ <xsd:enumeration value="FactoredCreditNote"/>
+ <xsd:enumeration value="FactoredInvoice"/>
+ <xsd:enumeration value="FederalLabelApproval"/>
+ <xsd:enumeration value="FinalPaymentRequestBasedOnCompletionOfWork"/>
+ <xsd:enumeration value="FinancialStatementOfAccount"/>
+ <xsd:enumeration value="FirstSampleTestReport"/>
+ <xsd:enumeration value="ForeignExchangePermit"/>
+ <xsd:enumeration value="FormulaFunds"/>
+ <xsd:enumeration value="ForwardersAdviceToExporter"/>
+ <xsd:enumeration value="ForwardersAdviceToImportAgent"/>
+ <xsd:enumeration value="ForwardersBillOfLading"/>
+ <xsd:enumeration value="ForwardersCertificateOfReceipt"/>
+ <xsd:enumeration value="ForwardersCertificateOfTransport"/>
+ <xsd:enumeration value="ForwardersInvoice"/>
+ <xsd:enumeration value="ForwardersWarehouseReceipt"/>
+ <xsd:enumeration value="ForwardingInstructions"/>
+ <xsd:enumeration value="FreePass"/>
+ <xsd:enumeration value="FreightInvoice"/>
+ <xsd:enumeration value="FreightManifest"/>
+ <xsd:enumeration value="FumigationCertificate"/>
+ <xsd:enumeration value="GatePass"/>
+ <xsd:enumeration value="GeneralCargoSummaryManifestReport"/>
+ <xsd:enumeration value="GeneralResponseCustoms"/>
+ <xsd:enumeration value="GoodsControlCertificate"/>
+ <xsd:enumeration value="GoodsDeclarationForCustomsTransit"/>
+ <xsd:enumeration value="GoodsDeclarationForExportation"/>
+ <xsd:enumeration value="GoodsDeclarationForHomeUse"/>
+ <xsd:enumeration value="GoodsDeclarationForImportation"/>
+ <xsd:enumeration value="GoodsReceipt"/>
+ <xsd:enumeration value="GoodsReceiptCarriage"/>
+ <xsd:enumeration value="GovernmentContract"/>
+ <xsd:enumeration value="Grant"/>
+ <xsd:enumeration value="HandlingOrder"/>
+ <xsd:enumeration value="HireInvoice"/>
+ <xsd:enumeration value="HireOrder"/>
+ <xsd:enumeration value="HorsemeatSanitaryCertificate"/>
+ <xsd:enumeration value="HouseBillOfLading"/>
+ <xsd:enumeration value="HouseWaybill"/>
+ <xsd:enumeration value="IdentityCard"/>
+ <xsd:enumeration value="ImpendingArrival"/>
+ <xsd:enumeration value="ImplementationGuideline"/>
+ <xsd:enumeration value="ImportLicence"/>
+ <xsd:enumeration value="ApplicationForImportLicence"/>
+ <xsd:enumeration value="IndefiniteDeliveryDefiniteQuantity"/>
+ <xsd:enumeration value="IndefiniteDeliveryDefiniteQuantityContract"/>
+ <xsd:enumeration value="IndefiniteDeliveryIndefiniteQuantity"/>
+ <xsd:enumeration value="IndefiniteDeliveryIndefiniteQuantityContract"/>
+ <xsd:enumeration value="IndustrySuperannuationContributionsAdvice"/>
+ <xsd:enumeration value="IndustrySuperannuationMemberMaintenanceMessage"/>
+ <xsd:enumeration value="InedibleSanitaryCertificate"/>
+ <xsd:enumeration value="InformationCopy"/>
+ <xsd:enumeration value="InlandWaterwayBillOfLading"/>
+ <xsd:enumeration value="Inquiry"/>
+ <xsd:enumeration value="InspectionCertificate"/>
+ <xsd:enumeration value="InspectionReport"/>
+ <xsd:enumeration value="InspectionRequest"/>
+ <xsd:enumeration value="InstructionsForBankTransfer"/>
+ <xsd:enumeration value="InstructionToCollect"/>
+ <xsd:enumeration value="InsuranceCertificate"/>
+ <xsd:enumeration value="InsuranceDeclarationSheetBordereau"/>
+ <xsd:enumeration value="InsurancePolicy"/>
+ <xsd:enumeration value="InsurersInvoice"/>
+ <xsd:enumeration value="InterimApplicationForPayment"/>
+ <xsd:enumeration value="InternalTransportOrder"/>
+ <xsd:enumeration value="IntrastatDeclaration"/>
+ <xsd:enumeration value="InventoryAdjustmentStatusReport"/>
+ <xsd:enumeration value="InventoryMovementAdvice"/>
+ <xsd:enumeration value="InventoryReport"/>
+ <xsd:enumeration value="InventoryStatusAdvice"/>
+ <xsd:enumeration value="InvoicingDataSheet"/>
+ <xsd:enumeration value="ItemsBookedToAFinancialAccountReport"/>
+ <xsd:enumeration value="JobLot"/>
+ <xsd:enumeration value="KanbanSchedule"/>
+ <xsd:enumeration value="Lease"/>
+ <xsd:enumeration value="LeaseBlanketAgreement"/>
+ <xsd:enumeration value="LeaseInvoice"/>
+ <xsd:enumeration value="LeaseOrder"/>
+ <xsd:enumeration value="LegalStatementOfAnAccount"/>
+ <xsd:enumeration value="LetterContract"/>
+ <xsd:enumeration value="LetterOfIndemnityForNon-SurrenderOfBillOfLading"/>
+ <xsd:enumeration value="LetterOfIntent"/>
+ <xsd:enumeration value="LifeInsurancePayrollDeductionsAdvice"/>
+ <xsd:enumeration value="ListingStatementOfAnAccount"/>
+ <xsd:enumeration value="LoadlineDocument"/>
+ <xsd:enumeration value="Loan"/>
+ <xsd:enumeration value="LowValuePaymentOrder"/>
+ <xsd:enumeration value="MakeOrBuyPlan"/>
+ <xsd:enumeration value="ManufacturingInstructions"/>
+ <xsd:enumeration value="ManufacturingSpecification"/>
+ <xsd:enumeration value="MaritimeDeclarationOfHealth"/>
+ <xsd:enumeration value="MasterAirWaybill"/>
+ <xsd:enumeration value="MasterBillOfLading"/>
+ <xsd:enumeration value="MaterialInspectionAndReceivingReport"/>
+ <xsd:enumeration value="MateSReceipt"/>
+ <xsd:enumeration value="MeansOfTransportAdvice"/>
+ <xsd:enumeration value="MeansOfTransportationAvailabilityInformation"/>
+ <xsd:enumeration value="MeansOfTransportationScheduleInformation"/>
+ <xsd:enumeration value="MeatAndMeatBy-ProductsSanitaryCertificate"/>
+ <xsd:enumeration value="MeatFoodProductsSanitaryCertificate"/>
+ <xsd:enumeration value="MessageInDevelopmentRequest"/>
+ <xsd:enumeration value="MeteredServicesInvoice"/>
+ <xsd:enumeration value="MillCertificate"/>
+ <xsd:enumeration value="ModificationOfExistingMessage"/>
+ <xsd:enumeration value="MovementCertificateATr1"/>
+ <xsd:enumeration value="MultidropOrder"/>
+ <xsd:enumeration value="MultimodalCombinedTransportDocumentGeneric"/>
+ <xsd:enumeration value="MultimodalTransportDocumentGeneric"/>
+ <xsd:enumeration value="MultiplePaymentOrder"/>
+ <xsd:enumeration value="NameProductPlate"/>
+ <xsd:enumeration value="NewCodeRequest"/>
+ <xsd:enumeration value="NewMessageRequest"/>
+ <xsd:enumeration value="NewOrder"/>
+ <xsd:enumeration value="NewProductIntroduction"/>
+ <xsd:enumeration value="NewStoreOpening"/>
+ <xsd:enumeration value="Non-NegotiableMaritimeTransportDocumentGeneric"/>
+ <xsd:enumeration value="Non-Pre-AuthorisedDirectDebit"/>
+ <xsd:enumeration value="Non-Pre-AuthorisedDirectDebitRequest"/>
+ <xsd:enumeration value="NotForSale"/>
+ <xsd:enumeration value="NoticeOfCircumstancesPreventingDeliveryGoods"/>
+ <xsd:enumeration value="NoticeOfCircumstancesPreventingTransportGoods"/>
+ <xsd:enumeration value="NotificationOfEmergencyShiftingFromTheDesignatedPlaceInPort"/>
+ <xsd:enumeration value="NotificationOfUsageOfBerthOrMooringFacilities"/>
+ <xsd:enumeration value="OfferQuotation"/>
+ <xsd:enumeration value="OperatingInstructions"/>
+ <xsd:enumeration value="OpticalCharacterReadingPayment"/>
+ <xsd:enumeration value="Order"/>
+ <xsd:enumeration value="OrderStatusEnquiry"/>
+ <xsd:enumeration value="OrderStatusReport"/>
+ <xsd:enumeration value="PackageResponseCustoms"/>
+ <xsd:enumeration value="PackingInstructions"/>
+ <xsd:enumeration value="PackingList"/>
+ <xsd:enumeration value="PartialInvoice"/>
+ <xsd:enumeration value="PartyInformation"/>
+ <xsd:enumeration value="PassengerList"/>
+ <xsd:enumeration value="Passport"/>
+ <xsd:enumeration value="PaymentBond"/>
+ <xsd:enumeration value="PaymentOrder"/>
+ <xsd:enumeration value="PaymentOrPerformanceBond"/>
+ <xsd:enumeration value="PaymentRequestForCompletedUnits"/>
+ <xsd:enumeration value="PaymentValuation"/>
+ <xsd:enumeration value="PaymentValuationForUnscheduledItems"/>
+ <xsd:enumeration value="PerformanceBond"/>
+ <xsd:enumeration value="PharmaceuticalSanitaryCertificate"/>
+ <xsd:enumeration value="PhytosanitaryCertificate"/>
+ <xsd:enumeration value="PickUpNotice"/>
+ <xsd:enumeration value="PortChargesDocuments"/>
+ <xsd:enumeration value="PostReceipt"/>
+ <xsd:enumeration value="PoultrySanitaryCertificate"/>
+ <xsd:enumeration value="PreadviceOfACredit"/>
+ <xsd:enumeration value="PreAuthorizedDirectDebit"/>
+ <xsd:enumeration value="PreAuthorizedDirectDebitRequest"/>
+ <xsd:enumeration value="PreferenceCertificateOfOrigin"/>
+ <xsd:enumeration value="PreliminaryCreditAssessment"/>
+ <xsd:enumeration value="PreliminarySalesReport"/>
+ <xsd:enumeration value="PrepaymentInvoice"/>
+ <xsd:enumeration value="PreviousCustomsDocumentMessage"/>
+ <xsd:enumeration value="PriceSalesCatalogue"/>
+ <xsd:enumeration value="PriceSalesCatalogueResponse"/>
+ <xsd:enumeration value="PricedAlternateTenderBillOfQuantity"/>
+ <xsd:enumeration value="PricedTenderBoq"/>
+ <xsd:enumeration value="PriceNegotiationResult"/>
+ <xsd:enumeration value="PriceVariationInvoice"/>
+ <xsd:enumeration value="ProcessDataReport"/>
+ <xsd:enumeration value="ProductDataMessage"/>
+ <xsd:enumeration value="ProductPerformanceReport"/>
+ <xsd:enumeration value="ProductSpecificationReport"/>
+ <xsd:enumeration value="ProformaInvoice"/>
+ <xsd:enumeration value="ProgressiveDischargeReport"/>
+ <xsd:enumeration value="ProjectMasterPlan"/>
+ <xsd:enumeration value="ProjectMasterSchedule"/>
+ <xsd:enumeration value="ProjectPlan"/>
+ <xsd:enumeration value="ProjectPlanningAvailableResources"/>
+ <xsd:enumeration value="ProjectPlanningCalendar"/>
+ <xsd:enumeration value="ProjectProductionPlan"/>
+ <xsd:enumeration value="ProjectRecoveryPlan"/>
+ <xsd:enumeration value="ProjectSchedule"/>
+ <xsd:enumeration value="PromissoryNote"/>
+ <xsd:enumeration value="Promotion"/>
+ <xsd:enumeration value="ProvisionalPaymentValuation"/>
+ <xsd:enumeration value="PurchaseOrder"/>
+ <xsd:enumeration value="PurchaseOrderChangeRequest"/>
+ <xsd:enumeration value="PurchaseOrderResponse"/>
+ <xsd:enumeration value="PurchasingSpecification"/>
+ <xsd:enumeration value="QualityDataMessage"/>
+ <xsd:enumeration value="QuantityValuation"/>
+ <xsd:enumeration value="QuantityValuationRequest"/>
+ <xsd:enumeration value="Query"/>
+ <xsd:enumeration value="QuotaPriorAllocationCertificate"/>
+ <xsd:enumeration value="RailConsignmentNoteGenericTerm"/>
+ <xsd:enumeration value="ReadyForDespatchAdvice"/>
+ <xsd:enumeration value="Reassignment"/>
+ <xsd:enumeration value="ReceiptCustoms"/>
+ <xsd:enumeration value="RechargingDocument"/>
+ <xsd:enumeration value="RecordUpdateService"/>
+ <xsd:enumeration value="RegionalAppellationCertificate"/>
+ <xsd:enumeration value="RegistrationChange"/>
+ <xsd:enumeration value="RegistrationDocument"/>
+ <xsd:enumeration value="RegistrationRenewal"/>
+ <xsd:enumeration value="RejectedDirectDebit"/>
+ <xsd:enumeration value="RelatedDocument"/>
+ <xsd:enumeration value="ReleaseAgainstAssortment"/>
+ <xsd:enumeration value="ReleaseOrDeliveryOrder"/>
+ <xsd:enumeration value="RemittanceAdvice"/>
+ <xsd:enumeration value="RenewalOrder"/>
+ <xsd:enumeration value="Rental"/>
+ <xsd:enumeration value="Reorder"/>
+ <xsd:enumeration value="RepairAndReturn"/>
+ <xsd:enumeration value="RepairOrder"/>
+ <xsd:enumeration value="ReportOfTransactionsForInformationOnly"/>
+ <xsd:enumeration value="ReportOfTransactionsWhichNeedFurtherInformationFromTheReceiver"/>
+ <xsd:enumeration value="RequestForAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="RequestForDeliveryInstructions"/>
+ <xsd:enumeration value="RequestForFinancialCancellation"/>
+ <xsd:enumeration value="RequestForPayment"/>
+ <xsd:enumeration value="RequestForQuote"/>
+ <xsd:enumeration value="RequestForStatisticalData"/>
+ <xsd:enumeration value="RequestForTransfer"/>
+ <xsd:enumeration value="Requirements"/>
+ <xsd:enumeration value="RequirementsContract"/>
+ <xsd:enumeration value="Re-SendingConsignmentNote"/>
+ <xsd:enumeration value="ResponseToAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="ResponseToATradeStatisticsMessage"/>
+ <xsd:enumeration value="ResponseToPreviousBankingStatusMessage"/>
+ <xsd:enumeration value="ResponseToQuery"/>
+ <xsd:enumeration value="ResponseToRegistration"/>
+ <xsd:enumeration value="Restow"/>
+ <xsd:enumeration value="ResumeWorkOrder"/>
+ <xsd:enumeration value="RetailerPrecommitment"/>
+ <xsd:enumeration value="ReversalOfCredit"/>
+ <xsd:enumeration value="ReversalOfDebit"/>
+ <xsd:enumeration value="RoadConsignmentNote"/>
+ <xsd:enumeration value="RoadList-Smgs"/>
+ <xsd:enumeration value="RushOrder"/>
+ <xsd:enumeration value="SafetyAndHazardDataSheet"/>
+ <xsd:enumeration value="SafetyOfEquipmentCertificate"/>
+ <xsd:enumeration value="SafetyOfRadioCertificate"/>
+ <xsd:enumeration value="SafetyOfShipCertificate"/>
+ <xsd:enumeration value="SampleOrder"/>
+ <xsd:enumeration value="SanitaryCertificate"/>
+ <xsd:enumeration value="SeasonTicket"/>
+ <xsd:enumeration value="SeaWaybill"/>
+ <xsd:enumeration value="SegmentChangeRequest"/>
+ <xsd:enumeration value="SegmentRequest"/>
+ <xsd:enumeration value="SelfBilledCreditNote"/>
+ <xsd:enumeration value="Self-BilledInvoice"/>
+ <xsd:enumeration value="SequencedDeliverySchedule"/>
+ <xsd:enumeration value="ServiceDirectoryDefinition"/>
+ <xsd:enumeration value="SettlementOfALetterOfCredit"/>
+ <xsd:enumeration value="ShippedOrder"/>
+ <xsd:enumeration value="ShippersLetterOfInstructionsAir"/>
+ <xsd:enumeration value="ShippingInstructions"/>
+ <xsd:enumeration value="ShippingNote"/>
+ <xsd:enumeration value="ShipsStoresDeclaration"/>
+ <xsd:enumeration value="SimpleDataElementChangeRequest"/>
+ <xsd:enumeration value="SimpleDataElementRequest"/>
+ <xsd:enumeration value="SingleAdministrativeDocument"/>
+ <xsd:enumeration value="SparePartsOrder"/>
+ <xsd:enumeration value="SpecialOrder"/>
+ <xsd:enumeration value="SpotOrder"/>
+ <xsd:enumeration value="StandAloneOrder"/>
+ <xsd:enumeration value="StandingOrder"/>
+ <xsd:enumeration value="StatementOfAccountMessage"/>
+ <xsd:enumeration value="StatisticalAndOtherAdministrativeInternalDocuments"/>
+ <xsd:enumeration value="StatisticalData"/>
+ <xsd:enumeration value="StatisticalDefinitions"/>
+ <xsd:enumeration value="StatisticalDocumentExport"/>
+ <xsd:enumeration value="StatisticalDocumentImport"/>
+ <xsd:enumeration value="StatusInformation"/>
+ <xsd:enumeration value="StatusReport"/>
+ <xsd:enumeration value="StopWork"/>
+ <xsd:enumeration value="StoresRequisition"/>
+ <xsd:enumeration value="SubcontractorPlan"/>
+ <xsd:enumeration value="SubstituteAirWaybill"/>
+ <xsd:enumeration value="SummarySalesReport"/>
+ <xsd:enumeration value="SupplementaryDocumentForApplicationForCargoOperationOfDangerousGoods"/>
+ <xsd:enumeration value="SupplementaryDocumentForApplicationForTransportOfDangerousGoods"/>
+ <xsd:enumeration value="SupplyOrServiceOrder"/>
+ <xsd:enumeration value="SwapOrder"/>
+ <xsd:enumeration value="TankerBillOfLading"/>
+ <xsd:enumeration value="TaskOrder"/>
+ <xsd:enumeration value="TaxCalculationConfirmationResponseCustoms"/>
+ <xsd:enumeration value="TaxDeclarationGeneral"/>
+ <xsd:enumeration value="TaxDeclarationValueAddedTax"/>
+ <xsd:enumeration value="TaxDemand"/>
+ <xsd:enumeration value="TaxInvoice"/>
+ <xsd:enumeration value="TaxNotification"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TestReport"/>
+ <xsd:enumeration value="ThroughBillOfLading"/>
+ <xsd:enumeration value="TifForm"/>
+ <xsd:enumeration value="TimeMaterials"/>
+ <xsd:enumeration value="TirCarnet"/>
+ <xsd:enumeration value="TollConversionOrder"/>
+ <xsd:enumeration value="TrackingNumberAssignmentReport"/>
+ <xsd:enumeration value="TradeData"/>
+ <xsd:enumeration value="TransportCargoReleaseOrder"/>
+ <xsd:enumeration value="TransportDepartureReport"/>
+ <xsd:enumeration value="TransportDischargeInstruction"/>
+ <xsd:enumeration value="TransportDischargeReport"/>
+ <xsd:enumeration value="TransportEmergencyCard"/>
+ <xsd:enumeration value="TransportEmptyEquipmentAdvice"/>
+ <xsd:enumeration value="TransportEquipmentAcceptanceOrder"/>
+ <xsd:enumeration value="TransportEquipmentDamageReport"/>
+ <xsd:enumeration value="TransportEquipmentDeliveryNotice"/>
+ <xsd:enumeration value="TransportEquipmentDirectInterchangeReport"/>
+ <xsd:enumeration value="TransportEquipmentEmptyReleaseInstruction"/>
+ <xsd:enumeration value="TransportEquipmentImpendingArrivalAdvice"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairNotice"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWorkAuthorization"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWorkEstimateAdvice"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWorkEstimateOrder"/>
+ <xsd:enumeration value="TransportEquipmentMovementInstruction"/>
+ <xsd:enumeration value="TransportEquipmentMovementReport"/>
+ <xsd:enumeration value="TransportEquipmentOffHireReport"/>
+ <xsd:enumeration value="TransportEquipmentOffHireRequest"/>
+ <xsd:enumeration value="TransportEquipmentOnHireOrder"/>
+ <xsd:enumeration value="TransportEquipmentOnHireReport"/>
+ <xsd:enumeration value="TransportEquipmentOnHireRequest"/>
+ <xsd:enumeration value="TransportEquipmentPackingInstruction"/>
+ <xsd:enumeration value="TransportEquipmentPickUpAvailabilityConfirmation"/>
+ <xsd:enumeration value="TransportEquipmentPickUpAvailabilityRequest"/>
+ <xsd:enumeration value="TransportEquipmentPickUpReport"/>
+ <xsd:enumeration value="TransportEquipmentShiftReport"/>
+ <xsd:enumeration value="TransportEquipmentSpecialServiceInstruction"/>
+ <xsd:enumeration value="TransportEquipmentStatusChangeReport"/>
+ <xsd:enumeration value="TransportEquipmentStockReport"/>
+ <xsd:enumeration value="TransportEquipmentSurveyOrder"/>
+ <xsd:enumeration value="TransportEquipmentSurveyOrderResponse"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReport"/>
+ <xsd:enumeration value="TransportEquipmentUnpackingInstruction"/>
+ <xsd:enumeration value="TransportEquipmentUnpackingReport"/>
+ <xsd:enumeration value="TransportLoadingInstruction"/>
+ <xsd:enumeration value="TransportLoadingReport"/>
+ <xsd:enumeration value="TransportMovementGateInReport"/>
+ <xsd:enumeration value="TransportMovementGateOutReport"/>
+ <xsd:enumeration value="TransportStatusReport"/>
+ <xsd:enumeration value="TransportStatusRequest"/>
+ <xsd:enumeration value="TransshipmentDespatchAdvice"/>
+ <xsd:enumeration value="TransshipmentOrder"/>
+ <xsd:enumeration value="TreatmentNilOutturn"/>
+ <xsd:enumeration value="TreatmentPersonalEffect"/>
+ <xsd:enumeration value="TreatmentTimber"/>
+ <xsd:enumeration value="TreatmentTimeUpUnderbond"/>
+ <xsd:enumeration value="TreatmentUnderbondBySea"/>
+ <xsd:enumeration value="UnderbondApproval"/>
+ <xsd:enumeration value="UnderbondRequest"/>
+ <xsd:enumeration value="UnitDown"/>
+ <xsd:enumeration value="UnitedNationsStandardMessageRequest"/>
+ <xsd:enumeration value="UnitExchange"/>
+ <xsd:enumeration value="UniversalMultipurposeTransportDocument"/>
+ <xsd:enumeration value="UnpricedBillOfQuantity"/>
+ <xsd:enumeration value="UnshipPermit"/>
+ <xsd:enumeration value="UrgentServiceRequest"/>
+ <xsd:enumeration value="UserDirectoryDefinition"/>
+ <xsd:enumeration value="VaccinationCertificate"/>
+ <xsd:enumeration value="ValidatedPricedTender"/>
+ <xsd:enumeration value="ValueDeclaration"/>
+ <xsd:enumeration value="VesselUnpackReport"/>
+ <xsd:enumeration value="VeterinaryCertificate"/>
+ <xsd:enumeration value="WageDetermination"/>
+ <xsd:enumeration value="WarehouseWarrant"/>
+ <xsd:enumeration value="WarrantyOrder"/>
+ <xsd:enumeration value="Waybill"/>
+ <xsd:enumeration value="WeightCertificate"/>
+ <xsd:enumeration value="WeightList"/>
+ <xsd:enumeration value="WineCertificate"/>
+ <xsd:enumeration value="WoolHealthCertificate"/>
+ <xsd:enumeration value="WrittenInstructionsInConformanceWithAdrArticleNumber10385"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Currency">
+ <xsd:sequence>
+ <xsd:element name="CurrencyCoded" type="CurrencyCode"/>
+ <xsd:element minOccurs="0" name="CurrencyCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Currency" type="Currency"/>
+ <xsd:simpleType name="CurrencyCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AFA"/>
+ <xsd:enumeration value="DZD"/>
+ <xsd:enumeration value="ADF"/>
+ <xsd:enumeration value="ADP"/>
+ <xsd:enumeration value="ARP"/>
+ <xsd:enumeration value="ARS"/>
+ <xsd:enumeration value="ARA"/>
+ <xsd:enumeration value="AMD"/>
+ <xsd:enumeration value="AWF"/>
+ <xsd:enumeration value="AUD"/>
+ <xsd:enumeration value="ATS"/>
+ <xsd:enumeration value="AZM"/>
+ <xsd:enumeration value="BSD"/>
+ <xsd:enumeration value="BHD"/>
+ <xsd:enumeration value="BDT"/>
+ <xsd:enumeration value="BBD"/>
+ <xsd:enumeration value="BYB"/>
+ <xsd:enumeration value="BEF"/>
+ <xsd:enumeration value="BZD"/>
+ <xsd:enumeration value="BMD"/>
+ <xsd:enumeration value="BTN"/>
+ <xsd:enumeration value="BOB"/>
+ <xsd:enumeration value="BAK"/>
+ <xsd:enumeration value="BWP"/>
+ <xsd:enumeration value="BRL"/>
+ <xsd:enumeration value="BND"/>
+ <xsd:enumeration value="BGL"/>
+ <xsd:enumeration value="BIF"/>
+ <xsd:enumeration value="KHR"/>
+ <xsd:enumeration value="CAD"/>
+ <xsd:enumeration value="CVE"/>
+ <xsd:enumeration value="KYD"/>
+ <xsd:enumeration value="XOF"/>
+ <xsd:enumeration value="XAF"/>
+ <xsd:enumeration value="XPF"/>
+ <xsd:enumeration value="CLP"/>
+ <xsd:enumeration value="CLF"/>
+ <xsd:enumeration value="CNY"/>
+ <xsd:enumeration value="COP"/>
+ <xsd:enumeration value="KMF"/>
+ <xsd:enumeration value="CRC"/>
+ <xsd:enumeration value="HRK"/>
+ <xsd:enumeration value="CUP"/>
+ <xsd:enumeration value="CYP"/>
+ <xsd:enumeration value="CZK"/>
+ <xsd:enumeration value="DKK"/>
+ <xsd:enumeration value="DEM"/>
+ <xsd:enumeration value="BAD"/>
+ <xsd:enumeration value="DJF"/>
+ <xsd:enumeration value="DOP"/>
+ <xsd:enumeration value="XCD"/>
+ <xsd:enumeration value="ECS"/>
+ <xsd:enumeration value="EGP"/>
+ <xsd:enumeration value="SVC"/>
+ <xsd:enumeration value="ERN"/>
+ <xsd:enumeration value="EEK"/>
+ <xsd:enumeration value="ETB"/>
+ <xsd:enumeration value="EUR"/>
+ <xsd:enumeration value="XEU"/>
+ <xsd:enumeration value="FKP"/>
+ <xsd:enumeration value="FJD"/>
+ <xsd:enumeration value="ZAL"/>
+ <xsd:enumeration value="FIM"/>
+ <xsd:enumeration value="FRF"/>
+ <xsd:enumeration value="GMD"/>
+ <xsd:enumeration value="GEL"/>
+ <xsd:enumeration value="GHC"/>
+ <xsd:enumeration value="GIP"/>
+ <xsd:enumeration value="XAU"/>
+ <xsd:enumeration value="GRD"/>
+ <xsd:enumeration value="GTQ"/>
+ <xsd:enumeration value="GNF"/>
+ <xsd:enumeration value="GWP"/>
+ <xsd:enumeration value="GYD"/>
+ <xsd:enumeration value="HTG"/>
+ <xsd:enumeration value="HNL"/>
+ <xsd:enumeration value="HKD"/>
+ <xsd:enumeration value="HUF"/>
+ <xsd:enumeration value="ISK"/>
+ <xsd:enumeration value="INR"/>
+ <xsd:enumeration value="IDR"/>
+ <xsd:enumeration value="IRA"/>
+ <xsd:enumeration value="IRR"/>
+ <xsd:enumeration value="IQD"/>
+ <xsd:enumeration value="IEP"/>
+ <xsd:enumeration value="ILS"/>
+ <xsd:enumeration value="ITL"/>
+ <xsd:enumeration value="JMD"/>
+ <xsd:enumeration value="JPY"/>
+ <xsd:enumeration value="JOD"/>
+ <xsd:enumeration value="KZT"/>
+ <xsd:enumeration value="KES"/>
+ <xsd:enumeration value="KWD"/>
+ <xsd:enumeration value="AOR"/>
+ <xsd:enumeration value="KGS"/>
+ <xsd:enumeration value="LAK"/>
+ <xsd:enumeration value="LVL"/>
+ <xsd:enumeration value="LBP"/>
+ <xsd:enumeration value="ALL"/>
+ <xsd:enumeration value="LSL"/>
+ <xsd:enumeration value="LRD"/>
+ <xsd:enumeration value="LYD"/>
+ <xsd:enumeration value="LTL"/>
+ <xsd:enumeration value="LUF"/>
+ <xsd:enumeration value="MOP"/>
+ <xsd:enumeration value="MKD"/>
+ <xsd:enumeration value="MGF"/>
+ <xsd:enumeration value="MWK"/>
+ <xsd:enumeration value="MYR"/>
+ <xsd:enumeration value="MVR"/>
+ <xsd:enumeration value="MTL"/>
+ <xsd:enumeration value="MRO"/>
+ <xsd:enumeration value="MUR"/>
+ <xsd:enumeration value="MXN"/>
+ <xsd:enumeration value="MDL"/>
+ <xsd:enumeration value="MNT"/>
+ <xsd:enumeration value="MAD"/>
+ <xsd:enumeration value="MZM"/>
+ <xsd:enumeration value="BOV"/>
+ <xsd:enumeration value="MMK"/>
+ <xsd:enumeration value="NAD"/>
+ <xsd:enumeration value="NPR"/>
+ <xsd:enumeration value="ANG"/>
+ <xsd:enumeration value="AWG"/>
+ <xsd:enumeration value="NLG"/>
+ <xsd:enumeration value="AON"/>
+ <xsd:enumeration value="TWD"/>
+ <xsd:enumeration value="ZRN"/>
+ <xsd:enumeration value="NZD"/>
+ <xsd:enumeration value="NIO"/>
+ <xsd:enumeration value="NGN"/>
+ <xsd:enumeration value="KPW"/>
+ <xsd:enumeration value="NOK"/>
+ <xsd:enumeration value="PKR"/>
+ <xsd:enumeration value="PAB"/>
+ <xsd:enumeration value="PGK"/>
+ <xsd:enumeration value="PYG"/>
+ <xsd:enumeration value="PEN"/>
+ <xsd:enumeration value="PHP"/>
+ <xsd:enumeration value="PLN"/>
+ <xsd:enumeration value="PLZ"/>
+ <xsd:enumeration value="PTE"/>
+ <xsd:enumeration value="GBP"/>
+ <xsd:enumeration value="QAR"/>
+ <xsd:enumeration value="OMR"/>
+ <xsd:enumeration value="ROL"/>
+ <xsd:enumeration value="RUR"/>
+ <xsd:enumeration value="RWF"/>
+ <xsd:enumeration value="WST"/>
+ <xsd:enumeration value="STD"/>
+ <xsd:enumeration value="SAR"/>
+ <xsd:enumeration value="SBL"/>
+ <xsd:enumeration value="SCR"/>
+ <xsd:enumeration value="SLL"/>
+ <xsd:enumeration value="SGD"/>
+ <xsd:enumeration value="SKK"/>
+ <xsd:enumeration value="SIT"/>
+ <xsd:enumeration value="SBD"/>
+ <xsd:enumeration value="SOS"/>
+ <xsd:enumeration value="ZAR"/>
+ <xsd:enumeration value="KRW"/>
+ <xsd:enumeration value="ESP"/>
+ <xsd:enumeration value="LKR"/>
+ <xsd:enumeration value="SHP"/>
+ <xsd:enumeration value="SDA"/>
+ <xsd:enumeration value="SDD"/>
+ <xsd:enumeration value="SDP"/>
+ <xsd:enumeration value="SRG"/>
+ <xsd:enumeration value="SZL"/>
+ <xsd:enumeration value="SEK"/>
+ <xsd:enumeration value="CHF"/>
+ <xsd:enumeration value="SYP"/>
+ <xsd:enumeration value="TJR"/>
+ <xsd:enumeration value="TZS"/>
+ <xsd:enumeration value="THB"/>
+ <xsd:enumeration value="TPE"/>
+ <xsd:enumeration value="TOP"/>
+ <xsd:enumeration value="TTD"/>
+ <xsd:enumeration value="TND"/>
+ <xsd:enumeration value="TRL"/>
+ <xsd:enumeration value="TMM"/>
+ <xsd:enumeration value="USD"/>
+ <xsd:enumeration value="AED"/>
+ <xsd:enumeration value="UGX"/>
+ <xsd:enumeration value="UAH"/>
+ <xsd:enumeration value="ECV"/>
+ <xsd:enumeration value="UYU"/>
+ <xsd:enumeration value="USN"/>
+ <xsd:enumeration value="UZS"/>
+ <xsd:enumeration value="VUV"/>
+ <xsd:enumeration value="VEB"/>
+ <xsd:enumeration value="VND"/>
+ <xsd:enumeration value="YER"/>
+ <xsd:enumeration value="YUN"/>
+ <xsd:enumeration value="ZMK"/>
+ <xsd:enumeration value="ZWD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Language">
+ <xsd:sequence>
+ <xsd:element name="LanguageCoded" type="LanguageCode"/>
+ <xsd:element minOccurs="0" name="LanguageCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="LocaleCoded" type="LocaleCode"/>
+ <xsd:element minOccurs="0" name="LocaleCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="LanguageDependent" type="xcblBoolean" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="Language" type="Language"/>
+ <xsd:simpleType name="LanguageCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="aa"/>
+ <xsd:enumeration value="ab"/>
+ <xsd:enumeration value="af"/>
+ <xsd:enumeration value="am"/>
+ <xsd:enumeration value="ar"/>
+ <xsd:enumeration value="as"/>
+ <xsd:enumeration value="ay"/>
+ <xsd:enumeration value="az"/>
+ <xsd:enumeration value="ba"/>
+ <xsd:enumeration value="be"/>
+ <xsd:enumeration value="bg"/>
+ <xsd:enumeration value="bh"/>
+ <xsd:enumeration value="bi"/>
+ <xsd:enumeration value="bn"/>
+ <xsd:enumeration value="bo"/>
+ <xsd:enumeration value="br"/>
+ <xsd:enumeration value="ca"/>
+ <xsd:enumeration value="co"/>
+ <xsd:enumeration value="cs"/>
+ <xsd:enumeration value="cy"/>
+ <xsd:enumeration value="da"/>
+ <xsd:enumeration value="de"/>
+ <xsd:enumeration value="dz"/>
+ <xsd:enumeration value="el"/>
+ <xsd:enumeration value="en"/>
+ <xsd:enumeration value="eo"/>
+ <xsd:enumeration value="es"/>
+ <xsd:enumeration value="et"/>
+ <xsd:enumeration value="eu"/>
+ <xsd:enumeration value="fa"/>
+ <xsd:enumeration value="fi"/>
+ <xsd:enumeration value="fj"/>
+ <xsd:enumeration value="fo"/>
+ <xsd:enumeration value="fr"/>
+ <xsd:enumeration value="fy"/>
+ <xsd:enumeration value="ga"/>
+ <xsd:enumeration value="gd"/>
+ <xsd:enumeration value="gl"/>
+ <xsd:enumeration value="gn"/>
+ <xsd:enumeration value="gu"/>
+ <xsd:enumeration value="ha"/>
+ <xsd:enumeration value="he"/>
+ <xsd:enumeration value="hi"/>
+ <xsd:enumeration value="hr"/>
+ <xsd:enumeration value="hu"/>
+ <xsd:enumeration value="hy"/>
+ <xsd:enumeration value="ia"/>
+ <xsd:enumeration value="id"/>
+ <xsd:enumeration value="ie"/>
+ <xsd:enumeration value="ik"/>
+ <xsd:enumeration value="is"/>
+ <xsd:enumeration value="it"/>
+ <xsd:enumeration value="iu"/>
+ <xsd:enumeration value="ja"/>
+ <xsd:enumeration value="jw"/>
+ <xsd:enumeration value="ka"/>
+ <xsd:enumeration value="kk"/>
+ <xsd:enumeration value="kl"/>
+ <xsd:enumeration value="km"/>
+ <xsd:enumeration value="kn"/>
+ <xsd:enumeration value="ko"/>
+ <xsd:enumeration value="ks"/>
+ <xsd:enumeration value="ku"/>
+ <xsd:enumeration value="ky"/>
+ <xsd:enumeration value="la"/>
+ <xsd:enumeration value="ln"/>
+ <xsd:enumeration value="lo"/>
+ <xsd:enumeration value="lt"/>
+ <xsd:enumeration value="lv"/>
+ <xsd:enumeration value="mg"/>
+ <xsd:enumeration value="mi"/>
+ <xsd:enumeration value="mk"/>
+ <xsd:enumeration value="ml"/>
+ <xsd:enumeration value="mn"/>
+ <xsd:enumeration value="mo"/>
+ <xsd:enumeration value="mr"/>
+ <xsd:enumeration value="ms"/>
+ <xsd:enumeration value="mt"/>
+ <xsd:enumeration value="my"/>
+ <xsd:enumeration value="na"/>
+ <xsd:enumeration value="ne"/>
+ <xsd:enumeration value="nl"/>
+ <xsd:enumeration value="no"/>
+ <xsd:enumeration value="oc"/>
+ <xsd:enumeration value="om"/>
+ <xsd:enumeration value="or"/>
+ <xsd:enumeration value="pa"/>
+ <xsd:enumeration value="pl"/>
+ <xsd:enumeration value="ps"/>
+ <xsd:enumeration value="pt"/>
+ <xsd:enumeration value="qu"/>
+ <xsd:enumeration value="rm"/>
+ <xsd:enumeration value="rn"/>
+ <xsd:enumeration value="ro"/>
+ <xsd:enumeration value="ru"/>
+ <xsd:enumeration value="rw"/>
+ <xsd:enumeration value="sa"/>
+ <xsd:enumeration value="sd"/>
+ <xsd:enumeration value="sg"/>
+ <xsd:enumeration value="sh"/>
+ <xsd:enumeration value="si"/>
+ <xsd:enumeration value="sk"/>
+ <xsd:enumeration value="sl"/>
+ <xsd:enumeration value="sm"/>
+ <xsd:enumeration value="sn"/>
+ <xsd:enumeration value="so"/>
+ <xsd:enumeration value="sq"/>
+ <xsd:enumeration value="sr"/>
+ <xsd:enumeration value="ss"/>
+ <xsd:enumeration value="st"/>
+ <xsd:enumeration value="su"/>
+ <xsd:enumeration value="sv"/>
+ <xsd:enumeration value="sw"/>
+ <xsd:enumeration value="ta"/>
+ <xsd:enumeration value="te"/>
+ <xsd:enumeration value="tg"/>
+ <xsd:enumeration value="th"/>
+ <xsd:enumeration value="ti"/>
+ <xsd:enumeration value="tk"/>
+ <xsd:enumeration value="tl"/>
+ <xsd:enumeration value="tn"/>
+ <xsd:enumeration value="to"/>
+ <xsd:enumeration value="tr"/>
+ <xsd:enumeration value="ts"/>
+ <xsd:enumeration value="tt"/>
+ <xsd:enumeration value="tw"/>
+ <xsd:enumeration value="ug"/>
+ <xsd:enumeration value="uk"/>
+ <xsd:enumeration value="ur"/>
+ <xsd:enumeration value="uz"/>
+ <xsd:enumeration value="vi"/>
+ <xsd:enumeration value="vo"/>
+ <xsd:enumeration value="wo"/>
+ <xsd:enumeration value="xh"/>
+ <xsd:enumeration value="yi"/>
+ <xsd:enumeration value="yo"/>
+ <xsd:enumeration value="za"/>
+ <xsd:enumeration value="zh"/>
+ <xsd:enumeration value="zu"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="LocaleCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ae"/>
+ <xsd:enumeration value="af"/>
+ <xsd:enumeration value="ag"/>
+ <xsd:enumeration value="ai"/>
+ <xsd:enumeration value="al"/>
+ <xsd:enumeration value="am"/>
+ <xsd:enumeration value="an"/>
+ <xsd:enumeration value="ao"/>
+ <xsd:enumeration value="aq"/>
+ <xsd:enumeration value="ar"/>
+ <xsd:enumeration value="as"/>
+ <xsd:enumeration value="at"/>
+ <xsd:enumeration value="au"/>
+ <xsd:enumeration value="aw"/>
+ <xsd:enumeration value="az"/>
+ <xsd:enumeration value="ba"/>
+ <xsd:enumeration value="bb"/>
+ <xsd:enumeration value="bd"/>
+ <xsd:enumeration value="be"/>
+ <xsd:enumeration value="bf"/>
+ <xsd:enumeration value="bg"/>
+ <xsd:enumeration value="bh"/>
+ <xsd:enumeration value="bi"/>
+ <xsd:enumeration value="bj"/>
+ <xsd:enumeration value="bm"/>
+ <xsd:enumeration value="bn"/>
+ <xsd:enumeration value="bo"/>
+ <xsd:enumeration value="br"/>
+ <xsd:enumeration value="bs"/>
+ <xsd:enumeration value="bt"/>
+ <xsd:enumeration value="bu"/>
+ <xsd:enumeration value="bw"/>
+ <xsd:enumeration value="by"/>
+ <xsd:enumeration value="bz"/>
+ <xsd:enumeration value="ca"/>
+ <xsd:enumeration value="cc"/>
+ <xsd:enumeration value="cd"/>
+ <xsd:enumeration value="cf"/>
+ <xsd:enumeration value="cg"/>
+ <xsd:enumeration value="ch"/>
+ <xsd:enumeration value="ci"/>
+ <xsd:enumeration value="ck"/>
+ <xsd:enumeration value="cl"/>
+ <xsd:enumeration value="cm"/>
+ <xsd:enumeration value="cn"/>
+ <xsd:enumeration value="co"/>
+ <xsd:enumeration value="cr"/>
+ <xsd:enumeration value="cs"/>
+ <xsd:enumeration value="cu"/>
+ <xsd:enumeration value="cv"/>
+ <xsd:enumeration value="cx"/>
+ <xsd:enumeration value="cy"/>
+ <xsd:enumeration value="cz"/>
+ <xsd:enumeration value="de"/>
+ <xsd:enumeration value="dj"/>
+ <xsd:enumeration value="dk"/>
+ <xsd:enumeration value="dm"/>
+ <xsd:enumeration value="do"/>
+ <xsd:enumeration value="dz"/>
+ <xsd:enumeration value="ec"/>
+ <xsd:enumeration value="ee"/>
+ <xsd:enumeration value="eg"/>
+ <xsd:enumeration value="eh"/>
+ <xsd:enumeration value="er"/>
+ <xsd:enumeration value="es"/>
+ <xsd:enumeration value="et"/>
+ <xsd:enumeration value="fi"/>
+ <xsd:enumeration value="fj"/>
+ <xsd:enumeration value="fk"/>
+ <xsd:enumeration value="fm"/>
+ <xsd:enumeration value="fo"/>
+ <xsd:enumeration value="fr"/>
+ <xsd:enumeration value="ga"/>
+ <xsd:enumeration value="gb"/>
+ <xsd:enumeration value="gd"/>
+ <xsd:enumeration value="ge"/>
+ <xsd:enumeration value="gf"/>
+ <xsd:enumeration value="gh"/>
+ <xsd:enumeration value="gi"/>
+ <xsd:enumeration value="gl"/>
+ <xsd:enumeration value="gm"/>
+ <xsd:enumeration value="gn"/>
+ <xsd:enumeration value="gp"/>
+ <xsd:enumeration value="gq"/>
+ <xsd:enumeration value="gr"/>
+ <xsd:enumeration value="gs"/>
+ <xsd:enumeration value="gt"/>
+ <xsd:enumeration value="gu"/>
+ <xsd:enumeration value="gw"/>
+ <xsd:enumeration value="gy"/>
+ <xsd:enumeration value="hk"/>
+ <xsd:enumeration value="hn"/>
+ <xsd:enumeration value="hr"/>
+ <xsd:enumeration value="ht"/>
+ <xsd:enumeration value="hu"/>
+ <xsd:enumeration value="id"/>
+ <xsd:enumeration value="ie"/>
+ <xsd:enumeration value="il"/>
+ <xsd:enumeration value="in"/>
+ <xsd:enumeration value="io"/>
+ <xsd:enumeration value="iq"/>
+ <xsd:enumeration value="ir"/>
+ <xsd:enumeration value="is"/>
+ <xsd:enumeration value="it"/>
+ <xsd:enumeration value="jm"/>
+ <xsd:enumeration value="jo"/>
+ <xsd:enumeration value="jp"/>
+ <xsd:enumeration value="ke"/>
+ <xsd:enumeration value="kg"/>
+ <xsd:enumeration value="kh"/>
+ <xsd:enumeration value="ki"/>
+ <xsd:enumeration value="km"/>
+ <xsd:enumeration value="kn"/>
+ <xsd:enumeration value="kp"/>
+ <xsd:enumeration value="kr"/>
+ <xsd:enumeration value="kw"/>
+ <xsd:enumeration value="ky"/>
+ <xsd:enumeration value="kz"/>
+ <xsd:enumeration value="la"/>
+ <xsd:enumeration value="lb"/>
+ <xsd:enumeration value="lc"/>
+ <xsd:enumeration value="li"/>
+ <xsd:enumeration value="lk"/>
+ <xsd:enumeration value="lr"/>
+ <xsd:enumeration value="ls"/>
+ <xsd:enumeration value="lt"/>
+ <xsd:enumeration value="lu"/>
+ <xsd:enumeration value="lv"/>
+ <xsd:enumeration value="ly"/>
+ <xsd:enumeration value="ma"/>
+ <xsd:enumeration value="mc"/>
+ <xsd:enumeration value="md"/>
+ <xsd:enumeration value="mg"/>
+ <xsd:enumeration value="mh"/>
+ <xsd:enumeration value="mk"/>
+ <xsd:enumeration value="ml"/>
+ <xsd:enumeration value="mm"/>
+ <xsd:enumeration value="mn"/>
+ <xsd:enumeration value="mo"/>
+ <xsd:enumeration value="mp"/>
+ <xsd:enumeration value="mq"/>
+ <xsd:enumeration value="mr"/>
+ <xsd:enumeration value="ms"/>
+ <xsd:enumeration value="mt"/>
+ <xsd:enumeration value="mu"/>
+ <xsd:enumeration value="mv"/>
+ <xsd:enumeration value="mw"/>
+ <xsd:enumeration value="mx"/>
+ <xsd:enumeration value="my"/>
+ <xsd:enumeration value="mz"/>
+ <xsd:enumeration value="na"/>
+ <xsd:enumeration value="nc"/>
+ <xsd:enumeration value="ne"/>
+ <xsd:enumeration value="nf"/>
+ <xsd:enumeration value="ng"/>
+ <xsd:enumeration value="ni"/>
+ <xsd:enumeration value="nl"/>
+ <xsd:enumeration value="no"/>
+ <xsd:enumeration value="np"/>
+ <xsd:enumeration value="nr"/>
+ <xsd:enumeration value="nu"/>
+ <xsd:enumeration value="nz"/>
+ <xsd:enumeration value="om"/>
+ <xsd:enumeration value="pa"/>
+ <xsd:enumeration value="pe"/>
+ <xsd:enumeration value="pf"/>
+ <xsd:enumeration value="pg"/>
+ <xsd:enumeration value="ph"/>
+ <xsd:enumeration value="pk"/>
+ <xsd:enumeration value="pl"/>
+ <xsd:enumeration value="pm"/>
+ <xsd:enumeration value="pn"/>
+ <xsd:enumeration value="pr"/>
+ <xsd:enumeration value="pt"/>
+ <xsd:enumeration value="pw"/>
+ <xsd:enumeration value="py"/>
+ <xsd:enumeration value="qa"/>
+ <xsd:enumeration value="re"/>
+ <xsd:enumeration value="ro"/>
+ <xsd:enumeration value="ru"/>
+ <xsd:enumeration value="rw"/>
+ <xsd:enumeration value="sa"/>
+ <xsd:enumeration value="sb"/>
+ <xsd:enumeration value="sc"/>
+ <xsd:enumeration value="sd"/>
+ <xsd:enumeration value="se"/>
+ <xsd:enumeration value="sg"/>
+ <xsd:enumeration value="sh"/>
+ <xsd:enumeration value="si"/>
+ <xsd:enumeration value="sj"/>
+ <xsd:enumeration value="sk"/>
+ <xsd:enumeration value="sl"/>
+ <xsd:enumeration value="sm"/>
+ <xsd:enumeration value="sn"/>
+ <xsd:enumeration value="so"/>
+ <xsd:enumeration value="sr"/>
+ <xsd:enumeration value="st"/>
+ <xsd:enumeration value="sv"/>
+ <xsd:enumeration value="sy"/>
+ <xsd:enumeration value="sz"/>
+ <xsd:enumeration value="tc"/>
+ <xsd:enumeration value="td"/>
+ <xsd:enumeration value="tf"/>
+ <xsd:enumeration value="tg"/>
+ <xsd:enumeration value="th"/>
+ <xsd:enumeration value="tj"/>
+ <xsd:enumeration value="tm"/>
+ <xsd:enumeration value="tn"/>
+ <xsd:enumeration value="to"/>
+ <xsd:enumeration value="tp"/>
+ <xsd:enumeration value="tr"/>
+ <xsd:enumeration value="tt"/>
+ <xsd:enumeration value="tv"/>
+ <xsd:enumeration value="tw"/>
+ <xsd:enumeration value="tz"/>
+ <xsd:enumeration value="ua"/>
+ <xsd:enumeration value="ug"/>
+ <xsd:enumeration value="um"/>
+ <xsd:enumeration value="us"/>
+ <xsd:enumeration value="uy"/>
+ <xsd:enumeration value="uz"/>
+ <xsd:enumeration value="va"/>
+ <xsd:enumeration value="vc"/>
+ <xsd:enumeration value="ve"/>
+ <xsd:enumeration value="vg"/>
+ <xsd:enumeration value="vi"/>
+ <xsd:enumeration value="vn"/>
+ <xsd:enumeration value="vu"/>
+ <xsd:enumeration value="wf"/>
+ <xsd:enumeration value="ws"/>
+ <xsd:enumeration value="ye"/>
+ <xsd:enumeration value="yt"/>
+ <xsd:enumeration value="yu"/>
+ <xsd:enumeration value="za"/>
+ <xsd:enumeration value="zm"/>
+ <xsd:enumeration value="zw"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TaxReference">
+ <xsd:complexContent>
+ <xsd:extension base="Tax">
+ <xsd:sequence>
+ <xsd:element name="TaxTreatmentCoded" type="TaxTreatmentCode"/>
+ <xsd:element minOccurs="0" name="TaxTreatmentCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="TaxReference" type="TaxReference"/>
+ <xsd:complexType name="TaxLocation">
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TaxLocation" type="TaxLocation"/>
+ <xsd:complexType name="Tax">
+ <xsd:sequence>
+ <xsd:element name="TaxFunctionQualifierCoded" type="TaxFunctionQualifierCode"/>
+ <xsd:element minOccurs="0" name="TaxFunctionQualifierCodedOther" type="xsd:string"/>
+ <xsd:element name="TaxCategoryCoded" type="TaxCategoryCode"/>
+ <xsd:element minOccurs="0" name="TaxCategoryCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReasonTaxExemptCoded" type="ReasonTaxExemptCode"/>
+ <xsd:element minOccurs="0" name="ReasonTaxExemptCodedOther" type="xsd:string"/>
+ <xsd:element name="TaxTypeCoded" type="TaxTypeCode"/>
+ <xsd:element minOccurs="0" name="TaxTypeCodedOther">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TaxPercent" type="Decimal10_4"/>
+ <xsd:element minOccurs="0" name="TaxPaymentMethodCoded" type="TaxPaymentMethodCode"/>
+ <xsd:element minOccurs="0" name="TaxPaymentMethodCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TaxableAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" name="TaxableAmountInTaxAccountingCurrency" type="Decimal21_6"/>
+ <xsd:element name="TaxAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" name="TaxAmountInTaxAccountingCurrency" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" ref="TaxLocation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Tax" type="Tax"/>
+ <xsd:simpleType name="TaxFunctionQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="IndividualDutyTaxOrFeeCustomsItem"/>
+ <xsd:enumeration value="TotalOfAllDutiesTaxesAndFeesCustomsItem"/>
+ <xsd:enumeration value="TotalOfEachDutyTaxOrFeeTypeCustomsDeclaration"/>
+ <xsd:enumeration value="TotalOfAllDutiesTaxesAndFeeTypesCustomsDeclaration"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="Fee"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="TaxRelatedInformation"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxCategoryCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Agriculture"/>
+ <xsd:enumeration value="DirectPayID"/>
+ <xsd:enumeration value="Disabled"/>
+ <xsd:enumeration value="DisabledVeteran"/>
+ <xsd:enumeration value="DutyPaidBySupplier"/>
+ <xsd:enumeration value="ExemptForExport"/>
+ <xsd:enumeration value="ExemptForResale"/>
+ <xsd:enumeration value="ExemptfromCountyPropertyTax"/>
+ <xsd:enumeration value="ExemptfromLocalPropertyTax"/>
+ <xsd:enumeration value="ExemptfromSchoolPropertyTax"/>
+ <xsd:enumeration value="ExemptfromStatePropertyTax"/>
+ <xsd:enumeration value="ExemptFromTax"/>
+ <xsd:enumeration value="ExemptGoodsandServicesTax"/>
+ <xsd:enumeration value="ExemptLetterOnFile"/>
+ <xsd:enumeration value="ExemptLocalService"/>
+ <xsd:enumeration value="ExemptNotForResale"/>
+ <xsd:enumeration value="Exempt-PerStateLaw"/>
+ <xsd:enumeration value="ExemptProvincialSalesTax"/>
+ <xsd:enumeration value="ExemptSaleToUSGovernment"/>
+ <xsd:enumeration value="ExemptTollService"/>
+ <xsd:enumeration value="FreeExportItemTaxNotCharged"/>
+ <xsd:enumeration value="HigherRate"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="LaborTaxableMaterialExempt"/>
+ <xsd:enumeration value="LowerRate"/>
+ <xsd:enumeration value="MaterialTaxableLaborExempt"/>
+ <xsd:enumeration value="MixedTaxRate"/>
+ <xsd:enumeration value="Non-Homestead"/>
+ <xsd:enumeration value="No-NotTaxExempt"/>
+ <xsd:enumeration value="NotExemptForResale"/>
+ <xsd:enumeration value="NotExemptNotForResale"/>
+ <xsd:enumeration value="NotTaxable"/>
+ <xsd:enumeration value="OpenSpace"/>
+ <xsd:enumeration value="OtherPropertyTaxExemption"/>
+ <xsd:enumeration value="Over65"/>
+ <xsd:enumeration value="RecurringExempt"/>
+ <xsd:enumeration value="ServicesOutsideScopeOfTax"/>
+ <xsd:enumeration value="StandardRate"/>
+ <xsd:enumeration value="TotallyExempt"/>
+ <xsd:enumeration value="Transferred"/>
+ <xsd:enumeration value="UsageExempt"/>
+ <xsd:enumeration value="ValueAddedTaxDueFromAPreviousInvoice"/>
+ <xsd:enumeration value="ValueAddedTaxNotNowDueForPayment"/>
+ <xsd:enumeration value="WorkingFarm"/>
+ <xsd:enumeration value="Yes-TaxExempt"/>
+ <xsd:enumeration value="ZeroRatedGoods"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ReasonTaxExemptCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Exempt-ForExport"/>
+ <xsd:enumeration value="Yes-TaxExempt"/>
+ <xsd:enumeration value="No-NotTaxExempt"/>
+ <xsd:enumeration value="Exempt-ForResale"/>
+ <xsd:enumeration value="NotExemptOrForResale"/>
+ <xsd:enumeration value="Exempt-NotForResale"/>
+ <xsd:enumeration value="NotExemptNotForResale"/>
+ <xsd:enumeration value="DirectPayId"/>
+ <xsd:enumeration value="Exempt-SaleToUSGovernment"/>
+ <xsd:enumeration value="Exempt-PerStateLaw"/>
+ <xsd:enumeration value="LaborTaxableMaterialExempt"/>
+ <xsd:enumeration value="MaterialTaxableLaborExempt"/>
+ <xsd:enumeration value="NotTaxable"/>
+ <xsd:enumeration value="Disabled"/>
+ <xsd:enumeration value="ExemptTollService"/>
+ <xsd:enumeration value="Exempt-GoodsAndServicesTax"/>
+ <xsd:enumeration value="Exempt-ProvincialSalesTax"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="Agriculture"/>
+ <xsd:enumeration value="WorkingFarm"/>
+ <xsd:enumeration value="OpenSpace"/>
+ <xsd:enumeration value="ExemptLocalService"/>
+ <xsd:enumeration value="DisabledVeteran"/>
+ <xsd:enumeration value="Non-Homestead"/>
+ <xsd:enumeration value="Over65"/>
+ <xsd:enumeration value="ExemptFromSchoolPropertyTax"/>
+ <xsd:enumeration value="ExemptFromLocalPropertyTax"/>
+ <xsd:enumeration value="RecurringExempt"/>
+ <xsd:enumeration value="ExemptFromCountyPropertyTax"/>
+ <xsd:enumeration value="TotallyExempt"/>
+ <xsd:enumeration value="UsageExempt"/>
+ <xsd:enumeration value="ExemptFromStatePropertyTax"/>
+ <xsd:enumeration value="OtherPropertyTaxExemption"/>
+ <xsd:enumeration value="Exempt-LetterOnFile"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="911CityTax"/>
+ <xsd:enumeration value="911CountyTax"/>
+ <xsd:enumeration value="911ExciseTax"/>
+ <xsd:enumeration value="911StateTax"/>
+ <xsd:enumeration value="911Tax"/>
+ <xsd:enumeration value="AccommodationsTax"/>
+ <xsd:enumeration value="AdValoremTax"/>
+ <xsd:enumeration value="AgriculturalExportRebate"/>
+ <xsd:enumeration value="Agriculturallevy"/>
+ <xsd:enumeration value="AlcoholicBeverageTax"/>
+ <xsd:enumeration value="AlcoholMarkTax"/>
+ <xsd:enumeration value="AllTaxes"/>
+ <xsd:enumeration value="Anti-DumpingDuty"/>
+ <xsd:enumeration value="Assessment"/>
+ <xsd:enumeration value="BusinessLicenseFee"/>
+ <xsd:enumeration value="BusinessPrivilegeTax"/>
+ <xsd:enumeration value="CarTax"/>
+ <xsd:enumeration value="CityRentalTax"/>
+ <xsd:enumeration value="CitySalesTax"/>
+ <xsd:enumeration value="CityTax"/>
+ <xsd:enumeration value="CoffeeTax"/>
+ <xsd:enumeration value="CoinOperatedDeviceTax"/>
+ <xsd:enumeration value="CommoditySpecificTax"/>
+ <xsd:enumeration value="CorporateIncomeTax"/>
+ <xsd:enumeration value="CountervailingDuty"/>
+ <xsd:enumeration value="CountyOrParishSalesTax"/>
+ <xsd:enumeration value="CountyRentalTax"/>
+ <xsd:enumeration value="CountyTax"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="DefaultLaborTax"/>
+ <xsd:enumeration value="EmploymentTax"/>
+ <xsd:enumeration value="EnergyTax"/>
+ <xsd:enumeration value="Enhanced911StateExciseTax"/>
+ <xsd:enumeration value="EnvironmentalTax"/>
+ <xsd:enumeration value="EquipmentTax"/>
+ <xsd:enumeration value="EstateTax"/>
+ <xsd:enumeration value="ExciseDuty"/>
+ <xsd:enumeration value="FederalExciseTax"/>
+ <xsd:enumeration value="FederalIncomeTaxWithholding"/>
+ <xsd:enumeration value="FederalTax"/>
+ <xsd:enumeration value="FederalValueAddedTaxOnGoods"/>
+ <xsd:enumeration value="FederalValueAddedTaxOnServices"/>
+ <xsd:enumeration value="FeeInLieu"/>
+ <xsd:enumeration value="FICAMedicareTax"/>
+ <xsd:enumeration value="FICASocialSecurityTax"/>
+ <xsd:enumeration value="FICATax"/>
+ <xsd:enumeration value="FranchiseTax"/>
+ <xsd:enumeration value="Free"/>
+ <xsd:enumeration value="FuelLUSTTax"/>
+ <xsd:enumeration value="FuelSpillTax"/>
+ <xsd:enumeration value="FuelSuperFundTax"/>
+ <xsd:enumeration value="GamingTax"/>
+ <xsd:enumeration value="GeneralConstructionTax"/>
+ <xsd:enumeration value="GiftTax"/>
+ <xsd:enumeration value="GoodsAndServicesTax"/>
+ <xsd:enumeration value="GrossReceiptsTax"/>
+ <xsd:enumeration value="HandicapTax"/>
+ <xsd:enumeration value="HazardousWasteTax"/>
+ <xsd:enumeration value="HighwayUseTax"/>
+ <xsd:enumeration value="IlluminantsTax"/>
+ <xsd:enumeration value="ImportTax"/>
+ <xsd:enumeration value="IndividualIncomeTax"/>
+ <xsd:enumeration value="IndividualTax"/>
+ <xsd:enumeration value="InheritanceTax"/>
+ <xsd:enumeration value="InternationalFuelTaxAgreementTax"/>
+ <xsd:enumeration value="LaborByTradeTax"/>
+ <xsd:enumeration value="LeakyUndergroundStorageTankTaxFederal"/>
+ <xsd:enumeration value="LeakyUndergroundStorageTankTaxState"/>
+ <xsd:enumeration value="LicenseTax"/>
+ <xsd:enumeration value="LightDuesPayable"/>
+ <xsd:enumeration value="LocalConstructionTax"/>
+ <xsd:enumeration value="LocalSalesTax"/>
+ <xsd:enumeration value="LocalTax"/>
+ <xsd:enumeration value="LustTax"/>
+ <xsd:enumeration value="MaterialTax"/>
+ <xsd:enumeration value="MetropolitanTransitTax"/>
+ <xsd:enumeration value="MinimumTax"/>
+ <xsd:enumeration value="MiscellaneousCashDeposit"/>
+ <xsd:enumeration value="MiscellaneousStateTax"/>
+ <xsd:enumeration value="MonetaryCompensatoryAmount"/>
+ <xsd:enumeration value="MotorFuelTax"/>
+ <xsd:enumeration value="MunicipalTax"/>
+ <xsd:enumeration value="OccupationalTax"/>
+ <xsd:enumeration value="OtherTaxes"/>
+ <xsd:enumeration value="PaperConsortiumTax-Italy"/>
+ <xsd:enumeration value="PersonalPropertyTax"/>
+ <xsd:enumeration value="PetroleumTax"/>
+ <xsd:enumeration value="PostThresholdTax"/>
+ <xsd:enumeration value="PreferenceDuty"/>
+ <xsd:enumeration value="PreThresholdTax"/>
+ <xsd:enumeration value="ProvisionalcountervailingDutyBond"/>
+ <xsd:enumeration value="ProvisionalCountervailingDutyCash"/>
+ <xsd:enumeration value="ProvisionalDutyBond"/>
+ <xsd:enumeration value="ProvisionalDutyCash"/>
+ <xsd:enumeration value="PublicHealthAndEducationTax"/>
+ <xsd:enumeration value="RealPropertyTax"/>
+ <xsd:enumeration value="SalesAndUseTax"/>
+ <xsd:enumeration value="SchoolTax"/>
+ <xsd:enumeration value="SecondaryPercentageTax"/>
+ <xsd:enumeration value="SeveranceTax"/>
+ <xsd:enumeration value="ShiftedSocialSecurities"/>
+ <xsd:enumeration value="ShiftedWageTax"/>
+ <xsd:enumeration value="SolidWasteTax"/>
+ <xsd:enumeration value="SpecialConstructionTax"/>
+ <xsd:enumeration value="StadiumTax"/>
+ <xsd:enumeration value="StampDuty-ImpostadiBollo"/>
+ <xsd:enumeration value="StateandLocalSalesTax"/>
+ <xsd:enumeration value="StateAndLocalTax"/>
+ <xsd:enumeration value="StateAndProvincialTax"/>
+ <xsd:enumeration value="StateExciseTax"/>
+ <xsd:enumeration value="StateorProvincialFuelTax"/>
+ <xsd:enumeration value="StateOrProvincialSalesTax"/>
+ <xsd:enumeration value="StateorProvincialTaxOnGoods"/>
+ <xsd:enumeration value="StateorProvincialTaxOnServices"/>
+ <xsd:enumeration value="StateRentalTax"/>
+ <xsd:enumeration value="StateTaxonSpecificLabor"/>
+ <xsd:enumeration value="SuperfundTax"/>
+ <xsd:enumeration value="SurTax"/>
+ <xsd:enumeration value="SuspendedDuty"/>
+ <xsd:enumeration value="TelecommunicationsDeviceForTheDeafServiceExciseTax"/>
+ <xsd:enumeration value="TelecommunicationsTax"/>
+ <xsd:enumeration value="ThresholdTax"/>
+ <xsd:enumeration value="TobaccoTax"/>
+ <xsd:enumeration value="TonnageTaxes"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="TourismTax"/>
+ <xsd:enumeration value="TransitTax"/>
+ <xsd:enumeration value="TurnOverTax"/>
+ <xsd:enumeration value="UnemploymentTax"/>
+ <xsd:enumeration value="UseTax"/>
+ <xsd:enumeration value="UtilityUsersTax"/>
+ <xsd:enumeration value="ValuationDeposit"/>
+ <xsd:enumeration value="ValueAddedTax"/>
+ <xsd:enumeration value="WellService"/>
+ <xsd:enumeration value="WithholdingTax"/>
+ <xsd:enumeration value="WorkersCompensationTax"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="Decimal10_4">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="10"/>
+ <xsd:fractionDigits value="4"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxPaymentMethodCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Normal"/>
+ <xsd:enumeration value="DirectPay"/>
+ <xsd:enumeration value="SelfAssess"/>
+ <xsd:enumeration value="PayVendor"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="Decimal21_6">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="21"/>
+ <xsd:fractionDigits value="6"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Location">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="LocationQualifierCoded" type="LocationQualifierCode"/>
+ <xsd:element minOccurs="0" name="LocationQualifierCodedOther" type="xsd:string"/>
+ <xsd:choice>
+ <xsd:element ref="LocationIdentifier"/>
+ <xsd:element name="ExternalAddressID" type="xsd:string"/>
+ <xsd:element ref="NameAddress"/>
+ </xsd:choice>
+ <xsd:element minOccurs="0" ref="GPSCooridinates"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Location" type="Location"/>
+ <xsd:simpleType name="LocationQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="JurisdictionToReceiveCreditForUniformCommercialCodeFiling"/>
+ <xsd:enumeration value="TransmittingUtility"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="CensusScheduleD"/>
+ <xsd:enumeration value="UniformCommercialCodeFilingOffice"/>
+ <xsd:enumeration value="CurrentAddress"/>
+ <xsd:enumeration value="CensusBlockGroup"/>
+ <xsd:enumeration value="HomeAddress"/>
+ <xsd:enumeration value="HomeBaseAddress"/>
+ <xsd:enumeration value="CensusTract"/>
+ <xsd:enumeration value="CensusScheduleK"/>
+ <xsd:enumeration value="LocalAddress"/>
+ <xsd:enumeration value="MailingAddress"/>
+ <xsd:enumeration value="OfficeAddress"/>
+ <xsd:enumeration value="PermanentAddress"/>
+ <xsd:enumeration value="Birthplace"/>
+ <xsd:enumeration value="WorldwideGeographicLocationCode"/>
+ <xsd:enumeration value="NearestCrossStreet"/>
+ <xsd:enumeration value="SecondaryCrossStreet"/>
+ <xsd:enumeration value="Range"/>
+ <xsd:enumeration value="Section"/>
+ <xsd:enumeration value="QuarterSection"/>
+ <xsd:enumeration value="MarkerIdentifierLocation"/>
+ <xsd:enumeration value="Route"/>
+ <xsd:enumeration value="RouteSubdivision"/>
+ <xsd:enumeration value="GridLocation"/>
+ <xsd:enumeration value="Page"/>
+ <xsd:enumeration value="MarkerType"/>
+ <xsd:enumeration value="Latitude-LongitudeSource"/>
+ <xsd:enumeration value="MapSource"/>
+ <xsd:enumeration value="MapReference"/>
+ <xsd:enumeration value="GridSource"/>
+ <xsd:enumeration value="Aliquot"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="District"/>
+ <xsd:enumeration value="DrainholeNumber"/>
+ <xsd:enumeration value="CityBlock"/>
+ <xsd:enumeration value="FootageCallDirection"/>
+ <xsd:enumeration value="LocationDirection"/>
+ <xsd:enumeration value="OuterContinentalLeaseLocation"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MapQuadrangle"/>
+ <xsd:enumeration value="PrincipalMeridian"/>
+ <xsd:enumeration value="OuterContinentalShelfArea"/>
+ <xsd:enumeration value="OuterContinentalShelfBlock"/>
+ <xsd:enumeration value="OfficialProtractionDiagram"/>
+ <xsd:enumeration value="QuarterQuarterQuarterSection"/>
+ <xsd:enumeration value="QuarterQuarterSection"/>
+ <xsd:enumeration value="SectionType"/>
+ <xsd:enumeration value="Abstract"/>
+ <xsd:enumeration value="Labor"/>
+ <xsd:enumeration value="League"/>
+ <xsd:enumeration value="Survey"/>
+ <xsd:enumeration value="Tier"/>
+ <xsd:enumeration value="Tract"/>
+ <xsd:enumeration value="UniversalTransverseMercatorQuadrant"/>
+ <xsd:enumeration value="CourseDirection"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="SendersLocationCode"/>
+ <xsd:enumeration value="ReceiversLocationCode"/>
+ <xsd:enumeration value="Office"/>
+ <xsd:enumeration value="AnnualStatementsMailingAddress"/>
+ <xsd:enumeration value="CityandState"/>
+ <xsd:enumeration value="AllPoints"/>
+ <xsd:enumeration value="ArmedServicesLocationDesignation"/>
+ <xsd:enumeration value="Branch"/>
+ <xsd:enumeration value="BusinessEconomicAreaRegionCode"/>
+ <xsd:enumeration value="GovernmentBillofLadingOfficeCode"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="GeopoliticalNameCode"/>
+ <xsd:enumeration value="CountryOfOrigin"/>
+ <xsd:enumeration value="ConfirmationMailingAddress"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CanadianCustomsOfficeCode"/>
+ <xsd:enumeration value="CorrespondenceMailingAddress"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="NationalRateBasis"/>
+ <xsd:enumeration value="CountyOrParishAndState"/>
+ <xsd:enumeration value="InTankCar"/>
+ <xsd:enumeration value="CanadianSPLC"/>
+ <xsd:enumeration value="CountyOrParish"/>
+ <xsd:enumeration value="DistributionCenterNumber"/>
+ <xsd:enumeration value="Destination-Shipping"/>
+ <xsd:enumeration value="DeliveryLocation"/>
+ <xsd:enumeration value="DistrictOffice"/>
+ <xsd:enumeration value="Department"/>
+ <xsd:enumeration value="DistrictOfResidence"/>
+ <xsd:enumeration value="DomicileTypeCode"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="EmployerLocation"/>
+ <xsd:enumeration value="Factory"/>
+ <xsd:enumeration value="FreightEqualizationPoint"/>
+ <xsd:enumeration value="ForeignFreightForwarderLocation"/>
+ <xsd:enumeration value="FederalInformationProcessingStandards55-NamedPopulatedPlaces"/>
+ <xsd:enumeration value="U.S.CustomsFacilitiesInformationandResourceManagementSystems"/>
+ <xsd:enumeration value="FreightStationAccountingCode"/>
+ <xsd:enumeration value="ForeignTradeZone"/>
+ <xsd:enumeration value="FreeAlongsideVessel-FreeOnBoardPoint"/>
+ <xsd:enumeration value="FreightStationGeographicLocation"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationLocationQualifier"/>
+ <xsd:enumeration value="IssueLocation"/>
+ <xsd:enumeration value="MilitaryStandardMovementProcedures"/>
+ <xsd:enumeration value="Postal"/>
+ <xsd:enumeration value="InStore"/>
+ <xsd:enumeration value="IntermediateFOBPoint"/>
+ <xsd:enumeration value="PortOfEmbarkation"/>
+ <xsd:enumeration value="GovernmentFurnishedPropertyFOBPoint"/>
+ <xsd:enumeration value="LocalOffice"/>
+ <xsd:enumeration value="Mill"/>
+ <xsd:enumeration value="MetropolitanSamplingAreaRegionCode"/>
+ <xsd:enumeration value="MexicanPostalCode"/>
+ <xsd:enumeration value="CityOrStateFromPoints"/>
+ <xsd:enumeration value="Origin-AfterLoadingOnEquipment"/>
+ <xsd:enumeration value="OtherUnlistedFreeOnBoardPoint"/>
+ <xsd:enumeration value="OpenandPrepayStationListCode"/>
+ <xsd:enumeration value="OtherUnlistedAcceptancePoint"/>
+ <xsd:enumeration value="Origin-ShippingPoint"/>
+ <xsd:enumeration value="OnVessel-FreeOnBoardPoint"/>
+ <xsd:enumeration value="PortofArrival"/>
+ <xsd:enumeration value="PortofDischarge"/>
+ <xsd:enumeration value="PolicyMailingAddress"/>
+ <xsd:enumeration value="ParentsAddress"/>
+ <xsd:enumeration value="Primary"/>
+ <xsd:enumeration value="PriorBusiness"/>
+ <xsd:enumeration value="Plant"/>
+ <xsd:enumeration value="PrincipalServicingOffice"/>
+ <xsd:enumeration value="PoolPoint"/>
+ <xsd:enumeration value="3DigitUSZIP"/>
+ <xsd:enumeration value="4DigitUSZIP"/>
+ <xsd:enumeration value="5DigitUSZIP"/>
+ <xsd:enumeration value="3DigitCanadianPostalCode"/>
+ <xsd:enumeration value="6DigitCanadianPostalCode"/>
+ <xsd:enumeration value="RateAreaCode"/>
+ <xsd:enumeration value="InRailCar"/>
+ <xsd:enumeration value="RegionalEducationServiceAgency"/>
+ <xsd:enumeration value="RegionCode"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="Rural"/>
+ <xsd:enumeration value="StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="RouteAdministrativeMessageTo"/>
+ <xsd:enumeration value="Secondary"/>
+ <xsd:enumeration value="Suburban"/>
+ <xsd:enumeration value="CityOrStateAndPointsWithin"/>
+ <xsd:enumeration value="SchoolDistrict"/>
+ <xsd:enumeration value="Summer"/>
+ <xsd:enumeration value="Storage"/>
+ <xsd:enumeration value="SchoolCampusCode"/>
+ <xsd:enumeration value="US-SPLC"/>
+ <xsd:enumeration value="StoreNumber"/>
+ <xsd:enumeration value="StateOrProvince"/>
+ <xsd:enumeration value="School"/>
+ <xsd:enumeration value="InStorageTank"/>
+ <xsd:enumeration value="SwitchingDistrict"/>
+ <xsd:enumeration value="Tank"/>
+ <xsd:enumeration value="TranscontinentalFreightBureau"/>
+ <xsd:enumeration value="TerminalCargoLocation"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="Township"/>
+ <xsd:enumeration value="Temporary"/>
+ <xsd:enumeration value="RailTerritory"/>
+ <xsd:enumeration value="TaxingDistrict"/>
+ <xsd:enumeration value="UnitedNationsLocationCode"/>
+ <xsd:enumeration value="Urban"/>
+ <xsd:enumeration value="BusinessUnit"/>
+ <xsd:enumeration value="Vacation"/>
+ <xsd:enumeration value="Village"/>
+ <xsd:enumeration value="VesselStowageLocation"/>
+ <xsd:enumeration value="Wharf"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Winter"/>
+ <xsd:enumeration value="ZoneCode"/>
+ <xsd:enumeration value="OverseasAndPointLocation"/>
+ <xsd:enumeration value="FinalPortOfDischarge"/>
+ <xsd:enumeration value="CollectChargeLocation"/>
+ <xsd:enumeration value="CustomsOfficeOfManifestOrigin"/>
+ <xsd:enumeration value="CustomsOfficeOfManifestDestination"/>
+ <xsd:enumeration value="ActivityLocation"/>
+ <xsd:enumeration value="OriginRailIntermodalTerminal"/>
+ <xsd:enumeration value="DestinationRailIntermodalTerminal"/>
+ <xsd:enumeration value="FirstOptionalPortOfDischarge"/>
+ <xsd:enumeration value="SecondOptionalPortOfDischarge"/>
+ <xsd:enumeration value="PlaceOfAcceptance"/>
+ <xsd:enumeration value="ReconsolidationPoint"/>
+ <xsd:enumeration value="De-ConsolidationPoint"/>
+ <xsd:enumeration value="PortOfDischarge"/>
+ <xsd:enumeration value="PlaceOfDelivery"/>
+ <xsd:enumeration value="FreightPayableAt"/>
+ <xsd:enumeration value="PortOfEntry"/>
+ <xsd:enumeration value="PortOfExit"/>
+ <xsd:enumeration value="InterimPoint"/>
+ <xsd:enumeration value="BillOfLadingPortOfLoading"/>
+ <xsd:enumeration value="BillOfLadingPortOfDischarge"/>
+ <xsd:enumeration value="PortOfLoading"/>
+ <xsd:enumeration value="Destination"/>
+ <xsd:enumeration value="FinalDestination"/>
+ <xsd:enumeration value="Origin"/>
+ <xsd:enumeration value="DispatchingPool"/>
+ <xsd:enumeration value="BillOfLadingOriginOfGoods"/>
+ <xsd:enumeration value="PlaceOfReceipt"/>
+ <xsd:enumeration value="ReturnPool"/>
+ <xsd:enumeration value="TransshipmentPort"/>
+ <xsd:enumeration value="PrepaidChargeLocation"/>
+ <xsd:enumeration value="BillOfLadingReleaseOffice"/>
+ <xsd:enumeration value="ThirdOptionalPortOfDischarge"/>
+ <xsd:enumeration value="RelayPort"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="LocationIdentifier">
+ <xsd:sequence>
+ <xsd:element name="LocID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="LocationDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LocationIdentifier" type="LocationIdentifier"/>
+ <xsd:complexType name="NameAddress">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ExternalAddressID" type="xsd:string"/>
+ <xsd:element name="Name1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Name2" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Name3" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Identifier"/>
+ <xsd:element minOccurs="0" ref="POBox"/>
+ <xsd:element minOccurs="0" name="Street" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HouseNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="StreetSupplement1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="StreetSupplement2" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Building" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Floor" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RoomNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="InhouseMail" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Department" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PostalCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="City" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="County" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Region"/>
+ <xsd:element minOccurs="0" name="District" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Country"/>
+ <xsd:element minOccurs="0" ref="Timezone"/>
+ </xsd:sequence>
+ <xsd:attribute name="AddressTypeCoded" type="AddressTypeCode" use="optional" default="NotApplicable"/>
+ <xsd:attribute name="AddressTypeCodedOther" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="NameAddress" type="NameAddress"/>
+ <xsd:complexType name="POBox">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="POBoxPostalCode" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="POBox" type="POBox"/>
+ <xsd:complexType name="Region">
+ <xsd:sequence>
+ <xsd:element name="RegionCoded" type="RegionCode"/>
+ <xsd:element minOccurs="0" name="RegionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Region" type="Region"/>
+ <xsd:simpleType name="RegionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AUACT"/>
+ <xsd:enumeration value="AUNSW"/>
+ <xsd:enumeration value="AUNT"/>
+ <xsd:enumeration value="AUQLD"/>
+ <xsd:enumeration value="AUSA"/>
+ <xsd:enumeration value="AUTAS"/>
+ <xsd:enumeration value="AUVIC"/>
+ <xsd:enumeration value="AUWA"/>
+ <xsd:enumeration value="BRAC"/>
+ <xsd:enumeration value="BRAL"/>
+ <xsd:enumeration value="BRAM"/>
+ <xsd:enumeration value="BRAP"/>
+ <xsd:enumeration value="BRBA"/>
+ <xsd:enumeration value="BRCE"/>
+ <xsd:enumeration value="BRDF"/>
+ <xsd:enumeration value="BRES"/>
+ <xsd:enumeration value="BRGO"/>
+ <xsd:enumeration value="BRMA"/>
+ <xsd:enumeration value="BRMG"/>
+ <xsd:enumeration value="BRMS"/>
+ <xsd:enumeration value="BRMT"/>
+ <xsd:enumeration value="BRPA"/>
+ <xsd:enumeration value="BRPB"/>
+ <xsd:enumeration value="BRPE"/>
+ <xsd:enumeration value="BRPI"/>
+ <xsd:enumeration value="BRPR"/>
+ <xsd:enumeration value="BRRJ"/>
+ <xsd:enumeration value="BRRN"/>
+ <xsd:enumeration value="BRRO"/>
+ <xsd:enumeration value="BRRR"/>
+ <xsd:enumeration value="BRRS"/>
+ <xsd:enumeration value="BRSC"/>
+ <xsd:enumeration value="BRSE"/>
+ <xsd:enumeration value="BRSP"/>
+ <xsd:enumeration value="BRTO"/>
+ <xsd:enumeration value="CAAB"/>
+ <xsd:enumeration value="CABC"/>
+ <xsd:enumeration value="CAMB"/>
+ <xsd:enumeration value="CANB"/>
+ <xsd:enumeration value="CANF"/>
+ <xsd:enumeration value="CANS"/>
+ <xsd:enumeration value="CANT"/>
+ <xsd:enumeration value="CAON"/>
+ <xsd:enumeration value="CAPE"/>
+ <xsd:enumeration value="CAQC"/>
+ <xsd:enumeration value="CASK"/>
+ <xsd:enumeration value="CAYT"/>
+ <xsd:enumeration value="GBAM"/>
+ <xsd:enumeration value="GBAR"/>
+ <xsd:enumeration value="GBAT"/>
+ <xsd:enumeration value="GBBA"/>
+ <xsd:enumeration value="GBBB"/>
+ <xsd:enumeration value="GBBE"/>
+ <xsd:enumeration value="GBBF"/>
+ <xsd:enumeration value="GBBH"/>
+ <xsd:enumeration value="GBBK"/>
+ <xsd:enumeration value="GBBL"/>
+ <xsd:enumeration value="GBBM"/>
+ <xsd:enumeration value="GBBN"/>
+ <xsd:enumeration value="GBBO"/>
+ <xsd:enumeration value="GBBP"/>
+ <xsd:enumeration value="GBBR"/>
+ <xsd:enumeration value="GBBS"/>
+ <xsd:enumeration value="GBBU"/>
+ <xsd:enumeration value="GBBY"/>
+ <xsd:enumeration value="GBCA"/>
+ <xsd:enumeration value="GBCE"/>
+ <xsd:enumeration value="GBCG"/>
+ <xsd:enumeration value="GBCH"/>
+ <xsd:enumeration value="GBCI"/>
+ <xsd:enumeration value="GBCK"/>
+ <xsd:enumeration value="GBCL"/>
+ <xsd:enumeration value="GBCO"/>
+ <xsd:enumeration value="GBCR"/>
+ <xsd:enumeration value="GBCS"/>
+ <xsd:enumeration value="GBCU"/>
+ <xsd:enumeration value="GBCV"/>
+ <xsd:enumeration value="GBDB"/>
+ <xsd:enumeration value="GBDF"/>
+ <xsd:enumeration value="GBDG"/>
+ <xsd:enumeration value="GBDL"/>
+ <xsd:enumeration value="GBDN"/>
+ <xsd:enumeration value="GBDO"/>
+ <xsd:enumeration value="GBDU"/>
+ <xsd:enumeration value="GBDV"/>
+ <xsd:enumeration value="GBDY"/>
+ <xsd:enumeration value="GBER"/>
+ <xsd:enumeration value="GBES"/>
+ <xsd:enumeration value="GBFI"/>
+ <xsd:enumeration value="GBFM"/>
+ <xsd:enumeration value="GBGL"/>
+ <xsd:enumeration value="GBGM"/>
+ <xsd:enumeration value="GBGR"/>
+ <xsd:enumeration value="GBGS"/>
+ <xsd:enumeration value="GBGW"/>
+ <xsd:enumeration value="GBGY"/>
+ <xsd:enumeration value="GBHA"/>
+ <xsd:enumeration value="GBHI"/>
+ <xsd:enumeration value="GBHL"/>
+ <xsd:enumeration value="GBHR"/>
+ <xsd:enumeration value="GBHT"/>
+ <xsd:enumeration value="GBHW"/>
+ <xsd:enumeration value="GBIW"/>
+ <xsd:enumeration value="GBKE"/>
+ <xsd:enumeration value="GBKH"/>
+ <xsd:enumeration value="GBLA"/>
+ <xsd:enumeration value="GBLC"/>
+ <xsd:enumeration value="GBLD"/>
+ <xsd:enumeration value="GBLE"/>
+ <xsd:enumeration value="GBLI"/>
+ <xsd:enumeration value="GBLM"/>
+ <xsd:enumeration value="GBLO"/>
+ <xsd:enumeration value="GBLR"/>
+ <xsd:enumeration value="GBLS"/>
+ <xsd:enumeration value="GBLT"/>
+ <xsd:enumeration value="GBLU"/>
+ <xsd:enumeration value="GBMA"/>
+ <xsd:enumeration value="GBMG"/>
+ <xsd:enumeration value="GBMI"/>
+ <xsd:enumeration value="GBMK"/>
+ <xsd:enumeration value="GBMO"/>
+ <xsd:enumeration value="GBMY"/>
+ <xsd:enumeration value="GBNA"/>
+ <xsd:enumeration value="GBNB"/>
+ <xsd:enumeration value="GBNC"/>
+ <xsd:enumeration value="GBND"/>
+ <xsd:enumeration value="GBNE"/>
+ <xsd:enumeration value="GBNH"/>
+ <xsd:enumeration value="GBNK"/>
+ <xsd:enumeration value="GBNL"/>
+ <xsd:enumeration value="GBNM"/>
+ <xsd:enumeration value="GBNS"/>
+ <xsd:enumeration value="GBNT"/>
+ <xsd:enumeration value="GBNU"/>
+ <xsd:enumeration value="GBOM"/>
+ <xsd:enumeration value="GBOR"/>
+ <xsd:enumeration value="GBOX"/>
+ <xsd:enumeration value="GBPB"/>
+ <xsd:enumeration value="GBPL"/>
+ <xsd:enumeration value="GBPM"/>
+ <xsd:enumeration value="GBPO"/>
+ <xsd:enumeration value="GBPY"/>
+ <xsd:enumeration value="GBRD"/>
+ <xsd:enumeration value="GBRE"/>
+ <xsd:enumeration value="GBRM"/>
+ <xsd:enumeration value="GBRU"/>
+ <xsd:enumeration value="GBSC"/>
+ <xsd:enumeration value="GBSD"/>
+ <xsd:enumeration value="GBSE"/>
+ <xsd:enumeration value="GBSG"/>
+ <xsd:enumeration value="GBSH"/>
+ <xsd:enumeration value="GBSK"/>
+ <xsd:enumeration value="GBSL"/>
+ <xsd:enumeration value="GBSN"/>
+ <xsd:enumeration value="GBSO"/>
+ <xsd:enumeration value="GBSP"/>
+ <xsd:enumeration value="GBSR"/>
+ <xsd:enumeration value="GBST"/>
+ <xsd:enumeration value="GBSU"/>
+ <xsd:enumeration value="GBSW"/>
+ <xsd:enumeration value="GBSY"/>
+ <xsd:enumeration value="GBTA"/>
+ <xsd:enumeration value="GBTD"/>
+ <xsd:enumeration value="GBTH"/>
+ <xsd:enumeration value="GBTO"/>
+ <xsd:enumeration value="GBTW"/>
+ <xsd:enumeration value="GBWA"/>
+ <xsd:enumeration value="GBWD"/>
+ <xsd:enumeration value="GBWG"/>
+ <xsd:enumeration value="GBWI"/>
+ <xsd:enumeration value="GBWL"/>
+ <xsd:enumeration value="GBWM"/>
+ <xsd:enumeration value="GBWO"/>
+ <xsd:enumeration value="GBWR"/>
+ <xsd:enumeration value="GBWT"/>
+ <xsd:enumeration value="GBYK"/>
+ <xsd:enumeration value="GBYN"/>
+ <xsd:enumeration value="GBYS"/>
+ <xsd:enumeration value="GBYW"/>
+ <xsd:enumeration value="ITAG"/>
+ <xsd:enumeration value="ITAL"/>
+ <xsd:enumeration value="ITAN"/>
+ <xsd:enumeration value="ITAO"/>
+ <xsd:enumeration value="ITAP"/>
+ <xsd:enumeration value="ITAQ"/>
+ <xsd:enumeration value="ITAR"/>
+ <xsd:enumeration value="ITAT"/>
+ <xsd:enumeration value="ITAV"/>
+ <xsd:enumeration value="ITBA"/>
+ <xsd:enumeration value="ITBG"/>
+ <xsd:enumeration value="ITBI"/>
+ <xsd:enumeration value="ITBL"/>
+ <xsd:enumeration value="ITBN"/>
+ <xsd:enumeration value="ITBO"/>
+ <xsd:enumeration value="ITBR"/>
+ <xsd:enumeration value="ITBS"/>
+ <xsd:enumeration value="ITBZ"/>
+ <xsd:enumeration value="ITCA"/>
+ <xsd:enumeration value="ITCB"/>
+ <xsd:enumeration value="ITCE"/>
+ <xsd:enumeration value="ITCH"/>
+ <xsd:enumeration value="ITCL"/>
+ <xsd:enumeration value="ITCN"/>
+ <xsd:enumeration value="ITCO"/>
+ <xsd:enumeration value="ITCR"/>
+ <xsd:enumeration value="ITCS"/>
+ <xsd:enumeration value="ITCT"/>
+ <xsd:enumeration value="ITCZ"/>
+ <xsd:enumeration value="ITEN"/>
+ <xsd:enumeration value="ITFE"/>
+ <xsd:enumeration value="ITFG"/>
+ <xsd:enumeration value="ITFI"/>
+ <xsd:enumeration value="ITFO"/>
+ <xsd:enumeration value="ITFR"/>
+ <xsd:enumeration value="ITGE"/>
+ <xsd:enumeration value="ITGO"/>
+ <xsd:enumeration value="ITGR"/>
+ <xsd:enumeration value="ITIM"/>
+ <xsd:enumeration value="ITIS"/>
+ <xsd:enumeration value="ITKR"/>
+ <xsd:enumeration value="ITLC"/>
+ <xsd:enumeration value="ITLE"/>
+ <xsd:enumeration value="ITLI"/>
+ <xsd:enumeration value="ITLO"/>
+ <xsd:enumeration value="ITLT"/>
+ <xsd:enumeration value="ITLU"/>
+ <xsd:enumeration value="ITMC"/>
+ <xsd:enumeration value="ITME"/>
+ <xsd:enumeration value="ITMI"/>
+ <xsd:enumeration value="ITMN"/>
+ <xsd:enumeration value="ITMO"/>
+ <xsd:enumeration value="ITMS"/>
+ <xsd:enumeration value="ITMT"/>
+ <xsd:enumeration value="ITNA"/>
+ <xsd:enumeration value="ITNO"/>
+ <xsd:enumeration value="ITNU"/>
+ <xsd:enumeration value="ITOR"/>
+ <xsd:enumeration value="ITPA"/>
+ <xsd:enumeration value="ITPC"/>
+ <xsd:enumeration value="ITPD"/>
+ <xsd:enumeration value="ITPE"/>
+ <xsd:enumeration value="ITPG"/>
+ <xsd:enumeration value="ITPI"/>
+ <xsd:enumeration value="ITPN"/>
+ <xsd:enumeration value="ITPO"/>
+ <xsd:enumeration value="ITPR"/>
+ <xsd:enumeration value="ITPS"/>
+ <xsd:enumeration value="ITPT"/>
+ <xsd:enumeration value="ITPV"/>
+ <xsd:enumeration value="ITPZ"/>
+ <xsd:enumeration value="ITRA"/>
+ <xsd:enumeration value="ITRC"/>
+ <xsd:enumeration value="ITRE"/>
+ <xsd:enumeration value="ITRG"/>
+ <xsd:enumeration value="ITRI"/>
+ <xsd:enumeration value="ITRM"/>
+ <xsd:enumeration value="ITRN"/>
+ <xsd:enumeration value="ITRO"/>
+ <xsd:enumeration value="ITRV"/>
+ <xsd:enumeration value="ITSA"/>
+ <xsd:enumeration value="ITSI"/>
+ <xsd:enumeration value="ITSO"/>
+ <xsd:enumeration value="ITSP"/>
+ <xsd:enumeration value="ITSR"/>
+ <xsd:enumeration value="ITSS"/>
+ <xsd:enumeration value="ITSV"/>
+ <xsd:enumeration value="ITTA"/>
+ <xsd:enumeration value="ITTE"/>
+ <xsd:enumeration value="ITTN"/>
+ <xsd:enumeration value="ITTO"/>
+ <xsd:enumeration value="ITTP"/>
+ <xsd:enumeration value="ITTR"/>
+ <xsd:enumeration value="ITTS"/>
+ <xsd:enumeration value="ITTV"/>
+ <xsd:enumeration value="ITUD"/>
+ <xsd:enumeration value="ITVA"/>
+ <xsd:enumeration value="ITVC"/>
+ <xsd:enumeration value="ITVE"/>
+ <xsd:enumeration value="ITVI"/>
+ <xsd:enumeration value="ITVR"/>
+ <xsd:enumeration value="ITVT"/>
+ <xsd:enumeration value="ITVV"/>
+ <xsd:enumeration value="USAK"/>
+ <xsd:enumeration value="USAL"/>
+ <xsd:enumeration value="USAR"/>
+ <xsd:enumeration value="USAS"/>
+ <xsd:enumeration value="USAZ"/>
+ <xsd:enumeration value="USCA"/>
+ <xsd:enumeration value="USCO"/>
+ <xsd:enumeration value="USCT"/>
+ <xsd:enumeration value="USDC"/>
+ <xsd:enumeration value="USDE"/>
+ <xsd:enumeration value="USFL"/>
+ <xsd:enumeration value="USGA"/>
+ <xsd:enumeration value="USGU"/>
+ <xsd:enumeration value="USHI"/>
+ <xsd:enumeration value="USIA"/>
+ <xsd:enumeration value="USID"/>
+ <xsd:enumeration value="USIL"/>
+ <xsd:enumeration value="USIN"/>
+ <xsd:enumeration value="USKS"/>
+ <xsd:enumeration value="USKY"/>
+ <xsd:enumeration value="USLA"/>
+ <xsd:enumeration value="USMA"/>
+ <xsd:enumeration value="USMD"/>
+ <xsd:enumeration value="USME"/>
+ <xsd:enumeration value="USMI"/>
+ <xsd:enumeration value="USMN"/>
+ <xsd:enumeration value="USMO"/>
+ <xsd:enumeration value="USMP"/>
+ <xsd:enumeration value="USMS"/>
+ <xsd:enumeration value="USMT"/>
+ <xsd:enumeration value="USNC"/>
+ <xsd:enumeration value="USND"/>
+ <xsd:enumeration value="USNE"/>
+ <xsd:enumeration value="USNH"/>
+ <xsd:enumeration value="USNJ"/>
+ <xsd:enumeration value="USNM"/>
+ <xsd:enumeration value="USNV"/>
+ <xsd:enumeration value="USNY"/>
+ <xsd:enumeration value="USOH"/>
+ <xsd:enumeration value="USOK"/>
+ <xsd:enumeration value="USOR"/>
+ <xsd:enumeration value="USPA"/>
+ <xsd:enumeration value="USPR"/>
+ <xsd:enumeration value="USRI"/>
+ <xsd:enumeration value="USSC"/>
+ <xsd:enumeration value="USSD"/>
+ <xsd:enumeration value="USTN"/>
+ <xsd:enumeration value="USTX"/>
+ <xsd:enumeration value="USUT"/>
+ <xsd:enumeration value="USVA"/>
+ <xsd:enumeration value="USVI"/>
+ <xsd:enumeration value="USVT"/>
+ <xsd:enumeration value="USWA"/>
+ <xsd:enumeration value="USWI"/>
+ <xsd:enumeration value="USWV"/>
+ <xsd:enumeration value="USWY"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Country">
+ <xsd:sequence>
+ <xsd:element name="CountryCoded" type="CountryCode"/>
+ <xsd:element minOccurs="0" name="CountryCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Country" type="Country"/>
+ <xsd:simpleType name="CountryCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AE"/>
+ <xsd:enumeration value="AF"/>
+ <xsd:enumeration value="AG"/>
+ <xsd:enumeration value="AI"/>
+ <xsd:enumeration value="AL"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="AN"/>
+ <xsd:enumeration value="AO"/>
+ <xsd:enumeration value="AQ"/>
+ <xsd:enumeration value="AR"/>
+ <xsd:enumeration value="AS"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="AU"/>
+ <xsd:enumeration value="AW"/>
+ <xsd:enumeration value="AZ"/>
+ <xsd:enumeration value="BA"/>
+ <xsd:enumeration value="BB"/>
+ <xsd:enumeration value="BD"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BF"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BH"/>
+ <xsd:enumeration value="BI"/>
+ <xsd:enumeration value="BJ"/>
+ <xsd:enumeration value="BM"/>
+ <xsd:enumeration value="BN"/>
+ <xsd:enumeration value="BO"/>
+ <xsd:enumeration value="BR"/>
+ <xsd:enumeration value="BS"/>
+ <xsd:enumeration value="BT"/>
+ <xsd:enumeration value="BU"/>
+ <xsd:enumeration value="BW"/>
+ <xsd:enumeration value="BY"/>
+ <xsd:enumeration value="BZ"/>
+ <xsd:enumeration value="CA"/>
+ <xsd:enumeration value="CC"/>
+ <xsd:enumeration value="CD"/>
+ <xsd:enumeration value="CF"/>
+ <xsd:enumeration value="CG"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CI"/>
+ <xsd:enumeration value="CK"/>
+ <xsd:enumeration value="CL"/>
+ <xsd:enumeration value="CM"/>
+ <xsd:enumeration value="CN"/>
+ <xsd:enumeration value="CO"/>
+ <xsd:enumeration value="CR"/>
+ <xsd:enumeration value="CS"/>
+ <xsd:enumeration value="CU"/>
+ <xsd:enumeration value="CV"/>
+ <xsd:enumeration value="CX"/>
+ <xsd:enumeration value="CY"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DJ"/>
+ <xsd:enumeration value="DK"/>
+ <xsd:enumeration value="DM"/>
+ <xsd:enumeration value="DO"/>
+ <xsd:enumeration value="DZ"/>
+ <xsd:enumeration value="EC"/>
+ <xsd:enumeration value="EE"/>
+ <xsd:enumeration value="EG"/>
+ <xsd:enumeration value="EH"/>
+ <xsd:enumeration value="ER"/>
+ <xsd:enumeration value="ES"/>
+ <xsd:enumeration value="ET"/>
+ <xsd:enumeration value="FI"/>
+ <xsd:enumeration value="FJ"/>
+ <xsd:enumeration value="FK"/>
+ <xsd:enumeration value="FM"/>
+ <xsd:enumeration value="FO"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="GA"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GD"/>
+ <xsd:enumeration value="GE"/>
+ <xsd:enumeration value="GF"/>
+ <xsd:enumeration value="GH"/>
+ <xsd:enumeration value="GI"/>
+ <xsd:enumeration value="GL"/>
+ <xsd:enumeration value="GM"/>
+ <xsd:enumeration value="GN"/>
+ <xsd:enumeration value="GP"/>
+ <xsd:enumeration value="GQ"/>
+ <xsd:enumeration value="GR"/>
+ <xsd:enumeration value="GS"/>
+ <xsd:enumeration value="GT"/>
+ <xsd:enumeration value="GU"/>
+ <xsd:enumeration value="GW"/>
+ <xsd:enumeration value="GY"/>
+ <xsd:enumeration value="HK"/>
+ <xsd:enumeration value="HN"/>
+ <xsd:enumeration value="HR"/>
+ <xsd:enumeration value="HT"/>
+ <xsd:enumeration value="HU"/>
+ <xsd:enumeration value="ID"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IL"/>
+ <xsd:enumeration value="IN"/>
+ <xsd:enumeration value="IO"/>
+ <xsd:enumeration value="IQ"/>
+ <xsd:enumeration value="IR"/>
+ <xsd:enumeration value="IS"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="JM"/>
+ <xsd:enumeration value="JO"/>
+ <xsd:enumeration value="JP"/>
+ <xsd:enumeration value="KE"/>
+ <xsd:enumeration value="KG"/>
+ <xsd:enumeration value="KH"/>
+ <xsd:enumeration value="KI"/>
+ <xsd:enumeration value="KM"/>
+ <xsd:enumeration value="KN"/>
+ <xsd:enumeration value="KP"/>
+ <xsd:enumeration value="KR"/>
+ <xsd:enumeration value="KW"/>
+ <xsd:enumeration value="KY"/>
+ <xsd:enumeration value="KZ"/>
+ <xsd:enumeration value="LA"/>
+ <xsd:enumeration value="LB"/>
+ <xsd:enumeration value="LC"/>
+ <xsd:enumeration value="LI"/>
+ <xsd:enumeration value="LK"/>
+ <xsd:enumeration value="LR"/>
+ <xsd:enumeration value="LS"/>
+ <xsd:enumeration value="LT"/>
+ <xsd:enumeration value="LU"/>
+ <xsd:enumeration value="LV"/>
+ <xsd:enumeration value="LY"/>
+ <xsd:enumeration value="MA"/>
+ <xsd:enumeration value="MC"/>
+ <xsd:enumeration value="MD"/>
+ <xsd:enumeration value="MG"/>
+ <xsd:enumeration value="MH"/>
+ <xsd:enumeration value="MK"/>
+ <xsd:enumeration value="ML"/>
+ <xsd:enumeration value="MM"/>
+ <xsd:enumeration value="MN"/>
+ <xsd:enumeration value="MO"/>
+ <xsd:enumeration value="MP"/>
+ <xsd:enumeration value="MQ"/>
+ <xsd:enumeration value="MR"/>
+ <xsd:enumeration value="MS"/>
+ <xsd:enumeration value="MT"/>
+ <xsd:enumeration value="MU"/>
+ <xsd:enumeration value="MV"/>
+ <xsd:enumeration value="MW"/>
+ <xsd:enumeration value="MX"/>
+ <xsd:enumeration value="MY"/>
+ <xsd:enumeration value="MZ"/>
+ <xsd:enumeration value="NA"/>
+ <xsd:enumeration value="NC"/>
+ <xsd:enumeration value="NE"/>
+ <xsd:enumeration value="NF"/>
+ <xsd:enumeration value="NG"/>
+ <xsd:enumeration value="NI"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NO"/>
+ <xsd:enumeration value="NP"/>
+ <xsd:enumeration value="NR"/>
+ <xsd:enumeration value="NU"/>
+ <xsd:enumeration value="NZ"/>
+ <xsd:enumeration value="OM"/>
+ <xsd:enumeration value="PA"/>
+ <xsd:enumeration value="PE"/>
+ <xsd:enumeration value="PF"/>
+ <xsd:enumeration value="PG"/>
+ <xsd:enumeration value="PH"/>
+ <xsd:enumeration value="PK"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PN"/>
+ <xsd:enumeration value="PR"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PW"/>
+ <xsd:enumeration value="PY"/>
+ <xsd:enumeration value="QA"/>
+ <xsd:enumeration value="RE"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RU"/>
+ <xsd:enumeration value="RW"/>
+ <xsd:enumeration value="SA"/>
+ <xsd:enumeration value="SB"/>
+ <xsd:enumeration value="SC"/>
+ <xsd:enumeration value="SD"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SG"/>
+ <xsd:enumeration value="SH"/>
+ <xsd:enumeration value="SI"/>
+ <xsd:enumeration value="SJ"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SL"/>
+ <xsd:enumeration value="SM"/>
+ <xsd:enumeration value="SN"/>
+ <xsd:enumeration value="SO"/>
+ <xsd:enumeration value="SR"/>
+ <xsd:enumeration value="ST"/>
+ <xsd:enumeration value="SV"/>
+ <xsd:enumeration value="SY"/>
+ <xsd:enumeration value="SZ"/>
+ <xsd:enumeration value="TC"/>
+ <xsd:enumeration value="TD"/>
+ <xsd:enumeration value="TF"/>
+ <xsd:enumeration value="TG"/>
+ <xsd:enumeration value="TH"/>
+ <xsd:enumeration value="TJ"/>
+ <xsd:enumeration value="TM"/>
+ <xsd:enumeration value="TN"/>
+ <xsd:enumeration value="TO"/>
+ <xsd:enumeration value="TP"/>
+ <xsd:enumeration value="TR"/>
+ <xsd:enumeration value="TT"/>
+ <xsd:enumeration value="TV"/>
+ <xsd:enumeration value="TW"/>
+ <xsd:enumeration value="TZ"/>
+ <xsd:enumeration value="UA"/>
+ <xsd:enumeration value="UG"/>
+ <xsd:enumeration value="UM"/>
+ <xsd:enumeration value="US"/>
+ <xsd:enumeration value="UY"/>
+ <xsd:enumeration value="UZ"/>
+ <xsd:enumeration value="VA"/>
+ <xsd:enumeration value="VC"/>
+ <xsd:enumeration value="VE"/>
+ <xsd:enumeration value="VG"/>
+ <xsd:enumeration value="VI"/>
+ <xsd:enumeration value="VN"/>
+ <xsd:enumeration value="VU"/>
+ <xsd:enumeration value="WF"/>
+ <xsd:enumeration value="WS"/>
+ <xsd:enumeration value="YE"/>
+ <xsd:enumeration value="YT"/>
+ <xsd:enumeration value="YU"/>
+ <xsd:enumeration value="ZA"/>
+ <xsd:enumeration value="ZM"/>
+ <xsd:enumeration value="ZW"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Timezone">
+ <xsd:sequence>
+ <xsd:element name="TimezoneCoded" type="TimezoneCode"/>
+ <xsd:element minOccurs="0" name="TimezoneCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Timezone" type="Timezone"/>
+ <xsd:simpleType name="TimezoneCode">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="12.00"/>
+ <xsd:enumeration value="11.45"/>
+ <xsd:enumeration value="11.30"/>
+ <xsd:enumeration value="11.15"/>
+ <xsd:enumeration value="11.00"/>
+ <xsd:enumeration value="10.45"/>
+ <xsd:enumeration value="10.30"/>
+ <xsd:enumeration value="10.15"/>
+ <xsd:enumeration value="10.00"/>
+ <xsd:enumeration value="09.45"/>
+ <xsd:enumeration value="09.30"/>
+ <xsd:enumeration value="09.15"/>
+ <xsd:enumeration value="09.00"/>
+ <xsd:enumeration value="08.45"/>
+ <xsd:enumeration value="08.30"/>
+ <xsd:enumeration value="08.15"/>
+ <xsd:enumeration value="08.00"/>
+ <xsd:enumeration value="07.45"/>
+ <xsd:enumeration value="07.30"/>
+ <xsd:enumeration value="07.15"/>
+ <xsd:enumeration value="07.00"/>
+ <xsd:enumeration value="06.45"/>
+ <xsd:enumeration value="06.30"/>
+ <xsd:enumeration value="06.15"/>
+ <xsd:enumeration value="06.00"/>
+ <xsd:enumeration value="05.45"/>
+ <xsd:enumeration value="05.30"/>
+ <xsd:enumeration value="05.15"/>
+ <xsd:enumeration value="05.00"/>
+ <xsd:enumeration value="04.45"/>
+ <xsd:enumeration value="04.30"/>
+ <xsd:enumeration value="04.15"/>
+ <xsd:enumeration value="04.00"/>
+ <xsd:enumeration value="03.45"/>
+ <xsd:enumeration value="03.30"/>
+ <xsd:enumeration value="03.15"/>
+ <xsd:enumeration value="03.00"/>
+ <xsd:enumeration value="02.45"/>
+ <xsd:enumeration value="02.30"/>
+ <xsd:enumeration value="02.15"/>
+ <xsd:enumeration value="02.00"/>
+ <xsd:enumeration value="01.45"/>
+ <xsd:enumeration value="01.30"/>
+ <xsd:enumeration value="01.15"/>
+ <xsd:enumeration value="01.00"/>
+ <xsd:enumeration value="00.45"/>
+ <xsd:enumeration value="00.30"/>
+ <xsd:enumeration value="00.15"/>
+ <xsd:enumeration value="00.00"/>
+ <xsd:enumeration value="-00.15"/>
+ <xsd:enumeration value="-00.30"/>
+ <xsd:enumeration value="-00.45"/>
+ <xsd:enumeration value="-01.00"/>
+ <xsd:enumeration value="-01.15"/>
+ <xsd:enumeration value="-01.30"/>
+ <xsd:enumeration value="-01.45"/>
+ <xsd:enumeration value="-02.00"/>
+ <xsd:enumeration value="-02.15"/>
+ <xsd:enumeration value="-02.30"/>
+ <xsd:enumeration value="-02.45"/>
+ <xsd:enumeration value="-03.00"/>
+ <xsd:enumeration value="-03.15"/>
+ <xsd:enumeration value="-03.30"/>
+ <xsd:enumeration value="-03.45"/>
+ <xsd:enumeration value="-04.00"/>
+ <xsd:enumeration value="-04.15"/>
+ <xsd:enumeration value="-04.30"/>
+ <xsd:enumeration value="-04.45"/>
+ <xsd:enumeration value="-05.00"/>
+ <xsd:enumeration value="-05.15"/>
+ <xsd:enumeration value="-05.30"/>
+ <xsd:enumeration value="-05.45"/>
+ <xsd:enumeration value="-06.00"/>
+ <xsd:enumeration value="-06.15"/>
+ <xsd:enumeration value="-06.30"/>
+ <xsd:enumeration value="-06.45"/>
+ <xsd:enumeration value="-07.00"/>
+ <xsd:enumeration value="-07.15"/>
+ <xsd:enumeration value="-07.30"/>
+ <xsd:enumeration value="-07.45"/>
+ <xsd:enumeration value="-08.00"/>
+ <xsd:enumeration value="-08.15"/>
+ <xsd:enumeration value="-08.30"/>
+ <xsd:enumeration value="-08.45"/>
+ <xsd:enumeration value="-09.00"/>
+ <xsd:enumeration value="-09.15"/>
+ <xsd:enumeration value="-09.30"/>
+ <xsd:enumeration value="-09.45"/>
+ <xsd:enumeration value="-10.00"/>
+ <xsd:enumeration value="-10.15"/>
+ <xsd:enumeration value="-10.30"/>
+ <xsd:enumeration value="-10.45"/>
+ <xsd:enumeration value="-11.00"/>
+ <xsd:enumeration value="-11.15"/>
+ <xsd:enumeration value="-11.30"/>
+ <xsd:enumeration value="-11.45"/>
+ <xsd:enumeration value="-12.00"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="AddressTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceLocation"/>
+ <xsd:enumeration value="AccountsPayableOffice"/>
+ <xsd:enumeration value="AcknowledgementRecipient"/>
+ <xsd:enumeration value="AdditionalAddress"/>
+ <xsd:enumeration value="AdditionalDeliveryAddress"/>
+ <xsd:enumeration value="AdditionalPickUpAddress"/>
+ <xsd:enumeration value="AlcoholBeverageDepartment"/>
+ <xsd:enumeration value="AlternateReturnAddress"/>
+ <xsd:enumeration value="AlternativeAddressee"/>
+ <xsd:enumeration value="AuditOffice"/>
+ <xsd:enumeration value="BailmentWarehouse"/>
+ <xsd:enumeration value="BidOpeningLocation"/>
+ <xsd:enumeration value="BillAndShipTo"/>
+ <xsd:enumeration value="BilledFrom"/>
+ <xsd:enumeration value="BillOfLadingRecipient"/>
+ <xsd:enumeration value="BillTo"/>
+ <xsd:enumeration value="BookingOffice"/>
+ <xsd:enumeration value="CandyAndConfectionsDepartment"/>
+ <xsd:enumeration value="ChangedAddress"/>
+ <xsd:enumeration value="CompanyAssignedWell"/>
+ <xsd:enumeration value="Company-OwnedOilField"/>
+ <xsd:enumeration value="ConsigneeCourierTransferStation"/>
+ <xsd:enumeration value="ConsignorCourierTransferStation"/>
+ <xsd:enumeration value="ConsultantsOffice"/>
+ <xsd:enumeration value="ContactOffice"/>
+ <xsd:enumeration value="ContainerLocation"/>
+ <xsd:enumeration value="CopyMessageTo"/>
+ <xsd:enumeration value="CorporateOffice"/>
+ <xsd:enumeration value="CorrectedAddress"/>
+ <xsd:enumeration value="DeliveryAddress"/>
+ <xsd:enumeration value="DestinationMailFacility"/>
+ <xsd:enumeration value="DifferentPremiseAddress"/>
+ <xsd:enumeration value="DistributionRecipient"/>
+ <xsd:enumeration value="DocumentOrMessageIssuerOrSender"/>
+ <xsd:enumeration value="DocumentRecipient"/>
+ <xsd:enumeration value="DomesticFinancialInstitution"/>
+ <xsd:enumeration value="DownstreamMeterLocation"/>
+ <xsd:enumeration value="Drop-OffLocation"/>
+ <xsd:enumeration value="EmergencyDepartment"/>
+ <xsd:enumeration value="EstablishedLocation"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="FilingAddress"/>
+ <xsd:enumeration value="FilingLocation"/>
+ <xsd:enumeration value="FilingOffice"/>
+ <xsd:enumeration value="FinalMessageRecipient"/>
+ <xsd:enumeration value="FinalRecipient"/>
+ <xsd:enumeration value="FinalScheduledDestination"/>
+ <xsd:enumeration value="FinancialInstitution"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FloralDepartment"/>
+ <xsd:enumeration value="ForeignDisclosureInformationOffice"/>
+ <xsd:enumeration value="ForeignOffice"/>
+ <xsd:enumeration value="ForeignRegistrationLocation"/>
+ <xsd:enumeration value="FormerAddress"/>
+ <xsd:enumeration value="FreeonBoardPoint"/>
+ <xsd:enumeration value="FrozenDepartment"/>
+ <xsd:enumeration value="GaragedLocation"/>
+ <xsd:enumeration value="GasPlant"/>
+ <xsd:enumeration value="GasTransactionEndingPoint"/>
+ <xsd:enumeration value="GasTransactionPoint1"/>
+ <xsd:enumeration value="GasTransactionPoint2"/>
+ <xsd:enumeration value="GasTransactionStartingPoint"/>
+ <xsd:enumeration value="HazardousMaterialOffice"/>
+ <xsd:enumeration value="HeadOffice"/>
+ <xsd:enumeration value="HomeOffice"/>
+ <xsd:enumeration value="ImportedFromLocation"/>
+ <xsd:enumeration value="IncorporatedLocation"/>
+ <xsd:enumeration value="IncorporationStatePlaceOfBusiness"/>
+ <xsd:enumeration value="IncorporationStatePrincipalOffice"/>
+ <xsd:enumeration value="InquiryAddress"/>
+ <xsd:enumeration value="InspectionAddress"/>
+ <xsd:enumeration value="InspectionAndAcceptanceLocation"/>
+ <xsd:enumeration value="InspectionLocation"/>
+ <xsd:enumeration value="InstalledAt"/>
+ <xsd:enumeration value="In-StoreBakeryDepartment"/>
+ <xsd:enumeration value="InsuredLocation"/>
+ <xsd:enumeration value="Laboratory"/>
+ <xsd:enumeration value="LastBreakTerminal"/>
+ <xsd:enumeration value="LeaseLocation"/>
+ <xsd:enumeration value="ListingOffice"/>
+ <xsd:enumeration value="LocalChain"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationOfGoodsForCustomsExaminationBeforeClearance"/>
+ <xsd:enumeration value="LocationOfLoadExchange"/>
+ <xsd:enumeration value="LocationOfSpotForStorage"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MailAddress"/>
+ <xsd:enumeration value="MailTo"/>
+ <xsd:enumeration value="ManufacturingPlant"/>
+ <xsd:enumeration value="MasterProperty"/>
+ <xsd:enumeration value="MaterialChangeNoticeAddress"/>
+ <xsd:enumeration value="MaterialDispositionAuthorizationLocation"/>
+ <xsd:enumeration value="MeatDepartment"/>
+ <xsd:enumeration value="MeetingLocation"/>
+ <xsd:enumeration value="MessageFrom"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageTo"/>
+ <xsd:enumeration value="Neighborhood"/>
+ <xsd:enumeration value="NewAddress"/>
+ <xsd:enumeration value="NewSupplySource"/>
+ <xsd:enumeration value="NextDestination"/>
+ <xsd:enumeration value="NextScheduledDestination"/>
+ <xsd:enumeration value="Non-TemporaryStorageFacility"/>
+ <xsd:enumeration value="NotApplicable"/>
+ <xsd:enumeration value="OperatorOfTheTransferPoint"/>
+ <xsd:enumeration value="OriginalLocation"/>
+ <xsd:enumeration value="OriginMailFacility"/>
+ <xsd:enumeration value="OriginSublocation"/>
+ <xsd:enumeration value="OriginTerminal"/>
+ <xsd:enumeration value="OtherDepartments"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaLocation"/>
+ <xsd:enumeration value="Out-Of-StatePrincipalOffice"/>
+ <xsd:enumeration value="OwningInventoryControlPoint"/>
+ <xsd:enumeration value="PartSource"/>
+ <xsd:enumeration value="PaymentAddress"/>
+ <xsd:enumeration value="PersonnelOffice"/>
+ <xsd:enumeration value="PharmacyDepartment"/>
+ <xsd:enumeration value="PhysicalAddress"/>
+ <xsd:enumeration value="PickUpAddress"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PipelineSegment"/>
+ <xsd:enumeration value="PipelineSegmentBoundary"/>
+ <xsd:enumeration value="PlaceOfBottling"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="PostalMailingAddress"/>
+ <xsd:enumeration value="PreliminaryInspectionLocation"/>
+ <xsd:enumeration value="Premises"/>
+ <xsd:enumeration value="PresentAddress"/>
+ <xsd:enumeration value="PrimaryControlPointLocation"/>
+ <xsd:enumeration value="ProduceDepartment"/>
+ <xsd:enumeration value="ProductServicesAndRepairsCentre"/>
+ <xsd:enumeration value="ProjectCoordinationOffice"/>
+ <xsd:enumeration value="ProjectManagementOffice"/>
+ <xsd:enumeration value="ProjectProperty"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="QualityControl"/>
+ <xsd:enumeration value="RadioControlStationLocation"/>
+ <xsd:enumeration value="Railroad"/>
+ <xsd:enumeration value="ReceiptMeterLocation"/>
+ <xsd:enumeration value="ReceiptZone"/>
+ <xsd:enumeration value="ReceivedFrom"/>
+ <xsd:enumeration value="ReceiverSite"/>
+ <xsd:enumeration value="ReceivingLocation"/>
+ <xsd:enumeration value="ReceivingPointForCustomerSamples"/>
+ <xsd:enumeration value="ReceivingSub-Location"/>
+ <xsd:enumeration value="ReclamationCenter"/>
+ <xsd:enumeration value="Record-KeepingAddress"/>
+ <xsd:enumeration value="Refinery"/>
+ <xsd:enumeration value="RegionalOffice"/>
+ <xsd:enumeration value="RegisteredOffice"/>
+ <xsd:enumeration value="ReleaseTo"/>
+ <xsd:enumeration value="RemitTo"/>
+ <xsd:enumeration value="RepairingOutlet"/>
+ <xsd:enumeration value="RepairOrRefurbishLocation"/>
+ <xsd:enumeration value="ReportingLocation"/>
+ <xsd:enumeration value="ResearchInstitute"/>
+ <xsd:enumeration value="ResidenceOrDomicile"/>
+ <xsd:enumeration value="ReturnedTo"/>
+ <xsd:enumeration value="RoutingPoint"/>
+ <xsd:enumeration value="SalesOffice"/>
+ <xsd:enumeration value="SamplesToBeReturnedTo"/>
+ <xsd:enumeration value="SamplingLocation"/>
+ <xsd:enumeration value="SecondaryLocationAddress"/>
+ <xsd:enumeration value="SecondHome"/>
+ <xsd:enumeration value="SellingOffice"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceLocation"/>
+ <xsd:enumeration value="ShelteredWorkshop"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="ShipTo"/>
+ <xsd:enumeration value="SmallBaseStationLocation"/>
+ <xsd:enumeration value="SmallControlStationLocation"/>
+ <xsd:enumeration value="SoldToAndShipTo"/>
+ <xsd:enumeration value="SoldToIfDifferentFromBillTo"/>
+ <xsd:enumeration value="StorageArea"/>
+ <xsd:enumeration value="StorageFacilityatDestination"/>
+ <xsd:enumeration value="StorageFacilityAtOrigin"/>
+ <xsd:enumeration value="Store"/>
+ <xsd:enumeration value="SoldTo"/>
+ <xsd:enumeration value="SubcontractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="SubjectProperty"/>
+ <xsd:enumeration value="Sub-Office"/>
+ <xsd:enumeration value="Subsidiary"/>
+ <xsd:enumeration value="SubsidiaryDivision"/>
+ <xsd:enumeration value="SupplierOrManufacturer"/>
+ <xsd:enumeration value="SuppliersCorporateOffice"/>
+ <xsd:enumeration value="SupplySource"/>
+ <xsd:enumeration value="TankFarm"/>
+ <xsd:enumeration value="TaxAddress"/>
+ <xsd:enumeration value="TaxCollectorsOffice"/>
+ <xsd:enumeration value="TechnicalOffice"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="TerminalLocation"/>
+ <xsd:enumeration value="TestingLaboratory"/>
+ <xsd:enumeration value="ToolSource"/>
+ <xsd:enumeration value="TransferPoint"/>
+ <xsd:enumeration value="TransferTo"/>
+ <xsd:enumeration value="TransportationOffice"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomer"/>
+ <xsd:enumeration value="UltimateParentCompany"/>
+ <xsd:enumeration value="UnitProperty"/>
+ <xsd:enumeration value="UpstreamMeterLocation"/>
+ <xsd:enumeration value="VacationHome"/>
+ <xsd:enumeration value="Vendor"/>
+ <xsd:enumeration value="VideoDepartment"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Wholesaler"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="GPSCooridinates">
+ <xsd:sequence>
+ <xsd:element name="GPSSystem" type="xsd:string"/>
+ <xsd:element name="Latitude" type="xsd:string"/>
+ <xsd:element name="Longitude" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="GPSCooridinates" type="GPSCooridinates"/>
+ <xsd:simpleType name="TaxTreatmentCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NoTaxApplies"/>
+ <xsd:enumeration value="NetInvoiceLevel"/>
+ <xsd:enumeration value="GrossInvoiceLevel"/>
+ <xsd:enumeration value="NetLineLevel"/>
+ <xsd:enumeration value="GrossLineLevel"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="OrderInvoiceMediumTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Circuitswitching"/>
+ <xsd:enumeration value="SITA"/>
+ <xsd:enumeration value="ARINC"/>
+ <xsd:enumeration value="Courier"/>
+ <xsd:enumeration value="CableAddress"/>
+ <xsd:enumeration value="EDITransmission"/>
+ <xsd:enumeration value="ElectronicMail"/>
+ <xsd:enumeration value="Extension"/>
+ <xsd:enumeration value="FileTransferAccessMethod"/>
+ <xsd:enumeration value="TeleFax"/>
+ <xsd:enumeration value="GEISMailbox"/>
+ <xsd:enumeration value="IBMInformationExchange"/>
+ <xsd:enumeration value="InternalMail"/>
+ <xsd:enumeration value="Mail"/>
+ <xsd:enumeration value="PostBoxNo"/>
+ <xsd:enumeration value="PacketSwitching"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="Telephone"/>
+ <xsd:enumeration value="Telegraph"/>
+ <xsd:enumeration value="Telex"/>
+ <xsd:enumeration value="TeleMail"/>
+ <xsd:enumeration value="TeleText"/>
+ <xsd:enumeration value="TWX"/>
+ <xsd:enumeration value="X.400"/>
+ <xsd:enumeration value="NotRequired"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderDates">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="RequestedShipByDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="RequestedDeliverByDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="PromiseDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:element minOccurs="0" name="CancelByDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" ref="ListOfDateCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderDates" type="OrderDates"/>
+ <xsd:complexType name="ListOfDateCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="DateCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDateCoded" type="ListOfDateCoded"/>
+ <xsd:complexType name="DateCoded">
+ <xsd:sequence>
+ <xsd:element name="Date" type="xcblDatetime"/>
+ <xsd:element ref="DateQualifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DateCoded" type="DateCoded"/>
+ <xsd:complexType name="DateQualifier">
+ <xsd:sequence>
+ <xsd:element name="DateQualifierCoded" type="DateQualifierCode"/>
+ <xsd:element minOccurs="0" name="DateQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DateQualifier" type="DateQualifier"/>
+ <xsd:simpleType name="DateQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="36030"/>
+ <xsd:enumeration value="36530"/>
+ <xsd:enumeration value="365630"/>
+ <xsd:enumeration value="3602831"/>
+ <xsd:enumeration value="3652831"/>
+ <xsd:enumeration value="36562831"/>
+ <xsd:enumeration value="1stScheduleDelivery"/>
+ <xsd:enumeration value="1stScheduleShip"/>
+ <xsd:enumeration value="Acceleration"/>
+ <xsd:enumeration value="AcceptanceDateOfDocument"/>
+ <xsd:enumeration value="AcceptanceDateOfGoodsDeclarationCustoms"/>
+ <xsd:enumeration value="AcceptanceDateTimeOfGoods"/>
+ <xsd:enumeration value="AccidentBenefitAgeLimit"/>
+ <xsd:enumeration value="AccidentBenefitPeriod"/>
+ <xsd:enumeration value="AccidentDateAndOrTime"/>
+ <xsd:enumeration value="AccidentInsuranceEliminationPeriod"/>
+ <xsd:enumeration value="AccidentLifetimeBenefitQualificationAge"/>
+ <xsd:enumeration value="AccountantsOpinionDate"/>
+ <xsd:enumeration value="AccountClosedDate"/>
+ <xsd:enumeration value="AccountingMethodologyChangeDate"/>
+ <xsd:enumeration value="AccountingPeriod"/>
+ <xsd:enumeration value="AccountingPeriodEndDate"/>
+ <xsd:enumeration value="AccountingPeriodStartDate"/>
+ <xsd:enumeration value="AccountingTransactionDate"/>
+ <xsd:enumeration value="AccountingValueDate"/>
+ <xsd:enumeration value="AccountingYear"/>
+ <xsd:enumeration value="AccountOpened"/>
+ <xsd:enumeration value="AccountsReceivable-StatementDate"/>
+ <xsd:enumeration value="Acknowledgment"/>
+ <xsd:enumeration value="AcquisitionDate"/>
+ <xsd:enumeration value="ActionDate"/>
+ <xsd:enumeration value="ActionEndDate"/>
+ <xsd:enumeration value="ActivityReportingDate"/>
+ <xsd:enumeration value="ActivityPeriodDateRange"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="ActualArchive"/>
+ <xsd:enumeration value="ArrivalDateTimeActual"/>
+ <xsd:enumeration value="ActualComplete"/>
+ <xsd:enumeration value="DepartureDateTimeActual"/>
+ <xsd:enumeration value="DischargeDateTimeActual"/>
+ <xsd:enumeration value="ActualPortOfEntry"/>
+ <xsd:enumeration value="ActualRelease"/>
+ <xsd:enumeration value="ActualReturnToWork"/>
+ <xsd:enumeration value="StartDateActual"/>
+ <xsd:enumeration value="AcuteManifestationDate"/>
+ <xsd:enumeration value="AcuteManifestationOfAChronicCondition"/>
+ <xsd:enumeration value="Added"/>
+ <xsd:enumeration value="AddressPeriod"/>
+ <xsd:enumeration value="Adjournment"/>
+ <xsd:enumeration value="AdjustedAge"/>
+ <xsd:enumeration value="AdjustedContestability"/>
+ <xsd:enumeration value="AdjustedDeathBenefit"/>
+ <xsd:enumeration value="AdjustedEnd"/>
+ <xsd:enumeration value="AdjustedHire"/>
+ <xsd:enumeration value="AdjustedStart"/>
+ <xsd:enumeration value="AdjustmentEffectiveDate"/>
+ <xsd:enumeration value="AdjustmentPeriod"/>
+ <xsd:enumeration value="AdjustmentPeriodEnd"/>
+ <xsd:enumeration value="AdjustmentPeriodStart"/>
+ <xsd:enumeration value="AdjustmentProcessed"/>
+ <xsd:enumeration value="AdjustmentPromised"/>
+ <xsd:enumeration value="AdjustmentToBillDated"/>
+ <xsd:enumeration value="AdministratorOrderedDate"/>
+ <xsd:enumeration value="AdmissionDateAndOrTimeExpected"/>
+ <xsd:enumeration value="AdoptionDateActual"/>
+ <xsd:enumeration value="AdviseAfterDateTime"/>
+ <xsd:enumeration value="AdviseBeforeDateTime"/>
+ <xsd:enumeration value="AdviseCompletedDateTime"/>
+ <xsd:enumeration value="AdviseOnDateTime"/>
+ <xsd:enumeration value="AdvisingDate"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AgreementToPayDate"/>
+ <xsd:enumeration value="AiredDate"/>
+ <xsd:enumeration value="AllotmentPeriodStart"/>
+ <xsd:enumeration value="AllowableEffective"/>
+ <xsd:enumeration value="AllowedRenewalDurationPeriod"/>
+ <xsd:enumeration value="AlternateBasePeriod"/>
+ <xsd:enumeration value="AlternateProblemResolution"/>
+ <xsd:enumeration value="AlternativeDueDate"/>
+ <xsd:enumeration value="AnalysisMonthEnding"/>
+ <xsd:enumeration value="AnesthesiaAdministration"/>
+ <xsd:enumeration value="Anniversary"/>
+ <xsd:enumeration value="AnnualReportDelinquentOnDate"/>
+ <xsd:enumeration value="AnnualReportDueDate"/>
+ <xsd:enumeration value="AnnualReportFilingDate"/>
+ <xsd:enumeration value="AnnualReportMailingDate"/>
+ <xsd:enumeration value="Annuitization"/>
+ <xsd:enumeration value="AnnuityCommencementDate"/>
+ <xsd:enumeration value="AnticipatedClosing"/>
+ <xsd:enumeration value="AppliancePlacement"/>
+ <xsd:enumeration value="ApplicantSigned"/>
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="ApplicationEntry"/>
+ <xsd:enumeration value="ApplicationLoggedDate"/>
+ <xsd:enumeration value="ApplicationStatus"/>
+ <xsd:enumeration value="AppointmentEffective"/>
+ <xsd:enumeration value="AppointmentExpiryDate"/>
+ <xsd:enumeration value="AppraisalOrdered"/>
+ <xsd:enumeration value="ApprovalOffer"/>
+ <xsd:enumeration value="ApprovalDate"/>
+ <xsd:enumeration value="Arrested"/>
+ <xsd:enumeration value="ArrivalDateTimeAtInitialPort"/>
+ <xsd:enumeration value="ArrivalDateTimeEarliest"/>
+ <xsd:enumeration value="ArrivalDateTimeOfTransportLeadTime"/>
+ <xsd:enumeration value="ArrivalDateTimeScheduled"/>
+ <xsd:enumeration value="ArrivalDateTimeUltimate"/>
+ <xsd:enumeration value="ArrivalInCountry"/>
+ <xsd:enumeration value="ArterialBloodGasTest"/>
+ <xsd:enumeration value="AsOf"/>
+ <xsd:enumeration value="AssemblyStart"/>
+ <xsd:enumeration value="Asset"/>
+ <xsd:enumeration value="AssetAndLiabilityScheduleDate"/>
+ <xsd:enumeration value="AssetDocumentationExpiration"/>
+ <xsd:enumeration value="AssignedDate"/>
+ <xsd:enumeration value="AssignmentRecorded"/>
+ <xsd:enumeration value="AttendanceDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="AudienceDeficiencyPeriod"/>
+ <xsd:enumeration value="AuditPeriodAfterSplitDate"/>
+ <xsd:enumeration value="AuditPeriodPriorToSplitDate"/>
+ <xsd:enumeration value="AuthenticationDateTimeOfDocument"/>
+ <xsd:enumeration value="AuthenticationValidationDateTime"/>
+ <xsd:enumeration value="AuthorizationDate"/>
+ <xsd:enumeration value="AutomaticPremiumLoan"/>
+ <xsd:enumeration value="AvailabilityDueDate"/>
+ <xsd:enumeration value="Availability"/>
+ <xsd:enumeration value="AverageDeliveryDelay"/>
+ <xsd:enumeration value="AveragePaymentPeriod"/>
+ <xsd:enumeration value="Award"/>
+ <xsd:enumeration value="BackOnMarket"/>
+ <xsd:enumeration value="BackOrderDeliveryDateTimePeriod"/>
+ <xsd:enumeration value="BalanceDateTimePeriod"/>
+ <xsd:enumeration value="BalanceSheetDateLatest"/>
+ <xsd:enumeration value="Base"/>
+ <xsd:enumeration value="Baseline"/>
+ <xsd:enumeration value="BaselineComplete"/>
+ <xsd:enumeration value="BaselineStart"/>
+ <xsd:enumeration value="BeforeInventoryIsReplenishedBasedOnStockCheckLeadTime"/>
+ <xsd:enumeration value="BeginningLayDate"/>
+ <xsd:enumeration value="BeginTherapy"/>
+ <xsd:enumeration value="BeneficiarysBanksDueDate"/>
+ <xsd:enumeration value="Benefit"/>
+ <xsd:enumeration value="BenefitAdjustmentEnd"/>
+ <xsd:enumeration value="BenefitAdjustmentPeriod"/>
+ <xsd:enumeration value="BenefitAdjustmentStart"/>
+ <xsd:enumeration value="BenefitApplicationDate"/>
+ <xsd:enumeration value="BenefitBegin"/>
+ <xsd:enumeration value="BenefitChangeDateTime"/>
+ <xsd:enumeration value="BenefitCreditEnd"/>
+ <xsd:enumeration value="BenefitCreditPeriod"/>
+ <xsd:enumeration value="BenefitCreditStart"/>
+ <xsd:enumeration value="BenefitDebitEnd"/>
+ <xsd:enumeration value="BenefitDebitStart"/>
+ <xsd:enumeration value="BenefitEnd"/>
+ <xsd:enumeration value="BenefitPaymentsTerminationDate"/>
+ <xsd:enumeration value="BenefitPeriod"/>
+ <xsd:enumeration value="BenefitReleaseAuthorizationDate"/>
+ <xsd:enumeration value="BenefitsPaid"/>
+ <xsd:enumeration value="BenefitTransferEnd"/>
+ <xsd:enumeration value="BenefitTransferPeriod"/>
+ <xsd:enumeration value="BenefitTransferStart"/>
+ <xsd:enumeration value="BenefitTypeGrossWeeklyAmountEffective"/>
+ <xsd:enumeration value="BenefitTypeNetWeeklyAmountEffective"/>
+ <xsd:enumeration value="BenefitPeriodEndDate"/>
+ <xsd:enumeration value="BenefitPeriodStartDate"/>
+ <xsd:enumeration value="BestBeforeDate"/>
+ <xsd:enumeration value="BestTimeToCall"/>
+ <xsd:enumeration value="BiannualTerminalInspectionDate"/>
+ <xsd:enumeration value="BidEffective"/>
+ <xsd:enumeration value="BidOpenDateBidsWillBeOpened"/>
+ <xsd:enumeration value="BidPriceException"/>
+ <xsd:enumeration value="Bill"/>
+ <xsd:enumeration value="BilledThrough"/>
+ <xsd:enumeration value="BillOfLadingDate"/>
+ <xsd:enumeration value="BirthCertificate"/>
+ <xsd:enumeration value="BirthDateTime"/>
+ <xsd:enumeration value="BlanksValueDate"/>
+ <xsd:enumeration value="Blueprint"/>
+ <xsd:enumeration value="BoardOfDirectorsIncompleteAsOf"/>
+ <xsd:enumeration value="BoardOfDirectorsNotAuthorizedAsOfGivenDate"/>
+ <xsd:enumeration value="BoardOfDirectorsNotCompleteAsOfGivenDate"/>
+ <xsd:enumeration value="BoardOfDirectorsRegistrationDate"/>
+ <xsd:enumeration value="BookEntryDelivery"/>
+ <xsd:enumeration value="BookingDateTime"/>
+ <xsd:enumeration value="BritishThermalUnitTestPerformed"/>
+ <xsd:enumeration value="BudgetLineApplicationDate"/>
+ <xsd:enumeration value="BusinessControlChangeDate"/>
+ <xsd:enumeration value="BusinessOpenedDate"/>
+ <xsd:enumeration value="BusinessTerminationDate"/>
+ <xsd:enumeration value="BuyersDock"/>
+ <xsd:enumeration value="BuyersLocalTime"/>
+ <xsd:enumeration value="CalculationDate"/>
+ <xsd:enumeration value="CalendarAnniversary"/>
+ <xsd:enumeration value="CalendarYear"/>
+ <xsd:enumeration value="CancelAfter"/>
+ <xsd:enumeration value="CancelAfterExCountry"/>
+ <xsd:enumeration value="CancelAfterExFactory"/>
+ <xsd:enumeration value="CancelIfNotDeliveredByThisDate"/>
+ <xsd:enumeration value="CancelIfNotPublishedByThisDate"/>
+ <xsd:enumeration value="CancelIfNotShippedByThisDate"/>
+ <xsd:enumeration value="CancellationDate"/>
+ <xsd:enumeration value="CancellationDateTimeLatest"/>
+ <xsd:enumeration value="CapitalizationDate"/>
+ <xsd:enumeration value="CapitationPeriodEnd"/>
+ <xsd:enumeration value="CapitationPeriodStart"/>
+ <xsd:enumeration value="CargoBookingConfirmedDateTime"/>
+ <xsd:enumeration value="CargoReleaseDateTimeUltimate"/>
+ <xsd:enumeration value="CaseConverted"/>
+ <xsd:enumeration value="CaseReopened"/>
+ <xsd:enumeration value="CashCallDate"/>
+ <xsd:enumeration value="CategoryChangeDateTime"/>
+ <xsd:enumeration value="CeasedOperations"/>
+ <xsd:enumeration value="CertificateEffective"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="CertificationOfWeightDateTime"/>
+ <xsd:enumeration value="CertificationPeriodStart"/>
+ <xsd:enumeration value="CertificationRevision"/>
+ <xsd:enumeration value="ChangedAccountingDate"/>
+ <xsd:enumeration value="ChangedDate"/>
+ <xsd:enumeration value="ChargeBackDateTime"/>
+ <xsd:enumeration value="ChargePeriod"/>
+ <xsd:enumeration value="ChargePeriodEndDate"/>
+ <xsd:enumeration value="ChargePeriodStartDate"/>
+ <xsd:enumeration value="ChartOfAccountPeriod"/>
+ <xsd:enumeration value="Check"/>
+ <xsd:enumeration value="CheckedDate"/>
+ <xsd:enumeration value="ChildbirthDateAndOrTimeActual"/>
+ <xsd:enumeration value="ChildbirthDateEstimated"/>
+ <xsd:enumeration value="Christening"/>
+ <xsd:enumeration value="Citation"/>
+ <xsd:enumeration value="CitizenshipChangeDate"/>
+ <xsd:enumeration value="ClaimAdministratorKnowledgeOfTheInjury"/>
+ <xsd:enumeration value="ClaimAdministratorNotifiedOfEmployeeLegalRepresentation"/>
+ <xsd:enumeration value="ClaimIncurredDate"/>
+ <xsd:enumeration value="ClaimMadeDate"/>
+ <xsd:enumeration value="ClaimNotificationReceived"/>
+ <xsd:enumeration value="ClaimsMade"/>
+ <xsd:enumeration value="ClaimStatementPeriodEnd"/>
+ <xsd:enumeration value="ClaimStatementPeriodStart"/>
+ <xsd:enumeration value="Clause"/>
+ <xsd:enumeration value="ClearanceDateCustoms"/>
+ <xsd:enumeration value="ClinicalExaminationDateAndOrTime"/>
+ <xsd:enumeration value="Closed"/>
+ <xsd:enumeration value="ClosedUntilDate"/>
+ <xsd:enumeration value="ClosingDateOfFirstBalanceSheet"/>
+ <xsd:enumeration value="ClosingDateTime"/>
+ <xsd:enumeration value="ClosureDateTimePeriod"/>
+ <xsd:enumeration value="CollateralDependent"/>
+ <xsd:enumeration value="CollateralDependentBegin"/>
+ <xsd:enumeration value="CollateralDependentEnd"/>
+ <xsd:enumeration value="Collection"/>
+ <xsd:enumeration value="CollectionDateTimeEarliest"/>
+ <xsd:enumeration value="CollectionDateTimeLatest"/>
+ <xsd:enumeration value="CommencedPumpingBallastDateTime"/>
+ <xsd:enumeration value="CommencedTankCleaningDateTime"/>
+ <xsd:enumeration value="CommercialRating"/>
+ <xsd:enumeration value="CompanyTermination"/>
+ <xsd:enumeration value="ComparisonPeriod"/>
+ <xsd:enumeration value="CompilationDateAndTime"/>
+ <xsd:enumeration value="Complaint"/>
+ <xsd:enumeration value="CompletedPumpingBallastDateTime"/>
+ <xsd:enumeration value="CompletedTankCleaningDateTime"/>
+ <xsd:enumeration value="CompletionDate"/>
+ <xsd:enumeration value="CompletionDateOrTimeNotAfter"/>
+ <xsd:enumeration value="CompletionDateOrTimeNotBefore"/>
+ <xsd:enumeration value="CompletionDateOrTimeScheduled"/>
+ <xsd:enumeration value="Compliance"/>
+ <xsd:enumeration value="ConditionInitialTreatmentDate"/>
+ <xsd:enumeration value="Confinement"/>
+ <xsd:enumeration value="ConfinementEnd"/>
+ <xsd:enumeration value="ConfinementStart"/>
+ <xsd:enumeration value="ConfirmationDateLeadTime"/>
+ <xsd:enumeration value="ConfirmedDateTime"/>
+ <xsd:enumeration value="Connection"/>
+ <xsd:enumeration value="Consolidated"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRA"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRABegin"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRAEnd"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRAQualifyingEvent"/>
+ <xsd:enumeration value="ConsolidationDate"/>
+ <xsd:enumeration value="ConstructionDateActual"/>
+ <xsd:enumeration value="ConstructionStart"/>
+ <xsd:enumeration value="ContainerSafetyConventionCscInspectionDate"/>
+ <xsd:enumeration value="ContainerSafetyConventionCscPlateExpirationDate"/>
+ <xsd:enumeration value="ContainerStrippingDateTimeUltimate"/>
+ <xsd:enumeration value="ContainerStuffingDateTimeUltimate"/>
+ <xsd:enumeration value="Contestability"/>
+ <xsd:enumeration value="Contingency"/>
+ <xsd:enumeration value="ContingencyEnd"/>
+ <xsd:enumeration value="Continuance"/>
+ <xsd:enumeration value="ContinuationOfPayStartDate"/>
+ <xsd:enumeration value="ContinuingEducationRequirement"/>
+ <xsd:enumeration value="ContinuousCoverageDates"/>
+ <xsd:enumeration value="ContinuousPassiveMotionCPM"/>
+ <xsd:enumeration value="ContractAuditDate"/>
+ <xsd:enumeration value="ContractAwardDateTime"/>
+ <xsd:enumeration value="ContractBindingDate"/>
+ <xsd:enumeration value="ContractCompletionDate"/>
+ <xsd:enumeration value="ContractCostsThrough"/>
+ <xsd:enumeration value="ContractDate"/>
+ <xsd:enumeration value="ContractDefinition"/>
+ <xsd:enumeration value="ContractEffectiveDate"/>
+ <xsd:enumeration value="ContractExpiryDate"/>
+ <xsd:enumeration value="ContractMailed"/>
+ <xsd:enumeration value="ContractPerformanceDelivery"/>
+ <xsd:enumeration value="ContractPerformanceStart"/>
+ <xsd:enumeration value="ContractPeriod"/>
+ <xsd:enumeration value="ContractRe-Open"/>
+ <xsd:enumeration value="ContractStart"/>
+ <xsd:enumeration value="ContractualDeliveryDate"/>
+ <xsd:enumeration value="ContractualStartDateTime"/>
+ <xsd:enumeration value="ContributionPeriodEndDateTime"/>
+ <xsd:enumeration value="ContributionPeriodStartDateTime"/>
+ <xsd:enumeration value="ContributionsCeasingDateTime"/>
+ <xsd:enumeration value="ControlPlan"/>
+ <xsd:enumeration value="ControvertDate"/>
+ <xsd:enumeration value="ConversionPrivilegeEnd"/>
+ <xsd:enumeration value="ConversionToRepayment"/>
+ <xsd:enumeration value="ConversionIntoHoldingCompanyDate"/>
+ <xsd:enumeration value="ConvertedToElectronicDate"/>
+ <xsd:enumeration value="ConveyanceRegistrationDate"/>
+ <xsd:enumeration value="ConvictedDate"/>
+ <xsd:enumeration value="CoordinationOfBenefits"/>
+ <xsd:enumeration value="CoordinationOfBenefitsBegin"/>
+ <xsd:enumeration value="CoordinationOfBenefitsEnd"/>
+ <xsd:enumeration value="CorrectedDateOfBirth"/>
+ <xsd:enumeration value="Correction"/>
+ <xsd:enumeration value="CosignerSigned"/>
+ <xsd:enumeration value="CourtDismissalDate"/>
+ <xsd:enumeration value="CourtEvent"/>
+ <xsd:enumeration value="CourtNotice"/>
+ <xsd:enumeration value="CourtRegistrationDate"/>
+ <xsd:enumeration value="CoverageDuration"/>
+ <xsd:enumeration value="CoverageIssueDate"/>
+ <xsd:enumeration value="CoveredIncomePeriod"/>
+ <xsd:enumeration value="CreditAdvice"/>
+ <xsd:enumeration value="CreditDocumentationExpiration"/>
+ <xsd:enumeration value="CreditedService"/>
+ <xsd:enumeration value="CreditedServiceBegin"/>
+ <xsd:enumeration value="CreditedServiceEnd"/>
+ <xsd:enumeration value="CreditorsRequestedValueDate"/>
+ <xsd:enumeration value="Crime"/>
+ <xsd:enumeration value="CriminalSentenceDuration"/>
+ <xsd:enumeration value="CrossborderDateTime"/>
+ <xsd:enumeration value="CumulativeQuantityEndDate"/>
+ <xsd:enumeration value="CumulativeQuantityStartDate"/>
+ <xsd:enumeration value="CureTime"/>
+ <xsd:enumeration value="Current"/>
+ <xsd:enumeration value="CurrentAuthorityControlStartDate"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodEnd"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodLastDayWorked"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodStart"/>
+ <xsd:enumeration value="CurrentIncomePeriod"/>
+ <xsd:enumeration value="CurrentLegalStructureEffectiveDate"/>
+ <xsd:enumeration value="CurrentList"/>
+ <xsd:enumeration value="CurrentMonthEnding"/>
+ <xsd:enumeration value="CurrentNameEffectiveDate"/>
+ <xsd:enumeration value="CurrentReportDate"/>
+ <xsd:enumeration value="CurrentScheduleDelivery"/>
+ <xsd:enumeration value="CurrentScheduleShip"/>
+ <xsd:enumeration value="CurtailmentDate"/>
+ <xsd:enumeration value="CurtailmentDatefromAdviceOfPayment"/>
+ <xsd:enumeration value="CustomerContractEffective"/>
+ <xsd:enumeration value="CustomerContractExpiration"/>
+ <xsd:enumeration value="CustomerOrder"/>
+ <xsd:enumeration value="CustomerValueDate"/>
+ <xsd:enumeration value="CustomsCargoRelease"/>
+ <xsd:enumeration value="CustomsClearance"/>
+ <xsd:enumeration value="CustomsEntryDate"/>
+ <xsd:enumeration value="Cycle"/>
+ <xsd:enumeration value="CycleBegin"/>
+ <xsd:enumeration value="CycleEnd"/>
+ <xsd:enumeration value="CycleToDate"/>
+ <xsd:enumeration value="DateAccountMatures"/>
+ <xsd:enumeration value="DateAcquired"/>
+ <xsd:enumeration value="DateAndOrTimeOfHandlingEstimated"/>
+ <xsd:enumeration value="DateAsAt"/>
+ <xsd:enumeration value="DateAssignmentFiledForRecord"/>
+ <xsd:enumeration value="BankruptcyFiledDate"/>
+ <xsd:enumeration value="DateBecameAware"/>
+ <xsd:enumeration value="DateClaimPaid"/>
+ <xsd:enumeration value="DateCourseOfOrthodonticsTreatmentBeganOrIsExpectedToBegin"/>
+ <xsd:enumeration value="DateDeedFiledForRecord"/>
+ <xsd:enumeration value="DateDefaultWasCured"/>
+ <xsd:enumeration value="DateDocumentationOrPaperworkOrBothWasSent"/>
+ <xsd:enumeration value="FiledDate"/>
+ <xsd:enumeration value="DateForeclosureHeld"/>
+ <xsd:enumeration value="DateForeclosureProceedingsInstituted"/>
+ <xsd:enumeration value="DateForeclosureSaleScheduled"/>
+ <xsd:enumeration value="DateForTheLastUpdate"/>
+ <xsd:enumeration value="DateHazardInsurancePolicyCancelled"/>
+ <xsd:enumeration value="DateHazardInsurancePolicyRefused"/>
+ <xsd:enumeration value="DateMaterialUsageSuspended"/>
+ <xsd:enumeration value="DateOfAbandonment"/>
+ <xsd:enumeration value="DateOfAcquisitionOfTitle"/>
+ <xsd:enumeration value="DateOfAction"/>
+ <xsd:enumeration value="DateOfAdvance"/>
+ <xsd:enumeration value="DateOfAppraisal"/>
+ <xsd:enumeration value="DateOfAssignmentApproval"/>
+ <xsd:enumeration value="DateOfAssignmentRejection"/>
+ <xsd:enumeration value="DateOfClaim"/>
+ <xsd:enumeration value="DateOfClosing"/>
+ <xsd:enumeration value="DateOfDamage"/>
+ <xsd:enumeration value="DeceaseDate"/>
+ <xsd:enumeration value="DateOfDeedInLieu"/>
+ <xsd:enumeration value="DateOfDivorce"/>
+ <xsd:enumeration value="DateOfExtensionToConvey"/>
+ <xsd:enumeration value="DateOfFirmCommitment"/>
+ <xsd:enumeration value="DateOfFirstMortgagePayment"/>
+ <xsd:enumeration value="DateOfFirstRegistration"/>
+ <xsd:enumeration value="DateOfFirstUncuredDefault"/>
+ <xsd:enumeration value="DateOfForeclosureNotice"/>
+ <xsd:enumeration value="DateOfLastContact"/>
+ <xsd:enumeration value="DateOfLastDraw"/>
+ <xsd:enumeration value="DateOfLastInstallmentReceived"/>
+ <xsd:enumeration value="DateOfLastPaymentReceived"/>
+ <xsd:enumeration value="DateOfLastUpdate"/>
+ <xsd:enumeration value="DateOfLoan"/>
+ <xsd:enumeration value="DateOfLocalOfficeApprovalOfConveyanceOfDamagedRealEstateProperty"/>
+ <xsd:enumeration value="DateOfLocalOfficeApprovalOfConveyanceOfOccupied"/>
+ <xsd:enumeration value="DateOfLocalOfficeCertificationOfConveyanceOfDamagedRealEstate"/>
+ <xsd:enumeration value="DateOfMaximumMedicalImprovement"/>
+ <xsd:enumeration value="DateOfNoticeOfProbableIneligibilityForAssignment"/>
+ <xsd:enumeration value="DateOfNoticeOfReferralForAssignment"/>
+ <xsd:enumeration value="DateOfNoticeToConvey"/>
+ <xsd:enumeration value="DateOfOperation"/>
+ <xsd:enumeration value="DateOfOrderLeadTime"/>
+ <xsd:enumeration value="DateOfPossession"/>
+ <xsd:enumeration value="DateOfProductFailure"/>
+ <xsd:enumeration value="DateOfPropertyInspection"/>
+ <xsd:enumeration value="ReleaseFromBankruptcyDate"/>
+ <xsd:enumeration value="DateOfRepairOrService"/>
+ <xsd:enumeration value="DateOfSeizure"/>
+ <xsd:enumeration value="DateOfSeparation"/>
+ <xsd:enumeration value="DateOfSourceDocument"/>
+ <xsd:enumeration value="DateOfSpecification"/>
+ <xsd:enumeration value="DateOfStandard"/>
+ <xsd:enumeration value="DateOnWhichAssetsJudgedInsufficientToPayCreditors"/>
+ <xsd:enumeration value="DateOutstandingLoanBalanceReported"/>
+ <xsd:enumeration value="PackagingDate"/>
+ <xsd:enumeration value="DatePaid"/>
+ <xsd:enumeration value="DatePlacedInDisfavour"/>
+ <xsd:enumeration value="DatePossessoryActionInitiated"/>
+ <xsd:enumeration value="DatePracticeCeased"/>
+ <xsd:enumeration value="DatePracticeEstablished"/>
+ <xsd:enumeration value="DatePropertySold"/>
+ <xsd:enumeration value="DateReadyForCollection"/>
+ <xsd:enumeration value="DateRedemptionPeriodEnds"/>
+ <xsd:enumeration value="DateReferredToAttorneyForForeclosure"/>
+ <xsd:enumeration value="RequestDate"/>
+ <xsd:enumeration value="DateThroughWhichPropertyTaxesHaveBeenPaid"/>
+ <xsd:enumeration value="DateTimeOfDiscountTermination"/>
+ <xsd:enumeration value="DateTimeOfInterestDue"/>
+ <xsd:enumeration value="DateTimeOfLatestAccountsFilingAtPublicRegistry"/>
+ <xsd:enumeration value="DateTotalAmountOfDelinquencyReported"/>
+ <xsd:enumeration value="DateVoluntaryConveyanceAccepted"/>
+ <xsd:enumeration value="DateWhenContainerEquipmentBecomesDomestic"/>
+ <xsd:enumeration value="DaylightOverdraftTime"/>
+ <xsd:enumeration value="DaysOfOperation"/>
+ <xsd:enumeration value="DeathDateAndOrTime"/>
+ <xsd:enumeration value="DebitAdvice"/>
+ <xsd:enumeration value="DebitValueDateRequested"/>
+ <xsd:enumeration value="DebtIncurred"/>
+ <xsd:enumeration value="DecisionDate"/>
+ <xsd:enumeration value="Declaration"/>
+ <xsd:enumeration value="DeclarationPresentationDate"/>
+ <xsd:enumeration value="DeclarationReferencePeriod"/>
+ <xsd:enumeration value="Deductible"/>
+ <xsd:enumeration value="DeedNotAvailableAsOfGivenDate"/>
+ <xsd:enumeration value="Deferral"/>
+ <xsd:enumeration value="DeferredDistribution"/>
+ <xsd:enumeration value="DeferredPayment"/>
+ <xsd:enumeration value="DeferredPeriod"/>
+ <xsd:enumeration value="DefinitionOfDisabilityDuration"/>
+ <xsd:enumeration value="DelayedBillingNotDelayedPayment"/>
+ <xsd:enumeration value="DeletionDate"/>
+ <xsd:enumeration value="Delivered"/>
+ <xsd:enumeration value="DeliverNotBeforeAndNotAfterDates"/>
+ <xsd:enumeration value="DeliveryAppointmentDateAndTime"/>
+ <xsd:enumeration value="DeliveryDateTime1StSchedule"/>
+ <xsd:enumeration value="DeliveryDateTimeActual"/>
+ <xsd:enumeration value="DeliveryDateTimeCurrentSchedule"/>
+ <xsd:enumeration value="DeliveryDateTimeDeferred"/>
+ <xsd:enumeration value="DeliveryDateTimeEarliest"/>
+ <xsd:enumeration value="DeliveryDateTimeExpected"/>
+ <xsd:enumeration value="DeliveryDateTimeFirst"/>
+ <xsd:enumeration value="DeliveryDateTimeLast"/>
+ <xsd:enumeration value="DeliveryDateTimeLatest"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedFor"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedForAfterAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedForPriorToAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimeRequested"/>
+ <xsd:enumeration value="DeliveryDateTimeScheduledFor"/>
+ <xsd:enumeration value="DeliveryEnd"/>
+ <xsd:enumeration value="DeliveryOrderIssued"/>
+ <xsd:enumeration value="DeliveryRating"/>
+ <xsd:enumeration value="DeliveryRequested"/>
+ <xsd:enumeration value="DeliveryStart"/>
+ <xsd:enumeration value="DeliveryTicket"/>
+ <xsd:enumeration value="DenialEffective"/>
+ <xsd:enumeration value="DenialRescission"/>
+ <xsd:enumeration value="DepartmentAdmissionDateAndOrTime"/>
+ <xsd:enumeration value="DepartmentDischargeDateAndOrTime"/>
+ <xsd:enumeration value="DepartmentOfLaborWageDeterminationDate"/>
+ <xsd:enumeration value="DepartureDateTime"/>
+ <xsd:enumeration value="DepartureDateTimeEarliest"/>
+ <xsd:enumeration value="DepartureDateTimeFromLastPortOfCall"/>
+ <xsd:enumeration value="DepartureDateTimeScheduled"/>
+ <xsd:enumeration value="DepartureDateTimeUltimate"/>
+ <xsd:enumeration value="DepartureFromSpecification"/>
+ <xsd:enumeration value="DepositDateTime"/>
+ <xsd:enumeration value="DespatchDateAndOrTime"/>
+ <xsd:enumeration value="DespatchNoteDate"/>
+ <xsd:enumeration value="DetrimentalInformationReceiptDate"/>
+ <xsd:enumeration value="DirectInterchangeDate"/>
+ <xsd:enumeration value="Disability"/>
+ <xsd:enumeration value="DisabilityWaitPeriod"/>
+ <xsd:enumeration value="DisbursementDate"/>
+ <xsd:enumeration value="DischargeDateTime"/>
+ <xsd:enumeration value="DischargeAndLoadingCompletedDateTime"/>
+ <xsd:enumeration value="Discharge-Planned"/>
+ <xsd:enumeration value="Discovered"/>
+ <xsd:enumeration value="DiscrepancyDateTime"/>
+ <xsd:enumeration value="DisembarkationDateAndTime"/>
+ <xsd:enumeration value="DismissalDate"/>
+ <xsd:enumeration value="Disposal"/>
+ <xsd:enumeration value="Disposition"/>
+ <xsd:enumeration value="DistributorEffective"/>
+ <xsd:enumeration value="DistributorTermination"/>
+ <xsd:enumeration value="DividendApplied"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentDate"/>
+ <xsd:enumeration value="DocumentaryCreditExpiryDateTime"/>
+ <xsd:enumeration value="DocumentaryCreditIssueDate"/>
+ <xsd:enumeration value="DocumentaryCreditPresentationPeriod"/>
+ <xsd:enumeration value="DocumentDate"/>
+ <xsd:enumeration value="DocumentDue"/>
+ <xsd:enumeration value="DocumentMessageDateTime"/>
+ <xsd:enumeration value="DocumentReceivedDateTime"/>
+ <xsd:enumeration value="DocumentRequestedDateTime"/>
+ <xsd:enumeration value="DoNotDeliverAfter"/>
+ <xsd:enumeration value="DoNotDeliverBefore"/>
+ <xsd:enumeration value="DoNotShipBeforeExCountry"/>
+ <xsd:enumeration value="DoNotShipBeforeExFactory"/>
+ <xsd:enumeration value="Draft"/>
+ <xsd:enumeration value="DrawingRevisionDate"/>
+ <xsd:enumeration value="DropActionDate"/>
+ <xsd:enumeration value="DroppedToLessThanHalfTime"/>
+ <xsd:enumeration value="DueDate"/>
+ <xsd:enumeration value="DueDateLastCompleteInstallmentPaid"/>
+ <xsd:enumeration value="DueDateOfFirstPaymentToPrincipalAndInterest"/>
+ <xsd:enumeration value="DueToCustomer"/>
+ <xsd:enumeration value="DuplicateBill"/>
+ <xsd:enumeration value="Duration"/>
+ <xsd:enumeration value="EarliestFilingPeriod"/>
+ <xsd:enumeration value="EarliestSaleDate"/>
+ <xsd:enumeration value="EarlyFinish"/>
+ <xsd:enumeration value="EarlyStart"/>
+ <xsd:enumeration value="EarlyWithdrawal"/>
+ <xsd:enumeration value="EarningsEffectiveDate"/>
+ <xsd:enumeration value="Education"/>
+ <xsd:enumeration value="EducationBegin"/>
+ <xsd:enumeration value="EducationEndDate"/>
+ <xsd:enumeration value="EducationStartDate"/>
+ <xsd:enumeration value="EffectiveDateTime"/>
+ <xsd:enumeration value="EffectiveDateOfChange"/>
+ <xsd:enumeration value="Election"/>
+ <xsd:enumeration value="Eligibility"/>
+ <xsd:enumeration value="EligibilityBegin"/>
+ <xsd:enumeration value="EligibilityEnd"/>
+ <xsd:enumeration value="EmbarkationDateAndTime"/>
+ <xsd:enumeration value="EmployedInThisPosition"/>
+ <xsd:enumeration value="EmployedInThisProfession"/>
+ <xsd:enumeration value="EmployeeEffectiveDateOfCoverage"/>
+ <xsd:enumeration value="EmployeeLaidOff"/>
+ <xsd:enumeration value="EmployeeTemporaryLaidOffPeriodStartDate"/>
+ <xsd:enumeration value="EmployeeTemporaryLaidOffPeriodEndDate"/>
+ <xsd:enumeration value="EmployeeWagesCeased"/>
+ <xsd:enumeration value="EmployerKnowledgeOfTheInjury"/>
+ <xsd:enumeration value="EmployerReportedInjuryToClaimAdministrator"/>
+ <xsd:enumeration value="EmploymentPositionStartDate"/>
+ <xsd:enumeration value="EmploymentEnd"/>
+ <xsd:enumeration value="EmploymentOrHire"/>
+ <xsd:enumeration value="EmploymentPositionStartDateEstimated"/>
+ <xsd:enumeration value="EmploymentProfessionStartDate"/>
+ <xsd:enumeration value="EndDateTime"/>
+ <xsd:enumeration value="EndAvailabilityDate"/>
+ <xsd:enumeration value="EndDateOfSupport"/>
+ <xsd:enumeration value="EndDateScheduled"/>
+ <xsd:enumeration value="EndingLayDate"/>
+ <xsd:enumeration value="EndOfGrace"/>
+ <xsd:enumeration value="EndOfLastFiscalYear"/>
+ <xsd:enumeration value="EndorsedCertificateIssueDate"/>
+ <xsd:enumeration value="EndorsementDate"/>
+ <xsd:enumeration value="EngineeringChangeLevelDate"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="Enrollment"/>
+ <xsd:enumeration value="EnrollmentSignatureDate"/>
+ <xsd:enumeration value="EntryDate"/>
+ <xsd:enumeration value="EntryDateEstimatedCustoms"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimeActual"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimeEarliest"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimePlanned"/>
+ <xsd:enumeration value="EquipmentLogEntry"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeActual"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeEstimated"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeRequested"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeUltimate"/>
+ <xsd:enumeration value="EquipmentPreTripDate"/>
+ <xsd:enumeration value="EquipmentReconditioningDateTimeActual"/>
+ <xsd:enumeration value="EquipmentRepairReadyDateTimeUltimate"/>
+ <xsd:enumeration value="EquipmentReturnPeriodExpected"/>
+ <xsd:enumeration value="EquipmentStockCheckDateTime"/>
+ <xsd:enumeration value="EscalationDate"/>
+ <xsd:enumeration value="EscalationStartDate"/>
+ <xsd:enumeration value="EstablishedDate"/>
+ <xsd:enumeration value="EstimateComment"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="EstimatedAcceptanceDate"/>
+ <xsd:enumeration value="ArrivalDateTimeEstimated"/>
+ <xsd:enumeration value="CompletionDateOrTimeEstimated"/>
+ <xsd:enumeration value="EstimatedCompletion-FirstPriorMonth"/>
+ <xsd:enumeration value="EstimatedCompletion-SecondPriorMonth"/>
+ <xsd:enumeration value="EstimatedCompletion-ThirdPriorMonth"/>
+ <xsd:enumeration value="ConstructionDateEstimated"/>
+ <xsd:enumeration value="DateOfBirthEstimated"/>
+ <xsd:enumeration value="DeliveryDateTimeEstimated"/>
+ <xsd:enumeration value="DepartureDateTimeEstimated"/>
+ <xsd:enumeration value="EstimatedEscrowClosing"/>
+ <xsd:enumeration value="EstimatedImmigrationDate"/>
+ <xsd:enumeration value="EstimatedPointOfArrival"/>
+ <xsd:enumeration value="EstimatedPointOfDischarge"/>
+ <xsd:enumeration value="EstimatedPortOfEntry"/>
+ <xsd:enumeration value="StartDateEstimated"/>
+ <xsd:enumeration value="EstimatedStart-FirstPriorMonth"/>
+ <xsd:enumeration value="EstimatedStart-SecondPriorMonth"/>
+ <xsd:enumeration value="EstimatedStart-ThirdPriorMonth"/>
+ <xsd:enumeration value="EstimatePreparation"/>
+ <xsd:enumeration value="EvaluationDate"/>
+ <xsd:enumeration value="EventDate"/>
+ <xsd:enumeration value="Examination"/>
+ <xsd:enumeration value="ExecutionDate"/>
+ <xsd:enumeration value="ExecutionDateTimeRequested"/>
+ <xsd:enumeration value="ExitPlantDate"/>
+ <xsd:enumeration value="ExpectedContainerHireFromDateTime"/>
+ <xsd:enumeration value="ExpectedFundingDate"/>
+ <xsd:enumeration value="ExpectedProblemResolutionDate"/>
+ <xsd:enumeration value="ExpectedReply"/>
+ <xsd:enumeration value="ExpectedValueDate"/>
+ <xsd:enumeration value="ExpeditedOn"/>
+ <xsd:enumeration value="Expiration"/>
+ <xsd:enumeration value="ExpirationDateOfExtensionToAssign"/>
+ <xsd:enumeration value="ExpirationDateOfExtensiontoForeclose"/>
+ <xsd:enumeration value="ExpirationDateTimeOfCustomsDocument"/>
+ <xsd:enumeration value="ExpirationDateToSubmitTitleEvidence"/>
+ <xsd:enumeration value="ExpirationOfExtensionToConvey"/>
+ <xsd:enumeration value="ExpirationOfExtensionToSubmitFiscalData"/>
+ <xsd:enumeration value="ExpirationOfForeclosureTimeframe"/>
+ <xsd:enumeration value="ExpiryDate"/>
+ <xsd:enumeration value="ExpiryDateOfExportLicence"/>
+ <xsd:enumeration value="ExpiryDateOfImportLicence"/>
+ <xsd:enumeration value="Explantation"/>
+ <xsd:enumeration value="ExportationDate"/>
+ <xsd:enumeration value="ExportationDateForTextiles"/>
+ <xsd:enumeration value="Exposure"/>
+ <xsd:enumeration value="ExposureSourcePeriod"/>
+ <xsd:enumeration value="Extended"/>
+ <xsd:enumeration value="Extract"/>
+ <xsd:enumeration value="FacsimileDueBy"/>
+ <xsd:enumeration value="Failed"/>
+ <xsd:enumeration value="FailureModeEffective"/>
+ <xsd:enumeration value="FeasibilitySignOff"/>
+ <xsd:enumeration value="FederalHighwayAdministrationFhwaInspectionDate"/>
+ <xsd:enumeration value="FeeCapitalization"/>
+ <xsd:enumeration value="FieldFailure"/>
+ <xsd:enumeration value="FieldTest"/>
+ <xsd:enumeration value="FileGenerationDateAndOrTime"/>
+ <xsd:enumeration value="FilingPeriod"/>
+ <xsd:enumeration value="FinalIssue"/>
+ <xsd:enumeration value="FinalReconciliationValueEstimateAsOf"/>
+ <xsd:enumeration value="FinalScheduledPayment"/>
+ <xsd:enumeration value="FinancialCoveragePeriod"/>
+ <xsd:enumeration value="FinancialInformationDate"/>
+ <xsd:enumeration value="FinancialInformationSubmissionDateTime"/>
+ <xsd:enumeration value="FinishDateOrTimeMandatory"/>
+ <xsd:enumeration value="FinishDateOrTimeEarliest"/>
+ <xsd:enumeration value="FinishDateOrTimeLatest"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FirstDateOfOrdering"/>
+ <xsd:enumeration value="FirstInterestBearingDate"/>
+ <xsd:enumeration value="FirstInterestPaymentDue"/>
+ <xsd:enumeration value="FirstInvolvement"/>
+ <xsd:enumeration value="FirstIssue"/>
+ <xsd:enumeration value="FirstMarketed"/>
+ <xsd:enumeration value="FirstPaymentChange"/>
+ <xsd:enumeration value="FirstPaymentDue"/>
+ <xsd:enumeration value="FirstProduced"/>
+ <xsd:enumeration value="FirstPublishedDate"/>
+ <xsd:enumeration value="FirstRateAdjustment"/>
+ <xsd:enumeration value="FirstSaleDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="FirstSubmission"/>
+ <xsd:enumeration value="FirstVisitorConsultation"/>
+ <xsd:enumeration value="FiscalAnniversary"/>
+ <xsd:enumeration value="FlatExtraEnd"/>
+ <xsd:enumeration value="FlatExtraPeriod"/>
+ <xsd:enumeration value="ForecastPeriod"/>
+ <xsd:enumeration value="ForecastPeriodEndDate"/>
+ <xsd:enumeration value="ForecastPeriodStart"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FreightBillDateTime"/>
+ <xsd:enumeration value="FromDateOfAwardToCompletion"/>
+ <xsd:enumeration value="FromDateOfAwardToDelivery"/>
+ <xsd:enumeration value="FromDateOfAwardToEarliestDelivery"/>
+ <xsd:enumeration value="FromDateOfAwardToLatestDelivery"/>
+ <xsd:enumeration value="FromDateOfNoticeToProceedToCommencementOf"/>
+ <xsd:enumeration value="FromDateOfNoticeToProceedToCompletion"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToDelivery"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToSampleReady"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToShipment"/>
+ <xsd:enumeration value="FromDateOfReceiptOfItemToApproval"/>
+ <xsd:enumeration value="FromDateOfReceiptOfToolingAidsToSampleReady"/>
+ <xsd:enumeration value="FromDateOfSampleApprovalToFirstProductShipment"/>
+ <xsd:enumeration value="FromDateOfToolingAuthorizationToSampleReady"/>
+ <xsd:enumeration value="FromLastBookedOrderToDelivery"/>
+ <xsd:enumeration value="FumigationDateAndOrTime"/>
+ <xsd:enumeration value="FunctionalTest"/>
+ <xsd:enumeration value="FundsAppropriation-End"/>
+ <xsd:enumeration value="FundsAppropriation-Start"/>
+ <xsd:enumeration value="FuturePeriod"/>
+ <xsd:enumeration value="GallonsPerMinuteTestPerformed"/>
+ <xsd:enumeration value="GoodsCollectionOrPickUpDateTimePlanned"/>
+ <xsd:enumeration value="GoodsPositioningDateTimeExpected"/>
+ <xsd:enumeration value="GoodsPositioningDateTimePlanned"/>
+ <xsd:enumeration value="GoodsReceiptDateTime"/>
+ <xsd:enumeration value="GraduationDate"/>
+ <xsd:enumeration value="GroupContractEffective"/>
+ <xsd:enumeration value="GroupContractExpiration"/>
+ <xsd:enumeration value="GuaranteeDate"/>
+ <xsd:enumeration value="GuaranteePeriod"/>
+ <xsd:enumeration value="GuarantorReceived"/>
+ <xsd:enumeration value="HandOverDateTimeActual"/>
+ <xsd:enumeration value="HandOverDateTimePlanned"/>
+ <xsd:enumeration value="HighCapitalYear"/>
+ <xsd:enumeration value="HighFabricationReleaseAuthorization"/>
+ <xsd:enumeration value="HighRawMaterialAuthorization"/>
+ <xsd:enumeration value="HiredFromDate"/>
+ <xsd:enumeration value="HiredUntilDate"/>
+ <xsd:enumeration value="HoldAsOf"/>
+ <xsd:enumeration value="HoldAsStockAsOf"/>
+ <xsd:enumeration value="Holiday"/>
+ <xsd:enumeration value="HolidayFinish"/>
+ <xsd:enumeration value="HolidayStart"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="HorizonEndDate"/>
+ <xsd:enumeration value="HorizonPeriod"/>
+ <xsd:enumeration value="HorizonStartDate"/>
+ <xsd:enumeration value="HosesConnectedDateTime"/>
+ <xsd:enumeration value="HosesDisconnectedDateTime"/>
+ <xsd:enumeration value="HospitalAdmissionDateAndOrTime"/>
+ <xsd:enumeration value="HospitalDischargeDateAndOrTime"/>
+ <xsd:enumeration value="HydrotestDate"/>
+ <xsd:enumeration value="Illness"/>
+ <xsd:enumeration value="IllnessBegin"/>
+ <xsd:enumeration value="IllnessRecoveryDateExpected"/>
+ <xsd:enumeration value="ImmigrationDate"/>
+ <xsd:enumeration value="Implantation"/>
+ <xsd:enumeration value="ImplementationDateTimePeriod"/>
+ <xsd:enumeration value="Import"/>
+ <xsd:enumeration value="ImportationDate"/>
+ <xsd:enumeration value="ImportLicenceDate"/>
+ <xsd:enumeration value="InactivityEndDate"/>
+ <xsd:enumeration value="Inactivity"/>
+ <xsd:enumeration value="InboundMovementAuthorizationDate"/>
+ <xsd:enumeration value="Incident"/>
+ <xsd:enumeration value="Income"/>
+ <xsd:enumeration value="IncomeDocumentationExpiration"/>
+ <xsd:enumeration value="IncomeIncreasePeriod"/>
+ <xsd:enumeration value="IncomePeriod"/>
+ <xsd:enumeration value="IncorporationDate"/>
+ <xsd:enumeration value="IncorporationDissolution"/>
+ <xsd:enumeration value="IncumbencyPeriod"/>
+ <xsd:enumeration value="IndividualEducationPlanIEP"/>
+ <xsd:enumeration value="In-force"/>
+ <xsd:enumeration value="InformationReleaseAuthorizationDate"/>
+ <xsd:enumeration value="InitialClaim"/>
+ <xsd:enumeration value="InitialCompletion"/>
+ <xsd:enumeration value="InitialContactDate"/>
+ <xsd:enumeration value="InitialDisabilityPeriodEnd"/>
+ <xsd:enumeration value="InitialDisabilityPeriodLastDayWorked"/>
+ <xsd:enumeration value="InitialDisabilityPeriodReturnToWork"/>
+ <xsd:enumeration value="InitialDisabilityPeriodStart"/>
+ <xsd:enumeration value="InitialFeeDue"/>
+ <xsd:enumeration value="InitialFinancialAccountsFiledDate"/>
+ <xsd:enumeration value="PlacementDateInitial"/>
+ <xsd:enumeration value="InitialPremium"/>
+ <xsd:enumeration value="InitialPremiumEffective"/>
+ <xsd:enumeration value="InitialRequestDate"/>
+ <xsd:enumeration value="InitialTreatment"/>
+ <xsd:enumeration value="InjuryBegin"/>
+ <xsd:enumeration value="InjuryEnd"/>
+ <xsd:enumeration value="InjuryOrIllness"/>
+ <xsd:enumeration value="InlandShip"/>
+ <xsd:enumeration value="InquiryDate"/>
+ <xsd:enumeration value="InServiceSurveyDate"/>
+ <xsd:enumeration value="InsolvencyDischargeGrantedDate"/>
+ <xsd:enumeration value="InspectionDate"/>
+ <xsd:enumeration value="InstallationDateTimePeriod"/>
+ <xsd:enumeration value="InstallmentDate"/>
+ <xsd:enumeration value="InstalmentPaymentDueDate"/>
+ <xsd:enumeration value="InstructionsOriginalExecutionDate"/>
+ <xsd:enumeration value="InsufficientAssetsJudgementDate"/>
+ <xsd:enumeration value="InsuranceCard"/>
+ <xsd:enumeration value="InterestCapitalization"/>
+ <xsd:enumeration value="InterestPaidThrough"/>
+ <xsd:enumeration value="InterestPaidTo"/>
+ <xsd:enumeration value="InterestPeriod"/>
+ <xsd:enumeration value="InterestRateValidityPeriod"/>
+ <xsd:enumeration value="InternationalAssessmentApprovalForPublicationDate"/>
+ <xsd:enumeration value="InternationalReviewCycleStartDate"/>
+ <xsd:enumeration value="InterruptionEnd"/>
+ <xsd:enumeration value="InterruptionStart"/>
+ <xsd:enumeration value="InterviewedDate"/>
+ <xsd:enumeration value="InterviewerSigned"/>
+ <xsd:enumeration value="Inventory"/>
+ <xsd:enumeration value="InventoryReportDate"/>
+ <xsd:enumeration value="InvestigationEndDate"/>
+ <xsd:enumeration value="InvestigationStartDate"/>
+ <xsd:enumeration value="InvestmentNumberAllocationDate"/>
+ <xsd:enumeration value="InvitationToTenderDateTime"/>
+ <xsd:enumeration value="InvoiceDateTime"/>
+ <xsd:enumeration value="InvoiceDateRequired"/>
+ <xsd:enumeration value="InvoicePeriodEnd"/>
+ <xsd:enumeration value="InvoicePeriodStart"/>
+ <xsd:enumeration value="InvoicingPeriod"/>
+ <xsd:enumeration value="IrregularInterestPaymentDue"/>
+ <xsd:enumeration value="IssueDate"/>
+ <xsd:enumeration value="ItemContractEffective"/>
+ <xsd:enumeration value="ItemContractExpiration"/>
+ <xsd:enumeration value="JoinedEmployerDate"/>
+ <xsd:enumeration value="JoinedFundDateTime"/>
+ <xsd:enumeration value="JudgementDate"/>
+ <xsd:enumeration value="Judgment"/>
+ <xsd:enumeration value="KeyEventCalendarYear"/>
+ <xsd:enumeration value="KeyEventFiscalYear"/>
+ <xsd:enumeration value="LabourWageDeterminationDate"/>
+ <xsd:enumeration value="LastActivityDate"/>
+ <xsd:enumeration value="LastAnnualReportDate"/>
+ <xsd:enumeration value="LastCapitalChangeDate"/>
+ <xsd:enumeration value="LastCertification"/>
+ <xsd:enumeration value="LastChange"/>
+ <xsd:enumeration value="LastCheckForBalanceSheetUpdateDate"/>
+ <xsd:enumeration value="LastCivilianFlight"/>
+ <xsd:enumeration value="LastDateForAGovernmentAgencyToFileAClaim"/>
+ <xsd:enumeration value="LastDateOfAccountsFiledAtPublicRegister"/>
+ <xsd:enumeration value="LastDateOfOrdering"/>
+ <xsd:enumeration value="LastDateToFileAClaim"/>
+ <xsd:enumeration value="LastDateToObject"/>
+ <xsd:enumeration value="LastEpisode"/>
+ <xsd:enumeration value="LastFlight"/>
+ <xsd:enumeration value="LastFollow-up"/>
+ <xsd:enumeration value="LastInsuranceMedical"/>
+ <xsd:enumeration value="LastInterestBearingDate"/>
+ <xsd:enumeration value="LastItemDelivery"/>
+ <xsd:enumeration value="LastLogged"/>
+ <xsd:enumeration value="LastMarketed"/>
+ <xsd:enumeration value="LastMeal"/>
+ <xsd:enumeration value="LastMenstrualCycleStartDate"/>
+ <xsd:enumeration value="LastMenstrualPeriod"/>
+ <xsd:enumeration value="LastMilitaryFlight"/>
+ <xsd:enumeration value="LastNotification"/>
+ <xsd:enumeration value="LastOffHireDate"/>
+ <xsd:enumeration value="LastOnHireDate"/>
+ <xsd:enumeration value="LastPaidInstallmentDate"/>
+ <xsd:enumeration value="LastPaymentMade"/>
+ <xsd:enumeration value="LastPhysical"/>
+ <xsd:enumeration value="LastPremiumEffective"/>
+ <xsd:enumeration value="LastPremiumPaidDate"/>
+ <xsd:enumeration value="LastProduction"/>
+ <xsd:enumeration value="LastPublication"/>
+ <xsd:enumeration value="LastPublishedDate"/>
+ <xsd:enumeration value="LastSalaryIncrease"/>
+ <xsd:enumeration value="LastSaleDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="LastScreening"/>
+ <xsd:enumeration value="LastSeenDate"/>
+ <xsd:enumeration value="LastVisitDate"/>
+ <xsd:enumeration value="LastXRayDate"/>
+ <xsd:enumeration value="LateFinish"/>
+ <xsd:enumeration value="LatestAbsence"/>
+ <xsd:enumeration value="LateStart"/>
+ <xsd:enumeration value="LatestBalanceSheet"/>
+ <xsd:enumeration value="LatestCheckInTime"/>
+ <xsd:enumeration value="LatestDeliveryDateatPier"/>
+ <xsd:enumeration value="LatestDeliveryDateAtRailRamp"/>
+ <xsd:enumeration value="LatestFilingPeriod"/>
+ <xsd:enumeration value="LatestMaterialSafetyDataSheetDate"/>
+ <xsd:enumeration value="LatestMeterReadingDate"/>
+ <xsd:enumeration value="LatestOnBoardCarrierDate"/>
+ <xsd:enumeration value="LatestPriceAdjustmentDate"/>
+ <xsd:enumeration value="LatestReceivingDateCutoffDate"/>
+ <xsd:enumeration value="LatestVisitorConsultation"/>
+ <xsd:enumeration value="LayTimeFirstDay"/>
+ <xsd:enumeration value="LayTimeLastDay"/>
+ <xsd:enumeration value="LeadTime"/>
+ <xsd:enumeration value="LeaseCommencement"/>
+ <xsd:enumeration value="LeasePeriod"/>
+ <xsd:enumeration value="LeaseTermEndDate"/>
+ <xsd:enumeration value="LeaseTermStartDate"/>
+ <xsd:enumeration value="LeftEmployerDate"/>
+ <xsd:enumeration value="LegalActionClosedDate"/>
+ <xsd:enumeration value="LegalActionStarted"/>
+ <xsd:enumeration value="LegalSettlementTermsMetDate"/>
+ <xsd:enumeration value="LegalStructureChangeDate"/>
+ <xsd:enumeration value="LenderCreditCheck"/>
+ <xsd:enumeration value="LetterOfAgreementDate"/>
+ <xsd:enumeration value="LetterOfLiabilityDate"/>
+ <xsd:enumeration value="License"/>
+ <xsd:enumeration value="LicenseEffective"/>
+ <xsd:enumeration value="LicenseExpiration"/>
+ <xsd:enumeration value="LicenseRenewal"/>
+ <xsd:enumeration value="LicenseRequested"/>
+ <xsd:enumeration value="Lien"/>
+ <xsd:enumeration value="LiquidationDate"/>
+ <xsd:enumeration value="ListingReceived"/>
+ <xsd:enumeration value="ListPriceChange"/>
+ <xsd:enumeration value="LoadedonVessel"/>
+ <xsd:enumeration value="LoadingDateTimeActual"/>
+ <xsd:enumeration value="Loan"/>
+ <xsd:enumeration value="LoanPurchase"/>
+ <xsd:enumeration value="LoanServicingTransfer"/>
+ <xsd:enumeration value="LocationExceptionOrderNumberAssigned"/>
+ <xsd:enumeration value="Loss"/>
+ <xsd:enumeration value="LotNumberExpiration"/>
+ <xsd:enumeration value="LowestActivityPeriod"/>
+ <xsd:enumeration value="LowPeriod"/>
+ <xsd:enumeration value="MailBy"/>
+ <xsd:enumeration value="MailingDate"/>
+ <xsd:enumeration value="MailReceiptDate"/>
+ <xsd:enumeration value="Maintenance"/>
+ <xsd:enumeration value="MaintenanceComment"/>
+ <xsd:enumeration value="MaintenanceEffective"/>
+ <xsd:enumeration value="MakegoodCommercialDate"/>
+ <xsd:enumeration value="ManagementAvailableDate"/>
+ <xsd:enumeration value="ManagerNotRegisteredAsOfGivenDate"/>
+ <xsd:enumeration value="MandatoryOrTargetFinish"/>
+ <xsd:enumeration value="MandatoryOrTargetStart"/>
+ <xsd:enumeration value="ManifestShipNoticeDate"/>
+ <xsd:enumeration value="Manufacture"/>
+ <xsd:enumeration value="Map"/>
+ <xsd:enumeration value="DateOfMarriage"/>
+ <xsd:enumeration value="MasterLeaseAgreement"/>
+ <xsd:enumeration value="MaterialChangeNotice"/>
+ <xsd:enumeration value="MaterialClassification"/>
+ <xsd:enumeration value="MaterialSpecification"/>
+ <xsd:enumeration value="Maturity"/>
+ <xsd:enumeration value="MaturityDate"/>
+ <xsd:enumeration value="MaximumCreditGrantedDate"/>
+ <xsd:enumeration value="MeatAgeingPeriod"/>
+ <xsd:enumeration value="Medicaid"/>
+ <xsd:enumeration value="MedicaidBegin"/>
+ <xsd:enumeration value="MedicaidEnd"/>
+ <xsd:enumeration value="MedicalCertificate"/>
+ <xsd:enumeration value="MedicalInformationSignature"/>
+ <xsd:enumeration value="MedicalInformationSystem"/>
+ <xsd:enumeration value="Medicare"/>
+ <xsd:enumeration value="MedicareBegin"/>
+ <xsd:enumeration value="MedicareEnd"/>
+ <xsd:enumeration value="MedicarePartACoverageEffectiveDate"/>
+ <xsd:enumeration value="MedicarePartAEligibilityBeginDate"/>
+ <xsd:enumeration value="MedicarePartAEligibilityEndDate"/>
+ <xsd:enumeration value="MedicarePartATerminationDate"/>
+ <xsd:enumeration value="MedicarePartBCoverageEffectiveDate"/>
+ <xsd:enumeration value="MedicarePartBEligibilityBeginDate"/>
+ <xsd:enumeration value="MedicarePartBEligibilityEndDate"/>
+ <xsd:enumeration value="MedicarePartBTerminationDate"/>
+ <xsd:enumeration value="Medication"/>
+ <xsd:enumeration value="MeetingDate"/>
+ <xsd:enumeration value="Merger"/>
+ <xsd:enumeration value="Message"/>
+ <xsd:enumeration value="MeterReading"/>
+ <xsd:enumeration value="MidpointOfPerformance"/>
+ <xsd:enumeration value="MinimumRequiredDistribution"/>
+ <xsd:enumeration value="MinimumShelfLifeRemainingAtTimeOfDespatchPeriod"/>
+ <xsd:enumeration value="MinimumShelfLifeRemainingAtTimeOfReceipt"/>
+ <xsd:enumeration value="MonthEnding"/>
+ <xsd:enumeration value="MonthToDate"/>
+ <xsd:enumeration value="MooringDateAndTime"/>
+ <xsd:enumeration value="MortgageeOfficialSignatureDate"/>
+ <xsd:enumeration value="MortgageeReportedCurtailmentDate"/>
+ <xsd:enumeration value="MortgageNoteDate"/>
+ <xsd:enumeration value="MostLikelyEarlyFinish"/>
+ <xsd:enumeration value="MostLikelyEarlyStart"/>
+ <xsd:enumeration value="MostLikelyLateFinish"/>
+ <xsd:enumeration value="MostLikelyLateStart"/>
+ <xsd:enumeration value="MostRecentHemoglobinOrHematocritOrBoth"/>
+ <xsd:enumeration value="MostRecentRenewal"/>
+ <xsd:enumeration value="MostRecentRevisionorInitialVersion"/>
+ <xsd:enumeration value="MostRecentSerumCreatine"/>
+ <xsd:enumeration value="MovedFromLocationDate"/>
+ <xsd:enumeration value="NegotiatedExtensionDate"/>
+ <xsd:enumeration value="NegotiatedFinish"/>
+ <xsd:enumeration value="NegotiatedStart"/>
+ <xsd:enumeration value="NegotiationsStartDate"/>
+ <xsd:enumeration value="NetCreditServiceDate"/>
+ <xsd:enumeration value="NetWorthDate"/>
+ <xsd:enumeration value="NextActivity"/>
+ <xsd:enumeration value="NextAnniversary"/>
+ <xsd:enumeration value="NextAnnualMeeting"/>
+ <xsd:enumeration value="NextInstallmentDueDate"/>
+ <xsd:enumeration value="NextInterestChangeDate"/>
+ <xsd:enumeration value="NextPayIncrease"/>
+ <xsd:enumeration value="NextPaymentDue"/>
+ <xsd:enumeration value="NextReviewDate"/>
+ <xsd:enumeration value="NonWorking"/>
+ <xsd:enumeration value="NoProductionScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="NoPromiseAsOf"/>
+ <xsd:enumeration value="NoShippingScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="NotAfter"/>
+ <xsd:enumeration value="NotBefore"/>
+ <xsd:enumeration value="Note"/>
+ <xsd:enumeration value="Notice"/>
+ <xsd:enumeration value="NotificationDateTime"/>
+ <xsd:enumeration value="NotificationOfDeath"/>
+ <xsd:enumeration value="NotificationTimeLimit"/>
+ <xsd:enumeration value="Notified"/>
+ <xsd:enumeration value="NotRegistered"/>
+ <xsd:enumeration value="NotRegisteredAsOfGivenDate"/>
+ <xsd:enumeration value="NursingHome"/>
+ <xsd:enumeration value="NursingHomeFrom"/>
+ <xsd:enumeration value="NursingHomeTo"/>
+ <xsd:enumeration value="Occupancy"/>
+ <xsd:enumeration value="Occurrence"/>
+ <xsd:enumeration value="OccurrenceSpan"/>
+ <xsd:enumeration value="OccurrenceSpanFrom"/>
+ <xsd:enumeration value="OccurrenceSpanTo"/>
+ <xsd:enumeration value="OfferExpiration"/>
+ <xsd:enumeration value="OffHireSurveyDate"/>
+ <xsd:enumeration value="OffHold"/>
+ <xsd:enumeration value="OfficialRailCarInterchangeEitherActualorAgreedUpon"/>
+ <xsd:enumeration value="Off-Market"/>
+ <xsd:enumeration value="Offset"/>
+ <xsd:enumeration value="OffsetBegin"/>
+ <xsd:enumeration value="OffsetEnd"/>
+ <xsd:enumeration value="OffsetFromCoordinatedUniversalTimeUtc"/>
+ <xsd:enumeration value="OldestUnpaidInstallment"/>
+ <xsd:enumeration value="On"/>
+ <xsd:enumeration value="OnBoardDate"/>
+ <xsd:enumeration value="OnHireSurveyDate"/>
+ <xsd:enumeration value="OnHold"/>
+ <xsd:enumeration value="OnsetOfCurrentSymptomsOrIllness"/>
+ <xsd:enumeration value="OnsetOfSimilarSymptomsOrIllness"/>
+ <xsd:enumeration value="OpenHouse"/>
+ <xsd:enumeration value="OpeningDate"/>
+ <xsd:enumeration value="OperationsCeasedDate"/>
+ <xsd:enumeration value="Opinion"/>
+ <xsd:enumeration value="OptimisticEarlyFinish"/>
+ <xsd:enumeration value="OptimisticEarlyStart"/>
+ <xsd:enumeration value="OptimisticLateFinish"/>
+ <xsd:enumeration value="OptimisticLateStart"/>
+ <xsd:enumeration value="Option"/>
+ <xsd:enumeration value="Order"/>
+ <xsd:enumeration value="OrderAmendmentBindingDate"/>
+ <xsd:enumeration value="OrderCompletionDateTimeUltimate"/>
+ <xsd:enumeration value="OrderDateTime"/>
+ <xsd:enumeration value="OrderEnd"/>
+ <xsd:enumeration value="OrderReceivedDateTime"/>
+ <xsd:enumeration value="OrderStart"/>
+ <xsd:enumeration value="OrderToProceedDate"/>
+ <xsd:enumeration value="Original"/>
+ <xsd:enumeration value="OriginalDueDate"/>
+ <xsd:enumeration value="OriginalDuration"/>
+ <xsd:enumeration value="OriginalEarlyFinish"/>
+ <xsd:enumeration value="OriginalEarlyStart"/>
+ <xsd:enumeration value="OriginalEstimateDate"/>
+ <xsd:enumeration value="OriginalIssueAge"/>
+ <xsd:enumeration value="OriginalList"/>
+ <xsd:enumeration value="OriginallyScheduledShip"/>
+ <xsd:enumeration value="OriginalMaturityDate"/>
+ <xsd:enumeration value="OriginalNameChangeDate"/>
+ <xsd:enumeration value="OriginalPostingDate"/>
+ <xsd:enumeration value="OriginalReceipt"/>
+ <xsd:enumeration value="OrthodonticTreatmentPeriodRemaining"/>
+ <xsd:enumeration value="OrthodonticTreatmentPeriodTotal"/>
+ <xsd:enumeration value="Out-Of-Pocket"/>
+ <xsd:enumeration value="OutsideAuditorsReport"/>
+ <xsd:enumeration value="Overhauled"/>
+ <xsd:enumeration value="OverrideDateForSettlement"/>
+ <xsd:enumeration value="OverTargetBaselineMonth"/>
+ <xsd:enumeration value="OvertimeEndDate"/>
+ <xsd:enumeration value="OvertimeStartDate"/>
+ <xsd:enumeration value="OwnershipChangeDate"/>
+ <xsd:enumeration value="OwnershipPeriod"/>
+ <xsd:enumeration value="OxygenSaturationTest"/>
+ <xsd:enumeration value="OxygenTherapy"/>
+ <xsd:enumeration value="OxygenTherapyEvaluation"/>
+ <xsd:enumeration value="OxygenTherapyFrom"/>
+ <xsd:enumeration value="OxygenTherapyTo"/>
+ <xsd:enumeration value="PackingEndDate"/>
+ <xsd:enumeration value="PackingStartDate"/>
+ <xsd:enumeration value="PaidInFull"/>
+ <xsd:enumeration value="PaidThroughDate"/>
+ <xsd:enumeration value="Paid-ThroughDateForAccruedSickPay"/>
+ <xsd:enumeration value="PaidThroughDateForMinimumPayment"/>
+ <xsd:enumeration value="Paid-ThroughDateForSalaryContinuation"/>
+ <xsd:enumeration value="PaidThroughDateForTotalPayment"/>
+ <xsd:enumeration value="Paid-ThroughDateForVacationPay"/>
+ <xsd:enumeration value="PaidToDate"/>
+ <xsd:enumeration value="Paid-up"/>
+ <xsd:enumeration value="PaperworkMailed"/>
+ <xsd:enumeration value="PartialAnnuitization"/>
+ <xsd:enumeration value="ParticipationDate"/>
+ <xsd:enumeration value="PartTimeWorkingChangeDateTime"/>
+ <xsd:enumeration value="PastDue"/>
+ <xsd:enumeration value="PatientFirstVisitForCondition"/>
+ <xsd:enumeration value="PaymentCommencement"/>
+ <xsd:enumeration value="PaymentDate"/>
+ <xsd:enumeration value="PaymentDateTimeDeferred"/>
+ <xsd:enumeration value="PaymentDueDate"/>
+ <xsd:enumeration value="PaymentEffective"/>
+ <xsd:enumeration value="PaymentInitiated"/>
+ <xsd:enumeration value="PaymentInstructionDateTime"/>
+ <xsd:enumeration value="PaymentIssue"/>
+ <xsd:enumeration value="PaymentPeriod"/>
+ <xsd:enumeration value="PaymentPeriodEnd"/>
+ <xsd:enumeration value="PaymentPeriodStart"/>
+ <xsd:enumeration value="PaymentValuationPresentationDateTime"/>
+ <xsd:enumeration value="PayrollDeductionDateTime"/>
+ <xsd:enumeration value="PayrollPeriod"/>
+ <xsd:enumeration value="PayrollPeriodBegin"/>
+ <xsd:enumeration value="PayrollPeriodEnd"/>
+ <xsd:enumeration value="PeakActivityPeriod"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStay"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStayFrom"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStayTo"/>
+ <xsd:enumeration value="Penalty"/>
+ <xsd:enumeration value="PenaltyBegin"/>
+ <xsd:enumeration value="PenaltyEnd"/>
+ <xsd:enumeration value="PendingArchive"/>
+ <xsd:enumeration value="PercolationTest"/>
+ <xsd:enumeration value="PeriodAnEventIsLateDueToCustomer"/>
+ <xsd:enumeration value="PeriodAssigned"/>
+ <xsd:enumeration value="PeriodBetweenChanges"/>
+ <xsd:enumeration value="PeriodCoveredBySourceDocuments"/>
+ <xsd:enumeration value="PeriodEnd"/>
+ <xsd:enumeration value="PeriodExtended"/>
+ <xsd:enumeration value="PeriodicInspectionDate"/>
+ <xsd:enumeration value="PeriodOfCareEndDateAndOrTime"/>
+ <xsd:enumeration value="PeriodOfCareStartDateAndOrTime"/>
+ <xsd:enumeration value="PeriodOfIllnessEndDate"/>
+ <xsd:enumeration value="PeriodOfIllnessStartDate"/>
+ <xsd:enumeration value="PeriodOverdue"/>
+ <xsd:enumeration value="PeriodStart"/>
+ <xsd:enumeration value="PeriodWorkedForTheCompany"/>
+ <xsd:enumeration value="PermitToAdmitDate"/>
+ <xsd:enumeration value="PermitYear"/>
+ <xsd:enumeration value="PessimisticEarlyFinish"/>
+ <xsd:enumeration value="PessimisticEarlyStart"/>
+ <xsd:enumeration value="PessimisticLateFinish"/>
+ <xsd:enumeration value="PessimisticLateStart"/>
+ <xsd:enumeration value="PickUpCollectionDateTimeOfCargo"/>
+ <xsd:enumeration value="PickUpDateTimeOfEquipment"/>
+ <xsd:enumeration value="Placement"/>
+ <xsd:enumeration value="PlacementDate"/>
+ <xsd:enumeration value="PlacementDatePrevious"/>
+ <xsd:enumeration value="PlacementPeriodExpiration"/>
+ <xsd:enumeration value="Plan"/>
+ <xsd:enumeration value="PlanAnniversary"/>
+ <xsd:enumeration value="PlanBegin"/>
+ <xsd:enumeration value="PlanEnd"/>
+ <xsd:enumeration value="PlanEntry"/>
+ <xsd:enumeration value="PlannedDurationOfWorks"/>
+ <xsd:enumeration value="PlannedRelease"/>
+ <xsd:enumeration value="PlanOfTreatmentPeriod"/>
+ <xsd:enumeration value="PlanParticipationSuspension"/>
+ <xsd:enumeration value="PlanPeriodElection"/>
+ <xsd:enumeration value="PlanPeriodElectionBegin"/>
+ <xsd:enumeration value="PlanPeriodElectionEnd"/>
+ <xsd:enumeration value="PlanTermination"/>
+ <xsd:enumeration value="PluggedAndAbandoned"/>
+ <xsd:enumeration value="PolicyEffective"/>
+ <xsd:enumeration value="PolicyEffectiveOnOrAfter"/>
+ <xsd:enumeration value="PolicyEffectiveOnOrBefore"/>
+ <xsd:enumeration value="PolicyExpiration"/>
+ <xsd:enumeration value="PolicySurrender"/>
+ <xsd:enumeration value="PoolSettlement"/>
+ <xsd:enumeration value="PositioningDateTimeOfEquipment"/>
+ <xsd:enumeration value="PositioningDateTimeOfGoods"/>
+ <xsd:enumeration value="PostingDate"/>
+ <xsd:enumeration value="PostmarkDateTime"/>
+ <xsd:enumeration value="Post-Reclassification"/>
+ <xsd:enumeration value="Post-ReclassificationEndOfSecondYear"/>
+ <xsd:enumeration value="Post-ReclassificationFirstReportCard"/>
+ <xsd:enumeration value="Post-ReclassificationFirstSemi-annual"/>
+ <xsd:enumeration value="Post-ReclassificationSecondSemi-annual"/>
+ <xsd:enumeration value="PrearrangedDealMatch"/>
+ <xsd:enumeration value="Pre-AwardSurvey"/>
+ <xsd:enumeration value="PrecedingPeriod"/>
+ <xsd:enumeration value="Pre-certificationDate"/>
+ <xsd:enumeration value="PreforeclosureAcceptanceDate"/>
+ <xsd:enumeration value="PreforeclosureSaleClosingDate"/>
+ <xsd:enumeration value="PregnancyBegin"/>
+ <xsd:enumeration value="PregnancyDurationActual"/>
+ <xsd:enumeration value="PregnancyEnd"/>
+ <xsd:enumeration value="PremiumChangePeriod"/>
+ <xsd:enumeration value="PremiumPaidToDate"/>
+ <xsd:enumeration value="PremiumPaidToDateBegin"/>
+ <xsd:enumeration value="PremiumPaidToDateEnd"/>
+ <xsd:enumeration value="PreparationDateTimeOfDocument"/>
+ <xsd:enumeration value="Prescription"/>
+ <xsd:enumeration value="PrescriptionDispensingDateAndOrTime"/>
+ <xsd:enumeration value="PrescriptionFill"/>
+ <xsd:enumeration value="PrescriptionFrom"/>
+ <xsd:enumeration value="PrescriptionIssueDateAndOrTime"/>
+ <xsd:enumeration value="PrescriptionTo"/>
+ <xsd:enumeration value="PresentationDateLatest"/>
+ <xsd:enumeration value="PresentationDateOfGoodsDeclarationCustoms"/>
+ <xsd:enumeration value="PresentationToBankruptcyReceiversDate"/>
+ <xsd:enumeration value="PresentControl"/>
+ <xsd:enumeration value="PresentedToReceivers"/>
+ <xsd:enumeration value="PresentLegalStructure"/>
+ <xsd:enumeration value="PresentlyResiding"/>
+ <xsd:enumeration value="PresentmentDate"/>
+ <xsd:enumeration value="PresentName"/>
+ <xsd:enumeration value="PresentResidenceStartDate"/>
+ <xsd:enumeration value="PreviousBookingDateTime"/>
+ <xsd:enumeration value="PreviousCourtEvent"/>
+ <xsd:enumeration value="PreviousCurrentAccountDate"/>
+ <xsd:enumeration value="PreviousEmployment"/>
+ <xsd:enumeration value="PreviousEmploymentEnd"/>
+ <xsd:enumeration value="PreviousEmploymentStart"/>
+ <xsd:enumeration value="PreviousInvoiceDate"/>
+ <xsd:enumeration value="PreviouslyReportedDateOfBirth"/>
+ <xsd:enumeration value="PreviouslyResided"/>
+ <xsd:enumeration value="PreviousMeterReadingDate"/>
+ <xsd:enumeration value="PreviousMonthEnding"/>
+ <xsd:enumeration value="PreviousPeriod"/>
+ <xsd:enumeration value="PreviousReportDate"/>
+ <xsd:enumeration value="PreviousResidence"/>
+ <xsd:enumeration value="PreviousResidenceEnd"/>
+ <xsd:enumeration value="PreviousResidenceStart"/>
+ <xsd:enumeration value="PreviousTerminationDate"/>
+ <xsd:enumeration value="PriceAdjustmentDate"/>
+ <xsd:enumeration value="PriceAdjustmentLimitDate"/>
+ <xsd:enumeration value="PriceAdjustmentStartDate"/>
+ <xsd:enumeration value="PriceBaseDateTime"/>
+ <xsd:enumeration value="PriceProtection"/>
+ <xsd:enumeration value="PrimaryCareProvider"/>
+ <xsd:enumeration value="PrimaryCareProviderBegin"/>
+ <xsd:enumeration value="PrimaryCareProviderEnd"/>
+ <xsd:enumeration value="Printed"/>
+ <xsd:enumeration value="PriorContractAnniversary"/>
+ <xsd:enumeration value="PriorContractIssue"/>
+ <xsd:enumeration value="PriorHospitalizationDatesRelatedToCurrentServices"/>
+ <xsd:enumeration value="PriorIncorrectDateOfBirth"/>
+ <xsd:enumeration value="PriorNotice"/>
+ <xsd:enumeration value="PriorPlacement"/>
+ <xsd:enumeration value="PrivilegeDetailsVerificationDate"/>
+ <xsd:enumeration value="ProcessingDateTime"/>
+ <xsd:enumeration value="ProcessingDatePeriod"/>
+ <xsd:enumeration value="ProcessingEndDateTime"/>
+ <xsd:enumeration value="ProcessingStartDateTime"/>
+ <xsd:enumeration value="ProductAvailabilityDate"/>
+ <xsd:enumeration value="ProductHeldUntil"/>
+ <xsd:enumeration value="Production"/>
+ <xsd:enumeration value="ProductionDateNoScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="ProductionInspectionDate"/>
+ <xsd:enumeration value="ProductionManufactureDate"/>
+ <xsd:enumeration value="ProductLifespanAtTimeOfProduction"/>
+ <xsd:enumeration value="ProfitPeriod"/>
+ <xsd:enumeration value="ProgrammedCalendarYear"/>
+ <xsd:enumeration value="ProgrammedFiscalYear"/>
+ <xsd:enumeration value="ProgressPayment"/>
+ <xsd:enumeration value="ProjectedActionEndDate"/>
+ <xsd:enumeration value="ProjectedForeclosureSaleDate"/>
+ <xsd:enumeration value="ProjectOverTargetBaselineDate"/>
+ <xsd:enumeration value="PromisedForDelivery"/>
+ <xsd:enumeration value="PromisedForDeliveryAfterAndIncluding"/>
+ <xsd:enumeration value="PromisedForDeliveryPriorToAndIncluding"/>
+ <xsd:enumeration value="PromisedForDeliveryWeekOf"/>
+ <xsd:enumeration value="PromisedForShipment"/>
+ <xsd:enumeration value="PromisedForShipmentAfterAndIncluding"/>
+ <xsd:enumeration value="PromisedForShipmentPriortoAndIncluding"/>
+ <xsd:enumeration value="PromisedForShipmentWeekOf"/>
+ <xsd:enumeration value="PromotionDatePeriod"/>
+ <xsd:enumeration value="PromotionEndDateTime"/>
+ <xsd:enumeration value="PromotionFloorStockProtect-End"/>
+ <xsd:enumeration value="PromotionFloorStockProtect-Start"/>
+ <xsd:enumeration value="PromotionInvoicePerformance-End"/>
+ <xsd:enumeration value="PromotionInvoicePerformance-Start"/>
+ <xsd:enumeration value="PromotionOrder-End"/>
+ <xsd:enumeration value="PromotionOrder-Start"/>
+ <xsd:enumeration value="PromotionPerformance-End"/>
+ <xsd:enumeration value="PromotionPerformance-Start"/>
+ <xsd:enumeration value="PromotionRequestedDelivery-End"/>
+ <xsd:enumeration value="PromotionRequestedDelivery-Start"/>
+ <xsd:enumeration value="PromotionShip-End"/>
+ <xsd:enumeration value="PromotionShip-Start"/>
+ <xsd:enumeration value="PromotionStartDateTime"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="PropertyAcquired"/>
+ <xsd:enumeration value="PropertyBuilt"/>
+ <xsd:enumeration value="PrototypeTest"/>
+ <xsd:enumeration value="ProviderSignatureDate"/>
+ <xsd:enumeration value="PublicationDate"/>
+ <xsd:enumeration value="PurchasedDate"/>
+ <xsd:enumeration value="PurchaseOrder"/>
+ <xsd:enumeration value="PurchaseOrderLatestPossibleChangeDate"/>
+ <xsd:enumeration value="PurchaseOrderReceived"/>
+ <xsd:enumeration value="PutIntoService"/>
+ <xsd:enumeration value="QualityRating"/>
+ <xsd:enumeration value="QuarterEnding"/>
+ <xsd:enumeration value="QuotaDate"/>
+ <xsd:enumeration value="Quote"/>
+ <xsd:enumeration value="QuoteToBeReceivedBy"/>
+ <xsd:enumeration value="RateAdjustment"/>
+ <xsd:enumeration value="RateDate"/>
+ <xsd:enumeration value="RateOfExchangeDateTime"/>
+ <xsd:enumeration value="RatePriceDateTime"/>
+ <xsd:enumeration value="ReachedTotalDepth"/>
+ <xsd:enumeration value="ReadyForInspection"/>
+ <xsd:enumeration value="RealEstateProperty"/>
+ <xsd:enumeration value="RealEstateTaxYear"/>
+ <xsd:enumeration value="Rebuilt"/>
+ <xsd:enumeration value="Recapture"/>
+ <xsd:enumeration value="ReceivablesCollectionPeriod"/>
+ <xsd:enumeration value="Received"/>
+ <xsd:enumeration value="ReceiveAtLockboxDate"/>
+ <xsd:enumeration value="ReceivedDateTime"/>
+ <xsd:enumeration value="ReceivedInTheMail"/>
+ <xsd:enumeration value="ReceiverAppointed"/>
+ <xsd:enumeration value="ReceivershipPeriod"/>
+ <xsd:enumeration value="ReceivershipResultDate"/>
+ <xsd:enumeration value="Reclassification"/>
+ <xsd:enumeration value="ReclassificationExitDate"/>
+ <xsd:enumeration value="Recompletion"/>
+ <xsd:enumeration value="RecordedDate"/>
+ <xsd:enumeration value="Recovery"/>
+ <xsd:enumeration value="RecoveryFinish"/>
+ <xsd:enumeration value="RecoveryStart"/>
+ <xsd:enumeration value="Re-entry"/>
+ <xsd:enumeration value="Re-evaluationDate"/>
+ <xsd:enumeration value="ReExportationDate"/>
+ <xsd:enumeration value="ReferenceDateTime"/>
+ <xsd:enumeration value="ReferencedItemCreationDate"/>
+ <xsd:enumeration value="ReferralDate"/>
+ <xsd:enumeration value="ReferredFrom"/>
+ <xsd:enumeration value="ReferredTo"/>
+ <xsd:enumeration value="Refinance"/>
+ <xsd:enumeration value="RefusalPeriod"/>
+ <xsd:enumeration value="Registered"/>
+ <xsd:enumeration value="RegisteredContractorNumberAssignmentDateOriginal"/>
+ <xsd:enumeration value="RegistrationDate"/>
+ <xsd:enumeration value="RegistrationDateOfPreviousCustomsDeclaration"/>
+ <xsd:enumeration value="RegistrationOfBoardOfDirectors"/>
+ <xsd:enumeration value="Rehire"/>
+ <xsd:enumeration value="ReimbursementClaimIssueDateAndOrTime"/>
+ <xsd:enumeration value="ReImportationDate"/>
+ <xsd:enumeration value="ReinstatementDate"/>
+ <xsd:enumeration value="ReinsuranceAccountingPeriod"/>
+ <xsd:enumeration value="ReinsuranceCoverageDuration"/>
+ <xsd:enumeration value="ReinsuranceCurrentAccountPeriod"/>
+ <xsd:enumeration value="ReinsuranceEffective"/>
+ <xsd:enumeration value="ReinsuranceIssueAge"/>
+ <xsd:enumeration value="ReinsurancePaidUpDate"/>
+ <xsd:enumeration value="ReinsurancePaymentFrequency"/>
+ <xsd:enumeration value="Reissue"/>
+ <xsd:enumeration value="Rejected"/>
+ <xsd:enumeration value="ReleaseDateTime"/>
+ <xsd:enumeration value="ReleaseDateCustoms"/>
+ <xsd:enumeration value="ReleaseDateOfCustomer"/>
+ <xsd:enumeration value="ReleaseDateOfSupplier"/>
+ <xsd:enumeration value="ReleasedReturnToWork"/>
+ <xsd:enumeration value="ReleasedToVessel"/>
+ <xsd:enumeration value="ReleaseFrequency"/>
+ <xsd:enumeration value="ReleaseOfInformation"/>
+ <xsd:enumeration value="Remittance"/>
+ <xsd:enumeration value="RemodelingCompleted"/>
+ <xsd:enumeration value="Removed"/>
+ <xsd:enumeration value="RenewalDate"/>
+ <xsd:enumeration value="RentalPeriod"/>
+ <xsd:enumeration value="RentStart"/>
+ <xsd:enumeration value="RentSurvey"/>
+ <xsd:enumeration value="RepairTurnaroundTime"/>
+ <xsd:enumeration value="RepaymentBegin"/>
+ <xsd:enumeration value="RepaymentScheduleSent"/>
+ <xsd:enumeration value="Replaced"/>
+ <xsd:enumeration value="Replacement"/>
+ <xsd:enumeration value="ReplacementEffective"/>
+ <xsd:enumeration value="ReplyDate"/>
+ <xsd:enumeration value="Report"/>
+ <xsd:enumeration value="ReportedDate"/>
+ <xsd:enumeration value="ReportEndDate"/>
+ <xsd:enumeration value="ReportingCycleDate"/>
+ <xsd:enumeration value="ReportPeriod"/>
+ <xsd:enumeration value="ReportStartDate"/>
+ <xsd:enumeration value="Requalification"/>
+ <xsd:enumeration value="Request"/>
+ <xsd:enumeration value="RequestedContract"/>
+ <xsd:enumeration value="RequestedDepartureDate"/>
+ <xsd:enumeration value="RequestedFinish"/>
+ <xsd:enumeration value="DeliveryDateTimeRequestedForAfterAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimeRequestedForPriorToAndIncluding"/>
+ <xsd:enumeration value="RequestedForDeliveryWeekOf"/>
+ <xsd:enumeration value="ShipmentDateTimeRequestedForAfterAndIncluding"/>
+ <xsd:enumeration value="ShipmentDateTimeRequestedForPriorToAndIncluding"/>
+ <xsd:enumeration value="RequestedForShipmentWeekOf"/>
+ <xsd:enumeration value="RequestedOffer"/>
+ <xsd:enumeration value="RequestedPick-up"/>
+ <xsd:enumeration value="RequestedSettlement"/>
+ <xsd:enumeration value="RequestedShip"/>
+ <xsd:enumeration value="RequestedStart"/>
+ <xsd:enumeration value="RequestForQuotation"/>
+ <xsd:enumeration value="RequiredBy"/>
+ <xsd:enumeration value="RequiredDelivery"/>
+ <xsd:enumeration value="ReservationOfFacility"/>
+ <xsd:enumeration value="ResidentLicenseEffective"/>
+ <xsd:enumeration value="ResidentLicenseExpiration"/>
+ <xsd:enumeration value="ResignationDate"/>
+ <xsd:enumeration value="Resigned"/>
+ <xsd:enumeration value="ResolvedDate"/>
+ <xsd:enumeration value="RestDay"/>
+ <xsd:enumeration value="RestFinish"/>
+ <xsd:enumeration value="RestStart"/>
+ <xsd:enumeration value="Resubmission"/>
+ <xsd:enumeration value="RetentionReleaseDateTime"/>
+ <xsd:enumeration value="RetentionReleaseDateTimePartial"/>
+ <xsd:enumeration value="Retermination"/>
+ <xsd:enumeration value="Retirement"/>
+ <xsd:enumeration value="RetransmissionTimeStamp"/>
+ <xsd:enumeration value="ReturnedDate"/>
+ <xsd:enumeration value="ReturnedToCustomer"/>
+ <xsd:enumeration value="ReturnToWorkDate"/>
+ <xsd:enumeration value="ReturnToWorkPartTime"/>
+ <xsd:enumeration value="ReviewDate"/>
+ <xsd:enumeration value="ReviewPeriodEnd"/>
+ <xsd:enumeration value="RevisedAdjustedEnd"/>
+ <xsd:enumeration value="RevisedAdjustedStart"/>
+ <xsd:enumeration value="RevisedEstimateDate"/>
+ <xsd:enumeration value="Revision"/>
+ <xsd:enumeration value="Revocation"/>
+ <xsd:enumeration value="Revoked"/>
+ <xsd:enumeration value="RigArrival"/>
+ <xsd:enumeration value="RoadFundTaxExpiryDate"/>
+ <xsd:enumeration value="Sailing"/>
+ <xsd:enumeration value="SalaryChangeEffectiveDate"/>
+ <xsd:enumeration value="SalaryDeferral"/>
+ <xsd:enumeration value="SaleableStockDemandCoverPeriodExpected"/>
+ <xsd:enumeration value="SalesDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="SalesPeriod"/>
+ <xsd:enumeration value="SampleAvailableDate"/>
+ <xsd:enumeration value="SampleCollected"/>
+ <xsd:enumeration value="SampleRequiredDate"/>
+ <xsd:enumeration value="SamplesToBeReturnedBy"/>
+ <xsd:enumeration value="Sanction"/>
+ <xsd:enumeration value="SatisfactionDate"/>
+ <xsd:enumeration value="Satisfied"/>
+ <xsd:enumeration value="Schedule"/>
+ <xsd:enumeration value="ScheduledFinish"/>
+ <xsd:enumeration value="ScheduledForDeliveryOnOrAfter"/>
+ <xsd:enumeration value="ScheduledForDeliveryOnOrBefore"/>
+ <xsd:enumeration value="ScheduledForDeliveryWeekOf"/>
+ <xsd:enumeration value="ScheduledForShipmentAfterAndIncluding"/>
+ <xsd:enumeration value="ScheduledForShipmentPriorToAndIncluding"/>
+ <xsd:enumeration value="ScheduledForShipmentWeekOf"/>
+ <xsd:enumeration value="ScheduledInterchangeDelivery"/>
+ <xsd:enumeration value="ScheduledStart"/>
+ <xsd:enumeration value="ScheduleRelease"/>
+ <xsd:enumeration value="SchoolRefund"/>
+ <xsd:enumeration value="Seal"/>
+ <xsd:enumeration value="SecondAdmissionDate"/>
+ <xsd:enumeration value="SecondDischargeDate"/>
+ <xsd:enumeration value="SecurityRateAdjustment"/>
+ <xsd:enumeration value="SecuritySharePriceAsOfGivenDate"/>
+ <xsd:enumeration value="Selected"/>
+ <xsd:enumeration value="SelectionPeriodEndDate"/>
+ <xsd:enumeration value="SelectionPeriodStartDate"/>
+ <xsd:enumeration value="SellByDate"/>
+ <xsd:enumeration value="SellersLocalTime"/>
+ <xsd:enumeration value="SemiannualEnding"/>
+ <xsd:enumeration value="SendingRoadTimeStamp"/>
+ <xsd:enumeration value="SepticApproval"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="ServiceCompletionDateTimeActual"/>
+ <xsd:enumeration value="ServiceInterruption"/>
+ <xsd:enumeration value="ServicePeriodEnd"/>
+ <xsd:enumeration value="ServicePeriodStart"/>
+ <xsd:enumeration value="ServiceRequested"/>
+ <xsd:enumeration value="ServicerSignatureDate"/>
+ <xsd:enumeration value="Setoff"/>
+ <xsd:enumeration value="Settled"/>
+ <xsd:enumeration value="SettlementDate"/>
+ <xsd:enumeration value="SettlementDateAsSpecifiedByTheOriginator"/>
+ <xsd:enumeration value="SettlementDateFromInterlineSettlementSystemOnly"/>
+ <xsd:enumeration value="SettlementDatePlanned"/>
+ <xsd:enumeration value="SettlementDueDate"/>
+ <xsd:enumeration value="SettlementStatus"/>
+ <xsd:enumeration value="SharePrice"/>
+ <xsd:enumeration value="ShelfLifeExpiration"/>
+ <xsd:enumeration value="ShipDateOriginallyScheduled"/>
+ <xsd:enumeration value="ShipDuringDate"/>
+ <xsd:enumeration value="ShipmentDateTimePromisedFor"/>
+ <xsd:enumeration value="ShipmentDateTimePromisedForPriorToAndIncluding"/>
+ <xsd:enumeration value="ShipmentDateTimeRequested"/>
+ <xsd:enumeration value="ShipNotLaterThanDateTime"/>
+ <xsd:enumeration value="ShipNotBeforeDateTime"/>
+ <xsd:enumeration value="ShipNotBeforeAndNotAfterDateTime"/>
+ <xsd:enumeration value="ShipOnOrAboutDate"/>
+ <xsd:enumeration value="Shipped"/>
+ <xsd:enumeration value="ShippingDateAndOrTimeCurrentSchedule"/>
+ <xsd:enumeration value="ShippingDateNoScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="ShipWeekOfDate"/>
+ <xsd:enumeration value="ShutIn"/>
+ <xsd:enumeration value="SicknessBenefitAgeLimit"/>
+ <xsd:enumeration value="SicknessBenefitPeriod"/>
+ <xsd:enumeration value="SicknessInsuranceEliminationPeriod"/>
+ <xsd:enumeration value="SicknessLifetimeBenefitQualificationAge"/>
+ <xsd:enumeration value="SidetrackedWellbore"/>
+ <xsd:enumeration value="SignatureDate"/>
+ <xsd:enumeration value="SignatureReceived"/>
+ <xsd:enumeration value="SimilarIllnessOnsetDate"/>
+ <xsd:enumeration value="SimpleInterestDue"/>
+ <xsd:enumeration value="SlaughteringEndDate"/>
+ <xsd:enumeration value="SlaughteringStartDate"/>
+ <xsd:enumeration value="SocialSecurityClaimsVerificationDate"/>
+ <xsd:enumeration value="Sold"/>
+ <xsd:enumeration value="SoldBookPublication"/>
+ <xsd:enumeration value="SoleDirectorshipRegistrationDate"/>
+ <xsd:enumeration value="Solicitation"/>
+ <xsd:enumeration value="SourceDocumentCaptureDate"/>
+ <xsd:enumeration value="SpacingOrderUnitAssigned"/>
+ <xsd:enumeration value="SponsoredDependent"/>
+ <xsd:enumeration value="SponsoredDependentBegin"/>
+ <xsd:enumeration value="SponsoredDependentEnd"/>
+ <xsd:enumeration value="SpouseRetirement"/>
+ <xsd:enumeration value="Spud"/>
+ <xsd:enumeration value="StartDateTime"/>
+ <xsd:enumeration value="StartDateOrTimeActual"/>
+ <xsd:enumeration value="StartDateOrTimeEarliest"/>
+ <xsd:enumeration value="StartDateOrTimeEstimated"/>
+ <xsd:enumeration value="StartDateOrTimeLatest"/>
+ <xsd:enumeration value="StartDateOrTimeMandatory"/>
+ <xsd:enumeration value="StartDateOrTimeNotAfter"/>
+ <xsd:enumeration value="StartDateOrTimeNotBefore"/>
+ <xsd:enumeration value="StartDateOrTimeScheduled"/>
+ <xsd:enumeration value="StartDateTimePlanned"/>
+ <xsd:enumeration value="StartedDoingBusiness"/>
+ <xsd:enumeration value="StartNoEarlierThan"/>
+ <xsd:enumeration value="StartNoLaterThan"/>
+ <xsd:enumeration value="Statement"/>
+ <xsd:enumeration value="StateResidencyDate"/>
+ <xsd:enumeration value="StateTermination"/>
+ <xsd:enumeration value="StatisticalTimeSeriesDate"/>
+ <xsd:enumeration value="Status"/>
+ <xsd:enumeration value="StatusAfterAndIncluding"/>
+ <xsd:enumeration value="StatusAssignmentDate"/>
+ <xsd:enumeration value="StatusChangeDateTime"/>
+ <xsd:enumeration value="StatusCommercial"/>
+ <xsd:enumeration value="StatusOutsideProcessor"/>
+ <xsd:enumeration value="StatusPriorAndIncluding"/>
+ <xsd:enumeration value="StopDistributionDate"/>
+ <xsd:enumeration value="StopWorkAsOfGivenDate"/>
+ <xsd:enumeration value="Stored"/>
+ <xsd:enumeration value="StudentSigned"/>
+ <xsd:enumeration value="SubcontractorPeriodOfHire"/>
+ <xsd:enumeration value="SubmissionDate"/>
+ <xsd:enumeration value="Submittal"/>
+ <xsd:enumeration value="SubsequentInterestPaymentDue"/>
+ <xsd:enumeration value="SubsequentSubmission"/>
+ <xsd:enumeration value="SupersededDateTime"/>
+ <xsd:enumeration value="SupplementalIssue"/>
+ <xsd:enumeration value="SuppliersAverageCreditPeriod"/>
+ <xsd:enumeration value="SurfaceCasingAuthorityApproval"/>
+ <xsd:enumeration value="Surgery"/>
+ <xsd:enumeration value="Surrender"/>
+ <xsd:enumeration value="SurveyYear"/>
+ <xsd:enumeration value="SuspendedDate"/>
+ <xsd:enumeration value="SuspensionEffective"/>
+ <xsd:enumeration value="SuspensionPeriod"/>
+ <xsd:enumeration value="SwornAndSubscribed"/>
+ <xsd:enumeration value="SymptomsOnsetPatientAlleged"/>
+ <xsd:enumeration value="SystemSurvey"/>
+ <xsd:enumeration value="SystemTest"/>
+ <xsd:enumeration value="TableRatingEnd"/>
+ <xsd:enumeration value="TailCoverageBegin"/>
+ <xsd:enumeration value="TailCoverageEnd"/>
+ <xsd:enumeration value="TanksAcceptedDateTime"/>
+ <xsd:enumeration value="TanksInspectedDateTime"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="TaxPeriod"/>
+ <xsd:enumeration value="TaxPeriodEndDate"/>
+ <xsd:enumeration value="TaxPeriodStartDate"/>
+ <xsd:enumeration value="TaxPointDate"/>
+ <xsd:enumeration value="TaxYear"/>
+ <xsd:enumeration value="TechnicalRating"/>
+ <xsd:enumeration value="TelexDate"/>
+ <xsd:enumeration value="TemporaryProsthesisDate"/>
+ <xsd:enumeration value="TenderSubmissionDateTime"/>
+ <xsd:enumeration value="TerminatedDate"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TerminationOfFacility"/>
+ <xsd:enumeration value="TermsDiscountDueDateTime"/>
+ <xsd:enumeration value="TermsMet"/>
+ <xsd:enumeration value="TermsNetDueDate"/>
+ <xsd:enumeration value="TestCompletionDate"/>
+ <xsd:enumeration value="TestPerformed"/>
+ <xsd:enumeration value="TestPeriodEnding"/>
+ <xsd:enumeration value="TestStartDate"/>
+ <xsd:enumeration value="TexasLineTermination"/>
+ <xsd:enumeration value="Therapy"/>
+ <xsd:enumeration value="TimeEmployeeBeganWork"/>
+ <xsd:enumeration value="TimeInUS"/>
+ <xsd:enumeration value="TimeLimit"/>
+ <xsd:enumeration value="TimeNowDate"/>
+ <xsd:enumeration value="TimePeriod"/>
+ <xsd:enumeration value="TitleTransfer"/>
+ <xsd:enumeration value="ToolingRequiredDate"/>
+ <xsd:enumeration value="TotalShelfLifePeriod"/>
+ <xsd:enumeration value="Tour"/>
+ <xsd:enumeration value="TradeDate"/>
+ <xsd:enumeration value="TradeStyleRegistrationDate"/>
+ <xsd:enumeration value="TrainingBegin"/>
+ <xsd:enumeration value="TrainingEnd"/>
+ <xsd:enumeration value="TransactionCreationDate"/>
+ <xsd:enumeration value="TransferNoteAcceptanceDateAndTime"/>
+ <xsd:enumeration value="Transferred"/>
+ <xsd:enumeration value="TranshipmentDateTime"/>
+ <xsd:enumeration value="Transition"/>
+ <xsd:enumeration value="TransitTimeLimits"/>
+ <xsd:enumeration value="TransmissionDateTimeOfDocument"/>
+ <xsd:enumeration value="Transmitted"/>
+ <xsd:enumeration value="TransportEquipmentStrippingDateAndOrTime"/>
+ <xsd:enumeration value="TransportEquipmentStuffingDateAndOrTime"/>
+ <xsd:enumeration value="Travel"/>
+ <xsd:enumeration value="Treatment"/>
+ <xsd:enumeration value="TreatmentEnd"/>
+ <xsd:enumeration value="TreatmentStart"/>
+ <xsd:enumeration value="TrialBalancePeriod"/>
+ <xsd:enumeration value="TrialSet"/>
+ <xsd:enumeration value="TrialStartDateActual"/>
+ <xsd:enumeration value="TrialStartDateScheduled"/>
+ <xsd:enumeration value="Trust"/>
+ <xsd:enumeration value="UnderwritingYear"/>
+ <xsd:enumeration value="UnloadedDateAndTime"/>
+ <xsd:enumeration value="ValidationDate"/>
+ <xsd:enumeration value="ValidityPeriod"/>
+ <xsd:enumeration value="ValidityStartDate"/>
+ <xsd:enumeration value="ValidUntil"/>
+ <xsd:enumeration value="ValuationDateTime"/>
+ <xsd:enumeration value="ValuationDateCustoms"/>
+ <xsd:enumeration value="ValueAddedTaxClaimsVerificationDate"/>
+ <xsd:enumeration value="ValueDate"/>
+ <xsd:enumeration value="ValueDateOfIndex"/>
+ <xsd:enumeration value="VerbalReportNeeded"/>
+ <xsd:enumeration value="VerificationReceived"/>
+ <xsd:enumeration value="VerificationSent"/>
+ <xsd:enumeration value="Verified"/>
+ <xsd:enumeration value="Version"/>
+ <xsd:enumeration value="VesselRegistry"/>
+ <xsd:enumeration value="VestingService"/>
+ <xsd:enumeration value="VestingServiceBegin"/>
+ <xsd:enumeration value="VestingServiceEnd"/>
+ <xsd:enumeration value="VoluntaryTermination"/>
+ <xsd:enumeration value="VoucherDateOf"/>
+ <xsd:enumeration value="WageEffective"/>
+ <xsd:enumeration value="WagesEarned"/>
+ <xsd:enumeration value="WagePeriodEndDate"/>
+ <xsd:enumeration value="WagePeriodStartDate"/>
+ <xsd:enumeration value="WaitingTime"/>
+ <xsd:enumeration value="WarrantyExpiration"/>
+ <xsd:enumeration value="Waybill"/>
+ <xsd:enumeration value="WeekEnding"/>
+ <xsd:enumeration value="Weighed"/>
+ <xsd:enumeration value="WellLogRun"/>
+ <xsd:enumeration value="WholesaleContractEffective"/>
+ <xsd:enumeration value="WholesaleContractExpiration"/>
+ <xsd:enumeration value="WillAdviseAsOf"/>
+ <xsd:enumeration value="WithdrawnDate"/>
+ <xsd:enumeration value="WithheldDate"/>
+ <xsd:enumeration value="WorkEffectiveStartDate"/>
+ <xsd:enumeration value="WorkingPeriodEndDate"/>
+ <xsd:enumeration value="WorkingPeriodStartDate"/>
+ <xsd:enumeration value="WorkPeriod"/>
+ <xsd:enumeration value="WorksCompletionDateTimeActual"/>
+ <xsd:enumeration value="WorksCompletionDateTimePlanned"/>
+ <xsd:enumeration value="WorstTimeToCall"/>
+ <xsd:enumeration value="YearBeginning"/>
+ <xsd:enumeration value="YearDue"/>
+ <xsd:enumeration value="YearEnding"/>
+ <xsd:enumeration value="YearOfOccurrence"/>
+ <xsd:enumeration value="YearToDate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderParty">
+ <xsd:sequence>
+ <xsd:element name="BuyerParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="BuyerTaxInformation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartyTaxInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SellerParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SellerTaxInformation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartyTaxInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShipToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="BillToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="RemitToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShipFromParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="WarehouseParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SoldToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ManufacturingToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="MaterialIssuer">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfPartyCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderParty" type="OrderParty"/>
+ <xsd:complexType name="Party">
+ <xsd:sequence>
+ <xsd:element name="PartyID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfIdentifier"/>
+ <xsd:element minOccurs="0" name="MDFBusiness" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" ref="NameAddress"/>
+ <xsd:element minOccurs="0" name="OrderContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ReceivingContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShippingContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OtherContacts">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfContact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CorrespondenceLanguage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Language"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Party" type="Party"/>
+ <xsd:complexType name="ListOfIdentifier">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfIdentifier" type="ListOfIdentifier"/>
+ <xsd:complexType name="Contact">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ContactID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ContactName" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ContactFunction"/>
+ <xsd:element minOccurs="0" name="ContactDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfContactNumber"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Contact" type="Contact"/>
+ <xsd:complexType name="ContactFunction">
+ <xsd:sequence>
+ <xsd:element name="ContactFunctionCoded" type="ContactFunctionCode"/>
+ <xsd:element minOccurs="0" name="ContactFunctionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContactFunction" type="ContactFunction"/>
+ <xsd:simpleType name="ContactFunctionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptingContact"/>
+ <xsd:enumeration value="AcceptingOfficial"/>
+ <xsd:enumeration value="Accountingcontact"/>
+ <xsd:enumeration value="AccountsPayableContact"/>
+ <xsd:enumeration value="AccountsReceivableContact"/>
+ <xsd:enumeration value="AdditionalInsuranceInformationContact"/>
+ <xsd:enumeration value="AdministrativeContractingOfficer"/>
+ <xsd:enumeration value="Administrator"/>
+ <xsd:enumeration value="Advisor"/>
+ <xsd:enumeration value="After-HoursContact"/>
+ <xsd:enumeration value="Agent"/>
+ <xsd:enumeration value="AlternateContact"/>
+ <xsd:enumeration value="Applicant"/>
+ <xsd:enumeration value="AppointmentScheduler"/>
+ <xsd:enumeration value="Appraiser"/>
+ <xsd:enumeration value="Attention-ToParty"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AuditingContact"/>
+ <xsd:enumeration value="AuthorizedFinancialContact"/>
+ <xsd:enumeration value="AuthorizedNegotiator"/>
+ <xsd:enumeration value="AuthorizedRepresentative"/>
+ <xsd:enumeration value="AuthorizedSignature"/>
+ <xsd:enumeration value="AutomatedClearinghouseContact"/>
+ <xsd:enumeration value="BankingContact"/>
+ <xsd:enumeration value="BillInquiryContact"/>
+ <xsd:enumeration value="BoardStaff"/>
+ <xsd:enumeration value="Broker"/>
+ <xsd:enumeration value="BrokerContact"/>
+ <xsd:enumeration value="BusinessUnitManager"/>
+ <xsd:enumeration value="BuyerNameorDepartment"/>
+ <xsd:enumeration value="CADAndCAMSpecialist"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CaseManager"/>
+ <xsd:enumeration value="CertificationContact"/>
+ <xsd:enumeration value="Certifier"/>
+ <xsd:enumeration value="ChairmanOfTheBoard"/>
+ <xsd:enumeration value="ChangedBy"/>
+ <xsd:enumeration value="ChangeOrderApprover"/>
+ <xsd:enumeration value="ChiefExecutiveOfficer"/>
+ <xsd:enumeration value="ChiefFinancialOfficer"/>
+ <xsd:enumeration value="ChiefInformationOfficer"/>
+ <xsd:enumeration value="ChiefOperatingOfficer"/>
+ <xsd:enumeration value="CityWorksAuthorityContact"/>
+ <xsd:enumeration value="Claimant"/>
+ <xsd:enumeration value="ClaimApprover"/>
+ <xsd:enumeration value="ClaimRecipient"/>
+ <xsd:enumeration value="ClaimsContact"/>
+ <xsd:enumeration value="ClearinghouseContact"/>
+ <xsd:enumeration value="ClerkOfCourt"/>
+ <xsd:enumeration value="Co-Borrower"/>
+ <xsd:enumeration value="Co-Investigator"/>
+ <xsd:enumeration value="Collector"/>
+ <xsd:enumeration value="CollegeofEducationAdmissionsOffice"/>
+ <xsd:enumeration value="ComplianceOfficer"/>
+ <xsd:enumeration value="ComponentEngineer"/>
+ <xsd:enumeration value="ComputerSystemsContact"/>
+ <xsd:enumeration value="ConcurrentEmployerContact"/>
+ <xsd:enumeration value="ConfirmedWith"/>
+ <xsd:enumeration value="Consignee"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="ContainerManager"/>
+ <xsd:enumeration value="ContractContact"/>
+ <xsd:enumeration value="CoordinationContact"/>
+ <xsd:enumeration value="Coordinator"/>
+ <xsd:enumeration value="CorporatePurchasingAgent"/>
+ <xsd:enumeration value="CostAndScheduleCoordinator"/>
+ <xsd:enumeration value="CustomerContactGrantingAppointment"/>
+ <xsd:enumeration value="CustomerEngineer"/>
+ <xsd:enumeration value="CustomerMaintenanceManager"/>
+ <xsd:enumeration value="CustomerRelations"/>
+ <xsd:enumeration value="DangerousGoodsContact"/>
+ <xsd:enumeration value="DeliveryContact"/>
+ <xsd:enumeration value="DeliveryInstructionsContact"/>
+ <xsd:enumeration value="DentalSchoolAdmissionsOffice"/>
+ <xsd:enumeration value="DepartmentOrEmployeeToExecuteExportProcedures"/>
+ <xsd:enumeration value="DepartmentOrEmployeeToExecuteImportProcedures"/>
+ <xsd:enumeration value="DepartmentOrPersonResponsibleForProcessingPurchaseOrder"/>
+ <xsd:enumeration value="DesignEngineer"/>
+ <xsd:enumeration value="Development"/>
+ <xsd:enumeration value="Director"/>
+ <xsd:enumeration value="DirectoryAdvertisingContact"/>
+ <xsd:enumeration value="DivisionDirector"/>
+ <xsd:enumeration value="DivisionManager"/>
+ <xsd:enumeration value="EDICoordinator"/>
+ <xsd:enumeration value="EducationCoordinator"/>
+ <xsd:enumeration value="ElectricitySupplyContact"/>
+ <xsd:enumeration value="ElectronicDataInterchangeCoordinator"/>
+ <xsd:enumeration value="ElectronicSubmissionRecipient"/>
+ <xsd:enumeration value="EmergencyContact"/>
+ <xsd:enumeration value="EmergencyContact-Consignee"/>
+ <xsd:enumeration value="EmergencyContact-MilitaryTrafficManagementCommand"/>
+ <xsd:enumeration value="EmergencyContact-Shipper"/>
+ <xsd:enumeration value="EmergencyDangerousGoodsContact"/>
+ <xsd:enumeration value="EmployerContact"/>
+ <xsd:enumeration value="Engineer"/>
+ <xsd:enumeration value="EngineeringContact"/>
+ <xsd:enumeration value="EnteredBy"/>
+ <xsd:enumeration value="Estimator"/>
+ <xsd:enumeration value="EveningProgramsOffice"/>
+ <xsd:enumeration value="ExecutiveOfficer"/>
+ <xsd:enumeration value="ExecutiveVice-President"/>
+ <xsd:enumeration value="Expeditor"/>
+ <xsd:enumeration value="FinancialAidOffice"/>
+ <xsd:enumeration value="ForeclosingLenderAdministrativeContact"/>
+ <xsd:enumeration value="ForwarderContact"/>
+ <xsd:enumeration value="FunctionalManager"/>
+ <xsd:enumeration value="GasSupplyContact"/>
+ <xsd:enumeration value="GeneralContact"/>
+ <xsd:enumeration value="GoodsReceivingContact"/>
+ <xsd:enumeration value="GraduateAdmissionsOffice"/>
+ <xsd:enumeration value="GraduateBusinessOffice"/>
+ <xsd:enumeration value="GraduateEngineeringOffice"/>
+ <xsd:enumeration value="GraduateFineArtsOffice"/>
+ <xsd:enumeration value="GuidanceCounselor"/>
+ <xsd:enumeration value="HazardousMaterialContact"/>
+ <xsd:enumeration value="HeadOfUnitForInformationDissemination"/>
+ <xsd:enumeration value="HeadOfUnitForInformationProduction"/>
+ <xsd:enumeration value="HeadOfUnitOrComputerDataProcessing"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationContact"/>
+ <xsd:enumeration value="HumanResources"/>
+ <xsd:enumeration value="InformationContact"/>
+ <xsd:enumeration value="InsuranceContact"/>
+ <xsd:enumeration value="InsuredParty"/>
+ <xsd:enumeration value="InsurerContact"/>
+ <xsd:enumeration value="Interviewer"/>
+ <xsd:enumeration value="Investigator"/>
+ <xsd:enumeration value="InvestmentContact"/>
+ <xsd:enumeration value="IssuingOfficer"/>
+ <xsd:enumeration value="JointWorkAgent"/>
+ <xsd:enumeration value="LaboratoryContact"/>
+ <xsd:enumeration value="LandregistryContact"/>
+ <xsd:enumeration value="LawFirm"/>
+ <xsd:enumeration value="LawSchoolAdmissionsOffice"/>
+ <xsd:enumeration value="LegalAuditingContact"/>
+ <xsd:enumeration value="Licensee"/>
+ <xsd:enumeration value="LocalPurchasingAgent"/>
+ <xsd:enumeration value="MaintenanceContact"/>
+ <xsd:enumeration value="Manager"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="ManufacturingPlantContact"/>
+ <xsd:enumeration value="MarketingDepartment"/>
+ <xsd:enumeration value="MarketingDirector"/>
+ <xsd:enumeration value="MaterialControlContact"/>
+ <xsd:enumeration value="MaterialDispositionContact"/>
+ <xsd:enumeration value="MaterialHandlingContact"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetContact"/>
+ <xsd:enumeration value="Mayor"/>
+ <xsd:enumeration value="MedicalAdmissionsOffice"/>
+ <xsd:enumeration value="MedicalContact"/>
+ <xsd:enumeration value="MessageRecipientContact"/>
+ <xsd:enumeration value="MessageSenderContact"/>
+ <xsd:enumeration value="MultipleListingServiceStaff"/>
+ <xsd:enumeration value="MultipleListingServiceVendor"/>
+ <xsd:enumeration value="NationalAgent"/>
+ <xsd:enumeration value="NewBusinessProcessing"/>
+ <xsd:enumeration value="NewDevelopmentsContact"/>
+ <xsd:enumeration value="NotaryPublic"/>
+ <xsd:enumeration value="NotificationContact"/>
+ <xsd:enumeration value="NumericalControlEngineer"/>
+ <xsd:enumeration value="OfficeManager"/>
+ <xsd:enumeration value="OfficeStaff"/>
+ <xsd:enumeration value="Operations"/>
+ <xsd:enumeration value="OrderContact"/>
+ <xsd:enumeration value="OrderDepartment"/>
+ <xsd:enumeration value="OrderingOfficer"/>
+ <xsd:enumeration value="OtherAdult"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnerRepresentative"/>
+ <xsd:enumeration value="Packager"/>
+ <xsd:enumeration value="ParentorGuardian"/>
+ <xsd:enumeration value="ParticipatingLaboratoryContact"/>
+ <xsd:enumeration value="Partner"/>
+ <xsd:enumeration value="Patient"/>
+ <xsd:enumeration value="PayeeContact"/>
+ <xsd:enumeration value="PayersClaimOffice"/>
+ <xsd:enumeration value="PerformanceEvaluationCommittee"/>
+ <xsd:enumeration value="PersonnelContact"/>
+ <xsd:enumeration value="Physician"/>
+ <xsd:enumeration value="PlaceOfCollectionContact"/>
+ <xsd:enumeration value="PlaceOfDeliveryContact"/>
+ <xsd:enumeration value="PlantManager"/>
+ <xsd:enumeration value="PlantOrEquipmentContact"/>
+ <xsd:enumeration value="PlatformMaintenanceManager"/>
+ <xsd:enumeration value="PortEngineer"/>
+ <xsd:enumeration value="PreawardSurveyManager"/>
+ <xsd:enumeration value="PreferredProviderOrganizationContact"/>
+ <xsd:enumeration value="Preparer"/>
+ <xsd:enumeration value="President"/>
+ <xsd:enumeration value="PriceAdministration"/>
+ <xsd:enumeration value="PrimaryContact"/>
+ <xsd:enumeration value="PrimaryControlPoint"/>
+ <xsd:enumeration value="PrimaryTaxpayer"/>
+ <xsd:enumeration value="PrincipalStudyContactorAuthor"/>
+ <xsd:enumeration value="ProbationorLegalOfficer"/>
+ <xsd:enumeration value="ProcessEngineer"/>
+ <xsd:enumeration value="Processor"/>
+ <xsd:enumeration value="ProductionRepresentative"/>
+ <xsd:enumeration value="ProductManagementContact"/>
+ <xsd:enumeration value="ProgramDirector"/>
+ <xsd:enumeration value="ProgramManager"/>
+ <xsd:enumeration value="ProjectDirector"/>
+ <xsd:enumeration value="ProjectManagementContact"/>
+ <xsd:enumeration value="ProjectManager"/>
+ <xsd:enumeration value="PrototypeCoordinator"/>
+ <xsd:enumeration value="Provider"/>
+ <xsd:enumeration value="PublicRelationsContact"/>
+ <xsd:enumeration value="PurchaseServiceProvider"/>
+ <xsd:enumeration value="PurchasingContact"/>
+ <xsd:enumeration value="PurchasingContractingOfficer"/>
+ <xsd:enumeration value="QualityAssuranceContact"/>
+ <xsd:enumeration value="QualityCoordinatorContact"/>
+ <xsd:enumeration value="QualityInspector"/>
+ <xsd:enumeration value="QualityManager"/>
+ <xsd:enumeration value="QuantitySurveyorContact"/>
+ <xsd:enumeration value="QuotingParty"/>
+ <xsd:enumeration value="RateSupervisorOrClerk"/>
+ <xsd:enumeration value="RealEstatePropertyKeyHolder"/>
+ <xsd:enumeration value="RealEstatePropertyOccupant"/>
+ <xsd:enumeration value="RebateOrChargebackContact"/>
+ <xsd:enumeration value="ReceivingContact"/>
+ <xsd:enumeration value="ReceivingDockContact"/>
+ <xsd:enumeration value="Registrar"/>
+ <xsd:enumeration value="RentalCompanyAdministrativeContact"/>
+ <xsd:enumeration value="ReportAuthorizer"/>
+ <xsd:enumeration value="ReportPreparer"/>
+ <xsd:enumeration value="Requestor"/>
+ <xsd:enumeration value="Respondant"/>
+ <xsd:enumeration value="ResponsiblePerson"/>
+ <xsd:enumeration value="ResponsiblePersonForComputerDataProcessing"/>
+ <xsd:enumeration value="ResponsiblePersonforInformationDissemination"/>
+ <xsd:enumeration value="ResponsiblePersonForInformationProduction"/>
+ <xsd:enumeration value="ReviewAndRepricingContact"/>
+ <xsd:enumeration value="SalesAdministration"/>
+ <xsd:enumeration value="SalesRepresentativeOrDepartment"/>
+ <xsd:enumeration value="ScheduleContact"/>
+ <xsd:enumeration value="SchoolClerk"/>
+ <xsd:enumeration value="SchoolofTheologyAdmissionsOffice"/>
+ <xsd:enumeration value="SchoolofVeterinaryMedicineAdmissionsOffice"/>
+ <xsd:enumeration value="SchoolPrincipal"/>
+ <xsd:enumeration value="SecondaryTaxpayer"/>
+ <xsd:enumeration value="Secretary"/>
+ <xsd:enumeration value="ServiceContact"/>
+ <xsd:enumeration value="ServiceManager"/>
+ <xsd:enumeration value="ServiceOrderWriter"/>
+ <xsd:enumeration value="ServiceOrganization"/>
+ <xsd:enumeration value="ServiceTeam"/>
+ <xsd:enumeration value="ServiceTechnician"/>
+ <xsd:enumeration value="ShipperContact"/>
+ <xsd:enumeration value="ShippingContact"/>
+ <xsd:enumeration value="SocialServicesWorker"/>
+ <xsd:enumeration value="SoftwareHouseContact"/>
+ <xsd:enumeration value="SpecialProgramContact"/>
+ <xsd:enumeration value="Spouse"/>
+ <xsd:enumeration value="Staff"/>
+ <xsd:enumeration value="Student"/>
+ <xsd:enumeration value="StudentinAbsentia"/>
+ <xsd:enumeration value="StudySubmitterContact"/>
+ <xsd:enumeration value="SubmittingContact"/>
+ <xsd:enumeration value="Supervisor"/>
+ <xsd:enumeration value="SupplierContact"/>
+ <xsd:enumeration value="SystemsAdministrator"/>
+ <xsd:enumeration value="TechnicalContact"/>
+ <xsd:enumeration value="TechnicalDepartment"/>
+ <xsd:enumeration value="TechnicalDocumentationRecipient"/>
+ <xsd:enumeration value="TechnicalMarketingRepresentative"/>
+ <xsd:enumeration value="TechnicalWriter"/>
+ <xsd:enumeration value="TelecommunicationsNetworkContact"/>
+ <xsd:enumeration value="TelephoneAnsweringServiceContact"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="TenderDeveloper"/>
+ <xsd:enumeration value="TestContact"/>
+ <xsd:enumeration value="Third-PartyAdministratorContact"/>
+ <xsd:enumeration value="TownPlanningContact"/>
+ <xsd:enumeration value="TrafficAdministrator"/>
+ <xsd:enumeration value="TrafficAuthorityContact"/>
+ <xsd:enumeration value="Transmitter"/>
+ <xsd:enumeration value="TransportContact"/>
+ <xsd:enumeration value="TransportInfrastructureAuthority"/>
+ <xsd:enumeration value="Treasurer"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateReceiver"/>
+ <xsd:enumeration value="UndergraduateAdmissionsOffice"/>
+ <xsd:enumeration value="Underwriter"/>
+ <xsd:enumeration value="UnionPresident"/>
+ <xsd:enumeration value="VicePresident"/>
+ <xsd:enumeration value="WaiverContact"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WaterSupplyContact"/>
+ <xsd:enumeration value="Witness"/>
+ <xsd:enumeration value="WorkBrokerMaintenanceManager"/>
+ <xsd:enumeration value="WorkshopContact"/>
+ <xsd:enumeration value="WorksManagementContact"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfContactNumber">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ContactNumber"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContactNumber" type="ListOfContactNumber"/>
+ <xsd:complexType name="ContactNumber">
+ <xsd:sequence>
+ <xsd:element name="ContactNumberValue" type="xsd:string"/>
+ <xsd:element name="ContactNumberTypeCoded" type="ContactNumberTypeCode"/>
+ <xsd:element minOccurs="0" name="ContactNumberTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContactNumber" type="ContactNumber"/>
+ <xsd:simpleType name="ContactNumberTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="TelephoneNumber"/>
+ <xsd:enumeration value="FaxNumber"/>
+ <xsd:enumeration value="EmailAddress"/>
+ <xsd:enumeration value="MobileNumber"/>
+ <xsd:enumeration value="TelexNumber"/>
+ <xsd:enumeration value="PagerNumber"/>
+ <xsd:enumeration value="HomePage"/>
+ <xsd:enumeration value="WWW"/>
+ <xsd:enumeration value="FTP"/>
+ <xsd:enumeration value="URLOther"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfContact">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContact" type="ListOfContact"/>
+ <xsd:complexType name="PartyTaxInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="TaxIdentifier">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="RegisteredName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RegisteredOffice" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="TaxLocation"/>
+ <xsd:element minOccurs="0" name="CompanyRegistrationNumber" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PartyTaxInformation" type="PartyTaxInformation"/>
+ <xsd:complexType name="ListOfPartyCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PartyCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPartyCoded" type="ListOfPartyCoded"/>
+ <xsd:complexType name="PartyCoded">
+ <xsd:complexContent>
+ <xsd:extension base="Party">
+ <xsd:sequence>
+ <xsd:element name="PartyRoleCoded" type="PartyRoleCode"/>
+ <xsd:element minOccurs="0" name="PartyRoleCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="PartyCoded" type="PartyCoded"/>
+ <xsd:complexType name="ListOfTransport">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Transport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfTransport" type="ListOfTransport"/>
+ <xsd:complexType name="Transport">
+ <xsd:sequence>
+ <xsd:element name="TransportID" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="TransportMode"/>
+ <xsd:element minOccurs="0" ref="TransportMeans"/>
+ <xsd:element minOccurs="0" name="CarrierName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CarrierID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CustShippingContractNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ServiceLevelCoded" type="ServiceLevelCode"/>
+ <xsd:element minOccurs="0" name="ServiceLevelCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ShippingInstructions" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportLegCoded" type="TransportLegCode"/>
+ <xsd:element minOccurs="0" name="TransportLegCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfTransportEquipment"/>
+ <xsd:element minOccurs="0" ref="TransitDirection"/>
+ <xsd:element minOccurs="0" name="TransportNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Transport" type="Transport"/>
+ <xsd:complexType name="TransportMode">
+ <xsd:sequence>
+ <xsd:element name="TransportModeCoded" type="TransportModeCode"/>
+ <xsd:element minOccurs="0" name="TransportModeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportMode" type="TransportMode"/>
+ <xsd:simpleType name="TransportModeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Air"/>
+ <xsd:enumeration value="AirCharter"/>
+ <xsd:enumeration value="AirExpress"/>
+ <xsd:enumeration value="AirFreight"/>
+ <xsd:enumeration value="AirFrieghtForwarder"/>
+ <xsd:enumeration value="AirTaxi"/>
+ <xsd:enumeration value="AirTransport"/>
+ <xsd:enumeration value="ArmedForcesCourierService"/>
+ <xsd:enumeration value="Backhaul"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BestWay-ShippersOption"/>
+ <xsd:enumeration value="BookPostal"/>
+ <xsd:enumeration value="Bus"/>
+ <xsd:enumeration value="CabOrTaxi"/>
+ <xsd:enumeration value="CommonIrregularCarrier"/>
+ <xsd:enumeration value="Consolidation"/>
+ <xsd:enumeration value="ContainerizedOcean"/>
+ <xsd:enumeration value="ContractCarrier"/>
+ <xsd:enumeration value="ConventionalOcean"/>
+ <xsd:enumeration value="CustomerPickup"/>
+ <xsd:enumeration value="CustomerPickupOrCustomersExpense"/>
+ <xsd:enumeration value="Driveaway"/>
+ <xsd:enumeration value="DriveawayService"/>
+ <xsd:enumeration value="EuropeanOrPacificDistributionSystem"/>
+ <xsd:enumeration value="ExpeditedTruck"/>
+ <xsd:enumeration value="FixedTransportInstallation"/>
+ <xsd:enumeration value="Flyaway"/>
+ <xsd:enumeration value="GeographicReceiving"/>
+ <xsd:enumeration value="GeographicReceivingOrShipping"/>
+ <xsd:enumeration value="GeographicShipping"/>
+ <xsd:enumeration value="InlandWaterTransport"/>
+ <xsd:enumeration value="InlandWaterway"/>
+ <xsd:enumeration value="Intermodal-Piggyback"/>
+ <xsd:enumeration value="LessThanTrailerLoad"/>
+ <xsd:enumeration value="Logair"/>
+ <xsd:enumeration value="Mail"/>
+ <xsd:enumeration value="MaritimeTransport"/>
+ <xsd:enumeration value="MilitaryIntratheaterAirliftService"/>
+ <xsd:enumeration value="MilitaryOfficialMail"/>
+ <xsd:enumeration value="ModeUnknown"/>
+ <xsd:enumeration value="Motor"/>
+ <xsd:enumeration value="Motor-BulkCarrier"/>
+ <xsd:enumeration value="Motor-CommonCarrier"/>
+ <xsd:enumeration value="Motor-Flatbed"/>
+ <xsd:enumeration value="Motor-PackageCarrier"/>
+ <xsd:enumeration value="Motor-Van"/>
+ <xsd:enumeration value="MutimodalTransport"/>
+ <xsd:enumeration value="Ocean"/>
+ <xsd:enumeration value="OceanConferenceCarrier"/>
+ <xsd:enumeration value="OceanNon-ConferenceCarrier"/>
+ <xsd:enumeration value="ParcelPost"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PooledAir"/>
+ <xsd:enumeration value="PooledPiggyback"/>
+ <xsd:enumeration value="PooledRail"/>
+ <xsd:enumeration value="PooledTruck"/>
+ <xsd:enumeration value="PoolToPool"/>
+ <xsd:enumeration value="PrivateCarrier"/>
+ <xsd:enumeration value="PrivateParcelService"/>
+ <xsd:enumeration value="PrivateVessel"/>
+ <xsd:enumeration value="Quicktrans"/>
+ <xsd:enumeration value="Rail"/>
+ <xsd:enumeration value="RailTransport"/>
+ <xsd:enumeration value="Roadrailer"/>
+ <xsd:enumeration value="RoadTransport"/>
+ <xsd:enumeration value="SeaOrAir"/>
+ <xsd:enumeration value="ShipperAgent"/>
+ <xsd:enumeration value="ShipperAgent-Truck"/>
+ <xsd:enumeration value="ShipperAssociation"/>
+ <xsd:enumeration value="StackTrain"/>
+ <xsd:enumeration value="Steamship"/>
+ <xsd:enumeration value="SupplierTruck"/>
+ <xsd:enumeration value="TowawayService"/>
+ <xsd:enumeration value="Vessel"/>
+ <xsd:enumeration value="WaterOrPipelineIntermodalMovement"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TransportMeans">
+ <xsd:sequence>
+ <xsd:element name="TransportMeansCoded" type="TransportMeansCode"/>
+ <xsd:element minOccurs="0" name="TransportMeansCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportMeans" type="TransportMeans"/>
+ <xsd:simpleType name="TransportMeansCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="20FtILContainer-ClosedTop"/>
+ <xsd:enumeration value="20FtILContainer-OpenTop"/>
+ <xsd:enumeration value="40FtILContainer-OpenTop"/>
+ <xsd:enumeration value="40FtILContainer-ClosedTop"/>
+ <xsd:enumeration value="Aircraft"/>
+ <xsd:enumeration value="AirFreight-BreakBulk"/>
+ <xsd:enumeration value="AirRideVan"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BargeChemicalTanker"/>
+ <xsd:enumeration value="BargeOpen"/>
+ <xsd:enumeration value="BilevelRailcarFullyEnclosed"/>
+ <xsd:enumeration value="BilevelRailcarFullyOpen"/>
+ <xsd:enumeration value="BilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="BilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Bogie"/>
+ <xsd:enumeration value="Boxcar"/>
+ <xsd:enumeration value="BoxcarCushionUnderFrameOF"/>
+ <xsd:enumeration value="Boxcar-DamageFreeEquipped"/>
+ <xsd:enumeration value="Boxcar-Insulated"/>
+ <xsd:enumeration value="Boxcar-InteriorBulkheads"/>
+ <xsd:enumeration value="Bulktruck"/>
+ <xsd:enumeration value="BulkTruckAndBulkTrailer"/>
+ <xsd:enumeration value="BulkTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="BulkTruckAndExtendableTrailer"/>
+ <xsd:enumeration value="BulkTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="BulkTruckAndTankTrailer"/>
+ <xsd:enumeration value="BulkTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Bus"/>
+ <xsd:enumeration value="Caboose"/>
+ <xsd:enumeration value="Car"/>
+ <xsd:enumeration value="CarCarrier"/>
+ <xsd:enumeration value="CargoAndPassengerVessel"/>
+ <xsd:enumeration value="CarWithCaravan"/>
+ <xsd:enumeration value="CementVessel"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="Chassis-Gooseneck"/>
+ <xsd:enumeration value="ClosedContainer"/>
+ <xsd:enumeration value="ClosedContainer-ControlledTemperature"/>
+ <xsd:enumeration value="ClosedVan"/>
+ <xsd:enumeration value="CoalVessel"/>
+ <xsd:enumeration value="CoasterChemicalTanker"/>
+ <xsd:enumeration value="Coil-CarCovered"/>
+ <xsd:enumeration value="CoilCarOpen"/>
+ <xsd:enumeration value="Container"/>
+ <xsd:enumeration value="Container-Aluminum"/>
+ <xsd:enumeration value="Container-Bulk"/>
+ <xsd:enumeration value="Container-ClosedTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-HighSideOpenTop"/>
+ <xsd:enumeration value="Container-Insulated"/>
+ <xsd:enumeration value="Container-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-LowSideOpenTop"/>
+ <xsd:enumeration value="ContainerOnlyVessel"/>
+ <xsd:enumeration value="Container-Open-Sided"/>
+ <xsd:enumeration value="Container-OpenTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-Platform"/>
+ <xsd:enumeration value="ContainerrestingonaChassis"/>
+ <xsd:enumeration value="ContainerShip"/>
+ <xsd:enumeration value="Container-Steel"/>
+ <xsd:enumeration value="Container-Tank"/>
+ <xsd:enumeration value="Container-TankChemicals"/>
+ <xsd:enumeration value="Container-TankFoodGrade-Liquid"/>
+ <xsd:enumeration value="Container-TankGas"/>
+ <xsd:enumeration value="Container-Upgraded"/>
+ <xsd:enumeration value="Container-Vented"/>
+ <xsd:enumeration value="ContainerwithBagHangers"/>
+ <xsd:enumeration value="ContainerwithFloorSecuringRings"/>
+ <xsd:enumeration value="ContainerwithFlushDoors"/>
+ <xsd:enumeration value="ContainerwithHangarBars"/>
+ <xsd:enumeration value="ContainerWithSmoothSides"/>
+ <xsd:enumeration value="ContainerWithWavyOrRippleSides"/>
+ <xsd:enumeration value="ControlledTemperatureTrailer"/>
+ <xsd:enumeration value="ControlUnit"/>
+ <xsd:enumeration value="CoveredBarge"/>
+ <xsd:enumeration value="CrudeOilTanker"/>
+ <xsd:enumeration value="CustomerDeterminedDeansOfTransport"/>
+ <xsd:enumeration value="CustomerRailTanker"/>
+ <xsd:enumeration value="Cut-InHelper"/>
+ <xsd:enumeration value="DeepSeaChemicalTanker"/>
+ <xsd:enumeration value="Double-DropTrailer"/>
+ <xsd:enumeration value="DropBackTrailer"/>
+ <xsd:enumeration value="DryBulkCarrier"/>
+ <xsd:enumeration value="EndofTrainDevice"/>
+ <xsd:enumeration value="ExceptionalTransport"/>
+ <xsd:enumeration value="Ferry"/>
+ <xsd:enumeration value="FishingVessel"/>
+ <xsd:enumeration value="Fixed-RackDoubleDropTrailer"/>
+ <xsd:enumeration value="FixedRack-FlatBedTrailer"/>
+ <xsd:enumeration value="FixedRack-SingleDropTrailer"/>
+ <xsd:enumeration value="FlatbedSlidingTandem"/>
+ <xsd:enumeration value="FlatBedTrailer"/>
+ <xsd:enumeration value="FlatBedTrailer-RemovableSides"/>
+ <xsd:enumeration value="FlatBedTrailerwithHeadboards"/>
+ <xsd:enumeration value="FlatBedTrailerwithNoHeadboards"/>
+ <xsd:enumeration value="FlatCar"/>
+ <xsd:enumeration value="FlatCar-EndBulkheads"/>
+ <xsd:enumeration value="FlatcarWithPedestal"/>
+ <xsd:enumeration value="FreezerTruck"/>
+ <xsd:enumeration value="FreezerTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="FreezerTruckAndRefrigeratedTrailer"/>
+ <xsd:enumeration value="FreezerTruckAndTrailer"/>
+ <xsd:enumeration value="FreezerVan"/>
+ <xsd:enumeration value="FrozenFoodTrailer"/>
+ <xsd:enumeration value="FurnitureTruck"/>
+ <xsd:enumeration value="GasTanker"/>
+ <xsd:enumeration value="GeneralCargoVessel"/>
+ <xsd:enumeration value="GeneratorSet"/>
+ <xsd:enumeration value="GondolaCar-CoveredInteriorBulkheads"/>
+ <xsd:enumeration value="GondolaCar-Open"/>
+ <xsd:enumeration value="GondolaCovered"/>
+ <xsd:enumeration value="Graincarrier"/>
+ <xsd:enumeration value="GravelVessel"/>
+ <xsd:enumeration value="HalfHeightFlatRack"/>
+ <xsd:enumeration value="Head-EndHelperUnit"/>
+ <xsd:enumeration value="HeadofTrainDevice"/>
+ <xsd:enumeration value="HighCubeVan"/>
+ <xsd:enumeration value="HopperCar-Covered"/>
+ <xsd:enumeration value="HopperCar-CoveredPneumaticDischarge"/>
+ <xsd:enumeration value="HopperCar-Open"/>
+ <xsd:enumeration value="HydrantCart"/>
+ <xsd:enumeration value="IdlerCar"/>
+ <xsd:enumeration value="IsothermicTruck"/>
+ <xsd:enumeration value="IsothermicTruckAndFreezerTrailer"/>
+ <xsd:enumeration value="IsothermicTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="Isothermictruckandrefrigeratedtrailer"/>
+ <xsd:enumeration value="IsothermicVan"/>
+ <xsd:enumeration value="LiquefiedNaturalGasCarrier"/>
+ <xsd:enumeration value="LiquefiedPetroleumGasCarrier"/>
+ <xsd:enumeration value="LoadOrUnloadDeviceOnEquipment"/>
+ <xsd:enumeration value="Locomotive"/>
+ <xsd:enumeration value="OceanVessel"/>
+ <xsd:enumeration value="OilProductsTanker"/>
+ <xsd:enumeration value="Open-TopOrFlatBedTrailer"/>
+ <xsd:enumeration value="OpenTopVan"/>
+ <xsd:enumeration value="OreCarrier"/>
+ <xsd:enumeration value="PassengerVessel"/>
+ <xsd:enumeration value="PatrolVessel"/>
+ <xsd:enumeration value="Pick-UpTruck"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PowerPack"/>
+ <xsd:enumeration value="ProtectedTrailer"/>
+ <xsd:enumeration value="RailBulkCar"/>
+ <xsd:enumeration value="RailCar"/>
+ <xsd:enumeration value="RailExpress"/>
+ <xsd:enumeration value="RailroadMaintenanceOfWayCar"/>
+ <xsd:enumeration value="RailSiloTanker"/>
+ <xsd:enumeration value="RailTanker"/>
+ <xsd:enumeration value="Rear-EndHelperUnit"/>
+ <xsd:enumeration value="RefrigeratedCar"/>
+ <xsd:enumeration value="RefrigeratedContainer"/>
+ <xsd:enumeration value="RefrigeratedTruck"/>
+ <xsd:enumeration value="RefrigeratedTruckAndFreezerTrailer"/>
+ <xsd:enumeration value="RefrigeratedTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="RefrigeratedTruckAndTrailer"/>
+ <xsd:enumeration value="RefrigeratedVan"/>
+ <xsd:enumeration value="RemovableSideTrailer"/>
+ <xsd:enumeration value="RemovalTruckAndTrailer"/>
+ <xsd:enumeration value="RigidTruckWithTank"/>
+ <xsd:enumeration value="RigidTruckWithTankAndBulkTrailer"/>
+ <xsd:enumeration value="RigidTruckWithTankAndTankTrailer"/>
+ <xsd:enumeration value="RoadRailer"/>
+ <xsd:enumeration value="RoadSiloTanker"/>
+ <xsd:enumeration value="RoadTanker"/>
+ <xsd:enumeration value="RollOn-RollOffVessel"/>
+ <xsd:enumeration value="Saddle"/>
+ <xsd:enumeration value="SellerDeterminedMeansOfTransport"/>
+ <xsd:enumeration value="ServiceCar"/>
+ <xsd:enumeration value="Ship"/>
+ <xsd:enumeration value="ShipTanker"/>
+ <xsd:enumeration value="Single-DropTrailer"/>
+ <xsd:enumeration value="StackCar"/>
+ <xsd:enumeration value="STAK-RAK"/>
+ <xsd:enumeration value="SteelProductsVessel"/>
+ <xsd:enumeration value="TankCar"/>
+ <xsd:enumeration value="Tautliner25TonneWith90CubicMeterTrailer"/>
+ <xsd:enumeration value="TautlinerTruck"/>
+ <xsd:enumeration value="TautlinerTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndExtendableTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndRemovalTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoof"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndExtendableTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndRemovalTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofandTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Taxi"/>
+ <xsd:enumeration value="TelescopingTrailer"/>
+ <xsd:enumeration value="TimberOrLogCarrier"/>
+ <xsd:enumeration value="Tip-UpArticulatedTruck"/>
+ <xsd:enumeration value="Tip-Uptruck"/>
+ <xsd:enumeration value="Tip-UpTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="Tip-UpTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="Tip-UpTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Tractor"/>
+ <xsd:enumeration value="Trailer-Boat"/>
+ <xsd:enumeration value="Trailer-Car"/>
+ <xsd:enumeration value="Trailer-DryFreight"/>
+ <xsd:enumeration value="Trailer-ElectricHeat"/>
+ <xsd:enumeration value="Trailer-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-Insulated"/>
+ <xsd:enumeration value="Trailer-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-NotOtherwiseSpecified"/>
+ <xsd:enumeration value="Trailer-Pneumatic"/>
+ <xsd:enumeration value="Trailer-Refrigerated"/>
+ <xsd:enumeration value="Trailer-Tank-Chemicals"/>
+ <xsd:enumeration value="Trailer-Tank-FoodGradeLiquid"/>
+ <xsd:enumeration value="Trailer-Tank-Gas"/>
+ <xsd:enumeration value="TrainingVessel"/>
+ <xsd:enumeration value="TrainWith20OrMoreWagons"/>
+ <xsd:enumeration value="TrainWithMoreThanOneAndLessThan20Wagons"/>
+ <xsd:enumeration value="TrainWithOneWagon"/>
+ <xsd:enumeration value="TrilevelRailcar20Feet"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-FullyEnclosed"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithDoorsNoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Truck"/>
+ <xsd:enumeration value="TruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Truck-OpenTop"/>
+ <xsd:enumeration value="Truck-OpenTopHighSide"/>
+ <xsd:enumeration value="Truck-OpenTopLowSide"/>
+ <xsd:enumeration value="TruckOrTrailerWithTilt"/>
+ <xsd:enumeration value="Truck-Van"/>
+ <xsd:enumeration value="TruckWithOpeningFloor"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndExtendableTrailer"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndGondolaTrailer"/>
+ <xsd:enumeration value="TugandOrPushboat"/>
+ <xsd:enumeration value="UnitLoadDevice"/>
+ <xsd:enumeration value="Van"/>
+ <xsd:enumeration value="Van-SpecialInsideLengthWidthOrHeightRequirements"/>
+ <xsd:enumeration value="Vessel-Lake"/>
+ <xsd:enumeration value="Vessel-Ocean"/>
+ <xsd:enumeration value="Vessel-Ocean-Containership"/>
+ <xsd:enumeration value="Vessel-Ocean-Lash"/>
+ <xsd:enumeration value="Vessel-Ocean-RollOn-RollOff"/>
+ <xsd:enumeration value="Woodchipcarrier"/>
+ <xsd:enumeration value="WorkVessel"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ServiceLevelCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BulkCommodityTrain"/>
+ <xsd:enumeration value="PremiumSurface"/>
+ <xsd:enumeration value="ThreeDayService"/>
+ <xsd:enumeration value="9AM"/>
+ <xsd:enumeration value="AirCargo"/>
+ <xsd:enumeration value="AirEconomy"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="BusinessClass"/>
+ <xsd:enumeration value="ConsigneeBillingService"/>
+ <xsd:enumeration value="CourierExpress"/>
+ <xsd:enumeration value="Ground"/>
+ <xsd:enumeration value="ExpressService"/>
+ <xsd:enumeration value="DeliveryScheduledNextDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryScheduledSecondDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryScheduledThirdDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryConfirmation"/>
+ <xsd:enumeration value="DeferredService"/>
+ <xsd:enumeration value="DeliveryConfirmationReturn"/>
+ <xsd:enumeration value="DoorService"/>
+ <xsd:enumeration value="DeliveryNotificationOnly"/>
+ <xsd:enumeration value="ExpeditedService"/>
+ <xsd:enumeration value="ProofOfDeliveryWithSignature"/>
+ <xsd:enumeration value="FirstClass"/>
+ <xsd:enumeration value="StandardService"/>
+ <xsd:enumeration value="ExpressServicePlus"/>
+ <xsd:enumeration value="TrackingGround"/>
+ <xsd:enumeration value="Iata"/>
+ <xsd:enumeration value="ExpeditedServiceWorldwide"/>
+ <xsd:enumeration value="ExpressServiceWorldwide"/>
+ <xsd:enumeration value="Metro"/>
+ <xsd:enumeration value="Multiweight"/>
+ <xsd:enumeration value="NextDayAir"/>
+ <xsd:enumeration value="NextFlightOut"/>
+ <xsd:enumeration value="NextDayHundredWeight"/>
+ <xsd:enumeration value="NextMorning"/>
+ <xsd:enumeration value="NotServed"/>
+ <xsd:enumeration value="Overnight"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy1030AM"/>
+ <xsd:enumeration value="PriorityMail"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy930AM"/>
+ <xsd:enumeration value="PriorityMailInsured"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayByNoon"/>
+ <xsd:enumeration value="POBoxZipCode"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy500PM"/>
+ <xsd:enumeration value="PrimaryServiceAreaSecondDayByNoon"/>
+ <xsd:enumeration value="PassengerService"/>
+ <xsd:enumeration value="QualityIntermodalHighSpeed70MilesPerHour"/>
+ <xsd:enumeration value="OtherIntermodalAndStackService"/>
+ <xsd:enumeration value="60MilesPerHourService"/>
+ <xsd:enumeration value="ManifestFreight"/>
+ <xsd:enumeration value="CircusTrain"/>
+ <xsd:enumeration value="WorkTrain"/>
+ <xsd:enumeration value="CommuterService"/>
+ <xsd:enumeration value="AuthorizedReturnService"/>
+ <xsd:enumeration value="SameDay"/>
+ <xsd:enumeration value="SecondDayAir"/>
+ <xsd:enumeration value="Saturday"/>
+ <xsd:enumeration value="SecondDay"/>
+ <xsd:enumeration value="StandardGround"/>
+ <xsd:enumeration value="SecondDayHundredWeight"/>
+ <xsd:enumeration value="StandardGroundHundredWeight"/>
+ <xsd:enumeration value="SecondMorning"/>
+ <xsd:enumeration value="SaturdayPickup"/>
+ <xsd:enumeration value="StandardClass"/>
+ <xsd:enumeration value="Express"/>
+ <xsd:enumeration value="HighSpeed"/>
+ <xsd:enumeration value="NormalSpeed"/>
+ <xsd:enumeration value="PostService"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransportLegCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="InlandTransport"/>
+ <xsd:enumeration value="AtTheStatisticalTerritoryLimit"/>
+ <xsd:enumeration value="Pre-CarriageTransport"/>
+ <xsd:enumeration value="AtBorder"/>
+ <xsd:enumeration value="AtDeparture"/>
+ <xsd:enumeration value="AtDestination"/>
+ <xsd:enumeration value="MainCarriage-FourthCarrier"/>
+ <xsd:enumeration value="MainCarriage-FifthCarrier"/>
+ <xsd:enumeration value="MainCarriage-SixthCarrier"/>
+ <xsd:enumeration value="MainCarriage-SeventhCarrier"/>
+ <xsd:enumeration value="MainCarriage-EighthCarrier"/>
+ <xsd:enumeration value="Main-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-FirstCarrier"/>
+ <xsd:enumeration value="MaiCarriage-SecondCarrier"/>
+ <xsd:enumeration value="MainCarriage-ThirdCarrier"/>
+ <xsd:enumeration value="InlandWaterwayTransport"/>
+ <xsd:enumeration value="DeliveryCarrierAllTransport"/>
+ <xsd:enumeration value="SecondPre-CarriageTransport"/>
+ <xsd:enumeration value="Pre-AcceptanceTransport"/>
+ <xsd:enumeration value="SecondOn-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-NinthCarrier"/>
+ <xsd:enumeration value="On-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-TenthCarrier"/>
+ <xsd:enumeration value="MainCarriage-EleventhCarrier"/>
+ <xsd:enumeration value="MainCarriage-TwelfthCarrier"/>
+ <xsd:enumeration value="1stCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="2ndCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="3rdCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="4thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="5thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="6thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="7thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="8thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="9thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="AgentsRoutingOriginCarrier"/>
+ <xsd:enumeration value="OriginDeliveryCarrier"/>
+ <xsd:enumeration value="DELY"/>
+ <xsd:enumeration value="HaulageRightsCarrierAndJunction"/>
+ <xsd:enumeration value="OriginSwitchCarrier"/>
+ <xsd:enumeration value="HaulageMovementCarrierAndJunction"/>
+ <xsd:enumeration value="OriginCarrierAirMotorOrOcean"/>
+ <xsd:enumeration value="OriginCarrierRule11Shipment"/>
+ <xsd:enumeration value="ShippersRoutingOriginCarrier"/>
+ <xsd:enumeration value="IntermediateSwitchCarrier"/>
+ <xsd:enumeration value="LastCarrierInRouteOnReturnRouteMove"/>
+ <xsd:enumeration value="JunctionSettlementCarrierFollowing"/>
+ <xsd:enumeration value="JunctionSettlementCarrierPredecessor"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfTransportEquipment">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="TransportEquipment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfTransportEquipment" type="ListOfTransportEquipment"/>
+ <xsd:complexType name="TransportEquipment">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="EquipmentProviderCoded" type="EquipmentProviderCode"/>
+ <xsd:element minOccurs="0" name="EquipmentProviderCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentOwnerCoded" type="EquipmentOwnerCode"/>
+ <xsd:element minOccurs="0" name="EquipmentOwnerCodedOther" type="xsd:string"/>
+ <xsd:element name="EquipmentID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentSizeTypeCoded" type="EquipmentSizeTypeCode"/>
+ <xsd:element minOccurs="0" name="EquipementSizeTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentStatusCoded" type="EquipmentStatusCode"/>
+ <xsd:element minOccurs="0" name="EquipmentStatusCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FullIndicatorCoded" type="FullIndicatorCode"/>
+ <xsd:element minOccurs="0" name="FullIndicatorCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Conditions"/>
+ <xsd:element minOccurs="0" name="EquipmentNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfSealInfo"/>
+ <xsd:element minOccurs="0" name="ListOfEquipmentMeasurements">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportEquipment" type="TransportEquipment"/>
+ <xsd:simpleType name="EquipmentProviderCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ShipperSupplied"/>
+ <xsd:enumeration value="CarrierSupplied"/>
+ <xsd:enumeration value="ConsolidatorSupplied"/>
+ <xsd:enumeration value="DeconsolidatorSupplied"/>
+ <xsd:enumeration value="ThirdPartySupplied"/>
+ <xsd:enumeration value="ForwarderSuppliedFromALeasingCompany"/>
+ <xsd:enumeration value="ForwarderSuppliedFromTheRailwaysPool"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentOwnerCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotCustomerOwnedOrLeased"/>
+ <xsd:enumeration value="SellerOwned"/>
+ <xsd:enumeration value="CustomerOwnedOrLeased"/>
+ <xsd:enumeration value="TripLeased"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentSizeTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="20FtIlContainer-ClosedTop"/>
+ <xsd:enumeration value="20FtIlContainer-OpenTop"/>
+ <xsd:enumeration value="40FtIlContainer-ClosedTop"/>
+ <xsd:enumeration value="40FtIlContainer-OpenTop"/>
+ <xsd:enumeration value="Aircraft"/>
+ <xsd:enumeration value="AirFreight-BreakBulk"/>
+ <xsd:enumeration value="AirRideVan"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BargeOpen"/>
+ <xsd:enumeration value="BilevelRailcarFullyEnclosed"/>
+ <xsd:enumeration value="BilevelRailcarFullyOpen"/>
+ <xsd:enumeration value="BilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="BilevelRailcarScreenedWithRoof"/>
+ <xsd:enumeration value="Bogie"/>
+ <xsd:enumeration value="Boxcar"/>
+ <xsd:enumeration value="BoxcarCushionUnderFrameOf"/>
+ <xsd:enumeration value="Boxcar-DamageFreeEquipped"/>
+ <xsd:enumeration value="Boxcar-Insulated"/>
+ <xsd:enumeration value="Boxcar-InteriorBulkheads"/>
+ <xsd:enumeration value="BoxPallet"/>
+ <xsd:enumeration value="Caboose"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="Chassis-Gooseneck"/>
+ <xsd:enumeration value="ClosedContainer"/>
+ <xsd:enumeration value="ClosedContainer-ControlledTemperature"/>
+ <xsd:enumeration value="ClosedVan"/>
+ <xsd:enumeration value="Coil-CarCovered"/>
+ <xsd:enumeration value="CoilCarOpen"/>
+ <xsd:enumeration value="Container"/>
+ <xsd:enumeration value="Container-Aluminum"/>
+ <xsd:enumeration value="Container-Bulk"/>
+ <xsd:enumeration value="Container-ClosedTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-HighSideOpenTop"/>
+ <xsd:enumeration value="ContainerIc20Feet"/>
+ <xsd:enumeration value="ContainerIc30Feet"/>
+ <xsd:enumeration value="ContainerIc40Feet"/>
+ <xsd:enumeration value="Container-Insulated"/>
+ <xsd:enumeration value="Container-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-LowSideOpenTop"/>
+ <xsd:enumeration value="Container-Open-Sided"/>
+ <xsd:enumeration value="Container-OpenTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-Platform"/>
+ <xsd:enumeration value="ContainerRestingOnAChassis"/>
+ <xsd:enumeration value="Container-Steel"/>
+ <xsd:enumeration value="Container-Tank"/>
+ <xsd:enumeration value="Container-Tank-Chemicals"/>
+ <xsd:enumeration value="Container-Tank-FoodGrade-Liquid"/>
+ <xsd:enumeration value="Container-Tank-Gas"/>
+ <xsd:enumeration value="Container-Upgraded"/>
+ <xsd:enumeration value="Container-Vented"/>
+ <xsd:enumeration value="ContainerWithBagHangers"/>
+ <xsd:enumeration value="ContainerWithFloorSecuringRings"/>
+ <xsd:enumeration value="ContainerWithFlushDoors"/>
+ <xsd:enumeration value="ContainerWithHangarBars"/>
+ <xsd:enumeration value="ContainerWithSmoothSides"/>
+ <xsd:enumeration value="ContainerWithWavyOrRippleSides"/>
+ <xsd:enumeration value="ControlledTemperatureTrailer-Reefer"/>
+ <xsd:enumeration value="ControlUnit"/>
+ <xsd:enumeration value="CoveredBarge"/>
+ <xsd:enumeration value="Cut-InHelper"/>
+ <xsd:enumeration value="DimeCoatedTank"/>
+ <xsd:enumeration value="Double-DropTrailer"/>
+ <xsd:enumeration value="DropBackTrailer"/>
+ <xsd:enumeration value="DualTrailers"/>
+ <xsd:enumeration value="EndOfTrainDevice"/>
+ <xsd:enumeration value="EpoxyCoatedTank"/>
+ <xsd:enumeration value="EuroPallet"/>
+ <xsd:enumeration value="ExchangeablePallet"/>
+ <xsd:enumeration value="Fixed-Rack-DoubleDropTrailer"/>
+ <xsd:enumeration value="Fixed-Rack-Flat-BedTrailer"/>
+ <xsd:enumeration value="Fixed-Rack-Single-DropTrailer"/>
+ <xsd:enumeration value="FlatbedSlidingTandem"/>
+ <xsd:enumeration value="FlatBedTrailer"/>
+ <xsd:enumeration value="FlatBedTrailer-RemovableSides"/>
+ <xsd:enumeration value="FlatBedTrailerWithHeadboards"/>
+ <xsd:enumeration value="FlatBedTrailerWithNoHeadboards"/>
+ <xsd:enumeration value="FlatCar"/>
+ <xsd:enumeration value="FlatCar-EndBulkheads"/>
+ <xsd:enumeration value="FlatcarWithPedestal"/>
+ <xsd:enumeration value="FrozenFoodTrailer"/>
+ <xsd:enumeration value="GeneratorSet"/>
+ <xsd:enumeration value="GondolaCar-Covered-InteriorBulkheads"/>
+ <xsd:enumeration value="GondolaCar-Open"/>
+ <xsd:enumeration value="GondolaCovered"/>
+ <xsd:enumeration value="HalfHeightFlatRack"/>
+ <xsd:enumeration value="Head-EndHelperUnit"/>
+ <xsd:enumeration value="HeadOfTrainDevice"/>
+ <xsd:enumeration value="HighCubeVan"/>
+ <xsd:enumeration value="HopperCar-Covered"/>
+ <xsd:enumeration value="HopperCar-Covered-PneumaticDischarge"/>
+ <xsd:enumeration value="HopperCar-Open"/>
+ <xsd:enumeration value="Hydrant-Cart"/>
+ <xsd:enumeration value="IdlerCar"/>
+ <xsd:enumeration value="IMO1"/>
+ <xsd:enumeration value="IMO2"/>
+ <xsd:enumeration value="IMO3"/>
+ <xsd:enumeration value="LoadOrUnloadDeviceOnEquipment"/>
+ <xsd:enumeration value="Locomotive"/>
+ <xsd:enumeration value="MovableCase-Between10.90MAnd13.75M"/>
+ <xsd:enumeration value="MovableCase-Between6.15MAnd7.82M"/>
+ <xsd:enumeration value="MovableCase-Between7.82MAnd9.15M"/>
+ <xsd:enumeration value="MovableCase-Between9.15MAnd10.90M"/>
+ <xsd:enumeration value="MovableCase-LessThan6.15M"/>
+ <xsd:enumeration value="NonworkingReeferContainer20Ft"/>
+ <xsd:enumeration value="NonworkingReeferContainer40Ft"/>
+ <xsd:enumeration value="NonWorkingRefrigeratedOrReeferContainer30Ft"/>
+ <xsd:enumeration value="OceanVessel-BreakBulk"/>
+ <xsd:enumeration value="Open-TopOrFlatbedTrailer"/>
+ <xsd:enumeration value="OpenTopVan"/>
+ <xsd:enumeration value="Pick-UpTruck"/>
+ <xsd:enumeration value="PowerPack"/>
+ <xsd:enumeration value="PressurizedTank"/>
+ <xsd:enumeration value="ProtectedTrailer"/>
+ <xsd:enumeration value="RailCar"/>
+ <xsd:enumeration value="RailroadMaintenanceOfWayCar"/>
+ <xsd:enumeration value="Rear-EndHelperUnit"/>
+ <xsd:enumeration value="RefrigeratedContainer"/>
+ <xsd:enumeration value="RefrigeratedOrReeferCar"/>
+ <xsd:enumeration value="RefrigeratedTank"/>
+ <xsd:enumeration value="RefrigeratedTank20Feet"/>
+ <xsd:enumeration value="RefrigeratedTank30Feet"/>
+ <xsd:enumeration value="RefrigeratedTank40Feet"/>
+ <xsd:enumeration value="RefrigeratedTankIc20Feet"/>
+ <xsd:enumeration value="RefrigeratedTankIc40Feet"/>
+ <xsd:enumeration value="RemovableSideTrailer"/>
+ <xsd:enumeration value="Roadrailer"/>
+ <xsd:enumeration value="Saddle"/>
+ <xsd:enumeration value="ScandinavianPallet"/>
+ <xsd:enumeration value="Semi-Refrigerated"/>
+ <xsd:enumeration value="Semi-Trailer"/>
+ <xsd:enumeration value="ServiceCar"/>
+ <xsd:enumeration value="Single-DropTrailer"/>
+ <xsd:enumeration value="StackCar"/>
+ <xsd:enumeration value="StainlessSteelTank"/>
+ <xsd:enumeration value="Stak-Rak"/>
+ <xsd:enumeration value="TankCar"/>
+ <xsd:enumeration value="TankContainer20Feet"/>
+ <xsd:enumeration value="TankContainer30Feet"/>
+ <xsd:enumeration value="TankContainer40Feet"/>
+ <xsd:enumeration value="TankContainerIc20Feet"/>
+ <xsd:enumeration value="TankContainerIc30Feet"/>
+ <xsd:enumeration value="TankContainerIc40Feet"/>
+ <xsd:enumeration value="TelescopingTrailer"/>
+ <xsd:enumeration value="TemperatureControlledContainer20Ft"/>
+ <xsd:enumeration value="TemperatureControlledContainer30Ft"/>
+ <xsd:enumeration value="TemperatureControlledContainer40Ft"/>
+ <xsd:enumeration value="Totebin"/>
+ <xsd:enumeration value="Tractor"/>
+ <xsd:enumeration value="Trailer"/>
+ <xsd:enumeration value="Trailer-Boat"/>
+ <xsd:enumeration value="Trailer-Car"/>
+ <xsd:enumeration value="Trailer-DryFreight"/>
+ <xsd:enumeration value="Trailer-ElectricHeat"/>
+ <xsd:enumeration value="Trailer-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-Insulated"/>
+ <xsd:enumeration value="Trailer-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-NotOtherwiseSpecified"/>
+ <xsd:enumeration value="Trailer-Pneumatic"/>
+ <xsd:enumeration value="Trailer-Refrigerated"/>
+ <xsd:enumeration value="Trailer-Tank-Chemicals"/>
+ <xsd:enumeration value="Trailer-Tank-FoodGrade-Liquid"/>
+ <xsd:enumeration value="Trailer-Tank-Gas"/>
+ <xsd:enumeration value="TrilevelRailcar20Feet"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-FullyEnclosed"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithDoors-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Truck-OpenTop"/>
+ <xsd:enumeration value="Truck-OpenTopHighSide"/>
+ <xsd:enumeration value="Truck-OpenTopLowSide"/>
+ <xsd:enumeration value="Truck-Van"/>
+ <xsd:enumeration value="UnitLoadDevice"/>
+ <xsd:enumeration value="Van-SpecialInsideLength-WidthOrHeightRequirements"/>
+ <xsd:enumeration value="Vessel-Lake"/>
+ <xsd:enumeration value="Vessel-Ocean"/>
+ <xsd:enumeration value="Vessel-Ocean-Containership"/>
+ <xsd:enumeration value="Vessel-Ocean-Lash"/>
+ <xsd:enumeration value="Vessel-Ocean-Rollon-Rolloff"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentStatusCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Continental"/>
+ <xsd:enumeration value="Export"/>
+ <xsd:enumeration value="Import"/>
+ <xsd:enumeration value="RemainOnBoard"/>
+ <xsd:enumeration value="Shifter"/>
+ <xsd:enumeration value="Transhipment"/>
+ <xsd:enumeration value="Shortlanded"/>
+ <xsd:enumeration value="Overlanded"/>
+ <xsd:enumeration value="Domestic"/>
+ <xsd:enumeration value="Positioning"/>
+ <xsd:enumeration value="Delivery"/>
+ <xsd:enumeration value="Redelivery"/>
+ <xsd:enumeration value="Repair"/>
+ <xsd:enumeration value="Reloader"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="FullIndicatorCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Full"/>
+ <xsd:enumeration value="Empty"/>
+ <xsd:enumeration value="Partial"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Conditions">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="RefrigerationOn" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="Residue" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ListOfConditions">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Conditions" type="Conditions"/>
+ <xsd:complexType name="ListOfDimension">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Dimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDimension" type="ListOfDimension"/>
+ <xsd:complexType name="Dimension">
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ <xsd:element name="DimensionCoded" type="DimensionCode"/>
+ <xsd:element minOccurs="0" name="DimensionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Dimension" type="Dimension"/>
+ <xsd:complexType name="Measurement">
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element ref="MeasurementValue"/>
+ <xsd:element ref="MeasurementRange"/>
+ </xsd:choice>
+ <xsd:element ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Measurement" type="Measurement"/>
+ <xsd:complexType name="MeasurementValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MeasurementValue" type="MeasurementValue"/>
+ <xsd:simpleType name="SignificanceCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Approximately"/>
+ <xsd:enumeration value="EqualTo"/>
+ <xsd:enumeration value="GreaterThanOrEqualTo"/>
+ <xsd:enumeration value="GreaterThan"/>
+ <xsd:enumeration value="LessThan"/>
+ <xsd:enumeration value="LessThanOrEqualTo"/>
+ <xsd:enumeration value="NotEqualTo"/>
+ <xsd:enumeration value="Trace"/>
+ <xsd:enumeration value="TrueValue"/>
+ <xsd:enumeration value="ObservedValue"/>
+ <xsd:enumeration value="OutOfRange"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ConditionsCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="WhereAirEquals1"/>
+ <xsd:enumeration value="WhereButylAcetateEquals1"/>
+ <xsd:enumeration value="WhereH2OEquals1OrWaterEquals1"/>
+ <xsd:enumeration value="CorrectedTo60DegreesFahrenheit"/>
+ <xsd:enumeration value="WhereTolueneEquals1"/>
+ <xsd:enumeration value="VaporInAir"/>
+ <xsd:enumeration value="VaporInOtherThanAir"/>
+ <xsd:enumeration value="StandardTemperatureAndPressure"/>
+ <xsd:enumeration value="ConditionsOtherThanStandardTemperatureAndPressure"/>
+ <xsd:enumeration value="InEthylAlcohol"/>
+ <xsd:enumeration value="InEthylEther"/>
+ <xsd:enumeration value="InWater"/>
+ <xsd:enumeration value="At1AtmospherePressure"/>
+ <xsd:enumeration value="WhereEtherEquals1"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="Predicted"/>
+ <xsd:enumeration value="Air-DriedBasis"/>
+ <xsd:enumeration value="As-ReceivedBasis"/>
+ <xsd:enumeration value="DryBasis"/>
+ <xsd:enumeration value="EquilibriumBasis"/>
+ <xsd:enumeration value="MoistureAndAsh-FreeBasis"/>
+ <xsd:enumeration value="OxidizingAtmosphere"/>
+ <xsd:enumeration value="ReducingAtmosphere"/>
+ <xsd:enumeration value="Calculated"/>
+ <xsd:enumeration value="ScaledWeight"/>
+ <xsd:enumeration value="Ratchet"/>
+ <xsd:enumeration value="SaturatedVapor"/>
+ <xsd:enumeration value="Unconditional"/>
+ <xsd:enumeration value="Short-Term"/>
+ <xsd:enumeration value="Time-Weighted"/>
+ <xsd:enumeration value="Corrected"/>
+ <xsd:enumeration value="Uncorrected"/>
+ <xsd:enumeration value="OffPeak"/>
+ <xsd:enumeration value="OnPeak"/>
+ <xsd:enumeration value="Intermediate"/>
+ <xsd:enumeration value="Average"/>
+ <xsd:enumeration value="PerGallon"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="Minimum"/>
+ <xsd:enumeration value="Mist"/>
+ <xsd:enumeration value="Predominant"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="Cost"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="ForSale"/>
+ <xsd:enumeration value="RealEstateOwnedOrCorporateOwned"/>
+ <xsd:enumeration value="BoardedOrBlockedUp"/>
+ <xsd:enumeration value="Planned"/>
+ <xsd:enumeration value="Completed"/>
+ <xsd:enumeration value="Sold"/>
+ <xsd:enumeration value="Rented"/>
+ <xsd:enumeration value="Current"/>
+ <xsd:enumeration value="CurrentList"/>
+ <xsd:enumeration value="Effective"/>
+ <xsd:enumeration value="ListWhenSold"/>
+ <xsd:enumeration value="Sales"/>
+ <xsd:enumeration value="FinalList"/>
+ <xsd:enumeration value="AsIs"/>
+ <xsd:enumeration value="AsRepairedOrImproved"/>
+ <xsd:enumeration value="Instantaneous"/>
+ <xsd:enumeration value="Low"/>
+ <xsd:enumeration value="LowToGood"/>
+ <xsd:enumeration value="LowToHigh"/>
+ <xsd:enumeration value="LowToMedium"/>
+ <xsd:enumeration value="LowToModerate"/>
+ <xsd:enumeration value="Medium"/>
+ <xsd:enumeration value="MediumToGood"/>
+ <xsd:enumeration value="MediumToHigh"/>
+ <xsd:enumeration value="Moderate"/>
+ <xsd:enumeration value="ModerateToGood"/>
+ <xsd:enumeration value="ModerateToHigh"/>
+ <xsd:enumeration value="ModerateToMedium"/>
+ <xsd:enumeration value="Good"/>
+ <xsd:enumeration value="GoodToHigh"/>
+ <xsd:enumeration value="High"/>
+ <xsd:enumeration value="Budgeted"/>
+ <xsd:enumeration value="Forecast"/>
+ <xsd:enumeration value="Adjusted"/>
+ <xsd:enumeration value="Allocated"/>
+ <xsd:enumeration value="Increasing"/>
+ <xsd:enumeration value="Stable"/>
+ <xsd:enumeration value="Declining"/>
+ <xsd:enumeration value="Previous"/>
+ <xsd:enumeration value="Potential"/>
+ <xsd:enumeration value="Modeled"/>
+ <xsd:enumeration value="Measured"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="SummerOn-Peak"/>
+ <xsd:enumeration value="SummerMid-Peak"/>
+ <xsd:enumeration value="SummerOff-Peak"/>
+ <xsd:enumeration value="SummerSuperOn-Peak"/>
+ <xsd:enumeration value="SummerSuperOff-Peak"/>
+ <xsd:enumeration value="WinterOn-Peak"/>
+ <xsd:enumeration value="WinterMid-Peak"/>
+ <xsd:enumeration value="WinterOff-Peak"/>
+ <xsd:enumeration value="WinterSuperOn-Peak"/>
+ <xsd:enumeration value="WinterSuperOff-Peak"/>
+ <xsd:enumeration value="SummerDay"/>
+ <xsd:enumeration value="SummerNight"/>
+ <xsd:enumeration value="WinterDay"/>
+ <xsd:enumeration value="WinterNight"/>
+ <xsd:enumeration value="Summer"/>
+ <xsd:enumeration value="Winter"/>
+ <xsd:enumeration value="Day"/>
+ <xsd:enumeration value="Night"/>
+ <xsd:enumeration value="Peak-2"/>
+ <xsd:enumeration value="Peak-3"/>
+ <xsd:enumeration value="Peak-4"/>
+ <xsd:enumeration value="Shoulder"/>
+ <xsd:enumeration value="NonTimeRelatedDemand"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="MeasurementRange">
+ <xsd:sequence>
+ <xsd:element ref="MinimumValue"/>
+ <xsd:element ref="MaximumValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MeasurementRange" type="MeasurementRange"/>
+ <xsd:complexType name="MinimumValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MinimumValue" type="MinimumValue"/>
+ <xsd:complexType name="MaximumValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MaximumValue" type="MaximumValue"/>
+ <xsd:complexType name="UnitOfMeasurement">
+ <xsd:sequence>
+ <xsd:element name="UOMCoded" type="UOMCode"/>
+ <xsd:element minOccurs="0" name="UOMCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="UnitOfMeasurement" type="UnitOfMeasurement"/>
+ <xsd:simpleType name="UOMCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="4"/>
+ <xsd:enumeration value="5"/>
+ <xsd:enumeration value="8"/>
+ <xsd:enumeration value="10"/>
+ <xsd:enumeration value="11"/>
+ <xsd:enumeration value="13"/>
+ <xsd:enumeration value="14"/>
+ <xsd:enumeration value="15"/>
+ <xsd:enumeration value="16"/>
+ <xsd:enumeration value="17"/>
+ <xsd:enumeration value="18"/>
+ <xsd:enumeration value="19"/>
+ <xsd:enumeration value="20"/>
+ <xsd:enumeration value="21"/>
+ <xsd:enumeration value="22"/>
+ <xsd:enumeration value="23"/>
+ <xsd:enumeration value="24"/>
+ <xsd:enumeration value="25"/>
+ <xsd:enumeration value="26"/>
+ <xsd:enumeration value="27"/>
+ <xsd:enumeration value="28"/>
+ <xsd:enumeration value="29"/>
+ <xsd:enumeration value="30"/>
+ <xsd:enumeration value="31"/>
+ <xsd:enumeration value="32"/>
+ <xsd:enumeration value="33"/>
+ <xsd:enumeration value="34"/>
+ <xsd:enumeration value="35"/>
+ <xsd:enumeration value="36"/>
+ <xsd:enumeration value="37"/>
+ <xsd:enumeration value="38"/>
+ <xsd:enumeration value="40"/>
+ <xsd:enumeration value="41"/>
+ <xsd:enumeration value="43"/>
+ <xsd:enumeration value="44"/>
+ <xsd:enumeration value="45"/>
+ <xsd:enumeration value="46"/>
+ <xsd:enumeration value="47"/>
+ <xsd:enumeration value="48"/>
+ <xsd:enumeration value="50"/>
+ <xsd:enumeration value="51"/>
+ <xsd:enumeration value="53"/>
+ <xsd:enumeration value="54"/>
+ <xsd:enumeration value="56"/>
+ <xsd:enumeration value="57"/>
+ <xsd:enumeration value="58"/>
+ <xsd:enumeration value="59"/>
+ <xsd:enumeration value="60"/>
+ <xsd:enumeration value="61"/>
+ <xsd:enumeration value="62"/>
+ <xsd:enumeration value="63"/>
+ <xsd:enumeration value="64"/>
+ <xsd:enumeration value="66"/>
+ <xsd:enumeration value="69"/>
+ <xsd:enumeration value="71"/>
+ <xsd:enumeration value="72"/>
+ <xsd:enumeration value="73"/>
+ <xsd:enumeration value="74"/>
+ <xsd:enumeration value="76"/>
+ <xsd:enumeration value="77"/>
+ <xsd:enumeration value="78"/>
+ <xsd:enumeration value="80"/>
+ <xsd:enumeration value="81"/>
+ <xsd:enumeration value="84"/>
+ <xsd:enumeration value="85"/>
+ <xsd:enumeration value="86"/>
+ <xsd:enumeration value="87"/>
+ <xsd:enumeration value="89"/>
+ <xsd:enumeration value="90"/>
+ <xsd:enumeration value="91"/>
+ <xsd:enumeration value="92"/>
+ <xsd:enumeration value="93"/>
+ <xsd:enumeration value="94"/>
+ <xsd:enumeration value="95"/>
+ <xsd:enumeration value="96"/>
+ <xsd:enumeration value="97"/>
+ <xsd:enumeration value="98"/>
+ <xsd:enumeration value="1A"/>
+ <xsd:enumeration value="1B"/>
+ <xsd:enumeration value="1C"/>
+ <xsd:enumeration value="1D"/>
+ <xsd:enumeration value="1E"/>
+ <xsd:enumeration value="1F"/>
+ <xsd:enumeration value="1G"/>
+ <xsd:enumeration value="1H"/>
+ <xsd:enumeration value="1I"/>
+ <xsd:enumeration value="1J"/>
+ <xsd:enumeration value="1K"/>
+ <xsd:enumeration value="1L"/>
+ <xsd:enumeration value="1M"/>
+ <xsd:enumeration value="1X"/>
+ <xsd:enumeration value="2A"/>
+ <xsd:enumeration value="2B"/>
+ <xsd:enumeration value="2C"/>
+ <xsd:enumeration value="2F"/>
+ <xsd:enumeration value="2G"/>
+ <xsd:enumeration value="2H"/>
+ <xsd:enumeration value="2I"/>
+ <xsd:enumeration value="2J"/>
+ <xsd:enumeration value="2K"/>
+ <xsd:enumeration value="2L"/>
+ <xsd:enumeration value="2M"/>
+ <xsd:enumeration value="2N"/>
+ <xsd:enumeration value="2P"/>
+ <xsd:enumeration value="2Q"/>
+ <xsd:enumeration value="2R"/>
+ <xsd:enumeration value="2U"/>
+ <xsd:enumeration value="2V"/>
+ <xsd:enumeration value="2W"/>
+ <xsd:enumeration value="2X"/>
+ <xsd:enumeration value="2Y"/>
+ <xsd:enumeration value="2Z"/>
+ <xsd:enumeration value="3B"/>
+ <xsd:enumeration value="3C"/>
+ <xsd:enumeration value="3E"/>
+ <xsd:enumeration value="3F"/>
+ <xsd:enumeration value="3G"/>
+ <xsd:enumeration value="3H"/>
+ <xsd:enumeration value="3I"/>
+ <xsd:enumeration value="4A"/>
+ <xsd:enumeration value="4B"/>
+ <xsd:enumeration value="4C"/>
+ <xsd:enumeration value="4E"/>
+ <xsd:enumeration value="4G"/>
+ <xsd:enumeration value="4H"/>
+ <xsd:enumeration value="4I"/>
+ <xsd:enumeration value="4J"/>
+ <xsd:enumeration value="4K"/>
+ <xsd:enumeration value="4L"/>
+ <xsd:enumeration value="4M"/>
+ <xsd:enumeration value="4N"/>
+ <xsd:enumeration value="4O"/>
+ <xsd:enumeration value="4P"/>
+ <xsd:enumeration value="4Q"/>
+ <xsd:enumeration value="4R"/>
+ <xsd:enumeration value="4T"/>
+ <xsd:enumeration value="4U"/>
+ <xsd:enumeration value="4W"/>
+ <xsd:enumeration value="4X"/>
+ <xsd:enumeration value="5A"/>
+ <xsd:enumeration value="5B"/>
+ <xsd:enumeration value="5C"/>
+ <xsd:enumeration value="5E"/>
+ <xsd:enumeration value="5F"/>
+ <xsd:enumeration value="5G"/>
+ <xsd:enumeration value="5H"/>
+ <xsd:enumeration value="5I"/>
+ <xsd:enumeration value="5J"/>
+ <xsd:enumeration value="5K"/>
+ <xsd:enumeration value="5P"/>
+ <xsd:enumeration value="5Q"/>
+ <xsd:enumeration value="A1"/>
+ <xsd:enumeration value="A10"/>
+ <xsd:enumeration value="A11"/>
+ <xsd:enumeration value="A12"/>
+ <xsd:enumeration value="A13"/>
+ <xsd:enumeration value="A14"/>
+ <xsd:enumeration value="A15"/>
+ <xsd:enumeration value="A16"/>
+ <xsd:enumeration value="A17"/>
+ <xsd:enumeration value="A18"/>
+ <xsd:enumeration value="A19"/>
+ <xsd:enumeration value="A2"/>
+ <xsd:enumeration value="A20"/>
+ <xsd:enumeration value="A22"/>
+ <xsd:enumeration value="A23"/>
+ <xsd:enumeration value="A24"/>
+ <xsd:enumeration value="A25"/>
+ <xsd:enumeration value="A26"/>
+ <xsd:enumeration value="A27"/>
+ <xsd:enumeration value="A28"/>
+ <xsd:enumeration value="A29"/>
+ <xsd:enumeration value="A3"/>
+ <xsd:enumeration value="A30"/>
+ <xsd:enumeration value="A31"/>
+ <xsd:enumeration value="A32"/>
+ <xsd:enumeration value="A33"/>
+ <xsd:enumeration value="A34"/>
+ <xsd:enumeration value="A35"/>
+ <xsd:enumeration value="A36"/>
+ <xsd:enumeration value="A37"/>
+ <xsd:enumeration value="A38"/>
+ <xsd:enumeration value="A39"/>
+ <xsd:enumeration value="A4"/>
+ <xsd:enumeration value="A40"/>
+ <xsd:enumeration value="A41"/>
+ <xsd:enumeration value="A42"/>
+ <xsd:enumeration value="A43"/>
+ <xsd:enumeration value="A44"/>
+ <xsd:enumeration value="A45"/>
+ <xsd:enumeration value="A47"/>
+ <xsd:enumeration value="A48"/>
+ <xsd:enumeration value="A49"/>
+ <xsd:enumeration value="A5"/>
+ <xsd:enumeration value="A50"/>
+ <xsd:enumeration value="A51"/>
+ <xsd:enumeration value="A52"/>
+ <xsd:enumeration value="A53"/>
+ <xsd:enumeration value="A54"/>
+ <xsd:enumeration value="A55"/>
+ <xsd:enumeration value="A56"/>
+ <xsd:enumeration value="A57"/>
+ <xsd:enumeration value="A58"/>
+ <xsd:enumeration value="A6"/>
+ <xsd:enumeration value="A60"/>
+ <xsd:enumeration value="A61"/>
+ <xsd:enumeration value="A62"/>
+ <xsd:enumeration value="A63"/>
+ <xsd:enumeration value="A64"/>
+ <xsd:enumeration value="A65"/>
+ <xsd:enumeration value="A66"/>
+ <xsd:enumeration value="A67"/>
+ <xsd:enumeration value="A68"/>
+ <xsd:enumeration value="A69"/>
+ <xsd:enumeration value="A7"/>
+ <xsd:enumeration value="A70"/>
+ <xsd:enumeration value="A71"/>
+ <xsd:enumeration value="A73"/>
+ <xsd:enumeration value="A74"/>
+ <xsd:enumeration value="A75"/>
+ <xsd:enumeration value="A76"/>
+ <xsd:enumeration value="A77"/>
+ <xsd:enumeration value="A78"/>
+ <xsd:enumeration value="A79"/>
+ <xsd:enumeration value="A8"/>
+ <xsd:enumeration value="A80"/>
+ <xsd:enumeration value="A81"/>
+ <xsd:enumeration value="A82"/>
+ <xsd:enumeration value="A83"/>
+ <xsd:enumeration value="A84"/>
+ <xsd:enumeration value="A85"/>
+ <xsd:enumeration value="A86"/>
+ <xsd:enumeration value="A87"/>
+ <xsd:enumeration value="A88"/>
+ <xsd:enumeration value="A89"/>
+ <xsd:enumeration value="A9"/>
+ <xsd:enumeration value="A90"/>
+ <xsd:enumeration value="A91"/>
+ <xsd:enumeration value="A93"/>
+ <xsd:enumeration value="A94"/>
+ <xsd:enumeration value="A95"/>
+ <xsd:enumeration value="A96"/>
+ <xsd:enumeration value="A97"/>
+ <xsd:enumeration value="A98"/>
+ <xsd:enumeration value="AA"/>
+ <xsd:enumeration value="AB"/>
+ <xsd:enumeration value="ACR"/>
+ <xsd:enumeration value="AD"/>
+ <xsd:enumeration value="AE"/>
+ <xsd:enumeration value="AH"/>
+ <xsd:enumeration value="AI"/>
+ <xsd:enumeration value="AJ"/>
+ <xsd:enumeration value="AK"/>
+ <xsd:enumeration value="AL"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="AMH"/>
+ <xsd:enumeration value="AMP"/>
+ <xsd:enumeration value="AN"/>
+ <xsd:enumeration value="ANN"/>
+ <xsd:enumeration value="AP"/>
+ <xsd:enumeration value="APZ"/>
+ <xsd:enumeration value="AQ"/>
+ <xsd:enumeration value="AR"/>
+ <xsd:enumeration value="ARE"/>
+ <xsd:enumeration value="AS"/>
+ <xsd:enumeration value="ASM"/>
+ <xsd:enumeration value="ASU"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="ATM"/>
+ <xsd:enumeration value="ATT"/>
+ <xsd:enumeration value="AU"/>
+ <xsd:enumeration value="AV"/>
+ <xsd:enumeration value="AW"/>
+ <xsd:enumeration value="AX"/>
+ <xsd:enumeration value="AY"/>
+ <xsd:enumeration value="AZ"/>
+ <xsd:enumeration value="B0"/>
+ <xsd:enumeration value="B1"/>
+ <xsd:enumeration value="B11"/>
+ <xsd:enumeration value="B12"/>
+ <xsd:enumeration value="B13"/>
+ <xsd:enumeration value="B14"/>
+ <xsd:enumeration value="B15"/>
+ <xsd:enumeration value="B16"/>
+ <xsd:enumeration value="B18"/>
+ <xsd:enumeration value="B2"/>
+ <xsd:enumeration value="B20"/>
+ <xsd:enumeration value="B21"/>
+ <xsd:enumeration value="B22"/>
+ <xsd:enumeration value="B23"/>
+ <xsd:enumeration value="B24"/>
+ <xsd:enumeration value="B25"/>
+ <xsd:enumeration value="B26"/>
+ <xsd:enumeration value="B27"/>
+ <xsd:enumeration value="B28"/>
+ <xsd:enumeration value="B29"/>
+ <xsd:enumeration value="B3"/>
+ <xsd:enumeration value="B31"/>
+ <xsd:enumeration value="B32"/>
+ <xsd:enumeration value="B33"/>
+ <xsd:enumeration value="B34"/>
+ <xsd:enumeration value="B35"/>
+ <xsd:enumeration value="B36"/>
+ <xsd:enumeration value="B37"/>
+ <xsd:enumeration value="B38"/>
+ <xsd:enumeration value="B39"/>
+ <xsd:enumeration value="B4"/>
+ <xsd:enumeration value="B40"/>
+ <xsd:enumeration value="B41"/>
+ <xsd:enumeration value="B42"/>
+ <xsd:enumeration value="B43"/>
+ <xsd:enumeration value="B44"/>
+ <xsd:enumeration value="B45"/>
+ <xsd:enumeration value="B46"/>
+ <xsd:enumeration value="B47"/>
+ <xsd:enumeration value="B48"/>
+ <xsd:enumeration value="B49"/>
+ <xsd:enumeration value="B5"/>
+ <xsd:enumeration value="B50"/>
+ <xsd:enumeration value="B51"/>
+ <xsd:enumeration value="B52"/>
+ <xsd:enumeration value="B53"/>
+ <xsd:enumeration value="B54"/>
+ <xsd:enumeration value="B55"/>
+ <xsd:enumeration value="B56"/>
+ <xsd:enumeration value="B57"/>
+ <xsd:enumeration value="B58"/>
+ <xsd:enumeration value="B59"/>
+ <xsd:enumeration value="B6"/>
+ <xsd:enumeration value="B60"/>
+ <xsd:enumeration value="B61"/>
+ <xsd:enumeration value="B62"/>
+ <xsd:enumeration value="B63"/>
+ <xsd:enumeration value="B64"/>
+ <xsd:enumeration value="B65"/>
+ <xsd:enumeration value="B66"/>
+ <xsd:enumeration value="B67"/>
+ <xsd:enumeration value="B69"/>
+ <xsd:enumeration value="B7"/>
+ <xsd:enumeration value="B70"/>
+ <xsd:enumeration value="B71"/>
+ <xsd:enumeration value="B72"/>
+ <xsd:enumeration value="B73"/>
+ <xsd:enumeration value="B74"/>
+ <xsd:enumeration value="B75"/>
+ <xsd:enumeration value="B76"/>
+ <xsd:enumeration value="B77"/>
+ <xsd:enumeration value="B78"/>
+ <xsd:enumeration value="B79"/>
+ <xsd:enumeration value="B8"/>
+ <xsd:enumeration value="B81"/>
+ <xsd:enumeration value="B83"/>
+ <xsd:enumeration value="B84"/>
+ <xsd:enumeration value="B85"/>
+ <xsd:enumeration value="B86"/>
+ <xsd:enumeration value="B87"/>
+ <xsd:enumeration value="B88"/>
+ <xsd:enumeration value="B89"/>
+ <xsd:enumeration value="B9"/>
+ <xsd:enumeration value="B90"/>
+ <xsd:enumeration value="B91"/>
+ <xsd:enumeration value="B92"/>
+ <xsd:enumeration value="B93"/>
+ <xsd:enumeration value="B94"/>
+ <xsd:enumeration value="B95"/>
+ <xsd:enumeration value="B96"/>
+ <xsd:enumeration value="B97"/>
+ <xsd:enumeration value="B98"/>
+ <xsd:enumeration value="B99"/>
+ <xsd:enumeration value="BAR"/>
+ <xsd:enumeration value="BB"/>
+ <xsd:enumeration value="BD"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BFT"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BH"/>
+ <xsd:enumeration value="BHP"/>
+ <xsd:enumeration value="BIL"/>
+ <xsd:enumeration value="BJ"/>
+ <xsd:enumeration value="BK"/>
+ <xsd:enumeration value="BL"/>
+ <xsd:enumeration value="BLD"/>
+ <xsd:enumeration value="BLL"/>
+ <xsd:enumeration value="BO"/>
+ <xsd:enumeration value="BP"/>
+ <xsd:enumeration value="BQL"/>
+ <xsd:enumeration value="BT"/>
+ <xsd:enumeration value="BTU"/>
+ <xsd:enumeration value="BU"/>
+ <xsd:enumeration value="BUA"/>
+ <xsd:enumeration value="BUI"/>
+ <xsd:enumeration value="BW"/>
+ <xsd:enumeration value="BX"/>
+ <xsd:enumeration value="BZ"/>
+ <xsd:enumeration value="C0"/>
+ <xsd:enumeration value="C1"/>
+ <xsd:enumeration value="C10"/>
+ <xsd:enumeration value="C11"/>
+ <xsd:enumeration value="C12"/>
+ <xsd:enumeration value="C13"/>
+ <xsd:enumeration value="C14"/>
+ <xsd:enumeration value="C15"/>
+ <xsd:enumeration value="C16"/>
+ <xsd:enumeration value="C17"/>
+ <xsd:enumeration value="C18"/>
+ <xsd:enumeration value="C19"/>
+ <xsd:enumeration value="C2"/>
+ <xsd:enumeration value="C20"/>
+ <xsd:enumeration value="C22"/>
+ <xsd:enumeration value="C23"/>
+ <xsd:enumeration value="C24"/>
+ <xsd:enumeration value="C25"/>
+ <xsd:enumeration value="C26"/>
+ <xsd:enumeration value="C27"/>
+ <xsd:enumeration value="C28"/>
+ <xsd:enumeration value="C29"/>
+ <xsd:enumeration value="C3"/>
+ <xsd:enumeration value="C30"/>
+ <xsd:enumeration value="C31"/>
+ <xsd:enumeration value="C32"/>
+ <xsd:enumeration value="C33"/>
+ <xsd:enumeration value="C34"/>
+ <xsd:enumeration value="C35"/>
+ <xsd:enumeration value="C36"/>
+ <xsd:enumeration value="C38"/>
+ <xsd:enumeration value="C39"/>
+ <xsd:enumeration value="C4"/>
+ <xsd:enumeration value="C40"/>
+ <xsd:enumeration value="C41"/>
+ <xsd:enumeration value="C42"/>
+ <xsd:enumeration value="C43"/>
+ <xsd:enumeration value="C44"/>
+ <xsd:enumeration value="C45"/>
+ <xsd:enumeration value="C46"/>
+ <xsd:enumeration value="C47"/>
+ <xsd:enumeration value="C48"/>
+ <xsd:enumeration value="C49"/>
+ <xsd:enumeration value="C5"/>
+ <xsd:enumeration value="C50"/>
+ <xsd:enumeration value="C51"/>
+ <xsd:enumeration value="C52"/>
+ <xsd:enumeration value="C53"/>
+ <xsd:enumeration value="C54"/>
+ <xsd:enumeration value="C55"/>
+ <xsd:enumeration value="C56"/>
+ <xsd:enumeration value="C57"/>
+ <xsd:enumeration value="C58"/>
+ <xsd:enumeration value="C59"/>
+ <xsd:enumeration value="C6"/>
+ <xsd:enumeration value="C60"/>
+ <xsd:enumeration value="C61"/>
+ <xsd:enumeration value="C62"/>
+ <xsd:enumeration value="C63"/>
+ <xsd:enumeration value="C64"/>
+ <xsd:enumeration value="C65"/>
+ <xsd:enumeration value="C66"/>
+ <xsd:enumeration value="C67"/>
+ <xsd:enumeration value="C68"/>
+ <xsd:enumeration value="C69"/>
+ <xsd:enumeration value="C7"/>
+ <xsd:enumeration value="C70"/>
+ <xsd:enumeration value="C71"/>
+ <xsd:enumeration value="C72"/>
+ <xsd:enumeration value="C73"/>
+ <xsd:enumeration value="C75"/>
+ <xsd:enumeration value="C76"/>
+ <xsd:enumeration value="C77"/>
+ <xsd:enumeration value="C78"/>
+ <xsd:enumeration value="C8"/>
+ <xsd:enumeration value="C80"/>
+ <xsd:enumeration value="C81"/>
+ <xsd:enumeration value="C82"/>
+ <xsd:enumeration value="C83"/>
+ <xsd:enumeration value="C84"/>
+ <xsd:enumeration value="C85"/>
+ <xsd:enumeration value="C86"/>
+ <xsd:enumeration value="C87"/>
+ <xsd:enumeration value="C88"/>
+ <xsd:enumeration value="C89"/>
+ <xsd:enumeration value="C9"/>
+ <xsd:enumeration value="C90"/>
+ <xsd:enumeration value="C91"/>
+ <xsd:enumeration value="C92"/>
+ <xsd:enumeration value="C93"/>
+ <xsd:enumeration value="C94"/>
+ <xsd:enumeration value="C95"/>
+ <xsd:enumeration value="C96"/>
+ <xsd:enumeration value="C97"/>
+ <xsd:enumeration value="C98"/>
+ <xsd:enumeration value="C99"/>
+ <xsd:enumeration value="CA"/>
+ <xsd:enumeration value="CCT"/>
+ <xsd:enumeration value="CD"/>
+ <xsd:enumeration value="CDL"/>
+ <xsd:enumeration value="CE"/>
+ <xsd:enumeration value="CEL"/>
+ <xsd:enumeration value="CEN"/>
+ <xsd:enumeration value="CG"/>
+ <xsd:enumeration value="CGM"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CJ"/>
+ <xsd:enumeration value="CK"/>
+ <xsd:enumeration value="CKG"/>
+ <xsd:enumeration value="CL"/>
+ <xsd:enumeration value="CLF"/>
+ <xsd:enumeration value="CLT"/>
+ <xsd:enumeration value="CMK"/>
+ <xsd:enumeration value="CMQ"/>
+ <xsd:enumeration value="CMT"/>
+ <xsd:enumeration value="CNP"/>
+ <xsd:enumeration value="CNT"/>
+ <xsd:enumeration value="CO"/>
+ <xsd:enumeration value="COU"/>
+ <xsd:enumeration value="CQ"/>
+ <xsd:enumeration value="CR"/>
+ <xsd:enumeration value="CS"/>
+ <xsd:enumeration value="CT"/>
+ <xsd:enumeration value="CTM"/>
+ <xsd:enumeration value="CU"/>
+ <xsd:enumeration value="CUR"/>
+ <xsd:enumeration value="CV"/>
+ <xsd:enumeration value="CWA"/>
+ <xsd:enumeration value="CWI"/>
+ <xsd:enumeration value="CY"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="D1"/>
+ <xsd:enumeration value="D10"/>
+ <xsd:enumeration value="D12"/>
+ <xsd:enumeration value="D13"/>
+ <xsd:enumeration value="D14"/>
+ <xsd:enumeration value="D16"/>
+ <xsd:enumeration value="D17"/>
+ <xsd:enumeration value="D18"/>
+ <xsd:enumeration value="D19"/>
+ <xsd:enumeration value="D2"/>
+ <xsd:enumeration value="D20"/>
+ <xsd:enumeration value="D21"/>
+ <xsd:enumeration value="D22"/>
+ <xsd:enumeration value="D23"/>
+ <xsd:enumeration value="D24"/>
+ <xsd:enumeration value="D25"/>
+ <xsd:enumeration value="D26"/>
+ <xsd:enumeration value="D27"/>
+ <xsd:enumeration value="D28"/>
+ <xsd:enumeration value="D29"/>
+ <xsd:enumeration value="D30"/>
+ <xsd:enumeration value="D31"/>
+ <xsd:enumeration value="D33"/>
+ <xsd:enumeration value="D34"/>
+ <xsd:enumeration value="D35"/>
+ <xsd:enumeration value="D37"/>
+ <xsd:enumeration value="D38"/>
+ <xsd:enumeration value="D39"/>
+ <xsd:enumeration value="D40"/>
+ <xsd:enumeration value="D41"/>
+ <xsd:enumeration value="D42"/>
+ <xsd:enumeration value="D43"/>
+ <xsd:enumeration value="D44"/>
+ <xsd:enumeration value="D45"/>
+ <xsd:enumeration value="D46"/>
+ <xsd:enumeration value="D47"/>
+ <xsd:enumeration value="D48"/>
+ <xsd:enumeration value="D49"/>
+ <xsd:enumeration value="D5"/>
+ <xsd:enumeration value="D50"/>
+ <xsd:enumeration value="D51"/>
+ <xsd:enumeration value="D52"/>
+ <xsd:enumeration value="D53"/>
+ <xsd:enumeration value="D54"/>
+ <xsd:enumeration value="D55"/>
+ <xsd:enumeration value="D56"/>
+ <xsd:enumeration value="D57"/>
+ <xsd:enumeration value="D58"/>
+ <xsd:enumeration value="D59"/>
+ <xsd:enumeration value="D6"/>
+ <xsd:enumeration value="D60"/>
+ <xsd:enumeration value="D63"/>
+ <xsd:enumeration value="D64"/>
+ <xsd:enumeration value="D65"/>
+ <xsd:enumeration value="D66"/>
+ <xsd:enumeration value="D67"/>
+ <xsd:enumeration value="D69"/>
+ <xsd:enumeration value="D7"/>
+ <xsd:enumeration value="D70"/>
+ <xsd:enumeration value="D71"/>
+ <xsd:enumeration value="D72"/>
+ <xsd:enumeration value="D73"/>
+ <xsd:enumeration value="D74"/>
+ <xsd:enumeration value="D75"/>
+ <xsd:enumeration value="D76"/>
+ <xsd:enumeration value="D77"/>
+ <xsd:enumeration value="D79"/>
+ <xsd:enumeration value="D8"/>
+ <xsd:enumeration value="D80"/>
+ <xsd:enumeration value="D81"/>
+ <xsd:enumeration value="D82"/>
+ <xsd:enumeration value="D83"/>
+ <xsd:enumeration value="D85"/>
+ <xsd:enumeration value="D86"/>
+ <xsd:enumeration value="D87"/>
+ <xsd:enumeration value="D88"/>
+ <xsd:enumeration value="D89"/>
+ <xsd:enumeration value="D9"/>
+ <xsd:enumeration value="D90"/>
+ <xsd:enumeration value="D91"/>
+ <xsd:enumeration value="D92"/>
+ <xsd:enumeration value="D93"/>
+ <xsd:enumeration value="D94"/>
+ <xsd:enumeration value="D95"/>
+ <xsd:enumeration value="D96"/>
+ <xsd:enumeration value="D97"/>
+ <xsd:enumeration value="D98"/>
+ <xsd:enumeration value="D99"/>
+ <xsd:enumeration value="DAA"/>
+ <xsd:enumeration value="DAD"/>
+ <xsd:enumeration value="DAY"/>
+ <xsd:enumeration value="DB"/>
+ <xsd:enumeration value="DC"/>
+ <xsd:enumeration value="DD"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DEC"/>
+ <xsd:enumeration value="DF"/>
+ <xsd:enumeration value="DG"/>
+ <xsd:enumeration value="DH"/>
+ <xsd:enumeration value="DI"/>
+ <xsd:enumeration value="DJ"/>
+ <xsd:enumeration value="DLT"/>
+ <xsd:enumeration value="DMK"/>
+ <xsd:enumeration value="DMQ"/>
+ <xsd:enumeration value="DMT"/>
+ <xsd:enumeration value="DN"/>
+ <xsd:enumeration value="DO"/>
+ <xsd:enumeration value="DPC"/>
+ <xsd:enumeration value="DPR"/>
+ <xsd:enumeration value="DPT"/>
+ <xsd:enumeration value="DQ"/>
+ <xsd:enumeration value="DR"/>
+ <xsd:enumeration value="DRA"/>
+ <xsd:enumeration value="DRI"/>
+ <xsd:enumeration value="DRL"/>
+ <xsd:enumeration value="DRM"/>
+ <xsd:enumeration value="DS"/>
+ <xsd:enumeration value="DT"/>
+ <xsd:enumeration value="DTN"/>
+ <xsd:enumeration value="DU"/>
+ <xsd:enumeration value="DWT"/>
+ <xsd:enumeration value="DX"/>
+ <xsd:enumeration value="DY"/>
+ <xsd:enumeration value="DZN"/>
+ <xsd:enumeration value="DZP"/>
+ <xsd:enumeration value="E2"/>
+ <xsd:enumeration value="E3"/>
+ <xsd:enumeration value="E4"/>
+ <xsd:enumeration value="E5"/>
+ <xsd:enumeration value="E9"/>
+ <xsd:enumeration value="EA"/>
+ <xsd:enumeration value="EB"/>
+ <xsd:enumeration value="EC"/>
+ <xsd:enumeration value="EP"/>
+ <xsd:enumeration value="EQ"/>
+ <xsd:enumeration value="EV"/>
+ <xsd:enumeration value="EX"/>
+ <xsd:enumeration value="EZ"/>
+ <xsd:enumeration value="F1"/>
+ <xsd:enumeration value="F9"/>
+ <xsd:enumeration value="FAH"/>
+ <xsd:enumeration value="FAR"/>
+ <xsd:enumeration value="FB"/>
+ <xsd:enumeration value="FC"/>
+ <xsd:enumeration value="FD"/>
+ <xsd:enumeration value="FE"/>
+ <xsd:enumeration value="FF"/>
+ <xsd:enumeration value="FG"/>
+ <xsd:enumeration value="FH"/>
+ <xsd:enumeration value="FL"/>
+ <xsd:enumeration value="FM"/>
+ <xsd:enumeration value="FO"/>
+ <xsd:enumeration value="FOT"/>
+ <xsd:enumeration value="FP"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="FS"/>
+ <xsd:enumeration value="FTK"/>
+ <xsd:enumeration value="FTQ"/>
+ <xsd:enumeration value="FZ"/>
+ <xsd:enumeration value="G2"/>
+ <xsd:enumeration value="G3"/>
+ <xsd:enumeration value="G5"/>
+ <xsd:enumeration value="G7"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GBQ"/>
+ <xsd:enumeration value="GC"/>
+ <xsd:enumeration value="GD"/>
+ <xsd:enumeration value="GE"/>
+ <xsd:enumeration value="GF"/>
+ <xsd:enumeration value="GFI"/>
+ <xsd:enumeration value="GG"/>
+ <xsd:enumeration value="GGR"/>
+ <xsd:enumeration value="GH"/>
+ <xsd:enumeration value="GI"/>
+ <xsd:enumeration value="GIA"/>
+ <xsd:enumeration value="GII"/>
+ <xsd:enumeration value="GJ"/>
+ <xsd:enumeration value="GK"/>
+ <xsd:enumeration value="GL"/>
+ <xsd:enumeration value="GLD"/>
+ <xsd:enumeration value="GLI"/>
+ <xsd:enumeration value="GLL"/>
+ <xsd:enumeration value="GM"/>
+ <xsd:enumeration value="GN"/>
+ <xsd:enumeration value="GO"/>
+ <xsd:enumeration value="GP"/>
+ <xsd:enumeration value="GQ"/>
+ <xsd:enumeration value="GRM"/>
+ <xsd:enumeration value="GRN"/>
+ <xsd:enumeration value="GRO"/>
+ <xsd:enumeration value="GRT"/>
+ <xsd:enumeration value="GT"/>
+ <xsd:enumeration value="GV"/>
+ <xsd:enumeration value="GW"/>
+ <xsd:enumeration value="GWH"/>
+ <xsd:enumeration value="GY"/>
+ <xsd:enumeration value="GZ"/>
+ <xsd:enumeration value="H1"/>
+ <xsd:enumeration value="H2"/>
+ <xsd:enumeration value="HA"/>
+ <xsd:enumeration value="HAR"/>
+ <xsd:enumeration value="HBA"/>
+ <xsd:enumeration value="HBX"/>
+ <xsd:enumeration value="HC"/>
+ <xsd:enumeration value="HD"/>
+ <xsd:enumeration value="HE"/>
+ <xsd:enumeration value="HF"/>
+ <xsd:enumeration value="HGM"/>
+ <xsd:enumeration value="HH"/>
+ <xsd:enumeration value="HI"/>
+ <xsd:enumeration value="HIU"/>
+ <xsd:enumeration value="HJ"/>
+ <xsd:enumeration value="HK"/>
+ <xsd:enumeration value="HL"/>
+ <xsd:enumeration value="HLT"/>
+ <xsd:enumeration value="HM"/>
+ <xsd:enumeration value="HMQ"/>
+ <xsd:enumeration value="HMT"/>
+ <xsd:enumeration value="HN"/>
+ <xsd:enumeration value="HO"/>
+ <xsd:enumeration value="HP"/>
+ <xsd:enumeration value="HPA"/>
+ <xsd:enumeration value="HS"/>
+ <xsd:enumeration value="HT"/>
+ <xsd:enumeration value="HTZ"/>
+ <xsd:enumeration value="HUR"/>
+ <xsd:enumeration value="HV"/>
+ <xsd:enumeration value="HW"/>
+ <xsd:enumeration value="HY"/>
+ <xsd:enumeration value="IA"/>
+ <xsd:enumeration value="IB"/>
+ <xsd:enumeration value="IC"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IF"/>
+ <xsd:enumeration value="II"/>
+ <xsd:enumeration value="IL"/>
+ <xsd:enumeration value="IM"/>
+ <xsd:enumeration value="INH"/>
+ <xsd:enumeration value="INK"/>
+ <xsd:enumeration value="INQ"/>
+ <xsd:enumeration value="IP"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="IU"/>
+ <xsd:enumeration value="IV"/>
+ <xsd:enumeration value="IW"/>
+ <xsd:enumeration value="J2"/>
+ <xsd:enumeration value="JB"/>
+ <xsd:enumeration value="JE"/>
+ <xsd:enumeration value="JG"/>
+ <xsd:enumeration value="JK"/>
+ <xsd:enumeration value="JM"/>
+ <xsd:enumeration value="JO"/>
+ <xsd:enumeration value="JOU"/>
+ <xsd:enumeration value="JR"/>
+ <xsd:enumeration value="K1"/>
+ <xsd:enumeration value="K2"/>
+ <xsd:enumeration value="K3"/>
+ <xsd:enumeration value="K5"/>
+ <xsd:enumeration value="K6"/>
+ <xsd:enumeration value="KA"/>
+ <xsd:enumeration value="KB"/>
+ <xsd:enumeration value="KBA"/>
+ <xsd:enumeration value="KD"/>
+ <xsd:enumeration value="KEL"/>
+ <xsd:enumeration value="KF"/>
+ <xsd:enumeration value="KG"/>
+ <xsd:enumeration value="KGM"/>
+ <xsd:enumeration value="KGS"/>
+ <xsd:enumeration value="KHZ"/>
+ <xsd:enumeration value="KI"/>
+ <xsd:enumeration value="KJ"/>
+ <xsd:enumeration value="KJO"/>
+ <xsd:enumeration value="KK"/>
+ <xsd:enumeration value="KL"/>
+ <xsd:enumeration value="KMH"/>
+ <xsd:enumeration value="KMK"/>
+ <xsd:enumeration value="KMQ"/>
+ <xsd:enumeration value="KNI"/>
+ <xsd:enumeration value="KNS"/>
+ <xsd:enumeration value="KNT"/>
+ <xsd:enumeration value="KO"/>
+ <xsd:enumeration value="KPA"/>
+ <xsd:enumeration value="KPH"/>
+ <xsd:enumeration value="KPO"/>
+ <xsd:enumeration value="KPP"/>
+ <xsd:enumeration value="KR"/>
+ <xsd:enumeration value="KS"/>
+ <xsd:enumeration value="KSD"/>
+ <xsd:enumeration value="KSH"/>
+ <xsd:enumeration value="KT"/>
+ <xsd:enumeration value="KMT"/>
+ <xsd:enumeration value="KTN"/>
+ <xsd:enumeration value="KUR"/>
+ <xsd:enumeration value="KVA"/>
+ <xsd:enumeration value="KVR"/>
+ <xsd:enumeration value="KVT"/>
+ <xsd:enumeration value="KW"/>
+ <xsd:enumeration value="KWH"/>
+ <xsd:enumeration value="KWT"/>
+ <xsd:enumeration value="KX"/>
+ <xsd:enumeration value="L2"/>
+ <xsd:enumeration value="LA"/>
+ <xsd:enumeration value="LBR"/>
+ <xsd:enumeration value="LBT"/>
+ <xsd:enumeration value="LC"/>
+ <xsd:enumeration value="LD"/>
+ <xsd:enumeration value="LE"/>
+ <xsd:enumeration value="LEF"/>
+ <xsd:enumeration value="LF"/>
+ <xsd:enumeration value="LG"/>
+ <xsd:enumeration value="LH"/>
+ <xsd:enumeration value="LI"/>
+ <xsd:enumeration value="LJ"/>
+ <xsd:enumeration value="LK"/>
+ <xsd:enumeration value="LM"/>
+ <xsd:enumeration value="LN"/>
+ <xsd:enumeration value="LO"/>
+ <xsd:enumeration value="LP"/>
+ <xsd:enumeration value="LPA"/>
+ <xsd:enumeration value="LR"/>
+ <xsd:enumeration value="LS"/>
+ <xsd:enumeration value="LTN"/>
+ <xsd:enumeration value="LTR"/>
+ <xsd:enumeration value="LUM"/>
+ <xsd:enumeration value="LUX"/>
+ <xsd:enumeration value="LX"/>
+ <xsd:enumeration value="LY"/>
+ <xsd:enumeration value="M0"/>
+ <xsd:enumeration value="M1"/>
+ <xsd:enumeration value="M2"/>
+ <xsd:enumeration value="M4"/>
+ <xsd:enumeration value="M5"/>
+ <xsd:enumeration value="M7"/>
+ <xsd:enumeration value="M9"/>
+ <xsd:enumeration value="MA"/>
+ <xsd:enumeration value="MAL"/>
+ <xsd:enumeration value="MAM"/>
+ <xsd:enumeration value="MAW"/>
+ <xsd:enumeration value="MB"/>
+ <xsd:enumeration value="MBE"/>
+ <xsd:enumeration value="MBF"/>
+ <xsd:enumeration value="MBR"/>
+ <xsd:enumeration value="MC"/>
+ <xsd:enumeration value="MCU"/>
+ <xsd:enumeration value="MD"/>
+ <xsd:enumeration value="MF"/>
+ <xsd:enumeration value="MGM"/>
+ <xsd:enumeration value="MH"/>
+ <xsd:enumeration value="MHZ"/>
+ <xsd:enumeration value="MI"/>
+ <xsd:enumeration value="MIK"/>
+ <xsd:enumeration value="MIL"/>
+ <xsd:enumeration value="MIN"/>
+ <xsd:enumeration value="MIO"/>
+ <xsd:enumeration value="MIU"/>
+ <xsd:enumeration value="MK"/>
+ <xsd:enumeration value="MLD"/>
+ <xsd:enumeration value="MLT"/>
+ <xsd:enumeration value="MMK"/>
+ <xsd:enumeration value="MMQ"/>
+ <xsd:enumeration value="MMT"/>
+ <xsd:enumeration value="MON"/>
+ <xsd:enumeration value="MPA"/>
+ <xsd:enumeration value="MQ"/>
+ <xsd:enumeration value="MQH"/>
+ <xsd:enumeration value="MQS"/>
+ <xsd:enumeration value="MSK"/>
+ <xsd:enumeration value="MT"/>
+ <xsd:enumeration value="MTK"/>
+ <xsd:enumeration value="MTQ"/>
+ <xsd:enumeration value="MTR"/>
+ <xsd:enumeration value="MTS"/>
+ <xsd:enumeration value="MV"/>
+ <xsd:enumeration value="MVA"/>
+ <xsd:enumeration value="MW"/>
+ <xsd:enumeration value="MWH"/>
+ <xsd:enumeration value="MX"/>
+ <xsd:enumeration value="MY"/>
+ <xsd:enumeration value="MZ"/>
+ <xsd:enumeration value="N1"/>
+ <xsd:enumeration value="N2"/>
+ <xsd:enumeration value="N3"/>
+ <xsd:enumeration value="NA"/>
+ <xsd:enumeration value="NAR"/>
+ <xsd:enumeration value="NB"/>
+ <xsd:enumeration value="NBB"/>
+ <xsd:enumeration value="NC"/>
+ <xsd:enumeration value="NCL"/>
+ <xsd:enumeration value="ND"/>
+ <xsd:enumeration value="NE"/>
+ <xsd:enumeration value="NEW"/>
+ <xsd:enumeration value="NF"/>
+ <xsd:enumeration value="NG"/>
+ <xsd:enumeration value="NH"/>
+ <xsd:enumeration value="NI"/>
+ <xsd:enumeration value="NIU"/>
+ <xsd:enumeration value="NJ"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NMI"/>
+ <xsd:enumeration value="NMP"/>
+ <xsd:enumeration value="NN"/>
+ <xsd:enumeration value="NPL"/>
+ <xsd:enumeration value="NPR"/>
+ <xsd:enumeration value="NPT"/>
+ <xsd:enumeration value="NQ"/>
+ <xsd:enumeration value="NR"/>
+ <xsd:enumeration value="NRL"/>
+ <xsd:enumeration value="NT"/>
+ <xsd:enumeration value="NTT"/>
+ <xsd:enumeration value="NU"/>
+ <xsd:enumeration value="NV"/>
+ <xsd:enumeration value="NX"/>
+ <xsd:enumeration value="NY"/>
+ <xsd:enumeration value="OA"/>
+ <xsd:enumeration value="OHM"/>
+ <xsd:enumeration value="ON"/>
+ <xsd:enumeration value="ONZ"/>
+ <xsd:enumeration value="OP"/>
+ <xsd:enumeration value="OT"/>
+ <xsd:enumeration value="OZ"/>
+ <xsd:enumeration value="OZA"/>
+ <xsd:enumeration value="OZI"/>
+ <xsd:enumeration value="P0"/>
+ <xsd:enumeration value="P1"/>
+ <xsd:enumeration value="P2"/>
+ <xsd:enumeration value="P3"/>
+ <xsd:enumeration value="P4"/>
+ <xsd:enumeration value="P5"/>
+ <xsd:enumeration value="P6"/>
+ <xsd:enumeration value="P7"/>
+ <xsd:enumeration value="P8"/>
+ <xsd:enumeration value="P9"/>
+ <xsd:enumeration value="PA"/>
+ <xsd:enumeration value="PAL"/>
+ <xsd:enumeration value="PB"/>
+ <xsd:enumeration value="PD"/>
+ <xsd:enumeration value="PE"/>
+ <xsd:enumeration value="PF"/>
+ <xsd:enumeration value="PG"/>
+ <xsd:enumeration value="PGL"/>
+ <xsd:enumeration value="PI"/>
+ <xsd:enumeration value="PK"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PN"/>
+ <xsd:enumeration value="PO"/>
+ <xsd:enumeration value="PQ"/>
+ <xsd:enumeration value="PR"/>
+ <xsd:enumeration value="PS"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PTD"/>
+ <xsd:enumeration value="PTI"/>
+ <xsd:enumeration value="PTL"/>
+ <xsd:enumeration value="PU"/>
+ <xsd:enumeration value="PV"/>
+ <xsd:enumeration value="PW"/>
+ <xsd:enumeration value="PY"/>
+ <xsd:enumeration value="PZ"/>
+ <xsd:enumeration value="Q1"/>
+ <xsd:enumeration value="Q2"/>
+ <xsd:enumeration value="Q3"/>
+ <xsd:enumeration value="Q4"/>
+ <xsd:enumeration value="Q5"/>
+ <xsd:enumeration value="Q6"/>
+ <xsd:enumeration value="Q7"/>
+ <xsd:enumeration value="QA"/>
+ <xsd:enumeration value="QAN"/>
+ <xsd:enumeration value="QB"/>
+ <xsd:enumeration value="QD"/>
+ <xsd:enumeration value="QH"/>
+ <xsd:enumeration value="QK"/>
+ <xsd:enumeration value="QR"/>
+ <xsd:enumeration value="QS"/>
+ <xsd:enumeration value="QT"/>
+ <xsd:enumeration value="QTD"/>
+ <xsd:enumeration value="QTI"/>
+ <xsd:enumeration value="QTL"/>
+ <xsd:enumeration value="QTR"/>
+ <xsd:enumeration value="R1"/>
+ <xsd:enumeration value="R4"/>
+ <xsd:enumeration value="R5"/>
+ <xsd:enumeration value="R6"/>
+ <xsd:enumeration value="R9"/>
+ <xsd:enumeration value="RA"/>
+ <xsd:enumeration value="RD"/>
+ <xsd:enumeration value="RG"/>
+ <xsd:enumeration value="RH"/>
+ <xsd:enumeration value="RK"/>
+ <xsd:enumeration value="RL"/>
+ <xsd:enumeration value="RM"/>
+ <xsd:enumeration value="RN"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RP"/>
+ <xsd:enumeration value="RPM"/>
+ <xsd:enumeration value="RPS"/>
+ <xsd:enumeration value="RS"/>
+ <xsd:enumeration value="RT"/>
+ <xsd:enumeration value="RU"/>
+ <xsd:enumeration value="S3"/>
+ <xsd:enumeration value="S4"/>
+ <xsd:enumeration value="S5"/>
+ <xsd:enumeration value="S6"/>
+ <xsd:enumeration value="S7"/>
+ <xsd:enumeration value="S8"/>
+ <xsd:enumeration value="SA"/>
+ <xsd:enumeration value="SAN"/>
+ <xsd:enumeration value="SCO"/>
+ <xsd:enumeration value="SCR"/>
+ <xsd:enumeration value="SD"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SEC"/>
+ <xsd:enumeration value="SET"/>
+ <xsd:enumeration value="SG"/>
+ <xsd:enumeration value="SHT"/>
+ <xsd:enumeration value="SIE"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SL"/>
+ <xsd:enumeration value="SMI"/>
+ <xsd:enumeration value="SN"/>
+ <xsd:enumeration value="SO"/>
+ <xsd:enumeration value="SP"/>
+ <xsd:enumeration value="SQ"/>
+ <xsd:enumeration value="SR"/>
+ <xsd:enumeration value="SS"/>
+ <xsd:enumeration value="SST"/>
+ <xsd:enumeration value="ST"/>
+ <xsd:enumeration value="STI"/>
+ <xsd:enumeration value="STN"/>
+ <xsd:enumeration value="SV"/>
+ <xsd:enumeration value="SW"/>
+ <xsd:enumeration value="SX"/>
+ <xsd:enumeration value="T0"/>
+ <xsd:enumeration value="T1"/>
+ <xsd:enumeration value="T2"/>
+ <xsd:enumeration value="T3"/>
+ <xsd:enumeration value="T4"/>
+ <xsd:enumeration value="T5"/>
+ <xsd:enumeration value="T6"/>
+ <xsd:enumeration value="T7"/>
+ <xsd:enumeration value="T8"/>
+ <xsd:enumeration value="T9"/>
+ <xsd:enumeration value="TA"/>
+ <xsd:enumeration value="TAH"/>
+ <xsd:enumeration value="TC"/>
+ <xsd:enumeration value="TD"/>
+ <xsd:enumeration value="TE"/>
+ <xsd:enumeration value="TF"/>
+ <xsd:enumeration value="TI"/>
+ <xsd:enumeration value="TJ"/>
+ <xsd:enumeration value="TK"/>
+ <xsd:enumeration value="TL"/>
+ <xsd:enumeration value="TM"/>
+ <xsd:enumeration value="TN"/>
+ <xsd:enumeration value="TNE"/>
+ <xsd:enumeration value="TP"/>
+ <xsd:enumeration value="TPR"/>
+ <xsd:enumeration value="TQ"/>
+ <xsd:enumeration value="TQD"/>
+ <xsd:enumeration value="TR"/>
+ <xsd:enumeration value="TRL"/>
+ <xsd:enumeration value="TS"/>
+ <xsd:enumeration value="TSD"/>
+ <xsd:enumeration value="TSH"/>
+ <xsd:enumeration value="TT"/>
+ <xsd:enumeration value="TU"/>
+ <xsd:enumeration value="TV"/>
+ <xsd:enumeration value="TW"/>
+ <xsd:enumeration value="TY"/>
+ <xsd:enumeration value="U1"/>
+ <xsd:enumeration value="U2"/>
+ <xsd:enumeration value="U3"/>
+ <xsd:enumeration value="U5"/>
+ <xsd:enumeration value="UA"/>
+ <xsd:enumeration value="UB"/>
+ <xsd:enumeration value="UC"/>
+ <xsd:enumeration value="UD"/>
+ <xsd:enumeration value="UE"/>
+ <xsd:enumeration value="UF"/>
+ <xsd:enumeration value="UH"/>
+ <xsd:enumeration value="UL"/>
+ <xsd:enumeration value="UM"/>
+ <xsd:enumeration value="VA"/>
+ <xsd:enumeration value="VC"/>
+ <xsd:enumeration value="VI"/>
+ <xsd:enumeration value="VLT"/>
+ <xsd:enumeration value="VQ"/>
+ <xsd:enumeration value="VS"/>
+ <xsd:enumeration value="VT"/>
+ <xsd:enumeration value="W2"/>
+ <xsd:enumeration value="W4"/>
+ <xsd:enumeration value="WA"/>
+ <xsd:enumeration value="WB"/>
+ <xsd:enumeration value="WCD"/>
+ <xsd:enumeration value="WE"/>
+ <xsd:enumeration value="WEB"/>
+ <xsd:enumeration value="WEE"/>
+ <xsd:enumeration value="WG"/>
+ <xsd:enumeration value="WH"/>
+ <xsd:enumeration value="WHR"/>
+ <xsd:enumeration value="WI"/>
+ <xsd:enumeration value="WM"/>
+ <xsd:enumeration value="WR"/>
+ <xsd:enumeration value="WSD"/>
+ <xsd:enumeration value="WTT"/>
+ <xsd:enumeration value="WW"/>
+ <xsd:enumeration value="X1"/>
+ <xsd:enumeration value="YDK"/>
+ <xsd:enumeration value="YDQ"/>
+ <xsd:enumeration value="YL"/>
+ <xsd:enumeration value="YRD"/>
+ <xsd:enumeration value="YT"/>
+ <xsd:enumeration value="Z1"/>
+ <xsd:enumeration value="Z2"/>
+ <xsd:enumeration value="Z3"/>
+ <xsd:enumeration value="Z4"/>
+ <xsd:enumeration value="Z5"/>
+ <xsd:enumeration value="Z6"/>
+ <xsd:enumeration value="Z8"/>
+ <xsd:enumeration value="ZP"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="DimensionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ConsolidatedWeight"/>
+ <xsd:enumeration value="UnitNetWeight"/>
+ <xsd:enumeration value="UnitGrossWeight"/>
+ <xsd:enumeration value="TotalNetWeight"/>
+ <xsd:enumeration value="TotalGrossWeight"/>
+ <xsd:enumeration value="ItemGrossWeight"/>
+ <xsd:enumeration value="NetNetWeight"/>
+ <xsd:enumeration value="NumberOfUnitsPerPallet"/>
+ <xsd:enumeration value="FatContent"/>
+ <xsd:enumeration value="NetWeight"/>
+ <xsd:enumeration value="GrossTonnageOfTheVessel"/>
+ <xsd:enumeration value="NetTonnageOfTheVessel"/>
+ <xsd:enumeration value="Humidity"/>
+ <xsd:enumeration value="Voltage"/>
+ <xsd:enumeration value="PowerConsumption"/>
+ <xsd:enumeration value="HeatDissipation"/>
+ <xsd:enumeration value="AirFlow"/>
+ <xsd:enumeration value="ShockImpact"/>
+ <xsd:enumeration value="OperativeTemperature"/>
+ <xsd:enumeration value="NonOperativeTemperature"/>
+ <xsd:enumeration value="GrossVolume"/>
+ <xsd:enumeration value="NetVolume"/>
+ <xsd:enumeration value="WaterContent"/>
+ <xsd:enumeration value="TensileStress"/>
+ <xsd:enumeration value="Fibrosity"/>
+ <xsd:enumeration value="GaugeLength"/>
+ <xsd:enumeration value="Radius"/>
+ <xsd:enumeration value="Straightness"/>
+ <xsd:enumeration value="Strain"/>
+ <xsd:enumeration value="Volume"/>
+ <xsd:enumeration value="ItemWeight"/>
+ <xsd:enumeration value="WeightOfConveyance"/>
+ <xsd:enumeration value="ConveyanceSummerDeadWeight"/>
+ <xsd:enumeration value="ContainerizedCargoOnVesselsWeight"/>
+ <xsd:enumeration value="Non-ContainerizedCargoOnVesselsWeight"/>
+ <xsd:enumeration value="WeightAscertained"/>
+ <xsd:enumeration value="ChargeableWeight"/>
+ <xsd:enumeration value="EstimatedGrossWeight"/>
+ <xsd:enumeration value="EstimatedVolume"/>
+ <xsd:enumeration value="VesselOverallLength"/>
+ <xsd:enumeration value="LoadingMeters"/>
+ <xsd:enumeration value="NumberOfAxles"/>
+ <xsd:enumeration value="Payload"/>
+ <xsd:enumeration value="StartPositionInTheLength"/>
+ <xsd:enumeration value="EndPositionInTheLength"/>
+ <xsd:enumeration value="StartPositionInTheWidth"/>
+ <xsd:enumeration value="EndPositionInTheWidth"/>
+ <xsd:enumeration value="StartPositionInTheThickness"/>
+ <xsd:enumeration value="EndPositionInTheThickness"/>
+ <xsd:enumeration value="TransportContainerActualFillingWeight"/>
+ <xsd:enumeration value="TransportContainerMaximumCapacity"/>
+ <xsd:enumeration value="DeclaredNetWeight"/>
+ <xsd:enumeration value="LoadingHeight"/>
+ <xsd:enumeration value="StackingHeight"/>
+ <xsd:enumeration value="CalculatedWeight"/>
+ <xsd:enumeration value="Ferrite"/>
+ <xsd:enumeration value="Impurity"/>
+ <xsd:enumeration value="GrainSize"/>
+ <xsd:enumeration value="Lanthanides"/>
+ <xsd:enumeration value="Elasticity"/>
+ <xsd:enumeration value="DrainedWeight"/>
+ <xsd:enumeration value="Gallium"/>
+ <xsd:enumeration value="Strontium"/>
+ <xsd:enumeration value="EquipmentStorageLimitation"/>
+ <xsd:enumeration value="RadioactiveIndexOfTransport"/>
+ <xsd:enumeration value="Radioactivity"/>
+ <xsd:enumeration value="AverageGrossWeight"/>
+ <xsd:enumeration value="ForwardDraft"/>
+ <xsd:enumeration value="AfterDraft"/>
+ <xsd:enumeration value="TransportEquipmentGrossWeight"/>
+ <xsd:enumeration value="TotalTransportEquipmentGrossWeight"/>
+ <xsd:enumeration value="AcidityOfJuice"/>
+ <xsd:enumeration value="Penetrometry"/>
+ <xsd:enumeration value="Durofel"/>
+ <xsd:enumeration value="JuiceWeightPer100Grams"/>
+ <xsd:enumeration value="FruitSkinColour"/>
+ <xsd:enumeration value="AngleOfBend"/>
+ <xsd:enumeration value="FixedIncrementalMeasurement"/>
+ <xsd:enumeration value="DurofelD10"/>
+ <xsd:enumeration value="DurofelD25"/>
+ <xsd:enumeration value="DurofelD50"/>
+ <xsd:enumeration value="MaximumStackingWeight"/>
+ <xsd:enumeration value="GrossMeasureCube"/>
+ <xsd:enumeration value="PercentageFatContentInDryMatter"/>
+ <xsd:enumeration value="SaccharometricContent"/>
+ <xsd:enumeration value="HydrateContentOfAnAlcoholicProductAfterBottling"/>
+ <xsd:enumeration value="AnhydrousContent"/>
+ <xsd:enumeration value="CertifiedWeight"/>
+ <xsd:enumeration value="BilledWeight"/>
+ <xsd:enumeration value="BreakingLoad"/>
+ <xsd:enumeration value="Platinum"/>
+ <xsd:enumeration value="Silver"/>
+ <xsd:enumeration value="List"/>
+ <xsd:enumeration value="Trim"/>
+ <xsd:enumeration value="FreeWater"/>
+ <xsd:enumeration value="Bands"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteGravity"/>
+ <xsd:enumeration value="PetroleumGrossObservedVolume"/>
+ <xsd:enumeration value="PetroleumGrossStandardVolume"/>
+ <xsd:enumeration value="VolumeVariance"/>
+ <xsd:enumeration value="PetroleumNetStandardVolume"/>
+ <xsd:enumeration value="MaterialOn-BoardQuantity-AfterDischarge"/>
+ <xsd:enumeration value="PetroleumTotalCalculatedVolume"/>
+ <xsd:enumeration value="PetroleumTotalObservedVolume"/>
+ <xsd:enumeration value="InnageGaugeDistance"/>
+ <xsd:enumeration value="PetroleumNetStandardWeight"/>
+ <xsd:enumeration value="SedimentAndWaterInPetroleum"/>
+ <xsd:enumeration value="ObservedReferenceHeight-Tank"/>
+ <xsd:enumeration value="ReferenceHeight-Tank"/>
+ <xsd:enumeration value="UllageGaugeDistance"/>
+ <xsd:enumeration value="TrimCorrection"/>
+ <xsd:enumeration value="BowToBridgeDistance"/>
+ <xsd:enumeration value="Brightness"/>
+ <xsd:enumeration value="Brakes"/>
+ <xsd:enumeration value="Break"/>
+ <xsd:enumeration value="BreakingStrength"/>
+ <xsd:enumeration value="BreakingStrengthWet"/>
+ <xsd:enumeration value="BasisWeight"/>
+ <xsd:enumeration value="Change"/>
+ <xsd:enumeration value="Colour"/>
+ <xsd:enumeration value="ContentsOfPackage"/>
+ <xsd:enumeration value="CommercialWeight"/>
+ <xsd:enumeration value="CoreLength"/>
+ <xsd:enumeration value="DestinationWeightAgreement"/>
+ <xsd:enumeration value="Diameter"/>
+ <xsd:enumeration value="DeltaValueL"/>
+ <xsd:enumeration value="Density"/>
+ <xsd:enumeration value="Depth"/>
+ <xsd:enumeration value="Denier"/>
+ <xsd:enumeration value="DistanceBetweenPoints"/>
+ <xsd:enumeration value="Width-BoxcarDoor"/>
+ <xsd:enumeration value="EstimatedNewWeight"/>
+ <xsd:enumeration value="Elongation"/>
+ <xsd:enumeration value="DeficitWeight"/>
+ <xsd:enumeration value="FilamentCount"/>
+ <xsd:enumeration value="LongitudinalFlatness"/>
+ <xsd:enumeration value="Flatness"/>
+ <xsd:enumeration value="TransverseFlatness"/>
+ <xsd:enumeration value="GrossWeight"/>
+ <xsd:enumeration value="Gauge"/>
+ <xsd:enumeration value="GrossWeight-Maximum"/>
+ <xsd:enumeration value="Hardness"/>
+ <xsd:enumeration value="Height-Maximum"/>
+ <xsd:enumeration value="HeightDimension"/>
+ <xsd:enumeration value="ImpactEnergy"/>
+ <xsd:enumeration value="InsideDiameter"/>
+ <xsd:enumeration value="LegalWeight"/>
+ <xsd:enumeration value="Length-Maximum"/>
+ <xsd:enumeration value="LengthDimension"/>
+ <xsd:enumeration value="LostEnd"/>
+ <xsd:enumeration value="MinimumWeight"/>
+ <xsd:enumeration value="Moisture"/>
+ <xsd:enumeration value="MaximumWeight"/>
+ <xsd:enumeration value="ActualNetWeight"/>
+ <xsd:enumeration value="OutsideDiameter"/>
+ <xsd:enumeration value="PreStretch"/>
+ <xsd:enumeration value="PerTonne"/>
+ <xsd:enumeration value="RelativeHumidity"/>
+ <xsd:enumeration value="Resistivity"/>
+ <xsd:enumeration value="RockwellC"/>
+ <xsd:enumeration value="ReamWeight"/>
+ <xsd:enumeration value="ReductionOfArea"/>
+ <xsd:enumeration value="Run-Process"/>
+ <xsd:enumeration value="Ratio"/>
+ <xsd:enumeration value="ShippedQuantity"/>
+ <xsd:enumeration value="TareWeight"/>
+ <xsd:enumeration value="Temperature"/>
+ <xsd:enumeration value="Thickness"/>
+ <xsd:enumeration value="TimePeriod"/>
+ <xsd:enumeration value="Time"/>
+ <xsd:enumeration value="WeightPerUnit"/>
+ <xsd:enumeration value="Height-VanDoor"/>
+ <xsd:enumeration value="Width-VanDoor"/>
+ <xsd:enumeration value="WeightPerUnitOfArea"/>
+ <xsd:enumeration value="WidthDimension"/>
+ <xsd:enumeration value="Width-Maximum"/>
+ <xsd:enumeration value="Weight"/>
+ <xsd:enumeration value="WeightPerUnitOfLength"/>
+ <xsd:enumeration value="SideHeight-FlatBedWithRemovableSides"/>
+ <xsd:enumeration value="Teir"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="Squareness"/>
+ <xsd:enumeration value="SpoolSize"/>
+ <xsd:enumeration value="YieldStress"/>
+ <xsd:enumeration value="Aluminium"/>
+ <xsd:enumeration value="Arsenic"/>
+ <xsd:enumeration value="Boron"/>
+ <xsd:enumeration value="Bismuth"/>
+ <xsd:enumeration value="Carbon"/>
+ <xsd:enumeration value="Calcium"/>
+ <xsd:enumeration value="Columbium"/>
+ <xsd:enumeration value="Cerium"/>
+ <xsd:enumeration value="Chlorine"/>
+ <xsd:enumeration value="Cobalt"/>
+ <xsd:enumeration value="Chromium"/>
+ <xsd:enumeration value="Copper"/>
+ <xsd:enumeration value="Iron"/>
+ <xsd:enumeration value="IronPlusSilicon"/>
+ <xsd:enumeration value="Germanium"/>
+ <xsd:enumeration value="Hydrogen"/>
+ <xsd:enumeration value="Potassium"/>
+ <xsd:enumeration value="Magnesium"/>
+ <xsd:enumeration value="Manganese"/>
+ <xsd:enumeration value="Molybdenum"/>
+ <xsd:enumeration value="Nitrogen"/>
+ <xsd:enumeration value="Sodium"/>
+ <xsd:enumeration value="Niobium"/>
+ <xsd:enumeration value="Nickel"/>
+ <xsd:enumeration value="Oxygen"/>
+ <xsd:enumeration value="Phosphorus"/>
+ <xsd:enumeration value="Lead"/>
+ <xsd:enumeration value="Sulphur"/>
+ <xsd:enumeration value="Antimony"/>
+ <xsd:enumeration value="Selenium"/>
+ <xsd:enumeration value="Silicon"/>
+ <xsd:enumeration value="SiliciumOxyd"/>
+ <xsd:enumeration value="Tin"/>
+ <xsd:enumeration value="Tantalium"/>
+ <xsd:enumeration value="Tellurium"/>
+ <xsd:enumeration value="Titanium"/>
+ <xsd:enumeration value="Vanadium"/>
+ <xsd:enumeration value="Tungsten"/>
+ <xsd:enumeration value="WasteContent"/>
+ <xsd:enumeration value="Zinc"/>
+ <xsd:enumeration value="Zirconium"/>
+ <xsd:enumeration value="StorageTemperature"/>
+ <xsd:enumeration value="TransportTemperature"/>
+ <xsd:enumeration value="CargoOperatingTemperature"/>
+ <xsd:enumeration value="TransportEmergencyTemperature"/>
+ <xsd:enumeration value="TransportControlTemperature"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfSealInfo">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="SealInfo"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfSealInfo" type="ListOfSealInfo"/>
+ <xsd:complexType name="SealInfo">
+ <xsd:sequence>
+ <xsd:element name="SealNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="SealIssuer"/>
+ <xsd:element minOccurs="0" ref="SealStatusDescription"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealInfo" type="SealInfo"/>
+ <xsd:complexType name="SealIssuer">
+ <xsd:sequence>
+ <xsd:element name="SealIssuerCoded" type="SealIssuerCode"/>
+ <xsd:element minOccurs="0" name="SealIssuerCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealIssuer" type="SealIssuer"/>
+ <xsd:simpleType name="SealIssuerCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Consolidator"/>
+ <xsd:enumeration value="Unknown"/>
+ <xsd:enumeration value="QuarantineAgency"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="Customs"/>
+ <xsd:enumeration value="Shipper"/>
+ <xsd:enumeration value="TerminalOperator"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="SealStatusDescription">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="SealStatusCoded" type="SealStatusCode"/>
+ <xsd:element minOccurs="0" name="SealStatusCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SealStatusInfo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealStatusDescription" type="SealStatusDescription"/>
+ <xsd:simpleType name="SealStatusCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Broken"/>
+ <xsd:enumeration value="Damaged"/>
+ <xsd:enumeration value="InRightCondition"/>
+ <xsd:enumeration value="Missing"/>
+ <xsd:enumeration value="Replaced"/>
+ <xsd:enumeration value="TheElectronicSealIsFaulty"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TransitDirection">
+ <xsd:sequence>
+ <xsd:element name="TransitDirectionCoded" type="TransitDirectionCode"/>
+ <xsd:element minOccurs="0" name="TransitDirectionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransitTimeQualifierCoded" type="TransitTimeQualifierCode"/>
+ <xsd:element minOccurs="0" name="TransitTimeQualifierCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransitTime" type="xsd:decimal"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransitDirection" type="TransitDirection"/>
+ <xsd:simpleType name="TransitDirectionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BuyerToSeller"/>
+ <xsd:enumeration value="SellerToBuyer"/>
+ <xsd:enumeration value="SubcontractorToSeller"/>
+ <xsd:enumeration value="SellerToDropShipDesignatedLocation"/>
+ <xsd:enumeration value="SellerToFreightForwarder"/>
+ <xsd:enumeration value="SellerToSubcontractor"/>
+ <xsd:enumeration value="MotherVesselToLighter"/>
+ <xsd:enumeration value="LighterToMotherVessel"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransitTimeQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AirHours"/>
+ <xsd:enumeration value="AirDays"/>
+ <xsd:enumeration value="CalendarDays"/>
+ <xsd:enumeration value="CalendarWeeks"/>
+ <xsd:enumeration value="Hours"/>
+ <xsd:enumeration value="SurfaceDays"/>
+ <xsd:enumeration value="SurfaceHours"/>
+ <xsd:enumeration value="WorkingDays"/>
+ <xsd:enumeration value="5DayWorkWeek"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TermsOfDelivery">
+ <xsd:sequence>
+ <xsd:element name="TermsOfDeliveryFunctionCoded" type="TermsOfDeliveryFunctionCode"/>
+ <xsd:element minOccurs="0" name="TermsOfDeliveryFunctionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportTermsCoded" type="TransportTermsCode"/>
+ <xsd:element minOccurs="0" name="TransportTermsCodedOther" type="xsd:string"/>
+ <xsd:element name="ShipmentMethodOfPaymentCoded" type="ShipmentMethodOfPaymentCode"/>
+ <xsd:element minOccurs="0" name="ShipmentMethodOfPaymentCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Location"/>
+ <xsd:element minOccurs="0" name="TermsOfDeliveryDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RiskOfLossCoded" type="RiskOfLossCode"/>
+ <xsd:element minOccurs="0" name="RiskOfLossCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RiskOfLossDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TermsOfDelivery" type="TermsOfDelivery"/>
+ <xsd:simpleType name="TermsOfDeliveryFunctionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="PriceCondition"/>
+ <xsd:enumeration value="DespatchCondition"/>
+ <xsd:enumeration value="PriceandDespatchCondition"/>
+ <xsd:enumeration value="CollectedByCustomer"/>
+ <xsd:enumeration value="TransportCondition"/>
+ <xsd:enumeration value="DeliveryCondition"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransportTermsCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Ex-Works"/>
+ <xsd:enumeration value="Free-Carrier"/>
+ <xsd:enumeration value="FreeAlongsideShip"/>
+ <xsd:enumeration value="FreeOnBoard"/>
+ <xsd:enumeration value="CostAndFreight"/>
+ <xsd:enumeration value="Cost-InsuranceAndFreight"/>
+ <xsd:enumeration value="CarriagePaidTo"/>
+ <xsd:enumeration value="Carriage-InsurancePaidTo"/>
+ <xsd:enumeration value="DeliveredAtFrontier"/>
+ <xsd:enumeration value="DeliveredEx-Ship"/>
+ <xsd:enumeration value="DeliveredEx-Quay"/>
+ <xsd:enumeration value="DeliveredDutyUnpaid"/>
+ <xsd:enumeration value="DeliveredDutyPaid"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ShipmentMethodOfPaymentCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Account"/>
+ <xsd:enumeration value="AdvanceCollect"/>
+ <xsd:enumeration value="AdvancePrepaid"/>
+ <xsd:enumeration value="CashOnDeliveryServiceChargePaidByConsignee"/>
+ <xsd:enumeration value="CashOnDeliveryServiceChargePaidByConsignor"/>
+ <xsd:enumeration value="Collect"/>
+ <xsd:enumeration value="CollectFreightCreditedToPaymentCustomer"/>
+ <xsd:enumeration value="CollectOnDelivery"/>
+ <xsd:enumeration value="CustomerPick-UpOrBackhaul"/>
+ <xsd:enumeration value="DefinedByBuyerAndSeller"/>
+ <xsd:enumeration value="FobPortOfCall"/>
+ <xsd:enumeration value="HalfPrepaid"/>
+ <xsd:enumeration value="InformationCopy-NoPaymentDue"/>
+ <xsd:enumeration value="InsuranceCostsPaidByConsignee"/>
+ <xsd:enumeration value="InsuranceCostsPaidByConsignor"/>
+ <xsd:enumeration value="Mixed"/>
+ <xsd:enumeration value="NonRevenue"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="PaidByBuyer"/>
+ <xsd:enumeration value="PaidBySupplierOrSeller"/>
+ <xsd:enumeration value="PayableElsewhere"/>
+ <xsd:enumeration value="PerContract"/>
+ <xsd:enumeration value="Pickup"/>
+ <xsd:enumeration value="PrepaidAndSummaryBill"/>
+ <xsd:enumeration value="PrepaidButChargedToCustomer"/>
+ <xsd:enumeration value="PrepaidByProcessor"/>
+ <xsd:enumeration value="Prepaid-BySeller"/>
+ <xsd:enumeration value="PrepaidLocalCollectOutstate"/>
+ <xsd:enumeration value="PrepaidOnly"/>
+ <xsd:enumeration value="ReturnContainerFreightFree"/>
+ <xsd:enumeration value="ReturnContainerFreightPaidByCustomer"/>
+ <xsd:enumeration value="ReturnContainerFreightPaidBySupplier"/>
+ <xsd:enumeration value="Rule11Shipment"/>
+ <xsd:enumeration value="ServiceFreight-NoCharge"/>
+ <xsd:enumeration value="ThirdPartyPay"/>
+ <xsd:enumeration value="WeightCondition"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="RiskOfLossCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="RiskOfLossInTransitToDestinationIsBuyers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToFreightEqualizationPointIsSellers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToPoolPointIsSellers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToDestinationIsSellers"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfPrice">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Price"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPrice" type="ListOfPrice"/>
+ <xsd:complexType name="Price">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="PricingType"/>
+ <xsd:element ref="UnitPrice"/>
+ <xsd:element minOccurs="0" name="PriceBasisQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CalculatedPriceBasisQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:element minOccurs="0" name="PriceQuantityRange">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="PriceMultiplier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Price" type="Price"/>
+ <xsd:complexType name="PricingType">
+ <xsd:sequence>
+ <xsd:element name="PriceTypeCoded" type="PriceTypeCode"/>
+ <xsd:element minOccurs="0" name="PriceTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PricingType" type="PricingType"/>
+ <xsd:simpleType name="PriceTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CancellationPrice"/>
+ <xsd:enumeration value="PerTon"/>
+ <xsd:enumeration value="MinimumOrderPrice"/>
+ <xsd:enumeration value="ExportPrice"/>
+ <xsd:enumeration value="RangeDependentPrice"/>
+ <xsd:enumeration value="ActiveIngredient"/>
+ <xsd:enumeration value="AsIsQuantity"/>
+ <xsd:enumeration value="CalculationNet"/>
+ <xsd:enumeration value="CalculationGross"/>
+ <xsd:enumeration value="TaxIncludedAllowancesAndChargesNotIncluded"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="AverageSellingPrice"/>
+ <xsd:enumeration value="InformationPriceTaxIncludedExcludingAllowancesOrCharges"/>
+ <xsd:enumeration value="InformationPriceExcludingAllowancesOrChargesAndTaxes"/>
+ <xsd:enumeration value="AdditiveUnitPriceComponent"/>
+ <xsd:enumeration value="AverageGenericProductPrice"/>
+ <xsd:enumeration value="AlternatePrice"/>
+ <xsd:enumeration value="AverageWholesalePrice"/>
+ <xsd:enumeration value="BaseCharge"/>
+ <xsd:enumeration value="ContractTier1"/>
+ <xsd:enumeration value="ContractTier2"/>
+ <xsd:enumeration value="ContractTier3"/>
+ <xsd:enumeration value="ContractTier4"/>
+ <xsd:enumeration value="ContractTier5"/>
+ <xsd:enumeration value="ContractTier6"/>
+ <xsd:enumeration value="ContractTier7"/>
+ <xsd:enumeration value="ContractTier8"/>
+ <xsd:enumeration value="ContractTier9"/>
+ <xsd:enumeration value="ContractTier10"/>
+ <xsd:enumeration value="ContractTier11"/>
+ <xsd:enumeration value="ContractTier12"/>
+ <xsd:enumeration value="ContractTier13"/>
+ <xsd:enumeration value="ContractTier14"/>
+ <xsd:enumeration value="ContractTier15"/>
+ <xsd:enumeration value="ContractTier16"/>
+ <xsd:enumeration value="ContractTier17"/>
+ <xsd:enumeration value="ContractTier18"/>
+ <xsd:enumeration value="ContractTier19"/>
+ <xsd:enumeration value="ContractTier20"/>
+ <xsd:enumeration value="ContractTier21"/>
+ <xsd:enumeration value="ContractTier22"/>
+ <xsd:enumeration value="ContractTier23"/>
+ <xsd:enumeration value="ContractTier24"/>
+ <xsd:enumeration value="ContractTier25"/>
+ <xsd:enumeration value="ContractTier26"/>
+ <xsd:enumeration value="ContractTier27"/>
+ <xsd:enumeration value="ContractTier28"/>
+ <xsd:enumeration value="ContractTier29"/>
+ <xsd:enumeration value="ContractTier30"/>
+ <xsd:enumeration value="CalculationPrice"/>
+ <xsd:enumeration value="CatalogPrice"/>
+ <xsd:enumeration value="CentralDistributionFacility"/>
+ <xsd:enumeration value="CurrentDomesticValue"/>
+ <xsd:enumeration value="ChangedPrice"/>
+ <xsd:enumeration value="ContractPrice"/>
+ <xsd:enumeration value="ConsumerUnit"/>
+ <xsd:enumeration value="ConfirmedUnitPrice"/>
+ <xsd:enumeration value="DeclaredCustomsUnitValue"/>
+ <xsd:enumeration value="DealerAdjustedPrice"/>
+ <xsd:enumeration value="DistributorsPrice"/>
+ <xsd:enumeration value="DiscountPrice"/>
+ <xsd:enumeration value="DiscountAmountAllowed"/>
+ <xsd:enumeration value="DirectStoreDelivery"/>
+ <xsd:enumeration value="DirectShipProgramPrice"/>
+ <xsd:enumeration value="EcscPrice"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceOriginalEquipmentManufacturer"/>
+ <xsd:enumeration value="EmergencyDirectShipPrice"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceSupplier"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceWarehouse"/>
+ <xsd:enumeration value="EstimatedPrice"/>
+ <xsd:enumeration value="ExpectedUnitPrice"/>
+ <xsd:enumeration value="FlatCharge"/>
+ <xsd:enumeration value="FrequentDeliveryService"/>
+ <xsd:enumeration value="FederalExciseTax"/>
+ <xsd:enumeration value="FreeGoodsPrice"/>
+ <xsd:enumeration value="FederalUpperLimitPriceMaximumAllowableCostPricingForDrugs"/>
+ <xsd:enumeration value="FirmPriceDoNotAdvise"/>
+ <xsd:enumeration value="GovernmentPrice"/>
+ <xsd:enumeration value="UnitPriceThroughQuantity"/>
+ <xsd:enumeration value="IndustrialPrice"/>
+ <xsd:enumeration value="InformationPrice"/>
+ <xsd:enumeration value="InstitutionalPrice"/>
+ <xsd:enumeration value="InvoiceBillingPrice"/>
+ <xsd:enumeration value="ListPrice"/>
+ <xsd:enumeration value="MandatoryToAdviseUnitPrice"/>
+ <xsd:enumeration value="MinimumActivitySurcharge"/>
+ <xsd:enumeration value="MaximumOrderQuantityPrice"/>
+ <xsd:enumeration value="MinimumOrderQuantityPrice"/>
+ <xsd:enumeration value="MinimumCharge"/>
+ <xsd:enumeration value="MinimumReleaseQuantityPrice"/>
+ <xsd:enumeration value="MaximumPriceReduction"/>
+ <xsd:enumeration value="ManufacturersSuggestedRetail"/>
+ <xsd:enumeration value="MaximumReleaseQuantityPrice"/>
+ <xsd:enumeration value="NoncontractTier1"/>
+ <xsd:enumeration value="NoncontractTier2"/>
+ <xsd:enumeration value="NoncontractTier3"/>
+ <xsd:enumeration value="NoncontractTier4"/>
+ <xsd:enumeration value="NoncontractTier5"/>
+ <xsd:enumeration value="NoncontractTier6"/>
+ <xsd:enumeration value="NoncontractTier7"/>
+ <xsd:enumeration value="NoncontractTier8"/>
+ <xsd:enumeration value="NoncontractTier9"/>
+ <xsd:enumeration value="NoncontractTier10"/>
+ <xsd:enumeration value="NoncontractTier11"/>
+ <xsd:enumeration value="NoncontractTier12"/>
+ <xsd:enumeration value="NoncontractTier13"/>
+ <xsd:enumeration value="NoncontractTier14"/>
+ <xsd:enumeration value="NoncontractTier15"/>
+ <xsd:enumeration value="NoncontractTier16"/>
+ <xsd:enumeration value="NoncontractTier17"/>
+ <xsd:enumeration value="NoncontractTier18"/>
+ <xsd:enumeration value="NoncontractTier19"/>
+ <xsd:enumeration value="NoncontractTier20"/>
+ <xsd:enumeration value="NoncontractTier21"/>
+ <xsd:enumeration value="NoncontractTier22"/>
+ <xsd:enumeration value="NoncontractTier23"/>
+ <xsd:enumeration value="NoncontractTier24"/>
+ <xsd:enumeration value="NoncontractTier25"/>
+ <xsd:enumeration value="NoncontractTier26"/>
+ <xsd:enumeration value="NoncontractTier27"/>
+ <xsd:enumeration value="NoncontractTier28"/>
+ <xsd:enumeration value="NoncontractTier29"/>
+ <xsd:enumeration value="NoncontractTier30"/>
+ <xsd:enumeration value="NetItemPrice"/>
+ <xsd:enumeration value="NetWeight"/>
+ <xsd:enumeration value="OptionalToAdviseUnitPrice"/>
+ <xsd:enumeration value="OriginalPurchaseOrderPrice"/>
+ <xsd:enumeration value="PriceBreakQuantity"/>
+ <xsd:enumeration value="UnitPriceBeginningQuantity"/>
+ <xsd:enumeration value="PriceBreakPurchaseOrderCount"/>
+ <xsd:enumeration value="PriceCatalogue"/>
+ <xsd:enumeration value="PerEach"/>
+ <xsd:enumeration value="PriceInEffectAtTimeOfShipment"/>
+ <xsd:enumeration value="PerKilogram"/>
+ <xsd:enumeration value="PerLiter"/>
+ <xsd:enumeration value="PrepaidFreightCharges"/>
+ <xsd:enumeration value="ProfessionalPrice"/>
+ <xsd:enumeration value="ProducersPrice"/>
+ <xsd:enumeration value="PromotionalPrice"/>
+ <xsd:enumeration value="PerTonne"/>
+ <xsd:enumeration value="SpecifiedUnit"/>
+ <xsd:enumeration value="ProvisionalPrice"/>
+ <xsd:enumeration value="GrossWeight"/>
+ <xsd:enumeration value="Purchase"/>
+ <xsd:enumeration value="QuotePrice"/>
+ <xsd:enumeration value="Resale"/>
+ <xsd:enumeration value="Retail"/>
+ <xsd:enumeration value="SuggestedDealerNetPrice"/>
+ <xsd:enumeration value="SuggestedFleetPrice"/>
+ <xsd:enumeration value="ShipAndDebit"/>
+ <xsd:enumeration value="SuggestedListPrice"/>
+ <xsd:enumeration value="SpecialPrice"/>
+ <xsd:enumeration value="SinglePriceFactorsEqualized"/>
+ <xsd:enumeration value="SuggestedRetail"/>
+ <xsd:enumeration value="StandardPrice"/>
+ <xsd:enumeration value="SumOfLineItems"/>
+ <xsd:enumeration value="SuggestedWholesalePrice"/>
+ <xsd:enumeration value="ToBeNegotiated"/>
+ <xsd:enumeration value="ThresholdPrice"/>
+ <xsd:enumeration value="TotalInvoiceAmountDue"/>
+ <xsd:enumeration value="Transfer"/>
+ <xsd:enumeration value="TradedUnit"/>
+ <xsd:enumeration value="TheoreticalWeight"/>
+ <xsd:enumeration value="UnitCostPrice"/>
+ <xsd:enumeration value="Wholesale"/>
+ <xsd:enumeration value="ZonePrice"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="UnitPrice">
+ <xsd:sequence>
+ <xsd:element name="UnitPriceValue" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="UnitPrice" type="UnitPrice"/>
+ <xsd:complexType name="Quantity">
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element ref="QuantityValue"/>
+ <xsd:element ref="QuantityRange"/>
+ </xsd:choice>
+ <xsd:element ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Quantity" type="Quantity"/>
+ <xsd:complexType name="QuantityValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="QuantityValue" type="QuantityValue"/>
+ <xsd:complexType name="QuantityRange">
+ <xsd:sequence>
+ <xsd:element ref="MinimumValue"/>
+ <xsd:element ref="MaximumValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="QuantityRange" type="QuantityRange"/>
+ <xsd:complexType name="PriceMultiplier">
+ <xsd:sequence>
+ <xsd:element name="PriceMultiplierCoded" type="PriceMultiplierCode"/>
+ <xsd:element minOccurs="0" name="PriceMultiplierCodedOther" type="xsd:string"/>
+ <xsd:element name="Multiplier" type="xsd:decimal"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PriceMultiplier" type="PriceMultiplier"/>
+ <xsd:simpleType name="PriceMultiplierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CostMarkupMultiplier-OriginalCost"/>
+ <xsd:enumeration value="CostMarkupMultiplier-RetailCost"/>
+ <xsd:enumeration value="DiscountMultiplier"/>
+ <xsd:enumeration value="CostMarkupMultiplier-WholesaleCost"/>
+ <xsd:enumeration value="PercentSolutionMultiplier"/>
+ <xsd:enumeration value="SellingMultiplier"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PaymentInstructions">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PaymentTerms"/>
+ <xsd:element maxOccurs="unbounded" ref="PaymentMethod"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PaymentInstructions" type="PaymentInstructions"/>
+ <xsd:complexType name="PaymentTerms">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PaymentTerm"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Discounts"/>
+ <xsd:element minOccurs="0" name="PaymentTermsNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PaymentTerms" type="PaymentTerms"/>
+ <xsd:complexType name="PaymentTerm">
+ <xsd:sequence>
+ <xsd:element name="PaymentTermCoded" type="PaymentTermCode"/>
+ <xsd:element minOccurs="0" name="PaymentTermCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PaymentTermValue" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="PaymentTermDetails">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Discounts"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PaymentTerm" type="PaymentTerm"/>
+ <xsd:simpleType name="PaymentTermCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="10DaysAfterEndOfMonth"/>
+ <xsd:enumeration value="AdjustmentPayment"/>
+ <xsd:enumeration value="AdvancedPayment"/>
+ <xsd:enumeration value="Anticipation"/>
+ <xsd:enumeration value="AvailableByAcceptance"/>
+ <xsd:enumeration value="AvailableByDeferredPayment"/>
+ <xsd:enumeration value="AvailableByNegotiation"/>
+ <xsd:enumeration value="AvailableByNegotiationByNamedBank"/>
+ <xsd:enumeration value="AvailableByNegotiationWithAnyBank"/>
+ <xsd:enumeration value="AvailableByNegotiationWithAnyBankin"/>
+ <xsd:enumeration value="AvailableBySightPayment"/>
+ <xsd:enumeration value="BankTransfer"/>
+ <xsd:enumeration value="Basic"/>
+ <xsd:enumeration value="BasicCommissionTerms"/>
+ <xsd:enumeration value="BasicDiscountOffered"/>
+ <xsd:enumeration value="BillOfExchange"/>
+ <xsd:enumeration value="BillToBill"/>
+ <xsd:enumeration value="CancellationOption"/>
+ <xsd:enumeration value="Cash"/>
+ <xsd:enumeration value="CashAccount"/>
+ <xsd:enumeration value="CashAgainstDocuments"/>
+ <xsd:enumeration value="CashByStateLaw"/>
+ <xsd:enumeration value="CashDiscountTermsApply"/>
+ <xsd:enumeration value="CashonAdvance"/>
+ <xsd:enumeration value="CashonArrival"/>
+ <xsd:enumeration value="CashOnDelivery"/>
+ <xsd:enumeration value="CashPerVendorRequest"/>
+ <xsd:enumeration value="CashWithOrder"/>
+ <xsd:enumeration value="CertifiedCheck"/>
+ <xsd:enumeration value="ChargeCard"/>
+ <xsd:enumeration value="CompletePayment"/>
+ <xsd:enumeration value="Consignment"/>
+ <xsd:enumeration value="ContractBasis"/>
+ <xsd:enumeration value="CostPlus"/>
+ <xsd:enumeration value="CreditControlled"/>
+ <xsd:enumeration value="DatingGiven"/>
+ <xsd:enumeration value="DeferredOrInstallment"/>
+ <xsd:enumeration value="DepositRequired"/>
+ <xsd:enumeration value="Discount"/>
+ <xsd:enumeration value="DiscountNotApplicable"/>
+ <xsd:enumeration value="DiscountWithAdvancePayment"/>
+ <xsd:enumeration value="DiscountWithPromptPay"/>
+ <xsd:enumeration value="DocumentsAgainstAcceptance"/>
+ <xsd:enumeration value="DocumentsAgainstPayment"/>
+ <xsd:enumeration value="Elective"/>
+ <xsd:enumeration value="EndOfMonth"/>
+ <xsd:enumeration value="Extended"/>
+ <xsd:enumeration value="FastPay"/>
+ <xsd:enumeration value="FixedDate"/>
+ <xsd:enumeration value="FixedDateLatePaymentPenaltyApplies"/>
+ <xsd:enumeration value="FixedFee"/>
+ <xsd:enumeration value="InstallmentPaymentsAreDueAnnually"/>
+ <xsd:enumeration value="InstallmentPaymentsAreDueMonthly"/>
+ <xsd:enumeration value="InstallmentPaymentsAreDueQuarterly"/>
+ <xsd:enumeration value="InstallmentPaymentsAreDueSemiAnnually"/>
+ <xsd:enumeration value="Instant"/>
+ <xsd:enumeration value="InterCompanyAccount"/>
+ <xsd:enumeration value="IrrevocableLetterOfCredit"/>
+ <xsd:enumeration value="LatePayment"/>
+ <xsd:enumeration value="LeaseAgreement"/>
+ <xsd:enumeration value="LetterOfCredit"/>
+ <xsd:enumeration value="LetterOfCreditAtSight"/>
+ <xsd:enumeration value="Liquidation"/>
+ <xsd:enumeration value="LumpSum"/>
+ <xsd:enumeration value="Mixed"/>
+ <xsd:enumeration value="NetMonthFollowingInvoice"/>
+ <xsd:enumeration value="NoCharge"/>
+ <xsd:enumeration value="NonStandard"/>
+ <xsd:enumeration value="NotYetDefined"/>
+ <xsd:enumeration value="PaidAgainstStatement"/>
+ <xsd:enumeration value="PartialAdvance"/>
+ <xsd:enumeration value="PaymentByInstalment"/>
+ <xsd:enumeration value="PaymentByinstalmentsAccordingToProgressAA"/>
+ <xsd:enumeration value="PaymentByInstalmentsAccordingToProgressTBA"/>
+ <xsd:enumeration value="PaymentDueUponReceiptOfInvoice"/>
+ <xsd:enumeration value="PaymentOrderThroughBank"/>
+ <xsd:enumeration value="PaymentTermsDefinedInConsolidatedInvoice"/>
+ <xsd:enumeration value="PaymentUponCompletion"/>
+ <xsd:enumeration value="PenaltyTerms"/>
+ <xsd:enumeration value="Prepayment"/>
+ <xsd:enumeration value="PreviouslyAgreedUpon"/>
+ <xsd:enumeration value="ProgressPayment"/>
+ <xsd:enumeration value="PromissoryNotes"/>
+ <xsd:enumeration value="PromptPaymentAct"/>
+ <xsd:enumeration value="Proximo"/>
+ <xsd:enumeration value="SecuredAccount"/>
+ <xsd:enumeration value="SellByNote"/>
+ <xsd:enumeration value="SellerToAdviseBuyer"/>
+ <xsd:enumeration value="SpecialProximo"/>
+ <xsd:enumeration value="SupplierFloorPlan"/>
+ <xsd:enumeration value="TenorPaymentTerms"/>
+ <xsd:enumeration value="TermsNotApplicable"/>
+ <xsd:enumeration value="TradeAcceptance"/>
+ <xsd:enumeration value="Ultimo"/>
+ <xsd:enumeration value="UnitedStatesFundsRequired"/>
+ <xsd:enumeration value="Unknown"/>
+ <xsd:enumeration value="UsanceBill"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Discounts">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="DiscountPercent" type="Decimal10_4"/>
+ <xsd:element minOccurs="0" name="DiscountAmount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="DiscountDaysDue" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="DiscountDueDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="DiscountDayOfMonth" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="DiscountDateTimeRefCoded" type="DateTimeRefCode"/>
+ <xsd:element minOccurs="0" name="DiscountDateTimeRefCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="NetDaysDue" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="NetDueDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="NetDateTimeRefCoded" type="DateTimeRefCode"/>
+ <xsd:element minOccurs="0" name="NetDateTimeRefCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Discounts" type="Discounts"/>
+ <xsd:complexType name="MonetaryValue">
+ <xsd:sequence>
+ <xsd:element name="MonetaryAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" ref="RateOfExchangeDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MonetaryValue" type="MonetaryValue"/>
+ <xsd:complexType name="RateOfExchangeDetail">
+ <xsd:sequence>
+ <xsd:element name="ReferenceCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TargetCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="RateOfExchange" type="Decimal19_9"/>
+ <xsd:element minOccurs="0" name="InverseRateOfExchange" type="Decimal19_9"/>
+ <xsd:element minOccurs="0" name="DateOfRateOfExchange" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="ListOfRateOfExchangeReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="RateOfExchangeDetail" type="RateOfExchangeDetail"/>
+ <xsd:simpleType name="Decimal19_9">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="19"/>
+ <xsd:fractionDigits value="9"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfReference">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfReference" type="ListOfReference"/>
+ <xsd:simpleType name="DateTimeRefCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AnticipatedDeliveryDate"/>
+ <xsd:enumeration value="ApprovalOfGageDate"/>
+ <xsd:enumeration value="ApprovalOfSampleDate"/>
+ <xsd:enumeration value="CompletionAndAcceptanceDate"/>
+ <xsd:enumeration value="CustomsClearanceDateExport"/>
+ <xsd:enumeration value="CustomsClearanceDateImport"/>
+ <xsd:enumeration value="DateCreditNoteReceived"/>
+ <xsd:enumeration value="DateExWorks"/>
+ <xsd:enumeration value="DateGoodsHandedOverForShipmentBySellerOrAgent"/>
+ <xsd:enumeration value="DateGoodsReceivedByBuyer"/>
+ <xsd:enumeration value="DateGoodsReceivedByBuyersAgent"/>
+ <xsd:enumeration value="DateGoodsReceivedByCarrier"/>
+ <xsd:enumeration value="DateInvoiceReceived"/>
+ <xsd:enumeration value="DateOfAcceptanceOfFirstSamplesProducedUnderProductionConditions"/>
+ <xsd:enumeration value="DateOfAcceptanceOfNegotiableInstrument"/>
+ <xsd:enumeration value="DateOfAcceptanceOfTooling"/>
+ <xsd:enumeration value="DateOfArrivalOfTransport"/>
+ <xsd:enumeration value="DateOfBillOfLadingConsignmentNoteOrOtherTransportDocument"/>
+ <xsd:enumeration value="DateOfCertificateOfFinalAcceptance"/>
+ <xsd:enumeration value="DateOfCertificateOfPreliminaryAcceptance"/>
+ <xsd:enumeration value="DateOfConfirmation"/>
+ <xsd:enumeration value="DateOfConfirmationOfOrderReceived"/>
+ <xsd:enumeration value="DateOfContract"/>
+ <xsd:enumeration value="DateOfCreditNote"/>
+ <xsd:enumeration value="DeliveryDate"/>
+ <xsd:enumeration value="DateOfDeliveryOfGoodsToEstablishmentsDomicileSite"/>
+ <xsd:enumeration value="DateOfDeliveryToBuyerOfDocumentsRepresentingGoods"/>
+ <xsd:enumeration value="DateOfDeliveryToBuyersAgentOfDocumentsRepresentingGoods"/>
+ <xsd:enumeration value="DateOfDeliveryToCarrierOfDocumentsRepresentingGoods"/>
+ <xsd:enumeration value="DateOfDeliveryToIntermediaryBankOfDocumentsRepresentingGood"/>
+ <xsd:enumeration value="DateOfEndOfWork"/>
+ <xsd:enumeration value="DateOfFinalAcceptanceOfWork"/>
+ <xsd:enumeration value="DateOfInvoice"/>
+ <xsd:enumeration value="DateOfInwardFrontierCrossing"/>
+ <xsd:enumeration value="DateOfIssueOfTransportDocument"/>
+ <xsd:enumeration value="DateOfNegotiableInstrumentDraftPromissoryNoteBank"/>
+ <xsd:enumeration value="DateOfOrder"/>
+ <xsd:enumeration value="DateOfOutwardFrontierCrossing"/>
+ <xsd:enumeration value="DateOfPresentationOfDocuments"/>
+ <xsd:enumeration value="DateOfPresentationOfNegotiableInstrument"/>
+ <xsd:enumeration value="DateOfPresentDocument"/>
+ <xsd:enumeration value="DateOfProvisionalReceptionOfWork"/>
+ <xsd:enumeration value="DateOfReceiptForLoadingMatesReceipt"/>
+ <xsd:enumeration value="DateOfReceiptOfToolDependentInitialSamplesPlusUnlimitedAbsoluteBankGuaranteePlusValueAddedTax"/>
+ <xsd:enumeration value="DateOfReceiptOfTooling"/>
+ <xsd:enumeration value="DateOfResaleByBuyer"/>
+ <xsd:enumeration value="DateOfSalaryPayment"/>
+ <xsd:enumeration value="ShipDate"/>
+ <xsd:enumeration value="DateOfShipmentAsEvidencedByTheTransportDocument"/>
+ <xsd:enumeration value="DateOfSignatureOfContract"/>
+ <xsd:enumeration value="DateOfStartOfWork"/>
+ <xsd:enumeration value="DatePresentDocumentReceived"/>
+ <xsd:enumeration value="DateProceedsOfResaleCollectedByBuyer"/>
+ <xsd:enumeration value="DraftAtDaysAfterDateOfIssuanceOfTransportDocument"/>
+ <xsd:enumeration value="DraftAtDaysAfterDateOfPresentationOfDocuments"/>
+ <xsd:enumeration value="DraftAtDaysDate"/>
+ <xsd:enumeration value="DraftAtDaysSight"/>
+ <xsd:enumeration value="DueDateOfNegotiableInstrument"/>
+ <xsd:enumeration value="EffectiveDate"/>
+ <xsd:enumeration value="InvoiceDate"/>
+ <xsd:enumeration value="InvoiceReceiptDate"/>
+ <xsd:enumeration value="InvoiceTransmissionDate"/>
+ <xsd:enumeration value="InvoiceVerificationDate"/>
+ <xsd:enumeration value="OtherReferenceDateAgreedUponBetweenTheParties"/>
+ <xsd:enumeration value="PaymentDate"/>
+ <xsd:enumeration value="PaymentDueDate"/>
+ <xsd:enumeration value="PurchaseOrderDate"/>
+ <xsd:enumeration value="QualityApprovalDate"/>
+ <xsd:enumeration value="QuarterStartDate"/>
+ <xsd:enumeration value="ReceiptOfGoods"/>
+ <xsd:enumeration value="RequestedDateOfDelivery"/>
+ <xsd:enumeration value="SpecifiedDate"/>
+ <xsd:enumeration value="SpecifiedDraftDate"/>
+ <xsd:enumeration value="StipulatedDateForAcceptanceOfDocumentaryCredit"/>
+ <xsd:enumeration value="StipulatedDateForNegotiationOfDocumentaryCredit"/>
+ <xsd:enumeration value="StipulatedDateForPaymentOfDocumentaryCredit"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PaymentMethod">
+ <xsd:sequence>
+ <xsd:element name="PaymentMeanCoded" type="PaymentMeanCode"/>
+ <xsd:element minOccurs="0" name="PaymentMeanCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PaymentMeanReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="PaymentSystemCoded" type="PaymentSystemCode"/>
+ <xsd:element minOccurs="0" name="PaymentSystemCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="OriginatingFIAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="FIAccount"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ReceivingFIAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="FIAccount"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="CardInfo"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PaymentMethod" type="PaymentMethod"/>
+ <xsd:simpleType name="PaymentMeanCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="1035Exchange"/>
+ <xsd:enumeration value="AcceptedBillOfExchange"/>
+ <xsd:enumeration value="ACHDemandCashConcentrationOrDisbursementCredit"/>
+ <xsd:enumeration value="ACHDemandCashConcentrationOrDisbursementDebit"/>
+ <xsd:enumeration value="ACHDemandCashConcentrationOrDisbursementPlusCredit"/>
+ <xsd:enumeration value="ACHDemandCashConcentrationOrDisbursementPlusDebit"/>
+ <xsd:enumeration value="ACHDemandCorporateTradeExchangeCredit"/>
+ <xsd:enumeration value="ACHDemandCorporateTradeExchangeDebit"/>
+ <xsd:enumeration value="ACHDemandCorporateTradePaymentCredit"/>
+ <xsd:enumeration value="ACHDemandCorporateTradePaymentDebit"/>
+ <xsd:enumeration value="ACHDemandCredit"/>
+ <xsd:enumeration value="ACHDemandCreditReversal"/>
+ <xsd:enumeration value="ACHDemandDebit"/>
+ <xsd:enumeration value="ACHDemandDebitReversal"/>
+ <xsd:enumeration value="ACHPreArrangedPaymentAndDeposit"/>
+ <xsd:enumeration value="ACHReversal"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementCredit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementDebit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPPDCredit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPPDDebit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPPDPlusCredit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPPDPlusDebit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPlusCredit"/>
+ <xsd:enumeration value="ACHSavingsCashConcentrationOrDisbursementPlusDebit"/>
+ <xsd:enumeration value="ACHSavingsCorporateTradeExchangeCredit"/>
+ <xsd:enumeration value="ACHSavingsCorporateTradeExchangeDebit"/>
+ <xsd:enumeration value="ACHSavingsCorporateTradePaymentCredit"/>
+ <xsd:enumeration value="ACHSavingsCorporateTradePaymentDebit"/>
+ <xsd:enumeration value="ACHSavingsCredit"/>
+ <xsd:enumeration value="ACHSavingsCreditReversal"/>
+ <xsd:enumeration value="ACHSavingsDebit"/>
+ <xsd:enumeration value="ACHSavingsDebitReversal"/>
+ <xsd:enumeration value="AutomatedClearingHouse"/>
+ <xsd:enumeration value="AutomatedClearingHouseCredit"/>
+ <xsd:enumeration value="AutomatedClearingHouseDebit"/>
+ <xsd:enumeration value="BankCard"/>
+ <xsd:enumeration value="Bankcheque-IssuedByABankingOrSimilarEstablishment"/>
+ <xsd:enumeration value="BankDraft"/>
+ <xsd:enumeration value="BankersDraft"/>
+ <xsd:enumeration value="BillDrawnByCreditorOnThirdPartyAndAcceptedAndEndorsedByABank"/>
+ <xsd:enumeration value="BillDrawnByTheCreditorAndEndorsedByAnotherBank"/>
+ <xsd:enumeration value="BillDrawnByTheCreditorOnABank"/>
+ <xsd:enumeration value="BillDrawnByTheCreditorOnABankAndEndorsedByAThirdParty"/>
+ <xsd:enumeration value="BillDrawnByTheCreditorOnAThirdParty"/>
+ <xsd:enumeration value="BillDrawnByTheCreditorOnTheDebtor"/>
+ <xsd:enumeration value="BillingAccount"/>
+ <xsd:enumeration value="BookEntry"/>
+ <xsd:enumeration value="BookEntryCredit"/>
+ <xsd:enumeration value="BookEntryDebit"/>
+ <xsd:enumeration value="Cash"/>
+ <xsd:enumeration value="CashiersCheck"/>
+ <xsd:enumeration value="Ccd"/>
+ <xsd:enumeration value="CcdPlus"/>
+ <xsd:enumeration value="CertifiedBankersDraft"/>
+ <xsd:enumeration value="CertifiedCheque"/>
+ <xsd:enumeration value="Cheque"/>
+ <xsd:enumeration value="ClearingBetweenPartners"/>
+ <xsd:enumeration value="ClearingHouse"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystem"/>
+ <xsd:enumeration value="CollectPaymentByCertifiedFunds"/>
+ <xsd:enumeration value="CollectPaymentByCompanyCheck"/>
+ <xsd:enumeration value="CompensationByBalance"/>
+ <xsd:enumeration value="Credit"/>
+ <xsd:enumeration value="CreditAccount"/>
+ <xsd:enumeration value="CreditDebitAccount"/>
+ <xsd:enumeration value="CreditCard"/>
+ <xsd:enumeration value="CreditTransfer"/>
+ <xsd:enumeration value="Ctp"/>
+ <xsd:enumeration value="Ctx"/>
+ <xsd:enumeration value="Debited"/>
+ <xsd:enumeration value="DebitCard"/>
+ <xsd:enumeration value="DebitTransfer"/>
+ <xsd:enumeration value="DeductionFromFilmRental"/>
+ <xsd:enumeration value="DirectDebit"/>
+ <xsd:enumeration value="DirectDeposit"/>
+ <xsd:enumeration value="DirectPayToOthers"/>
+ <xsd:enumeration value="Draft"/>
+ <xsd:enumeration value="EBINAXClearingNetwork"/>
+ <xsd:enumeration value="ElectronicPaymentSystem"/>
+ <xsd:enumeration value="FederalReserveFundsOrWireTransferRepetitive"/>
+ <xsd:enumeration value="FederalReserveFundsOrWireTransferNonRepetitive"/>
+ <xsd:enumeration value="FinancialInstitutionOption"/>
+ <xsd:enumeration value="FreeFormatGiro"/>
+ <xsd:enumeration value="FreightPaymentBank"/>
+ <xsd:enumeration value="Graduated"/>
+ <xsd:enumeration value="Hold"/>
+ <xsd:enumeration value="Home-BankingDebitTransfer"/>
+ <xsd:enumeration value="InCash"/>
+ <xsd:enumeration value="IncomeContingent"/>
+ <xsd:enumeration value="IncomeSensitive"/>
+ <xsd:enumeration value="InKindPayment"/>
+ <xsd:enumeration value="InstrumentNotDefined"/>
+ <xsd:enumeration value="InterBankDebitTransfer"/>
+ <xsd:enumeration value="InvoicedSeparately"/>
+ <xsd:enumeration value="LetterOfCredit"/>
+ <xsd:enumeration value="Level-SumConstant"/>
+ <xsd:enumeration value="LocalCheque"/>
+ <xsd:enumeration value="LockBox"/>
+ <xsd:enumeration value="MoneyOrder"/>
+ <xsd:enumeration value="NationalOrRegionalClearing"/>
+ <xsd:enumeration value="NonPaymentData"/>
+ <xsd:enumeration value="NotTransferableBankersDraft"/>
+ <xsd:enumeration value="NotTransferableLocalCheque"/>
+ <xsd:enumeration value="PayByCheck"/>
+ <xsd:enumeration value="PaymentByPostGiro"/>
+ <xsd:enumeration value="PaymentToBankAccount"/>
+ <xsd:enumeration value="PayrollDeduction"/>
+ <xsd:enumeration value="PetroleumClearinghouseBank"/>
+ <xsd:enumeration value="PPDCreditToDemandDepositAccount"/>
+ <xsd:enumeration value="PPDDebitToDemandDepositAccount"/>
+ <xsd:enumeration value="PPDPlusAddendumCreditToDemandDepositAccount"/>
+ <xsd:enumeration value="PPDPlusAddendumDebitToDemandDepositAccount"/>
+ <xsd:enumeration value="PreauthroizedCheck"/>
+ <xsd:enumeration value="PreviouslyCharged"/>
+ <xsd:enumeration value="PrivateNettingAgreementPayByWireTransfer"/>
+ <xsd:enumeration value="PrivateNettingPayByCheck"/>
+ <xsd:enumeration value="PromissoryNote"/>
+ <xsd:enumeration value="PromissoryNoteSignedByABank"/>
+ <xsd:enumeration value="PromissoryNoteSignedByABankAndEndorsedByAnotherBank"/>
+ <xsd:enumeration value="PromissoryNoteSignedByAThirdParty"/>
+ <xsd:enumeration value="PromissoryNoteSignedByAThirdPartyAndEndorsedByABank"/>
+ <xsd:enumeration value="PromissoryNoteSignedByTheDebtor"/>
+ <xsd:enumeration value="PromissoryNoteSignedByTheDebtorAndEndorsedByAThirdParty"/>
+ <xsd:enumeration value="PromissoryNoteSignedByTheDebtorAndEndorsedByBank"/>
+ <xsd:enumeration value="ProprietaryNetwork"/>
+ <xsd:enumeration value="ReferencedHome-BankingCreditTransfer"/>
+ <xsd:enumeration value="ReferenceGiro"/>
+ <xsd:enumeration value="RelatedDetailAccount"/>
+ <xsd:enumeration value="RequestedMethodForPaymentWasNotUsed"/>
+ <xsd:enumeration value="SpecialAccount"/>
+ <xsd:enumeration value="SummaryAccount"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="TravelersCheck"/>
+ <xsd:enumeration value="UrgentGiro"/>
+ <xsd:enumeration value="VISASpecialElectronicFundsTransferNetwork"/>
+ <xsd:enumeration value="Waived"/>
+ <xsd:enumeration value="WireTransfer"/>
+ <xsd:enumeration value="X12"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="PaymentSystemCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="OrdinaryPost"/>
+ <xsd:enumeration value="AirMail"/>
+ <xsd:enumeration value="BillPayment"/>
+ <xsd:enumeration value="ConsumerEmployeeCheck"/>
+ <xsd:enumeration value="CashConcentrationDisbursement"/>
+ <xsd:enumeration value="CashConcentrationDisbursementPlusAddenda"/>
+ <xsd:enumeration value="CustomerInitiatedEntry"/>
+ <xsd:enumeration value="CustomerInitiatedEntryPlusAddenda"/>
+ <xsd:enumeration value="CorporateTradeExchange"/>
+ <xsd:enumeration value="CorporateCheck"/>
+ <xsd:enumeration value="Telegraph"/>
+ <xsd:enumeration value="Telex"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="OtherTransmissionNetworks"/>
+ <xsd:enumeration value="NetworksNotDefined"/>
+ <xsd:enumeration value="Fedwire"/>
+ <xsd:enumeration value="Personal-Face-To-Face"/>
+ <xsd:enumeration value="PrearrangedPaymentAndDeposit"/>
+ <xsd:enumeration value="PrearrangedPaymentAndDepositPlusAddenda"/>
+ <xsd:enumeration value="PreauthorizedDraft"/>
+ <xsd:enumeration value="RegisteredAirMail"/>
+ <xsd:enumeration value="RegisteredMail"/>
+ <xsd:enumeration value="Courier"/>
+ <xsd:enumeration value="Messenger"/>
+ <xsd:enumeration value="NationalACH"/>
+ <xsd:enumeration value="OtherACH"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="FIAccount">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="AccountDetail"/>
+ <xsd:element ref="FinancialInstitution"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="FIAccount" type="FIAccount"/>
+ <xsd:complexType name="AccountDetail">
+ <xsd:sequence>
+ <xsd:element name="AccountID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SecondaryAccountID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="IBAN" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AccountControlKey" type="xsd:string"/>
+ <xsd:element name="AccountTypeCoded" type="AccountTypeCode"/>
+ <xsd:element minOccurs="0" name="AccountTypeCodedOther" type="xsd:string"/>
+ <xsd:element name="AccountName1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AccountName2" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" name="AccountReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AccountDetail" type="AccountDetail"/>
+ <xsd:simpleType name="AccountTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NewBusinessAccount"/>
+ <xsd:enumeration value="GroupNumber"/>
+ <xsd:enumeration value="PolicyNumber"/>
+ <xsd:enumeration value="MoneyMarketFund"/>
+ <xsd:enumeration value="RetirementAccountVestedInterestatMarketValue"/>
+ <xsd:enumeration value="RetirementAccountVestedInterestNetCashValue"/>
+ <xsd:enumeration value="IndividualRetirementAccount-IRA-VestedInterestatMarketValue"/>
+ <xsd:enumeration value="IndividualRetirementAccount-IRA-VestedInterestNetCashValue"/>
+ <xsd:enumeration value="CorporateControlledRetirementAccountVestedInterest"/>
+ <xsd:enumeration value="TimeDeposit"/>
+ <xsd:enumeration value="CheckingAccount"/>
+ <xsd:enumeration value="Stock"/>
+ <xsd:enumeration value="Bond"/>
+ <xsd:enumeration value="LifeInsuranceFaceValue"/>
+ <xsd:enumeration value="RetirementAccount-VestedInterest"/>
+ <xsd:enumeration value="BusinessAccount"/>
+ <xsd:enumeration value="TrustFundAccount"/>
+ <xsd:enumeration value="StocksandBondsAccount"/>
+ <xsd:enumeration value="LifeInsuranceAccount-NetCashValue"/>
+ <xsd:enumeration value="EmployeeRetirementAccount-401K"/>
+ <xsd:enumeration value="Agency"/>
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="BrokerageAccount"/>
+ <xsd:enumeration value="ChargeBackAccountforReturns"/>
+ <xsd:enumeration value="CreditCard"/>
+ <xsd:enumeration value="CashManagement"/>
+ <xsd:enumeration value="DemandDeposit"/>
+ <xsd:enumeration value="DebitCard"/>
+ <xsd:enumeration value="ExistingCarrier"/>
+ <xsd:enumeration value="ReturnItemsonDemandDepositAccount"/>
+ <xsd:enumeration value="ReturnItemsonSavingsAccount"/>
+ <xsd:enumeration value="Savings"/>
+ <xsd:enumeration value="AgencyLocationCode"/>
+ <xsd:enumeration value="Annuity"/>
+ <xsd:enumeration value="ControlledDisbursementMasterAccount"/>
+ <xsd:enumeration value="ControlledDisbursementSubAccount"/>
+ <xsd:enumeration value="CreditUnion"/>
+ <xsd:enumeration value="EnrichedPlanContractNumber"/>
+ <xsd:enumeration value="Long-termDisabilityPolicyNumber"/>
+ <xsd:enumeration value="MutualFund"/>
+ <xsd:enumeration value="PrimaryBank"/>
+ <xsd:enumeration value="RelationshipSummaryAccount"/>
+ <xsd:enumeration value="Safekeeping-CustodyAccount"/>
+ <xsd:enumeration value="ZeroBalanceMasterAccount"/>
+ <xsd:enumeration value="ZeroBalanceAffiliateAccount"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="FinancialInstitution">
+ <xsd:sequence>
+ <xsd:element name="FinancialInstitutionID" type="xsd:string"/>
+ <xsd:element name="FinancialInstitutionName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchStreet" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchHouseNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchStreetSupplement1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchStreetSupplement2" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchPostalCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchCity" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FIBranchRegion">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Region"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="FIBranchCountry">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Country"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="FinancialInstitution" type="FinancialInstitution"/>
+ <xsd:complexType name="CardInfo">
+ <xsd:sequence>
+ <xsd:element name="CardNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CardAuthCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CardRefNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CardExpirationDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="CardType" type="CardTypeCode"/>
+ <xsd:element minOccurs="0" name="CardTypeOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CardHolderName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="CardInfo" type="CardInfo"/>
+ <xsd:simpleType name="CardTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AMEX"/>
+ <xsd:enumeration value="VISA"/>
+ <xsd:enumeration value="MC"/>
+ <xsd:enumeration value="Discover"/>
+ <xsd:enumeration value="JCB"/>
+ <xsd:enumeration value="Diners"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfAllowOrCharge">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="AllowOrCharge"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfAllowOrCharge" type="ListOfAllowOrCharge"/>
+ <xsd:complexType name="AllowOrCharge">
+ <xsd:sequence>
+ <xsd:element name="IndicatorCoded" type="IndicatorCode"/>
+ <xsd:element minOccurs="0" name="IndicatorCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="BasisCoded" type="BasisCode"/>
+ <xsd:element minOccurs="0" name="BasisCodedOther" type="xsd:string"/>
+ <xsd:element name="MethodOfHandlingCoded" type="MethodOfHandlingCode"/>
+ <xsd:element minOccurs="0" name="MethodOfHandlingCodedOther" type="xsd:string"/>
+ <xsd:element name="AllowanceOrChargeDescription">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="AllowOrChgDesc"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:choice minOccurs="0">
+ <xsd:element name="BasisQuantityRange">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="BasisMonetaryRange"/>
+ </xsd:choice>
+ <xsd:element ref="TypeOfAllowanceOrCharge"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Tax"/>
+ </xsd:sequence>
+ <xsd:attribute name="SeqNo" type="xsd:int" use="optional" default="1"/>
+ </xsd:complexType>
+ <xsd:element name="AllowOrCharge" type="AllowOrCharge"/>
+ <xsd:simpleType name="IndicatorCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="About"/>
+ <xsd:enumeration value="Adjustment"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllowanceLineItems"/>
+ <xsd:enumeration value="AllowanceMessage"/>
+ <xsd:enumeration value="AllowancePerCallOf"/>
+ <xsd:enumeration value="AllowanceRequest"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeLineItems"/>
+ <xsd:enumeration value="ChargeMessage"/>
+ <xsd:enumeration value="ChargePerCallOf"/>
+ <xsd:enumeration value="ChargeRequest"/>
+ <xsd:enumeration value="Exact"/>
+ <xsd:enumeration value="LineItemAllowance"/>
+ <xsd:enumeration value="LineItemCharge"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="Minus-Amount"/>
+ <xsd:enumeration value="Minus-Percentage"/>
+ <xsd:enumeration value="NoAllowance"/>
+ <xsd:enumeration value="NoAllowanceOrCharge"/>
+ <xsd:enumeration value="NoCharge"/>
+ <xsd:enumeration value="Plus-Amount"/>
+ <xsd:enumeration value="Plus-Percentage"/>
+ <xsd:enumeration value="PlusOrMinusOrAmount"/>
+ <xsd:enumeration value="PlusOrMinus-Percentage"/>
+ <xsd:enumeration value="Promotion"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="TotalOther"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="BasisCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="None"/>
+ <xsd:enumeration value="Quantity"/>
+ <xsd:enumeration value="Percent"/>
+ <xsd:enumeration value="MonetaryAmount"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="MethodOfHandlingCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BillBack"/>
+ <xsd:enumeration value="OffInvoice"/>
+ <xsd:enumeration value="VendorCheckToCustomer"/>
+ <xsd:enumeration value="CreditCustomerAccount"/>
+ <xsd:enumeration value="ChargeToBePaidByVendor"/>
+ <xsd:enumeration value="ChargeToBePaidByCustomer"/>
+ <xsd:enumeration value="Optional"/>
+ <xsd:enumeration value="OffGrossQuantityInvoiced"/>
+ <xsd:enumeration value="AllowanceToBeIssuedByVendor"/>
+ <xsd:enumeration value="AllowanceToBeIssuedByReseller"/>
+ <xsd:enumeration value="ChargeDeniedByVendor"/>
+ <xsd:enumeration value="CancelAllowance"/>
+ <xsd:enumeration value="ProvideAmount"/>
+ <xsd:enumeration value="InformationOnly"/>
+ <xsd:enumeration value="Non-PayableTax"/>
+ <xsd:enumeration value="AccrualFund"/>
+ <xsd:enumeration value="FlatFund"/>
+ <xsd:enumeration value="CashInAdvance"/>
+ <xsd:enumeration value="CalculateAndAddtoInvoice"/>
+ <xsd:enumeration value="Collect"/>
+ <xsd:enumeration value="Prepaid"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="AllowOrChgDesc">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="RefID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfDescription"/>
+ <xsd:element name="ServiceCoded" type="ServiceCode"/>
+ <xsd:element minOccurs="0" name="ServiceCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AllowOrChgDesc" type="AllowOrChgDesc"/>
+ <xsd:complexType name="ListOfDescription">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Description"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDescription" type="ListOfDescription"/>
+ <xsd:complexType name="Description">
+ <xsd:sequence>
+ <xsd:element name="DescriptionText" type="xsd:string"/>
+ <xsd:element ref="Language"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Description" type="Description"/>
+ <xsd:simpleType name="ServiceCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="About"/>
+ <xsd:enumeration value="AbsoluteMinimumCharge"/>
+ <xsd:enumeration value="AccessCharge-Federal"/>
+ <xsd:enumeration value="AccessCharges"/>
+ <xsd:enumeration value="AccessCharge-State"/>
+ <xsd:enumeration value="AccountNumberCorrectionCharge"/>
+ <xsd:enumeration value="AcidBattery"/>
+ <xsd:enumeration value="AcknowledgmentofDeliveryFeeAOD"/>
+ <xsd:enumeration value="ActivationOfCarnet"/>
+ <xsd:enumeration value="AdditionalCommercialInvoices"/>
+ <xsd:enumeration value="AdditionalCopiesOfFreightBill"/>
+ <xsd:enumeration value="AdditionalMaterial"/>
+ <xsd:enumeration value="AdditionalTariffClassifications"/>
+ <xsd:enumeration value="AddOn-Destination"/>
+ <xsd:enumeration value="AddOn-Origin"/>
+ <xsd:enumeration value="AddressCorrection"/>
+ <xsd:enumeration value="AddToMakeMarketValue"/>
+ <xsd:enumeration value="Adjustment"/>
+ <xsd:enumeration value="AdjustmentForMaximumChargesBilling"/>
+ <xsd:enumeration value="AdjustmentForMinimumAverageTimeRequirementBilling"/>
+ <xsd:enumeration value="Adjustments"/>
+ <xsd:enumeration value="Administrative"/>
+ <xsd:enumeration value="AdValorem"/>
+ <xsd:enumeration value="AdvanceChargesHandling"/>
+ <xsd:enumeration value="AdvanceDestinationAmount"/>
+ <xsd:enumeration value="AdvanceDestinationFee"/>
+ <xsd:enumeration value="AdvanceFee"/>
+ <xsd:enumeration value="AdvanceLadingCharge"/>
+ <xsd:enumeration value="AdvanceOriginAmount"/>
+ <xsd:enumeration value="AdvanceOriginFee"/>
+ <xsd:enumeration value="Advances"/>
+ <xsd:enumeration value="AdvertisingAllowance"/>
+ <xsd:enumeration value="Affidavit"/>
+ <xsd:enumeration value="AgentDisbursement-Destination"/>
+ <xsd:enumeration value="AgentDisbursement-Origin"/>
+ <xsd:enumeration value="AircraftOnGround"/>
+ <xsd:enumeration value="AirExportCertificate"/>
+ <xsd:enumeration value="AirExpressCharge"/>
+ <xsd:enumeration value="AirlineOpeningFee"/>
+ <xsd:enumeration value="AirportTerminalHandlingCharge"/>
+ <xsd:enumeration value="AirTransportationCharge"/>
+ <xsd:enumeration value="AlcoholicBeverageReportCharge"/>
+ <xsd:enumeration value="AlleghenyCountyPADeliveryCharge"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllowanceLineItems"/>
+ <xsd:enumeration value="AllowanceMessage"/>
+ <xsd:enumeration value="AllowancePerCallOf"/>
+ <xsd:enumeration value="AllowanceAdvance"/>
+ <xsd:enumeration value="AllowanceForConsignmentMerchandise"/>
+ <xsd:enumeration value="AllowanceNon-Performance"/>
+ <xsd:enumeration value="AllowanceRequest"/>
+ <xsd:enumeration value="Alterations"/>
+ <xsd:enumeration value="AmendingExportDocumentation"/>
+ <xsd:enumeration value="AnnealHeatSteelorGlassTreatment"/>
+ <xsd:enumeration value="AnodizingCharge"/>
+ <xsd:enumeration value="Anti-dumpingDuty"/>
+ <xsd:enumeration value="AppointmentNotification"/>
+ <xsd:enumeration value="ArbitraryInAdditionToThroughRatesandCharges"/>
+ <xsd:enumeration value="ArtWork"/>
+ <xsd:enumeration value="Assembly"/>
+ <xsd:enumeration value="AssistAmount"/>
+ <xsd:enumeration value="AttachmentsToBillOfLadingCharge"/>
+ <xsd:enumeration value="BadDebt"/>
+ <xsd:enumeration value="BankingDrafts"/>
+ <xsd:enumeration value="BargeFreightAllKindsService"/>
+ <xsd:enumeration value="BaseCharge"/>
+ <xsd:enumeration value="BasicReorderAllowance"/>
+ <xsd:enumeration value="BeamingCharge"/>
+ <xsd:enumeration value="BeddingFeedingDisinfecting"/>
+ <xsd:enumeration value="BeefFee"/>
+ <xsd:enumeration value="BeyondCharge"/>
+ <xsd:enumeration value="BeyondFreightCharges"/>
+ <xsd:enumeration value="BillAndHold"/>
+ <xsd:enumeration value="BilledDemand"/>
+ <xsd:enumeration value="BillOfLadingAttendancy"/>
+ <xsd:enumeration value="BillOfLadingCharge"/>
+ <xsd:enumeration value="BlackLungTax"/>
+ <xsd:enumeration value="BlockingAndBracingCharge"/>
+ <xsd:enumeration value="BlowerCharge"/>
+ <xsd:enumeration value="BobtailCharges"/>
+ <xsd:enumeration value="BondAmount"/>
+ <xsd:enumeration value="BondCharge"/>
+ <xsd:enumeration value="BopSheet"/>
+ <xsd:enumeration value="BordeauxArbitraries"/>
+ <xsd:enumeration value="Both-Flat"/>
+ <xsd:enumeration value="BreakbulkServices"/>
+ <xsd:enumeration value="BreakBulkSurfaceCharge"/>
+ <xsd:enumeration value="BridgeToll"/>
+ <xsd:enumeration value="BrokenLot"/>
+ <xsd:enumeration value="BrokenPackageCharge"/>
+ <xsd:enumeration value="Brokerage"/>
+ <xsd:enumeration value="BrokerageOrDuty"/>
+ <xsd:enumeration value="BunkerAdjustment"/>
+ <xsd:enumeration value="BunkerAdjustment-20FootContainer"/>
+ <xsd:enumeration value="BunkerAdjustment-40FootContainer"/>
+ <xsd:enumeration value="BunkerSurcharge"/>
+ <xsd:enumeration value="BurdenOverheadOrAllowanceForIndirectCosts"/>
+ <xsd:enumeration value="Burning"/>
+ <xsd:enumeration value="BuyerHandCarry"/>
+ <xsd:enumeration value="BuyersCarAllowance"/>
+ <xsd:enumeration value="CablePressurization"/>
+ <xsd:enumeration value="CablesSendingOf"/>
+ <xsd:enumeration value="CallTag"/>
+ <xsd:enumeration value="CampArbitrary"/>
+ <xsd:enumeration value="CanadaGreatLakesAdditionals"/>
+ <xsd:enumeration value="CanadianCQCustomsClearance"/>
+ <xsd:enumeration value="CanadianCurrencyExchange"/>
+ <xsd:enumeration value="CanadianImportTerminationFee"/>
+ <xsd:enumeration value="CanadianReconsignmentFee"/>
+ <xsd:enumeration value="CanadianRemanifestFee"/>
+ <xsd:enumeration value="CancellationCharge"/>
+ <xsd:enumeration value="CancelledOrderHeavyDutyFlatcar"/>
+ <xsd:enumeration value="Capping"/>
+ <xsd:enumeration value="CaptureAdditionalData"/>
+ <xsd:enumeration value="CargoTaxes"/>
+ <xsd:enumeration value="CarLoading"/>
+ <xsd:enumeration value="CarRental"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CarrierCreditAllowance"/>
+ <xsd:enumeration value="CarrierDebitAllowance"/>
+ <xsd:enumeration value="CarrierNotificationCharge"/>
+ <xsd:enumeration value="Cartage"/>
+ <xsd:enumeration value="CartageCharge"/>
+ <xsd:enumeration value="CatalogingServices"/>
+ <xsd:enumeration value="CentralBuy"/>
+ <xsd:enumeration value="CentsOff"/>
+ <xsd:enumeration value="CertificateOfConformance"/>
+ <xsd:enumeration value="CertificateOfOrigin"/>
+ <xsd:enumeration value="CertificateOfRegistration"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="ChainAndBinders"/>
+ <xsd:enumeration value="ChamberOfCommerceServiceCharge"/>
+ <xsd:enumeration value="ChangeOfAirbill-ServiceFee"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeLineItems"/>
+ <xsd:enumeration value="ChargeMessage"/>
+ <xsd:enumeration value="ChargePerCallOf"/>
+ <xsd:enumeration value="ChargesForwardAdvanceCharge"/>
+ <xsd:enumeration value="CharterServices"/>
+ <xsd:enumeration value="ChassisTransfer"/>
+ <xsd:enumeration value="ChemicalMillingCharge"/>
+ <xsd:enumeration value="ChicagoLoopCharge"/>
+ <xsd:enumeration value="CigaretteStamping"/>
+ <xsd:enumeration value="CityDelivery"/>
+ <xsd:enumeration value="CityMaintenanceFee"/>
+ <xsd:enumeration value="CityPick-up"/>
+ <xsd:enumeration value="CityTerminalCharge"/>
+ <xsd:enumeration value="CleaningCharge"/>
+ <xsd:enumeration value="ClosingSealing"/>
+ <xsd:enumeration value="CoatingDipRustproofEDP"/>
+ <xsd:enumeration value="CODAmount"/>
+ <xsd:enumeration value="CODCharges"/>
+ <xsd:enumeration value="CollectOnDeliveryAlterationCharge"/>
+ <xsd:enumeration value="CollectOnDeliveryDeletionCharge"/>
+ <xsd:enumeration value="CollectSurcharge"/>
+ <xsd:enumeration value="Co-manufacturingDiscount"/>
+ <xsd:enumeration value="Combination"/>
+ <xsd:enumeration value="CombinationPerformanceAndNon-performance"/>
+ <xsd:enumeration value="CombineAllSameDayShipment"/>
+ <xsd:enumeration value="CommissionAmount"/>
+ <xsd:enumeration value="CommunicationsCharges"/>
+ <xsd:enumeration value="CompetitiveAllowance"/>
+ <xsd:enumeration value="CompetitiveCarAllowance"/>
+ <xsd:enumeration value="CompetitivePrice"/>
+ <xsd:enumeration value="CompressorCharge"/>
+ <xsd:enumeration value="ConcessionCredit"/>
+ <xsd:enumeration value="ConcessionMoney"/>
+ <xsd:enumeration value="CongestionSurcharge"/>
+ <xsd:enumeration value="ConnectCharge"/>
+ <xsd:enumeration value="ConservationResearchFee"/>
+ <xsd:enumeration value="ConsigneeUnload"/>
+ <xsd:enumeration value="Consolidation"/>
+ <xsd:enumeration value="ConstantSurveillanceService"/>
+ <xsd:enumeration value="ConstantSurveillanceService-Armed"/>
+ <xsd:enumeration value="ConsularizationFee"/>
+ <xsd:enumeration value="ConsularLegalizationService"/>
+ <xsd:enumeration value="ConsultingService"/>
+ <xsd:enumeration value="ConsumerServiceProviderCharge"/>
+ <xsd:enumeration value="ContainerAllowance"/>
+ <xsd:enumeration value="ContainerDeposits"/>
+ <xsd:enumeration value="ContainerDestuffing"/>
+ <xsd:enumeration value="ContainerDiscount"/>
+ <xsd:enumeration value="ContainerDiversion"/>
+ <xsd:enumeration value="ContainerLease"/>
+ <xsd:enumeration value="ContainerLeasing"/>
+ <xsd:enumeration value="ContainerLossDamage"/>
+ <xsd:enumeration value="ContainerServiceChargeUKEUR"/>
+ <xsd:enumeration value="ContainerServiceChargeUSACanada"/>
+ <xsd:enumeration value="ContainerStuffing"/>
+ <xsd:enumeration value="ContainerTrailerAllowance"/>
+ <xsd:enumeration value="ContinuousMileage"/>
+ <xsd:enumeration value="ContractAllowance"/>
+ <xsd:enumeration value="ContractEscalation"/>
+ <xsd:enumeration value="ContractServiceCharge"/>
+ <xsd:enumeration value="ControlledAtmosphere"/>
+ <xsd:enumeration value="Converting"/>
+ <xsd:enumeration value="Co-opCredit"/>
+ <xsd:enumeration value="CooperativeAdvertisingMerchandisingAllowancePerformance"/>
+ <xsd:enumeration value="Copying"/>
+ <xsd:enumeration value="CopyOfBillOfLadingCharge"/>
+ <xsd:enumeration value="CopyOfDeliveryReceiptCharge"/>
+ <xsd:enumeration value="CoreCharge"/>
+ <xsd:enumeration value="CostRecoveryAdjustment"/>
+ <xsd:enumeration value="CostRecoveryFactor"/>
+ <xsd:enumeration value="CottonFee"/>
+ <xsd:enumeration value="CountAndRecount"/>
+ <xsd:enumeration value="CountervailingDuty"/>
+ <xsd:enumeration value="CouponReimbursement"/>
+ <xsd:enumeration value="Crafting"/>
+ <xsd:enumeration value="Crating"/>
+ <xsd:enumeration value="Credit"/>
+ <xsd:enumeration value="CurrencyAdjustment"/>
+ <xsd:enumeration value="CurrencyAdjustment-20FootContainer"/>
+ <xsd:enumeration value="CurrencyAdjustment-40FootContainer"/>
+ <xsd:enumeration value="CurrencyAdjustment-BreakBulk"/>
+ <xsd:enumeration value="CurrencyAdjustmentFactor"/>
+ <xsd:enumeration value="CurrencyDiscount"/>
+ <xsd:enumeration value="CustomerAccountIdentification"/>
+ <xsd:enumeration value="CustomerEquipmentAllowance"/>
+ <xsd:enumeration value="CustomsBrokerFee"/>
+ <xsd:enumeration value="CustomsCharge"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="CustomsEntry"/>
+ <xsd:enumeration value="CustomsExam"/>
+ <xsd:enumeration value="CustomsFees-ContainerLevel"/>
+ <xsd:enumeration value="CustomsFees-LiftLevel"/>
+ <xsd:enumeration value="CustomsFormalities"/>
+ <xsd:enumeration value="CustomsInvoice"/>
+ <xsd:enumeration value="CustomsInvoice-AdditionalPage"/>
+ <xsd:enumeration value="CustomsPenalty"/>
+ <xsd:enumeration value="Cut"/>
+ <xsd:enumeration value="CutAndParallel"/>
+ <xsd:enumeration value="CuttingCharge"/>
+ <xsd:enumeration value="DamagedMerchandise"/>
+ <xsd:enumeration value="DamageToCarrierEquipment"/>
+ <xsd:enumeration value="DamageToCarrierVessel"/>
+ <xsd:enumeration value="DamageToGovernmentEquipment"/>
+ <xsd:enumeration value="DataDrawingCharge"/>
+ <xsd:enumeration value="DeadheadMileageCharge"/>
+ <xsd:enumeration value="DeafAndDisabledSurcharge"/>
+ <xsd:enumeration value="DeclaredValueForCarriage"/>
+ <xsd:enumeration value="DeclaredValueForCustoms"/>
+ <xsd:enumeration value="DeclaredValueForInsurance"/>
+ <xsd:enumeration value="DeductToMakeMarketValue"/>
+ <xsd:enumeration value="DefectiveAllowance"/>
+ <xsd:enumeration value="DeficitFreight"/>
+ <xsd:enumeration value="De-Installation"/>
+ <xsd:enumeration value="DelayFurnishingDestinationWeights"/>
+ <xsd:enumeration value="Delivery"/>
+ <xsd:enumeration value="DeliverySurcharge"/>
+ <xsd:enumeration value="DemandCharge"/>
+ <xsd:enumeration value="Demurrage"/>
+ <xsd:enumeration value="Demurrage-AverageAgreement"/>
+ <xsd:enumeration value="Demurrage-Special"/>
+ <xsd:enumeration value="Deposit"/>
+ <xsd:enumeration value="DepositCharges"/>
+ <xsd:enumeration value="DepositInLieuOfOrder"/>
+ <xsd:enumeration value="Deramping"/>
+ <xsd:enumeration value="DerrickCharge"/>
+ <xsd:enumeration value="DesignatedSupplierInspection"/>
+ <xsd:enumeration value="DestinationCharge"/>
+ <xsd:enumeration value="DetentionLoading"/>
+ <xsd:enumeration value="DetentionOfPowerUnits"/>
+ <xsd:enumeration value="DetentionOfTrailers"/>
+ <xsd:enumeration value="Detention-SpecialTypeFlatCar"/>
+ <xsd:enumeration value="DetentionUnloading"/>
+ <xsd:enumeration value="DeterminedFreight"/>
+ <xsd:enumeration value="DevelopmentCharge"/>
+ <xsd:enumeration value="DieServiceCharge"/>
+ <xsd:enumeration value="DirectProductHandling"/>
+ <xsd:enumeration value="Disbursement"/>
+ <xsd:enumeration value="DisconnectCharge"/>
+ <xsd:enumeration value="Discount"/>
+ <xsd:enumeration value="Discount-DropBoxConvenienceCtr"/>
+ <xsd:enumeration value="Discount-Incentive"/>
+ <xsd:enumeration value="Discount-MultipleShipment"/>
+ <xsd:enumeration value="Discount-ServiceOptionDelivery"/>
+ <xsd:enumeration value="Discount-ServiceOptionPickup"/>
+ <xsd:enumeration value="Discount-Special"/>
+ <xsd:enumeration value="DisplayAllowance"/>
+ <xsd:enumeration value="DistributionFee"/>
+ <xsd:enumeration value="DistributionService"/>
+ <xsd:enumeration value="DistributorDiscountAllowance"/>
+ <xsd:enumeration value="DiversionAndReconsignment"/>
+ <xsd:enumeration value="DiversionCharge"/>
+ <xsd:enumeration value="DiversionToAirCharge"/>
+ <xsd:enumeration value="Dockage-BoatDetention"/>
+ <xsd:enumeration value="DocumentationCharge"/>
+ <xsd:enumeration value="DocumentHandling"/>
+ <xsd:enumeration value="Door-To-Door"/>
+ <xsd:enumeration value="DowelPinCharge"/>
+ <xsd:enumeration value="DrayagAtPortOfDebarkation"/>
+ <xsd:enumeration value="Drayage"/>
+ <xsd:enumeration value="DrayageatPortOfDebarkationRateZone"/>
+ <xsd:enumeration value="DrayageAtPortOfEmbarkation"/>
+ <xsd:enumeration value="DrayageatPortOfEmbarkationRateZone"/>
+ <xsd:enumeration value="DrayageLineHaul"/>
+ <xsd:enumeration value="DriverAssistedUnloading"/>
+ <xsd:enumeration value="DriversWages"/>
+ <xsd:enumeration value="DropDock"/>
+ <xsd:enumeration value="DropYard"/>
+ <xsd:enumeration value="DrumCost"/>
+ <xsd:enumeration value="DrumDeposit"/>
+ <xsd:enumeration value="DrumUpCharge"/>
+ <xsd:enumeration value="DryerCharge"/>
+ <xsd:enumeration value="DryIce"/>
+ <xsd:enumeration value="Dunnage"/>
+ <xsd:enumeration value="DutyCharge"/>
+ <xsd:enumeration value="DutyDrawback"/>
+ <xsd:enumeration value="EarlyBuyAllowance"/>
+ <xsd:enumeration value="EarlyPaymentAllowance"/>
+ <xsd:enumeration value="EarlyShipAllowance"/>
+ <xsd:enumeration value="EmergencyPortCharge"/>
+ <xsd:enumeration value="EmergencyService"/>
+ <xsd:enumeration value="EmergencySurcharge"/>
+ <xsd:enumeration value="EmptyWeighingCharge"/>
+ <xsd:enumeration value="Enclosure"/>
+ <xsd:enumeration value="EndorsementFee"/>
+ <xsd:enumeration value="Energycharge"/>
+ <xsd:enumeration value="EnergySurchargeFuelAdjustmentFactor"/>
+ <xsd:enumeration value="EngineeringCharge"/>
+ <xsd:enumeration value="EngineeringSupplies"/>
+ <xsd:enumeration value="Engraving"/>
+ <xsd:enumeration value="EnteredValue"/>
+ <xsd:enumeration value="EnvironmentalProtectionService"/>
+ <xsd:enumeration value="EquipmentManufacturerRestorationAudit"/>
+ <xsd:enumeration value="Escalation"/>
+ <xsd:enumeration value="EscortService"/>
+ <xsd:enumeration value="Escrow"/>
+ <xsd:enumeration value="Eur1PresentationFee"/>
+ <xsd:enumeration value="EuropeanPortCharges"/>
+ <xsd:enumeration value="Exact"/>
+ <xsd:enumeration value="ExcessiveValueCharge"/>
+ <xsd:enumeration value="ExcessMileageCharge"/>
+ <xsd:enumeration value="ExcessPeriods"/>
+ <xsd:enumeration value="ExcessValueFee"/>
+ <xsd:enumeration value="ExcessWeight"/>
+ <xsd:enumeration value="ExchangeAccessCredit"/>
+ <xsd:enumeration value="ExclusiveUse"/>
+ <xsd:enumeration value="ExclusiveUseOfEquipment"/>
+ <xsd:enumeration value="ExhibitionDeliveryCharge"/>
+ <xsd:enumeration value="ExhibitionPickupCharge"/>
+ <xsd:enumeration value="ExpandedService"/>
+ <xsd:enumeration value="ExpeditedOneDayConsularService"/>
+ <xsd:enumeration value="ExpeditedServiceCharge"/>
+ <xsd:enumeration value="ExpeditedShipments"/>
+ <xsd:enumeration value="ExpeditingFee"/>
+ <xsd:enumeration value="ExpeditingPremium"/>
+ <xsd:enumeration value="ExportCustomsClearance"/>
+ <xsd:enumeration value="ExportDeclarations-Automated"/>
+ <xsd:enumeration value="ExportDeclarations-USShippers"/>
+ <xsd:enumeration value="ExportImportCharge"/>
+ <xsd:enumeration value="ExportLicenseApplication"/>
+ <xsd:enumeration value="ExportShippingCharge"/>
+ <xsd:enumeration value="ExtraCopiesandMailings"/>
+ <xsd:enumeration value="ExtraLaborHelperService"/>
+ <xsd:enumeration value="ExtraLength"/>
+ <xsd:enumeration value="ExtraLengthSurcharge"/>
+ <xsd:enumeration value="ExtraService-Counter-To-Counter"/>
+ <xsd:enumeration value="FabricationCharge"/>
+ <xsd:enumeration value="FacsimileCharges"/>
+ <xsd:enumeration value="FacsimileCharges-AdditionalPages"/>
+ <xsd:enumeration value="FailedLampPanelCharge"/>
+ <xsd:enumeration value="FaxPre-alert"/>
+ <xsd:enumeration value="FederalTransferSurcharge"/>
+ <xsd:enumeration value="Fee"/>
+ <xsd:enumeration value="FinanceCharge"/>
+ <xsd:enumeration value="FirstArticleCharge"/>
+ <xsd:enumeration value="FirstFlightOut"/>
+ <xsd:enumeration value="FlatrackSurcharge"/>
+ <xsd:enumeration value="FlatRate"/>
+ <xsd:enumeration value="FloorStockProtection"/>
+ <xsd:enumeration value="FoodAndLodging"/>
+ <xsd:enumeration value="ForeignCustomsDuty"/>
+ <xsd:enumeration value="ForeignMilitarySalesRental"/>
+ <xsd:enumeration value="ForeignMilitarySalesSpecialCharge"/>
+ <xsd:enumeration value="ForeignOfficeAdvance"/>
+ <xsd:enumeration value="ForwardCoupons"/>
+ <xsd:enumeration value="ForwardingAgentCommission"/>
+ <xsd:enumeration value="ForwardingCharge"/>
+ <xsd:enumeration value="FranchiseFee"/>
+ <xsd:enumeration value="FreeDomicileShipmentProcessing"/>
+ <xsd:enumeration value="FreeGoods"/>
+ <xsd:enumeration value="Freight"/>
+ <xsd:enumeration value="FreightBasedOnDollarMinimum"/>
+ <xsd:enumeration value="FreightChargesToBorder"/>
+ <xsd:enumeration value="FreightChargesToDestination"/>
+ <xsd:enumeration value="FreightEqualization"/>
+ <xsd:enumeration value="FreightInternational"/>
+ <xsd:enumeration value="FreightInternationalNon-USDollars"/>
+ <xsd:enumeration value="FreightInternationalUSDollars"/>
+ <xsd:enumeration value="FreightPassthrough"/>
+ <xsd:enumeration value="FreightSurcharge"/>
+ <xsd:enumeration value="FreshnessLeakerAllowance"/>
+ <xsd:enumeration value="FuelCharge"/>
+ <xsd:enumeration value="FuelSurcharge"/>
+ <xsd:enumeration value="FullService"/>
+ <xsd:enumeration value="FullTruckloadAllowance"/>
+ <xsd:enumeration value="Fumigation"/>
+ <xsd:enumeration value="GarmentDistrict"/>
+ <xsd:enumeration value="GarmentSurcharge"/>
+ <xsd:enumeration value="GasPressure"/>
+ <xsd:enumeration value="GatewayFee"/>
+ <xsd:enumeration value="Glaze"/>
+ <xsd:enumeration value="GoldFactor"/>
+ <xsd:enumeration value="GoodsAndServicesCharge"/>
+ <xsd:enumeration value="GoodsAndServicesCreditAllowance"/>
+ <xsd:enumeration value="GoodsAndServicesTaxCharge"/>
+ <xsd:enumeration value="GovernmentInspection"/>
+ <xsd:enumeration value="GovernmentWarehouseFee-Destination"/>
+ <xsd:enumeration value="GovernmentWarehouseFee-Origin"/>
+ <xsd:enumeration value="GrainDoors"/>
+ <xsd:enumeration value="GrainFlowCharge"/>
+ <xsd:enumeration value="Gratuity"/>
+ <xsd:enumeration value="Grinding"/>
+ <xsd:enumeration value="GrossReceiptsSurcharge"/>
+ <xsd:enumeration value="GroupageDiscount"/>
+ <xsd:enumeration value="GroupedItems"/>
+ <xsd:enumeration value="GuaranteedInspectionTechnicalService"/>
+ <xsd:enumeration value="GulfPortDeliveryCharge"/>
+ <xsd:enumeration value="Handling"/>
+ <xsd:enumeration value="HandlingChargesOnDistributionFreightForwardedBeyond"/>
+ <xsd:enumeration value="HandlingFreightAtPositionsNotImmediatelyAdjacentToVehicleCharge"/>
+ <xsd:enumeration value="HarborMaintenanceFee"/>
+ <xsd:enumeration value="HarborMaintenanceReport"/>
+ <xsd:enumeration value="HaulingAndHoisting"/>
+ <xsd:enumeration value="HaulingAndHoistingToBeDirectBilled"/>
+ <xsd:enumeration value="HazardousCargoCharge"/>
+ <xsd:enumeration value="HazardousCargoOnDeck"/>
+ <xsd:enumeration value="HazardousMaterialsHandlingFee-Domestic"/>
+ <xsd:enumeration value="HazardousMaterialsHandlingFee-International"/>
+ <xsd:enumeration value="HazardousStorage"/>
+ <xsd:enumeration value="HeatInTransitCharges"/>
+ <xsd:enumeration value="HeatTreatCharge"/>
+ <xsd:enumeration value="HeavyDutyFlatCarCharge"/>
+ <xsd:enumeration value="HeavyLift"/>
+ <xsd:enumeration value="HighSecurityRedIn-bondSealCharge"/>
+ <xsd:enumeration value="HighwayInterchange"/>
+ <xsd:enumeration value="HointinsAndHauling"/>
+ <xsd:enumeration value="HoldingCharge"/>
+ <xsd:enumeration value="HomeLineFreightCharge"/>
+ <xsd:enumeration value="HoneyFee"/>
+ <xsd:enumeration value="Hook-upcharge"/>
+ <xsd:enumeration value="HoseCharge"/>
+ <xsd:enumeration value="HoseChargeSpecial"/>
+ <xsd:enumeration value="HouseholdGoodsPick-upOrDelivery"/>
+ <xsd:enumeration value="IATAAirbillPreparation"/>
+ <xsd:enumeration value="IATAFee"/>
+ <xsd:enumeration value="Identification"/>
+ <xsd:enumeration value="ImportServiceFee"/>
+ <xsd:enumeration value="ImproperDocumentation"/>
+ <xsd:enumeration value="InboundFreightCharges"/>
+ <xsd:enumeration value="IncomeFreightManufacturingToShippingPoint"/>
+ <xsd:enumeration value="IncorrectBillingAccountCharge"/>
+ <xsd:enumeration value="IndustryPriceAllowance"/>
+ <xsd:enumeration value="InitialLicenseFee"/>
+ <xsd:enumeration value="InlandTransportation"/>
+ <xsd:enumeration value="InsideCableConnectors"/>
+ <xsd:enumeration value="InsideDelivery"/>
+ <xsd:enumeration value="InsidePick-up"/>
+ <xsd:enumeration value="InspectAtDestination"/>
+ <xsd:enumeration value="InspectAtOrigin"/>
+ <xsd:enumeration value="Inspection"/>
+ <xsd:enumeration value="Installation"/>
+ <xsd:enumeration value="InstallationAndTraining"/>
+ <xsd:enumeration value="InstallationWarranty"/>
+ <xsd:enumeration value="InsulatedTankCharge"/>
+ <xsd:enumeration value="Insurance"/>
+ <xsd:enumeration value="InsuranceFee"/>
+ <xsd:enumeration value="InsurancePlacementCostCharge"/>
+ <xsd:enumeration value="InsurancePremium"/>
+ <xsd:enumeration value="InsuranceProvidedByLessee"/>
+ <xsd:enumeration value="InsuranceProvidedByLessor"/>
+ <xsd:enumeration value="InsuranceSurcharge"/>
+ <xsd:enumeration value="InterdivisionProfit"/>
+ <xsd:enumeration value="InterestAmount"/>
+ <xsd:enumeration value="InterestOnRefund"/>
+ <xsd:enumeration value="InterestOnSecurityDeposit"/>
+ <xsd:enumeration value="InterimUsePermittedAtSpecialRate"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationCommission"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationMarkup"/>
+ <xsd:enumeration value="InternationalCourier"/>
+ <xsd:enumeration value="InternationalDoor-to-DoorHandlingFee"/>
+ <xsd:enumeration value="InterplantCharge"/>
+ <xsd:enumeration value="InterstateHighwayToll"/>
+ <xsd:enumeration value="InTransitPriceProtection"/>
+ <xsd:enumeration value="Intra-plantCharge"/>
+ <xsd:enumeration value="InvoiceAdditionalAmount"/>
+ <xsd:enumeration value="InvoiceAdjustment"/>
+ <xsd:enumeration value="InvoiceAt-CostAmount"/>
+ <xsd:enumeration value="InvoiceDeliveryTermsAmount"/>
+ <xsd:enumeration value="InvoiceNo-ChargeAmount"/>
+ <xsd:enumeration value="InvoiceServices"/>
+ <xsd:enumeration value="InvoiceWithGoods"/>
+ <xsd:enumeration value="IrishArbitraries"/>
+ <xsd:enumeration value="IslandDeliveryCharge"/>
+ <xsd:enumeration value="IslandPick-UpCharge"/>
+ <xsd:enumeration value="ItalianReleaseCharge"/>
+ <xsd:enumeration value="ItemPercentage"/>
+ <xsd:enumeration value="Item-Unit"/>
+ <xsd:enumeration value="KeepFromFreezingPercentDifferential"/>
+ <xsd:enumeration value="Koshering"/>
+ <xsd:enumeration value="LabelAllowance"/>
+ <xsd:enumeration value="Labeling"/>
+ <xsd:enumeration value="LaborCharges"/>
+ <xsd:enumeration value="LaborCostOfRemoval"/>
+ <xsd:enumeration value="LaborModify"/>
+ <xsd:enumeration value="LaborNoTroubleFound"/>
+ <xsd:enumeration value="LaborOvertime"/>
+ <xsd:enumeration value="LaborPremiumOvertime"/>
+ <xsd:enumeration value="LaborRepairAndReturnOrders"/>
+ <xsd:enumeration value="LaborService"/>
+ <xsd:enumeration value="LaborStraight-time"/>
+ <xsd:enumeration value="LaborTestAndCalibrate"/>
+ <xsd:enumeration value="LadingAdjustmentCharge"/>
+ <xsd:enumeration value="LandCurrencyAdjustmentFactor-20FootContainer"/>
+ <xsd:enumeration value="LandCurrencyAdjustmentFactor-40FootContainer"/>
+ <xsd:enumeration value="Lashing"/>
+ <xsd:enumeration value="LateOrderCharge"/>
+ <xsd:enumeration value="LatePaymentCharge"/>
+ <xsd:enumeration value="LayoutDesign"/>
+ <xsd:enumeration value="LayoverCharges"/>
+ <xsd:enumeration value="LeadFactor"/>
+ <xsd:enumeration value="LeakingUndergroundStorageTax"/>
+ <xsd:enumeration value="LeaseShortfallConsideration"/>
+ <xsd:enumeration value="LessThanContainer"/>
+ <xsd:enumeration value="LessThanTruckloadCharge"/>
+ <xsd:enumeration value="LetterOfCreditProcessing"/>
+ <xsd:enumeration value="LicenseAndTitle"/>
+ <xsd:enumeration value="LifelineSurcharge"/>
+ <xsd:enumeration value="LiftGateTruckOrForkliftServiceAtPick-upDelivery"/>
+ <xsd:enumeration value="LimeFee"/>
+ <xsd:enumeration value="LineItemAllowance"/>
+ <xsd:enumeration value="LineItemCharge"/>
+ <xsd:enumeration value="LinehaulFromPortOfDebarkation"/>
+ <xsd:enumeration value="LinehaulPercentDifferential"/>
+ <xsd:enumeration value="LinehaulToPortOfEmbarkation"/>
+ <xsd:enumeration value="LinerTermsAtPortOfDebarkation"/>
+ <xsd:enumeration value="LinerTermsAtPortOfEmbarkation"/>
+ <xsd:enumeration value="LiquidatedDamages"/>
+ <xsd:enumeration value="LiquidationAnti-DumpingDuty"/>
+ <xsd:enumeration value="LiquidationCountervailingDuty"/>
+ <xsd:enumeration value="LiquidationTaxAmount"/>
+ <xsd:enumeration value="LiquidationTotalDueUSCustomsService"/>
+ <xsd:enumeration value="LiquidationTotalFees"/>
+ <xsd:enumeration value="Loading"/>
+ <xsd:enumeration value="LoadingLaborCharges"/>
+ <xsd:enumeration value="LoadWeighingCharge"/>
+ <xsd:enumeration value="LoanFee"/>
+ <xsd:enumeration value="LocalDeliveryDrayage"/>
+ <xsd:enumeration value="LocomotiveDelayedInSwitchingService"/>
+ <xsd:enumeration value="LocomotiveUnderOwnPower"/>
+ <xsd:enumeration value="LotCharge"/>
+ <xsd:enumeration value="LotteryChargeBack"/>
+ <xsd:enumeration value="LotteryCrossRedeemed"/>
+ <xsd:enumeration value="Low-TierLotteryCashingBonus"/>
+ <xsd:enumeration value="Low-TierLotteryWinners"/>
+ <xsd:enumeration value="LumpSum"/>
+ <xsd:enumeration value="MachiningCharge"/>
+ <xsd:enumeration value="MailFee"/>
+ <xsd:enumeration value="Mailing-PostageCost"/>
+ <xsd:enumeration value="Mailing-ServiceFee"/>
+ <xsd:enumeration value="MailInvoice"/>
+ <xsd:enumeration value="MailInvoiceToEachLocation"/>
+ <xsd:enumeration value="ManifestCharge"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="MarketDevelopmentFunds"/>
+ <xsd:enumeration value="MarkingOrTaggingCharge"/>
+ <xsd:enumeration value="MarriageRule"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="MemoReturnableContainer"/>
+ <xsd:enumeration value="MerchandiseProcessingFee"/>
+ <xsd:enumeration value="MessageCharge"/>
+ <xsd:enumeration value="MessageRateAdjustment"/>
+ <xsd:enumeration value="MessengerService"/>
+ <xsd:enumeration value="MetalsSurcharge"/>
+ <xsd:enumeration value="MeterCharge"/>
+ <xsd:enumeration value="Mid-TierLotteryCashingBonus"/>
+ <xsd:enumeration value="Mid-TierLotteryWinners"/>
+ <xsd:enumeration value="MileageFeeForRepairAndReturn"/>
+ <xsd:enumeration value="MileageOrTravel"/>
+ <xsd:enumeration value="Minus-Amount"/>
+ <xsd:enumeration value="Minus-Percentage"/>
+ <xsd:enumeration value="ModifiedAtmosphere"/>
+ <xsd:enumeration value="MonthlyRental"/>
+ <xsd:enumeration value="MountDemount"/>
+ <xsd:enumeration value="Mounting"/>
+ <xsd:enumeration value="MunicipalSurcharge"/>
+ <xsd:enumeration value="MushroomFee"/>
+ <xsd:enumeration value="NewDiscount"/>
+ <xsd:enumeration value="NewDistributionAllowance"/>
+ <xsd:enumeration value="NewItemAllowance"/>
+ <xsd:enumeration value="NewStoreAllowance"/>
+ <xsd:enumeration value="NewStoreDiscount"/>
+ <xsd:enumeration value="NewWarehouse"/>
+ <xsd:enumeration value="NewWarehouseDiscount"/>
+ <xsd:enumeration value="NewYorkDeliveryCharge"/>
+ <xsd:enumeration value="NewYorkPick-upCharge"/>
+ <xsd:enumeration value="NHDWharfage"/>
+ <xsd:enumeration value="NoAllowance"/>
+ <xsd:enumeration value="NoAllowanceOrCharge"/>
+ <xsd:enumeration value="NoCharge"/>
+ <xsd:enumeration value="Non-DutiableCharges"/>
+ <xsd:enumeration value="NonGeneratedFreight"/>
+ <xsd:enumeration value="Non-returnableContainers"/>
+ <xsd:enumeration value="NoReturnCreditAllowance"/>
+ <xsd:enumeration value="NormalPumpCharge"/>
+ <xsd:enumeration value="NotarizedAffidavit"/>
+ <xsd:enumeration value="NotifyConsignee"/>
+ <xsd:enumeration value="NotifyConsigneeBeforeDelivery"/>
+ <xsd:enumeration value="NozzleCharge"/>
+ <xsd:enumeration value="OceanCharges-Hazardous"/>
+ <xsd:enumeration value="OceanFreight"/>
+ <xsd:enumeration value="OfficeSupplies"/>
+ <xsd:enumeration value="Offshore-AlaskaHawaii"/>
+ <xsd:enumeration value="OnCarriage"/>
+ <xsd:enumeration value="OnDeckBreakBulkDifferential"/>
+ <xsd:enumeration value="One-DayService"/>
+ <xsd:enumeration value="OneTimeEngineeringCharge"/>
+ <xsd:enumeration value="One-TimeLicenseFee"/>
+ <xsd:enumeration value="One-Time-OnlyCharge"/>
+ <xsd:enumeration value="OnetimeTooling"/>
+ <xsd:enumeration value="OnHandService"/>
+ <xsd:enumeration value="OperatorCredit"/>
+ <xsd:enumeration value="OptionalCharge"/>
+ <xsd:enumeration value="OptionalSoftwareSupportForOperationalSupportSystems"/>
+ <xsd:enumeration value="OptionalSoftwareSupportForSwitchingSystems"/>
+ <xsd:enumeration value="OptionChargeColorFabricOfficeFurniture"/>
+ <xsd:enumeration value="Order-Flat"/>
+ <xsd:enumeration value="OrderNotifyCharge"/>
+ <xsd:enumeration value="OtherAccessorialServiceCharge"/>
+ <xsd:enumeration value="OtherAdvances"/>
+ <xsd:enumeration value="OtherExportCharges"/>
+ <xsd:enumeration value="OtherGovernmentAgencyDeclaration"/>
+ <xsd:enumeration value="OtherGovernmentAgencyExam"/>
+ <xsd:enumeration value="OtherImportCharge"/>
+ <xsd:enumeration value="OtherMiscellaneousEarningOrAdditive"/>
+ <xsd:enumeration value="OtherSeeRelatedDescription"/>
+ <xsd:enumeration value="OutOfRouteMiles"/>
+ <xsd:enumeration value="OutOfZonePick-upOrDelivery"/>
+ <xsd:enumeration value="OutsideCableConnectors"/>
+ <xsd:enumeration value="OverDimension"/>
+ <xsd:enumeration value="OverHeightContainer"/>
+ <xsd:enumeration value="OverrunCharge"/>
+ <xsd:enumeration value="OversizedPremium"/>
+ <xsd:enumeration value="OvertimeLoading"/>
+ <xsd:enumeration value="OverWidthContainer"/>
+ <xsd:enumeration value="Packaging"/>
+ <xsd:enumeration value="PackagingService"/>
+ <xsd:enumeration value="PackingCratingAndHandlingCharge"/>
+ <xsd:enumeration value="PackingCratingHandlingAndTransportationCharge"/>
+ <xsd:enumeration value="PackInvoiceWithShipment"/>
+ <xsd:enumeration value="PaintingPrimerOrFinish"/>
+ <xsd:enumeration value="Pallet"/>
+ <xsd:enumeration value="PalletExchangeCharge"/>
+ <xsd:enumeration value="Palletizing"/>
+ <xsd:enumeration value="Paralleling"/>
+ <xsd:enumeration value="ParishCountySalesTaxOnly"/>
+ <xsd:enumeration value="PassingShippersExportEntry"/>
+ <xsd:enumeration value="Payment"/>
+ <xsd:enumeration value="PayrollAdditivesOvertimeLabor"/>
+ <xsd:enumeration value="PayrollAdditivesStraightTimeLabor"/>
+ <xsd:enumeration value="PayrollTaxes"/>
+ <xsd:enumeration value="PecanFee"/>
+ <xsd:enumeration value="PenaltyCharge"/>
+ <xsd:enumeration value="PercentDifferential-LessThanContainer"/>
+ <xsd:enumeration value="PercentOfProduct"/>
+ <xsd:enumeration value="PercentOfShipmentValueThatIsReturnable"/>
+ <xsd:enumeration value="PercentOfShippedQuantityThatIsReturnable"/>
+ <xsd:enumeration value="PerformanceAllowance"/>
+ <xsd:enumeration value="PerformanceAward"/>
+ <xsd:enumeration value="PerItemCharge"/>
+ <xsd:enumeration value="PermitCharge"/>
+ <xsd:enumeration value="PermitsBondsEscortAttendant"/>
+ <xsd:enumeration value="PerOrderCharge"/>
+ <xsd:enumeration value="PerPoundCharge"/>
+ <xsd:enumeration value="PersonalPropertyMember"/>
+ <xsd:enumeration value="PersonalPropertySpouse"/>
+ <xsd:enumeration value="PhosphatizingSteelTreatment"/>
+ <xsd:enumeration value="PickleAndOil"/>
+ <xsd:enumeration value="PickUp"/>
+ <xsd:enumeration value="Pick-upAndDelivery"/>
+ <xsd:enumeration value="Pickup-OutOfArea"/>
+ <xsd:enumeration value="PickupSurcharge"/>
+ <xsd:enumeration value="PierChargesOtherThanWharfage"/>
+ <xsd:enumeration value="PierCharges-Wharfage"/>
+ <xsd:enumeration value="PierPick-upAndOrDelivery"/>
+ <xsd:enumeration value="PierUnloading"/>
+ <xsd:enumeration value="PilotInspection"/>
+ <xsd:enumeration value="PlacementAndOrRemovalCharge"/>
+ <xsd:enumeration value="Plating"/>
+ <xsd:enumeration value="Plus-Amount"/>
+ <xsd:enumeration value="Plus-Percentage"/>
+ <xsd:enumeration value="PlusOrMinus-Amount"/>
+ <xsd:enumeration value="PlusOrMinus-Percentage"/>
+ <xsd:enumeration value="PoleLashingEquipmentSurcharge"/>
+ <xsd:enumeration value="PoleWood-ServiceCharge"/>
+ <xsd:enumeration value="PorkFee"/>
+ <xsd:enumeration value="PortChanges"/>
+ <xsd:enumeration value="PortHandlingAndUnloading"/>
+ <xsd:enumeration value="PositioningAtOrigin"/>
+ <xsd:enumeration value="Postage"/>
+ <xsd:enumeration value="PostDamagedHandling"/>
+ <xsd:enumeration value="PotatoFee"/>
+ <xsd:enumeration value="PowerFactorAdjustment"/>
+ <xsd:enumeration value="Pre-carriage"/>
+ <xsd:enumeration value="Pre-carriageExcess"/>
+ <xsd:enumeration value="PreciousMetalContent"/>
+ <xsd:enumeration value="PreloadingCharge"/>
+ <xsd:enumeration value="PrelodgeCharge"/>
+ <xsd:enumeration value="PremiseUse"/>
+ <xsd:enumeration value="PremiumCharge"/>
+ <xsd:enumeration value="PremiumTransportation"/>
+ <xsd:enumeration value="PrepaidUsageAllowance"/>
+ <xsd:enumeration value="Preparation"/>
+ <xsd:enumeration value="PreparationAndDelivery"/>
+ <xsd:enumeration value="PreparationOfAirWaybill-Origin"/>
+ <xsd:enumeration value="PreparationOfCanadianCustomsInvoice"/>
+ <xsd:enumeration value="PreparationOfCommercialInvoice"/>
+ <xsd:enumeration value="PreparationOfExportEntry"/>
+ <xsd:enumeration value="PreparationOfInsuranceCertificate"/>
+ <xsd:enumeration value="PreparationOfUSExportDocumentation"/>
+ <xsd:enumeration value="Pre-PositionedInventoryService"/>
+ <xsd:enumeration value="PreviousBilling"/>
+ <xsd:enumeration value="PriceAdjustmentPercent"/>
+ <xsd:enumeration value="PriceAndMarketingAllowance"/>
+ <xsd:enumeration value="PriceDeviation"/>
+ <xsd:enumeration value="PriorBalance"/>
+ <xsd:enumeration value="PriorBillingAmount"/>
+ <xsd:enumeration value="PriorDeliveryOfBillCharge"/>
+ <xsd:enumeration value="PriorityService"/>
+ <xsd:enumeration value="PriorMonthCredit"/>
+ <xsd:enumeration value="PrivateOwnedVehicleProcessing"/>
+ <xsd:enumeration value="Processing"/>
+ <xsd:enumeration value="ProcessingCharge"/>
+ <xsd:enumeration value="ProcessInTransitPrivilege"/>
+ <xsd:enumeration value="ProcurementCharge"/>
+ <xsd:enumeration value="ProfessionalFees"/>
+ <xsd:enumeration value="ProformaInvoice"/>
+ <xsd:enumeration value="ProgressPaymentRequirement"/>
+ <xsd:enumeration value="PromotionalAllowance"/>
+ <xsd:enumeration value="PromotionalDiscount"/>
+ <xsd:enumeration value="ProofComposition"/>
+ <xsd:enumeration value="ProofOfDelivery"/>
+ <xsd:enumeration value="ProtectiveServiceCharge"/>
+ <xsd:enumeration value="ProtectiveService-Cold"/>
+ <xsd:enumeration value="ProtectiveService-Heat"/>
+ <xsd:enumeration value="ProvideHouseholdIdentifier"/>
+ <xsd:enumeration value="ProvideNameAndAddress"/>
+ <xsd:enumeration value="PullingEyes"/>
+ <xsd:enumeration value="PumpAirCharge"/>
+ <xsd:enumeration value="PumpCharge"/>
+ <xsd:enumeration value="PurchaseOption"/>
+ <xsd:enumeration value="QuantityDiscount"/>
+ <xsd:enumeration value="QuantitySurcharge"/>
+ <xsd:enumeration value="RailheadHandling"/>
+ <xsd:enumeration value="Ramping"/>
+ <xsd:enumeration value="RateCode"/>
+ <xsd:enumeration value="RateReductionBond"/>
+ <xsd:enumeration value="Rebate"/>
+ <xsd:enumeration value="Re-BillCharge"/>
+ <xsd:enumeration value="RebilledDrayage-Destination"/>
+ <xsd:enumeration value="RebilledDrayage-Origin"/>
+ <xsd:enumeration value="Receiving"/>
+ <xsd:enumeration value="RecipientAddressCorrection"/>
+ <xsd:enumeration value="ReclamationCenterHandlingChute"/>
+ <xsd:enumeration value="ReclamationFederal"/>
+ <xsd:enumeration value="ReclamationSharedResponsibility"/>
+ <xsd:enumeration value="ReclamationState"/>
+ <xsd:enumeration value="Reconciliation"/>
+ <xsd:enumeration value="Reconnectcharge"/>
+ <xsd:enumeration value="ReconsignConsigneeCharge"/>
+ <xsd:enumeration value="ReconsignDeliveryCharge"/>
+ <xsd:enumeration value="ReconsignmentCharge"/>
+ <xsd:enumeration value="RecooperingAtOwnersOrShippersExpense"/>
+ <xsd:enumeration value="RecordFiling"/>
+ <xsd:enumeration value="Recovery"/>
+ <xsd:enumeration value="RecoveryFee"/>
+ <xsd:enumeration value="RecratingRecoopering-Destination"/>
+ <xsd:enumeration value="RecratingRecoopering-Origin"/>
+ <xsd:enumeration value="RecurringHardwareMaintenanceCharge"/>
+ <xsd:enumeration value="RecurringLicenseFee"/>
+ <xsd:enumeration value="RecurringSoftwareMaintenanceCharge"/>
+ <xsd:enumeration value="Redelivery"/>
+ <xsd:enumeration value="RedistributionAllowance"/>
+ <xsd:enumeration value="ReductionPrepalletizedCargo"/>
+ <xsd:enumeration value="ReeferCargoPercentDifferential"/>
+ <xsd:enumeration value="ReeferMaintenance"/>
+ <xsd:enumeration value="Reel"/>
+ <xsd:enumeration value="ReelCable"/>
+ <xsd:enumeration value="ReelDeposit"/>
+ <xsd:enumeration value="Refrigeration"/>
+ <xsd:enumeration value="RefrigerationMechanicalDetention"/>
+ <xsd:enumeration value="Refund"/>
+ <xsd:enumeration value="RefurbishingCharge"/>
+ <xsd:enumeration value="Regain"/>
+ <xsd:enumeration value="RegistrationOfExportForReentry"/>
+ <xsd:enumeration value="RegistrationOfExportShipments"/>
+ <xsd:enumeration value="RegulatoryFee"/>
+ <xsd:enumeration value="RegulatoryRequiredRefund"/>
+ <xsd:enumeration value="ReliabilityCharge"/>
+ <xsd:enumeration value="RelinquishmentCharge"/>
+ <xsd:enumeration value="ReliquidationAnti-DumpingDuty"/>
+ <xsd:enumeration value="ReliquidationCountervailingDuty"/>
+ <xsd:enumeration value="ReliquidationTaxAmount"/>
+ <xsd:enumeration value="ReliquidationTotalDueUSCustomsService"/>
+ <xsd:enumeration value="ReliquidationTotalFees"/>
+ <xsd:enumeration value="RentalCharge"/>
+ <xsd:enumeration value="RentalDeduction"/>
+ <xsd:enumeration value="RentsAndLeases"/>
+ <xsd:enumeration value="RepackCharge"/>
+ <xsd:enumeration value="Repair"/>
+ <xsd:enumeration value="RepairAtBuyersExpenseCharge"/>
+ <xsd:enumeration value="RepairAtCustomerExpenseCharge"/>
+ <xsd:enumeration value="RepairAtGovernmentExpenseCharge"/>
+ <xsd:enumeration value="Repickup"/>
+ <xsd:enumeration value="RequestViaCanada"/>
+ <xsd:enumeration value="ResearchDevelopmentFee"/>
+ <xsd:enumeration value="ResellersDiscount"/>
+ <xsd:enumeration value="ResidentialDelivery"/>
+ <xsd:enumeration value="ResidentialPick-up"/>
+ <xsd:enumeration value="Respotting"/>
+ <xsd:enumeration value="RestockingCharge"/>
+ <xsd:enumeration value="RestrictedArticleFee"/>
+ <xsd:enumeration value="Retainer"/>
+ <xsd:enumeration value="ReturnableContainer"/>
+ <xsd:enumeration value="ReturnCargoCharge"/>
+ <xsd:enumeration value="ReturnedLoad"/>
+ <xsd:enumeration value="Rework"/>
+ <xsd:enumeration value="RidingAttendantCharge"/>
+ <xsd:enumeration value="RockyMountainBureau583Item1100ArbitraryCharge"/>
+ <xsd:enumeration value="RollOutAdjustment"/>
+ <xsd:enumeration value="RollRebate"/>
+ <xsd:enumeration value="Royalties"/>
+ <xsd:enumeration value="Salvage"/>
+ <xsd:enumeration value="Same-DayService"/>
+ <xsd:enumeration value="SaturdayDelivery"/>
+ <xsd:enumeration value="SaturdayPick-Up"/>
+ <xsd:enumeration value="SaturdayPick-upOrDeliveryCharge"/>
+ <xsd:enumeration value="ScaleCharge"/>
+ <xsd:enumeration value="ScaleChargeUnloading"/>
+ <xsd:enumeration value="ScrapAllowance"/>
+ <xsd:enumeration value="SecuritySignatureService"/>
+ <xsd:enumeration value="SegregatingSorting"/>
+ <xsd:enumeration value="SelectCharge"/>
+ <xsd:enumeration value="SelfUnloader"/>
+ <xsd:enumeration value="SellerHandCarry"/>
+ <xsd:enumeration value="ServiceAssistanceProgramSurcharge"/>
+ <xsd:enumeration value="ServiceCharge"/>
+ <xsd:enumeration value="ServiceChargeWithCashDiscount"/>
+ <xsd:enumeration value="ServiceUpgrade"/>
+ <xsd:enumeration value="Set-up"/>
+ <xsd:enumeration value="Shearing"/>
+ <xsd:enumeration value="SheepFee"/>
+ <xsd:enumeration value="ShipperLoad"/>
+ <xsd:enumeration value="ShipperLoadAndCount"/>
+ <xsd:enumeration value="ShipperLoadCarrierCount"/>
+ <xsd:enumeration value="ShipperLoadConsigneeUnload"/>
+ <xsd:enumeration value="Shipping"/>
+ <xsd:enumeration value="ShippingAndHandling"/>
+ <xsd:enumeration value="ShipsidePickup"/>
+ <xsd:enumeration value="ShipToStockQualityAudit"/>
+ <xsd:enumeration value="Shotblasting"/>
+ <xsd:enumeration value="ShrinkageAllowance"/>
+ <xsd:enumeration value="ShrinkAllowance"/>
+ <xsd:enumeration value="Shrink-WrapCharge"/>
+ <xsd:enumeration value="SingleFactorOriginationDestination"/>
+ <xsd:enumeration value="SingleFactorOriginationPortOfDebarkation"/>
+ <xsd:enumeration value="SingleFactorPortOfEmbarkationDestination"/>
+ <xsd:enumeration value="SingleInvoiceAllowance"/>
+ <xsd:enumeration value="SinglePick-up"/>
+ <xsd:enumeration value="SingleShipmentFee"/>
+ <xsd:enumeration value="Sleeving"/>
+ <xsd:enumeration value="SlipSheetRail"/>
+ <xsd:enumeration value="SlipSheetTruck"/>
+ <xsd:enumeration value="SlipSheetUnloadingAllowance"/>
+ <xsd:enumeration value="SlottingAllowance"/>
+ <xsd:enumeration value="SmallOrderCharge"/>
+ <xsd:enumeration value="SoftwareSupportService"/>
+ <xsd:enumeration value="SourceInspection"/>
+ <xsd:enumeration value="SpecialAllowance"/>
+ <xsd:enumeration value="SpecialBuy"/>
+ <xsd:enumeration value="SpecialCircusTrains"/>
+ <xsd:enumeration value="SpecialCredit"/>
+ <xsd:enumeration value="SpecialDelivery"/>
+ <xsd:enumeration value="SpecialDetentionCharge"/>
+ <xsd:enumeration value="SpecialEquipmentCharge"/>
+ <xsd:enumeration value="SpecialFinishCharge"/>
+ <xsd:enumeration value="SpecialFreightSupplements"/>
+ <xsd:enumeration value="SpecialHandling"/>
+ <xsd:enumeration value="SpecialMileageMovements"/>
+ <xsd:enumeration value="SpecialPackaging"/>
+ <xsd:enumeration value="SpecialPermits"/>
+ <xsd:enumeration value="SpecialPickup"/>
+ <xsd:enumeration value="SpecialPumpCharge"/>
+ <xsd:enumeration value="SpecialSealCharge"/>
+ <xsd:enumeration value="SpecialServices"/>
+ <xsd:enumeration value="SpecialTestEquipmentCharge"/>
+ <xsd:enumeration value="SpecialToolingCharge"/>
+ <xsd:enumeration value="SpecialToolingreworkcharge"/>
+ <xsd:enumeration value="SpecialTrainMovement"/>
+ <xsd:enumeration value="SpecialUse"/>
+ <xsd:enumeration value="SpecialVehicleRent"/>
+ <xsd:enumeration value="SpecificationReview"/>
+ <xsd:enumeration value="SpecificDuty"/>
+ <xsd:enumeration value="SplitDelivery"/>
+ <xsd:enumeration value="SplitPick-up"/>
+ <xsd:enumeration value="SplitPick-UpAtPierCharge"/>
+ <xsd:enumeration value="SpoolCharge"/>
+ <xsd:enumeration value="SpottingOfTrailer"/>
+ <xsd:enumeration value="SpreaderCharge"/>
+ <xsd:enumeration value="StampFee"/>
+ <xsd:enumeration value="Stamping"/>
+ <xsd:enumeration value="StandbyCharge"/>
+ <xsd:enumeration value="StateMetropolitanTransitAuthoritySurcharge"/>
+ <xsd:enumeration value="StateMotorFuel"/>
+ <xsd:enumeration value="StateSalesCharge"/>
+ <xsd:enumeration value="StateSurcharge"/>
+ <xsd:enumeration value="SteamingCharge"/>
+ <xsd:enumeration value="StencilingCharge"/>
+ <xsd:enumeration value="Stopcharge"/>
+ <xsd:enumeration value="Stop-offAtDestination"/>
+ <xsd:enumeration value="Stop-offAtOrigination"/>
+ <xsd:enumeration value="Stop-offAtPierCharge"/>
+ <xsd:enumeration value="Stop-offCharge"/>
+ <xsd:enumeration value="StoppingInTransit"/>
+ <xsd:enumeration value="Storage"/>
+ <xsd:enumeration value="StorageInTransit"/>
+ <xsd:enumeration value="StraighteningCharge"/>
+ <xsd:enumeration value="Strapping"/>
+ <xsd:enumeration value="StreetLampsCharge"/>
+ <xsd:enumeration value="StrippingSortingAndConsolidation"/>
+ <xsd:enumeration value="Stuffing"/>
+ <xsd:enumeration value="StuffingCharge"/>
+ <xsd:enumeration value="SubjectToCooperativeAdvertisingAllowance"/>
+ <xsd:enumeration value="SubjectToTaxOnResale"/>
+ <xsd:enumeration value="SufferanceWarehouseChargeExportOrImport"/>
+ <xsd:enumeration value="SugarFee"/>
+ <xsd:enumeration value="SumOfAddsAndDeductsToMakeMarketValue"/>
+ <xsd:enumeration value="SundayOrHolidayPick-upOrDelivery"/>
+ <xsd:enumeration value="SuperBagCharge"/>
+ <xsd:enumeration value="SupervisorCharge"/>
+ <xsd:enumeration value="SupplementalDuty"/>
+ <xsd:enumeration value="SupplementalItems"/>
+ <xsd:enumeration value="Surcharge"/>
+ <xsd:enumeration value="SuretyBond"/>
+ <xsd:enumeration value="Swell"/>
+ <xsd:enumeration value="SwitchCharge"/>
+ <xsd:enumeration value="SwitchingCharge"/>
+ <xsd:enumeration value="TankCarAllowance"/>
+ <xsd:enumeration value="TankRental"/>
+ <xsd:enumeration value="Tarping"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="Tax-AirportTaxDestination"/>
+ <xsd:enumeration value="Tax-AirportTaxOrigin"/>
+ <xsd:enumeration value="Tax-BeverageTax"/>
+ <xsd:enumeration value="Tax-CitySalesTaxOnly"/>
+ <xsd:enumeration value="TaxCredit"/>
+ <xsd:enumeration value="Tax-ExciseTax-Destination"/>
+ <xsd:enumeration value="Tax-ExciseTax-Origin"/>
+ <xsd:enumeration value="Tax-FederalExciseTax"/>
+ <xsd:enumeration value="Tax-FederalExciseTaxOnTires"/>
+ <xsd:enumeration value="Tax-Governmental"/>
+ <xsd:enumeration value="Tax-HandlingChargeTax"/>
+ <xsd:enumeration value="TaxLiability-Amortized"/>
+ <xsd:enumeration value="TaxLiability-OneTime"/>
+ <xsd:enumeration value="Tax-LocalSalesTax"/>
+ <xsd:enumeration value="Tax-LocalTax"/>
+ <xsd:enumeration value="Tax-MetropolitanTransitTax"/>
+ <xsd:enumeration value="TaxOnMiscellaneousCharges"/>
+ <xsd:enumeration value="TaxOnTransportation"/>
+ <xsd:enumeration value="Tax-RegulatoryTax"/>
+ <xsd:enumeration value="Tax-SalesandUse"/>
+ <xsd:enumeration value="Tax-SalesTaxStateAndLocal"/>
+ <xsd:enumeration value="Tax-StateHazardousSubstance"/>
+ <xsd:enumeration value="Tax-StateTax"/>
+ <xsd:enumeration value="Tax-SuperFundExciseTax"/>
+ <xsd:enumeration value="Tax-UseTax"/>
+ <xsd:enumeration value="Tax-ValueAddedTax"/>
+ <xsd:enumeration value="TeaFee"/>
+ <xsd:enumeration value="TechnologyExchange"/>
+ <xsd:enumeration value="TelegramChargeback"/>
+ <xsd:enumeration value="TelephoneCharge"/>
+ <xsd:enumeration value="Telephone-Destination"/>
+ <xsd:enumeration value="Telephone-Origin"/>
+ <xsd:enumeration value="TemperatureProtection"/>
+ <xsd:enumeration value="TemporaryAllowance"/>
+ <xsd:enumeration value="TemporaryVoluntaryAllowance"/>
+ <xsd:enumeration value="TenderedAsTruckload"/>
+ <xsd:enumeration value="TerminalCharge"/>
+ <xsd:enumeration value="TerminalDifferential"/>
+ <xsd:enumeration value="TerminalHandlingCharges"/>
+ <xsd:enumeration value="TerminalServiceFee"/>
+ <xsd:enumeration value="TermsAllowance"/>
+ <xsd:enumeration value="Testing"/>
+ <xsd:enumeration value="TestingServicesCharge"/>
+ <xsd:enumeration value="TestQualificationCharge"/>
+ <xsd:enumeration value="ThirdPartyAllowance"/>
+ <xsd:enumeration value="ThirdPartyPallets"/>
+ <xsd:enumeration value="ThroughputAllowance"/>
+ <xsd:enumeration value="ThroughputContainerCharge"/>
+ <xsd:enumeration value="ThruwayCharge"/>
+ <xsd:enumeration value="TicketingService"/>
+ <xsd:enumeration value="TobaccoProductsReportCharge"/>
+ <xsd:enumeration value="TOFCServiceCharge"/>
+ <xsd:enumeration value="ToolCharge"/>
+ <xsd:enumeration value="Tooling"/>
+ <xsd:enumeration value="ToolingReworkCharge"/>
+ <xsd:enumeration value="ToolsForPrinting"/>
+ <xsd:enumeration value="TotalOther"/>
+ <xsd:enumeration value="TotalAssessorialCharges"/>
+ <xsd:enumeration value="TotalDueUSCustomsService"/>
+ <xsd:enumeration value="TotalFees"/>
+ <xsd:enumeration value="TotalInvoiceAmount"/>
+ <xsd:enumeration value="TotalInvoiceAmountNon-USDollars"/>
+ <xsd:enumeration value="TotalInvoiceAmountUSDollars"/>
+ <xsd:enumeration value="TotalMaterialInvoiceAmount"/>
+ <xsd:enumeration value="TracingInboundViaOtherCarriers"/>
+ <xsd:enumeration value="TracingServiceFee"/>
+ <xsd:enumeration value="TrackStorage"/>
+ <xsd:enumeration value="TradeDiscount"/>
+ <xsd:enumeration value="TradeIn"/>
+ <xsd:enumeration value="TrailerRentalCharge"/>
+ <xsd:enumeration value="TransferCharge"/>
+ <xsd:enumeration value="TransferOfLadingCharge"/>
+ <xsd:enumeration value="TransferredCharges"/>
+ <xsd:enumeration value="Transit"/>
+ <xsd:enumeration value="TransmissionCharge"/>
+ <xsd:enumeration value="TransportationAndSetup"/>
+ <xsd:enumeration value="TransportationChargeMinimumRate"/>
+ <xsd:enumeration value="TransportationDirectBilling"/>
+ <xsd:enumeration value="TransportationThirdPartyBilling"/>
+ <xsd:enumeration value="TransportationVendorProvided"/>
+ <xsd:enumeration value="TrimmingCharge"/>
+ <xsd:enumeration value="TruckDetention"/>
+ <xsd:enumeration value="TruckloadDiscount"/>
+ <xsd:enumeration value="TurningCharge"/>
+ <xsd:enumeration value="Two-DayService"/>
+ <xsd:enumeration value="TwoDoorPickUp"/>
+ <xsd:enumeration value="UnabsorbedSwitching"/>
+ <xsd:enumeration value="Unitized"/>
+ <xsd:enumeration value="Unloading"/>
+ <xsd:enumeration value="UnloadingLaborCharges"/>
+ <xsd:enumeration value="UnloadingReloadingCharge"/>
+ <xsd:enumeration value="UnsaleableMerchandiseAllowance"/>
+ <xsd:enumeration value="UnscheduledFee"/>
+ <xsd:enumeration value="UpCharge"/>
+ <xsd:enumeration value="UsagePlanDetailCharge"/>
+ <xsd:enumeration value="USCustomsServiceFlatAssistAmount"/>
+ <xsd:enumeration value="USCustomsServiceMaximumAssistAmount"/>
+ <xsd:enumeration value="USDAInspectedStampingCertification"/>
+ <xsd:enumeration value="UseChargeToolingPersonnel"/>
+ <xsd:enumeration value="Use-SpecialTypeFlatCar"/>
+ <xsd:enumeration value="USVehicles"/>
+ <xsd:enumeration value="ValuationFee"/>
+ <xsd:enumeration value="VanCleaning"/>
+ <xsd:enumeration value="VehicleOrderedButNotUsed"/>
+ <xsd:enumeration value="VehiclePrepChargeCourtesyDelivery"/>
+ <xsd:enumeration value="VehicleRoadCharge"/>
+ <xsd:enumeration value="VendorFreight"/>
+ <xsd:enumeration value="VentingInstructions"/>
+ <xsd:enumeration value="VirginIslandTransferCharge"/>
+ <xsd:enumeration value="VolumeDiscount"/>
+ <xsd:enumeration value="VoluntaryContributionCharge"/>
+ <xsd:enumeration value="WaitingTime"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Warehousing"/>
+ <xsd:enumeration value="Warranties"/>
+ <xsd:enumeration value="WarRiskCrewInsurance"/>
+ <xsd:enumeration value="WarRiskInsurance"/>
+ <xsd:enumeration value="WarRiskSurcharge"/>
+ <xsd:enumeration value="WastedFutileTrip"/>
+ <xsd:enumeration value="WatermelonFee"/>
+ <xsd:enumeration value="WaybillAndInvoiceDistribution"/>
+ <xsd:enumeration value="WeatherProtection"/>
+ <xsd:enumeration value="WeightVerificationCharge"/>
+ <xsd:enumeration value="Wharfage-Breakbulk"/>
+ <xsd:enumeration value="WharfageCharge"/>
+ <xsd:enumeration value="Wharfage-Container"/>
+ <xsd:enumeration value="WharfageHandling"/>
+ <xsd:enumeration value="WideAreaTelephoneServiceUsageCredit"/>
+ <xsd:enumeration value="WillCallCharge"/>
+ <xsd:enumeration value="WrittenProofOfDelivery"/>
+ <xsd:enumeration value="X-rayCharge"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="BasisMonetaryRange">
+ <xsd:choice>
+ <xsd:element ref="MonetaryRange"/>
+ <xsd:element ref="MonetaryLimit"/>
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:element name="BasisMonetaryRange" type="BasisMonetaryRange"/>
+ <xsd:complexType name="MonetaryRange">
+ <xsd:sequence>
+ <xsd:element name="MinimumMonetaryValue" type="Decimal21_6"/>
+ <xsd:element name="MaximumMonetaryValue" type="Decimal21_6"/>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MonetaryRange" type="MonetaryRange"/>
+ <xsd:complexType name="MonetaryLimit">
+ <xsd:sequence>
+ <xsd:element name="MonetaryLimitValue" type="Decimal21_6"/>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="MonetaryLimit" type="MonetaryLimit"/>
+ <xsd:complexType name="TypeOfAllowanceOrCharge">
+ <xsd:choice>
+ <xsd:element ref="QuantityAllowanceOrCharge"/>
+ <xsd:element ref="PercentageAllowanceOrCharge"/>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:element name="TypeOfAllowanceOrCharge" type="TypeOfAllowanceOrCharge"/>
+ <xsd:complexType name="QuantityAllowanceOrCharge">
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ <xsd:element ref="Rate"/>
+ <xsd:element minOccurs="0" name="QuantityMonetaryValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="QuantityAllowanceOrCharge" type="QuantityAllowanceOrCharge"/>
+ <xsd:complexType name="Rate">
+ <xsd:sequence>
+ <xsd:element name="RatePerUnit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="UnitPrice"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="UnitPriceBasis" type="Decimal18_3"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Rate" type="Rate"/>
+ <xsd:simpleType name="Decimal18_3">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="18"/>
+ <xsd:fractionDigits value="3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PercentageAllowanceOrCharge">
+ <xsd:sequence>
+ <xsd:element ref="PercentQualifier"/>
+ <xsd:element name="Percent" type="Decimal10_4"/>
+ <xsd:element minOccurs="0" name="PercentageMonetaryValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PercentageAllowanceOrCharge" type="PercentageAllowanceOrCharge"/>
+ <xsd:complexType name="PercentQualifier">
+ <xsd:sequence>
+ <xsd:element name="PercentQualifierCoded" type="PercentQualifierCode"/>
+ <xsd:element minOccurs="0" name="PercentQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PercentQualifier" type="PercentQualifier"/>
+ <xsd:simpleType name="PercentQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ItemListCost"/>
+ <xsd:enumeration value="ItemNetCost"/>
+ <xsd:enumeration value="Discount-Gross"/>
+ <xsd:enumeration value="Discount-Net"/>
+ <xsd:enumeration value="BasePriceperUnit"/>
+ <xsd:enumeration value="BasePriceAmount"/>
+ <xsd:enumeration value="BasePriceAmountLessPreviousDiscount"/>
+ <xsd:enumeration value="NetMonthlyOnAllInvoicesPastDue"/>
+ <xsd:enumeration value="LatePaymentChargeBaseAmount"/>
+ <xsd:enumeration value="FuelRate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="RoundTripInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="Immutable" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ReLink" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="SupplierShoppingCartID" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="RoundTripOrder" type="xcblBoolean" fixed="true"/>
+ </xsd:complexType>
+ <xsd:element name="RoundTripInformation" type="RoundTripInformation"/>
+ <xsd:complexType name="ListOfStructuredNote">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="StructuredNote"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfStructuredNote" type="ListOfStructuredNote"/>
+ <xsd:complexType name="StructuredNote">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="GeneralNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="NoteID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Agency"/>
+ <xsd:element minOccurs="0" name="NoteURL" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="TextTypeCoded" type="TextTypeCode"/>
+ <xsd:element minOccurs="0" name="TextTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StructuredNote" type="StructuredNote"/>
+ <xsd:simpleType name="TextTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Deadlines"/>
+ <xsd:enumeration value="Warranties"/>
+ <xsd:enumeration value="PenaltyForBreachOfContract"/>
+ <xsd:enumeration value="Guarantees"/>
+ <xsd:enumeration value="ContractRiders"/>
+ <xsd:enumeration value="Asset"/>
+ <xsd:enumeration value="OtherContractualStipulations"/>
+ <xsd:enumeration value="InfoRecordPOText"/>
+ <xsd:enumeration value="MaterialPOText"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfNameValueSet">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="NameValueSet"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfNameValueSet" type="ListOfNameValueSet"/>
+ <xsd:complexType name="NameValueSet">
+ <xsd:sequence>
+ <xsd:element name="SetName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SetID" type="xsd:string"/>
+ <xsd:element ref="ListOfNameValuePair"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="NameValueSet" type="NameValueSet"/>
+ <xsd:complexType name="ListOfNameValuePair">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="NameValuePair"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfNameValuePair" type="ListOfNameValuePair"/>
+ <xsd:complexType name="NameValuePair">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string"/>
+ <xsd:element name="Value" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Datatype" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="NameValuePair" type="NameValuePair"/>
+ <xsd:complexType name="ListOfAttachment">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Attachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfAttachment" type="ListOfAttachment"/>
+ <xsd:complexType name="Attachment">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="AttachmentActionCoded" type="AttachmentActionCode"/>
+ <xsd:element minOccurs="0" name="AttachmentActionCodedOther" type="xsd:string"/>
+ <xsd:element name="AttachmentPurpose" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FileName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AttachmentTitle" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AttachmentDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Language"/>
+ <xsd:element minOccurs="0" name="MIMEType" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReplacementFile" type="xcblBoolean"/>
+ <xsd:element name="AttachmentLocation" type="xsd:anyURI"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Attachment" type="Attachment"/>
+ <xsd:simpleType name="AttachmentActionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Add"/>
+ <xsd:enumeration value="Update"/>
+ <xsd:enumeration value="Delete"/>
+ <xsd:enumeration value="NoChange"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderDetail">
+ <xsd:sequence>
+ <xsd:element ref="ListOfItemDetail"/>
+ <xsd:element minOccurs="0" ref="ListOfPackageDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderDetail" type="OrderDetail"/>
+ <xsd:complexType name="ListOfItemDetail">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ItemDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfItemDetail" type="ListOfItemDetail"/>
+ <xsd:complexType name="ItemDetail">
+ <xsd:sequence>
+ <xsd:element ref="BaseItemDetail"/>
+ <xsd:element minOccurs="0" ref="PricingDetail"/>
+ <xsd:element minOccurs="0" ref="DeliveryDetail"/>
+ <xsd:element minOccurs="0" ref="RoundTripInformation"/>
+ <xsd:element minOccurs="0" name="LineItemNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfStructuredNote"/>
+ <xsd:element minOccurs="0" ref="ListOfNameValueSet"/>
+ <xsd:element minOccurs="0" name="LineItemAttachments">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAttachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemDetail" type="ItemDetail"/>
+ <xsd:complexType name="BaseItemDetail">
+ <xsd:sequence>
+ <xsd:element ref="LineItemNum"/>
+ <xsd:element minOccurs="0" ref="LineItemType"/>
+ <xsd:element minOccurs="0" name="ParentItemNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="LineItemNumberReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ItemIdentifiers"/>
+ <xsd:element minOccurs="0" ref="ListOfDimension"/>
+ <xsd:element minOccurs="0" name="TotalQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="MaxBackOrderQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfQuantityCoded"/>
+ <xsd:element minOccurs="0" name="OffCatalogFlag" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" ref="CatalogReference"/>
+ <xsd:element minOccurs="0" name="ItemContractReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfContractItem"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ListOfItemReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CountryOfOrigin">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Country"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CountryOfDestination">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Country"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="FinalRecipient">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfPartyCoded"/>
+ <xsd:element minOccurs="0" ref="ConditionsOfSale"/>
+ <xsd:element minOccurs="0" name="HazardousMaterials">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Hazardous"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="BaseItemDetail" type="BaseItemDetail"/>
+ <xsd:complexType name="LineItemNum">
+ <xsd:sequence>
+ <xsd:element name="BuyerLineItemNum" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="SellerLineItemNum" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LineItemNum" type="LineItemNum"/>
+ <xsd:complexType name="LineItemType">
+ <xsd:sequence>
+ <xsd:element name="LineItemTypeCoded" type="LineItemTypeCode"/>
+ <xsd:element minOccurs="0" name="LineItemTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LineItemType" type="LineItemType"/>
+ <xsd:simpleType name="LineItemTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Item"/>
+ <xsd:enumeration value="ComponentGroup"/>
+ <xsd:enumeration value="TextItem"/>
+ <xsd:enumeration value="Other"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="LineItemNumberReference">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:int">
+ <xsd:attribute name="LineItemNumTypeCoded" type="LineItemNumTypeCode" use="optional" default="Buyer"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="LineItemNumberReference" type="LineItemNumberReference"/>
+ <xsd:simpleType name="LineItemNumTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="Seller"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ItemIdentifiers">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="PartNumbers"/>
+ <xsd:element minOccurs="0" name="Service" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ItemDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfItemCharacteristic"/>
+ <xsd:element minOccurs="0" name="CommodityCode">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="Category"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemIdentifiers" type="ItemIdentifiers"/>
+ <xsd:complexType name="PartNumbers">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="SellerPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartNum"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="BuyerPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartNum"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ManufacturerPartNumber"/>
+ <xsd:element minOccurs="0" name="StandardPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SubstitutePartNumbers">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OtherItemIdentifiers">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PartNumbers" type="PartNumbers"/>
+ <xsd:complexType name="PartNum">
+ <xsd:sequence>
+ <xsd:element name="PartID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PartIDExt" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RevisionNumber" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PartNum" type="PartNum"/>
+ <xsd:complexType name="ManufacturerPartNumber">
+ <xsd:complexContent>
+ <xsd:extension base="PartNum">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ManufacturerID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ManufacturerName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="ManufacturerPartNumber" type="ManufacturerPartNumber"/>
+ <xsd:complexType name="ProductIdentifierCoded">
+ <xsd:sequence>
+ <xsd:element name="ProductIdentifierQualifierCoded" type="ProductIdentifierQualifierCode"/>
+ <xsd:element minOccurs="0" name="ProductIdentifierQualifierCodedOther" type="xsd:string"/>
+ <xsd:element name="ProductIdentifier" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ProductIdentifierExt" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ProductIdentifierCoded" type="ProductIdentifierCoded"/>
+ <xsd:simpleType name="ProductIdentifierQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalProductIdentificationAssignedByTheManufacturer"/>
+ <xsd:enumeration value="AdvertisingPackageIdentificationCode"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AggregationCode"/>
+ <xsd:enumeration value="AirTransportationAssociationProprietaryRightsCode"/>
+ <xsd:enumeration value="AllocationMethodologyIdentificationCode"/>
+ <xsd:enumeration value="AlternateISBN"/>
+ <xsd:enumeration value="AmericanDentalAssociationCodes"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsAssembly"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsPart"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsSystem"/>
+ <xsd:enumeration value="Anniversary"/>
+ <xsd:enumeration value="ApplicationCompletionMethod"/>
+ <xsd:enumeration value="ApplicationState"/>
+ <xsd:enumeration value="AppraisalProductType"/>
+ <xsd:enumeration value="AppraisalService"/>
+ <xsd:enumeration value="ARNICPartNumber"/>
+ <xsd:enumeration value="Assembly"/>
+ <xsd:enumeration value="AssemblyLotNumber"/>
+ <xsd:enumeration value="AssetCategory"/>
+ <xsd:enumeration value="AssetNumber"/>
+ <xsd:enumeration value="AssetType"/>
+ <xsd:enumeration value="AssortabilityCode"/>
+ <xsd:enumeration value="AuthorCode"/>
+ <xsd:enumeration value="AuthorizedPartsListNumber"/>
+ <xsd:enumeration value="AutomaticTransmissionSerialNumber"/>
+ <xsd:enumeration value="AuxiliaryTransmissionSerialNumber"/>
+ <xsd:enumeration value="AuxillaryTransmission"/>
+ <xsd:enumeration value="AxleRatio"/>
+ <xsd:enumeration value="AxleSerialNumber"/>
+ <xsd:enumeration value="Backing"/>
+ <xsd:enumeration value="BaleNumber"/>
+ <xsd:enumeration value="Bar-CodedSerialNumber"/>
+ <xsd:enumeration value="BatchNumber"/>
+ <xsd:enumeration value="BeamNumber"/>
+ <xsd:enumeration value="BenefitID"/>
+ <xsd:enumeration value="BeverageCommonCode"/>
+ <xsd:enumeration value="BillboardsCommercial"/>
+ <xsd:enumeration value="BillCreditCode"/>
+ <xsd:enumeration value="BillSubgroupCode"/>
+ <xsd:enumeration value="BindingCode"/>
+ <xsd:enumeration value="BrandOrLabel"/>
+ <xsd:enumeration value="BrokerPriceOpinionService"/>
+ <xsd:enumeration value="BusBodySerialNumber"/>
+ <xsd:enumeration value="BuyerGroundShadeIdentifier"/>
+ <xsd:enumeration value="BuyersCatalogNumber"/>
+ <xsd:enumeration value="BuyersColor"/>
+ <xsd:enumeration value="BuyersEndProductNumber"/>
+ <xsd:enumeration value="BuyersEngineeringChangeLevelNumber"/>
+ <xsd:enumeration value="BuyersInternalProductGroupCode"/>
+ <xsd:enumeration value="BuyersItemNumber"/>
+ <xsd:enumeration value="BuyersPartNumber"/>
+ <xsd:enumeration value="BuyersQualifierForSize"/>
+ <xsd:enumeration value="BuyersSizeCode"/>
+ <xsd:enumeration value="BuyersStyleNumber"/>
+ <xsd:enumeration value="BuyersSublineItemNumber"/>
+ <xsd:enumeration value="CAGECode"/>
+ <xsd:enumeration value="CandidateOil"/>
+ <xsd:enumeration value="Carry-OverPartNumber"/>
+ <xsd:enumeration value="Case"/>
+ <xsd:enumeration value="CatalogNumber"/>
+ <xsd:enumeration value="Channel"/>
+ <xsd:enumeration value="ChassisSerialNumber"/>
+ <xsd:enumeration value="ChemicalAbstractServiceRegistryNumber"/>
+ <xsd:enumeration value="Classification"/>
+ <xsd:enumeration value="ClassOfContractCode"/>
+ <xsd:enumeration value="CLEICode"/>
+ <xsd:enumeration value="CognizanceSymbol"/>
+ <xsd:enumeration value="ColdRollNumber"/>
+ <xsd:enumeration value="Color"/>
+ <xsd:enumeration value="CombinedNCCMAOrBankServiceCode"/>
+ <xsd:enumeration value="CommissionIdentifier"/>
+ <xsd:enumeration value="CommissionYear"/>
+ <xsd:enumeration value="CommitteeForUniformSecurityIdentificationProcedureNumber"/>
+ <xsd:enumeration value="CommodityGrouping"/>
+ <xsd:enumeration value="CommodityName"/>
+ <xsd:enumeration value="CommonLanguageEquipmentIdentifier"/>
+ <xsd:enumeration value="Company-OwnedUnitTrainNumber"/>
+ <xsd:enumeration value="CompanyPartNumber"/>
+ <xsd:enumeration value="CompatibleCutNumber"/>
+ <xsd:enumeration value="CompensationAllocationCode"/>
+ <xsd:enumeration value="CompensationTypeCode"/>
+ <xsd:enumeration value="CompletionNumber"/>
+ <xsd:enumeration value="ConceptCode"/>
+ <xsd:enumeration value="ConfigurationItemIdentifier"/>
+ <xsd:enumeration value="ConnectorType"/>
+ <xsd:enumeration value="Continuation"/>
+ <xsd:enumeration value="ContractActivityCode"/>
+ <xsd:enumeration value="ContractBreakdown"/>
+ <xsd:enumeration value="ContractChangeAuthorizationType"/>
+ <xsd:enumeration value="ContractNumber"/>
+ <xsd:enumeration value="ContractorEstablishmentCode"/>
+ <xsd:enumeration value="ContractTransferReasonCode"/>
+ <xsd:enumeration value="ContributionYear"/>
+ <xsd:enumeration value="ControlNumber"/>
+ <xsd:enumeration value="CountryFromWhichProcured"/>
+ <xsd:enumeration value="CountryOfOriginCode"/>
+ <xsd:enumeration value="CouponFamilyCode"/>
+ <xsd:enumeration value="CouponNumber"/>
+ <xsd:enumeration value="CoverageRiskType"/>
+ <xsd:enumeration value="CoverageType"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCodes"/>
+ <xsd:enumeration value="CustomerCompanyRegistryNumber"/>
+ <xsd:enumeration value="CustomerOrderNumber"/>
+ <xsd:enumeration value="CustomerProvidedEquipment"/>
+ <xsd:enumeration value="CustomsArticleNumber"/>
+ <xsd:enumeration value="CutNumber"/>
+ <xsd:enumeration value="DataCategory"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DepositItemNumber"/>
+ <xsd:enumeration value="DesignNumber"/>
+ <xsd:enumeration value="DeviceFamily"/>
+ <xsd:enumeration value="DeviceType"/>
+ <xsd:enumeration value="DiagnosisCodePointer"/>
+ <xsd:enumeration value="DieNumber"/>
+ <xsd:enumeration value="DiscontinuedPartNumber"/>
+ <xsd:enumeration value="DiscountGrouping"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="DividendUse"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="Drawing"/>
+ <xsd:enumeration value="DrawingRevisionNumber"/>
+ <xsd:enumeration value="DrugUPCConsumerPackageCode1-4-6-1"/>
+ <xsd:enumeration value="DrugUPCShippingContainerCode1-2-4-6-1"/>
+ <xsd:enumeration value="DunAndBradstreetStandardProductAndServiceCode"/>
+ <xsd:enumeration value="DyeLotNumber"/>
+ <xsd:enumeration value="EAN2-5-5-1"/>
+ <xsd:enumeration value="EAN-99In-StoreCouponCode"/>
+ <xsd:enumeration value="EditionCode"/>
+ <xsd:enumeration value="EndItemNumber"/>
+ <xsd:enumeration value="End-ItemDescription"/>
+ <xsd:enumeration value="EngineDisplacementIdentification"/>
+ <xsd:enumeration value="EngineeringChangeLevel"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="EngineSerialNumber"/>
+ <xsd:enumeration value="EquipmentCodePerCOPASStandard"/>
+ <xsd:enumeration value="EquipmentHierarchicalSequenceIdentifier"/>
+ <xsd:enumeration value="EquipmentIdentificationNumber"/>
+ <xsd:enumeration value="EquipmentLocation"/>
+ <xsd:enumeration value="EquipmentType"/>
+ <xsd:enumeration value="EventType"/>
+ <xsd:enumeration value="ExchangedPartOrAssemblyOrProduct"/>
+ <xsd:enumeration value="Exhibit"/>
+ <xsd:enumeration value="ExhibitIdentifier"/>
+ <xsd:enumeration value="ExhibitLineItemNumber"/>
+ <xsd:enumeration value="ExpendableContainerIdentification"/>
+ <xsd:enumeration value="ExpenseIdentifier"/>
+ <xsd:enumeration value="FAAServiceBulletinNumber"/>
+ <xsd:enumeration value="FabricPiecesPerRoll"/>
+ <xsd:enumeration value="FailedSubassemblyModelNumber"/>
+ <xsd:enumeration value="FailedSubassemblySerialNumber"/>
+ <xsd:enumeration value="FannieMaeAffordableLendingProductCode"/>
+ <xsd:enumeration value="FannieMaeProjectCondominiumClassificationCode"/>
+ <xsd:enumeration value="Feature"/>
+ <xsd:enumeration value="FederalSupplyClassification"/>
+ <xsd:enumeration value="FifthWheelSerialNumber"/>
+ <xsd:enumeration value="FinalTestLotNumber"/>
+ <xsd:enumeration value="FinancialPhase"/>
+ <xsd:enumeration value="FinishLotNumber"/>
+ <xsd:enumeration value="FinishNumber"/>
+ <xsd:enumeration value="FinishOrHandStandardReference"/>
+ <xsd:enumeration value="FirePump"/>
+ <xsd:enumeration value="FirstPriorIdentifier"/>
+ <xsd:enumeration value="FormerPublisher"/>
+ <xsd:enumeration value="FormNumber"/>
+ <xsd:enumeration value="FreddieMacAffordableLendingProductCode"/>
+ <xsd:enumeration value="FreddieMacProjectCondominiumClassificationCode"/>
+ <xsd:enumeration value="FrontAxle-Rear"/>
+ <xsd:enumeration value="FrontAxleDrivenSerialNumber"/>
+ <xsd:enumeration value="FrontAxleNonDrivenSerialNumber"/>
+ <xsd:enumeration value="FrontAxleSerialNumber"/>
+ <xsd:enumeration value="FuelTankSerialNumber"/>
+ <xsd:enumeration value="Fund"/>
+ <xsd:enumeration value="FundAbbreviation"/>
+ <xsd:enumeration value="FundManager"/>
+ <xsd:enumeration value="FundSub-Advisor"/>
+ <xsd:enumeration value="FundType"/>
+ <xsd:enumeration value="GASFLOWInvoicePostingCode"/>
+ <xsd:enumeration value="GASFLOWProductorServiceChargeCode"/>
+ <xsd:enumeration value="Gathering"/>
+ <xsd:enumeration value="GearRatio"/>
+ <xsd:enumeration value="GeneralSpecificationNumber"/>
+ <xsd:enumeration value="GenericNameDescription"/>
+ <xsd:enumeration value="GliderKit"/>
+ <xsd:enumeration value="GradeCode"/>
+ <xsd:enumeration value="GradeName"/>
+ <xsd:enumeration value="GrainDirection"/>
+ <xsd:enumeration value="GraphicsIndustryBarCode"/>
+ <xsd:enumeration value="GroundShadeStandardReference"/>
+ <xsd:enumeration value="GroupID"/>
+ <xsd:enumeration value="GroupQualifierCode"/>
+ <xsd:enumeration value="GTIN"/>
+ <xsd:enumeration value="HarmonisedSystem"/>
+ <xsd:enumeration value="HCPCS"/>
+ <xsd:enumeration value="HeatNumber"/>
+ <xsd:enumeration value="HIBC-HealthIndustryBarCode"/>
+ <xsd:enumeration value="HIBCSupplierLabelingStandardPrimaryDataMessage"/>
+ <xsd:enumeration value="HIECProductOrServiceCode"/>
+ <xsd:enumeration value="HotRollNumber"/>
+ <xsd:enumeration value="ICD-9-CM-Procedure"/>
+ <xsd:enumeration value="IgnitionKeyNumber"/>
+ <xsd:enumeration value="Imprint-TrademarkCodeOfSubsidiary"/>
+ <xsd:enumeration value="IndustryCommodityCode"/>
+ <xsd:enumeration value="InformationMediaType"/>
+ <xsd:enumeration value="Ingredient"/>
+ <xsd:enumeration value="InsurancePlanDescriptionCharacteristics"/>
+ <xsd:enumeration value="InsurersFundCode"/>
+ <xsd:enumeration value="InterchangeabilityCode"/>
+ <xsd:enumeration value="InteriorColorNumber"/>
+ <xsd:enumeration value="InternalNumber"/>
+ <xsd:enumeration value="InternationalArticleNumberingAssociation"/>
+ <xsd:enumeration value="ICD-9-CM-Diagnosis"/>
+ <xsd:enumeration value="InternationalHarmonizedCommodityCode"/>
+ <xsd:enumeration value="InternationalStandardBookNumber"/>
+ <xsd:enumeration value="InvestmentFundType"/>
+ <xsd:enumeration value="IRSQualificationCode"/>
+ <xsd:enumeration value="ISBN"/>
+ <xsd:enumeration value="ISSN"/>
+ <xsd:enumeration value="ItemManagementCode"/>
+ <xsd:enumeration value="ItemTypeNumber"/>
+ <xsd:enumeration value="JobNumber"/>
+ <xsd:enumeration value="JobSequenceNumber"/>
+ <xsd:enumeration value="JointLifeType"/>
+ <xsd:enumeration value="JurisdictionSpecificProcedureAndSupplyCodes"/>
+ <xsd:enumeration value="KanbanPlanNumber"/>
+ <xsd:enumeration value="LaboratorySampleIdentification"/>
+ <xsd:enumeration value="LaboratoryTestConditionCode"/>
+ <xsd:enumeration value="LaborGroup"/>
+ <xsd:enumeration value="LeaseNumber"/>
+ <xsd:enumeration value="LibraryOfCongressCode"/>
+ <xsd:enumeration value="LifeOrAnnuityProductCode"/>
+ <xsd:enumeration value="LifeOrAnnuityServiceFeatures"/>
+ <xsd:enumeration value="LiftGateSerialNumber"/>
+ <xsd:enumeration value="LineOfAuthority"/>
+ <xsd:enumeration value="LineOfBusiness"/>
+ <xsd:enumeration value="LoadSequence"/>
+ <xsd:enumeration value="LocallyAssignedControlNumber"/>
+ <xsd:enumeration value="LocalStockNumber"/>
+ <xsd:enumeration value="LocationCode"/>
+ <xsd:enumeration value="LOINCCodes"/>
+ <xsd:enumeration value="LotNumber"/>
+ <xsd:enumeration value="LotPricingUnitNumber"/>
+ <xsd:enumeration value="MachineNumber"/>
+ <xsd:enumeration value="MaintenanceIndexPageReferenceNumber"/>
+ <xsd:enumeration value="MajorProductOrMaterialOrMachineType"/>
+ <xsd:enumeration value="ManualTransmissionSerialNumber"/>
+ <xsd:enumeration value="Manufacturer"/>
+ <xsd:enumeration value="ManufacturersArticleNumber"/>
+ <xsd:enumeration value="ManufacturersPartNumber"/>
+ <xsd:enumeration value="MarketProgramCode"/>
+ <xsd:enumeration value="MaterialCode"/>
+ <xsd:enumeration value="MaterialControlCode"/>
+ <xsd:enumeration value="MaterialDischargeNumber"/>
+ <xsd:enumeration value="MeasurementTypeCode"/>
+ <xsd:enumeration value="MedicalInformationBureauAuthorization"/>
+ <xsd:enumeration value="MedicalStopLossCoverageCodes"/>
+ <xsd:enumeration value="MedicalStopLossLevelCodes"/>
+ <xsd:enumeration value="MedicalStopLossProductLineCodes"/>
+ <xsd:enumeration value="MedicationCode"/>
+ <xsd:enumeration value="MEMAProductTypeCode"/>
+ <xsd:enumeration value="MethodOfDeliveryCode"/>
+ <xsd:enumeration value="MilestoneEventNumber"/>
+ <xsd:enumeration value="MilitaryStandard"/>
+ <xsd:enumeration value="MILSPECNumber"/>
+ <xsd:enumeration value="ModelNumber"/>
+ <xsd:enumeration value="MortgageCreditDataOrderType"/>
+ <xsd:enumeration value="MortgageInsuranceProductCodeOrNumber"/>
+ <xsd:enumeration value="MortgageProductCode"/>
+ <xsd:enumeration value="MortgageUnderwritingType"/>
+ <xsd:enumeration value="MotorVehicleIdNumber"/>
+ <xsd:enumeration value="MotorVehicle-LineDesignator"/>
+ <xsd:enumeration value="MovementTypeCode"/>
+ <xsd:enumeration value="NationalDrugCode"/>
+ <xsd:enumeration value="NationalDrugCode4-4-2Format"/>
+ <xsd:enumeration value="NationalDrugCode5-3-2Format"/>
+ <xsd:enumeration value="NationalDrugCode5-4-1Format"/>
+ <xsd:enumeration value="NationalDrugCode5-4-2Format"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCode"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCodeIn4-6Format"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCodeIn5-5Format"/>
+ <xsd:enumeration value="NationalProductGroupCode"/>
+ <xsd:enumeration value="NationalRetailFederationColorCode"/>
+ <xsd:enumeration value="NationalRetailFederationSizeCode"/>
+ <xsd:enumeration value="NationalStockNumber"/>
+ <xsd:enumeration value="NDC"/>
+ <xsd:enumeration value="NewMicrocode"/>
+ <xsd:enumeration value="NewReplacementPartOrAssemblyDefective"/>
+ <xsd:enumeration value="NextHigherAssemblyNumber"/>
+ <xsd:enumeration value="NextHigherUsedAssembly"/>
+ <xsd:enumeration value="NonforfeitureOption"/>
+ <xsd:enumeration value="Non-ResaleableItemExcludingDepositNumber"/>
+ <xsd:enumeration value="NSN-NorthAtlanticTreatyOrganizationStockNumber"/>
+ <xsd:enumeration value="NUBCUB82Codes"/>
+ <xsd:enumeration value="NUBCUB92Codes"/>
+ <xsd:enumeration value="NumberOfPositionsOnMachine"/>
+ <xsd:enumeration value="ObligationAuthorityNumber"/>
+ <xsd:enumeration value="ObsoletePartNumber"/>
+ <xsd:enumeration value="OfferNumber"/>
+ <xsd:enumeration value="OldMicrocode"/>
+ <xsd:enumeration value="OldUPCOrEANCaseCode"/>
+ <xsd:enumeration value="OldUPCOrEANConsumerPackageCode"/>
+ <xsd:enumeration value="OldUPCOrEANModuleCode"/>
+ <xsd:enumeration value="OldUPCOrEANMultipackCode"/>
+ <xsd:enumeration value="OperatorAssignedPropertyIdentification"/>
+ <xsd:enumeration value="Opposite-HandPartNumber"/>
+ <xsd:enumeration value="OpticalCableCode"/>
+ <xsd:enumeration value="OpticalIndustryProductCode"/>
+ <xsd:enumeration value="OriginalEquipmentNumber"/>
+ <xsd:enumeration value="OutsideProductionOperationSheetNumber"/>
+ <xsd:enumeration value="PackageTypeCode"/>
+ <xsd:enumeration value="PackagingDrawing"/>
+ <xsd:enumeration value="PackagingSpecificationNumber"/>
+ <xsd:enumeration value="PackNumber"/>
+ <xsd:enumeration value="PartDrawing"/>
+ <xsd:enumeration value="PartNumber"/>
+ <xsd:enumeration value="PartNumberDescription"/>
+ <xsd:enumeration value="PartReferenceNumber"/>
+ <xsd:enumeration value="PatternNumber"/>
+ <xsd:enumeration value="PASCCEC-GoodsAndServicesTaxForwarded"/>
+ <xsd:enumeration value="PASCCEC-GoodsAndServicesTaxNotApplicable"/>
+ <xsd:enumeration value="PASC-NonTubularCode"/>
+ <xsd:enumeration value="PASCOMC-GoodsAndServicesTaxForwarded"/>
+ <xsd:enumeration value="PASCOMC-GoodsAndServicesTaxNotApplicable"/>
+ <xsd:enumeration value="PetroleumAccountantsSocietyOfCanadaTubularCode"/>
+ <xsd:enumeration value="Phase"/>
+ <xsd:enumeration value="PiecesInRoll"/>
+ <xsd:enumeration value="PiggybackCommercial"/>
+ <xsd:enumeration value="PipelineTransactionCode"/>
+ <xsd:enumeration value="PlanCode"/>
+ <xsd:enumeration value="PlantEquipmentNumber"/>
+ <xsd:enumeration value="Ply"/>
+ <xsd:enumeration value="PolicyForm"/>
+ <xsd:enumeration value="Position"/>
+ <xsd:enumeration value="PreferredManufacturer"/>
+ <xsd:enumeration value="PreferredNationalStockNumber"/>
+ <xsd:enumeration value="PreferredPartNumber"/>
+ <xsd:enumeration value="PremiumRateType"/>
+ <xsd:enumeration value="PremiumUse"/>
+ <xsd:enumeration value="PreviousCarrier"/>
+ <xsd:enumeration value="PreviousSampleIdentification"/>
+ <xsd:enumeration value="PriceLookUpNumber"/>
+ <xsd:enumeration value="PrimeContractorPartNumber"/>
+ <xsd:enumeration value="PrintColorStandardReference"/>
+ <xsd:enumeration value="PrintOrDrawing"/>
+ <xsd:enumeration value="ProcessNumber"/>
+ <xsd:enumeration value="ProductOrServiceIdentificationNumber"/>
+ <xsd:enumeration value="ProductChangeNoticeNumber"/>
+ <xsd:enumeration value="ProductDateCode"/>
+ <xsd:enumeration value="ProductIdAttributeCode"/>
+ <xsd:enumeration value="ProductTypeCode"/>
+ <xsd:enumeration value="ProductVersionNumber"/>
+ <xsd:enumeration value="ProgramCode"/>
+ <xsd:enumeration value="ProgramDescriptionIdentifier"/>
+ <xsd:enumeration value="ProgramLevel"/>
+ <xsd:enumeration value="PromotionalVariantNumber"/>
+ <xsd:enumeration value="PropertyAndCasualtyServiceCode"/>
+ <xsd:enumeration value="PublicationNumber"/>
+ <xsd:enumeration value="PublisherCode"/>
+ <xsd:enumeration value="PurchaseOrderNumber"/>
+ <xsd:enumeration value="PurchasersItemCode"/>
+ <xsd:enumeration value="PurchasersOrderLineNumber"/>
+ <xsd:enumeration value="PurposeOfInsurance"/>
+ <xsd:enumeration value="RackNumber"/>
+ <xsd:enumeration value="RadiatorSerialNumber"/>
+ <xsd:enumeration value="Railroad-OwnedUnitTrainNumber"/>
+ <xsd:enumeration value="RandomWeightAggregationCode"/>
+ <xsd:enumeration value="RateDetailCard"/>
+ <xsd:enumeration value="RealEstatePropertyInformationService"/>
+ <xsd:enumeration value="RearAxleExtendedTag"/>
+ <xsd:enumeration value="RearAxleFrontRearDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleMiddle"/>
+ <xsd:enumeration value="RearAxlePusher"/>
+ <xsd:enumeration value="RearAxleRearDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleRearNonDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleSerialNumber"/>
+ <xsd:enumeration value="RearAxleTag"/>
+ <xsd:enumeration value="ReclamationProcess"/>
+ <xsd:enumeration value="RecordKeepingOrModelYear"/>
+ <xsd:enumeration value="ReeferSerialNumber"/>
+ <xsd:enumeration value="ReelNumber"/>
+ <xsd:enumeration value="ReelType"/>
+ <xsd:enumeration value="ReferenceOil"/>
+ <xsd:enumeration value="RefinedProductCode"/>
+ <xsd:enumeration value="RelatedModelNumber"/>
+ <xsd:enumeration value="RelatedModelType"/>
+ <xsd:enumeration value="RelatedPolicyIdentification"/>
+ <xsd:enumeration value="RelativeValueUnits"/>
+ <xsd:enumeration value="ReleaseNumber"/>
+ <xsd:enumeration value="ReligiousRetailNon-BookItem"/>
+ <xsd:enumeration value="RepairFromProductCode"/>
+ <xsd:enumeration value="RepairInductionIdentifier"/>
+ <xsd:enumeration value="RepairTagNumber"/>
+ <xsd:enumeration value="ReplacedPartNumber"/>
+ <xsd:enumeration value="ReplacementNationalStockNumber"/>
+ <xsd:enumeration value="ReplacementProductNumber"/>
+ <xsd:enumeration value="ReplacementSubassemblyModelNumber"/>
+ <xsd:enumeration value="ReplacementSubassemblySerialNumber"/>
+ <xsd:enumeration value="ResourceNumber"/>
+ <xsd:enumeration value="RetailPLU"/>
+ <xsd:enumeration value="ReturnableContainerNumber"/>
+ <xsd:enumeration value="ReturnCode"/>
+ <xsd:enumeration value="RollNumber"/>
+ <xsd:enumeration value="RollSequenceNumber"/>
+ <xsd:enumeration value="RSKNumber"/>
+ <xsd:enumeration value="RunNumber"/>
+ <xsd:enumeration value="SalesPresentationID"/>
+ <xsd:enumeration value="SampleNumber"/>
+ <xsd:enumeration value="SchematicDiagramReferenceNumber"/>
+ <xsd:enumeration value="SeatSerialNumber"/>
+ <xsd:enumeration value="SecondaryPly"/>
+ <xsd:enumeration value="SecondPriorIdentifier"/>
+ <xsd:enumeration value="SectionPrintNumber"/>
+ <xsd:enumeration value="SellersDateCode"/>
+ <xsd:enumeration value="SellersLotNumber"/>
+ <xsd:enumeration value="SerialItemAndContributionIdentifier"/>
+ <xsd:enumeration value="SerialNumber"/>
+ <xsd:enumeration value="SeriesIdentifier"/>
+ <xsd:enumeration value="ServiceCodePerCOPASStandard"/>
+ <xsd:enumeration value="ServiceControlIdentification"/>
+ <xsd:enumeration value="ServiceFeatureID"/>
+ <xsd:enumeration value="ServiceRendered"/>
+ <xsd:enumeration value="ServiceRequested"/>
+ <xsd:enumeration value="SetNumber"/>
+ <xsd:enumeration value="SettlementOrPayoutOption"/>
+ <xsd:enumeration value="Shelf-LifeActionCode"/>
+ <xsd:enumeration value="Shelf-LifeCode"/>
+ <xsd:enumeration value="ShiftWorked"/>
+ <xsd:enumeration value="SideUpOrSideDown"/>
+ <xsd:enumeration value="SkillCode"/>
+ <xsd:enumeration value="SKU"/>
+ <xsd:enumeration value="SlabNumber"/>
+ <xsd:enumeration value="SleeperBoxKeyNumber"/>
+ <xsd:enumeration value="SleeperBoxSerialNumber"/>
+ <xsd:enumeration value="SNOMED"/>
+ <xsd:enumeration value="SoftwareRevisionNumber"/>
+ <xsd:enumeration value="SourceOfDepositCode"/>
+ <xsd:enumeration value="SourceOfLeadCode"/>
+ <xsd:enumeration value="SpecialMaterialIdentificationCode"/>
+ <xsd:enumeration value="SSCC-18AndApplicationIdentifier"/>
+ <xsd:enumeration value="StandardGroupOfProducts-MixedAssortment"/>
+ <xsd:enumeration value="StandardIndustrialClassificationCode"/>
+ <xsd:enumeration value="StateLabelCode"/>
+ <xsd:enumeration value="StateSampleIdentification"/>
+ <xsd:enumeration value="StockNumber"/>
+ <xsd:enumeration value="StyleNumber"/>
+ <xsd:enumeration value="SublineItemNumber"/>
+ <xsd:enumeration value="SubmissionNumber"/>
+ <xsd:enumeration value="SubsistenceIdentificationNumber"/>
+ <xsd:enumeration value="SubstituteProductNumber"/>
+ <xsd:enumeration value="SubtopicLevel"/>
+ <xsd:enumeration value="SupersededPartNumber"/>
+ <xsd:enumeration value="SupersededPurchaseOrderNumber"/>
+ <xsd:enumeration value="SupplierBrandCode"/>
+ <xsd:enumeration value="SupplierCompanyRegistryNumber"/>
+ <xsd:enumeration value="SuppliersArticleNumber"/>
+ <xsd:enumeration value="SuppliersSupplierArticleNumber"/>
+ <xsd:enumeration value="SurfaceFinish"/>
+ <xsd:enumeration value="SyntheticLube"/>
+ <xsd:enumeration value="SystemIdentifier"/>
+ <xsd:enumeration value="TACTCommodityCode"/>
+ <xsd:enumeration value="TaxCode"/>
+ <xsd:enumeration value="TechnicalManualNumber"/>
+ <xsd:enumeration value="TechnicalOrderNumber"/>
+ <xsd:enumeration value="TechnicalPhase"/>
+ <xsd:enumeration value="TelecommunicationsCircuitId"/>
+ <xsd:enumeration value="TelecommunicationsIndustryServiceCode"/>
+ <xsd:enumeration value="TelecomServiceType"/>
+ <xsd:enumeration value="TelephoneIndustryManufacturerCode"/>
+ <xsd:enumeration value="TestedMaterialIdentificationNumber"/>
+ <xsd:enumeration value="Tex"/>
+ <xsd:enumeration value="ThirdPriorIdentifier"/>
+ <xsd:enumeration value="TimeCompliantTechnicalOrder"/>
+ <xsd:enumeration value="TitleCode"/>
+ <xsd:enumeration value="TopicLevel"/>
+ <xsd:enumeration value="TradeInIdentifier"/>
+ <xsd:enumeration value="TransferCaseSerialNumber"/>
+ <xsd:enumeration value="TransmissionSerialNumber"/>
+ <xsd:enumeration value="TransportGroupNumber"/>
+ <xsd:enumeration value="TreasuryManagementAssociation"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCodeAndBankServiceCode"/>
+ <xsd:enumeration value="TreatmentCodes"/>
+ <xsd:enumeration value="TruckBodySerialNumber"/>
+ <xsd:enumeration value="TypeSelvage"/>
+ <xsd:enumeration value="UCCOrEAN-128CouponExtendedCode"/>
+ <xsd:enumeration value="UltimateCustomersArticleNumber"/>
+ <xsd:enumeration value="UNCCS"/>
+ <xsd:enumeration value="UnderwritingMethodOfDirectWriter"/>
+ <xsd:enumeration value="UniformStockSymbolSystemCodeNumber"/>
+ <xsd:enumeration value="UniversalProductNumber"/>
+ <xsd:enumeration value="UNNumberDangerousGoods"/>
+ <xsd:enumeration value="UPC"/>
+ <xsd:enumeration value="UPCOrEAN"/>
+ <xsd:enumeration value="UPCCaseCodeNumber1-1-5-5"/>
+ <xsd:enumeration value="UPCConsumerPackageCode1-5-5"/>
+ <xsd:enumeration value="UPCConsumerPackageCode1-5-5-1"/>
+ <xsd:enumeration value="UPCCouponCode1-5-5-1"/>
+ <xsd:enumeration value="UPCOrEANCaseCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANConsumerPackageCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANCouponCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANModuleCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANMultipackCode"/>
+ <xsd:enumeration value="UPCOrEANShippingContainerCode1-2-5-5-1"/>
+ <xsd:enumeration value="UPCShippingContainerCode1-2-5-5"/>
+ <xsd:enumeration value="UPCSuffix"/>
+ <xsd:enumeration value="UPCSuffix-DefinesPackingVariations"/>
+ <xsd:enumeration value="User-DefinedShippingContainerIdentifier"/>
+ <xsd:enumeration value="UVMRPMLines"/>
+ <xsd:enumeration value="UVMULine"/>
+ <xsd:enumeration value="VariableMeasureProductCode"/>
+ <xsd:enumeration value="VaryItemProductNumber"/>
+ <xsd:enumeration value="VehicleMaintenanceReportingStandards"/>
+ <xsd:enumeration value="VendorAlphanumericSizeCode"/>
+ <xsd:enumeration value="VendorColor"/>
+ <xsd:enumeration value="VendorGroundShadeIdentifier"/>
+ <xsd:enumeration value="VendorItemNumber"/>
+ <xsd:enumeration value="VendorsCatalogNumber"/>
+ <xsd:enumeration value="VendorsItemNumber"/>
+ <xsd:enumeration value="VendorsPartNumber"/>
+ <xsd:enumeration value="VendorsBasicUnitNumber"/>
+ <xsd:enumeration value="VendorsEngineeringChangeLevelNumber"/>
+ <xsd:enumeration value="VendorsOrderNumber"/>
+ <xsd:enumeration value="VendorSpecificationNumber"/>
+ <xsd:enumeration value="VendorsStyleNumber"/>
+ <xsd:enumeration value="VendorsSupplementalItemNumber"/>
+ <xsd:enumeration value="Vintage"/>
+ <xsd:enumeration value="VolumeSet"/>
+ <xsd:enumeration value="VolumeTypeIdentificationCode"/>
+ <xsd:enumeration value="VolumeUsageIdentificationCode"/>
+ <xsd:enumeration value="WaferLotIdentifier"/>
+ <xsd:enumeration value="WellNumber"/>
+ <xsd:enumeration value="WheelChairLiftSerialNumber"/>
+ <xsd:enumeration value="WoolenCut"/>
+ <xsd:enumeration value="WoolenRun"/>
+ <xsd:enumeration value="WorkTaskNumber"/>
+ <xsd:enumeration value="WorkUnitNumber"/>
+ <xsd:enumeration value="WorldCode"/>
+ <xsd:enumeration value="YarnCount-English"/>
+ <xsd:enumeration value="YarnCount-Metric"/>
+ <xsd:enumeration value="YarnCountWorsted"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfProductIdentifierCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfProductIdentifierCoded" type="ListOfProductIdentifierCoded"/>
+ <xsd:complexType name="ListOfItemCharacteristic">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ItemCharacteristic"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfItemCharacteristic" type="ListOfItemCharacteristic"/>
+ <xsd:complexType name="ItemCharacteristic">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ItemCharacteristicCoded" type="ItemCharacteristicCode"/>
+ <xsd:element minOccurs="0" name="ItemCharacteristicCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SurfaceLayerPositionCoded" type="SurfaceLayerPositionCode"/>
+ <xsd:element minOccurs="0" name="SurfaceLayerPositionCodedOther" type="xsd:string"/>
+ <xsd:element name="ItemCharacteristicValue" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Identifier"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ <xsd:element minOccurs="0" ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemCharacteristic" type="ItemCharacteristic"/>
+ <xsd:simpleType name="ItemCharacteristicCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalSectorialCharacteristics"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AlcoholBeverageClass"/>
+ <xsd:enumeration value="AlcoholBeverageType"/>
+ <xsd:enumeration value="Alloy"/>
+ <xsd:enumeration value="AnatomicalOriginOfSample"/>
+ <xsd:enumeration value="Appearance"/>
+ <xsd:enumeration value="Artist"/>
+ <xsd:enumeration value="AssemblyRequired"/>
+ <xsd:enumeration value="Author"/>
+ <xsd:enumeration value="BalanceOutArticle"/>
+ <xsd:enumeration value="BasisWeightSize"/>
+ <xsd:enumeration value="Behind-the-CounterDrugs"/>
+ <xsd:enumeration value="BeverageAge"/>
+ <xsd:enumeration value="BeverageBrand"/>
+ <xsd:enumeration value="BeverageCategory"/>
+ <xsd:enumeration value="BeverageContainerCharacteristics"/>
+ <xsd:enumeration value="BeverageFlavour"/>
+ <xsd:enumeration value="BeverageSegment"/>
+ <xsd:enumeration value="Binding"/>
+ <xsd:enumeration value="BottomholeLocationMethod"/>
+ <xsd:enumeration value="BottomholePressureMethod"/>
+ <xsd:enumeration value="BrandGroup"/>
+ <xsd:enumeration value="BrandGroup-AGroupingOfSimilarBrands"/>
+ <xsd:enumeration value="BureauofAlcoholTobaccoAndFirearmsClassCode"/>
+ <xsd:enumeration value="BureauOfAlcoholTobaccoAndFirearmsTypeCode"/>
+ <xsd:enumeration value="BuyersColorDescription"/>
+ <xsd:enumeration value="BuyersItemSizeDescription"/>
+ <xsd:enumeration value="Casing-Liner-TubingType"/>
+ <xsd:enumeration value="CasingOrLinerType"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="ChemicalFamilyName"/>
+ <xsd:enumeration value="Chemistry"/>
+ <xsd:enumeration value="CID-CommercialItemDescription"/>
+ <xsd:enumeration value="Coating"/>
+ <xsd:enumeration value="CoatingOrPaintSystemCode"/>
+ <xsd:enumeration value="CoatingOrPaintSystemName"/>
+ <xsd:enumeration value="Collateral"/>
+ <xsd:enumeration value="CollectionMethodCode"/>
+ <xsd:enumeration value="Color"/>
+ <xsd:enumeration value="Color-LowerBody"/>
+ <xsd:enumeration value="Color-UpperBody"/>
+ <xsd:enumeration value="CommercialStatus"/>
+ <xsd:enumeration value="CommonChemicalName"/>
+ <xsd:enumeration value="CompanyFieldCode"/>
+ <xsd:enumeration value="ComplianceMethod"/>
+ <xsd:enumeration value="Composer"/>
+ <xsd:enumeration value="ConditionedCode"/>
+ <xsd:enumeration value="ConstructionMethod"/>
+ <xsd:enumeration value="ConsumableResource"/>
+ <xsd:enumeration value="ConsumerInstructions"/>
+ <xsd:enumeration value="ControlItem"/>
+ <xsd:enumeration value="ControlledSubstance"/>
+ <xsd:enumeration value="ControlledSubstance-Class2"/>
+ <xsd:enumeration value="ControlledSubstance-Class3Narcotic"/>
+ <xsd:enumeration value="ControlledSubstance-Class3NNon-narcotic"/>
+ <xsd:enumeration value="ControlledSubstance-Class4"/>
+ <xsd:enumeration value="ControlledSubstance-Class5"/>
+ <xsd:enumeration value="CoordinateDescriptionCode"/>
+ <xsd:enumeration value="Coordinates"/>
+ <xsd:enumeration value="CorrosionResistance"/>
+ <xsd:enumeration value="Coupling"/>
+ <xsd:enumeration value="CurrentArticle"/>
+ <xsd:enumeration value="CurrentArticleSpares"/>
+ <xsd:enumeration value="CustomsSpecifications"/>
+ <xsd:enumeration value="DamageCode"/>
+ <xsd:enumeration value="DamageFault"/>
+ <xsd:enumeration value="Denier"/>
+ <xsd:enumeration value="Density"/>
+ <xsd:enumeration value="Dimensional"/>
+ <xsd:enumeration value="DirectionalIndicator"/>
+ <xsd:enumeration value="Dispersion"/>
+ <xsd:enumeration value="DosageForm"/>
+ <xsd:enumeration value="DrugEfficacy"/>
+ <xsd:enumeration value="DrugEfficacyStudyImplementation"/>
+ <xsd:enumeration value="DyeLot"/>
+ <xsd:enumeration value="DyeLotDescription"/>
+ <xsd:enumeration value="EdgeTreatment"/>
+ <xsd:enumeration value="Edition"/>
+ <xsd:enumeration value="Editor"/>
+ <xsd:enumeration value="Electrical"/>
+ <xsd:enumeration value="ElectronicallyCleaned"/>
+ <xsd:enumeration value="ElectronicField"/>
+ <xsd:enumeration value="Ends-Slitting-Splitting-Cutting"/>
+ <xsd:enumeration value="EndTreatment"/>
+ <xsd:enumeration value="EndUseApplication"/>
+ <xsd:enumeration value="Engine"/>
+ <xsd:enumeration value="EnginewithTransmission"/>
+ <xsd:enumeration value="Equipment"/>
+ <xsd:enumeration value="EscrowCode"/>
+ <xsd:enumeration value="EuropeanCommunityRiskClass"/>
+ <xsd:enumeration value="Fabric"/>
+ <xsd:enumeration value="FabricDescription"/>
+ <xsd:enumeration value="FailureAnalysisProcess"/>
+ <xsd:enumeration value="FEDSPEC-FederalSpecification"/>
+ <xsd:enumeration value="FED-STD-FederalStandard"/>
+ <xsd:enumeration value="Fiber"/>
+ <xsd:enumeration value="FibreTow"/>
+ <xsd:enumeration value="FieldCode-EIAOrDOD"/>
+ <xsd:enumeration value="FieldTest"/>
+ <xsd:enumeration value="Filament"/>
+ <xsd:enumeration value="Filter"/>
+ <xsd:enumeration value="Finish"/>
+ <xsd:enumeration value="FinishOrSurfaceRoughness"/>
+ <xsd:enumeration value="Flavor"/>
+ <xsd:enumeration value="Flow"/>
+ <xsd:enumeration value="Fluid"/>
+ <xsd:enumeration value="FoldConfiguration"/>
+ <xsd:enumeration value="Font"/>
+ <xsd:enumeration value="ForecastDeviation"/>
+ <xsd:enumeration value="Forming"/>
+ <xsd:enumeration value="Formula"/>
+ <xsd:enumeration value="Fragrance"/>
+ <xsd:enumeration value="Fuel"/>
+ <xsd:enumeration value="FunctionalPerformance"/>
+ <xsd:enumeration value="FurtherIdentifyingCharacteristic"/>
+ <xsd:enumeration value="GeneralDescription"/>
+ <xsd:enumeration value="GeneralMerchandise"/>
+ <xsd:enumeration value="GeneralProductForm"/>
+ <xsd:enumeration value="GenericDrug"/>
+ <xsd:enumeration value="Goods"/>
+ <xsd:enumeration value="Grade"/>
+ <xsd:enumeration value="GrainDirection"/>
+ <xsd:enumeration value="GrapeVariety"/>
+ <xsd:enumeration value="HazardousMaterial"/>
+ <xsd:enumeration value="HazardRatingSystem"/>
+ <xsd:enumeration value="HealthAndBeautyAids"/>
+ <xsd:enumeration value="HeatTreatOrAnneal"/>
+ <xsd:enumeration value="Hydraulics"/>
+ <xsd:enumeration value="Ingredient"/>
+ <xsd:enumeration value="InitialSample"/>
+ <xsd:enumeration value="Injectables"/>
+ <xsd:enumeration value="Key-Word"/>
+ <xsd:enumeration value="Kit"/>
+ <xsd:enumeration value="Labour"/>
+ <xsd:enumeration value="LabourDoubleTime"/>
+ <xsd:enumeration value="LabourOvertime"/>
+ <xsd:enumeration value="LeadOrCopperSampleType"/>
+ <xsd:enumeration value="LeasedResource"/>
+ <xsd:enumeration value="LimitingOperation"/>
+ <xsd:enumeration value="Luster"/>
+ <xsd:enumeration value="MachineRun"/>
+ <xsd:enumeration value="Magnetic"/>
+ <xsd:enumeration value="MajorGrade"/>
+ <xsd:enumeration value="ManufacturingMethod"/>
+ <xsd:enumeration value="ManufacturingProcess"/>
+ <xsd:enumeration value="MarketSegment"/>
+ <xsd:enumeration value="Marking"/>
+ <xsd:enumeration value="Material"/>
+ <xsd:enumeration value="MaterialClassification"/>
+ <xsd:enumeration value="MaterialDescription"/>
+ <xsd:enumeration value="MaterialResource"/>
+ <xsd:enumeration value="MaterialStatus-OutsideProcessor"/>
+ <xsd:enumeration value="Mechanical"/>
+ <xsd:enumeration value="MedicalSupplies"/>
+ <xsd:enumeration value="Metallographic"/>
+ <xsd:enumeration value="MILSPEC-MilitarySpecification"/>
+ <xsd:enumeration value="MMSBLM-IndianLandPropertyOrUnitNumber"/>
+ <xsd:enumeration value="Moisture"/>
+ <xsd:enumeration value="Multi-Media"/>
+ <xsd:enumeration value="MusicStyle"/>
+ <xsd:enumeration value="MutuallyDefined"/>
+ <xsd:enumeration value="NewArticle"/>
+ <xsd:enumeration value="Non-HazardousMaterial"/>
+ <xsd:enumeration value="Non-PrescriptionDrug"/>
+ <xsd:enumeration value="NonRecurringResource"/>
+ <xsd:enumeration value="Nutrition"/>
+ <xsd:enumeration value="ObsoleteArticle"/>
+ <xsd:enumeration value="Odor"/>
+ <xsd:enumeration value="Odorized"/>
+ <xsd:enumeration value="Options"/>
+ <xsd:enumeration value="Orientation"/>
+ <xsd:enumeration value="OtherDirectResource"/>
+ <xsd:enumeration value="OtherPhysicalDescription"/>
+ <xsd:enumeration value="Over-the-CounterDrug"/>
+ <xsd:enumeration value="PackageIntegrity"/>
+ <xsd:enumeration value="Parameter"/>
+ <xsd:enumeration value="Pattern"/>
+ <xsd:enumeration value="PercentageOfAlcohol"/>
+ <xsd:enumeration value="PerforationContinuityIndicator"/>
+ <xsd:enumeration value="PerforationInterval"/>
+ <xsd:enumeration value="PerforationType"/>
+ <xsd:enumeration value="Physical"/>
+ <xsd:enumeration value="PhysicalForm"/>
+ <xsd:enumeration value="PhysicalForm-Aerosol"/>
+ <xsd:enumeration value="PhysicalForm-AsDiluted"/>
+ <xsd:enumeration value="PhysicalForm-Concentrate"/>
+ <xsd:enumeration value="PhysicalForm-Emulsion"/>
+ <xsd:enumeration value="PhysicalForm-Gas"/>
+ <xsd:enumeration value="PhysicalForm-Liquid"/>
+ <xsd:enumeration value="PhysicalForm-Powder"/>
+ <xsd:enumeration value="PhysicalForm-Semisolid"/>
+ <xsd:enumeration value="PhysicalForm-Solid"/>
+ <xsd:enumeration value="PipeCoupling"/>
+ <xsd:enumeration value="PipelineStream"/>
+ <xsd:enumeration value="PrecautionaryInstructions"/>
+ <xsd:enumeration value="PrescriptionDrug"/>
+ <xsd:enumeration value="PresentationEffect"/>
+ <xsd:enumeration value="Preservative"/>
+ <xsd:enumeration value="PrimaryGrape"/>
+ <xsd:enumeration value="PrintOrientation"/>
+ <xsd:enumeration value="PrivateLabelName"/>
+ <xsd:enumeration value="ProcessActionTaken"/>
+ <xsd:enumeration value="ProcessOrProductionUnit"/>
+ <xsd:enumeration value="Product"/>
+ <xsd:enumeration value="ProductApplication"/>
+ <xsd:enumeration value="ProductDataBaseManagementDescription"/>
+ <xsd:enumeration value="ProductLifeCycle"/>
+ <xsd:enumeration value="Program"/>
+ <xsd:enumeration value="ProjectSubject"/>
+ <xsd:enumeration value="PromotionalEvent"/>
+ <xsd:enumeration value="PromotionalOffer"/>
+ <xsd:enumeration value="Proof"/>
+ <xsd:enumeration value="Proprietary"/>
+ <xsd:enumeration value="PublicInformation"/>
+ <xsd:enumeration value="Publisher"/>
+ <xsd:enumeration value="PureForm"/>
+ <xsd:enumeration value="Put-upDescription"/>
+ <xsd:enumeration value="Quality"/>
+ <xsd:enumeration value="QualityAssuranceStatus"/>
+ <xsd:enumeration value="Quality-QualityLevel"/>
+ <xsd:enumeration value="RecordingMedium"/>
+ <xsd:enumeration value="RecurringResource"/>
+ <xsd:enumeration value="Recycle"/>
+ <xsd:enumeration value="RefurbishedArticle"/>
+ <xsd:enumeration value="RegulatoryOrStateDistrict"/>
+ <xsd:enumeration value="Regulatory-StateOrEntityCode"/>
+ <xsd:enumeration value="ReinstatedArticle"/>
+ <xsd:enumeration value="RejectionReason"/>
+ <xsd:enumeration value="ReservoirCode-Company"/>
+ <xsd:enumeration value="ResultsMethodCode"/>
+ <xsd:enumeration value="RevisedArticle"/>
+ <xsd:enumeration value="RevisedDesign"/>
+ <xsd:enumeration value="RouteOfAdministration"/>
+ <xsd:enumeration value="SampleType"/>
+ <xsd:enumeration value="SecondaryGrape"/>
+ <xsd:enumeration value="SecretOrConfidentialInformation"/>
+ <xsd:enumeration value="SectionProfile"/>
+ <xsd:enumeration value="SeriesTitle"/>
+ <xsd:enumeration value="ServiceFeature"/>
+ <xsd:enumeration value="Services"/>
+ <xsd:enumeration value="Shade"/>
+ <xsd:enumeration value="Shelf-LifeCode"/>
+ <xsd:enumeration value="ShelfTag"/>
+ <xsd:enumeration value="ShippingUnitComponent"/>
+ <xsd:enumeration value="ShipToLine"/>
+ <xsd:enumeration value="ShipToStock"/>
+ <xsd:enumeration value="Silhouette"/>
+ <xsd:enumeration value="Size"/>
+ <xsd:enumeration value="SizeSystem"/>
+ <xsd:enumeration value="SocietyGovernmentAndOrCustomerSpecifications"/>
+ <xsd:enumeration value="Solubility"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SpecialProcessing"/>
+ <xsd:enumeration value="SpecialSpecification"/>
+ <xsd:enumeration value="Specification"/>
+ <xsd:enumeration value="StateControlled"/>
+ <xsd:enumeration value="StorageAndDisplay"/>
+ <xsd:enumeration value="SubcontractResource"/>
+ <xsd:enumeration value="Sub-Product"/>
+ <xsd:enumeration value="SurfaceCondition"/>
+ <xsd:enumeration value="SurfaceLocationMethod"/>
+ <xsd:enumeration value="SurfaceProtection"/>
+ <xsd:enumeration value="SurfaceTreatment-Chemical"/>
+ <xsd:enumeration value="SurfaceTreatment-Mechanical"/>
+ <xsd:enumeration value="Synonym"/>
+ <xsd:enumeration value="Temper"/>
+ <xsd:enumeration value="TestingAndInspectionAgencies"/>
+ <xsd:enumeration value="TestPanelType"/>
+ <xsd:enumeration value="TestSampleDirection"/>
+ <xsd:enumeration value="TestSampleFrequency"/>
+ <xsd:enumeration value="TestSampleLocation"/>
+ <xsd:enumeration value="TheoreticalWeightFormula"/>
+ <xsd:enumeration value="TherapeuticClass"/>
+ <xsd:enumeration value="TherapeuticEquivalency"/>
+ <xsd:enumeration value="Threshold"/>
+ <xsd:enumeration value="Tint"/>
+ <xsd:enumeration value="Tire"/>
+ <xsd:enumeration value="Title"/>
+ <xsd:enumeration value="TitleInsuranceForm"/>
+ <xsd:enumeration value="Tow"/>
+ <xsd:enumeration value="TradeName"/>
+ <xsd:enumeration value="Translator"/>
+ <xsd:enumeration value="Transmission"/>
+ <xsd:enumeration value="Trim"/>
+ <xsd:enumeration value="Twist"/>
+ <xsd:enumeration value="TypeAndOrProcess"/>
+ <xsd:enumeration value="Typeface"/>
+ <xsd:enumeration value="TypeOfSample"/>
+ <xsd:enumeration value="TypeOfTest-Inspection"/>
+ <xsd:enumeration value="TypeSpinning"/>
+ <xsd:enumeration value="Vehicle"/>
+ <xsd:enumeration value="VendorColorDescription"/>
+ <xsd:enumeration value="VendorSizeDescription"/>
+ <xsd:enumeration value="Vintage"/>
+ <xsd:enumeration value="Visual"/>
+ <xsd:enumeration value="VolatileOrganicCompoundControl"/>
+ <xsd:enumeration value="VolumeTitle"/>
+ <xsd:enumeration value="WarrantyDescription"/>
+ <xsd:enumeration value="WarrantyTypeDescription"/>
+ <xsd:enumeration value="Waste"/>
+ <xsd:enumeration value="WaxCode"/>
+ <xsd:enumeration value="WeldsOrSplices"/>
+ <xsd:enumeration value="WellClassification"/>
+ <xsd:enumeration value="WellDirection"/>
+ <xsd:enumeration value="WellPerforationContinuity"/>
+ <xsd:enumeration value="WellPerforationInterval"/>
+ <xsd:enumeration value="WellTestType"/>
+ <xsd:enumeration value="WindingInstructions"/>
+ <xsd:enumeration value="WineFruit"/>
+ <xsd:enumeration value="WineGrowingRegion"/>
+ <xsd:enumeration value="YarnCount"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="SurfaceLayerPositionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="All"/>
+ <xsd:enumeration value="BackOfCab"/>
+ <xsd:enumeration value="Bilateral"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="Bolster"/>
+ <xsd:enumeration value="BothSides"/>
+ <xsd:enumeration value="Bottom"/>
+ <xsd:enumeration value="Brick"/>
+ <xsd:enumeration value="CasingHeadFlange"/>
+ <xsd:enumeration value="Center"/>
+ <xsd:enumeration value="CornerDiagonals"/>
+ <xsd:enumeration value="DoubleEndOverhang"/>
+ <xsd:enumeration value="DownstreamTap"/>
+ <xsd:enumeration value="DualFuelTankPositions"/>
+ <xsd:enumeration value="Exterior"/>
+ <xsd:enumeration value="Front"/>
+ <xsd:enumeration value="FrontSpare"/>
+ <xsd:enumeration value="Inside"/>
+ <xsd:enumeration value="InsideLeftRear"/>
+ <xsd:enumeration value="InsideRightRear"/>
+ <xsd:enumeration value="Interior"/>
+ <xsd:enumeration value="KellyBushing"/>
+ <xsd:enumeration value="Left"/>
+ <xsd:enumeration value="LeftFront"/>
+ <xsd:enumeration value="LeftRear"/>
+ <xsd:enumeration value="LessCriticalSurface"/>
+ <xsd:enumeration value="Lower"/>
+ <xsd:enumeration value="Middle"/>
+ <xsd:enumeration value="MoreCriticalSurface"/>
+ <xsd:enumeration value="Multiple"/>
+ <xsd:enumeration value="NextRelativePosition"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="OffSurface"/>
+ <xsd:enumeration value="OneSide"/>
+ <xsd:enumeration value="OnSurface"/>
+ <xsd:enumeration value="OppositeCorners"/>
+ <xsd:enumeration value="Outside"/>
+ <xsd:enumeration value="OutsideLeftRear"/>
+ <xsd:enumeration value="OutsideRightRear"/>
+ <xsd:enumeration value="Overall"/>
+ <xsd:enumeration value="Port"/>
+ <xsd:enumeration value="Rear"/>
+ <xsd:enumeration value="RearSpare"/>
+ <xsd:enumeration value="RelativePosition1"/>
+ <xsd:enumeration value="RelativePosition10"/>
+ <xsd:enumeration value="RelativePosition11"/>
+ <xsd:enumeration value="RelativePosition12"/>
+ <xsd:enumeration value="RelativePosition13"/>
+ <xsd:enumeration value="RelativePosition14"/>
+ <xsd:enumeration value="RelativePosition15"/>
+ <xsd:enumeration value="RelativePosition16"/>
+ <xsd:enumeration value="RelativePosition17"/>
+ <xsd:enumeration value="RelativePosition18"/>
+ <xsd:enumeration value="RelativePosition19"/>
+ <xsd:enumeration value="RelativePosition2"/>
+ <xsd:enumeration value="RelativePosition20"/>
+ <xsd:enumeration value="RelativePosition21"/>
+ <xsd:enumeration value="RelativePosition22"/>
+ <xsd:enumeration value="RelativePosition23"/>
+ <xsd:enumeration value="RelativePosition24"/>
+ <xsd:enumeration value="RelativePosition25"/>
+ <xsd:enumeration value="RelativePosition26"/>
+ <xsd:enumeration value="RelativePosition27"/>
+ <xsd:enumeration value="RelativePosition28"/>
+ <xsd:enumeration value="RelativePosition29"/>
+ <xsd:enumeration value="RelativePosition3"/>
+ <xsd:enumeration value="RelativePosition30"/>
+ <xsd:enumeration value="RelativePosition31"/>
+ <xsd:enumeration value="RelativePosition32"/>
+ <xsd:enumeration value="RelativePosition33"/>
+ <xsd:enumeration value="RelativePosition34"/>
+ <xsd:enumeration value="RelativePosition35"/>
+ <xsd:enumeration value="RelativePosition36"/>
+ <xsd:enumeration value="RelativePosition37"/>
+ <xsd:enumeration value="RelativePosition38"/>
+ <xsd:enumeration value="RelativePosition39"/>
+ <xsd:enumeration value="RelativePosition4"/>
+ <xsd:enumeration value="RelativePosition40"/>
+ <xsd:enumeration value="RelativePosition41"/>
+ <xsd:enumeration value="RelativePosition42"/>
+ <xsd:enumeration value="RelativePosition43"/>
+ <xsd:enumeration value="RelativePosition44"/>
+ <xsd:enumeration value="RelativePosition45"/>
+ <xsd:enumeration value="RelativePosition46"/>
+ <xsd:enumeration value="RelativePosition47"/>
+ <xsd:enumeration value="RelativePosition48"/>
+ <xsd:enumeration value="RelativePosition49"/>
+ <xsd:enumeration value="RelativePosition5"/>
+ <xsd:enumeration value="RelativePosition50"/>
+ <xsd:enumeration value="RelativePosition6"/>
+ <xsd:enumeration value="RelativePosition7"/>
+ <xsd:enumeration value="RelativePosition8"/>
+ <xsd:enumeration value="RelativePosition9"/>
+ <xsd:enumeration value="RigFloor"/>
+ <xsd:enumeration value="Right"/>
+ <xsd:enumeration value="RightFront"/>
+ <xsd:enumeration value="RightRear"/>
+ <xsd:enumeration value="SideOne"/>
+ <xsd:enumeration value="SideTwo"/>
+ <xsd:enumeration value="Siding"/>
+ <xsd:enumeration value="Single"/>
+ <xsd:enumeration value="SingleEndOverhang"/>
+ <xsd:enumeration value="Soluble"/>
+ <xsd:enumeration value="SpareTirePosition"/>
+ <xsd:enumeration value="Starboard"/>
+ <xsd:enumeration value="Stone"/>
+ <xsd:enumeration value="Stucco"/>
+ <xsd:enumeration value="Sub-Sea"/>
+ <xsd:enumeration value="TankBottom"/>
+ <xsd:enumeration value="ToothBuccalSurface"/>
+ <xsd:enumeration value="ToothDistalSurface"/>
+ <xsd:enumeration value="ToothFacialSurface"/>
+ <xsd:enumeration value="ToothIncisalSurface"/>
+ <xsd:enumeration value="ToothLingualSurface"/>
+ <xsd:enumeration value="ToothMesialSurface"/>
+ <xsd:enumeration value="ToothOcclusalSurface"/>
+ <xsd:enumeration value="Top"/>
+ <xsd:enumeration value="TwoSides"/>
+ <xsd:enumeration value="UnderCab"/>
+ <xsd:enumeration value="Unilateral"/>
+ <xsd:enumeration value="Upper"/>
+ <xsd:enumeration value="UpstreamTap"/>
+ <xsd:enumeration value="Wood"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Category">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="CategoryID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="StandardCategoryID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Category" type="Category"/>
+ <xsd:complexType name="StandardCategoryID">
+ <xsd:sequence>
+ <xsd:element name="StandardCategoryType" type="xsd:string"/>
+ <xsd:element name="ClassificationID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TechnicalID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StandardCategoryID" type="StandardCategoryID"/>
+ <xsd:complexType name="ListOfQuantityCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="QuantityCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfQuantityCoded" type="ListOfQuantityCoded"/>
+ <xsd:complexType name="QuantityCoded">
+ <xsd:complexContent>
+ <xsd:extension base="Quantity">
+ <xsd:sequence>
+ <xsd:element name="QuantityQualifierCoded" type="QuantityQualifierCode"/>
+ <xsd:element minOccurs="0" name="QuantityQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="QuantityCoded" type="QuantityCoded"/>
+ <xsd:simpleType name="QuantityQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptableUnserviceableQuantity"/>
+ <xsd:enumeration value="Accidents"/>
+ <xsd:enumeration value="Accounts"/>
+ <xsd:enumeration value="AccountsPayableAverageOverdueDays"/>
+ <xsd:enumeration value="AccountsPlacedForCollection"/>
+ <xsd:enumeration value="AcknowledgedQuantity"/>
+ <xsd:enumeration value="ActiveAccounts"/>
+ <xsd:enumeration value="ActiveContractsDelinquent"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ActiveIngredient"/>
+ <xsd:enumeration value="ActiveIngredientDosePerUnit"/>
+ <xsd:enumeration value="ActiveIngredientDosePerUnitDispensed"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ActiveListings"/>
+ <xsd:enumeration value="ActiveMaintenanceTime"/>
+ <xsd:enumeration value="ActivityCodes"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="ActualDuration"/>
+ <xsd:enumeration value="ActualHours"/>
+ <xsd:enumeration value="ActualStock"/>
+ <xsd:enumeration value="ActualUnits"/>
+ <xsd:enumeration value="ActualUnitsCumulativeToDate"/>
+ <xsd:enumeration value="AddedEmployees"/>
+ <xsd:enumeration value="AdditionalAmount"/>
+ <xsd:enumeration value="AdditionalDemandQuantity"/>
+ <xsd:enumeration value="AdditionalPromotionSalesForecastQuantity"/>
+ <xsd:enumeration value="AdditionalReplenishmentDemandQuantity"/>
+ <xsd:enumeration value="AdditionalUsageQuantity"/>
+ <xsd:enumeration value="AdjustedCorrectorReading"/>
+ <xsd:enumeration value="AdjustedQuantity"/>
+ <xsd:enumeration value="AdjustedUnits"/>
+ <xsd:enumeration value="AdjustmentToInventoryQuantity"/>
+ <xsd:enumeration value="Administrators"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AgeAtDeath"/>
+ <xsd:enumeration value="AgedActiveLineItemsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="AgedLineItemsCompleted-ContractorCaused"/>
+ <xsd:enumeration value="AgedLineItemsDelinquent"/>
+ <xsd:enumeration value="AgeHighValue"/>
+ <xsd:enumeration value="AgeLowValue"/>
+ <xsd:enumeration value="AgeModifyingUnits"/>
+ <xsd:enumeration value="AgeNearest"/>
+ <xsd:enumeration value="AgeNext"/>
+ <xsd:enumeration value="Agents"/>
+ <xsd:enumeration value="AgeOfFinancialInformation"/>
+ <xsd:enumeration value="AggregateBenefitPeriod"/>
+ <xsd:enumeration value="AgriculturalWorkers"/>
+ <xsd:enumeration value="AircraftRadios"/>
+ <xsd:enumeration value="AirlineAttendants"/>
+ <xsd:enumeration value="AllocatedQuantity"/>
+ <xsd:enumeration value="AllottedUsageQuantity"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllTimeBuy"/>
+ <xsd:enumeration value="AmortisationQuantity"/>
+ <xsd:enumeration value="AmortizationCumulatedQuantity"/>
+ <xsd:enumeration value="AmortizationOrderQuantity"/>
+ <xsd:enumeration value="AmortizationTerm"/>
+ <xsd:enumeration value="AmortizationTotalQuantity"/>
+ <xsd:enumeration value="AnticipatedLengthOfService"/>
+ <xsd:enumeration value="ApprovalOrOfferDuration"/>
+ <xsd:enumeration value="ApprovedAmount"/>
+ <xsd:enumeration value="ApproximateNumberOfHolders"/>
+ <xsd:enumeration value="ApproximateNumberOfUnitsForSaleProjected"/>
+ <xsd:enumeration value="ApproximateNumberOfUnitsProjected"/>
+ <xsd:enumeration value="AreaDamaged"/>
+ <xsd:enumeration value="AreaOfLevel"/>
+ <xsd:enumeration value="AreaPerUnits"/>
+ <xsd:enumeration value="Arrests"/>
+ <xsd:enumeration value="AsIsQuantity"/>
+ <xsd:enumeration value="AssetSeizers"/>
+ <xsd:enumeration value="Associates"/>
+ <xsd:enumeration value="AtCompleteVariance"/>
+ <xsd:enumeration value="AtCompletionQuantityEstimated"/>
+ <xsd:enumeration value="Attendant-HandledQuantity"/>
+ <xsd:enumeration value="Auctions"/>
+ <xsd:enumeration value="Auditor"/>
+ <xsd:enumeration value="AuthorisedShares"/>
+ <xsd:enumeration value="AuthorizedRetentionLevel"/>
+ <xsd:enumeration value="AuthorizedShares"/>
+ <xsd:enumeration value="AvailableQuantity"/>
+ <xsd:enumeration value="AvailableResourceTaskQuantity"/>
+ <xsd:enumeration value="AvailableUnits"/>
+ <xsd:enumeration value="Average"/>
+ <xsd:enumeration value="AverageEmployees"/>
+ <xsd:enumeration value="AverageNumberOfEmployees"/>
+ <xsd:enumeration value="Axles"/>
+ <xsd:enumeration value="BackorderLines"/>
+ <xsd:enumeration value="BackorderQuantity"/>
+ <xsd:enumeration value="BankRejectItemCount."/>
+ <xsd:enumeration value="BankruptcyPetitionsFiled"/>
+ <xsd:enumeration value="BathroomCount"/>
+ <xsd:enumeration value="BathroomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="BedroomCount"/>
+ <xsd:enumeration value="BedroomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="Beds"/>
+ <xsd:enumeration value="BeginningShares"/>
+ <xsd:enumeration value="BenefitAmount"/>
+ <xsd:enumeration value="BenefitPeriod"/>
+ <xsd:enumeration value="BillableQuantity"/>
+ <xsd:enumeration value="Billed"/>
+ <xsd:enumeration value="BillingUnitPerPricingUnit"/>
+ <xsd:enumeration value="BirthWeight"/>
+ <xsd:enumeration value="BlankVotes"/>
+ <xsd:enumeration value="BloodRecord"/>
+ <xsd:enumeration value="BookInventory"/>
+ <xsd:enumeration value="BookOrderQuantity"/>
+ <xsd:enumeration value="Branches"/>
+ <xsd:enumeration value="BranchLocations"/>
+ <xsd:enumeration value="BranchLocationsLeased"/>
+ <xsd:enumeration value="BranchLocationsOwned"/>
+ <xsd:enumeration value="BranchOfficeLocationsEstimated"/>
+ <xsd:enumeration value="BrothersDeceased"/>
+ <xsd:enumeration value="BrothersLiving"/>
+ <xsd:enumeration value="Budget"/>
+ <xsd:enumeration value="BudgetAtComplete"/>
+ <xsd:enumeration value="BudgetCumulativeToDate"/>
+ <xsd:enumeration value="BudgetedHours"/>
+ <xsd:enumeration value="BusinessClassFailureIncidences"/>
+ <xsd:enumeration value="BusinessFailureClassIncidence"/>
+ <xsd:enumeration value="BusinessFailureIndustryIncidence"/>
+ <xsd:enumeration value="BusinessFailureNationalAverageIncidence"/>
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="BuyupOrBuydownRatePerBasisPoint"/>
+ <xsd:enumeration value="Bytes"/>
+ <xsd:enumeration value="CalendarUnits"/>
+ <xsd:enumeration value="CancelledQuantity"/>
+ <xsd:enumeration value="CapitalChanges"/>
+ <xsd:enumeration value="CertifiedRegisteredNurseAnesthetistNumberOfConcurrentProcedures"/>
+ <xsd:enumeration value="Changes"/>
+ <xsd:enumeration value="ChangesInCapitalStructure"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeableCubicMeasurements"/>
+ <xsd:enumeration value="ChargeableDistance"/>
+ <xsd:enumeration value="ChargeableGrossWeight"/>
+ <xsd:enumeration value="ChargeableLength"/>
+ <xsd:enumeration value="ChargeableNumberOfAxles"/>
+ <xsd:enumeration value="ChargeableNumberOfContainers"/>
+ <xsd:enumeration value="ChargeableNumberOfPackages"/>
+ <xsd:enumeration value="ChargeableNumberOfRailWagons"/>
+ <xsd:enumeration value="ChargeableNumberOfUnits"/>
+ <xsd:enumeration value="ChargeablePeriod"/>
+ <xsd:enumeration value="ChargeableSurface"/>
+ <xsd:enumeration value="ChargeableTareWeight"/>
+ <xsd:enumeration value="ChargeableVolume"/>
+ <xsd:enumeration value="ChargeableWeight"/>
+ <xsd:enumeration value="Children"/>
+ <xsd:enumeration value="CirculatingOil"/>
+ <xsd:enumeration value="Citations"/>
+ <xsd:enumeration value="ClaimPeriod"/>
+ <xsd:enumeration value="Clerks"/>
+ <xsd:enumeration value="ClosingStatementBalance"/>
+ <xsd:enumeration value="ClosingStockBalanceQuantity"/>
+ <xsd:enumeration value="Co2InjectionVolume"/>
+ <xsd:enumeration value="Co-Insured-Actual"/>
+ <xsd:enumeration value="Co-Insured-Estimated"/>
+ <xsd:enumeration value="CollateralRequirements"/>
+ <xsd:enumeration value="CollectionPeriod"/>
+ <xsd:enumeration value="CommitmentPeriod"/>
+ <xsd:enumeration value="CommittedQuantity"/>
+ <xsd:enumeration value="CommunityServiceDuration"/>
+ <xsd:enumeration value="CompaniesIncludedInConsolidatedFinancialStatement"/>
+ <xsd:enumeration value="CompaniesIncludedInConsolidation"/>
+ <xsd:enumeration value="CompaniesInSameActivity"/>
+ <xsd:enumeration value="ComparisonPeriod"/>
+ <xsd:enumeration value="Completed"/>
+ <xsd:enumeration value="CompletedContracts"/>
+ <xsd:enumeration value="CompletedLineItems"/>
+ <xsd:enumeration value="CompletedProjects"/>
+ <xsd:enumeration value="ComponentMeterReadingCount"/>
+ <xsd:enumeration value="ConcurrentItemOutputOfTooling"/>
+ <xsd:enumeration value="Confirmed"/>
+ <xsd:enumeration value="ConsolidatedDiscountInventory"/>
+ <xsd:enumeration value="ConsumerReservedQuantity"/>
+ <xsd:enumeration value="ContinuanceDuration"/>
+ <xsd:enumeration value="ContractBuydown"/>
+ <xsd:enumeration value="ContractBuyup"/>
+ <xsd:enumeration value="ContractCompletedDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ContractLineItemQuantity"/>
+ <xsd:enumeration value="ContractorAtComplete"/>
+ <xsd:enumeration value="ContractorCumulativeToDate"/>
+ <xsd:enumeration value="ContractsCompletedDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ContractsCompletedDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ContributionTotal"/>
+ <xsd:enumeration value="ControlQuantity"/>
+ <xsd:enumeration value="ConventionalMobiles"/>
+ <xsd:enumeration value="ConvictionsSent"/>
+ <xsd:enumeration value="CooperativeShares"/>
+ <xsd:enumeration value="CorrectedQuantity"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodC"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodD"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodE"/>
+ <xsd:enumeration value="CorrectiveActionRequests-Verbal"/>
+ <xsd:enumeration value="CorrectiveActionRequests-Written"/>
+ <xsd:enumeration value="CounterClerks"/>
+ <xsd:enumeration value="CourseSegments"/>
+ <xsd:enumeration value="Coverage"/>
+ <xsd:enumeration value="Covered-Actual"/>
+ <xsd:enumeration value="Covered-Estimated"/>
+ <xsd:enumeration value="Creditors"/>
+ <xsd:enumeration value="CriminalSentenceDuration"/>
+ <xsd:enumeration value="CumulativeActual"/>
+ <xsd:enumeration value="CumulativeBudget"/>
+ <xsd:enumeration value="CumulativeEarnedValue"/>
+ <xsd:enumeration value="CumulativeEffectOfPriorPeriodAdjustment"/>
+ <xsd:enumeration value="CumulativeGasInjectionVolume"/>
+ <xsd:enumeration value="CumulativeGasVolume"/>
+ <xsd:enumeration value="CumulativeLiquidInjectionVolume"/>
+ <xsd:enumeration value="CumulativeOilOrCondensateVolume"/>
+ <xsd:enumeration value="CumulativeQuantity"/>
+ <xsd:enumeration value="CumulativeQuantityActualEstimated"/>
+ <xsd:enumeration value="CumulativeQuantityActualMeasured"/>
+ <xsd:enumeration value="CumulativeQuantityActualPlanned"/>
+ <xsd:enumeration value="CumulativeQuantityOrdered"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodEstimated"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodMeasured"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodPlanned"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodReached"/>
+ <xsd:enumeration value="CumulativeQuantityReceived"/>
+ <xsd:enumeration value="CumulativeQuantityReceivedEndOfPriorYear"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionCredit"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionPending"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionReplacement"/>
+ <xsd:enumeration value="CumulativeQuantityRequiredPriorToTheFirstScheduledPeriod"/>
+ <xsd:enumeration value="CumulativeQuantityScheduled"/>
+ <xsd:enumeration value="CumulativeQuantityScheduledUpToAccumulationStartDate"/>
+ <xsd:enumeration value="CumulativeQuantityShipped"/>
+ <xsd:enumeration value="CumulativeQuantityShippedLong-DispositionChallenged"/>
+ <xsd:enumeration value="CumulativeQuantityShippedLong-DispositionPending"/>
+ <xsd:enumeration value="CumulativeQuantityShippedShort-DispositionChallenged"/>
+ <xsd:enumeration value="CumulativeQuantityShippedShort-DispositionPending"/>
+ <xsd:enumeration value="CumulativeScheduleVariance"/>
+ <xsd:enumeration value="CumulativeScrapQuantity"/>
+ <xsd:enumeration value="CumulativeVariance"/>
+ <xsd:enumeration value="CumulativeWaterVolume"/>
+ <xsd:enumeration value="CurrentDaysOnMarket"/>
+ <xsd:enumeration value="DeductibleBloodUnits"/>
+ <xsd:enumeration value="DefaultNotificationResponsePeriod"/>
+ <xsd:enumeration value="DegreeSegments"/>
+ <xsd:enumeration value="Deleted"/>
+ <xsd:enumeration value="DeliveryBatch"/>
+ <xsd:enumeration value="DeliveryBatchMultiple"/>
+ <xsd:enumeration value="DeliveryQuantity"/>
+ <xsd:enumeration value="DeliveryQuantityBalance"/>
+ <xsd:enumeration value="Departments"/>
+ <xsd:enumeration value="DependentCount"/>
+ <xsd:enumeration value="DependentsAge"/>
+ <xsd:enumeration value="DependentTotal"/>
+ <xsd:enumeration value="DesignEmployees"/>
+ <xsd:enumeration value="DespatchNoteQuantity"/>
+ <xsd:enumeration value="DespatchQuantity"/>
+ <xsd:enumeration value="DestroyedQuantity"/>
+ <xsd:enumeration value="DetrimentalLegalFilings"/>
+ <xsd:enumeration value="DetrimentalLegalFilingsAgainstDirectors"/>
+ <xsd:enumeration value="DimensionalSampleQuantity"/>
+ <xsd:enumeration value="Directors"/>
+ <xsd:enumeration value="DirectShipmentQuantity"/>
+ <xsd:enumeration value="DirectWorkers"/>
+ <xsd:enumeration value="DisbursementPeriod"/>
+ <xsd:enumeration value="DiscreetQuantity-RejectedMaterial"/>
+ <xsd:enumeration value="DiscreteQuantity"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionCredit"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionPending"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionReplacement"/>
+ <xsd:enumeration value="Disposed"/>
+ <xsd:enumeration value="DispositionUndeterminedQuantity"/>
+ <xsd:enumeration value="Distributed"/>
+ <xsd:enumeration value="DistributorInventory"/>
+ <xsd:enumeration value="DomesticAffiliatedCompanies"/>
+ <xsd:enumeration value="DomesticUses"/>
+ <xsd:enumeration value="Dose"/>
+ <xsd:enumeration value="Drafts"/>
+ <xsd:enumeration value="Drivers"/>
+ <xsd:enumeration value="Due"/>
+ <xsd:enumeration value="Due-In"/>
+ <xsd:enumeration value="Duplicates"/>
+ <xsd:enumeration value="DurationInCurrentJob"/>
+ <xsd:enumeration value="DwellingArea"/>
+ <xsd:enumeration value="EarnedValue"/>
+ <xsd:enumeration value="EarnedValueCumulativeToDate"/>
+ <xsd:enumeration value="EarnedValueHours"/>
+ <xsd:enumeration value="EffectiveAge"/>
+ <xsd:enumeration value="ElapsedDuration"/>
+ <xsd:enumeration value="ElectronicSignatures"/>
+ <xsd:enumeration value="EliminationPeriod"/>
+ <xsd:enumeration value="EliminationPeriod-Accident"/>
+ <xsd:enumeration value="EliminationPeriod-Sickness"/>
+ <xsd:enumeration value="EmergencyModifyingUnits"/>
+ <xsd:enumeration value="EmployedAtLocation"/>
+ <xsd:enumeration value="EmployedAtThisLocation"/>
+ <xsd:enumeration value="EmployedByThisCompany"/>
+ <xsd:enumeration value="EmployedInThisProfession"/>
+ <xsd:enumeration value="EmployedOnThisJob"/>
+ <xsd:enumeration value="EmployeeAverage"/>
+ <xsd:enumeration value="Employees"/>
+ <xsd:enumeration value="EmployeesAge"/>
+ <xsd:enumeration value="Employees-Nonowner"/>
+ <xsd:enumeration value="EmployeesNotIncludingOwners"/>
+ <xsd:enumeration value="EmployeesNumberOfDaysAwayFromWorkDueToInjury"/>
+ <xsd:enumeration value="EmployeesNumberOfDaysOfRestrictedWorkActivityDueToInjury"/>
+ <xsd:enumeration value="Employees-Owner"/>
+ <xsd:enumeration value="Employees-PartTime"/>
+ <xsd:enumeration value="Employees-SameDuties"/>
+ <xsd:enumeration value="Employees-SameOccupation"/>
+ <xsd:enumeration value="EmployeesShared"/>
+ <xsd:enumeration value="EmployeesTotalNumberOfDaysAwayFromWorkDueToIllness"/>
+ <xsd:enumeration value="EmployeeTotal"/>
+ <xsd:enumeration value="EmployeeTotalFirstMonthOfQuarter"/>
+ <xsd:enumeration value="EmployeeTotalSecondMonthOfQuarter"/>
+ <xsd:enumeration value="EmployeeTotalThirdMonthOfQuarter"/>
+ <xsd:enumeration value="EndingStock"/>
+ <xsd:enumeration value="EndOfMonthInventoryPriorToShip"/>
+ <xsd:enumeration value="EndQuantity"/>
+ <xsd:enumeration value="EngineeredStandard"/>
+ <xsd:enumeration value="Engineers"/>
+ <xsd:enumeration value="EquipmentQuantity"/>
+ <xsd:enumeration value="EquitySecurityHolder"/>
+ <xsd:enumeration value="EstimateAtComplete"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="EstimatedAccounts"/>
+ <xsd:enumeration value="EstimatedAnnualVolume"/>
+ <xsd:enumeration value="EstimatedDuration"/>
+ <xsd:enumeration value="EstimatedEmployeesAtLocation"/>
+ <xsd:enumeration value="EstimatedHours"/>
+ <xsd:enumeration value="EstimatedQuantity"/>
+ <xsd:enumeration value="EstimatedReadingQuantity"/>
+ <xsd:enumeration value="EstimatedRemainingEconomicLife"/>
+ <xsd:enumeration value="EstimatedRemainingPhysicalLife"/>
+ <xsd:enumeration value="EstimatedTotalEmployees"/>
+ <xsd:enumeration value="EvaporatedWater"/>
+ <xsd:enumeration value="ExclusiveUses"/>
+ <xsd:enumeration value="Executives"/>
+ <xsd:enumeration value="ExistenceLimitPeriod"/>
+ <xsd:enumeration value="ExpenditureQuantity"/>
+ <xsd:enumeration value="Expense"/>
+ <xsd:enumeration value="ExtendedTerm"/>
+ <xsd:enumeration value="ExtraUnplannedDelivery"/>
+ <xsd:enumeration value="Factor"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category1"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category2"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category3"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category4"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category5"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category1"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category2"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category3"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category4"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category5"/>
+ <xsd:enumeration value="FederalPensionMandate-Category1"/>
+ <xsd:enumeration value="FederalPensionMandate-Category2"/>
+ <xsd:enumeration value="FederalPensionMandate-Category3"/>
+ <xsd:enumeration value="FederalPensionMandate-Category4"/>
+ <xsd:enumeration value="FederalPensionMandate-Category5"/>
+ <xsd:enumeration value="FederalVotes"/>
+ <xsd:enumeration value="FieldWorkers"/>
+ <xsd:enumeration value="FileSizeAfterCompression"/>
+ <xsd:enumeration value="FileSizeBeforeCompression"/>
+ <xsd:enumeration value="FinalDeliveryQuantity"/>
+ <xsd:enumeration value="FinancialCoveragePeriod"/>
+ <xsd:enumeration value="FinancialInstitutions"/>
+ <xsd:enumeration value="FinishOffset"/>
+ <xsd:enumeration value="FirstQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="FirstQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="FirstQuarterRecurringDemand"/>
+ <xsd:enumeration value="FirstQuarterRecurringOrders"/>
+ <xsd:enumeration value="FlareOrFlash"/>
+ <xsd:enumeration value="FlatExtraPremium"/>
+ <xsd:enumeration value="Floors"/>
+ <xsd:enumeration value="FloorsOccupied"/>
+ <xsd:enumeration value="Forecast"/>
+ <xsd:enumeration value="ForecastAtComplete"/>
+ <xsd:enumeration value="ForecastedScannedQuantity"/>
+ <xsd:enumeration value="ForecastToComplete"/>
+ <xsd:enumeration value="ForeignRelatedEntities"/>
+ <xsd:enumeration value="Foremen"/>
+ <xsd:enumeration value="FourthQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="FourthQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="FourthQuarterRecurringDemand"/>
+ <xsd:enumeration value="FourthQuarterRecurringOrders"/>
+ <xsd:enumeration value="FreeFloat-InCalendarUnits"/>
+ <xsd:enumeration value="FreeFloatTime"/>
+ <xsd:enumeration value="FreeGoodsQuantity"/>
+ <xsd:enumeration value="FreelanceDebtCollectors"/>
+ <xsd:enumeration value="FreelanceSalespersons"/>
+ <xsd:enumeration value="FreeQuantityIncluded"/>
+ <xsd:enumeration value="FreeQuantityNotIncluded"/>
+ <xsd:enumeration value="Frequency"/>
+ <xsd:enumeration value="Fuel"/>
+ <xsd:enumeration value="FuelConsumedOrBurnedAmount"/>
+ <xsd:enumeration value="FuelPumps"/>
+ <xsd:enumeration value="FullBaths"/>
+ <xsd:enumeration value="FunctionalGroups"/>
+ <xsd:enumeration value="FunctionalSampleQuantity"/>
+ <xsd:enumeration value="FurnishedBloodUnits"/>
+ <xsd:enumeration value="GarageOrCarportArea"/>
+ <xsd:enumeration value="GasInjectionVolume"/>
+ <xsd:enumeration value="GasLiftVolume"/>
+ <xsd:enumeration value="GasReceiptVolume"/>
+ <xsd:enumeration value="GasReturnedToEarth"/>
+ <xsd:enumeration value="GasReturnedToPropertyForFuel"/>
+ <xsd:enumeration value="GasShrinkage"/>
+ <xsd:enumeration value="GasSold"/>
+ <xsd:enumeration value="GasUsedForDrilling"/>
+ <xsd:enumeration value="GasUsedForFuelSystem"/>
+ <xsd:enumeration value="GasUsedForPlantFuel"/>
+ <xsd:enumeration value="GasUsedForRepressuringOrPressureMaintenance"/>
+ <xsd:enumeration value="GasUsedOnProperty"/>
+ <xsd:enumeration value="GasVented"/>
+ <xsd:enumeration value="GasVolume"/>
+ <xsd:enumeration value="GeneralEliminationPeriod"/>
+ <xsd:enumeration value="GovernmentReportingQuantity"/>
+ <xsd:enumeration value="GradeTransferAmount"/>
+ <xsd:enumeration value="GrossAnnualIncomeMultiplier"/>
+ <xsd:enumeration value="GrossBuildingArea"/>
+ <xsd:enumeration value="GrossEstimate"/>
+ <xsd:enumeration value="GrossLivingArea"/>
+ <xsd:enumeration value="GrossLivingFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="GrossProduction"/>
+ <xsd:enumeration value="GrossRentMultiplier"/>
+ <xsd:enumeration value="GroupEmployees"/>
+ <xsd:enumeration value="GuaranteeFeeBuyupMaximum"/>
+ <xsd:enumeration value="GuaranteeFeeRateAfterAlternatePaymentMethod"/>
+ <xsd:enumeration value="GuaranteeFeeRateAfterBuyupOrBuydown"/>
+ <xsd:enumeration value="GuaranteePeriod"/>
+ <xsd:enumeration value="Height"/>
+ <xsd:enumeration value="HighFabricationAuthorizationQuantity"/>
+ <xsd:enumeration value="HighRawMaterialAuthorizationQuantity"/>
+ <xsd:enumeration value="HoldingPeriod"/>
+ <xsd:enumeration value="Hours"/>
+ <xsd:enumeration value="HoursFlown-AircraftOrTypeFlying"/>
+ <xsd:enumeration value="HoursFlown-AircraftTypeOrLife"/>
+ <xsd:enumeration value="HoursFlown-AircraftTypeOrPeriod"/>
+ <xsd:enumeration value="HoursFlown-Lifetime"/>
+ <xsd:enumeration value="HoursFlown-TypeFlying"/>
+ <xsd:enumeration value="ImpairmentDuration"/>
+ <xsd:enumeration value="ImpairmentFrequency"/>
+ <xsd:enumeration value="IncrementalOrderQuantity"/>
+ <xsd:enumeration value="IndirectEmployees"/>
+ <xsd:enumeration value="IndustryBusinessFailureIncidences"/>
+ <xsd:enumeration value="InformationProviderStandardizedMotorVehiclePenaltyPoints"/>
+ <xsd:enumeration value="InformationReadingQuantity"/>
+ <xsd:enumeration value="Inspectors"/>
+ <xsd:enumeration value="InstalledCapacity"/>
+ <xsd:enumeration value="Installers"/>
+ <xsd:enumeration value="InstallmentFrequency"/>
+ <xsd:enumeration value="InstallmentPayments"/>
+ <xsd:enumeration value="Installments"/>
+ <xsd:enumeration value="InsufficientFundsReturnedCheques"/>
+ <xsd:enumeration value="IntendedChangeTimePeriod"/>
+ <xsd:enumeration value="InterestForOverdrawnAccount"/>
+ <xsd:enumeration value="InterimTermPeriod"/>
+ <xsd:enumeration value="IntertankTransferAmount"/>
+ <xsd:enumeration value="InTransitQuantity"/>
+ <xsd:enumeration value="In-Use"/>
+ <xsd:enumeration value="InventoryCategoryTransfer"/>
+ <xsd:enumeration value="InventoryDiscrepancy"/>
+ <xsd:enumeration value="InventoryMovementQuantity"/>
+ <xsd:enumeration value="InventoryOnShelfWorkInProgress"/>
+ <xsd:enumeration value="InventoryQuantityAtSuppliersNotSubjectToInspectionByCustomer"/>
+ <xsd:enumeration value="InventoryQuantityAtSuppliersSubjectToInspectionByCustomer"/>
+ <xsd:enumeration value="InventoryWithdrawalQuantity"/>
+ <xsd:enumeration value="InvoicedQuantity"/>
+ <xsd:enumeration value="Invoices"/>
+ <xsd:enumeration value="InvolvementPeriod"/>
+ <xsd:enumeration value="IssuedShares"/>
+ <xsd:enumeration value="JailSentenceDuration"/>
+ <xsd:enumeration value="JudgementsRegistered"/>
+ <xsd:enumeration value="Judgments"/>
+ <xsd:enumeration value="JudicialStayDuration"/>
+ <xsd:enumeration value="Laborers"/>
+ <xsd:enumeration value="LabourHours"/>
+ <xsd:enumeration value="LagTime"/>
+ <xsd:enumeration value="LandHolding"/>
+ <xsd:enumeration value="LandSize"/>
+ <xsd:enumeration value="Lanes"/>
+ <xsd:enumeration value="Late"/>
+ <xsd:enumeration value="LatePaymentPeriod"/>
+ <xsd:enumeration value="LatestCumulativeQuantity"/>
+ <xsd:enumeration value="LawSuits"/>
+ <xsd:enumeration value="LeadTime"/>
+ <xsd:enumeration value="LeasePeriods"/>
+ <xsd:enumeration value="LengthOfResidency"/>
+ <xsd:enumeration value="LevelResource-Quantity"/>
+ <xsd:enumeration value="LevelResourceTaskQuantity"/>
+ <xsd:enumeration value="LevelsOccupied"/>
+ <xsd:enumeration value="LicenseWithdrawalDuration"/>
+ <xsd:enumeration value="LicenseWithdrawalsSent"/>
+ <xsd:enumeration value="Liens"/>
+ <xsd:enumeration value="LiensRegistered"/>
+ <xsd:enumeration value="LifetimeCapacityOfTooling"/>
+ <xsd:enumeration value="Life-TimeReserve-Actual"/>
+ <xsd:enumeration value="LifetimeReserveDays-AppliedToThisClaim"/>
+ <xsd:enumeration value="Life-TimeReserve-Estimated"/>
+ <xsd:enumeration value="LimitedQuantity"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="LineThreadQuantity"/>
+ <xsd:enumeration value="LiquidInjectionVolume"/>
+ <xsd:enumeration value="Livestock"/>
+ <xsd:enumeration value="LoanRate"/>
+ <xsd:enumeration value="LoanRepaymentTotal"/>
+ <xsd:enumeration value="LossAllowance"/>
+ <xsd:enumeration value="LossOrGain"/>
+ <xsd:enumeration value="LostGas"/>
+ <xsd:enumeration value="LostGoods"/>
+ <xsd:enumeration value="LostOil"/>
+ <xsd:enumeration value="LostWorkTimeActual"/>
+ <xsd:enumeration value="LostWorkTimeEstimated"/>
+ <xsd:enumeration value="LotSize"/>
+ <xsd:enumeration value="Machines"/>
+ <xsd:enumeration value="MaintenanceUnits"/>
+ <xsd:enumeration value="Manufactured"/>
+ <xsd:enumeration value="ManufacturedUnits"/>
+ <xsd:enumeration value="MarineRadios"/>
+ <xsd:enumeration value="MarketPriceChange"/>
+ <xsd:enumeration value="MatchingEquipment"/>
+ <xsd:enumeration value="MaterialOn-BoardQuantityPriorToLoading"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="MaximumAge"/>
+ <xsd:enumeration value="MaximumBenefitPeriod"/>
+ <xsd:enumeration value="MaximumBenefitPeriod-Accident"/>
+ <xsd:enumeration value="MaximumBenefitPeriodAccidentToAge"/>
+ <xsd:enumeration value="MaximumBenefitPeriod-Sickness"/>
+ <xsd:enumeration value="MaximumBenefitPeriodSicknessToAge"/>
+ <xsd:enumeration value="MaximumCriminalSentenceDuration"/>
+ <xsd:enumeration value="MaximumDeliveryBatch"/>
+ <xsd:enumeration value="MaximumForecastQuantity"/>
+ <xsd:enumeration value="MaximumInventory"/>
+ <xsd:enumeration value="MaximumMaturityExtension"/>
+ <xsd:enumeration value="MaximumNumberOfEmployees"/>
+ <xsd:enumeration value="MaximumNumberOfEmployeesAtLocation"/>
+ <xsd:enumeration value="MaximumNumberOfPurchaseOrdersAllowed"/>
+ <xsd:enumeration value="MaximumNumberOfShipmentsAllowed"/>
+ <xsd:enumeration value="MaximumOrderQuantity"/>
+ <xsd:enumeration value="MaximumProductionBatch"/>
+ <xsd:enumeration value="MaximumQuantityToWhichTaxRateApplies"/>
+ <xsd:enumeration value="MaximumRequestableQuantity"/>
+ <xsd:enumeration value="MaximumShipQuantity"/>
+ <xsd:enumeration value="MaximumStackability"/>
+ <xsd:enumeration value="MaximumStockLevel"/>
+ <xsd:enumeration value="MaximumSupplyQuantitySupplierEndorsed"/>
+ <xsd:enumeration value="MaximumTransfer"/>
+ <xsd:enumeration value="Mechanics"/>
+ <xsd:enumeration value="MedicationDuration"/>
+ <xsd:enumeration value="MembersInGroup"/>
+ <xsd:enumeration value="Messengers"/>
+ <xsd:enumeration value="MeterReading"/>
+ <xsd:enumeration value="Miles"/>
+ <xsd:enumeration value="MilitarySalesQuantity"/>
+ <xsd:enumeration value="MillionDollarRoundtableCredits"/>
+ <xsd:enumeration value="Minimum"/>
+ <xsd:enumeration value="MinimumAge"/>
+ <xsd:enumeration value="MinimumAverageTimeRequirementUnits"/>
+ <xsd:enumeration value="MinimumContractQuantity"/>
+ <xsd:enumeration value="MinimumCriminalSentenceDuration"/>
+ <xsd:enumeration value="MinimumDeliveryBatch"/>
+ <xsd:enumeration value="MinimumEmployeesAtLocation"/>
+ <xsd:enumeration value="MinimumFabricationQuantity"/>
+ <xsd:enumeration value="MinimumForecastQuantity"/>
+ <xsd:enumeration value="MinimumInventory"/>
+ <xsd:enumeration value="MinimumNumberOfEmployees"/>
+ <xsd:enumeration value="MinimumOrderPackageLevel"/>
+ <xsd:enumeration value="MinimumOrderQuantity"/>
+ <xsd:enumeration value="MinimumProductionBatch"/>
+ <xsd:enumeration value="MinimumQuantityToWhichTaxRateApplies"/>
+ <xsd:enumeration value="MinimumRequestableQuantity"/>
+ <xsd:enumeration value="MinimumShipQuantity"/>
+ <xsd:enumeration value="MinimumStockLevel"/>
+ <xsd:enumeration value="MinimumTransfer"/>
+ <xsd:enumeration value="MiscellaneousAllowance"/>
+ <xsd:enumeration value="MobileLoadingAllocation"/>
+ <xsd:enumeration value="ModelOrTargetStock"/>
+ <xsd:enumeration value="Month"/>
+ <xsd:enumeration value="MortgagePoolCount"/>
+ <xsd:enumeration value="MostLikelyDuration"/>
+ <xsd:enumeration value="NationalBusinessFailureIncidences"/>
+ <xsd:enumeration value="Net"/>
+ <xsd:enumeration value="NetQuantityDecrease"/>
+ <xsd:enumeration value="NetQuantityIncrease"/>
+ <xsd:enumeration value="NetToPayItemCount."/>
+ <xsd:enumeration value="NoDeliveryRequirementInThisInstruction"/>
+ <xsd:enumeration value="Non-BillableQuantity"/>
+ <xsd:enumeration value="NoncommittedInventoryOnShelf"/>
+ <xsd:enumeration value="NonconformanceQuantity"/>
+ <xsd:enumeration value="Non-ConsolidatedTotal-DomesticSubsidiaries"/>
+ <xsd:enumeration value="Non-ConsolidatedTotal-ForeignSubsidiaries"/>
+ <xsd:enumeration value="Noncovered-Actual"/>
+ <xsd:enumeration value="Non-Covered-Estimated"/>
+ <xsd:enumeration value="Non-DomesticStockholders"/>
+ <xsd:enumeration value="NonexclusiveUses"/>
+ <xsd:enumeration value="Non-UnionEmployees"/>
+ <xsd:enumeration value="Non-UrgentDeliveryQuantity"/>
+ <xsd:enumeration value="NormalDelivery"/>
+ <xsd:enumeration value="NormalReadingQuantity"/>
+ <xsd:enumeration value="NotReplacedBloodUnits"/>
+ <xsd:enumeration value="NoVotes"/>
+ <xsd:enumeration value="NumberOfAccountsPastDue"/>
+ <xsd:enumeration value="NumberOfActiveAccountsThisCycle"/>
+ <xsd:enumeration value="NumberOfAddedLocations"/>
+ <xsd:enumeration value="NumberOfAdjustmentPeriods"/>
+ <xsd:enumeration value="NumberOfAttacksOrOccurrences"/>
+ <xsd:enumeration value="NumberOfBatches"/>
+ <xsd:enumeration value="NumberOfBorrowers"/>
+ <xsd:enumeration value="NumberOfCardsNotReceived"/>
+ <xsd:enumeration value="NumberOfCardsOutstanding"/>
+ <xsd:enumeration value="NumberOfChecks"/>
+ <xsd:enumeration value="NumberOfClaimants"/>
+ <xsd:enumeration value="NumberOfClosedLocations"/>
+ <xsd:enumeration value="NumberOfCo-InsuranceDays"/>
+ <xsd:enumeration value="NumberOfCopiesOfBillOfLading"/>
+ <xsd:enumeration value="NumberOfCrew"/>
+ <xsd:enumeration value="NumberOfDaysCoveredByInventory"/>
+ <xsd:enumeration value="NumberOfDead"/>
+ <xsd:enumeration value="NumberOfDelinquentInstallments"/>
+ <xsd:enumeration value="NumberOfDeliveriesPerDespatchPeriod"/>
+ <xsd:enumeration value="NumberOfDependents"/>
+ <xsd:enumeration value="NumberOfEndUsers"/>
+ <xsd:enumeration value="NumberOfEntitledExemptions"/>
+ <xsd:enumeration value="NumberOfFailedBusinessesOfDirectors"/>
+ <xsd:enumeration value="NumberOfFranchisees"/>
+ <xsd:enumeration value="NumberOfFull-TimeEmployees"/>
+ <xsd:enumeration value="NumberOfHospitals"/>
+ <xsd:enumeration value="NumberOfIdenticalHandlingUnits"/>
+ <xsd:enumeration value="NumberOfInsuredLives"/>
+ <xsd:enumeration value="NumberOfInterestPayments"/>
+ <xsd:enumeration value="NumberOfIrregularInterestPayments"/>
+ <xsd:enumeration value="NumberOfItemsAuthorizedAtStore"/>
+ <xsd:enumeration value="NumberOfItemsAuthorizedAtWarehouse"/>
+ <xsd:enumeration value="NumberOfItemsInStock"/>
+ <xsd:enumeration value="NumberOfLateCharges"/>
+ <xsd:enumeration value="NumberOfLevels"/>
+ <xsd:enumeration value="NumberOfLimitedPartnershipShares"/>
+ <xsd:enumeration value="NumberOfLiving"/>
+ <xsd:enumeration value="NumberOfLoans"/>
+ <xsd:enumeration value="NumberOfLostCards"/>
+ <xsd:enumeration value="NumberOfMembers"/>
+ <xsd:enumeration value="NumberOfMessageRecipients"/>
+ <xsd:enumeration value="NumberOfMonths"/>
+ <xsd:enumeration value="NumberOfMortgagors"/>
+ <xsd:enumeration value="NumberOfMoulds"/>
+ <xsd:enumeration value="NumberOfNon-CoveredDays"/>
+ <xsd:enumeration value="NumberOfNonsufficientFundItems"/>
+ <xsd:enumeration value="NumberOfOpenAccounts"/>
+ <xsd:enumeration value="NumberOfOperatingPeriodsAtFailure"/>
+ <xsd:enumeration value="NumberOfOperatorCredits"/>
+ <xsd:enumeration value="NumberOfOriginals"/>
+ <xsd:enumeration value="NumberOfPackagesInHandlingUnit"/>
+ <xsd:enumeration value="NumberOfPassengers"/>
+ <xsd:enumeration value="NumberOfPatientAdmissions"/>
+ <xsd:enumeration value="NumberOfPeopleLivingAtResidence"/>
+ <xsd:enumeration value="NumberOfPhysicians"/>
+ <xsd:enumeration value="NumberOfProducingWellsRemainingOnPropertyOrFacility"/>
+ <xsd:enumeration value="NumberOfProducingWellsRemainingOnRoyaltyAccount"/>
+ <xsd:enumeration value="NumberOfQuantitativeIncentiveSchemeUnits"/>
+ <xsd:enumeration value="NumberOfServicesOrProcedures"/>
+ <xsd:enumeration value="NumberOfShelfFacings"/>
+ <xsd:enumeration value="NumberOfShelfTags"/>
+ <xsd:enumeration value="NumberOfSignedBillsOfLading"/>
+ <xsd:enumeration value="NumberOfStations"/>
+ <xsd:enumeration value="NumberOfStolenCards"/>
+ <xsd:enumeration value="NumberOfStops"/>
+ <xsd:enumeration value="NumberOfTheatres"/>
+ <xsd:enumeration value="NumberOfTimes"/>
+ <xsd:enumeration value="NumberOfTimesDeported"/>
+ <xsd:enumeration value="NumberOfTransportDocuments"/>
+ <xsd:enumeration value="NumberOfUnits"/>
+ <xsd:enumeration value="NumberOfUnits-Housing"/>
+ <xsd:enumeration value="NumberOfUnitsInTheDepthOfALayer"/>
+ <xsd:enumeration value="NumberOfUnitsInTheWidthOfALayer"/>
+ <xsd:enumeration value="NumberOfUnsignedBillsOfLading"/>
+ <xsd:enumeration value="NumberOfWithholdingExemptions"/>
+ <xsd:enumeration value="NumbersOfConsumerUnitsInTheTradedUnit"/>
+ <xsd:enumeration value="NumberWeeksPaid"/>
+ <xsd:enumeration value="Nurses"/>
+ <xsd:enumeration value="OemInventory"/>
+ <xsd:enumeration value="OfficeSize"/>
+ <xsd:enumeration value="OfficeWorkers"/>
+ <xsd:enumeration value="OffLeaseFuel"/>
+ <xsd:enumeration value="OffPremiseSalesQuantity"/>
+ <xsd:enumeration value="OffPremisesSales"/>
+ <xsd:enumeration value="OilCondensateSold"/>
+ <xsd:enumeration value="OilCondensateUsedOnProperty"/>
+ <xsd:enumeration value="OilOrCondensateVolume"/>
+ <xsd:enumeration value="OilSedimentation"/>
+ <xsd:enumeration value="OilTheft"/>
+ <xsd:enumeration value="OnHandAndDue-In"/>
+ <xsd:enumeration value="OnHoldForShipment"/>
+ <xsd:enumeration value="OnOrderQuantity"/>
+ <xsd:enumeration value="OnPremiseSalesQuantity"/>
+ <xsd:enumeration value="OnPremisesSales"/>
+ <xsd:enumeration value="OpeningStatementBalance"/>
+ <xsd:enumeration value="OpeningStockBalanceQuantity"/>
+ <xsd:enumeration value="OpenQuantity"/>
+ <xsd:enumeration value="OperatingBeds"/>
+ <xsd:enumeration value="OperatingDivisions"/>
+ <xsd:enumeration value="OperatingQuantity"/>
+ <xsd:enumeration value="Operators"/>
+ <xsd:enumeration value="OperatorsWorkingInterest"/>
+ <xsd:enumeration value="OptimalQuantity"/>
+ <xsd:enumeration value="OptimisticDuration"/>
+ <xsd:enumeration value="OrderCount"/>
+ <xsd:enumeration value="OrderedQuantity"/>
+ <xsd:enumeration value="OrderQuantityMultiple"/>
+ <xsd:enumeration value="Original"/>
+ <xsd:enumeration value="OriginalDuration"/>
+ <xsd:enumeration value="OriginalLoanTerm"/>
+ <xsd:enumeration value="OriginalPaymentItemCount."/>
+ <xsd:enumeration value="OriginalQuantity"/>
+ <xsd:enumeration value="OriginalTermInYears"/>
+ <xsd:enumeration value="OtherEmployees"/>
+ <xsd:enumeration value="OtherGasDisposition"/>
+ <xsd:enumeration value="OtherInjectionVolume"/>
+ <xsd:enumeration value="OtherMiscellaneousDisposition"/>
+ <xsd:enumeration value="OtherOilCondensateDisposition"/>
+ <xsd:enumeration value="OtherUnlistedParticipants"/>
+ <xsd:enumeration value="OtherUnlistedStockholders"/>
+ <xsd:enumeration value="OtherWarReserveMaterialRequirementsProtectableQuantity"/>
+ <xsd:enumeration value="OtherWaterDisposition"/>
+ <xsd:enumeration value="OutlierDays"/>
+ <xsd:enumeration value="OutOfInventoryQuantity"/>
+ <xsd:enumeration value="OutstandingQuantity"/>
+ <xsd:enumeration value="OutstandingShares"/>
+ <xsd:enumeration value="Out-TurnedQuantity"/>
+ <xsd:enumeration value="Overage"/>
+ <xsd:enumeration value="OverflowQuantity"/>
+ <xsd:enumeration value="OverShipped"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnersEquity"/>
+ <xsd:enumeration value="OwnershipChangeAge"/>
+ <xsd:enumeration value="OwnershipDuration"/>
+ <xsd:enumeration value="OwnershipPercentage"/>
+ <xsd:enumeration value="OwnOccupationQualificationPeriod"/>
+ <xsd:enumeration value="Pagers"/>
+ <xsd:enumeration value="Paid"/>
+ <xsd:enumeration value="Paid-InCommonShares"/>
+ <xsd:enumeration value="Paid-InPreferredShares"/>
+ <xsd:enumeration value="Paid-InSecurityShares"/>
+ <xsd:enumeration value="ParkingSpaces"/>
+ <xsd:enumeration value="PartialBaths"/>
+ <xsd:enumeration value="ParticipantTotal"/>
+ <xsd:enumeration value="ParticipationShares"/>
+ <xsd:enumeration value="Partners"/>
+ <xsd:enumeration value="PartTimeEmployees"/>
+ <xsd:enumeration value="PastDueQuantity"/>
+ <xsd:enumeration value="Patients"/>
+ <xsd:enumeration value="PaymentCancellationItemCount"/>
+ <xsd:enumeration value="PaymentDurationWeeks"/>
+ <xsd:enumeration value="PaymentExperiencesInTheLast12Months"/>
+ <xsd:enumeration value="PaymentExperiencesInTheLast3Months"/>
+ <xsd:enumeration value="PaymentFrequency"/>
+ <xsd:enumeration value="PaymentOrdersFiled"/>
+ <xsd:enumeration value="PaymentsNumber"/>
+ <xsd:enumeration value="PercentageOfOrderedQuantity"/>
+ <xsd:enumeration value="PeriodicCapacityOfTooling"/>
+ <xsd:enumeration value="PeriodOfEmployment"/>
+ <xsd:enumeration value="PeriodQuantityMeasured"/>
+ <xsd:enumeration value="PeriodQuantityPlanned"/>
+ <xsd:enumeration value="PeriodQuantityReached"/>
+ <xsd:enumeration value="Persistency"/>
+ <xsd:enumeration value="PessimisticDuration"/>
+ <xsd:enumeration value="PetitionsFiled"/>
+ <xsd:enumeration value="PhysicalStatusIii"/>
+ <xsd:enumeration value="PhysicalStatusIv"/>
+ <xsd:enumeration value="PhysicalStatusV"/>
+ <xsd:enumeration value="Physicians"/>
+ <xsd:enumeration value="PictureCount"/>
+ <xsd:enumeration value="PiecesDelivered"/>
+ <xsd:enumeration value="PilferageGoods"/>
+ <xsd:enumeration value="Pilots"/>
+ <xsd:enumeration value="PipelineAdjustmentOrAllowance"/>
+ <xsd:enumeration value="Pipes"/>
+ <xsd:enumeration value="PittedWater"/>
+ <xsd:enumeration value="PlacementPeriodExpiration"/>
+ <xsd:enumeration value="PlannedUnitDevelopmentUnits"/>
+ <xsd:enumeration value="PlantSize"/>
+ <xsd:enumeration value="PlantWorkers"/>
+ <xsd:enumeration value="PlatformCount"/>
+ <xsd:enumeration value="PortableRadios"/>
+ <xsd:enumeration value="PortedTelephoneLines"/>
+ <xsd:enumeration value="Post-OpDays"/>
+ <xsd:enumeration value="Poultry"/>
+ <xsd:enumeration value="PredominateAge"/>
+ <xsd:enumeration value="Pre-OpDays"/>
+ <xsd:enumeration value="PrepaidQuantityNotShipped"/>
+ <xsd:enumeration value="PrepaidQuantityShipped"/>
+ <xsd:enumeration value="Pre-ProductionQuantity"/>
+ <xsd:enumeration value="Prescription"/>
+ <xsd:enumeration value="PrescriptionDosage"/>
+ <xsd:enumeration value="PrescriptionEffectivePeriod"/>
+ <xsd:enumeration value="PrescriptionFrequency"/>
+ <xsd:enumeration value="PresidentialVotes"/>
+ <xsd:enumeration value="PressureBase"/>
+ <xsd:enumeration value="PreviousBenefits"/>
+ <xsd:enumeration value="PreviousCumulativeQuantity"/>
+ <xsd:enumeration value="PreviousHighestCumulativeQuantity"/>
+ <xsd:enumeration value="PreviouslyAmortisedQuantity"/>
+ <xsd:enumeration value="PreviousMonthsUsage"/>
+ <xsd:enumeration value="PreviousNumberOfAccounts"/>
+ <xsd:enumeration value="PreviousNumberOfBranchLocations"/>
+ <xsd:enumeration value="PreviousNumberOfEmployees"/>
+ <xsd:enumeration value="PreviousOrderQuantityToBeCancelled"/>
+ <xsd:enumeration value="PreviousQuantity"/>
+ <xsd:enumeration value="PreviousWeekQuantity"/>
+ <xsd:enumeration value="PriceBreakFrom"/>
+ <xsd:enumeration value="PriceBreakTo"/>
+ <xsd:enumeration value="PricingUnitPerBillingUnit"/>
+ <xsd:enumeration value="PrimaryManagers"/>
+ <xsd:enumeration value="PrimaryMeterReadingValue"/>
+ <xsd:enumeration value="PrimaryNetQuantity"/>
+ <xsd:enumeration value="PrincipalsIncludedAsEmployees"/>
+ <xsd:enumeration value="PriorCumulativeImbalance"/>
+ <xsd:enumeration value="PriorUnitsAccepted"/>
+ <xsd:enumeration value="ProbationDuration"/>
+ <xsd:enumeration value="ProducingWells"/>
+ <xsd:enumeration value="ProductExchangeAmount"/>
+ <xsd:enumeration value="ProductionRequirements"/>
+ <xsd:enumeration value="ProductionWorkers"/>
+ <xsd:enumeration value="ProductSalesAmount"/>
+ <xsd:enumeration value="Professionals"/>
+ <xsd:enumeration value="Professor"/>
+ <xsd:enumeration value="ProjectedAvailableInventory"/>
+ <xsd:enumeration value="ProjectPhases"/>
+ <xsd:enumeration value="ProjectsInProcess"/>
+ <xsd:enumeration value="ProjectUnitsSold"/>
+ <xsd:enumeration value="Promoters"/>
+ <xsd:enumeration value="PromotionQuantity"/>
+ <xsd:enumeration value="ProtestedBills"/>
+ <xsd:enumeration value="ProvidedQuantity"/>
+ <xsd:enumeration value="PublicationTurnSize"/>
+ <xsd:enumeration value="PurchaseOfProduct"/>
+ <xsd:enumeration value="QualificationPeriod"/>
+ <xsd:enumeration value="QualifyingWeeks"/>
+ <xsd:enumeration value="QualityControlFailed"/>
+ <xsd:enumeration value="QualityControlHeld"/>
+ <xsd:enumeration value="QuantitativeIncentiveSchemeBase"/>
+ <xsd:enumeration value="QuantityAdvised"/>
+ <xsd:enumeration value="QuantityApproved"/>
+ <xsd:enumeration value="QuantityAt100Pct"/>
+ <xsd:enumeration value="QuantityAvailableForReturn"/>
+ <xsd:enumeration value="QuantityAvailableForSale-StockQuantity"/>
+ <xsd:enumeration value="QuantityAvailableOnShelf"/>
+ <xsd:enumeration value="QuantityAwaitingDelivery"/>
+ <xsd:enumeration value="QuantityByPosition"/>
+ <xsd:enumeration value="QuantityCancelled"/>
+ <xsd:enumeration value="QuantityCarriedForward"/>
+ <xsd:enumeration value="QuantityDeferred"/>
+ <xsd:enumeration value="QuantityDelivered"/>
+ <xsd:enumeration value="QuantityDisapproved"/>
+ <xsd:enumeration value="QuantityDispensed"/>
+ <xsd:enumeration value="QuantityDisplayedNotAvailableForSale"/>
+ <xsd:enumeration value="QuantityEarned"/>
+ <xsd:enumeration value="QuantityHeldByDeliveryVehicle"/>
+ <xsd:enumeration value="QuantityHeldByLogisticServiceProvider"/>
+ <xsd:enumeration value="QuantityHeldByRetailOutlet"/>
+ <xsd:enumeration value="QuantityInFloat"/>
+ <xsd:enumeration value="QuantityInHoldOut"/>
+ <xsd:enumeration value="QuantityInManufacturingProcess"/>
+ <xsd:enumeration value="QuantityInPhysicalInventory"/>
+ <xsd:enumeration value="QuantityInQuarantine"/>
+ <xsd:enumeration value="QuantityInTransit"/>
+ <xsd:enumeration value="QuantityLanded"/>
+ <xsd:enumeration value="QuantityLoaded"/>
+ <xsd:enumeration value="QuantityManifested"/>
+ <xsd:enumeration value="QuantityNotAvailableForDespatch"/>
+ <xsd:enumeration value="QuantityOfDealerLicensePlates"/>
+ <xsd:enumeration value="QuantityOfMaterialInOrderedTime"/>
+ <xsd:enumeration value="QuantityOnHand"/>
+ <xsd:enumeration value="QuantityOnHold"/>
+ <xsd:enumeration value="QuantityPerNextHigherAssembly"/>
+ <xsd:enumeration value="QuantityPerPack"/>
+ <xsd:enumeration value="QuantityPerSkid"/>
+ <xsd:enumeration value="QuantityPerUnitOfIssue"/>
+ <xsd:enumeration value="QuantityReceived"/>
+ <xsd:enumeration value="QuantityRemaining"/>
+ <xsd:enumeration value="QuantityRequirementForMaintenanceAndRepairOf"/>
+ <xsd:enumeration value="QuantityRequirementForSampleInspection"/>
+ <xsd:enumeration value="QuantityRequiringManipulationBeforeDespatch"/>
+ <xsd:enumeration value="QuantityReturnedDefectiveOrDamaged"/>
+ <xsd:enumeration value="QuantityScheduled"/>
+ <xsd:enumeration value="QuantityServiced"/>
+ <xsd:enumeration value="QuantitySold"/>
+ <xsd:enumeration value="QuantitySoldNet"/>
+ <xsd:enumeration value="QuantitySuspended"/>
+ <xsd:enumeration value="QuantityToBeDelivered"/>
+ <xsd:enumeration value="QuantityUsed"/>
+ <xsd:enumeration value="QuantityWithdrawn"/>
+ <xsd:enumeration value="QuantityWithheldByOwnerOfGoods"/>
+ <xsd:enumeration value="QuoteQuantityOnInventory"/>
+ <xsd:enumeration value="RangeAverage"/>
+ <xsd:enumeration value="RangeMaximum"/>
+ <xsd:enumeration value="RangeMinimum"/>
+ <xsd:enumeration value="RatePerDay"/>
+ <xsd:enumeration value="Receipts"/>
+ <xsd:enumeration value="ReceivedAndAccepted"/>
+ <xsd:enumeration value="ReceivedNotAcceptedToBeDestroyed"/>
+ <xsd:enumeration value="ReceivedNotAcceptedToBeReturned"/>
+ <xsd:enumeration value="ReceivedQuantity"/>
+ <xsd:enumeration value="RecommendedMaintenanceQuantity"/>
+ <xsd:enumeration value="RecommendedOverhaulAndRepairQuantity"/>
+ <xsd:enumeration value="ReconsiderationPeriod"/>
+ <xsd:enumeration value="RedeliveryAfterPostProcessing"/>
+ <xsd:enumeration value="RefillsAuthorized"/>
+ <xsd:enumeration value="RegisteredBrandsDistributed"/>
+ <xsd:enumeration value="RegisteredBrandsManufactured"/>
+ <xsd:enumeration value="RejectedQuantity"/>
+ <xsd:enumeration value="RejectedReturnQuantity"/>
+ <xsd:enumeration value="RelatedBusinessEntities"/>
+ <xsd:enumeration value="RelatedEntities"/>
+ <xsd:enumeration value="RelationshipDuration"/>
+ <xsd:enumeration value="RelativesEmployed"/>
+ <xsd:enumeration value="RemainingAuthorizedQuantity"/>
+ <xsd:enumeration value="RemainingDuration"/>
+ <xsd:enumeration value="RemainingQuantity"/>
+ <xsd:enumeration value="ReorderingLevel"/>
+ <xsd:enumeration value="ReorderPointQuantity"/>
+ <xsd:enumeration value="ReplacedAmount"/>
+ <xsd:enumeration value="ReplacedBloodUnits"/>
+ <xsd:enumeration value="ReplenishmentOverrideQuantity"/>
+ <xsd:enumeration value="ReplenishmentQuantity"/>
+ <xsd:enumeration value="ReportDifference"/>
+ <xsd:enumeration value="ReportedDeficiencies"/>
+ <xsd:enumeration value="Reports"/>
+ <xsd:enumeration value="RequestedAmount"/>
+ <xsd:enumeration value="RequirementQuantity"/>
+ <xsd:enumeration value="RequirementQuantityThatWasPreviouslyReleased"/>
+ <xsd:enumeration value="RequisitioningObjective"/>
+ <xsd:enumeration value="ReservedQuantity"/>
+ <xsd:enumeration value="ReservedQuantityCustomerDirectDeliverySales"/>
+ <xsd:enumeration value="ReservedQuantityRetailSales"/>
+ <xsd:enumeration value="ResidenceDuration"/>
+ <xsd:enumeration value="Resource-Quantity-Available"/>
+ <xsd:enumeration value="RestingQuantity"/>
+ <xsd:enumeration value="RestrictionDuration"/>
+ <xsd:enumeration value="RetailSales"/>
+ <xsd:enumeration value="RetentionQuantity"/>
+ <xsd:enumeration value="ReturnedByConsumerQuantity"/>
+ <xsd:enumeration value="ReturnQuantity"/>
+ <xsd:enumeration value="ReturnsReplacementQuantity"/>
+ <xsd:enumeration value="RoomCount"/>
+ <xsd:enumeration value="Rooms"/>
+ <xsd:enumeration value="RoomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="Royalty"/>
+ <xsd:enumeration value="SafetyLevel"/>
+ <xsd:enumeration value="Salespersons"/>
+ <xsd:enumeration value="SalesQuantityNotIncludedInTheReplenishmentCalculation"/>
+ <xsd:enumeration value="SalesQuantityPlanned"/>
+ <xsd:enumeration value="SampleAmount"/>
+ <xsd:enumeration value="ScatteredVotes"/>
+ <xsd:enumeration value="ScheduleVariance"/>
+ <xsd:enumeration value="ScrapAllowed"/>
+ <xsd:enumeration value="ScrapQuantity"/>
+ <xsd:enumeration value="Seats"/>
+ <xsd:enumeration value="SecondaryNetQuantity"/>
+ <xsd:enumeration value="SecondQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="SecondQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="SecondQuarterRecurringDemand"/>
+ <xsd:enumeration value="SecondQuarterRecurringOrders"/>
+ <xsd:enumeration value="Secretaries"/>
+ <xsd:enumeration value="SecuredChargesRegistered"/>
+ <xsd:enumeration value="SecuritiesShares"/>
+ <xsd:enumeration value="Segments"/>
+ <xsd:enumeration value="Seller"/>
+ <xsd:enumeration value="ServiceResale"/>
+ <xsd:enumeration value="Shareholders"/>
+ <xsd:enumeration value="ShareholdersHoldingRemainderOfShares"/>
+ <xsd:enumeration value="Shares"/>
+ <xsd:enumeration value="SharesAdded"/>
+ <xsd:enumeration value="SharesDeleted"/>
+ <xsd:enumeration value="SharesHeldAsTreasuryStock"/>
+ <xsd:enumeration value="SharesOfCommonStock"/>
+ <xsd:enumeration value="SharesOfPreferredStock"/>
+ <xsd:enumeration value="SharesOwnedByIn-StateResidents"/>
+ <xsd:enumeration value="SharesOwnedByOut-Of-StateResidents"/>
+ <xsd:enumeration value="SharesSubscribed"/>
+ <xsd:enumeration value="SharesSubscribedButNotIssued"/>
+ <xsd:enumeration value="Shifts"/>
+ <xsd:enumeration value="Shipments"/>
+ <xsd:enumeration value="ShipNoticeQuantity"/>
+ <xsd:enumeration value="ShippedQuantity"/>
+ <xsd:enumeration value="Shortage"/>
+ <xsd:enumeration value="Short-LandedGoods"/>
+ <xsd:enumeration value="ShortShipped"/>
+ <xsd:enumeration value="SilentPartners"/>
+ <xsd:enumeration value="SinceLastTravel"/>
+ <xsd:enumeration value="SingleDeliveryQuantity"/>
+ <xsd:enumeration value="SistersDeceased"/>
+ <xsd:enumeration value="SistersLiving"/>
+ <xsd:enumeration value="Site"/>
+ <xsd:enumeration value="SizeOfHousehold"/>
+ <xsd:enumeration value="SkilledWorker"/>
+ <xsd:enumeration value="SmallBusinessUses"/>
+ <xsd:enumeration value="Solicited"/>
+ <xsd:enumeration value="SortedQuantity"/>
+ <xsd:enumeration value="SortedQuantityRejected"/>
+ <xsd:enumeration value="SpaceOccupied"/>
+ <xsd:enumeration value="SpecialPartners"/>
+ <xsd:enumeration value="SpeedCapacity"/>
+ <xsd:enumeration value="SplitQuantity"/>
+ <xsd:enumeration value="SplitShipment"/>
+ <xsd:enumeration value="Standard"/>
+ <xsd:enumeration value="Started"/>
+ <xsd:enumeration value="StartOffset"/>
+ <xsd:enumeration value="StartQuantity"/>
+ <xsd:enumeration value="StateOrProvinceMotorVehiclePenaltyPoints"/>
+ <xsd:enumeration value="StatisticalSalesQuantity"/>
+ <xsd:enumeration value="StockTransfersIn"/>
+ <xsd:enumeration value="StockTransfersOut"/>
+ <xsd:enumeration value="StolenCheques"/>
+ <xsd:enumeration value="SubcontractorAtComplete"/>
+ <xsd:enumeration value="SubcontractorCumulativeToDate"/>
+ <xsd:enumeration value="Subcontractors"/>
+ <xsd:enumeration value="SubmittedQuantityReturned"/>
+ <xsd:enumeration value="SubmittedQuantitySold"/>
+ <xsd:enumeration value="SubsequentDeliveryQuantity"/>
+ <xsd:enumeration value="Subsidiaries"/>
+ <xsd:enumeration value="SubstitutionalQuantity"/>
+ <xsd:enumeration value="Suits"/>
+ <xsd:enumeration value="Supervisors"/>
+ <xsd:enumeration value="SuppliedQuantity"/>
+ <xsd:enumeration value="SupplierEstimatedLatestMeterReading"/>
+ <xsd:enumeration value="SupplierEstimatedPreviousMeterReading"/>
+ <xsd:enumeration value="SupplierLatestMeterReading"/>
+ <xsd:enumeration value="SupplierPreviousMeterReading"/>
+ <xsd:enumeration value="Suppliers"/>
+ <xsd:enumeration value="SuppliersCredit"/>
+ <xsd:enumeration value="SurplusGoods"/>
+ <xsd:enumeration value="SurveysInAverageRating"/>
+ <xsd:enumeration value="SuspendedDuration"/>
+ <xsd:enumeration value="Swan-Ganz"/>
+ <xsd:enumeration value="TablesAvailable"/>
+ <xsd:enumeration value="TalkPaths"/>
+ <xsd:enumeration value="TankAllowance"/>
+ <xsd:enumeration value="TariffLossAllowance"/>
+ <xsd:enumeration value="TaxableQuantity"/>
+ <xsd:enumeration value="Teachers"/>
+ <xsd:enumeration value="Technicians"/>
+ <xsd:enumeration value="TheoreticalQuantity"/>
+ <xsd:enumeration value="ThirdQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="ThirdQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="ThirdQuarterRecurringDemand"/>
+ <xsd:enumeration value="ThirdQuarterRecurringOrders"/>
+ <xsd:enumeration value="TimeExpended"/>
+ <xsd:enumeration value="TimeFrame"/>
+ <xsd:enumeration value="TimeInCountry"/>
+ <xsd:enumeration value="TimeInPosition"/>
+ <xsd:enumeration value="TimeSinceHospitalization"/>
+ <xsd:enumeration value="TimeSinceLastApplication"/>
+ <xsd:enumeration value="TimeSinceLastCivilianFlight"/>
+ <xsd:enumeration value="TimeSinceLastInsuranceMedical"/>
+ <xsd:enumeration value="TimeSinceLastMilitaryFlight"/>
+ <xsd:enumeration value="TimeSinceMedicalConsult"/>
+ <xsd:enumeration value="TimeSinceMedicationEnd"/>
+ <xsd:enumeration value="TimeSinceMedicationStart"/>
+ <xsd:enumeration value="TimeSinceOnset"/>
+ <xsd:enumeration value="TimeSinceSurgery"/>
+ <xsd:enumeration value="TimeSinceTrip"/>
+ <xsd:enumeration value="TimeUnits"/>
+ <xsd:enumeration value="TimeUnitsKnown"/>
+ <xsd:enumeration value="TimeUnitsPerShift"/>
+ <xsd:enumeration value="TimeUnitsSpentOnDuty"/>
+ <xsd:enumeration value="Tires"/>
+ <xsd:enumeration value="ToCompleteQuantityEstimated"/>
+ <xsd:enumeration value="Tolerance"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="TotalAdjustmentsVolume"/>
+ <xsd:enumeration value="TotalAmortisationQuantity"/>
+ <xsd:enumeration value="TotalAtComplete"/>
+ <xsd:enumeration value="TotalAuthorizedQuantity"/>
+ <xsd:enumeration value="TotalBeginningInventory"/>
+ <xsd:enumeration value="TotalClaimsAssociatedWithRepeatedTrauma"/>
+ <xsd:enumeration value="TotalClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalClaimsWithDisordersDueToPhysicalAgents"/>
+ <xsd:enumeration value="TotalClaimsWithDustDiseasesOfTheLungs"/>
+ <xsd:enumeration value="TotalClaimsWithoutDaysAwayFromWorkAndWithoutRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalClaimsWithPoisoningIllnesses"/>
+ <xsd:enumeration value="TotalClaimsWithRespiratoryConditionsDueToToxicAgents"/>
+ <xsd:enumeration value="TotalClaimsWithSkinDiseasesOrDisorders"/>
+ <xsd:enumeration value="TotalConsolidatedDomesticSubsidiaries"/>
+ <xsd:enumeration value="TotalConsolidatedForeignSubsidiaries"/>
+ <xsd:enumeration value="TotalConsolidatedSubsidiaries"/>
+ <xsd:enumeration value="TotalCredits"/>
+ <xsd:enumeration value="TotalCreditsAccepted"/>
+ <xsd:enumeration value="TotalCreditsReceived"/>
+ <xsd:enumeration value="TotalCreditsRejected"/>
+ <xsd:enumeration value="TotalDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalDaysAwayFromWorkDueToIllness"/>
+ <xsd:enumeration value="TotalDaysAwayFromWorkDueToInjury"/>
+ <xsd:enumeration value="TotalDaysOfRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalDaysOfRestrictedWorkActivityDueToIllness"/>
+ <xsd:enumeration value="TotalDaysOnMarket"/>
+ <xsd:enumeration value="TotalDaysWithRestrictedWorkActivityDueToInjury"/>
+ <xsd:enumeration value="TotalDeathClaims"/>
+ <xsd:enumeration value="TotalDeathsAsAResultOfIllness"/>
+ <xsd:enumeration value="TotalDeathsAsAResultOfInjury"/>
+ <xsd:enumeration value="TotalDebits"/>
+ <xsd:enumeration value="TotalDebitsAccepted"/>
+ <xsd:enumeration value="TotalDebitsReceived"/>
+ <xsd:enumeration value="TotalDebitsRejected"/>
+ <xsd:enumeration value="TotalDeliveryQuantity"/>
+ <xsd:enumeration value="TotalDemandOrders"/>
+ <xsd:enumeration value="TotalDemandQuantity"/>
+ <xsd:enumeration value="TotalEmployees"/>
+ <xsd:enumeration value="TotalEndingInventory"/>
+ <xsd:enumeration value="TotalFloatTime"/>
+ <xsd:enumeration value="TotalGasDisposition"/>
+ <xsd:enumeration value="TotalGasInjectionVolume"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithOccupationalIllnessesNotOtherwiseClassified"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithoutLostWorkDays"/>
+ <xsd:enumeration value="TotalIllnessWithLostWorkDaysOrRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithDaysAwayFromWorkOrRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithoutLostWorkDays"/>
+ <xsd:enumeration value="TotalInventory"/>
+ <xsd:enumeration value="TotalNon-ConsolidatedSubsidiaries"/>
+ <xsd:enumeration value="TotalNumberOfConvictions"/>
+ <xsd:enumeration value="TotalNumberOfDomesticSubsidiariesIncludedInFinancial"/>
+ <xsd:enumeration value="TotalNumberOfDomesticSubsidiariesNotIncludedIn"/>
+ <xsd:enumeration value="TotalNumberOfForeignSubsidiariesIncludedInFinancial"/>
+ <xsd:enumeration value="TotalNumberOfForeignSubsidiariesNotIncludedIn"/>
+ <xsd:enumeration value="TotalNumberOfLoanDetailRecords"/>
+ <xsd:enumeration value="TotalNumberOfMortgagees"/>
+ <xsd:enumeration value="TotalNumberOfParkingSpaces"/>
+ <xsd:enumeration value="TotalNumberOfSubsidiariesNotIncludedInTheFinancial"/>
+ <xsd:enumeration value="TotalNumberOfUnits"/>
+ <xsd:enumeration value="TotalNumberOfUnitsForSale"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationCombinedReports"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationFirstReports"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationSubsequentReports"/>
+ <xsd:enumeration value="TotalOfIssuableAssets"/>
+ <xsd:enumeration value="TotalOilAndOrCondensateDisposition"/>
+ <xsd:enumeration value="TotalOilAndOrCondensateInjectionVolume"/>
+ <xsd:enumeration value="TotalOtherPropertiesOwnedAndFinanced"/>
+ <xsd:enumeration value="TotalPaymentsRejected"/>
+ <xsd:enumeration value="TotalPost-AdvicesAccepted"/>
+ <xsd:enumeration value="TotalPost-AdvicesReceived"/>
+ <xsd:enumeration value="TotalPost-AdvicesRejected"/>
+ <xsd:enumeration value="TotalPre-AdvicesAccepted"/>
+ <xsd:enumeration value="TotalPre-AdvicesReceived"/>
+ <xsd:enumeration value="TotalPre-AdvicesRejected"/>
+ <xsd:enumeration value="TotalPrenotesAccepted"/>
+ <xsd:enumeration value="TotalPrenotesReceived"/>
+ <xsd:enumeration value="TotalPrenotesRejected"/>
+ <xsd:enumeration value="TotalProductionVolume"/>
+ <xsd:enumeration value="TotalPropertiesOwned"/>
+ <xsd:enumeration value="TotalQuantityPlanned"/>
+ <xsd:enumeration value="TotalResource-Quantity"/>
+ <xsd:enumeration value="TotalRooms"/>
+ <xsd:enumeration value="TotalSales"/>
+ <xsd:enumeration value="TotalServiceBackorderQuantityHighPriority"/>
+ <xsd:enumeration value="TotalServiceBackorderQuantityLowPriority"/>
+ <xsd:enumeration value="TotalSharesOfStock"/>
+ <xsd:enumeration value="TotalSystemBackorderQuantityHighPriority"/>
+ <xsd:enumeration value="TotalSystemBackorderQuantityLowPriority"/>
+ <xsd:enumeration value="TotalToDate"/>
+ <xsd:enumeration value="TotalTransactions"/>
+ <xsd:enumeration value="TotalUnidentifiedTransactionsRejected"/>
+ <xsd:enumeration value="TotalWaterDisposition"/>
+ <xsd:enumeration value="TotalWaterInjectionVolume"/>
+ <xsd:enumeration value="TotalWorkedByAllEmployees"/>
+ <xsd:enumeration value="TotalWorkingInterest"/>
+ <xsd:enumeration value="TrademarkRepresented"/>
+ <xsd:enumeration value="TrademarksUsed"/>
+ <xsd:enumeration value="Trainees"/>
+ <xsd:enumeration value="Trainers"/>
+ <xsd:enumeration value="TransactionSets"/>
+ <xsd:enumeration value="TransferQuantity"/>
+ <xsd:enumeration value="TransferredInQuantity"/>
+ <xsd:enumeration value="TransferredOutQuantity"/>
+ <xsd:enumeration value="TravelFrequency"/>
+ <xsd:enumeration value="TravellingEmployees"/>
+ <xsd:enumeration value="TravelPeriod"/>
+ <xsd:enumeration value="TripDuration"/>
+ <xsd:enumeration value="Trips"/>
+ <xsd:enumeration value="TrunkedChannels"/>
+ <xsd:enumeration value="UnacknowledgedQuantity"/>
+ <xsd:enumeration value="UnadjustedCorrectorReading"/>
+ <xsd:enumeration value="UncoveredCheques"/>
+ <xsd:enumeration value="UniformCommercialCodeFilings"/>
+ <xsd:enumeration value="UnionEmployees"/>
+ <xsd:enumeration value="Units"/>
+ <xsd:enumeration value="UnitsCompleted"/>
+ <xsd:enumeration value="UnitsForSale"/>
+ <xsd:enumeration value="UnitsPerUnitPrice"/>
+ <xsd:enumeration value="UnitsProduced"/>
+ <xsd:enumeration value="UnitsRented"/>
+ <xsd:enumeration value="UnitsWorkedLastDay"/>
+ <xsd:enumeration value="UnitsWorkedPerDay"/>
+ <xsd:enumeration value="UnitsWorkedPerQuarter"/>
+ <xsd:enumeration value="UnitsWorkedPerWeek"/>
+ <xsd:enumeration value="Unpaid"/>
+ <xsd:enumeration value="UnsaleableQuantity"/>
+ <xsd:enumeration value="UnsoldQuantityHeldByWholesaler"/>
+ <xsd:enumeration value="UntilNextTravel"/>
+ <xsd:enumeration value="UnusableQuantity"/>
+ <xsd:enumeration value="UnusedAccumulatedSickDays"/>
+ <xsd:enumeration value="UnverifiedReceipts"/>
+ <xsd:enumeration value="UrgentDeliveryQuantity"/>
+ <xsd:enumeration value="Used"/>
+ <xsd:enumeration value="UseOfExtracorporealCirculation"/>
+ <xsd:enumeration value="UseOfHyperbaricPressurization"/>
+ <xsd:enumeration value="UseOfHypertension"/>
+ <xsd:enumeration value="UseOfHypotension"/>
+ <xsd:enumeration value="UseOfHypothermia"/>
+ <xsd:enumeration value="Vacancies"/>
+ <xsd:enumeration value="Variance"/>
+ <xsd:enumeration value="VarianceAdjustment"/>
+ <xsd:enumeration value="VehicularRadios"/>
+ <xsd:enumeration value="VerifiedReceipts"/>
+ <xsd:enumeration value="VisitationFrequency"/>
+ <xsd:enumeration value="Visits"/>
+ <xsd:enumeration value="VoiceStorageQuantity"/>
+ <xsd:enumeration value="VoidVotes"/>
+ <xsd:enumeration value="VolumeShrinkageAdjustmentOrAllowance"/>
+ <xsd:enumeration value="Votes"/>
+ <xsd:enumeration value="VotingSharesHeld"/>
+ <xsd:enumeration value="WarehouseEmployees"/>
+ <xsd:enumeration value="WarehouseSize"/>
+ <xsd:enumeration value="WaterRe-InjectedOnProperty"/>
+ <xsd:enumeration value="WaterVolume"/>
+ <xsd:enumeration value="WeeksWorked"/>
+ <xsd:enumeration value="Weight"/>
+ <xsd:enumeration value="WeightChangePeriod"/>
+ <xsd:enumeration value="WeightGain"/>
+ <xsd:enumeration value="WeightLoss"/>
+ <xsd:enumeration value="WholesalerToWholesalerSales"/>
+ <xsd:enumeration value="WideAreaTelephoneServicePer800ServiceUnits"/>
+ <xsd:enumeration value="WorkCalendarUnits"/>
+ <xsd:enumeration value="WorkDays"/>
+ <xsd:enumeration value="WorkInProcess"/>
+ <xsd:enumeration value="WorkPeriod"/>
+ <xsd:enumeration value="WorkTimeUnits"/>
+ <xsd:enumeration value="WorkTimeUnitsPerShift"/>
+ <xsd:enumeration value="Years"/>
+ <xsd:enumeration value="YearsInSchool"/>
+ <xsd:enumeration value="YearsInThisLineOfWorkOrProfession"/>
+ <xsd:enumeration value="YearsOnJob"/>
+ <xsd:enumeration value="YearsRemaining"/>
+ <xsd:enumeration value="YesVotes"/>
+ <xsd:enumeration value="CurrentDuration"/>
+ <xsd:enumeration value="CurrentInventoryQuantityAvailableForShipment"/>
+ <xsd:enumeration value="CurrentPeriodImbalance"/>
+ <xsd:enumeration value="CurrentServiceLife"/>
+ <xsd:enumeration value="CurrentShareBalance"/>
+ <xsd:enumeration value="CustomerEstimatedLatestMeterReading"/>
+ <xsd:enumeration value="CustomerEstimatedPreviousMeterReading"/>
+ <xsd:enumeration value="CustomerReadingQuantity"/>
+ <xsd:enumeration value="DailyAdjustments"/>
+ <xsd:enumeration value="DailyAverageQuantity"/>
+ <xsd:enumeration value="DailyWorkShifts"/>
+ <xsd:enumeration value="DamagedGoods"/>
+ <xsd:enumeration value="DataStorageQuantity"/>
+ <xsd:enumeration value="Days"/>
+ <xsd:enumeration value="DaysOperated"/>
+ <xsd:enumeration value="DaysProduced"/>
+ <xsd:enumeration value="DaysSupply"/>
+ <xsd:enumeration value="DebentureBond"/>
+ <xsd:enumeration value="DebenturesFiledAgainstDirectors"/>
+ <xsd:enumeration value="Debited"/>
+ <xsd:enumeration value="DebtCollectors"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="CatalogReference">
+ <xsd:sequence>
+ <xsd:element name="CatalogURL" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="CatalogID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CatalogItemID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="CatalogReference" type="CatalogReference"/>
+ <xsd:complexType name="ListOfContractItem">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ContractItem"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContractItem" type="ListOfContractItem"/>
+ <xsd:complexType name="ContractItem">
+ <xsd:sequence>
+ <xsd:element ref="Contract"/>
+ <xsd:element minOccurs="0" name="ContractItemNumber" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractItem" type="ContractItem"/>
+ <xsd:complexType name="ConditionsOfSale">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="SalesRequirement"/>
+ <xsd:element minOccurs="0" name="SalesActionCoded" type="SalesActionCode"/>
+ <xsd:element minOccurs="0" name="SalesActionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SalesActionValue" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ConditionsOfSale" type="ConditionsOfSale"/>
+ <xsd:complexType name="SalesRequirement">
+ <xsd:sequence>
+ <xsd:element name="SalesRequirementCoded" type="SalesRequirementCode"/>
+ <xsd:element minOccurs="0" name="SalesRequirementCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SalesRequirement" type="SalesRequirement"/>
+ <xsd:simpleType name="SalesRequirementCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AddQuantityToMakeMinimumWeightRequirement"/>
+ <xsd:enumeration value="BackOrderIfItemsAreOutOfStockOrNotYetPublished"/>
+ <xsd:enumeration value="BackOrderIfOutOfStock"/>
+ <xsd:enumeration value="BackOrderOnlyIfNewItem"/>
+ <xsd:enumeration value="BidGuarantee"/>
+ <xsd:enumeration value="CombinedSmallDisadvantagedBusinessAndLaborSurplusAreaSet-Aside"/>
+ <xsd:enumeration value="Consignment"/>
+ <xsd:enumeration value="DoNotPreship"/>
+ <xsd:enumeration value="EqualProductAllowed"/>
+ <xsd:enumeration value="ExcludeImportQuotaInFirstCost"/>
+ <xsd:enumeration value="FactoryShip"/>
+ <xsd:enumeration value="GuaranteedSale"/>
+ <xsd:enumeration value="IncludeImportQuotaInFirstCost"/>
+ <xsd:enumeration value="LaborSurplusAreaSet-Aside"/>
+ <xsd:enumeration value="LargePurchaseSet-AsideForSmallBusiness"/>
+ <xsd:enumeration value="MayPreship"/>
+ <xsd:enumeration value="Multi-yearAward"/>
+ <xsd:enumeration value="NoBackOrder"/>
+ <xsd:enumeration value="NoSubstitutes"/>
+ <xsd:enumeration value="NotifyPriorToShipmentIfQuantitySpecifiedIsNotAvailable"/>
+ <xsd:enumeration value="OnQualifiedBiddersList"/>
+ <xsd:enumeration value="OnQualifiedManufacturersList"/>
+ <xsd:enumeration value="OtherUnlistedSalesCondition"/>
+ <xsd:enumeration value="PartialLaborSurplusAreaSetAside"/>
+ <xsd:enumeration value="RestrictedToApprovedSources"/>
+ <xsd:enumeration value="RestrictedToEducationalInstitutions"/>
+ <xsd:enumeration value="RestrictedToHistoricallyBlackCollegeOrUniversityOrMinorityInstitution"/>
+ <xsd:enumeration value="RestrictedToIndustrialPreparednessProgramParticipants"/>
+ <xsd:enumeration value="RestrictedToQualifiedProductsListProducts"/>
+ <xsd:enumeration value="RestrictedToUSAndCanadianSources"/>
+ <xsd:enumeration value="RestrictedToYoungInvestigatorProgram"/>
+ <xsd:enumeration value="Section8aSet-Aside"/>
+ <xsd:enumeration value="Set-asideForAmericanIndian-ownedBusiness"/>
+ <xsd:enumeration value="ShipAsSoonAsPossible"/>
+ <xsd:enumeration value="ShipComplete"/>
+ <xsd:enumeration value="ShipFullTruckOnly"/>
+ <xsd:enumeration value="ShipIn-Place"/>
+ <xsd:enumeration value="ShipPartial-BalanceBackOrder"/>
+ <xsd:enumeration value="ShipPartialBalanceCancel"/>
+ <xsd:enumeration value="ShipPartialBalanceSubstitute"/>
+ <xsd:enumeration value="ShipPartialCarloadLotsOnly"/>
+ <xsd:enumeration value="ShipPartialItemQtyProportionalToTotalOrder"/>
+ <xsd:enumeration value="ShipPartialTruckloadLotsOnly"/>
+ <xsd:enumeration value="ShipPerRelease"/>
+ <xsd:enumeration value="ShipPerReleaseorBuyerAuthorization"/>
+ <xsd:enumeration value="ShipPerSchedule"/>
+ <xsd:enumeration value="SmallBusinessWithSmallDisadvantagedBusinessConsiderationSet-Aside"/>
+ <xsd:enumeration value="SmallDisadvantagedBusinessSet-Aside"/>
+ <xsd:enumeration value="SmallPurchaseSetAsideForSmallBusinesses"/>
+ <xsd:enumeration value="SmallRemainingBalanceCancellationAllowed"/>
+ <xsd:enumeration value="SmallRemainingBalanceCancellationNotAllowed"/>
+ <xsd:enumeration value="SubstituteItemAllowed"/>
+ <xsd:enumeration value="UnrestrictedProcurement"/>
+ <xsd:enumeration value="WarehouseShip"/>
+ <xsd:enumeration value="Warranty"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="SalesActionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CancelBalanceThatExceedsSalesActionValues"/>
+ <xsd:enumeration value="CancelEntire"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Hazardous">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="ListOfHazardousIdentifiers"/>
+ <xsd:element minOccurs="0" name="HazardClassCoded" type="HazardClassCode"/>
+ <xsd:element minOccurs="0" name="HazardClassCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="HazardousPlacardInformation"/>
+ <xsd:element minOccurs="0" name="HazardousReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="HazardousContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="HazardNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="UNDGNum" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="HazardousTemperatures"/>
+ <xsd:element minOccurs="0" ref="HazardousShipmentInformation"/>
+ <xsd:element minOccurs="0" name="EMSNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Mfag" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Hazardous" type="Hazardous"/>
+ <xsd:complexType name="ListOfHazardousIdentifiers">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="HazardousIdentifiers"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfHazardousIdentifiers" type="ListOfHazardousIdentifiers"/>
+ <xsd:complexType name="HazardousIdentifiers">
+ <xsd:sequence>
+ <xsd:element name="HazardousRegulationsCoded" type="AgencyCode"/>
+ <xsd:element minOccurs="0" name="HazardousRegulationsCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeExtension" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeVersion" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardOfficialText" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TremCardNum" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousIdentifiers" type="HazardousIdentifiers"/>
+ <xsd:simpleType name="HazardClassCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Primary"/>
+ <xsd:enumeration value="Secondary"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="HazardousPlacardInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="HazardousPlacardIdentification" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousPlacardText" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousPlacardInformation" type="HazardousPlacardInformation"/>
+ <xsd:complexType name="HazardousTemperatures">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="Flashpoint">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="Emergency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="Control">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ListOfTemperatureCoded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousTemperatures" type="HazardousTemperatures"/>
+ <xsd:complexType name="HazardousShipmentInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="HazardPackingCoded" type="HazardPackingCode"/>
+ <xsd:element minOccurs="0" name="HazardPackingCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentCoded" type="HazardousShipmentCode"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousZoneCoded" type="HazardousZoneCode"/>
+ <xsd:element minOccurs="0" name="HazardousZoneCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousShipmentInformation" type="HazardousShipmentInformation"/>
+ <xsd:simpleType name="HazardPackingCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="GreatDanger"/>
+ <xsd:enumeration value="MediumDanger"/>
+ <xsd:enumeration value="MinorDanger"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="HazardousShipmentCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalDescriptiveInformationNotRequiredByRegulationButDesiredToAccompanyTheMovementByTheShipper"/>
+ <xsd:enumeration value="CargoAirliftOnly"/>
+ <xsd:enumeration value="DOT-113DoNotBumpOrCutOffCarWhileInMotionDeclaration"/>
+ <xsd:enumeration value="DamagedCarNumber"/>
+ <xsd:enumeration value="DangerousWhenWetDeclaration"/>
+ <xsd:enumeration value="EMSPageNumber"/>
+ <xsd:enumeration value="IdentifiesProductsInAHeatedMoltenState"/>
+ <xsd:enumeration value="HazardousSubstanceConstituents"/>
+ <xsd:enumeration value="InhalationHazard"/>
+ <xsd:enumeration value="LimitedQuantityDeclaration"/>
+ <xsd:enumeration value="MFAGPageNumber"/>
+ <xsd:enumeration value="MaximumOperatingSpeed"/>
+ <xsd:enumeration value="MarinePollutant"/>
+ <xsd:enumeration value="Poison-InhalationHazardDeclaration"/>
+ <xsd:enumeration value="PoisonDeclaration"/>
+ <xsd:enumeration value="RadioactiveMaterialData"/>
+ <xsd:enumeration value="TechnicalOrChemicalGroupName"/>
+ <xsd:enumeration value="TradeName"/>
+ <xsd:enumeration value="WasteDeclaration"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="HazardousZoneCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="HazardZoneA"/>
+ <xsd:enumeration value="HazardZoneB"/>
+ <xsd:enumeration value="HazardZoneC"/>
+ <xsd:enumeration value="HazardZoneD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PricingDetail">
+ <xsd:sequence>
+ <xsd:element ref="ListOfPrice"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Tax"/>
+ <xsd:element minOccurs="0" name="ItemAllowancesOrCharges">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAllowOrCharge"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PricingDetail" type="PricingDetail"/>
+ <xsd:complexType name="DeliveryDetail">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ShipToLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShipFromLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfScheduleLine"/>
+ <xsd:element minOccurs="0" ref="ItemPackagingReference"/>
+ <xsd:element minOccurs="0" name="SimplePackageNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="TermsOfDelivery"/>
+ <xsd:element minOccurs="0" ref="CargoClassification"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DeliveryDetail" type="DeliveryDetail"/>
+ <xsd:complexType name="ListOfScheduleLine">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ScheduleLine"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfScheduleLine" type="ListOfScheduleLine"/>
+ <xsd:complexType name="ScheduleLine">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ScheduleLineID" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusEventCoded" type="ShipmentStatusEventCode"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusEventCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusReasons">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfStatusReason"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="Quantity"/>
+ <xsd:element minOccurs="0" name="RequestedDeliveryDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="ListOfOtherDeliveryDate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDateCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ScheduleLineNote" type="xsd:string"/>
+ <xsd:choice minOccurs="0">
+ <xsd:element ref="Transport"/>
+ <xsd:element name="TransportReference" type="xsd:int"/>
+ </xsd:choice>
+ <xsd:element minOccurs="0" ref="ListOfShipToSubInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ScheduleLine" type="ScheduleLine"/>
+ <xsd:simpleType name="ShipmentStatusEventCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotApplicable"/>
+ <xsd:enumeration value="NotYetShipped"/>
+ <xsd:enumeration value="BackOrdered"/>
+ <xsd:enumeration value="BackOrderShipped"/>
+ <xsd:enumeration value="ReadyForPickup"/>
+ <xsd:enumeration value="InTransit"/>
+ <xsd:enumeration value="PartiallyShipped"/>
+ <xsd:enumeration value="PartiallyDelivered"/>
+ <xsd:enumeration value="ShipmentComplete"/>
+ <xsd:enumeration value="Delivered"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfStatusReason">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="StatusReason"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfStatusReason" type="ListOfStatusReason"/>
+ <xsd:complexType name="StatusReason">
+ <xsd:sequence>
+ <xsd:element name="StatusReasonCoded" type="StatusReasonCode"/>
+ <xsd:element minOccurs="0" name="StatusReasonCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StatusReason" type="StatusReason"/>
+ <xsd:simpleType name="StatusReasonCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="ChangedSchedule"/>
+ <xsd:enumeration value="InstructionsAwaited"/>
+ <xsd:enumeration value="Damaged"/>
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CustomsRefusal"/>
+ <xsd:enumeration value="EmptyOnInspection"/>
+ <xsd:enumeration value="DestinationIncorrect"/>
+ <xsd:enumeration value="ExportRestrictions"/>
+ <xsd:enumeration value="ImportRestrictions"/>
+ <xsd:enumeration value="PaymentNotReceived"/>
+ <xsd:enumeration value="DeliveryDifferentDate"/>
+ <xsd:enumeration value="DeliveryTooLate"/>
+ <xsd:enumeration value="IncidentAttributedToSeller"/>
+ <xsd:enumeration value="IncidentAttributedToTheBuyer"/>
+ <xsd:enumeration value="IncidentAttributedToTheCarrier"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfShipToSubInformation">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ShipToSubInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfShipToSubInformation" type="ListOfShipToSubInformation"/>
+ <xsd:complexType name="ShipToSubInformation">
+ <xsd:sequence>
+ <xsd:element name="ShipToSubLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ShipToSubQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SubLocationItemPackagingReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ItemPackagingReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ShipToSubInformation" type="ShipToSubInformation"/>
+ <xsd:complexType name="ItemPackagingReference">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemPackagingReference" type="ItemPackagingReference"/>
+ <xsd:complexType name="PackageReference">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="Quantity"/>
+ <xsd:element name="PackageIDReference" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="PackageReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageReference" type="PackageReference"/>
+ <xsd:complexType name="CargoClassification">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="NatureOfGoods">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OperationalTypeCoded" type="OperationalTypeCode"/>
+ <xsd:element minOccurs="0" name="OperationalTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TypeOfCargo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="CargoClassification" type="CargoClassification"/>
+ <xsd:simpleType name="OperationalTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Documents"/>
+ <xsd:enumeration value="LowValueNon-DutiableConsignments"/>
+ <xsd:enumeration value="LowValueDutiableConsignments"/>
+ <xsd:enumeration value="HighValueConsignments"/>
+ <xsd:enumeration value="OtherNon-Containerized"/>
+ <xsd:enumeration value="Vehicles"/>
+ <xsd:enumeration value="Roll-OnRoll-Off"/>
+ <xsd:enumeration value="Palletized"/>
+ <xsd:enumeration value="Containerized"/>
+ <xsd:enumeration value="Breakbulk"/>
+ <xsd:enumeration value="HazardousCargo"/>
+ <xsd:enumeration value="GeneralCargo"/>
+ <xsd:enumeration value="LiquidCargo"/>
+ <xsd:enumeration value="TemperatureControlledCargo"/>
+ <xsd:enumeration value="EnvironmentalPollutantCargo"/>
+ <xsd:enumeration value="Not-HazardousCargo"/>
+ <xsd:enumeration value="Diplomatic"/>
+ <xsd:enumeration value="Military"/>
+ <xsd:enumeration value="Obnoxious"/>
+ <xsd:enumeration value="OutOfGauge"/>
+ <xsd:enumeration value="HouseholdGoodsAndPersonalEffects"/>
+ <xsd:enumeration value="FrozenCargo"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfPackageDetail">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackageDetail" type="ListOfPackageDetail"/>
+ <xsd:complexType name="PackageDetail">
+ <xsd:sequence>
+ <xsd:element ref="PackageType"/>
+ <xsd:element name="NumberOfPackages" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="ListOfPackage"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageDetail" type="PackageDetail"/>
+ <xsd:complexType name="PackageType">
+ <xsd:sequence>
+ <xsd:element name="PackageTypeCoded" type="PackageTypeCode"/>
+ <xsd:element minOccurs="0" name="PackageTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PackageTypeDescription">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDescription"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageType" type="PackageType"/>
+ <xsd:simpleType name="PackageTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Aerosol"/>
+ <xsd:enumeration value="Aluminum"/>
+ <xsd:enumeration value="AmmoPack"/>
+ <xsd:enumeration value="Ampoule"/>
+ <xsd:enumeration value="Ampoule-Non-Protected"/>
+ <xsd:enumeration value="Ampoule-Protected"/>
+ <xsd:enumeration value="AsSpecifiedByTheDOT"/>
+ <xsd:enumeration value="Atomizer"/>
+ <xsd:enumeration value="Attachment"/>
+ <xsd:enumeration value="Bag"/>
+ <xsd:enumeration value="Bale"/>
+ <xsd:enumeration value="Bale-Compressed"/>
+ <xsd:enumeration value="Bale-Non-Compressed"/>
+ <xsd:enumeration value="Balloon-Non-Protected"/>
+ <xsd:enumeration value="Balloon-Protected"/>
+ <xsd:enumeration value="Banding"/>
+ <xsd:enumeration value="Bar"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="Barrel"/>
+ <xsd:enumeration value="Bars-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Basket"/>
+ <xsd:enumeration value="Beam"/>
+ <xsd:enumeration value="BeerCrate"/>
+ <xsd:enumeration value="Belting"/>
+ <xsd:enumeration value="Bin"/>
+ <xsd:enumeration value="BingChest"/>
+ <xsd:enumeration value="Board"/>
+ <xsd:enumeration value="Board-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Bobbin"/>
+ <xsd:enumeration value="Bolt"/>
+ <xsd:enumeration value="Bottle"/>
+ <xsd:enumeration value="Bottlecrate-Bottlerack"/>
+ <xsd:enumeration value="Bottle-Non-Protected-Bulbous"/>
+ <xsd:enumeration value="Bottle-Non-Protected-Cylindrical"/>
+ <xsd:enumeration value="Bottle-ProtectedBulbous"/>
+ <xsd:enumeration value="Bottle-ProtectedCylindrical"/>
+ <xsd:enumeration value="Box"/>
+ <xsd:enumeration value="BoxWithInnerContainer"/>
+ <xsd:enumeration value="Bracing"/>
+ <xsd:enumeration value="Bucket"/>
+ <xsd:enumeration value="Bulk"/>
+ <xsd:enumeration value="Bulk-Gas-At1031MbarAnd15DegC"/>
+ <xsd:enumeration value="Bulk-LiquefiedGas-AtAbnormalTemperatureOrPressure"/>
+ <xsd:enumeration value="Bulk-Liquid"/>
+ <xsd:enumeration value="Bulk-Solid-FineParticles-Powders"/>
+ <xsd:enumeration value="Bulk-Solid-GranularParticles-Grains"/>
+ <xsd:enumeration value="Bulk-Solid-LargeParticles-Nodules"/>
+ <xsd:enumeration value="Bunch"/>
+ <xsd:enumeration value="Bundle"/>
+ <xsd:enumeration value="Burlap"/>
+ <xsd:enumeration value="Butt"/>
+ <xsd:enumeration value="Cabinet"/>
+ <xsd:enumeration value="Cage"/>
+ <xsd:enumeration value="CanCase"/>
+ <xsd:enumeration value="Can-Cylindrical"/>
+ <xsd:enumeration value="Canister"/>
+ <xsd:enumeration value="Can-Rectangular"/>
+ <xsd:enumeration value="Canvas"/>
+ <xsd:enumeration value="Carboy"/>
+ <xsd:enumeration value="Carboy-Non-Protected"/>
+ <xsd:enumeration value="Carboy-Protected"/>
+ <xsd:enumeration value="CarLoad-Rail"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="Carton"/>
+ <xsd:enumeration value="Case"/>
+ <xsd:enumeration value="Cask"/>
+ <xsd:enumeration value="Cheeses"/>
+ <xsd:enumeration value="ChemicallyHardenedFibre"/>
+ <xsd:enumeration value="Chest"/>
+ <xsd:enumeration value="Churn"/>
+ <xsd:enumeration value="Cloth"/>
+ <xsd:enumeration value="ClothOrFabric"/>
+ <xsd:enumeration value="ClothTop"/>
+ <xsd:enumeration value="Coffer"/>
+ <xsd:enumeration value="Coffin"/>
+ <xsd:enumeration value="Coil"/>
+ <xsd:enumeration value="CollapsibleTube"/>
+ <xsd:enumeration value="Compressed"/>
+ <xsd:enumeration value="Cones"/>
+ <xsd:enumeration value="Conex"/>
+ <xsd:enumeration value="Container"/>
+ <xsd:enumeration value="Container-CommercialHighwayLift"/>
+ <xsd:enumeration value="Container-Engine"/>
+ <xsd:enumeration value="Container-Mac-Iso-Lt.Wgt8X8X20FootAir"/>
+ <xsd:enumeration value="Container-Multi-Walled-SecuredToWarehousePallet"/>
+ <xsd:enumeration value="Container-NavyCargoTransporter"/>
+ <xsd:enumeration value="ContainersOfBulkCargo"/>
+ <xsd:enumeration value="Core"/>
+ <xsd:enumeration value="CornerReinforcement"/>
+ <xsd:enumeration value="CorrugatedOrSolid"/>
+ <xsd:enumeration value="Cover"/>
+ <xsd:enumeration value="Cradle"/>
+ <xsd:enumeration value="Crate"/>
+ <xsd:enumeration value="Creel"/>
+ <xsd:enumeration value="Cup"/>
+ <xsd:enumeration value="Cylinder"/>
+ <xsd:enumeration value="Demijohn-Non-Protected"/>
+ <xsd:enumeration value="Demijohn-Protected"/>
+ <xsd:enumeration value="Double-LengthRack"/>
+ <xsd:enumeration value="Double-LengthSkid"/>
+ <xsd:enumeration value="Double-LengthToteBin"/>
+ <xsd:enumeration value="DoubleWallCorrugatedBoard"/>
+ <xsd:enumeration value="Double-WallPaper"/>
+ <xsd:enumeration value="Drum"/>
+ <xsd:enumeration value="DryBulk"/>
+ <xsd:enumeration value="Duffelbag"/>
+ <xsd:enumeration value="EdgeProtection"/>
+ <xsd:enumeration value="EggCrating"/>
+ <xsd:enumeration value="Envelope"/>
+ <xsd:enumeration value="Fiberboard"/>
+ <xsd:enumeration value="FiberboardMetal"/>
+ <xsd:enumeration value="Fibre"/>
+ <xsd:enumeration value="Fibre-Paperboard"/>
+ <xsd:enumeration value="Filmpack"/>
+ <xsd:enumeration value="Firkin"/>
+ <xsd:enumeration value="Flask"/>
+ <xsd:enumeration value="Flo-Bin"/>
+ <xsd:enumeration value="Foam"/>
+ <xsd:enumeration value="Footlocker"/>
+ <xsd:enumeration value="ForwardReel"/>
+ <xsd:enumeration value="Frame"/>
+ <xsd:enumeration value="FramedCrate"/>
+ <xsd:enumeration value="FruitCrate"/>
+ <xsd:enumeration value="GasBottle"/>
+ <xsd:enumeration value="Girder"/>
+ <xsd:enumeration value="Girders-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Glass"/>
+ <xsd:enumeration value="Half-StandardRack"/>
+ <xsd:enumeration value="Half-StandardToteBin"/>
+ <xsd:enumeration value="Hamper"/>
+ <xsd:enumeration value="HeadsOfBeef"/>
+ <xsd:enumeration value="Hogshead"/>
+ <xsd:enumeration value="HopperTruck"/>
+ <xsd:enumeration value="HouseholdGoodsContainer-Wood"/>
+ <xsd:enumeration value="Ingot"/>
+ <xsd:enumeration value="Ingots-InBundleBunchTruss"/>
+ <xsd:enumeration value="InInnerContainers"/>
+ <xsd:enumeration value="Insulated"/>
+ <xsd:enumeration value="IntermediateContainer"/>
+ <xsd:enumeration value="IntermodalTrailerOrContainerLoad-Rail"/>
+ <xsd:enumeration value="IronOrSteel"/>
+ <xsd:enumeration value="Jar"/>
+ <xsd:enumeration value="Jerrican-Cylindrical"/>
+ <xsd:enumeration value="Jerrican-Rectangular"/>
+ <xsd:enumeration value="Jug"/>
+ <xsd:enumeration value="Jumbo"/>
+ <xsd:enumeration value="Jutebag"/>
+ <xsd:enumeration value="Keg"/>
+ <xsd:enumeration value="Kit"/>
+ <xsd:enumeration value="KnockdownRack"/>
+ <xsd:enumeration value="KnockdownToteBin"/>
+ <xsd:enumeration value="Lead"/>
+ <xsd:enumeration value="Lifts"/>
+ <xsd:enumeration value="LiftVan"/>
+ <xsd:enumeration value="Liners"/>
+ <xsd:enumeration value="LipOrTop"/>
+ <xsd:enumeration value="LiquidBulk"/>
+ <xsd:enumeration value="Log"/>
+ <xsd:enumeration value="Logs-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Loose"/>
+ <xsd:enumeration value="Lug"/>
+ <xsd:enumeration value="Mat"/>
+ <xsd:enumeration value="MatchBox"/>
+ <xsd:enumeration value="Metal"/>
+ <xsd:enumeration value="MetalCans"/>
+ <xsd:enumeration value="MilkCrate"/>
+ <xsd:enumeration value="Milvan"/>
+ <xsd:enumeration value="Mixed"/>
+ <xsd:enumeration value="MixedContainerTypes"/>
+ <xsd:enumeration value="MoistureResistant"/>
+ <xsd:enumeration value="MoldedPlastic"/>
+ <xsd:enumeration value="Mscvan"/>
+ <xsd:enumeration value="Multiple-WallPaper-2OrMoreWalls"/>
+ <xsd:enumeration value="Multiple-WallPaper3OrMoreWalls"/>
+ <xsd:enumeration value="MultiplyBag"/>
+ <xsd:enumeration value="Multi-RollPack"/>
+ <xsd:enumeration value="MultiwallSack"/>
+ <xsd:enumeration value="Nest"/>
+ <xsd:enumeration value="Net"/>
+ <xsd:enumeration value="Noil"/>
+ <xsd:enumeration value="NotOtherwiseSpecified"/>
+ <xsd:enumeration value="OnHangerOrRackInBoxes"/>
+ <xsd:enumeration value="OnOwnWheel"/>
+ <xsd:enumeration value="OtherThanGlass"/>
+ <xsd:enumeration value="OtherThanMetalOrPlasticTubesOrGlass"/>
+ <xsd:enumeration value="Package"/>
+ <xsd:enumeration value="Packed-NotOtherwiseSpecified"/>
+ <xsd:enumeration value="Packet"/>
+ <xsd:enumeration value="Pail"/>
+ <xsd:enumeration value="Pallet"/>
+ <xsd:enumeration value="AluminumPallet"/>
+ <xsd:enumeration value="MetalPallet"/>
+ <xsd:enumeration value="StandardPallet"/>
+ <xsd:enumeration value="SteelPallet"/>
+ <xsd:enumeration value="WoodPallet"/>
+ <xsd:enumeration value="SlipSheetPallet"/>
+ <xsd:enumeration value="DOTPallet"/>
+ <xsd:enumeration value="Pallet-2Way"/>
+ <xsd:enumeration value="Pallet-4Way"/>
+ <xsd:enumeration value="Paper"/>
+ <xsd:enumeration value="Paper-Vci"/>
+ <xsd:enumeration value="Parcel"/>
+ <xsd:enumeration value="Partitioning"/>
+ <xsd:enumeration value="Pieces"/>
+ <xsd:enumeration value="Pipe"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PipeRack"/>
+ <xsd:enumeration value="Pipes-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Pirns"/>
+ <xsd:enumeration value="Pitcher"/>
+ <xsd:enumeration value="Plank"/>
+ <xsd:enumeration value="Planks-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Plastic"/>
+ <xsd:enumeration value="Plastic-InjectionMolded"/>
+ <xsd:enumeration value="Plastic-Regrind"/>
+ <xsd:enumeration value="Plastic-StructuralFoam"/>
+ <xsd:enumeration value="Plastic-VacuumFormed"/>
+ <xsd:enumeration value="Plastic-Virgin"/>
+ <xsd:enumeration value="Plastic-WrappedTray"/>
+ <xsd:enumeration value="Plate"/>
+ <xsd:enumeration value="Plates-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Platform"/>
+ <xsd:enumeration value="PolyethyleneLined"/>
+ <xsd:enumeration value="Polystyrene"/>
+ <xsd:enumeration value="Pot"/>
+ <xsd:enumeration value="Pouch"/>
+ <xsd:enumeration value="PrimaryLiftContainer"/>
+ <xsd:enumeration value="PrivateVehicle"/>
+ <xsd:enumeration value="Pulpboard"/>
+ <xsd:enumeration value="QuarterOfBeef"/>
+ <xsd:enumeration value="Rack"/>
+ <xsd:enumeration value="Rail-Semiconductor"/>
+ <xsd:enumeration value="Rednet"/>
+ <xsd:enumeration value="Reel"/>
+ <xsd:enumeration value="Reinforcement"/>
+ <xsd:enumeration value="ReverseReel"/>
+ <xsd:enumeration value="Ring"/>
+ <xsd:enumeration value="Rod"/>
+ <xsd:enumeration value="Rods-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Roll"/>
+ <xsd:enumeration value="Rubber"/>
+ <xsd:enumeration value="RubberAndFabric"/>
+ <xsd:enumeration value="Sachet"/>
+ <xsd:enumeration value="Sack"/>
+ <xsd:enumeration value="Sea-Chest"/>
+ <xsd:enumeration value="Seavan"/>
+ <xsd:enumeration value="SeparatorOrDivider"/>
+ <xsd:enumeration value="ShallowCrate"/>
+ <xsd:enumeration value="Sheet"/>
+ <xsd:enumeration value="Sheetmetal"/>
+ <xsd:enumeration value="Sheets-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Shook"/>
+ <xsd:enumeration value="ShrinkWrap"/>
+ <xsd:enumeration value="Shrinkwrapped"/>
+ <xsd:enumeration value="SideOfBeef"/>
+ <xsd:enumeration value="SingleWallCorrugatedBoard"/>
+ <xsd:enumeration value="SkeletonCase"/>
+ <xsd:enumeration value="Skid"/>
+ <xsd:enumeration value="Skid-ElevatingOrLiftTruck"/>
+ <xsd:enumeration value="Sleeve"/>
+ <xsd:enumeration value="Slipsheet"/>
+ <xsd:enumeration value="Special"/>
+ <xsd:enumeration value="SpecialJumbo"/>
+ <xsd:enumeration value="SpinCylinders"/>
+ <xsd:enumeration value="Spindle"/>
+ <xsd:enumeration value="Spool"/>
+ <xsd:enumeration value="StainlessSteel"/>
+ <xsd:enumeration value="Standard"/>
+ <xsd:enumeration value="Steel-VinylCoated"/>
+ <xsd:enumeration value="StretchWrap"/>
+ <xsd:enumeration value="Suitcase"/>
+ <xsd:enumeration value="Tank"/>
+ <xsd:enumeration value="TankCar"/>
+ <xsd:enumeration value="Tank-Cylindrical"/>
+ <xsd:enumeration value="Tank-Rectangular"/>
+ <xsd:enumeration value="TankTruck"/>
+ <xsd:enumeration value="Tea-Chest"/>
+ <xsd:enumeration value="Tierce"/>
+ <xsd:enumeration value="Tin"/>
+ <xsd:enumeration value="ToteBin"/>
+ <xsd:enumeration value="Tray"/>
+ <xsd:enumeration value="TrayPack"/>
+ <xsd:enumeration value="TripleWallCorrugatedBoard"/>
+ <xsd:enumeration value="Truck"/>
+ <xsd:enumeration value="TrunkAndChest"/>
+ <xsd:enumeration value="Trunk-SalesmenSample"/>
+ <xsd:enumeration value="Truss"/>
+ <xsd:enumeration value="Tub"/>
+ <xsd:enumeration value="Tube"/>
+ <xsd:enumeration value="Tube-Collapsible"/>
+ <xsd:enumeration value="Tubes-InBundleOrBunchOrTruss"/>
+ <xsd:enumeration value="Tubes-MetalOrPlastic"/>
+ <xsd:enumeration value="Tun"/>
+ <xsd:enumeration value="Unit"/>
+ <xsd:enumeration value="UnpackedOrUnpackaged"/>
+ <xsd:enumeration value="Vacuum-Packed"/>
+ <xsd:enumeration value="VanPack"/>
+ <xsd:enumeration value="Vat"/>
+ <xsd:enumeration value="VehicleInOperatingCondition"/>
+ <xsd:enumeration value="Vehicles"/>
+ <xsd:enumeration value="Vial"/>
+ <xsd:enumeration value="WheeledCarrier"/>
+ <xsd:enumeration value="Wickerbottle"/>
+ <xsd:enumeration value="WireMesh"/>
+ <xsd:enumeration value="WireOrCord"/>
+ <xsd:enumeration value="Wood"/>
+ <xsd:enumeration value="Wrapped"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfPackage">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Package"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackage" type="ListOfPackage"/>
+ <xsd:complexType name="Package">
+ <xsd:sequence>
+ <xsd:element name="PackageID" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="ListOfItemReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfOrderReferences"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfPackageMark"/>
+ <xsd:element minOccurs="0" ref="ListOfPackageCharacteristic"/>
+ <xsd:element minOccurs="0" ref="ListOfDimension"/>
+ <xsd:element minOccurs="0" ref="ListOfPackageDescription"/>
+ <xsd:element minOccurs="0" name="TransportReference" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="SpecialHandling"/>
+ <xsd:element minOccurs="0" name="HazardousPackaging">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Hazardous"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="AssociatedDocuments"/>
+ <xsd:element minOccurs="0" name="ShippingInstructions" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ReturnableContainerInfo"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="PackageDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Package" type="Package"/>
+ <xsd:complexType name="ListOfOrderReferences">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="OrderReferences"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfOrderReferences" type="ListOfOrderReferences"/>
+ <xsd:complexType name="ListOfPackageMark">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageMark"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackageMark" type="ListOfPackageMark"/>
+ <xsd:complexType name="PackageMark">
+ <xsd:sequence>
+ <xsd:element name="PackageMarkCoded" type="PackageMarkCode"/>
+ <xsd:element minOccurs="0" name="PackageMarkCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PackageMarkValue" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageMark" type="PackageMark"/>
+ <xsd:simpleType name="PackageMarkCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BuyersInstructions"/>
+ <xsd:enumeration value="Carrier-AssignedPackageIdNumber"/>
+ <xsd:enumeration value="CarriersInstructions"/>
+ <xsd:enumeration value="DoNotMarkSuppliersCompanyName"/>
+ <xsd:enumeration value="EntireShipment"/>
+ <xsd:enumeration value="IndustryInstructions"/>
+ <xsd:enumeration value="LegalRequirements"/>
+ <xsd:enumeration value="LineItemOnly"/>
+ <xsd:enumeration value="MarkAdditionallyCustomersArticleDescription"/>
+ <xsd:enumeration value="MarkArticleNumberCustomer"/>
+ <xsd:enumeration value="MarkBatchNumber"/>
+ <xsd:enumeration value="MarkCaseNumber"/>
+ <xsd:enumeration value="MarkCustomersCompanyName"/>
+ <xsd:enumeration value="MarkCustomersReferences"/>
+ <xsd:enumeration value="MarkDateOfProduction"/>
+ <xsd:enumeration value="MarkExclusivelyCustomersArticleDescription"/>
+ <xsd:enumeration value="MarkExpiryDate"/>
+ <xsd:enumeration value="MarkFreeText"/>
+ <xsd:enumeration value="MarkGrossWeight"/>
+ <xsd:enumeration value="MarkNetWeight"/>
+ <xsd:enumeration value="MarkPackagesDimensions"/>
+ <xsd:enumeration value="MarkRunningNumberOfPackages"/>
+ <xsd:enumeration value="MarkSerialShippingContainerCode"/>
+ <xsd:enumeration value="MarkSupplierNumber"/>
+ <xsd:enumeration value="MarkTareWeight"/>
+ <xsd:enumeration value="MasterCartonNumber"/>
+ <xsd:enumeration value="OriginatorAssigned"/>
+ <xsd:enumeration value="PalletConfigurationNumber"/>
+ <xsd:enumeration value="PalletNumber"/>
+ <xsd:enumeration value="PreMarkedByBuyer"/>
+ <xsd:enumeration value="ReceiverAssignedDropZone"/>
+ <xsd:enumeration value="Self-IdentifyingContainerViaRadioFrequencyIdDevice"/>
+ <xsd:enumeration value="SellersInstructions"/>
+ <xsd:enumeration value="ShipperAssigned"/>
+ <xsd:enumeration value="Shipper-AssignedCaseNumber"/>
+ <xsd:enumeration value="ShipperAssignedRollNumber"/>
+ <xsd:enumeration value="ShipperAssignedSkidNumber"/>
+ <xsd:enumeration value="SSCC-18"/>
+ <xsd:enumeration value="SSCC-18AndApplicationIdentifier"/>
+ <xsd:enumeration value="UPCShippingContainerCode"/>
+ <xsd:enumeration value="UCCOrEAN128ApplicationIdentifierAndData"/>
+ <xsd:enumeration value="UniformCodeCouncilFormat"/>
+ <xsd:enumeration value="UPCConsumerPackageCode-1-5-5-1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfPackageCharacteristic">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageCharacteristic"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackageCharacteristic" type="ListOfPackageCharacteristic"/>
+ <xsd:complexType name="PackageCharacteristic">
+ <xsd:sequence>
+ <xsd:element name="PackageCharacteristicCoded" type="PackageCharacteristicCode"/>
+ <xsd:element minOccurs="0" name="PackageCharacteristicCodedOther" type="xsd:string"/>
+ <xsd:element name="PackageCharacteristicDescription">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageCharacteristic" type="PackageCharacteristic"/>
+ <xsd:simpleType name="PackageCharacteristicCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CasingType"/>
+ <xsd:enumeration value="ShippingPackageLabeling"/>
+ <xsd:enumeration value="ShippingPackageSealing"/>
+ <xsd:enumeration value="ProductMarking"/>
+ <xsd:enumeration value="TypeofPackage"/>
+ <xsd:enumeration value="PackageSpecifications"/>
+ <xsd:enumeration value="PackageProtection"/>
+ <xsd:enumeration value="Tarping"/>
+ <xsd:enumeration value="PlatformOrSkidLocation"/>
+ <xsd:enumeration value="BearingPieceLocation"/>
+ <xsd:enumeration value="PlacementonCarrier"/>
+ <xsd:enumeration value="SpacingDirections"/>
+ <xsd:enumeration value="UnloadingDevice"/>
+ <xsd:enumeration value="UnloadingEquipment"/>
+ <xsd:enumeration value="ProductMarkingPattern"/>
+ <xsd:enumeration value="ProductMarkingLocation"/>
+ <xsd:enumeration value="PackageOrContainerMarkLocation"/>
+ <xsd:enumeration value="MarkingMethod"/>
+ <xsd:enumeration value="CoreCharacteristics"/>
+ <xsd:enumeration value="ReceivingFacilityLimitations"/>
+ <xsd:enumeration value="TaggingOrBarCodeInstructions"/>
+ <xsd:enumeration value="SkidOrPalletType"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfPackageDescription">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageDescription"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackageDescription" type="ListOfPackageDescription"/>
+ <xsd:complexType name="PackageDescription">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="ListOfPackageIdentifier"/>
+ <xsd:element minOccurs="0" name="ContainerCounter" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="LoadOrderCounter" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageDescription" type="PackageDescription"/>
+ <xsd:complexType name="ListOfPackageIdentifier">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageIdentifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPackageIdentifier" type="ListOfPackageIdentifier"/>
+ <xsd:complexType name="PackageIdentifier">
+ <xsd:sequence>
+ <xsd:element name="PackageIdentifierCoded" type="PackageIdentifierCode"/>
+ <xsd:element minOccurs="0" name="PackageIdentifierCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PackageIdentifierValue" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageIdentifier" type="PackageIdentifier"/>
+ <xsd:simpleType name="PackageIdentifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="EAN8OrEAN13Barcoded"/>
+ <xsd:enumeration value="ITF14OrITF6Barcoded"/>
+ <xsd:enumeration value="UCCOrEAN128Barcoded"/>
+ <xsd:enumeration value="ADR"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="SpecialHandling">
+ <xsd:sequence>
+ <xsd:element name="SpecialHandlingCoded" type="SpecialHandlingCode"/>
+ <xsd:element minOccurs="0" name="SpecialHandlingCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SpecialHandlingNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SpecialHandling" type="SpecialHandling"/>
+ <xsd:simpleType name="SpecialHandlingCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="SpeedRestrictedTo15MilesPerHour"/>
+ <xsd:enumeration value="SpeedRestrictedTo25MilesPerHour"/>
+ <xsd:enumeration value="SpeedRestrictedTo35MilesPerHour"/>
+ <xsd:enumeration value="SpeedRestrictedTo45MilesPerHour"/>
+ <xsd:enumeration value="NoFacialHair"/>
+ <xsd:enumeration value="CarIsAirBrakeControlled"/>
+ <xsd:enumeration value="CustomerRequiredPackingList"/>
+ <xsd:enumeration value="CustomerRequiredPRONumber"/>
+ <xsd:enumeration value="CustomerRequiredAppointmentNumber"/>
+ <xsd:enumeration value="LoadOnTopOfResidue"/>
+ <xsd:enumeration value="DisposeOfResidue"/>
+ <xsd:enumeration value="Attachment-AutoKeys"/>
+ <xsd:enumeration value="AttachmentToMoveWithCar"/>
+ <xsd:enumeration value="AnnualVolume"/>
+ <xsd:enumeration value="Attachments-AdvanceOnlyWaybill"/>
+ <xsd:enumeration value="ClearinghouseBalance"/>
+ <xsd:enumeration value="BlowableLoad"/>
+ <xsd:enumeration value="IfBadOrderedNotifyShipper"/>
+ <xsd:enumeration value="BillShipperForWeighCharge"/>
+ <xsd:enumeration value="ContainerConsolidatorLoad"/>
+ <xsd:enumeration value="Attachment-CustomersDocument"/>
+ <xsd:enumeration value="ClearedForExport"/>
+ <xsd:enumeration value="ContainerFactoryLoad"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CustomsInspection"/>
+ <xsd:enumeration value="Attachment-CottonManifest"/>
+ <xsd:enumeration value="NoMarshallingRequiredForHazardousMaterials"/>
+ <xsd:enumeration value="CircusRampOnlyTOFCVan"/>
+ <xsd:enumeration value="BillConsigneeForWeighCharges"/>
+ <xsd:enumeration value="TopLoadOnly"/>
+ <xsd:enumeration value="CertificationThatThisShipmentIsForRecyclingAsDefinedInApplicableTariffsContainingSuchProvisions"/>
+ <xsd:enumeration value="Dangerous"/>
+ <xsd:enumeration value="Demurrage"/>
+ <xsd:enumeration value="Domestic"/>
+ <xsd:enumeration value="ShipperAuthorizationRequiredForDiversionOrConsignment"/>
+ <xsd:enumeration value="DropYard"/>
+ <xsd:enumeration value="DeliveryOnlyOnSurrenderOfWrittenOrder"/>
+ <xsd:enumeration value="DeadInTow"/>
+ <xsd:enumeration value="DoNotUncouple"/>
+ <xsd:enumeration value="Equipment"/>
+ <xsd:enumeration value="DestinationWeightsApply"/>
+ <xsd:enumeration value="ExcessiveDimensions"/>
+ <xsd:enumeration value="ElectronicEquipmentTransfer"/>
+ <xsd:enumeration value="EnvironmentalControlLimits"/>
+ <xsd:enumeration value="Expedite"/>
+ <xsd:enumeration value="ReturnEmptyViaReverseRoute"/>
+ <xsd:enumeration value="DamagesIncurredIfShipmentFailsToMeetVesselLoading"/>
+ <xsd:enumeration value="ExcessiveWeight"/>
+ <xsd:enumeration value="ExplosiveFlammableGas"/>
+ <xsd:enumeration value="FaceA-EndToHeadOfTrain"/>
+ <xsd:enumeration value="FaceB-EndToHeadOfTrain"/>
+ <xsd:enumeration value="MovingUnderForFurtheranceInstructionsAndMayBeDelivered"/>
+ <xsd:enumeration value="FullService"/>
+ <xsd:enumeration value="FlammableGas"/>
+ <xsd:enumeration value="Flammable"/>
+ <xsd:enumeration value="FlammablePoisonGas"/>
+ <xsd:enumeration value="Fragile-HandleWithCare"/>
+ <xsd:enumeration value="NontransitFlatShipment"/>
+ <xsd:enumeration value="GrainInspection"/>
+ <xsd:enumeration value="HeadEndCar"/>
+ <xsd:enumeration value="Household"/>
+ <xsd:enumeration value="EndorsedAsHazardousMaterial"/>
+ <xsd:enumeration value="HoldForOrders"/>
+ <xsd:enumeration value="HeatedPriorToLoading"/>
+ <xsd:enumeration value="HomeForRepair"/>
+ <xsd:enumeration value="Heat"/>
+ <xsd:enumeration value="HighValueLoad"/>
+ <xsd:enumeration value="HighWideLoad"/>
+ <xsd:enumeration value="In-Bond"/>
+ <xsd:enumeration value="Ice"/>
+ <xsd:enumeration value="ShipmentToBeInspectedAtDestinationAndDispositionInstructionsWillBeFurnished"/>
+ <xsd:enumeration value="InterofficeMove"/>
+ <xsd:enumeration value="ImportShipment"/>
+ <xsd:enumeration value="RailIncentiveRate"/>
+ <xsd:enumeration value="SurveillanceService"/>
+ <xsd:enumeration value="JunctionSettlementAccount"/>
+ <xsd:enumeration value="LandBridgeImportOrExport"/>
+ <xsd:enumeration value="CarTripLeasedToConsignee"/>
+ <xsd:enumeration value="LoadingDevices"/>
+ <xsd:enumeration value="LoadedToFullVisibleCapacity"/>
+ <xsd:enumeration value="LessThanContainerConsolidatorLoad"/>
+ <xsd:enumeration value="ProtectLowestThroughRate"/>
+ <xsd:enumeration value="LessThanContainerFactoryLoad"/>
+ <xsd:enumeration value="LocalServiceOnly"/>
+ <xsd:enumeration value="LessThanFullCarload"/>
+ <xsd:enumeration value="PersonInChargeOfCar"/>
+ <xsd:enumeration value="ClearedForBorderCrossing"/>
+ <xsd:enumeration value="MultiplePickup"/>
+ <xsd:enumeration value="MechanicalRefrigeration"/>
+ <xsd:enumeration value="NotifyConsigneeBeforeDelivery"/>
+ <xsd:enumeration value="DoNotDivert"/>
+ <xsd:enumeration value="NoSpecialEntrainmentRequired"/>
+ <xsd:enumeration value="DoNotHump"/>
+ <xsd:enumeration value="NewEquipmentFirstTransborderMovement"/>
+ <xsd:enumeration value="DoNotPool"/>
+ <xsd:enumeration value="NotifyShipperBeforeReconsignment"/>
+ <xsd:enumeration value="DoNotTransferContents"/>
+ <xsd:enumeration value="InCaseOfFireDoNotUseWater"/>
+ <xsd:enumeration value="NotForExport"/>
+ <xsd:enumeration value="CommodityLoadedLessThanOrEqualToTheCarOrdered"/>
+ <xsd:enumeration value="Overweight"/>
+ <xsd:enumeration value="PerishableInBoxCar"/>
+ <xsd:enumeration value="PrivatelyControlledPrivateEquipmentSubjectToDemurrage"/>
+ <xsd:enumeration value="PoisonousGas"/>
+ <xsd:enumeration value="IcedPriorToLoading"/>
+ <xsd:enumeration value="ProductProtectionService"/>
+ <xsd:enumeration value="Attachment-PrepaidWaybill"/>
+ <xsd:enumeration value="ReturnAuthorization"/>
+ <xsd:enumeration value="RenderBillForCharges"/>
+ <xsd:enumeration value="RailroadControlledPrivateEquipmentSubjectToDemurrage"/>
+ <xsd:enumeration value="RadioactiveMaterial"/>
+ <xsd:enumeration value="RushOrder"/>
+ <xsd:enumeration value="RearRider"/>
+ <xsd:enumeration value="InspectHourlyIfCarStopped"/>
+ <xsd:enumeration value="RecordForTransit"/>
+ <xsd:enumeration value="ShipperLoadOrCarrierCount"/>
+ <xsd:enumeration value="ShoveToRestAndCover"/>
+ <xsd:enumeration value="SubjectToSpecialDetentionRulesOrCharges"/>
+ <xsd:enumeration value="Attachment-ShippersExportDocument"/>
+ <xsd:enumeration value="ShiftableLoad"/>
+ <xsd:enumeration value="ShipToCrossDockOrPool"/>
+ <xsd:enumeration value="RequiresShelfCouplers"/>
+ <xsd:enumeration value="Attachment-ShippersManifest"/>
+ <xsd:enumeration value="Attachment-ShippersPackingInstructions"/>
+ <xsd:enumeration value="SpeedRestricted"/>
+ <xsd:enumeration value="StackTrain"/>
+ <xsd:enumeration value="StretchWrap"/>
+ <xsd:enumeration value="CarsTemporarilyArticulated"/>
+ <xsd:enumeration value="TrailerConsolidatorLoad"/>
+ <xsd:enumeration value="TrailerFactoryLoad"/>
+ <xsd:enumeration value="TurnCar"/>
+ <xsd:enumeration value="TransitShipment"/>
+ <xsd:enumeration value="TeamTrackDelivery"/>
+ <xsd:enumeration value="TimeVolumeRatesOnly"/>
+ <xsd:enumeration value="UnloadAtBumperCircusRamp"/>
+ <xsd:enumeration value="Unitized"/>
+ <xsd:enumeration value="UnloadFromLeftSideOfCar"/>
+ <xsd:enumeration value="UnloadAsPlacarded"/>
+ <xsd:enumeration value="UnprotectedPerishable"/>
+ <xsd:enumeration value="UnloadFromRightSideOfCar"/>
+ <xsd:enumeration value="ShipperCertifiesGrossWeightUnder240000Pounds"/>
+ <xsd:enumeration value="VerificationWeigh"/>
+ <xsd:enumeration value="VentilationInstructions"/>
+ <xsd:enumeration value="Wide-BodyPickupTruckAppliesToFinishedVehicleLoading"/>
+ <xsd:enumeration value="WaivedInspection-SetDirect"/>
+ <xsd:enumeration value="WeighEmpty"/>
+ <xsd:enumeration value="Attachments-HighWideNotice"/>
+ <xsd:enumeration value="WaiveInspection"/>
+ <xsd:enumeration value="ManifestMustAccompanyWaybill"/>
+ <xsd:enumeration value="WeighToCheckForOverload"/>
+ <xsd:enumeration value="WasteWater"/>
+ <xsd:enumeration value="Export"/>
+ <xsd:enumeration value="CrossTown"/>
+ <xsd:enumeration value="AdvancedFee"/>
+ <xsd:enumeration value="CertificateOfOrigin"/>
+ <xsd:enumeration value="FuelSurchargeAuthorized"/>
+ <xsd:enumeration value="Offshore-AlaskaOrHawaiiService"/>
+ <xsd:enumeration value="OversizedPremium"/>
+ <xsd:enumeration value="PreparationOfAirWaybill-Origin"/>
+ <xsd:enumeration value="PreparationOfCanadianCustomsInvoice"/>
+ <xsd:enumeration value="PreparationOfExportEntry"/>
+ <xsd:enumeration value="PreparationOfInsuranceCertificate"/>
+ <xsd:enumeration value="PreparationOfU.S.ExportDocumentation"/>
+ <xsd:enumeration value="SaturdayDelivery"/>
+ <xsd:enumeration value="SaturdayPick-Up"/>
+ <xsd:enumeration value="SecuritySignatureService"/>
+ <xsd:enumeration value="WrittenProofOfDelivery"/>
+ <xsd:enumeration value="Aggregate1000"/>
+ <xsd:enumeration value="Aggregate3000"/>
+ <xsd:enumeration value="Aggregate5000"/>
+ <xsd:enumeration value="AttendantsAccompanying"/>
+ <xsd:enumeration value="AdvanceLoading"/>
+ <xsd:enumeration value="AirCraftFurnishedAndNotUsed"/>
+ <xsd:enumeration value="AggregateTenderDiscount"/>
+ <xsd:enumeration value="ArmedGuardService"/>
+ <xsd:enumeration value="AdditionalInjectionOrBlendingService"/>
+ <xsd:enumeration value="PortChanges"/>
+ <xsd:enumeration value="UseOfAlternateTerminal"/>
+ <xsd:enumeration value="A.M.DeliveryRequirement"/>
+ <xsd:enumeration value="AnchoringAndUnanchoring"/>
+ <xsd:enumeration value="AdditionalCopyOfShippingPapersForProofOfDelivery"/>
+ <xsd:enumeration value="ApplianceServicing"/>
+ <xsd:enumeration value="AirConditioningDisconnectAndConnect"/>
+ <xsd:enumeration value="RailArmedGuardService"/>
+ <xsd:enumeration value="AirRideTractorService"/>
+ <xsd:enumeration value="AirRideTruckService"/>
+ <xsd:enumeration value="AssemblyServiceRequested"/>
+ <xsd:enumeration value="AuxiliaryService"/>
+ <xsd:enumeration value="BypassConsolidationPoint"/>
+ <xsd:enumeration value="BulkyArticle"/>
+ <xsd:enumeration value="BlockingAndBracing"/>
+ <xsd:enumeration value="BlindShipment"/>
+ <xsd:enumeration value="BolsterLoadDoNotSwitch"/>
+ <xsd:enumeration value="BoxingService-DryBulk"/>
+ <xsd:enumeration value="BunkerSurchargeAuthorized"/>
+ <xsd:enumeration value="BunkerAdjustment-20FootContainer"/>
+ <xsd:enumeration value="BunkerAdjustment-40FootContainer"/>
+ <xsd:enumeration value="BunkerAdjustment"/>
+ <xsd:enumeration value="CurrencyAdjustment-20FootContainer"/>
+ <xsd:enumeration value="CurrencyAdjustment-40FootContainer"/>
+ <xsd:enumeration value="RoeeCarOrPick-UpTruck"/>
+ <xsd:enumeration value="ConvertCommercialBillOfLadingBolToGovernmentBol"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="CarrierCaboose"/>
+ <xsd:enumeration value="CorrosionAdditiveService"/>
+ <xsd:enumeration value="CustomsFees-ContainerLevel"/>
+ <xsd:enumeration value="CustomsFees-LiftLevel"/>
+ <xsd:enumeration value="CarrierGuardCarService"/>
+ <xsd:enumeration value="ReturnCarrierGuardCarService"/>
+ <xsd:enumeration value="CargoTaxes"/>
+ <xsd:enumeration value="ChainAndBinders"/>
+ <xsd:enumeration value="CommercialInvoicePreparation"/>
+ <xsd:enumeration value="ConstantSurveillance"/>
+ <xsd:enumeration value="Cleaning"/>
+ <xsd:enumeration value="ClassRatesApplied"/>
+ <xsd:enumeration value="Comb.RatesOverDetroit"/>
+ <xsd:enumeration value="ConsolidationAndLineHaul"/>
+ <xsd:enumeration value="Consolidation"/>
+ <xsd:enumeration value="ContractRatesApply"/>
+ <xsd:enumeration value="CertificationThatTheNewsprintWindingCoresBeingReturnedEmptyWereReceivedFilledByRailFreightService"/>
+ <xsd:enumeration value="ConsigneeUnload"/>
+ <xsd:enumeration value="CourierOvernight"/>
+ <xsd:enumeration value="CopilotService"/>
+ <xsd:enumeration value="CustomsPapersMailed"/>
+ <xsd:enumeration value="ContainerLease"/>
+ <xsd:enumeration value="CourierSameDay"/>
+ <xsd:enumeration value="GovernmentCaboose"/>
+ <xsd:enumeration value="ControlledAtmosphere"/>
+ <xsd:enumeration value="ContainerMounting"/>
+ <xsd:enumeration value="CircuitousRouting"/>
+ <xsd:enumeration value="CurrencyAdjustment-BreakBulk"/>
+ <xsd:enumeration value="DoubleWideSeparateAndReassemble"/>
+ <xsd:enumeration value="DeliveryOfFuelFromBargeToPipeline"/>
+ <xsd:enumeration value="DodConstantSurveillanceService"/>
+ <xsd:enumeration value="DualDriverWithNationalAgencyCheck"/>
+ <xsd:enumeration value="DualDriverProtectiveService"/>
+ <xsd:enumeration value="DirectDelivery"/>
+ <xsd:enumeration value="DrayageAtPortOfDebarkationRateZone"/>
+ <xsd:enumeration value="DeliveryService"/>
+ <xsd:enumeration value="DetentionOfConveyingEquipmentAndThePowerUnit"/>
+ <xsd:enumeration value="DetentionOfConveyingEquipmentExcludingThePowerUnit"/>
+ <xsd:enumeration value="DrayageAtPortOfEmbarkationRateZone"/>
+ <xsd:enumeration value="KeepFromFreezingPercentDifferential"/>
+ <xsd:enumeration value="410DromedaryWithMechanicalRestrainingDevices"/>
+ <xsd:enumeration value="410Dromedary"/>
+ <xsd:enumeration value="DistributionServiceRequested"/>
+ <xsd:enumeration value="DeliveryOfFuelFromRailTankCarToPipeline"/>
+ <xsd:enumeration value="NotifyShipperImmediatelyIfShipmentIsDelayedEnRoute"/>
+ <xsd:enumeration value="DoNotCoupleToOtherDiaphragmedCars"/>
+ <xsd:enumeration value="DoNotFreeze"/>
+ <xsd:enumeration value="DoNotCoupleToTankCars"/>
+ <xsd:enumeration value="Documentation-Special"/>
+ <xsd:enumeration value="ContainerDiversion"/>
+ <xsd:enumeration value="DeliveryOfFuelFromPipelineToBarge"/>
+ <xsd:enumeration value="DrayageAtPortOfDebarkation"/>
+ <xsd:enumeration value="DrayageAtPortOfEmbarkation"/>
+ <xsd:enumeration value="DeliveryOfFuelFromPipelineToRailTankCar"/>
+ <xsd:enumeration value="DeliveryOfFuelFromPipelineToTankTruckOrTrailer"/>
+ <xsd:enumeration value="DetentionWithPowerUnits30MinutePeriods"/>
+ <xsd:enumeration value="Drop-OffDelivery"/>
+ <xsd:enumeration value="DrummingService"/>
+ <xsd:enumeration value="DoNotCoupleToDoubleShelfCouples"/>
+ <xsd:enumeration value="DromedaryWithMechanicalRestrainingDevices"/>
+ <xsd:enumeration value="DromedaryServiceRequested"/>
+ <xsd:enumeration value="DoorSideVanning"/>
+ <xsd:enumeration value="LaborAssociatedWithDetentionOfConveyingEquipment"/>
+ <xsd:enumeration value="DeliveryOfFuelFromTankTruckOrTrailerToPipeline"/>
+ <xsd:enumeration value="DetentionVehicle"/>
+ <xsd:enumeration value="DetentionWithPowerUnits60MinutePeriods"/>
+ <xsd:enumeration value="ExtraAxles"/>
+ <xsd:enumeration value="EscortOrCourierService"/>
+ <xsd:enumeration value="EmptyRailcarOrderedButNotUsed"/>
+ <xsd:enumeration value="EquipmentHoseAtDestination"/>
+ <xsd:enumeration value="EquipmentHoseAtOrigin"/>
+ <xsd:enumeration value="ExclusiveUse"/>
+ <xsd:enumeration value="ExtraLights"/>
+ <xsd:enumeration value="EmergencyService"/>
+ <xsd:enumeration value="EmptyMovement"/>
+ <xsd:enumeration value="Endorsement"/>
+ <xsd:enumeration value="EmptyReturn"/>
+ <xsd:enumeration value="SatisfactoryServiceStandards"/>
+ <xsd:enumeration value="ExcessiveValuationAuthorized"/>
+ <xsd:enumeration value="ExclusiveUseOfVehicle"/>
+ <xsd:enumeration value="ExtraDriver"/>
+ <xsd:enumeration value="ExtraLengthSurcharge"/>
+ <xsd:enumeration value="ExportPreparation"/>
+ <xsd:enumeration value="ExpeditedRatesApplied"/>
+ <xsd:enumeration value="ExpeditedService"/>
+ <xsd:enumeration value="ExtraLabor"/>
+ <xsd:enumeration value="ExclusiveUseOfVehicleDamaged"/>
+ <xsd:enumeration value="ExpandRemoveAndInstall"/>
+ <xsd:enumeration value="RoadwayEasyRatesApplied"/>
+ <xsd:enumeration value="BargeFreightAllKindsService"/>
+ <xsd:enumeration value="Firearms"/>
+ <xsd:enumeration value="FurnishingChassis"/>
+ <xsd:enumeration value="FuelFiltersFurnishedByCarrier"/>
+ <xsd:enumeration value="FuelFiltersFurnishedByShipper"/>
+ <xsd:enumeration value="FlatrackSurcharge"/>
+ <xsd:enumeration value="ForProcessingInTransit"/>
+ <xsd:enumeration value="AcceptedByCarrierAtOwnerSRiskOfFreezing"/>
+ <xsd:enumeration value="ForStorageInTransit"/>
+ <xsd:enumeration value="FiltrationService"/>
+ <xsd:enumeration value="GarmentSurcharge"/>
+ <xsd:enumeration value="Government-OwnedContainers"/>
+ <xsd:enumeration value="GovernmentGuardCar"/>
+ <xsd:enumeration value="GreaterSecurityService"/>
+ <xsd:enumeration value="HoldAtLocation"/>
+ <xsd:enumeration value="Handling"/>
+ <xsd:enumeration value="HandBrakesAtEachEndMustBeReleased"/>
+ <xsd:enumeration value="ShipmentHoldoverForHolidays"/>
+ <xsd:enumeration value="ShipmentHoldoverForWeekends"/>
+ <xsd:enumeration value="HeatInTransit"/>
+ <xsd:enumeration value="Heat-Special"/>
+ <xsd:enumeration value="HeatWithSteam"/>
+ <xsd:enumeration value="AccessibleHazardousMaterial"/>
+ <xsd:enumeration value="InaccessibleHazardousMaterial"/>
+ <xsd:enumeration value="SundayOrHolidayPickupOrDelivery"/>
+ <xsd:enumeration value="24HourAvailability"/>
+ <xsd:enumeration value="Hose"/>
+ <xsd:enumeration value="SpecialHose"/>
+ <xsd:enumeration value="HighCubeTrailerRates"/>
+ <xsd:enumeration value="HeaterOrRefrigeration"/>
+ <xsd:enumeration value="HitchInstallation"/>
+ <xsd:enumeration value="HazardousMaterialsSurcharge"/>
+ <xsd:enumeration value="HazardousCargoOnDeck"/>
+ <xsd:enumeration value="IdlerCar"/>
+ <xsd:enumeration value="InsideDelivery"/>
+ <xsd:enumeration value="IcingInhibitorService"/>
+ <xsd:enumeration value="Impactographs"/>
+ <xsd:enumeration value="IntermodalShipmentService"/>
+ <xsd:enumeration value="Intra-PlantMove"/>
+ <xsd:enumeration value="InsidePickup"/>
+ <xsd:enumeration value="InterlineTransferService"/>
+ <xsd:enumeration value="Just-In-TimeJit"/>
+ <xsd:enumeration value="JointLineException"/>
+ <xsd:enumeration value="CertificationThatTheContainersBeingReturnedEmptyWereReceivedFilledByRailFreightService"/>
+ <xsd:enumeration value="KeepMaterialDry"/>
+ <xsd:enumeration value="LaborDisturbance"/>
+ <xsd:enumeration value="Layover"/>
+ <xsd:enumeration value="ApplyAUCCOrEANSerialShippingContainerLabelToTheShippingContainers"/>
+ <xsd:enumeration value="LightBarService"/>
+ <xsd:enumeration value="LowBoyTrailerOrFlatBed"/>
+ <xsd:enumeration value="LandCurrencyAdjustmentFactor-20FootContainer"/>
+ <xsd:enumeration value="LandCurrencyAdjustment-40FootContainer"/>
+ <xsd:enumeration value="PercentDifferential-LessThanContainer"/>
+ <xsd:enumeration value="LessThanContainer"/>
+ <xsd:enumeration value="LinehaulFromPortOfDebarkation"/>
+ <xsd:enumeration value="LinehaulService"/>
+ <xsd:enumeration value="LiabilityOfCarrier"/>
+ <xsd:enumeration value="LinerTermsAtPortOfDebarkation"/>
+ <xsd:enumeration value="LinerTermsAtPortOfEmbarkation"/>
+ <xsd:enumeration value="LinehaulPercentDifferential"/>
+ <xsd:enumeration value="LinehaulToPortOfEmbarkation"/>
+ <xsd:enumeration value="LessThanTruckload"/>
+ <xsd:enumeration value="LayoverService"/>
+ <xsd:enumeration value="ModifiedAtmosphere"/>
+ <xsd:enumeration value="EscortServiceWithOvernightSubsistence"/>
+ <xsd:enumeration value="Escort"/>
+ <xsd:enumeration value="EscortServicesTelephone"/>
+ <xsd:enumeration value="Insulated"/>
+ <xsd:enumeration value="MotorSurveillanceService"/>
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Refrigerated"/>
+ <xsd:enumeration value="MilitaryTrafficExpeditingService"/>
+ <xsd:enumeration value="SpecialMotorSurveillance"/>
+ <xsd:enumeration value="DoNotHumpOrHumpInto"/>
+ <xsd:enumeration value="DoNotUseHelperLocomotiveToPush"/>
+ <xsd:enumeration value="NoPlacardsRequired"/>
+ <xsd:enumeration value="NoseSideVanning"/>
+ <xsd:enumeration value="StowAwayFromHeat"/>
+ <xsd:enumeration value="BlockStowage"/>
+ <xsd:enumeration value="CargoAboard"/>
+ <xsd:enumeration value="CarrierLoadAndConsigneeUnload"/>
+ <xsd:enumeration value="OverHeightContainer"/>
+ <xsd:enumeration value="CompletingShipment"/>
+ <xsd:enumeration value="DeliveryVerificationNotRequired"/>
+ <xsd:enumeration value="StowWithDoorsFacingInward"/>
+ <xsd:enumeration value="ExemptCommodity"/>
+ <xsd:enumeration value="InFrontOfHouseStowage"/>
+ <xsd:enumeration value="Fumigation"/>
+ <xsd:enumeration value="Harmless"/>
+ <xsd:enumeration value="OilFieldService"/>
+ <xsd:enumeration value="UseNoHooks"/>
+ <xsd:enumeration value="NotRestrictedCargo"/>
+ <xsd:enumeration value="CargoOnBoardCertificationRequired"/>
+ <xsd:enumeration value="OnDeckStowage"/>
+ <xsd:enumeration value="CarrierLoadAndCarrierUnload"/>
+ <xsd:enumeration value="Perishable"/>
+ <xsd:enumeration value="PartialShipment"/>
+ <xsd:enumeration value="StowBelowDeck"/>
+ <xsd:enumeration value="StowBetweenDecks"/>
+ <xsd:enumeration value="TemperatureControl"/>
+ <xsd:enumeration value="TimeOfDeliveryAndSignatureRequired"/>
+ <xsd:enumeration value="OnTopIn-HatchStowage"/>
+ <xsd:enumeration value="OnTopOn-DeckStowage"/>
+ <xsd:enumeration value="TotalShipment"/>
+ <xsd:enumeration value="UnderContainerOn-DeckStowage"/>
+ <xsd:enumeration value="BelowWaterLineStowage"/>
+ <xsd:enumeration value="Overflow"/>
+ <xsd:enumeration value="OverWidthContainer"/>
+ <xsd:enumeration value="OneWayRatesApplied"/>
+ <xsd:enumeration value="PumpingEquipment"/>
+ <xsd:enumeration value="PickupOfShipmentsOnSaturdaySundayAndOrHolidaysRequiringAbsoluteNextDayDelivery"/>
+ <xsd:enumeration value="PickupAndDeliveryFromStorageInTransit"/>
+ <xsd:enumeration value="PickupAndDeliveryBeyondServiceArea"/>
+ <xsd:enumeration value="SpecialPermits"/>
+ <xsd:enumeration value="ProtectFromHeat"/>
+ <xsd:enumeration value="PerHourRatesApplied"/>
+ <xsd:enumeration value="PierTime"/>
+ <xsd:enumeration value="PalletsOrSkidsOrPlatforms"/>
+ <xsd:enumeration value="P.M.DeliveryRequirement"/>
+ <xsd:enumeration value="PerMileRatesApply"/>
+ <xsd:enumeration value="PickupOfShipmentsRequiringSameDayDeliveryService"/>
+ <xsd:enumeration value="PickupOfShipmentsRequiringSameDayDeliveryServiceAndOrDeliveryAtASpecifiedTime"/>
+ <xsd:enumeration value="PianoOrOrganCarry"/>
+ <xsd:enumeration value="PositioningAtOrigin"/>
+ <xsd:enumeration value="PickupAndDeliveryServiceForPerishables"/>
+ <xsd:enumeration value="Prelodge"/>
+ <xsd:enumeration value="StuffingCharge"/>
+ <xsd:enumeration value="ProtectiveServiceSecurityWithArmedGuards"/>
+ <xsd:enumeration value="ProtectiveSecurityService"/>
+ <xsd:enumeration value="ProtectiveTarpForSecurityPurposes"/>
+ <xsd:enumeration value="Pickup"/>
+ <xsd:enumeration value="PickupAndDelivery"/>
+ <xsd:enumeration value="PackAndUnpack"/>
+ <xsd:enumeration value="PUPTrailerRatesApply"/>
+ <xsd:enumeration value="BondedPrivatelyOwnedVehicle"/>
+ <xsd:enumeration value="DetentionOfPrivatelyOwnedVehicle"/>
+ <xsd:enumeration value="InoperablePrivatelyOwnedVehicle"/>
+ <xsd:enumeration value="LoadingOrUnloadingOfPrivatelyOwnedVehicle"/>
+ <xsd:enumeration value="PrivateOwnedVehicleProcessing"/>
+ <xsd:enumeration value="Stop-OffsForPrivatelyOwnedVehicleShipment"/>
+ <xsd:enumeration value="PrivatelyOwnedVehicleInTruckawayService"/>
+ <xsd:enumeration value="PriorityService"/>
+ <xsd:enumeration value="Reconsignment"/>
+ <xsd:enumeration value="Redelivery"/>
+ <xsd:enumeration value="RailheadHandling"/>
+ <xsd:enumeration value="RoadrailerService"/>
+ <xsd:enumeration value="Respotting"/>
+ <xsd:enumeration value="ResidentialDelivery"/>
+ <xsd:enumeration value="ReeferMaintenance"/>
+ <xsd:enumeration value="ReleasedValueChargeInExcessOfCarrierMaximumLiability"/>
+ <xsd:enumeration value="RelocationOfVehicle"/>
+ <xsd:enumeration value="ReturnOfEmptyContainer"/>
+ <xsd:enumeration value="ReturnMovementOfPallet"/>
+ <xsd:enumeration value="RailSurveillance"/>
+ <xsd:enumeration value="ReeferCargoPercentDifferential"/>
+ <xsd:enumeration value="RoundTripService"/>
+ <xsd:enumeration value="Reshipment"/>
+ <xsd:enumeration value="RestrictedSpeeds"/>
+ <xsd:enumeration value="Reservations"/>
+ <xsd:enumeration value="ReweightRequested"/>
+ <xsd:enumeration value="ShipmentHoldoverOnWeekends"/>
+ <xsd:enumeration value="SaturdayPickupOrDelivery"/>
+ <xsd:enumeration value="SpecialContainers"/>
+ <xsd:enumeration value="ShipperLoadAndConsigneeUnload"/>
+ <xsd:enumeration value="SplitDelivery"/>
+ <xsd:enumeration value="SpecialDromedaryService"/>
+ <xsd:enumeration value="SpecialEquipmentCharge"/>
+ <xsd:enumeration value="ShipperExportDeclarationRequired"/>
+ <xsd:enumeration value="StairsElevatorExcessCarry"/>
+ <xsd:enumeration value="ServiceChargeApplies"/>
+ <xsd:enumeration value="SecurityEscortVehicleService"/>
+ <xsd:enumeration value="SingleFactorOriginationOrDestination"/>
+ <xsd:enumeration value="SingleFactorOriginationOrPortOfDebarkation"/>
+ <xsd:enumeration value="SingleFactorPortOfEmbarkationOrDestination"/>
+ <xsd:enumeration value="SpecialTrainMovement"/>
+ <xsd:enumeration value="SingleShipment"/>
+ <xsd:enumeration value="ShipmentHoldoverOnHolidays"/>
+ <xsd:enumeration value="ShipperLoad"/>
+ <xsd:enumeration value="ShipmentHoldoverOnWeekdays"/>
+ <xsd:enumeration value="SkirtingAndUnskirting"/>
+ <xsd:enumeration value="ShipperLoadAndCount"/>
+ <xsd:enumeration value="SmallPackage"/>
+ <xsd:enumeration value="TransmitAShipNoticeOrManifestTransactionSet"/>
+ <xsd:enumeration value="SatelliteSurveillanceService"/>
+ <xsd:enumeration value="ShipmentFromNon-TempStorage"/>
+ <xsd:enumeration value="Stop-Off"/>
+ <xsd:enumeration value="ShipperLoadAndCarrierUnload"/>
+ <xsd:enumeration value="SpecialPermit"/>
+ <xsd:enumeration value="SpreaderService"/>
+ <xsd:enumeration value="SpotForStorage-NoShipment"/>
+ <xsd:enumeration value="SplitPickup"/>
+ <xsd:enumeration value="Storage"/>
+ <xsd:enumeration value="SurveyingRoutes"/>
+ <xsd:enumeration value="StrippingSortingAndConsolidation"/>
+ <xsd:enumeration value="SubstituteServiceNotToBeUsed"/>
+ <xsd:enumeration value="PoleLashingEquipmentPleSurcharge"/>
+ <xsd:enumeration value="ConductivityOrAnti-StaticAdditive"/>
+ <xsd:enumeration value="Stop-OffAtDestination"/>
+ <xsd:enumeration value="Stowage"/>
+ <xsd:enumeration value="Stop-OffAtOrigination"/>
+ <xsd:enumeration value="SignatureAndTallyRecord"/>
+ <xsd:enumeration value="SpotForUnloadingFromAEnd"/>
+ <xsd:enumeration value="SpotForUnloadingFromBBrakeEnd"/>
+ <xsd:enumeration value="SupervisorRequested"/>
+ <xsd:enumeration value="StorageOfVehicles"/>
+ <xsd:enumeration value="Truckload-DoubleOperator-CommonCarrier"/>
+ <xsd:enumeration value="Truckload-DoubleOperator-PaddedVan"/>
+ <xsd:enumeration value="TerminalHandlingCharges"/>
+ <xsd:enumeration value="TenderedAsTruckloadTruckloadServiceRequested"/>
+ <xsd:enumeration value="Multi-TankSurveillanceService"/>
+ <xsd:enumeration value="TenderingOfMultipleVehicles"/>
+ <xsd:enumeration value="TrailerOnFlatCar"/>
+ <xsd:enumeration value="ThirdPartyService"/>
+ <xsd:enumeration value="TractorOnly"/>
+ <xsd:enumeration value="TruckRatesApplicable"/>
+ <xsd:enumeration value="TrailerPreparation-Special"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TransferProduct"/>
+ <xsd:enumeration value="TireRepairAndReplace"/>
+ <xsd:enumeration value="TradeShow"/>
+ <xsd:enumeration value="TractorAndTrailer"/>
+ <xsd:enumeration value="Truckload-SingleOperator-CommonCarrier"/>
+ <xsd:enumeration value="Truckload-SingleOperator-PaddedVan"/>
+ <xsd:enumeration value="TankSurveillanceService"/>
+ <xsd:enumeration value="UnderCarriageFurnishedByCarrier"/>
+ <xsd:enumeration value="Unpacking"/>
+ <xsd:enumeration value="UnloadingOrReloading"/>
+ <xsd:enumeration value="UtilitiesDisconnectAndConnect"/>
+ <xsd:enumeration value="VacuumService"/>
+ <xsd:enumeration value="RoeeVanTypeTruck"/>
+ <xsd:enumeration value="VanCleaning"/>
+ <xsd:enumeration value="VehiclesFurnishedButNotUsed"/>
+ <xsd:enumeration value="VehiclesInoperable"/>
+ <xsd:enumeration value="Stop-OffDeliveryOfPersonalVehicles"/>
+ <xsd:enumeration value="VehiclesInTruckaway"/>
+ <xsd:enumeration value="Wharfage-Breakbulk"/>
+ <xsd:enumeration value="Wharfage-Container"/>
+ <xsd:enumeration value="WaterfrontDelivery"/>
+ <xsd:enumeration value="Wharfage"/>
+ <xsd:enumeration value="WarRiskCrewBonus"/>
+ <xsd:enumeration value="WarRiskInsurance"/>
+ <xsd:enumeration value="WaitingTimeAuthorized"/>
+ <xsd:enumeration value="WeightVerification"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="AssociatedDocuments">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="ListOfDocumentLoose"/>
+ <xsd:element minOccurs="0" ref="ListOfDocumentAttached"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AssociatedDocuments" type="AssociatedDocuments"/>
+ <xsd:complexType name="ListOfDocumentLoose">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" name="DocumentLoose">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PackageDoc"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDocumentLoose" type="ListOfDocumentLoose"/>
+ <xsd:complexType name="PackageDoc">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="DocumentTitle" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="DocumentTypeCoded" type="DocumentTypeCode" use="required"/>
+ <xsd:attribute name="DocumentTypeCodedOther" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="PackageDoc" type="PackageDoc"/>
+ <xsd:simpleType name="DocumentTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CertificateOfAnalysis"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="CertificateOfQuality"/>
+ <xsd:enumeration value="TestReport"/>
+ <xsd:enumeration value="ProductPerformanceReport"/>
+ <xsd:enumeration value="ProductSpecificationReport"/>
+ <xsd:enumeration value="ProcessDataReport"/>
+ <xsd:enumeration value="FirstSampleTestReport"/>
+ <xsd:enumeration value="PriceSalesCatalogue"/>
+ <xsd:enumeration value="PartyInformation"/>
+ <xsd:enumeration value="FederalLabelApproval"/>
+ <xsd:enumeration value="MillCertificate"/>
+ <xsd:enumeration value="PostReceipt"/>
+ <xsd:enumeration value="WeightCertificate"/>
+ <xsd:enumeration value="WeightList"/>
+ <xsd:enumeration value="Certificate"/>
+ <xsd:enumeration value="CombinedCertificateOfValueAndOrigin"/>
+ <xsd:enumeration value="MovementCertificateATr1"/>
+ <xsd:enumeration value="CertificateOfQuantity"/>
+ <xsd:enumeration value="QualityDataMessage"/>
+ <xsd:enumeration value="Query"/>
+ <xsd:enumeration value="ResponseToQuery"/>
+ <xsd:enumeration value="StatusInformation"/>
+ <xsd:enumeration value="Restow"/>
+ <xsd:enumeration value="ContainerDischargeList"/>
+ <xsd:enumeration value="CorporateSuperannuationContributionsAdvice"/>
+ <xsd:enumeration value="IndustrySuperannuationContributionsAdvice"/>
+ <xsd:enumeration value="CorporateSuperannuationMemberMaintenanceMessage"/>
+ <xsd:enumeration value="IndustrySuperannuationMemberMaintenanceMessage"/>
+ <xsd:enumeration value="LifeInsurancePayrollDeductionsAdvice"/>
+ <xsd:enumeration value="UnderbondRequest"/>
+ <xsd:enumeration value="UnderbondApproval"/>
+ <xsd:enumeration value="CertificateOfSealingOfExportMeatLockers"/>
+ <xsd:enumeration value="CargoStatus"/>
+ <xsd:enumeration value="InventoryReport"/>
+ <xsd:enumeration value="IdentityCard"/>
+ <xsd:enumeration value="ResponseToATradeStatisticsMessage"/>
+ <xsd:enumeration value="VaccinationCertificate"/>
+ <xsd:enumeration value="Passport"/>
+ <xsd:enumeration value="DrivingLicenceNational"/>
+ <xsd:enumeration value="DrivingLicenceInternational"/>
+ <xsd:enumeration value="FreePass"/>
+ <xsd:enumeration value="SeasonTicket"/>
+ <xsd:enumeration value="TransportStatusReport"/>
+ <xsd:enumeration value="TransportStatusRequest"/>
+ <xsd:enumeration value="BankingStatus"/>
+ <xsd:enumeration value="Extra-CommunityTradeStatisticalDeclaration"/>
+ <xsd:enumeration value="WrittenInstructionsInConformanceWithAdrArticleNumber"/>
+ <xsd:enumeration value="DamageCertification"/>
+ <xsd:enumeration value="ValidatedPricedTender"/>
+ <xsd:enumeration value="PriceSalesCatalogueResponse"/>
+ <xsd:enumeration value="PriceNegotiationResult"/>
+ <xsd:enumeration value="SafetyAndHazardDataSheet"/>
+ <xsd:enumeration value="LegalStatementOfAnAccount"/>
+ <xsd:enumeration value="ListingStatementOfAnAccount"/>
+ <xsd:enumeration value="ClosingStatementOfAnAccount"/>
+ <xsd:enumeration value="TransportEquipmentOn-HireReport"/>
+ <xsd:enumeration value="TransportEquipmentOff-HireReport"/>
+ <xsd:enumeration value="Treatment-NilOutturn"/>
+ <xsd:enumeration value="Treatment-Time-UpUnderbond"/>
+ <xsd:enumeration value="Treatment-UnderbondBySea"/>
+ <xsd:enumeration value="Treatment-PersonalEffect"/>
+ <xsd:enumeration value="Treatment-Timber"/>
+ <xsd:enumeration value="PreliminaryCreditAssessment"/>
+ <xsd:enumeration value="CreditCover"/>
+ <xsd:enumeration value="CurrentAccount"/>
+ <xsd:enumeration value="CommercialDispute"/>
+ <xsd:enumeration value="Chargeback"/>
+ <xsd:enumeration value="Reassignment"/>
+ <xsd:enumeration value="CollateralAccount"/>
+ <xsd:enumeration value="RequestForPayment"/>
+ <xsd:enumeration value="UnshipPermit"/>
+ <xsd:enumeration value="StatisticalDefinitions"/>
+ <xsd:enumeration value="StatisticalData"/>
+ <xsd:enumeration value="RequestForStatisticalData"/>
+ <xsd:enumeration value="Call-OffDelivery"/>
+ <xsd:enumeration value="ConsignmentStatusReport"/>
+ <xsd:enumeration value="InventoryMovementAdvice"/>
+ <xsd:enumeration value="InventoryStatusAdvice"/>
+ <xsd:enumeration value="DebitNoteRelatedToGoodsOrServices"/>
+ <xsd:enumeration value="CreditNoteRelatedToGoodsOrServices"/>
+ <xsd:enumeration value="MeteredServicesInvoice"/>
+ <xsd:enumeration value="CreditNoteRelatedToFinancialAdjustments"/>
+ <xsd:enumeration value="DebitNoteRelatedToFinancialAdjustments"/>
+ <xsd:enumeration value="CustomsManifest"/>
+ <xsd:enumeration value="VesselUnpackReport"/>
+ <xsd:enumeration value="GeneralCargoSummaryManifestReport"/>
+ <xsd:enumeration value="ConsignmentUnpackReport"/>
+ <xsd:enumeration value="MeatAndMeatBy-ProductsSanitaryCertificate"/>
+ <xsd:enumeration value="MeatFoodProductsSanitaryCertificate"/>
+ <xsd:enumeration value="PoultrySanitaryCertificate"/>
+ <xsd:enumeration value="HorsemeatSanitaryCertificate"/>
+ <xsd:enumeration value="CasingSanitaryCertificate"/>
+ <xsd:enumeration value="PharmaceuticalSanitaryCertificate"/>
+ <xsd:enumeration value="InedibleSanitaryCertificate"/>
+ <xsd:enumeration value="ImpendingArrival"/>
+ <xsd:enumeration value="MeansOfTransportAdvice"/>
+ <xsd:enumeration value="ArrivalInformation"/>
+ <xsd:enumeration value="CargoReleaseNotification"/>
+ <xsd:enumeration value="ExciseCertificate"/>
+ <xsd:enumeration value="RegistrationDocument"/>
+ <xsd:enumeration value="TaxNotification"/>
+ <xsd:enumeration value="TransportEquipmentDirectInterchangeReport"/>
+ <xsd:enumeration value="TransportEquipmentImpendingArrivalAdvice"/>
+ <xsd:enumeration value="PurchaseOrder"/>
+ <xsd:enumeration value="TransportEquipmentDamageReport"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWorkEstimateAdvice"/>
+ <xsd:enumeration value="TransportEquipmentEmptyReleaseInstruction"/>
+ <xsd:enumeration value="TransportMovementGateInReport"/>
+ <xsd:enumeration value="ManufacturingInstructions"/>
+ <xsd:enumeration value="TransportMovementGateOutReport"/>
+ <xsd:enumeration value="TransportEquipmentUnpackingInstruction"/>
+ <xsd:enumeration value="TransportEquipmentUnpackingReport"/>
+ <xsd:enumeration value="TransportEquipmentPick-UpAvailabilityRequest"/>
+ <xsd:enumeration value="TransportEquipmentPick-UpAvailabilityConfirmation"/>
+ <xsd:enumeration value="TransportEquipmentPick-UpReport"/>
+ <xsd:enumeration value="TransportEquipmentShiftReport"/>
+ <xsd:enumeration value="TransportDischargeInstruction"/>
+ <xsd:enumeration value="TransportDischargeReport"/>
+ <xsd:enumeration value="StoresRequisition"/>
+ <xsd:enumeration value="TransportLoadingInstruction"/>
+ <xsd:enumeration value="TransportLoadingReport"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWork"/>
+ <xsd:enumeration value="TransportDepartureReport"/>
+ <xsd:enumeration value="TransportEmptyEquipmentAdvice"/>
+ <xsd:enumeration value="TransportEquipmentAcceptanceOrder"/>
+ <xsd:enumeration value="TransportEquipmentSpecialServiceInstruction"/>
+ <xsd:enumeration value="TransportEquipmentStockReport"/>
+ <xsd:enumeration value="TransportCargoReleaseOrder"/>
+ <xsd:enumeration value="InvoicingDataSheet"/>
+ <xsd:enumeration value="TransportEquipmentPackingInstruction"/>
+ <xsd:enumeration value="CustomsClearanceNotice"/>
+ <xsd:enumeration value="CustomsDocumentsExpirationNotice"/>
+ <xsd:enumeration value="TransportEquipmentOn-HireRequest"/>
+ <xsd:enumeration value="TransportEquipmentOn-HireOrder"/>
+ <xsd:enumeration value="TransportEquipmentOff-HireRequest"/>
+ <xsd:enumeration value="TransportEquipmentSurveyOrder"/>
+ <xsd:enumeration value="TransportEquipmentSurveyOrderResponse"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReport"/>
+ <xsd:enumeration value="PackingInstructions"/>
+ <xsd:enumeration value="AdvisingItemsToBeBookedToAFinancialAccount"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairWorkEstimateOrder"/>
+ <xsd:enumeration value="TransportEquipmentMaintenanceAndRepairNotice"/>
+ <xsd:enumeration value="EmptyContainerDispositionOrder"/>
+ <xsd:enumeration value="CargoVesselDischargeOrder"/>
+ <xsd:enumeration value="CargoVesselLoadingOrder"/>
+ <xsd:enumeration value="MultidropOrder"/>
+ <xsd:enumeration value="BailmentContract"/>
+ <xsd:enumeration value="BasicAgreement"/>
+ <xsd:enumeration value="InternalTransportOrder"/>
+ <xsd:enumeration value="Grant"/>
+ <xsd:enumeration value="IndefiniteDeliveryIndefiniteQuantityContract"/>
+ <xsd:enumeration value="IndefiniteDeliveryDefiniteQuantityContract"/>
+ <xsd:enumeration value="RequirementsContract"/>
+ <xsd:enumeration value="TaskOrder"/>
+ <xsd:enumeration value="MakeOrBuyPlan"/>
+ <xsd:enumeration value="SubcontractorPlan"/>
+ <xsd:enumeration value="CostDataSummary"/>
+ <xsd:enumeration value="CertifiedCostAndPriceData"/>
+ <xsd:enumeration value="WageDetermination"/>
+ <xsd:enumeration value="ContractFundsStatusReportCfsr"/>
+ <xsd:enumeration value="CertifiedInspectionAndTestResults"/>
+ <xsd:enumeration value="MaterialInspectionAndReceivingReport"/>
+ <xsd:enumeration value="PurchasingSpecification"/>
+ <xsd:enumeration value="PaymentOrPerformanceBond"/>
+ <xsd:enumeration value="ContractSecurityClassificationSpecification"/>
+ <xsd:enumeration value="ManufacturingSpecification"/>
+ <xsd:enumeration value="BuyAmericaCertificateOfCompliance"/>
+ <xsd:enumeration value="ContainerOff-HireNotice"/>
+ <xsd:enumeration value="CargoAcceptanceOrder"/>
+ <xsd:enumeration value="Pick-UpNotice"/>
+ <xsd:enumeration value="AuthorisationToPlanAndSuggestOrders"/>
+ <xsd:enumeration value="AuthorisationToPlanAndShipOrders"/>
+ <xsd:enumeration value="Drawing"/>
+ <xsd:enumeration value="CostPerformanceReportCprFormat2"/>
+ <xsd:enumeration value="CostScheduleStatusReportCssr"/>
+ <xsd:enumeration value="CostPerformanceReportCprFormat1"/>
+ <xsd:enumeration value="CostPerformanceReportCprFormat3"/>
+ <xsd:enumeration value="CostPerformanceReportCprFormat4"/>
+ <xsd:enumeration value="CostPerformanceReportCprFormat5"/>
+ <xsd:enumeration value="ProgressiveDischargeReport"/>
+ <xsd:enumeration value="BalanceConfirmation"/>
+ <xsd:enumeration value="ContainerStrippingOrder"/>
+ <xsd:enumeration value="ContainerStuffingOrder"/>
+ <xsd:enumeration value="ConveyanceDeclarationArrival"/>
+ <xsd:enumeration value="ConveyanceDeclarationDeparture"/>
+ <xsd:enumeration value="ConveyanceDeclarationCombined"/>
+ <xsd:enumeration value="ProjectRecoveryPlan"/>
+ <xsd:enumeration value="ProjectProductionPlan"/>
+ <xsd:enumeration value="StatisticalAndOtherAdministrativeInternalDocuments"/>
+ <xsd:enumeration value="ProjectMasterSchedule"/>
+ <xsd:enumeration value="PricedAlternateTenderBillOfQuantity"/>
+ <xsd:enumeration value="EstimatedPricedBillOfQuantity"/>
+ <xsd:enumeration value="DraftBillOfQuantity"/>
+ <xsd:enumeration value="DocumentaryCreditCollectionInstruction"/>
+ <xsd:enumeration value="RequestForAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentInformation"/>
+ <xsd:enumeration value="AdviceOfAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="ResponseToAnAmendmentOfADocumentaryCredit"/>
+ <xsd:enumeration value="DocumentaryCreditIssuanceInformation"/>
+ <xsd:enumeration value="DirectPaymentValuationRequest"/>
+ <xsd:enumeration value="DirectPaymentValuation"/>
+ <xsd:enumeration value="ProvisionalPaymentValuation"/>
+ <xsd:enumeration value="PaymentValuation"/>
+ <xsd:enumeration value="QuantityValuation"/>
+ <xsd:enumeration value="QuantityValuationRequest"/>
+ <xsd:enumeration value="ContractBillOfQuantities-Boq"/>
+ <xsd:enumeration value="UnpricedBillOfQuantity"/>
+ <xsd:enumeration value="PricedTenderBoq"/>
+ <xsd:enumeration value="Enquiry"/>
+ <xsd:enumeration value="InterimApplicationForPayment"/>
+ <xsd:enumeration value="AgreementToPay"/>
+ <xsd:enumeration value="RequestForFinancialCancellation"/>
+ <xsd:enumeration value="Pre-AuthorisedDirectDebits"/>
+ <xsd:enumeration value="LetterOfIntent"/>
+ <xsd:enumeration value="ApprovedUnpricedBillOfQuantity"/>
+ <xsd:enumeration value="PaymentValuationForUnscheduledItems"/>
+ <xsd:enumeration value="FinalPaymentRequestBasedOnCompletionOfWork"/>
+ <xsd:enumeration value="PaymentRequestForCompletedUnits"/>
+ <xsd:enumeration value="Order"/>
+ <xsd:enumeration value="BlanketOrder"/>
+ <xsd:enumeration value="SpotOrder"/>
+ <xsd:enumeration value="LeaseOrder"/>
+ <xsd:enumeration value="RushOrder"/>
+ <xsd:enumeration value="RepairOrder"/>
+ <xsd:enumeration value="CallOffOrder"/>
+ <xsd:enumeration value="ConsignmentOrder"/>
+ <xsd:enumeration value="SampleOrder"/>
+ <xsd:enumeration value="SwapOrder"/>
+ <xsd:enumeration value="PurchaseOrderChangeRequest"/>
+ <xsd:enumeration value="PurchaseOrderResponse"/>
+ <xsd:enumeration value="HireOrder"/>
+ <xsd:enumeration value="SparePartsOrder"/>
+ <xsd:enumeration value="CampaignPriceSalesCatalogue"/>
+ <xsd:enumeration value="ContainerList"/>
+ <xsd:enumeration value="DeliveryForecast"/>
+ <xsd:enumeration value="CrossDockingServicesOrder"/>
+ <xsd:enumeration value="Non-Pre-AuthorisedDirectDebits"/>
+ <xsd:enumeration value="RejectedDirectDebits"/>
+ <xsd:enumeration value="DeliveryInstructions"/>
+ <xsd:enumeration value="DeliverySchedule"/>
+ <xsd:enumeration value="DeliveryJust-In-Time"/>
+ <xsd:enumeration value="Pre-AuthorisedDirectDebitRequests"/>
+ <xsd:enumeration value="Non-Pre-AuthorisedDirectDebitRequests"/>
+ <xsd:enumeration value="DeliveryRelease"/>
+ <xsd:enumeration value="SettlementOfALetterOfCredit"/>
+ <xsd:enumeration value="BankToBankFundsTransfer"/>
+ <xsd:enumeration value="CustomerPaymentOrders"/>
+ <xsd:enumeration value="LowValuePaymentOrders"/>
+ <xsd:enumeration value="CrewListDeclaration"/>
+ <xsd:enumeration value="Inquiry"/>
+ <xsd:enumeration value="ResponseToPreviousBankingStatusMessage"/>
+ <xsd:enumeration value="ProjectMasterPlan"/>
+ <xsd:enumeration value="ProjectPlan"/>
+ <xsd:enumeration value="ProjectSchedule"/>
+ <xsd:enumeration value="ProjectPlanningAvailableResources"/>
+ <xsd:enumeration value="ProjectPlanningCalendar"/>
+ <xsd:enumeration value="StandingOrder"/>
+ <xsd:enumeration value="CargoMovementEventLog"/>
+ <xsd:enumeration value="CargoAnalysisVoyageReport"/>
+ <xsd:enumeration value="SelfBilledCreditNote"/>
+ <xsd:enumeration value="ConsolidatedCreditNote-GoodsAndServices"/>
+ <xsd:enumeration value="InventoryAdjustmentStatusReport"/>
+ <xsd:enumeration value="TransportEquipmentMovementInstruction"/>
+ <xsd:enumeration value="TransportEquipmentMovementReport"/>
+ <xsd:enumeration value="TransportEquipmentStatusChangeReport"/>
+ <xsd:enumeration value="FumigationCertificate"/>
+ <xsd:enumeration value="WineCertificate"/>
+ <xsd:enumeration value="WoolHealthCertificate"/>
+ <xsd:enumeration value="DeliveryNote"/>
+ <xsd:enumeration value="PackingList"/>
+ <xsd:enumeration value="NewCodeRequest"/>
+ <xsd:enumeration value="CodeChangeRequest"/>
+ <xsd:enumeration value="SimpleDataElementRequest"/>
+ <xsd:enumeration value="SimpleDataElementChangeRequest"/>
+ <xsd:enumeration value="CompositeDataElementRequest"/>
+ <xsd:enumeration value="CompositeDataElementChangeRequest"/>
+ <xsd:enumeration value="SegmentRequest"/>
+ <xsd:enumeration value="SegmentChangeRequest"/>
+ <xsd:enumeration value="NewMessageRequest"/>
+ <xsd:enumeration value="MessageInDevelopmentRequest"/>
+ <xsd:enumeration value="ModificationOfExistingMessage"/>
+ <xsd:enumeration value="TrackingNumberAssignmentReport"/>
+ <xsd:enumeration value="UserDirectoryDefinition"/>
+ <xsd:enumeration value="UnitedNationsStandardMessageRequest"/>
+ <xsd:enumeration value="ServiceDirectoryDefinition"/>
+ <xsd:enumeration value="StatusReport"/>
+ <xsd:enumeration value="KanbanSchedule"/>
+ <xsd:enumeration value="ProductDataMessage"/>
+ <xsd:enumeration value="AClaimForPartsAndOrLabourCharges"/>
+ <xsd:enumeration value="DeliveryScheduleResponse"/>
+ <xsd:enumeration value="InspectionRequest"/>
+ <xsd:enumeration value="InspectionReport"/>
+ <xsd:enumeration value="ApplicationAcknowledgementAndErrorReport"/>
+ <xsd:enumeration value="PriceVariationInvoice"/>
+ <xsd:enumeration value="CreditNoteForPriceVariation"/>
+ <xsd:enumeration value="InstructionToCollect"/>
+ <xsd:enumeration value="DangerousGoodsList"/>
+ <xsd:enumeration value="RegistrationRenewal"/>
+ <xsd:enumeration value="RegistrationChange"/>
+ <xsd:enumeration value="ResponseToRegistration"/>
+ <xsd:enumeration value="ImplementationGuideline"/>
+ <xsd:enumeration value="RequestForTransfer"/>
+ <xsd:enumeration value="CostPerformanceReport"/>
+ <xsd:enumeration value="ApplicationErrorAndAcknowledgement"/>
+ <xsd:enumeration value="CashPoolFinancialStatement"/>
+ <xsd:enumeration value="SequencedDeliverySchedule"/>
+ <xsd:enumeration value="DelcredereCreditNote"/>
+ <xsd:enumeration value="OfferQuotation"/>
+ <xsd:enumeration value="RequestForQuote"/>
+ <xsd:enumeration value="AcknowledgementMessage"/>
+ <xsd:enumeration value="ApplicationErrorMessage"/>
+ <xsd:enumeration value="CargoMovementVoyageSummary"/>
+ <xsd:enumeration value="Contract"/>
+ <xsd:enumeration value="ApplicationForUsageOfBerthOrMooringFacilities"/>
+ <xsd:enumeration value="ApplicationForDesignationOfBerthingPlaces"/>
+ <xsd:enumeration value="ApplicationForShiftingFromTheDesignatedPlaceInPort"/>
+ <xsd:enumeration value="SupplementaryDocumentForApplicationForCargoOperationOfDangerousGoods"/>
+ <xsd:enumeration value="AcknowledgementOfOrder"/>
+ <xsd:enumeration value="SupplementaryDocumentForApplicationForTransportOfDangerousGoods"/>
+ <xsd:enumeration value="OpticalCharacterReadingOcrPayment"/>
+ <xsd:enumeration value="PreliminarySalesReport"/>
+ <xsd:enumeration value="TransportEmergencyCard"/>
+ <xsd:enumeration value="ProformaInvoice"/>
+ <xsd:enumeration value="PartialInvoice"/>
+ <xsd:enumeration value="OperatingInstructions"/>
+ <xsd:enumeration value="NameProductPlate"/>
+ <xsd:enumeration value="Co-InsuranceCedingBordereau"/>
+ <xsd:enumeration value="RequestForDeliveryInstructions"/>
+ <xsd:enumeration value="CommercialInvoiceWhichIncludesAPackingList"/>
+ <xsd:enumeration value="TradeData"/>
+ <xsd:enumeration value="CustomsDeclarationForCargoExamination"/>
+ <xsd:enumeration value="CustomsDeclarationForCargoExaminationAlternate"/>
+ <xsd:enumeration value="BookingRequest"/>
+ <xsd:enumeration value="CustomsCrewAndConveyance"/>
+ <xsd:enumeration value="CustomsSummaryDeclarationWithCommercialDetailAlternate"/>
+ <xsd:enumeration value="ItemsBookedToAFinancialAccountReport"/>
+ <xsd:enumeration value="ReportOfTransactionsWhichNeedFurtherInformationFromTheReceiver"/>
+ <xsd:enumeration value="ShippingInstructions"/>
+ <xsd:enumeration value="ShippersLetterOfInstructionsAir"/>
+ <xsd:enumeration value="ReportOfTransactionsForInformationOnly"/>
+ <xsd:enumeration value="CartageOrderLocalTransport"/>
+ <xsd:enumeration value="EdiAssociatedObjectAdministrationMessage"/>
+ <xsd:enumeration value="ReadyForDespatchAdvice"/>
+ <xsd:enumeration value="SummarySalesReport"/>
+ <xsd:enumeration value="OrderStatusEnquiry"/>
+ <xsd:enumeration value="OrderStatusReport"/>
+ <xsd:enumeration value="DeclarationRegardingTheInwardAndOutwardMovementOfVessel"/>
+ <xsd:enumeration value="DespatchOrder"/>
+ <xsd:enumeration value="DespatchAdvice"/>
+ <xsd:enumeration value="NotificationOfUsageOfBerthOrMooringFacilities"/>
+ <xsd:enumeration value="ApplicationForVesselsEnteringIntoPortAreaInNight-Time"/>
+ <xsd:enumeration value="NotificationOfEmergencyShiftingFromTheDesignatedPlaceInPort"/>
+ <xsd:enumeration value="CustomsSummaryDeclarationWithoutCommercialDetailAlternate"/>
+ <xsd:enumeration value="PerformanceBond"/>
+ <xsd:enumeration value="PaymentBond"/>
+ <xsd:enumeration value="AdviceOfDistributionOfDocuments"/>
+ <xsd:enumeration value="CommercialInvoice"/>
+ <xsd:enumeration value="CreditNote"/>
+ <xsd:enumeration value="CommissionNote"/>
+ <xsd:enumeration value="DebitNote"/>
+ <xsd:enumeration value="CorrectedInvoice"/>
+ <xsd:enumeration value="ConsolidatedInvoice"/>
+ <xsd:enumeration value="PrepaymentInvoice"/>
+ <xsd:enumeration value="HireInvoice"/>
+ <xsd:enumeration value="TaxInvoice"/>
+ <xsd:enumeration value="Self-BilledInvoice"/>
+ <xsd:enumeration value="DelcredereInvoice"/>
+ <xsd:enumeration value="FactoredInvoice"/>
+ <xsd:enumeration value="LeaseInvoice"/>
+ <xsd:enumeration value="ConsignmentInvoice"/>
+ <xsd:enumeration value="FactoredCreditNote"/>
+ <xsd:enumeration value="CommercialAccountSummaryResponse"/>
+ <xsd:enumeration value="CrossDockingDespatchAdvice"/>
+ <xsd:enumeration value="TransshipmentDespatchAdvice"/>
+ <xsd:enumeration value="ExceptionalOrder"/>
+ <xsd:enumeration value="TransshipmentOrder"/>
+ <xsd:enumeration value="CrossDockingOrder"/>
+ <xsd:enumeration value="MeansOfTransportationAvailabilityInformation"/>
+ <xsd:enumeration value="MeansOfTransportationScheduleInformation"/>
+ <xsd:enumeration value="TransportEquipmentDeliveryNotice"/>
+ <xsd:enumeration value="InstructionsForBankTransfer"/>
+ <xsd:enumeration value="ApplicationForBankersDraft"/>
+ <xsd:enumeration value="CollectionPaymentAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditPaymentAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditAcceptanceAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditNegotiationAdvice"/>
+ <xsd:enumeration value="ApplicationForBankersGuarantee"/>
+ <xsd:enumeration value="BankersGuarantee"/>
+ <xsd:enumeration value="DocumentaryCreditLetterOfIndemnity"/>
+ <xsd:enumeration value="PreadviceOfACredit"/>
+ <xsd:enumeration value="CollectionOrder"/>
+ <xsd:enumeration value="DocumentsPresentationForm"/>
+ <xsd:enumeration value="PaymentOrder"/>
+ <xsd:enumeration value="ExtendedPaymentOrder"/>
+ <xsd:enumeration value="MultiplePaymentOrder"/>
+ <xsd:enumeration value="CreditAdvice"/>
+ <xsd:enumeration value="ExtendedCreditAdvice"/>
+ <xsd:enumeration value="DebitAdvice"/>
+ <xsd:enumeration value="ReversalOfDebit"/>
+ <xsd:enumeration value="ReversalOfCredit"/>
+ <xsd:enumeration value="DocumentaryCreditApplication"/>
+ <xsd:enumeration value="DocumentaryCredit"/>
+ <xsd:enumeration value="DocumentaryCreditNotification"/>
+ <xsd:enumeration value="DocumentaryCreditTransferAdvice"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentNotification"/>
+ <xsd:enumeration value="DocumentaryCreditAmendment"/>
+ <xsd:enumeration value="RemittanceAdvice"/>
+ <xsd:enumeration value="BankersDraft"/>
+ <xsd:enumeration value="BillOfExchange"/>
+ <xsd:enumeration value="PromissoryNote"/>
+ <xsd:enumeration value="FinancialStatementOfAccount"/>
+ <xsd:enumeration value="StatementOfAccountMessage"/>
+ <xsd:enumeration value="InsuranceCertificate"/>
+ <xsd:enumeration value="InsurancePolicy"/>
+ <xsd:enumeration value="InsuranceDeclarationSheetBordereau"/>
+ <xsd:enumeration value="InsurersInvoice"/>
+ <xsd:enumeration value="CoverNote"/>
+ <xsd:enumeration value="ForwardingInstructions"/>
+ <xsd:enumeration value="ForwardersAdviceToImportAgent"/>
+ <xsd:enumeration value="ForwardersAdviceToExporter"/>
+ <xsd:enumeration value="ForwardersInvoice"/>
+ <xsd:enumeration value="ForwardersCertificateOfReceipt"/>
+ <xsd:enumeration value="ShippingNote"/>
+ <xsd:enumeration value="ForwardersWarehouseReceipt"/>
+ <xsd:enumeration value="GoodsReceipt"/>
+ <xsd:enumeration value="PortChargesDocuments"/>
+ <xsd:enumeration value="WarehouseWarrant"/>
+ <xsd:enumeration value="DeliveryOrder"/>
+ <xsd:enumeration value="HandlingOrder"/>
+ <xsd:enumeration value="GatePass"/>
+ <xsd:enumeration value="Waybill"/>
+ <xsd:enumeration value="UniversalMultipurposeTransportDocument"/>
+ <xsd:enumeration value="GoodsReceiptCarriage"/>
+ <xsd:enumeration value="HouseWaybill"/>
+ <xsd:enumeration value="MasterBillOfLading"/>
+ <xsd:enumeration value="BillOfLading"/>
+ <xsd:enumeration value="BillOfLadingOriginal"/>
+ <xsd:enumeration value="BillOfLadingCopy"/>
+ <xsd:enumeration value="EmptyContainerBill"/>
+ <xsd:enumeration value="TankerBillOfLading"/>
+ <xsd:enumeration value="SeaWaybill"/>
+ <xsd:enumeration value="InlandWaterwayBillOfLading"/>
+ <xsd:enumeration value="Non-NegotiableMaritimeTransportDocumentGeneric"/>
+ <xsd:enumeration value="MatesReceipt"/>
+ <xsd:enumeration value="HouseBillOfLading"/>
+ <xsd:enumeration value="LetterOfIndemnityForNon-SurrenderOfBillOfLading"/>
+ <xsd:enumeration value="ForwardersBillOfLading"/>
+ <xsd:enumeration value="RailConsignmentNoteGenericTerm"/>
+ <xsd:enumeration value="RoadList-Smgs"/>
+ <xsd:enumeration value="EscortOfficialRecognition"/>
+ <xsd:enumeration value="RechargingDocument"/>
+ <xsd:enumeration value="RoadConsignmentNote"/>
+ <xsd:enumeration value="AirWaybill"/>
+ <xsd:enumeration value="MasterAirWaybill"/>
+ <xsd:enumeration value="SubstituteAirWaybill"/>
+ <xsd:enumeration value="CrewsEffectsDeclaration"/>
+ <xsd:enumeration value="PassengerList"/>
+ <xsd:enumeration value="DeliveryNoticeRailTransport"/>
+ <xsd:enumeration value="DespatchNotePostParcels"/>
+ <xsd:enumeration value="MultimodalCombinedTransportDocumentGeneric"/>
+ <xsd:enumeration value="ThroughBillOfLading"/>
+ <xsd:enumeration value="ForwardersCertificateOfTransport"/>
+ <xsd:enumeration value="CombinedTransportDocumentGeneric"/>
+ <xsd:enumeration value="MultimodalTransportDocumentGeneric"/>
+ <xsd:enumeration value="CombinedTransportBillOfLadingMultimodalBillOfLading"/>
+ <xsd:enumeration value="BookingConfirmation"/>
+ <xsd:enumeration value="CallingForwardNotice"/>
+ <xsd:enumeration value="FreightInvoice"/>
+ <xsd:enumeration value="ArrivalNoticeGoods"/>
+ <xsd:enumeration value="NoticeOfCircumstancesPreventingDeliveryGoods"/>
+ <xsd:enumeration value="NoticeOfCircumstancesPreventingTransportGoods"/>
+ <xsd:enumeration value="DeliveryNoticeGoods"/>
+ <xsd:enumeration value="CargoManifest"/>
+ <xsd:enumeration value="FreightManifest"/>
+ <xsd:enumeration value="Bordereau"/>
+ <xsd:enumeration value="ContainerManifestUnitPackingList"/>
+ <xsd:enumeration value="ChargesNote"/>
+ <xsd:enumeration value="AdviceOfCollection"/>
+ <xsd:enumeration value="SafetyOfShipCertificate"/>
+ <xsd:enumeration value="SafetyOfRadioCertificate"/>
+ <xsd:enumeration value="SafetyOfEquipmentCertificate"/>
+ <xsd:enumeration value="CivilLiabilityForOilCertificate"/>
+ <xsd:enumeration value="LoadlineDocument"/>
+ <xsd:enumeration value="DeratDocument"/>
+ <xsd:enumeration value="MaritimeDeclarationOfHealth"/>
+ <xsd:enumeration value="CertificateOfRegistry"/>
+ <xsd:enumeration value="ShipsStoresDeclaration"/>
+ <xsd:enumeration value="ExportLicenceApplicationFor"/>
+ <xsd:enumeration value="ExportLicence"/>
+ <xsd:enumeration value="ExchangeControlDeclarationExport"/>
+ <xsd:enumeration value="DespatchNoteModelT"/>
+ <xsd:enumeration value="DespatchNoteModelT1"/>
+ <xsd:enumeration value="DespatchNoteModelT2"/>
+ <xsd:enumeration value="ControlDocumentT5"/>
+ <xsd:enumeration value="Re-SendingConsignmentNote"/>
+ <xsd:enumeration value="DespatchNoteModelT2L"/>
+ <xsd:enumeration value="GoodsDeclarationForExportation"/>
+ <xsd:enumeration value="CargoDeclarationDeparture"/>
+ <xsd:enumeration value="ApplicationForGoodsControlCertificate"/>
+ <xsd:enumeration value="GoodsControlCertificate"/>
+ <xsd:enumeration value="ApplicationForPhytosanitaryCertificate"/>
+ <xsd:enumeration value="PhytosanitaryCertificate"/>
+ <xsd:enumeration value="SanitaryCertificate"/>
+ <xsd:enumeration value="VeterinaryCertificate"/>
+ <xsd:enumeration value="ApplicationForInspectionCertificate"/>
+ <xsd:enumeration value="InspectionCertificate"/>
+ <xsd:enumeration value="CertificateOfOriginApplicationFor"/>
+ <xsd:enumeration value="CertificateOfOrigin"/>
+ <xsd:enumeration value="DeclarationOfOrigin"/>
+ <xsd:enumeration value="RegionalAppellationCertificate"/>
+ <xsd:enumeration value="PreferenceCertificateOfOrigin"/>
+ <xsd:enumeration value="CertificateOfOriginFormGsp"/>
+ <xsd:enumeration value="ConsularInvoice"/>
+ <xsd:enumeration value="DangerousGoodsDeclaration"/>
+ <xsd:enumeration value="StatisticalDocumentExport"/>
+ <xsd:enumeration value="IntrastatDeclaration"/>
+ <xsd:enumeration value="DeliveryVerificationCertificate"/>
+ <xsd:enumeration value="ImportLicenceApplicationFor"/>
+ <xsd:enumeration value="ImportLicence"/>
+ <xsd:enumeration value="CustomsDeclarationWithoutCommercialDetail"/>
+ <xsd:enumeration value="CustomsDeclarationWithCommercialAndItemDetail"/>
+ <xsd:enumeration value="CustomsDeclarationWithoutItemDetail"/>
+ <xsd:enumeration value="RelatedDocument"/>
+ <xsd:enumeration value="ReceiptCustoms"/>
+ <xsd:enumeration value="ApplicationForExchangeAllocation"/>
+ <xsd:enumeration value="ForeignExchangePermit"/>
+ <xsd:enumeration value="ExchangeControlDeclarationImport"/>
+ <xsd:enumeration value="GoodsDeclarationForImportation"/>
+ <xsd:enumeration value="GoodsDeclarationForHomeUse"/>
+ <xsd:enumeration value="CustomsImmediateReleaseDeclaration"/>
+ <xsd:enumeration value="CustomsDeliveryNote"/>
+ <xsd:enumeration value="CargoDeclarationArrival"/>
+ <xsd:enumeration value="ValueDeclaration"/>
+ <xsd:enumeration value="CustomsInvoice"/>
+ <xsd:enumeration value="CustomsDeclarationPostParcels"/>
+ <xsd:enumeration value="TaxDeclarationValueAddedTax"/>
+ <xsd:enumeration value="TaxDeclarationGeneral"/>
+ <xsd:enumeration value="TaxDemand"/>
+ <xsd:enumeration value="EmbargoPermit"/>
+ <xsd:enumeration value="GoodsDeclarationForCustomsTransit"/>
+ <xsd:enumeration value="TifForm"/>
+ <xsd:enumeration value="TirCarnet"/>
+ <xsd:enumeration value="EcCarnet"/>
+ <xsd:enumeration value="Eur1CertificateOfOrigin"/>
+ <xsd:enumeration value="AtaCarnet"/>
+ <xsd:enumeration value="SingleAdministrativeDocument"/>
+ <xsd:enumeration value="GeneralResponseCustoms"/>
+ <xsd:enumeration value="DocumentResponseCustoms"/>
+ <xsd:enumeration value="ErrorResponseCustoms"/>
+ <xsd:enumeration value="PackageResponseCustoms"/>
+ <xsd:enumeration value="TaxCalculationConfirmationResponseCustoms"/>
+ <xsd:enumeration value="QuotaPriorAllocationCertificate"/>
+ <xsd:enumeration value="EndUseAuthorization"/>
+ <xsd:enumeration value="GovernmentContract"/>
+ <xsd:enumeration value="StatisticalDocumentImport"/>
+ <xsd:enumeration value="ApplicationForDocumentaryCredit"/>
+ <xsd:enumeration value="PreviousCustomsDocumentMessage"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfDocumentAttached">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" name="DocumentAttached">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PackageDoc"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDocumentAttached" type="ListOfDocumentAttached"/>
+ <xsd:complexType name="ReturnableContainerInfo">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ReturnableContainerPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartNum"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="PaymentResponsibilityCoded" type="PaymentResponsibilityCode"/>
+ <xsd:element minOccurs="0" name="PaymentResponsibilityCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReturnLoadCoded" type="ReturnLoadCode"/>
+ <xsd:element minOccurs="0" name="ReturnLoadCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReturnNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ReturnableContainerInfo" type="ReturnableContainerInfo"/>
+ <xsd:simpleType name="PaymentResponsibilityCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="PaidByCustomer"/>
+ <xsd:enumeration value="Free"/>
+ <xsd:enumeration value="PaidBySupplier"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ReturnLoadCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="LoadedEithEmpty4BlockForBlockingPurposes"/>
+ <xsd:enumeration value="EmptyContainerWithDunnage"/>
+ <xsd:enumeration value="EmptyContainer"/>
+ <xsd:enumeration value="LoadedWithProductionMaterial"/>
+ <xsd:enumeration value="MixedEmptyAndLoaded"/>
+ <xsd:enumeration value="ObsoleteMaterial"/>
+ <xsd:enumeration value="LoadedWithExcessReturnedProductionMaterial"/>
+ <xsd:enumeration value="LoadedWithRejectedMaterial"/>
+ <xsd:enumeration value="ServicePartObsoleteContainer"/>
+ <xsd:enumeration value="LoadedWithReturnedProcessedMaterial"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderSummary">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="NumberOfLines" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="TotalTax">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalAmount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="TransportPackagingTotals"/>
+ <xsd:element minOccurs="0" name="SummaryNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderSummary" type="OrderSummary"/>
+ <xsd:complexType name="TransportPackagingTotals">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="TotalPackages" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="TotalPackageDepth" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="TotalTransport" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="TotalGrossWeight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalNetWeight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalNetNetWeight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalTareWeight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="GrossVolume">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportPackagingTotals" type="TransportPackagingTotals"/>
+ <!-- SOX format datatypes where they difer from standard XSDL datatypes-->
+ <xsd:simpleType name="xcblDate">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblTime">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="((([0-1][0-9])|(2[0-3]))(:([0-5][0-9])){2}((\+|-)(([0-1][0-9])|(2[0-3])):([0-5][0-9]))?)"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblDatetime">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))T((([0-1][0-9])|(2[0-3]))(:([0-5][0-9])){2}((\+|-)(([0-1][0-9])|(2[0-3])):([0-5][0-9]))?)"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblBoolean">
+ <xsd:restriction base="xsd:boolean">
+ <xsd:pattern value="true|false"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblFloat">
+ <xsd:restriction base="xsd:float">
+ <xsd:pattern value="(\+|-)?[0-9]*\.?[0-9]*(E|e)?[0-9]*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblDouble">
+ <xsd:restriction base="xsd:double">
+ <xsd:pattern value="(\+|-)?[0-9]*\.?[0-9]*(E|e)?[0-9]*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/cases/schema/wli/OrderConfirmation.xsd b/v1/test/cases/schema/wli/OrderConfirmation.xsd
new file mode 100644
index 0000000..58e56ac
--- /dev/null
+++ b/v1/test/cases/schema/wli/OrderConfirmation.xsd
@@ -0,0 +1,17069 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="publicid:org.xCBL:schemas/XCBL35/OrderConfirmation.xsd" targetNamespace="publicid:org.xCBL:schemas/XCBL35/OrderConfirmation.xsd" elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ XML Common Business Library 3.5
+ Copyright 2000 Commerce One, Inc.
+ Permission is granted to use, copy, modify and distribute the
+ DTD's, schemas and modules in the Commerce One XML Common Business
+ Library Version 3.5 subject to the terms and conditions specified
+ at http://www.xcbl.org/license.html
+ </xsd:documentation>
+ <xsd:documentation>
+ PLEASE NOTE: This schema, whilst it describes in entirety a valid, single,
+ xCBL 3.5 document, is defined to be in a namespace other than the main xCBL 3.5
+ namespace. Therefore it is recommended that the full xCBL 3.5 schema is used
+ for full production situations. Please see the notes at
+ <a href="http://www.xcbl.org/xcbl35/xsd/schemas.html">www.xCBL.org</a>.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType name="OrderConfirmation">
+ <xsd:sequence>
+ <xsd:element ref="OrderConfirmationHeader"/>
+ <xsd:element ref="OrderConfirmationDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmation" type="OrderConfirmation"/>
+ <xsd:complexType name="OrderConfirmationHeader">
+ <xsd:sequence>
+ <xsd:element name="SellerOrderConfirmationNumber" type="xsd:string"/>
+ <xsd:element name="SellerOrderNumber" type="xsd:string"/>
+ <xsd:element name="OrderConfirmationIssueDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" ref="OrderConfirmationType"/>
+ <xsd:element minOccurs="0" ref="Language"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" ref="OrderConfirmationParty"/>
+ <xsd:element minOccurs="0" ref="OrderConfirmationAction"/>
+ <xsd:element minOccurs="0" name="OrderConfirmationHeaderShortDescription" type="AlphaNum40"/>
+ <xsd:element minOccurs="0" name="OrderConfirmationHeaderNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfStructuredNote"/>
+ <xsd:element minOccurs="0" ref="ListOfNameValueSet"/>
+ <xsd:element minOccurs="0" ref="ListOfAttachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationHeader" type="OrderConfirmationHeader"/>
+ <xsd:complexType name="OrderConfirmationType">
+ <xsd:sequence>
+ <xsd:element name="OrderConfirmationTypeCoded" type="OrderConfirmationTypeCode"/>
+ <xsd:element minOccurs="0" name="OrderConfirmationTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationType" type="OrderConfirmationType"/>
+ <xsd:simpleType name="OrderConfirmationTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="OrderConfirmation"/>
+ <xsd:enumeration value="ReturnDelivery"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Language">
+ <xsd:sequence>
+ <xsd:element name="LanguageCoded" type="LanguageCode"/>
+ <xsd:element minOccurs="0" name="LanguageCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="LocaleCoded" type="LocaleCode"/>
+ <xsd:element minOccurs="0" name="LocaleCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="LanguageDependent" type="xcblBoolean" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="Language" type="Language"/>
+ <xsd:simpleType name="LanguageCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="aa"/>
+ <xsd:enumeration value="ab"/>
+ <xsd:enumeration value="af"/>
+ <xsd:enumeration value="am"/>
+ <xsd:enumeration value="ar"/>
+ <xsd:enumeration value="as"/>
+ <xsd:enumeration value="ay"/>
+ <xsd:enumeration value="az"/>
+ <xsd:enumeration value="ba"/>
+ <xsd:enumeration value="be"/>
+ <xsd:enumeration value="bg"/>
+ <xsd:enumeration value="bh"/>
+ <xsd:enumeration value="bi"/>
+ <xsd:enumeration value="bn"/>
+ <xsd:enumeration value="bo"/>
+ <xsd:enumeration value="br"/>
+ <xsd:enumeration value="ca"/>
+ <xsd:enumeration value="co"/>
+ <xsd:enumeration value="cs"/>
+ <xsd:enumeration value="cy"/>
+ <xsd:enumeration value="da"/>
+ <xsd:enumeration value="de"/>
+ <xsd:enumeration value="dz"/>
+ <xsd:enumeration value="el"/>
+ <xsd:enumeration value="en"/>
+ <xsd:enumeration value="eo"/>
+ <xsd:enumeration value="es"/>
+ <xsd:enumeration value="et"/>
+ <xsd:enumeration value="eu"/>
+ <xsd:enumeration value="fa"/>
+ <xsd:enumeration value="fi"/>
+ <xsd:enumeration value="fj"/>
+ <xsd:enumeration value="fo"/>
+ <xsd:enumeration value="fr"/>
+ <xsd:enumeration value="fy"/>
+ <xsd:enumeration value="ga"/>
+ <xsd:enumeration value="gd"/>
+ <xsd:enumeration value="gl"/>
+ <xsd:enumeration value="gn"/>
+ <xsd:enumeration value="gu"/>
+ <xsd:enumeration value="ha"/>
+ <xsd:enumeration value="he"/>
+ <xsd:enumeration value="hi"/>
+ <xsd:enumeration value="hr"/>
+ <xsd:enumeration value="hu"/>
+ <xsd:enumeration value="hy"/>
+ <xsd:enumeration value="ia"/>
+ <xsd:enumeration value="id"/>
+ <xsd:enumeration value="ie"/>
+ <xsd:enumeration value="ik"/>
+ <xsd:enumeration value="is"/>
+ <xsd:enumeration value="it"/>
+ <xsd:enumeration value="iu"/>
+ <xsd:enumeration value="ja"/>
+ <xsd:enumeration value="jw"/>
+ <xsd:enumeration value="ka"/>
+ <xsd:enumeration value="kk"/>
+ <xsd:enumeration value="kl"/>
+ <xsd:enumeration value="km"/>
+ <xsd:enumeration value="kn"/>
+ <xsd:enumeration value="ko"/>
+ <xsd:enumeration value="ks"/>
+ <xsd:enumeration value="ku"/>
+ <xsd:enumeration value="ky"/>
+ <xsd:enumeration value="la"/>
+ <xsd:enumeration value="ln"/>
+ <xsd:enumeration value="lo"/>
+ <xsd:enumeration value="lt"/>
+ <xsd:enumeration value="lv"/>
+ <xsd:enumeration value="mg"/>
+ <xsd:enumeration value="mi"/>
+ <xsd:enumeration value="mk"/>
+ <xsd:enumeration value="ml"/>
+ <xsd:enumeration value="mn"/>
+ <xsd:enumeration value="mo"/>
+ <xsd:enumeration value="mr"/>
+ <xsd:enumeration value="ms"/>
+ <xsd:enumeration value="mt"/>
+ <xsd:enumeration value="my"/>
+ <xsd:enumeration value="na"/>
+ <xsd:enumeration value="ne"/>
+ <xsd:enumeration value="nl"/>
+ <xsd:enumeration value="no"/>
+ <xsd:enumeration value="oc"/>
+ <xsd:enumeration value="om"/>
+ <xsd:enumeration value="or"/>
+ <xsd:enumeration value="pa"/>
+ <xsd:enumeration value="pl"/>
+ <xsd:enumeration value="ps"/>
+ <xsd:enumeration value="pt"/>
+ <xsd:enumeration value="qu"/>
+ <xsd:enumeration value="rm"/>
+ <xsd:enumeration value="rn"/>
+ <xsd:enumeration value="ro"/>
+ <xsd:enumeration value="ru"/>
+ <xsd:enumeration value="rw"/>
+ <xsd:enumeration value="sa"/>
+ <xsd:enumeration value="sd"/>
+ <xsd:enumeration value="sg"/>
+ <xsd:enumeration value="sh"/>
+ <xsd:enumeration value="si"/>
+ <xsd:enumeration value="sk"/>
+ <xsd:enumeration value="sl"/>
+ <xsd:enumeration value="sm"/>
+ <xsd:enumeration value="sn"/>
+ <xsd:enumeration value="so"/>
+ <xsd:enumeration value="sq"/>
+ <xsd:enumeration value="sr"/>
+ <xsd:enumeration value="ss"/>
+ <xsd:enumeration value="st"/>
+ <xsd:enumeration value="su"/>
+ <xsd:enumeration value="sv"/>
+ <xsd:enumeration value="sw"/>
+ <xsd:enumeration value="ta"/>
+ <xsd:enumeration value="te"/>
+ <xsd:enumeration value="tg"/>
+ <xsd:enumeration value="th"/>
+ <xsd:enumeration value="ti"/>
+ <xsd:enumeration value="tk"/>
+ <xsd:enumeration value="tl"/>
+ <xsd:enumeration value="tn"/>
+ <xsd:enumeration value="to"/>
+ <xsd:enumeration value="tr"/>
+ <xsd:enumeration value="ts"/>
+ <xsd:enumeration value="tt"/>
+ <xsd:enumeration value="tw"/>
+ <xsd:enumeration value="ug"/>
+ <xsd:enumeration value="uk"/>
+ <xsd:enumeration value="ur"/>
+ <xsd:enumeration value="uz"/>
+ <xsd:enumeration value="vi"/>
+ <xsd:enumeration value="vo"/>
+ <xsd:enumeration value="wo"/>
+ <xsd:enumeration value="xh"/>
+ <xsd:enumeration value="yi"/>
+ <xsd:enumeration value="yo"/>
+ <xsd:enumeration value="za"/>
+ <xsd:enumeration value="zh"/>
+ <xsd:enumeration value="zu"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="LocaleCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ae"/>
+ <xsd:enumeration value="af"/>
+ <xsd:enumeration value="ag"/>
+ <xsd:enumeration value="ai"/>
+ <xsd:enumeration value="al"/>
+ <xsd:enumeration value="am"/>
+ <xsd:enumeration value="an"/>
+ <xsd:enumeration value="ao"/>
+ <xsd:enumeration value="aq"/>
+ <xsd:enumeration value="ar"/>
+ <xsd:enumeration value="as"/>
+ <xsd:enumeration value="at"/>
+ <xsd:enumeration value="au"/>
+ <xsd:enumeration value="aw"/>
+ <xsd:enumeration value="az"/>
+ <xsd:enumeration value="ba"/>
+ <xsd:enumeration value="bb"/>
+ <xsd:enumeration value="bd"/>
+ <xsd:enumeration value="be"/>
+ <xsd:enumeration value="bf"/>
+ <xsd:enumeration value="bg"/>
+ <xsd:enumeration value="bh"/>
+ <xsd:enumeration value="bi"/>
+ <xsd:enumeration value="bj"/>
+ <xsd:enumeration value="bm"/>
+ <xsd:enumeration value="bn"/>
+ <xsd:enumeration value="bo"/>
+ <xsd:enumeration value="br"/>
+ <xsd:enumeration value="bs"/>
+ <xsd:enumeration value="bt"/>
+ <xsd:enumeration value="bu"/>
+ <xsd:enumeration value="bw"/>
+ <xsd:enumeration value="by"/>
+ <xsd:enumeration value="bz"/>
+ <xsd:enumeration value="ca"/>
+ <xsd:enumeration value="cc"/>
+ <xsd:enumeration value="cd"/>
+ <xsd:enumeration value="cf"/>
+ <xsd:enumeration value="cg"/>
+ <xsd:enumeration value="ch"/>
+ <xsd:enumeration value="ci"/>
+ <xsd:enumeration value="ck"/>
+ <xsd:enumeration value="cl"/>
+ <xsd:enumeration value="cm"/>
+ <xsd:enumeration value="cn"/>
+ <xsd:enumeration value="co"/>
+ <xsd:enumeration value="cr"/>
+ <xsd:enumeration value="cs"/>
+ <xsd:enumeration value="cu"/>
+ <xsd:enumeration value="cv"/>
+ <xsd:enumeration value="cx"/>
+ <xsd:enumeration value="cy"/>
+ <xsd:enumeration value="cz"/>
+ <xsd:enumeration value="de"/>
+ <xsd:enumeration value="dj"/>
+ <xsd:enumeration value="dk"/>
+ <xsd:enumeration value="dm"/>
+ <xsd:enumeration value="do"/>
+ <xsd:enumeration value="dz"/>
+ <xsd:enumeration value="ec"/>
+ <xsd:enumeration value="ee"/>
+ <xsd:enumeration value="eg"/>
+ <xsd:enumeration value="eh"/>
+ <xsd:enumeration value="er"/>
+ <xsd:enumeration value="es"/>
+ <xsd:enumeration value="et"/>
+ <xsd:enumeration value="fi"/>
+ <xsd:enumeration value="fj"/>
+ <xsd:enumeration value="fk"/>
+ <xsd:enumeration value="fm"/>
+ <xsd:enumeration value="fo"/>
+ <xsd:enumeration value="fr"/>
+ <xsd:enumeration value="ga"/>
+ <xsd:enumeration value="gb"/>
+ <xsd:enumeration value="gd"/>
+ <xsd:enumeration value="ge"/>
+ <xsd:enumeration value="gf"/>
+ <xsd:enumeration value="gh"/>
+ <xsd:enumeration value="gi"/>
+ <xsd:enumeration value="gl"/>
+ <xsd:enumeration value="gm"/>
+ <xsd:enumeration value="gn"/>
+ <xsd:enumeration value="gp"/>
+ <xsd:enumeration value="gq"/>
+ <xsd:enumeration value="gr"/>
+ <xsd:enumeration value="gs"/>
+ <xsd:enumeration value="gt"/>
+ <xsd:enumeration value="gu"/>
+ <xsd:enumeration value="gw"/>
+ <xsd:enumeration value="gy"/>
+ <xsd:enumeration value="hk"/>
+ <xsd:enumeration value="hn"/>
+ <xsd:enumeration value="hr"/>
+ <xsd:enumeration value="ht"/>
+ <xsd:enumeration value="hu"/>
+ <xsd:enumeration value="id"/>
+ <xsd:enumeration value="ie"/>
+ <xsd:enumeration value="il"/>
+ <xsd:enumeration value="in"/>
+ <xsd:enumeration value="io"/>
+ <xsd:enumeration value="iq"/>
+ <xsd:enumeration value="ir"/>
+ <xsd:enumeration value="is"/>
+ <xsd:enumeration value="it"/>
+ <xsd:enumeration value="jm"/>
+ <xsd:enumeration value="jo"/>
+ <xsd:enumeration value="jp"/>
+ <xsd:enumeration value="ke"/>
+ <xsd:enumeration value="kg"/>
+ <xsd:enumeration value="kh"/>
+ <xsd:enumeration value="ki"/>
+ <xsd:enumeration value="km"/>
+ <xsd:enumeration value="kn"/>
+ <xsd:enumeration value="kp"/>
+ <xsd:enumeration value="kr"/>
+ <xsd:enumeration value="kw"/>
+ <xsd:enumeration value="ky"/>
+ <xsd:enumeration value="kz"/>
+ <xsd:enumeration value="la"/>
+ <xsd:enumeration value="lb"/>
+ <xsd:enumeration value="lc"/>
+ <xsd:enumeration value="li"/>
+ <xsd:enumeration value="lk"/>
+ <xsd:enumeration value="lr"/>
+ <xsd:enumeration value="ls"/>
+ <xsd:enumeration value="lt"/>
+ <xsd:enumeration value="lu"/>
+ <xsd:enumeration value="lv"/>
+ <xsd:enumeration value="ly"/>
+ <xsd:enumeration value="ma"/>
+ <xsd:enumeration value="mc"/>
+ <xsd:enumeration value="md"/>
+ <xsd:enumeration value="mg"/>
+ <xsd:enumeration value="mh"/>
+ <xsd:enumeration value="mk"/>
+ <xsd:enumeration value="ml"/>
+ <xsd:enumeration value="mm"/>
+ <xsd:enumeration value="mn"/>
+ <xsd:enumeration value="mo"/>
+ <xsd:enumeration value="mp"/>
+ <xsd:enumeration value="mq"/>
+ <xsd:enumeration value="mr"/>
+ <xsd:enumeration value="ms"/>
+ <xsd:enumeration value="mt"/>
+ <xsd:enumeration value="mu"/>
+ <xsd:enumeration value="mv"/>
+ <xsd:enumeration value="mw"/>
+ <xsd:enumeration value="mx"/>
+ <xsd:enumeration value="my"/>
+ <xsd:enumeration value="mz"/>
+ <xsd:enumeration value="na"/>
+ <xsd:enumeration value="nc"/>
+ <xsd:enumeration value="ne"/>
+ <xsd:enumeration value="nf"/>
+ <xsd:enumeration value="ng"/>
+ <xsd:enumeration value="ni"/>
+ <xsd:enumeration value="nl"/>
+ <xsd:enumeration value="no"/>
+ <xsd:enumeration value="np"/>
+ <xsd:enumeration value="nr"/>
+ <xsd:enumeration value="nu"/>
+ <xsd:enumeration value="nz"/>
+ <xsd:enumeration value="om"/>
+ <xsd:enumeration value="pa"/>
+ <xsd:enumeration value="pe"/>
+ <xsd:enumeration value="pf"/>
+ <xsd:enumeration value="pg"/>
+ <xsd:enumeration value="ph"/>
+ <xsd:enumeration value="pk"/>
+ <xsd:enumeration value="pl"/>
+ <xsd:enumeration value="pm"/>
+ <xsd:enumeration value="pn"/>
+ <xsd:enumeration value="pr"/>
+ <xsd:enumeration value="pt"/>
+ <xsd:enumeration value="pw"/>
+ <xsd:enumeration value="py"/>
+ <xsd:enumeration value="qa"/>
+ <xsd:enumeration value="re"/>
+ <xsd:enumeration value="ro"/>
+ <xsd:enumeration value="ru"/>
+ <xsd:enumeration value="rw"/>
+ <xsd:enumeration value="sa"/>
+ <xsd:enumeration value="sb"/>
+ <xsd:enumeration value="sc"/>
+ <xsd:enumeration value="sd"/>
+ <xsd:enumeration value="se"/>
+ <xsd:enumeration value="sg"/>
+ <xsd:enumeration value="sh"/>
+ <xsd:enumeration value="si"/>
+ <xsd:enumeration value="sj"/>
+ <xsd:enumeration value="sk"/>
+ <xsd:enumeration value="sl"/>
+ <xsd:enumeration value="sm"/>
+ <xsd:enumeration value="sn"/>
+ <xsd:enumeration value="so"/>
+ <xsd:enumeration value="sr"/>
+ <xsd:enumeration value="st"/>
+ <xsd:enumeration value="sv"/>
+ <xsd:enumeration value="sy"/>
+ <xsd:enumeration value="sz"/>
+ <xsd:enumeration value="tc"/>
+ <xsd:enumeration value="td"/>
+ <xsd:enumeration value="tf"/>
+ <xsd:enumeration value="tg"/>
+ <xsd:enumeration value="th"/>
+ <xsd:enumeration value="tj"/>
+ <xsd:enumeration value="tm"/>
+ <xsd:enumeration value="tn"/>
+ <xsd:enumeration value="to"/>
+ <xsd:enumeration value="tp"/>
+ <xsd:enumeration value="tr"/>
+ <xsd:enumeration value="tt"/>
+ <xsd:enumeration value="tv"/>
+ <xsd:enumeration value="tw"/>
+ <xsd:enumeration value="tz"/>
+ <xsd:enumeration value="ua"/>
+ <xsd:enumeration value="ug"/>
+ <xsd:enumeration value="um"/>
+ <xsd:enumeration value="us"/>
+ <xsd:enumeration value="uy"/>
+ <xsd:enumeration value="uz"/>
+ <xsd:enumeration value="va"/>
+ <xsd:enumeration value="vc"/>
+ <xsd:enumeration value="ve"/>
+ <xsd:enumeration value="vg"/>
+ <xsd:enumeration value="vi"/>
+ <xsd:enumeration value="vn"/>
+ <xsd:enumeration value="vu"/>
+ <xsd:enumeration value="wf"/>
+ <xsd:enumeration value="ws"/>
+ <xsd:enumeration value="ye"/>
+ <xsd:enumeration value="yt"/>
+ <xsd:enumeration value="yu"/>
+ <xsd:enumeration value="za"/>
+ <xsd:enumeration value="zm"/>
+ <xsd:enumeration value="zw"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Currency">
+ <xsd:sequence>
+ <xsd:element name="CurrencyCoded" type="CurrencyCode"/>
+ <xsd:element minOccurs="0" name="CurrencyCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Currency" type="Currency"/>
+ <xsd:simpleType name="CurrencyCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AFA"/>
+ <xsd:enumeration value="DZD"/>
+ <xsd:enumeration value="ADF"/>
+ <xsd:enumeration value="ADP"/>
+ <xsd:enumeration value="ARP"/>
+ <xsd:enumeration value="ARS"/>
+ <xsd:enumeration value="ARA"/>
+ <xsd:enumeration value="AMD"/>
+ <xsd:enumeration value="AWF"/>
+ <xsd:enumeration value="AUD"/>
+ <xsd:enumeration value="ATS"/>
+ <xsd:enumeration value="AZM"/>
+ <xsd:enumeration value="BSD"/>
+ <xsd:enumeration value="BHD"/>
+ <xsd:enumeration value="BDT"/>
+ <xsd:enumeration value="BBD"/>
+ <xsd:enumeration value="BYB"/>
+ <xsd:enumeration value="BEF"/>
+ <xsd:enumeration value="BZD"/>
+ <xsd:enumeration value="BMD"/>
+ <xsd:enumeration value="BTN"/>
+ <xsd:enumeration value="BOB"/>
+ <xsd:enumeration value="BAK"/>
+ <xsd:enumeration value="BWP"/>
+ <xsd:enumeration value="BRL"/>
+ <xsd:enumeration value="BND"/>
+ <xsd:enumeration value="BGL"/>
+ <xsd:enumeration value="BIF"/>
+ <xsd:enumeration value="KHR"/>
+ <xsd:enumeration value="CAD"/>
+ <xsd:enumeration value="CVE"/>
+ <xsd:enumeration value="KYD"/>
+ <xsd:enumeration value="XOF"/>
+ <xsd:enumeration value="XAF"/>
+ <xsd:enumeration value="XPF"/>
+ <xsd:enumeration value="CLP"/>
+ <xsd:enumeration value="CLF"/>
+ <xsd:enumeration value="CNY"/>
+ <xsd:enumeration value="COP"/>
+ <xsd:enumeration value="KMF"/>
+ <xsd:enumeration value="CRC"/>
+ <xsd:enumeration value="HRK"/>
+ <xsd:enumeration value="CUP"/>
+ <xsd:enumeration value="CYP"/>
+ <xsd:enumeration value="CZK"/>
+ <xsd:enumeration value="DKK"/>
+ <xsd:enumeration value="DEM"/>
+ <xsd:enumeration value="BAD"/>
+ <xsd:enumeration value="DJF"/>
+ <xsd:enumeration value="DOP"/>
+ <xsd:enumeration value="XCD"/>
+ <xsd:enumeration value="ECS"/>
+ <xsd:enumeration value="EGP"/>
+ <xsd:enumeration value="SVC"/>
+ <xsd:enumeration value="ERN"/>
+ <xsd:enumeration value="EEK"/>
+ <xsd:enumeration value="ETB"/>
+ <xsd:enumeration value="EUR"/>
+ <xsd:enumeration value="XEU"/>
+ <xsd:enumeration value="FKP"/>
+ <xsd:enumeration value="FJD"/>
+ <xsd:enumeration value="ZAL"/>
+ <xsd:enumeration value="FIM"/>
+ <xsd:enumeration value="FRF"/>
+ <xsd:enumeration value="GMD"/>
+ <xsd:enumeration value="GEL"/>
+ <xsd:enumeration value="GHC"/>
+ <xsd:enumeration value="GIP"/>
+ <xsd:enumeration value="XAU"/>
+ <xsd:enumeration value="GRD"/>
+ <xsd:enumeration value="GTQ"/>
+ <xsd:enumeration value="GNF"/>
+ <xsd:enumeration value="GWP"/>
+ <xsd:enumeration value="GYD"/>
+ <xsd:enumeration value="HTG"/>
+ <xsd:enumeration value="HNL"/>
+ <xsd:enumeration value="HKD"/>
+ <xsd:enumeration value="HUF"/>
+ <xsd:enumeration value="ISK"/>
+ <xsd:enumeration value="INR"/>
+ <xsd:enumeration value="IDR"/>
+ <xsd:enumeration value="IRA"/>
+ <xsd:enumeration value="IRR"/>
+ <xsd:enumeration value="IQD"/>
+ <xsd:enumeration value="IEP"/>
+ <xsd:enumeration value="ILS"/>
+ <xsd:enumeration value="ITL"/>
+ <xsd:enumeration value="JMD"/>
+ <xsd:enumeration value="JPY"/>
+ <xsd:enumeration value="JOD"/>
+ <xsd:enumeration value="KZT"/>
+ <xsd:enumeration value="KES"/>
+ <xsd:enumeration value="KWD"/>
+ <xsd:enumeration value="AOR"/>
+ <xsd:enumeration value="KGS"/>
+ <xsd:enumeration value="LAK"/>
+ <xsd:enumeration value="LVL"/>
+ <xsd:enumeration value="LBP"/>
+ <xsd:enumeration value="ALL"/>
+ <xsd:enumeration value="LSL"/>
+ <xsd:enumeration value="LRD"/>
+ <xsd:enumeration value="LYD"/>
+ <xsd:enumeration value="LTL"/>
+ <xsd:enumeration value="LUF"/>
+ <xsd:enumeration value="MOP"/>
+ <xsd:enumeration value="MKD"/>
+ <xsd:enumeration value="MGF"/>
+ <xsd:enumeration value="MWK"/>
+ <xsd:enumeration value="MYR"/>
+ <xsd:enumeration value="MVR"/>
+ <xsd:enumeration value="MTL"/>
+ <xsd:enumeration value="MRO"/>
+ <xsd:enumeration value="MUR"/>
+ <xsd:enumeration value="MXN"/>
+ <xsd:enumeration value="MDL"/>
+ <xsd:enumeration value="MNT"/>
+ <xsd:enumeration value="MAD"/>
+ <xsd:enumeration value="MZM"/>
+ <xsd:enumeration value="BOV"/>
+ <xsd:enumeration value="MMK"/>
+ <xsd:enumeration value="NAD"/>
+ <xsd:enumeration value="NPR"/>
+ <xsd:enumeration value="ANG"/>
+ <xsd:enumeration value="AWG"/>
+ <xsd:enumeration value="NLG"/>
+ <xsd:enumeration value="AON"/>
+ <xsd:enumeration value="TWD"/>
+ <xsd:enumeration value="ZRN"/>
+ <xsd:enumeration value="NZD"/>
+ <xsd:enumeration value="NIO"/>
+ <xsd:enumeration value="NGN"/>
+ <xsd:enumeration value="KPW"/>
+ <xsd:enumeration value="NOK"/>
+ <xsd:enumeration value="PKR"/>
+ <xsd:enumeration value="PAB"/>
+ <xsd:enumeration value="PGK"/>
+ <xsd:enumeration value="PYG"/>
+ <xsd:enumeration value="PEN"/>
+ <xsd:enumeration value="PHP"/>
+ <xsd:enumeration value="PLN"/>
+ <xsd:enumeration value="PLZ"/>
+ <xsd:enumeration value="PTE"/>
+ <xsd:enumeration value="GBP"/>
+ <xsd:enumeration value="QAR"/>
+ <xsd:enumeration value="OMR"/>
+ <xsd:enumeration value="ROL"/>
+ <xsd:enumeration value="RUR"/>
+ <xsd:enumeration value="RWF"/>
+ <xsd:enumeration value="WST"/>
+ <xsd:enumeration value="STD"/>
+ <xsd:enumeration value="SAR"/>
+ <xsd:enumeration value="SBL"/>
+ <xsd:enumeration value="SCR"/>
+ <xsd:enumeration value="SLL"/>
+ <xsd:enumeration value="SGD"/>
+ <xsd:enumeration value="SKK"/>
+ <xsd:enumeration value="SIT"/>
+ <xsd:enumeration value="SBD"/>
+ <xsd:enumeration value="SOS"/>
+ <xsd:enumeration value="ZAR"/>
+ <xsd:enumeration value="KRW"/>
+ <xsd:enumeration value="ESP"/>
+ <xsd:enumeration value="LKR"/>
+ <xsd:enumeration value="SHP"/>
+ <xsd:enumeration value="SDA"/>
+ <xsd:enumeration value="SDD"/>
+ <xsd:enumeration value="SDP"/>
+ <xsd:enumeration value="SRG"/>
+ <xsd:enumeration value="SZL"/>
+ <xsd:enumeration value="SEK"/>
+ <xsd:enumeration value="CHF"/>
+ <xsd:enumeration value="SYP"/>
+ <xsd:enumeration value="TJR"/>
+ <xsd:enumeration value="TZS"/>
+ <xsd:enumeration value="THB"/>
+ <xsd:enumeration value="TPE"/>
+ <xsd:enumeration value="TOP"/>
+ <xsd:enumeration value="TTD"/>
+ <xsd:enumeration value="TND"/>
+ <xsd:enumeration value="TRL"/>
+ <xsd:enumeration value="TMM"/>
+ <xsd:enumeration value="USD"/>
+ <xsd:enumeration value="AED"/>
+ <xsd:enumeration value="UGX"/>
+ <xsd:enumeration value="UAH"/>
+ <xsd:enumeration value="ECV"/>
+ <xsd:enumeration value="UYU"/>
+ <xsd:enumeration value="USN"/>
+ <xsd:enumeration value="UZS"/>
+ <xsd:enumeration value="VUV"/>
+ <xsd:enumeration value="VEB"/>
+ <xsd:enumeration value="VND"/>
+ <xsd:enumeration value="YER"/>
+ <xsd:enumeration value="YUN"/>
+ <xsd:enumeration value="ZMK"/>
+ <xsd:enumeration value="ZWD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderConfirmationParty">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="BuyerParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SellerParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShipToParty">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfPartyCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationParty" type="OrderConfirmationParty"/>
+ <xsd:complexType name="Party">
+ <xsd:sequence>
+ <xsd:element name="PartyID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfIdentifier"/>
+ <xsd:element minOccurs="0" name="MDFBusiness" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" ref="NameAddress"/>
+ <xsd:element minOccurs="0" name="OrderContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ReceivingContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShippingContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OtherContacts">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfContact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CorrespondenceLanguage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Language"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Party" type="Party"/>
+ <xsd:complexType name="Identifier">
+ <xsd:sequence>
+ <xsd:element ref="Agency"/>
+ <xsd:element name="Ident" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Identifier" type="Identifier"/>
+ <xsd:complexType name="Agency">
+ <xsd:sequence>
+ <xsd:element name="AgencyCoded" type="AgencyCode"/>
+ <xsd:element minOccurs="0" name="AgencyCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AgencyDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeListIdentifierCoded" type="CodeListIdentifierCode"/>
+ <xsd:element minOccurs="0" name="CodeListIdentifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Agency" type="Agency"/>
+ <xsd:simpleType name="AgencyCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AAMVA"/>
+ <xsd:enumeration value="ABCD-TheMicrocomputerIndustryAssociation"/>
+ <xsd:enumeration value="ACGIH"/>
+ <xsd:enumeration value="ACORD"/>
+ <xsd:enumeration value="AdvertisingIndustry"/>
+ <xsd:enumeration value="AECMA"/>
+ <xsd:enumeration value="AIHA"/>
+ <xsd:enumeration value="AirTransportAssociationOfAmerica"/>
+ <xsd:enumeration value="Alabama"/>
+ <xsd:enumeration value="Alaska"/>
+ <xsd:enumeration value="AluminumAssociation"/>
+ <xsd:enumeration value="AmericanApparelManufacturersAssociation"/>
+ <xsd:enumeration value="AmericanFurnitureManufacturersAssociation"/>
+ <xsd:enumeration value="AmericanIronAndSteelInstitute"/>
+ <xsd:enumeration value="AmericanLandTitleAssociation"/>
+ <xsd:enumeration value="AmericanMedicalAssociation"/>
+ <xsd:enumeration value="AmericanPaperInstitute"/>
+ <xsd:enumeration value="AmericanPetroleumInstitute"/>
+ <xsd:enumeration value="APWAAndOCSI"/>
+ <xsd:enumeration value="AmericanSocietyForAutomationInPharmacy"/>
+ <xsd:enumeration value="AmericanTextileManufacturersInstitute"/>
+ <xsd:enumeration value="AmericanTruckingAssociations"/>
+ <xsd:enumeration value="ANSIAccreditedStandardsCommittee"/>
+ <xsd:enumeration value="Arizona"/>
+ <xsd:enumeration value="Arkansas"/>
+ <xsd:enumeration value="ASME"/>
+ <xsd:enumeration value="AssignedByBuyerOrBuyersAgent"/>
+ <xsd:enumeration value="AssignedByCarrier"/>
+ <xsd:enumeration value="AssignedByDistributor"/>
+ <xsd:enumeration value="AssignedByManufacturer"/>
+ <xsd:enumeration value="AssignedByMarketPlace"/>
+ <xsd:enumeration value="AssignedByNationalTradeAgency"/>
+ <xsd:enumeration value="AssignedByOwnerOfOperation"/>
+ <xsd:enumeration value="AssignedByPartyOriginatingTheMessage"/>
+ <xsd:enumeration value="AssignedBySellerOrSellersAgent"/>
+ <xsd:enumeration value="AssignedByTransportCompany"/>
+ <xsd:enumeration value="ASTM"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="AT-GeldausgabeautomatenServiceGesellschaftMBH"/>
+ <xsd:enumeration value="AT-AustrianCustoms"/>
+ <xsd:enumeration value="AT-AustrianPTT"/>
+ <xsd:enumeration value="AT-VerbandOesterreichischerBankenUndBankiers"/>
+ <xsd:enumeration value="AU-ACOS"/>
+ <xsd:enumeration value="AU-ADA"/>
+ <xsd:enumeration value="AU-AIHW"/>
+ <xsd:enumeration value="AU-APCA"/>
+ <xsd:enumeration value="AU-AQIS"/>
+ <xsd:enumeration value="AU-AustrianCustomsService"/>
+ <xsd:enumeration value="AU-DOH"/>
+ <xsd:enumeration value="AU-HIC"/>
+ <xsd:enumeration value="AU-LIFA"/>
+ <xsd:enumeration value="AU-NCCH"/>
+ <xsd:enumeration value="AU-ROA"/>
+ <xsd:enumeration value="AU-SAA"/>
+ <xsd:enumeration value="AU-Tradegate"/>
+ <xsd:enumeration value="AWS"/>
+ <xsd:enumeration value="AYSA"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BE-BelgianBankersAssociation"/>
+ <xsd:enumeration value="BE-BelgianCustoms"/>
+ <xsd:enumeration value="BE-BelgianMinistryOfFinance"/>
+ <xsd:enumeration value="Bellcore"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BIC"/>
+ <xsd:enumeration value="BookIndustrySystemsAdvisoryCommittee"/>
+ <xsd:enumeration value="BR-BancoCentralDoBrazil"/>
+ <xsd:enumeration value="BR-MAAndRAAAndLIMNETAndRINET"/>
+ <xsd:enumeration value="CA-CPA"/>
+ <xsd:enumeration value="CA-CSIO"/>
+ <xsd:enumeration value="California"/>
+ <xsd:enumeration value="CaliforniaLandTitleAssociation"/>
+ <xsd:enumeration value="CanadianFreightClassification"/>
+ <xsd:enumeration value="CarbideManufacturers"/>
+ <xsd:enumeration value="CA-RevenueCanadaCustomsAndExcise"/>
+ <xsd:enumeration value="CAS"/>
+ <xsd:enumeration value="CA-SCC"/>
+ <xsd:enumeration value="CCC"/>
+ <xsd:enumeration value="CEC"/>
+ <xsd:enumeration value="CECDGXIIID5"/>
+ <xsd:enumeration value="CECDGXXI01"/>
+ <xsd:enumeration value="CECDGXXIB1"/>
+ <xsd:enumeration value="CECDGXXXIV"/>
+ <xsd:enumeration value="CEFIC"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CH-AdministrationFederaleDesContributions"/>
+ <xsd:enumeration value="CH-AssociationSuisseCodeDesArticles"/>
+ <xsd:enumeration value="CH-Carbura"/>
+ <xsd:enumeration value="CH-CentraleSuissePourLImportationDuCharbon"/>
+ <xsd:enumeration value="CH-DirectionGeneraleDesDouanes"/>
+ <xsd:enumeration value="CH-DivisionDesImportationsEtExportations"/>
+ <xsd:enumeration value="CH-EntrepriseDesPTT"/>
+ <xsd:enumeration value="CH-MinistryOfTaxationCentralCustomsAndTaxAdministration"/>
+ <xsd:enumeration value="CH-OfficeFiduciaireDesImportateursDeDenreesAlimentaires"/>
+ <xsd:enumeration value="CH-SwissSecuritiesClearingCorporation"/>
+ <xsd:enumeration value="CH-TelekursAG"/>
+ <xsd:enumeration value="CIDX"/>
+ <xsd:enumeration value="CIECA"/>
+ <xsd:enumeration value="CodeAssignedByTheOrganizationThatIsTheUltimateDestinationOfTheTransactionSet"/>
+ <xsd:enumeration value="CO-DIAN"/>
+ <xsd:enumeration value="Colorado"/>
+ <xsd:enumeration value="CommanderRomeAirDevelopmentCenter"/>
+ <xsd:enumeration value="ConcordEDIGroup"/>
+ <xsd:enumeration value="Connecticut"/>
+ <xsd:enumeration value="ConventionsOnSADAndTransit"/>
+ <xsd:enumeration value="CopperAndBrassFabricatorsCouncil"/>
+ <xsd:enumeration value="CO-SBDC"/>
+ <xsd:enumeration value="CountyDesignatorCode"/>
+ <xsd:enumeration value="CSI"/>
+ <xsd:enumeration value="CSIExtended"/>
+ <xsd:enumeration value="CUSIP"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DE-ARE"/>
+ <xsd:enumeration value="DE-BDI"/>
+ <xsd:enumeration value="DE-BIA"/>
+ <xsd:enumeration value="DE-BRD"/>
+ <xsd:enumeration value="DE-DIN"/>
+ <xsd:enumeration value="DE-DTAG"/>
+ <xsd:enumeration value="DE-EDIBAU"/>
+ <xsd:enumeration value="DefenseLogisticsAgency"/>
+ <xsd:enumeration value="DE-GDV"/>
+ <xsd:enumeration value="DE-GermanBankersAssociation"/>
+ <xsd:enumeration value="DE-GermanCustoms"/>
+ <xsd:enumeration value="DE-GMBH"/>
+ <xsd:enumeration value="Delaware"/>
+ <xsd:enumeration value="DepartmentOfAirForce"/>
+ <xsd:enumeration value="DepartmentOfArmy"/>
+ <xsd:enumeration value="DepartmentOfDefense"/>
+ <xsd:enumeration value="DepartmentOfHealthAndHumanServices"/>
+ <xsd:enumeration value="DepartmentOfHousingAndUrbanDevelopment"/>
+ <xsd:enumeration value="DepartmentOfLabor"/>
+ <xsd:enumeration value="DepartmentOfTheNavy"/>
+ <xsd:enumeration value="DE-SiemensAG"/>
+ <xsd:enumeration value="DE-VDA"/>
+ <xsd:enumeration value="DFAS"/>
+ <xsd:enumeration value="DIN"/>
+ <xsd:enumeration value="DirectionGeneraleDesDouanesEtDroitsIndirects"/>
+ <xsd:enumeration value="DistrictOfColumbia"/>
+ <xsd:enumeration value="DK"/>
+ <xsd:enumeration value="DK-EAN"/>
+ <xsd:enumeration value="DK-MHA"/>
+ <xsd:enumeration value="DK-NBH"/>
+ <xsd:enumeration value="DK-PBS"/>
+ <xsd:enumeration value="DunAndBradstreet"/>
+ <xsd:enumeration value="EAN"/>
+ <xsd:enumeration value="Edibuild"/>
+ <xsd:enumeration value="EdielNordicForum"/>
+ <xsd:enumeration value="EDIFICE"/>
+ <xsd:enumeration value="EDITEUR"/>
+ <xsd:enumeration value="EDITEX"/>
+ <xsd:enumeration value="EEG7"/>
+ <xsd:enumeration value="EIDX"/>
+ <xsd:enumeration value="ElectricUtilities"/>
+ <xsd:enumeration value="ElectronicIndustriesAssociation"/>
+ <xsd:enumeration value="EPA"/>
+ <xsd:enumeration value="ES"/>
+ <xsd:enumeration value="ESDX"/>
+ <xsd:enumeration value="ES-ODETT"/>
+ <xsd:enumeration value="ES-SpanishCustoms"/>
+ <xsd:enumeration value="EU-EDIFICAS"/>
+ <xsd:enumeration value="EU-ETIS"/>
+ <xsd:enumeration value="EU-ROFER"/>
+ <xsd:enumeration value="FASLINC"/>
+ <xsd:enumeration value="FCC"/>
+ <xsd:enumeration value="FCI"/>
+ <xsd:enumeration value="FDA"/>
+ <xsd:enumeration value="FederalGovernment"/>
+ <xsd:enumeration value="FederalHighwayAdministration"/>
+ <xsd:enumeration value="FI"/>
+ <xsd:enumeration value="FI-ATA"/>
+ <xsd:enumeration value="FI-FinnishCustoms"/>
+ <xsd:enumeration value="FI-TB"/>
+ <xsd:enumeration value="FI-TheFinnishBankersAssociation"/>
+ <xsd:enumeration value="Florida"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="FR-AGF"/>
+ <xsd:enumeration value="FR-ArvA"/>
+ <xsd:enumeration value="FR-BanqueDeFrance"/>
+ <xsd:enumeration value="FR-CFONB"/>
+ <xsd:enumeration value="FR-CNAMTS"/>
+ <xsd:enumeration value="FR-DCP"/>
+ <xsd:enumeration value="FR-DGI"/>
+ <xsd:enumeration value="FR-EDIFCAS"/>
+ <xsd:enumeration value="FR-EDIFRANCE"/>
+ <xsd:enumeration value="FR-EDITRANSPORT"/>
+ <xsd:enumeration value="FR-GALIA"/>
+ <xsd:enumeration value="FR-GENCOD"/>
+ <xsd:enumeration value="FR-INSEE"/>
+ <xsd:enumeration value="FR-RC"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GB-ABI"/>
+ <xsd:enumeration value="GB-ABTA"/>
+ <xsd:enumeration value="GB-ArticleNumberAssociationLimited"/>
+ <xsd:enumeration value="GB-AssociationForPaymentClearingServices"/>
+ <xsd:enumeration value="GB-BACSLimited"/>
+ <xsd:enumeration value="GB-CHAPSAndTownClearingCompanyLimited"/>
+ <xsd:enumeration value="GB-FLEETNET"/>
+ <xsd:enumeration value="GB-HMCustomsAndExcise"/>
+ <xsd:enumeration value="GB-ODETTE"/>
+ <xsd:enumeration value="GB-TheClearingHouse"/>
+ <xsd:enumeration value="Georgia"/>
+ <xsd:enumeration value="GraphicsCommunicationsAssociation"/>
+ <xsd:enumeration value="GRE"/>
+ <xsd:enumeration value="GR-GreekCustoms"/>
+ <xsd:enumeration value="GSA"/>
+ <xsd:enumeration value="GTIN"/>
+ <xsd:enumeration value="Hawaii"/>
+ <xsd:enumeration value="HealthCareFinancingAdministration"/>
+ <xsd:enumeration value="HealthInsuranceAssociationOfAmerica"/>
+ <xsd:enumeration value="HK-HongKongCustoms"/>
+ <xsd:enumeration value="HU"/>
+ <xsd:enumeration value="IAPSO"/>
+ <xsd:enumeration value="IARC"/>
+ <xsd:enumeration value="IATA"/>
+ <xsd:enumeration value="ICAO"/>
+ <xsd:enumeration value="ICC"/>
+ <xsd:enumeration value="ICS"/>
+ <xsd:enumeration value="Idaho"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IE-RevenueCommissionersCustomsAEProject"/>
+ <xsd:enumeration value="IL-IsraelCustoms"/>
+ <xsd:enumeration value="Illinois"/>
+ <xsd:enumeration value="IMO"/>
+ <xsd:enumeration value="Indiana"/>
+ <xsd:enumeration value="InterContainerInterFrigo"/>
+ <xsd:enumeration value="InternationalAssociationOfCorporationAdministrators"/>
+ <xsd:enumeration value="InternationalAssociationOfIndustrialAccidentBoardsAndCommissions"/>
+ <xsd:enumeration value="InternationalStandardsOrganization"/>
+ <xsd:enumeration value="Iowa"/>
+ <xsd:enumeration value="IP"/>
+ <xsd:enumeration value="IronAndSteelStandardsCommitteeISM"/>
+ <xsd:enumeration value="IS-IcelandCustoms"/>
+ <xsd:enumeration value="ISO"/>
+ <xsd:enumeration value="InsuranceServicesOffice"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="IT-AssociazioneBancariaItaliana"/>
+ <xsd:enumeration value="IT-ItalianCustoms"/>
+ <xsd:enumeration value="IT-ODETTE"/>
+ <xsd:enumeration value="IT-SocieataInterbancariaPerLAutomazione"/>
+ <xsd:enumeration value="JapaneseStandardsAssociation"/>
+ <xsd:enumeration value="JP-JapanCustoms"/>
+ <xsd:enumeration value="JP-MOT"/>
+ <xsd:enumeration value="JP-MSA"/>
+ <xsd:enumeration value="JP-NACCS"/>
+ <xsd:enumeration value="Kansas"/>
+ <xsd:enumeration value="Kentucky"/>
+ <xsd:enumeration value="LeasingIndustry"/>
+ <xsd:enumeration value="LifeAndAnnuityIndustryCommittee"/>
+ <xsd:enumeration value="LI-LiechtensteinAuthority"/>
+ <xsd:enumeration value="LloydsRegisterOfShipping"/>
+ <xsd:enumeration value="Louisiana"/>
+ <xsd:enumeration value="LU"/>
+ <xsd:enumeration value="LU-LuxembourgCustoms"/>
+ <xsd:enumeration value="Maine"/>
+ <xsd:enumeration value="ManufacturingCompany"/>
+ <xsd:enumeration value="Maryland"/>
+ <xsd:enumeration value="Massachusetts"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetProvider"/>
+ <xsd:enumeration value="Michigan"/>
+ <xsd:enumeration value="MilitaryStandard"/>
+ <xsd:enumeration value="Minnesota"/>
+ <xsd:enumeration value="Mississippi"/>
+ <xsd:enumeration value="Missouri"/>
+ <xsd:enumeration value="Montana"/>
+ <xsd:enumeration value="MortgageBankersAssociationOfAmerica"/>
+ <xsd:enumeration value="MY-DagangNet"/>
+ <xsd:enumeration value="MY-MalaysiaCentralBank"/>
+ <xsd:enumeration value="MY-MalaysiaCustomsAndExcise"/>
+ <xsd:enumeration value="NACE"/>
+ <xsd:enumeration value="NAGS"/>
+ <xsd:enumeration value="NationalAlcoholBeverageControlAssociation"/>
+ <xsd:enumeration value="NationalAssociationOfBusinessAndEducationalRadio"/>
+ <xsd:enumeration value="NationalBusinessFormsAssociation"/>
+ <xsd:enumeration value="NationalCenterforStateCourts"/>
+ <xsd:enumeration value="NationalCottonCouncilOfAmerica"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsurance"/>
+ <xsd:enumeration value="NationalRetailMerchantsAssociation"/>
+ <xsd:enumeration value="NationalWholesaleDruggistsAssociation"/>
+ <xsd:enumeration value="NATO"/>
+ <xsd:enumeration value="NaturalGasUtilities"/>
+ <xsd:enumeration value="NCIC"/>
+ <xsd:enumeration value="Nebraska"/>
+ <xsd:enumeration value="NEMA"/>
+ <xsd:enumeration value="Nevada"/>
+ <xsd:enumeration value="NewHampshire"/>
+ <xsd:enumeration value="NewJersey"/>
+ <xsd:enumeration value="NewMexico"/>
+ <xsd:enumeration value="NewspaperAssociationOfAmerica"/>
+ <xsd:enumeration value="NewYork"/>
+ <xsd:enumeration value="NFPA"/>
+ <xsd:enumeration value="NICB"/>
+ <xsd:enumeration value="NIOSH"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NetherlandsRailways"/>
+ <xsd:enumeration value="NL-BankGirocentraleBV"/>
+ <xsd:enumeration value="NL-BEANETBV"/>
+ <xsd:enumeration value="NL-EAN"/>
+ <xsd:enumeration value="NL-InterpayCards"/>
+ <xsd:enumeration value="NL-InterpayGiraal"/>
+ <xsd:enumeration value="NL-NetherlandsCustoms"/>
+ <xsd:enumeration value="NL-ODETTE"/>
+ <xsd:enumeration value="NorweigianStateRailway"/>
+ <xsd:enumeration value="NO"/>
+ <xsd:enumeration value="NO-NORPRO"/>
+ <xsd:enumeration value="NO-NorwegianBankersAssociation"/>
+ <xsd:enumeration value="NO-NorwegianCustoms"/>
+ <xsd:enumeration value="NO-NorwegianInterbankResearchOrganization"/>
+ <xsd:enumeration value="NorthAmerica-TelecommunicationsIndustryForum"/>
+ <xsd:enumeration value="NorthCarolina"/>
+ <xsd:enumeration value="NorthDakota"/>
+ <xsd:enumeration value="NTP"/>
+ <xsd:enumeration value="NZ-NewZealandCustoms"/>
+ <xsd:enumeration value="ODETTE"/>
+ <xsd:enumeration value="OfficeOfManagementAndBudget"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationPrograms"/>
+ <xsd:enumeration value="OfficeProducts"/>
+ <xsd:enumeration value="Ohio"/>
+ <xsd:enumeration value="Oklahoma"/>
+ <xsd:enumeration value="OpticalIndustry"/>
+ <xsd:enumeration value="Oregon"/>
+ <xsd:enumeration value="OSHA"/>
+ <xsd:enumeration value="Pennsylvania"/>
+ <xsd:enumeration value="PennsylvaniaCourts"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PT-CB"/>
+ <xsd:enumeration value="PT-PortugueseCustoms"/>
+ <xsd:enumeration value="PT-SIBS"/>
+ <xsd:enumeration value="RealEstateInformationIndustry"/>
+ <xsd:enumeration value="RhodeIsland"/>
+ <xsd:enumeration value="RINET"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RU-BIC"/>
+ <xsd:enumeration value="RU-SFT"/>
+ <xsd:enumeration value="SAE"/>
+ <xsd:enumeration value="SA-SaudiArabiaCustoms"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SE-CentralBank"/>
+ <xsd:enumeration value="SE-ODETTE"/>
+ <xsd:enumeration value="SE-SvenskaBankfoereningen"/>
+ <xsd:enumeration value="SE-SwedishCustoms"/>
+ <xsd:enumeration value="ShippersAssociation"/>
+ <xsd:enumeration value="SISAC"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SouthCarolina"/>
+ <xsd:enumeration value="SouthDakota"/>
+ <xsd:enumeration value="StateAgencyAssigned"/>
+ <xsd:enumeration value="StudentLoanGuarantor"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="TALC"/>
+ <xsd:enumeration value="TelecommunicationsIndustry"/>
+ <xsd:enumeration value="TemporaryHelpIndustry"/>
+ <xsd:enumeration value="Tennessee"/>
+ <xsd:enumeration value="Texas"/>
+ <xsd:enumeration value="TexasLandTitleAssociation"/>
+ <xsd:enumeration value="TextileDistributorsAssociationInc"/>
+ <xsd:enumeration value="TDCC-EDIA"/>
+ <xsd:enumeration value="TW-ChineseTaipeiCustoms"/>
+ <xsd:enumeration value="TW-Trade-van"/>
+ <xsd:enumeration value="UCS"/>
+ <xsd:enumeration value="UIC"/>
+ <xsd:enumeration value="UN"/>
+ <xsd:enumeration value="UNECE"/>
+ <xsd:enumeration value="UNCTAD"/>
+ <xsd:enumeration value="UnitedStatesCourts"/>
+ <xsd:enumeration value="UnitedStatesMarineCorps"/>
+ <xsd:enumeration value="UnitedStatesNuclearRegulatoryCommission"/>
+ <xsd:enumeration value="UPU"/>
+ <xsd:enumeration value="US-AA"/>
+ <xsd:enumeration value="US-AAR"/>
+ <xsd:enumeration value="US-ABA"/>
+ <xsd:enumeration value="US-AIAG"/>
+ <xsd:enumeration value="US-AirTransportAssociationOfAmerica"/>
+ <xsd:enumeration value="US-AISI"/>
+ <xsd:enumeration value="US-AmericanPetroleumInstitute"/>
+ <xsd:enumeration value="US-ANSIASCX12"/>
+ <xsd:enumeration value="US-API"/>
+ <xsd:enumeration value="US-ASTM"/>
+ <xsd:enumeration value="US-ATF"/>
+ <xsd:enumeration value="US-BATF"/>
+ <xsd:enumeration value="US-BXA"/>
+ <xsd:enumeration value="US-CHIPS"/>
+ <xsd:enumeration value="US-CIDX"/>
+ <xsd:enumeration value="US-CM"/>
+ <xsd:enumeration value="US-COPAS"/>
+ <xsd:enumeration value="US-DAndB"/>
+ <xsd:enumeration value="US-DCI"/>
+ <xsd:enumeration value="US-DEA"/>
+ <xsd:enumeration value="US-DHHS"/>
+ <xsd:enumeration value="US-DISA"/>
+ <xsd:enumeration value="US-DISCUS"/>
+ <xsd:enumeration value="US-DLMSO"/>
+ <xsd:enumeration value="US-DOA"/>
+ <xsd:enumeration value="US-DOD"/>
+ <xsd:enumeration value="US-DODAAC"/>
+ <xsd:enumeration value="US-DOL"/>
+ <xsd:enumeration value="US-DOT"/>
+ <xsd:enumeration value="US-DSAA"/>
+ <xsd:enumeration value="US-EIA"/>
+ <xsd:enumeration value="US-FCC"/>
+ <xsd:enumeration value="US-FDA"/>
+ <xsd:enumeration value="US-FIPS"/>
+ <xsd:enumeration value="US-FMC"/>
+ <xsd:enumeration value="US-FWS"/>
+ <xsd:enumeration value="US-GSA"/>
+ <xsd:enumeration value="US-HBICC"/>
+ <xsd:enumeration value="US-HI"/>
+ <xsd:enumeration value="US-HL7"/>
+ <xsd:enumeration value="US-ISA"/>
+ <xsd:enumeration value="US-MARAD"/>
+ <xsd:enumeration value="US-NABCA"/>
+ <xsd:enumeration value="US-NAIC"/>
+ <xsd:enumeration value="USNationalCenterForHealthStatisticsCommissionOfProfessionalAndHospitalActivities"/>
+ <xsd:enumeration value="US-NationalMotorFreightClassificationAssociation"/>
+ <xsd:enumeration value="US-NationalRetailFederation"/>
+ <xsd:enumeration value="US-NCCMA"/>
+ <xsd:enumeration value="US-NIST"/>
+ <xsd:enumeration value="US-NRC"/>
+ <xsd:enumeration value="US-NWDA"/>
+ <xsd:enumeration value="US-ODTC"/>
+ <xsd:enumeration value="US-OFAC"/>
+ <xsd:enumeration value="US-OMB"/>
+ <xsd:enumeration value="US-StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="US-TDCC"/>
+ <xsd:enumeration value="US-UCC"/>
+ <xsd:enumeration value="US-UN-SPSC"/>
+ <xsd:enumeration value="US-UOP"/>
+ <xsd:enumeration value="US-USCensusBureau"/>
+ <xsd:enumeration value="US-USCustomsService"/>
+ <xsd:enumeration value="US-USPS"/>
+ <xsd:enumeration value="US-VA"/>
+ <xsd:enumeration value="US-VICS"/>
+ <xsd:enumeration value="US-WSSA"/>
+ <xsd:enumeration value="Utah"/>
+ <xsd:enumeration value="UtilityIndustryGroup"/>
+ <xsd:enumeration value="Vermont"/>
+ <xsd:enumeration value="VICS"/>
+ <xsd:enumeration value="Virginia"/>
+ <xsd:enumeration value="Washington"/>
+ <xsd:enumeration value="WestVirginia"/>
+ <xsd:enumeration value="WHMIS"/>
+ <xsd:enumeration value="Wisconsin"/>
+ <xsd:enumeration value="Wyoming"/>
+ <xsd:enumeration value="DirectorGeneralOfCanada"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="CodeListIdentifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceSiteCode"/>
+ <xsd:enumeration value="AccidentParameters"/>
+ <xsd:enumeration value="AccordEuropeenRelatifAuTransportInternationalDesMarchandises"/>
+ <xsd:enumeration value="AccountAnalysisCodes"/>
+ <xsd:enumeration value="AccountCharacteristicsCode"/>
+ <xsd:enumeration value="AccountingInformationIdentifier"/>
+ <xsd:enumeration value="AccountRating"/>
+ <xsd:enumeration value="AccountRelationshipType"/>
+ <xsd:enumeration value="AcquisitionAdviceCode"/>
+ <xsd:enumeration value="AcquisitionMethodCode"/>
+ <xsd:enumeration value="AcquisitionMethodSuffixCode"/>
+ <xsd:enumeration value="ActionCode"/>
+ <xsd:enumeration value="ActivitePrincipaleExerceeCode"/>
+ <xsd:enumeration value="Activity"/>
+ <xsd:enumeration value="AdmittingDiagnosis"/>
+ <xsd:enumeration value="AdverseEventCode"/>
+ <xsd:enumeration value="AdverseEventOutcomeCode"/>
+ <xsd:enumeration value="AdviceCode"/>
+ <xsd:enumeration value="AgentStatusCode"/>
+ <xsd:enumeration value="AidTypeCode"/>
+ <xsd:enumeration value="AirCarrier"/>
+ <xsd:enumeration value="AirCommodityAndSpecialHandlingCode"/>
+ <xsd:enumeration value="AircraftMissionDesignSeriesCode"/>
+ <xsd:enumeration value="AirDimensionCode"/>
+ <xsd:enumeration value="AirportOrCity"/>
+ <xsd:enumeration value="AirportTerminal"/>
+ <xsd:enumeration value="AirTerminalIdentifierCode"/>
+ <xsd:enumeration value="AllegationTypeCode"/>
+ <xsd:enumeration value="AllPatientDiagnosisRelatedGroups"/>
+ <xsd:enumeration value="AllPatientRefinedDiagnosisRelatedGroups"/>
+ <xsd:enumeration value="AlterationLookup"/>
+ <xsd:enumeration value="AmbulatoryPatientGroups"/>
+ <xsd:enumeration value="AmendmentCode-Customs"/>
+ <xsd:enumeration value="AmericanPsychiatricAssociationDiagnosticStatisticalManualOfMentalDisorders"/>
+ <xsd:enumeration value="AmericanSocietyForTestingAndMaterials"/>
+ <xsd:enumeration value="AntennaPolarization"/>
+ <xsd:enumeration value="AntennaStructureType"/>
+ <xsd:enumeration value="ApplicantClassificationType"/>
+ <xsd:enumeration value="ApplicantType"/>
+ <xsd:enumeration value="ApplicationAcknowledgementAndErrorCodes"/>
+ <xsd:enumeration value="ApplicationErrorCode"/>
+ <xsd:enumeration value="ApplicationQuestionIdentifier"/>
+ <xsd:enumeration value="ApplicationType"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="AreaOfOperation"/>
+ <xsd:enumeration value="ArrestReason"/>
+ <xsd:enumeration value="ArticleStatus"/>
+ <xsd:enumeration value="AssetDetails"/>
+ <xsd:enumeration value="AssetRecurrence"/>
+ <xsd:enumeration value="AssetStatusOrTransactionReportingCode"/>
+ <xsd:enumeration value="AssetTransferStatusCode"/>
+ <xsd:enumeration value="AssetType"/>
+ <xsd:enumeration value="AssignedByReceiver"/>
+ <xsd:enumeration value="AssignedBySender"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsDeprescriptionDistributionList"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsDeprescriptionExceptionList"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsRateEdiNetworkErrorCode"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsStandardTransportationCommodityCodeDescriptionQualifier"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsStandardTransportationCommodityCodeMasterDescriptionInformation"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsSwitchReleaseCodes"/>
+ <xsd:enumeration value="AssuredDeliveryIndicator"/>
+ <xsd:enumeration value="AuthorizationType"/>
+ <xsd:enumeration value="AutomatedClearingHouse"/>
+ <xsd:enumeration value="AutomatedDataProcessingEquipmentIdentificationCode"/>
+ <xsd:enumeration value="AwardSource"/>
+ <xsd:enumeration value="BalanceTypeCode"/>
+ <xsd:enumeration value="BankAdministrationInstitute"/>
+ <xsd:enumeration value="BankBranchSortingIdentification"/>
+ <xsd:enumeration value="BankIdentification"/>
+ <xsd:enumeration value="BankSecuritiesCode"/>
+ <xsd:enumeration value="BasisOfJurisdictionCode"/>
+ <xsd:enumeration value="BeneficiaryType"/>
+ <xsd:enumeration value="BidRejectionReason"/>
+ <xsd:enumeration value="BilledOfficeIndicatorCode"/>
+ <xsd:enumeration value="BillingAdviceCode"/>
+ <xsd:enumeration value="BillingStatusCode"/>
+ <xsd:enumeration value="BillOfLadingClauses"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyPartLookup"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyResponsibilityLookup"/>
+ <xsd:enumeration value="BoardOfInspectionAndSurveyShipLookup"/>
+ <xsd:enumeration value="BusinessAccountNumber"/>
+ <xsd:enumeration value="BusinessChangeCode"/>
+ <xsd:enumeration value="BusinessClassification"/>
+ <xsd:enumeration value="BusinessCreditRating"/>
+ <xsd:enumeration value="BusinessEntityFilingDetailCode"/>
+ <xsd:enumeration value="BusinessEntityFilingLocationCode"/>
+ <xsd:enumeration value="BusinessEntityFilingReportTypeCode"/>
+ <xsd:enumeration value="BusinessEntityFilingSecuritiesInformationCode"/>
+ <xsd:enumeration value="BusinessEntityFilingStatusCode"/>
+ <xsd:enumeration value="BusinessEntityFinancialInformationCode"/>
+ <xsd:enumeration value="BusinessEntityStatusCode"/>
+ <xsd:enumeration value="BusinessFunction"/>
+ <xsd:enumeration value="BusinessLegalStructureType"/>
+ <xsd:enumeration value="BusinessSizeCode"/>
+ <xsd:enumeration value="BusinessType"/>
+ <xsd:enumeration value="CallSignDirectory"/>
+ <xsd:enumeration value="CanadianInterEdi"/>
+ <xsd:enumeration value="CancellationReason"/>
+ <xsd:enumeration value="Carriers"/>
+ <xsd:enumeration value="CaseDesignatorNumber"/>
+ <xsd:enumeration value="CaseOriginCode"/>
+ <xsd:enumeration value="CashDiscountStipulationCode"/>
+ <xsd:enumeration value="CauseLookup"/>
+ <xsd:enumeration value="CauseOfInjuryCode"/>
+ <xsd:enumeration value="CauseOfLossCode"/>
+ <xsd:enumeration value="CeilingTypeCode"/>
+ <xsd:enumeration value="CertificationRequirementsCode"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="CitizenIdentification"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="CitySubdivision"/>
+ <xsd:enumeration value="ClaimPaymentRemarkCodes"/>
+ <xsd:enumeration value="ClaimType"/>
+ <xsd:enumeration value="ClassOfOperation"/>
+ <xsd:enumeration value="ClassOfPitch"/>
+ <xsd:enumeration value="ClauseStatusType"/>
+ <xsd:enumeration value="ClearingCode"/>
+ <xsd:enumeration value="ClearingHouseAutomatedPayment"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemParticipantsId"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemUniversalId"/>
+ <xsd:enumeration value="CoastDesignationCode"/>
+ <xsd:enumeration value="CognizanceSymbol"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-Inspection"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-LossCategory"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-PointsOfImpact"/>
+ <xsd:enumeration value="CollisionIndustryElectronicCommerceAssociation-Profile"/>
+ <xsd:enumeration value="Combiterms1990"/>
+ <xsd:enumeration value="CommercialAndGovernmentEntity"/>
+ <xsd:enumeration value="CommercialDriversLicense"/>
+ <xsd:enumeration value="CommercialVehicleOperationsCommodityCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsHazardousMaterialCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsInsurance"/>
+ <xsd:enumeration value="CommercialVehicleOperationsSafetyCode"/>
+ <xsd:enumeration value="CommercialVehicleOperationsStatusCode"/>
+ <xsd:enumeration value="CommercialVehicleRegistration"/>
+ <xsd:enumeration value="CommercialVehicleTax"/>
+ <xsd:enumeration value="CommercialVehicleTitle"/>
+ <xsd:enumeration value="CommercialVehicleType"/>
+ <xsd:enumeration value="Commodity"/>
+ <xsd:enumeration value="CommunicationsRoutingIdentifierCode"/>
+ <xsd:enumeration value="CompensationTypeCodes"/>
+ <xsd:enumeration value="CompetitiveCharacteristicsCode"/>
+ <xsd:enumeration value="ComplaintRequestCode"/>
+ <xsd:enumeration value="ComplianceReviewCode"/>
+ <xsd:enumeration value="ConclusionEvaluationCode"/>
+ <xsd:enumeration value="Condition"/>
+ <xsd:enumeration value="ConditionDetail"/>
+ <xsd:enumeration value="ConsigneesPremises"/>
+ <xsd:enumeration value="ConsignorsPremises"/>
+ <xsd:enumeration value="ConsolidationAndContainerizationPointCode"/>
+ <xsd:enumeration value="ConsolidationDetail"/>
+ <xsd:enumeration value="ConstructionMaterial"/>
+ <xsd:enumeration value="ContactorAlertListReason"/>
+ <xsd:enumeration value="ContactStatusCode"/>
+ <xsd:enumeration value="ContainerAndRoll-OnOrRoll-OffNumberCode"/>
+ <xsd:enumeration value="ContainerTerminal"/>
+ <xsd:enumeration value="ContentIndicatorCode"/>
+ <xsd:enumeration value="Continent"/>
+ <xsd:enumeration value="Contract"/>
+ <xsd:enumeration value="ContractClose-OutGroupCode"/>
+ <xsd:enumeration value="ContractDeliveryDateRevisionAgentCode"/>
+ <xsd:enumeration value="ContractFundReportingTransactionCode"/>
+ <xsd:enumeration value="ContractorAlertListStatus"/>
+ <xsd:enumeration value="ContractorReviewListStatus"/>
+ <xsd:enumeration value="ContractPaymentDeductionOrCollectionCode"/>
+ <xsd:enumeration value="ContractPaymentLineItemStatusCode"/>
+ <xsd:enumeration value="ContractShipmentAdviceCode"/>
+ <xsd:enumeration value="ControlledInventoryItemCode"/>
+ <xsd:enumeration value="ControlUnitDesignCode"/>
+ <xsd:enumeration value="ControvertCode"/>
+ <xsd:enumeration value="ConvictionOffenseType"/>
+ <xsd:enumeration value="CooperativeLogisticsProgramSupportCode"/>
+ <xsd:enumeration value="CorporateFinancialFilingCriteria"/>
+ <xsd:enumeration value="CorporateStatementFilingCode"/>
+ <xsd:enumeration value="CorrectionOrChangeForStorageItemRecordsCode"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CountryAndActivityCode"/>
+ <xsd:enumeration value="CountryCode-FinanceAndAcquisition"/>
+ <xsd:enumeration value="CountrySub-Entity"/>
+ <xsd:enumeration value="County"/>
+ <xsd:enumeration value="CountyDesignatorCode"/>
+ <xsd:enumeration value="CouponAdjustmentReasonCode"/>
+ <xsd:enumeration value="CourtAppearanceTypeCode"/>
+ <xsd:enumeration value="CourtCaseStatusCode"/>
+ <xsd:enumeration value="CourtDispositionCode"/>
+ <xsd:enumeration value="CourtDocumentTypeCode"/>
+ <xsd:enumeration value="CourtIssuedWarrantTypeCode"/>
+ <xsd:enumeration value="CourtOfLawEventType"/>
+ <xsd:enumeration value="CourtOfLawType"/>
+ <xsd:enumeration value="CourtPartyStatus"/>
+ <xsd:enumeration value="CourtPleadingTypeCode"/>
+ <xsd:enumeration value="CoverageCodeList"/>
+ <xsd:enumeration value="CoverageModifier"/>
+ <xsd:enumeration value="Cpa-CanadianPaymentsAssociation"/>
+ <xsd:enumeration value="CriminalCharge"/>
+ <xsd:enumeration value="CriminalChargeGrade"/>
+ <xsd:enumeration value="CriticalityDesignatorCode"/>
+ <xsd:enumeration value="CuisineTypeCode"/>
+ <xsd:enumeration value="CurrentAssetDetails"/>
+ <xsd:enumeration value="CurrentDentalTerminologyCode"/>
+ <xsd:enumeration value="CurrentLiabilityDetails"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCodes"/>
+ <xsd:enumeration value="CustomerMaintenanceLevelLookup"/>
+ <xsd:enumeration value="CustomerWithinCountryCode"/>
+ <xsd:enumeration value="CustomizedNoticeTypeCode"/>
+ <xsd:enumeration value="CustomsAreaOfTransaction"/>
+ <xsd:enumeration value="CustomsDeclarationType"/>
+ <xsd:enumeration value="CustomsDomesticPortLocationCodes-USScheduleD"/>
+ <xsd:enumeration value="CustomsForeignPortLocationCodes-USScheduleK"/>
+ <xsd:enumeration value="CustomsIndicator"/>
+ <xsd:enumeration value="CustomsInspectionType"/>
+ <xsd:enumeration value="CustomsOffice"/>
+ <xsd:enumeration value="CustomsPreference"/>
+ <xsd:enumeration value="CustomsProcedure"/>
+ <xsd:enumeration value="CustomsReleaseNotification"/>
+ <xsd:enumeration value="CustomsSimplifiedProcedure"/>
+ <xsd:enumeration value="CustomsSpecialCodes"/>
+ <xsd:enumeration value="CustomsStatusOfGoods"/>
+ <xsd:enumeration value="CustomsTransitGuarantee"/>
+ <xsd:enumeration value="CustomsTransitType"/>
+ <xsd:enumeration value="CustomsValuationMethod"/>
+ <xsd:enumeration value="CustomsWarehouse"/>
+ <xsd:enumeration value="DangerousGoodsPackingType"/>
+ <xsd:enumeration value="DataCategory"/>
+ <xsd:enumeration value="DateShippedOrReceivedCode"/>
+ <xsd:enumeration value="DebtorBusinessTypeCode"/>
+ <xsd:enumeration value="DebtorTypeCode"/>
+ <xsd:enumeration value="DefendantPleaTypeCode"/>
+ <xsd:enumeration value="DefensePrioritiesAndAllocationsSystemCode"/>
+ <xsd:enumeration value="DeferralLookup"/>
+ <xsd:enumeration value="DeficiencyCause"/>
+ <xsd:enumeration value="DeficiencyIndicator"/>
+ <xsd:enumeration value="DelinquencyIndicator"/>
+ <xsd:enumeration value="DeliverySourceCode"/>
+ <xsd:enumeration value="DeliveryTermCode"/>
+ <xsd:enumeration value="DemandCode"/>
+ <xsd:enumeration value="DemilitarizationCode"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DeviceAvailabilityCode"/>
+ <xsd:enumeration value="DeviceEvaluationCode"/>
+ <xsd:enumeration value="DeviceEventProblemCode"/>
+ <xsd:enumeration value="DeviceOperatorTypeCode"/>
+ <xsd:enumeration value="DeviceStatusCode"/>
+ <xsd:enumeration value="DeviceUsageCode"/>
+ <xsd:enumeration value="Diagnosis"/>
+ <xsd:enumeration value="DiagnosisEncounteredDuringExaminationAndInvestigationOfIndividualsAndPopulationsCode"/>
+ <xsd:enumeration value="DiagnosisRelatedGroup"/>
+ <xsd:enumeration value="DiagnosticAndStatisticalManualOfMentalDisorders"/>
+ <xsd:enumeration value="DirectNumericalControlSystemCode"/>
+ <xsd:enumeration value="DisbursementStatusCode"/>
+ <xsd:enumeration value="Discrepancy"/>
+ <xsd:enumeration value="DiscrepancyAdviceCode"/>
+ <xsd:enumeration value="DiscrepancyCode"/>
+ <xsd:enumeration value="DiscrepancyIndicatorCode"/>
+ <xsd:enumeration value="DiscrepancyStatusOrDispositionCode"/>
+ <xsd:enumeration value="DisposalAuthorityCode"/>
+ <xsd:enumeration value="DisposalConditionCode"/>
+ <xsd:enumeration value="DistributionCode"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="DocumentRequestedByCustoms"/>
+ <xsd:enumeration value="Dodaac-DepartmentOfDefenseActivityAddressCode"/>
+ <xsd:enumeration value="DomesticLineOfBusinessCode"/>
+ <xsd:enumeration value="DoseFormCode"/>
+ <xsd:enumeration value="DriverParameters"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalBasis"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalDueProcessStatus"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalExtent"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalReason"/>
+ <xsd:enumeration value="DriversLicenseWithdrawalType"/>
+ <xsd:enumeration value="DrugDetailCode"/>
+ <xsd:enumeration value="DrugStatusAdverseEventCode"/>
+ <xsd:enumeration value="DrugStatusCode"/>
+ <xsd:enumeration value="DumpingOrCountervailingAssessmentMethod"/>
+ <xsd:enumeration value="DumpingSpecification"/>
+ <xsd:enumeration value="DunAndBradstreetCanadas8DigitStandardIndustrialClassificationCode"/>
+ <xsd:enumeration value="Duns-DunAndBradstreetPlus4"/>
+ <xsd:enumeration value="DunsStandardIndustrialClassification2Plus2DunAndBradstreet"/>
+ <xsd:enumeration value="DutyTaxOrFeePaymentMethod"/>
+ <xsd:enumeration value="DynamicGeneratorSetCode"/>
+ <xsd:enumeration value="DynamicLocomotiveTagCode"/>
+ <xsd:enumeration value="Edira-Id-EdiRegistrationAuthorityIdentification"/>
+ <xsd:enumeration value="EditErrorCode"/>
+ <xsd:enumeration value="EducationalInstitutionType"/>
+ <xsd:enumeration value="EducationalStudyArea"/>
+ <xsd:enumeration value="ElectromagneticTransmitterIdentification"/>
+ <xsd:enumeration value="EmployeeIdentification"/>
+ <xsd:enumeration value="EnhancedPartyIdentification"/>
+ <xsd:enumeration value="Entitlement"/>
+ <xsd:enumeration value="EntityRelationship"/>
+ <xsd:enumeration value="EquipmentStatusLookup"/>
+ <xsd:enumeration value="ErrorClassificationCode"/>
+ <xsd:enumeration value="EssentialityCode"/>
+ <xsd:enumeration value="EstimatedTimeOfArrivalCode"/>
+ <xsd:enumeration value="EstimateTypeLookup"/>
+ <xsd:enumeration value="EstimatingMethodStatusCode"/>
+ <xsd:enumeration value="Ethnicity"/>
+ <xsd:enumeration value="EvaluateWorkCandidateLookup"/>
+ <xsd:enumeration value="EvaluateWorkCandidateReasonLookup"/>
+ <xsd:enumeration value="EventAbatementCode"/>
+ <xsd:enumeration value="EventCodes"/>
+ <xsd:enumeration value="EventOrExposureCode"/>
+ <xsd:enumeration value="EventReappearanceCode"/>
+ <xsd:enumeration value="ExaminationFacility"/>
+ <xsd:enumeration value="ExcavationInformationCodeList"/>
+ <xsd:enumeration value="ExcessMaterialDispositionCode"/>
+ <xsd:enumeration value="ExciseDuty"/>
+ <xsd:enumeration value="ExportCommodityClassification-USScheduleB"/>
+ <xsd:enumeration value="ExportRequirements"/>
+ <xsd:enumeration value="ExtensionReason"/>
+ <xsd:enumeration value="EyeColorCode"/>
+ <xsd:enumeration value="FacilityIdentification"/>
+ <xsd:enumeration value="FacilitySecurityClearance"/>
+ <xsd:enumeration value="FailureToAwardReason"/>
+ <xsd:enumeration value="FannieMaeAdjustableRateMortgagePlanCodes"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-MortgageInsuranceCode"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-PoolFeatureCode"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-RemittancePrograms"/>
+ <xsd:enumeration value="FannieMae-FederalNationalMortgageAssociation-SpecialFeatureCode"/>
+ <xsd:enumeration value="FannieMaeRefinancePlanCode"/>
+ <xsd:enumeration value="FederalFinanceCodeList1"/>
+ <xsd:enumeration value="FederalHealthCareCodeList1"/>
+ <xsd:enumeration value="FederalLogisticsCodeList1"/>
+ <xsd:enumeration value="FederalProcurementCodeList1"/>
+ <xsd:enumeration value="FederalTransportationCodeList1"/>
+ <xsd:enumeration value="FinancialAnalysisCategories"/>
+ <xsd:enumeration value="FinancialInformationType"/>
+ <xsd:enumeration value="FinancialItemAllocation"/>
+ <xsd:enumeration value="FinancialItemAttributedCode"/>
+ <xsd:enumeration value="FinancialItemReclassification"/>
+ <xsd:enumeration value="FinancialManagementServiceCash-LinkCode"/>
+ <xsd:enumeration value="FinancialRating"/>
+ <xsd:enumeration value="FinancialRegime"/>
+ <xsd:enumeration value="FinancialRouting"/>
+ <xsd:enumeration value="FinancialStatementFormat"/>
+ <xsd:enumeration value="FleetParameters"/>
+ <xsd:enumeration value="FlowOfTheGoods"/>
+ <xsd:enumeration value="Follow-UpCode"/>
+ <xsd:enumeration value="ForecastType"/>
+ <xsd:enumeration value="ForeignLineOfBusinessCode"/>
+ <xsd:enumeration value="ForeignMilitarySalesCountryCode"/>
+ <xsd:enumeration value="FormTypeCode"/>
+ <xsd:enumeration value="ForwardingRestrictions"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-MortgageInsuranceCode"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-RemittancePrograms"/>
+ <xsd:enumeration value="FreddieMac-FederalHomeLoanMortgageCorporation-SpecialCharacterCode"/>
+ <xsd:enumeration value="FreddieMacRefinancePlanCode"/>
+ <xsd:enumeration value="FreeOnBoardSiteCode"/>
+ <xsd:enumeration value="FreeZone"/>
+ <xsd:enumeration value="FreightForwarder"/>
+ <xsd:enumeration value="Frequency"/>
+ <xsd:enumeration value="FrequencyBand"/>
+ <xsd:enumeration value="FunctionalArea"/>
+ <xsd:enumeration value="FunctionalGroup"/>
+ <xsd:enumeration value="FundCode"/>
+ <xsd:enumeration value="FundPurpose"/>
+ <xsd:enumeration value="GainOrLossIndicatorCode"/>
+ <xsd:enumeration value="Gate"/>
+ <xsd:enumeration value="GeneralServicesAdministrationCustomerSupplyCenterNumberCode"/>
+ <xsd:enumeration value="GeneralTerritoryType"/>
+ <xsd:enumeration value="GeneratorSetMountingCode"/>
+ <xsd:enumeration value="GeographicLocation"/>
+ <xsd:enumeration value="GlassActionCode"/>
+ <xsd:enumeration value="GoodsDescription"/>
+ <xsd:enumeration value="GovernmentAgencyProcedure"/>
+ <xsd:enumeration value="GradeOfDifficulty"/>
+ <xsd:enumeration value="GroupQualifierCode"/>
+ <xsd:enumeration value="HairColorCode"/>
+ <xsd:enumeration value="HandlingAction"/>
+ <xsd:enumeration value="HarmonizedSystem"/>
+ <xsd:enumeration value="HazardousMaterialCode"/>
+ <xsd:enumeration value="HazardousMaterialsCredential"/>
+ <xsd:enumeration value="HazardousResponseCodes"/>
+ <xsd:enumeration value="HealthCareClaimStatusCode"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationCommonProceduralCodingSystem"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationCommonProceduralCodingSystemPrincipalProcedure"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationDurableMedicalEquipmentRegionalCarrierCertificateOfMedicalNecessityForms"/>
+ <xsd:enumeration value="HealthcareProviderCharacteristicsAndResources"/>
+ <xsd:enumeration value="HealthcareProviderTaxonomy"/>
+ <xsd:enumeration value="HealthIndustryNumber"/>
+ <xsd:enumeration value="HealthIndustryOrganizationIdentification"/>
+ <xsd:enumeration value="Hobby"/>
+ <xsd:enumeration value="Icd10"/>
+ <xsd:enumeration value="IdentificationCode"/>
+ <xsd:enumeration value="IdentifyingCharacteristics"/>
+ <xsd:enumeration value="IdentityDisclosureCode"/>
+ <xsd:enumeration value="ImmunizationInjectionCode"/>
+ <xsd:enumeration value="ImpactAxisOrAnalogPortCode"/>
+ <xsd:enumeration value="ImpactRecorderCode"/>
+ <xsd:enumeration value="IncidentConditionCode"/>
+ <xsd:enumeration value="IncidentConsequenceCode"/>
+ <xsd:enumeration value="IncidentLocationCode"/>
+ <xsd:enumeration value="IncidentRelatedActionCode"/>
+ <xsd:enumeration value="Incoterms1980"/>
+ <xsd:enumeration value="IndicatorCode"/>
+ <xsd:enumeration value="IndividualInsuranceFinancialDetail"/>
+ <xsd:enumeration value="IndividualParticipationInCompany"/>
+ <xsd:enumeration value="IndividualSecurityClearance"/>
+ <xsd:enumeration value="IndustryRating"/>
+ <xsd:enumeration value="InformationIndicatorCode"/>
+ <xsd:enumeration value="InformationRequestResult"/>
+ <xsd:enumeration value="InformationRequestType"/>
+ <xsd:enumeration value="InformationType"/>
+ <xsd:enumeration value="InitialTreatmentCode"/>
+ <xsd:enumeration value="InquirySelection"/>
+ <xsd:enumeration value="InspectionParameters"/>
+ <xsd:enumeration value="InsuranceCoverageDetail"/>
+ <xsd:enumeration value="InsuranceInformationIndicator"/>
+ <xsd:enumeration value="InsurancePlanDescriptionCharacteristics"/>
+ <xsd:enumeration value="IntermediateContainerCode"/>
+ <xsd:enumeration value="IntermediateContainerQuantityCode"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModificationProcedure"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModificationPrincipalProcedure"/>
+ <xsd:enumeration value="InternationalClassificationOfDiseasesClinicalModification-Icd-9-CmCode"/>
+ <xsd:enumeration value="InternationalStandardDesignationSystemForTeethAndAreasOfTheOralCavity"/>
+ <xsd:enumeration value="InventoryCategoryCode"/>
+ <xsd:enumeration value="InventoryTypeCode"/>
+ <xsd:enumeration value="InvestigationStatusCode"/>
+ <xsd:enumeration value="InvestmentFundType"/>
+ <xsd:enumeration value="InvestmentType"/>
+ <xsd:enumeration value="IrsQualificationCode"/>
+ <xsd:enumeration value="ItemManagementCode"/>
+ <xsd:enumeration value="ItemSourcingCategory"/>
+ <xsd:enumeration value="ItemType"/>
+ <xsd:enumeration value="JobCharacteristicsLookup"/>
+ <xsd:enumeration value="JobOriginatorLookup"/>
+ <xsd:enumeration value="JointLifeInsuranceIndicator"/>
+ <xsd:enumeration value="JudicialHearingTypeCode"/>
+ <xsd:enumeration value="JudicialOrderTypeCode"/>
+ <xsd:enumeration value="JudicialSentenceTypeCode"/>
+ <xsd:enumeration value="JurisdictionType"/>
+ <xsd:enumeration value="KeyEventLookup"/>
+ <xsd:enumeration value="KindOfContractCode"/>
+ <xsd:enumeration value="KindOfModificationCode"/>
+ <xsd:enumeration value="LaboratoryResultsIdentificationCode"/>
+ <xsd:enumeration value="LaboratoryTestConditionCode"/>
+ <xsd:enumeration value="LegalCaseType"/>
+ <xsd:enumeration value="LegalEvent"/>
+ <xsd:enumeration value="LegalStructureCode"/>
+ <xsd:enumeration value="LetterOfRecommendationRatingCategory"/>
+ <xsd:enumeration value="LiabilityDetails"/>
+ <xsd:enumeration value="LiabilityType"/>
+ <xsd:enumeration value="LifeOrAnnuityProductCode"/>
+ <xsd:enumeration value="LifeOrAnnuityServiceFeatures"/>
+ <xsd:enumeration value="LifeOrAnnuityStatusCodes"/>
+ <xsd:enumeration value="LifeReinsuranceMessageType"/>
+ <xsd:enumeration value="LineItemConditionCode"/>
+ <xsd:enumeration value="LineOfAuthority"/>
+ <xsd:enumeration value="LineOfBusinessCode"/>
+ <xsd:enumeration value="LoanType"/>
+ <xsd:enumeration value="LocaleOfActivity"/>
+ <xsd:enumeration value="LocalSourceCode"/>
+ <xsd:enumeration value="LocationCode"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationsForTariffCalculations"/>
+ <xsd:enumeration value="LogicalObservationIdentifierNamesAndCodesCodes"/>
+ <xsd:enumeration value="LogisticsCodeList"/>
+ <xsd:enumeration value="LossDescriptionCode"/>
+ <xsd:enumeration value="LossSeverityCode"/>
+ <xsd:enumeration value="LotTypeCode"/>
+ <xsd:enumeration value="MajorForceProgramCode"/>
+ <xsd:enumeration value="ManagementCode"/>
+ <xsd:enumeration value="ManagementIndicatorCode-Petroleum"/>
+ <xsd:enumeration value="ManualClassCode"/>
+ <xsd:enumeration value="MarineBerth"/>
+ <xsd:enumeration value="MarineWharf"/>
+ <xsd:enumeration value="MarketPlaceOrganizationID"/>
+ <xsd:enumeration value="MarketPlaceTradingPartnerID"/>
+ <xsd:enumeration value="MaterialControlCode"/>
+ <xsd:enumeration value="Materials"/>
+ <xsd:enumeration value="MeansOfCommunicationsIdentifier"/>
+ <xsd:enumeration value="MeansOfTransportIdentification"/>
+ <xsd:enumeration value="MechanizationOfContractAdministrationServicesSystemErrorCode"/>
+ <xsd:enumeration value="MediaAndStatusCode"/>
+ <xsd:enumeration value="MedicaidProvider"/>
+ <xsd:enumeration value="MedicalBenefitsSchedule"/>
+ <xsd:enumeration value="MedicareProvider"/>
+ <xsd:enumeration value="MediumOfTransmissionCode"/>
+ <xsd:enumeration value="MemberOrganizations"/>
+ <xsd:enumeration value="MethodEvaluationCode"/>
+ <xsd:enumeration value="MethodsOfPayment"/>
+ <xsd:enumeration value="MilitaryAndCivilianGradeCode"/>
+ <xsd:enumeration value="MilitaryAssistanceProgramAddressCode"/>
+ <xsd:enumeration value="MinorityIndicator"/>
+ <xsd:enumeration value="MissionImpactStatementCode"/>
+ <xsd:enumeration value="MonetaryFunctionDetail"/>
+ <xsd:enumeration value="MortgageIndexSourceCode"/>
+ <xsd:enumeration value="Multi-MediaObject"/>
+ <xsd:enumeration value="Nacha-NationalAutomatedClearingHouseAssociation"/>
+ <xsd:enumeration value="NationalCouncilForPrescriptionDrugProgramsRejectOrPaymentCodes"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsuranceNatureOfInjuryCode"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsurancePartOfBodyCode"/>
+ <xsd:enumeration value="NationalCouncilOnCompensationInsuranceSourceOfInjuryCode"/>
+ <xsd:enumeration value="NationalDrugCode"/>
+ <xsd:enumeration value="NationalMotorFreightClassificationCode"/>
+ <xsd:enumeration value="NationalStandardToothNumberingSystem"/>
+ <xsd:enumeration value="NatureOfBuy"/>
+ <xsd:enumeration value="NatureOfDebtCode"/>
+ <xsd:enumeration value="NatureOfEventCode"/>
+ <xsd:enumeration value="NatureOfInjuryCode"/>
+ <xsd:enumeration value="NatureOfSuit"/>
+ <xsd:enumeration value="NatureOfSuitCode"/>
+ <xsd:enumeration value="NatureOfTransaction"/>
+ <xsd:enumeration value="NoLongerConsideredForAwardReason"/>
+ <xsd:enumeration value="NomenclatureActivityClassificationEconomyCode"/>
+ <xsd:enumeration value="Non-PostalTown"/>
+ <xsd:enumeration value="NormeActiviteFrancaiseCode"/>
+ <xsd:enumeration value="NoticeType"/>
+ <xsd:enumeration value="NotificationIndicatorCode"/>
+ <xsd:enumeration value="ObligationVarianceCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationNatureOfInjuryCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationPartOfBodyCode"/>
+ <xsd:enumeration value="OccupationalSafetyAndHealthAdministrationSourceOfInjuryCode"/>
+ <xsd:enumeration value="OccupationClassification"/>
+ <xsd:enumeration value="OccupationCode"/>
+ <xsd:enumeration value="Occurrence"/>
+ <xsd:enumeration value="OccurrenceSpan"/>
+ <xsd:enumeration value="OceanCarrierCode"/>
+ <xsd:enumeration value="OfferAndReleaseOptionCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsNatureOfInjuryCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsOccupationCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsPartOfBodyCode"/>
+ <xsd:enumeration value="OfficeOfWorkersCompensationProgramsSourceOfInjuryCode"/>
+ <xsd:enumeration value="OperatingStatus"/>
+ <xsd:enumeration value="OperationType"/>
+ <xsd:enumeration value="OversizeOrOverweightCredential"/>
+ <xsd:enumeration value="OwnershipCode"/>
+ <xsd:enumeration value="OwnershipRights"/>
+ <xsd:enumeration value="PackageFailureCode"/>
+ <xsd:enumeration value="PackingAndOrUnpackingFacility"/>
+ <xsd:enumeration value="PackingRequirementLevelACode"/>
+ <xsd:enumeration value="PackingRequirementLevelBCode"/>
+ <xsd:enumeration value="PackingRequirementLevelCCode"/>
+ <xsd:enumeration value="PartOfBodyAffected"/>
+ <xsd:enumeration value="PartOfBodyCode"/>
+ <xsd:enumeration value="PartyIdentification"/>
+ <xsd:enumeration value="PassportNumber"/>
+ <xsd:enumeration value="PatientEventProblemCode"/>
+ <xsd:enumeration value="PaymentBehaviourRating"/>
+ <xsd:enumeration value="PaymentTypeCode"/>
+ <xsd:enumeration value="PedestrianCode"/>
+ <xsd:enumeration value="PersonalPropertyAndContentsCode"/>
+ <xsd:enumeration value="PetroleumBillType"/>
+ <xsd:enumeration value="PetroleumLandCategory"/>
+ <xsd:enumeration value="PetroleumLeaseStatus"/>
+ <xsd:enumeration value="PetroleumProductDisposition"/>
+ <xsd:enumeration value="PetroleumProductPoint-Of-Sale"/>
+ <xsd:enumeration value="PetroleumProductSellingArrangement"/>
+ <xsd:enumeration value="PetroleumProductValueAdjustment"/>
+ <xsd:enumeration value="PetroleumRegulatoryReport"/>
+ <xsd:enumeration value="PetroleumRoyaltyAdjustment"/>
+ <xsd:enumeration value="PetroleumRoyaltyCalculationMethod"/>
+ <xsd:enumeration value="PetroleumRoyaltyTransaction"/>
+ <xsd:enumeration value="PetroleumUnitedStatesGeologicalSurveyFormationCode"/>
+ <xsd:enumeration value="PetroleumWellAction"/>
+ <xsd:enumeration value="PetroleumWellClassificationStatus"/>
+ <xsd:enumeration value="PetroleumWellInformation"/>
+ <xsd:enumeration value="PetroleumWellShut-InReason"/>
+ <xsd:enumeration value="PetroleumWellTestInformation"/>
+ <xsd:enumeration value="PhysicalCharacteristicsCode"/>
+ <xsd:enumeration value="PlantClearanceOfficeCode"/>
+ <xsd:enumeration value="PlusOrMinusIndicatorCode"/>
+ <xsd:enumeration value="PolicyOnClaimIndicator"/>
+ <xsd:enumeration value="PolicyReserveValuationType"/>
+ <xsd:enumeration value="PolicyType"/>
+ <xsd:enumeration value="Port"/>
+ <xsd:enumeration value="PortalID"/>
+ <xsd:enumeration value="PostalDistrict"/>
+ <xsd:enumeration value="PostalServiceCarrierRoute"/>
+ <xsd:enumeration value="PostcodeDirectory"/>
+ <xsd:enumeration value="PostMarketStudyStatusCode"/>
+ <xsd:enumeration value="PreciousMetalsIndicatorCode"/>
+ <xsd:enumeration value="PreservationDataCode"/>
+ <xsd:enumeration value="PreservationMaterialCode"/>
+ <xsd:enumeration value="PreventiveMeasure"/>
+ <xsd:enumeration value="PrimaryDiagnosis"/>
+ <xsd:enumeration value="PrincipalDiagnosis"/>
+ <xsd:enumeration value="PrincipalPartyCitizenshipCode"/>
+ <xsd:enumeration value="PriorityDesignatorCode"/>
+ <xsd:enumeration value="PriorityLookup"/>
+ <xsd:enumeration value="ProducerFinancialHistoryCodes"/>
+ <xsd:enumeration value="ProductCode"/>
+ <xsd:enumeration value="ProductQualityDeficiencyReportSummaryCode"/>
+ <xsd:enumeration value="ProductSupplyCondition"/>
+ <xsd:enumeration value="ProfessionalDesignation"/>
+ <xsd:enumeration value="ProfessionalStatusCode"/>
+ <xsd:enumeration value="ProfessionTypeCode"/>
+ <xsd:enumeration value="ProgramOriginatorCode"/>
+ <xsd:enumeration value="ProgramYearCode"/>
+ <xsd:enumeration value="ProjectCode"/>
+ <xsd:enumeration value="ProjectionType"/>
+ <xsd:enumeration value="PropertyOwnershipExtent"/>
+ <xsd:enumeration value="PropertyOwnershipTypeCode"/>
+ <xsd:enumeration value="PropertyRecordStatusCode"/>
+ <xsd:enumeration value="PropertySourceCode"/>
+ <xsd:enumeration value="PropertyType"/>
+ <xsd:enumeration value="PropertyUnderwritingConditionCode"/>
+ <xsd:enumeration value="Proprietary"/>
+ <xsd:enumeration value="PurchasingContractOfficerInstructionsCode"/>
+ <xsd:enumeration value="PurposeCode"/>
+ <xsd:enumeration value="QualityAlertListReason"/>
+ <xsd:enumeration value="QualityAssuranceSiteCode"/>
+ <xsd:enumeration value="QualityConformance"/>
+ <xsd:enumeration value="QualityControlCode"/>
+ <xsd:enumeration value="QuantityPerUnitPackCode"/>
+ <xsd:enumeration value="QueryOptions"/>
+ <xsd:enumeration value="QueryStatus"/>
+ <xsd:enumeration value="RadioFrequencyType"/>
+ <xsd:enumeration value="RadioServiceType"/>
+ <xsd:enumeration value="RadioSystemType"/>
+ <xsd:enumeration value="RailAdditionalCharges"/>
+ <xsd:enumeration value="RailcarLetterMarking"/>
+ <xsd:enumeration value="RailDocumentNames"/>
+ <xsd:enumeration value="RailHandlingRestrictionsAndInstructions"/>
+ <xsd:enumeration value="RailHarmonizedCodificationOfTariffs"/>
+ <xsd:enumeration value="RailHarmonizedEquipmentType"/>
+ <xsd:enumeration value="RailRoutes"/>
+ <xsd:enumeration value="RailUnifiedNomenclatureOfGoods"/>
+ <xsd:enumeration value="RailwayCompanyNetwork"/>
+ <xsd:enumeration value="RailwayCustomer"/>
+ <xsd:enumeration value="RailwayFrontierAndTransitPoint"/>
+ <xsd:enumeration value="RailwayLocations"/>
+ <xsd:enumeration value="RailwayServicesHarmonizedCode"/>
+ <xsd:enumeration value="RateClass"/>
+ <xsd:enumeration value="RatingSummaryValue"/>
+ <xsd:enumeration value="RealEstateAssetType"/>
+ <xsd:enumeration value="ReasonForContractDeliveryDateRevisionCode"/>
+ <xsd:enumeration value="ReasonForDelayedClosingOfContractFileCode"/>
+ <xsd:enumeration value="ReasonForDisposalCode"/>
+ <xsd:enumeration value="ReasonForFinancialItemDetailChange"/>
+ <xsd:enumeration value="ReasonForPublicRecordFiling"/>
+ <xsd:enumeration value="ReasonForRequisitioningCode"/>
+ <xsd:enumeration value="RecipientOfBillingStatusCode"/>
+ <xsd:enumeration value="RecommendationsRegardingDelayedDeliveriesCode"/>
+ <xsd:enumeration value="RecordControlNumber"/>
+ <xsd:enumeration value="RecordPrecedenceBasedOnItsCurrencyInTime"/>
+ <xsd:enumeration value="ReferenceAndStationCode"/>
+ <xsd:enumeration value="RefrigerationUnitOperatingModeCode"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegisteredContractorActivityCode"/>
+ <xsd:enumeration value="RegistrationType"/>
+ <xsd:enumeration value="ReinsuranceMonetaryType"/>
+ <xsd:enumeration value="ReinsurancePolicyAttributes"/>
+ <xsd:enumeration value="RejectAdviceCode"/>
+ <xsd:enumeration value="RejectIndicatorCode"/>
+ <xsd:enumeration value="RelatedDeviceApplicabilityCode"/>
+ <xsd:enumeration value="ReligiousAffiliationCode"/>
+ <xsd:enumeration value="RemedialActionCode"/>
+ <xsd:enumeration value="RemovableAccessoriesAndSpecialEquipmentOnRailcars"/>
+ <xsd:enumeration value="RentalCharge"/>
+ <xsd:enumeration value="RepairFacility"/>
+ <xsd:enumeration value="ReportableEventCode"/>
+ <xsd:enumeration value="ReportableEventStatusCode"/>
+ <xsd:enumeration value="ReportCode"/>
+ <xsd:enumeration value="ReportDistributionCode"/>
+ <xsd:enumeration value="ReportSourceCode"/>
+ <xsd:enumeration value="RepresentativeBuyIndicator"/>
+ <xsd:enumeration value="RequestCode"/>
+ <xsd:enumeration value="RequestType"/>
+ <xsd:enumeration value="RequirementCode"/>
+ <xsd:enumeration value="RequirementsIndicator"/>
+ <xsd:enumeration value="ResidencyIndicator"/>
+ <xsd:enumeration value="ResidentialAndCommercialRoomCode"/>
+ <xsd:enumeration value="ResponseStatusCode"/>
+ <xsd:enumeration value="RestrictionsAndProhibitionsPlacedOnTheRe-UseOf"/>
+ <xsd:enumeration value="ResultEvaluationCode"/>
+ <xsd:enumeration value="ReviewPeriodIndicatorCode"/>
+ <xsd:enumeration value="RiskClass"/>
+ <xsd:enumeration value="RoadCharacteristicCode"/>
+ <xsd:enumeration value="RoadwayDetail"/>
+ <xsd:enumeration value="RoadwayType"/>
+ <xsd:enumeration value="RouteCode"/>
+ <xsd:enumeration value="RunType"/>
+ <xsd:enumeration value="SafetyAndFitnessElectronicRecordSystemsErrorCode"/>
+ <xsd:enumeration value="SafetyAndFitnessElectronicRecordSystemsSubscriptionOption"/>
+ <xsd:enumeration value="SafetyHazardLookup"/>
+ <xsd:enumeration value="SafetyRegulation"/>
+ <xsd:enumeration value="SalesPriceConditionCode"/>
+ <xsd:enumeration value="SalvageDispositionCode"/>
+ <xsd:enumeration value="SampleExtractionLocation"/>
+ <xsd:enumeration value="SeavanOwnershipCode"/>
+ <xsd:enumeration value="SecondaryDiagnosis"/>
+ <xsd:enumeration value="SecondarySourceOfInjury"/>
+ <xsd:enumeration value="SecurityShareType"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="ServiceAndAgencyCode"/>
+ <xsd:enumeration value="ServiceContractActOccupationCategoryCode"/>
+ <xsd:enumeration value="ServiceContractActOccupationClassificationCode"/>
+ <xsd:enumeration value="ServiceContractActOperationCode"/>
+ <xsd:enumeration value="SettlementOrPayoutOptions"/>
+ <xsd:enumeration value="ShareTypeCode"/>
+ <xsd:enumeration value="ShelfLifeCode"/>
+ <xsd:enumeration value="ShipmentAcceptanceDiscrepancyExplanationCode"/>
+ <xsd:enumeration value="ShipmentDescription"/>
+ <xsd:enumeration value="ShipmentHoldCode"/>
+ <xsd:enumeration value="ShipmentReleaseCode"/>
+ <xsd:enumeration value="ShippingAgent"/>
+ <xsd:enumeration value="SignalCode"/>
+ <xsd:enumeration value="SingleStateRegistrationSystemAndOperatingAuthorityCredential"/>
+ <xsd:enumeration value="SingleUseLabelCode"/>
+ <xsd:enumeration value="SizeAndType"/>
+ <xsd:enumeration value="SkinToneCode"/>
+ <xsd:enumeration value="SmallArmsErrorTransactionRejectCode"/>
+ <xsd:enumeration value="SmallArmsTransactionCode"/>
+ <xsd:enumeration value="SocialSecurityIdentification"/>
+ <xsd:enumeration value="SolicitationCancellationReason"/>
+ <xsd:enumeration value="SolicitationMethod"/>
+ <xsd:enumeration value="SoundCode"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SourceMaintenanceAndRecoverabilityCode"/>
+ <xsd:enumeration value="SourceOfDepositCode"/>
+ <xsd:enumeration value="SourceOfDisclosure"/>
+ <xsd:enumeration value="SourceOfInjuryCode"/>
+ <xsd:enumeration value="SourceOfLeadCode"/>
+ <xsd:enumeration value="SourceOfLossCode"/>
+ <xsd:enumeration value="SpecialCategoryCode"/>
+ <xsd:enumeration value="SpecialContractProvisionCode"/>
+ <xsd:enumeration value="SpecialDating"/>
+ <xsd:enumeration value="SpecialHandling"/>
+ <xsd:enumeration value="SpecialMarketingTypeCode"/>
+ <xsd:enumeration value="SpecialMarkingCode"/>
+ <xsd:enumeration value="SpecialMaterialIdentificationCode"/>
+ <xsd:enumeration value="SpecialProgramRequirementStatusCode"/>
+ <xsd:enumeration value="SpecialReimbursableProvisionsCode"/>
+ <xsd:enumeration value="SpecialRequirementLookup"/>
+ <xsd:enumeration value="SpecialRequirementsCode"/>
+ <xsd:enumeration value="StandardIndustrialClassification"/>
+ <xsd:enumeration value="StandardOccupationClassificationCode"/>
+ <xsd:enumeration value="StandardTextAccordingUSEmbargoRegulations"/>
+ <xsd:enumeration value="StandardTextClauses"/>
+ <xsd:enumeration value="StandardTextForExportAccordingNationalPrescriptions"/>
+ <xsd:enumeration value="StateCode"/>
+ <xsd:enumeration value="StationClassification"/>
+ <xsd:enumeration value="StationClassificationType"/>
+ <xsd:enumeration value="StatisticalAdministrativeInformationCode"/>
+ <xsd:enumeration value="StatisticalNatureOfTransaction"/>
+ <xsd:enumeration value="StatisticalObject"/>
+ <xsd:enumeration value="StatisticalProcedures"/>
+ <xsd:enumeration value="StatisticBundesAmtCode"/>
+ <xsd:enumeration value="StatusCode"/>
+ <xsd:enumeration value="StockExchangeCode"/>
+ <xsd:enumeration value="StockExchangeDetail"/>
+ <xsd:enumeration value="StockFundOrNon-StockFundCode"/>
+ <xsd:enumeration value="StorageFacility"/>
+ <xsd:enumeration value="StudentActivityTypeCode"/>
+ <xsd:enumeration value="StudentAwardCode"/>
+ <xsd:enumeration value="SubcaseNumber"/>
+ <xsd:enumeration value="SubrogationActionCode"/>
+ <xsd:enumeration value="SubrogationPaymentOptions"/>
+ <xsd:enumeration value="SubrogationRequestCodes"/>
+ <xsd:enumeration value="SubrogationResponseCodes"/>
+ <xsd:enumeration value="SubsistenceTypeOfPackCode"/>
+ <xsd:enumeration value="SuffixCode"/>
+ <xsd:enumeration value="SuffixOrLimitCode"/>
+ <xsd:enumeration value="SummonsTypeCode"/>
+ <xsd:enumeration value="SupplementalData"/>
+ <xsd:enumeration value="SupplementaryAccountingClassificationCode"/>
+ <xsd:enumeration value="SuppliersStockTurnover"/>
+ <xsd:enumeration value="SupplyConditionCode"/>
+ <xsd:enumeration value="SurfaceDescriptorCode"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="SyntaxNotes"/>
+ <xsd:enumeration value="SystematizedNomenclatureOfHumanAndVeterinaryMedicine"/>
+ <xsd:enumeration value="SystemStatus"/>
+ <xsd:enumeration value="TariffSchedule"/>
+ <xsd:enumeration value="TaxAssessmentMethod"/>
+ <xsd:enumeration value="TaxOrFeeExemptionReasonCode"/>
+ <xsd:enumeration value="TaxPartyIdentification"/>
+ <xsd:enumeration value="TechnicalAssessmentChecklist"/>
+ <xsd:enumeration value="TelephoneDirectory"/>
+ <xsd:enumeration value="TemplateCharacteristicLookup"/>
+ <xsd:enumeration value="TemplateOwnerLookup"/>
+ <xsd:enumeration value="TemplateTypeLookup"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TermsOfDelivery"/>
+ <xsd:enumeration value="TertiaryDiagnosis"/>
+ <xsd:enumeration value="TestingDemographicCategoryCodeList"/>
+ <xsd:enumeration value="TestingServiceQuestionCodeList"/>
+ <xsd:enumeration value="TestingStatisticalCategoryCodeList"/>
+ <xsd:enumeration value="TestResultsCode"/>
+ <xsd:enumeration value="TitleDocumentCodeList"/>
+ <xsd:enumeration value="TitleExceptionAndRequirementCodeList"/>
+ <xsd:enumeration value="TradeCode"/>
+ <xsd:enumeration value="TrainIdentification"/>
+ <xsd:enumeration value="TransactionStatusIndicatorCode"/>
+ <xsd:enumeration value="TransportationBillCode"/>
+ <xsd:enumeration value="TransportationHoldingDelayCode"/>
+ <xsd:enumeration value="TransportationModeOrMethodCode"/>
+ <xsd:enumeration value="TransportationModeReasonCode"/>
+ <xsd:enumeration value="TransportationPriorityCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCodeAndBankServiceCode"/>
+ <xsd:enumeration value="TreasurySymbolCode"/>
+ <xsd:enumeration value="TreatmentCodes"/>
+ <xsd:enumeration value="TrendReason"/>
+ <xsd:enumeration value="TrialTypeCode"/>
+ <xsd:enumeration value="TypeAdjustmentCode"/>
+ <xsd:enumeration value="TypeAndCauseCode"/>
+ <xsd:enumeration value="TypeDue-InIndicator"/>
+ <xsd:enumeration value="TypeIdentityChangeCode"/>
+ <xsd:enumeration value="TypeInspectionCode"/>
+ <xsd:enumeration value="TypeNumericalControlSystemCode"/>
+ <xsd:enumeration value="TypeOfAssetsAndLiabilities"/>
+ <xsd:enumeration value="TypeOfAssistanceCode"/>
+ <xsd:enumeration value="TypeOfBillCode"/>
+ <xsd:enumeration value="TypeOfBusinessCode"/>
+ <xsd:enumeration value="TypeOfCargoCode"/>
+ <xsd:enumeration value="TypeOfContractCode"/>
+ <xsd:enumeration value="TypeOfContractorCode"/>
+ <xsd:enumeration value="TypeOfDelayCode"/>
+ <xsd:enumeration value="TypeOfFinancialAccount"/>
+ <xsd:enumeration value="TypeOfFirmCode"/>
+ <xsd:enumeration value="TypeOfIndustrialActivity"/>
+ <xsd:enumeration value="TypeOfInquiryCode"/>
+ <xsd:enumeration value="TypeOfInsured"/>
+ <xsd:enumeration value="TypeOfIssueCode"/>
+ <xsd:enumeration value="TypeOfLocationReconciliationRequest"/>
+ <xsd:enumeration value="TypeOfMediaCode"/>
+ <xsd:enumeration value="TypeOfPackage"/>
+ <xsd:enumeration value="TypeOfProcurement"/>
+ <xsd:enumeration value="TypeOfStorageCode"/>
+ <xsd:enumeration value="TypeOfSurveyQuestion"/>
+ <xsd:enumeration value="TypePackCode"/>
+ <xsd:enumeration value="TypePhysicalInventoryOrTransactionHistoryCode"/>
+ <xsd:enumeration value="UltimateRecipientCode"/>
+ <xsd:enumeration value="UnclaimedPropertyAdditionsDeletionsAndDeductionsCodes"/>
+ <xsd:enumeration value="UnclaimedPropertyTypeCode"/>
+ <xsd:enumeration value="UniformFreightClassificationCode"/>
+ <xsd:enumeration value="UniformResidentialAppraisalAttributesCode"/>
+ <xsd:enumeration value="UnitCode"/>
+ <xsd:enumeration value="UnitedNationsCommonCodingSystem"/>
+ <xsd:enumeration value="UnitedNationsStandardProductsAndServices"/>
+ <xsd:enumeration value="UnitedStatesDepartmentOfHealthAndHumanServicesOfficeOfVitalStatisticsE-Code"/>
+ <xsd:enumeration value="UnsolicitedProposalRejectionReason"/>
+ <xsd:enumeration value="UtilizationCode"/>
+ <xsd:enumeration value="VaccinationInnoculationOrIsolationCode"/>
+ <xsd:enumeration value="ValuationTypeCode"/>
+ <xsd:enumeration value="Value"/>
+ <xsd:enumeration value="ValueAddedTaxIdentification"/>
+ <xsd:enumeration value="VehicleClass"/>
+ <xsd:enumeration value="VehicleOccupantCode"/>
+ <xsd:enumeration value="VehicleParameters"/>
+ <xsd:enumeration value="VesselStatusAndTermsOfCarriageCode"/>
+ <xsd:enumeration value="VesselStowageLocationCode"/>
+ <xsd:enumeration value="VesselSustainingCode"/>
+ <xsd:enumeration value="ViewParameters"/>
+ <xsd:enumeration value="ViolationTypeCodeList"/>
+ <xsd:enumeration value="VoyageDocumentNumberCode"/>
+ <xsd:enumeration value="VoyageManifestReferenceCode"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WarReserveMaterialRequirementCode"/>
+ <xsd:enumeration value="WaterCommodityAndSpecialHandlingCode"/>
+ <xsd:enumeration value="WaterTerminalIdentifierCode"/>
+ <xsd:enumeration value="WeightOrFragilityCode"/>
+ <xsd:enumeration value="WhenDiscoveredLookup"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfIdentifier">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfIdentifier" type="ListOfIdentifier"/>
+ <xsd:complexType name="NameAddress">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ExternalAddressID" type="xsd:string"/>
+ <xsd:element name="Name1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Name2" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Name3" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Identifier"/>
+ <xsd:element minOccurs="0" ref="POBox"/>
+ <xsd:element minOccurs="0" name="Street" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HouseNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="StreetSupplement1" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="StreetSupplement2" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Building" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Floor" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RoomNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="InhouseMail" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Department" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PostalCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="City" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="County" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Region"/>
+ <xsd:element minOccurs="0" name="District" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Country"/>
+ <xsd:element minOccurs="0" ref="Timezone"/>
+ </xsd:sequence>
+ <xsd:attribute name="AddressTypeCoded" type="AddressTypeCode" use="optional" default="NotApplicable"/>
+ <xsd:attribute name="AddressTypeCodedOther" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="NameAddress" type="NameAddress"/>
+ <xsd:complexType name="POBox">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="POBoxPostalCode" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="POBox" type="POBox"/>
+ <xsd:complexType name="Region">
+ <xsd:sequence>
+ <xsd:element name="RegionCoded" type="RegionCode"/>
+ <xsd:element minOccurs="0" name="RegionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Region" type="Region"/>
+ <xsd:simpleType name="RegionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AUACT"/>
+ <xsd:enumeration value="AUNSW"/>
+ <xsd:enumeration value="AUNT"/>
+ <xsd:enumeration value="AUQLD"/>
+ <xsd:enumeration value="AUSA"/>
+ <xsd:enumeration value="AUTAS"/>
+ <xsd:enumeration value="AUVIC"/>
+ <xsd:enumeration value="AUWA"/>
+ <xsd:enumeration value="BRAC"/>
+ <xsd:enumeration value="BRAL"/>
+ <xsd:enumeration value="BRAM"/>
+ <xsd:enumeration value="BRAP"/>
+ <xsd:enumeration value="BRBA"/>
+ <xsd:enumeration value="BRCE"/>
+ <xsd:enumeration value="BRDF"/>
+ <xsd:enumeration value="BRES"/>
+ <xsd:enumeration value="BRGO"/>
+ <xsd:enumeration value="BRMA"/>
+ <xsd:enumeration value="BRMG"/>
+ <xsd:enumeration value="BRMS"/>
+ <xsd:enumeration value="BRMT"/>
+ <xsd:enumeration value="BRPA"/>
+ <xsd:enumeration value="BRPB"/>
+ <xsd:enumeration value="BRPE"/>
+ <xsd:enumeration value="BRPI"/>
+ <xsd:enumeration value="BRPR"/>
+ <xsd:enumeration value="BRRJ"/>
+ <xsd:enumeration value="BRRN"/>
+ <xsd:enumeration value="BRRO"/>
+ <xsd:enumeration value="BRRR"/>
+ <xsd:enumeration value="BRRS"/>
+ <xsd:enumeration value="BRSC"/>
+ <xsd:enumeration value="BRSE"/>
+ <xsd:enumeration value="BRSP"/>
+ <xsd:enumeration value="BRTO"/>
+ <xsd:enumeration value="CAAB"/>
+ <xsd:enumeration value="CABC"/>
+ <xsd:enumeration value="CAMB"/>
+ <xsd:enumeration value="CANB"/>
+ <xsd:enumeration value="CANF"/>
+ <xsd:enumeration value="CANS"/>
+ <xsd:enumeration value="CANT"/>
+ <xsd:enumeration value="CAON"/>
+ <xsd:enumeration value="CAPE"/>
+ <xsd:enumeration value="CAQC"/>
+ <xsd:enumeration value="CASK"/>
+ <xsd:enumeration value="CAYT"/>
+ <xsd:enumeration value="GBAM"/>
+ <xsd:enumeration value="GBAR"/>
+ <xsd:enumeration value="GBAT"/>
+ <xsd:enumeration value="GBBA"/>
+ <xsd:enumeration value="GBBB"/>
+ <xsd:enumeration value="GBBE"/>
+ <xsd:enumeration value="GBBF"/>
+ <xsd:enumeration value="GBBH"/>
+ <xsd:enumeration value="GBBK"/>
+ <xsd:enumeration value="GBBL"/>
+ <xsd:enumeration value="GBBM"/>
+ <xsd:enumeration value="GBBN"/>
+ <xsd:enumeration value="GBBO"/>
+ <xsd:enumeration value="GBBP"/>
+ <xsd:enumeration value="GBBR"/>
+ <xsd:enumeration value="GBBS"/>
+ <xsd:enumeration value="GBBU"/>
+ <xsd:enumeration value="GBBY"/>
+ <xsd:enumeration value="GBCA"/>
+ <xsd:enumeration value="GBCE"/>
+ <xsd:enumeration value="GBCG"/>
+ <xsd:enumeration value="GBCH"/>
+ <xsd:enumeration value="GBCI"/>
+ <xsd:enumeration value="GBCK"/>
+ <xsd:enumeration value="GBCL"/>
+ <xsd:enumeration value="GBCO"/>
+ <xsd:enumeration value="GBCR"/>
+ <xsd:enumeration value="GBCS"/>
+ <xsd:enumeration value="GBCU"/>
+ <xsd:enumeration value="GBCV"/>
+ <xsd:enumeration value="GBDB"/>
+ <xsd:enumeration value="GBDF"/>
+ <xsd:enumeration value="GBDG"/>
+ <xsd:enumeration value="GBDL"/>
+ <xsd:enumeration value="GBDN"/>
+ <xsd:enumeration value="GBDO"/>
+ <xsd:enumeration value="GBDU"/>
+ <xsd:enumeration value="GBDV"/>
+ <xsd:enumeration value="GBDY"/>
+ <xsd:enumeration value="GBER"/>
+ <xsd:enumeration value="GBES"/>
+ <xsd:enumeration value="GBFI"/>
+ <xsd:enumeration value="GBFM"/>
+ <xsd:enumeration value="GBGL"/>
+ <xsd:enumeration value="GBGM"/>
+ <xsd:enumeration value="GBGR"/>
+ <xsd:enumeration value="GBGS"/>
+ <xsd:enumeration value="GBGW"/>
+ <xsd:enumeration value="GBGY"/>
+ <xsd:enumeration value="GBHA"/>
+ <xsd:enumeration value="GBHI"/>
+ <xsd:enumeration value="GBHL"/>
+ <xsd:enumeration value="GBHR"/>
+ <xsd:enumeration value="GBHT"/>
+ <xsd:enumeration value="GBHW"/>
+ <xsd:enumeration value="GBIW"/>
+ <xsd:enumeration value="GBKE"/>
+ <xsd:enumeration value="GBKH"/>
+ <xsd:enumeration value="GBLA"/>
+ <xsd:enumeration value="GBLC"/>
+ <xsd:enumeration value="GBLD"/>
+ <xsd:enumeration value="GBLE"/>
+ <xsd:enumeration value="GBLI"/>
+ <xsd:enumeration value="GBLM"/>
+ <xsd:enumeration value="GBLO"/>
+ <xsd:enumeration value="GBLR"/>
+ <xsd:enumeration value="GBLS"/>
+ <xsd:enumeration value="GBLT"/>
+ <xsd:enumeration value="GBLU"/>
+ <xsd:enumeration value="GBMA"/>
+ <xsd:enumeration value="GBMG"/>
+ <xsd:enumeration value="GBMI"/>
+ <xsd:enumeration value="GBMK"/>
+ <xsd:enumeration value="GBMO"/>
+ <xsd:enumeration value="GBMY"/>
+ <xsd:enumeration value="GBNA"/>
+ <xsd:enumeration value="GBNB"/>
+ <xsd:enumeration value="GBNC"/>
+ <xsd:enumeration value="GBND"/>
+ <xsd:enumeration value="GBNE"/>
+ <xsd:enumeration value="GBNH"/>
+ <xsd:enumeration value="GBNK"/>
+ <xsd:enumeration value="GBNL"/>
+ <xsd:enumeration value="GBNM"/>
+ <xsd:enumeration value="GBNS"/>
+ <xsd:enumeration value="GBNT"/>
+ <xsd:enumeration value="GBNU"/>
+ <xsd:enumeration value="GBOM"/>
+ <xsd:enumeration value="GBOR"/>
+ <xsd:enumeration value="GBOX"/>
+ <xsd:enumeration value="GBPB"/>
+ <xsd:enumeration value="GBPL"/>
+ <xsd:enumeration value="GBPM"/>
+ <xsd:enumeration value="GBPO"/>
+ <xsd:enumeration value="GBPY"/>
+ <xsd:enumeration value="GBRD"/>
+ <xsd:enumeration value="GBRE"/>
+ <xsd:enumeration value="GBRM"/>
+ <xsd:enumeration value="GBRU"/>
+ <xsd:enumeration value="GBSC"/>
+ <xsd:enumeration value="GBSD"/>
+ <xsd:enumeration value="GBSE"/>
+ <xsd:enumeration value="GBSG"/>
+ <xsd:enumeration value="GBSH"/>
+ <xsd:enumeration value="GBSK"/>
+ <xsd:enumeration value="GBSL"/>
+ <xsd:enumeration value="GBSN"/>
+ <xsd:enumeration value="GBSO"/>
+ <xsd:enumeration value="GBSP"/>
+ <xsd:enumeration value="GBSR"/>
+ <xsd:enumeration value="GBST"/>
+ <xsd:enumeration value="GBSU"/>
+ <xsd:enumeration value="GBSW"/>
+ <xsd:enumeration value="GBSY"/>
+ <xsd:enumeration value="GBTA"/>
+ <xsd:enumeration value="GBTD"/>
+ <xsd:enumeration value="GBTH"/>
+ <xsd:enumeration value="GBTO"/>
+ <xsd:enumeration value="GBTW"/>
+ <xsd:enumeration value="GBWA"/>
+ <xsd:enumeration value="GBWD"/>
+ <xsd:enumeration value="GBWG"/>
+ <xsd:enumeration value="GBWI"/>
+ <xsd:enumeration value="GBWL"/>
+ <xsd:enumeration value="GBWM"/>
+ <xsd:enumeration value="GBWO"/>
+ <xsd:enumeration value="GBWR"/>
+ <xsd:enumeration value="GBWT"/>
+ <xsd:enumeration value="GBYK"/>
+ <xsd:enumeration value="GBYN"/>
+ <xsd:enumeration value="GBYS"/>
+ <xsd:enumeration value="GBYW"/>
+ <xsd:enumeration value="ITAG"/>
+ <xsd:enumeration value="ITAL"/>
+ <xsd:enumeration value="ITAN"/>
+ <xsd:enumeration value="ITAO"/>
+ <xsd:enumeration value="ITAP"/>
+ <xsd:enumeration value="ITAQ"/>
+ <xsd:enumeration value="ITAR"/>
+ <xsd:enumeration value="ITAT"/>
+ <xsd:enumeration value="ITAV"/>
+ <xsd:enumeration value="ITBA"/>
+ <xsd:enumeration value="ITBG"/>
+ <xsd:enumeration value="ITBI"/>
+ <xsd:enumeration value="ITBL"/>
+ <xsd:enumeration value="ITBN"/>
+ <xsd:enumeration value="ITBO"/>
+ <xsd:enumeration value="ITBR"/>
+ <xsd:enumeration value="ITBS"/>
+ <xsd:enumeration value="ITBZ"/>
+ <xsd:enumeration value="ITCA"/>
+ <xsd:enumeration value="ITCB"/>
+ <xsd:enumeration value="ITCE"/>
+ <xsd:enumeration value="ITCH"/>
+ <xsd:enumeration value="ITCL"/>
+ <xsd:enumeration value="ITCN"/>
+ <xsd:enumeration value="ITCO"/>
+ <xsd:enumeration value="ITCR"/>
+ <xsd:enumeration value="ITCS"/>
+ <xsd:enumeration value="ITCT"/>
+ <xsd:enumeration value="ITCZ"/>
+ <xsd:enumeration value="ITEN"/>
+ <xsd:enumeration value="ITFE"/>
+ <xsd:enumeration value="ITFG"/>
+ <xsd:enumeration value="ITFI"/>
+ <xsd:enumeration value="ITFO"/>
+ <xsd:enumeration value="ITFR"/>
+ <xsd:enumeration value="ITGE"/>
+ <xsd:enumeration value="ITGO"/>
+ <xsd:enumeration value="ITGR"/>
+ <xsd:enumeration value="ITIM"/>
+ <xsd:enumeration value="ITIS"/>
+ <xsd:enumeration value="ITKR"/>
+ <xsd:enumeration value="ITLC"/>
+ <xsd:enumeration value="ITLE"/>
+ <xsd:enumeration value="ITLI"/>
+ <xsd:enumeration value="ITLO"/>
+ <xsd:enumeration value="ITLT"/>
+ <xsd:enumeration value="ITLU"/>
+ <xsd:enumeration value="ITMC"/>
+ <xsd:enumeration value="ITME"/>
+ <xsd:enumeration value="ITMI"/>
+ <xsd:enumeration value="ITMN"/>
+ <xsd:enumeration value="ITMO"/>
+ <xsd:enumeration value="ITMS"/>
+ <xsd:enumeration value="ITMT"/>
+ <xsd:enumeration value="ITNA"/>
+ <xsd:enumeration value="ITNO"/>
+ <xsd:enumeration value="ITNU"/>
+ <xsd:enumeration value="ITOR"/>
+ <xsd:enumeration value="ITPA"/>
+ <xsd:enumeration value="ITPC"/>
+ <xsd:enumeration value="ITPD"/>
+ <xsd:enumeration value="ITPE"/>
+ <xsd:enumeration value="ITPG"/>
+ <xsd:enumeration value="ITPI"/>
+ <xsd:enumeration value="ITPN"/>
+ <xsd:enumeration value="ITPO"/>
+ <xsd:enumeration value="ITPR"/>
+ <xsd:enumeration value="ITPS"/>
+ <xsd:enumeration value="ITPT"/>
+ <xsd:enumeration value="ITPV"/>
+ <xsd:enumeration value="ITPZ"/>
+ <xsd:enumeration value="ITRA"/>
+ <xsd:enumeration value="ITRC"/>
+ <xsd:enumeration value="ITRE"/>
+ <xsd:enumeration value="ITRG"/>
+ <xsd:enumeration value="ITRI"/>
+ <xsd:enumeration value="ITRM"/>
+ <xsd:enumeration value="ITRN"/>
+ <xsd:enumeration value="ITRO"/>
+ <xsd:enumeration value="ITRV"/>
+ <xsd:enumeration value="ITSA"/>
+ <xsd:enumeration value="ITSI"/>
+ <xsd:enumeration value="ITSO"/>
+ <xsd:enumeration value="ITSP"/>
+ <xsd:enumeration value="ITSR"/>
+ <xsd:enumeration value="ITSS"/>
+ <xsd:enumeration value="ITSV"/>
+ <xsd:enumeration value="ITTA"/>
+ <xsd:enumeration value="ITTE"/>
+ <xsd:enumeration value="ITTN"/>
+ <xsd:enumeration value="ITTO"/>
+ <xsd:enumeration value="ITTP"/>
+ <xsd:enumeration value="ITTR"/>
+ <xsd:enumeration value="ITTS"/>
+ <xsd:enumeration value="ITTV"/>
+ <xsd:enumeration value="ITUD"/>
+ <xsd:enumeration value="ITVA"/>
+ <xsd:enumeration value="ITVC"/>
+ <xsd:enumeration value="ITVE"/>
+ <xsd:enumeration value="ITVI"/>
+ <xsd:enumeration value="ITVR"/>
+ <xsd:enumeration value="ITVT"/>
+ <xsd:enumeration value="ITVV"/>
+ <xsd:enumeration value="USAK"/>
+ <xsd:enumeration value="USAL"/>
+ <xsd:enumeration value="USAR"/>
+ <xsd:enumeration value="USAS"/>
+ <xsd:enumeration value="USAZ"/>
+ <xsd:enumeration value="USCA"/>
+ <xsd:enumeration value="USCO"/>
+ <xsd:enumeration value="USCT"/>
+ <xsd:enumeration value="USDC"/>
+ <xsd:enumeration value="USDE"/>
+ <xsd:enumeration value="USFL"/>
+ <xsd:enumeration value="USGA"/>
+ <xsd:enumeration value="USGU"/>
+ <xsd:enumeration value="USHI"/>
+ <xsd:enumeration value="USIA"/>
+ <xsd:enumeration value="USID"/>
+ <xsd:enumeration value="USIL"/>
+ <xsd:enumeration value="USIN"/>
+ <xsd:enumeration value="USKS"/>
+ <xsd:enumeration value="USKY"/>
+ <xsd:enumeration value="USLA"/>
+ <xsd:enumeration value="USMA"/>
+ <xsd:enumeration value="USMD"/>
+ <xsd:enumeration value="USME"/>
+ <xsd:enumeration value="USMI"/>
+ <xsd:enumeration value="USMN"/>
+ <xsd:enumeration value="USMO"/>
+ <xsd:enumeration value="USMP"/>
+ <xsd:enumeration value="USMS"/>
+ <xsd:enumeration value="USMT"/>
+ <xsd:enumeration value="USNC"/>
+ <xsd:enumeration value="USND"/>
+ <xsd:enumeration value="USNE"/>
+ <xsd:enumeration value="USNH"/>
+ <xsd:enumeration value="USNJ"/>
+ <xsd:enumeration value="USNM"/>
+ <xsd:enumeration value="USNV"/>
+ <xsd:enumeration value="USNY"/>
+ <xsd:enumeration value="USOH"/>
+ <xsd:enumeration value="USOK"/>
+ <xsd:enumeration value="USOR"/>
+ <xsd:enumeration value="USPA"/>
+ <xsd:enumeration value="USPR"/>
+ <xsd:enumeration value="USRI"/>
+ <xsd:enumeration value="USSC"/>
+ <xsd:enumeration value="USSD"/>
+ <xsd:enumeration value="USTN"/>
+ <xsd:enumeration value="USTX"/>
+ <xsd:enumeration value="USUT"/>
+ <xsd:enumeration value="USVA"/>
+ <xsd:enumeration value="USVI"/>
+ <xsd:enumeration value="USVT"/>
+ <xsd:enumeration value="USWA"/>
+ <xsd:enumeration value="USWI"/>
+ <xsd:enumeration value="USWV"/>
+ <xsd:enumeration value="USWY"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Country">
+ <xsd:sequence>
+ <xsd:element name="CountryCoded" type="CountryCode"/>
+ <xsd:element minOccurs="0" name="CountryCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Country" type="Country"/>
+ <xsd:simpleType name="CountryCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AE"/>
+ <xsd:enumeration value="AF"/>
+ <xsd:enumeration value="AG"/>
+ <xsd:enumeration value="AI"/>
+ <xsd:enumeration value="AL"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="AN"/>
+ <xsd:enumeration value="AO"/>
+ <xsd:enumeration value="AQ"/>
+ <xsd:enumeration value="AR"/>
+ <xsd:enumeration value="AS"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="AU"/>
+ <xsd:enumeration value="AW"/>
+ <xsd:enumeration value="AZ"/>
+ <xsd:enumeration value="BA"/>
+ <xsd:enumeration value="BB"/>
+ <xsd:enumeration value="BD"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BF"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BH"/>
+ <xsd:enumeration value="BI"/>
+ <xsd:enumeration value="BJ"/>
+ <xsd:enumeration value="BM"/>
+ <xsd:enumeration value="BN"/>
+ <xsd:enumeration value="BO"/>
+ <xsd:enumeration value="BR"/>
+ <xsd:enumeration value="BS"/>
+ <xsd:enumeration value="BT"/>
+ <xsd:enumeration value="BU"/>
+ <xsd:enumeration value="BW"/>
+ <xsd:enumeration value="BY"/>
+ <xsd:enumeration value="BZ"/>
+ <xsd:enumeration value="CA"/>
+ <xsd:enumeration value="CC"/>
+ <xsd:enumeration value="CD"/>
+ <xsd:enumeration value="CF"/>
+ <xsd:enumeration value="CG"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CI"/>
+ <xsd:enumeration value="CK"/>
+ <xsd:enumeration value="CL"/>
+ <xsd:enumeration value="CM"/>
+ <xsd:enumeration value="CN"/>
+ <xsd:enumeration value="CO"/>
+ <xsd:enumeration value="CR"/>
+ <xsd:enumeration value="CS"/>
+ <xsd:enumeration value="CU"/>
+ <xsd:enumeration value="CV"/>
+ <xsd:enumeration value="CX"/>
+ <xsd:enumeration value="CY"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DJ"/>
+ <xsd:enumeration value="DK"/>
+ <xsd:enumeration value="DM"/>
+ <xsd:enumeration value="DO"/>
+ <xsd:enumeration value="DZ"/>
+ <xsd:enumeration value="EC"/>
+ <xsd:enumeration value="EE"/>
+ <xsd:enumeration value="EG"/>
+ <xsd:enumeration value="EH"/>
+ <xsd:enumeration value="ER"/>
+ <xsd:enumeration value="ES"/>
+ <xsd:enumeration value="ET"/>
+ <xsd:enumeration value="FI"/>
+ <xsd:enumeration value="FJ"/>
+ <xsd:enumeration value="FK"/>
+ <xsd:enumeration value="FM"/>
+ <xsd:enumeration value="FO"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="GA"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GD"/>
+ <xsd:enumeration value="GE"/>
+ <xsd:enumeration value="GF"/>
+ <xsd:enumeration value="GH"/>
+ <xsd:enumeration value="GI"/>
+ <xsd:enumeration value="GL"/>
+ <xsd:enumeration value="GM"/>
+ <xsd:enumeration value="GN"/>
+ <xsd:enumeration value="GP"/>
+ <xsd:enumeration value="GQ"/>
+ <xsd:enumeration value="GR"/>
+ <xsd:enumeration value="GS"/>
+ <xsd:enumeration value="GT"/>
+ <xsd:enumeration value="GU"/>
+ <xsd:enumeration value="GW"/>
+ <xsd:enumeration value="GY"/>
+ <xsd:enumeration value="HK"/>
+ <xsd:enumeration value="HN"/>
+ <xsd:enumeration value="HR"/>
+ <xsd:enumeration value="HT"/>
+ <xsd:enumeration value="HU"/>
+ <xsd:enumeration value="ID"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IL"/>
+ <xsd:enumeration value="IN"/>
+ <xsd:enumeration value="IO"/>
+ <xsd:enumeration value="IQ"/>
+ <xsd:enumeration value="IR"/>
+ <xsd:enumeration value="IS"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="JM"/>
+ <xsd:enumeration value="JO"/>
+ <xsd:enumeration value="JP"/>
+ <xsd:enumeration value="KE"/>
+ <xsd:enumeration value="KG"/>
+ <xsd:enumeration value="KH"/>
+ <xsd:enumeration value="KI"/>
+ <xsd:enumeration value="KM"/>
+ <xsd:enumeration value="KN"/>
+ <xsd:enumeration value="KP"/>
+ <xsd:enumeration value="KR"/>
+ <xsd:enumeration value="KW"/>
+ <xsd:enumeration value="KY"/>
+ <xsd:enumeration value="KZ"/>
+ <xsd:enumeration value="LA"/>
+ <xsd:enumeration value="LB"/>
+ <xsd:enumeration value="LC"/>
+ <xsd:enumeration value="LI"/>
+ <xsd:enumeration value="LK"/>
+ <xsd:enumeration value="LR"/>
+ <xsd:enumeration value="LS"/>
+ <xsd:enumeration value="LT"/>
+ <xsd:enumeration value="LU"/>
+ <xsd:enumeration value="LV"/>
+ <xsd:enumeration value="LY"/>
+ <xsd:enumeration value="MA"/>
+ <xsd:enumeration value="MC"/>
+ <xsd:enumeration value="MD"/>
+ <xsd:enumeration value="MG"/>
+ <xsd:enumeration value="MH"/>
+ <xsd:enumeration value="MK"/>
+ <xsd:enumeration value="ML"/>
+ <xsd:enumeration value="MM"/>
+ <xsd:enumeration value="MN"/>
+ <xsd:enumeration value="MO"/>
+ <xsd:enumeration value="MP"/>
+ <xsd:enumeration value="MQ"/>
+ <xsd:enumeration value="MR"/>
+ <xsd:enumeration value="MS"/>
+ <xsd:enumeration value="MT"/>
+ <xsd:enumeration value="MU"/>
+ <xsd:enumeration value="MV"/>
+ <xsd:enumeration value="MW"/>
+ <xsd:enumeration value="MX"/>
+ <xsd:enumeration value="MY"/>
+ <xsd:enumeration value="MZ"/>
+ <xsd:enumeration value="NA"/>
+ <xsd:enumeration value="NC"/>
+ <xsd:enumeration value="NE"/>
+ <xsd:enumeration value="NF"/>
+ <xsd:enumeration value="NG"/>
+ <xsd:enumeration value="NI"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NO"/>
+ <xsd:enumeration value="NP"/>
+ <xsd:enumeration value="NR"/>
+ <xsd:enumeration value="NU"/>
+ <xsd:enumeration value="NZ"/>
+ <xsd:enumeration value="OM"/>
+ <xsd:enumeration value="PA"/>
+ <xsd:enumeration value="PE"/>
+ <xsd:enumeration value="PF"/>
+ <xsd:enumeration value="PG"/>
+ <xsd:enumeration value="PH"/>
+ <xsd:enumeration value="PK"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PN"/>
+ <xsd:enumeration value="PR"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PW"/>
+ <xsd:enumeration value="PY"/>
+ <xsd:enumeration value="QA"/>
+ <xsd:enumeration value="RE"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RU"/>
+ <xsd:enumeration value="RW"/>
+ <xsd:enumeration value="SA"/>
+ <xsd:enumeration value="SB"/>
+ <xsd:enumeration value="SC"/>
+ <xsd:enumeration value="SD"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SG"/>
+ <xsd:enumeration value="SH"/>
+ <xsd:enumeration value="SI"/>
+ <xsd:enumeration value="SJ"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SL"/>
+ <xsd:enumeration value="SM"/>
+ <xsd:enumeration value="SN"/>
+ <xsd:enumeration value="SO"/>
+ <xsd:enumeration value="SR"/>
+ <xsd:enumeration value="ST"/>
+ <xsd:enumeration value="SV"/>
+ <xsd:enumeration value="SY"/>
+ <xsd:enumeration value="SZ"/>
+ <xsd:enumeration value="TC"/>
+ <xsd:enumeration value="TD"/>
+ <xsd:enumeration value="TF"/>
+ <xsd:enumeration value="TG"/>
+ <xsd:enumeration value="TH"/>
+ <xsd:enumeration value="TJ"/>
+ <xsd:enumeration value="TM"/>
+ <xsd:enumeration value="TN"/>
+ <xsd:enumeration value="TO"/>
+ <xsd:enumeration value="TP"/>
+ <xsd:enumeration value="TR"/>
+ <xsd:enumeration value="TT"/>
+ <xsd:enumeration value="TV"/>
+ <xsd:enumeration value="TW"/>
+ <xsd:enumeration value="TZ"/>
+ <xsd:enumeration value="UA"/>
+ <xsd:enumeration value="UG"/>
+ <xsd:enumeration value="UM"/>
+ <xsd:enumeration value="US"/>
+ <xsd:enumeration value="UY"/>
+ <xsd:enumeration value="UZ"/>
+ <xsd:enumeration value="VA"/>
+ <xsd:enumeration value="VC"/>
+ <xsd:enumeration value="VE"/>
+ <xsd:enumeration value="VG"/>
+ <xsd:enumeration value="VI"/>
+ <xsd:enumeration value="VN"/>
+ <xsd:enumeration value="VU"/>
+ <xsd:enumeration value="WF"/>
+ <xsd:enumeration value="WS"/>
+ <xsd:enumeration value="YE"/>
+ <xsd:enumeration value="YT"/>
+ <xsd:enumeration value="YU"/>
+ <xsd:enumeration value="ZA"/>
+ <xsd:enumeration value="ZM"/>
+ <xsd:enumeration value="ZW"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Timezone">
+ <xsd:sequence>
+ <xsd:element name="TimezoneCoded" type="TimezoneCode"/>
+ <xsd:element minOccurs="0" name="TimezoneCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Timezone" type="Timezone"/>
+ <xsd:simpleType name="TimezoneCode">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="12.00"/>
+ <xsd:enumeration value="11.45"/>
+ <xsd:enumeration value="11.30"/>
+ <xsd:enumeration value="11.15"/>
+ <xsd:enumeration value="11.00"/>
+ <xsd:enumeration value="10.45"/>
+ <xsd:enumeration value="10.30"/>
+ <xsd:enumeration value="10.15"/>
+ <xsd:enumeration value="10.00"/>
+ <xsd:enumeration value="09.45"/>
+ <xsd:enumeration value="09.30"/>
+ <xsd:enumeration value="09.15"/>
+ <xsd:enumeration value="09.00"/>
+ <xsd:enumeration value="08.45"/>
+ <xsd:enumeration value="08.30"/>
+ <xsd:enumeration value="08.15"/>
+ <xsd:enumeration value="08.00"/>
+ <xsd:enumeration value="07.45"/>
+ <xsd:enumeration value="07.30"/>
+ <xsd:enumeration value="07.15"/>
+ <xsd:enumeration value="07.00"/>
+ <xsd:enumeration value="06.45"/>
+ <xsd:enumeration value="06.30"/>
+ <xsd:enumeration value="06.15"/>
+ <xsd:enumeration value="06.00"/>
+ <xsd:enumeration value="05.45"/>
+ <xsd:enumeration value="05.30"/>
+ <xsd:enumeration value="05.15"/>
+ <xsd:enumeration value="05.00"/>
+ <xsd:enumeration value="04.45"/>
+ <xsd:enumeration value="04.30"/>
+ <xsd:enumeration value="04.15"/>
+ <xsd:enumeration value="04.00"/>
+ <xsd:enumeration value="03.45"/>
+ <xsd:enumeration value="03.30"/>
+ <xsd:enumeration value="03.15"/>
+ <xsd:enumeration value="03.00"/>
+ <xsd:enumeration value="02.45"/>
+ <xsd:enumeration value="02.30"/>
+ <xsd:enumeration value="02.15"/>
+ <xsd:enumeration value="02.00"/>
+ <xsd:enumeration value="01.45"/>
+ <xsd:enumeration value="01.30"/>
+ <xsd:enumeration value="01.15"/>
+ <xsd:enumeration value="01.00"/>
+ <xsd:enumeration value="00.45"/>
+ <xsd:enumeration value="00.30"/>
+ <xsd:enumeration value="00.15"/>
+ <xsd:enumeration value="00.00"/>
+ <xsd:enumeration value="-00.15"/>
+ <xsd:enumeration value="-00.30"/>
+ <xsd:enumeration value="-00.45"/>
+ <xsd:enumeration value="-01.00"/>
+ <xsd:enumeration value="-01.15"/>
+ <xsd:enumeration value="-01.30"/>
+ <xsd:enumeration value="-01.45"/>
+ <xsd:enumeration value="-02.00"/>
+ <xsd:enumeration value="-02.15"/>
+ <xsd:enumeration value="-02.30"/>
+ <xsd:enumeration value="-02.45"/>
+ <xsd:enumeration value="-03.00"/>
+ <xsd:enumeration value="-03.15"/>
+ <xsd:enumeration value="-03.30"/>
+ <xsd:enumeration value="-03.45"/>
+ <xsd:enumeration value="-04.00"/>
+ <xsd:enumeration value="-04.15"/>
+ <xsd:enumeration value="-04.30"/>
+ <xsd:enumeration value="-04.45"/>
+ <xsd:enumeration value="-05.00"/>
+ <xsd:enumeration value="-05.15"/>
+ <xsd:enumeration value="-05.30"/>
+ <xsd:enumeration value="-05.45"/>
+ <xsd:enumeration value="-06.00"/>
+ <xsd:enumeration value="-06.15"/>
+ <xsd:enumeration value="-06.30"/>
+ <xsd:enumeration value="-06.45"/>
+ <xsd:enumeration value="-07.00"/>
+ <xsd:enumeration value="-07.15"/>
+ <xsd:enumeration value="-07.30"/>
+ <xsd:enumeration value="-07.45"/>
+ <xsd:enumeration value="-08.00"/>
+ <xsd:enumeration value="-08.15"/>
+ <xsd:enumeration value="-08.30"/>
+ <xsd:enumeration value="-08.45"/>
+ <xsd:enumeration value="-09.00"/>
+ <xsd:enumeration value="-09.15"/>
+ <xsd:enumeration value="-09.30"/>
+ <xsd:enumeration value="-09.45"/>
+ <xsd:enumeration value="-10.00"/>
+ <xsd:enumeration value="-10.15"/>
+ <xsd:enumeration value="-10.30"/>
+ <xsd:enumeration value="-10.45"/>
+ <xsd:enumeration value="-11.00"/>
+ <xsd:enumeration value="-11.15"/>
+ <xsd:enumeration value="-11.30"/>
+ <xsd:enumeration value="-11.45"/>
+ <xsd:enumeration value="-12.00"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="AddressTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceLocation"/>
+ <xsd:enumeration value="AccountsPayableOffice"/>
+ <xsd:enumeration value="AcknowledgementRecipient"/>
+ <xsd:enumeration value="AdditionalAddress"/>
+ <xsd:enumeration value="AdditionalDeliveryAddress"/>
+ <xsd:enumeration value="AdditionalPickUpAddress"/>
+ <xsd:enumeration value="AlcoholBeverageDepartment"/>
+ <xsd:enumeration value="AlternateReturnAddress"/>
+ <xsd:enumeration value="AlternativeAddressee"/>
+ <xsd:enumeration value="AuditOffice"/>
+ <xsd:enumeration value="BailmentWarehouse"/>
+ <xsd:enumeration value="BidOpeningLocation"/>
+ <xsd:enumeration value="BillAndShipTo"/>
+ <xsd:enumeration value="BilledFrom"/>
+ <xsd:enumeration value="BillOfLadingRecipient"/>
+ <xsd:enumeration value="BillTo"/>
+ <xsd:enumeration value="BookingOffice"/>
+ <xsd:enumeration value="CandyAndConfectionsDepartment"/>
+ <xsd:enumeration value="ChangedAddress"/>
+ <xsd:enumeration value="CompanyAssignedWell"/>
+ <xsd:enumeration value="Company-OwnedOilField"/>
+ <xsd:enumeration value="ConsigneeCourierTransferStation"/>
+ <xsd:enumeration value="ConsignorCourierTransferStation"/>
+ <xsd:enumeration value="ConsultantsOffice"/>
+ <xsd:enumeration value="ContactOffice"/>
+ <xsd:enumeration value="ContainerLocation"/>
+ <xsd:enumeration value="CopyMessageTo"/>
+ <xsd:enumeration value="CorporateOffice"/>
+ <xsd:enumeration value="CorrectedAddress"/>
+ <xsd:enumeration value="DeliveryAddress"/>
+ <xsd:enumeration value="DestinationMailFacility"/>
+ <xsd:enumeration value="DifferentPremiseAddress"/>
+ <xsd:enumeration value="DistributionRecipient"/>
+ <xsd:enumeration value="DocumentOrMessageIssuerOrSender"/>
+ <xsd:enumeration value="DocumentRecipient"/>
+ <xsd:enumeration value="DomesticFinancialInstitution"/>
+ <xsd:enumeration value="DownstreamMeterLocation"/>
+ <xsd:enumeration value="Drop-OffLocation"/>
+ <xsd:enumeration value="EmergencyDepartment"/>
+ <xsd:enumeration value="EstablishedLocation"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="FilingAddress"/>
+ <xsd:enumeration value="FilingLocation"/>
+ <xsd:enumeration value="FilingOffice"/>
+ <xsd:enumeration value="FinalMessageRecipient"/>
+ <xsd:enumeration value="FinalRecipient"/>
+ <xsd:enumeration value="FinalScheduledDestination"/>
+ <xsd:enumeration value="FinancialInstitution"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FloralDepartment"/>
+ <xsd:enumeration value="ForeignDisclosureInformationOffice"/>
+ <xsd:enumeration value="ForeignOffice"/>
+ <xsd:enumeration value="ForeignRegistrationLocation"/>
+ <xsd:enumeration value="FormerAddress"/>
+ <xsd:enumeration value="FreeonBoardPoint"/>
+ <xsd:enumeration value="FrozenDepartment"/>
+ <xsd:enumeration value="GaragedLocation"/>
+ <xsd:enumeration value="GasPlant"/>
+ <xsd:enumeration value="GasTransactionEndingPoint"/>
+ <xsd:enumeration value="GasTransactionPoint1"/>
+ <xsd:enumeration value="GasTransactionPoint2"/>
+ <xsd:enumeration value="GasTransactionStartingPoint"/>
+ <xsd:enumeration value="HazardousMaterialOffice"/>
+ <xsd:enumeration value="HeadOffice"/>
+ <xsd:enumeration value="HomeOffice"/>
+ <xsd:enumeration value="ImportedFromLocation"/>
+ <xsd:enumeration value="IncorporatedLocation"/>
+ <xsd:enumeration value="IncorporationStatePlaceOfBusiness"/>
+ <xsd:enumeration value="IncorporationStatePrincipalOffice"/>
+ <xsd:enumeration value="InquiryAddress"/>
+ <xsd:enumeration value="InspectionAddress"/>
+ <xsd:enumeration value="InspectionAndAcceptanceLocation"/>
+ <xsd:enumeration value="InspectionLocation"/>
+ <xsd:enumeration value="InstalledAt"/>
+ <xsd:enumeration value="In-StoreBakeryDepartment"/>
+ <xsd:enumeration value="InsuredLocation"/>
+ <xsd:enumeration value="Laboratory"/>
+ <xsd:enumeration value="LastBreakTerminal"/>
+ <xsd:enumeration value="LeaseLocation"/>
+ <xsd:enumeration value="ListingOffice"/>
+ <xsd:enumeration value="LocalChain"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationOfGoodsForCustomsExaminationBeforeClearance"/>
+ <xsd:enumeration value="LocationOfLoadExchange"/>
+ <xsd:enumeration value="LocationOfSpotForStorage"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MailAddress"/>
+ <xsd:enumeration value="MailTo"/>
+ <xsd:enumeration value="ManufacturingPlant"/>
+ <xsd:enumeration value="MasterProperty"/>
+ <xsd:enumeration value="MaterialChangeNoticeAddress"/>
+ <xsd:enumeration value="MaterialDispositionAuthorizationLocation"/>
+ <xsd:enumeration value="MeatDepartment"/>
+ <xsd:enumeration value="MeetingLocation"/>
+ <xsd:enumeration value="MessageFrom"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageTo"/>
+ <xsd:enumeration value="Neighborhood"/>
+ <xsd:enumeration value="NewAddress"/>
+ <xsd:enumeration value="NewSupplySource"/>
+ <xsd:enumeration value="NextDestination"/>
+ <xsd:enumeration value="NextScheduledDestination"/>
+ <xsd:enumeration value="Non-TemporaryStorageFacility"/>
+ <xsd:enumeration value="NotApplicable"/>
+ <xsd:enumeration value="OperatorOfTheTransferPoint"/>
+ <xsd:enumeration value="OriginalLocation"/>
+ <xsd:enumeration value="OriginMailFacility"/>
+ <xsd:enumeration value="OriginSublocation"/>
+ <xsd:enumeration value="OriginTerminal"/>
+ <xsd:enumeration value="OtherDepartments"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaLocation"/>
+ <xsd:enumeration value="Out-Of-StatePrincipalOffice"/>
+ <xsd:enumeration value="OwningInventoryControlPoint"/>
+ <xsd:enumeration value="PartSource"/>
+ <xsd:enumeration value="PaymentAddress"/>
+ <xsd:enumeration value="PersonnelOffice"/>
+ <xsd:enumeration value="PharmacyDepartment"/>
+ <xsd:enumeration value="PhysicalAddress"/>
+ <xsd:enumeration value="PickUpAddress"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PipelineSegment"/>
+ <xsd:enumeration value="PipelineSegmentBoundary"/>
+ <xsd:enumeration value="PlaceOfBottling"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="PostalMailingAddress"/>
+ <xsd:enumeration value="PreliminaryInspectionLocation"/>
+ <xsd:enumeration value="Premises"/>
+ <xsd:enumeration value="PresentAddress"/>
+ <xsd:enumeration value="PrimaryControlPointLocation"/>
+ <xsd:enumeration value="ProduceDepartment"/>
+ <xsd:enumeration value="ProductServicesAndRepairsCentre"/>
+ <xsd:enumeration value="ProjectCoordinationOffice"/>
+ <xsd:enumeration value="ProjectManagementOffice"/>
+ <xsd:enumeration value="ProjectProperty"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="QualityControl"/>
+ <xsd:enumeration value="RadioControlStationLocation"/>
+ <xsd:enumeration value="Railroad"/>
+ <xsd:enumeration value="ReceiptMeterLocation"/>
+ <xsd:enumeration value="ReceiptZone"/>
+ <xsd:enumeration value="ReceivedFrom"/>
+ <xsd:enumeration value="ReceiverSite"/>
+ <xsd:enumeration value="ReceivingLocation"/>
+ <xsd:enumeration value="ReceivingPointForCustomerSamples"/>
+ <xsd:enumeration value="ReceivingSub-Location"/>
+ <xsd:enumeration value="ReclamationCenter"/>
+ <xsd:enumeration value="Record-KeepingAddress"/>
+ <xsd:enumeration value="Refinery"/>
+ <xsd:enumeration value="RegionalOffice"/>
+ <xsd:enumeration value="RegisteredOffice"/>
+ <xsd:enumeration value="ReleaseTo"/>
+ <xsd:enumeration value="RemitTo"/>
+ <xsd:enumeration value="RepairingOutlet"/>
+ <xsd:enumeration value="RepairOrRefurbishLocation"/>
+ <xsd:enumeration value="ReportingLocation"/>
+ <xsd:enumeration value="ResearchInstitute"/>
+ <xsd:enumeration value="ResidenceOrDomicile"/>
+ <xsd:enumeration value="ReturnedTo"/>
+ <xsd:enumeration value="RoutingPoint"/>
+ <xsd:enumeration value="SalesOffice"/>
+ <xsd:enumeration value="SamplesToBeReturnedTo"/>
+ <xsd:enumeration value="SamplingLocation"/>
+ <xsd:enumeration value="SecondaryLocationAddress"/>
+ <xsd:enumeration value="SecondHome"/>
+ <xsd:enumeration value="SellingOffice"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceLocation"/>
+ <xsd:enumeration value="ShelteredWorkshop"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="ShipTo"/>
+ <xsd:enumeration value="SmallBaseStationLocation"/>
+ <xsd:enumeration value="SmallControlStationLocation"/>
+ <xsd:enumeration value="SoldToAndShipTo"/>
+ <xsd:enumeration value="SoldToIfDifferentFromBillTo"/>
+ <xsd:enumeration value="StorageArea"/>
+ <xsd:enumeration value="StorageFacilityatDestination"/>
+ <xsd:enumeration value="StorageFacilityAtOrigin"/>
+ <xsd:enumeration value="Store"/>
+ <xsd:enumeration value="SoldTo"/>
+ <xsd:enumeration value="SubcontractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="SubjectProperty"/>
+ <xsd:enumeration value="Sub-Office"/>
+ <xsd:enumeration value="Subsidiary"/>
+ <xsd:enumeration value="SubsidiaryDivision"/>
+ <xsd:enumeration value="SupplierOrManufacturer"/>
+ <xsd:enumeration value="SuppliersCorporateOffice"/>
+ <xsd:enumeration value="SupplySource"/>
+ <xsd:enumeration value="TankFarm"/>
+ <xsd:enumeration value="TaxAddress"/>
+ <xsd:enumeration value="TaxCollectorsOffice"/>
+ <xsd:enumeration value="TechnicalOffice"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="TerminalLocation"/>
+ <xsd:enumeration value="TestingLaboratory"/>
+ <xsd:enumeration value="ToolSource"/>
+ <xsd:enumeration value="TransferPoint"/>
+ <xsd:enumeration value="TransferTo"/>
+ <xsd:enumeration value="TransportationOffice"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomer"/>
+ <xsd:enumeration value="UltimateParentCompany"/>
+ <xsd:enumeration value="UnitProperty"/>
+ <xsd:enumeration value="UpstreamMeterLocation"/>
+ <xsd:enumeration value="VacationHome"/>
+ <xsd:enumeration value="Vendor"/>
+ <xsd:enumeration value="VideoDepartment"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Wholesaler"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Contact">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ContactID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ContactName" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ContactFunction"/>
+ <xsd:element minOccurs="0" name="ContactDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfContactNumber"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Contact" type="Contact"/>
+ <xsd:complexType name="ContactFunction">
+ <xsd:sequence>
+ <xsd:element name="ContactFunctionCoded" type="ContactFunctionCode"/>
+ <xsd:element minOccurs="0" name="ContactFunctionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContactFunction" type="ContactFunction"/>
+ <xsd:simpleType name="ContactFunctionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptingContact"/>
+ <xsd:enumeration value="AcceptingOfficial"/>
+ <xsd:enumeration value="Accountingcontact"/>
+ <xsd:enumeration value="AccountsPayableContact"/>
+ <xsd:enumeration value="AccountsReceivableContact"/>
+ <xsd:enumeration value="AdditionalInsuranceInformationContact"/>
+ <xsd:enumeration value="AdministrativeContractingOfficer"/>
+ <xsd:enumeration value="Administrator"/>
+ <xsd:enumeration value="Advisor"/>
+ <xsd:enumeration value="After-HoursContact"/>
+ <xsd:enumeration value="Agent"/>
+ <xsd:enumeration value="AlternateContact"/>
+ <xsd:enumeration value="Applicant"/>
+ <xsd:enumeration value="AppointmentScheduler"/>
+ <xsd:enumeration value="Appraiser"/>
+ <xsd:enumeration value="Attention-ToParty"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AuditingContact"/>
+ <xsd:enumeration value="AuthorizedFinancialContact"/>
+ <xsd:enumeration value="AuthorizedNegotiator"/>
+ <xsd:enumeration value="AuthorizedRepresentative"/>
+ <xsd:enumeration value="AuthorizedSignature"/>
+ <xsd:enumeration value="AutomatedClearinghouseContact"/>
+ <xsd:enumeration value="BankingContact"/>
+ <xsd:enumeration value="BillInquiryContact"/>
+ <xsd:enumeration value="BoardStaff"/>
+ <xsd:enumeration value="Broker"/>
+ <xsd:enumeration value="BrokerContact"/>
+ <xsd:enumeration value="BusinessUnitManager"/>
+ <xsd:enumeration value="BuyerNameorDepartment"/>
+ <xsd:enumeration value="CADAndCAMSpecialist"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CaseManager"/>
+ <xsd:enumeration value="CertificationContact"/>
+ <xsd:enumeration value="Certifier"/>
+ <xsd:enumeration value="ChairmanOfTheBoard"/>
+ <xsd:enumeration value="ChangedBy"/>
+ <xsd:enumeration value="ChangeOrderApprover"/>
+ <xsd:enumeration value="ChiefExecutiveOfficer"/>
+ <xsd:enumeration value="ChiefFinancialOfficer"/>
+ <xsd:enumeration value="ChiefInformationOfficer"/>
+ <xsd:enumeration value="ChiefOperatingOfficer"/>
+ <xsd:enumeration value="CityWorksAuthorityContact"/>
+ <xsd:enumeration value="Claimant"/>
+ <xsd:enumeration value="ClaimApprover"/>
+ <xsd:enumeration value="ClaimRecipient"/>
+ <xsd:enumeration value="ClaimsContact"/>
+ <xsd:enumeration value="ClearinghouseContact"/>
+ <xsd:enumeration value="ClerkOfCourt"/>
+ <xsd:enumeration value="Co-Borrower"/>
+ <xsd:enumeration value="Co-Investigator"/>
+ <xsd:enumeration value="Collector"/>
+ <xsd:enumeration value="CollegeofEducationAdmissionsOffice"/>
+ <xsd:enumeration value="ComplianceOfficer"/>
+ <xsd:enumeration value="ComponentEngineer"/>
+ <xsd:enumeration value="ComputerSystemsContact"/>
+ <xsd:enumeration value="ConcurrentEmployerContact"/>
+ <xsd:enumeration value="ConfirmedWith"/>
+ <xsd:enumeration value="Consignee"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="ContainerManager"/>
+ <xsd:enumeration value="ContractContact"/>
+ <xsd:enumeration value="CoordinationContact"/>
+ <xsd:enumeration value="Coordinator"/>
+ <xsd:enumeration value="CorporatePurchasingAgent"/>
+ <xsd:enumeration value="CostAndScheduleCoordinator"/>
+ <xsd:enumeration value="CustomerContactGrantingAppointment"/>
+ <xsd:enumeration value="CustomerEngineer"/>
+ <xsd:enumeration value="CustomerMaintenanceManager"/>
+ <xsd:enumeration value="CustomerRelations"/>
+ <xsd:enumeration value="DangerousGoodsContact"/>
+ <xsd:enumeration value="DeliveryContact"/>
+ <xsd:enumeration value="DeliveryInstructionsContact"/>
+ <xsd:enumeration value="DentalSchoolAdmissionsOffice"/>
+ <xsd:enumeration value="DepartmentOrEmployeeToExecuteExportProcedures"/>
+ <xsd:enumeration value="DepartmentOrEmployeeToExecuteImportProcedures"/>
+ <xsd:enumeration value="DepartmentOrPersonResponsibleForProcessingPurchaseOrder"/>
+ <xsd:enumeration value="DesignEngineer"/>
+ <xsd:enumeration value="Development"/>
+ <xsd:enumeration value="Director"/>
+ <xsd:enumeration value="DirectoryAdvertisingContact"/>
+ <xsd:enumeration value="DivisionDirector"/>
+ <xsd:enumeration value="DivisionManager"/>
+ <xsd:enumeration value="EDICoordinator"/>
+ <xsd:enumeration value="EducationCoordinator"/>
+ <xsd:enumeration value="ElectricitySupplyContact"/>
+ <xsd:enumeration value="ElectronicDataInterchangeCoordinator"/>
+ <xsd:enumeration value="ElectronicSubmissionRecipient"/>
+ <xsd:enumeration value="EmergencyContact"/>
+ <xsd:enumeration value="EmergencyContact-Consignee"/>
+ <xsd:enumeration value="EmergencyContact-MilitaryTrafficManagementCommand"/>
+ <xsd:enumeration value="EmergencyContact-Shipper"/>
+ <xsd:enumeration value="EmergencyDangerousGoodsContact"/>
+ <xsd:enumeration value="EmployerContact"/>
+ <xsd:enumeration value="Engineer"/>
+ <xsd:enumeration value="EngineeringContact"/>
+ <xsd:enumeration value="EnteredBy"/>
+ <xsd:enumeration value="Estimator"/>
+ <xsd:enumeration value="EveningProgramsOffice"/>
+ <xsd:enumeration value="ExecutiveOfficer"/>
+ <xsd:enumeration value="ExecutiveVice-President"/>
+ <xsd:enumeration value="Expeditor"/>
+ <xsd:enumeration value="FinancialAidOffice"/>
+ <xsd:enumeration value="ForeclosingLenderAdministrativeContact"/>
+ <xsd:enumeration value="ForwarderContact"/>
+ <xsd:enumeration value="FunctionalManager"/>
+ <xsd:enumeration value="GasSupplyContact"/>
+ <xsd:enumeration value="GeneralContact"/>
+ <xsd:enumeration value="GoodsReceivingContact"/>
+ <xsd:enumeration value="GraduateAdmissionsOffice"/>
+ <xsd:enumeration value="GraduateBusinessOffice"/>
+ <xsd:enumeration value="GraduateEngineeringOffice"/>
+ <xsd:enumeration value="GraduateFineArtsOffice"/>
+ <xsd:enumeration value="GuidanceCounselor"/>
+ <xsd:enumeration value="HazardousMaterialContact"/>
+ <xsd:enumeration value="HeadOfUnitForInformationDissemination"/>
+ <xsd:enumeration value="HeadOfUnitForInformationProduction"/>
+ <xsd:enumeration value="HeadOfUnitOrComputerDataProcessing"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationContact"/>
+ <xsd:enumeration value="HumanResources"/>
+ <xsd:enumeration value="InformationContact"/>
+ <xsd:enumeration value="InsuranceContact"/>
+ <xsd:enumeration value="InsuredParty"/>
+ <xsd:enumeration value="InsurerContact"/>
+ <xsd:enumeration value="Interviewer"/>
+ <xsd:enumeration value="Investigator"/>
+ <xsd:enumeration value="InvestmentContact"/>
+ <xsd:enumeration value="IssuingOfficer"/>
+ <xsd:enumeration value="JointWorkAgent"/>
+ <xsd:enumeration value="LaboratoryContact"/>
+ <xsd:enumeration value="LandregistryContact"/>
+ <xsd:enumeration value="LawFirm"/>
+ <xsd:enumeration value="LawSchoolAdmissionsOffice"/>
+ <xsd:enumeration value="LegalAuditingContact"/>
+ <xsd:enumeration value="Licensee"/>
+ <xsd:enumeration value="LocalPurchasingAgent"/>
+ <xsd:enumeration value="MaintenanceContact"/>
+ <xsd:enumeration value="Manager"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="ManufacturingPlantContact"/>
+ <xsd:enumeration value="MarketingDepartment"/>
+ <xsd:enumeration value="MarketingDirector"/>
+ <xsd:enumeration value="MaterialControlContact"/>
+ <xsd:enumeration value="MaterialDispositionContact"/>
+ <xsd:enumeration value="MaterialHandlingContact"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetContact"/>
+ <xsd:enumeration value="Mayor"/>
+ <xsd:enumeration value="MedicalAdmissionsOffice"/>
+ <xsd:enumeration value="MedicalContact"/>
+ <xsd:enumeration value="MessageRecipientContact"/>
+ <xsd:enumeration value="MessageSenderContact"/>
+ <xsd:enumeration value="MultipleListingServiceStaff"/>
+ <xsd:enumeration value="MultipleListingServiceVendor"/>
+ <xsd:enumeration value="NationalAgent"/>
+ <xsd:enumeration value="NewBusinessProcessing"/>
+ <xsd:enumeration value="NewDevelopmentsContact"/>
+ <xsd:enumeration value="NotaryPublic"/>
+ <xsd:enumeration value="NotificationContact"/>
+ <xsd:enumeration value="NumericalControlEngineer"/>
+ <xsd:enumeration value="OfficeManager"/>
+ <xsd:enumeration value="OfficeStaff"/>
+ <xsd:enumeration value="Operations"/>
+ <xsd:enumeration value="OrderContact"/>
+ <xsd:enumeration value="OrderDepartment"/>
+ <xsd:enumeration value="OrderingOfficer"/>
+ <xsd:enumeration value="OtherAdult"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnerRepresentative"/>
+ <xsd:enumeration value="Packager"/>
+ <xsd:enumeration value="ParentorGuardian"/>
+ <xsd:enumeration value="ParticipatingLaboratoryContact"/>
+ <xsd:enumeration value="Partner"/>
+ <xsd:enumeration value="Patient"/>
+ <xsd:enumeration value="PayeeContact"/>
+ <xsd:enumeration value="PayersClaimOffice"/>
+ <xsd:enumeration value="PerformanceEvaluationCommittee"/>
+ <xsd:enumeration value="PersonnelContact"/>
+ <xsd:enumeration value="Physician"/>
+ <xsd:enumeration value="PlaceOfCollectionContact"/>
+ <xsd:enumeration value="PlaceOfDeliveryContact"/>
+ <xsd:enumeration value="PlantManager"/>
+ <xsd:enumeration value="PlantOrEquipmentContact"/>
+ <xsd:enumeration value="PlatformMaintenanceManager"/>
+ <xsd:enumeration value="PortEngineer"/>
+ <xsd:enumeration value="PreawardSurveyManager"/>
+ <xsd:enumeration value="PreferredProviderOrganizationContact"/>
+ <xsd:enumeration value="Preparer"/>
+ <xsd:enumeration value="President"/>
+ <xsd:enumeration value="PriceAdministration"/>
+ <xsd:enumeration value="PrimaryContact"/>
+ <xsd:enumeration value="PrimaryControlPoint"/>
+ <xsd:enumeration value="PrimaryTaxpayer"/>
+ <xsd:enumeration value="PrincipalStudyContactorAuthor"/>
+ <xsd:enumeration value="ProbationorLegalOfficer"/>
+ <xsd:enumeration value="ProcessEngineer"/>
+ <xsd:enumeration value="Processor"/>
+ <xsd:enumeration value="ProductionRepresentative"/>
+ <xsd:enumeration value="ProductManagementContact"/>
+ <xsd:enumeration value="ProgramDirector"/>
+ <xsd:enumeration value="ProgramManager"/>
+ <xsd:enumeration value="ProjectDirector"/>
+ <xsd:enumeration value="ProjectManagementContact"/>
+ <xsd:enumeration value="ProjectManager"/>
+ <xsd:enumeration value="PrototypeCoordinator"/>
+ <xsd:enumeration value="Provider"/>
+ <xsd:enumeration value="PublicRelationsContact"/>
+ <xsd:enumeration value="PurchaseServiceProvider"/>
+ <xsd:enumeration value="PurchasingContact"/>
+ <xsd:enumeration value="PurchasingContractingOfficer"/>
+ <xsd:enumeration value="QualityAssuranceContact"/>
+ <xsd:enumeration value="QualityCoordinatorContact"/>
+ <xsd:enumeration value="QualityInspector"/>
+ <xsd:enumeration value="QualityManager"/>
+ <xsd:enumeration value="QuantitySurveyorContact"/>
+ <xsd:enumeration value="QuotingParty"/>
+ <xsd:enumeration value="RateSupervisorOrClerk"/>
+ <xsd:enumeration value="RealEstatePropertyKeyHolder"/>
+ <xsd:enumeration value="RealEstatePropertyOccupant"/>
+ <xsd:enumeration value="RebateOrChargebackContact"/>
+ <xsd:enumeration value="ReceivingContact"/>
+ <xsd:enumeration value="ReceivingDockContact"/>
+ <xsd:enumeration value="Registrar"/>
+ <xsd:enumeration value="RentalCompanyAdministrativeContact"/>
+ <xsd:enumeration value="ReportAuthorizer"/>
+ <xsd:enumeration value="ReportPreparer"/>
+ <xsd:enumeration value="Requestor"/>
+ <xsd:enumeration value="Respondant"/>
+ <xsd:enumeration value="ResponsiblePerson"/>
+ <xsd:enumeration value="ResponsiblePersonForComputerDataProcessing"/>
+ <xsd:enumeration value="ResponsiblePersonforInformationDissemination"/>
+ <xsd:enumeration value="ResponsiblePersonForInformationProduction"/>
+ <xsd:enumeration value="ReviewAndRepricingContact"/>
+ <xsd:enumeration value="SalesAdministration"/>
+ <xsd:enumeration value="SalesRepresentativeOrDepartment"/>
+ <xsd:enumeration value="ScheduleContact"/>
+ <xsd:enumeration value="SchoolClerk"/>
+ <xsd:enumeration value="SchoolofTheologyAdmissionsOffice"/>
+ <xsd:enumeration value="SchoolofVeterinaryMedicineAdmissionsOffice"/>
+ <xsd:enumeration value="SchoolPrincipal"/>
+ <xsd:enumeration value="SecondaryTaxpayer"/>
+ <xsd:enumeration value="Secretary"/>
+ <xsd:enumeration value="ServiceContact"/>
+ <xsd:enumeration value="ServiceManager"/>
+ <xsd:enumeration value="ServiceOrderWriter"/>
+ <xsd:enumeration value="ServiceOrganization"/>
+ <xsd:enumeration value="ServiceTeam"/>
+ <xsd:enumeration value="ServiceTechnician"/>
+ <xsd:enumeration value="ShipperContact"/>
+ <xsd:enumeration value="ShippingContact"/>
+ <xsd:enumeration value="SocialServicesWorker"/>
+ <xsd:enumeration value="SoftwareHouseContact"/>
+ <xsd:enumeration value="SpecialProgramContact"/>
+ <xsd:enumeration value="Spouse"/>
+ <xsd:enumeration value="Staff"/>
+ <xsd:enumeration value="Student"/>
+ <xsd:enumeration value="StudentinAbsentia"/>
+ <xsd:enumeration value="StudySubmitterContact"/>
+ <xsd:enumeration value="SubmittingContact"/>
+ <xsd:enumeration value="Supervisor"/>
+ <xsd:enumeration value="SupplierContact"/>
+ <xsd:enumeration value="SystemsAdministrator"/>
+ <xsd:enumeration value="TechnicalContact"/>
+ <xsd:enumeration value="TechnicalDepartment"/>
+ <xsd:enumeration value="TechnicalDocumentationRecipient"/>
+ <xsd:enumeration value="TechnicalMarketingRepresentative"/>
+ <xsd:enumeration value="TechnicalWriter"/>
+ <xsd:enumeration value="TelecommunicationsNetworkContact"/>
+ <xsd:enumeration value="TelephoneAnsweringServiceContact"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="TenderDeveloper"/>
+ <xsd:enumeration value="TestContact"/>
+ <xsd:enumeration value="Third-PartyAdministratorContact"/>
+ <xsd:enumeration value="TownPlanningContact"/>
+ <xsd:enumeration value="TrafficAdministrator"/>
+ <xsd:enumeration value="TrafficAuthorityContact"/>
+ <xsd:enumeration value="Transmitter"/>
+ <xsd:enumeration value="TransportContact"/>
+ <xsd:enumeration value="TransportInfrastructureAuthority"/>
+ <xsd:enumeration value="Treasurer"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateReceiver"/>
+ <xsd:enumeration value="UndergraduateAdmissionsOffice"/>
+ <xsd:enumeration value="Underwriter"/>
+ <xsd:enumeration value="UnionPresident"/>
+ <xsd:enumeration value="VicePresident"/>
+ <xsd:enumeration value="WaiverContact"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WaterSupplyContact"/>
+ <xsd:enumeration value="Witness"/>
+ <xsd:enumeration value="WorkBrokerMaintenanceManager"/>
+ <xsd:enumeration value="WorkshopContact"/>
+ <xsd:enumeration value="WorksManagementContact"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfContactNumber">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ContactNumber"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContactNumber" type="ListOfContactNumber"/>
+ <xsd:complexType name="ContactNumber">
+ <xsd:sequence>
+ <xsd:element name="ContactNumberValue" type="xsd:string"/>
+ <xsd:element name="ContactNumberTypeCoded" type="ContactNumberTypeCode"/>
+ <xsd:element minOccurs="0" name="ContactNumberTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContactNumber" type="ContactNumber"/>
+ <xsd:simpleType name="ContactNumberTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="TelephoneNumber"/>
+ <xsd:enumeration value="FaxNumber"/>
+ <xsd:enumeration value="EmailAddress"/>
+ <xsd:enumeration value="MobileNumber"/>
+ <xsd:enumeration value="TelexNumber"/>
+ <xsd:enumeration value="PagerNumber"/>
+ <xsd:enumeration value="HomePage"/>
+ <xsd:enumeration value="WWW"/>
+ <xsd:enumeration value="FTP"/>
+ <xsd:enumeration value="URLOther"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfContact">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContact" type="ListOfContact"/>
+ <xsd:complexType name="ListOfPartyCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PartyCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPartyCoded" type="ListOfPartyCoded"/>
+ <xsd:complexType name="PartyCoded">
+ <xsd:complexContent>
+ <xsd:extension base="Party">
+ <xsd:sequence>
+ <xsd:element name="PartyRoleCoded" type="PartyRoleCode"/>
+ <xsd:element minOccurs="0" name="PartyRoleCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="PartyCoded" type="PartyCoded"/>
+ <xsd:simpleType name="PartyRoleCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptanceLocation"/>
+ <xsd:enumeration value="AcceptingParty"/>
+ <xsd:enumeration value="Accountant"/>
+ <xsd:enumeration value="AccountCoordinator"/>
+ <xsd:enumeration value="AccountingStation"/>
+ <xsd:enumeration value="AccountOf"/>
+ <xsd:enumeration value="AccountOfDestinationParty"/>
+ <xsd:enumeration value="AccountOf-OriginParty"/>
+ <xsd:enumeration value="AccountOwner"/>
+ <xsd:enumeration value="AccountOwnersServicingBankOnTheReceivingSide"/>
+ <xsd:enumeration value="AccountOwnersServicingBankOnTheSendingSide"/>
+ <xsd:enumeration value="AccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="AccountsPayableOffice"/>
+ <xsd:enumeration value="AcknowledgementRecipient"/>
+ <xsd:enumeration value="Acronym"/>
+ <xsd:enumeration value="ActionParty"/>
+ <xsd:enumeration value="ActualPurchasersCustomer"/>
+ <xsd:enumeration value="ActualReferredByOrganization"/>
+ <xsd:enumeration value="ActualReferredToOrganization"/>
+ <xsd:enumeration value="AcuteCareHospital"/>
+ <xsd:enumeration value="AdditionalAddress"/>
+ <xsd:enumeration value="AdditionalDebtor"/>
+ <xsd:enumeration value="AdditionalDeliveryAddress"/>
+ <xsd:enumeration value="AdditionalPickUpAddress"/>
+ <xsd:enumeration value="Adjuster"/>
+ <xsd:enumeration value="AdministrationCentre"/>
+ <xsd:enumeration value="Administrator"/>
+ <xsd:enumeration value="AdmittingHealthCareProvider"/>
+ <xsd:enumeration value="AdmittingServices"/>
+ <xsd:enumeration value="AdmittingSurgeon"/>
+ <xsd:enumeration value="AdultDayCareProgramFacility"/>
+ <xsd:enumeration value="Advertiser"/>
+ <xsd:enumeration value="AdvertisingGroup"/>
+ <xsd:enumeration value="AdviseThroughBank"/>
+ <xsd:enumeration value="AdvisingBank"/>
+ <xsd:enumeration value="Advisor"/>
+ <xsd:enumeration value="Affiant"/>
+ <xsd:enumeration value="Affiliate"/>
+ <xsd:enumeration value="AffiliatedCompany"/>
+ <xsd:enumeration value="AffiliatedParty"/>
+ <xsd:enumeration value="Agency"/>
+ <xsd:enumeration value="AgencyGrantingSecurityClearance"/>
+ <xsd:enumeration value="AgentOrRepresentative"/>
+ <xsd:enumeration value="AgentsBank"/>
+ <xsd:enumeration value="AIDSOrARCUnit"/>
+ <xsd:enumeration value="AirAmbulanceServices"/>
+ <xsd:enumeration value="AirCargoCompany"/>
+ <xsd:enumeration value="AirForceFacility"/>
+ <xsd:enumeration value="Airline"/>
+ <xsd:enumeration value="AirportAuthority"/>
+ <xsd:enumeration value="AlcoholBeverageDepartment"/>
+ <xsd:enumeration value="AlcoholismAndOtherChemicalDependencyFacility"/>
+ <xsd:enumeration value="AlcoholOrDrugAbuseOrDependencyInpatientUnit"/>
+ <xsd:enumeration value="AlcoholOrDrugAbuseOrDependencyOutpatientServices"/>
+ <xsd:enumeration value="Alias"/>
+ <xsd:enumeration value="AlienAffiliate"/>
+ <xsd:enumeration value="AllegedDebtor"/>
+ <xsd:enumeration value="Alliance"/>
+ <xsd:enumeration value="AlliedHealthProfessional"/>
+ <xsd:enumeration value="AllotmentCustomer"/>
+ <xsd:enumeration value="AllowableRecipient"/>
+ <xsd:enumeration value="AlternateReturnAddress"/>
+ <xsd:enumeration value="AlternativeAddressee"/>
+ <xsd:enumeration value="AlternativeManufacturer"/>
+ <xsd:enumeration value="AlzheimersDiagnosticOrAssessmentServices"/>
+ <xsd:enumeration value="AmendedName"/>
+ <xsd:enumeration value="AmericanIndian-OwnedBusiness"/>
+ <xsd:enumeration value="AmicusCuriae"/>
+ <xsd:enumeration value="AnesthesiologyServices"/>
+ <xsd:enumeration value="AngioplastyFacility"/>
+ <xsd:enumeration value="AnimalBeingInvestigated"/>
+ <xsd:enumeration value="AnimalSource"/>
+ <xsd:enumeration value="Annuitant"/>
+ <xsd:enumeration value="AnnuitantPayor"/>
+ <xsd:enumeration value="AntennaSite"/>
+ <xsd:enumeration value="Appellant"/>
+ <xsd:enumeration value="Appellee"/>
+ <xsd:enumeration value="Applicant"/>
+ <xsd:enumeration value="ApplicantComaker"/>
+ <xsd:enumeration value="ApplicantForJob"/>
+ <xsd:enumeration value="ApplicantsBank"/>
+ <xsd:enumeration value="ApplicantsCosigner"/>
+ <xsd:enumeration value="ApplicantsEmployer"/>
+ <xsd:enumeration value="ApplicantsReference"/>
+ <xsd:enumeration value="ApplicationParty"/>
+ <xsd:enumeration value="AppraisalCompany"/>
+ <xsd:enumeration value="AppraiserName"/>
+ <xsd:enumeration value="ApprovedConsignor"/>
+ <xsd:enumeration value="ApprovedImporter"/>
+ <xsd:enumeration value="Approver"/>
+ <xsd:enumeration value="Arbitrator"/>
+ <xsd:enumeration value="Architect"/>
+ <xsd:enumeration value="Architect-Designer"/>
+ <xsd:enumeration value="AreaOfOperation"/>
+ <xsd:enumeration value="ArmedServicesLocationDesignation"/>
+ <xsd:enumeration value="ArmyFacility"/>
+ <xsd:enumeration value="ArrestingOfficer"/>
+ <xsd:enumeration value="ArthritisTreatmentCenter"/>
+ <xsd:enumeration value="AssetAccountHolder"/>
+ <xsd:enumeration value="Assignee"/>
+ <xsd:enumeration value="Assigner"/>
+ <xsd:enumeration value="Assignor"/>
+ <xsd:enumeration value="AssistantSurgeon"/>
+ <xsd:enumeration value="AssistantUSTrustee"/>
+ <xsd:enumeration value="AssociateGeneralAgent"/>
+ <xsd:enumeration value="Association"/>
+ <xsd:enumeration value="AttendingPhysician"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AttorneyForDefendantPrivate"/>
+ <xsd:enumeration value="AttorneyForDefendantPublic"/>
+ <xsd:enumeration value="AttorneyForPlaintiff"/>
+ <xsd:enumeration value="AttorneyOfRecord"/>
+ <xsd:enumeration value="Auctioneer"/>
+ <xsd:enumeration value="AuditOffice"/>
+ <xsd:enumeration value="Auditor"/>
+ <xsd:enumeration value="AuthenticatingParty"/>
+ <xsd:enumeration value="Author"/>
+ <xsd:enumeration value="AuthorityForShipment"/>
+ <xsd:enumeration value="AuthorizationAssignedBy"/>
+ <xsd:enumeration value="AuthorizedAcceptingOfficial"/>
+ <xsd:enumeration value="AuthorizedEntity"/>
+ <xsd:enumeration value="AuthorizedExporter"/>
+ <xsd:enumeration value="AuthorizedFrom"/>
+ <xsd:enumeration value="AuthorizedImporter"/>
+ <xsd:enumeration value="AuthorizedMarketer"/>
+ <xsd:enumeration value="AuthorizedOfficial"/>
+ <xsd:enumeration value="AuthorizedTo"/>
+ <xsd:enumeration value="AuthorizedTrader"/>
+ <xsd:enumeration value="AuthorizingOfficial"/>
+ <xsd:enumeration value="AutomatedDataProcessingPoint"/>
+ <xsd:enumeration value="AutomatedUnderwritingSystem"/>
+ <xsd:enumeration value="AvailableWithBank"/>
+ <xsd:enumeration value="AvailabilityShipToParty"/>
+ <xsd:enumeration value="Bailiff"/>
+ <xsd:enumeration value="BailmentWarehouse"/>
+ <xsd:enumeration value="BailPayor"/>
+ <xsd:enumeration value="BakeryDepartment"/>
+ <xsd:enumeration value="Bank"/>
+ <xsd:enumeration value="Banker"/>
+ <xsd:enumeration value="BankruptcyReferee"/>
+ <xsd:enumeration value="BankruptcyTrustee"/>
+ <xsd:enumeration value="BaseJurisdiction"/>
+ <xsd:enumeration value="BasePeriodEmployer"/>
+ <xsd:enumeration value="Battery"/>
+ <xsd:enumeration value="BeneficialOwner"/>
+ <xsd:enumeration value="Beneficiary"/>
+ <xsd:enumeration value="BeneficiarysBank"/>
+ <xsd:enumeration value="Bidder"/>
+ <xsd:enumeration value="BidOpeningLocation"/>
+ <xsd:enumeration value="BillAndShipTo"/>
+ <xsd:enumeration value="BilledFrom"/>
+ <xsd:enumeration value="BillingProvider"/>
+ <xsd:enumeration value="BillingService"/>
+ <xsd:enumeration value="BillOfLadingRecipient"/>
+ <xsd:enumeration value="BillTo"/>
+ <xsd:enumeration value="Bill-ToPartyForDiversionCharges"/>
+ <xsd:enumeration value="BirthingRoomOrLDRPRoom"/>
+ <xsd:enumeration value="BirthName"/>
+ <xsd:enumeration value="Birthplace"/>
+ <xsd:enumeration value="BloodBank"/>
+ <xsd:enumeration value="BoardOfRealtors"/>
+ <xsd:enumeration value="BobtailServicePoint"/>
+ <xsd:enumeration value="Bondsman"/>
+ <xsd:enumeration value="BookingAgent"/>
+ <xsd:enumeration value="BookingOffice"/>
+ <xsd:enumeration value="Bookkeeper"/>
+ <xsd:enumeration value="BorderCrossing"/>
+ <xsd:enumeration value="Borrower"/>
+ <xsd:enumeration value="BorrowersEmployer"/>
+ <xsd:enumeration value="Bottler"/>
+ <xsd:enumeration value="Brakeman"/>
+ <xsd:enumeration value="Branch"/>
+ <xsd:enumeration value="BrandName"/>
+ <xsd:enumeration value="BreakBulkBerthOperator"/>
+ <xsd:enumeration value="BreakBulkPoint"/>
+ <xsd:enumeration value="Broadcaster"/>
+ <xsd:enumeration value="Broker"/>
+ <xsd:enumeration value="BrokerDealer"/>
+ <xsd:enumeration value="BrokerOpinionOrAnalysisRequester"/>
+ <xsd:enumeration value="BrokerOrSalesOffice"/>
+ <xsd:enumeration value="BrokersAssistant"/>
+ <xsd:enumeration value="BuilderName"/>
+ <xsd:enumeration value="BuildingInspectorate"/>
+ <xsd:enumeration value="BuildingSiteEngineer"/>
+ <xsd:enumeration value="BuildingSiteForwarder"/>
+ <xsd:enumeration value="BuildingSitePurchaser"/>
+ <xsd:enumeration value="BureauOfLandManagementPropertyUnit"/>
+ <xsd:enumeration value="BurnCareUnit"/>
+ <xsd:enumeration value="Business"/>
+ <xsd:enumeration value="BusinessArea"/>
+ <xsd:enumeration value="BusinessAssociate"/>
+ <xsd:enumeration value="BusinessEntity"/>
+ <xsd:enumeration value="BusinessPartner"/>
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="BuyerAsOfficiallyRegistered"/>
+ <xsd:enumeration value="BuyersAgentOrRepresentative"/>
+ <xsd:enumeration value="BuyersBank"/>
+ <xsd:enumeration value="BuyersCorporateOffice"/>
+ <xsd:enumeration value="BuyersFinancialInstitution"/>
+ <xsd:enumeration value="BuyersParentCompany"/>
+ <xsd:enumeration value="BuyersQualityReviewBoard"/>
+ <xsd:enumeration value="BuyingGroup"/>
+ <xsd:enumeration value="BuyingParty"/>
+ <xsd:enumeration value="CanadianCustomsBroker"/>
+ <xsd:enumeration value="Candidate"/>
+ <xsd:enumeration value="CandyAndConfectionsDepartment"/>
+ <xsd:enumeration value="CardiacCatherizationLaboratory"/>
+ <xsd:enumeration value="CardiacIntensiveCareUnit"/>
+ <xsd:enumeration value="CardiacRehabilitationProgramFacility"/>
+ <xsd:enumeration value="CardiacRehabilitationServices"/>
+ <xsd:enumeration value="CarnetIssuer"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CarriersAgent"/>
+ <xsd:enumeration value="CaseManager"/>
+ <xsd:enumeration value="CaseOfNeedParty"/>
+ <xsd:enumeration value="CashPoolLevelAccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CashPoolSub-AccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CashPoolTopAccountServicingFinancialInstitution"/>
+ <xsd:enumeration value="CedingCompany"/>
+ <xsd:enumeration value="CentralBankOrRegulatoryAuthority"/>
+ <xsd:enumeration value="CentralCatalogueParty"/>
+ <xsd:enumeration value="CertifiedAccountant"/>
+ <xsd:enumeration value="CertifyingParty"/>
+ <xsd:enumeration value="Chairperson"/>
+ <xsd:enumeration value="ChamberOfCommerce"/>
+ <xsd:enumeration value="ChangedAddress"/>
+ <xsd:enumeration value="ChargesPayerAtDestination"/>
+ <xsd:enumeration value="Charity"/>
+ <xsd:enumeration value="CharterSchool"/>
+ <xsd:enumeration value="ChassisProvider"/>
+ <xsd:enumeration value="CheckingParty"/>
+ <xsd:enumeration value="ChequeDrawnBank"/>
+ <xsd:enumeration value="ChequeOrder"/>
+ <xsd:enumeration value="ChiefDeputyClerkOfCourt"/>
+ <xsd:enumeration value="Child"/>
+ <xsd:enumeration value="ChildrensChronicDiseaseFacility"/>
+ <xsd:enumeration value="ChildrensDayCareCenter"/>
+ <xsd:enumeration value="ChildrensEyeEarNoseAndThroatFacility"/>
+ <xsd:enumeration value="ChildrensGeneralFacility"/>
+ <xsd:enumeration value="ChildrensHospitalUnitOfAnInstitution"/>
+ <xsd:enumeration value="ChildrensOrthopedicFacility"/>
+ <xsd:enumeration value="ChildrensOtherSpecialtyFacility"/>
+ <xsd:enumeration value="ChildrensPsychiatricFacility"/>
+ <xsd:enumeration value="ChildrensRehabilitationFacility"/>
+ <xsd:enumeration value="ChildrensTuberculosisAndOtherRespiratoryDiseasesFacility"/>
+ <xsd:enumeration value="Chiropractor"/>
+ <xsd:enumeration value="ChronicDiseaseFacility"/>
+ <xsd:enumeration value="ChronicObstructivePulmonaryDiseaseServiceFacility"/>
+ <xsd:enumeration value="ChurchOperatedFacility"/>
+ <xsd:enumeration value="CigarettesAndTobaccoDepartment"/>
+ <xsd:enumeration value="CircuitLocationIdentifier"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="ClaimAdministrator"/>
+ <xsd:enumeration value="Claimant"/>
+ <xsd:enumeration value="ClaimantAuthorizedRepresentative"/>
+ <xsd:enumeration value="ClaimRecipient"/>
+ <xsd:enumeration value="ClearingHouse"/>
+ <xsd:enumeration value="Clerk"/>
+ <xsd:enumeration value="ClerkOfCourt"/>
+ <xsd:enumeration value="Clinic"/>
+ <xsd:enumeration value="ClosedDoorPharmacy"/>
+ <xsd:enumeration value="ClosedSale"/>
+ <xsd:enumeration value="ClosingAgent"/>
+ <xsd:enumeration value="CoatingOrPaintSupplier"/>
+ <xsd:enumeration value="Co-Borrower"/>
+ <xsd:enumeration value="Co-Contractor"/>
+ <xsd:enumeration value="Co-Counsel"/>
+ <xsd:enumeration value="Co-Debtor"/>
+ <xsd:enumeration value="Co-Defendant"/>
+ <xsd:enumeration value="Co-Driver"/>
+ <xsd:enumeration value="Co-Investigator"/>
+ <xsd:enumeration value="CollateralAssignee"/>
+ <xsd:enumeration value="CollectingBank"/>
+ <xsd:enumeration value="CollectionPrincipal"/>
+ <xsd:enumeration value="CommercialInsurer"/>
+ <xsd:enumeration value="CommissionableAgent"/>
+ <xsd:enumeration value="CommissionProcessor"/>
+ <xsd:enumeration value="CommunityAgent"/>
+ <xsd:enumeration value="CommunityHealthPromotionFacility"/>
+ <xsd:enumeration value="CompanyAssignedWell"/>
+ <xsd:enumeration value="CompanyInterviewerWorksFor"/>
+ <xsd:enumeration value="CompanyInWhichInterestHeld"/>
+ <xsd:enumeration value="CompanyMergedWith"/>
+ <xsd:enumeration value="Company-OwnedOilField"/>
+ <xsd:enumeration value="CompanyWhichHoldsFinancialInterest"/>
+ <xsd:enumeration value="ComparableProperty"/>
+ <xsd:enumeration value="ComparablePropertyListing"/>
+ <xsd:enumeration value="ComparableRentals"/>
+ <xsd:enumeration value="CompetingProperty"/>
+ <xsd:enumeration value="CompetitivePropertyListing"/>
+ <xsd:enumeration value="CompilationAgency"/>
+ <xsd:enumeration value="Complainant"/>
+ <xsd:enumeration value="ComplainantsAttorney"/>
+ <xsd:enumeration value="ComponentManufacturer"/>
+ <xsd:enumeration value="ComprehensiveGeriatricAssessmentFacility"/>
+ <xsd:enumeration value="ConcurrentEmployer"/>
+ <xsd:enumeration value="Conductor"/>
+ <xsd:enumeration value="ConductorPilot"/>
+ <xsd:enumeration value="Conduit"/>
+ <xsd:enumeration value="ConnectingCarrier"/>
+ <xsd:enumeration value="Connection"/>
+ <xsd:enumeration value="Consignee"/>
+ <xsd:enumeration value="ConsigneeCourierTransferStation"/>
+ <xsd:enumeration value="ConsigneeOfVessel"/>
+ <xsd:enumeration value="ConsigneesAgent"/>
+ <xsd:enumeration value="ConsigneeToBeSpecified"/>
+ <xsd:enumeration value="Consignee-ToReceiveLargeParcelsAndFreight"/>
+ <xsd:enumeration value="Consignee-ToReceiveMailAndSmallParcels"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="ConsignorCourierTransferStation"/>
+ <xsd:enumeration value="ConsignorsRepresentative"/>
+ <xsd:enumeration value="ConsolidatedDebtor"/>
+ <xsd:enumeration value="Consolidator"/>
+ <xsd:enumeration value="ConstructionContractor"/>
+ <xsd:enumeration value="ConstructionFirm"/>
+ <xsd:enumeration value="ConsultantsOffice"/>
+ <xsd:enumeration value="ConsultingPhysician"/>
+ <xsd:enumeration value="ConsumerCreditAccountCompany"/>
+ <xsd:enumeration value="ConsumerReferralContact"/>
+ <xsd:enumeration value="ConsumerServiceProvider"/>
+ <xsd:enumeration value="ConsumerServiceProviderCustomer"/>
+ <xsd:enumeration value="Contact"/>
+ <xsd:enumeration value="ContactBank1"/>
+ <xsd:enumeration value="ContactBank2"/>
+ <xsd:enumeration value="ContactOffice"/>
+ <xsd:enumeration value="ContactParty"/>
+ <xsd:enumeration value="ContactParty1"/>
+ <xsd:enumeration value="ContactParty2"/>
+ <xsd:enumeration value="ContactParty3"/>
+ <xsd:enumeration value="ContactParty4"/>
+ <xsd:enumeration value="ContactPerson"/>
+ <xsd:enumeration value="ContainerLocation"/>
+ <xsd:enumeration value="ContainerLocationParty"/>
+ <xsd:enumeration value="ContainerOperatorOrLessee"/>
+ <xsd:enumeration value="ContainerReturnCompany"/>
+ <xsd:enumeration value="ContainerSurveyAgent"/>
+ <xsd:enumeration value="ContingentAnnuitant"/>
+ <xsd:enumeration value="ContingentBeneficiary"/>
+ <xsd:enumeration value="ContingentOwner"/>
+ <xsd:enumeration value="ContractAdministrationOffice"/>
+ <xsd:enumeration value="ContractedServiceProvider"/>
+ <xsd:enumeration value="ContractHolder"/>
+ <xsd:enumeration value="ContractingOfficerRepresentative"/>
+ <xsd:enumeration value="Contractor-General"/>
+ <xsd:enumeration value="ContractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="Contractor-Lead"/>
+ <xsd:enumeration value="Contractor-Main"/>
+ <xsd:enumeration value="ContractualDeliveryMeter"/>
+ <xsd:enumeration value="ContractualReceiptMeter"/>
+ <xsd:enumeration value="ControllerQuality"/>
+ <xsd:enumeration value="Converter"/>
+ <xsd:enumeration value="ConvoyingParty"/>
+ <xsd:enumeration value="Co-Occupant"/>
+ <xsd:enumeration value="Co-Operative"/>
+ <xsd:enumeration value="CooperativeBuyingGroup"/>
+ <xsd:enumeration value="Coordinator"/>
+ <xsd:enumeration value="Co-Owner"/>
+ <xsd:enumeration value="Co-Participant"/>
+ <xsd:enumeration value="Co-Producer"/>
+ <xsd:enumeration value="CopyMessageTo"/>
+ <xsd:enumeration value="CorporateOffice"/>
+ <xsd:enumeration value="Corporation"/>
+ <xsd:enumeration value="CorporationFor-ProfitFacility"/>
+ <xsd:enumeration value="CorrectedAddress"/>
+ <xsd:enumeration value="CorrectedInsured"/>
+ <xsd:enumeration value="CorrectedName"/>
+ <xsd:enumeration value="Cosigner"/>
+ <xsd:enumeration value="CosignersEmployer"/>
+ <xsd:enumeration value="CouncilOfGovernments"/>
+ <xsd:enumeration value="CounterClaimant"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CountryOfDestination"/>
+ <xsd:enumeration value="CountryOfExport"/>
+ <xsd:enumeration value="CountryOfOrigin"/>
+ <xsd:enumeration value="County"/>
+ <xsd:enumeration value="Court"/>
+ <xsd:enumeration value="CourtAppointedAttorney"/>
+ <xsd:enumeration value="CreditGrantor"/>
+ <xsd:enumeration value="Creditor"/>
+ <xsd:enumeration value="CreditorsAttorney"/>
+ <xsd:enumeration value="CreditRatingAgency"/>
+ <xsd:enumeration value="CreditReportingAgency"/>
+ <xsd:enumeration value="CrewMember"/>
+ <xsd:enumeration value="CrimeVictim"/>
+ <xsd:enumeration value="CrossClaimant"/>
+ <xsd:enumeration value="Cross-TownSwitch"/>
+ <xsd:enumeration value="CTScannerUnit"/>
+ <xsd:enumeration value="CurrentEmployer-Primary"/>
+ <xsd:enumeration value="CurrentEmployer-Secondary"/>
+ <xsd:enumeration value="CurrentReceiver"/>
+ <xsd:enumeration value="CurrentSender"/>
+ <xsd:enumeration value="CustodialParent"/>
+ <xsd:enumeration value="Custodian"/>
+ <xsd:enumeration value="Customer"/>
+ <xsd:enumeration value="CustomerFOrWhomSameOrSimilarWOrkWasPerFormed"/>
+ <xsd:enumeration value="CustomerIdentificationFileCustomerIdentifier"/>
+ <xsd:enumeration value="Customs"/>
+ <xsd:enumeration value="CustomsBroker"/>
+ <xsd:enumeration value="CustomsOfficeOfClearance"/>
+ <xsd:enumeration value="DairyDepartment"/>
+ <xsd:enumeration value="DataProcessingServiceBureau"/>
+ <xsd:enumeration value="Dealer"/>
+ <xsd:enumeration value="Debtor"/>
+ <xsd:enumeration value="DebtorCompany"/>
+ <xsd:enumeration value="DebtorIndividual"/>
+ <xsd:enumeration value="Debtor-In-Possession"/>
+ <xsd:enumeration value="DebtorsAttorney"/>
+ <xsd:enumeration value="DebtPaymentAuthorisationParty"/>
+ <xsd:enumeration value="DecisionMaker"/>
+ <xsd:enumeration value="Declarant"/>
+ <xsd:enumeration value="DeclarantsAgentOrRepresentative"/>
+ <xsd:enumeration value="Deconsolidator"/>
+ <xsd:enumeration value="DefaultOrForeclosureSpecialist"/>
+ <xsd:enumeration value="Defendant"/>
+ <xsd:enumeration value="DelicatessenDepartment"/>
+ <xsd:enumeration value="DeliveryAddress"/>
+ <xsd:enumeration value="DeliveryParty"/>
+ <xsd:enumeration value="DeliveryZone"/>
+ <xsd:enumeration value="Dentist"/>
+ <xsd:enumeration value="DepartmentOfJusticeFacility"/>
+ <xsd:enumeration value="Dependent"/>
+ <xsd:enumeration value="DependentInsured"/>
+ <xsd:enumeration value="DependentName"/>
+ <xsd:enumeration value="Depositor"/>
+ <xsd:enumeration value="DesignatedHazardousWasteFacility"/>
+ <xsd:enumeration value="DesignEngineering"/>
+ <xsd:enumeration value="Designer"/>
+ <xsd:enumeration value="DespatchChargePayer"/>
+ <xsd:enumeration value="DespatchParty"/>
+ <xsd:enumeration value="DestinationCarrier"/>
+ <xsd:enumeration value="DestinationDrayman"/>
+ <xsd:enumeration value="DestinationIntermodalRamp"/>
+ <xsd:enumeration value="DestinationMailFacility"/>
+ <xsd:enumeration value="DestinationTerminal"/>
+ <xsd:enumeration value="DiagnosticRadioisotopeFacility"/>
+ <xsd:enumeration value="DialysisCenters"/>
+ <xsd:enumeration value="DifferentPremiseAddress"/>
+ <xsd:enumeration value="Director"/>
+ <xsd:enumeration value="DisabledIndividual"/>
+ <xsd:enumeration value="DisbursingOfficer"/>
+ <xsd:enumeration value="DischargePoint"/>
+ <xsd:enumeration value="DisciplinaryContact"/>
+ <xsd:enumeration value="Dispatcher"/>
+ <xsd:enumeration value="Distiller"/>
+ <xsd:enumeration value="DistributionRecipient"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="DistributorBranch"/>
+ <xsd:enumeration value="District"/>
+ <xsd:enumeration value="DistrictAttorney"/>
+ <xsd:enumeration value="DistrictJustice"/>
+ <xsd:enumeration value="Division"/>
+ <xsd:enumeration value="DoctorOfOptometry"/>
+ <xsd:enumeration value="DoctorOfOsteopathy"/>
+ <xsd:enumeration value="DocumentaryCreditAccountParty"/>
+ <xsd:enumeration value="DocumentaryCreditAccountPartysBank"/>
+ <xsd:enumeration value="DocumentaryCreditApplicant"/>
+ <xsd:enumeration value="DocumentaryCreditBeneficiary"/>
+ <xsd:enumeration value="DocumentaryCreditBeneficiarysBank"/>
+ <xsd:enumeration value="DocumentaryCreditReimbursingBank"/>
+ <xsd:enumeration value="DocumentaryCreditSecondBeneficiary"/>
+ <xsd:enumeration value="DocumentCustodian"/>
+ <xsd:enumeration value="DocumentOrMessageIssuerOrSender"/>
+ <xsd:enumeration value="DocumentRecipient"/>
+ <xsd:enumeration value="DoingBusinessAs"/>
+ <xsd:enumeration value="DomesticFinancialInstitution"/>
+ <xsd:enumeration value="DownstreamFirstSupplier"/>
+ <xsd:enumeration value="DownstreamMeterLocation"/>
+ <xsd:enumeration value="DownstreamParty"/>
+ <xsd:enumeration value="Drawee"/>
+ <xsd:enumeration value="DrillingContractor"/>
+ <xsd:enumeration value="Driver"/>
+ <xsd:enumeration value="Drop-OffLocation"/>
+ <xsd:enumeration value="DryGroceryDepartment"/>
+ <xsd:enumeration value="DurableMedicalEquipmentSupplier"/>
+ <xsd:enumeration value="EconomicallyDisadvantagedIndividual"/>
+ <xsd:enumeration value="EducationalInstitution"/>
+ <xsd:enumeration value="ElectronicDataInterchangeCoordinatorPointAddress"/>
+ <xsd:enumeration value="ElectronicFiler"/>
+ <xsd:enumeration value="ElectronicRegistrationUtility"/>
+ <xsd:enumeration value="ElectronicReturnOriginator"/>
+ <xsd:enumeration value="ElementarySchool"/>
+ <xsd:enumeration value="EligiblePartyToTheContract"/>
+ <xsd:enumeration value="EligiblePartyToTheRate"/>
+ <xsd:enumeration value="EmergencyDepartment"/>
+ <xsd:enumeration value="EmergencyDepartmentSocialWorkServices"/>
+ <xsd:enumeration value="EmergencyMedicalTechnician"/>
+ <xsd:enumeration value="EmergencyProvider"/>
+ <xsd:enumeration value="EmergencyResponseUnit"/>
+ <xsd:enumeration value="EmergingSmallBusiness"/>
+ <xsd:enumeration value="Employee"/>
+ <xsd:enumeration value="EmployeeName"/>
+ <xsd:enumeration value="Employer"/>
+ <xsd:enumeration value="EmptyContainerResponsibleParty"/>
+ <xsd:enumeration value="EmptyContainerReturnAgent"/>
+ <xsd:enumeration value="EmptyEquipmentDespatchParty"/>
+ <xsd:enumeration value="EmptyEquipmentReturnParty"/>
+ <xsd:enumeration value="EndItemManufacturer"/>
+ <xsd:enumeration value="EndUser"/>
+ <xsd:enumeration value="EnergyInformationAdministration-OwnedOilField"/>
+ <xsd:enumeration value="Engineer"/>
+ <xsd:enumeration value="Engineer-Construction"/>
+ <xsd:enumeration value="Engineer-Consultant"/>
+ <xsd:enumeration value="Engineering"/>
+ <xsd:enumeration value="EngineerMeasurement"/>
+ <xsd:enumeration value="EngineerPilot"/>
+ <xsd:enumeration value="Engineer-ResidentConstruction"/>
+ <xsd:enumeration value="Enroller"/>
+ <xsd:enumeration value="EntityHoldingTheInformation"/>
+ <xsd:enumeration value="EntityInWhichAFinancialInterestIsHeld"/>
+ <xsd:enumeration value="EntityProvidingTheService"/>
+ <xsd:enumeration value="EntityResponsibleForFollow-Up"/>
+ <xsd:enumeration value="EntryPointTechnicalAssessmentGroup"/>
+ <xsd:enumeration value="EquipmentDrop-OffParty"/>
+ <xsd:enumeration value="EquipmentOwner"/>
+ <xsd:enumeration value="EquipmentRepairParty"/>
+ <xsd:enumeration value="EstablishedLocation"/>
+ <xsd:enumeration value="Estimator"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="Examiner"/>
+ <xsd:enumeration value="Exchanger"/>
+ <xsd:enumeration value="ExciseParty"/>
+ <xsd:enumeration value="ExcludedParty"/>
+ <xsd:enumeration value="ExecutiveCommitteeMember"/>
+ <xsd:enumeration value="ExecutorOfEstate"/>
+ <xsd:enumeration value="Exhibitor"/>
+ <xsd:enumeration value="ExpertWitness"/>
+ <xsd:enumeration value="Exporter"/>
+ <xsd:enumeration value="Ex-Spouse"/>
+ <xsd:enumeration value="ExtendedCareFacility"/>
+ <xsd:enumeration value="ExtracorporealShock-WaveLithotripterUnit"/>
+ <xsd:enumeration value="EyeEarNoseAndThroatFacility"/>
+ <xsd:enumeration value="Facility"/>
+ <xsd:enumeration value="Factor"/>
+ <xsd:enumeration value="Factor-Correspondent"/>
+ <xsd:enumeration value="FamilyMember"/>
+ <xsd:enumeration value="Father"/>
+ <xsd:enumeration value="FederalFacility"/>
+ <xsd:enumeration value="FederalGovernment"/>
+ <xsd:enumeration value="FederallyCharteredFacility"/>
+ <xsd:enumeration value="FederalStateCountyOrCityFacility"/>
+ <xsd:enumeration value="FellowshipInstitution"/>
+ <xsd:enumeration value="Felon"/>
+ <xsd:enumeration value="Field"/>
+ <xsd:enumeration value="FieldorBranchOffice"/>
+ <xsd:enumeration value="FilerName"/>
+ <xsd:enumeration value="FilingAddress"/>
+ <xsd:enumeration value="FilingLocation"/>
+ <xsd:enumeration value="FilingOffice"/>
+ <xsd:enumeration value="FinalCustomerOrganization"/>
+ <xsd:enumeration value="FinalMaintenanceOrganization"/>
+ <xsd:enumeration value="FinalMaintenancePeriodDesignatingOrganization"/>
+ <xsd:enumeration value="FinalMessageRecipient"/>
+ <xsd:enumeration value="FinalRecipient"/>
+ <xsd:enumeration value="FinalReferredToOrganization"/>
+ <xsd:enumeration value="FinalScheduledDestination"/>
+ <xsd:enumeration value="FinancialInstitution"/>
+ <xsd:enumeration value="FinancialPlanner"/>
+ <xsd:enumeration value="FinancialStatementRecipient"/>
+ <xsd:enumeration value="Fireman"/>
+ <xsd:enumeration value="FirstAppraiser"/>
+ <xsd:enumeration value="FirstBreakTerminal"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FirstSupplier"/>
+ <xsd:enumeration value="FitnessCenter"/>
+ <xsd:enumeration value="FloodCertifier"/>
+ <xsd:enumeration value="FloodDeterminationProvider"/>
+ <xsd:enumeration value="FloralDepartment"/>
+ <xsd:enumeration value="FoodServiceOperator"/>
+ <xsd:enumeration value="ForeclosingLender"/>
+ <xsd:enumeration value="ForeignDisclosureInformationOffice"/>
+ <xsd:enumeration value="ForeignLanguageSynonym"/>
+ <xsd:enumeration value="ForeignOffice"/>
+ <xsd:enumeration value="ForeignRegistrationLocation"/>
+ <xsd:enumeration value="ForeignSupplier"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FormerAddress"/>
+ <xsd:enumeration value="FormerlyDoingBusinessAs"/>
+ <xsd:enumeration value="FormerlyKnownAs"/>
+ <xsd:enumeration value="FormerPresident"/>
+ <xsd:enumeration value="FormerRegisteredAddress"/>
+ <xsd:enumeration value="FormerResidence"/>
+ <xsd:enumeration value="ForProfitHealthCareProvider"/>
+ <xsd:enumeration value="Forwarder"/>
+ <xsd:enumeration value="Foundation"/>
+ <xsd:enumeration value="Founder"/>
+ <xsd:enumeration value="Franchisee"/>
+ <xsd:enumeration value="Franchisor"/>
+ <xsd:enumeration value="FreeonBoardPoint"/>
+ <xsd:enumeration value="FreightForwarder"/>
+ <xsd:enumeration value="FreightManagementFacilitator"/>
+ <xsd:enumeration value="FreightOrChargesPayer"/>
+ <xsd:enumeration value="FreightPayerOnBehalfOfTheConsignee"/>
+ <xsd:enumeration value="FreightPayerOnBehalfOfTheConsignor"/>
+ <xsd:enumeration value="FrozenDepartment"/>
+ <xsd:enumeration value="FutureAddress"/>
+ <xsd:enumeration value="GainingInventoryManager"/>
+ <xsd:enumeration value="GaragedLocation"/>
+ <xsd:enumeration value="Garnishee"/>
+ <xsd:enumeration value="GasPlant"/>
+ <xsd:enumeration value="GasTransactionEndingPoint"/>
+ <xsd:enumeration value="GasTransactionPoint1"/>
+ <xsd:enumeration value="GasTransactionPoint2"/>
+ <xsd:enumeration value="GasTransactionStartingPoint"/>
+ <xsd:enumeration value="GatewayProvider"/>
+ <xsd:enumeration value="GeneralAgency"/>
+ <xsd:enumeration value="GeneralInpatientCareForAIDSOrARCFacility"/>
+ <xsd:enumeration value="GeneralMedicalAndSurgicalFacility"/>
+ <xsd:enumeration value="GeneralMerchandiseDepartment"/>
+ <xsd:enumeration value="GeneticCounselingOrScreeningServices"/>
+ <xsd:enumeration value="GeriatricAcuteCareUnit"/>
+ <xsd:enumeration value="GeriatricClinics"/>
+ <xsd:enumeration value="GiftRecipient"/>
+ <xsd:enumeration value="GoodsCollectionParty"/>
+ <xsd:enumeration value="GoodsCustodian"/>
+ <xsd:enumeration value="GoodsOwner"/>
+ <xsd:enumeration value="GoodsReleaser"/>
+ <xsd:enumeration value="Government"/>
+ <xsd:enumeration value="Government-CombinedControl"/>
+ <xsd:enumeration value="Government-Federal-Military"/>
+ <xsd:enumeration value="Government-Federal-Other"/>
+ <xsd:enumeration value="Government-Federal-Veterans"/>
+ <xsd:enumeration value="GovernmentFurnishedPropertyFOBPoint"/>
+ <xsd:enumeration value="GovernmentLoanAgencySponsorOrAgent"/>
+ <xsd:enumeration value="Government-Local"/>
+ <xsd:enumeration value="Grandparent"/>
+ <xsd:enumeration value="Grantor"/>
+ <xsd:enumeration value="GroundAmbulanceServices"/>
+ <xsd:enumeration value="Group"/>
+ <xsd:enumeration value="GroupAffiliate"/>
+ <xsd:enumeration value="GroupAffiliation"/>
+ <xsd:enumeration value="GroupingCentre"/>
+ <xsd:enumeration value="GroupPractice"/>
+ <xsd:enumeration value="GroupPurchasingOrganization"/>
+ <xsd:enumeration value="GuaranteeAgency"/>
+ <xsd:enumeration value="Guardian"/>
+ <xsd:enumeration value="HazardousMaterialOffice"/>
+ <xsd:enumeration value="HazardousWasteGenerator"/>
+ <xsd:enumeration value="HeadOffice"/>
+ <xsd:enumeration value="HealthAndBeautyDepartment"/>
+ <xsd:enumeration value="HealthcareProfessionalShortageAreaFacility"/>
+ <xsd:enumeration value="HealthMaintenanceOrganization"/>
+ <xsd:enumeration value="HealthMiscellaneous"/>
+ <xsd:enumeration value="HealthSciencesLibrary"/>
+ <xsd:enumeration value="HemodialysisFacility"/>
+ <xsd:enumeration value="HighSchool"/>
+ <xsd:enumeration value="HisopathologyLaboratory"/>
+ <xsd:enumeration value="HispanicServiceInstitute"/>
+ <xsd:enumeration value="HistoricallyBlackCollegeOrUniversity"/>
+ <xsd:enumeration value="HomeHealthAgency"/>
+ <xsd:enumeration value="HomeHealthCare"/>
+ <xsd:enumeration value="HomeHealthCorporation"/>
+ <xsd:enumeration value="HomeHealthServices"/>
+ <xsd:enumeration value="HomeOffice"/>
+ <xsd:enumeration value="HomeSchool"/>
+ <xsd:enumeration value="HomeStateName"/>
+ <xsd:enumeration value="Hospice"/>
+ <xsd:enumeration value="Hospital"/>
+ <xsd:enumeration value="HospitalAuxiliaryUnit"/>
+ <xsd:enumeration value="HospitalDistrictOrAuthority"/>
+ <xsd:enumeration value="HospitalUnitOfAnInstitution"/>
+ <xsd:enumeration value="HospitalUnitWithinAnInstitutionForTheMentallyRetarded"/>
+ <xsd:enumeration value="HostileWitness"/>
+ <xsd:enumeration value="ImportedFromLocation"/>
+ <xsd:enumeration value="Importer"/>
+ <xsd:enumeration value="InCareOfPartyNo1"/>
+ <xsd:enumeration value="InCareOfPartyNo2"/>
+ <xsd:enumeration value="IncorporatedBy"/>
+ <xsd:enumeration value="IncorporatedLocation"/>
+ <xsd:enumeration value="IncorporationJurisdiction"/>
+ <xsd:enumeration value="IncorporationStatePlaceOfBusiness"/>
+ <xsd:enumeration value="IncorporationStatePrincipalOffice"/>
+ <xsd:enumeration value="IndependentAdjuster"/>
+ <xsd:enumeration value="IndependentLab"/>
+ <xsd:enumeration value="IndependentPhysiciansAssociation"/>
+ <xsd:enumeration value="Individual"/>
+ <xsd:enumeration value="IndividualFor-ProfitFacility"/>
+ <xsd:enumeration value="IndustryAssociation"/>
+ <xsd:enumeration value="IndustryBureau"/>
+ <xsd:enumeration value="IneligibleParty"/>
+ <xsd:enumeration value="InformationDisseminationAgency"/>
+ <xsd:enumeration value="InformationMaintenanceAgency"/>
+ <xsd:enumeration value="InformationProvider"/>
+ <xsd:enumeration value="InformationReferenceAgency"/>
+ <xsd:enumeration value="InformationSource"/>
+ <xsd:enumeration value="InitialDealer"/>
+ <xsd:enumeration value="InitialMedicalProvider"/>
+ <xsd:enumeration value="InitialSubscriber"/>
+ <xsd:enumeration value="Initiating"/>
+ <xsd:enumeration value="InjectionPoint"/>
+ <xsd:enumeration value="In-PatientPharmacy"/>
+ <xsd:enumeration value="InquiringParty"/>
+ <xsd:enumeration value="InquiryAddress"/>
+ <xsd:enumeration value="In-ServiceSource"/>
+ <xsd:enumeration value="InspectionAddress"/>
+ <xsd:enumeration value="InspectionAndAcceptanceLocation"/>
+ <xsd:enumeration value="InspectionAndAcceptanceParty"/>
+ <xsd:enumeration value="InspectionCompany"/>
+ <xsd:enumeration value="InspectionLeader"/>
+ <xsd:enumeration value="InspectionLocation"/>
+ <xsd:enumeration value="Inspector"/>
+ <xsd:enumeration value="InstallationOnSite"/>
+ <xsd:enumeration value="InstalledAt"/>
+ <xsd:enumeration value="InstitutionalProvider"/>
+ <xsd:enumeration value="InstitutionForMentalRetardation"/>
+ <xsd:enumeration value="In-StoreBakeryDepartment"/>
+ <xsd:enumeration value="InsuranceBeneficiary"/>
+ <xsd:enumeration value="InsuranceClaimAdjuster"/>
+ <xsd:enumeration value="InsuranceCompany"/>
+ <xsd:enumeration value="InsuranceInstitute"/>
+ <xsd:enumeration value="Insured"/>
+ <xsd:enumeration value="InsuredLocation"/>
+ <xsd:enumeration value="InsuredOrSubscriber"/>
+ <xsd:enumeration value="Insurer"/>
+ <xsd:enumeration value="IntegratedMaterialManager"/>
+ <xsd:enumeration value="IntellectualPropertyOwner"/>
+ <xsd:enumeration value="InterestedParty"/>
+ <xsd:enumeration value="InterimFundingOrganization"/>
+ <xsd:enumeration value="InterimTrustee"/>
+ <xsd:enumeration value="InterlineServiceCommitmentCustomer"/>
+ <xsd:enumeration value="Intermediary"/>
+ <xsd:enumeration value="IntermediaryBank1"/>
+ <xsd:enumeration value="IntermediaryBank2"/>
+ <xsd:enumeration value="IntermediaryOrBroker"/>
+ <xsd:enumeration value="IntermediateCarrier"/>
+ <xsd:enumeration value="IntermediateConsignee"/>
+ <xsd:enumeration value="IntermediateLevelParentCompany"/>
+ <xsd:enumeration value="InternationalFreightForwarder"/>
+ <xsd:enumeration value="InternationalOrganization"/>
+ <xsd:enumeration value="InternshipEntity"/>
+ <xsd:enumeration value="Interpreter"/>
+ <xsd:enumeration value="Interviewee"/>
+ <xsd:enumeration value="Interviewer"/>
+ <xsd:enumeration value="Inventor"/>
+ <xsd:enumeration value="InventoryController"/>
+ <xsd:enumeration value="InventoryControlPoint"/>
+ <xsd:enumeration value="InventoryReportingParty"/>
+ <xsd:enumeration value="Investigator"/>
+ <xsd:enumeration value="InvestmentAdvisor"/>
+ <xsd:enumeration value="Investor"/>
+ <xsd:enumeration value="Invoicee"/>
+ <xsd:enumeration value="InvoicingDealer"/>
+ <xsd:enumeration value="InvolvedParty"/>
+ <xsd:enumeration value="IrrevocableBeneficiary"/>
+ <xsd:enumeration value="Issuer"/>
+ <xsd:enumeration value="IssuerOfDebitOrCreditMemo"/>
+ <xsd:enumeration value="IssuerOfInvoice"/>
+ <xsd:enumeration value="IssuerOfWaybill"/>
+ <xsd:enumeration value="IssuingBank"/>
+ <xsd:enumeration value="ItemManager"/>
+ <xsd:enumeration value="ItemShipTo"/>
+ <xsd:enumeration value="ItemShipFrom"/>
+ <xsd:enumeration value="JointAnnuitant"/>
+ <xsd:enumeration value="JointAnnuitantOwner"/>
+ <xsd:enumeration value="JointDebtor"/>
+ <xsd:enumeration value="JointDebtorAttorney"/>
+ <xsd:enumeration value="JointOwner"/>
+ <xsd:enumeration value="JointOwnerAnnuitant"/>
+ <xsd:enumeration value="JointOwnerAnnuitantPayor"/>
+ <xsd:enumeration value="JointOwnerJointAnnuitant"/>
+ <xsd:enumeration value="JointOwnerJointAnnuitantPayor"/>
+ <xsd:enumeration value="JointOwnerPayor"/>
+ <xsd:enumeration value="JointVenture"/>
+ <xsd:enumeration value="Judge"/>
+ <xsd:enumeration value="JuniorHighSchool"/>
+ <xsd:enumeration value="Jurisdiction"/>
+ <xsd:enumeration value="JuvenileDefendant"/>
+ <xsd:enumeration value="JuvenileOwner"/>
+ <xsd:enumeration value="JuvenileVictim"/>
+ <xsd:enumeration value="JuvenileWitness"/>
+ <xsd:enumeration value="KeyPerson"/>
+ <xsd:enumeration value="KidneyDialysisUnit"/>
+ <xsd:enumeration value="Labeler"/>
+ <xsd:enumeration value="Laboratory"/>
+ <xsd:enumeration value="LaborSurplusAreaFirm"/>
+ <xsd:enumeration value="Landlord"/>
+ <xsd:enumeration value="LargeBusiness"/>
+ <xsd:enumeration value="LastBreakTerminal"/>
+ <xsd:enumeration value="LastEmployer"/>
+ <xsd:enumeration value="LastKnownSourceOfSupply"/>
+ <xsd:enumeration value="LastSupplier"/>
+ <xsd:enumeration value="LawEnforcementAgency"/>
+ <xsd:enumeration value="LawFirm"/>
+ <xsd:enumeration value="LeaseLocation"/>
+ <xsd:enumeration value="LegalReceiver"/>
+ <xsd:enumeration value="LegalRepresentative"/>
+ <xsd:enumeration value="LegalTitleHolder"/>
+ <xsd:enumeration value="Lender"/>
+ <xsd:enumeration value="LendingInstitution"/>
+ <xsd:enumeration value="Lessee"/>
+ <xsd:enumeration value="LesseesSurveyor"/>
+ <xsd:enumeration value="Lessor"/>
+ <xsd:enumeration value="LiabilityHolder"/>
+ <xsd:enumeration value="Licensee"/>
+ <xsd:enumeration value="LienHolder"/>
+ <xsd:enumeration value="LimitedLiabilityCompany"/>
+ <xsd:enumeration value="LimitedLiabilityPartnership"/>
+ <xsd:enumeration value="LimitedPartner"/>
+ <xsd:enumeration value="Liquidator"/>
+ <xsd:enumeration value="ListingAgent"/>
+ <xsd:enumeration value="ListingCompany"/>
+ <xsd:enumeration value="ListingOffice"/>
+ <xsd:enumeration value="ListMailer"/>
+ <xsd:enumeration value="ListOwner"/>
+ <xsd:enumeration value="LiterallyTranslatedName"/>
+ <xsd:enumeration value="LoadingParty"/>
+ <xsd:enumeration value="LoanApplicant"/>
+ <xsd:enumeration value="LoanBroker"/>
+ <xsd:enumeration value="LoanCorrespondent"/>
+ <xsd:enumeration value="LoanHolderForRealEstateAsset"/>
+ <xsd:enumeration value="LoanOriginator"/>
+ <xsd:enumeration value="LoanServicer"/>
+ <xsd:enumeration value="LocalChain"/>
+ <xsd:enumeration value="LocalGovernmentSponsor"/>
+ <xsd:enumeration value="LocationOfGoods"/>
+ <xsd:enumeration value="LocationOfGoodsForCustomsExaminationBeforeClearance"/>
+ <xsd:enumeration value="LocationOfLoadExchange"/>
+ <xsd:enumeration value="LocationOfPrincipalAssets"/>
+ <xsd:enumeration value="LocationOfSpotForStorage"/>
+ <xsd:enumeration value="LongTermCareFacility"/>
+ <xsd:enumeration value="Long-TermDisabilityCarrier"/>
+ <xsd:enumeration value="LosingInventoryManager"/>
+ <xsd:enumeration value="LossPayee"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MagistrateJudge"/>
+ <xsd:enumeration value="MagneticResonanceImagingFacility"/>
+ <xsd:enumeration value="MaidenName"/>
+ <xsd:enumeration value="MailAddress"/>
+ <xsd:enumeration value="MailTo"/>
+ <xsd:enumeration value="Mainline"/>
+ <xsd:enumeration value="MaintenanceOrganizationUsedForEstimate"/>
+ <xsd:enumeration value="MammographyScreeningCenter"/>
+ <xsd:enumeration value="ManagedCare"/>
+ <xsd:enumeration value="ManagedCareOrganization"/>
+ <xsd:enumeration value="ManagementControlActivity"/>
+ <xsd:enumeration value="ManagementNon-Officer"/>
+ <xsd:enumeration value="Manager"/>
+ <xsd:enumeration value="ManagingAgent"/>
+ <xsd:enumeration value="ManagingGeneralAgent"/>
+ <xsd:enumeration value="ManufacturerOfGoods"/>
+ <xsd:enumeration value="ManufacturersRepresentative"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="ManufacturingPlant"/>
+ <xsd:enumeration value="MarineSurveyor"/>
+ <xsd:enumeration value="MarkerOwner"/>
+ <xsd:enumeration value="MarketTimer"/>
+ <xsd:enumeration value="Mark-ForParty"/>
+ <xsd:enumeration value="MasterAgent"/>
+ <xsd:enumeration value="MasterGeneralAgent"/>
+ <xsd:enumeration value="MasterProperty"/>
+ <xsd:enumeration value="Material"/>
+ <xsd:enumeration value="MaterialChangeNoticeAddress"/>
+ <xsd:enumeration value="MaterialDispositionAuthorizationLocation"/>
+ <xsd:enumeration value="MaterialIssuer"/>
+ <xsd:enumeration value="MaterialSafetyDataSheetRecipient"/>
+ <xsd:enumeration value="MeansOfTransportCharterer"/>
+ <xsd:enumeration value="MeatDepartment"/>
+ <xsd:enumeration value="MedicalDoctor"/>
+ <xsd:enumeration value="MedicalInsuranceCarrier"/>
+ <xsd:enumeration value="MedicalNurse"/>
+ <xsd:enumeration value="MedicalSchool"/>
+ <xsd:enumeration value="MedicalSurgicalOrOtherIntensiveCareUnit"/>
+ <xsd:enumeration value="MedicalTreatmentExecutant"/>
+ <xsd:enumeration value="MedicalTreatmentPrescriber"/>
+ <xsd:enumeration value="MeetingLocation"/>
+ <xsd:enumeration value="MegavoltageRadiationTherapyUnit"/>
+ <xsd:enumeration value="Member"/>
+ <xsd:enumeration value="MerchantBanker"/>
+ <xsd:enumeration value="MergedCompany"/>
+ <xsd:enumeration value="MergedCompanyWithRetainedIdentity"/>
+ <xsd:enumeration value="MergedName"/>
+ <xsd:enumeration value="MessageFrom"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageTo"/>
+ <xsd:enumeration value="MeteringLocation"/>
+ <xsd:enumeration value="MexicanCustomsBroker"/>
+ <xsd:enumeration value="MiddleSchool"/>
+ <xsd:enumeration value="MigrantHealthClinic"/>
+ <xsd:enumeration value="MilitaryBranch"/>
+ <xsd:enumeration value="MilitaryFacility"/>
+ <xsd:enumeration value="MinimumRoyaltyPayor"/>
+ <xsd:enumeration value="Minister"/>
+ <xsd:enumeration value="MinorityInstitution"/>
+ <xsd:enumeration value="Minority-OwnedBusinessLarge"/>
+ <xsd:enumeration value="Minority-OwnedBusinessSmall"/>
+ <xsd:enumeration value="MiscellaneousHealthCareFacility"/>
+ <xsd:enumeration value="MonitoringParty"/>
+ <xsd:enumeration value="MortgageCompany"/>
+ <xsd:enumeration value="MortgageInsurer"/>
+ <xsd:enumeration value="MortgageLiabilityAccountHolder"/>
+ <xsd:enumeration value="MostRecentEmployer"/>
+ <xsd:enumeration value="Mother"/>
+ <xsd:enumeration value="MotorCarrier"/>
+ <xsd:enumeration value="MotorVehicleReportProviderCompany"/>
+ <xsd:enumeration value="MultipleListingService"/>
+ <xsd:enumeration value="Municipality"/>
+ <xsd:enumeration value="NameChangedTo"/>
+ <xsd:enumeration value="NameNotToBeConfusedWith"/>
+ <xsd:enumeration value="NameonCreditCard"/>
+ <xsd:enumeration value="NameUnderWhichFiled"/>
+ <xsd:enumeration value="NameVariationSynonym"/>
+ <xsd:enumeration value="NationalChain"/>
+ <xsd:enumeration value="NationalOrganization"/>
+ <xsd:enumeration value="NativeHawaiianOrganization"/>
+ <xsd:enumeration value="NavyFacility"/>
+ <xsd:enumeration value="NeglectedOrDelinquentInstitution"/>
+ <xsd:enumeration value="NegotiatingBank"/>
+ <xsd:enumeration value="Neighbor"/>
+ <xsd:enumeration value="Neighborhood"/>
+ <xsd:enumeration value="NeonatalIntensiveCareUnit"/>
+ <xsd:enumeration value="NetworkName"/>
+ <xsd:enumeration value="NewAddress"/>
+ <xsd:enumeration value="NewAssignee"/>
+ <xsd:enumeration value="NewDebtor"/>
+ <xsd:enumeration value="NewSecuredParty"/>
+ <xsd:enumeration value="NewServiceProvider"/>
+ <xsd:enumeration value="Newspaper"/>
+ <xsd:enumeration value="NewSupplySource"/>
+ <xsd:enumeration value="NextDestination"/>
+ <xsd:enumeration value="NextScheduledDestination"/>
+ <xsd:enumeration value="Nickname"/>
+ <xsd:enumeration value="NoHeading"/>
+ <xsd:enumeration value="NominatedBank"/>
+ <xsd:enumeration value="NominatedFreightCompany"/>
+ <xsd:enumeration value="Non-DomesticFinancialInstitution"/>
+ <xsd:enumeration value="NonemploymentIncomeSource"/>
+ <xsd:enumeration value="Non-HealthCareMiscellaneousFacility"/>
+ <xsd:enumeration value="Non-Insured"/>
+ <xsd:enumeration value="Non-InvasiveCardiacAssessmentServices"/>
+ <xsd:enumeration value="Non-MortgageLiabilityAccountHolder"/>
+ <xsd:enumeration value="Non-OccupantCo-Borrower"/>
+ <xsd:enumeration value="Non-ProductionSupplier"/>
+ <xsd:enumeration value="Non-ProfitHealthCareProvider"/>
+ <xsd:enumeration value="NonprofitInstitution"/>
+ <xsd:enumeration value="Non-RailroadEntity"/>
+ <xsd:enumeration value="NonRegisteredBusinessName"/>
+ <xsd:enumeration value="Non-RegisteredInvestmentAdvisor"/>
+ <xsd:enumeration value="Non-ResidentBeneficiary"/>
+ <xsd:enumeration value="Non-ResidentCreditor"/>
+ <xsd:enumeration value="Non-ResidentDebtor"/>
+ <xsd:enumeration value="Non-ResidentGroupCompanyWithWhomFinancialAccountIs"/>
+ <xsd:enumeration value="Non-ResidentInstructingParty"/>
+ <xsd:enumeration value="Non-ResidentThirdPartyCompanyWithWhomFinancial"/>
+ <xsd:enumeration value="Non-TemporaryStorageFacility"/>
+ <xsd:enumeration value="Notary"/>
+ <xsd:enumeration value="NotaryPublic"/>
+ <xsd:enumeration value="NoteCo-Signer"/>
+ <xsd:enumeration value="NotForProfitHealthCareProvider"/>
+ <xsd:enumeration value="NotifyParty"/>
+ <xsd:enumeration value="NotifyPartyForShippersOrder"/>
+ <xsd:enumeration value="NotifyPartyNo1"/>
+ <xsd:enumeration value="NotifyPartyNo2"/>
+ <xsd:enumeration value="NursingHome"/>
+ <xsd:enumeration value="NursingHomeChain"/>
+ <xsd:enumeration value="ObservationRoomServices"/>
+ <xsd:enumeration value="ObstetricsAndGynecologyFacility"/>
+ <xsd:enumeration value="ObstetricsUnit"/>
+ <xsd:enumeration value="Occupant"/>
+ <xsd:enumeration value="OccupationalHealthServices"/>
+ <xsd:enumeration value="OccupationalTherapyServices"/>
+ <xsd:enumeration value="OceanTariffConference"/>
+ <xsd:enumeration value="OfficeManager"/>
+ <xsd:enumeration value="Officer"/>
+ <xsd:enumeration value="OffsetOperator"/>
+ <xsd:enumeration value="OilAndGasCustodian"/>
+ <xsd:enumeration value="OilAndGasRegulatoryAgency"/>
+ <xsd:enumeration value="OldAssignee"/>
+ <xsd:enumeration value="OldDebtor"/>
+ <xsd:enumeration value="OldSecuredParty"/>
+ <xsd:enumeration value="OnBehalfOf"/>
+ <xsd:enumeration value="On-CallProvider"/>
+ <xsd:enumeration value="OncologyCenter"/>
+ <xsd:enumeration value="Open-HeartSurgeryFacility"/>
+ <xsd:enumeration value="OperatingPhysician"/>
+ <xsd:enumeration value="Operator-CommunicationChannel"/>
+ <xsd:enumeration value="Operator-EssentialServices"/>
+ <xsd:enumeration value="OperatorOfPropertyOrEquipment"/>
+ <xsd:enumeration value="OperatorOfPropertyOrUnit"/>
+ <xsd:enumeration value="OperatorOfTheSourceTransferPoint"/>
+ <xsd:enumeration value="OperatorOfTheTransferPoint"/>
+ <xsd:enumeration value="OrderedBank"/>
+ <xsd:enumeration value="OrderedBy"/>
+ <xsd:enumeration value="OrderingBank"/>
+ <xsd:enumeration value="OrderingCustomer"/>
+ <xsd:enumeration value="OrderingParty"/>
+ <xsd:enumeration value="OrderingPhysician"/>
+ <xsd:enumeration value="OrderOfShippersOrders-Transportation"/>
+ <xsd:enumeration value="OrderOfTheShipperParty"/>
+ <xsd:enumeration value="OrderWriter"/>
+ <xsd:enumeration value="Organization"/>
+ <xsd:enumeration value="OrganizationCompletingConfigurationChange"/>
+ <xsd:enumeration value="OrganizationGroup"/>
+ <xsd:enumeration value="OrganizationHavingSourceControl"/>
+ <xsd:enumeration value="OrganizedOutpatientServices"/>
+ <xsd:enumeration value="OrganizedSocialWorkServiceFacility"/>
+ <xsd:enumeration value="Organizer"/>
+ <xsd:enumeration value="OrganOrTissueTransplantUnit"/>
+ <xsd:enumeration value="OriginalClaimant"/>
+ <xsd:enumeration value="OriginalIntermodalRamp"/>
+ <xsd:enumeration value="OriginalJurisdiction"/>
+ <xsd:enumeration value="OriginalLocation"/>
+ <xsd:enumeration value="OriginalName"/>
+ <xsd:enumeration value="OriginalShipper"/>
+ <xsd:enumeration value="OriginatingBank"/>
+ <xsd:enumeration value="OriginatingCompany"/>
+ <xsd:enumeration value="OriginatorOfArticleNumber"/>
+ <xsd:enumeration value="OriginCarrier"/>
+ <xsd:enumeration value="OriginDrayman"/>
+ <xsd:enumeration value="OriginMailFacility"/>
+ <xsd:enumeration value="OriginSublocation"/>
+ <xsd:enumeration value="OriginTerminal"/>
+ <xsd:enumeration value="OrthopedicFacility"/>
+ <xsd:enumeration value="OrthopedicSurgeryFacility"/>
+ <xsd:enumeration value="OtherDepartments"/>
+ <xsd:enumeration value="OtherDisadvantagedBusiness"/>
+ <xsd:enumeration value="OtherIndividualDisabilityCarrier"/>
+ <xsd:enumeration value="OtherInsured"/>
+ <xsd:enumeration value="OtherNot-For-ProfitFacility"/>
+ <xsd:enumeration value="OtherPersonOrEntityAssociatedWithStudent"/>
+ <xsd:enumeration value="OtherPhysician"/>
+ <xsd:enumeration value="OtherRelatedParty"/>
+ <xsd:enumeration value="OtherSpecialtyFacility"/>
+ <xsd:enumeration value="OtherUnlistedTypeOfOrganizationalEntity"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaLocation"/>
+ <xsd:enumeration value="Out-Of-StatePrincipalOffice"/>
+ <xsd:enumeration value="OutpatientSocialWorkServices"/>
+ <xsd:enumeration value="OutpatientSurgeryServices"/>
+ <xsd:enumeration value="OutpatientSurgicenter"/>
+ <xsd:enumeration value="OutsideInspectionAgency"/>
+ <xsd:enumeration value="OutsideProcessor"/>
+ <xsd:enumeration value="OutsideTestAgency"/>
+ <xsd:enumeration value="OverrideInstitution"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnerAnnuitant"/>
+ <xsd:enumeration value="OwnerAnnuitantPayor"/>
+ <xsd:enumeration value="OwnerJointAnnuitantPayor"/>
+ <xsd:enumeration value="OwnerOfEquipment"/>
+ <xsd:enumeration value="OwnerOfMeansOfTransport"/>
+ <xsd:enumeration value="OwnerOfOperation"/>
+ <xsd:enumeration value="OwnerOfProperty"/>
+ <xsd:enumeration value="OwnerOfPropertyOrUnit"/>
+ <xsd:enumeration value="OwnerOfResidence"/>
+ <xsd:enumeration value="OwnerOfVehicle"/>
+ <xsd:enumeration value="OwnerOfVessel"/>
+ <xsd:enumeration value="OwnerOrLessorsSurveyor"/>
+ <xsd:enumeration value="OwnerPayor"/>
+ <xsd:enumeration value="OwnersAgent"/>
+ <xsd:enumeration value="OwnersRepresentative"/>
+ <xsd:enumeration value="OwningInventoryControlPoint"/>
+ <xsd:enumeration value="OxygenTherapyFacility"/>
+ <xsd:enumeration value="Packer"/>
+ <xsd:enumeration value="Paramedic"/>
+ <xsd:enumeration value="ParamedicalCompany"/>
+ <xsd:enumeration value="Parent"/>
+ <xsd:enumeration value="ParentCompany"/>
+ <xsd:enumeration value="Participant"/>
+ <xsd:enumeration value="ParticipatingArea"/>
+ <xsd:enumeration value="ParticipatingLaboratory"/>
+ <xsd:enumeration value="Partner"/>
+ <xsd:enumeration value="Partnership"/>
+ <xsd:enumeration value="PartnershipFor-ProfitFacility"/>
+ <xsd:enumeration value="PartRemanufacturer"/>
+ <xsd:enumeration value="PartsDistributor"/>
+ <xsd:enumeration value="PartSource"/>
+ <xsd:enumeration value="PartyAccordingToDocumentaryCreditTransaction"/>
+ <xsd:enumeration value="PartyAssigningAStatus"/>
+ <xsd:enumeration value="PartyAtFinalPlaceOfPositioning"/>
+ <xsd:enumeration value="PartyAtPick-UpLocation"/>
+ <xsd:enumeration value="PartyAuthorizedtoDefinitizeContractAction"/>
+ <xsd:enumeration value="PartyAuthorizedToMakeDefiniteAContractAction"/>
+ <xsd:enumeration value="PartyAuthorizingDisposition"/>
+ <xsd:enumeration value="PartyAuthorizingReleaseOfSecurityInformation"/>
+ <xsd:enumeration value="PartyDataResponsibleParty"/>
+ <xsd:enumeration value="PartyDeclaringTheValueAddedTax"/>
+ <xsd:enumeration value="PartyDesignatedToExecuteRe-Icing"/>
+ <xsd:enumeration value="PartyDesignatedToExecuteSanitaryProcedures"/>
+ <xsd:enumeration value="PartyDesignatedToProvideLivingAnimalCare"/>
+ <xsd:enumeration value="PartyExecutingAndVerifying"/>
+ <xsd:enumeration value="PartyFillingShippersOrder"/>
+ <xsd:enumeration value="PartyForWhomItemIsUltimatelyIntended"/>
+ <xsd:enumeration value="PartyFromWhomCustomsDocumentsAreToBePickedUp"/>
+ <xsd:enumeration value="PartyFromWhomNon-CustomsDocumentsAreToBePickedUp"/>
+ <xsd:enumeration value="PartyFulfillingAllOperations"/>
+ <xsd:enumeration value="PartyInPossession"/>
+ <xsd:enumeration value="PartyIssuingMutuallyAgreedCodes"/>
+ <xsd:enumeration value="PartyMaintainingTheCodesUsedInTheMessage"/>
+ <xsd:enumeration value="PartyMaintainingTheIdentifiersUsedInTheMessage"/>
+ <xsd:enumeration value="PartyMandatedToLiquidateAnEnterprise"/>
+ <xsd:enumeration value="PartyManufacturedFor"/>
+ <xsd:enumeration value="PartyNotToBeConfusedWith"/>
+ <xsd:enumeration value="PartyPassingTheTransaction"/>
+ <xsd:enumeration value="PartyPerformingCertification"/>
+ <xsd:enumeration value="PartyPerformingCount"/>
+ <xsd:enumeration value="PartyPerformingInspection"/>
+ <xsd:enumeration value="PartyPerformingTask"/>
+ <xsd:enumeration value="PartyPerformingVerification"/>
+ <xsd:enumeration value="PartyProvidingFinancing"/>
+ <xsd:enumeration value="PartyProvidingGovernmentFurnishedProperty"/>
+ <xsd:enumeration value="PartyRecoveringTheValueAddedTax"/>
+ <xsd:enumeration value="PartyRepresented"/>
+ <xsd:enumeration value="PartyResponsibleForDisinfection"/>
+ <xsd:enumeration value="PartyResponsibleForFinancialSettlement"/>
+ <xsd:enumeration value="PartyResponsibleForRefueling"/>
+ <xsd:enumeration value="PartySubmittingQuote"/>
+ <xsd:enumeration value="PartyThatReceivedDisclosureStatement"/>
+ <xsd:enumeration value="PartyThatRemitsPayment"/>
+ <xsd:enumeration value="PartytoAppearBefore"/>
+ <xsd:enumeration value="PartyToApproveSpecification"/>
+ <xsd:enumeration value="Partytobeadvised-WrittenOrders"/>
+ <xsd:enumeration value="PartyToBeBilled"/>
+ <xsd:enumeration value="PartyToBeBilledForOtherThanFreight"/>
+ <xsd:enumeration value="PartytoContract"/>
+ <xsd:enumeration value="PartyToFilePersonalPropertyTax"/>
+ <xsd:enumeration value="PartytoLease"/>
+ <xsd:enumeration value="PartytoPerformPackaging"/>
+ <xsd:enumeration value="PartyToPrintSomeDocument"/>
+ <xsd:enumeration value="PartytoProvideDiscount"/>
+ <xsd:enumeration value="PartyToReceiveAllDocuments"/>
+ <xsd:enumeration value="PartytoReceiveBillOfLading"/>
+ <xsd:enumeration value="PartyToReceiveCertificateOfCompliance"/>
+ <xsd:enumeration value="PartyToReceiveCertificateOfConformance"/>
+ <xsd:enumeration value="PartyToReceiveCertifiedInspectionReport"/>
+ <xsd:enumeration value="PartyToReceiveCertifiedTestResults"/>
+ <xsd:enumeration value="PartyToReceiveCommercialInvoiceRemittance"/>
+ <xsd:enumeration value="PartyToReceiveContractSecurityClassificationSpecification"/>
+ <xsd:enumeration value="PartyToReceiveCopy"/>
+ <xsd:enumeration value="PartyToReceiveCorrespondence"/>
+ <xsd:enumeration value="PartytoReceiveCredit"/>
+ <xsd:enumeration value="PartyToReceiveCustomsDocuments"/>
+ <xsd:enumeration value="PartyToReceiveElectronicMemoOfInvoice"/>
+ <xsd:enumeration value="PartyToReceiveEquipment"/>
+ <xsd:enumeration value="PartyToReceiveFreightBill"/>
+ <xsd:enumeration value="PartyToReceiveInspectionReport"/>
+ <xsd:enumeration value="PartyToReceiveInvitationToOffer"/>
+ <xsd:enumeration value="PartytoReceiveInvoiceFOrGoodsOrServices"/>
+ <xsd:enumeration value="PartyToReceiveInvoiceForLeasePayments"/>
+ <xsd:enumeration value="PartytoReceiveLimitationsOfHeavyElementsReport"/>
+ <xsd:enumeration value="PartytoReceiveMaterialRelease"/>
+ <xsd:enumeration value="PartyToReceiveNon-CustomsDocuments"/>
+ <xsd:enumeration value="PartyToReceiveOrderToSupply"/>
+ <xsd:enumeration value="PartyToReceivePackingCratingAndHandlingCredit"/>
+ <xsd:enumeration value="PartyToReceivePaperMemoOfInvoice"/>
+ <xsd:enumeration value="PartytoReceiveProposal"/>
+ <xsd:enumeration value="PartyToReceivePurchaseOrder"/>
+ <xsd:enumeration value="PartyToReceiveReports"/>
+ <xsd:enumeration value="PartytoReceiveScaleTicket"/>
+ <xsd:enumeration value="PartytoReceiveShippingManifest"/>
+ <xsd:enumeration value="PartyToReceiveShippingNotice"/>
+ <xsd:enumeration value="PartytoReceiveSolicitation"/>
+ <xsd:enumeration value="PartyToReceiveStatementOfAccount"/>
+ <xsd:enumeration value="PartyToReceiveStatementOfFeesDue"/>
+ <xsd:enumeration value="PartytoReceiveStatus"/>
+ <xsd:enumeration value="PartyToReceiveTechnicalDocumentation"/>
+ <xsd:enumeration value="PartyToReceiveTestReport"/>
+ <xsd:enumeration value="PartytoReceiveTransportationCredit"/>
+ <xsd:enumeration value="PartytoWhomAcknowledgmentShouldBeSent"/>
+ <xsd:enumeration value="PartyToWhomDocumentsAreToBePresented"/>
+ <xsd:enumeration value="PartytoWhomProtestSubmitted"/>
+ <xsd:enumeration value="PartyWaivingRequirements"/>
+ <xsd:enumeration value="PartyWhichDeliversConsignmentsToTheTerminal"/>
+ <xsd:enumeration value="PartyWhichPicksUpConsignmentsFromTheTerminal"/>
+ <xsd:enumeration value="PartyWhoSignedTheDeliveryReceipt"/>
+ <xsd:enumeration value="PartyWithKnowledgeOfAffairsOfTheCompany"/>
+ <xsd:enumeration value="PartyWithPowerToVoteSecurities"/>
+ <xsd:enumeration value="Passenger"/>
+ <xsd:enumeration value="Patient"/>
+ <xsd:enumeration value="PatientCompanion"/>
+ <xsd:enumeration value="PatientEducationUnit"/>
+ <xsd:enumeration value="PatientFacility"/>
+ <xsd:enumeration value="PatientRepresentativeServices"/>
+ <xsd:enumeration value="Payee"/>
+ <xsd:enumeration value="PayeesCompanyNameOrId"/>
+ <xsd:enumeration value="Payer"/>
+ <xsd:enumeration value="PayerOfLastResort"/>
+ <xsd:enumeration value="PayersCompanyNameOrId"/>
+ <xsd:enumeration value="PayersFinancialInstitution"/>
+ <xsd:enumeration value="PayingAgent"/>
+ <xsd:enumeration value="PayingBank"/>
+ <xsd:enumeration value="PayingFinancialInstitution"/>
+ <xsd:enumeration value="PaymentAddress"/>
+ <xsd:enumeration value="Payor"/>
+ <xsd:enumeration value="Pay-ToProvider"/>
+ <xsd:enumeration value="Pedestrian"/>
+ <xsd:enumeration value="PediatricAcuteInpatientUnit"/>
+ <xsd:enumeration value="PerformedAt"/>
+ <xsd:enumeration value="PermitHolder"/>
+ <xsd:enumeration value="PersonForWhoseBenefitPropertywasSeized"/>
+ <xsd:enumeration value="PersonnelOffice"/>
+ <xsd:enumeration value="PersonOnClaim"/>
+ <xsd:enumeration value="PersonOrOtherEntityLegallyResponsibleForAChild"/>
+ <xsd:enumeration value="PersonOrOtherEntityLegallyResponsibleForAndWithWhomAChildResides"/>
+ <xsd:enumeration value="PersonOrOtherEntityWithWhomAChildResides"/>
+ <xsd:enumeration value="PetitioningCreditor"/>
+ <xsd:enumeration value="PetitioningCreditorsAttorney"/>
+ <xsd:enumeration value="Pharmacist"/>
+ <xsd:enumeration value="Pharmacy"/>
+ <xsd:enumeration value="PharmacyDepartment"/>
+ <xsd:enumeration value="PhysicalAddress"/>
+ <xsd:enumeration value="PhysicalTherapyServices"/>
+ <xsd:enumeration value="Physician"/>
+ <xsd:enumeration value="PhysicianClinicOrGroupPractice"/>
+ <xsd:enumeration value="PhysicianHospitalOrganization"/>
+ <xsd:enumeration value="Physician-Specialists"/>
+ <xsd:enumeration value="PickUpAddress"/>
+ <xsd:enumeration value="PierName"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PipelineSegment"/>
+ <xsd:enumeration value="PipelineSegmentBoundary"/>
+ <xsd:enumeration value="PlaceOfBottling"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="PlaceOfDistilling"/>
+ <xsd:enumeration value="PlaceOfOccurrence"/>
+ <xsd:enumeration value="PlaceOfPerformanceCognizantSecurityOffice"/>
+ <xsd:enumeration value="Plaintiff"/>
+ <xsd:enumeration value="PlanAdministrator"/>
+ <xsd:enumeration value="PlanningOrMaintenanceOrganization"/>
+ <xsd:enumeration value="PlanningCommission"/>
+ <xsd:enumeration value="PlanningScheduleOrMaterialReleaseIssuer"/>
+ <xsd:enumeration value="PlanSponsor"/>
+ <xsd:enumeration value="Plant"/>
+ <xsd:enumeration value="PlantClearanceOfficer"/>
+ <xsd:enumeration value="Podiatrist"/>
+ <xsd:enumeration value="PointOfService"/>
+ <xsd:enumeration value="PolicyHolder"/>
+ <xsd:enumeration value="PolicyWritingAgent"/>
+ <xsd:enumeration value="PollingSite"/>
+ <xsd:enumeration value="PortAuthority"/>
+ <xsd:enumeration value="PostalMailingAddress"/>
+ <xsd:enumeration value="PostsecondaryEducationRecipient"/>
+ <xsd:enumeration value="PostsecondaryEducationSender"/>
+ <xsd:enumeration value="Post-SecondaryInstitution"/>
+ <xsd:enumeration value="PotentialSourceOfSupply"/>
+ <xsd:enumeration value="PowerOfAttorney"/>
+ <xsd:enumeration value="PreferredProviderOrganization"/>
+ <xsd:enumeration value="Pre-KDayCare"/>
+ <xsd:enumeration value="Pre-kindergartenToGrade12Recipient"/>
+ <xsd:enumeration value="Pre-kindergartenToGrade12Sender"/>
+ <xsd:enumeration value="PreliminaryCustomerOrganization"/>
+ <xsd:enumeration value="PreliminaryInspectionLocation"/>
+ <xsd:enumeration value="PreliminaryMaintenanceOrganization"/>
+ <xsd:enumeration value="PreliminaryMaintenancePeriodDesignatingOrganization"/>
+ <xsd:enumeration value="PreliminaryReferredToOrganization"/>
+ <xsd:enumeration value="Premises"/>
+ <xsd:enumeration value="Preparer"/>
+ <xsd:enumeration value="PresentAddress"/>
+ <xsd:enumeration value="PresentingBank"/>
+ <xsd:enumeration value="President"/>
+ <xsd:enumeration value="PreviousBusinessPartner"/>
+ <xsd:enumeration value="PreviousCreditGrantor"/>
+ <xsd:enumeration value="PreviousDebtHolder"/>
+ <xsd:enumeration value="PreviousDistributor"/>
+ <xsd:enumeration value="PreviousEmployer"/>
+ <xsd:enumeration value="PreviousGroup"/>
+ <xsd:enumeration value="PreviousInsured"/>
+ <xsd:enumeration value="PreviousMember"/>
+ <xsd:enumeration value="PreviousName"/>
+ <xsd:enumeration value="PreviousNameOfFirm"/>
+ <xsd:enumeration value="PreviousNeighbor"/>
+ <xsd:enumeration value="PreviousOccupant"/>
+ <xsd:enumeration value="PreviousOwner"/>
+ <xsd:enumeration value="PreviousResidence"/>
+ <xsd:enumeration value="PreviousStation"/>
+ <xsd:enumeration value="PreviousTitleCompany"/>
+ <xsd:enumeration value="PreviousTradeUnion"/>
+ <xsd:enumeration value="PriceAdministration"/>
+ <xsd:enumeration value="PrimaryBeneficiary"/>
+ <xsd:enumeration value="PrimaryCareProvider"/>
+ <xsd:enumeration value="PriceCheckShipTo"/>
+ <xsd:enumeration value="PrimaryControlPointLocation"/>
+ <xsd:enumeration value="PrimaryHealthCareProvider"/>
+ <xsd:enumeration value="PrimaryInsuredOrSubscriber"/>
+ <xsd:enumeration value="PrimaryInterexchangeCarrier"/>
+ <xsd:enumeration value="PrimaryInternationalTelecomCarrier"/>
+ <xsd:enumeration value="PrimaryIntra-LATACarrier"/>
+ <xsd:enumeration value="PrimaryInventoryControlActivity"/>
+ <xsd:enumeration value="PrimaryOwner"/>
+ <xsd:enumeration value="PrimaryPayer"/>
+ <xsd:enumeration value="PrimaryPhysician"/>
+ <xsd:enumeration value="PrimaryResidence"/>
+ <xsd:enumeration value="PrimarySupportOrganization"/>
+ <xsd:enumeration value="PrimarySurgeon"/>
+ <xsd:enumeration value="PrimaryTaxpayer"/>
+ <xsd:enumeration value="PrimeContractor"/>
+ <xsd:enumeration value="Principal"/>
+ <xsd:enumeration value="PrincipalBorrower"/>
+ <xsd:enumeration value="PrincipalExecutiveOffice"/>
+ <xsd:enumeration value="PrincipalPerson"/>
+ <xsd:enumeration value="Printer"/>
+ <xsd:enumeration value="PriorBaseJurisdiction"/>
+ <xsd:enumeration value="PriorIncorrectInsured"/>
+ <xsd:enumeration value="PriorInsuranceCarrier"/>
+ <xsd:enumeration value="PriorTitleEvidenceHolder"/>
+ <xsd:enumeration value="PrivatePre-KEducation"/>
+ <xsd:enumeration value="PrivateSchool"/>
+ <xsd:enumeration value="ProBonoAttorney"/>
+ <xsd:enumeration value="Processor"/>
+ <xsd:enumeration value="ProcurementResponsibilityForOrder"/>
+ <xsd:enumeration value="ProduceDepartment"/>
+ <xsd:enumeration value="Producer"/>
+ <xsd:enumeration value="Production"/>
+ <xsd:enumeration value="ProductionManager"/>
+ <xsd:enumeration value="ProductPositionHolder"/>
+ <xsd:enumeration value="ProductServicesAndRepairsCentre"/>
+ <xsd:enumeration value="ProfessionalOrganization"/>
+ <xsd:enumeration value="Project"/>
+ <xsd:enumeration value="ProjectCoordinationOffice"/>
+ <xsd:enumeration value="ProjectManagementOffice"/>
+ <xsd:enumeration value="ProjectManager"/>
+ <xsd:enumeration value="ProjectName"/>
+ <xsd:enumeration value="ProjectProperty"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="PropertyOrBuildingManager"/>
+ <xsd:enumeration value="ProposedInsured"/>
+ <xsd:enumeration value="Proposer"/>
+ <xsd:enumeration value="ProSeCounsel"/>
+ <xsd:enumeration value="PrototypeSupplier"/>
+ <xsd:enumeration value="Provider"/>
+ <xsd:enumeration value="PsychiatricChildOrAdolescentServices"/>
+ <xsd:enumeration value="PsychiatricConsultation-LiaisonServices"/>
+ <xsd:enumeration value="PsychiatricEducationServices"/>
+ <xsd:enumeration value="PsychiatricEmergencyServices"/>
+ <xsd:enumeration value="PsychiatricFacility"/>
+ <xsd:enumeration value="PsychiatricGeriatricServices"/>
+ <xsd:enumeration value="PsychiatricHealthFacility"/>
+ <xsd:enumeration value="PsychiatricInpatientUnit"/>
+ <xsd:enumeration value="PsychiatricOutpatientServices"/>
+ <xsd:enumeration value="PsychiatricPartialHospitalizationProgram"/>
+ <xsd:enumeration value="Psychiatrist"/>
+ <xsd:enumeration value="Psychologist"/>
+ <xsd:enumeration value="PublicAlternativeSchool"/>
+ <xsd:enumeration value="PublicHealthServiceFacility"/>
+ <xsd:enumeration value="PublicHealthServiceIndianServiceFacility"/>
+ <xsd:enumeration value="PublicorPrivateOrganizationForTheDisabled"/>
+ <xsd:enumeration value="PublicPre-KEducation"/>
+ <xsd:enumeration value="PublicSchool"/>
+ <xsd:enumeration value="Publisher"/>
+ <xsd:enumeration value="Pumper"/>
+ <xsd:enumeration value="PurchasedCompany"/>
+ <xsd:enumeration value="PurchasersDepartmentBuyer"/>
+ <xsd:enumeration value="PurchaseServiceProvider"/>
+ <xsd:enumeration value="QualifyingOfficer"/>
+ <xsd:enumeration value="QualityControl"/>
+ <xsd:enumeration value="QuotationRequestingParty"/>
+ <xsd:enumeration value="RadioactiveImplantsUnit"/>
+ <xsd:enumeration value="RadioControlStationLocation"/>
+ <xsd:enumeration value="RadioStation"/>
+ <xsd:enumeration value="RailCarrier"/>
+ <xsd:enumeration value="Railroad"/>
+ <xsd:enumeration value="RatingOrganization"/>
+ <xsd:enumeration value="ReceiptMeterLocation"/>
+ <xsd:enumeration value="ReceiptZone"/>
+ <xsd:enumeration value="ReceivedFrom"/>
+ <xsd:enumeration value="Receiver"/>
+ <xsd:enumeration value="ReceiverManager"/>
+ <xsd:enumeration value="ReceiverOfCheque"/>
+ <xsd:enumeration value="ReceiverOfFunds"/>
+ <xsd:enumeration value="ReceiversCorrespondentBank"/>
+ <xsd:enumeration value="ReceiverSite"/>
+ <xsd:enumeration value="ReceiversSub-Entity"/>
+ <xsd:enumeration value="ReceivingBank"/>
+ <xsd:enumeration value="ReceivingCompany"/>
+ <xsd:enumeration value="ReceivingFacilityScheduler"/>
+ <xsd:enumeration value="ReceivingFinancialInstitution"/>
+ <xsd:enumeration value="ReceivingLocation"/>
+ <xsd:enumeration value="ReceivingPointForCustomerSamples"/>
+ <xsd:enumeration value="ReceivingSub-Location"/>
+ <xsd:enumeration value="RecipientOfCivilorLegalLiabilityPayment"/>
+ <xsd:enumeration value="ReclamationCenter"/>
+ <xsd:enumeration value="Record-KeepingAddress"/>
+ <xsd:enumeration value="RecoveryRoom"/>
+ <xsd:enumeration value="RecreationalTherapyServices"/>
+ <xsd:enumeration value="Referee"/>
+ <xsd:enumeration value="Reference"/>
+ <xsd:enumeration value="ReferencesEmployer"/>
+ <xsd:enumeration value="ReferralProvider"/>
+ <xsd:enumeration value="ReferringHealthCareProvider"/>
+ <xsd:enumeration value="ReferringProvider"/>
+ <xsd:enumeration value="Refinery"/>
+ <xsd:enumeration value="RefineryOperator"/>
+ <xsd:enumeration value="RefusalParty"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegionalOffice"/>
+ <xsd:enumeration value="RegisteredBusinessName"/>
+ <xsd:enumeration value="RegisteredInvestmentAdvisor"/>
+ <xsd:enumeration value="RegisteredOffice"/>
+ <xsd:enumeration value="RegisteredOwner"/>
+ <xsd:enumeration value="RegisteredPrincipal"/>
+ <xsd:enumeration value="RegisteringNonparentParty"/>
+ <xsd:enumeration value="RegisteringParentParty"/>
+ <xsd:enumeration value="RegisteringParty"/>
+ <xsd:enumeration value="Registrar"/>
+ <xsd:enumeration value="RegistrationTribunal"/>
+ <xsd:enumeration value="RegularDealer"/>
+ <xsd:enumeration value="RegulatoryStateDistrict"/>
+ <xsd:enumeration value="RegulatoryStateEntity"/>
+ <xsd:enumeration value="RehabilitationFacility"/>
+ <xsd:enumeration value="RehabilitationInpatientUnit"/>
+ <xsd:enumeration value="RehabilitationOutpatientServices"/>
+ <xsd:enumeration value="ReimbursingBank"/>
+ <xsd:enumeration value="ReinsuranceIntermediaryOrBroker"/>
+ <xsd:enumeration value="Reinsurer"/>
+ <xsd:enumeration value="Relative"/>
+ <xsd:enumeration value="ReleaseDrayman"/>
+ <xsd:enumeration value="ReleaseToParty"/>
+ <xsd:enumeration value="RemittingBank"/>
+ <xsd:enumeration value="RemitTo"/>
+ <xsd:enumeration value="RenderingProvider"/>
+ <xsd:enumeration value="Renter"/>
+ <xsd:enumeration value="RentPayor"/>
+ <xsd:enumeration value="RepairingOutlet"/>
+ <xsd:enumeration value="RepairOrRefurbishLocation"/>
+ <xsd:enumeration value="ReplacingManufacturer"/>
+ <xsd:enumeration value="Reporter"/>
+ <xsd:enumeration value="ReportingCarrier"/>
+ <xsd:enumeration value="ReportingCarriersNominatedAgentOrRepresentative"/>
+ <xsd:enumeration value="ReportingLocation"/>
+ <xsd:enumeration value="ReportingOfficer"/>
+ <xsd:enumeration value="Representative"/>
+ <xsd:enumeration value="ReproductiveHealthServices"/>
+ <xsd:enumeration value="RequestedLender"/>
+ <xsd:enumeration value="Requestor"/>
+ <xsd:enumeration value="ResaleCustomer"/>
+ <xsd:enumeration value="ResaleDealer"/>
+ <xsd:enumeration value="ResearchInstitute"/>
+ <xsd:enumeration value="Reservoir"/>
+ <xsd:enumeration value="ResidenceOrDomicile"/>
+ <xsd:enumeration value="ResidencyInstitution"/>
+ <xsd:enumeration value="ResidentBeneficiary"/>
+ <xsd:enumeration value="ResidentInstructingParty"/>
+ <xsd:enumeration value="RespiratoryTherapyServices"/>
+ <xsd:enumeration value="RespiteCareFacility"/>
+ <xsd:enumeration value="ResponsibleExhibitor"/>
+ <xsd:enumeration value="ResponsibleGovernmentAgency"/>
+ <xsd:enumeration value="ResponsibleInstallationDestination"/>
+ <xsd:enumeration value="ResponsibleInstallationOrigin"/>
+ <xsd:enumeration value="ResponsibleParty"/>
+ <xsd:enumeration value="RetailAccount"/>
+ <xsd:enumeration value="RetailPharmacy"/>
+ <xsd:enumeration value="Retrocessionaire"/>
+ <xsd:enumeration value="ReturnedTo"/>
+ <xsd:enumeration value="RoadCarrier"/>
+ <xsd:enumeration value="RoutingParty"/>
+ <xsd:enumeration value="RoutingPoint"/>
+ <xsd:enumeration value="RoyaltyOwner"/>
+ <xsd:enumeration value="RuralHealthClinic"/>
+ <xsd:enumeration value="SalesAssistant"/>
+ <xsd:enumeration value="SalesOffice"/>
+ <xsd:enumeration value="Salesperson"/>
+ <xsd:enumeration value="SalesResponsibility"/>
+ <xsd:enumeration value="SalvageCarrier"/>
+ <xsd:enumeration value="SamplesToBeReturnedTo"/>
+ <xsd:enumeration value="SamplingLocation"/>
+ <xsd:enumeration value="School-BasedServiceProvider"/>
+ <xsd:enumeration value="SchoolDistrict"/>
+ <xsd:enumeration value="SCorporation"/>
+ <xsd:enumeration value="ScreeningPoint"/>
+ <xsd:enumeration value="SealingCompany"/>
+ <xsd:enumeration value="SecondaryInventoryControlActivity"/>
+ <xsd:enumeration value="SecondaryLocationAddress"/>
+ <xsd:enumeration value="SecondaryPayer"/>
+ <xsd:enumeration value="SecondaryTaxpayer"/>
+ <xsd:enumeration value="SecondaryWarranter"/>
+ <xsd:enumeration value="SecondContact"/>
+ <xsd:enumeration value="SecondContactOrganization"/>
+ <xsd:enumeration value="SecondHome"/>
+ <xsd:enumeration value="SecondLevelParentCompany"/>
+ <xsd:enumeration value="Secretariat"/>
+ <xsd:enumeration value="Section8AProgramParticipantFirm"/>
+ <xsd:enumeration value="SecuredParty"/>
+ <xsd:enumeration value="SecuredPartyCompany"/>
+ <xsd:enumeration value="SecuredPartyIndividual"/>
+ <xsd:enumeration value="SelfInsured"/>
+ <xsd:enumeration value="Seller"/>
+ <xsd:enumeration value="SellerAsOfficiallyRegistered"/>
+ <xsd:enumeration value="SellersAgentOrRepresentative"/>
+ <xsd:enumeration value="SellersFinancialInstitution"/>
+ <xsd:enumeration value="SellingAgent"/>
+ <xsd:enumeration value="SellingOffice"/>
+ <xsd:enumeration value="SellingParty"/>
+ <xsd:enumeration value="SenderOfFunds"/>
+ <xsd:enumeration value="SendersCorrespondentBank"/>
+ <xsd:enumeration value="SeniorMembershipProgram"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceLocation"/>
+ <xsd:enumeration value="ServiceManager"/>
+ <xsd:enumeration value="ServiceOrganization"/>
+ <xsd:enumeration value="ServicePerformanceSite"/>
+ <xsd:enumeration value="ServicePerformer"/>
+ <xsd:enumeration value="ServiceProvider"/>
+ <xsd:enumeration value="ServiceRequester"/>
+ <xsd:enumeration value="ServiceSupplier"/>
+ <xsd:enumeration value="ServicingAgent"/>
+ <xsd:enumeration value="ServicingBroker"/>
+ <xsd:enumeration value="ServicingDealer"/>
+ <xsd:enumeration value="ServicingOrganization"/>
+ <xsd:enumeration value="SharedService"/>
+ <xsd:enumeration value="Shareholder"/>
+ <xsd:enumeration value="ShelteredWorkshop"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="Shipper"/>
+ <xsd:enumeration value="ShippersAssociation"/>
+ <xsd:enumeration value="ShippingLineService"/>
+ <xsd:enumeration value="ShippingScheduleIssuer"/>
+ <xsd:enumeration value="ShipTo"/>
+ <xsd:enumeration value="ShowingAgent"/>
+ <xsd:enumeration value="Sibling"/>
+ <xsd:enumeration value="Signatory"/>
+ <xsd:enumeration value="Signer"/>
+ <xsd:enumeration value="SignificantOther"/>
+ <xsd:enumeration value="SinglePhotonEmissionComputerizedTomographyUnit"/>
+ <xsd:enumeration value="SiteOperator"/>
+ <xsd:enumeration value="SkilledNursingFacility"/>
+ <xsd:enumeration value="SkilledNursingorOtherLong-TermCareUnit"/>
+ <xsd:enumeration value="SkilledNursingServices"/>
+ <xsd:enumeration value="Slaughterer"/>
+ <xsd:enumeration value="SlotCharterParty"/>
+ <xsd:enumeration value="SmallBaseStationLocation"/>
+ <xsd:enumeration value="SmallBusiness"/>
+ <xsd:enumeration value="SmallControlStationLocation"/>
+ <xsd:enumeration value="SmallDisadvantagedBusiness"/>
+ <xsd:enumeration value="SociallyDisadvantagedBusiness"/>
+ <xsd:enumeration value="SociallyDisadvantagedIndividual"/>
+ <xsd:enumeration value="SociallyInsuredPerson"/>
+ <xsd:enumeration value="SocialSecuritiesCollectorsOffice"/>
+ <xsd:enumeration value="SocietyOfPropertyInformationCompilersAndAnalysts"/>
+ <xsd:enumeration value="SoldTo"/>
+ <xsd:enumeration value="SoldToAndShipTo"/>
+ <xsd:enumeration value="SoldToIfDifferentFromBillTo"/>
+ <xsd:enumeration value="SoleProprietor"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SourceMeterLocation"/>
+ <xsd:enumeration value="SourceOfInformation"/>
+ <xsd:enumeration value="SourcePartyOfInformation"/>
+ <xsd:enumeration value="SpecialAccount"/>
+ <xsd:enumeration value="SpecialCounsel"/>
+ <xsd:enumeration value="SpecializedMobileRadioServiceLicensee"/>
+ <xsd:enumeration value="SpecializedOutpatientProgramForAIDSOrARC"/>
+ <xsd:enumeration value="SpecifiedRepository"/>
+ <xsd:enumeration value="SpeechTherapyServices"/>
+ <xsd:enumeration value="SportsMedicineClinicOrServices"/>
+ <xsd:enumeration value="Spouse"/>
+ <xsd:enumeration value="SpouseInsured"/>
+ <xsd:enumeration value="SpudContractor"/>
+ <xsd:enumeration value="State"/>
+ <xsd:enumeration value="StateCharteredFacility"/>
+ <xsd:enumeration value="StateDivision"/>
+ <xsd:enumeration value="SteamshipCompany"/>
+ <xsd:enumeration value="Stockholder"/>
+ <xsd:enumeration value="StorageArea"/>
+ <xsd:enumeration value="StorageFacilityatDestination"/>
+ <xsd:enumeration value="StorageFacilityAtOrigin"/>
+ <xsd:enumeration value="Store"/>
+ <xsd:enumeration value="StoreClass"/>
+ <xsd:enumeration value="StoreGroup"/>
+ <xsd:enumeration value="StoreKeeper"/>
+ <xsd:enumeration value="StoreManager"/>
+ <xsd:enumeration value="Student"/>
+ <xsd:enumeration value="StudySubmitter"/>
+ <xsd:enumeration value="Sub-Account"/>
+ <xsd:enumeration value="Subcontractor"/>
+ <xsd:enumeration value="SubcontractOrCognizantSecurityOffice"/>
+ <xsd:enumeration value="Subcontractor-Nominated"/>
+ <xsd:enumeration value="SubcontractorWithDirectPayment"/>
+ <xsd:enumeration value="Sub-Entity"/>
+ <xsd:enumeration value="Subgroup"/>
+ <xsd:enumeration value="SubjectOfInquiry"/>
+ <xsd:enumeration value="SubjectProperty"/>
+ <xsd:enumeration value="Submitter"/>
+ <xsd:enumeration value="SubmitterOfSample"/>
+ <xsd:enumeration value="Sub-Office"/>
+ <xsd:enumeration value="Subscriber"/>
+ <xsd:enumeration value="SubscribersEmployer"/>
+ <xsd:enumeration value="SubscribersSchool"/>
+ <xsd:enumeration value="SubsequentOwner"/>
+ <xsd:enumeration value="Sub-Servicer"/>
+ <xsd:enumeration value="Subsidiary"/>
+ <xsd:enumeration value="SubsidiaryDivision"/>
+ <xsd:enumeration value="SubstituteSupplier"/>
+ <xsd:enumeration value="SuccessfulJobApplicant"/>
+ <xsd:enumeration value="SupervisingHealthCareProvider"/>
+ <xsd:enumeration value="SupervisingPhysician"/>
+ <xsd:enumeration value="Supervisor"/>
+ <xsd:enumeration value="SupervisoryAppraiserName"/>
+ <xsd:enumeration value="Supplier"/>
+ <xsd:enumeration value="SupplierOrManufacturer"/>
+ <xsd:enumeration value="SuppliersCorporateOffice"/>
+ <xsd:enumeration value="SupplierWorkTeam"/>
+ <xsd:enumeration value="SupplySource"/>
+ <xsd:enumeration value="SupportingPersonnel"/>
+ <xsd:enumeration value="SupportParty"/>
+ <xsd:enumeration value="Surety"/>
+ <xsd:enumeration value="SuretyForAdditions"/>
+ <xsd:enumeration value="SuretyForAntidumpingOrCountervailingDuty"/>
+ <xsd:enumeration value="SurfaceDischargeAgency"/>
+ <xsd:enumeration value="SurfaceManagementEntity"/>
+ <xsd:enumeration value="Surgeon"/>
+ <xsd:enumeration value="SurplusDealer"/>
+ <xsd:enumeration value="Surveyor-PofessionalQuantity"/>
+ <xsd:enumeration value="SurveyorQuantity"/>
+ <xsd:enumeration value="SurveyorTopographical"/>
+ <xsd:enumeration value="System"/>
+ <xsd:enumeration value="TankFarm"/>
+ <xsd:enumeration value="TankFarmOwner"/>
+ <xsd:enumeration value="TariffIssuer"/>
+ <xsd:enumeration value="TaxAddress"/>
+ <xsd:enumeration value="TaxAuthority"/>
+ <xsd:enumeration value="TaxCollectorsOffice"/>
+ <xsd:enumeration value="TaxExemptOrganization"/>
+ <xsd:enumeration value="Team"/>
+ <xsd:enumeration value="TechnicalOffice"/>
+ <xsd:enumeration value="TelephoneAnsweringServiceBureau"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="TenantManager"/>
+ <xsd:enumeration value="Tenderer"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="TerminalLocation"/>
+ <xsd:enumeration value="TerminalOperator"/>
+ <xsd:enumeration value="TertiaryPayer"/>
+ <xsd:enumeration value="TestingLaboratory"/>
+ <xsd:enumeration value="TestingService"/>
+ <xsd:enumeration value="TestSponsor"/>
+ <xsd:enumeration value="TheaterCircuit"/>
+ <xsd:enumeration value="Theatre"/>
+ <xsd:enumeration value="TherapeuticRadioisotopeFacility"/>
+ <xsd:enumeration value="ThirdParty"/>
+ <xsd:enumeration value="ThirdPartyAdministrator"/>
+ <xsd:enumeration value="ThirdPartyInvestmentAdvisor"/>
+ <xsd:enumeration value="ThirdPartyMarketer"/>
+ <xsd:enumeration value="ThirdPartyRepricingOrganization"/>
+ <xsd:enumeration value="ThirdPartyRepricingPreferredProviderOrganization"/>
+ <xsd:enumeration value="ThirdPartyReviewingOrganization"/>
+ <xsd:enumeration value="ThirdPartyReviewingPreferredProviderOrganization"/>
+ <xsd:enumeration value="Titleholder"/>
+ <xsd:enumeration value="TitleInsuranceServicesProvider"/>
+ <xsd:enumeration value="TitleUnderwriter"/>
+ <xsd:enumeration value="Tooling"/>
+ <xsd:enumeration value="ToolingDesign"/>
+ <xsd:enumeration value="ToolingFabrication"/>
+ <xsd:enumeration value="ToolSource"/>
+ <xsd:enumeration value="TopParentCompanyInSameCountry"/>
+ <xsd:enumeration value="TowingAgency"/>
+ <xsd:enumeration value="Tradename"/>
+ <xsd:enumeration value="TradeNameSynonym"/>
+ <xsd:enumeration value="TradeUnion"/>
+ <xsd:enumeration value="TrainingInstitution"/>
+ <xsd:enumeration value="TransferPoint"/>
+ <xsd:enumeration value="TransferringParty"/>
+ <xsd:enumeration value="TransferTo"/>
+ <xsd:enumeration value="TransitAuthority"/>
+ <xsd:enumeration value="TransitChargePayer"/>
+ <xsd:enumeration value="TransitFreightForwarder"/>
+ <xsd:enumeration value="TransitPrincipal"/>
+ <xsd:enumeration value="TransitPrincipalsAgentOrRepresentative"/>
+ <xsd:enumeration value="Transmitter"/>
+ <xsd:enumeration value="TransportationOffice"/>
+ <xsd:enumeration value="TransporterOfHazardousWaste"/>
+ <xsd:enumeration value="TransshipmentParty"/>
+ <xsd:enumeration value="TraumaCenter"/>
+ <xsd:enumeration value="TreatmentFacility"/>
+ <xsd:enumeration value="TribalGovernment"/>
+ <xsd:enumeration value="Trust"/>
+ <xsd:enumeration value="Trustee"/>
+ <xsd:enumeration value="TrusteesAttorney"/>
+ <xsd:enumeration value="TrustOfficer"/>
+ <xsd:enumeration value="TrustOrEstate"/>
+ <xsd:enumeration value="TuberculosisAndOTherRespiratoryDiseasesFacility"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomer"/>
+ <xsd:enumeration value="UltimateParentCompany"/>
+ <xsd:enumeration value="UltimateSameCountryParentCompany"/>
+ <xsd:enumeration value="UltrasoundUnit"/>
+ <xsd:enumeration value="UnassignedAgent"/>
+ <xsd:enumeration value="Underwriter"/>
+ <xsd:enumeration value="UnexpectedHandlingParty"/>
+ <xsd:enumeration value="Union"/>
+ <xsd:enumeration value="UnitedStatesCustomsBroker"/>
+ <xsd:enumeration value="UnitedStatesOverseasSecurityAdministrationOffice"/>
+ <xsd:enumeration value="UnitProperty"/>
+ <xsd:enumeration value="University-CollegeOrSchool"/>
+ <xsd:enumeration value="UnloadingParty"/>
+ <xsd:enumeration value="UnserviceableMaterialConsignee"/>
+ <xsd:enumeration value="UpstreamMeterLocation"/>
+ <xsd:enumeration value="UpstreamParty"/>
+ <xsd:enumeration value="USTrustee"/>
+ <xsd:enumeration value="UtilizationManagementOrganization"/>
+ <xsd:enumeration value="VacationHome"/>
+ <xsd:enumeration value="ValidatingParty"/>
+ <xsd:enumeration value="ValueAddedNetworkProvider"/>
+ <xsd:enumeration value="Vehicle"/>
+ <xsd:enumeration value="VehicleCustodian"/>
+ <xsd:enumeration value="VehicleSalvageAssignment"/>
+ <xsd:enumeration value="Vendor"/>
+ <xsd:enumeration value="VesselMaster"/>
+ <xsd:enumeration value="VesselName"/>
+ <xsd:enumeration value="Veteran-OwnedBusiness"/>
+ <xsd:enumeration value="VeteransAdministrationFacility"/>
+ <xsd:enumeration value="VeteransAdministrationLoanAuthorizedSupplier"/>
+ <xsd:enumeration value="VeteransAdministrationLoanGuarantyAuthority"/>
+ <xsd:enumeration value="Veterinarian"/>
+ <xsd:enumeration value="VeterinaryHospital"/>
+ <xsd:enumeration value="Victim"/>
+ <xsd:enumeration value="VideoDepartment"/>
+ <xsd:enumeration value="VolunteerServicesDepartment"/>
+ <xsd:enumeration value="Voter"/>
+ <xsd:enumeration value="WageEarner"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="WarehouseDepositor"/>
+ <xsd:enumeration value="WarehouseKeeper"/>
+ <xsd:enumeration value="Warranter"/>
+ <xsd:enumeration value="WaterAmbulanceServices"/>
+ <xsd:enumeration value="WaterSystem"/>
+ <xsd:enumeration value="WeightingParty"/>
+ <xsd:enumeration value="WellCasingDepthAuthority"/>
+ <xsd:enumeration value="WellPadConstructionContractor"/>
+ <xsd:enumeration value="Wholesaler"/>
+ <xsd:enumeration value="Wholly-OwnedSubsidiary"/>
+ <xsd:enumeration value="Winner"/>
+ <xsd:enumeration value="WithdrawalPoint"/>
+ <xsd:enumeration value="Witness"/>
+ <xsd:enumeration value="WitnessForDefendant"/>
+ <xsd:enumeration value="WitnessForPlaintiff"/>
+ <xsd:enumeration value="WitnessForProsecution"/>
+ <xsd:enumeration value="Woman-OwnedBusiness"/>
+ <xsd:enumeration value="Woman-OwnedBusinessLarge"/>
+ <xsd:enumeration value="Woman-OwnedBusinessSmall"/>
+ <xsd:enumeration value="WomensHealthCenterOrServices"/>
+ <xsd:enumeration value="WorksiteHealthPromotionFacility"/>
+ <xsd:enumeration value="WorksManager"/>
+ <xsd:enumeration value="WorkTeam"/>
+ <xsd:enumeration value="WritingAgent"/>
+ <xsd:enumeration value="X-RayRadiationTherapyUnit"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderConfirmationAction">
+ <xsd:sequence>
+ <xsd:element name="OrderConfirmationActionCoded" type="OrderConfirmationActionCode"/>
+ <xsd:element minOccurs="0" name="OrderConfirmationActionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationAction" type="OrderConfirmationAction"/>
+ <xsd:simpleType name="OrderConfirmationActionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Create"/>
+ <xsd:enumeration value="Update"/>
+ <xsd:enumeration value="Delete"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="AlphaNum40">
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="40"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfStructuredNote">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="StructuredNote"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfStructuredNote" type="ListOfStructuredNote"/>
+ <xsd:complexType name="StructuredNote">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="GeneralNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="NoteID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Agency"/>
+ <xsd:element minOccurs="0" name="NoteURL" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="TextTypeCoded" type="TextTypeCode"/>
+ <xsd:element minOccurs="0" name="TextTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StructuredNote" type="StructuredNote"/>
+ <xsd:simpleType name="TextTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Deadlines"/>
+ <xsd:enumeration value="Warranties"/>
+ <xsd:enumeration value="PenaltyForBreachOfContract"/>
+ <xsd:enumeration value="Guarantees"/>
+ <xsd:enumeration value="ContractRiders"/>
+ <xsd:enumeration value="Asset"/>
+ <xsd:enumeration value="OtherContractualStipulations"/>
+ <xsd:enumeration value="InfoRecordPOText"/>
+ <xsd:enumeration value="MaterialPOText"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfNameValueSet">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="NameValueSet"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfNameValueSet" type="ListOfNameValueSet"/>
+ <xsd:complexType name="NameValueSet">
+ <xsd:sequence>
+ <xsd:element name="SetName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SetID" type="xsd:string"/>
+ <xsd:element ref="ListOfNameValuePair"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="NameValueSet" type="NameValueSet"/>
+ <xsd:complexType name="ListOfNameValuePair">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="NameValuePair"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfNameValuePair" type="ListOfNameValuePair"/>
+ <xsd:complexType name="NameValuePair">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string"/>
+ <xsd:element name="Value" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Datatype" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="NameValuePair" type="NameValuePair"/>
+ <xsd:complexType name="ListOfAttachment">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Attachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfAttachment" type="ListOfAttachment"/>
+ <xsd:complexType name="Attachment">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="AttachmentActionCoded" type="AttachmentActionCode"/>
+ <xsd:element minOccurs="0" name="AttachmentActionCodedOther" type="xsd:string"/>
+ <xsd:element name="AttachmentPurpose" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FileName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AttachmentTitle" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AttachmentDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Language"/>
+ <xsd:element minOccurs="0" name="MIMEType" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReplacementFile" type="xcblBoolean"/>
+ <xsd:element name="AttachmentLocation" type="xsd:anyURI"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Attachment" type="Attachment"/>
+ <xsd:simpleType name="AttachmentActionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Add"/>
+ <xsd:enumeration value="Update"/>
+ <xsd:enumeration value="Delete"/>
+ <xsd:enumeration value="NoChange"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="OrderConfirmationDetail">
+ <xsd:sequence>
+ <xsd:element ref="ListOfOrderConfirmationItemDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationDetail" type="OrderConfirmationDetail"/>
+ <xsd:complexType name="ListOfOrderConfirmationItemDetail">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="OrderConfirmationItemDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfOrderConfirmationItemDetail" type="ListOfOrderConfirmationItemDetail"/>
+ <xsd:complexType name="OrderConfirmationItemDetail">
+ <xsd:sequence>
+ <xsd:element name="OrderConfirmationItemNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="OrderConfirmationAction"/>
+ <xsd:element minOccurs="0" name="OrderConfirmationDetailShortDescription" type="AlphaNum40"/>
+ <xsd:element ref="OrderConfirmationDetailReferences"/>
+ <xsd:element minOccurs="0" name="DeliveryComplete" type="xcblBoolean"/>
+ <xsd:element ref="ItemDetail"/>
+ <xsd:element minOccurs="0" ref="ListOfAccountAssignment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationItemDetail" type="OrderConfirmationItemDetail"/>
+ <xsd:complexType name="OrderConfirmationDetailReferences">
+ <xsd:sequence>
+ <xsd:element ref="PurchaseOrderReference"/>
+ <xsd:element minOccurs="0" ref="Category"/>
+ <xsd:element minOccurs="0" ref="CatalogReference"/>
+ <xsd:element minOccurs="0" ref="ContractAndSystemReference"/>
+ <xsd:element minOccurs="0" ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OrderConfirmationDetailReferences" type="OrderConfirmationDetailReferences"/>
+ <xsd:complexType name="PurchaseOrderReference">
+ <xsd:sequence>
+ <xsd:element name="PurchaseOrderNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="PurchaseOrderDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="PurchaseOrderLineItemNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PartialOrderCoded" type="ASNPartialOrderCode"/>
+ <xsd:element minOccurs="0" name="PartialOrderCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PurchaseOrderReference" type="PurchaseOrderReference"/>
+ <xsd:complexType name="Reference">
+ <xsd:sequence>
+ <xsd:element name="RefNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RefDate" type="xcblDatetime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Reference" type="Reference"/>
+ <xsd:simpleType name="ASNPartialOrderCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CompleteOrder"/>
+ <xsd:enumeration value="PartialOrder"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Category">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="CategoryID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="StandardCategoryID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Category" type="Category"/>
+ <xsd:complexType name="StandardCategoryID">
+ <xsd:sequence>
+ <xsd:element name="StandardCategoryType" type="xsd:string"/>
+ <xsd:element name="ClassificationID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TechnicalID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StandardCategoryID" type="StandardCategoryID"/>
+ <xsd:complexType name="CatalogReference">
+ <xsd:sequence>
+ <xsd:element name="CatalogURL" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="CatalogID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CatalogItemID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="CatalogReference" type="CatalogReference"/>
+ <xsd:complexType name="ContractID">
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractID" type="ContractID"/>
+ <xsd:complexType name="ContractAndSystemReference">
+ <xsd:sequence>
+ <xsd:element ref="ContractID"/>
+ <xsd:element name="ContractItemID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SystemID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractAndSystemReference" type="ContractAndSystemReference"/>
+ <xsd:complexType name="ListOfReferenceCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfReferenceCoded" type="ListOfReferenceCoded"/>
+ <xsd:complexType name="ReferenceCoded">
+ <xsd:sequence>
+ <xsd:element name="ReferenceTypeCoded" type="ReferenceTypeCode"/>
+ <xsd:element minOccurs="0" name="ReferenceTypeCodedOther" type="xsd:string"/>
+ <xsd:element name="PrimaryReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SupportingReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SupportingSubReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ReferenceDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ReferenceCoded" type="ReferenceCoded"/>
+ <xsd:simpleType name="ReferenceTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AbbreviatedNewDrugApplicationNumber"/>
+ <xsd:enumeration value="AcceptableSourceDUNSNumber"/>
+ <xsd:enumeration value="AcceptableSourcePurchaserID"/>
+ <xsd:enumeration value="AcceptableSourceSupplierID"/>
+ <xsd:enumeration value="AccessCode"/>
+ <xsd:enumeration value="AccessorialRailDiversionReferenceNumber"/>
+ <xsd:enumeration value="AccessorialStatusCode"/>
+ <xsd:enumeration value="AccidentReferenceNumber"/>
+ <xsd:enumeration value="AccountCategory"/>
+ <xsd:enumeration value="AccountingCode"/>
+ <xsd:enumeration value="AccountingEquipmentLocationNumber"/>
+ <xsd:enumeration value="AccountingFileReference"/>
+ <xsd:enumeration value="AccountingPeriodReference"/>
+ <xsd:enumeration value="AccountManagersCode"/>
+ <xsd:enumeration value="AccountNumber"/>
+ <xsd:enumeration value="AccountPartysBankReference"/>
+ <xsd:enumeration value="AccountPartysReference"/>
+ <xsd:enumeration value="AccountPayableNumber"/>
+ <xsd:enumeration value="AccountServicingBanksReferenceNumber"/>
+ <xsd:enumeration value="AccountsReceivableCustomerAccount"/>
+ <xsd:enumeration value="AccountsReceivableNumber"/>
+ <xsd:enumeration value="AccountsReceivableOpenItem"/>
+ <xsd:enumeration value="AccountsReceivableStatementNumber"/>
+ <xsd:enumeration value="AccountSuffixCode"/>
+ <xsd:enumeration value="AcknowledgementOfOrderNumber"/>
+ <xsd:enumeration value="ActionAuthorizationNumber"/>
+ <xsd:enumeration value="AdditionalReferenceNumber"/>
+ <xsd:enumeration value="AddOnSystemNumber"/>
+ <xsd:enumeration value="AddresseeReference"/>
+ <xsd:enumeration value="AdjustedRepricedClaimReferenceNumber"/>
+ <xsd:enumeration value="AdjustedRepricedLineItemReferenceNumber"/>
+ <xsd:enumeration value="AdjustmentControlNumber"/>
+ <xsd:enumeration value="AdjustmentMemoChargeBack"/>
+ <xsd:enumeration value="AdministratorsReferenceNumber"/>
+ <xsd:enumeration value="AdversaryCase"/>
+ <xsd:enumeration value="AdvertiserNumber"/>
+ <xsd:enumeration value="AdviceOfCollectionNumber"/>
+ <xsd:enumeration value="AdviseThroughBanksReference"/>
+ <xsd:enumeration value="AdvisingBanksReference"/>
+ <xsd:enumeration value="AeronauticalEquipmentReferenceNumber"/>
+ <xsd:enumeration value="AFE"/>
+ <xsd:enumeration value="AffectedSubsystemCode"/>
+ <xsd:enumeration value="AffiliationNumber"/>
+ <xsd:enumeration value="AgencyAssignedEmployeeID"/>
+ <xsd:enumeration value="AgencyAssignedNumber"/>
+ <xsd:enumeration value="AgencyCaseNumber"/>
+ <xsd:enumeration value="AgencyClaimNumber"/>
+ <xsd:enumeration value="AgencyClauseNumber"/>
+ <xsd:enumeration value="AIDAR"/>
+ <xsd:enumeration value="AgencyHierarchicalLevel"/>
+ <xsd:enumeration value="AgencyLocationCode"/>
+ <xsd:enumeration value="AgencysStudentNumber"/>
+ <xsd:enumeration value="AgentClaimNumber"/>
+ <xsd:enumeration value="AgentContractNumber"/>
+ <xsd:enumeration value="AgentNumber"/>
+ <xsd:enumeration value="AgentsBankReference"/>
+ <xsd:enumeration value="AgentsReference"/>
+ <xsd:enumeration value="AgentsShipmentNumber"/>
+ <xsd:enumeration value="AGERD"/>
+ <xsd:enumeration value="AgreementNumber"/>
+ <xsd:enumeration value="AgreementToPayNumber"/>
+ <xsd:enumeration value="AirCargoTransferManifest"/>
+ <xsd:enumeration value="AirDimensionCode"/>
+ <xsd:enumeration value="AirHandlingCode"/>
+ <xsd:enumeration value="AirlinesFlightIdentificationNumber"/>
+ <xsd:enumeration value="AirlineTicketNumber"/>
+ <xsd:enumeration value="AirWaybillNumber"/>
+ <xsd:enumeration value="AllotmentIdentification"/>
+ <xsd:enumeration value="AllowanceRecipientIdentification"/>
+ <xsd:enumeration value="AlterationNumber"/>
+ <xsd:enumeration value="AlternateClauseNumber"/>
+ <xsd:enumeration value="AmbulatoryPatientGroupNumber"/>
+ <xsd:enumeration value="AmendedUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="Amendment"/>
+ <xsd:enumeration value="AmendmentFiling"/>
+ <xsd:enumeration value="AmericanBankersAssociationTransitOrRoutingNumber"/>
+ <xsd:enumeration value="AmericanGasAssociationEquationNumber"/>
+ <xsd:enumeration value="AmericanOsteopathicAssociationCertificationNumber"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteDeductionCode"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteWell"/>
+ <xsd:enumeration value="AnalysisNumberOrTestNumber"/>
+ <xsd:enumeration value="AnesthesiaLicenseNumber"/>
+ <xsd:enumeration value="AnimalSpecies"/>
+ <xsd:enumeration value="AnimalStrain"/>
+ <xsd:enumeration value="AntiDumpingCaseNumber"/>
+ <xsd:enumeration value="APE"/>
+ <xsd:enumeration value="ApplicableCoefficientIdentificationNumber"/>
+ <xsd:enumeration value="ApplicableInstructionsOrStandards"/>
+ <xsd:enumeration value="ApplicantsBankReference"/>
+ <xsd:enumeration value="ApplicantsReference"/>
+ <xsd:enumeration value="ApplicationNumber"/>
+ <xsd:enumeration value="ApplicationReferenceNumber"/>
+ <xsd:enumeration value="ApplicationTransactionReferenceNumber"/>
+ <xsd:enumeration value="AppointmentNumber"/>
+ <xsd:enumeration value="AppraiserLicense"/>
+ <xsd:enumeration value="AppropriationNumber"/>
+ <xsd:enumeration value="ApprovalCode"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="ArrivalCode"/>
+ <xsd:enumeration value="ArticleNumber"/>
+ <xsd:enumeration value="AssemblyLineFeedLocation"/>
+ <xsd:enumeration value="AssemblyNumber"/>
+ <xsd:enumeration value="AssessmentNumber"/>
+ <xsd:enumeration value="AssignedByTransactionSetSender"/>
+ <xsd:enumeration value="AssignedContractNumber"/>
+ <xsd:enumeration value="AssignedSequenceNumber"/>
+ <xsd:enumeration value="AssignmentNumber"/>
+ <xsd:enumeration value="AssignmentRecordingNumber"/>
+ <xsd:enumeration value="AssociatedCaseControlNumber"/>
+ <xsd:enumeration value="AssociatedInvoices"/>
+ <xsd:enumeration value="AssociatedNumberForJoinedUnitNotResubdivided"/>
+ <xsd:enumeration value="AssociatedNumberForLimitedCommonElementParking"/>
+ <xsd:enumeration value="AssociatedNumberForUnitParking"/>
+ <xsd:enumeration value="AssociatedPolicyNumber"/>
+ <xsd:enumeration value="AssociatedProductNumber"/>
+ <xsd:enumeration value="AssociatedPropertyNumber"/>
+ <xsd:enumeration value="AssociatedPurchaseOrders"/>
+ <xsd:enumeration value="AssociationOfAmericanRailroadsRailwayAccountingRules"/>
+ <xsd:enumeration value="AssumingCompany"/>
+ <xsd:enumeration value="AtaCarnetNumber"/>
+ <xsd:enumeration value="AtomicSafetyandLicensingBoardPanelNumber"/>
+ <xsd:enumeration value="AttachedTo"/>
+ <xsd:enumeration value="AttachmentCode"/>
+ <xsd:enumeration value="Attorney"/>
+ <xsd:enumeration value="AuthorisationForRepairReference"/>
+ <xsd:enumeration value="AuthorityIssuedEquipmentIdentification"/>
+ <xsd:enumeration value="AuthorizationNumber"/>
+ <xsd:enumeration value="AuthorizationNumberForExceptionToDangerousGoods"/>
+ <xsd:enumeration value="AuthorizationToMeetCompetitionNumber"/>
+ <xsd:enumeration value="AutoLossItemNumber"/>
+ <xsd:enumeration value="ACHReturnOrNotificationOfChangeCode"/>
+ <xsd:enumeration value="ACHEntryDescription"/>
+ <xsd:enumeration value="ACHStandardEntryClass"/>
+ <xsd:enumeration value="ACHTraceNumber"/>
+ <xsd:enumeration value="AutomatedUnderwritingReferenceNumber"/>
+ <xsd:enumeration value="AxleRatio"/>
+ <xsd:enumeration value="BackoutProcedureCode"/>
+ <xsd:enumeration value="BadgeNumber"/>
+ <xsd:enumeration value="BalanceDueReferenceNumber"/>
+ <xsd:enumeration value="BankAssignedBankersReferenceNumber"/>
+ <xsd:enumeration value="BankAssignedSecurityIdentifier"/>
+ <xsd:enumeration value="BankersAcceptance"/>
+ <xsd:enumeration value="BankReference"/>
+ <xsd:enumeration value="BankruptcyProcedureNumber"/>
+ <xsd:enumeration value="BanksCommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="BanksIndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="BankTelegraphicNumber"/>
+ <xsd:enumeration value="BankToBankInformation"/>
+ <xsd:enumeration value="BarCodedLabelSerialNumber"/>
+ <xsd:enumeration value="BarCodedSerialNumber"/>
+ <xsd:enumeration value="BargePermitNumber"/>
+ <xsd:enumeration value="BasicContractLineItemNumber"/>
+ <xsd:enumeration value="BatchNumberOrLotNumber"/>
+ <xsd:enumeration value="BatchSequenceNumber"/>
+ <xsd:enumeration value="BeamAssemblyCode"/>
+ <xsd:enumeration value="BeginMileMarker"/>
+ <xsd:enumeration value="BeginningJobSequenceNumber"/>
+ <xsd:enumeration value="BeginningKanbanSerialNumber"/>
+ <xsd:enumeration value="BeginningMeterReadingActual"/>
+ <xsd:enumeration value="BeginningMeterReadingEstimated"/>
+ <xsd:enumeration value="BeginningSerialNumber"/>
+ <xsd:enumeration value="BeneficiarysBankReference"/>
+ <xsd:enumeration value="BeneficiarysReference"/>
+ <xsd:enumeration value="BidNumber"/>
+ <xsd:enumeration value="BilateralCarServiceAgreements"/>
+ <xsd:enumeration value="BillAndHoldInvoiceNumber"/>
+ <xsd:enumeration value="BillingAccount"/>
+ <xsd:enumeration value="BillingCenterIdentification"/>
+ <xsd:enumeration value="BillingType"/>
+ <xsd:enumeration value="BillOfLadingNumber"/>
+ <xsd:enumeration value="BillofMaterialRevisionNumber"/>
+ <xsd:enumeration value="BillOfQuantitiesNumber"/>
+ <xsd:enumeration value="BinaryObjectIdentifier"/>
+ <xsd:enumeration value="BinLocationNumber"/>
+ <xsd:enumeration value="BlanketOrderNumber"/>
+ <xsd:enumeration value="BlendedWithBatchNumber"/>
+ <xsd:enumeration value="BlendedWithNumber"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="BlueCrossProviderNumber"/>
+ <xsd:enumeration value="BlueShieldProviderNumber"/>
+ <xsd:enumeration value="BondedCarrierInternalRevenueServiceIdentificationNumber"/>
+ <xsd:enumeration value="BookingReferenceNumber"/>
+ <xsd:enumeration value="BookNumber"/>
+ <xsd:enumeration value="BordereauNumber"/>
+ <xsd:enumeration value="BranchIdentifier"/>
+ <xsd:enumeration value="BrokerIdentification"/>
+ <xsd:enumeration value="BrokerOrSalesOfficeNumber"/>
+ <xsd:enumeration value="BrokerReference1"/>
+ <xsd:enumeration value="BrokerReference2"/>
+ <xsd:enumeration value="BrokersOrderNumber"/>
+ <xsd:enumeration value="BrokerReferenceNumber"/>
+ <xsd:enumeration value="BudgetChapter"/>
+ <xsd:enumeration value="BureauofLaborandStatisticsScheduleIdentifier"/>
+ <xsd:enumeration value="BureauSigningOR"/>
+ <xsd:enumeration value="BureauSigningSR"/>
+ <xsd:enumeration value="BusinessActivity"/>
+ <xsd:enumeration value="BusinessIdentificationNumber"/>
+ <xsd:enumeration value="BusinessTaxNumber"/>
+ <xsd:enumeration value="BuyerIdentification"/>
+ <xsd:enumeration value="BuyersApprovalMark"/>
+ <xsd:enumeration value="BuyersCatalogueNumber"/>
+ <xsd:enumeration value="BuyersContractNumber"/>
+ <xsd:enumeration value="BuyersCreditMemo"/>
+ <xsd:enumeration value="BuyersDebitMemo"/>
+ <xsd:enumeration value="BuyersDebtorNumber"/>
+ <xsd:enumeration value="BuyersItemNumber"/>
+ <xsd:enumeration value="BuyersOrderNumber"/>
+ <xsd:enumeration value="BuyersShipmentMarkNumber"/>
+ <xsd:enumeration value="CadFileLayerConvention"/>
+ <xsd:enumeration value="Calendar"/>
+ <xsd:enumeration value="CalendarNumber"/>
+ <xsd:enumeration value="CallOffOrderNumber"/>
+ <xsd:enumeration value="CallSign"/>
+ <xsd:enumeration value="CanadianExciseEntryNumber"/>
+ <xsd:enumeration value="CanadianFinancialInstitutionBranchAndInstitutionNumber"/>
+ <xsd:enumeration value="CanadianGoodsAndServicesorQuebecSalesTaxReferenceNumber"/>
+ <xsd:enumeration value="CanadianProvinceOperatingAuthorityNumber"/>
+ <xsd:enumeration value="CanadianSocialInsuranceNumber"/>
+ <xsd:enumeration value="CanadianWheatBoardPermitNumber"/>
+ <xsd:enumeration value="CanceledRevisionNumber"/>
+ <xsd:enumeration value="CardAccountReportingIdentifier"/>
+ <xsd:enumeration value="CardAccountReportingLevel"/>
+ <xsd:enumeration value="CardAccountStatusCode"/>
+ <xsd:enumeration value="CardAccountTypeCode"/>
+ <xsd:enumeration value="CardBillingTypeCode"/>
+ <xsd:enumeration value="CardIssuerTransactionCode"/>
+ <xsd:enumeration value="CargoAcceptanceOrderReferenceNumber"/>
+ <xsd:enumeration value="CargoControlNumber"/>
+ <xsd:enumeration value="CargoManifestNumber"/>
+ <xsd:enumeration value="CarnetNumber"/>
+ <xsd:enumeration value="CarrierAssignedCode"/>
+ <xsd:enumeration value="CarrierAssignedConsigneeNumber"/>
+ <xsd:enumeration value="CarrierAssignedPackageIdentificationNumber"/>
+ <xsd:enumeration value="CarrierAssignedReferenceNumber"/>
+ <xsd:enumeration value="CarrierAssignedShipperNumber"/>
+ <xsd:enumeration value="CarriersAgentReferenceNumber"/>
+ <xsd:enumeration value="CarriersCustomsBondNumber"/>
+ <xsd:enumeration value="CarriersReferenceNumber"/>
+ <xsd:enumeration value="CaseNumber"/>
+ <xsd:enumeration value="CaseOfNeedPartysReference"/>
+ <xsd:enumeration value="CasualtyReportNumber"/>
+ <xsd:enumeration value="CasualtyReportSerialNumber"/>
+ <xsd:enumeration value="Catalog"/>
+ <xsd:enumeration value="CatalogueSequenceNumber"/>
+ <xsd:enumeration value="CatastropheNumber"/>
+ <xsd:enumeration value="CategoryOfWorkReference"/>
+ <xsd:enumeration value="CedentsClaimNumber"/>
+ <xsd:enumeration value="CedingCompany"/>
+ <xsd:enumeration value="CeilingFormulaReferenceNumber"/>
+ <xsd:enumeration value="CensusAutomatedFilesID"/>
+ <xsd:enumeration value="CensusBlockGroup"/>
+ <xsd:enumeration value="CensusStateCode"/>
+ <xsd:enumeration value="CensusTract"/>
+ <xsd:enumeration value="CensusTractSuffix"/>
+ <xsd:enumeration value="CentralSecretariatLogNumber"/>
+ <xsd:enumeration value="CentralSecretariatLogNumberChildDataMaintenance"/>
+ <xsd:enumeration value="CentralSecretariatLogNumberParentDataMaintenance"/>
+ <xsd:enumeration value="CertificateNumber"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="CertificateofIncorporationNumber"/>
+ <xsd:enumeration value="CertificateofTransportation"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="CertifiedMailNumber"/>
+ <xsd:enumeration value="CRNA"/>
+ <xsd:enumeration value="ChamberOfCommerceNumber"/>
+ <xsd:enumeration value="ChamberOfCommerceRegistrationNumber"/>
+ <xsd:enumeration value="CHAMPUSIdentificationNumber"/>
+ <xsd:enumeration value="ChangeDocumentNumber"/>
+ <xsd:enumeration value="ChangeNumber"/>
+ <xsd:enumeration value="ChangeOrderAuthority"/>
+ <xsd:enumeration value="ChangeVerificationProcedureCode"/>
+ <xsd:enumeration value="ChargeCardAccountNumber"/>
+ <xsd:enumeration value="ChargeCardNumber"/>
+ <xsd:enumeration value="ChargeNoteReferenceNumber"/>
+ <xsd:enumeration value="ChargeNumber"/>
+ <xsd:enumeration value="CharterNumber"/>
+ <xsd:enumeration value="CheckingNumber"/>
+ <xsd:enumeration value="CheckListNumber"/>
+ <xsd:enumeration value="CheckNumber"/>
+ <xsd:enumeration value="ChemicalAbstractServiceRegistryNumber"/>
+ <xsd:enumeration value="ChequeNumber"/>
+ <xsd:enumeration value="CircuitNumber"/>
+ <xsd:enumeration value="Circular"/>
+ <xsd:enumeration value="CircularPublicationNumber"/>
+ <xsd:enumeration value="Citation"/>
+ <xsd:enumeration value="CitationOfOpinion"/>
+ <xsd:enumeration value="CitationOfStatute"/>
+ <xsd:enumeration value="CitizenshipDocumentNumber"/>
+ <xsd:enumeration value="CivilActionNumber"/>
+ <xsd:enumeration value="CivilLiabilitiesofOilCertificate"/>
+ <xsd:enumeration value="ClaimAdministratorClaimNumber"/>
+ <xsd:enumeration value="ClaimantNumber"/>
+ <xsd:enumeration value="ClaimantsClaimNumber"/>
+ <xsd:enumeration value="ClaimNumber"/>
+ <xsd:enumeration value="ClaimOfficeNumber"/>
+ <xsd:enumeration value="ClassCode"/>
+ <xsd:enumeration value="ClassOfContractCode"/>
+ <xsd:enumeration value="ClauseNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentsSystemSequenceNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemParticipantNumber"/>
+ <xsd:enumeration value="ClearingHouseInterbankPaymentSystemUserIdentification"/>
+ <xsd:enumeration value="ClearingReference"/>
+ <xsd:enumeration value="ClearTextClause"/>
+ <xsd:enumeration value="ClientCompanyCode"/>
+ <xsd:enumeration value="ClientNumber"/>
+ <xsd:enumeration value="ClientReportingCategory"/>
+ <xsd:enumeration value="ClinicalLaboratoryImprovementAmendmentNumber"/>
+ <xsd:enumeration value="ClinicNumber"/>
+ <xsd:enumeration value="CoalAuthorityNumber"/>
+ <xsd:enumeration value="CodeOfFederalRegulations"/>
+ <xsd:enumeration value="CoilNumber"/>
+ <xsd:enumeration value="ColdRollNumber"/>
+ <xsd:enumeration value="CollectingBanksReference"/>
+ <xsd:enumeration value="CollectorIdentification"/>
+ <xsd:enumeration value="CollocationIndicator"/>
+ <xsd:enumeration value="CombinedShipment"/>
+ <xsd:enumeration value="CommercialOrPrivatePassengerVehicleQualifier"/>
+ <xsd:enumeration value="CommercialAccountSummaryReferenceNumber"/>
+ <xsd:enumeration value="CommercialandGovernmentEntityCode"/>
+ <xsd:enumeration value="CommercialDriversLicense"/>
+ <xsd:enumeration value="CommercialInvoiceNumber"/>
+ <xsd:enumeration value="CommercialRegistrationNumber"/>
+ <xsd:enumeration value="CommercialVehicleSafetyAssuranceNumber"/>
+ <xsd:enumeration value="CommitmentNumber"/>
+ <xsd:enumeration value="CommitteeOnUniformSecurityIdentificationProceduresNumber"/>
+ <xsd:enumeration value="CommodityNumber"/>
+ <xsd:enumeration value="CommonAccessReferenceNumber"/>
+ <xsd:enumeration value="CommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="CompanyAndPlaceRegistrationNumber"/>
+ <xsd:enumeration value="CompanyAndSyndicateReference1"/>
+ <xsd:enumeration value="CompanyAndSyndicateReference2"/>
+ <xsd:enumeration value="CompanyIssuedEquipmentId"/>
+ <xsd:enumeration value="CRO"/>
+ <xsd:enumeration value="ComparableProperty"/>
+ <xsd:enumeration value="ComparablePropertyPendingSaleReferenceNumber"/>
+ <xsd:enumeration value="ComparablePropertySaleReferenceNumber"/>
+ <xsd:enumeration value="ComparablePropertyVerificationSource"/>
+ <xsd:enumeration value="CompetentAuthority"/>
+ <xsd:enumeration value="Complaint"/>
+ <xsd:enumeration value="ComplaintCode"/>
+ <xsd:enumeration value="CompletedUnitsPaymentRequestReference"/>
+ <xsd:enumeration value="ComplianceCodeNumber"/>
+ <xsd:enumeration value="Component"/>
+ <xsd:enumeration value="ConditionOfPurchaseDocumentNumber"/>
+ <xsd:enumeration value="ConditionOfSaleDocumentNumber"/>
+ <xsd:enumeration value="CondominiumIdentificationNumber"/>
+ <xsd:enumeration value="CongressionalDistrict"/>
+ <xsd:enumeration value="ConnectingCarrier"/>
+ <xsd:enumeration value="ConsigneeReferenceNumber"/>
+ <xsd:enumeration value="ConsigneesFurtherOrder"/>
+ <xsd:enumeration value="ConsigneesInvoiceNumber"/>
+ <xsd:enumeration value="ConsigneesOrderNumber"/>
+ <xsd:enumeration value="ConsigneesReleaseNumber"/>
+ <xsd:enumeration value="ConsigneesShipmentReferenceNumber"/>
+ <xsd:enumeration value="ConsignmentClassificationID"/>
+ <xsd:enumeration value="ConsignorsFurtherOrder"/>
+ <xsd:enumeration value="ConsignorsReferenceNumber"/>
+ <xsd:enumeration value="ConsolidatedInvoiceNumber"/>
+ <xsd:enumeration value="ConsolidationShipmentNumber"/>
+ <xsd:enumeration value="ConsolidatorsReceiptNumber"/>
+ <xsd:enumeration value="ConstraintNotation"/>
+ <xsd:enumeration value="ConsumerIdentifier"/>
+ <xsd:enumeration value="ConsumptionDataRequestNumber"/>
+ <xsd:enumeration value="ContainerOrEquipmentReceiptNumber"/>
+ <xsd:enumeration value="ContainerOrPackagingSpecificationNumber"/>
+ <xsd:enumeration value="ContainerDispositionOrderReferenceNumber"/>
+ <xsd:enumeration value="ContainerOperatorsReferenceNumber"/>
+ <xsd:enumeration value="ContainerorEquipmentReceiptNumber"/>
+ <xsd:enumeration value="ContainerPrefix"/>
+ <xsd:enumeration value="ContainerSequenceNumber"/>
+ <xsd:enumeration value="ContainerWorkOrderReferenceNumber"/>
+ <xsd:enumeration value="ContinuationFiling"/>
+ <xsd:enumeration value="ContinuationUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="ContinuousMoveNumber"/>
+ <xsd:enumeration value="ContinuousTransferNumber"/>
+ <xsd:enumeration value="ContractAddendumNumber"/>
+ <xsd:enumeration value="ContractAuditorIDNumber"/>
+ <xsd:enumeration value="ContractBreakdownReference"/>
+ <xsd:enumeration value="ContractCoopNumber"/>
+ <xsd:enumeration value="ContractHolderClaimNumber"/>
+ <xsd:enumeration value="ContractLineItemNumber"/>
+ <xsd:enumeration value="ContractNumber"/>
+ <xsd:enumeration value="ContractOptionNumber"/>
+ <xsd:enumeration value="ContractorDataRequirementsList"/>
+ <xsd:enumeration value="ContractorEstablishmentCode"/>
+ <xsd:enumeration value="ContractorRequestReference"/>
+ <xsd:enumeration value="ContractPartyReferenceNumber"/>
+ <xsd:enumeration value="ContractReference"/>
+ <xsd:enumeration value="ContractRiderNumber"/>
+ <xsd:enumeration value="ConveyanceReferenceNumber"/>
+ <xsd:enumeration value="CooperationContractNumber"/>
+ <xsd:enumeration value="CornboreCertificationNumber"/>
+ <xsd:enumeration value="CorrectedBatchNumber"/>
+ <xsd:enumeration value="CorrectedContractNumber"/>
+ <xsd:enumeration value="CorrectedSocialSecurityNumber"/>
+ <xsd:enumeration value="CorrectionNumber"/>
+ <xsd:enumeration value="CostAccount"/>
+ <xsd:enumeration value="CostAllocationReference"/>
+ <xsd:enumeration value="CostaRicanJudicialNumber"/>
+ <xsd:enumeration value="CostCentre"/>
+ <xsd:enumeration value="CostElement"/>
+ <xsd:enumeration value="CountyBusinessRegistrationNumber"/>
+ <xsd:enumeration value="CountyCode"/>
+ <xsd:enumeration value="CountyLegislativeDistrict"/>
+ <xsd:enumeration value="CouponDistributionMethod"/>
+ <xsd:enumeration value="CouponRedemptionNumber"/>
+ <xsd:enumeration value="CoverageCode"/>
+ <xsd:enumeration value="CreditCard"/>
+ <xsd:enumeration value="CreditCounselingIdentificationNumber"/>
+ <xsd:enumeration value="CreditMemoNumber"/>
+ <xsd:enumeration value="CreditNoteNumber"/>
+ <xsd:enumeration value="Creditor"/>
+ <xsd:enumeration value="CreditorDebitAdjustmentNumber"/>
+ <xsd:enumeration value="CreditorsReferenceNumber"/>
+ <xsd:enumeration value="CreditRatingAgencysReferenceNumber"/>
+ <xsd:enumeration value="CreditReferenceNumber"/>
+ <xsd:enumeration value="CreditReportNumber"/>
+ <xsd:enumeration value="CreditRepositoryCode"/>
+ <xsd:enumeration value="CriticalApplication"/>
+ <xsd:enumeration value="CriticalityDesignator"/>
+ <xsd:enumeration value="CropYear"/>
+ <xsd:enumeration value="CrossListedCourseNumber"/>
+ <xsd:enumeration value="CrossReferenceNumber"/>
+ <xsd:enumeration value="CS54KeyTrainIndicatorCode"/>
+ <xsd:enumeration value="CS54KeyTrainIndicatorGroupName"/>
+ <xsd:enumeration value="CurrentCertificateNumber"/>
+ <xsd:enumeration value="CurrentInvoiceNumber"/>
+ <xsd:enumeration value="CurrentorLatestCourseNumber"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCode"/>
+ <xsd:enumeration value="CurrentRevisionNumber"/>
+ <xsd:enumeration value="CustomerCatalogNumber"/>
+ <xsd:enumeration value="CustomerMaintenancePeriodSequenceNumber"/>
+ <xsd:enumeration value="CustomerMaterialSpecificationNumber"/>
+ <xsd:enumeration value="CustomerOrderNumber"/>
+ <xsd:enumeration value="CustomerProcessSpecificationNumber"/>
+ <xsd:enumeration value="CustomerReferenceNumber"/>
+ <xsd:enumeration value="CustomerReferenceNumberAssignedToPreviousBalanceOf"/>
+ <xsd:enumeration value="CustomersCommonTransactionReferenceNumber"/>
+ <xsd:enumeration value="CustomersIndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="CustomersPartNumber"/>
+ <xsd:enumeration value="CustomerSpecificationNumber"/>
+ <xsd:enumeration value="CustomersReleaseNumber"/>
+ <xsd:enumeration value="CustomersUnitInventoryNumber"/>
+ <xsd:enumeration value="CustomerTrackingNumberForLoanedMaterials"/>
+ <xsd:enumeration value="CustomsBarCodeNumber"/>
+ <xsd:enumeration value="CustomsBrokerReferenceNumber"/>
+ <xsd:enumeration value="CustomsDecisionRequestNumber"/>
+ <xsd:enumeration value="CustomsDeclarationNumber"/>
+ <xsd:enumeration value="CustomsDrawbackEntryNumber"/>
+ <xsd:enumeration value="CustomsGuaranteeNumber"/>
+ <xsd:enumeration value="CustomshouseBrokerLicenseNumber"/>
+ <xsd:enumeration value="CustomsItemNumber"/>
+ <xsd:enumeration value="CustomsPreferenceInquiryNumber"/>
+ <xsd:enumeration value="CustomsReleaseCode"/>
+ <xsd:enumeration value="CustomsTariffNumber"/>
+ <xsd:enumeration value="CustomsTranshipmentNumber"/>
+ <xsd:enumeration value="CustomsValuationDecisionNumber"/>
+ <xsd:enumeration value="CutNumber"/>
+ <xsd:enumeration value="DangerousGoodsSecurityNumber"/>
+ <xsd:enumeration value="DangerousGoodsTransportLicenceNumber"/>
+ <xsd:enumeration value="DataAuthenticationNumber"/>
+ <xsd:enumeration value="DataItemDescriptionReference"/>
+ <xsd:enumeration value="DataQualityRejectReason"/>
+ <xsd:enumeration value="DataReliabilityCode"/>
+ <xsd:enumeration value="DataSource"/>
+ <xsd:enumeration value="DataStructureTag"/>
+ <xsd:enumeration value="DealerIdentification"/>
+ <xsd:enumeration value="DealerNumber"/>
+ <xsd:enumeration value="DealerOrderNumber"/>
+ <xsd:enumeration value="Dealerpurchaseordernumber"/>
+ <xsd:enumeration value="DealerTypeIdentification"/>
+ <xsd:enumeration value="DebitAccountNumber"/>
+ <xsd:enumeration value="DebitNoteNumber"/>
+ <xsd:enumeration value="DebitReferenceNumber"/>
+ <xsd:enumeration value="Debtor"/>
+ <xsd:enumeration value="DebtorsAccount"/>
+ <xsd:enumeration value="DebtorsReferenceNumber"/>
+ <xsd:enumeration value="DeclarantsCustomsIdentityNumber"/>
+ <xsd:enumeration value="DeclarantsReferenceNumber"/>
+ <xsd:enumeration value="DefectCodeNumber"/>
+ <xsd:enumeration value="DefenseFederalAcquisitionRegulations"/>
+ <xsd:enumeration value="DefensePrioritiesAllocationSystemPriorityRating"/>
+ <xsd:enumeration value="DefermentApprovalNumber"/>
+ <xsd:enumeration value="DeferredPaymentReference"/>
+ <xsd:enumeration value="DeliveryNoteNumber"/>
+ <xsd:enumeration value="DeliveryNumber"/>
+ <xsd:enumeration value="DeliveryOrderNumber"/>
+ <xsd:enumeration value="DeliveryQuoteNumber"/>
+ <xsd:enumeration value="DeliveryReference"/>
+ <xsd:enumeration value="DeliveryRegion"/>
+ <xsd:enumeration value="DeliveryScheduleNumber"/>
+ <xsd:enumeration value="DeliveryTicketNumber"/>
+ <xsd:enumeration value="DeliveryTrailerManifest"/>
+ <xsd:enumeration value="DeliveryVerificationCertificate"/>
+ <xsd:enumeration value="DenialReasonIdentifier"/>
+ <xsd:enumeration value="DensityOrderNumber"/>
+ <xsd:enumeration value="DentalInsuranceAccountNumber"/>
+ <xsd:enumeration value="DentalInsurancePolicyNumber"/>
+ <xsd:enumeration value="DentistLicenseNumber"/>
+ <xsd:enumeration value="Department"/>
+ <xsd:enumeration value="DepartmentOrAgencyNumber"/>
+ <xsd:enumeration value="DepartmentNumber"/>
+ <xsd:enumeration value="DepartmentofAgricultureAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofCommerceAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentOfDefenseForm250RequirementCode"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DDTSCN"/>
+ <xsd:enumeration value="DepartmentofEducationAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofEnergyAcquisitionRegulation"/>
+ <xsd:enumeration value="HHSAR"/>
+ <xsd:enumeration value="HUDAR"/>
+ <xsd:enumeration value="DepartmentofInteriorAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofJusticeAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofLaborAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentofStateAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentoftheTreasuryAcquisitionOrProcurementRegulation"/>
+ <xsd:enumeration value="DepartmentofTransportationAcquisitionRegulation"/>
+ <xsd:enumeration value="DepartmentOfTransportationBondNumber"/>
+ <xsd:enumeration value="DepartmentofTransportationHazardousNumber"/>
+ <xsd:enumeration value="DepartmentofVeteransAffairsAcquisitionRegulations"/>
+ <xsd:enumeration value="DepartmentWhereInjuryOccurredIdentification"/>
+ <xsd:enumeration value="DeparturefromSpecificationClassCode"/>
+ <xsd:enumeration value="DeparturefromSpecificationNumber"/>
+ <xsd:enumeration value="DeparturefromSpecificationTypeCode"/>
+ <xsd:enumeration value="DependentsInformation"/>
+ <xsd:enumeration value="DepositAccountNumber"/>
+ <xsd:enumeration value="DepositNumber"/>
+ <xsd:enumeration value="DepositorNumber"/>
+ <xsd:enumeration value="DepositoryTrustCompanyIdentification"/>
+ <xsd:enumeration value="DepositSequenceNumber"/>
+ <xsd:enumeration value="DeratCertificate"/>
+ <xsd:enumeration value="DescriptionOfChangeCode"/>
+ <xsd:enumeration value="DespatchAdviceNumber"/>
+ <xsd:enumeration value="DespatchNotePostParcelsNumber"/>
+ <xsd:enumeration value="DespatchNoteNumber"/>
+ <xsd:enumeration value="DestinationofShipmentHarmonizedBasedCode"/>
+ <xsd:enumeration value="DiagnosisRelatedGroupNumber"/>
+ <xsd:enumeration value="DirectDebitReference"/>
+ <xsd:enumeration value="DirectoryNumber"/>
+ <xsd:enumeration value="DirectPaymentValuationNumber"/>
+ <xsd:enumeration value="DirectPaymentValuationRequestNumber"/>
+ <xsd:enumeration value="DisabilityInsuranceAccountNumber"/>
+ <xsd:enumeration value="DisabilityInsurancePolicyNumber"/>
+ <xsd:enumeration value="DiscounterRegistrationNumber"/>
+ <xsd:enumeration value="DispensationReference"/>
+ <xsd:enumeration value="DisposalTurnInDocumentNumber"/>
+ <xsd:enumeration value="DisputeNumber"/>
+ <xsd:enumeration value="DistributionCenterNumber"/>
+ <xsd:enumeration value="DistributionList"/>
+ <xsd:enumeration value="DistributionStatementCode"/>
+ <xsd:enumeration value="DistributorAssignedOrderNumber"/>
+ <xsd:enumeration value="DistributorAssignedTransactionNumber"/>
+ <xsd:enumeration value="DistributOrInvoiceNumber"/>
+ <xsd:enumeration value="DistributorsAccountIdentification"/>
+ <xsd:enumeration value="DistributorsAccountNumber"/>
+ <xsd:enumeration value="DistributorsRepresentativeIdentification"/>
+ <xsd:enumeration value="DistributorsSplitAgentNumber"/>
+ <xsd:enumeration value="DistrictNumber"/>
+ <xsd:enumeration value="DiversionAuthorityNumber"/>
+ <xsd:enumeration value="DivisionIdentifier"/>
+ <xsd:enumeration value="DocketNumber"/>
+ <xsd:enumeration value="DockNumber"/>
+ <xsd:enumeration value="DockReceiptNumber"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentNumber"/>
+ <xsd:enumeration value="DocumentaryCreditNumber"/>
+ <xsd:enumeration value="DocumentaryPaymentReference"/>
+ <xsd:enumeration value="DocumentationAffectedNumber"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="DocumentNumber"/>
+ <xsd:enumeration value="DocumentVolumeNumber"/>
+ <xsd:enumeration value="DomesticFlightNumber"/>
+ <xsd:enumeration value="DomesticInventoryManagementCode"/>
+ <xsd:enumeration value="DomicileBranchNumber"/>
+ <xsd:enumeration value="DominionOfCanadaCode"/>
+ <xsd:enumeration value="DownstreamShipperContractNumber"/>
+ <xsd:enumeration value="DraftNumber"/>
+ <xsd:enumeration value="DrainholeNumber"/>
+ <xsd:enumeration value="DraweesReference"/>
+ <xsd:enumeration value="DrawingListNumber"/>
+ <xsd:enumeration value="DrawingNumber"/>
+ <xsd:enumeration value="DrawingRevisionNumber"/>
+ <xsd:enumeration value="DrawingType"/>
+ <xsd:enumeration value="DriversLicense"/>
+ <xsd:enumeration value="DrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="DrugEnforcementAdministrationOrderBlankNumber"/>
+ <xsd:enumeration value="DrugFormularyNumber"/>
+ <xsd:enumeration value="DunAndBradstreetCanadas8DigitStandardIndustrial"/>
+ <xsd:enumeration value="DunAndBradstreetUS8DigitStandardIndustrial"/>
+ <xsd:enumeration value="DUNSNumberwithFourCharacterSuffix"/>
+ <xsd:enumeration value="DUNSNumberDunAndBradstreet"/>
+ <xsd:enumeration value="DuplicateBillNumber"/>
+ <xsd:enumeration value="DuplicateWaybillinRoute"/>
+ <xsd:enumeration value="DuplicateWaybillNotInRoute"/>
+ <xsd:enumeration value="DutyFreeProductsReceiptAuthorisationNumber"/>
+ <xsd:enumeration value="DutyFreeProductsSecurityNumber"/>
+ <xsd:enumeration value="DutyMemoNumber"/>
+ <xsd:enumeration value="DyeLotNumber"/>
+ <xsd:enumeration value="ECCN"/>
+ <xsd:enumeration value="EducationalInstitutionIdentificationNumber"/>
+ <xsd:enumeration value="ElectionDistrict"/>
+ <xsd:enumeration value="ElectronicDataInterchangeAgreementNumber"/>
+ <xsd:enumeration value="Electronicdevicepinnumber"/>
+ <xsd:enumeration value="ElectronicFundsTransferIDNumber"/>
+ <xsd:enumeration value="ElectronicPaymentReferenceNumber"/>
+ <xsd:enumeration value="Elevation"/>
+ <xsd:enumeration value="EmbargoNumber"/>
+ <xsd:enumeration value="EmbargoPermitNumber"/>
+ <xsd:enumeration value="EmergencyOrderNumber"/>
+ <xsd:enumeration value="EmissionDesignator"/>
+ <xsd:enumeration value="EmployeeOrNonEmployeeClassificationQualifier"/>
+ <xsd:enumeration value="EmployeeIdentificationNumber"/>
+ <xsd:enumeration value="EmployeeTaxFilingStatusCode"/>
+ <xsd:enumeration value="EmployerIdentificationNumberOfServiceBureau"/>
+ <xsd:enumeration value="EmployersIdentificationNumber"/>
+ <xsd:enumeration value="EmployersSocialSecurityNumber"/>
+ <xsd:enumeration value="EmploymentVisa"/>
+ <xsd:enumeration value="EmptyContainerBillNumber"/>
+ <xsd:enumeration value="EmptyRepositioningNumber"/>
+ <xsd:enumeration value="EndingJobSequenceNumber"/>
+ <xsd:enumeration value="EndingKanbanSerialNumber"/>
+ <xsd:enumeration value="EndingMeterReadingActual"/>
+ <xsd:enumeration value="EndingMeterReadingEstimated"/>
+ <xsd:enumeration value="EndingPackageNumber"/>
+ <xsd:enumeration value="EndingSerialNumber"/>
+ <xsd:enumeration value="EndItem"/>
+ <xsd:enumeration value="EndItemNumber"/>
+ <xsd:enumeration value="EndMileMarker"/>
+ <xsd:enumeration value="EndorsementNumber"/>
+ <xsd:enumeration value="EndUseAuthorizationNumber"/>
+ <xsd:enumeration value="EndUseNumber"/>
+ <xsd:enumeration value="EndUsersPurchaseOrderNumber"/>
+ <xsd:enumeration value="EngineeringChangeOrder"/>
+ <xsd:enumeration value="EngineeringChangeProposal"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="EngineeringSpecificationNumber"/>
+ <xsd:enumeration value="EnquiryNumber"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumber"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumberChildDmr"/>
+ <xsd:enumeration value="EntryPointAssessmentLogNumberParentDmr"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyAcquisitionRegulation"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyTestTypePurposeCode"/>
+ <xsd:enumeration value="EnvironmentalProtectionAgencyTransporterIdentificationNumber"/>
+ <xsd:enumeration value="EquipmentInitial"/>
+ <xsd:enumeration value="EquipmentNumber"/>
+ <xsd:enumeration value="EquipmentOwnerReferenceNumber"/>
+ <xsd:enumeration value="EquipmentSequenceNumber"/>
+ <xsd:enumeration value="EquipmentTransportChargeNumber"/>
+ <xsd:enumeration value="EquivalentCourseNumberatRequestingInstitution"/>
+ <xsd:enumeration value="ErrorIdentificationCode"/>
+ <xsd:enumeration value="EscrowFileNumber"/>
+ <xsd:enumeration value="EstimateNumber"/>
+ <xsd:enumeration value="EstimateOrderReferenceNumber"/>
+ <xsd:enumeration value="EstimateSequenceNumber"/>
+ <xsd:enumeration value="EtermsReference"/>
+ <xsd:enumeration value="Eur1CertificateNumber"/>
+ <xsd:enumeration value="EventReferenceNumber"/>
+ <xsd:enumeration value="ExcessTransportationNumber"/>
+ <xsd:enumeration value="ExhibitDistributionList"/>
+ <xsd:enumeration value="ExhibitIdentifier"/>
+ <xsd:enumeration value="ExpansiononEffectofChangeNumber"/>
+ <xsd:enumeration value="ExportClearanceInstructionReferenceNumber"/>
+ <xsd:enumeration value="ExportDeclaration"/>
+ <xsd:enumeration value="ExportersReferenceNumber"/>
+ <xsd:enumeration value="ExportEstablishmentNumber"/>
+ <xsd:enumeration value="ExportLicenceNumber"/>
+ <xsd:enumeration value="ExportPermitNumber"/>
+ <xsd:enumeration value="ExportReferenceNumber"/>
+ <xsd:enumeration value="ExtendedOrExhibitLineItemNumber"/>
+ <xsd:enumeration value="FacilityCertificationNumber"/>
+ <xsd:enumeration value="FacilityIDNumber"/>
+ <xsd:enumeration value="FacilityMeasurementPointNumber"/>
+ <xsd:enumeration value="FacilityNetworkIdentificationNumber"/>
+ <xsd:enumeration value="FailureAnalysisReportNumber"/>
+ <xsd:enumeration value="Failuremechanismnumber"/>
+ <xsd:enumeration value="FamilyMemberIdentification"/>
+ <xsd:enumeration value="FamilyUnitNumber"/>
+ <xsd:enumeration value="FannieMaeSellerServicerNumber"/>
+ <xsd:enumeration value="FederalAcquisitionRegulations"/>
+ <xsd:enumeration value="FederalBureauOfInvestigationIndividualIdentification"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionConditionCode"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionIdentifier"/>
+ <xsd:enumeration value="FederalCommunicationsCommissionTradeOrBrandIdentifier"/>
+ <xsd:enumeration value="FederalEnergyRegulatoryCommissionCertificateOfPublicConvenience"/>
+ <xsd:enumeration value="FHLMCD"/>
+ <xsd:enumeration value="FederalHomeLoanMortgageCorporationLoanNumber"/>
+ <xsd:enumeration value="FederalHousingAdministrationCaseNumber"/>
+ <xsd:enumeration value="CHUMS"/>
+ <xsd:enumeration value="FederalHousingAdministrationOriginatorIdentification"/>
+ <xsd:enumeration value="FederalInformationResourcesManagementRegulation"/>
+ <xsd:enumeration value="FederalMaritimeCommissionForwardersNumber"/>
+ <xsd:enumeration value="FederalMaritimeCommissionTariffNumber"/>
+ <xsd:enumeration value="FederalNationalMortgageAssociationLoanNumber"/>
+ <xsd:enumeration value="FederalRegulation"/>
+ <xsd:enumeration value="FederalSupplyClassificationCode"/>
+ <xsd:enumeration value="FederalSupplyScheduleItemNumber"/>
+ <xsd:enumeration value="FederalSupplyScheduleNumber"/>
+ <xsd:enumeration value="FederalTaxpayersIdentificationNumber"/>
+ <xsd:enumeration value="FederalWireTransfer"/>
+ <xsd:enumeration value="FEDWIREConfirmationNumber"/>
+ <xsd:enumeration value="FeeScheduleIdentifier"/>
+ <xsd:enumeration value="Field"/>
+ <xsd:enumeration value="FileConversionJournal"/>
+ <xsd:enumeration value="FileIdentificationNumber"/>
+ <xsd:enumeration value="FileIdentifier"/>
+ <xsd:enumeration value="FileLineIdentifier"/>
+ <xsd:enumeration value="FilerCodeIssuedbyBureauOfCensus"/>
+ <xsd:enumeration value="FilerCodeIssuedByCustoms"/>
+ <xsd:enumeration value="FileTransferFormNumber"/>
+ <xsd:enumeration value="FileTransferProtocolLocator"/>
+ <xsd:enumeration value="FileVersionNumber"/>
+ <xsd:enumeration value="FilmNumber"/>
+ <xsd:enumeration value="FinalSequenceNumber"/>
+ <xsd:enumeration value="FinalWorkCandidateNumber"/>
+ <xsd:enumeration value="FinancialClassificationCode"/>
+ <xsd:enumeration value="FinancialDetailCode"/>
+ <xsd:enumeration value="FinancialManagementReference"/>
+ <xsd:enumeration value="FinancialPhaseReference"/>
+ <xsd:enumeration value="FinancialSettlementPartysReferenceNumber"/>
+ <xsd:enumeration value="FinancialTransactionReferenceNumber"/>
+ <xsd:enumeration value="FinderNumber"/>
+ <xsd:enumeration value="FineLineClassification"/>
+ <xsd:enumeration value="FinishLotNumber"/>
+ <xsd:enumeration value="FirstTransferNumber"/>
+ <xsd:enumeration value="FiscalCode"/>
+ <xsd:enumeration value="FiscalNumber"/>
+ <xsd:enumeration value="FleetReferenceNumber"/>
+ <xsd:enumeration value="FlexibleSpendingAccountInsuranceAccountNumber"/>
+ <xsd:enumeration value="FlexibleSpendingAccountInsurancePolicyNumber"/>
+ <xsd:enumeration value="FloodDataIdentifier"/>
+ <xsd:enumeration value="FloodZone"/>
+ <xsd:enumeration value="FloorNumber"/>
+ <xsd:enumeration value="FloorPlanApprovalNumber"/>
+ <xsd:enumeration value="FlowReferenceNumber"/>
+ <xsd:enumeration value="FolderNumber"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationAccessionNumber"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationProductCode"/>
+ <xsd:enumeration value="FoodAndDrugAdministrationProductType"/>
+ <xsd:enumeration value="ForeclosingStatus"/>
+ <xsd:enumeration value="ForeclosureAccountNumber"/>
+ <xsd:enumeration value="ForeignExchange"/>
+ <xsd:enumeration value="ForeignExchangeContractNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesCaseNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesNoticeNumber"/>
+ <xsd:enumeration value="ForeignMilitarySalesNumber"/>
+ <xsd:enumeration value="ForeignTradeZone"/>
+ <xsd:enumeration value="ForestryPermitNumber"/>
+ <xsd:enumeration value="FormalStatementReference"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FormationIdentifier"/>
+ <xsd:enumeration value="FormNumber"/>
+ <xsd:enumeration value="ForPickupLimitedFreightTariffNumber"/>
+ <xsd:enumeration value="ForwardersOrAgentsReferenceNumber"/>
+ <xsd:enumeration value="ForwardingOrderNumber"/>
+ <xsd:enumeration value="Frame"/>
+ <xsd:enumeration value="FranchiseTaxAccountNumber"/>
+ <xsd:enumeration value="FreddieMacSellerServicerNumber"/>
+ <xsd:enumeration value="FreeZoneIdentifier"/>
+ <xsd:enumeration value="FreightBillNumber"/>
+ <xsd:enumeration value="FreightForwarderNumber"/>
+ <xsd:enumeration value="FreightForwardersReferenceNumber"/>
+ <xsd:enumeration value="FreightPayorReferenceNumber"/>
+ <xsd:enumeration value="FullTimeOrPartTimeEmployeeClassificationQualifier"/>
+ <xsd:enumeration value="FunctionalCategory"/>
+ <xsd:enumeration value="FunctionalWorkGroup"/>
+ <xsd:enumeration value="FundCodeNumber"/>
+ <xsd:enumeration value="FundIdentificationNumber"/>
+ <xsd:enumeration value="FundManagersReferenceNumber"/>
+ <xsd:enumeration value="FundsAuthorization"/>
+ <xsd:enumeration value="GasAnalysisSourceMeterNumber"/>
+ <xsd:enumeration value="GasCustodianIdentification"/>
+ <xsd:enumeration value="GaugeTicketNumber"/>
+ <xsd:enumeration value="GeneralAgencyNumber"/>
+ <xsd:enumeration value="GeneralCargoConsignmentReferenceNumber"/>
+ <xsd:enumeration value="GeneralDeclarationNumber"/>
+ <xsd:enumeration value="GeneralLedgerAccount"/>
+ <xsd:enumeration value="GeneralOrderNumber"/>
+ <xsd:enumeration value="GeneralPurposeMessageReferenceNumber"/>
+ <xsd:enumeration value="GeneralServicesAdministrationRegulations"/>
+ <xsd:enumeration value="GeographicDestinationZoneNumber"/>
+ <xsd:enumeration value="GeographicIndex"/>
+ <xsd:enumeration value="GeographicKey"/>
+ <xsd:enumeration value="GeographicNumber"/>
+ <xsd:enumeration value="GeographicScore"/>
+ <xsd:enumeration value="GinnieMaePoolPackageNumber"/>
+ <xsd:enumeration value="GoodsAndServicesTaxIdentificationNumber"/>
+ <xsd:enumeration value="GoodsandServiceTaxRegistrationNumber"/>
+ <xsd:enumeration value="GoodsDeclarationNumber"/>
+ <xsd:enumeration value="GoverningClassCode"/>
+ <xsd:enumeration value="GovernmentAccountingClassReferenceNumber"/>
+ <xsd:enumeration value="GovernmentAdvanceProgress"/>
+ <xsd:enumeration value="GovernmentAgencyReferenceNumber"/>
+ <xsd:enumeration value="GovernmentBillOfLading"/>
+ <xsd:enumeration value="GovernmentBillofLadingOfficeCode"/>
+ <xsd:enumeration value="GovernmentContractNumber"/>
+ <xsd:enumeration value="GovernmentPriorityNumber"/>
+ <xsd:enumeration value="GovernmentQualityAssuranceAndControlLevelNumber"/>
+ <xsd:enumeration value="GovernmentReferenceNumber"/>
+ <xsd:enumeration value="GovernmentRegistrationNumber"/>
+ <xsd:enumeration value="GovernmentTransportationRequest"/>
+ <xsd:enumeration value="GrainBlockNumber"/>
+ <xsd:enumeration value="GrainOrderReferenceNumber"/>
+ <xsd:enumeration value="GravitySourceMeterNumber"/>
+ <xsd:enumeration value="GreenCard"/>
+ <xsd:enumeration value="GroupAccounting"/>
+ <xsd:enumeration value="GroupNumber"/>
+ <xsd:enumeration value="GroupOrPolicyNumber"/>
+ <xsd:enumeration value="GroupWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="GrowthFactorReference"/>
+ <xsd:enumeration value="GuarantorLoanNumber"/>
+ <xsd:enumeration value="GuarantorUse"/>
+ <xsd:enumeration value="HarmonisedSystemNumber"/>
+ <xsd:enumeration value="HarmonizedCodeSystem"/>
+ <xsd:enumeration value="HasteningNumber"/>
+ <xsd:enumeration value="HazardousCertificationNumber"/>
+ <xsd:enumeration value="HazardousExemptionNumber"/>
+ <xsd:enumeration value="HazardousWasteManifestDocumentNumber"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationNationalPayerIdentificationNumber"/>
+ <xsd:enumeration value="HealthCareFinancingAdministrationNationalProviderIdentifier"/>
+ <xsd:enumeration value="HealthcareManpowerShortageAreaFacilityIdentificationNumber"/>
+ <xsd:enumeration value="HealthCertificateNumber"/>
+ <xsd:enumeration value="HIBCCLabelerIdentificationCode"/>
+ <xsd:enumeration value="HealthIndustryNumber"/>
+ <xsd:enumeration value="HealthInsuranceAccountNumber"/>
+ <xsd:enumeration value="HealthInsuranceClaimNumber"/>
+ <xsd:enumeration value="HealthInsurancePolicyNumber"/>
+ <xsd:enumeration value="HealthInsuranceRatingAccountNumber"/>
+ <xsd:enumeration value="HealthInsuranceRatingSuffixCode"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationReferenceNumber"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="HealthMaintenanceOrganizationCodeNumber"/>
+ <xsd:enumeration value="HeatCode"/>
+ <xsd:enumeration value="HighOrWideFileNumber"/>
+ <xsd:enumeration value="HighFabricationAuthorizationNumber"/>
+ <xsd:enumeration value="HighRawMaterialAuthorizationNumber"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActCensusTract"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActBlockNumberArea"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActCountyCode"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActMetropolitanStatisticalArea"/>
+ <xsd:enumeration value="HomeMortgageDisclosureActStateCode"/>
+ <xsd:enumeration value="HorizontalCoordinate"/>
+ <xsd:enumeration value="Horsepower"/>
+ <xsd:enumeration value="HotRollNumber"/>
+ <xsd:enumeration value="HouseBillOfLadingNumber"/>
+ <xsd:enumeration value="HouseWaybillNumber"/>
+ <xsd:enumeration value="IataCargoAgentCassAddressNumber"/>
+ <xsd:enumeration value="IataCargoAgentCodeNumber"/>
+ <xsd:enumeration value="ICD9CM"/>
+ <xsd:enumeration value="IdentificationCardSerialNumber"/>
+ <xsd:enumeration value="IdentityCardNumber"/>
+ <xsd:enumeration value="ImageIdentifier"/>
+ <xsd:enumeration value="ImmediateExportationNoForInBondMovement"/>
+ <xsd:enumeration value="ImmediateTransportationNoForInBondMovement"/>
+ <xsd:enumeration value="ImplementationVersionNumber"/>
+ <xsd:enumeration value="ImportClearanceInstructionReferenceNumber"/>
+ <xsd:enumeration value="ImporterReferenceNumber"/>
+ <xsd:enumeration value="ImportersReferenceNumberToLetterOfCredit"/>
+ <xsd:enumeration value="ImportLicenceNumber"/>
+ <xsd:enumeration value="ImportPermitNumber"/>
+ <xsd:enumeration value="ImputationAccount"/>
+ <xsd:enumeration value="InBondNumber"/>
+ <xsd:enumeration value="InboundToOrOutboundFromParty"/>
+ <xsd:enumeration value="InboundToParty"/>
+ <xsd:enumeration value="Incident"/>
+ <xsd:enumeration value="IncorporatedLegalReference"/>
+ <xsd:enumeration value="IndividualTransactionReferenceNumber"/>
+ <xsd:enumeration value="InitialDealerClaimNumber"/>
+ <xsd:enumeration value="InitialFailureClaim"/>
+ <xsd:enumeration value="InitialSampleInspectionReportNumber"/>
+ <xsd:enumeration value="InitialTroubleIndication"/>
+ <xsd:enumeration value="InlandTransportOrderNumber"/>
+ <xsd:enumeration value="InquiryRequestNumber"/>
+ <xsd:enumeration value="InspectionandSurveySequenceNumber"/>
+ <xsd:enumeration value="InspectionReportNumber"/>
+ <xsd:enumeration value="InspectorIdentificationNumber"/>
+ <xsd:enumeration value="InstituteOfSecurityAndFutureMarketDevelopmentSerialNumber"/>
+ <xsd:enumeration value="InstitutionLoanNumber"/>
+ <xsd:enumeration value="InstitutionNoteHolderIdentification"/>
+ <xsd:enumeration value="InstitutionNumber"/>
+ <xsd:enumeration value="InsuranceCertificateNumber"/>
+ <xsd:enumeration value="InsuranceCertificateReferenceNumber"/>
+ <xsd:enumeration value="InsuranceContractReferenceNumber"/>
+ <xsd:enumeration value="InsuranceLicenseNumber"/>
+ <xsd:enumeration value="InsurancePolicyNumber"/>
+ <xsd:enumeration value="InsuredLocationIdentifier"/>
+ <xsd:enumeration value="InsuredParcelPostNumber"/>
+ <xsd:enumeration value="InsuredsLoanNumber"/>
+ <xsd:enumeration value="InsurerAssignedReferenceNumber"/>
+ <xsd:enumeration value="InsurorPoolIdentificationNumber"/>
+ <xsd:enumeration value="IntegratedLogisticSupportCrossReferenceNumber"/>
+ <xsd:enumeration value="IntegratedMasterPlan"/>
+ <xsd:enumeration value="IntegratedMasterSchedule"/>
+ <xsd:enumeration value="InterchangeAgreementNumber"/>
+ <xsd:enumeration value="InterchangeNumberNew"/>
+ <xsd:enumeration value="InterchangeNumberOld"/>
+ <xsd:enumeration value="InterchangeTrainIdentification"/>
+ <xsd:enumeration value="IntergovernmentalMaritimeOrganizationNumber"/>
+ <xsd:enumeration value="InterimFundingOrganizationLoanNumber"/>
+ <xsd:enumeration value="IntermediaryBroker"/>
+ <xsd:enumeration value="InternalControlNumber"/>
+ <xsd:enumeration value="InternalCustomerNumber"/>
+ <xsd:enumeration value="InternalDataProcessNumber"/>
+ <xsd:enumeration value="InternalOrderNumber"/>
+ <xsd:enumeration value="InternalPurchaseOrderItemNumber"/>
+ <xsd:enumeration value="InternalPurchaseOrderReleaseNumber"/>
+ <xsd:enumeration value="InternalVendorNumber"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumber"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumberChildDataMaintenance"/>
+ <xsd:enumeration value="InternationalAssessmentLogNumberParentDataMaintenance"/>
+ <xsd:enumeration value="InternationalFlightNumber"/>
+ <xsd:enumeration value="InternationalFuelTaxAgreementAccountNumber"/>
+ <xsd:enumeration value="InternationalRegistrationPlanAccountNumber"/>
+ <xsd:enumeration value="InternationalRegistrationPlanStickerNumber"/>
+ <xsd:enumeration value="InternationalStandardIndustrialClassificationDominionOfCanadaCode"/>
+ <xsd:enumeration value="InternationalStandardIndustryClassificationCode"/>
+ <xsd:enumeration value="InterstateCommerceCommissionAccountNumber"/>
+ <xsd:enumeration value="InterviewerID"/>
+ <xsd:enumeration value="IntraPlantRouting"/>
+ <xsd:enumeration value="InventoryReportReferenceNumber"/>
+ <xsd:enumeration value="InvestigatorialNewDrugNumber"/>
+ <xsd:enumeration value="InvestmentReferenceNumber"/>
+ <xsd:enumeration value="Investor"/>
+ <xsd:enumeration value="InvestorAssignedIdentificationNumber"/>
+ <xsd:enumeration value="InvestorLoanNumber"/>
+ <xsd:enumeration value="InvestorNoteHolderIdentification"/>
+ <xsd:enumeration value="InvoiceIdentification"/>
+ <xsd:enumeration value="InvoiceNumber"/>
+ <xsd:enumeration value="InvoiceNumberSuffix"/>
+ <xsd:enumeration value="InvoicingDataSheetReferenceNumber"/>
+ <xsd:enumeration value="IronChargeNumber"/>
+ <xsd:enumeration value="ISFMD"/>
+ <xsd:enumeration value="IssueNumber"/>
+ <xsd:enumeration value="IssuerNumber"/>
+ <xsd:enumeration value="IssuingBanksReference"/>
+ <xsd:enumeration value="ItemNumber"/>
+ <xsd:enumeration value="JobOrProjectNumber"/>
+ <xsd:enumeration value="JobOrderNumber"/>
+ <xsd:enumeration value="JobSequenceNumber"/>
+ <xsd:enumeration value="JointCreditSpecificationNumber"/>
+ <xsd:enumeration value="JointlyAdministeredCase"/>
+ <xsd:enumeration value="JointVentureReferenceNumber"/>
+ <xsd:enumeration value="Judge"/>
+ <xsd:enumeration value="JudgmentNumber"/>
+ <xsd:enumeration value="JudicialDistrict"/>
+ <xsd:enumeration value="JudicialNumber"/>
+ <xsd:enumeration value="JurisdictionalCommunityNameIdentifier"/>
+ <xsd:enumeration value="JurisdictionalCommunityNumber"/>
+ <xsd:enumeration value="LaboratoryNumber"/>
+ <xsd:enumeration value="LaboratoryRegistrationNumber"/>
+ <xsd:enumeration value="LaborOperationNumber"/>
+ <xsd:enumeration value="LabororAffiliationIdentification"/>
+ <xsd:enumeration value="LaneNumber"/>
+ <xsd:enumeration value="LastTransferNumber"/>
+ <xsd:enumeration value="LatitudeExpressedinDegreesMinutesandSeconds"/>
+ <xsd:enumeration value="LatitudeExpressedinSeconds"/>
+ <xsd:enumeration value="LeadCase"/>
+ <xsd:enumeration value="LeaseAgreementAmendmentNumberMaster"/>
+ <xsd:enumeration value="LeaseContractReference"/>
+ <xsd:enumeration value="LeaseNumber"/>
+ <xsd:enumeration value="LeaseRiderNumber"/>
+ <xsd:enumeration value="LeaseScheduleNumber"/>
+ <xsd:enumeration value="LeaseScheduleNumberBlanket"/>
+ <xsd:enumeration value="LeaseScheduleNumberPrior"/>
+ <xsd:enumeration value="LeaseScheduleNumberReplacement"/>
+ <xsd:enumeration value="LenderAccountNumber"/>
+ <xsd:enumeration value="LenderCaseNumber"/>
+ <xsd:enumeration value="LenderEntityNumber"/>
+ <xsd:enumeration value="LenderUse"/>
+ <xsd:enumeration value="LesseeBillCodeNumber"/>
+ <xsd:enumeration value="LesseeIdentification"/>
+ <xsd:enumeration value="LetterofCreditDraftNumber"/>
+ <xsd:enumeration value="LetterOfCreditNumber"/>
+ <xsd:enumeration value="LetterofCreditNumber"/>
+ <xsd:enumeration value="LettersorNotes"/>
+ <xsd:enumeration value="LevyingOfficerIdentification"/>
+ <xsd:enumeration value="LicensePlateNumber"/>
+ <xsd:enumeration value="LifeInsuranceBillingAccountNumber"/>
+ <xsd:enumeration value="LifeInsuranceBillingSuffixCode"/>
+ <xsd:enumeration value="LifeInsurancePolicyNumber"/>
+ <xsd:enumeration value="LimitedPartnershipIdentificationNumber"/>
+ <xsd:enumeration value="LineItemControlNumber"/>
+ <xsd:enumeration value="LineItemIdentifier"/>
+ <xsd:enumeration value="LineItemReferenceNumber"/>
+ <xsd:enumeration value="LineofBusiness"/>
+ <xsd:enumeration value="LineOfCreditCategory"/>
+ <xsd:enumeration value="LinkSequenceNumber"/>
+ <xsd:enumeration value="ListBillNumber"/>
+ <xsd:enumeration value="ListOfMaterials"/>
+ <xsd:enumeration value="LloydsClaimsOfficeReference"/>
+ <xsd:enumeration value="LoadingAuthorizationNumber"/>
+ <xsd:enumeration value="LoadLineCertificate"/>
+ <xsd:enumeration value="LoadPlanningNumber"/>
+ <xsd:enumeration value="LoanAcquisitionNumber"/>
+ <xsd:enumeration value="LoanFeatureCode"/>
+ <xsd:enumeration value="LoanNumber"/>
+ <xsd:enumeration value="LoanProspectorKeyNumber"/>
+ <xsd:enumeration value="LoanRequestNumber"/>
+ <xsd:enumeration value="LoanType"/>
+ <xsd:enumeration value="LocalJurisdiction"/>
+ <xsd:enumeration value="LocallyAssignedControlNumber"/>
+ <xsd:enumeration value="LocalMediaIdentifier"/>
+ <xsd:enumeration value="LocalSchoolCourseNumber"/>
+ <xsd:enumeration value="LocalSchoolDistrictCourseNumber"/>
+ <xsd:enumeration value="LocalStudentIdentificationNumber"/>
+ <xsd:enumeration value="LocationExceptionOrderNumber"/>
+ <xsd:enumeration value="LocationNumber"/>
+ <xsd:enumeration value="LocationonProductCode"/>
+ <xsd:enumeration value="LocationSpecificServicesReferenceNumber"/>
+ <xsd:enumeration value="LocationWithinEquipment"/>
+ <xsd:enumeration value="Lockbox"/>
+ <xsd:enumeration value="Log"/>
+ <xsd:enumeration value="LogicalObservationIdentifierNamesandCodes"/>
+ <xsd:enumeration value="LogisticsSupportDocumentationTypeCode"/>
+ <xsd:enumeration value="LongitudeExpressedInDegreesMinutesandSeconds"/>
+ <xsd:enumeration value="LongitudeExpressedinSeconds"/>
+ <xsd:enumeration value="LongTermDisabilityPolicyNumber"/>
+ <xsd:enumeration value="LossOrEventNumber"/>
+ <xsd:enumeration value="LossReportNumber"/>
+ <xsd:enumeration value="LotNumber"/>
+ <xsd:enumeration value="LowerArticleNumberOfRange"/>
+ <xsd:enumeration value="MagazineCode"/>
+ <xsd:enumeration value="Mailbox"/>
+ <xsd:enumeration value="MailingReferenceNumber"/>
+ <xsd:enumeration value="MailSlot"/>
+ <xsd:enumeration value="MaintenanceAvailabilityType"/>
+ <xsd:enumeration value="MaintenanceRequestNumber"/>
+ <xsd:enumeration value="MajorForceProgramNumber"/>
+ <xsd:enumeration value="MajorSystemAffectedCode"/>
+ <xsd:enumeration value="MakegoodCommercialLineNumber"/>
+ <xsd:enumeration value="MammographyCertificationNumber"/>
+ <xsd:enumeration value="ManagedCareOrganizationCode"/>
+ <xsd:enumeration value="ManagedCareOrganizationIdentificationNumber"/>
+ <xsd:enumeration value="ManifestKeyNumber"/>
+ <xsd:enumeration value="ManualProcessingAuthorityNumber"/>
+ <xsd:enumeration value="ManufacturerDefinedRepairRatesReference"/>
+ <xsd:enumeration value="ManufacturerNumber"/>
+ <xsd:enumeration value="ManufacturersMaterialSafetyDataSheetNumber"/>
+ <xsd:enumeration value="ManufacturersPartNumber"/>
+ <xsd:enumeration value="ManufacturingDirectiveNumber"/>
+ <xsd:enumeration value="ManufacturingOperationNumber"/>
+ <xsd:enumeration value="ManufacturingOrderNumber"/>
+ <xsd:enumeration value="MapNumber"/>
+ <xsd:enumeration value="MapReference"/>
+ <xsd:enumeration value="MaritimeDeclarationofHealth"/>
+ <xsd:enumeration value="MarketArea"/>
+ <xsd:enumeration value="MarkingOrLabelReference"/>
+ <xsd:enumeration value="MasterAccountNumber"/>
+ <xsd:enumeration value="MasterAirWaybillNumber"/>
+ <xsd:enumeration value="MasterBillOfLadingNumber"/>
+ <xsd:enumeration value="MasterContract"/>
+ <xsd:enumeration value="MasterLabelNumber"/>
+ <xsd:enumeration value="MasterLeaseAgreementNumber"/>
+ <xsd:enumeration value="MasterPolicyNumber"/>
+ <xsd:enumeration value="MasterPropertyNumber"/>
+ <xsd:enumeration value="MasterReferenceNumber"/>
+ <xsd:enumeration value="MasterSolicitationProceduresTermsAndConditionsNumber"/>
+ <xsd:enumeration value="MaterialChangeNoticeNumber"/>
+ <xsd:enumeration value="MaterialStorageLocation"/>
+ <xsd:enumeration value="MaturedCertificateOfDeposit"/>
+ <xsd:enumeration value="MeatProcessingEstablishmentRegistrationNumber"/>
+ <xsd:enumeration value="MedicaidProviderNumber"/>
+ <xsd:enumeration value="MedicaidRecipientIdentificationNumber"/>
+ <xsd:enumeration value="MedicalAssistanceCategory"/>
+ <xsd:enumeration value="MedicalRecordIdentificationNumber"/>
+ <xsd:enumeration value="MedicareProviderNumber"/>
+ <xsd:enumeration value="MedicareVersionCode"/>
+ <xsd:enumeration value="MemberIdentificationNumber"/>
+ <xsd:enumeration value="MemberNumber"/>
+ <xsd:enumeration value="MerchandiseTypeCode"/>
+ <xsd:enumeration value="MerchantCategoryCode"/>
+ <xsd:enumeration value="MessageAddressorID"/>
+ <xsd:enumeration value="MessageBatchNumber"/>
+ <xsd:enumeration value="MessageDesignGroupNumber"/>
+ <xsd:enumeration value="MessageRecipient"/>
+ <xsd:enumeration value="MessageSender"/>
+ <xsd:enumeration value="MeterNumber"/>
+ <xsd:enumeration value="MeterProvingReportNumber"/>
+ <xsd:enumeration value="MeterReadingAtTheBeginningOfTheDelivery"/>
+ <xsd:enumeration value="MeterReadingAtTheEndOfDelivery"/>
+ <xsd:enumeration value="MeterTicketNumber"/>
+ <xsd:enumeration value="MeterUnitNumber"/>
+ <xsd:enumeration value="MICRNumber"/>
+ <xsd:enumeration value="MicrofilmNumber"/>
+ <xsd:enumeration value="MigrantNumber"/>
+ <xsd:enumeration value="Milestone"/>
+ <xsd:enumeration value="MilitaryCallNumber"/>
+ <xsd:enumeration value="MilitaryID"/>
+ <xsd:enumeration value="MilitaryInterdepartmentalPurchaseRequestNumber"/>
+ <xsd:enumeration value="MilitaryOrdnanceSecurityRiskNumber"/>
+ <xsd:enumeration value="MilitaryRankOrCivilianPayGradeNumber"/>
+ <xsd:enumeration value="MilitarySpecificationNumber"/>
+ <xsd:enumeration value="MilitaryStandardNumber"/>
+ <xsd:enumeration value="MillinginTransit"/>
+ <xsd:enumeration value="MillOrderNumber"/>
+ <xsd:enumeration value="MinimumRoyaltyPayorIdentification"/>
+ <xsd:enumeration value="MinisterialCertificateOfHomologation"/>
+ <xsd:enumeration value="Model"/>
+ <xsd:enumeration value="ModelNumber"/>
+ <xsd:enumeration value="Modelyearnumber"/>
+ <xsd:enumeration value="MORNETPlusCaseNumber"/>
+ <xsd:enumeration value="MORNETPlusInstitutionNumber"/>
+ <xsd:enumeration value="MORNETPlusUserIdentification"/>
+ <xsd:enumeration value="MortgageBackedSecurityLoanNumber"/>
+ <xsd:enumeration value="MortgageBackedSecurityPoolNumber"/>
+ <xsd:enumeration value="MortgageElectronicRegistrationSystemOrganizationIdentifier"/>
+ <xsd:enumeration value="MortgageeLoanNumber"/>
+ <xsd:enumeration value="MortgageIdentificationNumber"/>
+ <xsd:enumeration value="MortgageInsuranceCompanyNumber"/>
+ <xsd:enumeration value="MortgageInsuranceIndicatorNumber"/>
+ <xsd:enumeration value="MortgageNumber"/>
+ <xsd:enumeration value="MotorCarrierIdentificationNumber"/>
+ <xsd:enumeration value="MotorFuelCertificateNumber"/>
+ <xsd:enumeration value="MotorVehicleIDNumber"/>
+ <xsd:enumeration value="MultifamilyProjectNumber"/>
+ <xsd:enumeration value="MultipleListingNumber"/>
+ <xsd:enumeration value="MultipleListingServiceArea"/>
+ <xsd:enumeration value="MultipleListingServiceBookType"/>
+ <xsd:enumeration value="MultipleListingServiceMapXCoordinate"/>
+ <xsd:enumeration value="MultipleListingServiceMapYCoordinate"/>
+ <xsd:enumeration value="MultipleListingServiceSubArea"/>
+ <xsd:enumeration value="MultiplePOOfAnInvoice"/>
+ <xsd:enumeration value="MultipleZoneOrderNumber"/>
+ <xsd:enumeration value="MunicipalityAssignedBusinessRegistryNumber"/>
+ <xsd:enumeration value="NACE"/>
+ <xsd:enumeration value="NAF"/>
+ <xsd:enumeration value="NamedBanksReference"/>
+ <xsd:enumeration value="NationalAeronauticsandSpaceAdministrationFARSupplement"/>
+ <xsd:enumeration value="NationalAssociationOfBoardsOfPharmacyNumber"/>
+ <xsd:enumeration value="NationalAssociationOfInsuranceCommissionersCode"/>
+ <xsd:enumeration value="NationalBusinessIdentificationNumber"/>
+ <xsd:enumeration value="NationalCriminalInformationCenterOriginatingAgencyIdentification"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCommunityName"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCommunityNumber"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramCounty"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramMapNumber"/>
+ <xsd:enumeration value="NationalFloodInsuranceProgramState"/>
+ <xsd:enumeration value="NationalGovernmentBusinessIdentificationNumber"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel1"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel2"/>
+ <xsd:enumeration value="NationalPropertyRegistrySystemLevel3"/>
+ <xsd:enumeration value="NationalStockNumber"/>
+ <xsd:enumeration value="NaturalGasPolicyActCategoryCode"/>
+ <xsd:enumeration value="NewDrugApplicationNumber"/>
+ <xsd:enumeration value="NewHealthInsuranceClaimNumber"/>
+ <xsd:enumeration value="NewPartNumber"/>
+ <xsd:enumeration value="NextRentalAgreementNumber"/>
+ <xsd:enumeration value="NextRentalAgreementReasonNumber"/>
+ <xsd:enumeration value="NextShipmentIdentificationNumberContinuousMove"/>
+ <xsd:enumeration value="NIT"/>
+ <xsd:enumeration value="NominationNumber"/>
+ <xsd:enumeration value="NonAmericanIdentificationNumber"/>
+ <xsd:enumeration value="NonConformanceReportNumber"/>
+ <xsd:enumeration value="NonNegotiableMaritimeTransportDocumentNumber"/>
+ <xsd:enumeration value="NonOriginatingThirdPartyNumber"/>
+ <xsd:enumeration value="NonPickupLimitedTariffNumber"/>
+ <xsd:enumeration value="NonProvisionalPatentApplicationNumber"/>
+ <xsd:enumeration value="NonSpouseTie"/>
+ <xsd:enumeration value="NoOT5AuthorityZeroMileageRate"/>
+ <xsd:enumeration value="NorthAmericanDatumStandard"/>
+ <xsd:enumeration value="NorthAmericanFreeTradeAgreementComplianceNumber"/>
+ <xsd:enumeration value="NorthAmericanHazardousClassificationNumber"/>
+ <xsd:enumeration value="NorthAmericanHazardousGoodsClassificationNumber"/>
+ <xsd:enumeration value="NorthAmericanIndustrialClassificationSystemCode"/>
+ <xsd:enumeration value="NOTICOL"/>
+ <xsd:enumeration value="NumberOfTemporaryImportationDocument"/>
+ <xsd:enumeration value="NumerodeCeduladeIdentidadNumber"/>
+ <xsd:enumeration value="NumerodeIdentificacionTributaria"/>
+ <xsd:enumeration value="ObjectIdentifier"/>
+ <xsd:enumeration value="OccupationalSafetyandHealthAdministrationClaimNumber"/>
+ <xsd:enumeration value="OccupationClassificationCode"/>
+ <xsd:enumeration value="OccupationCode"/>
+ <xsd:enumeration value="OceanBillofLading"/>
+ <xsd:enumeration value="OceanContainerNumber"/>
+ <xsd:enumeration value="OceanManifest"/>
+ <xsd:enumeration value="OffenderTracking"/>
+ <xsd:enumeration value="OffenseTracking"/>
+ <xsd:enumeration value="OfferGroup"/>
+ <xsd:enumeration value="OfferNumber"/>
+ <xsd:enumeration value="OfficeNumber"/>
+ <xsd:enumeration value="OfficerLicenseNumber"/>
+ <xsd:enumeration value="OfficeSymbol"/>
+ <xsd:enumeration value="OldAccountNumber"/>
+ <xsd:enumeration value="OldMeterNumber"/>
+ <xsd:enumeration value="OldPartNumber"/>
+ <xsd:enumeration value="OneCallAgencyTicketNumber"/>
+ <xsd:enumeration value="OnlineProcurementandAccountingControlTransaction"/>
+ <xsd:enumeration value="OpenandPrepaidStationListNumber"/>
+ <xsd:enumeration value="OperationNumber"/>
+ <xsd:enumeration value="OperatorAssignedUnitNumber"/>
+ <xsd:enumeration value="OperatorIdentificationNumber"/>
+ <xsd:enumeration value="OperatorLeaseNumber"/>
+ <xsd:enumeration value="OptionPolicyNumber"/>
+ <xsd:enumeration value="OrderOrParagraphNumber"/>
+ <xsd:enumeration value="OrderingCustomerConsignmentReferenceNumber"/>
+ <xsd:enumeration value="OrderingCustomersSecondReferenceNumber"/>
+ <xsd:enumeration value="OrderNumber"/>
+ <xsd:enumeration value="PurchaseOrderNumber"/>
+ <xsd:enumeration value="VendorOrderNumber"/>
+ <xsd:enumeration value="OrganizationBreakdownStructure"/>
+ <xsd:enumeration value="OriginalCertificateNumber"/>
+ <xsd:enumeration value="OriginalFdoTransactionReference"/>
+ <xsd:enumeration value="OriginalFiling"/>
+ <xsd:enumeration value="OriginalFilingNumber"/>
+ <xsd:enumeration value="OriginalInvoiceNumber"/>
+ <xsd:enumeration value="OriginalPurchaseOrder"/>
+ <xsd:enumeration value="OriginalReferenceNumber"/>
+ <xsd:enumeration value="OriginalReturnRequestReferenceNumber"/>
+ <xsd:enumeration value="OriginalShippersBillOfLadingNumber"/>
+ <xsd:enumeration value="OriginalSubmitterChildDataMaintenanceRequestLog"/>
+ <xsd:enumeration value="OriginalSubmitterLogNumber"/>
+ <xsd:enumeration value="OriginalSubmitterParentDataMaintenanceRequest"/>
+ <xsd:enumeration value="OriginalUniformCommercialCodeFilingNumber"/>
+ <xsd:enumeration value="OriginalVoucherNumber"/>
+ <xsd:enumeration value="OriginatingCase"/>
+ <xsd:enumeration value="OriginatingCompanyIdentifier"/>
+ <xsd:enumeration value="OriginatingDepositoryFinancialInstitutionIdentifier"/>
+ <xsd:enumeration value="OriginatorsReference"/>
+ <xsd:enumeration value="OriginHouse"/>
+ <xsd:enumeration value="OriginOfShipmentHarmonizedBasedCode"/>
+ <xsd:enumeration value="OT5AuthorityConditionOrRestrictiononCarHireRate"/>
+ <xsd:enumeration value="OtherUnlistedTypeOfReferenceNumber"/>
+ <xsd:enumeration value="OutboundFromParty"/>
+ <xsd:enumeration value="OuterContinentalShelfAreaCode"/>
+ <xsd:enumeration value="OuterContinentalShelfBlockNumber"/>
+ <xsd:enumeration value="OuterpackagingUnitIdentification"/>
+ <xsd:enumeration value="OutletNumber"/>
+ <xsd:enumeration value="OutofServiceNumber"/>
+ <xsd:enumeration value="OwningBureauIdentificationNumber"/>
+ <xsd:enumeration value="PackAndHoldInvoiceNumber"/>
+ <xsd:enumeration value="PackageNumber"/>
+ <xsd:enumeration value="PackagingGroupNumber"/>
+ <xsd:enumeration value="PackagingSpecificationNumber"/>
+ <xsd:enumeration value="PackagingUnitIdentification"/>
+ <xsd:enumeration value="PackerNumber"/>
+ <xsd:enumeration value="Packet"/>
+ <xsd:enumeration value="PackingGroupCode"/>
+ <xsd:enumeration value="PackingListNumber"/>
+ <xsd:enumeration value="PackingPlantNumber"/>
+ <xsd:enumeration value="PageNumber"/>
+ <xsd:enumeration value="Paragraph"/>
+ <xsd:enumeration value="ParagraphNumber"/>
+ <xsd:enumeration value="ParamedicalIDNumber"/>
+ <xsd:enumeration value="ParentFile"/>
+ <xsd:enumeration value="PartCausingRepairNumber"/>
+ <xsd:enumeration value="PartConsignmentNumber"/>
+ <xsd:enumeration value="PartialPaymentNumber"/>
+ <xsd:enumeration value="ParticipatingArea"/>
+ <xsd:enumeration value="PartInterchangeability"/>
+ <xsd:enumeration value="PartNumber"/>
+ <xsd:enumeration value="PartReferenceIndicatorInADrawing"/>
+ <xsd:enumeration value="PartyInformationMessageReference"/>
+ <xsd:enumeration value="PartySequenceNumber"/>
+ <xsd:enumeration value="Passport"/>
+ <xsd:enumeration value="PassportNumber"/>
+ <xsd:enumeration value="PatentCooperationTreatyApplicationNumber"/>
+ <xsd:enumeration value="PatentNumber"/>
+ <xsd:enumeration value="PatentType"/>
+ <xsd:enumeration value="PatientAccountNumber"/>
+ <xsd:enumeration value="PatronNumber"/>
+ <xsd:enumeration value="PayeeIdentification"/>
+ <xsd:enumeration value="PayeeLoanNumber"/>
+ <xsd:enumeration value="PayeesFinancialInstitutionAccountNumber"/>
+ <xsd:enumeration value="PayeesFinancialInstitutionTransitRoutingNo"/>
+ <xsd:enumeration value="PayeesReferenceNumber"/>
+ <xsd:enumeration value="PayerAssignedResubmissionReferenceNumber"/>
+ <xsd:enumeration value="PayerCategory"/>
+ <xsd:enumeration value="PayerIdentificationNumber"/>
+ <xsd:enumeration value="PayersFinancialInstitutionAccountNumber"/>
+ <xsd:enumeration value="PayersFinancialInstitutionTransitRoutingNo"/>
+ <xsd:enumeration value="PayersReferenceNumber"/>
+ <xsd:enumeration value="PayGrade"/>
+ <xsd:enumeration value="PaymentCategory"/>
+ <xsd:enumeration value="PaymentHistoryReferenceNumber"/>
+ <xsd:enumeration value="PaymentInAdvanceRequestReference"/>
+ <xsd:enumeration value="PaymentInstalmentReferenceNumber"/>
+ <xsd:enumeration value="PaymentLocation"/>
+ <xsd:enumeration value="PaymentOrderNumber"/>
+ <xsd:enumeration value="PaymentPlanReference"/>
+ <xsd:enumeration value="PaymentReference"/>
+ <xsd:enumeration value="PaymentValuationNumber"/>
+ <xsd:enumeration value="PayorsClaimNumber"/>
+ <xsd:enumeration value="PayrollAccountNumber"/>
+ <xsd:enumeration value="PayrollNumber"/>
+ <xsd:enumeration value="PcsCatastrophe"/>
+ <xsd:enumeration value="PeerReviewOrganizationApprovalNumber"/>
+ <xsd:enumeration value="PendingCase"/>
+ <xsd:enumeration value="PensionContract"/>
+ <xsd:enumeration value="PeriodicityCode"/>
+ <xsd:enumeration value="PermitNumber"/>
+ <xsd:enumeration value="PersonalIdentificationNumber"/>
+ <xsd:enumeration value="PersonalIdentityCardNumber"/>
+ <xsd:enumeration value="PersonalIDNumber"/>
+ <xsd:enumeration value="PetroleumPoolCode"/>
+ <xsd:enumeration value="PharmacyPrescriptionNumber"/>
+ <xsd:enumeration value="PhoneCalls"/>
+ <xsd:enumeration value="PhysicalInventoryRecountReferenceNumber"/>
+ <xsd:enumeration value="PickupReferenceNumber"/>
+ <xsd:enumeration value="PictureNumber"/>
+ <xsd:enumeration value="PictureOfActualProduct"/>
+ <xsd:enumeration value="PictureOfAGenericProduct"/>
+ <xsd:enumeration value="PierNumber"/>
+ <xsd:enumeration value="Piggyback"/>
+ <xsd:enumeration value="PilotLicenseNumber"/>
+ <xsd:enumeration value="PipelineNumber"/>
+ <xsd:enumeration value="PlanNetworkIdentificationNumber"/>
+ <xsd:enumeration value="PlanningPackage"/>
+ <xsd:enumeration value="PlanNumber"/>
+ <xsd:enumeration value="PlantNumber"/>
+ <xsd:enumeration value="PlateNumber"/>
+ <xsd:enumeration value="PlatformIdentificationNumber"/>
+ <xsd:enumeration value="PlotFile"/>
+ <xsd:enumeration value="PlugNumber"/>
+ <xsd:enumeration value="PolicyFormNumber"/>
+ <xsd:enumeration value="PolicyLinkNumber"/>
+ <xsd:enumeration value="PolicyNumber"/>
+ <xsd:enumeration value="PolicyType"/>
+ <xsd:enumeration value="Pollutant"/>
+ <xsd:enumeration value="PoolContractCode"/>
+ <xsd:enumeration value="PoolNumber"/>
+ <xsd:enumeration value="PoolSuffix"/>
+ <xsd:enumeration value="PositionCode"/>
+ <xsd:enumeration value="PostEntryReference"/>
+ <xsd:enumeration value="PreAwardSurvey"/>
+ <xsd:enumeration value="PrecinctNumber"/>
+ <xsd:enumeration value="PredecessorAccount"/>
+ <xsd:enumeration value="PredeterminationofBenefitsIdentificationNumber"/>
+ <xsd:enumeration value="PreferredCallSign"/>
+ <xsd:enumeration value="PreferredProviderOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="PreferredProviderOrganizationNumber"/>
+ <xsd:enumeration value="PreferredProviderOrganizationSiteNumber"/>
+ <xsd:enumeration value="PreliminaryWorkCandidateNumber"/>
+ <xsd:enumeration value="PremarketApplicationNumber"/>
+ <xsd:enumeration value="PremarketNotificationNumber"/>
+ <xsd:enumeration value="PremiumAuditPriorityIdentifier"/>
+ <xsd:enumeration value="PremiumAuditPurposeIdentifier"/>
+ <xsd:enumeration value="PremiumAuditTypeIdentifier"/>
+ <xsd:enumeration value="PremiumRateTable"/>
+ <xsd:enumeration value="PreparersVerificationNumber"/>
+ <xsd:enumeration value="PresentingBanksReference"/>
+ <xsd:enumeration value="PressFormIdentifier"/>
+ <xsd:enumeration value="PressIdentifier"/>
+ <xsd:enumeration value="PreviousBillofLadingNumber"/>
+ <xsd:enumeration value="PreviousCargoControlNumber"/>
+ <xsd:enumeration value="PreviousClaimHistoryIdentifier"/>
+ <xsd:enumeration value="PreviousContractNumber"/>
+ <xsd:enumeration value="PreviousCourseNumber"/>
+ <xsd:enumeration value="PreviousCreditOrDebitAdjustmentNumber"/>
+ <xsd:enumeration value="PreviousCreditAdviceReferenceNumber"/>
+ <xsd:enumeration value="PreviousCustomerReferenceNumber"/>
+ <xsd:enumeration value="PreviousDeliveryInstructionNumber"/>
+ <xsd:enumeration value="PreviousDeliveryScheduleNumber"/>
+ <xsd:enumeration value="PreviousDistributorNumber"/>
+ <xsd:enumeration value="PreviousDriversLicense"/>
+ <xsd:enumeration value="PreviousDrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="PreviousHighestScheduleNumber"/>
+ <xsd:enumeration value="PreviousInvoiceNumber"/>
+ <xsd:enumeration value="PreviouslyReportedSocialSecurityNumber"/>
+ <xsd:enumeration value="PreviousMemberNumber"/>
+ <xsd:enumeration value="PreviousPolicyNumber"/>
+ <xsd:enumeration value="PreviousRentalAgreementNumber"/>
+ <xsd:enumeration value="PreviousReportNumber"/>
+ <xsd:enumeration value="PreviousRequestForMeteredReadingReferenceNumber"/>
+ <xsd:enumeration value="PreviousSchemeOrPlanNumber"/>
+ <xsd:enumeration value="PreviousSequence"/>
+ <xsd:enumeration value="PreviousShipmentIdentificationNumberContinuousMove"/>
+ <xsd:enumeration value="PreviousTaxControlNumber"/>
+ <xsd:enumeration value="PreviousTicketNumber"/>
+ <xsd:enumeration value="PriceOrSalesCatalogueResponseReferenceNumber"/>
+ <xsd:enumeration value="PriceAreaNumber"/>
+ <xsd:enumeration value="PriceListChangeorIssueNumber"/>
+ <xsd:enumeration value="PriceListNumber"/>
+ <xsd:enumeration value="PriceListVersionNumber"/>
+ <xsd:enumeration value="PriceQuoteNumber"/>
+ <xsd:enumeration value="PriceVariationFormulaReferenceNumber"/>
+ <xsd:enumeration value="PrimaryReference"/>
+ <xsd:enumeration value="PrimeContractorContractNumber"/>
+ <xsd:enumeration value="PrincipalReferenceNumber"/>
+ <xsd:enumeration value="PrincipalsBankReference"/>
+ <xsd:enumeration value="PrincipalsReference"/>
+ <xsd:enumeration value="PriorAuthorizationNumber"/>
+ <xsd:enumeration value="PriorCase"/>
+ <xsd:enumeration value="PriorCertificateNumber"/>
+ <xsd:enumeration value="PriorContractNumber"/>
+ <xsd:enumeration value="PriorDataUniversalNumberSystemNumber"/>
+ <xsd:enumeration value="PriorHealthIndustryNumber"/>
+ <xsd:enumeration value="PriorIdentifierNumber"/>
+ <xsd:enumeration value="PriorIncorrectBatchNumber"/>
+ <xsd:enumeration value="PriorIncorrectSocialSecurityNumber"/>
+ <xsd:enumeration value="PriorityRating"/>
+ <xsd:enumeration value="PriorLoanNumber"/>
+ <xsd:enumeration value="PriorPhoneNumber"/>
+ <xsd:enumeration value="PriorPolicyNumber"/>
+ <xsd:enumeration value="PriorPostalZipCode"/>
+ <xsd:enumeration value="PriorPurchaseOrderNumber"/>
+ <xsd:enumeration value="Priorpurchaseordernumber"/>
+ <xsd:enumeration value="PriorTaxIdentificationNumber"/>
+ <xsd:enumeration value="PriorTradingPartnerIdentificationNumber"/>
+ <xsd:enumeration value="PriorUniversalProviderIdentificationNumber"/>
+ <xsd:enumeration value="Proceeding"/>
+ <xsd:enumeration value="ProcessHandlingCode"/>
+ <xsd:enumeration value="ProcessingArea"/>
+ <xsd:enumeration value="ProcessingPlantNumber"/>
+ <xsd:enumeration value="ProcessorIdentificationNumber"/>
+ <xsd:enumeration value="ProcessorsInvoiceNumber"/>
+ <xsd:enumeration value="ProcurementBudgetNumber"/>
+ <xsd:enumeration value="ProcurementRequestNumber"/>
+ <xsd:enumeration value="ProcuringAgency"/>
+ <xsd:enumeration value="ProductChangeAuthorityNumber"/>
+ <xsd:enumeration value="ProductChangeInformationNumber"/>
+ <xsd:enumeration value="ProductChangeNoticeNumber"/>
+ <xsd:enumeration value="ProductGroup"/>
+ <xsd:enumeration value="ProductionCode"/>
+ <xsd:enumeration value="ProductLicensingAgreementNumber"/>
+ <xsd:enumeration value="ProductLineNumber"/>
+ <xsd:enumeration value="ProductNumber"/>
+ <xsd:enumeration value="ProductPeriodForWhichLaborCostsAreFirm"/>
+ <xsd:enumeration value="ProductReservationNumber"/>
+ <xsd:enumeration value="ProductSourcingAgreementNumber"/>
+ <xsd:enumeration value="ProductSpecificationDocumentNumber"/>
+ <xsd:enumeration value="ProductType"/>
+ <xsd:enumeration value="ProfileNumber"/>
+ <xsd:enumeration value="ProformaInvoiceNumber"/>
+ <xsd:enumeration value="ProgramIdentificationNumber"/>
+ <xsd:enumeration value="ProgressPaymentNumber"/>
+ <xsd:enumeration value="ProjectCode"/>
+ <xsd:enumeration value="ProjectNumber"/>
+ <xsd:enumeration value="ProjectParagraphNumber"/>
+ <xsd:enumeration value="ProjectPropertyNumber"/>
+ <xsd:enumeration value="ProjectSpecificationNumber"/>
+ <xsd:enumeration value="PromotionOrDealNumber"/>
+ <xsd:enumeration value="ProofOfDeliveryReferenceNumber"/>
+ <xsd:enumeration value="PropertyComponentLocation"/>
+ <xsd:enumeration value="PropertyControlNumber"/>
+ <xsd:enumeration value="PropertyLossItemNumber"/>
+ <xsd:enumeration value="ProposalNumber"/>
+ <xsd:enumeration value="ProposalParagraphNumber"/>
+ <xsd:enumeration value="ProposedContractNumber"/>
+ <xsd:enumeration value="ProposedGroupWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="ProposedSequenceNumber"/>
+ <xsd:enumeration value="ProposedWorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="ProtocolNumber"/>
+ <xsd:enumeration value="ProtractionNumber"/>
+ <xsd:enumeration value="ProviderClaimNumber"/>
+ <xsd:enumeration value="ProviderCommercialNumber"/>
+ <xsd:enumeration value="ProviderControlNumber"/>
+ <xsd:enumeration value="ProviderOrderTicketNumber"/>
+ <xsd:enumeration value="ProviderPlanNetworkIdentificationNumber"/>
+ <xsd:enumeration value="ProviderSiteNumber"/>
+ <xsd:enumeration value="ProviderUPINNumber"/>
+ <xsd:enumeration value="ProvincialCanadianSalesTaxExemptionNumber"/>
+ <xsd:enumeration value="ProvincialTaxIdentification"/>
+ <xsd:enumeration value="ProvisionalPatentApplicationNumber"/>
+ <xsd:enumeration value="PublicationIssueNumber"/>
+ <xsd:enumeration value="PublicDeedNumber"/>
+ <xsd:enumeration value="PublicFilingRegistrationNumber"/>
+ <xsd:enumeration value="PublicUtilitiesCommissionCertificateOfPublicConvenience"/>
+ <xsd:enumeration value="PurchaseDescription"/>
+ <xsd:enumeration value="PurchaseOptionAgreement"/>
+ <xsd:enumeration value="PurchaseOrderChangeNumber"/>
+ <xsd:enumeration value="PurchaseOrderLineItemIdentifierBuyer"/>
+ <xsd:enumeration value="PurchaseOrderNumberIncludedinOnOrderPosition"/>
+ <xsd:enumeration value="PurchaseOrderNumberOfOrderReceivedSinceLastReportingDate"/>
+ <xsd:enumeration value="PurchaseOrderNumberOfShipmentReceivedSinceLastReportingDate"/>
+ <xsd:enumeration value="PurchaseOrderNumberSuffix"/>
+ <xsd:enumeration value="PurchaseOrderResponseNumber"/>
+ <xsd:enumeration value="PurchaseOrderRevisionNumber"/>
+ <xsd:enumeration value="PurchaseRequisitionNumber"/>
+ <xsd:enumeration value="PurchasersRequestReference"/>
+ <xsd:enumeration value="PurchasingActivityClauseNumber"/>
+ <xsd:enumeration value="QualifiedMaterialsList"/>
+ <xsd:enumeration value="QualifiedProductsList"/>
+ <xsd:enumeration value="QualityClause"/>
+ <xsd:enumeration value="QualityDispositionAreaIdentifier"/>
+ <xsd:enumeration value="QualityInspectionAreaIdentifier"/>
+ <xsd:enumeration value="QualityReportNumber"/>
+ <xsd:enumeration value="QualityReviewMaterialCribIdentifier"/>
+ <xsd:enumeration value="QuantityValuationNumber"/>
+ <xsd:enumeration value="QuantityValuationRequestNumber"/>
+ <xsd:enumeration value="QuarantineOrTreatmentStatusReferenceNumber"/>
+ <xsd:enumeration value="QuarterQuarterSectionNumber"/>
+ <xsd:enumeration value="QuarterQuarterSpotNumber"/>
+ <xsd:enumeration value="QuestionNumber"/>
+ <xsd:enumeration value="QuotaNumber"/>
+ <xsd:enumeration value="QuoteOrShoppingCartID"/>
+ <xsd:enumeration value="RackTypeNumber"/>
+ <xsd:enumeration value="RailOrRoadRoutingCode"/>
+ <xsd:enumeration value="RailroadCommissionOilNumber"/>
+ <xsd:enumeration value="RailroadCommissionRecordNumber"/>
+ <xsd:enumeration value="RailRoutingCode"/>
+ <xsd:enumeration value="RailWayBillNumber"/>
+ <xsd:enumeration value="RailwayConsignmentNoteNumber"/>
+ <xsd:enumeration value="RailwayWagonNumber"/>
+ <xsd:enumeration value="RangeNumber"/>
+ <xsd:enumeration value="RateCardNumber"/>
+ <xsd:enumeration value="RateCodeNumber"/>
+ <xsd:enumeration value="RateConferenceIDCode"/>
+ <xsd:enumeration value="RateNoteNumber"/>
+ <xsd:enumeration value="RatingPeriod"/>
+ <xsd:enumeration value="RawmaterialSupplierDunAndBradstreetNumber"/>
+ <xsd:enumeration value="RealEstateOwnedPropertyIdentifier"/>
+ <xsd:enumeration value="ReasonForChange"/>
+ <xsd:enumeration value="ReasonNotLowestCostCode"/>
+ <xsd:enumeration value="RebateNumber"/>
+ <xsd:enumeration value="RecallNumber"/>
+ <xsd:enumeration value="ReceiptNumber"/>
+ <xsd:enumeration value="ReceivedNumber"/>
+ <xsd:enumeration value="ReceiverAssignedDropZone"/>
+ <xsd:enumeration value="ReceiverClaimNumber"/>
+ <xsd:enumeration value="ReceiverIdentificationNumber"/>
+ <xsd:enumeration value="ReceiverIDQualifier"/>
+ <xsd:enumeration value="ReceiversFileReferenceNumber"/>
+ <xsd:enumeration value="ReceiverSubIdentificationNumber"/>
+ <xsd:enumeration value="ReceivingAdviceNumber"/>
+ <xsd:enumeration value="ReceivingBanksAuthorizationNumber"/>
+ <xsd:enumeration value="ReceivingCompanyIdentifier"/>
+ <xsd:enumeration value="ReceivingDepositoryFinancialInstitutionIdentifier"/>
+ <xsd:enumeration value="ReceivingNumber"/>
+ <xsd:enumeration value="ReceivingPartysMemberIdentification"/>
+ <xsd:enumeration value="ReconciliationReportSectionIdentificationCode"/>
+ <xsd:enumeration value="RecordingNumber"/>
+ <xsd:enumeration value="ReducedEarningWeekIdentifier"/>
+ <xsd:enumeration value="ReelNumber"/>
+ <xsd:enumeration value="ReferencedBy"/>
+ <xsd:enumeration value="ReferencedPatternIdentification"/>
+ <xsd:enumeration value="ReferenceDrawingNumber"/>
+ <xsd:enumeration value="ReferenceNumberAssignedByThirdParty"/>
+ <xsd:enumeration value="ReferenceNumberOfARequestForMeteredReading"/>
+ <xsd:enumeration value="ReferenceNumberQuotedOnStatement"/>
+ <xsd:enumeration value="ReferenceNumberToPreviousMessage"/>
+ <xsd:enumeration value="ReferenceVersionNumber"/>
+ <xsd:enumeration value="ReferralNumber"/>
+ <xsd:enumeration value="ReferredProductForChemicalAnalysis"/>
+ <xsd:enumeration value="ReferredProductForMechanicalAnalysis"/>
+ <xsd:enumeration value="RefinerIdentification"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="RegionalAccountNumber"/>
+ <xsd:enumeration value="RegiristoFederalDeContribuyentes"/>
+ <xsd:enumeration value="RegiristoFederaldeContribuyentes"/>
+ <xsd:enumeration value="RegisteredCapitalReference"/>
+ <xsd:enumeration value="RegisteredContractorActivityType"/>
+ <xsd:enumeration value="RegisteredMailNumber"/>
+ <xsd:enumeration value="RegistrationNumber"/>
+ <xsd:enumeration value="RegistrationNumberOfPreviousCustomsDeclaration"/>
+ <xsd:enumeration value="RegistroInformacionFiscal"/>
+ <xsd:enumeration value="RegistroNacionaldeContribuyente"/>
+ <xsd:enumeration value="RegistroUnicodeContribuyente"/>
+ <xsd:enumeration value="RegulationPrimaryNumber"/>
+ <xsd:enumeration value="RegulationSecondaryNumber"/>
+ <xsd:enumeration value="RegulatoryGuidelineIdentifier"/>
+ <xsd:enumeration value="ReinsuranceReference"/>
+ <xsd:enumeration value="ReinsurersClaimNumber"/>
+ <xsd:enumeration value="ReissueCessionNumber"/>
+ <xsd:enumeration value="RejectionNumber"/>
+ <xsd:enumeration value="RelatedCase"/>
+ <xsd:enumeration value="RelatedContractLineItemNumber"/>
+ <xsd:enumeration value="RelatedDocumentNumber"/>
+ <xsd:enumeration value="RelatedNonconformanceNumber"/>
+ <xsd:enumeration value="RelatedObjectIdentificationNumber"/>
+ <xsd:enumeration value="RelatedTransactionReferenceNumber"/>
+ <xsd:enumeration value="RelatedVendorOrderNumber"/>
+ <xsd:enumeration value="RelativePriority"/>
+ <xsd:enumeration value="ReleaseInvoiceNumberForPriorBillAndHold"/>
+ <xsd:enumeration value="ReleaseNumber"/>
+ <xsd:enumeration value="RemittanceAdviceNumber"/>
+ <xsd:enumeration value="RemittingBanksReference"/>
+ <xsd:enumeration value="RemovalNumber"/>
+ <xsd:enumeration value="RentalAccountNumber"/>
+ <xsd:enumeration value="RentalAgreementNumber"/>
+ <xsd:enumeration value="RentPayorIdentification"/>
+ <xsd:enumeration value="RepairActionNumber"/>
+ <xsd:enumeration value="RepairCategoryNumber"/>
+ <xsd:enumeration value="RepairDataRequestNumber"/>
+ <xsd:enumeration value="RepairEstimateNumber"/>
+ <xsd:enumeration value="RepairOrderNumber"/>
+ <xsd:enumeration value="RepairPartNumber"/>
+ <xsd:enumeration value="RepeatLocation"/>
+ <xsd:enumeration value="RepetitiveBookingNumber"/>
+ <xsd:enumeration value="RepetitiveCargoShipmentNumber"/>
+ <xsd:enumeration value="RepetitivePatternCode"/>
+ <xsd:enumeration value="RepetitiveWaybillCode"/>
+ <xsd:enumeration value="ReplacementAssemblyModelNumber"/>
+ <xsd:enumeration value="ReplacementAssemblySerialNumber"/>
+ <xsd:enumeration value="ReplacementClaimNumber"/>
+ <xsd:enumeration value="ReplacementCustomerReferenceNumber"/>
+ <xsd:enumeration value="ReplacementDrugEnforcementAdministrationNumber"/>
+ <xsd:enumeration value="ReplacingPartNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderRangeEndNumber"/>
+ <xsd:enumeration value="ReplenishmentPurchaseOrderRangeStartNumber"/>
+ <xsd:enumeration value="ReporterIdentification"/>
+ <xsd:enumeration value="ReportingFormNumber"/>
+ <xsd:enumeration value="ReportNumber"/>
+ <xsd:enumeration value="Representation"/>
+ <xsd:enumeration value="RepresentativeIdentificationNumber"/>
+ <xsd:enumeration value="RepricedClaimReferenceNumber"/>
+ <xsd:enumeration value="RepricedLineItemReferenceNumber"/>
+ <xsd:enumeration value="RequestForCancellationNumber"/>
+ <xsd:enumeration value="RequestforQuotationReference"/>
+ <xsd:enumeration value="RequestForQuoteNumber"/>
+ <xsd:enumeration value="RequestNumber"/>
+ <xsd:enumeration value="ReservationNumber"/>
+ <xsd:enumeration value="ReserveAssemblyLineFeedLocation"/>
+ <xsd:enumeration value="ResourceScreeningReference"/>
+ <xsd:enumeration value="ResourceUtilizationGroupNumber"/>
+ <xsd:enumeration value="ResponsetoaRequestforQuotationReference"/>
+ <xsd:enumeration value="RestrictedAvailabilityAuthorization"/>
+ <xsd:enumeration value="RestrictedAvailabilityNumber"/>
+ <xsd:enumeration value="ResubmissionNumber"/>
+ <xsd:enumeration value="ResubmissionReasonCode"/>
+ <xsd:enumeration value="Resubmitnumber"/>
+ <xsd:enumeration value="RetailMerchantsCertificationNumber"/>
+ <xsd:enumeration value="RetirementPlanAccountNumber"/>
+ <xsd:enumeration value="RetirementPlanPolicyNumber"/>
+ <xsd:enumeration value="ReturnableContainerReferenceNumber"/>
+ <xsd:enumeration value="ReturnableContainerSerialNumber"/>
+ <xsd:enumeration value="ReturnedGoodsAuthorizationNumber"/>
+ <xsd:enumeration value="ReturnGoodsBillOfLadingNumber"/>
+ <xsd:enumeration value="ReturnMaterialAuthorizationNumber"/>
+ <xsd:enumeration value="ReturnsNoticeNumber"/>
+ <xsd:enumeration value="RevenueSource"/>
+ <xsd:enumeration value="Review"/>
+ <xsd:enumeration value="ReviewerFileNumber"/>
+ <xsd:enumeration value="ReviewPeriodNumber"/>
+ <xsd:enumeration value="RevisionNumber"/>
+ <xsd:enumeration value="RIF"/>
+ <xsd:enumeration value="RigNumber"/>
+ <xsd:enumeration value="RoadConsignmentNoteNumber"/>
+ <xsd:enumeration value="RouteNumber"/>
+ <xsd:enumeration value="RouteOrderNumberDomestic"/>
+ <xsd:enumeration value="RouteOrderNumberEmergency"/>
+ <xsd:enumeration value="RouteOrderNumberExport"/>
+ <xsd:enumeration value="RoutingInstructionNumber"/>
+ <xsd:enumeration value="RUC"/>
+ <xsd:enumeration value="RuleSection"/>
+ <xsd:enumeration value="RunNumber"/>
+ <xsd:enumeration value="SafekeepingAccountNumber"/>
+ <xsd:enumeration value="SafetyEquipmentCertificate"/>
+ <xsd:enumeration value="SafetyofRadioCertificate"/>
+ <xsd:enumeration value="SafetyofShipCertificate"/>
+ <xsd:enumeration value="SalesOrTerritoryCode"/>
+ <xsd:enumeration value="SalesAllowanceNumber"/>
+ <xsd:enumeration value="SalesDepartmentNumber"/>
+ <xsd:enumeration value="SalesForecastNumber"/>
+ <xsd:enumeration value="SalesOfficeNumber"/>
+ <xsd:enumeration value="SalesPersonNumber"/>
+ <xsd:enumeration value="SalesProgramNumber"/>
+ <xsd:enumeration value="SalesRegionNumber"/>
+ <xsd:enumeration value="SalesReportNumber"/>
+ <xsd:enumeration value="SalesRepresentativeOrderNumber"/>
+ <xsd:enumeration value="SalesResponsibility"/>
+ <xsd:enumeration value="SampleNumber"/>
+ <xsd:enumeration value="Savings"/>
+ <xsd:enumeration value="SBA"/>
+ <xsd:enumeration value="ScaleNumber"/>
+ <xsd:enumeration value="ScanLine"/>
+ <xsd:enumeration value="ScheduleReferenceNumber"/>
+ <xsd:enumeration value="SchemeOrPlanNumber"/>
+ <xsd:enumeration value="SchoolLoanNumber"/>
+ <xsd:enumeration value="SchoolUse"/>
+ <xsd:enumeration value="SealNumber"/>
+ <xsd:enumeration value="SealOffNumber"/>
+ <xsd:enumeration value="SealOnNumber"/>
+ <xsd:enumeration value="SearchKey"/>
+ <xsd:enumeration value="SecondaryCoverageCertificateNumber"/>
+ <xsd:enumeration value="SecondaryCoverageCompanyNumber"/>
+ <xsd:enumeration value="SecondaryCustomsReference"/>
+ <xsd:enumeration value="SecondaryEmployeeIdentificationNumber"/>
+ <xsd:enumeration value="SecondaryHealthInsuranceIdentificationNumber"/>
+ <xsd:enumeration value="SecondaryPolicyNumber"/>
+ <xsd:enumeration value="SecondaryProviderNumber"/>
+ <xsd:enumeration value="SecondarySuffixCodeIndicator"/>
+ <xsd:enumeration value="SecondBeneficiarysReference"/>
+ <xsd:enumeration value="SecretariadeComerciayFamentaIndustrialNumber"/>
+ <xsd:enumeration value="SecretaryofStateAssignedIdentificationNumber"/>
+ <xsd:enumeration value="SectionNumber"/>
+ <xsd:enumeration value="SectionOfTheNationalHousingActCode"/>
+ <xsd:enumeration value="SecurityInstrumentNumber"/>
+ <xsd:enumeration value="SecurityType"/>
+ <xsd:enumeration value="SelfInsuranceIdentificationNumber"/>
+ <xsd:enumeration value="SelfInsurerAuthorizationTypeCode"/>
+ <xsd:enumeration value="SelfInsurerOrganizationType"/>
+ <xsd:enumeration value="SellerLoanNumber"/>
+ <xsd:enumeration value="SellersCatalogueNumber"/>
+ <xsd:enumeration value="SellersCreditMemo"/>
+ <xsd:enumeration value="SellersDebitMemo"/>
+ <xsd:enumeration value="SellersInvoiceNumber"/>
+ <xsd:enumeration value="SellersReferenceNumber"/>
+ <xsd:enumeration value="SellersSaleNumber"/>
+ <xsd:enumeration value="SellingArrangement"/>
+ <xsd:enumeration value="SenderDefinedClause"/>
+ <xsd:enumeration value="SendersClauseNumber"/>
+ <xsd:enumeration value="SendersFileReferenceNumber"/>
+ <xsd:enumeration value="SendersReferenceToTheOriginalMessage"/>
+ <xsd:enumeration value="SendingBankReferenceNumber"/>
+ <xsd:enumeration value="SendingCompanyAuditNumberAutomatedClearinghouseTransfers"/>
+ <xsd:enumeration value="SequenceNumber"/>
+ <xsd:enumeration value="SerialNumber"/>
+ <xsd:enumeration value="ServiceAuthorizationNumber"/>
+ <xsd:enumeration value="ServiceBulletinNumber"/>
+ <xsd:enumeration value="ServiceBureau"/>
+ <xsd:enumeration value="ServiceChangeNumber"/>
+ <xsd:enumeration value="ServiceChargeNumber"/>
+ <xsd:enumeration value="ServiceContractNumber"/>
+ <xsd:enumeration value="ServiceEstimateNumber"/>
+ <xsd:enumeration value="ServiceGroupIdentificationNumber"/>
+ <xsd:enumeration value="ServiceInterruptTrackingNumber"/>
+ <xsd:enumeration value="ServiceOrderNumber"/>
+ <xsd:enumeration value="ServicePerformedCode"/>
+ <xsd:enumeration value="Servicer"/>
+ <xsd:enumeration value="ServiceRequestNumber"/>
+ <xsd:enumeration value="ServicerLoanNumber"/>
+ <xsd:enumeration value="Session"/>
+ <xsd:enumeration value="SetNumber"/>
+ <xsd:enumeration value="Sheet"/>
+ <xsd:enumeration value="ShelfLifeIndicator"/>
+ <xsd:enumeration value="ShipFrom"/>
+ <xsd:enumeration value="ShipmentDestinationCode"/>
+ <xsd:enumeration value="ShipmentOriginCode"/>
+ <xsd:enumeration value="ShipmentReferenceNumber"/>
+ <xsd:enumeration value="ShipNoticeOrManifestNumber"/>
+ <xsd:enumeration value="ShipownersAuthorizationNumber"/>
+ <xsd:enumeration value="ShipperCarOrderNumber"/>
+ <xsd:enumeration value="ShippersBondNumber"/>
+ <xsd:enumeration value="ShippersHazardousNumber"/>
+ <xsd:enumeration value="ShippersOrder"/>
+ <xsd:enumeration value="ShippingLabelSerialNumber"/>
+ <xsd:enumeration value="ShippingNoteNumber"/>
+ <xsd:enumeration value="ShippingUnitIdentification"/>
+ <xsd:enumeration value="ShippingZone"/>
+ <xsd:enumeration value="ShortTermDisabilityPolicyNumber"/>
+ <xsd:enumeration value="ShowIdentification"/>
+ <xsd:enumeration value="SIC"/>
+ <xsd:enumeration value="SID"/>
+ <xsd:enumeration value="SignalCode"/>
+ <xsd:enumeration value="SignalCodeNumber"/>
+ <xsd:enumeration value="SingleTransactionSequenceNumber"/>
+ <xsd:enumeration value="SIRENNumber"/>
+ <xsd:enumeration value="SIRETNumber"/>
+ <xsd:enumeration value="SiteSpecificProceduresTermsAndConditions"/>
+ <xsd:enumeration value="SituationNumber"/>
+ <xsd:enumeration value="SlaughterPlantNumber"/>
+ <xsd:enumeration value="SocialInsuranceNumber"/>
+ <xsd:enumeration value="SocialSecurityNumber"/>
+ <xsd:enumeration value="SocietyofPropertyInformationCompilersandAnalysts"/>
+ <xsd:enumeration value="SoftwareApplicationNumber"/>
+ <xsd:enumeration value="Solicitation"/>
+ <xsd:enumeration value="SortAndSegregate"/>
+ <xsd:enumeration value="SourceDocumentInternalReference"/>
+ <xsd:enumeration value="SpacingUnitOrderNumber"/>
+ <xsd:enumeration value="SpecialApproval"/>
+ <xsd:enumeration value="SpecialBudgetAccountNumber"/>
+ <xsd:enumeration value="SpecialChargeOrAllowanceCode"/>
+ <xsd:enumeration value="SpecialClause"/>
+ <xsd:enumeration value="SpecialGovernmentAccountingClassificationReferenceNumber"/>
+ <xsd:enumeration value="SpecialInstructionsNumber"/>
+ <xsd:enumeration value="SpecialMoveReferenceNumber"/>
+ <xsd:enumeration value="SpecialPackagingInstructionNumber"/>
+ <xsd:enumeration value="SpecialPaymentReferenceNumber"/>
+ <xsd:enumeration value="SpecialProcessingCode"/>
+ <xsd:enumeration value="SpecialQuoteNumber"/>
+ <xsd:enumeration value="SpecialtyLicenseNumber"/>
+ <xsd:enumeration value="SpecificationClassNumber"/>
+ <xsd:enumeration value="SpecificationNumber"/>
+ <xsd:enumeration value="SpecificationRevision"/>
+ <xsd:enumeration value="SpecimenIdentifier"/>
+ <xsd:enumeration value="SplitBookingNumber"/>
+ <xsd:enumeration value="SplitPremiumAuditChangeIdentifier"/>
+ <xsd:enumeration value="SplitShipmentNumber"/>
+ <xsd:enumeration value="SponsorsReferenceNumber"/>
+ <xsd:enumeration value="SpouseTie"/>
+ <xsd:enumeration value="StackTrainIdentification"/>
+ <xsd:enumeration value="Standard"/>
+ <xsd:enumeration value="StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="StandardClause"/>
+ <xsd:enumeration value="StandardIndustryClassificationCode"/>
+ <xsd:enumeration value="StandardNumberOfInspectionDocument"/>
+ <xsd:enumeration value="StandardPointLocationCode"/>
+ <xsd:enumeration value="StandardsCodeNumber"/>
+ <xsd:enumeration value="StandardsNumber"/>
+ <xsd:enumeration value="StandardsVersionNumber"/>
+ <xsd:enumeration value="StandardTransportationCommodityCodeBridgeNumber"/>
+ <xsd:enumeration value="StandardTransportationCommodityCodeReplacementCode"/>
+ <xsd:enumeration value="StartingPackageNumber"/>
+ <xsd:enumeration value="StateAssemblyDistrict"/>
+ <xsd:enumeration value="StateCharterNumber"/>
+ <xsd:enumeration value="StateControlledSubstanceLicenseNumber"/>
+ <xsd:enumeration value="StateCriminalHistoryRepositoryIndividualIdentification"/>
+ <xsd:enumeration value="StateDepartmentI20FormNumber"/>
+ <xsd:enumeration value="StateDepartmentIAP66FormNumber"/>
+ <xsd:enumeration value="StateHazardousWasteEntityIdentifier"/>
+ <xsd:enumeration value="StateIndustrialAccidentProviderNumber"/>
+ <xsd:enumeration value="StateLegislativeDistrict"/>
+ <xsd:enumeration value="StateLicenseIdentificationNumber"/>
+ <xsd:enumeration value="StateLicenseNumber"/>
+ <xsd:enumeration value="StatementNumber"/>
+ <xsd:enumeration value="StatementOfWork"/>
+ <xsd:enumeration value="StateNonResidentViolatorCompact"/>
+ <xsd:enumeration value="StateorProvinceAssignedBusinessRegistryNumber"/>
+ <xsd:enumeration value="StateOrProvinceAssignedEntityIdentification"/>
+ <xsd:enumeration value="StateSalesTaxIdentificationNumber"/>
+ <xsd:enumeration value="StateSenateDistrict"/>
+ <xsd:enumeration value="StateStudentIdentificationNumber"/>
+ <xsd:enumeration value="StateTaxIdentificationNumber"/>
+ <xsd:enumeration value="StatewideCourseNumber"/>
+ <xsd:enumeration value="StationReferenceNumber"/>
+ <xsd:enumeration value="Status"/>
+ <xsd:enumeration value="StatusReportNumber"/>
+ <xsd:enumeration value="StockCertificateNumber"/>
+ <xsd:enumeration value="StockExchangeCode"/>
+ <xsd:enumeration value="StockExchangeCompanyIdentifier"/>
+ <xsd:enumeration value="StockKeepingUnitNumber"/>
+ <xsd:enumeration value="StockNumber"/>
+ <xsd:enumeration value="StopSequenceNumber"/>
+ <xsd:enumeration value="StorageInformationCode"/>
+ <xsd:enumeration value="StoreNumber"/>
+ <xsd:enumeration value="Study"/>
+ <xsd:enumeration value="SubassemblyNumber"/>
+ <xsd:enumeration value="SubcontractLineItemNumber"/>
+ <xsd:enumeration value="SubcontractNumber"/>
+ <xsd:enumeration value="SubcontractorDataRequirements"/>
+ <xsd:enumeration value="SubdayNumber"/>
+ <xsd:enumeration value="SubdivisionIdentifier"/>
+ <xsd:enumeration value="SubexhibitLineItemNumber"/>
+ <xsd:enumeration value="SubFile"/>
+ <xsd:enumeration value="SubhouseBillOfLading"/>
+ <xsd:enumeration value="SubjectPropertyNonSaleReferenceNumber"/>
+ <xsd:enumeration value="SubjectPropertyReferenceNumber"/>
+ <xsd:enumeration value="SubjectPropertyVerificationSource"/>
+ <xsd:enumeration value="SublineofInsurance"/>
+ <xsd:enumeration value="SubmissionNumber"/>
+ <xsd:enumeration value="SubmitterIdentificationNumber"/>
+ <xsd:enumeration value="SubscriberAuthorizationNumber"/>
+ <xsd:enumeration value="SubscriberNumber"/>
+ <xsd:enumeration value="Subservicer"/>
+ <xsd:enumeration value="SubServicerLoanNumber"/>
+ <xsd:enumeration value="SubsistenceIdentificationNumber"/>
+ <xsd:enumeration value="SubstantivelyConsolidatedCase"/>
+ <xsd:enumeration value="SubstituteAirWaybillNumber"/>
+ <xsd:enumeration value="SubstituteManufacturersPartNumber"/>
+ <xsd:enumeration value="SubstituteNationalStockNumber"/>
+ <xsd:enumeration value="SubstitutePartNumber"/>
+ <xsd:enumeration value="SubSubhouseBillOfLading"/>
+ <xsd:enumeration value="SuccessorAccount"/>
+ <xsd:enumeration value="Suffix"/>
+ <xsd:enumeration value="SuperintendenciadeInversionesExtranjerasNumber"/>
+ <xsd:enumeration value="SupervisoryAppraiserCertificationNumber"/>
+ <xsd:enumeration value="SupplementalAccountNumber"/>
+ <xsd:enumeration value="SupplementalAgreementAuthority"/>
+ <xsd:enumeration value="SupplementalClaimNumber"/>
+ <xsd:enumeration value="SupplementNumber"/>
+ <xsd:enumeration value="Supplier"/>
+ <xsd:enumeration value="SupplierReplacement"/>
+ <xsd:enumeration value="SupplierDocumentIdentificationNumber"/>
+ <xsd:enumeration value="SuppliersControlNumber"/>
+ <xsd:enumeration value="SuppliersCreditClaimReferenceNumber"/>
+ <xsd:enumeration value="SupportingDocumentNumber"/>
+ <xsd:enumeration value="SuretyBondNumber"/>
+ <xsd:enumeration value="SuspensionIdentifier"/>
+ <xsd:enumeration value="SwapOrderNumber"/>
+ <xsd:enumeration value="SWIFT"/>
+ <xsd:enumeration value="SWIFTMT100"/>
+ <xsd:enumeration value="SWIFTMT202"/>
+ <xsd:enumeration value="SWIFTConfirmationNumber"/>
+ <xsd:enumeration value="SymbolNumber"/>
+ <xsd:enumeration value="SymbolNumberForMilestoneOrLOBReports"/>
+ <xsd:enumeration value="SystematizedNomenclatureofHumanandVeterinaryMedicine"/>
+ <xsd:enumeration value="SystemeInformatiquePourLeRepertoireDesEntreprises"/>
+ <xsd:enumeration value="SystemeInformatiquePourLeRepertoireDesEtablissements"/>
+ <xsd:enumeration value="SystemNumber"/>
+ <xsd:enumeration value="Tag"/>
+ <xsd:enumeration value="TankNumber"/>
+ <xsd:enumeration value="TariffNumber"/>
+ <xsd:enumeration value="TariffPageNumber"/>
+ <xsd:enumeration value="TariffRuleNumber"/>
+ <xsd:enumeration value="TariffSectionNumber"/>
+ <xsd:enumeration value="TariffSuffixNumber"/>
+ <xsd:enumeration value="TariffSupplementNumber"/>
+ <xsd:enumeration value="TaskOrder"/>
+ <xsd:enumeration value="TaxAgencyNumber"/>
+ <xsd:enumeration value="TaxExchangeCode"/>
+ <xsd:enumeration value="TaxExemptionLicenceNumber"/>
+ <xsd:enumeration value="TaxExemptNumber"/>
+ <xsd:enumeration value="TaxFiling"/>
+ <xsd:enumeration value="TaxFormCode"/>
+ <xsd:enumeration value="TaxingAuthorityIdentificationNumber"/>
+ <xsd:enumeration value="TaxLicenseExemption"/>
+ <xsd:enumeration value="TaxLienJurisdiction"/>
+ <xsd:enumeration value="TaxRegistrationNumber"/>
+ <xsd:enumeration value="TaxScheduleCode"/>
+ <xsd:enumeration value="TaxShelterNumber"/>
+ <xsd:enumeration value="TaxWorksheet"/>
+ <xsd:enumeration value="TCN"/>
+ <xsd:enumeration value="TeamAssignmentNumber"/>
+ <xsd:enumeration value="TechnicalDocumentationType"/>
+ <xsd:enumeration value="TechnicalDocumentNumber"/>
+ <xsd:enumeration value="TechnicalInformationPackage"/>
+ <xsd:enumeration value="TechnicalOrderNumber"/>
+ <xsd:enumeration value="TechnicalPhaseReference"/>
+ <xsd:enumeration value="TechnicalRegulation"/>
+ <xsd:enumeration value="TelecommunicationCircuitSupplementalID"/>
+ <xsd:enumeration value="TelexMessageNumber"/>
+ <xsd:enumeration value="TemplateSequenceNumber"/>
+ <xsd:enumeration value="Tenor"/>
+ <xsd:enumeration value="Term"/>
+ <xsd:enumeration value="TerminalCode"/>
+ <xsd:enumeration value="TerminalOperatorNumber"/>
+ <xsd:enumeration value="TerminalReleaseOrderNumber"/>
+ <xsd:enumeration value="TerminationFiling"/>
+ <xsd:enumeration value="TesterIdentification"/>
+ <xsd:enumeration value="TestReportNumber"/>
+ <xsd:enumeration value="TestSpecificationNumber"/>
+ <xsd:enumeration value="TextElementIdentifierDeletionReference"/>
+ <xsd:enumeration value="TheaterScreenNumber"/>
+ <xsd:enumeration value="ThirdBanksReferenceNumber"/>
+ <xsd:enumeration value="ThirdBanksReference"/>
+ <xsd:enumeration value="ThirdPartyAdministratorClaimNumber"/>
+ <xsd:enumeration value="ThirdPartyNoteHolderIdentification"/>
+ <xsd:enumeration value="ThirdPartyOrganizationAuthorizationNumber"/>
+ <xsd:enumeration value="ThirdPartyOriginatorNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderItemNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderNumber"/>
+ <xsd:enumeration value="ThirdPartyPurchaseOrderReleaseNumber"/>
+ <xsd:enumeration value="ThirdPartyReferenceNumber"/>
+ <xsd:enumeration value="ThroughBillOfLadingNumber"/>
+ <xsd:enumeration value="TicketNumber"/>
+ <xsd:enumeration value="TimeFailure"/>
+ <xsd:enumeration value="TirCarnetNumber"/>
+ <xsd:enumeration value="TIRNumber"/>
+ <xsd:enumeration value="TitleCompanyCodeBookReference"/>
+ <xsd:enumeration value="TitleDocumentSchedule"/>
+ <xsd:enumeration value="TitlePolicyNumber"/>
+ <xsd:enumeration value="TitleReference"/>
+ <xsd:enumeration value="TitleXIXIdentifierNumber"/>
+ <xsd:enumeration value="TokyoShokoResearchBusinessIdentifier"/>
+ <xsd:enumeration value="TollBillingTelephoneReferenceNumber"/>
+ <xsd:enumeration value="TotalCycleNumber"/>
+ <xsd:enumeration value="TotalOrderCycleNumber"/>
+ <xsd:enumeration value="TownshipNumber"/>
+ <xsd:enumeration value="ToxicologyID"/>
+ <xsd:enumeration value="TracerActionRequestNumber"/>
+ <xsd:enumeration value="TrackingNumber"/>
+ <xsd:enumeration value="Tract"/>
+ <xsd:enumeration value="TraderAccountNumber"/>
+ <xsd:enumeration value="TradingPartnerIdentificationNumber"/>
+ <xsd:enumeration value="TrailerTypeQualifier"/>
+ <xsd:enumeration value="TrailerUseAgreements"/>
+ <xsd:enumeration value="TrainingFlightNumber"/>
+ <xsd:enumeration value="TransactionCategoryOrType"/>
+ <xsd:enumeration value="TransactionReferenceNumber"/>
+ <xsd:enumeration value="TransferNumber"/>
+ <xsd:enumeration value="TransitGuaranteeNumber"/>
+ <xsd:enumeration value="TransponderNumber"/>
+ <xsd:enumeration value="TransportationAccountCode"/>
+ <xsd:enumeration value="TransportationAccountNumber"/>
+ <xsd:enumeration value="TransportationControlNumber"/>
+ <xsd:enumeration value="TransportationExportationNoForInBondMovement"/>
+ <xsd:enumeration value="TransportationPriorityNumber"/>
+ <xsd:enumeration value="TransportContractReferenceNumber"/>
+ <xsd:enumeration value="TransportCostsReferenceNumber"/>
+ <xsd:enumeration value="TransportDocumentNumber"/>
+ <xsd:enumeration value="TransportEquipmentReturnReference"/>
+ <xsd:enumeration value="TransportEquipmentStrippingOrder"/>
+ <xsd:enumeration value="TransportEquipmentStuffingOrder"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReference"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReferenceNumber"/>
+ <xsd:enumeration value="TransportEquipmentSurveyReportNumber"/>
+ <xsd:enumeration value="TransportRoute"/>
+ <xsd:enumeration value="TransportSectionReferenceNumber"/>
+ <xsd:enumeration value="TravelManifest"/>
+ <xsd:enumeration value="TreatyIdentifier"/>
+ <xsd:enumeration value="TreatyNumber"/>
+ <xsd:enumeration value="TrialLocationCode"/>
+ <xsd:enumeration value="Tripleback"/>
+ <xsd:enumeration value="TruckersBillOfLading"/>
+ <xsd:enumeration value="Trustee"/>
+ <xsd:enumeration value="TSRBusinessIdentifier"/>
+ <xsd:enumeration value="TypeOfComment"/>
+ <xsd:enumeration value="TypeOfEscrowNumber"/>
+ <xsd:enumeration value="TypeOfHouseholdGoodsCode"/>
+ <xsd:enumeration value="TypeOfLawSuit"/>
+ <xsd:enumeration value="TypeOfOutstandingJudgment"/>
+ <xsd:enumeration value="TypeOfScienceCode"/>
+ <xsd:enumeration value="U.S.DefenseFederalAcquisitionRegulationSupplement"/>
+ <xsd:enumeration value="U.S.DepartmentOfVeteransAffairsAcquisitionRegulation"/>
+ <xsd:enumeration value="U.S.GovernmentTransportationControlNumber"/>
+ <xsd:enumeration value="UltimateConsignee"/>
+ <xsd:enumeration value="UltimateCustomersOrderNumber"/>
+ <xsd:enumeration value="UltimateCustomersReferenceNumber"/>
+ <xsd:enumeration value="UnacceptableSourceDUNSNumber"/>
+ <xsd:enumeration value="UnacceptableSourcePurchaserID"/>
+ <xsd:enumeration value="UnacceptableSourceSupplierID"/>
+ <xsd:enumeration value="UnderwriterIdentificationNumber"/>
+ <xsd:enumeration value="UnderwritingAlertReferenceCode"/>
+ <xsd:enumeration value="UNDG"/>
+ <xsd:enumeration value="UnemploymentInsuranceNumber"/>
+ <xsd:enumeration value="UniformCommercialCodeFilingCollateralNumber"/>
+ <xsd:enumeration value="UniformResourceLocator"/>
+ <xsd:enumeration value="UnionNumber"/>
+ <xsd:enumeration value="UniqueClaimsReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueConsignmentIdentifier"/>
+ <xsd:enumeration value="UniqueConsignmentReferenceNumber"/>
+ <xsd:enumeration value="UniqueCurracReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueMarketReference"/>
+ <xsd:enumeration value="UniqueReinacReferenceNumberOfTheSender"/>
+ <xsd:enumeration value="UniqueSupplierIdentificationNumber"/>
+ <xsd:enumeration value="UnitedNationsHazardousClassificationNumber"/>
+ <xsd:enumeration value="UnitedStatesGovernmentVisaNumber"/>
+ <xsd:enumeration value="UnitedStatesStandardMetropolitanStatisticalAreaCode"/>
+ <xsd:enumeration value="UnitLoadDeviceIdentificationNumber"/>
+ <xsd:enumeration value="UnitNumber"/>
+ <xsd:enumeration value="UnitPropertyNumber"/>
+ <xsd:enumeration value="UnitReliefNumber"/>
+ <xsd:enumeration value="UnitReportPeriod"/>
+ <xsd:enumeration value="UnitReportPeriodID"/>
+ <xsd:enumeration value="UnitTrain"/>
+ <xsd:enumeration value="UniversalRailroadRevenueWaybillIdentifiedNumber"/>
+ <xsd:enumeration value="UniversalTransverseMercatorEast"/>
+ <xsd:enumeration value="UniversalTransverseMercatorNorth"/>
+ <xsd:enumeration value="UniversalTransverseMercatorZone"/>
+ <xsd:enumeration value="UnpaidInstallmentReferenceNumber"/>
+ <xsd:enumeration value="UpperSerialNumberOfRange"/>
+ <xsd:enumeration value="UpstreamShipperContractNumber"/>
+ <xsd:enumeration value="USCFR"/>
+ <xsd:enumeration value="USCS"/>
+ <xsd:enumeration value="USCustomsServiceAntiDumpingDutyCaseNumber"/>
+ <xsd:enumeration value="USCustomsServiceBindingRulingNumber"/>
+ <xsd:enumeration value="USCustomsServiceCommercialDescription"/>
+ <xsd:enumeration value="USCustomsServiceCountervailingDutyCaseNumber"/>
+ <xsd:enumeration value="USCustomsServiceEntryNumber"/>
+ <xsd:enumeration value="USCustomsServiceEntryTypeCode"/>
+ <xsd:enumeration value="USCustomsServicePreApprovalRulingNumber"/>
+ <xsd:enumeration value="USCustomsServicePreClassificationRulingNumber"/>
+ <xsd:enumeration value="USCustomsServiceStatementNumber"/>
+ <xsd:enumeration value="USDOEAndNCES"/>
+ <xsd:enumeration value="USDOTBondSuretyCode"/>
+ <xsd:enumeration value="UserID"/>
+ <xsd:enumeration value="UserIdentification"/>
+ <xsd:enumeration value="USFCCImportCondition"/>
+ <xsd:enumeration value="USFederalAcquisitionRegulation"/>
+ <xsd:enumeration value="USFederalInformationResourcesManagementRegulation"/>
+ <xsd:enumeration value="USFoodAndDrugAdministrationEstablishmentIndicator"/>
+ <xsd:enumeration value="USGeneralServicesAdministrationRegulation"/>
+ <xsd:enumeration value="USGovernmentAgencyNumber"/>
+ <xsd:enumeration value="ValueAddedTaxRegistrationNumber"/>
+ <xsd:enumeration value="VatRegistrationNumber"/>
+ <xsd:enumeration value="VehicleBusinessUseQualifier"/>
+ <xsd:enumeration value="VehicleLicenceNumber"/>
+ <xsd:enumeration value="VehicleRadiusofOperationQualifier"/>
+ <xsd:enumeration value="VehicleRelatedServicesReferenceNumber"/>
+ <xsd:enumeration value="VehicleSizeClassQualifier"/>
+ <xsd:enumeration value="VendorAbbreviationCode"/>
+ <xsd:enumeration value="VendorChangeIdentificationCode"/>
+ <xsd:enumeration value="VendorChangeProcedureCode"/>
+ <xsd:enumeration value="VendorContractNumber"/>
+ <xsd:enumeration value="VendorIDNumber"/>
+ <xsd:enumeration value="VendorOrderNumberSuffix"/>
+ <xsd:enumeration value="VendorProductNumber"/>
+ <xsd:enumeration value="VendorsPreviousJobNumber"/>
+ <xsd:enumeration value="VendorTerms"/>
+ <xsd:enumeration value="VerificationSourceCode"/>
+ <xsd:enumeration value="Version"/>
+ <xsd:enumeration value="VersionCodeLocal"/>
+ <xsd:enumeration value="VersionCodeNational"/>
+ <xsd:enumeration value="VerticalCoordinate"/>
+ <xsd:enumeration value="Vessel"/>
+ <xsd:enumeration value="VesselAgentNumber"/>
+ <xsd:enumeration value="VesselIdentification"/>
+ <xsd:enumeration value="VesselName"/>
+ <xsd:enumeration value="VeteransAdministrationOriginatorIdentification"/>
+ <xsd:enumeration value="VeteransAffairsCaseNumber"/>
+ <xsd:enumeration value="VIN"/>
+ <xsd:enumeration value="VisaType"/>
+ <xsd:enumeration value="VolumeNumber"/>
+ <xsd:enumeration value="VolumePurchaseAgreementNumber"/>
+ <xsd:enumeration value="VoucherNumber"/>
+ <xsd:enumeration value="VoyageNumber"/>
+ <xsd:enumeration value="WageDetermination"/>
+ <xsd:enumeration value="Waiver"/>
+ <xsd:enumeration value="Ward"/>
+ <xsd:enumeration value="WarehouseEntryNumber"/>
+ <xsd:enumeration value="WarehousePickTicketNumber"/>
+ <xsd:enumeration value="WarehouseReceiptNumber"/>
+ <xsd:enumeration value="WarehouseStorageLocationNumber"/>
+ <xsd:enumeration value="Warrant"/>
+ <xsd:enumeration value="WarrantyCoverageCode"/>
+ <xsd:enumeration value="WarrantyRegistrationNumber"/>
+ <xsd:enumeration value="WaybillNumber"/>
+ <xsd:enumeration value="WeaponSystemNumber"/>
+ <xsd:enumeration value="WeightAgreementNumber"/>
+ <xsd:enumeration value="WellClassificationCode"/>
+ <xsd:enumeration value="WellNumber"/>
+ <xsd:enumeration value="WithdrawalAccountNumber"/>
+ <xsd:enumeration value="WithdrawalRecord"/>
+ <xsd:enumeration value="WoolIdentificationNumber"/>
+ <xsd:enumeration value="WoolTaxReferenceNumber"/>
+ <xsd:enumeration value="WorkBreakdownStructure"/>
+ <xsd:enumeration value="WorkCandidateSequenceNumber"/>
+ <xsd:enumeration value="WorkCenter"/>
+ <xsd:enumeration value="WorkingShiftNumber"/>
+ <xsd:enumeration value="WorkItemQuantityDetermination"/>
+ <xsd:enumeration value="WorkOrderNumber"/>
+ <xsd:enumeration value="WorkPackage"/>
+ <xsd:enumeration value="WorkShift"/>
+ <xsd:enumeration value="WorksiteNumber"/>
+ <xsd:enumeration value="WorkTaskChargeNumber"/>
+ <xsd:enumeration value="WorkTeam"/>
+ <xsd:enumeration value="YardPosition"/>
+ <xsd:enumeration value="Zone"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ItemDetail">
+ <xsd:sequence>
+ <xsd:element ref="BaseItemDetail"/>
+ <xsd:element minOccurs="0" ref="PricingDetail"/>
+ <xsd:element minOccurs="0" ref="DeliveryDetail"/>
+ <xsd:element minOccurs="0" ref="RoundTripInformation"/>
+ <xsd:element minOccurs="0" name="LineItemNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfStructuredNote"/>
+ <xsd:element minOccurs="0" ref="ListOfNameValueSet"/>
+ <xsd:element minOccurs="0" name="LineItemAttachments">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAttachment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemDetail" type="ItemDetail"/>
+ <xsd:complexType name="BaseItemDetail">
+ <xsd:sequence>
+ <xsd:element ref="LineItemNum"/>
+ <xsd:element minOccurs="0" ref="LineItemType"/>
+ <xsd:element minOccurs="0" name="ParentItemNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="LineItemNumberReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ItemIdentifiers"/>
+ <xsd:element minOccurs="0" ref="ListOfDimension"/>
+ <xsd:element minOccurs="0" name="TotalQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="MaxBackOrderQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfQuantityCoded"/>
+ <xsd:element minOccurs="0" name="OffCatalogFlag" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" ref="CatalogReference"/>
+ <xsd:element minOccurs="0" name="ItemContractReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfContractItem"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ListOfItemReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CountryOfOrigin">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Country"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CountryOfDestination">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Country"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="FinalRecipient">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfPartyCoded"/>
+ <xsd:element minOccurs="0" ref="ConditionsOfSale"/>
+ <xsd:element minOccurs="0" name="HazardousMaterials">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Hazardous"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="BaseItemDetail" type="BaseItemDetail"/>
+ <xsd:complexType name="LineItemNum">
+ <xsd:sequence>
+ <xsd:element name="BuyerLineItemNum" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="SellerLineItemNum" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LineItemNum" type="LineItemNum"/>
+ <xsd:complexType name="LineItemType">
+ <xsd:sequence>
+ <xsd:element name="LineItemTypeCoded" type="LineItemTypeCode"/>
+ <xsd:element minOccurs="0" name="LineItemTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LineItemType" type="LineItemType"/>
+ <xsd:simpleType name="LineItemTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Item"/>
+ <xsd:enumeration value="ComponentGroup"/>
+ <xsd:enumeration value="TextItem"/>
+ <xsd:enumeration value="Other"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="LineItemNumberReference">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:int">
+ <xsd:attribute name="LineItemNumTypeCoded" type="LineItemNumTypeCode" use="optional" default="Buyer"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="LineItemNumberReference" type="LineItemNumberReference"/>
+ <xsd:simpleType name="LineItemNumTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="Seller"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ItemIdentifiers">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="PartNumbers"/>
+ <xsd:element minOccurs="0" name="Service" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ItemDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfItemCharacteristic"/>
+ <xsd:element minOccurs="0" name="CommodityCode">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="Category"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemIdentifiers" type="ItemIdentifiers"/>
+ <xsd:complexType name="PartNumbers">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="SellerPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartNum"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="BuyerPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="PartNum"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ManufacturerPartNumber"/>
+ <xsd:element minOccurs="0" name="StandardPartNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SubstitutePartNumbers">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OtherItemIdentifiers">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PartNumbers" type="PartNumbers"/>
+ <xsd:complexType name="PartNum">
+ <xsd:sequence>
+ <xsd:element name="PartID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="PartIDExt" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RevisionNumber" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PartNum" type="PartNum"/>
+ <xsd:complexType name="ManufacturerPartNumber">
+ <xsd:complexContent>
+ <xsd:extension base="PartNum">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ManufacturerID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ManufacturerName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="ManufacturerPartNumber" type="ManufacturerPartNumber"/>
+ <xsd:complexType name="ProductIdentifierCoded">
+ <xsd:sequence>
+ <xsd:element name="ProductIdentifierQualifierCoded" type="ProductIdentifierQualifierCode"/>
+ <xsd:element minOccurs="0" name="ProductIdentifierQualifierCodedOther" type="xsd:string"/>
+ <xsd:element name="ProductIdentifier" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ProductIdentifierExt" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ProductIdentifierCoded" type="ProductIdentifierCoded"/>
+ <xsd:simpleType name="ProductIdentifierQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalProductIdentificationAssignedByTheManufacturer"/>
+ <xsd:enumeration value="AdvertisingPackageIdentificationCode"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AggregationCode"/>
+ <xsd:enumeration value="AirTransportationAssociationProprietaryRightsCode"/>
+ <xsd:enumeration value="AllocationMethodologyIdentificationCode"/>
+ <xsd:enumeration value="AlternateISBN"/>
+ <xsd:enumeration value="AmericanDentalAssociationCodes"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsAssembly"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsPart"/>
+ <xsd:enumeration value="AmericanTruckingAssociationsSystem"/>
+ <xsd:enumeration value="Anniversary"/>
+ <xsd:enumeration value="ApplicationCompletionMethod"/>
+ <xsd:enumeration value="ApplicationState"/>
+ <xsd:enumeration value="AppraisalProductType"/>
+ <xsd:enumeration value="AppraisalService"/>
+ <xsd:enumeration value="ARNICPartNumber"/>
+ <xsd:enumeration value="Assembly"/>
+ <xsd:enumeration value="AssemblyLotNumber"/>
+ <xsd:enumeration value="AssetCategory"/>
+ <xsd:enumeration value="AssetNumber"/>
+ <xsd:enumeration value="AssetType"/>
+ <xsd:enumeration value="AssortabilityCode"/>
+ <xsd:enumeration value="AuthorCode"/>
+ <xsd:enumeration value="AuthorizedPartsListNumber"/>
+ <xsd:enumeration value="AutomaticTransmissionSerialNumber"/>
+ <xsd:enumeration value="AuxiliaryTransmissionSerialNumber"/>
+ <xsd:enumeration value="AuxillaryTransmission"/>
+ <xsd:enumeration value="AxleRatio"/>
+ <xsd:enumeration value="AxleSerialNumber"/>
+ <xsd:enumeration value="Backing"/>
+ <xsd:enumeration value="BaleNumber"/>
+ <xsd:enumeration value="Bar-CodedSerialNumber"/>
+ <xsd:enumeration value="BatchNumber"/>
+ <xsd:enumeration value="BeamNumber"/>
+ <xsd:enumeration value="BenefitID"/>
+ <xsd:enumeration value="BeverageCommonCode"/>
+ <xsd:enumeration value="BillboardsCommercial"/>
+ <xsd:enumeration value="BillCreditCode"/>
+ <xsd:enumeration value="BillSubgroupCode"/>
+ <xsd:enumeration value="BindingCode"/>
+ <xsd:enumeration value="BrandOrLabel"/>
+ <xsd:enumeration value="BrokerPriceOpinionService"/>
+ <xsd:enumeration value="BusBodySerialNumber"/>
+ <xsd:enumeration value="BuyerGroundShadeIdentifier"/>
+ <xsd:enumeration value="BuyersCatalogNumber"/>
+ <xsd:enumeration value="BuyersColor"/>
+ <xsd:enumeration value="BuyersEndProductNumber"/>
+ <xsd:enumeration value="BuyersEngineeringChangeLevelNumber"/>
+ <xsd:enumeration value="BuyersInternalProductGroupCode"/>
+ <xsd:enumeration value="BuyersItemNumber"/>
+ <xsd:enumeration value="BuyersPartNumber"/>
+ <xsd:enumeration value="BuyersQualifierForSize"/>
+ <xsd:enumeration value="BuyersSizeCode"/>
+ <xsd:enumeration value="BuyersStyleNumber"/>
+ <xsd:enumeration value="BuyersSublineItemNumber"/>
+ <xsd:enumeration value="CAGECode"/>
+ <xsd:enumeration value="CandidateOil"/>
+ <xsd:enumeration value="Carry-OverPartNumber"/>
+ <xsd:enumeration value="Case"/>
+ <xsd:enumeration value="CatalogNumber"/>
+ <xsd:enumeration value="Channel"/>
+ <xsd:enumeration value="ChassisSerialNumber"/>
+ <xsd:enumeration value="ChemicalAbstractServiceRegistryNumber"/>
+ <xsd:enumeration value="Classification"/>
+ <xsd:enumeration value="ClassOfContractCode"/>
+ <xsd:enumeration value="CLEICode"/>
+ <xsd:enumeration value="CognizanceSymbol"/>
+ <xsd:enumeration value="ColdRollNumber"/>
+ <xsd:enumeration value="Color"/>
+ <xsd:enumeration value="CombinedNCCMAOrBankServiceCode"/>
+ <xsd:enumeration value="CommissionIdentifier"/>
+ <xsd:enumeration value="CommissionYear"/>
+ <xsd:enumeration value="CommitteeForUniformSecurityIdentificationProcedureNumber"/>
+ <xsd:enumeration value="CommodityGrouping"/>
+ <xsd:enumeration value="CommodityName"/>
+ <xsd:enumeration value="CommonLanguageEquipmentIdentifier"/>
+ <xsd:enumeration value="Company-OwnedUnitTrainNumber"/>
+ <xsd:enumeration value="CompanyPartNumber"/>
+ <xsd:enumeration value="CompatibleCutNumber"/>
+ <xsd:enumeration value="CompensationAllocationCode"/>
+ <xsd:enumeration value="CompensationTypeCode"/>
+ <xsd:enumeration value="CompletionNumber"/>
+ <xsd:enumeration value="ConceptCode"/>
+ <xsd:enumeration value="ConfigurationItemIdentifier"/>
+ <xsd:enumeration value="ConnectorType"/>
+ <xsd:enumeration value="Continuation"/>
+ <xsd:enumeration value="ContractActivityCode"/>
+ <xsd:enumeration value="ContractBreakdown"/>
+ <xsd:enumeration value="ContractChangeAuthorizationType"/>
+ <xsd:enumeration value="ContractNumber"/>
+ <xsd:enumeration value="ContractorEstablishmentCode"/>
+ <xsd:enumeration value="ContractTransferReasonCode"/>
+ <xsd:enumeration value="ContributionYear"/>
+ <xsd:enumeration value="ControlNumber"/>
+ <xsd:enumeration value="CountryFromWhichProcured"/>
+ <xsd:enumeration value="CountryOfOriginCode"/>
+ <xsd:enumeration value="CouponFamilyCode"/>
+ <xsd:enumeration value="CouponNumber"/>
+ <xsd:enumeration value="CoverageRiskType"/>
+ <xsd:enumeration value="CoverageType"/>
+ <xsd:enumeration value="CurrentProceduralTerminologyCodes"/>
+ <xsd:enumeration value="CustomerCompanyRegistryNumber"/>
+ <xsd:enumeration value="CustomerOrderNumber"/>
+ <xsd:enumeration value="CustomerProvidedEquipment"/>
+ <xsd:enumeration value="CustomsArticleNumber"/>
+ <xsd:enumeration value="CutNumber"/>
+ <xsd:enumeration value="DataCategory"/>
+ <xsd:enumeration value="DepartmentOfDefenseIdentificationCode"/>
+ <xsd:enumeration value="DepositItemNumber"/>
+ <xsd:enumeration value="DesignNumber"/>
+ <xsd:enumeration value="DeviceFamily"/>
+ <xsd:enumeration value="DeviceType"/>
+ <xsd:enumeration value="DiagnosisCodePointer"/>
+ <xsd:enumeration value="DieNumber"/>
+ <xsd:enumeration value="DiscontinuedPartNumber"/>
+ <xsd:enumeration value="DiscountGrouping"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="DividendUse"/>
+ <xsd:enumeration value="DocumentIdentificationCode"/>
+ <xsd:enumeration value="Drawing"/>
+ <xsd:enumeration value="DrawingRevisionNumber"/>
+ <xsd:enumeration value="DrugUPCConsumerPackageCode1-4-6-1"/>
+ <xsd:enumeration value="DrugUPCShippingContainerCode1-2-4-6-1"/>
+ <xsd:enumeration value="DunAndBradstreetStandardProductAndServiceCode"/>
+ <xsd:enumeration value="DyeLotNumber"/>
+ <xsd:enumeration value="EAN2-5-5-1"/>
+ <xsd:enumeration value="EAN-99In-StoreCouponCode"/>
+ <xsd:enumeration value="EditionCode"/>
+ <xsd:enumeration value="EndItemNumber"/>
+ <xsd:enumeration value="End-ItemDescription"/>
+ <xsd:enumeration value="EngineDisplacementIdentification"/>
+ <xsd:enumeration value="EngineeringChangeLevel"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="EngineSerialNumber"/>
+ <xsd:enumeration value="EquipmentCodePerCOPASStandard"/>
+ <xsd:enumeration value="EquipmentHierarchicalSequenceIdentifier"/>
+ <xsd:enumeration value="EquipmentIdentificationNumber"/>
+ <xsd:enumeration value="EquipmentLocation"/>
+ <xsd:enumeration value="EquipmentType"/>
+ <xsd:enumeration value="EventType"/>
+ <xsd:enumeration value="ExchangedPartOrAssemblyOrProduct"/>
+ <xsd:enumeration value="Exhibit"/>
+ <xsd:enumeration value="ExhibitIdentifier"/>
+ <xsd:enumeration value="ExhibitLineItemNumber"/>
+ <xsd:enumeration value="ExpendableContainerIdentification"/>
+ <xsd:enumeration value="ExpenseIdentifier"/>
+ <xsd:enumeration value="FAAServiceBulletinNumber"/>
+ <xsd:enumeration value="FabricPiecesPerRoll"/>
+ <xsd:enumeration value="FailedSubassemblyModelNumber"/>
+ <xsd:enumeration value="FailedSubassemblySerialNumber"/>
+ <xsd:enumeration value="FannieMaeAffordableLendingProductCode"/>
+ <xsd:enumeration value="FannieMaeProjectCondominiumClassificationCode"/>
+ <xsd:enumeration value="Feature"/>
+ <xsd:enumeration value="FederalSupplyClassification"/>
+ <xsd:enumeration value="FifthWheelSerialNumber"/>
+ <xsd:enumeration value="FinalTestLotNumber"/>
+ <xsd:enumeration value="FinancialPhase"/>
+ <xsd:enumeration value="FinishLotNumber"/>
+ <xsd:enumeration value="FinishNumber"/>
+ <xsd:enumeration value="FinishOrHandStandardReference"/>
+ <xsd:enumeration value="FirePump"/>
+ <xsd:enumeration value="FirstPriorIdentifier"/>
+ <xsd:enumeration value="FormerPublisher"/>
+ <xsd:enumeration value="FormNumber"/>
+ <xsd:enumeration value="FreddieMacAffordableLendingProductCode"/>
+ <xsd:enumeration value="FreddieMacProjectCondominiumClassificationCode"/>
+ <xsd:enumeration value="FrontAxle-Rear"/>
+ <xsd:enumeration value="FrontAxleDrivenSerialNumber"/>
+ <xsd:enumeration value="FrontAxleNonDrivenSerialNumber"/>
+ <xsd:enumeration value="FrontAxleSerialNumber"/>
+ <xsd:enumeration value="FuelTankSerialNumber"/>
+ <xsd:enumeration value="Fund"/>
+ <xsd:enumeration value="FundAbbreviation"/>
+ <xsd:enumeration value="FundManager"/>
+ <xsd:enumeration value="FundSub-Advisor"/>
+ <xsd:enumeration value="FundType"/>
+ <xsd:enumeration value="GASFLOWInvoicePostingCode"/>
+ <xsd:enumeration value="GASFLOWProductorServiceChargeCode"/>
+ <xsd:enumeration value="Gathering"/>
+ <xsd:enumeration value="GearRatio"/>
+ <xsd:enumeration value="GeneralSpecificationNumber"/>
+ <xsd:enumeration value="GenericNameDescription"/>
+ <xsd:enumeration value="GliderKit"/>
+ <xsd:enumeration value="GradeCode"/>
+ <xsd:enumeration value="GradeName"/>
+ <xsd:enumeration value="GrainDirection"/>
+ <xsd:enumeration value="GraphicsIndustryBarCode"/>
+ <xsd:enumeration value="GroundShadeStandardReference"/>
+ <xsd:enumeration value="GroupID"/>
+ <xsd:enumeration value="GroupQualifierCode"/>
+ <xsd:enumeration value="GTIN"/>
+ <xsd:enumeration value="HarmonisedSystem"/>
+ <xsd:enumeration value="HCPCS"/>
+ <xsd:enumeration value="HeatNumber"/>
+ <xsd:enumeration value="HIBC-HealthIndustryBarCode"/>
+ <xsd:enumeration value="HIBCSupplierLabelingStandardPrimaryDataMessage"/>
+ <xsd:enumeration value="HIECProductOrServiceCode"/>
+ <xsd:enumeration value="HotRollNumber"/>
+ <xsd:enumeration value="ICD-9-CM-Procedure"/>
+ <xsd:enumeration value="IgnitionKeyNumber"/>
+ <xsd:enumeration value="Imprint-TrademarkCodeOfSubsidiary"/>
+ <xsd:enumeration value="IndustryCommodityCode"/>
+ <xsd:enumeration value="InformationMediaType"/>
+ <xsd:enumeration value="Ingredient"/>
+ <xsd:enumeration value="InsurancePlanDescriptionCharacteristics"/>
+ <xsd:enumeration value="InsurersFundCode"/>
+ <xsd:enumeration value="InterchangeabilityCode"/>
+ <xsd:enumeration value="InteriorColorNumber"/>
+ <xsd:enumeration value="InternalNumber"/>
+ <xsd:enumeration value="InternationalArticleNumberingAssociation"/>
+ <xsd:enumeration value="ICD-9-CM-Diagnosis"/>
+ <xsd:enumeration value="InternationalHarmonizedCommodityCode"/>
+ <xsd:enumeration value="InternationalStandardBookNumber"/>
+ <xsd:enumeration value="InvestmentFundType"/>
+ <xsd:enumeration value="IRSQualificationCode"/>
+ <xsd:enumeration value="ISBN"/>
+ <xsd:enumeration value="ISSN"/>
+ <xsd:enumeration value="ItemManagementCode"/>
+ <xsd:enumeration value="ItemTypeNumber"/>
+ <xsd:enumeration value="JobNumber"/>
+ <xsd:enumeration value="JobSequenceNumber"/>
+ <xsd:enumeration value="JointLifeType"/>
+ <xsd:enumeration value="JurisdictionSpecificProcedureAndSupplyCodes"/>
+ <xsd:enumeration value="KanbanPlanNumber"/>
+ <xsd:enumeration value="LaboratorySampleIdentification"/>
+ <xsd:enumeration value="LaboratoryTestConditionCode"/>
+ <xsd:enumeration value="LaborGroup"/>
+ <xsd:enumeration value="LeaseNumber"/>
+ <xsd:enumeration value="LibraryOfCongressCode"/>
+ <xsd:enumeration value="LifeOrAnnuityProductCode"/>
+ <xsd:enumeration value="LifeOrAnnuityServiceFeatures"/>
+ <xsd:enumeration value="LiftGateSerialNumber"/>
+ <xsd:enumeration value="LineOfAuthority"/>
+ <xsd:enumeration value="LineOfBusiness"/>
+ <xsd:enumeration value="LoadSequence"/>
+ <xsd:enumeration value="LocallyAssignedControlNumber"/>
+ <xsd:enumeration value="LocalStockNumber"/>
+ <xsd:enumeration value="LocationCode"/>
+ <xsd:enumeration value="LOINCCodes"/>
+ <xsd:enumeration value="LotNumber"/>
+ <xsd:enumeration value="LotPricingUnitNumber"/>
+ <xsd:enumeration value="MachineNumber"/>
+ <xsd:enumeration value="MaintenanceIndexPageReferenceNumber"/>
+ <xsd:enumeration value="MajorProductOrMaterialOrMachineType"/>
+ <xsd:enumeration value="ManualTransmissionSerialNumber"/>
+ <xsd:enumeration value="Manufacturer"/>
+ <xsd:enumeration value="ManufacturersArticleNumber"/>
+ <xsd:enumeration value="ManufacturersPartNumber"/>
+ <xsd:enumeration value="MarketProgramCode"/>
+ <xsd:enumeration value="MaterialCode"/>
+ <xsd:enumeration value="MaterialControlCode"/>
+ <xsd:enumeration value="MaterialDischargeNumber"/>
+ <xsd:enumeration value="MeasurementTypeCode"/>
+ <xsd:enumeration value="MedicalInformationBureauAuthorization"/>
+ <xsd:enumeration value="MedicalStopLossCoverageCodes"/>
+ <xsd:enumeration value="MedicalStopLossLevelCodes"/>
+ <xsd:enumeration value="MedicalStopLossProductLineCodes"/>
+ <xsd:enumeration value="MedicationCode"/>
+ <xsd:enumeration value="MEMAProductTypeCode"/>
+ <xsd:enumeration value="MethodOfDeliveryCode"/>
+ <xsd:enumeration value="MilestoneEventNumber"/>
+ <xsd:enumeration value="MilitaryStandard"/>
+ <xsd:enumeration value="MILSPECNumber"/>
+ <xsd:enumeration value="ModelNumber"/>
+ <xsd:enumeration value="MortgageCreditDataOrderType"/>
+ <xsd:enumeration value="MortgageInsuranceProductCodeOrNumber"/>
+ <xsd:enumeration value="MortgageProductCode"/>
+ <xsd:enumeration value="MortgageUnderwritingType"/>
+ <xsd:enumeration value="MotorVehicleIdNumber"/>
+ <xsd:enumeration value="MotorVehicle-LineDesignator"/>
+ <xsd:enumeration value="MovementTypeCode"/>
+ <xsd:enumeration value="NationalDrugCode"/>
+ <xsd:enumeration value="NationalDrugCode4-4-2Format"/>
+ <xsd:enumeration value="NationalDrugCode5-3-2Format"/>
+ <xsd:enumeration value="NationalDrugCode5-4-1Format"/>
+ <xsd:enumeration value="NationalDrugCode5-4-2Format"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCode"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCodeIn4-6Format"/>
+ <xsd:enumeration value="NationalHealthRelatedItemCodeIn5-5Format"/>
+ <xsd:enumeration value="NationalProductGroupCode"/>
+ <xsd:enumeration value="NationalRetailFederationColorCode"/>
+ <xsd:enumeration value="NationalRetailFederationSizeCode"/>
+ <xsd:enumeration value="NationalStockNumber"/>
+ <xsd:enumeration value="NDC"/>
+ <xsd:enumeration value="NewMicrocode"/>
+ <xsd:enumeration value="NewReplacementPartOrAssemblyDefective"/>
+ <xsd:enumeration value="NextHigherAssemblyNumber"/>
+ <xsd:enumeration value="NextHigherUsedAssembly"/>
+ <xsd:enumeration value="NonforfeitureOption"/>
+ <xsd:enumeration value="Non-ResaleableItemExcludingDepositNumber"/>
+ <xsd:enumeration value="NSN-NorthAtlanticTreatyOrganizationStockNumber"/>
+ <xsd:enumeration value="NUBCUB82Codes"/>
+ <xsd:enumeration value="NUBCUB92Codes"/>
+ <xsd:enumeration value="NumberOfPositionsOnMachine"/>
+ <xsd:enumeration value="ObligationAuthorityNumber"/>
+ <xsd:enumeration value="ObsoletePartNumber"/>
+ <xsd:enumeration value="OfferNumber"/>
+ <xsd:enumeration value="OldMicrocode"/>
+ <xsd:enumeration value="OldUPCOrEANCaseCode"/>
+ <xsd:enumeration value="OldUPCOrEANConsumerPackageCode"/>
+ <xsd:enumeration value="OldUPCOrEANModuleCode"/>
+ <xsd:enumeration value="OldUPCOrEANMultipackCode"/>
+ <xsd:enumeration value="OperatorAssignedPropertyIdentification"/>
+ <xsd:enumeration value="Opposite-HandPartNumber"/>
+ <xsd:enumeration value="OpticalCableCode"/>
+ <xsd:enumeration value="OpticalIndustryProductCode"/>
+ <xsd:enumeration value="OriginalEquipmentNumber"/>
+ <xsd:enumeration value="OutsideProductionOperationSheetNumber"/>
+ <xsd:enumeration value="PackageTypeCode"/>
+ <xsd:enumeration value="PackagingDrawing"/>
+ <xsd:enumeration value="PackagingSpecificationNumber"/>
+ <xsd:enumeration value="PackNumber"/>
+ <xsd:enumeration value="PartDrawing"/>
+ <xsd:enumeration value="PartNumber"/>
+ <xsd:enumeration value="PartNumberDescription"/>
+ <xsd:enumeration value="PartReferenceNumber"/>
+ <xsd:enumeration value="PatternNumber"/>
+ <xsd:enumeration value="PASCCEC-GoodsAndServicesTaxForwarded"/>
+ <xsd:enumeration value="PASCCEC-GoodsAndServicesTaxNotApplicable"/>
+ <xsd:enumeration value="PASC-NonTubularCode"/>
+ <xsd:enumeration value="PASCOMC-GoodsAndServicesTaxForwarded"/>
+ <xsd:enumeration value="PASCOMC-GoodsAndServicesTaxNotApplicable"/>
+ <xsd:enumeration value="PetroleumAccountantsSocietyOfCanadaTubularCode"/>
+ <xsd:enumeration value="Phase"/>
+ <xsd:enumeration value="PiecesInRoll"/>
+ <xsd:enumeration value="PiggybackCommercial"/>
+ <xsd:enumeration value="PipelineTransactionCode"/>
+ <xsd:enumeration value="PlanCode"/>
+ <xsd:enumeration value="PlantEquipmentNumber"/>
+ <xsd:enumeration value="Ply"/>
+ <xsd:enumeration value="PolicyForm"/>
+ <xsd:enumeration value="Position"/>
+ <xsd:enumeration value="PreferredManufacturer"/>
+ <xsd:enumeration value="PreferredNationalStockNumber"/>
+ <xsd:enumeration value="PreferredPartNumber"/>
+ <xsd:enumeration value="PremiumRateType"/>
+ <xsd:enumeration value="PremiumUse"/>
+ <xsd:enumeration value="PreviousCarrier"/>
+ <xsd:enumeration value="PreviousSampleIdentification"/>
+ <xsd:enumeration value="PriceLookUpNumber"/>
+ <xsd:enumeration value="PrimeContractorPartNumber"/>
+ <xsd:enumeration value="PrintColorStandardReference"/>
+ <xsd:enumeration value="PrintOrDrawing"/>
+ <xsd:enumeration value="ProcessNumber"/>
+ <xsd:enumeration value="ProductOrServiceIdentificationNumber"/>
+ <xsd:enumeration value="ProductChangeNoticeNumber"/>
+ <xsd:enumeration value="ProductDateCode"/>
+ <xsd:enumeration value="ProductIdAttributeCode"/>
+ <xsd:enumeration value="ProductTypeCode"/>
+ <xsd:enumeration value="ProductVersionNumber"/>
+ <xsd:enumeration value="ProgramCode"/>
+ <xsd:enumeration value="ProgramDescriptionIdentifier"/>
+ <xsd:enumeration value="ProgramLevel"/>
+ <xsd:enumeration value="PromotionalVariantNumber"/>
+ <xsd:enumeration value="PropertyAndCasualtyServiceCode"/>
+ <xsd:enumeration value="PublicationNumber"/>
+ <xsd:enumeration value="PublisherCode"/>
+ <xsd:enumeration value="PurchaseOrderNumber"/>
+ <xsd:enumeration value="PurchasersItemCode"/>
+ <xsd:enumeration value="PurchasersOrderLineNumber"/>
+ <xsd:enumeration value="PurposeOfInsurance"/>
+ <xsd:enumeration value="RackNumber"/>
+ <xsd:enumeration value="RadiatorSerialNumber"/>
+ <xsd:enumeration value="Railroad-OwnedUnitTrainNumber"/>
+ <xsd:enumeration value="RandomWeightAggregationCode"/>
+ <xsd:enumeration value="RateDetailCard"/>
+ <xsd:enumeration value="RealEstatePropertyInformationService"/>
+ <xsd:enumeration value="RearAxleExtendedTag"/>
+ <xsd:enumeration value="RearAxleFrontRearDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleMiddle"/>
+ <xsd:enumeration value="RearAxlePusher"/>
+ <xsd:enumeration value="RearAxleRearDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleRearNonDrivenSerialNumber"/>
+ <xsd:enumeration value="RearAxleSerialNumber"/>
+ <xsd:enumeration value="RearAxleTag"/>
+ <xsd:enumeration value="ReclamationProcess"/>
+ <xsd:enumeration value="RecordKeepingOrModelYear"/>
+ <xsd:enumeration value="ReeferSerialNumber"/>
+ <xsd:enumeration value="ReelNumber"/>
+ <xsd:enumeration value="ReelType"/>
+ <xsd:enumeration value="ReferenceOil"/>
+ <xsd:enumeration value="RefinedProductCode"/>
+ <xsd:enumeration value="RelatedModelNumber"/>
+ <xsd:enumeration value="RelatedModelType"/>
+ <xsd:enumeration value="RelatedPolicyIdentification"/>
+ <xsd:enumeration value="RelativeValueUnits"/>
+ <xsd:enumeration value="ReleaseNumber"/>
+ <xsd:enumeration value="ReligiousRetailNon-BookItem"/>
+ <xsd:enumeration value="RepairFromProductCode"/>
+ <xsd:enumeration value="RepairInductionIdentifier"/>
+ <xsd:enumeration value="RepairTagNumber"/>
+ <xsd:enumeration value="ReplacedPartNumber"/>
+ <xsd:enumeration value="ReplacementNationalStockNumber"/>
+ <xsd:enumeration value="ReplacementProductNumber"/>
+ <xsd:enumeration value="ReplacementSubassemblyModelNumber"/>
+ <xsd:enumeration value="ReplacementSubassemblySerialNumber"/>
+ <xsd:enumeration value="ResourceNumber"/>
+ <xsd:enumeration value="RetailPLU"/>
+ <xsd:enumeration value="ReturnableContainerNumber"/>
+ <xsd:enumeration value="ReturnCode"/>
+ <xsd:enumeration value="RollNumber"/>
+ <xsd:enumeration value="RollSequenceNumber"/>
+ <xsd:enumeration value="RSKNumber"/>
+ <xsd:enumeration value="RunNumber"/>
+ <xsd:enumeration value="SalesPresentationID"/>
+ <xsd:enumeration value="SampleNumber"/>
+ <xsd:enumeration value="SchematicDiagramReferenceNumber"/>
+ <xsd:enumeration value="SeatSerialNumber"/>
+ <xsd:enumeration value="SecondaryPly"/>
+ <xsd:enumeration value="SecondPriorIdentifier"/>
+ <xsd:enumeration value="SectionPrintNumber"/>
+ <xsd:enumeration value="SellersDateCode"/>
+ <xsd:enumeration value="SellersLotNumber"/>
+ <xsd:enumeration value="SerialItemAndContributionIdentifier"/>
+ <xsd:enumeration value="SerialNumber"/>
+ <xsd:enumeration value="SeriesIdentifier"/>
+ <xsd:enumeration value="ServiceCodePerCOPASStandard"/>
+ <xsd:enumeration value="ServiceControlIdentification"/>
+ <xsd:enumeration value="ServiceFeatureID"/>
+ <xsd:enumeration value="ServiceRendered"/>
+ <xsd:enumeration value="ServiceRequested"/>
+ <xsd:enumeration value="SetNumber"/>
+ <xsd:enumeration value="SettlementOrPayoutOption"/>
+ <xsd:enumeration value="Shelf-LifeActionCode"/>
+ <xsd:enumeration value="Shelf-LifeCode"/>
+ <xsd:enumeration value="ShiftWorked"/>
+ <xsd:enumeration value="SideUpOrSideDown"/>
+ <xsd:enumeration value="SkillCode"/>
+ <xsd:enumeration value="SKU"/>
+ <xsd:enumeration value="SlabNumber"/>
+ <xsd:enumeration value="SleeperBoxKeyNumber"/>
+ <xsd:enumeration value="SleeperBoxSerialNumber"/>
+ <xsd:enumeration value="SNOMED"/>
+ <xsd:enumeration value="SoftwareRevisionNumber"/>
+ <xsd:enumeration value="SourceOfDepositCode"/>
+ <xsd:enumeration value="SourceOfLeadCode"/>
+ <xsd:enumeration value="SpecialMaterialIdentificationCode"/>
+ <xsd:enumeration value="SSCC-18AndApplicationIdentifier"/>
+ <xsd:enumeration value="StandardGroupOfProducts-MixedAssortment"/>
+ <xsd:enumeration value="StandardIndustrialClassificationCode"/>
+ <xsd:enumeration value="StateLabelCode"/>
+ <xsd:enumeration value="StateSampleIdentification"/>
+ <xsd:enumeration value="StockNumber"/>
+ <xsd:enumeration value="StyleNumber"/>
+ <xsd:enumeration value="SublineItemNumber"/>
+ <xsd:enumeration value="SubmissionNumber"/>
+ <xsd:enumeration value="SubsistenceIdentificationNumber"/>
+ <xsd:enumeration value="SubstituteProductNumber"/>
+ <xsd:enumeration value="SubtopicLevel"/>
+ <xsd:enumeration value="SupersededPartNumber"/>
+ <xsd:enumeration value="SupersededPurchaseOrderNumber"/>
+ <xsd:enumeration value="SupplierBrandCode"/>
+ <xsd:enumeration value="SupplierCompanyRegistryNumber"/>
+ <xsd:enumeration value="SuppliersArticleNumber"/>
+ <xsd:enumeration value="SuppliersSupplierArticleNumber"/>
+ <xsd:enumeration value="SurfaceFinish"/>
+ <xsd:enumeration value="SyntheticLube"/>
+ <xsd:enumeration value="SystemIdentifier"/>
+ <xsd:enumeration value="TACTCommodityCode"/>
+ <xsd:enumeration value="TaxCode"/>
+ <xsd:enumeration value="TechnicalManualNumber"/>
+ <xsd:enumeration value="TechnicalOrderNumber"/>
+ <xsd:enumeration value="TechnicalPhase"/>
+ <xsd:enumeration value="TelecommunicationsCircuitId"/>
+ <xsd:enumeration value="TelecommunicationsIndustryServiceCode"/>
+ <xsd:enumeration value="TelecomServiceType"/>
+ <xsd:enumeration value="TelephoneIndustryManufacturerCode"/>
+ <xsd:enumeration value="TestedMaterialIdentificationNumber"/>
+ <xsd:enumeration value="Tex"/>
+ <xsd:enumeration value="ThirdPriorIdentifier"/>
+ <xsd:enumeration value="TimeCompliantTechnicalOrder"/>
+ <xsd:enumeration value="TitleCode"/>
+ <xsd:enumeration value="TopicLevel"/>
+ <xsd:enumeration value="TradeInIdentifier"/>
+ <xsd:enumeration value="TransferCaseSerialNumber"/>
+ <xsd:enumeration value="TransmissionSerialNumber"/>
+ <xsd:enumeration value="TransportGroupNumber"/>
+ <xsd:enumeration value="TreasuryManagementAssociation"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCode"/>
+ <xsd:enumeration value="TreasuryManagementAssociationServiceCodeAndBankServiceCode"/>
+ <xsd:enumeration value="TreatmentCodes"/>
+ <xsd:enumeration value="TruckBodySerialNumber"/>
+ <xsd:enumeration value="TypeSelvage"/>
+ <xsd:enumeration value="UCCOrEAN-128CouponExtendedCode"/>
+ <xsd:enumeration value="UltimateCustomersArticleNumber"/>
+ <xsd:enumeration value="UNCCS"/>
+ <xsd:enumeration value="UnderwritingMethodOfDirectWriter"/>
+ <xsd:enumeration value="UniformStockSymbolSystemCodeNumber"/>
+ <xsd:enumeration value="UniversalProductNumber"/>
+ <xsd:enumeration value="UNNumberDangerousGoods"/>
+ <xsd:enumeration value="UPC"/>
+ <xsd:enumeration value="UPCOrEAN"/>
+ <xsd:enumeration value="UPCCaseCodeNumber1-1-5-5"/>
+ <xsd:enumeration value="UPCConsumerPackageCode1-5-5"/>
+ <xsd:enumeration value="UPCConsumerPackageCode1-5-5-1"/>
+ <xsd:enumeration value="UPCCouponCode1-5-5-1"/>
+ <xsd:enumeration value="UPCOrEANCaseCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANConsumerPackageCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANCouponCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANModuleCode2-5-5"/>
+ <xsd:enumeration value="UPCOrEANMultipackCode"/>
+ <xsd:enumeration value="UPCOrEANShippingContainerCode1-2-5-5-1"/>
+ <xsd:enumeration value="UPCShippingContainerCode1-2-5-5"/>
+ <xsd:enumeration value="UPCSuffix"/>
+ <xsd:enumeration value="UPCSuffix-DefinesPackingVariations"/>
+ <xsd:enumeration value="User-DefinedShippingContainerIdentifier"/>
+ <xsd:enumeration value="UVMRPMLines"/>
+ <xsd:enumeration value="UVMULine"/>
+ <xsd:enumeration value="VariableMeasureProductCode"/>
+ <xsd:enumeration value="VaryItemProductNumber"/>
+ <xsd:enumeration value="VehicleMaintenanceReportingStandards"/>
+ <xsd:enumeration value="VendorAlphanumericSizeCode"/>
+ <xsd:enumeration value="VendorColor"/>
+ <xsd:enumeration value="VendorGroundShadeIdentifier"/>
+ <xsd:enumeration value="VendorItemNumber"/>
+ <xsd:enumeration value="VendorsCatalogNumber"/>
+ <xsd:enumeration value="VendorsItemNumber"/>
+ <xsd:enumeration value="VendorsPartNumber"/>
+ <xsd:enumeration value="VendorsBasicUnitNumber"/>
+ <xsd:enumeration value="VendorsEngineeringChangeLevelNumber"/>
+ <xsd:enumeration value="VendorsOrderNumber"/>
+ <xsd:enumeration value="VendorSpecificationNumber"/>
+ <xsd:enumeration value="VendorsStyleNumber"/>
+ <xsd:enumeration value="VendorsSupplementalItemNumber"/>
+ <xsd:enumeration value="Vintage"/>
+ <xsd:enumeration value="VolumeSet"/>
+ <xsd:enumeration value="VolumeTypeIdentificationCode"/>
+ <xsd:enumeration value="VolumeUsageIdentificationCode"/>
+ <xsd:enumeration value="WaferLotIdentifier"/>
+ <xsd:enumeration value="WellNumber"/>
+ <xsd:enumeration value="WheelChairLiftSerialNumber"/>
+ <xsd:enumeration value="WoolenCut"/>
+ <xsd:enumeration value="WoolenRun"/>
+ <xsd:enumeration value="WorkTaskNumber"/>
+ <xsd:enumeration value="WorkUnitNumber"/>
+ <xsd:enumeration value="WorldCode"/>
+ <xsd:enumeration value="YarnCount-English"/>
+ <xsd:enumeration value="YarnCount-Metric"/>
+ <xsd:enumeration value="YarnCountWorsted"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfProductIdentifierCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ProductIdentifierCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfProductIdentifierCoded" type="ListOfProductIdentifierCoded"/>
+ <xsd:complexType name="ListOfItemCharacteristic">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ItemCharacteristic"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfItemCharacteristic" type="ListOfItemCharacteristic"/>
+ <xsd:complexType name="ItemCharacteristic">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ItemCharacteristicCoded" type="ItemCharacteristicCode"/>
+ <xsd:element minOccurs="0" name="ItemCharacteristicCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SurfaceLayerPositionCoded" type="SurfaceLayerPositionCode"/>
+ <xsd:element minOccurs="0" name="SurfaceLayerPositionCodedOther" type="xsd:string"/>
+ <xsd:element name="ItemCharacteristicValue" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Identifier"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ <xsd:element minOccurs="0" ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemCharacteristic" type="ItemCharacteristic"/>
+ <xsd:simpleType name="ItemCharacteristicCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalSectorialCharacteristics"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AlcoholBeverageClass"/>
+ <xsd:enumeration value="AlcoholBeverageType"/>
+ <xsd:enumeration value="Alloy"/>
+ <xsd:enumeration value="AnatomicalOriginOfSample"/>
+ <xsd:enumeration value="Appearance"/>
+ <xsd:enumeration value="Artist"/>
+ <xsd:enumeration value="AssemblyRequired"/>
+ <xsd:enumeration value="Author"/>
+ <xsd:enumeration value="BalanceOutArticle"/>
+ <xsd:enumeration value="BasisWeightSize"/>
+ <xsd:enumeration value="Behind-the-CounterDrugs"/>
+ <xsd:enumeration value="BeverageAge"/>
+ <xsd:enumeration value="BeverageBrand"/>
+ <xsd:enumeration value="BeverageCategory"/>
+ <xsd:enumeration value="BeverageContainerCharacteristics"/>
+ <xsd:enumeration value="BeverageFlavour"/>
+ <xsd:enumeration value="BeverageSegment"/>
+ <xsd:enumeration value="Binding"/>
+ <xsd:enumeration value="BottomholeLocationMethod"/>
+ <xsd:enumeration value="BottomholePressureMethod"/>
+ <xsd:enumeration value="BrandGroup"/>
+ <xsd:enumeration value="BrandGroup-AGroupingOfSimilarBrands"/>
+ <xsd:enumeration value="BureauofAlcoholTobaccoAndFirearmsClassCode"/>
+ <xsd:enumeration value="BureauOfAlcoholTobaccoAndFirearmsTypeCode"/>
+ <xsd:enumeration value="BuyersColorDescription"/>
+ <xsd:enumeration value="BuyersItemSizeDescription"/>
+ <xsd:enumeration value="Casing-Liner-TubingType"/>
+ <xsd:enumeration value="CasingOrLinerType"/>
+ <xsd:enumeration value="CertificateOfConformity"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="ChemicalFamilyName"/>
+ <xsd:enumeration value="Chemistry"/>
+ <xsd:enumeration value="CID-CommercialItemDescription"/>
+ <xsd:enumeration value="Coating"/>
+ <xsd:enumeration value="CoatingOrPaintSystemCode"/>
+ <xsd:enumeration value="CoatingOrPaintSystemName"/>
+ <xsd:enumeration value="Collateral"/>
+ <xsd:enumeration value="CollectionMethodCode"/>
+ <xsd:enumeration value="Color"/>
+ <xsd:enumeration value="Color-LowerBody"/>
+ <xsd:enumeration value="Color-UpperBody"/>
+ <xsd:enumeration value="CommercialStatus"/>
+ <xsd:enumeration value="CommonChemicalName"/>
+ <xsd:enumeration value="CompanyFieldCode"/>
+ <xsd:enumeration value="ComplianceMethod"/>
+ <xsd:enumeration value="Composer"/>
+ <xsd:enumeration value="ConditionedCode"/>
+ <xsd:enumeration value="ConstructionMethod"/>
+ <xsd:enumeration value="ConsumableResource"/>
+ <xsd:enumeration value="ConsumerInstructions"/>
+ <xsd:enumeration value="ControlItem"/>
+ <xsd:enumeration value="ControlledSubstance"/>
+ <xsd:enumeration value="ControlledSubstance-Class2"/>
+ <xsd:enumeration value="ControlledSubstance-Class3Narcotic"/>
+ <xsd:enumeration value="ControlledSubstance-Class3NNon-narcotic"/>
+ <xsd:enumeration value="ControlledSubstance-Class4"/>
+ <xsd:enumeration value="ControlledSubstance-Class5"/>
+ <xsd:enumeration value="CoordinateDescriptionCode"/>
+ <xsd:enumeration value="Coordinates"/>
+ <xsd:enumeration value="CorrosionResistance"/>
+ <xsd:enumeration value="Coupling"/>
+ <xsd:enumeration value="CurrentArticle"/>
+ <xsd:enumeration value="CurrentArticleSpares"/>
+ <xsd:enumeration value="CustomsSpecifications"/>
+ <xsd:enumeration value="DamageCode"/>
+ <xsd:enumeration value="DamageFault"/>
+ <xsd:enumeration value="Denier"/>
+ <xsd:enumeration value="Density"/>
+ <xsd:enumeration value="Dimensional"/>
+ <xsd:enumeration value="DirectionalIndicator"/>
+ <xsd:enumeration value="Dispersion"/>
+ <xsd:enumeration value="DosageForm"/>
+ <xsd:enumeration value="DrugEfficacy"/>
+ <xsd:enumeration value="DrugEfficacyStudyImplementation"/>
+ <xsd:enumeration value="DyeLot"/>
+ <xsd:enumeration value="DyeLotDescription"/>
+ <xsd:enumeration value="EdgeTreatment"/>
+ <xsd:enumeration value="Edition"/>
+ <xsd:enumeration value="Editor"/>
+ <xsd:enumeration value="Electrical"/>
+ <xsd:enumeration value="ElectronicallyCleaned"/>
+ <xsd:enumeration value="ElectronicField"/>
+ <xsd:enumeration value="Ends-Slitting-Splitting-Cutting"/>
+ <xsd:enumeration value="EndTreatment"/>
+ <xsd:enumeration value="EndUseApplication"/>
+ <xsd:enumeration value="Engine"/>
+ <xsd:enumeration value="EnginewithTransmission"/>
+ <xsd:enumeration value="Equipment"/>
+ <xsd:enumeration value="EscrowCode"/>
+ <xsd:enumeration value="EuropeanCommunityRiskClass"/>
+ <xsd:enumeration value="Fabric"/>
+ <xsd:enumeration value="FabricDescription"/>
+ <xsd:enumeration value="FailureAnalysisProcess"/>
+ <xsd:enumeration value="FEDSPEC-FederalSpecification"/>
+ <xsd:enumeration value="FED-STD-FederalStandard"/>
+ <xsd:enumeration value="Fiber"/>
+ <xsd:enumeration value="FibreTow"/>
+ <xsd:enumeration value="FieldCode-EIAOrDOD"/>
+ <xsd:enumeration value="FieldTest"/>
+ <xsd:enumeration value="Filament"/>
+ <xsd:enumeration value="Filter"/>
+ <xsd:enumeration value="Finish"/>
+ <xsd:enumeration value="FinishOrSurfaceRoughness"/>
+ <xsd:enumeration value="Flavor"/>
+ <xsd:enumeration value="Flow"/>
+ <xsd:enumeration value="Fluid"/>
+ <xsd:enumeration value="FoldConfiguration"/>
+ <xsd:enumeration value="Font"/>
+ <xsd:enumeration value="ForecastDeviation"/>
+ <xsd:enumeration value="Forming"/>
+ <xsd:enumeration value="Formula"/>
+ <xsd:enumeration value="Fragrance"/>
+ <xsd:enumeration value="Fuel"/>
+ <xsd:enumeration value="FunctionalPerformance"/>
+ <xsd:enumeration value="FurtherIdentifyingCharacteristic"/>
+ <xsd:enumeration value="GeneralDescription"/>
+ <xsd:enumeration value="GeneralMerchandise"/>
+ <xsd:enumeration value="GeneralProductForm"/>
+ <xsd:enumeration value="GenericDrug"/>
+ <xsd:enumeration value="Goods"/>
+ <xsd:enumeration value="Grade"/>
+ <xsd:enumeration value="GrainDirection"/>
+ <xsd:enumeration value="GrapeVariety"/>
+ <xsd:enumeration value="HazardousMaterial"/>
+ <xsd:enumeration value="HazardRatingSystem"/>
+ <xsd:enumeration value="HealthAndBeautyAids"/>
+ <xsd:enumeration value="HeatTreatOrAnneal"/>
+ <xsd:enumeration value="Hydraulics"/>
+ <xsd:enumeration value="Ingredient"/>
+ <xsd:enumeration value="InitialSample"/>
+ <xsd:enumeration value="Injectables"/>
+ <xsd:enumeration value="Key-Word"/>
+ <xsd:enumeration value="Kit"/>
+ <xsd:enumeration value="Labour"/>
+ <xsd:enumeration value="LabourDoubleTime"/>
+ <xsd:enumeration value="LabourOvertime"/>
+ <xsd:enumeration value="LeadOrCopperSampleType"/>
+ <xsd:enumeration value="LeasedResource"/>
+ <xsd:enumeration value="LimitingOperation"/>
+ <xsd:enumeration value="Luster"/>
+ <xsd:enumeration value="MachineRun"/>
+ <xsd:enumeration value="Magnetic"/>
+ <xsd:enumeration value="MajorGrade"/>
+ <xsd:enumeration value="ManufacturingMethod"/>
+ <xsd:enumeration value="ManufacturingProcess"/>
+ <xsd:enumeration value="MarketSegment"/>
+ <xsd:enumeration value="Marking"/>
+ <xsd:enumeration value="Material"/>
+ <xsd:enumeration value="MaterialClassification"/>
+ <xsd:enumeration value="MaterialDescription"/>
+ <xsd:enumeration value="MaterialResource"/>
+ <xsd:enumeration value="MaterialStatus-OutsideProcessor"/>
+ <xsd:enumeration value="Mechanical"/>
+ <xsd:enumeration value="MedicalSupplies"/>
+ <xsd:enumeration value="Metallographic"/>
+ <xsd:enumeration value="MILSPEC-MilitarySpecification"/>
+ <xsd:enumeration value="MMSBLM-IndianLandPropertyOrUnitNumber"/>
+ <xsd:enumeration value="Moisture"/>
+ <xsd:enumeration value="Multi-Media"/>
+ <xsd:enumeration value="MusicStyle"/>
+ <xsd:enumeration value="MutuallyDefined"/>
+ <xsd:enumeration value="NewArticle"/>
+ <xsd:enumeration value="Non-HazardousMaterial"/>
+ <xsd:enumeration value="Non-PrescriptionDrug"/>
+ <xsd:enumeration value="NonRecurringResource"/>
+ <xsd:enumeration value="Nutrition"/>
+ <xsd:enumeration value="ObsoleteArticle"/>
+ <xsd:enumeration value="Odor"/>
+ <xsd:enumeration value="Odorized"/>
+ <xsd:enumeration value="Options"/>
+ <xsd:enumeration value="Orientation"/>
+ <xsd:enumeration value="OtherDirectResource"/>
+ <xsd:enumeration value="OtherPhysicalDescription"/>
+ <xsd:enumeration value="Over-the-CounterDrug"/>
+ <xsd:enumeration value="PackageIntegrity"/>
+ <xsd:enumeration value="Parameter"/>
+ <xsd:enumeration value="Pattern"/>
+ <xsd:enumeration value="PercentageOfAlcohol"/>
+ <xsd:enumeration value="PerforationContinuityIndicator"/>
+ <xsd:enumeration value="PerforationInterval"/>
+ <xsd:enumeration value="PerforationType"/>
+ <xsd:enumeration value="Physical"/>
+ <xsd:enumeration value="PhysicalForm"/>
+ <xsd:enumeration value="PhysicalForm-Aerosol"/>
+ <xsd:enumeration value="PhysicalForm-AsDiluted"/>
+ <xsd:enumeration value="PhysicalForm-Concentrate"/>
+ <xsd:enumeration value="PhysicalForm-Emulsion"/>
+ <xsd:enumeration value="PhysicalForm-Gas"/>
+ <xsd:enumeration value="PhysicalForm-Liquid"/>
+ <xsd:enumeration value="PhysicalForm-Powder"/>
+ <xsd:enumeration value="PhysicalForm-Semisolid"/>
+ <xsd:enumeration value="PhysicalForm-Solid"/>
+ <xsd:enumeration value="PipeCoupling"/>
+ <xsd:enumeration value="PipelineStream"/>
+ <xsd:enumeration value="PrecautionaryInstructions"/>
+ <xsd:enumeration value="PrescriptionDrug"/>
+ <xsd:enumeration value="PresentationEffect"/>
+ <xsd:enumeration value="Preservative"/>
+ <xsd:enumeration value="PrimaryGrape"/>
+ <xsd:enumeration value="PrintOrientation"/>
+ <xsd:enumeration value="PrivateLabelName"/>
+ <xsd:enumeration value="ProcessActionTaken"/>
+ <xsd:enumeration value="ProcessOrProductionUnit"/>
+ <xsd:enumeration value="Product"/>
+ <xsd:enumeration value="ProductApplication"/>
+ <xsd:enumeration value="ProductDataBaseManagementDescription"/>
+ <xsd:enumeration value="ProductLifeCycle"/>
+ <xsd:enumeration value="Program"/>
+ <xsd:enumeration value="ProjectSubject"/>
+ <xsd:enumeration value="PromotionalEvent"/>
+ <xsd:enumeration value="PromotionalOffer"/>
+ <xsd:enumeration value="Proof"/>
+ <xsd:enumeration value="Proprietary"/>
+ <xsd:enumeration value="PublicInformation"/>
+ <xsd:enumeration value="Publisher"/>
+ <xsd:enumeration value="PureForm"/>
+ <xsd:enumeration value="Put-upDescription"/>
+ <xsd:enumeration value="Quality"/>
+ <xsd:enumeration value="QualityAssuranceStatus"/>
+ <xsd:enumeration value="Quality-QualityLevel"/>
+ <xsd:enumeration value="RecordingMedium"/>
+ <xsd:enumeration value="RecurringResource"/>
+ <xsd:enumeration value="Recycle"/>
+ <xsd:enumeration value="RefurbishedArticle"/>
+ <xsd:enumeration value="RegulatoryOrStateDistrict"/>
+ <xsd:enumeration value="Regulatory-StateOrEntityCode"/>
+ <xsd:enumeration value="ReinstatedArticle"/>
+ <xsd:enumeration value="RejectionReason"/>
+ <xsd:enumeration value="ReservoirCode-Company"/>
+ <xsd:enumeration value="ResultsMethodCode"/>
+ <xsd:enumeration value="RevisedArticle"/>
+ <xsd:enumeration value="RevisedDesign"/>
+ <xsd:enumeration value="RouteOfAdministration"/>
+ <xsd:enumeration value="SampleType"/>
+ <xsd:enumeration value="SecondaryGrape"/>
+ <xsd:enumeration value="SecretOrConfidentialInformation"/>
+ <xsd:enumeration value="SectionProfile"/>
+ <xsd:enumeration value="SeriesTitle"/>
+ <xsd:enumeration value="ServiceFeature"/>
+ <xsd:enumeration value="Services"/>
+ <xsd:enumeration value="Shade"/>
+ <xsd:enumeration value="Shelf-LifeCode"/>
+ <xsd:enumeration value="ShelfTag"/>
+ <xsd:enumeration value="ShippingUnitComponent"/>
+ <xsd:enumeration value="ShipToLine"/>
+ <xsd:enumeration value="ShipToStock"/>
+ <xsd:enumeration value="Silhouette"/>
+ <xsd:enumeration value="Size"/>
+ <xsd:enumeration value="SizeSystem"/>
+ <xsd:enumeration value="SocietyGovernmentAndOrCustomerSpecifications"/>
+ <xsd:enumeration value="Solubility"/>
+ <xsd:enumeration value="Source"/>
+ <xsd:enumeration value="SpecialProcessing"/>
+ <xsd:enumeration value="SpecialSpecification"/>
+ <xsd:enumeration value="Specification"/>
+ <xsd:enumeration value="StateControlled"/>
+ <xsd:enumeration value="StorageAndDisplay"/>
+ <xsd:enumeration value="SubcontractResource"/>
+ <xsd:enumeration value="Sub-Product"/>
+ <xsd:enumeration value="SurfaceCondition"/>
+ <xsd:enumeration value="SurfaceLocationMethod"/>
+ <xsd:enumeration value="SurfaceProtection"/>
+ <xsd:enumeration value="SurfaceTreatment-Chemical"/>
+ <xsd:enumeration value="SurfaceTreatment-Mechanical"/>
+ <xsd:enumeration value="Synonym"/>
+ <xsd:enumeration value="Temper"/>
+ <xsd:enumeration value="TestingAndInspectionAgencies"/>
+ <xsd:enumeration value="TestPanelType"/>
+ <xsd:enumeration value="TestSampleDirection"/>
+ <xsd:enumeration value="TestSampleFrequency"/>
+ <xsd:enumeration value="TestSampleLocation"/>
+ <xsd:enumeration value="TheoreticalWeightFormula"/>
+ <xsd:enumeration value="TherapeuticClass"/>
+ <xsd:enumeration value="TherapeuticEquivalency"/>
+ <xsd:enumeration value="Threshold"/>
+ <xsd:enumeration value="Tint"/>
+ <xsd:enumeration value="Tire"/>
+ <xsd:enumeration value="Title"/>
+ <xsd:enumeration value="TitleInsuranceForm"/>
+ <xsd:enumeration value="Tow"/>
+ <xsd:enumeration value="TradeName"/>
+ <xsd:enumeration value="Translator"/>
+ <xsd:enumeration value="Transmission"/>
+ <xsd:enumeration value="Trim"/>
+ <xsd:enumeration value="Twist"/>
+ <xsd:enumeration value="TypeAndOrProcess"/>
+ <xsd:enumeration value="Typeface"/>
+ <xsd:enumeration value="TypeOfSample"/>
+ <xsd:enumeration value="TypeOfTest-Inspection"/>
+ <xsd:enumeration value="TypeSpinning"/>
+ <xsd:enumeration value="Vehicle"/>
+ <xsd:enumeration value="VendorColorDescription"/>
+ <xsd:enumeration value="VendorSizeDescription"/>
+ <xsd:enumeration value="Vintage"/>
+ <xsd:enumeration value="Visual"/>
+ <xsd:enumeration value="VolatileOrganicCompoundControl"/>
+ <xsd:enumeration value="VolumeTitle"/>
+ <xsd:enumeration value="WarrantyDescription"/>
+ <xsd:enumeration value="WarrantyTypeDescription"/>
+ <xsd:enumeration value="Waste"/>
+ <xsd:enumeration value="WaxCode"/>
+ <xsd:enumeration value="WeldsOrSplices"/>
+ <xsd:enumeration value="WellClassification"/>
+ <xsd:enumeration value="WellDirection"/>
+ <xsd:enumeration value="WellPerforationContinuity"/>
+ <xsd:enumeration value="WellPerforationInterval"/>
+ <xsd:enumeration value="WellTestType"/>
+ <xsd:enumeration value="WindingInstructions"/>
+ <xsd:enumeration value="WineFruit"/>
+ <xsd:enumeration value="WineGrowingRegion"/>
+ <xsd:enumeration value="YarnCount"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="SurfaceLayerPositionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="All"/>
+ <xsd:enumeration value="BackOfCab"/>
+ <xsd:enumeration value="Bilateral"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="Bolster"/>
+ <xsd:enumeration value="BothSides"/>
+ <xsd:enumeration value="Bottom"/>
+ <xsd:enumeration value="Brick"/>
+ <xsd:enumeration value="CasingHeadFlange"/>
+ <xsd:enumeration value="Center"/>
+ <xsd:enumeration value="CornerDiagonals"/>
+ <xsd:enumeration value="DoubleEndOverhang"/>
+ <xsd:enumeration value="DownstreamTap"/>
+ <xsd:enumeration value="DualFuelTankPositions"/>
+ <xsd:enumeration value="Exterior"/>
+ <xsd:enumeration value="Front"/>
+ <xsd:enumeration value="FrontSpare"/>
+ <xsd:enumeration value="Inside"/>
+ <xsd:enumeration value="InsideLeftRear"/>
+ <xsd:enumeration value="InsideRightRear"/>
+ <xsd:enumeration value="Interior"/>
+ <xsd:enumeration value="KellyBushing"/>
+ <xsd:enumeration value="Left"/>
+ <xsd:enumeration value="LeftFront"/>
+ <xsd:enumeration value="LeftRear"/>
+ <xsd:enumeration value="LessCriticalSurface"/>
+ <xsd:enumeration value="Lower"/>
+ <xsd:enumeration value="Middle"/>
+ <xsd:enumeration value="MoreCriticalSurface"/>
+ <xsd:enumeration value="Multiple"/>
+ <xsd:enumeration value="NextRelativePosition"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="OffSurface"/>
+ <xsd:enumeration value="OneSide"/>
+ <xsd:enumeration value="OnSurface"/>
+ <xsd:enumeration value="OppositeCorners"/>
+ <xsd:enumeration value="Outside"/>
+ <xsd:enumeration value="OutsideLeftRear"/>
+ <xsd:enumeration value="OutsideRightRear"/>
+ <xsd:enumeration value="Overall"/>
+ <xsd:enumeration value="Port"/>
+ <xsd:enumeration value="Rear"/>
+ <xsd:enumeration value="RearSpare"/>
+ <xsd:enumeration value="RelativePosition1"/>
+ <xsd:enumeration value="RelativePosition10"/>
+ <xsd:enumeration value="RelativePosition11"/>
+ <xsd:enumeration value="RelativePosition12"/>
+ <xsd:enumeration value="RelativePosition13"/>
+ <xsd:enumeration value="RelativePosition14"/>
+ <xsd:enumeration value="RelativePosition15"/>
+ <xsd:enumeration value="RelativePosition16"/>
+ <xsd:enumeration value="RelativePosition17"/>
+ <xsd:enumeration value="RelativePosition18"/>
+ <xsd:enumeration value="RelativePosition19"/>
+ <xsd:enumeration value="RelativePosition2"/>
+ <xsd:enumeration value="RelativePosition20"/>
+ <xsd:enumeration value="RelativePosition21"/>
+ <xsd:enumeration value="RelativePosition22"/>
+ <xsd:enumeration value="RelativePosition23"/>
+ <xsd:enumeration value="RelativePosition24"/>
+ <xsd:enumeration value="RelativePosition25"/>
+ <xsd:enumeration value="RelativePosition26"/>
+ <xsd:enumeration value="RelativePosition27"/>
+ <xsd:enumeration value="RelativePosition28"/>
+ <xsd:enumeration value="RelativePosition29"/>
+ <xsd:enumeration value="RelativePosition3"/>
+ <xsd:enumeration value="RelativePosition30"/>
+ <xsd:enumeration value="RelativePosition31"/>
+ <xsd:enumeration value="RelativePosition32"/>
+ <xsd:enumeration value="RelativePosition33"/>
+ <xsd:enumeration value="RelativePosition34"/>
+ <xsd:enumeration value="RelativePosition35"/>
+ <xsd:enumeration value="RelativePosition36"/>
+ <xsd:enumeration value="RelativePosition37"/>
+ <xsd:enumeration value="RelativePosition38"/>
+ <xsd:enumeration value="RelativePosition39"/>
+ <xsd:enumeration value="RelativePosition4"/>
+ <xsd:enumeration value="RelativePosition40"/>
+ <xsd:enumeration value="RelativePosition41"/>
+ <xsd:enumeration value="RelativePosition42"/>
+ <xsd:enumeration value="RelativePosition43"/>
+ <xsd:enumeration value="RelativePosition44"/>
+ <xsd:enumeration value="RelativePosition45"/>
+ <xsd:enumeration value="RelativePosition46"/>
+ <xsd:enumeration value="RelativePosition47"/>
+ <xsd:enumeration value="RelativePosition48"/>
+ <xsd:enumeration value="RelativePosition49"/>
+ <xsd:enumeration value="RelativePosition5"/>
+ <xsd:enumeration value="RelativePosition50"/>
+ <xsd:enumeration value="RelativePosition6"/>
+ <xsd:enumeration value="RelativePosition7"/>
+ <xsd:enumeration value="RelativePosition8"/>
+ <xsd:enumeration value="RelativePosition9"/>
+ <xsd:enumeration value="RigFloor"/>
+ <xsd:enumeration value="Right"/>
+ <xsd:enumeration value="RightFront"/>
+ <xsd:enumeration value="RightRear"/>
+ <xsd:enumeration value="SideOne"/>
+ <xsd:enumeration value="SideTwo"/>
+ <xsd:enumeration value="Siding"/>
+ <xsd:enumeration value="Single"/>
+ <xsd:enumeration value="SingleEndOverhang"/>
+ <xsd:enumeration value="Soluble"/>
+ <xsd:enumeration value="SpareTirePosition"/>
+ <xsd:enumeration value="Starboard"/>
+ <xsd:enumeration value="Stone"/>
+ <xsd:enumeration value="Stucco"/>
+ <xsd:enumeration value="Sub-Sea"/>
+ <xsd:enumeration value="TankBottom"/>
+ <xsd:enumeration value="ToothBuccalSurface"/>
+ <xsd:enumeration value="ToothDistalSurface"/>
+ <xsd:enumeration value="ToothFacialSurface"/>
+ <xsd:enumeration value="ToothIncisalSurface"/>
+ <xsd:enumeration value="ToothLingualSurface"/>
+ <xsd:enumeration value="ToothMesialSurface"/>
+ <xsd:enumeration value="ToothOcclusalSurface"/>
+ <xsd:enumeration value="Top"/>
+ <xsd:enumeration value="TwoSides"/>
+ <xsd:enumeration value="UnderCab"/>
+ <xsd:enumeration value="Unilateral"/>
+ <xsd:enumeration value="Upper"/>
+ <xsd:enumeration value="UpstreamTap"/>
+ <xsd:enumeration value="Wood"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="UnitOfMeasurement">
+ <xsd:sequence>
+ <xsd:element name="UOMCoded" type="UOMCode"/>
+ <xsd:element minOccurs="0" name="UOMCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="UnitOfMeasurement" type="UnitOfMeasurement"/>
+ <xsd:simpleType name="UOMCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="4"/>
+ <xsd:enumeration value="5"/>
+ <xsd:enumeration value="8"/>
+ <xsd:enumeration value="10"/>
+ <xsd:enumeration value="11"/>
+ <xsd:enumeration value="13"/>
+ <xsd:enumeration value="14"/>
+ <xsd:enumeration value="15"/>
+ <xsd:enumeration value="16"/>
+ <xsd:enumeration value="17"/>
+ <xsd:enumeration value="18"/>
+ <xsd:enumeration value="19"/>
+ <xsd:enumeration value="20"/>
+ <xsd:enumeration value="21"/>
+ <xsd:enumeration value="22"/>
+ <xsd:enumeration value="23"/>
+ <xsd:enumeration value="24"/>
+ <xsd:enumeration value="25"/>
+ <xsd:enumeration value="26"/>
+ <xsd:enumeration value="27"/>
+ <xsd:enumeration value="28"/>
+ <xsd:enumeration value="29"/>
+ <xsd:enumeration value="30"/>
+ <xsd:enumeration value="31"/>
+ <xsd:enumeration value="32"/>
+ <xsd:enumeration value="33"/>
+ <xsd:enumeration value="34"/>
+ <xsd:enumeration value="35"/>
+ <xsd:enumeration value="36"/>
+ <xsd:enumeration value="37"/>
+ <xsd:enumeration value="38"/>
+ <xsd:enumeration value="40"/>
+ <xsd:enumeration value="41"/>
+ <xsd:enumeration value="43"/>
+ <xsd:enumeration value="44"/>
+ <xsd:enumeration value="45"/>
+ <xsd:enumeration value="46"/>
+ <xsd:enumeration value="47"/>
+ <xsd:enumeration value="48"/>
+ <xsd:enumeration value="50"/>
+ <xsd:enumeration value="51"/>
+ <xsd:enumeration value="53"/>
+ <xsd:enumeration value="54"/>
+ <xsd:enumeration value="56"/>
+ <xsd:enumeration value="57"/>
+ <xsd:enumeration value="58"/>
+ <xsd:enumeration value="59"/>
+ <xsd:enumeration value="60"/>
+ <xsd:enumeration value="61"/>
+ <xsd:enumeration value="62"/>
+ <xsd:enumeration value="63"/>
+ <xsd:enumeration value="64"/>
+ <xsd:enumeration value="66"/>
+ <xsd:enumeration value="69"/>
+ <xsd:enumeration value="71"/>
+ <xsd:enumeration value="72"/>
+ <xsd:enumeration value="73"/>
+ <xsd:enumeration value="74"/>
+ <xsd:enumeration value="76"/>
+ <xsd:enumeration value="77"/>
+ <xsd:enumeration value="78"/>
+ <xsd:enumeration value="80"/>
+ <xsd:enumeration value="81"/>
+ <xsd:enumeration value="84"/>
+ <xsd:enumeration value="85"/>
+ <xsd:enumeration value="86"/>
+ <xsd:enumeration value="87"/>
+ <xsd:enumeration value="89"/>
+ <xsd:enumeration value="90"/>
+ <xsd:enumeration value="91"/>
+ <xsd:enumeration value="92"/>
+ <xsd:enumeration value="93"/>
+ <xsd:enumeration value="94"/>
+ <xsd:enumeration value="95"/>
+ <xsd:enumeration value="96"/>
+ <xsd:enumeration value="97"/>
+ <xsd:enumeration value="98"/>
+ <xsd:enumeration value="1A"/>
+ <xsd:enumeration value="1B"/>
+ <xsd:enumeration value="1C"/>
+ <xsd:enumeration value="1D"/>
+ <xsd:enumeration value="1E"/>
+ <xsd:enumeration value="1F"/>
+ <xsd:enumeration value="1G"/>
+ <xsd:enumeration value="1H"/>
+ <xsd:enumeration value="1I"/>
+ <xsd:enumeration value="1J"/>
+ <xsd:enumeration value="1K"/>
+ <xsd:enumeration value="1L"/>
+ <xsd:enumeration value="1M"/>
+ <xsd:enumeration value="1X"/>
+ <xsd:enumeration value="2A"/>
+ <xsd:enumeration value="2B"/>
+ <xsd:enumeration value="2C"/>
+ <xsd:enumeration value="2F"/>
+ <xsd:enumeration value="2G"/>
+ <xsd:enumeration value="2H"/>
+ <xsd:enumeration value="2I"/>
+ <xsd:enumeration value="2J"/>
+ <xsd:enumeration value="2K"/>
+ <xsd:enumeration value="2L"/>
+ <xsd:enumeration value="2M"/>
+ <xsd:enumeration value="2N"/>
+ <xsd:enumeration value="2P"/>
+ <xsd:enumeration value="2Q"/>
+ <xsd:enumeration value="2R"/>
+ <xsd:enumeration value="2U"/>
+ <xsd:enumeration value="2V"/>
+ <xsd:enumeration value="2W"/>
+ <xsd:enumeration value="2X"/>
+ <xsd:enumeration value="2Y"/>
+ <xsd:enumeration value="2Z"/>
+ <xsd:enumeration value="3B"/>
+ <xsd:enumeration value="3C"/>
+ <xsd:enumeration value="3E"/>
+ <xsd:enumeration value="3F"/>
+ <xsd:enumeration value="3G"/>
+ <xsd:enumeration value="3H"/>
+ <xsd:enumeration value="3I"/>
+ <xsd:enumeration value="4A"/>
+ <xsd:enumeration value="4B"/>
+ <xsd:enumeration value="4C"/>
+ <xsd:enumeration value="4E"/>
+ <xsd:enumeration value="4G"/>
+ <xsd:enumeration value="4H"/>
+ <xsd:enumeration value="4I"/>
+ <xsd:enumeration value="4J"/>
+ <xsd:enumeration value="4K"/>
+ <xsd:enumeration value="4L"/>
+ <xsd:enumeration value="4M"/>
+ <xsd:enumeration value="4N"/>
+ <xsd:enumeration value="4O"/>
+ <xsd:enumeration value="4P"/>
+ <xsd:enumeration value="4Q"/>
+ <xsd:enumeration value="4R"/>
+ <xsd:enumeration value="4T"/>
+ <xsd:enumeration value="4U"/>
+ <xsd:enumeration value="4W"/>
+ <xsd:enumeration value="4X"/>
+ <xsd:enumeration value="5A"/>
+ <xsd:enumeration value="5B"/>
+ <xsd:enumeration value="5C"/>
+ <xsd:enumeration value="5E"/>
+ <xsd:enumeration value="5F"/>
+ <xsd:enumeration value="5G"/>
+ <xsd:enumeration value="5H"/>
+ <xsd:enumeration value="5I"/>
+ <xsd:enumeration value="5J"/>
+ <xsd:enumeration value="5K"/>
+ <xsd:enumeration value="5P"/>
+ <xsd:enumeration value="5Q"/>
+ <xsd:enumeration value="A1"/>
+ <xsd:enumeration value="A10"/>
+ <xsd:enumeration value="A11"/>
+ <xsd:enumeration value="A12"/>
+ <xsd:enumeration value="A13"/>
+ <xsd:enumeration value="A14"/>
+ <xsd:enumeration value="A15"/>
+ <xsd:enumeration value="A16"/>
+ <xsd:enumeration value="A17"/>
+ <xsd:enumeration value="A18"/>
+ <xsd:enumeration value="A19"/>
+ <xsd:enumeration value="A2"/>
+ <xsd:enumeration value="A20"/>
+ <xsd:enumeration value="A22"/>
+ <xsd:enumeration value="A23"/>
+ <xsd:enumeration value="A24"/>
+ <xsd:enumeration value="A25"/>
+ <xsd:enumeration value="A26"/>
+ <xsd:enumeration value="A27"/>
+ <xsd:enumeration value="A28"/>
+ <xsd:enumeration value="A29"/>
+ <xsd:enumeration value="A3"/>
+ <xsd:enumeration value="A30"/>
+ <xsd:enumeration value="A31"/>
+ <xsd:enumeration value="A32"/>
+ <xsd:enumeration value="A33"/>
+ <xsd:enumeration value="A34"/>
+ <xsd:enumeration value="A35"/>
+ <xsd:enumeration value="A36"/>
+ <xsd:enumeration value="A37"/>
+ <xsd:enumeration value="A38"/>
+ <xsd:enumeration value="A39"/>
+ <xsd:enumeration value="A4"/>
+ <xsd:enumeration value="A40"/>
+ <xsd:enumeration value="A41"/>
+ <xsd:enumeration value="A42"/>
+ <xsd:enumeration value="A43"/>
+ <xsd:enumeration value="A44"/>
+ <xsd:enumeration value="A45"/>
+ <xsd:enumeration value="A47"/>
+ <xsd:enumeration value="A48"/>
+ <xsd:enumeration value="A49"/>
+ <xsd:enumeration value="A5"/>
+ <xsd:enumeration value="A50"/>
+ <xsd:enumeration value="A51"/>
+ <xsd:enumeration value="A52"/>
+ <xsd:enumeration value="A53"/>
+ <xsd:enumeration value="A54"/>
+ <xsd:enumeration value="A55"/>
+ <xsd:enumeration value="A56"/>
+ <xsd:enumeration value="A57"/>
+ <xsd:enumeration value="A58"/>
+ <xsd:enumeration value="A6"/>
+ <xsd:enumeration value="A60"/>
+ <xsd:enumeration value="A61"/>
+ <xsd:enumeration value="A62"/>
+ <xsd:enumeration value="A63"/>
+ <xsd:enumeration value="A64"/>
+ <xsd:enumeration value="A65"/>
+ <xsd:enumeration value="A66"/>
+ <xsd:enumeration value="A67"/>
+ <xsd:enumeration value="A68"/>
+ <xsd:enumeration value="A69"/>
+ <xsd:enumeration value="A7"/>
+ <xsd:enumeration value="A70"/>
+ <xsd:enumeration value="A71"/>
+ <xsd:enumeration value="A73"/>
+ <xsd:enumeration value="A74"/>
+ <xsd:enumeration value="A75"/>
+ <xsd:enumeration value="A76"/>
+ <xsd:enumeration value="A77"/>
+ <xsd:enumeration value="A78"/>
+ <xsd:enumeration value="A79"/>
+ <xsd:enumeration value="A8"/>
+ <xsd:enumeration value="A80"/>
+ <xsd:enumeration value="A81"/>
+ <xsd:enumeration value="A82"/>
+ <xsd:enumeration value="A83"/>
+ <xsd:enumeration value="A84"/>
+ <xsd:enumeration value="A85"/>
+ <xsd:enumeration value="A86"/>
+ <xsd:enumeration value="A87"/>
+ <xsd:enumeration value="A88"/>
+ <xsd:enumeration value="A89"/>
+ <xsd:enumeration value="A9"/>
+ <xsd:enumeration value="A90"/>
+ <xsd:enumeration value="A91"/>
+ <xsd:enumeration value="A93"/>
+ <xsd:enumeration value="A94"/>
+ <xsd:enumeration value="A95"/>
+ <xsd:enumeration value="A96"/>
+ <xsd:enumeration value="A97"/>
+ <xsd:enumeration value="A98"/>
+ <xsd:enumeration value="AA"/>
+ <xsd:enumeration value="AB"/>
+ <xsd:enumeration value="ACR"/>
+ <xsd:enumeration value="AD"/>
+ <xsd:enumeration value="AE"/>
+ <xsd:enumeration value="AH"/>
+ <xsd:enumeration value="AI"/>
+ <xsd:enumeration value="AJ"/>
+ <xsd:enumeration value="AK"/>
+ <xsd:enumeration value="AL"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="AMH"/>
+ <xsd:enumeration value="AMP"/>
+ <xsd:enumeration value="AN"/>
+ <xsd:enumeration value="ANN"/>
+ <xsd:enumeration value="AP"/>
+ <xsd:enumeration value="APZ"/>
+ <xsd:enumeration value="AQ"/>
+ <xsd:enumeration value="AR"/>
+ <xsd:enumeration value="ARE"/>
+ <xsd:enumeration value="AS"/>
+ <xsd:enumeration value="ASM"/>
+ <xsd:enumeration value="ASU"/>
+ <xsd:enumeration value="AT"/>
+ <xsd:enumeration value="ATM"/>
+ <xsd:enumeration value="ATT"/>
+ <xsd:enumeration value="AU"/>
+ <xsd:enumeration value="AV"/>
+ <xsd:enumeration value="AW"/>
+ <xsd:enumeration value="AX"/>
+ <xsd:enumeration value="AY"/>
+ <xsd:enumeration value="AZ"/>
+ <xsd:enumeration value="B0"/>
+ <xsd:enumeration value="B1"/>
+ <xsd:enumeration value="B11"/>
+ <xsd:enumeration value="B12"/>
+ <xsd:enumeration value="B13"/>
+ <xsd:enumeration value="B14"/>
+ <xsd:enumeration value="B15"/>
+ <xsd:enumeration value="B16"/>
+ <xsd:enumeration value="B18"/>
+ <xsd:enumeration value="B2"/>
+ <xsd:enumeration value="B20"/>
+ <xsd:enumeration value="B21"/>
+ <xsd:enumeration value="B22"/>
+ <xsd:enumeration value="B23"/>
+ <xsd:enumeration value="B24"/>
+ <xsd:enumeration value="B25"/>
+ <xsd:enumeration value="B26"/>
+ <xsd:enumeration value="B27"/>
+ <xsd:enumeration value="B28"/>
+ <xsd:enumeration value="B29"/>
+ <xsd:enumeration value="B3"/>
+ <xsd:enumeration value="B31"/>
+ <xsd:enumeration value="B32"/>
+ <xsd:enumeration value="B33"/>
+ <xsd:enumeration value="B34"/>
+ <xsd:enumeration value="B35"/>
+ <xsd:enumeration value="B36"/>
+ <xsd:enumeration value="B37"/>
+ <xsd:enumeration value="B38"/>
+ <xsd:enumeration value="B39"/>
+ <xsd:enumeration value="B4"/>
+ <xsd:enumeration value="B40"/>
+ <xsd:enumeration value="B41"/>
+ <xsd:enumeration value="B42"/>
+ <xsd:enumeration value="B43"/>
+ <xsd:enumeration value="B44"/>
+ <xsd:enumeration value="B45"/>
+ <xsd:enumeration value="B46"/>
+ <xsd:enumeration value="B47"/>
+ <xsd:enumeration value="B48"/>
+ <xsd:enumeration value="B49"/>
+ <xsd:enumeration value="B5"/>
+ <xsd:enumeration value="B50"/>
+ <xsd:enumeration value="B51"/>
+ <xsd:enumeration value="B52"/>
+ <xsd:enumeration value="B53"/>
+ <xsd:enumeration value="B54"/>
+ <xsd:enumeration value="B55"/>
+ <xsd:enumeration value="B56"/>
+ <xsd:enumeration value="B57"/>
+ <xsd:enumeration value="B58"/>
+ <xsd:enumeration value="B59"/>
+ <xsd:enumeration value="B6"/>
+ <xsd:enumeration value="B60"/>
+ <xsd:enumeration value="B61"/>
+ <xsd:enumeration value="B62"/>
+ <xsd:enumeration value="B63"/>
+ <xsd:enumeration value="B64"/>
+ <xsd:enumeration value="B65"/>
+ <xsd:enumeration value="B66"/>
+ <xsd:enumeration value="B67"/>
+ <xsd:enumeration value="B69"/>
+ <xsd:enumeration value="B7"/>
+ <xsd:enumeration value="B70"/>
+ <xsd:enumeration value="B71"/>
+ <xsd:enumeration value="B72"/>
+ <xsd:enumeration value="B73"/>
+ <xsd:enumeration value="B74"/>
+ <xsd:enumeration value="B75"/>
+ <xsd:enumeration value="B76"/>
+ <xsd:enumeration value="B77"/>
+ <xsd:enumeration value="B78"/>
+ <xsd:enumeration value="B79"/>
+ <xsd:enumeration value="B8"/>
+ <xsd:enumeration value="B81"/>
+ <xsd:enumeration value="B83"/>
+ <xsd:enumeration value="B84"/>
+ <xsd:enumeration value="B85"/>
+ <xsd:enumeration value="B86"/>
+ <xsd:enumeration value="B87"/>
+ <xsd:enumeration value="B88"/>
+ <xsd:enumeration value="B89"/>
+ <xsd:enumeration value="B9"/>
+ <xsd:enumeration value="B90"/>
+ <xsd:enumeration value="B91"/>
+ <xsd:enumeration value="B92"/>
+ <xsd:enumeration value="B93"/>
+ <xsd:enumeration value="B94"/>
+ <xsd:enumeration value="B95"/>
+ <xsd:enumeration value="B96"/>
+ <xsd:enumeration value="B97"/>
+ <xsd:enumeration value="B98"/>
+ <xsd:enumeration value="B99"/>
+ <xsd:enumeration value="BAR"/>
+ <xsd:enumeration value="BB"/>
+ <xsd:enumeration value="BD"/>
+ <xsd:enumeration value="BE"/>
+ <xsd:enumeration value="BFT"/>
+ <xsd:enumeration value="BG"/>
+ <xsd:enumeration value="BH"/>
+ <xsd:enumeration value="BHP"/>
+ <xsd:enumeration value="BIL"/>
+ <xsd:enumeration value="BJ"/>
+ <xsd:enumeration value="BK"/>
+ <xsd:enumeration value="BL"/>
+ <xsd:enumeration value="BLD"/>
+ <xsd:enumeration value="BLL"/>
+ <xsd:enumeration value="BO"/>
+ <xsd:enumeration value="BP"/>
+ <xsd:enumeration value="BQL"/>
+ <xsd:enumeration value="BT"/>
+ <xsd:enumeration value="BTU"/>
+ <xsd:enumeration value="BU"/>
+ <xsd:enumeration value="BUA"/>
+ <xsd:enumeration value="BUI"/>
+ <xsd:enumeration value="BW"/>
+ <xsd:enumeration value="BX"/>
+ <xsd:enumeration value="BZ"/>
+ <xsd:enumeration value="C0"/>
+ <xsd:enumeration value="C1"/>
+ <xsd:enumeration value="C10"/>
+ <xsd:enumeration value="C11"/>
+ <xsd:enumeration value="C12"/>
+ <xsd:enumeration value="C13"/>
+ <xsd:enumeration value="C14"/>
+ <xsd:enumeration value="C15"/>
+ <xsd:enumeration value="C16"/>
+ <xsd:enumeration value="C17"/>
+ <xsd:enumeration value="C18"/>
+ <xsd:enumeration value="C19"/>
+ <xsd:enumeration value="C2"/>
+ <xsd:enumeration value="C20"/>
+ <xsd:enumeration value="C22"/>
+ <xsd:enumeration value="C23"/>
+ <xsd:enumeration value="C24"/>
+ <xsd:enumeration value="C25"/>
+ <xsd:enumeration value="C26"/>
+ <xsd:enumeration value="C27"/>
+ <xsd:enumeration value="C28"/>
+ <xsd:enumeration value="C29"/>
+ <xsd:enumeration value="C3"/>
+ <xsd:enumeration value="C30"/>
+ <xsd:enumeration value="C31"/>
+ <xsd:enumeration value="C32"/>
+ <xsd:enumeration value="C33"/>
+ <xsd:enumeration value="C34"/>
+ <xsd:enumeration value="C35"/>
+ <xsd:enumeration value="C36"/>
+ <xsd:enumeration value="C38"/>
+ <xsd:enumeration value="C39"/>
+ <xsd:enumeration value="C4"/>
+ <xsd:enumeration value="C40"/>
+ <xsd:enumeration value="C41"/>
+ <xsd:enumeration value="C42"/>
+ <xsd:enumeration value="C43"/>
+ <xsd:enumeration value="C44"/>
+ <xsd:enumeration value="C45"/>
+ <xsd:enumeration value="C46"/>
+ <xsd:enumeration value="C47"/>
+ <xsd:enumeration value="C48"/>
+ <xsd:enumeration value="C49"/>
+ <xsd:enumeration value="C5"/>
+ <xsd:enumeration value="C50"/>
+ <xsd:enumeration value="C51"/>
+ <xsd:enumeration value="C52"/>
+ <xsd:enumeration value="C53"/>
+ <xsd:enumeration value="C54"/>
+ <xsd:enumeration value="C55"/>
+ <xsd:enumeration value="C56"/>
+ <xsd:enumeration value="C57"/>
+ <xsd:enumeration value="C58"/>
+ <xsd:enumeration value="C59"/>
+ <xsd:enumeration value="C6"/>
+ <xsd:enumeration value="C60"/>
+ <xsd:enumeration value="C61"/>
+ <xsd:enumeration value="C62"/>
+ <xsd:enumeration value="C63"/>
+ <xsd:enumeration value="C64"/>
+ <xsd:enumeration value="C65"/>
+ <xsd:enumeration value="C66"/>
+ <xsd:enumeration value="C67"/>
+ <xsd:enumeration value="C68"/>
+ <xsd:enumeration value="C69"/>
+ <xsd:enumeration value="C7"/>
+ <xsd:enumeration value="C70"/>
+ <xsd:enumeration value="C71"/>
+ <xsd:enumeration value="C72"/>
+ <xsd:enumeration value="C73"/>
+ <xsd:enumeration value="C75"/>
+ <xsd:enumeration value="C76"/>
+ <xsd:enumeration value="C77"/>
+ <xsd:enumeration value="C78"/>
+ <xsd:enumeration value="C8"/>
+ <xsd:enumeration value="C80"/>
+ <xsd:enumeration value="C81"/>
+ <xsd:enumeration value="C82"/>
+ <xsd:enumeration value="C83"/>
+ <xsd:enumeration value="C84"/>
+ <xsd:enumeration value="C85"/>
+ <xsd:enumeration value="C86"/>
+ <xsd:enumeration value="C87"/>
+ <xsd:enumeration value="C88"/>
+ <xsd:enumeration value="C89"/>
+ <xsd:enumeration value="C9"/>
+ <xsd:enumeration value="C90"/>
+ <xsd:enumeration value="C91"/>
+ <xsd:enumeration value="C92"/>
+ <xsd:enumeration value="C93"/>
+ <xsd:enumeration value="C94"/>
+ <xsd:enumeration value="C95"/>
+ <xsd:enumeration value="C96"/>
+ <xsd:enumeration value="C97"/>
+ <xsd:enumeration value="C98"/>
+ <xsd:enumeration value="C99"/>
+ <xsd:enumeration value="CA"/>
+ <xsd:enumeration value="CCT"/>
+ <xsd:enumeration value="CD"/>
+ <xsd:enumeration value="CDL"/>
+ <xsd:enumeration value="CE"/>
+ <xsd:enumeration value="CEL"/>
+ <xsd:enumeration value="CEN"/>
+ <xsd:enumeration value="CG"/>
+ <xsd:enumeration value="CGM"/>
+ <xsd:enumeration value="CH"/>
+ <xsd:enumeration value="CJ"/>
+ <xsd:enumeration value="CK"/>
+ <xsd:enumeration value="CKG"/>
+ <xsd:enumeration value="CL"/>
+ <xsd:enumeration value="CLF"/>
+ <xsd:enumeration value="CLT"/>
+ <xsd:enumeration value="CMK"/>
+ <xsd:enumeration value="CMQ"/>
+ <xsd:enumeration value="CMT"/>
+ <xsd:enumeration value="CNP"/>
+ <xsd:enumeration value="CNT"/>
+ <xsd:enumeration value="CO"/>
+ <xsd:enumeration value="COU"/>
+ <xsd:enumeration value="CQ"/>
+ <xsd:enumeration value="CR"/>
+ <xsd:enumeration value="CS"/>
+ <xsd:enumeration value="CT"/>
+ <xsd:enumeration value="CTM"/>
+ <xsd:enumeration value="CU"/>
+ <xsd:enumeration value="CUR"/>
+ <xsd:enumeration value="CV"/>
+ <xsd:enumeration value="CWA"/>
+ <xsd:enumeration value="CWI"/>
+ <xsd:enumeration value="CY"/>
+ <xsd:enumeration value="CZ"/>
+ <xsd:enumeration value="D1"/>
+ <xsd:enumeration value="D10"/>
+ <xsd:enumeration value="D12"/>
+ <xsd:enumeration value="D13"/>
+ <xsd:enumeration value="D14"/>
+ <xsd:enumeration value="D16"/>
+ <xsd:enumeration value="D17"/>
+ <xsd:enumeration value="D18"/>
+ <xsd:enumeration value="D19"/>
+ <xsd:enumeration value="D2"/>
+ <xsd:enumeration value="D20"/>
+ <xsd:enumeration value="D21"/>
+ <xsd:enumeration value="D22"/>
+ <xsd:enumeration value="D23"/>
+ <xsd:enumeration value="D24"/>
+ <xsd:enumeration value="D25"/>
+ <xsd:enumeration value="D26"/>
+ <xsd:enumeration value="D27"/>
+ <xsd:enumeration value="D28"/>
+ <xsd:enumeration value="D29"/>
+ <xsd:enumeration value="D30"/>
+ <xsd:enumeration value="D31"/>
+ <xsd:enumeration value="D33"/>
+ <xsd:enumeration value="D34"/>
+ <xsd:enumeration value="D35"/>
+ <xsd:enumeration value="D37"/>
+ <xsd:enumeration value="D38"/>
+ <xsd:enumeration value="D39"/>
+ <xsd:enumeration value="D40"/>
+ <xsd:enumeration value="D41"/>
+ <xsd:enumeration value="D42"/>
+ <xsd:enumeration value="D43"/>
+ <xsd:enumeration value="D44"/>
+ <xsd:enumeration value="D45"/>
+ <xsd:enumeration value="D46"/>
+ <xsd:enumeration value="D47"/>
+ <xsd:enumeration value="D48"/>
+ <xsd:enumeration value="D49"/>
+ <xsd:enumeration value="D5"/>
+ <xsd:enumeration value="D50"/>
+ <xsd:enumeration value="D51"/>
+ <xsd:enumeration value="D52"/>
+ <xsd:enumeration value="D53"/>
+ <xsd:enumeration value="D54"/>
+ <xsd:enumeration value="D55"/>
+ <xsd:enumeration value="D56"/>
+ <xsd:enumeration value="D57"/>
+ <xsd:enumeration value="D58"/>
+ <xsd:enumeration value="D59"/>
+ <xsd:enumeration value="D6"/>
+ <xsd:enumeration value="D60"/>
+ <xsd:enumeration value="D63"/>
+ <xsd:enumeration value="D64"/>
+ <xsd:enumeration value="D65"/>
+ <xsd:enumeration value="D66"/>
+ <xsd:enumeration value="D67"/>
+ <xsd:enumeration value="D69"/>
+ <xsd:enumeration value="D7"/>
+ <xsd:enumeration value="D70"/>
+ <xsd:enumeration value="D71"/>
+ <xsd:enumeration value="D72"/>
+ <xsd:enumeration value="D73"/>
+ <xsd:enumeration value="D74"/>
+ <xsd:enumeration value="D75"/>
+ <xsd:enumeration value="D76"/>
+ <xsd:enumeration value="D77"/>
+ <xsd:enumeration value="D79"/>
+ <xsd:enumeration value="D8"/>
+ <xsd:enumeration value="D80"/>
+ <xsd:enumeration value="D81"/>
+ <xsd:enumeration value="D82"/>
+ <xsd:enumeration value="D83"/>
+ <xsd:enumeration value="D85"/>
+ <xsd:enumeration value="D86"/>
+ <xsd:enumeration value="D87"/>
+ <xsd:enumeration value="D88"/>
+ <xsd:enumeration value="D89"/>
+ <xsd:enumeration value="D9"/>
+ <xsd:enumeration value="D90"/>
+ <xsd:enumeration value="D91"/>
+ <xsd:enumeration value="D92"/>
+ <xsd:enumeration value="D93"/>
+ <xsd:enumeration value="D94"/>
+ <xsd:enumeration value="D95"/>
+ <xsd:enumeration value="D96"/>
+ <xsd:enumeration value="D97"/>
+ <xsd:enumeration value="D98"/>
+ <xsd:enumeration value="D99"/>
+ <xsd:enumeration value="DAA"/>
+ <xsd:enumeration value="DAD"/>
+ <xsd:enumeration value="DAY"/>
+ <xsd:enumeration value="DB"/>
+ <xsd:enumeration value="DC"/>
+ <xsd:enumeration value="DD"/>
+ <xsd:enumeration value="DE"/>
+ <xsd:enumeration value="DEC"/>
+ <xsd:enumeration value="DF"/>
+ <xsd:enumeration value="DG"/>
+ <xsd:enumeration value="DH"/>
+ <xsd:enumeration value="DI"/>
+ <xsd:enumeration value="DJ"/>
+ <xsd:enumeration value="DLT"/>
+ <xsd:enumeration value="DMK"/>
+ <xsd:enumeration value="DMQ"/>
+ <xsd:enumeration value="DMT"/>
+ <xsd:enumeration value="DN"/>
+ <xsd:enumeration value="DO"/>
+ <xsd:enumeration value="DPC"/>
+ <xsd:enumeration value="DPR"/>
+ <xsd:enumeration value="DPT"/>
+ <xsd:enumeration value="DQ"/>
+ <xsd:enumeration value="DR"/>
+ <xsd:enumeration value="DRA"/>
+ <xsd:enumeration value="DRI"/>
+ <xsd:enumeration value="DRL"/>
+ <xsd:enumeration value="DRM"/>
+ <xsd:enumeration value="DS"/>
+ <xsd:enumeration value="DT"/>
+ <xsd:enumeration value="DTN"/>
+ <xsd:enumeration value="DU"/>
+ <xsd:enumeration value="DWT"/>
+ <xsd:enumeration value="DX"/>
+ <xsd:enumeration value="DY"/>
+ <xsd:enumeration value="DZN"/>
+ <xsd:enumeration value="DZP"/>
+ <xsd:enumeration value="E2"/>
+ <xsd:enumeration value="E3"/>
+ <xsd:enumeration value="E4"/>
+ <xsd:enumeration value="E5"/>
+ <xsd:enumeration value="E9"/>
+ <xsd:enumeration value="EA"/>
+ <xsd:enumeration value="EB"/>
+ <xsd:enumeration value="EC"/>
+ <xsd:enumeration value="EP"/>
+ <xsd:enumeration value="EQ"/>
+ <xsd:enumeration value="EV"/>
+ <xsd:enumeration value="EX"/>
+ <xsd:enumeration value="EZ"/>
+ <xsd:enumeration value="F1"/>
+ <xsd:enumeration value="F9"/>
+ <xsd:enumeration value="FAH"/>
+ <xsd:enumeration value="FAR"/>
+ <xsd:enumeration value="FB"/>
+ <xsd:enumeration value="FC"/>
+ <xsd:enumeration value="FD"/>
+ <xsd:enumeration value="FE"/>
+ <xsd:enumeration value="FF"/>
+ <xsd:enumeration value="FG"/>
+ <xsd:enumeration value="FH"/>
+ <xsd:enumeration value="FL"/>
+ <xsd:enumeration value="FM"/>
+ <xsd:enumeration value="FO"/>
+ <xsd:enumeration value="FOT"/>
+ <xsd:enumeration value="FP"/>
+ <xsd:enumeration value="FR"/>
+ <xsd:enumeration value="FS"/>
+ <xsd:enumeration value="FTK"/>
+ <xsd:enumeration value="FTQ"/>
+ <xsd:enumeration value="FZ"/>
+ <xsd:enumeration value="G2"/>
+ <xsd:enumeration value="G3"/>
+ <xsd:enumeration value="G5"/>
+ <xsd:enumeration value="G7"/>
+ <xsd:enumeration value="GB"/>
+ <xsd:enumeration value="GBQ"/>
+ <xsd:enumeration value="GC"/>
+ <xsd:enumeration value="GD"/>
+ <xsd:enumeration value="GE"/>
+ <xsd:enumeration value="GF"/>
+ <xsd:enumeration value="GFI"/>
+ <xsd:enumeration value="GG"/>
+ <xsd:enumeration value="GGR"/>
+ <xsd:enumeration value="GH"/>
+ <xsd:enumeration value="GI"/>
+ <xsd:enumeration value="GIA"/>
+ <xsd:enumeration value="GII"/>
+ <xsd:enumeration value="GJ"/>
+ <xsd:enumeration value="GK"/>
+ <xsd:enumeration value="GL"/>
+ <xsd:enumeration value="GLD"/>
+ <xsd:enumeration value="GLI"/>
+ <xsd:enumeration value="GLL"/>
+ <xsd:enumeration value="GM"/>
+ <xsd:enumeration value="GN"/>
+ <xsd:enumeration value="GO"/>
+ <xsd:enumeration value="GP"/>
+ <xsd:enumeration value="GQ"/>
+ <xsd:enumeration value="GRM"/>
+ <xsd:enumeration value="GRN"/>
+ <xsd:enumeration value="GRO"/>
+ <xsd:enumeration value="GRT"/>
+ <xsd:enumeration value="GT"/>
+ <xsd:enumeration value="GV"/>
+ <xsd:enumeration value="GW"/>
+ <xsd:enumeration value="GWH"/>
+ <xsd:enumeration value="GY"/>
+ <xsd:enumeration value="GZ"/>
+ <xsd:enumeration value="H1"/>
+ <xsd:enumeration value="H2"/>
+ <xsd:enumeration value="HA"/>
+ <xsd:enumeration value="HAR"/>
+ <xsd:enumeration value="HBA"/>
+ <xsd:enumeration value="HBX"/>
+ <xsd:enumeration value="HC"/>
+ <xsd:enumeration value="HD"/>
+ <xsd:enumeration value="HE"/>
+ <xsd:enumeration value="HF"/>
+ <xsd:enumeration value="HGM"/>
+ <xsd:enumeration value="HH"/>
+ <xsd:enumeration value="HI"/>
+ <xsd:enumeration value="HIU"/>
+ <xsd:enumeration value="HJ"/>
+ <xsd:enumeration value="HK"/>
+ <xsd:enumeration value="HL"/>
+ <xsd:enumeration value="HLT"/>
+ <xsd:enumeration value="HM"/>
+ <xsd:enumeration value="HMQ"/>
+ <xsd:enumeration value="HMT"/>
+ <xsd:enumeration value="HN"/>
+ <xsd:enumeration value="HO"/>
+ <xsd:enumeration value="HP"/>
+ <xsd:enumeration value="HPA"/>
+ <xsd:enumeration value="HS"/>
+ <xsd:enumeration value="HT"/>
+ <xsd:enumeration value="HTZ"/>
+ <xsd:enumeration value="HUR"/>
+ <xsd:enumeration value="HV"/>
+ <xsd:enumeration value="HW"/>
+ <xsd:enumeration value="HY"/>
+ <xsd:enumeration value="IA"/>
+ <xsd:enumeration value="IB"/>
+ <xsd:enumeration value="IC"/>
+ <xsd:enumeration value="IE"/>
+ <xsd:enumeration value="IF"/>
+ <xsd:enumeration value="II"/>
+ <xsd:enumeration value="IL"/>
+ <xsd:enumeration value="IM"/>
+ <xsd:enumeration value="INH"/>
+ <xsd:enumeration value="INK"/>
+ <xsd:enumeration value="INQ"/>
+ <xsd:enumeration value="IP"/>
+ <xsd:enumeration value="IT"/>
+ <xsd:enumeration value="IU"/>
+ <xsd:enumeration value="IV"/>
+ <xsd:enumeration value="IW"/>
+ <xsd:enumeration value="J2"/>
+ <xsd:enumeration value="JB"/>
+ <xsd:enumeration value="JE"/>
+ <xsd:enumeration value="JG"/>
+ <xsd:enumeration value="JK"/>
+ <xsd:enumeration value="JM"/>
+ <xsd:enumeration value="JO"/>
+ <xsd:enumeration value="JOU"/>
+ <xsd:enumeration value="JR"/>
+ <xsd:enumeration value="K1"/>
+ <xsd:enumeration value="K2"/>
+ <xsd:enumeration value="K3"/>
+ <xsd:enumeration value="K5"/>
+ <xsd:enumeration value="K6"/>
+ <xsd:enumeration value="KA"/>
+ <xsd:enumeration value="KB"/>
+ <xsd:enumeration value="KBA"/>
+ <xsd:enumeration value="KD"/>
+ <xsd:enumeration value="KEL"/>
+ <xsd:enumeration value="KF"/>
+ <xsd:enumeration value="KG"/>
+ <xsd:enumeration value="KGM"/>
+ <xsd:enumeration value="KGS"/>
+ <xsd:enumeration value="KHZ"/>
+ <xsd:enumeration value="KI"/>
+ <xsd:enumeration value="KJ"/>
+ <xsd:enumeration value="KJO"/>
+ <xsd:enumeration value="KK"/>
+ <xsd:enumeration value="KL"/>
+ <xsd:enumeration value="KMH"/>
+ <xsd:enumeration value="KMK"/>
+ <xsd:enumeration value="KMQ"/>
+ <xsd:enumeration value="KNI"/>
+ <xsd:enumeration value="KNS"/>
+ <xsd:enumeration value="KNT"/>
+ <xsd:enumeration value="KO"/>
+ <xsd:enumeration value="KPA"/>
+ <xsd:enumeration value="KPH"/>
+ <xsd:enumeration value="KPO"/>
+ <xsd:enumeration value="KPP"/>
+ <xsd:enumeration value="KR"/>
+ <xsd:enumeration value="KS"/>
+ <xsd:enumeration value="KSD"/>
+ <xsd:enumeration value="KSH"/>
+ <xsd:enumeration value="KT"/>
+ <xsd:enumeration value="KMT"/>
+ <xsd:enumeration value="KTN"/>
+ <xsd:enumeration value="KUR"/>
+ <xsd:enumeration value="KVA"/>
+ <xsd:enumeration value="KVR"/>
+ <xsd:enumeration value="KVT"/>
+ <xsd:enumeration value="KW"/>
+ <xsd:enumeration value="KWH"/>
+ <xsd:enumeration value="KWT"/>
+ <xsd:enumeration value="KX"/>
+ <xsd:enumeration value="L2"/>
+ <xsd:enumeration value="LA"/>
+ <xsd:enumeration value="LBR"/>
+ <xsd:enumeration value="LBT"/>
+ <xsd:enumeration value="LC"/>
+ <xsd:enumeration value="LD"/>
+ <xsd:enumeration value="LE"/>
+ <xsd:enumeration value="LEF"/>
+ <xsd:enumeration value="LF"/>
+ <xsd:enumeration value="LG"/>
+ <xsd:enumeration value="LH"/>
+ <xsd:enumeration value="LI"/>
+ <xsd:enumeration value="LJ"/>
+ <xsd:enumeration value="LK"/>
+ <xsd:enumeration value="LM"/>
+ <xsd:enumeration value="LN"/>
+ <xsd:enumeration value="LO"/>
+ <xsd:enumeration value="LP"/>
+ <xsd:enumeration value="LPA"/>
+ <xsd:enumeration value="LR"/>
+ <xsd:enumeration value="LS"/>
+ <xsd:enumeration value="LTN"/>
+ <xsd:enumeration value="LTR"/>
+ <xsd:enumeration value="LUM"/>
+ <xsd:enumeration value="LUX"/>
+ <xsd:enumeration value="LX"/>
+ <xsd:enumeration value="LY"/>
+ <xsd:enumeration value="M0"/>
+ <xsd:enumeration value="M1"/>
+ <xsd:enumeration value="M2"/>
+ <xsd:enumeration value="M4"/>
+ <xsd:enumeration value="M5"/>
+ <xsd:enumeration value="M7"/>
+ <xsd:enumeration value="M9"/>
+ <xsd:enumeration value="MA"/>
+ <xsd:enumeration value="MAL"/>
+ <xsd:enumeration value="MAM"/>
+ <xsd:enumeration value="MAW"/>
+ <xsd:enumeration value="MB"/>
+ <xsd:enumeration value="MBE"/>
+ <xsd:enumeration value="MBF"/>
+ <xsd:enumeration value="MBR"/>
+ <xsd:enumeration value="MC"/>
+ <xsd:enumeration value="MCU"/>
+ <xsd:enumeration value="MD"/>
+ <xsd:enumeration value="MF"/>
+ <xsd:enumeration value="MGM"/>
+ <xsd:enumeration value="MH"/>
+ <xsd:enumeration value="MHZ"/>
+ <xsd:enumeration value="MI"/>
+ <xsd:enumeration value="MIK"/>
+ <xsd:enumeration value="MIL"/>
+ <xsd:enumeration value="MIN"/>
+ <xsd:enumeration value="MIO"/>
+ <xsd:enumeration value="MIU"/>
+ <xsd:enumeration value="MK"/>
+ <xsd:enumeration value="MLD"/>
+ <xsd:enumeration value="MLT"/>
+ <xsd:enumeration value="MMK"/>
+ <xsd:enumeration value="MMQ"/>
+ <xsd:enumeration value="MMT"/>
+ <xsd:enumeration value="MON"/>
+ <xsd:enumeration value="MPA"/>
+ <xsd:enumeration value="MQ"/>
+ <xsd:enumeration value="MQH"/>
+ <xsd:enumeration value="MQS"/>
+ <xsd:enumeration value="MSK"/>
+ <xsd:enumeration value="MT"/>
+ <xsd:enumeration value="MTK"/>
+ <xsd:enumeration value="MTQ"/>
+ <xsd:enumeration value="MTR"/>
+ <xsd:enumeration value="MTS"/>
+ <xsd:enumeration value="MV"/>
+ <xsd:enumeration value="MVA"/>
+ <xsd:enumeration value="MW"/>
+ <xsd:enumeration value="MWH"/>
+ <xsd:enumeration value="MX"/>
+ <xsd:enumeration value="MY"/>
+ <xsd:enumeration value="MZ"/>
+ <xsd:enumeration value="N1"/>
+ <xsd:enumeration value="N2"/>
+ <xsd:enumeration value="N3"/>
+ <xsd:enumeration value="NA"/>
+ <xsd:enumeration value="NAR"/>
+ <xsd:enumeration value="NB"/>
+ <xsd:enumeration value="NBB"/>
+ <xsd:enumeration value="NC"/>
+ <xsd:enumeration value="NCL"/>
+ <xsd:enumeration value="ND"/>
+ <xsd:enumeration value="NE"/>
+ <xsd:enumeration value="NEW"/>
+ <xsd:enumeration value="NF"/>
+ <xsd:enumeration value="NG"/>
+ <xsd:enumeration value="NH"/>
+ <xsd:enumeration value="NI"/>
+ <xsd:enumeration value="NIU"/>
+ <xsd:enumeration value="NJ"/>
+ <xsd:enumeration value="NL"/>
+ <xsd:enumeration value="NMI"/>
+ <xsd:enumeration value="NMP"/>
+ <xsd:enumeration value="NN"/>
+ <xsd:enumeration value="NPL"/>
+ <xsd:enumeration value="NPR"/>
+ <xsd:enumeration value="NPT"/>
+ <xsd:enumeration value="NQ"/>
+ <xsd:enumeration value="NR"/>
+ <xsd:enumeration value="NRL"/>
+ <xsd:enumeration value="NT"/>
+ <xsd:enumeration value="NTT"/>
+ <xsd:enumeration value="NU"/>
+ <xsd:enumeration value="NV"/>
+ <xsd:enumeration value="NX"/>
+ <xsd:enumeration value="NY"/>
+ <xsd:enumeration value="OA"/>
+ <xsd:enumeration value="OHM"/>
+ <xsd:enumeration value="ON"/>
+ <xsd:enumeration value="ONZ"/>
+ <xsd:enumeration value="OP"/>
+ <xsd:enumeration value="OT"/>
+ <xsd:enumeration value="OZ"/>
+ <xsd:enumeration value="OZA"/>
+ <xsd:enumeration value="OZI"/>
+ <xsd:enumeration value="P0"/>
+ <xsd:enumeration value="P1"/>
+ <xsd:enumeration value="P2"/>
+ <xsd:enumeration value="P3"/>
+ <xsd:enumeration value="P4"/>
+ <xsd:enumeration value="P5"/>
+ <xsd:enumeration value="P6"/>
+ <xsd:enumeration value="P7"/>
+ <xsd:enumeration value="P8"/>
+ <xsd:enumeration value="P9"/>
+ <xsd:enumeration value="PA"/>
+ <xsd:enumeration value="PAL"/>
+ <xsd:enumeration value="PB"/>
+ <xsd:enumeration value="PD"/>
+ <xsd:enumeration value="PE"/>
+ <xsd:enumeration value="PF"/>
+ <xsd:enumeration value="PG"/>
+ <xsd:enumeration value="PGL"/>
+ <xsd:enumeration value="PI"/>
+ <xsd:enumeration value="PK"/>
+ <xsd:enumeration value="PL"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PN"/>
+ <xsd:enumeration value="PO"/>
+ <xsd:enumeration value="PQ"/>
+ <xsd:enumeration value="PR"/>
+ <xsd:enumeration value="PS"/>
+ <xsd:enumeration value="PT"/>
+ <xsd:enumeration value="PTD"/>
+ <xsd:enumeration value="PTI"/>
+ <xsd:enumeration value="PTL"/>
+ <xsd:enumeration value="PU"/>
+ <xsd:enumeration value="PV"/>
+ <xsd:enumeration value="PW"/>
+ <xsd:enumeration value="PY"/>
+ <xsd:enumeration value="PZ"/>
+ <xsd:enumeration value="Q1"/>
+ <xsd:enumeration value="Q2"/>
+ <xsd:enumeration value="Q3"/>
+ <xsd:enumeration value="Q4"/>
+ <xsd:enumeration value="Q5"/>
+ <xsd:enumeration value="Q6"/>
+ <xsd:enumeration value="Q7"/>
+ <xsd:enumeration value="QA"/>
+ <xsd:enumeration value="QAN"/>
+ <xsd:enumeration value="QB"/>
+ <xsd:enumeration value="QD"/>
+ <xsd:enumeration value="QH"/>
+ <xsd:enumeration value="QK"/>
+ <xsd:enumeration value="QR"/>
+ <xsd:enumeration value="QS"/>
+ <xsd:enumeration value="QT"/>
+ <xsd:enumeration value="QTD"/>
+ <xsd:enumeration value="QTI"/>
+ <xsd:enumeration value="QTL"/>
+ <xsd:enumeration value="QTR"/>
+ <xsd:enumeration value="R1"/>
+ <xsd:enumeration value="R4"/>
+ <xsd:enumeration value="R5"/>
+ <xsd:enumeration value="R6"/>
+ <xsd:enumeration value="R9"/>
+ <xsd:enumeration value="RA"/>
+ <xsd:enumeration value="RD"/>
+ <xsd:enumeration value="RG"/>
+ <xsd:enumeration value="RH"/>
+ <xsd:enumeration value="RK"/>
+ <xsd:enumeration value="RL"/>
+ <xsd:enumeration value="RM"/>
+ <xsd:enumeration value="RN"/>
+ <xsd:enumeration value="RO"/>
+ <xsd:enumeration value="RP"/>
+ <xsd:enumeration value="RPM"/>
+ <xsd:enumeration value="RPS"/>
+ <xsd:enumeration value="RS"/>
+ <xsd:enumeration value="RT"/>
+ <xsd:enumeration value="RU"/>
+ <xsd:enumeration value="S3"/>
+ <xsd:enumeration value="S4"/>
+ <xsd:enumeration value="S5"/>
+ <xsd:enumeration value="S6"/>
+ <xsd:enumeration value="S7"/>
+ <xsd:enumeration value="S8"/>
+ <xsd:enumeration value="SA"/>
+ <xsd:enumeration value="SAN"/>
+ <xsd:enumeration value="SCO"/>
+ <xsd:enumeration value="SCR"/>
+ <xsd:enumeration value="SD"/>
+ <xsd:enumeration value="SE"/>
+ <xsd:enumeration value="SEC"/>
+ <xsd:enumeration value="SET"/>
+ <xsd:enumeration value="SG"/>
+ <xsd:enumeration value="SHT"/>
+ <xsd:enumeration value="SIE"/>
+ <xsd:enumeration value="SK"/>
+ <xsd:enumeration value="SL"/>
+ <xsd:enumeration value="SMI"/>
+ <xsd:enumeration value="SN"/>
+ <xsd:enumeration value="SO"/>
+ <xsd:enumeration value="SP"/>
+ <xsd:enumeration value="SQ"/>
+ <xsd:enumeration value="SR"/>
+ <xsd:enumeration value="SS"/>
+ <xsd:enumeration value="SST"/>
+ <xsd:enumeration value="ST"/>
+ <xsd:enumeration value="STI"/>
+ <xsd:enumeration value="STN"/>
+ <xsd:enumeration value="SV"/>
+ <xsd:enumeration value="SW"/>
+ <xsd:enumeration value="SX"/>
+ <xsd:enumeration value="T0"/>
+ <xsd:enumeration value="T1"/>
+ <xsd:enumeration value="T2"/>
+ <xsd:enumeration value="T3"/>
+ <xsd:enumeration value="T4"/>
+ <xsd:enumeration value="T5"/>
+ <xsd:enumeration value="T6"/>
+ <xsd:enumeration value="T7"/>
+ <xsd:enumeration value="T8"/>
+ <xsd:enumeration value="T9"/>
+ <xsd:enumeration value="TA"/>
+ <xsd:enumeration value="TAH"/>
+ <xsd:enumeration value="TC"/>
+ <xsd:enumeration value="TD"/>
+ <xsd:enumeration value="TE"/>
+ <xsd:enumeration value="TF"/>
+ <xsd:enumeration value="TI"/>
+ <xsd:enumeration value="TJ"/>
+ <xsd:enumeration value="TK"/>
+ <xsd:enumeration value="TL"/>
+ <xsd:enumeration value="TM"/>
+ <xsd:enumeration value="TN"/>
+ <xsd:enumeration value="TNE"/>
+ <xsd:enumeration value="TP"/>
+ <xsd:enumeration value="TPR"/>
+ <xsd:enumeration value="TQ"/>
+ <xsd:enumeration value="TQD"/>
+ <xsd:enumeration value="TR"/>
+ <xsd:enumeration value="TRL"/>
+ <xsd:enumeration value="TS"/>
+ <xsd:enumeration value="TSD"/>
+ <xsd:enumeration value="TSH"/>
+ <xsd:enumeration value="TT"/>
+ <xsd:enumeration value="TU"/>
+ <xsd:enumeration value="TV"/>
+ <xsd:enumeration value="TW"/>
+ <xsd:enumeration value="TY"/>
+ <xsd:enumeration value="U1"/>
+ <xsd:enumeration value="U2"/>
+ <xsd:enumeration value="U3"/>
+ <xsd:enumeration value="U5"/>
+ <xsd:enumeration value="UA"/>
+ <xsd:enumeration value="UB"/>
+ <xsd:enumeration value="UC"/>
+ <xsd:enumeration value="UD"/>
+ <xsd:enumeration value="UE"/>
+ <xsd:enumeration value="UF"/>
+ <xsd:enumeration value="UH"/>
+ <xsd:enumeration value="UL"/>
+ <xsd:enumeration value="UM"/>
+ <xsd:enumeration value="VA"/>
+ <xsd:enumeration value="VC"/>
+ <xsd:enumeration value="VI"/>
+ <xsd:enumeration value="VLT"/>
+ <xsd:enumeration value="VQ"/>
+ <xsd:enumeration value="VS"/>
+ <xsd:enumeration value="VT"/>
+ <xsd:enumeration value="W2"/>
+ <xsd:enumeration value="W4"/>
+ <xsd:enumeration value="WA"/>
+ <xsd:enumeration value="WB"/>
+ <xsd:enumeration value="WCD"/>
+ <xsd:enumeration value="WE"/>
+ <xsd:enumeration value="WEB"/>
+ <xsd:enumeration value="WEE"/>
+ <xsd:enumeration value="WG"/>
+ <xsd:enumeration value="WH"/>
+ <xsd:enumeration value="WHR"/>
+ <xsd:enumeration value="WI"/>
+ <xsd:enumeration value="WM"/>
+ <xsd:enumeration value="WR"/>
+ <xsd:enumeration value="WSD"/>
+ <xsd:enumeration value="WTT"/>
+ <xsd:enumeration value="WW"/>
+ <xsd:enumeration value="X1"/>
+ <xsd:enumeration value="YDK"/>
+ <xsd:enumeration value="YDQ"/>
+ <xsd:enumeration value="YL"/>
+ <xsd:enumeration value="YRD"/>
+ <xsd:enumeration value="YT"/>
+ <xsd:enumeration value="Z1"/>
+ <xsd:enumeration value="Z2"/>
+ <xsd:enumeration value="Z3"/>
+ <xsd:enumeration value="Z4"/>
+ <xsd:enumeration value="Z5"/>
+ <xsd:enumeration value="Z6"/>
+ <xsd:enumeration value="Z8"/>
+ <xsd:enumeration value="ZP"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfDimension">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Dimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDimension" type="ListOfDimension"/>
+ <xsd:complexType name="Dimension">
+ <xsd:sequence>
+ <xsd:element ref="Measurement"/>
+ <xsd:element name="DimensionCoded" type="DimensionCode"/>
+ <xsd:element minOccurs="0" name="DimensionCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Dimension" type="Dimension"/>
+ <xsd:complexType name="Measurement">
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element ref="MeasurementValue"/>
+ <xsd:element ref="MeasurementRange"/>
+ </xsd:choice>
+ <xsd:element ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Measurement" type="Measurement"/>
+ <xsd:complexType name="MeasurementValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MeasurementValue" type="MeasurementValue"/>
+ <xsd:simpleType name="SignificanceCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Approximately"/>
+ <xsd:enumeration value="EqualTo"/>
+ <xsd:enumeration value="GreaterThanOrEqualTo"/>
+ <xsd:enumeration value="GreaterThan"/>
+ <xsd:enumeration value="LessThan"/>
+ <xsd:enumeration value="LessThanOrEqualTo"/>
+ <xsd:enumeration value="NotEqualTo"/>
+ <xsd:enumeration value="Trace"/>
+ <xsd:enumeration value="TrueValue"/>
+ <xsd:enumeration value="ObservedValue"/>
+ <xsd:enumeration value="OutOfRange"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ConditionsCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="WhereAirEquals1"/>
+ <xsd:enumeration value="WhereButylAcetateEquals1"/>
+ <xsd:enumeration value="WhereH2OEquals1OrWaterEquals1"/>
+ <xsd:enumeration value="CorrectedTo60DegreesFahrenheit"/>
+ <xsd:enumeration value="WhereTolueneEquals1"/>
+ <xsd:enumeration value="VaporInAir"/>
+ <xsd:enumeration value="VaporInOtherThanAir"/>
+ <xsd:enumeration value="StandardTemperatureAndPressure"/>
+ <xsd:enumeration value="ConditionsOtherThanStandardTemperatureAndPressure"/>
+ <xsd:enumeration value="InEthylAlcohol"/>
+ <xsd:enumeration value="InEthylEther"/>
+ <xsd:enumeration value="InWater"/>
+ <xsd:enumeration value="At1AtmospherePressure"/>
+ <xsd:enumeration value="WhereEtherEquals1"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="Predicted"/>
+ <xsd:enumeration value="Air-DriedBasis"/>
+ <xsd:enumeration value="As-ReceivedBasis"/>
+ <xsd:enumeration value="DryBasis"/>
+ <xsd:enumeration value="EquilibriumBasis"/>
+ <xsd:enumeration value="MoistureAndAsh-FreeBasis"/>
+ <xsd:enumeration value="OxidizingAtmosphere"/>
+ <xsd:enumeration value="ReducingAtmosphere"/>
+ <xsd:enumeration value="Calculated"/>
+ <xsd:enumeration value="ScaledWeight"/>
+ <xsd:enumeration value="Ratchet"/>
+ <xsd:enumeration value="SaturatedVapor"/>
+ <xsd:enumeration value="Unconditional"/>
+ <xsd:enumeration value="Short-Term"/>
+ <xsd:enumeration value="Time-Weighted"/>
+ <xsd:enumeration value="Corrected"/>
+ <xsd:enumeration value="Uncorrected"/>
+ <xsd:enumeration value="OffPeak"/>
+ <xsd:enumeration value="OnPeak"/>
+ <xsd:enumeration value="Intermediate"/>
+ <xsd:enumeration value="Average"/>
+ <xsd:enumeration value="PerGallon"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="Minimum"/>
+ <xsd:enumeration value="Mist"/>
+ <xsd:enumeration value="Predominant"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="Cost"/>
+ <xsd:enumeration value="Tenant"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="ForSale"/>
+ <xsd:enumeration value="RealEstateOwnedOrCorporateOwned"/>
+ <xsd:enumeration value="BoardedOrBlockedUp"/>
+ <xsd:enumeration value="Planned"/>
+ <xsd:enumeration value="Completed"/>
+ <xsd:enumeration value="Sold"/>
+ <xsd:enumeration value="Rented"/>
+ <xsd:enumeration value="Current"/>
+ <xsd:enumeration value="CurrentList"/>
+ <xsd:enumeration value="Effective"/>
+ <xsd:enumeration value="ListWhenSold"/>
+ <xsd:enumeration value="Sales"/>
+ <xsd:enumeration value="FinalList"/>
+ <xsd:enumeration value="AsIs"/>
+ <xsd:enumeration value="AsRepairedOrImproved"/>
+ <xsd:enumeration value="Instantaneous"/>
+ <xsd:enumeration value="Low"/>
+ <xsd:enumeration value="LowToGood"/>
+ <xsd:enumeration value="LowToHigh"/>
+ <xsd:enumeration value="LowToMedium"/>
+ <xsd:enumeration value="LowToModerate"/>
+ <xsd:enumeration value="Medium"/>
+ <xsd:enumeration value="MediumToGood"/>
+ <xsd:enumeration value="MediumToHigh"/>
+ <xsd:enumeration value="Moderate"/>
+ <xsd:enumeration value="ModerateToGood"/>
+ <xsd:enumeration value="ModerateToHigh"/>
+ <xsd:enumeration value="ModerateToMedium"/>
+ <xsd:enumeration value="Good"/>
+ <xsd:enumeration value="GoodToHigh"/>
+ <xsd:enumeration value="High"/>
+ <xsd:enumeration value="Budgeted"/>
+ <xsd:enumeration value="Forecast"/>
+ <xsd:enumeration value="Adjusted"/>
+ <xsd:enumeration value="Allocated"/>
+ <xsd:enumeration value="Increasing"/>
+ <xsd:enumeration value="Stable"/>
+ <xsd:enumeration value="Declining"/>
+ <xsd:enumeration value="Previous"/>
+ <xsd:enumeration value="Potential"/>
+ <xsd:enumeration value="Modeled"/>
+ <xsd:enumeration value="Measured"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="SummerOn-Peak"/>
+ <xsd:enumeration value="SummerMid-Peak"/>
+ <xsd:enumeration value="SummerOff-Peak"/>
+ <xsd:enumeration value="SummerSuperOn-Peak"/>
+ <xsd:enumeration value="SummerSuperOff-Peak"/>
+ <xsd:enumeration value="WinterOn-Peak"/>
+ <xsd:enumeration value="WinterMid-Peak"/>
+ <xsd:enumeration value="WinterOff-Peak"/>
+ <xsd:enumeration value="WinterSuperOn-Peak"/>
+ <xsd:enumeration value="WinterSuperOff-Peak"/>
+ <xsd:enumeration value="SummerDay"/>
+ <xsd:enumeration value="SummerNight"/>
+ <xsd:enumeration value="WinterDay"/>
+ <xsd:enumeration value="WinterNight"/>
+ <xsd:enumeration value="Summer"/>
+ <xsd:enumeration value="Winter"/>
+ <xsd:enumeration value="Day"/>
+ <xsd:enumeration value="Night"/>
+ <xsd:enumeration value="Peak-2"/>
+ <xsd:enumeration value="Peak-3"/>
+ <xsd:enumeration value="Peak-4"/>
+ <xsd:enumeration value="Shoulder"/>
+ <xsd:enumeration value="NonTimeRelatedDemand"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="MeasurementRange">
+ <xsd:sequence>
+ <xsd:element ref="MinimumValue"/>
+ <xsd:element ref="MaximumValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MeasurementRange" type="MeasurementRange"/>
+ <xsd:complexType name="MinimumValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MinimumValue" type="MinimumValue"/>
+ <xsd:complexType name="MaximumValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="MaximumValue" type="MaximumValue"/>
+ <xsd:simpleType name="DimensionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ConsolidatedWeight"/>
+ <xsd:enumeration value="UnitNetWeight"/>
+ <xsd:enumeration value="UnitGrossWeight"/>
+ <xsd:enumeration value="TotalNetWeight"/>
+ <xsd:enumeration value="TotalGrossWeight"/>
+ <xsd:enumeration value="ItemGrossWeight"/>
+ <xsd:enumeration value="NetNetWeight"/>
+ <xsd:enumeration value="NumberOfUnitsPerPallet"/>
+ <xsd:enumeration value="FatContent"/>
+ <xsd:enumeration value="NetWeight"/>
+ <xsd:enumeration value="GrossTonnageOfTheVessel"/>
+ <xsd:enumeration value="NetTonnageOfTheVessel"/>
+ <xsd:enumeration value="Humidity"/>
+ <xsd:enumeration value="Voltage"/>
+ <xsd:enumeration value="PowerConsumption"/>
+ <xsd:enumeration value="HeatDissipation"/>
+ <xsd:enumeration value="AirFlow"/>
+ <xsd:enumeration value="ShockImpact"/>
+ <xsd:enumeration value="OperativeTemperature"/>
+ <xsd:enumeration value="NonOperativeTemperature"/>
+ <xsd:enumeration value="GrossVolume"/>
+ <xsd:enumeration value="NetVolume"/>
+ <xsd:enumeration value="WaterContent"/>
+ <xsd:enumeration value="TensileStress"/>
+ <xsd:enumeration value="Fibrosity"/>
+ <xsd:enumeration value="GaugeLength"/>
+ <xsd:enumeration value="Radius"/>
+ <xsd:enumeration value="Straightness"/>
+ <xsd:enumeration value="Strain"/>
+ <xsd:enumeration value="Volume"/>
+ <xsd:enumeration value="ItemWeight"/>
+ <xsd:enumeration value="WeightOfConveyance"/>
+ <xsd:enumeration value="ConveyanceSummerDeadWeight"/>
+ <xsd:enumeration value="ContainerizedCargoOnVesselsWeight"/>
+ <xsd:enumeration value="Non-ContainerizedCargoOnVesselsWeight"/>
+ <xsd:enumeration value="WeightAscertained"/>
+ <xsd:enumeration value="ChargeableWeight"/>
+ <xsd:enumeration value="EstimatedGrossWeight"/>
+ <xsd:enumeration value="EstimatedVolume"/>
+ <xsd:enumeration value="VesselOverallLength"/>
+ <xsd:enumeration value="LoadingMeters"/>
+ <xsd:enumeration value="NumberOfAxles"/>
+ <xsd:enumeration value="Payload"/>
+ <xsd:enumeration value="StartPositionInTheLength"/>
+ <xsd:enumeration value="EndPositionInTheLength"/>
+ <xsd:enumeration value="StartPositionInTheWidth"/>
+ <xsd:enumeration value="EndPositionInTheWidth"/>
+ <xsd:enumeration value="StartPositionInTheThickness"/>
+ <xsd:enumeration value="EndPositionInTheThickness"/>
+ <xsd:enumeration value="TransportContainerActualFillingWeight"/>
+ <xsd:enumeration value="TransportContainerMaximumCapacity"/>
+ <xsd:enumeration value="DeclaredNetWeight"/>
+ <xsd:enumeration value="LoadingHeight"/>
+ <xsd:enumeration value="StackingHeight"/>
+ <xsd:enumeration value="CalculatedWeight"/>
+ <xsd:enumeration value="Ferrite"/>
+ <xsd:enumeration value="Impurity"/>
+ <xsd:enumeration value="GrainSize"/>
+ <xsd:enumeration value="Lanthanides"/>
+ <xsd:enumeration value="Elasticity"/>
+ <xsd:enumeration value="DrainedWeight"/>
+ <xsd:enumeration value="Gallium"/>
+ <xsd:enumeration value="Strontium"/>
+ <xsd:enumeration value="EquipmentStorageLimitation"/>
+ <xsd:enumeration value="RadioactiveIndexOfTransport"/>
+ <xsd:enumeration value="Radioactivity"/>
+ <xsd:enumeration value="AverageGrossWeight"/>
+ <xsd:enumeration value="ForwardDraft"/>
+ <xsd:enumeration value="AfterDraft"/>
+ <xsd:enumeration value="TransportEquipmentGrossWeight"/>
+ <xsd:enumeration value="TotalTransportEquipmentGrossWeight"/>
+ <xsd:enumeration value="AcidityOfJuice"/>
+ <xsd:enumeration value="Penetrometry"/>
+ <xsd:enumeration value="Durofel"/>
+ <xsd:enumeration value="JuiceWeightPer100Grams"/>
+ <xsd:enumeration value="FruitSkinColour"/>
+ <xsd:enumeration value="AngleOfBend"/>
+ <xsd:enumeration value="FixedIncrementalMeasurement"/>
+ <xsd:enumeration value="DurofelD10"/>
+ <xsd:enumeration value="DurofelD25"/>
+ <xsd:enumeration value="DurofelD50"/>
+ <xsd:enumeration value="MaximumStackingWeight"/>
+ <xsd:enumeration value="GrossMeasureCube"/>
+ <xsd:enumeration value="PercentageFatContentInDryMatter"/>
+ <xsd:enumeration value="SaccharometricContent"/>
+ <xsd:enumeration value="HydrateContentOfAnAlcoholicProductAfterBottling"/>
+ <xsd:enumeration value="AnhydrousContent"/>
+ <xsd:enumeration value="CertifiedWeight"/>
+ <xsd:enumeration value="BilledWeight"/>
+ <xsd:enumeration value="BreakingLoad"/>
+ <xsd:enumeration value="Platinum"/>
+ <xsd:enumeration value="Silver"/>
+ <xsd:enumeration value="List"/>
+ <xsd:enumeration value="Trim"/>
+ <xsd:enumeration value="FreeWater"/>
+ <xsd:enumeration value="Bands"/>
+ <xsd:enumeration value="AmericanPetroleumInstituteGravity"/>
+ <xsd:enumeration value="PetroleumGrossObservedVolume"/>
+ <xsd:enumeration value="PetroleumGrossStandardVolume"/>
+ <xsd:enumeration value="VolumeVariance"/>
+ <xsd:enumeration value="PetroleumNetStandardVolume"/>
+ <xsd:enumeration value="MaterialOn-BoardQuantity-AfterDischarge"/>
+ <xsd:enumeration value="PetroleumTotalCalculatedVolume"/>
+ <xsd:enumeration value="PetroleumTotalObservedVolume"/>
+ <xsd:enumeration value="InnageGaugeDistance"/>
+ <xsd:enumeration value="PetroleumNetStandardWeight"/>
+ <xsd:enumeration value="SedimentAndWaterInPetroleum"/>
+ <xsd:enumeration value="ObservedReferenceHeight-Tank"/>
+ <xsd:enumeration value="ReferenceHeight-Tank"/>
+ <xsd:enumeration value="UllageGaugeDistance"/>
+ <xsd:enumeration value="TrimCorrection"/>
+ <xsd:enumeration value="BowToBridgeDistance"/>
+ <xsd:enumeration value="Brightness"/>
+ <xsd:enumeration value="Brakes"/>
+ <xsd:enumeration value="Break"/>
+ <xsd:enumeration value="BreakingStrength"/>
+ <xsd:enumeration value="BreakingStrengthWet"/>
+ <xsd:enumeration value="BasisWeight"/>
+ <xsd:enumeration value="Change"/>
+ <xsd:enumeration value="Colour"/>
+ <xsd:enumeration value="ContentsOfPackage"/>
+ <xsd:enumeration value="CommercialWeight"/>
+ <xsd:enumeration value="CoreLength"/>
+ <xsd:enumeration value="DestinationWeightAgreement"/>
+ <xsd:enumeration value="Diameter"/>
+ <xsd:enumeration value="DeltaValueL"/>
+ <xsd:enumeration value="Density"/>
+ <xsd:enumeration value="Depth"/>
+ <xsd:enumeration value="Denier"/>
+ <xsd:enumeration value="DistanceBetweenPoints"/>
+ <xsd:enumeration value="Width-BoxcarDoor"/>
+ <xsd:enumeration value="EstimatedNewWeight"/>
+ <xsd:enumeration value="Elongation"/>
+ <xsd:enumeration value="DeficitWeight"/>
+ <xsd:enumeration value="FilamentCount"/>
+ <xsd:enumeration value="LongitudinalFlatness"/>
+ <xsd:enumeration value="Flatness"/>
+ <xsd:enumeration value="TransverseFlatness"/>
+ <xsd:enumeration value="GrossWeight"/>
+ <xsd:enumeration value="Gauge"/>
+ <xsd:enumeration value="GrossWeight-Maximum"/>
+ <xsd:enumeration value="Hardness"/>
+ <xsd:enumeration value="Height-Maximum"/>
+ <xsd:enumeration value="HeightDimension"/>
+ <xsd:enumeration value="ImpactEnergy"/>
+ <xsd:enumeration value="InsideDiameter"/>
+ <xsd:enumeration value="LegalWeight"/>
+ <xsd:enumeration value="Length-Maximum"/>
+ <xsd:enumeration value="LengthDimension"/>
+ <xsd:enumeration value="LostEnd"/>
+ <xsd:enumeration value="MinimumWeight"/>
+ <xsd:enumeration value="Moisture"/>
+ <xsd:enumeration value="MaximumWeight"/>
+ <xsd:enumeration value="ActualNetWeight"/>
+ <xsd:enumeration value="OutsideDiameter"/>
+ <xsd:enumeration value="PreStretch"/>
+ <xsd:enumeration value="PerTonne"/>
+ <xsd:enumeration value="RelativeHumidity"/>
+ <xsd:enumeration value="Resistivity"/>
+ <xsd:enumeration value="RockwellC"/>
+ <xsd:enumeration value="ReamWeight"/>
+ <xsd:enumeration value="ReductionOfArea"/>
+ <xsd:enumeration value="Run-Process"/>
+ <xsd:enumeration value="Ratio"/>
+ <xsd:enumeration value="ShippedQuantity"/>
+ <xsd:enumeration value="TareWeight"/>
+ <xsd:enumeration value="Temperature"/>
+ <xsd:enumeration value="Thickness"/>
+ <xsd:enumeration value="TimePeriod"/>
+ <xsd:enumeration value="Time"/>
+ <xsd:enumeration value="WeightPerUnit"/>
+ <xsd:enumeration value="Height-VanDoor"/>
+ <xsd:enumeration value="Width-VanDoor"/>
+ <xsd:enumeration value="WeightPerUnitOfArea"/>
+ <xsd:enumeration value="WidthDimension"/>
+ <xsd:enumeration value="Width-Maximum"/>
+ <xsd:enumeration value="Weight"/>
+ <xsd:enumeration value="WeightPerUnitOfLength"/>
+ <xsd:enumeration value="SideHeight-FlatBedWithRemovableSides"/>
+ <xsd:enumeration value="Teir"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="Squareness"/>
+ <xsd:enumeration value="SpoolSize"/>
+ <xsd:enumeration value="YieldStress"/>
+ <xsd:enumeration value="Aluminium"/>
+ <xsd:enumeration value="Arsenic"/>
+ <xsd:enumeration value="Boron"/>
+ <xsd:enumeration value="Bismuth"/>
+ <xsd:enumeration value="Carbon"/>
+ <xsd:enumeration value="Calcium"/>
+ <xsd:enumeration value="Columbium"/>
+ <xsd:enumeration value="Cerium"/>
+ <xsd:enumeration value="Chlorine"/>
+ <xsd:enumeration value="Cobalt"/>
+ <xsd:enumeration value="Chromium"/>
+ <xsd:enumeration value="Copper"/>
+ <xsd:enumeration value="Iron"/>
+ <xsd:enumeration value="IronPlusSilicon"/>
+ <xsd:enumeration value="Germanium"/>
+ <xsd:enumeration value="Hydrogen"/>
+ <xsd:enumeration value="Potassium"/>
+ <xsd:enumeration value="Magnesium"/>
+ <xsd:enumeration value="Manganese"/>
+ <xsd:enumeration value="Molybdenum"/>
+ <xsd:enumeration value="Nitrogen"/>
+ <xsd:enumeration value="Sodium"/>
+ <xsd:enumeration value="Niobium"/>
+ <xsd:enumeration value="Nickel"/>
+ <xsd:enumeration value="Oxygen"/>
+ <xsd:enumeration value="Phosphorus"/>
+ <xsd:enumeration value="Lead"/>
+ <xsd:enumeration value="Sulphur"/>
+ <xsd:enumeration value="Antimony"/>
+ <xsd:enumeration value="Selenium"/>
+ <xsd:enumeration value="Silicon"/>
+ <xsd:enumeration value="SiliciumOxyd"/>
+ <xsd:enumeration value="Tin"/>
+ <xsd:enumeration value="Tantalium"/>
+ <xsd:enumeration value="Tellurium"/>
+ <xsd:enumeration value="Titanium"/>
+ <xsd:enumeration value="Vanadium"/>
+ <xsd:enumeration value="Tungsten"/>
+ <xsd:enumeration value="WasteContent"/>
+ <xsd:enumeration value="Zinc"/>
+ <xsd:enumeration value="Zirconium"/>
+ <xsd:enumeration value="StorageTemperature"/>
+ <xsd:enumeration value="TransportTemperature"/>
+ <xsd:enumeration value="CargoOperatingTemperature"/>
+ <xsd:enumeration value="TransportEmergencyTemperature"/>
+ <xsd:enumeration value="TransportControlTemperature"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Quantity">
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element ref="QuantityValue"/>
+ <xsd:element ref="QuantityRange"/>
+ </xsd:choice>
+ <xsd:element ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Quantity" type="Quantity"/>
+ <xsd:complexType name="QuantityValue">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:decimal">
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ <xsd:attribute name="ConditionsCoded" type="ConditionsCode" use="optional"/>
+ <xsd:attribute name="ConditionsCodedOther" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="QuantityValue" type="QuantityValue"/>
+ <xsd:complexType name="QuantityRange">
+ <xsd:sequence>
+ <xsd:element ref="MinimumValue"/>
+ <xsd:element ref="MaximumValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="QuantityRange" type="QuantityRange"/>
+ <xsd:complexType name="ListOfQuantityCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="QuantityCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfQuantityCoded" type="ListOfQuantityCoded"/>
+ <xsd:complexType name="QuantityCoded">
+ <xsd:complexContent>
+ <xsd:extension base="Quantity">
+ <xsd:sequence>
+ <xsd:element name="QuantityQualifierCoded" type="QuantityQualifierCode"/>
+ <xsd:element minOccurs="0" name="QuantityQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="QuantityCoded" type="QuantityCoded"/>
+ <xsd:simpleType name="QuantityQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AcceptableUnserviceableQuantity"/>
+ <xsd:enumeration value="Accidents"/>
+ <xsd:enumeration value="Accounts"/>
+ <xsd:enumeration value="AccountsPayableAverageOverdueDays"/>
+ <xsd:enumeration value="AccountsPlacedForCollection"/>
+ <xsd:enumeration value="AcknowledgedQuantity"/>
+ <xsd:enumeration value="ActiveAccounts"/>
+ <xsd:enumeration value="ActiveContractsDelinquent"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ActiveContractsDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ActiveIngredient"/>
+ <xsd:enumeration value="ActiveIngredientDosePerUnit"/>
+ <xsd:enumeration value="ActiveIngredientDosePerUnitDispensed"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ActiveLineItemsDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ActiveListings"/>
+ <xsd:enumeration value="ActiveMaintenanceTime"/>
+ <xsd:enumeration value="ActivityCodes"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="ActualDuration"/>
+ <xsd:enumeration value="ActualHours"/>
+ <xsd:enumeration value="ActualStock"/>
+ <xsd:enumeration value="ActualUnits"/>
+ <xsd:enumeration value="ActualUnitsCumulativeToDate"/>
+ <xsd:enumeration value="AddedEmployees"/>
+ <xsd:enumeration value="AdditionalAmount"/>
+ <xsd:enumeration value="AdditionalDemandQuantity"/>
+ <xsd:enumeration value="AdditionalPromotionSalesForecastQuantity"/>
+ <xsd:enumeration value="AdditionalReplenishmentDemandQuantity"/>
+ <xsd:enumeration value="AdditionalUsageQuantity"/>
+ <xsd:enumeration value="AdjustedCorrectorReading"/>
+ <xsd:enumeration value="AdjustedQuantity"/>
+ <xsd:enumeration value="AdjustedUnits"/>
+ <xsd:enumeration value="AdjustmentToInventoryQuantity"/>
+ <xsd:enumeration value="Administrators"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AgeAtDeath"/>
+ <xsd:enumeration value="AgedActiveLineItemsDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="AgedLineItemsCompleted-ContractorCaused"/>
+ <xsd:enumeration value="AgedLineItemsDelinquent"/>
+ <xsd:enumeration value="AgeHighValue"/>
+ <xsd:enumeration value="AgeLowValue"/>
+ <xsd:enumeration value="AgeModifyingUnits"/>
+ <xsd:enumeration value="AgeNearest"/>
+ <xsd:enumeration value="AgeNext"/>
+ <xsd:enumeration value="Agents"/>
+ <xsd:enumeration value="AgeOfFinancialInformation"/>
+ <xsd:enumeration value="AggregateBenefitPeriod"/>
+ <xsd:enumeration value="AgriculturalWorkers"/>
+ <xsd:enumeration value="AircraftRadios"/>
+ <xsd:enumeration value="AirlineAttendants"/>
+ <xsd:enumeration value="AllocatedQuantity"/>
+ <xsd:enumeration value="AllottedUsageQuantity"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllTimeBuy"/>
+ <xsd:enumeration value="AmortisationQuantity"/>
+ <xsd:enumeration value="AmortizationCumulatedQuantity"/>
+ <xsd:enumeration value="AmortizationOrderQuantity"/>
+ <xsd:enumeration value="AmortizationTerm"/>
+ <xsd:enumeration value="AmortizationTotalQuantity"/>
+ <xsd:enumeration value="AnticipatedLengthOfService"/>
+ <xsd:enumeration value="ApprovalOrOfferDuration"/>
+ <xsd:enumeration value="ApprovedAmount"/>
+ <xsd:enumeration value="ApproximateNumberOfHolders"/>
+ <xsd:enumeration value="ApproximateNumberOfUnitsForSaleProjected"/>
+ <xsd:enumeration value="ApproximateNumberOfUnitsProjected"/>
+ <xsd:enumeration value="AreaDamaged"/>
+ <xsd:enumeration value="AreaOfLevel"/>
+ <xsd:enumeration value="AreaPerUnits"/>
+ <xsd:enumeration value="Arrests"/>
+ <xsd:enumeration value="AsIsQuantity"/>
+ <xsd:enumeration value="AssetSeizers"/>
+ <xsd:enumeration value="Associates"/>
+ <xsd:enumeration value="AtCompleteVariance"/>
+ <xsd:enumeration value="AtCompletionQuantityEstimated"/>
+ <xsd:enumeration value="Attendant-HandledQuantity"/>
+ <xsd:enumeration value="Auctions"/>
+ <xsd:enumeration value="Auditor"/>
+ <xsd:enumeration value="AuthorisedShares"/>
+ <xsd:enumeration value="AuthorizedRetentionLevel"/>
+ <xsd:enumeration value="AuthorizedShares"/>
+ <xsd:enumeration value="AvailableQuantity"/>
+ <xsd:enumeration value="AvailableResourceTaskQuantity"/>
+ <xsd:enumeration value="AvailableUnits"/>
+ <xsd:enumeration value="Average"/>
+ <xsd:enumeration value="AverageEmployees"/>
+ <xsd:enumeration value="AverageNumberOfEmployees"/>
+ <xsd:enumeration value="Axles"/>
+ <xsd:enumeration value="BackorderLines"/>
+ <xsd:enumeration value="BackorderQuantity"/>
+ <xsd:enumeration value="BankRejectItemCount."/>
+ <xsd:enumeration value="BankruptcyPetitionsFiled"/>
+ <xsd:enumeration value="BathroomCount"/>
+ <xsd:enumeration value="BathroomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="BedroomCount"/>
+ <xsd:enumeration value="BedroomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="Beds"/>
+ <xsd:enumeration value="BeginningShares"/>
+ <xsd:enumeration value="BenefitAmount"/>
+ <xsd:enumeration value="BenefitPeriod"/>
+ <xsd:enumeration value="BillableQuantity"/>
+ <xsd:enumeration value="Billed"/>
+ <xsd:enumeration value="BillingUnitPerPricingUnit"/>
+ <xsd:enumeration value="BirthWeight"/>
+ <xsd:enumeration value="BlankVotes"/>
+ <xsd:enumeration value="BloodRecord"/>
+ <xsd:enumeration value="BookInventory"/>
+ <xsd:enumeration value="BookOrderQuantity"/>
+ <xsd:enumeration value="Branches"/>
+ <xsd:enumeration value="BranchLocations"/>
+ <xsd:enumeration value="BranchLocationsLeased"/>
+ <xsd:enumeration value="BranchLocationsOwned"/>
+ <xsd:enumeration value="BranchOfficeLocationsEstimated"/>
+ <xsd:enumeration value="BrothersDeceased"/>
+ <xsd:enumeration value="BrothersLiving"/>
+ <xsd:enumeration value="Budget"/>
+ <xsd:enumeration value="BudgetAtComplete"/>
+ <xsd:enumeration value="BudgetCumulativeToDate"/>
+ <xsd:enumeration value="BudgetedHours"/>
+ <xsd:enumeration value="BusinessClassFailureIncidences"/>
+ <xsd:enumeration value="BusinessFailureClassIncidence"/>
+ <xsd:enumeration value="BusinessFailureIndustryIncidence"/>
+ <xsd:enumeration value="BusinessFailureNationalAverageIncidence"/>
+ <xsd:enumeration value="Buyer"/>
+ <xsd:enumeration value="BuyupOrBuydownRatePerBasisPoint"/>
+ <xsd:enumeration value="Bytes"/>
+ <xsd:enumeration value="CalendarUnits"/>
+ <xsd:enumeration value="CancelledQuantity"/>
+ <xsd:enumeration value="CapitalChanges"/>
+ <xsd:enumeration value="CertifiedRegisteredNurseAnesthetistNumberOfConcurrentProcedures"/>
+ <xsd:enumeration value="Changes"/>
+ <xsd:enumeration value="ChangesInCapitalStructure"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeableCubicMeasurements"/>
+ <xsd:enumeration value="ChargeableDistance"/>
+ <xsd:enumeration value="ChargeableGrossWeight"/>
+ <xsd:enumeration value="ChargeableLength"/>
+ <xsd:enumeration value="ChargeableNumberOfAxles"/>
+ <xsd:enumeration value="ChargeableNumberOfContainers"/>
+ <xsd:enumeration value="ChargeableNumberOfPackages"/>
+ <xsd:enumeration value="ChargeableNumberOfRailWagons"/>
+ <xsd:enumeration value="ChargeableNumberOfUnits"/>
+ <xsd:enumeration value="ChargeablePeriod"/>
+ <xsd:enumeration value="ChargeableSurface"/>
+ <xsd:enumeration value="ChargeableTareWeight"/>
+ <xsd:enumeration value="ChargeableVolume"/>
+ <xsd:enumeration value="ChargeableWeight"/>
+ <xsd:enumeration value="Children"/>
+ <xsd:enumeration value="CirculatingOil"/>
+ <xsd:enumeration value="Citations"/>
+ <xsd:enumeration value="ClaimPeriod"/>
+ <xsd:enumeration value="Clerks"/>
+ <xsd:enumeration value="ClosingStatementBalance"/>
+ <xsd:enumeration value="ClosingStockBalanceQuantity"/>
+ <xsd:enumeration value="Co2InjectionVolume"/>
+ <xsd:enumeration value="Co-Insured-Actual"/>
+ <xsd:enumeration value="Co-Insured-Estimated"/>
+ <xsd:enumeration value="CollateralRequirements"/>
+ <xsd:enumeration value="CollectionPeriod"/>
+ <xsd:enumeration value="CommitmentPeriod"/>
+ <xsd:enumeration value="CommittedQuantity"/>
+ <xsd:enumeration value="CommunityServiceDuration"/>
+ <xsd:enumeration value="CompaniesIncludedInConsolidatedFinancialStatement"/>
+ <xsd:enumeration value="CompaniesIncludedInConsolidation"/>
+ <xsd:enumeration value="CompaniesInSameActivity"/>
+ <xsd:enumeration value="ComparisonPeriod"/>
+ <xsd:enumeration value="Completed"/>
+ <xsd:enumeration value="CompletedContracts"/>
+ <xsd:enumeration value="CompletedLineItems"/>
+ <xsd:enumeration value="CompletedProjects"/>
+ <xsd:enumeration value="ComponentMeterReadingCount"/>
+ <xsd:enumeration value="ConcurrentItemOutputOfTooling"/>
+ <xsd:enumeration value="Confirmed"/>
+ <xsd:enumeration value="ConsolidatedDiscountInventory"/>
+ <xsd:enumeration value="ConsumerReservedQuantity"/>
+ <xsd:enumeration value="ContinuanceDuration"/>
+ <xsd:enumeration value="ContractBuydown"/>
+ <xsd:enumeration value="ContractBuyup"/>
+ <xsd:enumeration value="ContractCompletedDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="ContractLineItemQuantity"/>
+ <xsd:enumeration value="ContractorAtComplete"/>
+ <xsd:enumeration value="ContractorCumulativeToDate"/>
+ <xsd:enumeration value="ContractsCompletedDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="ContractsCompletedDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="ContributionTotal"/>
+ <xsd:enumeration value="ControlQuantity"/>
+ <xsd:enumeration value="ConventionalMobiles"/>
+ <xsd:enumeration value="ConvictionsSent"/>
+ <xsd:enumeration value="CooperativeShares"/>
+ <xsd:enumeration value="CorrectedQuantity"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodC"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodD"/>
+ <xsd:enumeration value="CorrectiveActionRequests-MethodE"/>
+ <xsd:enumeration value="CorrectiveActionRequests-Verbal"/>
+ <xsd:enumeration value="CorrectiveActionRequests-Written"/>
+ <xsd:enumeration value="CounterClerks"/>
+ <xsd:enumeration value="CourseSegments"/>
+ <xsd:enumeration value="Coverage"/>
+ <xsd:enumeration value="Covered-Actual"/>
+ <xsd:enumeration value="Covered-Estimated"/>
+ <xsd:enumeration value="Creditors"/>
+ <xsd:enumeration value="CriminalSentenceDuration"/>
+ <xsd:enumeration value="CumulativeActual"/>
+ <xsd:enumeration value="CumulativeBudget"/>
+ <xsd:enumeration value="CumulativeEarnedValue"/>
+ <xsd:enumeration value="CumulativeEffectOfPriorPeriodAdjustment"/>
+ <xsd:enumeration value="CumulativeGasInjectionVolume"/>
+ <xsd:enumeration value="CumulativeGasVolume"/>
+ <xsd:enumeration value="CumulativeLiquidInjectionVolume"/>
+ <xsd:enumeration value="CumulativeOilOrCondensateVolume"/>
+ <xsd:enumeration value="CumulativeQuantity"/>
+ <xsd:enumeration value="CumulativeQuantityActualEstimated"/>
+ <xsd:enumeration value="CumulativeQuantityActualMeasured"/>
+ <xsd:enumeration value="CumulativeQuantityActualPlanned"/>
+ <xsd:enumeration value="CumulativeQuantityOrdered"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodEstimated"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodMeasured"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodPlanned"/>
+ <xsd:enumeration value="CumulativeQuantityPrecedingPeriodReached"/>
+ <xsd:enumeration value="CumulativeQuantityReceived"/>
+ <xsd:enumeration value="CumulativeQuantityReceivedEndOfPriorYear"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionCredit"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionPending"/>
+ <xsd:enumeration value="CumulativeQuantity-RejectedMaterial-DispositionReplacement"/>
+ <xsd:enumeration value="CumulativeQuantityRequiredPriorToTheFirstScheduledPeriod"/>
+ <xsd:enumeration value="CumulativeQuantityScheduled"/>
+ <xsd:enumeration value="CumulativeQuantityScheduledUpToAccumulationStartDate"/>
+ <xsd:enumeration value="CumulativeQuantityShipped"/>
+ <xsd:enumeration value="CumulativeQuantityShippedLong-DispositionChallenged"/>
+ <xsd:enumeration value="CumulativeQuantityShippedLong-DispositionPending"/>
+ <xsd:enumeration value="CumulativeQuantityShippedShort-DispositionChallenged"/>
+ <xsd:enumeration value="CumulativeQuantityShippedShort-DispositionPending"/>
+ <xsd:enumeration value="CumulativeScheduleVariance"/>
+ <xsd:enumeration value="CumulativeScrapQuantity"/>
+ <xsd:enumeration value="CumulativeVariance"/>
+ <xsd:enumeration value="CumulativeWaterVolume"/>
+ <xsd:enumeration value="CurrentDaysOnMarket"/>
+ <xsd:enumeration value="DeductibleBloodUnits"/>
+ <xsd:enumeration value="DefaultNotificationResponsePeriod"/>
+ <xsd:enumeration value="DegreeSegments"/>
+ <xsd:enumeration value="Deleted"/>
+ <xsd:enumeration value="DeliveryBatch"/>
+ <xsd:enumeration value="DeliveryBatchMultiple"/>
+ <xsd:enumeration value="DeliveryQuantity"/>
+ <xsd:enumeration value="DeliveryQuantityBalance"/>
+ <xsd:enumeration value="Departments"/>
+ <xsd:enumeration value="DependentCount"/>
+ <xsd:enumeration value="DependentsAge"/>
+ <xsd:enumeration value="DependentTotal"/>
+ <xsd:enumeration value="DesignEmployees"/>
+ <xsd:enumeration value="DespatchNoteQuantity"/>
+ <xsd:enumeration value="DespatchQuantity"/>
+ <xsd:enumeration value="DestroyedQuantity"/>
+ <xsd:enumeration value="DetrimentalLegalFilings"/>
+ <xsd:enumeration value="DetrimentalLegalFilingsAgainstDirectors"/>
+ <xsd:enumeration value="DimensionalSampleQuantity"/>
+ <xsd:enumeration value="Directors"/>
+ <xsd:enumeration value="DirectShipmentQuantity"/>
+ <xsd:enumeration value="DirectWorkers"/>
+ <xsd:enumeration value="DisbursementPeriod"/>
+ <xsd:enumeration value="DiscreetQuantity-RejectedMaterial"/>
+ <xsd:enumeration value="DiscreteQuantity"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionCredit"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionPending"/>
+ <xsd:enumeration value="DiscreteQuantity-RejectedMaterial-DispositionReplacement"/>
+ <xsd:enumeration value="Disposed"/>
+ <xsd:enumeration value="DispositionUndeterminedQuantity"/>
+ <xsd:enumeration value="Distributed"/>
+ <xsd:enumeration value="DistributorInventory"/>
+ <xsd:enumeration value="DomesticAffiliatedCompanies"/>
+ <xsd:enumeration value="DomesticUses"/>
+ <xsd:enumeration value="Dose"/>
+ <xsd:enumeration value="Drafts"/>
+ <xsd:enumeration value="Drivers"/>
+ <xsd:enumeration value="Due"/>
+ <xsd:enumeration value="Due-In"/>
+ <xsd:enumeration value="Duplicates"/>
+ <xsd:enumeration value="DurationInCurrentJob"/>
+ <xsd:enumeration value="DwellingArea"/>
+ <xsd:enumeration value="EarnedValue"/>
+ <xsd:enumeration value="EarnedValueCumulativeToDate"/>
+ <xsd:enumeration value="EarnedValueHours"/>
+ <xsd:enumeration value="EffectiveAge"/>
+ <xsd:enumeration value="ElapsedDuration"/>
+ <xsd:enumeration value="ElectronicSignatures"/>
+ <xsd:enumeration value="EliminationPeriod"/>
+ <xsd:enumeration value="EliminationPeriod-Accident"/>
+ <xsd:enumeration value="EliminationPeriod-Sickness"/>
+ <xsd:enumeration value="EmergencyModifyingUnits"/>
+ <xsd:enumeration value="EmployedAtLocation"/>
+ <xsd:enumeration value="EmployedAtThisLocation"/>
+ <xsd:enumeration value="EmployedByThisCompany"/>
+ <xsd:enumeration value="EmployedInThisProfession"/>
+ <xsd:enumeration value="EmployedOnThisJob"/>
+ <xsd:enumeration value="EmployeeAverage"/>
+ <xsd:enumeration value="Employees"/>
+ <xsd:enumeration value="EmployeesAge"/>
+ <xsd:enumeration value="Employees-Nonowner"/>
+ <xsd:enumeration value="EmployeesNotIncludingOwners"/>
+ <xsd:enumeration value="EmployeesNumberOfDaysAwayFromWorkDueToInjury"/>
+ <xsd:enumeration value="EmployeesNumberOfDaysOfRestrictedWorkActivityDueToInjury"/>
+ <xsd:enumeration value="Employees-Owner"/>
+ <xsd:enumeration value="Employees-PartTime"/>
+ <xsd:enumeration value="Employees-SameDuties"/>
+ <xsd:enumeration value="Employees-SameOccupation"/>
+ <xsd:enumeration value="EmployeesShared"/>
+ <xsd:enumeration value="EmployeesTotalNumberOfDaysAwayFromWorkDueToIllness"/>
+ <xsd:enumeration value="EmployeeTotal"/>
+ <xsd:enumeration value="EmployeeTotalFirstMonthOfQuarter"/>
+ <xsd:enumeration value="EmployeeTotalSecondMonthOfQuarter"/>
+ <xsd:enumeration value="EmployeeTotalThirdMonthOfQuarter"/>
+ <xsd:enumeration value="EndingStock"/>
+ <xsd:enumeration value="EndOfMonthInventoryPriorToShip"/>
+ <xsd:enumeration value="EndQuantity"/>
+ <xsd:enumeration value="EngineeredStandard"/>
+ <xsd:enumeration value="Engineers"/>
+ <xsd:enumeration value="EquipmentQuantity"/>
+ <xsd:enumeration value="EquitySecurityHolder"/>
+ <xsd:enumeration value="EstimateAtComplete"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="EstimatedAccounts"/>
+ <xsd:enumeration value="EstimatedAnnualVolume"/>
+ <xsd:enumeration value="EstimatedDuration"/>
+ <xsd:enumeration value="EstimatedEmployeesAtLocation"/>
+ <xsd:enumeration value="EstimatedHours"/>
+ <xsd:enumeration value="EstimatedQuantity"/>
+ <xsd:enumeration value="EstimatedReadingQuantity"/>
+ <xsd:enumeration value="EstimatedRemainingEconomicLife"/>
+ <xsd:enumeration value="EstimatedRemainingPhysicalLife"/>
+ <xsd:enumeration value="EstimatedTotalEmployees"/>
+ <xsd:enumeration value="EvaporatedWater"/>
+ <xsd:enumeration value="ExclusiveUses"/>
+ <xsd:enumeration value="Executives"/>
+ <xsd:enumeration value="ExistenceLimitPeriod"/>
+ <xsd:enumeration value="ExpenditureQuantity"/>
+ <xsd:enumeration value="Expense"/>
+ <xsd:enumeration value="ExtendedTerm"/>
+ <xsd:enumeration value="ExtraUnplannedDelivery"/>
+ <xsd:enumeration value="Factor"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category1"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category2"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category3"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category4"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidClaimMandate-Category5"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category1"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category2"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category3"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category4"/>
+ <xsd:enumeration value="FederalMedicareOrMedicaidPaymentMandate-Category5"/>
+ <xsd:enumeration value="FederalPensionMandate-Category1"/>
+ <xsd:enumeration value="FederalPensionMandate-Category2"/>
+ <xsd:enumeration value="FederalPensionMandate-Category3"/>
+ <xsd:enumeration value="FederalPensionMandate-Category4"/>
+ <xsd:enumeration value="FederalPensionMandate-Category5"/>
+ <xsd:enumeration value="FederalVotes"/>
+ <xsd:enumeration value="FieldWorkers"/>
+ <xsd:enumeration value="FileSizeAfterCompression"/>
+ <xsd:enumeration value="FileSizeBeforeCompression"/>
+ <xsd:enumeration value="FinalDeliveryQuantity"/>
+ <xsd:enumeration value="FinancialCoveragePeriod"/>
+ <xsd:enumeration value="FinancialInstitutions"/>
+ <xsd:enumeration value="FinishOffset"/>
+ <xsd:enumeration value="FirstQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="FirstQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="FirstQuarterRecurringDemand"/>
+ <xsd:enumeration value="FirstQuarterRecurringOrders"/>
+ <xsd:enumeration value="FlareOrFlash"/>
+ <xsd:enumeration value="FlatExtraPremium"/>
+ <xsd:enumeration value="Floors"/>
+ <xsd:enumeration value="FloorsOccupied"/>
+ <xsd:enumeration value="Forecast"/>
+ <xsd:enumeration value="ForecastAtComplete"/>
+ <xsd:enumeration value="ForecastedScannedQuantity"/>
+ <xsd:enumeration value="ForecastToComplete"/>
+ <xsd:enumeration value="ForeignRelatedEntities"/>
+ <xsd:enumeration value="Foremen"/>
+ <xsd:enumeration value="FourthQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="FourthQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="FourthQuarterRecurringDemand"/>
+ <xsd:enumeration value="FourthQuarterRecurringOrders"/>
+ <xsd:enumeration value="FreeFloat-InCalendarUnits"/>
+ <xsd:enumeration value="FreeFloatTime"/>
+ <xsd:enumeration value="FreeGoodsQuantity"/>
+ <xsd:enumeration value="FreelanceDebtCollectors"/>
+ <xsd:enumeration value="FreelanceSalespersons"/>
+ <xsd:enumeration value="FreeQuantityIncluded"/>
+ <xsd:enumeration value="FreeQuantityNotIncluded"/>
+ <xsd:enumeration value="Frequency"/>
+ <xsd:enumeration value="Fuel"/>
+ <xsd:enumeration value="FuelConsumedOrBurnedAmount"/>
+ <xsd:enumeration value="FuelPumps"/>
+ <xsd:enumeration value="FullBaths"/>
+ <xsd:enumeration value="FunctionalGroups"/>
+ <xsd:enumeration value="FunctionalSampleQuantity"/>
+ <xsd:enumeration value="FurnishedBloodUnits"/>
+ <xsd:enumeration value="GarageOrCarportArea"/>
+ <xsd:enumeration value="GasInjectionVolume"/>
+ <xsd:enumeration value="GasLiftVolume"/>
+ <xsd:enumeration value="GasReceiptVolume"/>
+ <xsd:enumeration value="GasReturnedToEarth"/>
+ <xsd:enumeration value="GasReturnedToPropertyForFuel"/>
+ <xsd:enumeration value="GasShrinkage"/>
+ <xsd:enumeration value="GasSold"/>
+ <xsd:enumeration value="GasUsedForDrilling"/>
+ <xsd:enumeration value="GasUsedForFuelSystem"/>
+ <xsd:enumeration value="GasUsedForPlantFuel"/>
+ <xsd:enumeration value="GasUsedForRepressuringOrPressureMaintenance"/>
+ <xsd:enumeration value="GasUsedOnProperty"/>
+ <xsd:enumeration value="GasVented"/>
+ <xsd:enumeration value="GasVolume"/>
+ <xsd:enumeration value="GeneralEliminationPeriod"/>
+ <xsd:enumeration value="GovernmentReportingQuantity"/>
+ <xsd:enumeration value="GradeTransferAmount"/>
+ <xsd:enumeration value="GrossAnnualIncomeMultiplier"/>
+ <xsd:enumeration value="GrossBuildingArea"/>
+ <xsd:enumeration value="GrossEstimate"/>
+ <xsd:enumeration value="GrossLivingArea"/>
+ <xsd:enumeration value="GrossLivingFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="GrossProduction"/>
+ <xsd:enumeration value="GrossRentMultiplier"/>
+ <xsd:enumeration value="GroupEmployees"/>
+ <xsd:enumeration value="GuaranteeFeeBuyupMaximum"/>
+ <xsd:enumeration value="GuaranteeFeeRateAfterAlternatePaymentMethod"/>
+ <xsd:enumeration value="GuaranteeFeeRateAfterBuyupOrBuydown"/>
+ <xsd:enumeration value="GuaranteePeriod"/>
+ <xsd:enumeration value="Height"/>
+ <xsd:enumeration value="HighFabricationAuthorizationQuantity"/>
+ <xsd:enumeration value="HighRawMaterialAuthorizationQuantity"/>
+ <xsd:enumeration value="HoldingPeriod"/>
+ <xsd:enumeration value="Hours"/>
+ <xsd:enumeration value="HoursFlown-AircraftOrTypeFlying"/>
+ <xsd:enumeration value="HoursFlown-AircraftTypeOrLife"/>
+ <xsd:enumeration value="HoursFlown-AircraftTypeOrPeriod"/>
+ <xsd:enumeration value="HoursFlown-Lifetime"/>
+ <xsd:enumeration value="HoursFlown-TypeFlying"/>
+ <xsd:enumeration value="ImpairmentDuration"/>
+ <xsd:enumeration value="ImpairmentFrequency"/>
+ <xsd:enumeration value="IncrementalOrderQuantity"/>
+ <xsd:enumeration value="IndirectEmployees"/>
+ <xsd:enumeration value="IndustryBusinessFailureIncidences"/>
+ <xsd:enumeration value="InformationProviderStandardizedMotorVehiclePenaltyPoints"/>
+ <xsd:enumeration value="InformationReadingQuantity"/>
+ <xsd:enumeration value="Inspectors"/>
+ <xsd:enumeration value="InstalledCapacity"/>
+ <xsd:enumeration value="Installers"/>
+ <xsd:enumeration value="InstallmentFrequency"/>
+ <xsd:enumeration value="InstallmentPayments"/>
+ <xsd:enumeration value="Installments"/>
+ <xsd:enumeration value="InsufficientFundsReturnedCheques"/>
+ <xsd:enumeration value="IntendedChangeTimePeriod"/>
+ <xsd:enumeration value="InterestForOverdrawnAccount"/>
+ <xsd:enumeration value="InterimTermPeriod"/>
+ <xsd:enumeration value="IntertankTransferAmount"/>
+ <xsd:enumeration value="InTransitQuantity"/>
+ <xsd:enumeration value="In-Use"/>
+ <xsd:enumeration value="InventoryCategoryTransfer"/>
+ <xsd:enumeration value="InventoryDiscrepancy"/>
+ <xsd:enumeration value="InventoryMovementQuantity"/>
+ <xsd:enumeration value="InventoryOnShelfWorkInProgress"/>
+ <xsd:enumeration value="InventoryQuantityAtSuppliersNotSubjectToInspectionByCustomer"/>
+ <xsd:enumeration value="InventoryQuantityAtSuppliersSubjectToInspectionByCustomer"/>
+ <xsd:enumeration value="InventoryWithdrawalQuantity"/>
+ <xsd:enumeration value="InvoicedQuantity"/>
+ <xsd:enumeration value="Invoices"/>
+ <xsd:enumeration value="InvolvementPeriod"/>
+ <xsd:enumeration value="IssuedShares"/>
+ <xsd:enumeration value="JailSentenceDuration"/>
+ <xsd:enumeration value="JudgementsRegistered"/>
+ <xsd:enumeration value="Judgments"/>
+ <xsd:enumeration value="JudicialStayDuration"/>
+ <xsd:enumeration value="Laborers"/>
+ <xsd:enumeration value="LabourHours"/>
+ <xsd:enumeration value="LagTime"/>
+ <xsd:enumeration value="LandHolding"/>
+ <xsd:enumeration value="LandSize"/>
+ <xsd:enumeration value="Lanes"/>
+ <xsd:enumeration value="Late"/>
+ <xsd:enumeration value="LatePaymentPeriod"/>
+ <xsd:enumeration value="LatestCumulativeQuantity"/>
+ <xsd:enumeration value="LawSuits"/>
+ <xsd:enumeration value="LeadTime"/>
+ <xsd:enumeration value="LeasePeriods"/>
+ <xsd:enumeration value="LengthOfResidency"/>
+ <xsd:enumeration value="LevelResource-Quantity"/>
+ <xsd:enumeration value="LevelResourceTaskQuantity"/>
+ <xsd:enumeration value="LevelsOccupied"/>
+ <xsd:enumeration value="LicenseWithdrawalDuration"/>
+ <xsd:enumeration value="LicenseWithdrawalsSent"/>
+ <xsd:enumeration value="Liens"/>
+ <xsd:enumeration value="LiensRegistered"/>
+ <xsd:enumeration value="LifetimeCapacityOfTooling"/>
+ <xsd:enumeration value="Life-TimeReserve-Actual"/>
+ <xsd:enumeration value="LifetimeReserveDays-AppliedToThisClaim"/>
+ <xsd:enumeration value="Life-TimeReserve-Estimated"/>
+ <xsd:enumeration value="LimitedQuantity"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-BuyingPartyCaused"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-ContractorCaused"/>
+ <xsd:enumeration value="LineItemsCompletedDelinquent-UnknownCauses"/>
+ <xsd:enumeration value="LineThreadQuantity"/>
+ <xsd:enumeration value="LiquidInjectionVolume"/>
+ <xsd:enumeration value="Livestock"/>
+ <xsd:enumeration value="LoanRate"/>
+ <xsd:enumeration value="LoanRepaymentTotal"/>
+ <xsd:enumeration value="LossAllowance"/>
+ <xsd:enumeration value="LossOrGain"/>
+ <xsd:enumeration value="LostGas"/>
+ <xsd:enumeration value="LostGoods"/>
+ <xsd:enumeration value="LostOil"/>
+ <xsd:enumeration value="LostWorkTimeActual"/>
+ <xsd:enumeration value="LostWorkTimeEstimated"/>
+ <xsd:enumeration value="LotSize"/>
+ <xsd:enumeration value="Machines"/>
+ <xsd:enumeration value="MaintenanceUnits"/>
+ <xsd:enumeration value="Manufactured"/>
+ <xsd:enumeration value="ManufacturedUnits"/>
+ <xsd:enumeration value="MarineRadios"/>
+ <xsd:enumeration value="MarketPriceChange"/>
+ <xsd:enumeration value="MatchingEquipment"/>
+ <xsd:enumeration value="MaterialOn-BoardQuantityPriorToLoading"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="MaximumAge"/>
+ <xsd:enumeration value="MaximumBenefitPeriod"/>
+ <xsd:enumeration value="MaximumBenefitPeriod-Accident"/>
+ <xsd:enumeration value="MaximumBenefitPeriodAccidentToAge"/>
+ <xsd:enumeration value="MaximumBenefitPeriod-Sickness"/>
+ <xsd:enumeration value="MaximumBenefitPeriodSicknessToAge"/>
+ <xsd:enumeration value="MaximumCriminalSentenceDuration"/>
+ <xsd:enumeration value="MaximumDeliveryBatch"/>
+ <xsd:enumeration value="MaximumForecastQuantity"/>
+ <xsd:enumeration value="MaximumInventory"/>
+ <xsd:enumeration value="MaximumMaturityExtension"/>
+ <xsd:enumeration value="MaximumNumberOfEmployees"/>
+ <xsd:enumeration value="MaximumNumberOfEmployeesAtLocation"/>
+ <xsd:enumeration value="MaximumNumberOfPurchaseOrdersAllowed"/>
+ <xsd:enumeration value="MaximumNumberOfShipmentsAllowed"/>
+ <xsd:enumeration value="MaximumOrderQuantity"/>
+ <xsd:enumeration value="MaximumProductionBatch"/>
+ <xsd:enumeration value="MaximumQuantityToWhichTaxRateApplies"/>
+ <xsd:enumeration value="MaximumRequestableQuantity"/>
+ <xsd:enumeration value="MaximumShipQuantity"/>
+ <xsd:enumeration value="MaximumStackability"/>
+ <xsd:enumeration value="MaximumStockLevel"/>
+ <xsd:enumeration value="MaximumSupplyQuantitySupplierEndorsed"/>
+ <xsd:enumeration value="MaximumTransfer"/>
+ <xsd:enumeration value="Mechanics"/>
+ <xsd:enumeration value="MedicationDuration"/>
+ <xsd:enumeration value="MembersInGroup"/>
+ <xsd:enumeration value="Messengers"/>
+ <xsd:enumeration value="MeterReading"/>
+ <xsd:enumeration value="Miles"/>
+ <xsd:enumeration value="MilitarySalesQuantity"/>
+ <xsd:enumeration value="MillionDollarRoundtableCredits"/>
+ <xsd:enumeration value="Minimum"/>
+ <xsd:enumeration value="MinimumAge"/>
+ <xsd:enumeration value="MinimumAverageTimeRequirementUnits"/>
+ <xsd:enumeration value="MinimumContractQuantity"/>
+ <xsd:enumeration value="MinimumCriminalSentenceDuration"/>
+ <xsd:enumeration value="MinimumDeliveryBatch"/>
+ <xsd:enumeration value="MinimumEmployeesAtLocation"/>
+ <xsd:enumeration value="MinimumFabricationQuantity"/>
+ <xsd:enumeration value="MinimumForecastQuantity"/>
+ <xsd:enumeration value="MinimumInventory"/>
+ <xsd:enumeration value="MinimumNumberOfEmployees"/>
+ <xsd:enumeration value="MinimumOrderPackageLevel"/>
+ <xsd:enumeration value="MinimumOrderQuantity"/>
+ <xsd:enumeration value="MinimumProductionBatch"/>
+ <xsd:enumeration value="MinimumQuantityToWhichTaxRateApplies"/>
+ <xsd:enumeration value="MinimumRequestableQuantity"/>
+ <xsd:enumeration value="MinimumShipQuantity"/>
+ <xsd:enumeration value="MinimumStockLevel"/>
+ <xsd:enumeration value="MinimumTransfer"/>
+ <xsd:enumeration value="MiscellaneousAllowance"/>
+ <xsd:enumeration value="MobileLoadingAllocation"/>
+ <xsd:enumeration value="ModelOrTargetStock"/>
+ <xsd:enumeration value="Month"/>
+ <xsd:enumeration value="MortgagePoolCount"/>
+ <xsd:enumeration value="MostLikelyDuration"/>
+ <xsd:enumeration value="NationalBusinessFailureIncidences"/>
+ <xsd:enumeration value="Net"/>
+ <xsd:enumeration value="NetQuantityDecrease"/>
+ <xsd:enumeration value="NetQuantityIncrease"/>
+ <xsd:enumeration value="NetToPayItemCount."/>
+ <xsd:enumeration value="NoDeliveryRequirementInThisInstruction"/>
+ <xsd:enumeration value="Non-BillableQuantity"/>
+ <xsd:enumeration value="NoncommittedInventoryOnShelf"/>
+ <xsd:enumeration value="NonconformanceQuantity"/>
+ <xsd:enumeration value="Non-ConsolidatedTotal-DomesticSubsidiaries"/>
+ <xsd:enumeration value="Non-ConsolidatedTotal-ForeignSubsidiaries"/>
+ <xsd:enumeration value="Noncovered-Actual"/>
+ <xsd:enumeration value="Non-Covered-Estimated"/>
+ <xsd:enumeration value="Non-DomesticStockholders"/>
+ <xsd:enumeration value="NonexclusiveUses"/>
+ <xsd:enumeration value="Non-UnionEmployees"/>
+ <xsd:enumeration value="Non-UrgentDeliveryQuantity"/>
+ <xsd:enumeration value="NormalDelivery"/>
+ <xsd:enumeration value="NormalReadingQuantity"/>
+ <xsd:enumeration value="NotReplacedBloodUnits"/>
+ <xsd:enumeration value="NoVotes"/>
+ <xsd:enumeration value="NumberOfAccountsPastDue"/>
+ <xsd:enumeration value="NumberOfActiveAccountsThisCycle"/>
+ <xsd:enumeration value="NumberOfAddedLocations"/>
+ <xsd:enumeration value="NumberOfAdjustmentPeriods"/>
+ <xsd:enumeration value="NumberOfAttacksOrOccurrences"/>
+ <xsd:enumeration value="NumberOfBatches"/>
+ <xsd:enumeration value="NumberOfBorrowers"/>
+ <xsd:enumeration value="NumberOfCardsNotReceived"/>
+ <xsd:enumeration value="NumberOfCardsOutstanding"/>
+ <xsd:enumeration value="NumberOfChecks"/>
+ <xsd:enumeration value="NumberOfClaimants"/>
+ <xsd:enumeration value="NumberOfClosedLocations"/>
+ <xsd:enumeration value="NumberOfCo-InsuranceDays"/>
+ <xsd:enumeration value="NumberOfCopiesOfBillOfLading"/>
+ <xsd:enumeration value="NumberOfCrew"/>
+ <xsd:enumeration value="NumberOfDaysCoveredByInventory"/>
+ <xsd:enumeration value="NumberOfDead"/>
+ <xsd:enumeration value="NumberOfDelinquentInstallments"/>
+ <xsd:enumeration value="NumberOfDeliveriesPerDespatchPeriod"/>
+ <xsd:enumeration value="NumberOfDependents"/>
+ <xsd:enumeration value="NumberOfEndUsers"/>
+ <xsd:enumeration value="NumberOfEntitledExemptions"/>
+ <xsd:enumeration value="NumberOfFailedBusinessesOfDirectors"/>
+ <xsd:enumeration value="NumberOfFranchisees"/>
+ <xsd:enumeration value="NumberOfFull-TimeEmployees"/>
+ <xsd:enumeration value="NumberOfHospitals"/>
+ <xsd:enumeration value="NumberOfIdenticalHandlingUnits"/>
+ <xsd:enumeration value="NumberOfInsuredLives"/>
+ <xsd:enumeration value="NumberOfInterestPayments"/>
+ <xsd:enumeration value="NumberOfIrregularInterestPayments"/>
+ <xsd:enumeration value="NumberOfItemsAuthorizedAtStore"/>
+ <xsd:enumeration value="NumberOfItemsAuthorizedAtWarehouse"/>
+ <xsd:enumeration value="NumberOfItemsInStock"/>
+ <xsd:enumeration value="NumberOfLateCharges"/>
+ <xsd:enumeration value="NumberOfLevels"/>
+ <xsd:enumeration value="NumberOfLimitedPartnershipShares"/>
+ <xsd:enumeration value="NumberOfLiving"/>
+ <xsd:enumeration value="NumberOfLoans"/>
+ <xsd:enumeration value="NumberOfLostCards"/>
+ <xsd:enumeration value="NumberOfMembers"/>
+ <xsd:enumeration value="NumberOfMessageRecipients"/>
+ <xsd:enumeration value="NumberOfMonths"/>
+ <xsd:enumeration value="NumberOfMortgagors"/>
+ <xsd:enumeration value="NumberOfMoulds"/>
+ <xsd:enumeration value="NumberOfNon-CoveredDays"/>
+ <xsd:enumeration value="NumberOfNonsufficientFundItems"/>
+ <xsd:enumeration value="NumberOfOpenAccounts"/>
+ <xsd:enumeration value="NumberOfOperatingPeriodsAtFailure"/>
+ <xsd:enumeration value="NumberOfOperatorCredits"/>
+ <xsd:enumeration value="NumberOfOriginals"/>
+ <xsd:enumeration value="NumberOfPackagesInHandlingUnit"/>
+ <xsd:enumeration value="NumberOfPassengers"/>
+ <xsd:enumeration value="NumberOfPatientAdmissions"/>
+ <xsd:enumeration value="NumberOfPeopleLivingAtResidence"/>
+ <xsd:enumeration value="NumberOfPhysicians"/>
+ <xsd:enumeration value="NumberOfProducingWellsRemainingOnPropertyOrFacility"/>
+ <xsd:enumeration value="NumberOfProducingWellsRemainingOnRoyaltyAccount"/>
+ <xsd:enumeration value="NumberOfQuantitativeIncentiveSchemeUnits"/>
+ <xsd:enumeration value="NumberOfServicesOrProcedures"/>
+ <xsd:enumeration value="NumberOfShelfFacings"/>
+ <xsd:enumeration value="NumberOfShelfTags"/>
+ <xsd:enumeration value="NumberOfSignedBillsOfLading"/>
+ <xsd:enumeration value="NumberOfStations"/>
+ <xsd:enumeration value="NumberOfStolenCards"/>
+ <xsd:enumeration value="NumberOfStops"/>
+ <xsd:enumeration value="NumberOfTheatres"/>
+ <xsd:enumeration value="NumberOfTimes"/>
+ <xsd:enumeration value="NumberOfTimesDeported"/>
+ <xsd:enumeration value="NumberOfTransportDocuments"/>
+ <xsd:enumeration value="NumberOfUnits"/>
+ <xsd:enumeration value="NumberOfUnits-Housing"/>
+ <xsd:enumeration value="NumberOfUnitsInTheDepthOfALayer"/>
+ <xsd:enumeration value="NumberOfUnitsInTheWidthOfALayer"/>
+ <xsd:enumeration value="NumberOfUnsignedBillsOfLading"/>
+ <xsd:enumeration value="NumberOfWithholdingExemptions"/>
+ <xsd:enumeration value="NumbersOfConsumerUnitsInTheTradedUnit"/>
+ <xsd:enumeration value="NumberWeeksPaid"/>
+ <xsd:enumeration value="Nurses"/>
+ <xsd:enumeration value="OemInventory"/>
+ <xsd:enumeration value="OfficeSize"/>
+ <xsd:enumeration value="OfficeWorkers"/>
+ <xsd:enumeration value="OffLeaseFuel"/>
+ <xsd:enumeration value="OffPremiseSalesQuantity"/>
+ <xsd:enumeration value="OffPremisesSales"/>
+ <xsd:enumeration value="OilCondensateSold"/>
+ <xsd:enumeration value="OilCondensateUsedOnProperty"/>
+ <xsd:enumeration value="OilOrCondensateVolume"/>
+ <xsd:enumeration value="OilSedimentation"/>
+ <xsd:enumeration value="OilTheft"/>
+ <xsd:enumeration value="OnHandAndDue-In"/>
+ <xsd:enumeration value="OnHoldForShipment"/>
+ <xsd:enumeration value="OnOrderQuantity"/>
+ <xsd:enumeration value="OnPremiseSalesQuantity"/>
+ <xsd:enumeration value="OnPremisesSales"/>
+ <xsd:enumeration value="OpeningStatementBalance"/>
+ <xsd:enumeration value="OpeningStockBalanceQuantity"/>
+ <xsd:enumeration value="OpenQuantity"/>
+ <xsd:enumeration value="OperatingBeds"/>
+ <xsd:enumeration value="OperatingDivisions"/>
+ <xsd:enumeration value="OperatingQuantity"/>
+ <xsd:enumeration value="Operators"/>
+ <xsd:enumeration value="OperatorsWorkingInterest"/>
+ <xsd:enumeration value="OptimalQuantity"/>
+ <xsd:enumeration value="OptimisticDuration"/>
+ <xsd:enumeration value="OrderCount"/>
+ <xsd:enumeration value="OrderedQuantity"/>
+ <xsd:enumeration value="OrderQuantityMultiple"/>
+ <xsd:enumeration value="Original"/>
+ <xsd:enumeration value="OriginalDuration"/>
+ <xsd:enumeration value="OriginalLoanTerm"/>
+ <xsd:enumeration value="OriginalPaymentItemCount."/>
+ <xsd:enumeration value="OriginalQuantity"/>
+ <xsd:enumeration value="OriginalTermInYears"/>
+ <xsd:enumeration value="OtherEmployees"/>
+ <xsd:enumeration value="OtherGasDisposition"/>
+ <xsd:enumeration value="OtherInjectionVolume"/>
+ <xsd:enumeration value="OtherMiscellaneousDisposition"/>
+ <xsd:enumeration value="OtherOilCondensateDisposition"/>
+ <xsd:enumeration value="OtherUnlistedParticipants"/>
+ <xsd:enumeration value="OtherUnlistedStockholders"/>
+ <xsd:enumeration value="OtherWarReserveMaterialRequirementsProtectableQuantity"/>
+ <xsd:enumeration value="OtherWaterDisposition"/>
+ <xsd:enumeration value="OutlierDays"/>
+ <xsd:enumeration value="OutOfInventoryQuantity"/>
+ <xsd:enumeration value="OutstandingQuantity"/>
+ <xsd:enumeration value="OutstandingShares"/>
+ <xsd:enumeration value="Out-TurnedQuantity"/>
+ <xsd:enumeration value="Overage"/>
+ <xsd:enumeration value="OverflowQuantity"/>
+ <xsd:enumeration value="OverShipped"/>
+ <xsd:enumeration value="Owner"/>
+ <xsd:enumeration value="OwnersEquity"/>
+ <xsd:enumeration value="OwnershipChangeAge"/>
+ <xsd:enumeration value="OwnershipDuration"/>
+ <xsd:enumeration value="OwnershipPercentage"/>
+ <xsd:enumeration value="OwnOccupationQualificationPeriod"/>
+ <xsd:enumeration value="Pagers"/>
+ <xsd:enumeration value="Paid"/>
+ <xsd:enumeration value="Paid-InCommonShares"/>
+ <xsd:enumeration value="Paid-InPreferredShares"/>
+ <xsd:enumeration value="Paid-InSecurityShares"/>
+ <xsd:enumeration value="ParkingSpaces"/>
+ <xsd:enumeration value="PartialBaths"/>
+ <xsd:enumeration value="ParticipantTotal"/>
+ <xsd:enumeration value="ParticipationShares"/>
+ <xsd:enumeration value="Partners"/>
+ <xsd:enumeration value="PartTimeEmployees"/>
+ <xsd:enumeration value="PastDueQuantity"/>
+ <xsd:enumeration value="Patients"/>
+ <xsd:enumeration value="PaymentCancellationItemCount"/>
+ <xsd:enumeration value="PaymentDurationWeeks"/>
+ <xsd:enumeration value="PaymentExperiencesInTheLast12Months"/>
+ <xsd:enumeration value="PaymentExperiencesInTheLast3Months"/>
+ <xsd:enumeration value="PaymentFrequency"/>
+ <xsd:enumeration value="PaymentOrdersFiled"/>
+ <xsd:enumeration value="PaymentsNumber"/>
+ <xsd:enumeration value="PercentageOfOrderedQuantity"/>
+ <xsd:enumeration value="PeriodicCapacityOfTooling"/>
+ <xsd:enumeration value="PeriodOfEmployment"/>
+ <xsd:enumeration value="PeriodQuantityMeasured"/>
+ <xsd:enumeration value="PeriodQuantityPlanned"/>
+ <xsd:enumeration value="PeriodQuantityReached"/>
+ <xsd:enumeration value="Persistency"/>
+ <xsd:enumeration value="PessimisticDuration"/>
+ <xsd:enumeration value="PetitionsFiled"/>
+ <xsd:enumeration value="PhysicalStatusIii"/>
+ <xsd:enumeration value="PhysicalStatusIv"/>
+ <xsd:enumeration value="PhysicalStatusV"/>
+ <xsd:enumeration value="Physicians"/>
+ <xsd:enumeration value="PictureCount"/>
+ <xsd:enumeration value="PiecesDelivered"/>
+ <xsd:enumeration value="PilferageGoods"/>
+ <xsd:enumeration value="Pilots"/>
+ <xsd:enumeration value="PipelineAdjustmentOrAllowance"/>
+ <xsd:enumeration value="Pipes"/>
+ <xsd:enumeration value="PittedWater"/>
+ <xsd:enumeration value="PlacementPeriodExpiration"/>
+ <xsd:enumeration value="PlannedUnitDevelopmentUnits"/>
+ <xsd:enumeration value="PlantSize"/>
+ <xsd:enumeration value="PlantWorkers"/>
+ <xsd:enumeration value="PlatformCount"/>
+ <xsd:enumeration value="PortableRadios"/>
+ <xsd:enumeration value="PortedTelephoneLines"/>
+ <xsd:enumeration value="Post-OpDays"/>
+ <xsd:enumeration value="Poultry"/>
+ <xsd:enumeration value="PredominateAge"/>
+ <xsd:enumeration value="Pre-OpDays"/>
+ <xsd:enumeration value="PrepaidQuantityNotShipped"/>
+ <xsd:enumeration value="PrepaidQuantityShipped"/>
+ <xsd:enumeration value="Pre-ProductionQuantity"/>
+ <xsd:enumeration value="Prescription"/>
+ <xsd:enumeration value="PrescriptionDosage"/>
+ <xsd:enumeration value="PrescriptionEffectivePeriod"/>
+ <xsd:enumeration value="PrescriptionFrequency"/>
+ <xsd:enumeration value="PresidentialVotes"/>
+ <xsd:enumeration value="PressureBase"/>
+ <xsd:enumeration value="PreviousBenefits"/>
+ <xsd:enumeration value="PreviousCumulativeQuantity"/>
+ <xsd:enumeration value="PreviousHighestCumulativeQuantity"/>
+ <xsd:enumeration value="PreviouslyAmortisedQuantity"/>
+ <xsd:enumeration value="PreviousMonthsUsage"/>
+ <xsd:enumeration value="PreviousNumberOfAccounts"/>
+ <xsd:enumeration value="PreviousNumberOfBranchLocations"/>
+ <xsd:enumeration value="PreviousNumberOfEmployees"/>
+ <xsd:enumeration value="PreviousOrderQuantityToBeCancelled"/>
+ <xsd:enumeration value="PreviousQuantity"/>
+ <xsd:enumeration value="PreviousWeekQuantity"/>
+ <xsd:enumeration value="PriceBreakFrom"/>
+ <xsd:enumeration value="PriceBreakTo"/>
+ <xsd:enumeration value="PricingUnitPerBillingUnit"/>
+ <xsd:enumeration value="PrimaryManagers"/>
+ <xsd:enumeration value="PrimaryMeterReadingValue"/>
+ <xsd:enumeration value="PrimaryNetQuantity"/>
+ <xsd:enumeration value="PrincipalsIncludedAsEmployees"/>
+ <xsd:enumeration value="PriorCumulativeImbalance"/>
+ <xsd:enumeration value="PriorUnitsAccepted"/>
+ <xsd:enumeration value="ProbationDuration"/>
+ <xsd:enumeration value="ProducingWells"/>
+ <xsd:enumeration value="ProductExchangeAmount"/>
+ <xsd:enumeration value="ProductionRequirements"/>
+ <xsd:enumeration value="ProductionWorkers"/>
+ <xsd:enumeration value="ProductSalesAmount"/>
+ <xsd:enumeration value="Professionals"/>
+ <xsd:enumeration value="Professor"/>
+ <xsd:enumeration value="ProjectedAvailableInventory"/>
+ <xsd:enumeration value="ProjectPhases"/>
+ <xsd:enumeration value="ProjectsInProcess"/>
+ <xsd:enumeration value="ProjectUnitsSold"/>
+ <xsd:enumeration value="Promoters"/>
+ <xsd:enumeration value="PromotionQuantity"/>
+ <xsd:enumeration value="ProtestedBills"/>
+ <xsd:enumeration value="ProvidedQuantity"/>
+ <xsd:enumeration value="PublicationTurnSize"/>
+ <xsd:enumeration value="PurchaseOfProduct"/>
+ <xsd:enumeration value="QualificationPeriod"/>
+ <xsd:enumeration value="QualifyingWeeks"/>
+ <xsd:enumeration value="QualityControlFailed"/>
+ <xsd:enumeration value="QualityControlHeld"/>
+ <xsd:enumeration value="QuantitativeIncentiveSchemeBase"/>
+ <xsd:enumeration value="QuantityAdvised"/>
+ <xsd:enumeration value="QuantityApproved"/>
+ <xsd:enumeration value="QuantityAt100Pct"/>
+ <xsd:enumeration value="QuantityAvailableForReturn"/>
+ <xsd:enumeration value="QuantityAvailableForSale-StockQuantity"/>
+ <xsd:enumeration value="QuantityAvailableOnShelf"/>
+ <xsd:enumeration value="QuantityAwaitingDelivery"/>
+ <xsd:enumeration value="QuantityByPosition"/>
+ <xsd:enumeration value="QuantityCancelled"/>
+ <xsd:enumeration value="QuantityCarriedForward"/>
+ <xsd:enumeration value="QuantityDeferred"/>
+ <xsd:enumeration value="QuantityDelivered"/>
+ <xsd:enumeration value="QuantityDisapproved"/>
+ <xsd:enumeration value="QuantityDispensed"/>
+ <xsd:enumeration value="QuantityDisplayedNotAvailableForSale"/>
+ <xsd:enumeration value="QuantityEarned"/>
+ <xsd:enumeration value="QuantityHeldByDeliveryVehicle"/>
+ <xsd:enumeration value="QuantityHeldByLogisticServiceProvider"/>
+ <xsd:enumeration value="QuantityHeldByRetailOutlet"/>
+ <xsd:enumeration value="QuantityInFloat"/>
+ <xsd:enumeration value="QuantityInHoldOut"/>
+ <xsd:enumeration value="QuantityInManufacturingProcess"/>
+ <xsd:enumeration value="QuantityInPhysicalInventory"/>
+ <xsd:enumeration value="QuantityInQuarantine"/>
+ <xsd:enumeration value="QuantityInTransit"/>
+ <xsd:enumeration value="QuantityLanded"/>
+ <xsd:enumeration value="QuantityLoaded"/>
+ <xsd:enumeration value="QuantityManifested"/>
+ <xsd:enumeration value="QuantityNotAvailableForDespatch"/>
+ <xsd:enumeration value="QuantityOfDealerLicensePlates"/>
+ <xsd:enumeration value="QuantityOfMaterialInOrderedTime"/>
+ <xsd:enumeration value="QuantityOnHand"/>
+ <xsd:enumeration value="QuantityOnHold"/>
+ <xsd:enumeration value="QuantityPerNextHigherAssembly"/>
+ <xsd:enumeration value="QuantityPerPack"/>
+ <xsd:enumeration value="QuantityPerSkid"/>
+ <xsd:enumeration value="QuantityPerUnitOfIssue"/>
+ <xsd:enumeration value="QuantityReceived"/>
+ <xsd:enumeration value="QuantityRemaining"/>
+ <xsd:enumeration value="QuantityRequirementForMaintenanceAndRepairOf"/>
+ <xsd:enumeration value="QuantityRequirementForSampleInspection"/>
+ <xsd:enumeration value="QuantityRequiringManipulationBeforeDespatch"/>
+ <xsd:enumeration value="QuantityReturnedDefectiveOrDamaged"/>
+ <xsd:enumeration value="QuantityScheduled"/>
+ <xsd:enumeration value="QuantityServiced"/>
+ <xsd:enumeration value="QuantitySold"/>
+ <xsd:enumeration value="QuantitySoldNet"/>
+ <xsd:enumeration value="QuantitySuspended"/>
+ <xsd:enumeration value="QuantityToBeDelivered"/>
+ <xsd:enumeration value="QuantityUsed"/>
+ <xsd:enumeration value="QuantityWithdrawn"/>
+ <xsd:enumeration value="QuantityWithheldByOwnerOfGoods"/>
+ <xsd:enumeration value="QuoteQuantityOnInventory"/>
+ <xsd:enumeration value="RangeAverage"/>
+ <xsd:enumeration value="RangeMaximum"/>
+ <xsd:enumeration value="RangeMinimum"/>
+ <xsd:enumeration value="RatePerDay"/>
+ <xsd:enumeration value="Receipts"/>
+ <xsd:enumeration value="ReceivedAndAccepted"/>
+ <xsd:enumeration value="ReceivedNotAcceptedToBeDestroyed"/>
+ <xsd:enumeration value="ReceivedNotAcceptedToBeReturned"/>
+ <xsd:enumeration value="ReceivedQuantity"/>
+ <xsd:enumeration value="RecommendedMaintenanceQuantity"/>
+ <xsd:enumeration value="RecommendedOverhaulAndRepairQuantity"/>
+ <xsd:enumeration value="ReconsiderationPeriod"/>
+ <xsd:enumeration value="RedeliveryAfterPostProcessing"/>
+ <xsd:enumeration value="RefillsAuthorized"/>
+ <xsd:enumeration value="RegisteredBrandsDistributed"/>
+ <xsd:enumeration value="RegisteredBrandsManufactured"/>
+ <xsd:enumeration value="RejectedQuantity"/>
+ <xsd:enumeration value="RejectedReturnQuantity"/>
+ <xsd:enumeration value="RelatedBusinessEntities"/>
+ <xsd:enumeration value="RelatedEntities"/>
+ <xsd:enumeration value="RelationshipDuration"/>
+ <xsd:enumeration value="RelativesEmployed"/>
+ <xsd:enumeration value="RemainingAuthorizedQuantity"/>
+ <xsd:enumeration value="RemainingDuration"/>
+ <xsd:enumeration value="RemainingQuantity"/>
+ <xsd:enumeration value="ReorderingLevel"/>
+ <xsd:enumeration value="ReorderPointQuantity"/>
+ <xsd:enumeration value="ReplacedAmount"/>
+ <xsd:enumeration value="ReplacedBloodUnits"/>
+ <xsd:enumeration value="ReplenishmentOverrideQuantity"/>
+ <xsd:enumeration value="ReplenishmentQuantity"/>
+ <xsd:enumeration value="ReportDifference"/>
+ <xsd:enumeration value="ReportedDeficiencies"/>
+ <xsd:enumeration value="Reports"/>
+ <xsd:enumeration value="RequestedAmount"/>
+ <xsd:enumeration value="RequirementQuantity"/>
+ <xsd:enumeration value="RequirementQuantityThatWasPreviouslyReleased"/>
+ <xsd:enumeration value="RequisitioningObjective"/>
+ <xsd:enumeration value="ReservedQuantity"/>
+ <xsd:enumeration value="ReservedQuantityCustomerDirectDeliverySales"/>
+ <xsd:enumeration value="ReservedQuantityRetailSales"/>
+ <xsd:enumeration value="ResidenceDuration"/>
+ <xsd:enumeration value="Resource-Quantity-Available"/>
+ <xsd:enumeration value="RestingQuantity"/>
+ <xsd:enumeration value="RestrictionDuration"/>
+ <xsd:enumeration value="RetailSales"/>
+ <xsd:enumeration value="RetentionQuantity"/>
+ <xsd:enumeration value="ReturnedByConsumerQuantity"/>
+ <xsd:enumeration value="ReturnQuantity"/>
+ <xsd:enumeration value="ReturnsReplacementQuantity"/>
+ <xsd:enumeration value="RoomCount"/>
+ <xsd:enumeration value="Rooms"/>
+ <xsd:enumeration value="RoomsFinishedAreaAboveGrade"/>
+ <xsd:enumeration value="Royalty"/>
+ <xsd:enumeration value="SafetyLevel"/>
+ <xsd:enumeration value="Salespersons"/>
+ <xsd:enumeration value="SalesQuantityNotIncludedInTheReplenishmentCalculation"/>
+ <xsd:enumeration value="SalesQuantityPlanned"/>
+ <xsd:enumeration value="SampleAmount"/>
+ <xsd:enumeration value="ScatteredVotes"/>
+ <xsd:enumeration value="ScheduleVariance"/>
+ <xsd:enumeration value="ScrapAllowed"/>
+ <xsd:enumeration value="ScrapQuantity"/>
+ <xsd:enumeration value="Seats"/>
+ <xsd:enumeration value="SecondaryNetQuantity"/>
+ <xsd:enumeration value="SecondQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="SecondQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="SecondQuarterRecurringDemand"/>
+ <xsd:enumeration value="SecondQuarterRecurringOrders"/>
+ <xsd:enumeration value="Secretaries"/>
+ <xsd:enumeration value="SecuredChargesRegistered"/>
+ <xsd:enumeration value="SecuritiesShares"/>
+ <xsd:enumeration value="Segments"/>
+ <xsd:enumeration value="Seller"/>
+ <xsd:enumeration value="ServiceResale"/>
+ <xsd:enumeration value="Shareholders"/>
+ <xsd:enumeration value="ShareholdersHoldingRemainderOfShares"/>
+ <xsd:enumeration value="Shares"/>
+ <xsd:enumeration value="SharesAdded"/>
+ <xsd:enumeration value="SharesDeleted"/>
+ <xsd:enumeration value="SharesHeldAsTreasuryStock"/>
+ <xsd:enumeration value="SharesOfCommonStock"/>
+ <xsd:enumeration value="SharesOfPreferredStock"/>
+ <xsd:enumeration value="SharesOwnedByIn-StateResidents"/>
+ <xsd:enumeration value="SharesOwnedByOut-Of-StateResidents"/>
+ <xsd:enumeration value="SharesSubscribed"/>
+ <xsd:enumeration value="SharesSubscribedButNotIssued"/>
+ <xsd:enumeration value="Shifts"/>
+ <xsd:enumeration value="Shipments"/>
+ <xsd:enumeration value="ShipNoticeQuantity"/>
+ <xsd:enumeration value="ShippedQuantity"/>
+ <xsd:enumeration value="Shortage"/>
+ <xsd:enumeration value="Short-LandedGoods"/>
+ <xsd:enumeration value="ShortShipped"/>
+ <xsd:enumeration value="SilentPartners"/>
+ <xsd:enumeration value="SinceLastTravel"/>
+ <xsd:enumeration value="SingleDeliveryQuantity"/>
+ <xsd:enumeration value="SistersDeceased"/>
+ <xsd:enumeration value="SistersLiving"/>
+ <xsd:enumeration value="Site"/>
+ <xsd:enumeration value="SizeOfHousehold"/>
+ <xsd:enumeration value="SkilledWorker"/>
+ <xsd:enumeration value="SmallBusinessUses"/>
+ <xsd:enumeration value="Solicited"/>
+ <xsd:enumeration value="SortedQuantity"/>
+ <xsd:enumeration value="SortedQuantityRejected"/>
+ <xsd:enumeration value="SpaceOccupied"/>
+ <xsd:enumeration value="SpecialPartners"/>
+ <xsd:enumeration value="SpeedCapacity"/>
+ <xsd:enumeration value="SplitQuantity"/>
+ <xsd:enumeration value="SplitShipment"/>
+ <xsd:enumeration value="Standard"/>
+ <xsd:enumeration value="Started"/>
+ <xsd:enumeration value="StartOffset"/>
+ <xsd:enumeration value="StartQuantity"/>
+ <xsd:enumeration value="StateOrProvinceMotorVehiclePenaltyPoints"/>
+ <xsd:enumeration value="StatisticalSalesQuantity"/>
+ <xsd:enumeration value="StockTransfersIn"/>
+ <xsd:enumeration value="StockTransfersOut"/>
+ <xsd:enumeration value="StolenCheques"/>
+ <xsd:enumeration value="SubcontractorAtComplete"/>
+ <xsd:enumeration value="SubcontractorCumulativeToDate"/>
+ <xsd:enumeration value="Subcontractors"/>
+ <xsd:enumeration value="SubmittedQuantityReturned"/>
+ <xsd:enumeration value="SubmittedQuantitySold"/>
+ <xsd:enumeration value="SubsequentDeliveryQuantity"/>
+ <xsd:enumeration value="Subsidiaries"/>
+ <xsd:enumeration value="SubstitutionalQuantity"/>
+ <xsd:enumeration value="Suits"/>
+ <xsd:enumeration value="Supervisors"/>
+ <xsd:enumeration value="SuppliedQuantity"/>
+ <xsd:enumeration value="SupplierEstimatedLatestMeterReading"/>
+ <xsd:enumeration value="SupplierEstimatedPreviousMeterReading"/>
+ <xsd:enumeration value="SupplierLatestMeterReading"/>
+ <xsd:enumeration value="SupplierPreviousMeterReading"/>
+ <xsd:enumeration value="Suppliers"/>
+ <xsd:enumeration value="SuppliersCredit"/>
+ <xsd:enumeration value="SurplusGoods"/>
+ <xsd:enumeration value="SurveysInAverageRating"/>
+ <xsd:enumeration value="SuspendedDuration"/>
+ <xsd:enumeration value="Swan-Ganz"/>
+ <xsd:enumeration value="TablesAvailable"/>
+ <xsd:enumeration value="TalkPaths"/>
+ <xsd:enumeration value="TankAllowance"/>
+ <xsd:enumeration value="TariffLossAllowance"/>
+ <xsd:enumeration value="TaxableQuantity"/>
+ <xsd:enumeration value="Teachers"/>
+ <xsd:enumeration value="Technicians"/>
+ <xsd:enumeration value="TheoreticalQuantity"/>
+ <xsd:enumeration value="ThirdQuarterNon-RecurringDemand"/>
+ <xsd:enumeration value="ThirdQuarterNon-RecurringOrders"/>
+ <xsd:enumeration value="ThirdQuarterRecurringDemand"/>
+ <xsd:enumeration value="ThirdQuarterRecurringOrders"/>
+ <xsd:enumeration value="TimeExpended"/>
+ <xsd:enumeration value="TimeFrame"/>
+ <xsd:enumeration value="TimeInCountry"/>
+ <xsd:enumeration value="TimeInPosition"/>
+ <xsd:enumeration value="TimeSinceHospitalization"/>
+ <xsd:enumeration value="TimeSinceLastApplication"/>
+ <xsd:enumeration value="TimeSinceLastCivilianFlight"/>
+ <xsd:enumeration value="TimeSinceLastInsuranceMedical"/>
+ <xsd:enumeration value="TimeSinceLastMilitaryFlight"/>
+ <xsd:enumeration value="TimeSinceMedicalConsult"/>
+ <xsd:enumeration value="TimeSinceMedicationEnd"/>
+ <xsd:enumeration value="TimeSinceMedicationStart"/>
+ <xsd:enumeration value="TimeSinceOnset"/>
+ <xsd:enumeration value="TimeSinceSurgery"/>
+ <xsd:enumeration value="TimeSinceTrip"/>
+ <xsd:enumeration value="TimeUnits"/>
+ <xsd:enumeration value="TimeUnitsKnown"/>
+ <xsd:enumeration value="TimeUnitsPerShift"/>
+ <xsd:enumeration value="TimeUnitsSpentOnDuty"/>
+ <xsd:enumeration value="Tires"/>
+ <xsd:enumeration value="ToCompleteQuantityEstimated"/>
+ <xsd:enumeration value="Tolerance"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="TotalAdjustmentsVolume"/>
+ <xsd:enumeration value="TotalAmortisationQuantity"/>
+ <xsd:enumeration value="TotalAtComplete"/>
+ <xsd:enumeration value="TotalAuthorizedQuantity"/>
+ <xsd:enumeration value="TotalBeginningInventory"/>
+ <xsd:enumeration value="TotalClaimsAssociatedWithRepeatedTrauma"/>
+ <xsd:enumeration value="TotalClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalClaimsWithDisordersDueToPhysicalAgents"/>
+ <xsd:enumeration value="TotalClaimsWithDustDiseasesOfTheLungs"/>
+ <xsd:enumeration value="TotalClaimsWithoutDaysAwayFromWorkAndWithoutRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalClaimsWithPoisoningIllnesses"/>
+ <xsd:enumeration value="TotalClaimsWithRespiratoryConditionsDueToToxicAgents"/>
+ <xsd:enumeration value="TotalClaimsWithSkinDiseasesOrDisorders"/>
+ <xsd:enumeration value="TotalConsolidatedDomesticSubsidiaries"/>
+ <xsd:enumeration value="TotalConsolidatedForeignSubsidiaries"/>
+ <xsd:enumeration value="TotalConsolidatedSubsidiaries"/>
+ <xsd:enumeration value="TotalCredits"/>
+ <xsd:enumeration value="TotalCreditsAccepted"/>
+ <xsd:enumeration value="TotalCreditsReceived"/>
+ <xsd:enumeration value="TotalCreditsRejected"/>
+ <xsd:enumeration value="TotalDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalDaysAwayFromWorkDueToIllness"/>
+ <xsd:enumeration value="TotalDaysAwayFromWorkDueToInjury"/>
+ <xsd:enumeration value="TotalDaysOfRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalDaysOfRestrictedWorkActivityDueToIllness"/>
+ <xsd:enumeration value="TotalDaysOnMarket"/>
+ <xsd:enumeration value="TotalDaysWithRestrictedWorkActivityDueToInjury"/>
+ <xsd:enumeration value="TotalDeathClaims"/>
+ <xsd:enumeration value="TotalDeathsAsAResultOfIllness"/>
+ <xsd:enumeration value="TotalDeathsAsAResultOfInjury"/>
+ <xsd:enumeration value="TotalDebits"/>
+ <xsd:enumeration value="TotalDebitsAccepted"/>
+ <xsd:enumeration value="TotalDebitsReceived"/>
+ <xsd:enumeration value="TotalDebitsRejected"/>
+ <xsd:enumeration value="TotalDeliveryQuantity"/>
+ <xsd:enumeration value="TotalDemandOrders"/>
+ <xsd:enumeration value="TotalDemandQuantity"/>
+ <xsd:enumeration value="TotalEmployees"/>
+ <xsd:enumeration value="TotalEndingInventory"/>
+ <xsd:enumeration value="TotalFloatTime"/>
+ <xsd:enumeration value="TotalGasDisposition"/>
+ <xsd:enumeration value="TotalGasInjectionVolume"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithOccupationalIllnessesNotOtherwiseClassified"/>
+ <xsd:enumeration value="TotalIllnessClaimsWithoutLostWorkDays"/>
+ <xsd:enumeration value="TotalIllnessWithLostWorkDaysOrRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithDaysAwayFromWork"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithDaysAwayFromWorkOrRestrictedWorkActivity"/>
+ <xsd:enumeration value="TotalInjuryClaimsWithoutLostWorkDays"/>
+ <xsd:enumeration value="TotalInventory"/>
+ <xsd:enumeration value="TotalNon-ConsolidatedSubsidiaries"/>
+ <xsd:enumeration value="TotalNumberOfConvictions"/>
+ <xsd:enumeration value="TotalNumberOfDomesticSubsidiariesIncludedInFinancial"/>
+ <xsd:enumeration value="TotalNumberOfDomesticSubsidiariesNotIncludedIn"/>
+ <xsd:enumeration value="TotalNumberOfForeignSubsidiariesIncludedInFinancial"/>
+ <xsd:enumeration value="TotalNumberOfForeignSubsidiariesNotIncludedIn"/>
+ <xsd:enumeration value="TotalNumberOfLoanDetailRecords"/>
+ <xsd:enumeration value="TotalNumberOfMortgagees"/>
+ <xsd:enumeration value="TotalNumberOfParkingSpaces"/>
+ <xsd:enumeration value="TotalNumberOfSubsidiariesNotIncludedInTheFinancial"/>
+ <xsd:enumeration value="TotalNumberOfUnits"/>
+ <xsd:enumeration value="TotalNumberOfUnitsForSale"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationCombinedReports"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationFirstReports"/>
+ <xsd:enumeration value="TotalNumberOfWorkersCompensationSubsequentReports"/>
+ <xsd:enumeration value="TotalOfIssuableAssets"/>
+ <xsd:enumeration value="TotalOilAndOrCondensateDisposition"/>
+ <xsd:enumeration value="TotalOilAndOrCondensateInjectionVolume"/>
+ <xsd:enumeration value="TotalOtherPropertiesOwnedAndFinanced"/>
+ <xsd:enumeration value="TotalPaymentsRejected"/>
+ <xsd:enumeration value="TotalPost-AdvicesAccepted"/>
+ <xsd:enumeration value="TotalPost-AdvicesReceived"/>
+ <xsd:enumeration value="TotalPost-AdvicesRejected"/>
+ <xsd:enumeration value="TotalPre-AdvicesAccepted"/>
+ <xsd:enumeration value="TotalPre-AdvicesReceived"/>
+ <xsd:enumeration value="TotalPre-AdvicesRejected"/>
+ <xsd:enumeration value="TotalPrenotesAccepted"/>
+ <xsd:enumeration value="TotalPrenotesReceived"/>
+ <xsd:enumeration value="TotalPrenotesRejected"/>
+ <xsd:enumeration value="TotalProductionVolume"/>
+ <xsd:enumeration value="TotalPropertiesOwned"/>
+ <xsd:enumeration value="TotalQuantityPlanned"/>
+ <xsd:enumeration value="TotalResource-Quantity"/>
+ <xsd:enumeration value="TotalRooms"/>
+ <xsd:enumeration value="TotalSales"/>
+ <xsd:enumeration value="TotalServiceBackorderQuantityHighPriority"/>
+ <xsd:enumeration value="TotalServiceBackorderQuantityLowPriority"/>
+ <xsd:enumeration value="TotalSharesOfStock"/>
+ <xsd:enumeration value="TotalSystemBackorderQuantityHighPriority"/>
+ <xsd:enumeration value="TotalSystemBackorderQuantityLowPriority"/>
+ <xsd:enumeration value="TotalToDate"/>
+ <xsd:enumeration value="TotalTransactions"/>
+ <xsd:enumeration value="TotalUnidentifiedTransactionsRejected"/>
+ <xsd:enumeration value="TotalWaterDisposition"/>
+ <xsd:enumeration value="TotalWaterInjectionVolume"/>
+ <xsd:enumeration value="TotalWorkedByAllEmployees"/>
+ <xsd:enumeration value="TotalWorkingInterest"/>
+ <xsd:enumeration value="TrademarkRepresented"/>
+ <xsd:enumeration value="TrademarksUsed"/>
+ <xsd:enumeration value="Trainees"/>
+ <xsd:enumeration value="Trainers"/>
+ <xsd:enumeration value="TransactionSets"/>
+ <xsd:enumeration value="TransferQuantity"/>
+ <xsd:enumeration value="TransferredInQuantity"/>
+ <xsd:enumeration value="TransferredOutQuantity"/>
+ <xsd:enumeration value="TravelFrequency"/>
+ <xsd:enumeration value="TravellingEmployees"/>
+ <xsd:enumeration value="TravelPeriod"/>
+ <xsd:enumeration value="TripDuration"/>
+ <xsd:enumeration value="Trips"/>
+ <xsd:enumeration value="TrunkedChannels"/>
+ <xsd:enumeration value="UnacknowledgedQuantity"/>
+ <xsd:enumeration value="UnadjustedCorrectorReading"/>
+ <xsd:enumeration value="UncoveredCheques"/>
+ <xsd:enumeration value="UniformCommercialCodeFilings"/>
+ <xsd:enumeration value="UnionEmployees"/>
+ <xsd:enumeration value="Units"/>
+ <xsd:enumeration value="UnitsCompleted"/>
+ <xsd:enumeration value="UnitsForSale"/>
+ <xsd:enumeration value="UnitsPerUnitPrice"/>
+ <xsd:enumeration value="UnitsProduced"/>
+ <xsd:enumeration value="UnitsRented"/>
+ <xsd:enumeration value="UnitsWorkedLastDay"/>
+ <xsd:enumeration value="UnitsWorkedPerDay"/>
+ <xsd:enumeration value="UnitsWorkedPerQuarter"/>
+ <xsd:enumeration value="UnitsWorkedPerWeek"/>
+ <xsd:enumeration value="Unpaid"/>
+ <xsd:enumeration value="UnsaleableQuantity"/>
+ <xsd:enumeration value="UnsoldQuantityHeldByWholesaler"/>
+ <xsd:enumeration value="UntilNextTravel"/>
+ <xsd:enumeration value="UnusableQuantity"/>
+ <xsd:enumeration value="UnusedAccumulatedSickDays"/>
+ <xsd:enumeration value="UnverifiedReceipts"/>
+ <xsd:enumeration value="UrgentDeliveryQuantity"/>
+ <xsd:enumeration value="Used"/>
+ <xsd:enumeration value="UseOfExtracorporealCirculation"/>
+ <xsd:enumeration value="UseOfHyperbaricPressurization"/>
+ <xsd:enumeration value="UseOfHypertension"/>
+ <xsd:enumeration value="UseOfHypotension"/>
+ <xsd:enumeration value="UseOfHypothermia"/>
+ <xsd:enumeration value="Vacancies"/>
+ <xsd:enumeration value="Variance"/>
+ <xsd:enumeration value="VarianceAdjustment"/>
+ <xsd:enumeration value="VehicularRadios"/>
+ <xsd:enumeration value="VerifiedReceipts"/>
+ <xsd:enumeration value="VisitationFrequency"/>
+ <xsd:enumeration value="Visits"/>
+ <xsd:enumeration value="VoiceStorageQuantity"/>
+ <xsd:enumeration value="VoidVotes"/>
+ <xsd:enumeration value="VolumeShrinkageAdjustmentOrAllowance"/>
+ <xsd:enumeration value="Votes"/>
+ <xsd:enumeration value="VotingSharesHeld"/>
+ <xsd:enumeration value="WarehouseEmployees"/>
+ <xsd:enumeration value="WarehouseSize"/>
+ <xsd:enumeration value="WaterRe-InjectedOnProperty"/>
+ <xsd:enumeration value="WaterVolume"/>
+ <xsd:enumeration value="WeeksWorked"/>
+ <xsd:enumeration value="Weight"/>
+ <xsd:enumeration value="WeightChangePeriod"/>
+ <xsd:enumeration value="WeightGain"/>
+ <xsd:enumeration value="WeightLoss"/>
+ <xsd:enumeration value="WholesalerToWholesalerSales"/>
+ <xsd:enumeration value="WideAreaTelephoneServicePer800ServiceUnits"/>
+ <xsd:enumeration value="WorkCalendarUnits"/>
+ <xsd:enumeration value="WorkDays"/>
+ <xsd:enumeration value="WorkInProcess"/>
+ <xsd:enumeration value="WorkPeriod"/>
+ <xsd:enumeration value="WorkTimeUnits"/>
+ <xsd:enumeration value="WorkTimeUnitsPerShift"/>
+ <xsd:enumeration value="Years"/>
+ <xsd:enumeration value="YearsInSchool"/>
+ <xsd:enumeration value="YearsInThisLineOfWorkOrProfession"/>
+ <xsd:enumeration value="YearsOnJob"/>
+ <xsd:enumeration value="YearsRemaining"/>
+ <xsd:enumeration value="YesVotes"/>
+ <xsd:enumeration value="CurrentDuration"/>
+ <xsd:enumeration value="CurrentInventoryQuantityAvailableForShipment"/>
+ <xsd:enumeration value="CurrentPeriodImbalance"/>
+ <xsd:enumeration value="CurrentServiceLife"/>
+ <xsd:enumeration value="CurrentShareBalance"/>
+ <xsd:enumeration value="CustomerEstimatedLatestMeterReading"/>
+ <xsd:enumeration value="CustomerEstimatedPreviousMeterReading"/>
+ <xsd:enumeration value="CustomerReadingQuantity"/>
+ <xsd:enumeration value="DailyAdjustments"/>
+ <xsd:enumeration value="DailyAverageQuantity"/>
+ <xsd:enumeration value="DailyWorkShifts"/>
+ <xsd:enumeration value="DamagedGoods"/>
+ <xsd:enumeration value="DataStorageQuantity"/>
+ <xsd:enumeration value="Days"/>
+ <xsd:enumeration value="DaysOperated"/>
+ <xsd:enumeration value="DaysProduced"/>
+ <xsd:enumeration value="DaysSupply"/>
+ <xsd:enumeration value="DebentureBond"/>
+ <xsd:enumeration value="DebenturesFiledAgainstDirectors"/>
+ <xsd:enumeration value="Debited"/>
+ <xsd:enumeration value="DebtCollectors"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfContractItem">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ContractItem"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfContractItem" type="ListOfContractItem"/>
+ <xsd:complexType name="ContractItem">
+ <xsd:sequence>
+ <xsd:element ref="Contract"/>
+ <xsd:element minOccurs="0" name="ContractItemNumber" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractItem" type="ContractItem"/>
+ <xsd:complexType name="Contract">
+ <xsd:sequence>
+ <xsd:element ref="ContractID"/>
+ <xsd:element minOccurs="0" ref="ContractType"/>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:element minOccurs="0" name="SystemID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Contract" type="Contract"/>
+ <xsd:complexType name="ContractType">
+ <xsd:sequence>
+ <xsd:element name="ContractTypeCoded" type="ContractTypeCode"/>
+ <xsd:element minOccurs="0" name="ContractTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ContractType" type="ContractType"/>
+ <xsd:simpleType name="ContractTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="DiagnosisRelatedGroup"/>
+ <xsd:enumeration value="PerDiem"/>
+ <xsd:enumeration value="VariablePerDiem"/>
+ <xsd:enumeration value="Flat"/>
+ <xsd:enumeration value="Capitated"/>
+ <xsd:enumeration value="Percent"/>
+ <xsd:enumeration value="NegotiatedGrowingEquityMortgage"/>
+ <xsd:enumeration value="AnticipatedContract"/>
+ <xsd:enumeration value="FederalHousingAuthorityAdjustableRateMortgage"/>
+ <xsd:enumeration value="FederalHousingAuthorityVeteransAffairsFixedRateMortgage"/>
+ <xsd:enumeration value="ConventionalSecondMortgages"/>
+ <xsd:enumeration value="ConventionalFixedRateMortgages"/>
+ <xsd:enumeration value="FederalHousingAuthorityVeteransAffairsGraduatedPaymentMortgage"/>
+ <xsd:enumeration value="NegotiatedConventionalGraduatedPaymentOrStepRateMortgage"/>
+ <xsd:enumeration value="ConventionalAdjustableRateMortgage"/>
+ <xsd:enumeration value="CostPlusIncentiveFee"/>
+ <xsd:enumeration value="CostSharing"/>
+ <xsd:enumeration value="CostPlus"/>
+ <xsd:enumeration value="Cost"/>
+ <xsd:enumeration value="CostPlusAwardFee"/>
+ <xsd:enumeration value="CostPlusFixedFee"/>
+ <xsd:enumeration value="Distributor"/>
+ <xsd:enumeration value="ExclusiveAgency"/>
+ <xsd:enumeration value="ExclusiveRight"/>
+ <xsd:enumeration value="FirmorActualContract"/>
+ <xsd:enumeration value="FixedPriceIncentiveFirmTargetWithPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceIncentiveFirmTargetWithoutPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceRedetermination"/>
+ <xsd:enumeration value="FixedPricewithEscalation"/>
+ <xsd:enumeration value="FixedPriceIncentiveSuccessiveTargetWithPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceIncentiveSuccessiveTargetWithoutPerformanceIncentive"/>
+ <xsd:enumeration value="FixedPriceAwardFee"/>
+ <xsd:enumeration value="FixedPriceIncentive"/>
+ <xsd:enumeration value="FixedPriceLevelofEffort"/>
+ <xsd:enumeration value="NoCost"/>
+ <xsd:enumeration value="FlatAmount"/>
+ <xsd:enumeration value="RetroactiveFixedPriceRedetermination"/>
+ <xsd:enumeration value="FirmFixedPrice"/>
+ <xsd:enumeration value="FixedPricewithEconomicPriceAdjustment"/>
+ <xsd:enumeration value="Labor"/>
+ <xsd:enumeration value="LevelofEffort"/>
+ <xsd:enumeration value="LaborHours"/>
+ <xsd:enumeration value="OtherContractType"/>
+ <xsd:enumeration value="ProspectReservation"/>
+ <xsd:enumeration value="SamePercentageasFilmRentalEarned"/>
+ <xsd:enumeration value="TimeandMaterials"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ValidityDates">
+ <xsd:sequence>
+ <xsd:element name="StartDate" type="xcblDatetime"/>
+ <xsd:element name="EndDate" type="xcblDatetime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ValidityDates" type="ValidityDates"/>
+ <xsd:complexType name="ConditionsOfSale">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="SalesRequirement"/>
+ <xsd:element minOccurs="0" name="SalesActionCoded" type="SalesActionCode"/>
+ <xsd:element minOccurs="0" name="SalesActionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SalesActionValue" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ConditionsOfSale" type="ConditionsOfSale"/>
+ <xsd:complexType name="SalesRequirement">
+ <xsd:sequence>
+ <xsd:element name="SalesRequirementCoded" type="SalesRequirementCode"/>
+ <xsd:element minOccurs="0" name="SalesRequirementCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SalesRequirement" type="SalesRequirement"/>
+ <xsd:simpleType name="SalesRequirementCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AddQuantityToMakeMinimumWeightRequirement"/>
+ <xsd:enumeration value="BackOrderIfItemsAreOutOfStockOrNotYetPublished"/>
+ <xsd:enumeration value="BackOrderIfOutOfStock"/>
+ <xsd:enumeration value="BackOrderOnlyIfNewItem"/>
+ <xsd:enumeration value="BidGuarantee"/>
+ <xsd:enumeration value="CombinedSmallDisadvantagedBusinessAndLaborSurplusAreaSet-Aside"/>
+ <xsd:enumeration value="Consignment"/>
+ <xsd:enumeration value="DoNotPreship"/>
+ <xsd:enumeration value="EqualProductAllowed"/>
+ <xsd:enumeration value="ExcludeImportQuotaInFirstCost"/>
+ <xsd:enumeration value="FactoryShip"/>
+ <xsd:enumeration value="GuaranteedSale"/>
+ <xsd:enumeration value="IncludeImportQuotaInFirstCost"/>
+ <xsd:enumeration value="LaborSurplusAreaSet-Aside"/>
+ <xsd:enumeration value="LargePurchaseSet-AsideForSmallBusiness"/>
+ <xsd:enumeration value="MayPreship"/>
+ <xsd:enumeration value="Multi-yearAward"/>
+ <xsd:enumeration value="NoBackOrder"/>
+ <xsd:enumeration value="NoSubstitutes"/>
+ <xsd:enumeration value="NotifyPriorToShipmentIfQuantitySpecifiedIsNotAvailable"/>
+ <xsd:enumeration value="OnQualifiedBiddersList"/>
+ <xsd:enumeration value="OnQualifiedManufacturersList"/>
+ <xsd:enumeration value="OtherUnlistedSalesCondition"/>
+ <xsd:enumeration value="PartialLaborSurplusAreaSetAside"/>
+ <xsd:enumeration value="RestrictedToApprovedSources"/>
+ <xsd:enumeration value="RestrictedToEducationalInstitutions"/>
+ <xsd:enumeration value="RestrictedToHistoricallyBlackCollegeOrUniversityOrMinorityInstitution"/>
+ <xsd:enumeration value="RestrictedToIndustrialPreparednessProgramParticipants"/>
+ <xsd:enumeration value="RestrictedToQualifiedProductsListProducts"/>
+ <xsd:enumeration value="RestrictedToUSAndCanadianSources"/>
+ <xsd:enumeration value="RestrictedToYoungInvestigatorProgram"/>
+ <xsd:enumeration value="Section8aSet-Aside"/>
+ <xsd:enumeration value="Set-asideForAmericanIndian-ownedBusiness"/>
+ <xsd:enumeration value="ShipAsSoonAsPossible"/>
+ <xsd:enumeration value="ShipComplete"/>
+ <xsd:enumeration value="ShipFullTruckOnly"/>
+ <xsd:enumeration value="ShipIn-Place"/>
+ <xsd:enumeration value="ShipPartial-BalanceBackOrder"/>
+ <xsd:enumeration value="ShipPartialBalanceCancel"/>
+ <xsd:enumeration value="ShipPartialBalanceSubstitute"/>
+ <xsd:enumeration value="ShipPartialCarloadLotsOnly"/>
+ <xsd:enumeration value="ShipPartialItemQtyProportionalToTotalOrder"/>
+ <xsd:enumeration value="ShipPartialTruckloadLotsOnly"/>
+ <xsd:enumeration value="ShipPerRelease"/>
+ <xsd:enumeration value="ShipPerReleaseorBuyerAuthorization"/>
+ <xsd:enumeration value="ShipPerSchedule"/>
+ <xsd:enumeration value="SmallBusinessWithSmallDisadvantagedBusinessConsiderationSet-Aside"/>
+ <xsd:enumeration value="SmallDisadvantagedBusinessSet-Aside"/>
+ <xsd:enumeration value="SmallPurchaseSetAsideForSmallBusinesses"/>
+ <xsd:enumeration value="SmallRemainingBalanceCancellationAllowed"/>
+ <xsd:enumeration value="SmallRemainingBalanceCancellationNotAllowed"/>
+ <xsd:enumeration value="SubstituteItemAllowed"/>
+ <xsd:enumeration value="UnrestrictedProcurement"/>
+ <xsd:enumeration value="WarehouseShip"/>
+ <xsd:enumeration value="Warranty"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="SalesActionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CancelBalanceThatExceedsSalesActionValues"/>
+ <xsd:enumeration value="CancelEntire"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Hazardous">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="ListOfHazardousIdentifiers"/>
+ <xsd:element minOccurs="0" name="HazardClassCoded" type="HazardClassCode"/>
+ <xsd:element minOccurs="0" name="HazardClassCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="HazardousPlacardInformation"/>
+ <xsd:element minOccurs="0" name="HazardousReferences">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReferenceCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="HazardousContact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Contact"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="HazardNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="UNDGNum" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="HazardousTemperatures"/>
+ <xsd:element minOccurs="0" ref="HazardousShipmentInformation"/>
+ <xsd:element minOccurs="0" name="EMSNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Mfag" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Hazardous" type="Hazardous"/>
+ <xsd:complexType name="ListOfHazardousIdentifiers">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="HazardousIdentifiers"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfHazardousIdentifiers" type="ListOfHazardousIdentifiers"/>
+ <xsd:complexType name="HazardousIdentifiers">
+ <xsd:sequence>
+ <xsd:element name="HazardousRegulationsCoded" type="AgencyCode"/>
+ <xsd:element minOccurs="0" name="HazardousRegulationsCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardCode" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeExtension" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CodeVersion" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardOfficialText" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TremCardNum" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousIdentifiers" type="HazardousIdentifiers"/>
+ <xsd:simpleType name="HazardClassCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Primary"/>
+ <xsd:enumeration value="Secondary"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="HazardousPlacardInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="HazardousPlacardIdentification" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousPlacardText" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousPlacardInformation" type="HazardousPlacardInformation"/>
+ <xsd:complexType name="HazardousTemperatures">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="Flashpoint">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="Emergency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="Control">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ListOfTemperatureCoded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousTemperatures" type="HazardousTemperatures"/>
+ <xsd:complexType name="HazardousShipmentInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="HazardPackingCoded" type="HazardPackingCode"/>
+ <xsd:element minOccurs="0" name="HazardPackingCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentCoded" type="HazardousShipmentCode"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousShipmentNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="HazardousZoneCoded" type="HazardousZoneCode"/>
+ <xsd:element minOccurs="0" name="HazardousZoneCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="HazardousShipmentInformation" type="HazardousShipmentInformation"/>
+ <xsd:simpleType name="HazardPackingCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="GreatDanger"/>
+ <xsd:enumeration value="MediumDanger"/>
+ <xsd:enumeration value="MinorDanger"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="HazardousShipmentCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AdditionalDescriptiveInformationNotRequiredByRegulationButDesiredToAccompanyTheMovementByTheShipper"/>
+ <xsd:enumeration value="CargoAirliftOnly"/>
+ <xsd:enumeration value="DOT-113DoNotBumpOrCutOffCarWhileInMotionDeclaration"/>
+ <xsd:enumeration value="DamagedCarNumber"/>
+ <xsd:enumeration value="DangerousWhenWetDeclaration"/>
+ <xsd:enumeration value="EMSPageNumber"/>
+ <xsd:enumeration value="IdentifiesProductsInAHeatedMoltenState"/>
+ <xsd:enumeration value="HazardousSubstanceConstituents"/>
+ <xsd:enumeration value="InhalationHazard"/>
+ <xsd:enumeration value="LimitedQuantityDeclaration"/>
+ <xsd:enumeration value="MFAGPageNumber"/>
+ <xsd:enumeration value="MaximumOperatingSpeed"/>
+ <xsd:enumeration value="MarinePollutant"/>
+ <xsd:enumeration value="Poison-InhalationHazardDeclaration"/>
+ <xsd:enumeration value="PoisonDeclaration"/>
+ <xsd:enumeration value="RadioactiveMaterialData"/>
+ <xsd:enumeration value="TechnicalOrChemicalGroupName"/>
+ <xsd:enumeration value="TradeName"/>
+ <xsd:enumeration value="WasteDeclaration"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="HazardousZoneCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="HazardZoneA"/>
+ <xsd:enumeration value="HazardZoneB"/>
+ <xsd:enumeration value="HazardZoneC"/>
+ <xsd:enumeration value="HazardZoneD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PricingDetail">
+ <xsd:sequence>
+ <xsd:element ref="ListOfPrice"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Tax"/>
+ <xsd:element minOccurs="0" name="ItemAllowancesOrCharges">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfAllowOrCharge"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TotalValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PricingDetail" type="PricingDetail"/>
+ <xsd:complexType name="ListOfPrice">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Price"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfPrice" type="ListOfPrice"/>
+ <xsd:complexType name="Price">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="PricingType"/>
+ <xsd:element ref="UnitPrice"/>
+ <xsd:element minOccurs="0" name="PriceBasisQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CalculatedPriceBasisQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:element minOccurs="0" name="PriceQuantityRange">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="PriceMultiplier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Price" type="Price"/>
+ <xsd:complexType name="PricingType">
+ <xsd:sequence>
+ <xsd:element name="PriceTypeCoded" type="PriceTypeCode"/>
+ <xsd:element minOccurs="0" name="PriceTypeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PricingType" type="PricingType"/>
+ <xsd:simpleType name="PriceTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CancellationPrice"/>
+ <xsd:enumeration value="PerTon"/>
+ <xsd:enumeration value="MinimumOrderPrice"/>
+ <xsd:enumeration value="ExportPrice"/>
+ <xsd:enumeration value="RangeDependentPrice"/>
+ <xsd:enumeration value="ActiveIngredient"/>
+ <xsd:enumeration value="AsIsQuantity"/>
+ <xsd:enumeration value="CalculationNet"/>
+ <xsd:enumeration value="CalculationGross"/>
+ <xsd:enumeration value="TaxIncludedAllowancesAndChargesNotIncluded"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="AverageSellingPrice"/>
+ <xsd:enumeration value="InformationPriceTaxIncludedExcludingAllowancesOrCharges"/>
+ <xsd:enumeration value="InformationPriceExcludingAllowancesOrChargesAndTaxes"/>
+ <xsd:enumeration value="AdditiveUnitPriceComponent"/>
+ <xsd:enumeration value="AverageGenericProductPrice"/>
+ <xsd:enumeration value="AlternatePrice"/>
+ <xsd:enumeration value="AverageWholesalePrice"/>
+ <xsd:enumeration value="BaseCharge"/>
+ <xsd:enumeration value="ContractTier1"/>
+ <xsd:enumeration value="ContractTier2"/>
+ <xsd:enumeration value="ContractTier3"/>
+ <xsd:enumeration value="ContractTier4"/>
+ <xsd:enumeration value="ContractTier5"/>
+ <xsd:enumeration value="ContractTier6"/>
+ <xsd:enumeration value="ContractTier7"/>
+ <xsd:enumeration value="ContractTier8"/>
+ <xsd:enumeration value="ContractTier9"/>
+ <xsd:enumeration value="ContractTier10"/>
+ <xsd:enumeration value="ContractTier11"/>
+ <xsd:enumeration value="ContractTier12"/>
+ <xsd:enumeration value="ContractTier13"/>
+ <xsd:enumeration value="ContractTier14"/>
+ <xsd:enumeration value="ContractTier15"/>
+ <xsd:enumeration value="ContractTier16"/>
+ <xsd:enumeration value="ContractTier17"/>
+ <xsd:enumeration value="ContractTier18"/>
+ <xsd:enumeration value="ContractTier19"/>
+ <xsd:enumeration value="ContractTier20"/>
+ <xsd:enumeration value="ContractTier21"/>
+ <xsd:enumeration value="ContractTier22"/>
+ <xsd:enumeration value="ContractTier23"/>
+ <xsd:enumeration value="ContractTier24"/>
+ <xsd:enumeration value="ContractTier25"/>
+ <xsd:enumeration value="ContractTier26"/>
+ <xsd:enumeration value="ContractTier27"/>
+ <xsd:enumeration value="ContractTier28"/>
+ <xsd:enumeration value="ContractTier29"/>
+ <xsd:enumeration value="ContractTier30"/>
+ <xsd:enumeration value="CalculationPrice"/>
+ <xsd:enumeration value="CatalogPrice"/>
+ <xsd:enumeration value="CentralDistributionFacility"/>
+ <xsd:enumeration value="CurrentDomesticValue"/>
+ <xsd:enumeration value="ChangedPrice"/>
+ <xsd:enumeration value="ContractPrice"/>
+ <xsd:enumeration value="ConsumerUnit"/>
+ <xsd:enumeration value="ConfirmedUnitPrice"/>
+ <xsd:enumeration value="DeclaredCustomsUnitValue"/>
+ <xsd:enumeration value="DealerAdjustedPrice"/>
+ <xsd:enumeration value="DistributorsPrice"/>
+ <xsd:enumeration value="DiscountPrice"/>
+ <xsd:enumeration value="DiscountAmountAllowed"/>
+ <xsd:enumeration value="DirectStoreDelivery"/>
+ <xsd:enumeration value="DirectShipProgramPrice"/>
+ <xsd:enumeration value="EcscPrice"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceOriginalEquipmentManufacturer"/>
+ <xsd:enumeration value="EmergencyDirectShipPrice"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceSupplier"/>
+ <xsd:enumeration value="EmergencyDirectShipPriceWarehouse"/>
+ <xsd:enumeration value="EstimatedPrice"/>
+ <xsd:enumeration value="ExpectedUnitPrice"/>
+ <xsd:enumeration value="FlatCharge"/>
+ <xsd:enumeration value="FrequentDeliveryService"/>
+ <xsd:enumeration value="FederalExciseTax"/>
+ <xsd:enumeration value="FreeGoodsPrice"/>
+ <xsd:enumeration value="FederalUpperLimitPriceMaximumAllowableCostPricingForDrugs"/>
+ <xsd:enumeration value="FirmPriceDoNotAdvise"/>
+ <xsd:enumeration value="GovernmentPrice"/>
+ <xsd:enumeration value="UnitPriceThroughQuantity"/>
+ <xsd:enumeration value="IndustrialPrice"/>
+ <xsd:enumeration value="InformationPrice"/>
+ <xsd:enumeration value="InstitutionalPrice"/>
+ <xsd:enumeration value="InvoiceBillingPrice"/>
+ <xsd:enumeration value="ListPrice"/>
+ <xsd:enumeration value="MandatoryToAdviseUnitPrice"/>
+ <xsd:enumeration value="MinimumActivitySurcharge"/>
+ <xsd:enumeration value="MaximumOrderQuantityPrice"/>
+ <xsd:enumeration value="MinimumOrderQuantityPrice"/>
+ <xsd:enumeration value="MinimumCharge"/>
+ <xsd:enumeration value="MinimumReleaseQuantityPrice"/>
+ <xsd:enumeration value="MaximumPriceReduction"/>
+ <xsd:enumeration value="ManufacturersSuggestedRetail"/>
+ <xsd:enumeration value="MaximumReleaseQuantityPrice"/>
+ <xsd:enumeration value="NoncontractTier1"/>
+ <xsd:enumeration value="NoncontractTier2"/>
+ <xsd:enumeration value="NoncontractTier3"/>
+ <xsd:enumeration value="NoncontractTier4"/>
+ <xsd:enumeration value="NoncontractTier5"/>
+ <xsd:enumeration value="NoncontractTier6"/>
+ <xsd:enumeration value="NoncontractTier7"/>
+ <xsd:enumeration value="NoncontractTier8"/>
+ <xsd:enumeration value="NoncontractTier9"/>
+ <xsd:enumeration value="NoncontractTier10"/>
+ <xsd:enumeration value="NoncontractTier11"/>
+ <xsd:enumeration value="NoncontractTier12"/>
+ <xsd:enumeration value="NoncontractTier13"/>
+ <xsd:enumeration value="NoncontractTier14"/>
+ <xsd:enumeration value="NoncontractTier15"/>
+ <xsd:enumeration value="NoncontractTier16"/>
+ <xsd:enumeration value="NoncontractTier17"/>
+ <xsd:enumeration value="NoncontractTier18"/>
+ <xsd:enumeration value="NoncontractTier19"/>
+ <xsd:enumeration value="NoncontractTier20"/>
+ <xsd:enumeration value="NoncontractTier21"/>
+ <xsd:enumeration value="NoncontractTier22"/>
+ <xsd:enumeration value="NoncontractTier23"/>
+ <xsd:enumeration value="NoncontractTier24"/>
+ <xsd:enumeration value="NoncontractTier25"/>
+ <xsd:enumeration value="NoncontractTier26"/>
+ <xsd:enumeration value="NoncontractTier27"/>
+ <xsd:enumeration value="NoncontractTier28"/>
+ <xsd:enumeration value="NoncontractTier29"/>
+ <xsd:enumeration value="NoncontractTier30"/>
+ <xsd:enumeration value="NetItemPrice"/>
+ <xsd:enumeration value="NetWeight"/>
+ <xsd:enumeration value="OptionalToAdviseUnitPrice"/>
+ <xsd:enumeration value="OriginalPurchaseOrderPrice"/>
+ <xsd:enumeration value="PriceBreakQuantity"/>
+ <xsd:enumeration value="UnitPriceBeginningQuantity"/>
+ <xsd:enumeration value="PriceBreakPurchaseOrderCount"/>
+ <xsd:enumeration value="PriceCatalogue"/>
+ <xsd:enumeration value="PerEach"/>
+ <xsd:enumeration value="PriceInEffectAtTimeOfShipment"/>
+ <xsd:enumeration value="PerKilogram"/>
+ <xsd:enumeration value="PerLiter"/>
+ <xsd:enumeration value="PrepaidFreightCharges"/>
+ <xsd:enumeration value="ProfessionalPrice"/>
+ <xsd:enumeration value="ProducersPrice"/>
+ <xsd:enumeration value="PromotionalPrice"/>
+ <xsd:enumeration value="PerTonne"/>
+ <xsd:enumeration value="SpecifiedUnit"/>
+ <xsd:enumeration value="ProvisionalPrice"/>
+ <xsd:enumeration value="GrossWeight"/>
+ <xsd:enumeration value="Purchase"/>
+ <xsd:enumeration value="QuotePrice"/>
+ <xsd:enumeration value="Resale"/>
+ <xsd:enumeration value="Retail"/>
+ <xsd:enumeration value="SuggestedDealerNetPrice"/>
+ <xsd:enumeration value="SuggestedFleetPrice"/>
+ <xsd:enumeration value="ShipAndDebit"/>
+ <xsd:enumeration value="SuggestedListPrice"/>
+ <xsd:enumeration value="SpecialPrice"/>
+ <xsd:enumeration value="SinglePriceFactorsEqualized"/>
+ <xsd:enumeration value="SuggestedRetail"/>
+ <xsd:enumeration value="StandardPrice"/>
+ <xsd:enumeration value="SumOfLineItems"/>
+ <xsd:enumeration value="SuggestedWholesalePrice"/>
+ <xsd:enumeration value="ToBeNegotiated"/>
+ <xsd:enumeration value="ThresholdPrice"/>
+ <xsd:enumeration value="TotalInvoiceAmountDue"/>
+ <xsd:enumeration value="Transfer"/>
+ <xsd:enumeration value="TradedUnit"/>
+ <xsd:enumeration value="TheoreticalWeight"/>
+ <xsd:enumeration value="UnitCostPrice"/>
+ <xsd:enumeration value="Wholesale"/>
+ <xsd:enumeration value="ZonePrice"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="UnitPrice">
+ <xsd:sequence>
+ <xsd:element name="UnitPriceValue" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="UnitPrice" type="UnitPrice"/>
+ <xsd:simpleType name="Decimal21_6">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="21"/>
+ <xsd:fractionDigits value="6"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="PriceMultiplier">
+ <xsd:sequence>
+ <xsd:element name="PriceMultiplierCoded" type="PriceMultiplierCode"/>
+ <xsd:element minOccurs="0" name="PriceMultiplierCodedOther" type="xsd:string"/>
+ <xsd:element name="Multiplier" type="xsd:decimal"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PriceMultiplier" type="PriceMultiplier"/>
+ <xsd:simpleType name="PriceMultiplierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CostMarkupMultiplier-OriginalCost"/>
+ <xsd:enumeration value="CostMarkupMultiplier-RetailCost"/>
+ <xsd:enumeration value="DiscountMultiplier"/>
+ <xsd:enumeration value="CostMarkupMultiplier-WholesaleCost"/>
+ <xsd:enumeration value="PercentSolutionMultiplier"/>
+ <xsd:enumeration value="SellingMultiplier"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Tax">
+ <xsd:sequence>
+ <xsd:element name="TaxFunctionQualifierCoded" type="TaxFunctionQualifierCode"/>
+ <xsd:element minOccurs="0" name="TaxFunctionQualifierCodedOther" type="xsd:string"/>
+ <xsd:element name="TaxCategoryCoded" type="TaxCategoryCode"/>
+ <xsd:element minOccurs="0" name="TaxCategoryCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ReasonTaxExemptCoded" type="ReasonTaxExemptCode"/>
+ <xsd:element minOccurs="0" name="ReasonTaxExemptCodedOther" type="xsd:string"/>
+ <xsd:element name="TaxTypeCoded" type="TaxTypeCode"/>
+ <xsd:element minOccurs="0" name="TaxTypeCodedOther">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="TaxPercent" type="Decimal10_4"/>
+ <xsd:element minOccurs="0" name="TaxPaymentMethodCoded" type="TaxPaymentMethodCode"/>
+ <xsd:element minOccurs="0" name="TaxPaymentMethodCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TaxableAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" name="TaxableAmountInTaxAccountingCurrency" type="Decimal21_6"/>
+ <xsd:element name="TaxAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" name="TaxAmountInTaxAccountingCurrency" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" name="TaxLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Tax" type="Tax"/>
+ <xsd:simpleType name="TaxFunctionQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="IndividualDutyTaxOrFeeCustomsItem"/>
+ <xsd:enumeration value="TotalOfAllDutiesTaxesAndFeesCustomsItem"/>
+ <xsd:enumeration value="TotalOfEachDutyTaxOrFeeTypeCustomsDeclaration"/>
+ <xsd:enumeration value="TotalOfAllDutiesTaxesAndFeeTypesCustomsDeclaration"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="Fee"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="TaxRelatedInformation"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxCategoryCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Agriculture"/>
+ <xsd:enumeration value="DirectPayID"/>
+ <xsd:enumeration value="Disabled"/>
+ <xsd:enumeration value="DisabledVeteran"/>
+ <xsd:enumeration value="DutyPaidBySupplier"/>
+ <xsd:enumeration value="ExemptForExport"/>
+ <xsd:enumeration value="ExemptForResale"/>
+ <xsd:enumeration value="ExemptfromCountyPropertyTax"/>
+ <xsd:enumeration value="ExemptfromLocalPropertyTax"/>
+ <xsd:enumeration value="ExemptfromSchoolPropertyTax"/>
+ <xsd:enumeration value="ExemptfromStatePropertyTax"/>
+ <xsd:enumeration value="ExemptFromTax"/>
+ <xsd:enumeration value="ExemptGoodsandServicesTax"/>
+ <xsd:enumeration value="ExemptLetterOnFile"/>
+ <xsd:enumeration value="ExemptLocalService"/>
+ <xsd:enumeration value="ExemptNotForResale"/>
+ <xsd:enumeration value="Exempt-PerStateLaw"/>
+ <xsd:enumeration value="ExemptProvincialSalesTax"/>
+ <xsd:enumeration value="ExemptSaleToUSGovernment"/>
+ <xsd:enumeration value="ExemptTollService"/>
+ <xsd:enumeration value="FreeExportItemTaxNotCharged"/>
+ <xsd:enumeration value="HigherRate"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="LaborTaxableMaterialExempt"/>
+ <xsd:enumeration value="LowerRate"/>
+ <xsd:enumeration value="MaterialTaxableLaborExempt"/>
+ <xsd:enumeration value="MixedTaxRate"/>
+ <xsd:enumeration value="Non-Homestead"/>
+ <xsd:enumeration value="No-NotTaxExempt"/>
+ <xsd:enumeration value="NotExemptForResale"/>
+ <xsd:enumeration value="NotExemptNotForResale"/>
+ <xsd:enumeration value="NotTaxable"/>
+ <xsd:enumeration value="OpenSpace"/>
+ <xsd:enumeration value="OtherPropertyTaxExemption"/>
+ <xsd:enumeration value="Over65"/>
+ <xsd:enumeration value="RecurringExempt"/>
+ <xsd:enumeration value="ServicesOutsideScopeOfTax"/>
+ <xsd:enumeration value="StandardRate"/>
+ <xsd:enumeration value="TotallyExempt"/>
+ <xsd:enumeration value="Transferred"/>
+ <xsd:enumeration value="UsageExempt"/>
+ <xsd:enumeration value="ValueAddedTaxDueFromAPreviousInvoice"/>
+ <xsd:enumeration value="ValueAddedTaxNotNowDueForPayment"/>
+ <xsd:enumeration value="WorkingFarm"/>
+ <xsd:enumeration value="Yes-TaxExempt"/>
+ <xsd:enumeration value="ZeroRatedGoods"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ReasonTaxExemptCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Exempt-ForExport"/>
+ <xsd:enumeration value="Yes-TaxExempt"/>
+ <xsd:enumeration value="No-NotTaxExempt"/>
+ <xsd:enumeration value="Exempt-ForResale"/>
+ <xsd:enumeration value="NotExemptOrForResale"/>
+ <xsd:enumeration value="Exempt-NotForResale"/>
+ <xsd:enumeration value="NotExemptNotForResale"/>
+ <xsd:enumeration value="DirectPayId"/>
+ <xsd:enumeration value="Exempt-SaleToUSGovernment"/>
+ <xsd:enumeration value="Exempt-PerStateLaw"/>
+ <xsd:enumeration value="LaborTaxableMaterialExempt"/>
+ <xsd:enumeration value="MaterialTaxableLaborExempt"/>
+ <xsd:enumeration value="NotTaxable"/>
+ <xsd:enumeration value="Disabled"/>
+ <xsd:enumeration value="ExemptTollService"/>
+ <xsd:enumeration value="Exempt-GoodsAndServicesTax"/>
+ <xsd:enumeration value="Exempt-ProvincialSalesTax"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="Agriculture"/>
+ <xsd:enumeration value="WorkingFarm"/>
+ <xsd:enumeration value="OpenSpace"/>
+ <xsd:enumeration value="ExemptLocalService"/>
+ <xsd:enumeration value="DisabledVeteran"/>
+ <xsd:enumeration value="Non-Homestead"/>
+ <xsd:enumeration value="Over65"/>
+ <xsd:enumeration value="ExemptFromSchoolPropertyTax"/>
+ <xsd:enumeration value="ExemptFromLocalPropertyTax"/>
+ <xsd:enumeration value="RecurringExempt"/>
+ <xsd:enumeration value="ExemptFromCountyPropertyTax"/>
+ <xsd:enumeration value="TotallyExempt"/>
+ <xsd:enumeration value="UsageExempt"/>
+ <xsd:enumeration value="ExemptFromStatePropertyTax"/>
+ <xsd:enumeration value="OtherPropertyTaxExemption"/>
+ <xsd:enumeration value="Exempt-LetterOnFile"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="911CityTax"/>
+ <xsd:enumeration value="911CountyTax"/>
+ <xsd:enumeration value="911ExciseTax"/>
+ <xsd:enumeration value="911StateTax"/>
+ <xsd:enumeration value="911Tax"/>
+ <xsd:enumeration value="AccommodationsTax"/>
+ <xsd:enumeration value="AdValoremTax"/>
+ <xsd:enumeration value="AgriculturalExportRebate"/>
+ <xsd:enumeration value="Agriculturallevy"/>
+ <xsd:enumeration value="AlcoholicBeverageTax"/>
+ <xsd:enumeration value="AlcoholMarkTax"/>
+ <xsd:enumeration value="AllTaxes"/>
+ <xsd:enumeration value="Anti-DumpingDuty"/>
+ <xsd:enumeration value="Assessment"/>
+ <xsd:enumeration value="BusinessLicenseFee"/>
+ <xsd:enumeration value="BusinessPrivilegeTax"/>
+ <xsd:enumeration value="CarTax"/>
+ <xsd:enumeration value="CityRentalTax"/>
+ <xsd:enumeration value="CitySalesTax"/>
+ <xsd:enumeration value="CityTax"/>
+ <xsd:enumeration value="CoffeeTax"/>
+ <xsd:enumeration value="CoinOperatedDeviceTax"/>
+ <xsd:enumeration value="CommoditySpecificTax"/>
+ <xsd:enumeration value="CorporateIncomeTax"/>
+ <xsd:enumeration value="CountervailingDuty"/>
+ <xsd:enumeration value="CountyOrParishSalesTax"/>
+ <xsd:enumeration value="CountyRentalTax"/>
+ <xsd:enumeration value="CountyTax"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="DefaultLaborTax"/>
+ <xsd:enumeration value="EmploymentTax"/>
+ <xsd:enumeration value="EnergyTax"/>
+ <xsd:enumeration value="Enhanced911StateExciseTax"/>
+ <xsd:enumeration value="EnvironmentalTax"/>
+ <xsd:enumeration value="EquipmentTax"/>
+ <xsd:enumeration value="EstateTax"/>
+ <xsd:enumeration value="ExciseDuty"/>
+ <xsd:enumeration value="FederalExciseTax"/>
+ <xsd:enumeration value="FederalIncomeTaxWithholding"/>
+ <xsd:enumeration value="FederalTax"/>
+ <xsd:enumeration value="FederalValueAddedTaxOnGoods"/>
+ <xsd:enumeration value="FederalValueAddedTaxOnServices"/>
+ <xsd:enumeration value="FeeInLieu"/>
+ <xsd:enumeration value="FICAMedicareTax"/>
+ <xsd:enumeration value="FICASocialSecurityTax"/>
+ <xsd:enumeration value="FICATax"/>
+ <xsd:enumeration value="FranchiseTax"/>
+ <xsd:enumeration value="Free"/>
+ <xsd:enumeration value="FuelLUSTTax"/>
+ <xsd:enumeration value="FuelSpillTax"/>
+ <xsd:enumeration value="FuelSuperFundTax"/>
+ <xsd:enumeration value="GamingTax"/>
+ <xsd:enumeration value="GeneralConstructionTax"/>
+ <xsd:enumeration value="GiftTax"/>
+ <xsd:enumeration value="GoodsAndServicesTax"/>
+ <xsd:enumeration value="GrossReceiptsTax"/>
+ <xsd:enumeration value="HandicapTax"/>
+ <xsd:enumeration value="HazardousWasteTax"/>
+ <xsd:enumeration value="HighwayUseTax"/>
+ <xsd:enumeration value="IlluminantsTax"/>
+ <xsd:enumeration value="ImportTax"/>
+ <xsd:enumeration value="IndividualIncomeTax"/>
+ <xsd:enumeration value="IndividualTax"/>
+ <xsd:enumeration value="InheritanceTax"/>
+ <xsd:enumeration value="InternationalFuelTaxAgreementTax"/>
+ <xsd:enumeration value="LaborByTradeTax"/>
+ <xsd:enumeration value="LeakyUndergroundStorageTankTaxFederal"/>
+ <xsd:enumeration value="LeakyUndergroundStorageTankTaxState"/>
+ <xsd:enumeration value="LicenseTax"/>
+ <xsd:enumeration value="LightDuesPayable"/>
+ <xsd:enumeration value="LocalConstructionTax"/>
+ <xsd:enumeration value="LocalSalesTax"/>
+ <xsd:enumeration value="LocalTax"/>
+ <xsd:enumeration value="LustTax"/>
+ <xsd:enumeration value="MaterialTax"/>
+ <xsd:enumeration value="MetropolitanTransitTax"/>
+ <xsd:enumeration value="MinimumTax"/>
+ <xsd:enumeration value="MiscellaneousCashDeposit"/>
+ <xsd:enumeration value="MiscellaneousStateTax"/>
+ <xsd:enumeration value="MonetaryCompensatoryAmount"/>
+ <xsd:enumeration value="MotorFuelTax"/>
+ <xsd:enumeration value="MunicipalTax"/>
+ <xsd:enumeration value="OccupationalTax"/>
+ <xsd:enumeration value="OtherTaxes"/>
+ <xsd:enumeration value="PaperConsortiumTax-Italy"/>
+ <xsd:enumeration value="PersonalPropertyTax"/>
+ <xsd:enumeration value="PetroleumTax"/>
+ <xsd:enumeration value="PostThresholdTax"/>
+ <xsd:enumeration value="PreferenceDuty"/>
+ <xsd:enumeration value="PreThresholdTax"/>
+ <xsd:enumeration value="ProvisionalcountervailingDutyBond"/>
+ <xsd:enumeration value="ProvisionalCountervailingDutyCash"/>
+ <xsd:enumeration value="ProvisionalDutyBond"/>
+ <xsd:enumeration value="ProvisionalDutyCash"/>
+ <xsd:enumeration value="PublicHealthAndEducationTax"/>
+ <xsd:enumeration value="RealPropertyTax"/>
+ <xsd:enumeration value="SalesAndUseTax"/>
+ <xsd:enumeration value="SchoolTax"/>
+ <xsd:enumeration value="SecondaryPercentageTax"/>
+ <xsd:enumeration value="SeveranceTax"/>
+ <xsd:enumeration value="ShiftedSocialSecurities"/>
+ <xsd:enumeration value="ShiftedWageTax"/>
+ <xsd:enumeration value="SolidWasteTax"/>
+ <xsd:enumeration value="SpecialConstructionTax"/>
+ <xsd:enumeration value="StadiumTax"/>
+ <xsd:enumeration value="StampDuty-ImpostadiBollo"/>
+ <xsd:enumeration value="StateandLocalSalesTax"/>
+ <xsd:enumeration value="StateAndLocalTax"/>
+ <xsd:enumeration value="StateAndProvincialTax"/>
+ <xsd:enumeration value="StateExciseTax"/>
+ <xsd:enumeration value="StateorProvincialFuelTax"/>
+ <xsd:enumeration value="StateOrProvincialSalesTax"/>
+ <xsd:enumeration value="StateorProvincialTaxOnGoods"/>
+ <xsd:enumeration value="StateorProvincialTaxOnServices"/>
+ <xsd:enumeration value="StateRentalTax"/>
+ <xsd:enumeration value="StateTaxonSpecificLabor"/>
+ <xsd:enumeration value="SuperfundTax"/>
+ <xsd:enumeration value="SurTax"/>
+ <xsd:enumeration value="SuspendedDuty"/>
+ <xsd:enumeration value="TelecommunicationsDeviceForTheDeafServiceExciseTax"/>
+ <xsd:enumeration value="TelecommunicationsTax"/>
+ <xsd:enumeration value="ThresholdTax"/>
+ <xsd:enumeration value="TobaccoTax"/>
+ <xsd:enumeration value="TonnageTaxes"/>
+ <xsd:enumeration value="Total"/>
+ <xsd:enumeration value="TourismTax"/>
+ <xsd:enumeration value="TransitTax"/>
+ <xsd:enumeration value="TurnOverTax"/>
+ <xsd:enumeration value="UnemploymentTax"/>
+ <xsd:enumeration value="UseTax"/>
+ <xsd:enumeration value="UtilityUsersTax"/>
+ <xsd:enumeration value="ValuationDeposit"/>
+ <xsd:enumeration value="ValueAddedTax"/>
+ <xsd:enumeration value="WellService"/>
+ <xsd:enumeration value="WithholdingTax"/>
+ <xsd:enumeration value="WorkersCompensationTax"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="Decimal10_4">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="10"/>
+ <xsd:fractionDigits value="4"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TaxPaymentMethodCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Normal"/>
+ <xsd:enumeration value="DirectPay"/>
+ <xsd:enumeration value="SelfAssess"/>
+ <xsd:enumeration value="PayVendor"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Location">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="LocationQualifierCoded" type="LocationQualifierCode"/>
+ <xsd:element minOccurs="0" name="LocationQualifierCodedOther" type="xsd:string"/>
+ <xsd:choice>
+ <xsd:element ref="LocationIdentifier"/>
+ <xsd:element name="ExternalAddressID" type="xsd:string"/>
+ <xsd:element ref="NameAddress"/>
+ </xsd:choice>
+ <xsd:element minOccurs="0" ref="GPSCooridinates"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Location" type="Location"/>
+ <xsd:simpleType name="LocationQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="JurisdictionToReceiveCreditForUniformCommercialCodeFiling"/>
+ <xsd:enumeration value="TransmittingUtility"/>
+ <xsd:enumeration value="Consignor"/>
+ <xsd:enumeration value="CensusScheduleD"/>
+ <xsd:enumeration value="UniformCommercialCodeFilingOffice"/>
+ <xsd:enumeration value="CurrentAddress"/>
+ <xsd:enumeration value="CensusBlockGroup"/>
+ <xsd:enumeration value="HomeAddress"/>
+ <xsd:enumeration value="HomeBaseAddress"/>
+ <xsd:enumeration value="CensusTract"/>
+ <xsd:enumeration value="CensusScheduleK"/>
+ <xsd:enumeration value="LocalAddress"/>
+ <xsd:enumeration value="MailingAddress"/>
+ <xsd:enumeration value="OfficeAddress"/>
+ <xsd:enumeration value="PermanentAddress"/>
+ <xsd:enumeration value="Birthplace"/>
+ <xsd:enumeration value="WorldwideGeographicLocationCode"/>
+ <xsd:enumeration value="NearestCrossStreet"/>
+ <xsd:enumeration value="SecondaryCrossStreet"/>
+ <xsd:enumeration value="Range"/>
+ <xsd:enumeration value="Section"/>
+ <xsd:enumeration value="QuarterSection"/>
+ <xsd:enumeration value="MarkerIdentifierLocation"/>
+ <xsd:enumeration value="Route"/>
+ <xsd:enumeration value="RouteSubdivision"/>
+ <xsd:enumeration value="GridLocation"/>
+ <xsd:enumeration value="Page"/>
+ <xsd:enumeration value="MarkerType"/>
+ <xsd:enumeration value="Latitude-LongitudeSource"/>
+ <xsd:enumeration value="MapSource"/>
+ <xsd:enumeration value="MapReference"/>
+ <xsd:enumeration value="GridSource"/>
+ <xsd:enumeration value="Aliquot"/>
+ <xsd:enumeration value="Block"/>
+ <xsd:enumeration value="District"/>
+ <xsd:enumeration value="DrainholeNumber"/>
+ <xsd:enumeration value="CityBlock"/>
+ <xsd:enumeration value="FootageCallDirection"/>
+ <xsd:enumeration value="LocationDirection"/>
+ <xsd:enumeration value="OuterContinentalLeaseLocation"/>
+ <xsd:enumeration value="Lot"/>
+ <xsd:enumeration value="MapQuadrangle"/>
+ <xsd:enumeration value="PrincipalMeridian"/>
+ <xsd:enumeration value="OuterContinentalShelfArea"/>
+ <xsd:enumeration value="OuterContinentalShelfBlock"/>
+ <xsd:enumeration value="OfficialProtractionDiagram"/>
+ <xsd:enumeration value="QuarterQuarterQuarterSection"/>
+ <xsd:enumeration value="QuarterQuarterSection"/>
+ <xsd:enumeration value="SectionType"/>
+ <xsd:enumeration value="Abstract"/>
+ <xsd:enumeration value="Labor"/>
+ <xsd:enumeration value="League"/>
+ <xsd:enumeration value="Survey"/>
+ <xsd:enumeration value="Tier"/>
+ <xsd:enumeration value="Tract"/>
+ <xsd:enumeration value="UniversalTransverseMercatorQuadrant"/>
+ <xsd:enumeration value="CourseDirection"/>
+ <xsd:enumeration value="Area"/>
+ <xsd:enumeration value="SendersLocationCode"/>
+ <xsd:enumeration value="ReceiversLocationCode"/>
+ <xsd:enumeration value="Office"/>
+ <xsd:enumeration value="AnnualStatementsMailingAddress"/>
+ <xsd:enumeration value="CityandState"/>
+ <xsd:enumeration value="AllPoints"/>
+ <xsd:enumeration value="ArmedServicesLocationDesignation"/>
+ <xsd:enumeration value="Branch"/>
+ <xsd:enumeration value="BusinessEconomicAreaRegionCode"/>
+ <xsd:enumeration value="GovernmentBillofLadingOfficeCode"/>
+ <xsd:enumeration value="PlaceOfBusiness"/>
+ <xsd:enumeration value="GeopoliticalNameCode"/>
+ <xsd:enumeration value="CountryOfOrigin"/>
+ <xsd:enumeration value="ConfirmationMailingAddress"/>
+ <xsd:enumeration value="Country"/>
+ <xsd:enumeration value="CanadianCustomsOfficeCode"/>
+ <xsd:enumeration value="CorrespondenceMailingAddress"/>
+ <xsd:enumeration value="City"/>
+ <xsd:enumeration value="NationalRateBasis"/>
+ <xsd:enumeration value="CountyOrParishAndState"/>
+ <xsd:enumeration value="InTankCar"/>
+ <xsd:enumeration value="CanadianSPLC"/>
+ <xsd:enumeration value="CountyOrParish"/>
+ <xsd:enumeration value="DistributionCenterNumber"/>
+ <xsd:enumeration value="Destination-Shipping"/>
+ <xsd:enumeration value="DeliveryLocation"/>
+ <xsd:enumeration value="DistrictOffice"/>
+ <xsd:enumeration value="Department"/>
+ <xsd:enumeration value="DistrictOfResidence"/>
+ <xsd:enumeration value="DomicileTypeCode"/>
+ <xsd:enumeration value="EventLocation"/>
+ <xsd:enumeration value="EmployerLocation"/>
+ <xsd:enumeration value="Factory"/>
+ <xsd:enumeration value="FreightEqualizationPoint"/>
+ <xsd:enumeration value="ForeignFreightForwarderLocation"/>
+ <xsd:enumeration value="FederalInformationProcessingStandards55-NamedPopulatedPlaces"/>
+ <xsd:enumeration value="U.S.CustomsFacilitiesInformationandResourceManagementSystems"/>
+ <xsd:enumeration value="FreightStationAccountingCode"/>
+ <xsd:enumeration value="ForeignTradeZone"/>
+ <xsd:enumeration value="FreeAlongsideVessel-FreeOnBoardPoint"/>
+ <xsd:enumeration value="FreightStationGeographicLocation"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationLocationQualifier"/>
+ <xsd:enumeration value="IssueLocation"/>
+ <xsd:enumeration value="MilitaryStandardMovementProcedures"/>
+ <xsd:enumeration value="Postal"/>
+ <xsd:enumeration value="InStore"/>
+ <xsd:enumeration value="IntermediateFOBPoint"/>
+ <xsd:enumeration value="PortOfEmbarkation"/>
+ <xsd:enumeration value="GovernmentFurnishedPropertyFOBPoint"/>
+ <xsd:enumeration value="LocalOffice"/>
+ <xsd:enumeration value="Mill"/>
+ <xsd:enumeration value="MetropolitanSamplingAreaRegionCode"/>
+ <xsd:enumeration value="MexicanPostalCode"/>
+ <xsd:enumeration value="CityOrStateFromPoints"/>
+ <xsd:enumeration value="Origin-AfterLoadingOnEquipment"/>
+ <xsd:enumeration value="OtherUnlistedFreeOnBoardPoint"/>
+ <xsd:enumeration value="OpenandPrepayStationListCode"/>
+ <xsd:enumeration value="OtherUnlistedAcceptancePoint"/>
+ <xsd:enumeration value="Origin-ShippingPoint"/>
+ <xsd:enumeration value="OnVessel-FreeOnBoardPoint"/>
+ <xsd:enumeration value="PortofArrival"/>
+ <xsd:enumeration value="PortofDischarge"/>
+ <xsd:enumeration value="PolicyMailingAddress"/>
+ <xsd:enumeration value="ParentsAddress"/>
+ <xsd:enumeration value="Primary"/>
+ <xsd:enumeration value="PriorBusiness"/>
+ <xsd:enumeration value="Plant"/>
+ <xsd:enumeration value="PrincipalServicingOffice"/>
+ <xsd:enumeration value="PoolPoint"/>
+ <xsd:enumeration value="3DigitUSZIP"/>
+ <xsd:enumeration value="4DigitUSZIP"/>
+ <xsd:enumeration value="5DigitUSZIP"/>
+ <xsd:enumeration value="3DigitCanadianPostalCode"/>
+ <xsd:enumeration value="6DigitCanadianPostalCode"/>
+ <xsd:enumeration value="RateAreaCode"/>
+ <xsd:enumeration value="InRailCar"/>
+ <xsd:enumeration value="RegionalEducationServiceAgency"/>
+ <xsd:enumeration value="RegionCode"/>
+ <xsd:enumeration value="Region"/>
+ <xsd:enumeration value="Rural"/>
+ <xsd:enumeration value="StandardCarrierAlphaCode"/>
+ <xsd:enumeration value="RouteAdministrativeMessageTo"/>
+ <xsd:enumeration value="Secondary"/>
+ <xsd:enumeration value="Suburban"/>
+ <xsd:enumeration value="CityOrStateAndPointsWithin"/>
+ <xsd:enumeration value="SchoolDistrict"/>
+ <xsd:enumeration value="Summer"/>
+ <xsd:enumeration value="Storage"/>
+ <xsd:enumeration value="SchoolCampusCode"/>
+ <xsd:enumeration value="US-SPLC"/>
+ <xsd:enumeration value="StoreNumber"/>
+ <xsd:enumeration value="StateOrProvince"/>
+ <xsd:enumeration value="School"/>
+ <xsd:enumeration value="InStorageTank"/>
+ <xsd:enumeration value="SwitchingDistrict"/>
+ <xsd:enumeration value="Tank"/>
+ <xsd:enumeration value="TranscontinentalFreightBureau"/>
+ <xsd:enumeration value="TerminalCargoLocation"/>
+ <xsd:enumeration value="Terminal"/>
+ <xsd:enumeration value="Township"/>
+ <xsd:enumeration value="Temporary"/>
+ <xsd:enumeration value="RailTerritory"/>
+ <xsd:enumeration value="TaxingDistrict"/>
+ <xsd:enumeration value="UnitedNationsLocationCode"/>
+ <xsd:enumeration value="Urban"/>
+ <xsd:enumeration value="BusinessUnit"/>
+ <xsd:enumeration value="Vacation"/>
+ <xsd:enumeration value="Village"/>
+ <xsd:enumeration value="VesselStowageLocation"/>
+ <xsd:enumeration value="Wharf"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Winter"/>
+ <xsd:enumeration value="ZoneCode"/>
+ <xsd:enumeration value="OverseasAndPointLocation"/>
+ <xsd:enumeration value="FinalPortOfDischarge"/>
+ <xsd:enumeration value="CollectChargeLocation"/>
+ <xsd:enumeration value="CustomsOfficeOfManifestOrigin"/>
+ <xsd:enumeration value="CustomsOfficeOfManifestDestination"/>
+ <xsd:enumeration value="ActivityLocation"/>
+ <xsd:enumeration value="OriginRailIntermodalTerminal"/>
+ <xsd:enumeration value="DestinationRailIntermodalTerminal"/>
+ <xsd:enumeration value="FirstOptionalPortOfDischarge"/>
+ <xsd:enumeration value="SecondOptionalPortOfDischarge"/>
+ <xsd:enumeration value="PlaceOfAcceptance"/>
+ <xsd:enumeration value="ReconsolidationPoint"/>
+ <xsd:enumeration value="De-ConsolidationPoint"/>
+ <xsd:enumeration value="PortOfDischarge"/>
+ <xsd:enumeration value="PlaceOfDelivery"/>
+ <xsd:enumeration value="FreightPayableAt"/>
+ <xsd:enumeration value="PortOfEntry"/>
+ <xsd:enumeration value="PortOfExit"/>
+ <xsd:enumeration value="InterimPoint"/>
+ <xsd:enumeration value="BillOfLadingPortOfLoading"/>
+ <xsd:enumeration value="BillOfLadingPortOfDischarge"/>
+ <xsd:enumeration value="PortOfLoading"/>
+ <xsd:enumeration value="Destination"/>
+ <xsd:enumeration value="FinalDestination"/>
+ <xsd:enumeration value="Origin"/>
+ <xsd:enumeration value="DispatchingPool"/>
+ <xsd:enumeration value="BillOfLadingOriginOfGoods"/>
+ <xsd:enumeration value="PlaceOfReceipt"/>
+ <xsd:enumeration value="ReturnPool"/>
+ <xsd:enumeration value="TransshipmentPort"/>
+ <xsd:enumeration value="PrepaidChargeLocation"/>
+ <xsd:enumeration value="BillOfLadingReleaseOffice"/>
+ <xsd:enumeration value="ThirdOptionalPortOfDischarge"/>
+ <xsd:enumeration value="RelayPort"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="LocationIdentifier">
+ <xsd:sequence>
+ <xsd:element name="LocID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="LocationDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="LocationIdentifier" type="LocationIdentifier"/>
+ <xsd:complexType name="GPSCooridinates">
+ <xsd:sequence>
+ <xsd:element name="GPSSystem" type="xsd:string"/>
+ <xsd:element name="Latitude" type="xsd:string"/>
+ <xsd:element name="Longitude" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="GPSCooridinates" type="GPSCooridinates"/>
+ <xsd:complexType name="ListOfAllowOrCharge">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="AllowOrCharge"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfAllowOrCharge" type="ListOfAllowOrCharge"/>
+ <xsd:complexType name="AllowOrCharge">
+ <xsd:sequence>
+ <xsd:element name="IndicatorCoded" type="IndicatorCode"/>
+ <xsd:element minOccurs="0" name="IndicatorCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="BasisCoded" type="BasisCode"/>
+ <xsd:element minOccurs="0" name="BasisCodedOther" type="xsd:string"/>
+ <xsd:element name="MethodOfHandlingCoded" type="MethodOfHandlingCode"/>
+ <xsd:element minOccurs="0" name="MethodOfHandlingCodedOther" type="xsd:string"/>
+ <xsd:element name="AllowanceOrChargeDescription">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="AllowOrChgDesc"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ValidityDates"/>
+ <xsd:choice minOccurs="0">
+ <xsd:element name="BasisQuantityRange">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="BasisMonetaryRange"/>
+ </xsd:choice>
+ <xsd:element ref="TypeOfAllowanceOrCharge"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Tax"/>
+ </xsd:sequence>
+ <xsd:attribute name="SeqNo" type="xsd:int" use="optional" default="1"/>
+ </xsd:complexType>
+ <xsd:element name="AllowOrCharge" type="AllowOrCharge"/>
+ <xsd:simpleType name="IndicatorCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="About"/>
+ <xsd:enumeration value="Adjustment"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllowanceLineItems"/>
+ <xsd:enumeration value="AllowanceMessage"/>
+ <xsd:enumeration value="AllowancePerCallOf"/>
+ <xsd:enumeration value="AllowanceRequest"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeLineItems"/>
+ <xsd:enumeration value="ChargeMessage"/>
+ <xsd:enumeration value="ChargePerCallOf"/>
+ <xsd:enumeration value="ChargeRequest"/>
+ <xsd:enumeration value="Exact"/>
+ <xsd:enumeration value="LineItemAllowance"/>
+ <xsd:enumeration value="LineItemCharge"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="Minus-Amount"/>
+ <xsd:enumeration value="Minus-Percentage"/>
+ <xsd:enumeration value="NoAllowance"/>
+ <xsd:enumeration value="NoAllowanceOrCharge"/>
+ <xsd:enumeration value="NoCharge"/>
+ <xsd:enumeration value="Plus-Amount"/>
+ <xsd:enumeration value="Plus-Percentage"/>
+ <xsd:enumeration value="PlusOrMinusOrAmount"/>
+ <xsd:enumeration value="PlusOrMinus-Percentage"/>
+ <xsd:enumeration value="Promotion"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="TotalOther"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="BasisCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="None"/>
+ <xsd:enumeration value="Quantity"/>
+ <xsd:enumeration value="Percent"/>
+ <xsd:enumeration value="MonetaryAmount"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="MethodOfHandlingCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BillBack"/>
+ <xsd:enumeration value="OffInvoice"/>
+ <xsd:enumeration value="VendorCheckToCustomer"/>
+ <xsd:enumeration value="CreditCustomerAccount"/>
+ <xsd:enumeration value="ChargeToBePaidByVendor"/>
+ <xsd:enumeration value="ChargeToBePaidByCustomer"/>
+ <xsd:enumeration value="Optional"/>
+ <xsd:enumeration value="OffGrossQuantityInvoiced"/>
+ <xsd:enumeration value="AllowanceToBeIssuedByVendor"/>
+ <xsd:enumeration value="AllowanceToBeIssuedByReseller"/>
+ <xsd:enumeration value="ChargeDeniedByVendor"/>
+ <xsd:enumeration value="CancelAllowance"/>
+ <xsd:enumeration value="ProvideAmount"/>
+ <xsd:enumeration value="InformationOnly"/>
+ <xsd:enumeration value="Non-PayableTax"/>
+ <xsd:enumeration value="AccrualFund"/>
+ <xsd:enumeration value="FlatFund"/>
+ <xsd:enumeration value="CashInAdvance"/>
+ <xsd:enumeration value="CalculateAndAddtoInvoice"/>
+ <xsd:enumeration value="Collect"/>
+ <xsd:enumeration value="Prepaid"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="AllowOrChgDesc">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="RefID" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfDescription"/>
+ <xsd:element name="ServiceCoded" type="ServiceCode"/>
+ <xsd:element minOccurs="0" name="ServiceCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AllowOrChgDesc" type="AllowOrChgDesc"/>
+ <xsd:complexType name="ListOfDescription">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Description"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDescription" type="ListOfDescription"/>
+ <xsd:complexType name="Description">
+ <xsd:sequence>
+ <xsd:element name="DescriptionText" type="xsd:string"/>
+ <xsd:element ref="Language"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Description" type="Description"/>
+ <xsd:simpleType name="ServiceCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="About"/>
+ <xsd:enumeration value="AbsoluteMinimumCharge"/>
+ <xsd:enumeration value="AccessCharge-Federal"/>
+ <xsd:enumeration value="AccessCharges"/>
+ <xsd:enumeration value="AccessCharge-State"/>
+ <xsd:enumeration value="AccountNumberCorrectionCharge"/>
+ <xsd:enumeration value="AcidBattery"/>
+ <xsd:enumeration value="AcknowledgmentofDeliveryFeeAOD"/>
+ <xsd:enumeration value="ActivationOfCarnet"/>
+ <xsd:enumeration value="AdditionalCommercialInvoices"/>
+ <xsd:enumeration value="AdditionalCopiesOfFreightBill"/>
+ <xsd:enumeration value="AdditionalMaterial"/>
+ <xsd:enumeration value="AdditionalTariffClassifications"/>
+ <xsd:enumeration value="AddOn-Destination"/>
+ <xsd:enumeration value="AddOn-Origin"/>
+ <xsd:enumeration value="AddressCorrection"/>
+ <xsd:enumeration value="AddToMakeMarketValue"/>
+ <xsd:enumeration value="Adjustment"/>
+ <xsd:enumeration value="AdjustmentForMaximumChargesBilling"/>
+ <xsd:enumeration value="AdjustmentForMinimumAverageTimeRequirementBilling"/>
+ <xsd:enumeration value="Adjustments"/>
+ <xsd:enumeration value="Administrative"/>
+ <xsd:enumeration value="AdValorem"/>
+ <xsd:enumeration value="AdvanceChargesHandling"/>
+ <xsd:enumeration value="AdvanceDestinationAmount"/>
+ <xsd:enumeration value="AdvanceDestinationFee"/>
+ <xsd:enumeration value="AdvanceFee"/>
+ <xsd:enumeration value="AdvanceLadingCharge"/>
+ <xsd:enumeration value="AdvanceOriginAmount"/>
+ <xsd:enumeration value="AdvanceOriginFee"/>
+ <xsd:enumeration value="Advances"/>
+ <xsd:enumeration value="AdvertisingAllowance"/>
+ <xsd:enumeration value="Affidavit"/>
+ <xsd:enumeration value="AgentDisbursement-Destination"/>
+ <xsd:enumeration value="AgentDisbursement-Origin"/>
+ <xsd:enumeration value="AircraftOnGround"/>
+ <xsd:enumeration value="AirExportCertificate"/>
+ <xsd:enumeration value="AirExpressCharge"/>
+ <xsd:enumeration value="AirlineOpeningFee"/>
+ <xsd:enumeration value="AirportTerminalHandlingCharge"/>
+ <xsd:enumeration value="AirTransportationCharge"/>
+ <xsd:enumeration value="AlcoholicBeverageReportCharge"/>
+ <xsd:enumeration value="AlleghenyCountyPADeliveryCharge"/>
+ <xsd:enumeration value="Allowance"/>
+ <xsd:enumeration value="AllowanceLineItems"/>
+ <xsd:enumeration value="AllowanceMessage"/>
+ <xsd:enumeration value="AllowancePerCallOf"/>
+ <xsd:enumeration value="AllowanceAdvance"/>
+ <xsd:enumeration value="AllowanceForConsignmentMerchandise"/>
+ <xsd:enumeration value="AllowanceNon-Performance"/>
+ <xsd:enumeration value="AllowanceRequest"/>
+ <xsd:enumeration value="Alterations"/>
+ <xsd:enumeration value="AmendingExportDocumentation"/>
+ <xsd:enumeration value="AnnealHeatSteelorGlassTreatment"/>
+ <xsd:enumeration value="AnodizingCharge"/>
+ <xsd:enumeration value="Anti-dumpingDuty"/>
+ <xsd:enumeration value="AppointmentNotification"/>
+ <xsd:enumeration value="ArbitraryInAdditionToThroughRatesandCharges"/>
+ <xsd:enumeration value="ArtWork"/>
+ <xsd:enumeration value="Assembly"/>
+ <xsd:enumeration value="AssistAmount"/>
+ <xsd:enumeration value="AttachmentsToBillOfLadingCharge"/>
+ <xsd:enumeration value="BadDebt"/>
+ <xsd:enumeration value="BankingDrafts"/>
+ <xsd:enumeration value="BargeFreightAllKindsService"/>
+ <xsd:enumeration value="BaseCharge"/>
+ <xsd:enumeration value="BasicReorderAllowance"/>
+ <xsd:enumeration value="BeamingCharge"/>
+ <xsd:enumeration value="BeddingFeedingDisinfecting"/>
+ <xsd:enumeration value="BeefFee"/>
+ <xsd:enumeration value="BeyondCharge"/>
+ <xsd:enumeration value="BeyondFreightCharges"/>
+ <xsd:enumeration value="BillAndHold"/>
+ <xsd:enumeration value="BilledDemand"/>
+ <xsd:enumeration value="BillOfLadingAttendancy"/>
+ <xsd:enumeration value="BillOfLadingCharge"/>
+ <xsd:enumeration value="BlackLungTax"/>
+ <xsd:enumeration value="BlockingAndBracingCharge"/>
+ <xsd:enumeration value="BlowerCharge"/>
+ <xsd:enumeration value="BobtailCharges"/>
+ <xsd:enumeration value="BondAmount"/>
+ <xsd:enumeration value="BondCharge"/>
+ <xsd:enumeration value="BopSheet"/>
+ <xsd:enumeration value="BordeauxArbitraries"/>
+ <xsd:enumeration value="Both-Flat"/>
+ <xsd:enumeration value="BreakbulkServices"/>
+ <xsd:enumeration value="BreakBulkSurfaceCharge"/>
+ <xsd:enumeration value="BridgeToll"/>
+ <xsd:enumeration value="BrokenLot"/>
+ <xsd:enumeration value="BrokenPackageCharge"/>
+ <xsd:enumeration value="Brokerage"/>
+ <xsd:enumeration value="BrokerageOrDuty"/>
+ <xsd:enumeration value="BunkerAdjustment"/>
+ <xsd:enumeration value="BunkerAdjustment-20FootContainer"/>
+ <xsd:enumeration value="BunkerAdjustment-40FootContainer"/>
+ <xsd:enumeration value="BunkerSurcharge"/>
+ <xsd:enumeration value="BurdenOverheadOrAllowanceForIndirectCosts"/>
+ <xsd:enumeration value="Burning"/>
+ <xsd:enumeration value="BuyerHandCarry"/>
+ <xsd:enumeration value="BuyersCarAllowance"/>
+ <xsd:enumeration value="CablePressurization"/>
+ <xsd:enumeration value="CablesSendingOf"/>
+ <xsd:enumeration value="CallTag"/>
+ <xsd:enumeration value="CampArbitrary"/>
+ <xsd:enumeration value="CanadaGreatLakesAdditionals"/>
+ <xsd:enumeration value="CanadianCQCustomsClearance"/>
+ <xsd:enumeration value="CanadianCurrencyExchange"/>
+ <xsd:enumeration value="CanadianImportTerminationFee"/>
+ <xsd:enumeration value="CanadianReconsignmentFee"/>
+ <xsd:enumeration value="CanadianRemanifestFee"/>
+ <xsd:enumeration value="CancellationCharge"/>
+ <xsd:enumeration value="CancelledOrderHeavyDutyFlatcar"/>
+ <xsd:enumeration value="Capping"/>
+ <xsd:enumeration value="CaptureAdditionalData"/>
+ <xsd:enumeration value="CargoTaxes"/>
+ <xsd:enumeration value="CarLoading"/>
+ <xsd:enumeration value="CarRental"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="CarrierCreditAllowance"/>
+ <xsd:enumeration value="CarrierDebitAllowance"/>
+ <xsd:enumeration value="CarrierNotificationCharge"/>
+ <xsd:enumeration value="Cartage"/>
+ <xsd:enumeration value="CartageCharge"/>
+ <xsd:enumeration value="CatalogingServices"/>
+ <xsd:enumeration value="CentralBuy"/>
+ <xsd:enumeration value="CentsOff"/>
+ <xsd:enumeration value="CertificateOfConformance"/>
+ <xsd:enumeration value="CertificateOfOrigin"/>
+ <xsd:enumeration value="CertificateOfRegistration"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="ChainAndBinders"/>
+ <xsd:enumeration value="ChamberOfCommerceServiceCharge"/>
+ <xsd:enumeration value="ChangeOfAirbill-ServiceFee"/>
+ <xsd:enumeration value="Charge"/>
+ <xsd:enumeration value="ChargeLineItems"/>
+ <xsd:enumeration value="ChargeMessage"/>
+ <xsd:enumeration value="ChargePerCallOf"/>
+ <xsd:enumeration value="ChargesForwardAdvanceCharge"/>
+ <xsd:enumeration value="CharterServices"/>
+ <xsd:enumeration value="ChassisTransfer"/>
+ <xsd:enumeration value="ChemicalMillingCharge"/>
+ <xsd:enumeration value="ChicagoLoopCharge"/>
+ <xsd:enumeration value="CigaretteStamping"/>
+ <xsd:enumeration value="CityDelivery"/>
+ <xsd:enumeration value="CityMaintenanceFee"/>
+ <xsd:enumeration value="CityPick-up"/>
+ <xsd:enumeration value="CityTerminalCharge"/>
+ <xsd:enumeration value="CleaningCharge"/>
+ <xsd:enumeration value="ClosingSealing"/>
+ <xsd:enumeration value="CoatingDipRustproofEDP"/>
+ <xsd:enumeration value="CODAmount"/>
+ <xsd:enumeration value="CODCharges"/>
+ <xsd:enumeration value="CollectOnDeliveryAlterationCharge"/>
+ <xsd:enumeration value="CollectOnDeliveryDeletionCharge"/>
+ <xsd:enumeration value="CollectSurcharge"/>
+ <xsd:enumeration value="Co-manufacturingDiscount"/>
+ <xsd:enumeration value="Combination"/>
+ <xsd:enumeration value="CombinationPerformanceAndNon-performance"/>
+ <xsd:enumeration value="CombineAllSameDayShipment"/>
+ <xsd:enumeration value="CommissionAmount"/>
+ <xsd:enumeration value="CommunicationsCharges"/>
+ <xsd:enumeration value="CompetitiveAllowance"/>
+ <xsd:enumeration value="CompetitiveCarAllowance"/>
+ <xsd:enumeration value="CompetitivePrice"/>
+ <xsd:enumeration value="CompressorCharge"/>
+ <xsd:enumeration value="ConcessionCredit"/>
+ <xsd:enumeration value="ConcessionMoney"/>
+ <xsd:enumeration value="CongestionSurcharge"/>
+ <xsd:enumeration value="ConnectCharge"/>
+ <xsd:enumeration value="ConservationResearchFee"/>
+ <xsd:enumeration value="ConsigneeUnload"/>
+ <xsd:enumeration value="Consolidation"/>
+ <xsd:enumeration value="ConstantSurveillanceService"/>
+ <xsd:enumeration value="ConstantSurveillanceService-Armed"/>
+ <xsd:enumeration value="ConsularizationFee"/>
+ <xsd:enumeration value="ConsularLegalizationService"/>
+ <xsd:enumeration value="ConsultingService"/>
+ <xsd:enumeration value="ConsumerServiceProviderCharge"/>
+ <xsd:enumeration value="ContainerAllowance"/>
+ <xsd:enumeration value="ContainerDeposits"/>
+ <xsd:enumeration value="ContainerDestuffing"/>
+ <xsd:enumeration value="ContainerDiscount"/>
+ <xsd:enumeration value="ContainerDiversion"/>
+ <xsd:enumeration value="ContainerLease"/>
+ <xsd:enumeration value="ContainerLeasing"/>
+ <xsd:enumeration value="ContainerLossDamage"/>
+ <xsd:enumeration value="ContainerServiceChargeUKEUR"/>
+ <xsd:enumeration value="ContainerServiceChargeUSACanada"/>
+ <xsd:enumeration value="ContainerStuffing"/>
+ <xsd:enumeration value="ContainerTrailerAllowance"/>
+ <xsd:enumeration value="ContinuousMileage"/>
+ <xsd:enumeration value="ContractAllowance"/>
+ <xsd:enumeration value="ContractEscalation"/>
+ <xsd:enumeration value="ContractServiceCharge"/>
+ <xsd:enumeration value="ControlledAtmosphere"/>
+ <xsd:enumeration value="Converting"/>
+ <xsd:enumeration value="Co-opCredit"/>
+ <xsd:enumeration value="CooperativeAdvertisingMerchandisingAllowancePerformance"/>
+ <xsd:enumeration value="Copying"/>
+ <xsd:enumeration value="CopyOfBillOfLadingCharge"/>
+ <xsd:enumeration value="CopyOfDeliveryReceiptCharge"/>
+ <xsd:enumeration value="CoreCharge"/>
+ <xsd:enumeration value="CostRecoveryAdjustment"/>
+ <xsd:enumeration value="CostRecoveryFactor"/>
+ <xsd:enumeration value="CottonFee"/>
+ <xsd:enumeration value="CountAndRecount"/>
+ <xsd:enumeration value="CountervailingDuty"/>
+ <xsd:enumeration value="CouponReimbursement"/>
+ <xsd:enumeration value="Crafting"/>
+ <xsd:enumeration value="Crating"/>
+ <xsd:enumeration value="Credit"/>
+ <xsd:enumeration value="CurrencyAdjustment"/>
+ <xsd:enumeration value="CurrencyAdjustment-20FootContainer"/>
+ <xsd:enumeration value="CurrencyAdjustment-40FootContainer"/>
+ <xsd:enumeration value="CurrencyAdjustment-BreakBulk"/>
+ <xsd:enumeration value="CurrencyAdjustmentFactor"/>
+ <xsd:enumeration value="CurrencyDiscount"/>
+ <xsd:enumeration value="CustomerAccountIdentification"/>
+ <xsd:enumeration value="CustomerEquipmentAllowance"/>
+ <xsd:enumeration value="CustomsBrokerFee"/>
+ <xsd:enumeration value="CustomsCharge"/>
+ <xsd:enumeration value="CustomsDuty"/>
+ <xsd:enumeration value="CustomsEntry"/>
+ <xsd:enumeration value="CustomsExam"/>
+ <xsd:enumeration value="CustomsFees-ContainerLevel"/>
+ <xsd:enumeration value="CustomsFees-LiftLevel"/>
+ <xsd:enumeration value="CustomsFormalities"/>
+ <xsd:enumeration value="CustomsInvoice"/>
+ <xsd:enumeration value="CustomsInvoice-AdditionalPage"/>
+ <xsd:enumeration value="CustomsPenalty"/>
+ <xsd:enumeration value="Cut"/>
+ <xsd:enumeration value="CutAndParallel"/>
+ <xsd:enumeration value="CuttingCharge"/>
+ <xsd:enumeration value="DamagedMerchandise"/>
+ <xsd:enumeration value="DamageToCarrierEquipment"/>
+ <xsd:enumeration value="DamageToCarrierVessel"/>
+ <xsd:enumeration value="DamageToGovernmentEquipment"/>
+ <xsd:enumeration value="DataDrawingCharge"/>
+ <xsd:enumeration value="DeadheadMileageCharge"/>
+ <xsd:enumeration value="DeafAndDisabledSurcharge"/>
+ <xsd:enumeration value="DeclaredValueForCarriage"/>
+ <xsd:enumeration value="DeclaredValueForCustoms"/>
+ <xsd:enumeration value="DeclaredValueForInsurance"/>
+ <xsd:enumeration value="DeductToMakeMarketValue"/>
+ <xsd:enumeration value="DefectiveAllowance"/>
+ <xsd:enumeration value="DeficitFreight"/>
+ <xsd:enumeration value="De-Installation"/>
+ <xsd:enumeration value="DelayFurnishingDestinationWeights"/>
+ <xsd:enumeration value="Delivery"/>
+ <xsd:enumeration value="DeliverySurcharge"/>
+ <xsd:enumeration value="DemandCharge"/>
+ <xsd:enumeration value="Demurrage"/>
+ <xsd:enumeration value="Demurrage-AverageAgreement"/>
+ <xsd:enumeration value="Demurrage-Special"/>
+ <xsd:enumeration value="Deposit"/>
+ <xsd:enumeration value="DepositCharges"/>
+ <xsd:enumeration value="DepositInLieuOfOrder"/>
+ <xsd:enumeration value="Deramping"/>
+ <xsd:enumeration value="DerrickCharge"/>
+ <xsd:enumeration value="DesignatedSupplierInspection"/>
+ <xsd:enumeration value="DestinationCharge"/>
+ <xsd:enumeration value="DetentionLoading"/>
+ <xsd:enumeration value="DetentionOfPowerUnits"/>
+ <xsd:enumeration value="DetentionOfTrailers"/>
+ <xsd:enumeration value="Detention-SpecialTypeFlatCar"/>
+ <xsd:enumeration value="DetentionUnloading"/>
+ <xsd:enumeration value="DeterminedFreight"/>
+ <xsd:enumeration value="DevelopmentCharge"/>
+ <xsd:enumeration value="DieServiceCharge"/>
+ <xsd:enumeration value="DirectProductHandling"/>
+ <xsd:enumeration value="Disbursement"/>
+ <xsd:enumeration value="DisconnectCharge"/>
+ <xsd:enumeration value="Discount"/>
+ <xsd:enumeration value="Discount-DropBoxConvenienceCtr"/>
+ <xsd:enumeration value="Discount-Incentive"/>
+ <xsd:enumeration value="Discount-MultipleShipment"/>
+ <xsd:enumeration value="Discount-ServiceOptionDelivery"/>
+ <xsd:enumeration value="Discount-ServiceOptionPickup"/>
+ <xsd:enumeration value="Discount-Special"/>
+ <xsd:enumeration value="DisplayAllowance"/>
+ <xsd:enumeration value="DistributionFee"/>
+ <xsd:enumeration value="DistributionService"/>
+ <xsd:enumeration value="DistributorDiscountAllowance"/>
+ <xsd:enumeration value="DiversionAndReconsignment"/>
+ <xsd:enumeration value="DiversionCharge"/>
+ <xsd:enumeration value="DiversionToAirCharge"/>
+ <xsd:enumeration value="Dockage-BoatDetention"/>
+ <xsd:enumeration value="DocumentationCharge"/>
+ <xsd:enumeration value="DocumentHandling"/>
+ <xsd:enumeration value="Door-To-Door"/>
+ <xsd:enumeration value="DowelPinCharge"/>
+ <xsd:enumeration value="DrayagAtPortOfDebarkation"/>
+ <xsd:enumeration value="Drayage"/>
+ <xsd:enumeration value="DrayageatPortOfDebarkationRateZone"/>
+ <xsd:enumeration value="DrayageAtPortOfEmbarkation"/>
+ <xsd:enumeration value="DrayageatPortOfEmbarkationRateZone"/>
+ <xsd:enumeration value="DrayageLineHaul"/>
+ <xsd:enumeration value="DriverAssistedUnloading"/>
+ <xsd:enumeration value="DriversWages"/>
+ <xsd:enumeration value="DropDock"/>
+ <xsd:enumeration value="DropYard"/>
+ <xsd:enumeration value="DrumCost"/>
+ <xsd:enumeration value="DrumDeposit"/>
+ <xsd:enumeration value="DrumUpCharge"/>
+ <xsd:enumeration value="DryerCharge"/>
+ <xsd:enumeration value="DryIce"/>
+ <xsd:enumeration value="Dunnage"/>
+ <xsd:enumeration value="DutyCharge"/>
+ <xsd:enumeration value="DutyDrawback"/>
+ <xsd:enumeration value="EarlyBuyAllowance"/>
+ <xsd:enumeration value="EarlyPaymentAllowance"/>
+ <xsd:enumeration value="EarlyShipAllowance"/>
+ <xsd:enumeration value="EmergencyPortCharge"/>
+ <xsd:enumeration value="EmergencyService"/>
+ <xsd:enumeration value="EmergencySurcharge"/>
+ <xsd:enumeration value="EmptyWeighingCharge"/>
+ <xsd:enumeration value="Enclosure"/>
+ <xsd:enumeration value="EndorsementFee"/>
+ <xsd:enumeration value="Energycharge"/>
+ <xsd:enumeration value="EnergySurchargeFuelAdjustmentFactor"/>
+ <xsd:enumeration value="EngineeringCharge"/>
+ <xsd:enumeration value="EngineeringSupplies"/>
+ <xsd:enumeration value="Engraving"/>
+ <xsd:enumeration value="EnteredValue"/>
+ <xsd:enumeration value="EnvironmentalProtectionService"/>
+ <xsd:enumeration value="EquipmentManufacturerRestorationAudit"/>
+ <xsd:enumeration value="Escalation"/>
+ <xsd:enumeration value="EscortService"/>
+ <xsd:enumeration value="Escrow"/>
+ <xsd:enumeration value="Eur1PresentationFee"/>
+ <xsd:enumeration value="EuropeanPortCharges"/>
+ <xsd:enumeration value="Exact"/>
+ <xsd:enumeration value="ExcessiveValueCharge"/>
+ <xsd:enumeration value="ExcessMileageCharge"/>
+ <xsd:enumeration value="ExcessPeriods"/>
+ <xsd:enumeration value="ExcessValueFee"/>
+ <xsd:enumeration value="ExcessWeight"/>
+ <xsd:enumeration value="ExchangeAccessCredit"/>
+ <xsd:enumeration value="ExclusiveUse"/>
+ <xsd:enumeration value="ExclusiveUseOfEquipment"/>
+ <xsd:enumeration value="ExhibitionDeliveryCharge"/>
+ <xsd:enumeration value="ExhibitionPickupCharge"/>
+ <xsd:enumeration value="ExpandedService"/>
+ <xsd:enumeration value="ExpeditedOneDayConsularService"/>
+ <xsd:enumeration value="ExpeditedServiceCharge"/>
+ <xsd:enumeration value="ExpeditedShipments"/>
+ <xsd:enumeration value="ExpeditingFee"/>
+ <xsd:enumeration value="ExpeditingPremium"/>
+ <xsd:enumeration value="ExportCustomsClearance"/>
+ <xsd:enumeration value="ExportDeclarations-Automated"/>
+ <xsd:enumeration value="ExportDeclarations-USShippers"/>
+ <xsd:enumeration value="ExportImportCharge"/>
+ <xsd:enumeration value="ExportLicenseApplication"/>
+ <xsd:enumeration value="ExportShippingCharge"/>
+ <xsd:enumeration value="ExtraCopiesandMailings"/>
+ <xsd:enumeration value="ExtraLaborHelperService"/>
+ <xsd:enumeration value="ExtraLength"/>
+ <xsd:enumeration value="ExtraLengthSurcharge"/>
+ <xsd:enumeration value="ExtraService-Counter-To-Counter"/>
+ <xsd:enumeration value="FabricationCharge"/>
+ <xsd:enumeration value="FacsimileCharges"/>
+ <xsd:enumeration value="FacsimileCharges-AdditionalPages"/>
+ <xsd:enumeration value="FailedLampPanelCharge"/>
+ <xsd:enumeration value="FaxPre-alert"/>
+ <xsd:enumeration value="FederalTransferSurcharge"/>
+ <xsd:enumeration value="Fee"/>
+ <xsd:enumeration value="FinanceCharge"/>
+ <xsd:enumeration value="FirstArticleCharge"/>
+ <xsd:enumeration value="FirstFlightOut"/>
+ <xsd:enumeration value="FlatrackSurcharge"/>
+ <xsd:enumeration value="FlatRate"/>
+ <xsd:enumeration value="FloorStockProtection"/>
+ <xsd:enumeration value="FoodAndLodging"/>
+ <xsd:enumeration value="ForeignCustomsDuty"/>
+ <xsd:enumeration value="ForeignMilitarySalesRental"/>
+ <xsd:enumeration value="ForeignMilitarySalesSpecialCharge"/>
+ <xsd:enumeration value="ForeignOfficeAdvance"/>
+ <xsd:enumeration value="ForwardCoupons"/>
+ <xsd:enumeration value="ForwardingAgentCommission"/>
+ <xsd:enumeration value="ForwardingCharge"/>
+ <xsd:enumeration value="FranchiseFee"/>
+ <xsd:enumeration value="FreeDomicileShipmentProcessing"/>
+ <xsd:enumeration value="FreeGoods"/>
+ <xsd:enumeration value="Freight"/>
+ <xsd:enumeration value="FreightBasedOnDollarMinimum"/>
+ <xsd:enumeration value="FreightChargesToBorder"/>
+ <xsd:enumeration value="FreightChargesToDestination"/>
+ <xsd:enumeration value="FreightEqualization"/>
+ <xsd:enumeration value="FreightInternational"/>
+ <xsd:enumeration value="FreightInternationalNon-USDollars"/>
+ <xsd:enumeration value="FreightInternationalUSDollars"/>
+ <xsd:enumeration value="FreightPassthrough"/>
+ <xsd:enumeration value="FreightSurcharge"/>
+ <xsd:enumeration value="FreshnessLeakerAllowance"/>
+ <xsd:enumeration value="FuelCharge"/>
+ <xsd:enumeration value="FuelSurcharge"/>
+ <xsd:enumeration value="FullService"/>
+ <xsd:enumeration value="FullTruckloadAllowance"/>
+ <xsd:enumeration value="Fumigation"/>
+ <xsd:enumeration value="GarmentDistrict"/>
+ <xsd:enumeration value="GarmentSurcharge"/>
+ <xsd:enumeration value="GasPressure"/>
+ <xsd:enumeration value="GatewayFee"/>
+ <xsd:enumeration value="Glaze"/>
+ <xsd:enumeration value="GoldFactor"/>
+ <xsd:enumeration value="GoodsAndServicesCharge"/>
+ <xsd:enumeration value="GoodsAndServicesCreditAllowance"/>
+ <xsd:enumeration value="GoodsAndServicesTaxCharge"/>
+ <xsd:enumeration value="GovernmentInspection"/>
+ <xsd:enumeration value="GovernmentWarehouseFee-Destination"/>
+ <xsd:enumeration value="GovernmentWarehouseFee-Origin"/>
+ <xsd:enumeration value="GrainDoors"/>
+ <xsd:enumeration value="GrainFlowCharge"/>
+ <xsd:enumeration value="Gratuity"/>
+ <xsd:enumeration value="Grinding"/>
+ <xsd:enumeration value="GrossReceiptsSurcharge"/>
+ <xsd:enumeration value="GroupageDiscount"/>
+ <xsd:enumeration value="GroupedItems"/>
+ <xsd:enumeration value="GuaranteedInspectionTechnicalService"/>
+ <xsd:enumeration value="GulfPortDeliveryCharge"/>
+ <xsd:enumeration value="Handling"/>
+ <xsd:enumeration value="HandlingChargesOnDistributionFreightForwardedBeyond"/>
+ <xsd:enumeration value="HandlingFreightAtPositionsNotImmediatelyAdjacentToVehicleCharge"/>
+ <xsd:enumeration value="HarborMaintenanceFee"/>
+ <xsd:enumeration value="HarborMaintenanceReport"/>
+ <xsd:enumeration value="HaulingAndHoisting"/>
+ <xsd:enumeration value="HaulingAndHoistingToBeDirectBilled"/>
+ <xsd:enumeration value="HazardousCargoCharge"/>
+ <xsd:enumeration value="HazardousCargoOnDeck"/>
+ <xsd:enumeration value="HazardousMaterialsHandlingFee-Domestic"/>
+ <xsd:enumeration value="HazardousMaterialsHandlingFee-International"/>
+ <xsd:enumeration value="HazardousStorage"/>
+ <xsd:enumeration value="HeatInTransitCharges"/>
+ <xsd:enumeration value="HeatTreatCharge"/>
+ <xsd:enumeration value="HeavyDutyFlatCarCharge"/>
+ <xsd:enumeration value="HeavyLift"/>
+ <xsd:enumeration value="HighSecurityRedIn-bondSealCharge"/>
+ <xsd:enumeration value="HighwayInterchange"/>
+ <xsd:enumeration value="HointinsAndHauling"/>
+ <xsd:enumeration value="HoldingCharge"/>
+ <xsd:enumeration value="HomeLineFreightCharge"/>
+ <xsd:enumeration value="HoneyFee"/>
+ <xsd:enumeration value="Hook-upcharge"/>
+ <xsd:enumeration value="HoseCharge"/>
+ <xsd:enumeration value="HoseChargeSpecial"/>
+ <xsd:enumeration value="HouseholdGoodsPick-upOrDelivery"/>
+ <xsd:enumeration value="IATAAirbillPreparation"/>
+ <xsd:enumeration value="IATAFee"/>
+ <xsd:enumeration value="Identification"/>
+ <xsd:enumeration value="ImportServiceFee"/>
+ <xsd:enumeration value="ImproperDocumentation"/>
+ <xsd:enumeration value="InboundFreightCharges"/>
+ <xsd:enumeration value="IncomeFreightManufacturingToShippingPoint"/>
+ <xsd:enumeration value="IncorrectBillingAccountCharge"/>
+ <xsd:enumeration value="IndustryPriceAllowance"/>
+ <xsd:enumeration value="InitialLicenseFee"/>
+ <xsd:enumeration value="InlandTransportation"/>
+ <xsd:enumeration value="InsideCableConnectors"/>
+ <xsd:enumeration value="InsideDelivery"/>
+ <xsd:enumeration value="InsidePick-up"/>
+ <xsd:enumeration value="InspectAtDestination"/>
+ <xsd:enumeration value="InspectAtOrigin"/>
+ <xsd:enumeration value="Inspection"/>
+ <xsd:enumeration value="Installation"/>
+ <xsd:enumeration value="InstallationAndTraining"/>
+ <xsd:enumeration value="InstallationWarranty"/>
+ <xsd:enumeration value="InsulatedTankCharge"/>
+ <xsd:enumeration value="Insurance"/>
+ <xsd:enumeration value="InsuranceFee"/>
+ <xsd:enumeration value="InsurancePlacementCostCharge"/>
+ <xsd:enumeration value="InsurancePremium"/>
+ <xsd:enumeration value="InsuranceProvidedByLessee"/>
+ <xsd:enumeration value="InsuranceProvidedByLessor"/>
+ <xsd:enumeration value="InsuranceSurcharge"/>
+ <xsd:enumeration value="InterdivisionProfit"/>
+ <xsd:enumeration value="InterestAmount"/>
+ <xsd:enumeration value="InterestOnRefund"/>
+ <xsd:enumeration value="InterestOnSecurityDeposit"/>
+ <xsd:enumeration value="InterimUsePermittedAtSpecialRate"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationCommission"/>
+ <xsd:enumeration value="InternationalAirTransportAssociationMarkup"/>
+ <xsd:enumeration value="InternationalCourier"/>
+ <xsd:enumeration value="InternationalDoor-to-DoorHandlingFee"/>
+ <xsd:enumeration value="InterplantCharge"/>
+ <xsd:enumeration value="InterstateHighwayToll"/>
+ <xsd:enumeration value="InTransitPriceProtection"/>
+ <xsd:enumeration value="Intra-plantCharge"/>
+ <xsd:enumeration value="InvoiceAdditionalAmount"/>
+ <xsd:enumeration value="InvoiceAdjustment"/>
+ <xsd:enumeration value="InvoiceAt-CostAmount"/>
+ <xsd:enumeration value="InvoiceDeliveryTermsAmount"/>
+ <xsd:enumeration value="InvoiceNo-ChargeAmount"/>
+ <xsd:enumeration value="InvoiceServices"/>
+ <xsd:enumeration value="InvoiceWithGoods"/>
+ <xsd:enumeration value="IrishArbitraries"/>
+ <xsd:enumeration value="IslandDeliveryCharge"/>
+ <xsd:enumeration value="IslandPick-UpCharge"/>
+ <xsd:enumeration value="ItalianReleaseCharge"/>
+ <xsd:enumeration value="ItemPercentage"/>
+ <xsd:enumeration value="Item-Unit"/>
+ <xsd:enumeration value="KeepFromFreezingPercentDifferential"/>
+ <xsd:enumeration value="Koshering"/>
+ <xsd:enumeration value="LabelAllowance"/>
+ <xsd:enumeration value="Labeling"/>
+ <xsd:enumeration value="LaborCharges"/>
+ <xsd:enumeration value="LaborCostOfRemoval"/>
+ <xsd:enumeration value="LaborModify"/>
+ <xsd:enumeration value="LaborNoTroubleFound"/>
+ <xsd:enumeration value="LaborOvertime"/>
+ <xsd:enumeration value="LaborPremiumOvertime"/>
+ <xsd:enumeration value="LaborRepairAndReturnOrders"/>
+ <xsd:enumeration value="LaborService"/>
+ <xsd:enumeration value="LaborStraight-time"/>
+ <xsd:enumeration value="LaborTestAndCalibrate"/>
+ <xsd:enumeration value="LadingAdjustmentCharge"/>
+ <xsd:enumeration value="LandCurrencyAdjustmentFactor-20FootContainer"/>
+ <xsd:enumeration value="LandCurrencyAdjustmentFactor-40FootContainer"/>
+ <xsd:enumeration value="Lashing"/>
+ <xsd:enumeration value="LateOrderCharge"/>
+ <xsd:enumeration value="LatePaymentCharge"/>
+ <xsd:enumeration value="LayoutDesign"/>
+ <xsd:enumeration value="LayoverCharges"/>
+ <xsd:enumeration value="LeadFactor"/>
+ <xsd:enumeration value="LeakingUndergroundStorageTax"/>
+ <xsd:enumeration value="LeaseShortfallConsideration"/>
+ <xsd:enumeration value="LessThanContainer"/>
+ <xsd:enumeration value="LessThanTruckloadCharge"/>
+ <xsd:enumeration value="LetterOfCreditProcessing"/>
+ <xsd:enumeration value="LicenseAndTitle"/>
+ <xsd:enumeration value="LifelineSurcharge"/>
+ <xsd:enumeration value="LiftGateTruckOrForkliftServiceAtPick-upDelivery"/>
+ <xsd:enumeration value="LimeFee"/>
+ <xsd:enumeration value="LineItemAllowance"/>
+ <xsd:enumeration value="LineItemCharge"/>
+ <xsd:enumeration value="LinehaulFromPortOfDebarkation"/>
+ <xsd:enumeration value="LinehaulPercentDifferential"/>
+ <xsd:enumeration value="LinehaulToPortOfEmbarkation"/>
+ <xsd:enumeration value="LinerTermsAtPortOfDebarkation"/>
+ <xsd:enumeration value="LinerTermsAtPortOfEmbarkation"/>
+ <xsd:enumeration value="LiquidatedDamages"/>
+ <xsd:enumeration value="LiquidationAnti-DumpingDuty"/>
+ <xsd:enumeration value="LiquidationCountervailingDuty"/>
+ <xsd:enumeration value="LiquidationTaxAmount"/>
+ <xsd:enumeration value="LiquidationTotalDueUSCustomsService"/>
+ <xsd:enumeration value="LiquidationTotalFees"/>
+ <xsd:enumeration value="Loading"/>
+ <xsd:enumeration value="LoadingLaborCharges"/>
+ <xsd:enumeration value="LoadWeighingCharge"/>
+ <xsd:enumeration value="LoanFee"/>
+ <xsd:enumeration value="LocalDeliveryDrayage"/>
+ <xsd:enumeration value="LocomotiveDelayedInSwitchingService"/>
+ <xsd:enumeration value="LocomotiveUnderOwnPower"/>
+ <xsd:enumeration value="LotCharge"/>
+ <xsd:enumeration value="LotteryChargeBack"/>
+ <xsd:enumeration value="LotteryCrossRedeemed"/>
+ <xsd:enumeration value="Low-TierLotteryCashingBonus"/>
+ <xsd:enumeration value="Low-TierLotteryWinners"/>
+ <xsd:enumeration value="LumpSum"/>
+ <xsd:enumeration value="MachiningCharge"/>
+ <xsd:enumeration value="MailFee"/>
+ <xsd:enumeration value="Mailing-PostageCost"/>
+ <xsd:enumeration value="Mailing-ServiceFee"/>
+ <xsd:enumeration value="MailInvoice"/>
+ <xsd:enumeration value="MailInvoiceToEachLocation"/>
+ <xsd:enumeration value="ManifestCharge"/>
+ <xsd:enumeration value="Manufacturing"/>
+ <xsd:enumeration value="MarketDevelopmentFunds"/>
+ <xsd:enumeration value="MarkingOrTaggingCharge"/>
+ <xsd:enumeration value="MarriageRule"/>
+ <xsd:enumeration value="Maximum"/>
+ <xsd:enumeration value="MemoReturnableContainer"/>
+ <xsd:enumeration value="MerchandiseProcessingFee"/>
+ <xsd:enumeration value="MessageCharge"/>
+ <xsd:enumeration value="MessageRateAdjustment"/>
+ <xsd:enumeration value="MessengerService"/>
+ <xsd:enumeration value="MetalsSurcharge"/>
+ <xsd:enumeration value="MeterCharge"/>
+ <xsd:enumeration value="Mid-TierLotteryCashingBonus"/>
+ <xsd:enumeration value="Mid-TierLotteryWinners"/>
+ <xsd:enumeration value="MileageFeeForRepairAndReturn"/>
+ <xsd:enumeration value="MileageOrTravel"/>
+ <xsd:enumeration value="Minus-Amount"/>
+ <xsd:enumeration value="Minus-Percentage"/>
+ <xsd:enumeration value="ModifiedAtmosphere"/>
+ <xsd:enumeration value="MonthlyRental"/>
+ <xsd:enumeration value="MountDemount"/>
+ <xsd:enumeration value="Mounting"/>
+ <xsd:enumeration value="MunicipalSurcharge"/>
+ <xsd:enumeration value="MushroomFee"/>
+ <xsd:enumeration value="NewDiscount"/>
+ <xsd:enumeration value="NewDistributionAllowance"/>
+ <xsd:enumeration value="NewItemAllowance"/>
+ <xsd:enumeration value="NewStoreAllowance"/>
+ <xsd:enumeration value="NewStoreDiscount"/>
+ <xsd:enumeration value="NewWarehouse"/>
+ <xsd:enumeration value="NewWarehouseDiscount"/>
+ <xsd:enumeration value="NewYorkDeliveryCharge"/>
+ <xsd:enumeration value="NewYorkPick-upCharge"/>
+ <xsd:enumeration value="NHDWharfage"/>
+ <xsd:enumeration value="NoAllowance"/>
+ <xsd:enumeration value="NoAllowanceOrCharge"/>
+ <xsd:enumeration value="NoCharge"/>
+ <xsd:enumeration value="Non-DutiableCharges"/>
+ <xsd:enumeration value="NonGeneratedFreight"/>
+ <xsd:enumeration value="Non-returnableContainers"/>
+ <xsd:enumeration value="NoReturnCreditAllowance"/>
+ <xsd:enumeration value="NormalPumpCharge"/>
+ <xsd:enumeration value="NotarizedAffidavit"/>
+ <xsd:enumeration value="NotifyConsignee"/>
+ <xsd:enumeration value="NotifyConsigneeBeforeDelivery"/>
+ <xsd:enumeration value="NozzleCharge"/>
+ <xsd:enumeration value="OceanCharges-Hazardous"/>
+ <xsd:enumeration value="OceanFreight"/>
+ <xsd:enumeration value="OfficeSupplies"/>
+ <xsd:enumeration value="Offshore-AlaskaHawaii"/>
+ <xsd:enumeration value="OnCarriage"/>
+ <xsd:enumeration value="OnDeckBreakBulkDifferential"/>
+ <xsd:enumeration value="One-DayService"/>
+ <xsd:enumeration value="OneTimeEngineeringCharge"/>
+ <xsd:enumeration value="One-TimeLicenseFee"/>
+ <xsd:enumeration value="One-Time-OnlyCharge"/>
+ <xsd:enumeration value="OnetimeTooling"/>
+ <xsd:enumeration value="OnHandService"/>
+ <xsd:enumeration value="OperatorCredit"/>
+ <xsd:enumeration value="OptionalCharge"/>
+ <xsd:enumeration value="OptionalSoftwareSupportForOperationalSupportSystems"/>
+ <xsd:enumeration value="OptionalSoftwareSupportForSwitchingSystems"/>
+ <xsd:enumeration value="OptionChargeColorFabricOfficeFurniture"/>
+ <xsd:enumeration value="Order-Flat"/>
+ <xsd:enumeration value="OrderNotifyCharge"/>
+ <xsd:enumeration value="OtherAccessorialServiceCharge"/>
+ <xsd:enumeration value="OtherAdvances"/>
+ <xsd:enumeration value="OtherExportCharges"/>
+ <xsd:enumeration value="OtherGovernmentAgencyDeclaration"/>
+ <xsd:enumeration value="OtherGovernmentAgencyExam"/>
+ <xsd:enumeration value="OtherImportCharge"/>
+ <xsd:enumeration value="OtherMiscellaneousEarningOrAdditive"/>
+ <xsd:enumeration value="OtherSeeRelatedDescription"/>
+ <xsd:enumeration value="OutOfRouteMiles"/>
+ <xsd:enumeration value="OutOfZonePick-upOrDelivery"/>
+ <xsd:enumeration value="OutsideCableConnectors"/>
+ <xsd:enumeration value="OverDimension"/>
+ <xsd:enumeration value="OverHeightContainer"/>
+ <xsd:enumeration value="OverrunCharge"/>
+ <xsd:enumeration value="OversizedPremium"/>
+ <xsd:enumeration value="OvertimeLoading"/>
+ <xsd:enumeration value="OverWidthContainer"/>
+ <xsd:enumeration value="Packaging"/>
+ <xsd:enumeration value="PackagingService"/>
+ <xsd:enumeration value="PackingCratingAndHandlingCharge"/>
+ <xsd:enumeration value="PackingCratingHandlingAndTransportationCharge"/>
+ <xsd:enumeration value="PackInvoiceWithShipment"/>
+ <xsd:enumeration value="PaintingPrimerOrFinish"/>
+ <xsd:enumeration value="Pallet"/>
+ <xsd:enumeration value="PalletExchangeCharge"/>
+ <xsd:enumeration value="Palletizing"/>
+ <xsd:enumeration value="Paralleling"/>
+ <xsd:enumeration value="ParishCountySalesTaxOnly"/>
+ <xsd:enumeration value="PassingShippersExportEntry"/>
+ <xsd:enumeration value="Payment"/>
+ <xsd:enumeration value="PayrollAdditivesOvertimeLabor"/>
+ <xsd:enumeration value="PayrollAdditivesStraightTimeLabor"/>
+ <xsd:enumeration value="PayrollTaxes"/>
+ <xsd:enumeration value="PecanFee"/>
+ <xsd:enumeration value="PenaltyCharge"/>
+ <xsd:enumeration value="PercentDifferential-LessThanContainer"/>
+ <xsd:enumeration value="PercentOfProduct"/>
+ <xsd:enumeration value="PercentOfShipmentValueThatIsReturnable"/>
+ <xsd:enumeration value="PercentOfShippedQuantityThatIsReturnable"/>
+ <xsd:enumeration value="PerformanceAllowance"/>
+ <xsd:enumeration value="PerformanceAward"/>
+ <xsd:enumeration value="PerItemCharge"/>
+ <xsd:enumeration value="PermitCharge"/>
+ <xsd:enumeration value="PermitsBondsEscortAttendant"/>
+ <xsd:enumeration value="PerOrderCharge"/>
+ <xsd:enumeration value="PerPoundCharge"/>
+ <xsd:enumeration value="PersonalPropertyMember"/>
+ <xsd:enumeration value="PersonalPropertySpouse"/>
+ <xsd:enumeration value="PhosphatizingSteelTreatment"/>
+ <xsd:enumeration value="PickleAndOil"/>
+ <xsd:enumeration value="PickUp"/>
+ <xsd:enumeration value="Pick-upAndDelivery"/>
+ <xsd:enumeration value="Pickup-OutOfArea"/>
+ <xsd:enumeration value="PickupSurcharge"/>
+ <xsd:enumeration value="PierChargesOtherThanWharfage"/>
+ <xsd:enumeration value="PierCharges-Wharfage"/>
+ <xsd:enumeration value="PierPick-upAndOrDelivery"/>
+ <xsd:enumeration value="PierUnloading"/>
+ <xsd:enumeration value="PilotInspection"/>
+ <xsd:enumeration value="PlacementAndOrRemovalCharge"/>
+ <xsd:enumeration value="Plating"/>
+ <xsd:enumeration value="Plus-Amount"/>
+ <xsd:enumeration value="Plus-Percentage"/>
+ <xsd:enumeration value="PlusOrMinus-Amount"/>
+ <xsd:enumeration value="PlusOrMinus-Percentage"/>
+ <xsd:enumeration value="PoleLashingEquipmentSurcharge"/>
+ <xsd:enumeration value="PoleWood-ServiceCharge"/>
+ <xsd:enumeration value="PorkFee"/>
+ <xsd:enumeration value="PortChanges"/>
+ <xsd:enumeration value="PortHandlingAndUnloading"/>
+ <xsd:enumeration value="PositioningAtOrigin"/>
+ <xsd:enumeration value="Postage"/>
+ <xsd:enumeration value="PostDamagedHandling"/>
+ <xsd:enumeration value="PotatoFee"/>
+ <xsd:enumeration value="PowerFactorAdjustment"/>
+ <xsd:enumeration value="Pre-carriage"/>
+ <xsd:enumeration value="Pre-carriageExcess"/>
+ <xsd:enumeration value="PreciousMetalContent"/>
+ <xsd:enumeration value="PreloadingCharge"/>
+ <xsd:enumeration value="PrelodgeCharge"/>
+ <xsd:enumeration value="PremiseUse"/>
+ <xsd:enumeration value="PremiumCharge"/>
+ <xsd:enumeration value="PremiumTransportation"/>
+ <xsd:enumeration value="PrepaidUsageAllowance"/>
+ <xsd:enumeration value="Preparation"/>
+ <xsd:enumeration value="PreparationAndDelivery"/>
+ <xsd:enumeration value="PreparationOfAirWaybill-Origin"/>
+ <xsd:enumeration value="PreparationOfCanadianCustomsInvoice"/>
+ <xsd:enumeration value="PreparationOfCommercialInvoice"/>
+ <xsd:enumeration value="PreparationOfExportEntry"/>
+ <xsd:enumeration value="PreparationOfInsuranceCertificate"/>
+ <xsd:enumeration value="PreparationOfUSExportDocumentation"/>
+ <xsd:enumeration value="Pre-PositionedInventoryService"/>
+ <xsd:enumeration value="PreviousBilling"/>
+ <xsd:enumeration value="PriceAdjustmentPercent"/>
+ <xsd:enumeration value="PriceAndMarketingAllowance"/>
+ <xsd:enumeration value="PriceDeviation"/>
+ <xsd:enumeration value="PriorBalance"/>
+ <xsd:enumeration value="PriorBillingAmount"/>
+ <xsd:enumeration value="PriorDeliveryOfBillCharge"/>
+ <xsd:enumeration value="PriorityService"/>
+ <xsd:enumeration value="PriorMonthCredit"/>
+ <xsd:enumeration value="PrivateOwnedVehicleProcessing"/>
+ <xsd:enumeration value="Processing"/>
+ <xsd:enumeration value="ProcessingCharge"/>
+ <xsd:enumeration value="ProcessInTransitPrivilege"/>
+ <xsd:enumeration value="ProcurementCharge"/>
+ <xsd:enumeration value="ProfessionalFees"/>
+ <xsd:enumeration value="ProformaInvoice"/>
+ <xsd:enumeration value="ProgressPaymentRequirement"/>
+ <xsd:enumeration value="PromotionalAllowance"/>
+ <xsd:enumeration value="PromotionalDiscount"/>
+ <xsd:enumeration value="ProofComposition"/>
+ <xsd:enumeration value="ProofOfDelivery"/>
+ <xsd:enumeration value="ProtectiveServiceCharge"/>
+ <xsd:enumeration value="ProtectiveService-Cold"/>
+ <xsd:enumeration value="ProtectiveService-Heat"/>
+ <xsd:enumeration value="ProvideHouseholdIdentifier"/>
+ <xsd:enumeration value="ProvideNameAndAddress"/>
+ <xsd:enumeration value="PullingEyes"/>
+ <xsd:enumeration value="PumpAirCharge"/>
+ <xsd:enumeration value="PumpCharge"/>
+ <xsd:enumeration value="PurchaseOption"/>
+ <xsd:enumeration value="QuantityDiscount"/>
+ <xsd:enumeration value="QuantitySurcharge"/>
+ <xsd:enumeration value="RailheadHandling"/>
+ <xsd:enumeration value="Ramping"/>
+ <xsd:enumeration value="RateCode"/>
+ <xsd:enumeration value="RateReductionBond"/>
+ <xsd:enumeration value="Rebate"/>
+ <xsd:enumeration value="Re-BillCharge"/>
+ <xsd:enumeration value="RebilledDrayage-Destination"/>
+ <xsd:enumeration value="RebilledDrayage-Origin"/>
+ <xsd:enumeration value="Receiving"/>
+ <xsd:enumeration value="RecipientAddressCorrection"/>
+ <xsd:enumeration value="ReclamationCenterHandlingChute"/>
+ <xsd:enumeration value="ReclamationFederal"/>
+ <xsd:enumeration value="ReclamationSharedResponsibility"/>
+ <xsd:enumeration value="ReclamationState"/>
+ <xsd:enumeration value="Reconciliation"/>
+ <xsd:enumeration value="Reconnectcharge"/>
+ <xsd:enumeration value="ReconsignConsigneeCharge"/>
+ <xsd:enumeration value="ReconsignDeliveryCharge"/>
+ <xsd:enumeration value="ReconsignmentCharge"/>
+ <xsd:enumeration value="RecooperingAtOwnersOrShippersExpense"/>
+ <xsd:enumeration value="RecordFiling"/>
+ <xsd:enumeration value="Recovery"/>
+ <xsd:enumeration value="RecoveryFee"/>
+ <xsd:enumeration value="RecratingRecoopering-Destination"/>
+ <xsd:enumeration value="RecratingRecoopering-Origin"/>
+ <xsd:enumeration value="RecurringHardwareMaintenanceCharge"/>
+ <xsd:enumeration value="RecurringLicenseFee"/>
+ <xsd:enumeration value="RecurringSoftwareMaintenanceCharge"/>
+ <xsd:enumeration value="Redelivery"/>
+ <xsd:enumeration value="RedistributionAllowance"/>
+ <xsd:enumeration value="ReductionPrepalletizedCargo"/>
+ <xsd:enumeration value="ReeferCargoPercentDifferential"/>
+ <xsd:enumeration value="ReeferMaintenance"/>
+ <xsd:enumeration value="Reel"/>
+ <xsd:enumeration value="ReelCable"/>
+ <xsd:enumeration value="ReelDeposit"/>
+ <xsd:enumeration value="Refrigeration"/>
+ <xsd:enumeration value="RefrigerationMechanicalDetention"/>
+ <xsd:enumeration value="Refund"/>
+ <xsd:enumeration value="RefurbishingCharge"/>
+ <xsd:enumeration value="Regain"/>
+ <xsd:enumeration value="RegistrationOfExportForReentry"/>
+ <xsd:enumeration value="RegistrationOfExportShipments"/>
+ <xsd:enumeration value="RegulatoryFee"/>
+ <xsd:enumeration value="RegulatoryRequiredRefund"/>
+ <xsd:enumeration value="ReliabilityCharge"/>
+ <xsd:enumeration value="RelinquishmentCharge"/>
+ <xsd:enumeration value="ReliquidationAnti-DumpingDuty"/>
+ <xsd:enumeration value="ReliquidationCountervailingDuty"/>
+ <xsd:enumeration value="ReliquidationTaxAmount"/>
+ <xsd:enumeration value="ReliquidationTotalDueUSCustomsService"/>
+ <xsd:enumeration value="ReliquidationTotalFees"/>
+ <xsd:enumeration value="RentalCharge"/>
+ <xsd:enumeration value="RentalDeduction"/>
+ <xsd:enumeration value="RentsAndLeases"/>
+ <xsd:enumeration value="RepackCharge"/>
+ <xsd:enumeration value="Repair"/>
+ <xsd:enumeration value="RepairAtBuyersExpenseCharge"/>
+ <xsd:enumeration value="RepairAtCustomerExpenseCharge"/>
+ <xsd:enumeration value="RepairAtGovernmentExpenseCharge"/>
+ <xsd:enumeration value="Repickup"/>
+ <xsd:enumeration value="RequestViaCanada"/>
+ <xsd:enumeration value="ResearchDevelopmentFee"/>
+ <xsd:enumeration value="ResellersDiscount"/>
+ <xsd:enumeration value="ResidentialDelivery"/>
+ <xsd:enumeration value="ResidentialPick-up"/>
+ <xsd:enumeration value="Respotting"/>
+ <xsd:enumeration value="RestockingCharge"/>
+ <xsd:enumeration value="RestrictedArticleFee"/>
+ <xsd:enumeration value="Retainer"/>
+ <xsd:enumeration value="ReturnableContainer"/>
+ <xsd:enumeration value="ReturnCargoCharge"/>
+ <xsd:enumeration value="ReturnedLoad"/>
+ <xsd:enumeration value="Rework"/>
+ <xsd:enumeration value="RidingAttendantCharge"/>
+ <xsd:enumeration value="RockyMountainBureau583Item1100ArbitraryCharge"/>
+ <xsd:enumeration value="RollOutAdjustment"/>
+ <xsd:enumeration value="RollRebate"/>
+ <xsd:enumeration value="Royalties"/>
+ <xsd:enumeration value="Salvage"/>
+ <xsd:enumeration value="Same-DayService"/>
+ <xsd:enumeration value="SaturdayDelivery"/>
+ <xsd:enumeration value="SaturdayPick-Up"/>
+ <xsd:enumeration value="SaturdayPick-upOrDeliveryCharge"/>
+ <xsd:enumeration value="ScaleCharge"/>
+ <xsd:enumeration value="ScaleChargeUnloading"/>
+ <xsd:enumeration value="ScrapAllowance"/>
+ <xsd:enumeration value="SecuritySignatureService"/>
+ <xsd:enumeration value="SegregatingSorting"/>
+ <xsd:enumeration value="SelectCharge"/>
+ <xsd:enumeration value="SelfUnloader"/>
+ <xsd:enumeration value="SellerHandCarry"/>
+ <xsd:enumeration value="ServiceAssistanceProgramSurcharge"/>
+ <xsd:enumeration value="ServiceCharge"/>
+ <xsd:enumeration value="ServiceChargeWithCashDiscount"/>
+ <xsd:enumeration value="ServiceUpgrade"/>
+ <xsd:enumeration value="Set-up"/>
+ <xsd:enumeration value="Shearing"/>
+ <xsd:enumeration value="SheepFee"/>
+ <xsd:enumeration value="ShipperLoad"/>
+ <xsd:enumeration value="ShipperLoadAndCount"/>
+ <xsd:enumeration value="ShipperLoadCarrierCount"/>
+ <xsd:enumeration value="ShipperLoadConsigneeUnload"/>
+ <xsd:enumeration value="Shipping"/>
+ <xsd:enumeration value="ShippingAndHandling"/>
+ <xsd:enumeration value="ShipsidePickup"/>
+ <xsd:enumeration value="ShipToStockQualityAudit"/>
+ <xsd:enumeration value="Shotblasting"/>
+ <xsd:enumeration value="ShrinkageAllowance"/>
+ <xsd:enumeration value="ShrinkAllowance"/>
+ <xsd:enumeration value="Shrink-WrapCharge"/>
+ <xsd:enumeration value="SingleFactorOriginationDestination"/>
+ <xsd:enumeration value="SingleFactorOriginationPortOfDebarkation"/>
+ <xsd:enumeration value="SingleFactorPortOfEmbarkationDestination"/>
+ <xsd:enumeration value="SingleInvoiceAllowance"/>
+ <xsd:enumeration value="SinglePick-up"/>
+ <xsd:enumeration value="SingleShipmentFee"/>
+ <xsd:enumeration value="Sleeving"/>
+ <xsd:enumeration value="SlipSheetRail"/>
+ <xsd:enumeration value="SlipSheetTruck"/>
+ <xsd:enumeration value="SlipSheetUnloadingAllowance"/>
+ <xsd:enumeration value="SlottingAllowance"/>
+ <xsd:enumeration value="SmallOrderCharge"/>
+ <xsd:enumeration value="SoftwareSupportService"/>
+ <xsd:enumeration value="SourceInspection"/>
+ <xsd:enumeration value="SpecialAllowance"/>
+ <xsd:enumeration value="SpecialBuy"/>
+ <xsd:enumeration value="SpecialCircusTrains"/>
+ <xsd:enumeration value="SpecialCredit"/>
+ <xsd:enumeration value="SpecialDelivery"/>
+ <xsd:enumeration value="SpecialDetentionCharge"/>
+ <xsd:enumeration value="SpecialEquipmentCharge"/>
+ <xsd:enumeration value="SpecialFinishCharge"/>
+ <xsd:enumeration value="SpecialFreightSupplements"/>
+ <xsd:enumeration value="SpecialHandling"/>
+ <xsd:enumeration value="SpecialMileageMovements"/>
+ <xsd:enumeration value="SpecialPackaging"/>
+ <xsd:enumeration value="SpecialPermits"/>
+ <xsd:enumeration value="SpecialPickup"/>
+ <xsd:enumeration value="SpecialPumpCharge"/>
+ <xsd:enumeration value="SpecialSealCharge"/>
+ <xsd:enumeration value="SpecialServices"/>
+ <xsd:enumeration value="SpecialTestEquipmentCharge"/>
+ <xsd:enumeration value="SpecialToolingCharge"/>
+ <xsd:enumeration value="SpecialToolingreworkcharge"/>
+ <xsd:enumeration value="SpecialTrainMovement"/>
+ <xsd:enumeration value="SpecialUse"/>
+ <xsd:enumeration value="SpecialVehicleRent"/>
+ <xsd:enumeration value="SpecificationReview"/>
+ <xsd:enumeration value="SpecificDuty"/>
+ <xsd:enumeration value="SplitDelivery"/>
+ <xsd:enumeration value="SplitPick-up"/>
+ <xsd:enumeration value="SplitPick-UpAtPierCharge"/>
+ <xsd:enumeration value="SpoolCharge"/>
+ <xsd:enumeration value="SpottingOfTrailer"/>
+ <xsd:enumeration value="SpreaderCharge"/>
+ <xsd:enumeration value="StampFee"/>
+ <xsd:enumeration value="Stamping"/>
+ <xsd:enumeration value="StandbyCharge"/>
+ <xsd:enumeration value="StateMetropolitanTransitAuthoritySurcharge"/>
+ <xsd:enumeration value="StateMotorFuel"/>
+ <xsd:enumeration value="StateSalesCharge"/>
+ <xsd:enumeration value="StateSurcharge"/>
+ <xsd:enumeration value="SteamingCharge"/>
+ <xsd:enumeration value="StencilingCharge"/>
+ <xsd:enumeration value="Stopcharge"/>
+ <xsd:enumeration value="Stop-offAtDestination"/>
+ <xsd:enumeration value="Stop-offAtOrigination"/>
+ <xsd:enumeration value="Stop-offAtPierCharge"/>
+ <xsd:enumeration value="Stop-offCharge"/>
+ <xsd:enumeration value="StoppingInTransit"/>
+ <xsd:enumeration value="Storage"/>
+ <xsd:enumeration value="StorageInTransit"/>
+ <xsd:enumeration value="StraighteningCharge"/>
+ <xsd:enumeration value="Strapping"/>
+ <xsd:enumeration value="StreetLampsCharge"/>
+ <xsd:enumeration value="StrippingSortingAndConsolidation"/>
+ <xsd:enumeration value="Stuffing"/>
+ <xsd:enumeration value="StuffingCharge"/>
+ <xsd:enumeration value="SubjectToCooperativeAdvertisingAllowance"/>
+ <xsd:enumeration value="SubjectToTaxOnResale"/>
+ <xsd:enumeration value="SufferanceWarehouseChargeExportOrImport"/>
+ <xsd:enumeration value="SugarFee"/>
+ <xsd:enumeration value="SumOfAddsAndDeductsToMakeMarketValue"/>
+ <xsd:enumeration value="SundayOrHolidayPick-upOrDelivery"/>
+ <xsd:enumeration value="SuperBagCharge"/>
+ <xsd:enumeration value="SupervisorCharge"/>
+ <xsd:enumeration value="SupplementalDuty"/>
+ <xsd:enumeration value="SupplementalItems"/>
+ <xsd:enumeration value="Surcharge"/>
+ <xsd:enumeration value="SuretyBond"/>
+ <xsd:enumeration value="Swell"/>
+ <xsd:enumeration value="SwitchCharge"/>
+ <xsd:enumeration value="SwitchingCharge"/>
+ <xsd:enumeration value="TankCarAllowance"/>
+ <xsd:enumeration value="TankRental"/>
+ <xsd:enumeration value="Tarping"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="Tax-AirportTaxDestination"/>
+ <xsd:enumeration value="Tax-AirportTaxOrigin"/>
+ <xsd:enumeration value="Tax-BeverageTax"/>
+ <xsd:enumeration value="Tax-CitySalesTaxOnly"/>
+ <xsd:enumeration value="TaxCredit"/>
+ <xsd:enumeration value="Tax-ExciseTax-Destination"/>
+ <xsd:enumeration value="Tax-ExciseTax-Origin"/>
+ <xsd:enumeration value="Tax-FederalExciseTax"/>
+ <xsd:enumeration value="Tax-FederalExciseTaxOnTires"/>
+ <xsd:enumeration value="Tax-Governmental"/>
+ <xsd:enumeration value="Tax-HandlingChargeTax"/>
+ <xsd:enumeration value="TaxLiability-Amortized"/>
+ <xsd:enumeration value="TaxLiability-OneTime"/>
+ <xsd:enumeration value="Tax-LocalSalesTax"/>
+ <xsd:enumeration value="Tax-LocalTax"/>
+ <xsd:enumeration value="Tax-MetropolitanTransitTax"/>
+ <xsd:enumeration value="TaxOnMiscellaneousCharges"/>
+ <xsd:enumeration value="TaxOnTransportation"/>
+ <xsd:enumeration value="Tax-RegulatoryTax"/>
+ <xsd:enumeration value="Tax-SalesandUse"/>
+ <xsd:enumeration value="Tax-SalesTaxStateAndLocal"/>
+ <xsd:enumeration value="Tax-StateHazardousSubstance"/>
+ <xsd:enumeration value="Tax-StateTax"/>
+ <xsd:enumeration value="Tax-SuperFundExciseTax"/>
+ <xsd:enumeration value="Tax-UseTax"/>
+ <xsd:enumeration value="Tax-ValueAddedTax"/>
+ <xsd:enumeration value="TeaFee"/>
+ <xsd:enumeration value="TechnologyExchange"/>
+ <xsd:enumeration value="TelegramChargeback"/>
+ <xsd:enumeration value="TelephoneCharge"/>
+ <xsd:enumeration value="Telephone-Destination"/>
+ <xsd:enumeration value="Telephone-Origin"/>
+ <xsd:enumeration value="TemperatureProtection"/>
+ <xsd:enumeration value="TemporaryAllowance"/>
+ <xsd:enumeration value="TemporaryVoluntaryAllowance"/>
+ <xsd:enumeration value="TenderedAsTruckload"/>
+ <xsd:enumeration value="TerminalCharge"/>
+ <xsd:enumeration value="TerminalDifferential"/>
+ <xsd:enumeration value="TerminalHandlingCharges"/>
+ <xsd:enumeration value="TerminalServiceFee"/>
+ <xsd:enumeration value="TermsAllowance"/>
+ <xsd:enumeration value="Testing"/>
+ <xsd:enumeration value="TestingServicesCharge"/>
+ <xsd:enumeration value="TestQualificationCharge"/>
+ <xsd:enumeration value="ThirdPartyAllowance"/>
+ <xsd:enumeration value="ThirdPartyPallets"/>
+ <xsd:enumeration value="ThroughputAllowance"/>
+ <xsd:enumeration value="ThroughputContainerCharge"/>
+ <xsd:enumeration value="ThruwayCharge"/>
+ <xsd:enumeration value="TicketingService"/>
+ <xsd:enumeration value="TobaccoProductsReportCharge"/>
+ <xsd:enumeration value="TOFCServiceCharge"/>
+ <xsd:enumeration value="ToolCharge"/>
+ <xsd:enumeration value="Tooling"/>
+ <xsd:enumeration value="ToolingReworkCharge"/>
+ <xsd:enumeration value="ToolsForPrinting"/>
+ <xsd:enumeration value="TotalOther"/>
+ <xsd:enumeration value="TotalAssessorialCharges"/>
+ <xsd:enumeration value="TotalDueUSCustomsService"/>
+ <xsd:enumeration value="TotalFees"/>
+ <xsd:enumeration value="TotalInvoiceAmount"/>
+ <xsd:enumeration value="TotalInvoiceAmountNon-USDollars"/>
+ <xsd:enumeration value="TotalInvoiceAmountUSDollars"/>
+ <xsd:enumeration value="TotalMaterialInvoiceAmount"/>
+ <xsd:enumeration value="TracingInboundViaOtherCarriers"/>
+ <xsd:enumeration value="TracingServiceFee"/>
+ <xsd:enumeration value="TrackStorage"/>
+ <xsd:enumeration value="TradeDiscount"/>
+ <xsd:enumeration value="TradeIn"/>
+ <xsd:enumeration value="TrailerRentalCharge"/>
+ <xsd:enumeration value="TransferCharge"/>
+ <xsd:enumeration value="TransferOfLadingCharge"/>
+ <xsd:enumeration value="TransferredCharges"/>
+ <xsd:enumeration value="Transit"/>
+ <xsd:enumeration value="TransmissionCharge"/>
+ <xsd:enumeration value="TransportationAndSetup"/>
+ <xsd:enumeration value="TransportationChargeMinimumRate"/>
+ <xsd:enumeration value="TransportationDirectBilling"/>
+ <xsd:enumeration value="TransportationThirdPartyBilling"/>
+ <xsd:enumeration value="TransportationVendorProvided"/>
+ <xsd:enumeration value="TrimmingCharge"/>
+ <xsd:enumeration value="TruckDetention"/>
+ <xsd:enumeration value="TruckloadDiscount"/>
+ <xsd:enumeration value="TurningCharge"/>
+ <xsd:enumeration value="Two-DayService"/>
+ <xsd:enumeration value="TwoDoorPickUp"/>
+ <xsd:enumeration value="UnabsorbedSwitching"/>
+ <xsd:enumeration value="Unitized"/>
+ <xsd:enumeration value="Unloading"/>
+ <xsd:enumeration value="UnloadingLaborCharges"/>
+ <xsd:enumeration value="UnloadingReloadingCharge"/>
+ <xsd:enumeration value="UnsaleableMerchandiseAllowance"/>
+ <xsd:enumeration value="UnscheduledFee"/>
+ <xsd:enumeration value="UpCharge"/>
+ <xsd:enumeration value="UsagePlanDetailCharge"/>
+ <xsd:enumeration value="USCustomsServiceFlatAssistAmount"/>
+ <xsd:enumeration value="USCustomsServiceMaximumAssistAmount"/>
+ <xsd:enumeration value="USDAInspectedStampingCertification"/>
+ <xsd:enumeration value="UseChargeToolingPersonnel"/>
+ <xsd:enumeration value="Use-SpecialTypeFlatCar"/>
+ <xsd:enumeration value="USVehicles"/>
+ <xsd:enumeration value="ValuationFee"/>
+ <xsd:enumeration value="VanCleaning"/>
+ <xsd:enumeration value="VehicleOrderedButNotUsed"/>
+ <xsd:enumeration value="VehiclePrepChargeCourtesyDelivery"/>
+ <xsd:enumeration value="VehicleRoadCharge"/>
+ <xsd:enumeration value="VendorFreight"/>
+ <xsd:enumeration value="VentingInstructions"/>
+ <xsd:enumeration value="VirginIslandTransferCharge"/>
+ <xsd:enumeration value="VolumeDiscount"/>
+ <xsd:enumeration value="VoluntaryContributionCharge"/>
+ <xsd:enumeration value="WaitingTime"/>
+ <xsd:enumeration value="Warehouse"/>
+ <xsd:enumeration value="Warehousing"/>
+ <xsd:enumeration value="Warranties"/>
+ <xsd:enumeration value="WarRiskCrewInsurance"/>
+ <xsd:enumeration value="WarRiskInsurance"/>
+ <xsd:enumeration value="WarRiskSurcharge"/>
+ <xsd:enumeration value="WastedFutileTrip"/>
+ <xsd:enumeration value="WatermelonFee"/>
+ <xsd:enumeration value="WaybillAndInvoiceDistribution"/>
+ <xsd:enumeration value="WeatherProtection"/>
+ <xsd:enumeration value="WeightVerificationCharge"/>
+ <xsd:enumeration value="Wharfage-Breakbulk"/>
+ <xsd:enumeration value="WharfageCharge"/>
+ <xsd:enumeration value="Wharfage-Container"/>
+ <xsd:enumeration value="WharfageHandling"/>
+ <xsd:enumeration value="WideAreaTelephoneServiceUsageCredit"/>
+ <xsd:enumeration value="WillCallCharge"/>
+ <xsd:enumeration value="WrittenProofOfDelivery"/>
+ <xsd:enumeration value="X-rayCharge"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="BasisMonetaryRange">
+ <xsd:choice>
+ <xsd:element ref="MonetaryRange"/>
+ <xsd:element ref="MonetaryLimit"/>
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:element name="BasisMonetaryRange" type="BasisMonetaryRange"/>
+ <xsd:complexType name="MonetaryRange">
+ <xsd:sequence>
+ <xsd:element name="MinimumMonetaryValue" type="Decimal21_6"/>
+ <xsd:element name="MaximumMonetaryValue" type="Decimal21_6"/>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MonetaryRange" type="MonetaryRange"/>
+ <xsd:complexType name="MonetaryLimit">
+ <xsd:sequence>
+ <xsd:element name="MonetaryLimitValue" type="Decimal21_6"/>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ <xsd:attribute name="SignificanceCoded" type="SignificanceCode" use="optional"/>
+ <xsd:attribute name="SignificanceCodedOther" type="xsd:string" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="MonetaryLimit" type="MonetaryLimit"/>
+ <xsd:complexType name="TypeOfAllowanceOrCharge">
+ <xsd:choice>
+ <xsd:element ref="QuantityAllowanceOrCharge"/>
+ <xsd:element ref="PercentageAllowanceOrCharge"/>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:element name="TypeOfAllowanceOrCharge" type="TypeOfAllowanceOrCharge"/>
+ <xsd:complexType name="QuantityAllowanceOrCharge">
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ <xsd:element ref="Rate"/>
+ <xsd:element minOccurs="0" name="QuantityMonetaryValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="QuantityAllowanceOrCharge" type="QuantityAllowanceOrCharge"/>
+ <xsd:complexType name="Rate">
+ <xsd:sequence>
+ <xsd:element name="RatePerUnit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="UnitPrice"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="UnitPriceBasis" type="Decimal18_3"/>
+ <xsd:element minOccurs="0" ref="UnitOfMeasurement"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Rate" type="Rate"/>
+ <xsd:simpleType name="Decimal18_3">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="18"/>
+ <xsd:fractionDigits value="3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="MonetaryValue">
+ <xsd:sequence>
+ <xsd:element name="MonetaryAmount" type="Decimal21_6"/>
+ <xsd:element minOccurs="0" ref="Currency"/>
+ <xsd:element minOccurs="0" ref="RateOfExchangeDetail"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="MonetaryValue" type="MonetaryValue"/>
+ <xsd:complexType name="RateOfExchangeDetail">
+ <xsd:sequence>
+ <xsd:element name="ReferenceCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TargetCurrency">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Currency"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="RateOfExchange" type="Decimal19_9"/>
+ <xsd:element minOccurs="0" name="InverseRateOfExchange" type="Decimal19_9"/>
+ <xsd:element minOccurs="0" name="DateOfRateOfExchange" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="ListOfRateOfExchangeReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="RateOfExchangeDetail" type="RateOfExchangeDetail"/>
+ <xsd:simpleType name="Decimal19_9">
+ <xsd:restriction base="xsd:decimal">
+ <xsd:totalDigits value="19"/>
+ <xsd:fractionDigits value="9"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfReference">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="Reference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfReference" type="ListOfReference"/>
+ <xsd:complexType name="PercentageAllowanceOrCharge">
+ <xsd:sequence>
+ <xsd:element ref="PercentQualifier"/>
+ <xsd:element name="Percent" type="Decimal10_4"/>
+ <xsd:element minOccurs="0" name="PercentageMonetaryValue">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="MonetaryValue"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PercentageAllowanceOrCharge" type="PercentageAllowanceOrCharge"/>
+ <xsd:complexType name="PercentQualifier">
+ <xsd:sequence>
+ <xsd:element name="PercentQualifierCoded" type="PercentQualifierCode"/>
+ <xsd:element minOccurs="0" name="PercentQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PercentQualifier" type="PercentQualifier"/>
+ <xsd:simpleType name="PercentQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ItemListCost"/>
+ <xsd:enumeration value="ItemNetCost"/>
+ <xsd:enumeration value="Discount-Gross"/>
+ <xsd:enumeration value="Discount-Net"/>
+ <xsd:enumeration value="BasePriceperUnit"/>
+ <xsd:enumeration value="BasePriceAmount"/>
+ <xsd:enumeration value="BasePriceAmountLessPreviousDiscount"/>
+ <xsd:enumeration value="NetMonthlyOnAllInvoicesPastDue"/>
+ <xsd:enumeration value="LatePaymentChargeBaseAmount"/>
+ <xsd:enumeration value="FuelRate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="DeliveryDetail">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ShipToLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ShipFromLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" ref="ListOfScheduleLine"/>
+ <xsd:element minOccurs="0" ref="ItemPackagingReference"/>
+ <xsd:element minOccurs="0" name="SimplePackageNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" ref="TermsOfDelivery"/>
+ <xsd:element minOccurs="0" ref="CargoClassification"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DeliveryDetail" type="DeliveryDetail"/>
+ <xsd:complexType name="ListOfScheduleLine">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ScheduleLine"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfScheduleLine" type="ListOfScheduleLine"/>
+ <xsd:complexType name="ScheduleLine">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="ScheduleLineID" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusEventCoded" type="ShipmentStatusEventCode"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusEventCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ShipmentStatusReasons">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfStatusReason"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="Quantity"/>
+ <xsd:element minOccurs="0" name="RequestedDeliveryDate" type="xcblDatetime"/>
+ <xsd:element minOccurs="0" name="ListOfOtherDeliveryDate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDateCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="ScheduleLineNote" type="xsd:string"/>
+ <xsd:choice minOccurs="0">
+ <xsd:element ref="Transport"/>
+ <xsd:element name="TransportReference" type="xsd:int"/>
+ </xsd:choice>
+ <xsd:element minOccurs="0" ref="ListOfShipToSubInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ScheduleLine" type="ScheduleLine"/>
+ <xsd:simpleType name="ShipmentStatusEventCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotApplicable"/>
+ <xsd:enumeration value="NotYetShipped"/>
+ <xsd:enumeration value="BackOrdered"/>
+ <xsd:enumeration value="BackOrderShipped"/>
+ <xsd:enumeration value="ReadyForPickup"/>
+ <xsd:enumeration value="InTransit"/>
+ <xsd:enumeration value="PartiallyShipped"/>
+ <xsd:enumeration value="PartiallyDelivered"/>
+ <xsd:enumeration value="ShipmentComplete"/>
+ <xsd:enumeration value="Delivered"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfStatusReason">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="StatusReason"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfStatusReason" type="ListOfStatusReason"/>
+ <xsd:complexType name="StatusReason">
+ <xsd:sequence>
+ <xsd:element name="StatusReasonCoded" type="StatusReasonCode"/>
+ <xsd:element minOccurs="0" name="StatusReasonCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="StatusReason" type="StatusReason"/>
+ <xsd:simpleType name="StatusReasonCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="ChangedSchedule"/>
+ <xsd:enumeration value="InstructionsAwaited"/>
+ <xsd:enumeration value="Damaged"/>
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="CustomsRefusal"/>
+ <xsd:enumeration value="EmptyOnInspection"/>
+ <xsd:enumeration value="DestinationIncorrect"/>
+ <xsd:enumeration value="ExportRestrictions"/>
+ <xsd:enumeration value="ImportRestrictions"/>
+ <xsd:enumeration value="PaymentNotReceived"/>
+ <xsd:enumeration value="DeliveryDifferentDate"/>
+ <xsd:enumeration value="DeliveryTooLate"/>
+ <xsd:enumeration value="IncidentAttributedToSeller"/>
+ <xsd:enumeration value="IncidentAttributedToTheBuyer"/>
+ <xsd:enumeration value="IncidentAttributedToTheCarrier"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfDateCoded">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="DateCoded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfDateCoded" type="ListOfDateCoded"/>
+ <xsd:complexType name="DateCoded">
+ <xsd:sequence>
+ <xsd:element name="Date" type="xcblDatetime"/>
+ <xsd:element ref="DateQualifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DateCoded" type="DateCoded"/>
+ <xsd:complexType name="DateQualifier">
+ <xsd:sequence>
+ <xsd:element name="DateQualifierCoded" type="DateQualifierCode"/>
+ <xsd:element minOccurs="0" name="DateQualifierCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DateQualifier" type="DateQualifier"/>
+ <xsd:simpleType name="DateQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="36030"/>
+ <xsd:enumeration value="36530"/>
+ <xsd:enumeration value="365630"/>
+ <xsd:enumeration value="3602831"/>
+ <xsd:enumeration value="3652831"/>
+ <xsd:enumeration value="36562831"/>
+ <xsd:enumeration value="1stScheduleDelivery"/>
+ <xsd:enumeration value="1stScheduleShip"/>
+ <xsd:enumeration value="Acceleration"/>
+ <xsd:enumeration value="AcceptanceDateOfDocument"/>
+ <xsd:enumeration value="AcceptanceDateOfGoodsDeclarationCustoms"/>
+ <xsd:enumeration value="AcceptanceDateTimeOfGoods"/>
+ <xsd:enumeration value="AccidentBenefitAgeLimit"/>
+ <xsd:enumeration value="AccidentBenefitPeriod"/>
+ <xsd:enumeration value="AccidentDateAndOrTime"/>
+ <xsd:enumeration value="AccidentInsuranceEliminationPeriod"/>
+ <xsd:enumeration value="AccidentLifetimeBenefitQualificationAge"/>
+ <xsd:enumeration value="AccountantsOpinionDate"/>
+ <xsd:enumeration value="AccountClosedDate"/>
+ <xsd:enumeration value="AccountingMethodologyChangeDate"/>
+ <xsd:enumeration value="AccountingPeriod"/>
+ <xsd:enumeration value="AccountingPeriodEndDate"/>
+ <xsd:enumeration value="AccountingPeriodStartDate"/>
+ <xsd:enumeration value="AccountingTransactionDate"/>
+ <xsd:enumeration value="AccountingValueDate"/>
+ <xsd:enumeration value="AccountingYear"/>
+ <xsd:enumeration value="AccountOpened"/>
+ <xsd:enumeration value="AccountsReceivable-StatementDate"/>
+ <xsd:enumeration value="Acknowledgment"/>
+ <xsd:enumeration value="AcquisitionDate"/>
+ <xsd:enumeration value="ActionDate"/>
+ <xsd:enumeration value="ActionEndDate"/>
+ <xsd:enumeration value="ActivityReportingDate"/>
+ <xsd:enumeration value="ActivityPeriodDateRange"/>
+ <xsd:enumeration value="Actual"/>
+ <xsd:enumeration value="ActualArchive"/>
+ <xsd:enumeration value="ArrivalDateTimeActual"/>
+ <xsd:enumeration value="ActualComplete"/>
+ <xsd:enumeration value="DepartureDateTimeActual"/>
+ <xsd:enumeration value="DischargeDateTimeActual"/>
+ <xsd:enumeration value="ActualPortOfEntry"/>
+ <xsd:enumeration value="ActualRelease"/>
+ <xsd:enumeration value="ActualReturnToWork"/>
+ <xsd:enumeration value="StartDateActual"/>
+ <xsd:enumeration value="AcuteManifestationDate"/>
+ <xsd:enumeration value="AcuteManifestationOfAChronicCondition"/>
+ <xsd:enumeration value="Added"/>
+ <xsd:enumeration value="AddressPeriod"/>
+ <xsd:enumeration value="Adjournment"/>
+ <xsd:enumeration value="AdjustedAge"/>
+ <xsd:enumeration value="AdjustedContestability"/>
+ <xsd:enumeration value="AdjustedDeathBenefit"/>
+ <xsd:enumeration value="AdjustedEnd"/>
+ <xsd:enumeration value="AdjustedHire"/>
+ <xsd:enumeration value="AdjustedStart"/>
+ <xsd:enumeration value="AdjustmentEffectiveDate"/>
+ <xsd:enumeration value="AdjustmentPeriod"/>
+ <xsd:enumeration value="AdjustmentPeriodEnd"/>
+ <xsd:enumeration value="AdjustmentPeriodStart"/>
+ <xsd:enumeration value="AdjustmentProcessed"/>
+ <xsd:enumeration value="AdjustmentPromised"/>
+ <xsd:enumeration value="AdjustmentToBillDated"/>
+ <xsd:enumeration value="AdministratorOrderedDate"/>
+ <xsd:enumeration value="AdmissionDateAndOrTimeExpected"/>
+ <xsd:enumeration value="AdoptionDateActual"/>
+ <xsd:enumeration value="AdviseAfterDateTime"/>
+ <xsd:enumeration value="AdviseBeforeDateTime"/>
+ <xsd:enumeration value="AdviseCompletedDateTime"/>
+ <xsd:enumeration value="AdviseOnDateTime"/>
+ <xsd:enumeration value="AdvisingDate"/>
+ <xsd:enumeration value="Age"/>
+ <xsd:enumeration value="AgreementToPayDate"/>
+ <xsd:enumeration value="AiredDate"/>
+ <xsd:enumeration value="AllotmentPeriodStart"/>
+ <xsd:enumeration value="AllowableEffective"/>
+ <xsd:enumeration value="AllowedRenewalDurationPeriod"/>
+ <xsd:enumeration value="AlternateBasePeriod"/>
+ <xsd:enumeration value="AlternateProblemResolution"/>
+ <xsd:enumeration value="AlternativeDueDate"/>
+ <xsd:enumeration value="AnalysisMonthEnding"/>
+ <xsd:enumeration value="AnesthesiaAdministration"/>
+ <xsd:enumeration value="Anniversary"/>
+ <xsd:enumeration value="AnnualReportDelinquentOnDate"/>
+ <xsd:enumeration value="AnnualReportDueDate"/>
+ <xsd:enumeration value="AnnualReportFilingDate"/>
+ <xsd:enumeration value="AnnualReportMailingDate"/>
+ <xsd:enumeration value="Annuitization"/>
+ <xsd:enumeration value="AnnuityCommencementDate"/>
+ <xsd:enumeration value="AnticipatedClosing"/>
+ <xsd:enumeration value="AppliancePlacement"/>
+ <xsd:enumeration value="ApplicantSigned"/>
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="ApplicationEntry"/>
+ <xsd:enumeration value="ApplicationLoggedDate"/>
+ <xsd:enumeration value="ApplicationStatus"/>
+ <xsd:enumeration value="AppointmentEffective"/>
+ <xsd:enumeration value="AppointmentExpiryDate"/>
+ <xsd:enumeration value="AppraisalOrdered"/>
+ <xsd:enumeration value="ApprovalOffer"/>
+ <xsd:enumeration value="ApprovalDate"/>
+ <xsd:enumeration value="Arrested"/>
+ <xsd:enumeration value="ArrivalDateTimeAtInitialPort"/>
+ <xsd:enumeration value="ArrivalDateTimeEarliest"/>
+ <xsd:enumeration value="ArrivalDateTimeOfTransportLeadTime"/>
+ <xsd:enumeration value="ArrivalDateTimeScheduled"/>
+ <xsd:enumeration value="ArrivalDateTimeUltimate"/>
+ <xsd:enumeration value="ArrivalInCountry"/>
+ <xsd:enumeration value="ArterialBloodGasTest"/>
+ <xsd:enumeration value="AsOf"/>
+ <xsd:enumeration value="AssemblyStart"/>
+ <xsd:enumeration value="Asset"/>
+ <xsd:enumeration value="AssetAndLiabilityScheduleDate"/>
+ <xsd:enumeration value="AssetDocumentationExpiration"/>
+ <xsd:enumeration value="AssignedDate"/>
+ <xsd:enumeration value="AssignmentRecorded"/>
+ <xsd:enumeration value="AttendanceDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="AudienceDeficiencyPeriod"/>
+ <xsd:enumeration value="AuditPeriodAfterSplitDate"/>
+ <xsd:enumeration value="AuditPeriodPriorToSplitDate"/>
+ <xsd:enumeration value="AuthenticationDateTimeOfDocument"/>
+ <xsd:enumeration value="AuthenticationValidationDateTime"/>
+ <xsd:enumeration value="AuthorizationDate"/>
+ <xsd:enumeration value="AutomaticPremiumLoan"/>
+ <xsd:enumeration value="AvailabilityDueDate"/>
+ <xsd:enumeration value="Availability"/>
+ <xsd:enumeration value="AverageDeliveryDelay"/>
+ <xsd:enumeration value="AveragePaymentPeriod"/>
+ <xsd:enumeration value="Award"/>
+ <xsd:enumeration value="BackOnMarket"/>
+ <xsd:enumeration value="BackOrderDeliveryDateTimePeriod"/>
+ <xsd:enumeration value="BalanceDateTimePeriod"/>
+ <xsd:enumeration value="BalanceSheetDateLatest"/>
+ <xsd:enumeration value="Base"/>
+ <xsd:enumeration value="Baseline"/>
+ <xsd:enumeration value="BaselineComplete"/>
+ <xsd:enumeration value="BaselineStart"/>
+ <xsd:enumeration value="BeforeInventoryIsReplenishedBasedOnStockCheckLeadTime"/>
+ <xsd:enumeration value="BeginningLayDate"/>
+ <xsd:enumeration value="BeginTherapy"/>
+ <xsd:enumeration value="BeneficiarysBanksDueDate"/>
+ <xsd:enumeration value="Benefit"/>
+ <xsd:enumeration value="BenefitAdjustmentEnd"/>
+ <xsd:enumeration value="BenefitAdjustmentPeriod"/>
+ <xsd:enumeration value="BenefitAdjustmentStart"/>
+ <xsd:enumeration value="BenefitApplicationDate"/>
+ <xsd:enumeration value="BenefitBegin"/>
+ <xsd:enumeration value="BenefitChangeDateTime"/>
+ <xsd:enumeration value="BenefitCreditEnd"/>
+ <xsd:enumeration value="BenefitCreditPeriod"/>
+ <xsd:enumeration value="BenefitCreditStart"/>
+ <xsd:enumeration value="BenefitDebitEnd"/>
+ <xsd:enumeration value="BenefitDebitStart"/>
+ <xsd:enumeration value="BenefitEnd"/>
+ <xsd:enumeration value="BenefitPaymentsTerminationDate"/>
+ <xsd:enumeration value="BenefitPeriod"/>
+ <xsd:enumeration value="BenefitReleaseAuthorizationDate"/>
+ <xsd:enumeration value="BenefitsPaid"/>
+ <xsd:enumeration value="BenefitTransferEnd"/>
+ <xsd:enumeration value="BenefitTransferPeriod"/>
+ <xsd:enumeration value="BenefitTransferStart"/>
+ <xsd:enumeration value="BenefitTypeGrossWeeklyAmountEffective"/>
+ <xsd:enumeration value="BenefitTypeNetWeeklyAmountEffective"/>
+ <xsd:enumeration value="BenefitPeriodEndDate"/>
+ <xsd:enumeration value="BenefitPeriodStartDate"/>
+ <xsd:enumeration value="BestBeforeDate"/>
+ <xsd:enumeration value="BestTimeToCall"/>
+ <xsd:enumeration value="BiannualTerminalInspectionDate"/>
+ <xsd:enumeration value="BidEffective"/>
+ <xsd:enumeration value="BidOpenDateBidsWillBeOpened"/>
+ <xsd:enumeration value="BidPriceException"/>
+ <xsd:enumeration value="Bill"/>
+ <xsd:enumeration value="BilledThrough"/>
+ <xsd:enumeration value="BillOfLadingDate"/>
+ <xsd:enumeration value="BirthCertificate"/>
+ <xsd:enumeration value="BirthDateTime"/>
+ <xsd:enumeration value="BlanksValueDate"/>
+ <xsd:enumeration value="Blueprint"/>
+ <xsd:enumeration value="BoardOfDirectorsIncompleteAsOf"/>
+ <xsd:enumeration value="BoardOfDirectorsNotAuthorizedAsOfGivenDate"/>
+ <xsd:enumeration value="BoardOfDirectorsNotCompleteAsOfGivenDate"/>
+ <xsd:enumeration value="BoardOfDirectorsRegistrationDate"/>
+ <xsd:enumeration value="BookEntryDelivery"/>
+ <xsd:enumeration value="BookingDateTime"/>
+ <xsd:enumeration value="BritishThermalUnitTestPerformed"/>
+ <xsd:enumeration value="BudgetLineApplicationDate"/>
+ <xsd:enumeration value="BusinessControlChangeDate"/>
+ <xsd:enumeration value="BusinessOpenedDate"/>
+ <xsd:enumeration value="BusinessTerminationDate"/>
+ <xsd:enumeration value="BuyersDock"/>
+ <xsd:enumeration value="BuyersLocalTime"/>
+ <xsd:enumeration value="CalculationDate"/>
+ <xsd:enumeration value="CalendarAnniversary"/>
+ <xsd:enumeration value="CalendarYear"/>
+ <xsd:enumeration value="CancelAfter"/>
+ <xsd:enumeration value="CancelAfterExCountry"/>
+ <xsd:enumeration value="CancelAfterExFactory"/>
+ <xsd:enumeration value="CancelIfNotDeliveredByThisDate"/>
+ <xsd:enumeration value="CancelIfNotPublishedByThisDate"/>
+ <xsd:enumeration value="CancelIfNotShippedByThisDate"/>
+ <xsd:enumeration value="CancellationDate"/>
+ <xsd:enumeration value="CancellationDateTimeLatest"/>
+ <xsd:enumeration value="CapitalizationDate"/>
+ <xsd:enumeration value="CapitationPeriodEnd"/>
+ <xsd:enumeration value="CapitationPeriodStart"/>
+ <xsd:enumeration value="CargoBookingConfirmedDateTime"/>
+ <xsd:enumeration value="CargoReleaseDateTimeUltimate"/>
+ <xsd:enumeration value="CaseConverted"/>
+ <xsd:enumeration value="CaseReopened"/>
+ <xsd:enumeration value="CashCallDate"/>
+ <xsd:enumeration value="CategoryChangeDateTime"/>
+ <xsd:enumeration value="CeasedOperations"/>
+ <xsd:enumeration value="CertificateEffective"/>
+ <xsd:enumeration value="Certification"/>
+ <xsd:enumeration value="CertificationOfWeightDateTime"/>
+ <xsd:enumeration value="CertificationPeriodStart"/>
+ <xsd:enumeration value="CertificationRevision"/>
+ <xsd:enumeration value="ChangedAccountingDate"/>
+ <xsd:enumeration value="ChangedDate"/>
+ <xsd:enumeration value="ChargeBackDateTime"/>
+ <xsd:enumeration value="ChargePeriod"/>
+ <xsd:enumeration value="ChargePeriodEndDate"/>
+ <xsd:enumeration value="ChargePeriodStartDate"/>
+ <xsd:enumeration value="ChartOfAccountPeriod"/>
+ <xsd:enumeration value="Check"/>
+ <xsd:enumeration value="CheckedDate"/>
+ <xsd:enumeration value="ChildbirthDateAndOrTimeActual"/>
+ <xsd:enumeration value="ChildbirthDateEstimated"/>
+ <xsd:enumeration value="Christening"/>
+ <xsd:enumeration value="Citation"/>
+ <xsd:enumeration value="CitizenshipChangeDate"/>
+ <xsd:enumeration value="ClaimAdministratorKnowledgeOfTheInjury"/>
+ <xsd:enumeration value="ClaimAdministratorNotifiedOfEmployeeLegalRepresentation"/>
+ <xsd:enumeration value="ClaimIncurredDate"/>
+ <xsd:enumeration value="ClaimMadeDate"/>
+ <xsd:enumeration value="ClaimNotificationReceived"/>
+ <xsd:enumeration value="ClaimsMade"/>
+ <xsd:enumeration value="ClaimStatementPeriodEnd"/>
+ <xsd:enumeration value="ClaimStatementPeriodStart"/>
+ <xsd:enumeration value="Clause"/>
+ <xsd:enumeration value="ClearanceDateCustoms"/>
+ <xsd:enumeration value="ClinicalExaminationDateAndOrTime"/>
+ <xsd:enumeration value="Closed"/>
+ <xsd:enumeration value="ClosedUntilDate"/>
+ <xsd:enumeration value="ClosingDateOfFirstBalanceSheet"/>
+ <xsd:enumeration value="ClosingDateTime"/>
+ <xsd:enumeration value="ClosureDateTimePeriod"/>
+ <xsd:enumeration value="CollateralDependent"/>
+ <xsd:enumeration value="CollateralDependentBegin"/>
+ <xsd:enumeration value="CollateralDependentEnd"/>
+ <xsd:enumeration value="Collection"/>
+ <xsd:enumeration value="CollectionDateTimeEarliest"/>
+ <xsd:enumeration value="CollectionDateTimeLatest"/>
+ <xsd:enumeration value="CommencedPumpingBallastDateTime"/>
+ <xsd:enumeration value="CommencedTankCleaningDateTime"/>
+ <xsd:enumeration value="CommercialRating"/>
+ <xsd:enumeration value="CompanyTermination"/>
+ <xsd:enumeration value="ComparisonPeriod"/>
+ <xsd:enumeration value="CompilationDateAndTime"/>
+ <xsd:enumeration value="Complaint"/>
+ <xsd:enumeration value="CompletedPumpingBallastDateTime"/>
+ <xsd:enumeration value="CompletedTankCleaningDateTime"/>
+ <xsd:enumeration value="CompletionDate"/>
+ <xsd:enumeration value="CompletionDateOrTimeNotAfter"/>
+ <xsd:enumeration value="CompletionDateOrTimeNotBefore"/>
+ <xsd:enumeration value="CompletionDateOrTimeScheduled"/>
+ <xsd:enumeration value="Compliance"/>
+ <xsd:enumeration value="ConditionInitialTreatmentDate"/>
+ <xsd:enumeration value="Confinement"/>
+ <xsd:enumeration value="ConfinementEnd"/>
+ <xsd:enumeration value="ConfinementStart"/>
+ <xsd:enumeration value="ConfirmationDateLeadTime"/>
+ <xsd:enumeration value="ConfirmedDateTime"/>
+ <xsd:enumeration value="Connection"/>
+ <xsd:enumeration value="Consolidated"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRA"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRABegin"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRAEnd"/>
+ <xsd:enumeration value="ConsolidatedOmnibusBudgetReconciliationActCOBRAQualifyingEvent"/>
+ <xsd:enumeration value="ConsolidationDate"/>
+ <xsd:enumeration value="ConstructionDateActual"/>
+ <xsd:enumeration value="ConstructionStart"/>
+ <xsd:enumeration value="ContainerSafetyConventionCscInspectionDate"/>
+ <xsd:enumeration value="ContainerSafetyConventionCscPlateExpirationDate"/>
+ <xsd:enumeration value="ContainerStrippingDateTimeUltimate"/>
+ <xsd:enumeration value="ContainerStuffingDateTimeUltimate"/>
+ <xsd:enumeration value="Contestability"/>
+ <xsd:enumeration value="Contingency"/>
+ <xsd:enumeration value="ContingencyEnd"/>
+ <xsd:enumeration value="Continuance"/>
+ <xsd:enumeration value="ContinuationOfPayStartDate"/>
+ <xsd:enumeration value="ContinuingEducationRequirement"/>
+ <xsd:enumeration value="ContinuousCoverageDates"/>
+ <xsd:enumeration value="ContinuousPassiveMotionCPM"/>
+ <xsd:enumeration value="ContractAuditDate"/>
+ <xsd:enumeration value="ContractAwardDateTime"/>
+ <xsd:enumeration value="ContractBindingDate"/>
+ <xsd:enumeration value="ContractCompletionDate"/>
+ <xsd:enumeration value="ContractCostsThrough"/>
+ <xsd:enumeration value="ContractDate"/>
+ <xsd:enumeration value="ContractDefinition"/>
+ <xsd:enumeration value="ContractEffectiveDate"/>
+ <xsd:enumeration value="ContractExpiryDate"/>
+ <xsd:enumeration value="ContractMailed"/>
+ <xsd:enumeration value="ContractPerformanceDelivery"/>
+ <xsd:enumeration value="ContractPerformanceStart"/>
+ <xsd:enumeration value="ContractPeriod"/>
+ <xsd:enumeration value="ContractRe-Open"/>
+ <xsd:enumeration value="ContractStart"/>
+ <xsd:enumeration value="ContractualDeliveryDate"/>
+ <xsd:enumeration value="ContractualStartDateTime"/>
+ <xsd:enumeration value="ContributionPeriodEndDateTime"/>
+ <xsd:enumeration value="ContributionPeriodStartDateTime"/>
+ <xsd:enumeration value="ContributionsCeasingDateTime"/>
+ <xsd:enumeration value="ControlPlan"/>
+ <xsd:enumeration value="ControvertDate"/>
+ <xsd:enumeration value="ConversionPrivilegeEnd"/>
+ <xsd:enumeration value="ConversionToRepayment"/>
+ <xsd:enumeration value="ConversionIntoHoldingCompanyDate"/>
+ <xsd:enumeration value="ConvertedToElectronicDate"/>
+ <xsd:enumeration value="ConveyanceRegistrationDate"/>
+ <xsd:enumeration value="ConvictedDate"/>
+ <xsd:enumeration value="CoordinationOfBenefits"/>
+ <xsd:enumeration value="CoordinationOfBenefitsBegin"/>
+ <xsd:enumeration value="CoordinationOfBenefitsEnd"/>
+ <xsd:enumeration value="CorrectedDateOfBirth"/>
+ <xsd:enumeration value="Correction"/>
+ <xsd:enumeration value="CosignerSigned"/>
+ <xsd:enumeration value="CourtDismissalDate"/>
+ <xsd:enumeration value="CourtEvent"/>
+ <xsd:enumeration value="CourtNotice"/>
+ <xsd:enumeration value="CourtRegistrationDate"/>
+ <xsd:enumeration value="CoverageDuration"/>
+ <xsd:enumeration value="CoverageIssueDate"/>
+ <xsd:enumeration value="CoveredIncomePeriod"/>
+ <xsd:enumeration value="CreditAdvice"/>
+ <xsd:enumeration value="CreditDocumentationExpiration"/>
+ <xsd:enumeration value="CreditedService"/>
+ <xsd:enumeration value="CreditedServiceBegin"/>
+ <xsd:enumeration value="CreditedServiceEnd"/>
+ <xsd:enumeration value="CreditorsRequestedValueDate"/>
+ <xsd:enumeration value="Crime"/>
+ <xsd:enumeration value="CriminalSentenceDuration"/>
+ <xsd:enumeration value="CrossborderDateTime"/>
+ <xsd:enumeration value="CumulativeQuantityEndDate"/>
+ <xsd:enumeration value="CumulativeQuantityStartDate"/>
+ <xsd:enumeration value="CureTime"/>
+ <xsd:enumeration value="Current"/>
+ <xsd:enumeration value="CurrentAuthorityControlStartDate"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodEnd"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodLastDayWorked"/>
+ <xsd:enumeration value="CurrentDisabilityPeriodStart"/>
+ <xsd:enumeration value="CurrentIncomePeriod"/>
+ <xsd:enumeration value="CurrentLegalStructureEffectiveDate"/>
+ <xsd:enumeration value="CurrentList"/>
+ <xsd:enumeration value="CurrentMonthEnding"/>
+ <xsd:enumeration value="CurrentNameEffectiveDate"/>
+ <xsd:enumeration value="CurrentReportDate"/>
+ <xsd:enumeration value="CurrentScheduleDelivery"/>
+ <xsd:enumeration value="CurrentScheduleShip"/>
+ <xsd:enumeration value="CurtailmentDate"/>
+ <xsd:enumeration value="CurtailmentDatefromAdviceOfPayment"/>
+ <xsd:enumeration value="CustomerContractEffective"/>
+ <xsd:enumeration value="CustomerContractExpiration"/>
+ <xsd:enumeration value="CustomerOrder"/>
+ <xsd:enumeration value="CustomerValueDate"/>
+ <xsd:enumeration value="CustomsCargoRelease"/>
+ <xsd:enumeration value="CustomsClearance"/>
+ <xsd:enumeration value="CustomsEntryDate"/>
+ <xsd:enumeration value="Cycle"/>
+ <xsd:enumeration value="CycleBegin"/>
+ <xsd:enumeration value="CycleEnd"/>
+ <xsd:enumeration value="CycleToDate"/>
+ <xsd:enumeration value="DateAccountMatures"/>
+ <xsd:enumeration value="DateAcquired"/>
+ <xsd:enumeration value="DateAndOrTimeOfHandlingEstimated"/>
+ <xsd:enumeration value="DateAsAt"/>
+ <xsd:enumeration value="DateAssignmentFiledForRecord"/>
+ <xsd:enumeration value="BankruptcyFiledDate"/>
+ <xsd:enumeration value="DateBecameAware"/>
+ <xsd:enumeration value="DateClaimPaid"/>
+ <xsd:enumeration value="DateCourseOfOrthodonticsTreatmentBeganOrIsExpectedToBegin"/>
+ <xsd:enumeration value="DateDeedFiledForRecord"/>
+ <xsd:enumeration value="DateDefaultWasCured"/>
+ <xsd:enumeration value="DateDocumentationOrPaperworkOrBothWasSent"/>
+ <xsd:enumeration value="FiledDate"/>
+ <xsd:enumeration value="DateForeclosureHeld"/>
+ <xsd:enumeration value="DateForeclosureProceedingsInstituted"/>
+ <xsd:enumeration value="DateForeclosureSaleScheduled"/>
+ <xsd:enumeration value="DateForTheLastUpdate"/>
+ <xsd:enumeration value="DateHazardInsurancePolicyCancelled"/>
+ <xsd:enumeration value="DateHazardInsurancePolicyRefused"/>
+ <xsd:enumeration value="DateMaterialUsageSuspended"/>
+ <xsd:enumeration value="DateOfAbandonment"/>
+ <xsd:enumeration value="DateOfAcquisitionOfTitle"/>
+ <xsd:enumeration value="DateOfAction"/>
+ <xsd:enumeration value="DateOfAdvance"/>
+ <xsd:enumeration value="DateOfAppraisal"/>
+ <xsd:enumeration value="DateOfAssignmentApproval"/>
+ <xsd:enumeration value="DateOfAssignmentRejection"/>
+ <xsd:enumeration value="DateOfClaim"/>
+ <xsd:enumeration value="DateOfClosing"/>
+ <xsd:enumeration value="DateOfDamage"/>
+ <xsd:enumeration value="DeceaseDate"/>
+ <xsd:enumeration value="DateOfDeedInLieu"/>
+ <xsd:enumeration value="DateOfDivorce"/>
+ <xsd:enumeration value="DateOfExtensionToConvey"/>
+ <xsd:enumeration value="DateOfFirmCommitment"/>
+ <xsd:enumeration value="DateOfFirstMortgagePayment"/>
+ <xsd:enumeration value="DateOfFirstRegistration"/>
+ <xsd:enumeration value="DateOfFirstUncuredDefault"/>
+ <xsd:enumeration value="DateOfForeclosureNotice"/>
+ <xsd:enumeration value="DateOfLastContact"/>
+ <xsd:enumeration value="DateOfLastDraw"/>
+ <xsd:enumeration value="DateOfLastInstallmentReceived"/>
+ <xsd:enumeration value="DateOfLastPaymentReceived"/>
+ <xsd:enumeration value="DateOfLastUpdate"/>
+ <xsd:enumeration value="DateOfLoan"/>
+ <xsd:enumeration value="DateOfLocalOfficeApprovalOfConveyanceOfDamagedRealEstateProperty"/>
+ <xsd:enumeration value="DateOfLocalOfficeApprovalOfConveyanceOfOccupied"/>
+ <xsd:enumeration value="DateOfLocalOfficeCertificationOfConveyanceOfDamagedRealEstate"/>
+ <xsd:enumeration value="DateOfMaximumMedicalImprovement"/>
+ <xsd:enumeration value="DateOfNoticeOfProbableIneligibilityForAssignment"/>
+ <xsd:enumeration value="DateOfNoticeOfReferralForAssignment"/>
+ <xsd:enumeration value="DateOfNoticeToConvey"/>
+ <xsd:enumeration value="DateOfOperation"/>
+ <xsd:enumeration value="DateOfOrderLeadTime"/>
+ <xsd:enumeration value="DateOfPossession"/>
+ <xsd:enumeration value="DateOfProductFailure"/>
+ <xsd:enumeration value="DateOfPropertyInspection"/>
+ <xsd:enumeration value="ReleaseFromBankruptcyDate"/>
+ <xsd:enumeration value="DateOfRepairOrService"/>
+ <xsd:enumeration value="DateOfSeizure"/>
+ <xsd:enumeration value="DateOfSeparation"/>
+ <xsd:enumeration value="DateOfSourceDocument"/>
+ <xsd:enumeration value="DateOfSpecification"/>
+ <xsd:enumeration value="DateOfStandard"/>
+ <xsd:enumeration value="DateOnWhichAssetsJudgedInsufficientToPayCreditors"/>
+ <xsd:enumeration value="DateOutstandingLoanBalanceReported"/>
+ <xsd:enumeration value="PackagingDate"/>
+ <xsd:enumeration value="DatePaid"/>
+ <xsd:enumeration value="DatePlacedInDisfavour"/>
+ <xsd:enumeration value="DatePossessoryActionInitiated"/>
+ <xsd:enumeration value="DatePracticeCeased"/>
+ <xsd:enumeration value="DatePracticeEstablished"/>
+ <xsd:enumeration value="DatePropertySold"/>
+ <xsd:enumeration value="DateReadyForCollection"/>
+ <xsd:enumeration value="DateRedemptionPeriodEnds"/>
+ <xsd:enumeration value="DateReferredToAttorneyForForeclosure"/>
+ <xsd:enumeration value="RequestDate"/>
+ <xsd:enumeration value="DateThroughWhichPropertyTaxesHaveBeenPaid"/>
+ <xsd:enumeration value="DateTimeOfDiscountTermination"/>
+ <xsd:enumeration value="DateTimeOfInterestDue"/>
+ <xsd:enumeration value="DateTimeOfLatestAccountsFilingAtPublicRegistry"/>
+ <xsd:enumeration value="DateTotalAmountOfDelinquencyReported"/>
+ <xsd:enumeration value="DateVoluntaryConveyanceAccepted"/>
+ <xsd:enumeration value="DateWhenContainerEquipmentBecomesDomestic"/>
+ <xsd:enumeration value="DaylightOverdraftTime"/>
+ <xsd:enumeration value="DaysOfOperation"/>
+ <xsd:enumeration value="DeathDateAndOrTime"/>
+ <xsd:enumeration value="DebitAdvice"/>
+ <xsd:enumeration value="DebitValueDateRequested"/>
+ <xsd:enumeration value="DebtIncurred"/>
+ <xsd:enumeration value="DecisionDate"/>
+ <xsd:enumeration value="Declaration"/>
+ <xsd:enumeration value="DeclarationPresentationDate"/>
+ <xsd:enumeration value="DeclarationReferencePeriod"/>
+ <xsd:enumeration value="Deductible"/>
+ <xsd:enumeration value="DeedNotAvailableAsOfGivenDate"/>
+ <xsd:enumeration value="Deferral"/>
+ <xsd:enumeration value="DeferredDistribution"/>
+ <xsd:enumeration value="DeferredPayment"/>
+ <xsd:enumeration value="DeferredPeriod"/>
+ <xsd:enumeration value="DefinitionOfDisabilityDuration"/>
+ <xsd:enumeration value="DelayedBillingNotDelayedPayment"/>
+ <xsd:enumeration value="DeletionDate"/>
+ <xsd:enumeration value="Delivered"/>
+ <xsd:enumeration value="DeliverNotBeforeAndNotAfterDates"/>
+ <xsd:enumeration value="DeliveryAppointmentDateAndTime"/>
+ <xsd:enumeration value="DeliveryDateTime1StSchedule"/>
+ <xsd:enumeration value="DeliveryDateTimeActual"/>
+ <xsd:enumeration value="DeliveryDateTimeCurrentSchedule"/>
+ <xsd:enumeration value="DeliveryDateTimeDeferred"/>
+ <xsd:enumeration value="DeliveryDateTimeEarliest"/>
+ <xsd:enumeration value="DeliveryDateTimeExpected"/>
+ <xsd:enumeration value="DeliveryDateTimeFirst"/>
+ <xsd:enumeration value="DeliveryDateTimeLast"/>
+ <xsd:enumeration value="DeliveryDateTimeLatest"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedFor"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedForAfterAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimePromisedForPriorToAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimeRequested"/>
+ <xsd:enumeration value="DeliveryDateTimeScheduledFor"/>
+ <xsd:enumeration value="DeliveryEnd"/>
+ <xsd:enumeration value="DeliveryOrderIssued"/>
+ <xsd:enumeration value="DeliveryRating"/>
+ <xsd:enumeration value="DeliveryRequested"/>
+ <xsd:enumeration value="DeliveryStart"/>
+ <xsd:enumeration value="DeliveryTicket"/>
+ <xsd:enumeration value="DenialEffective"/>
+ <xsd:enumeration value="DenialRescission"/>
+ <xsd:enumeration value="DepartmentAdmissionDateAndOrTime"/>
+ <xsd:enumeration value="DepartmentDischargeDateAndOrTime"/>
+ <xsd:enumeration value="DepartmentOfLaborWageDeterminationDate"/>
+ <xsd:enumeration value="DepartureDateTime"/>
+ <xsd:enumeration value="DepartureDateTimeEarliest"/>
+ <xsd:enumeration value="DepartureDateTimeFromLastPortOfCall"/>
+ <xsd:enumeration value="DepartureDateTimeScheduled"/>
+ <xsd:enumeration value="DepartureDateTimeUltimate"/>
+ <xsd:enumeration value="DepartureFromSpecification"/>
+ <xsd:enumeration value="DepositDateTime"/>
+ <xsd:enumeration value="DespatchDateAndOrTime"/>
+ <xsd:enumeration value="DespatchNoteDate"/>
+ <xsd:enumeration value="DetrimentalInformationReceiptDate"/>
+ <xsd:enumeration value="DirectInterchangeDate"/>
+ <xsd:enumeration value="Disability"/>
+ <xsd:enumeration value="DisabilityWaitPeriod"/>
+ <xsd:enumeration value="DisbursementDate"/>
+ <xsd:enumeration value="DischargeDateTime"/>
+ <xsd:enumeration value="DischargeAndLoadingCompletedDateTime"/>
+ <xsd:enumeration value="Discharge-Planned"/>
+ <xsd:enumeration value="Discovered"/>
+ <xsd:enumeration value="DiscrepancyDateTime"/>
+ <xsd:enumeration value="DisembarkationDateAndTime"/>
+ <xsd:enumeration value="DismissalDate"/>
+ <xsd:enumeration value="Disposal"/>
+ <xsd:enumeration value="Disposition"/>
+ <xsd:enumeration value="DistributorEffective"/>
+ <xsd:enumeration value="DistributorTermination"/>
+ <xsd:enumeration value="DividendApplied"/>
+ <xsd:enumeration value="DocumentaryCreditAmendmentDate"/>
+ <xsd:enumeration value="DocumentaryCreditExpiryDateTime"/>
+ <xsd:enumeration value="DocumentaryCreditIssueDate"/>
+ <xsd:enumeration value="DocumentaryCreditPresentationPeriod"/>
+ <xsd:enumeration value="DocumentDate"/>
+ <xsd:enumeration value="DocumentDue"/>
+ <xsd:enumeration value="DocumentMessageDateTime"/>
+ <xsd:enumeration value="DocumentReceivedDateTime"/>
+ <xsd:enumeration value="DocumentRequestedDateTime"/>
+ <xsd:enumeration value="DoNotDeliverAfter"/>
+ <xsd:enumeration value="DoNotDeliverBefore"/>
+ <xsd:enumeration value="DoNotShipBeforeExCountry"/>
+ <xsd:enumeration value="DoNotShipBeforeExFactory"/>
+ <xsd:enumeration value="Draft"/>
+ <xsd:enumeration value="DrawingRevisionDate"/>
+ <xsd:enumeration value="DropActionDate"/>
+ <xsd:enumeration value="DroppedToLessThanHalfTime"/>
+ <xsd:enumeration value="DueDate"/>
+ <xsd:enumeration value="DueDateLastCompleteInstallmentPaid"/>
+ <xsd:enumeration value="DueDateOfFirstPaymentToPrincipalAndInterest"/>
+ <xsd:enumeration value="DueToCustomer"/>
+ <xsd:enumeration value="DuplicateBill"/>
+ <xsd:enumeration value="Duration"/>
+ <xsd:enumeration value="EarliestFilingPeriod"/>
+ <xsd:enumeration value="EarliestSaleDate"/>
+ <xsd:enumeration value="EarlyFinish"/>
+ <xsd:enumeration value="EarlyStart"/>
+ <xsd:enumeration value="EarlyWithdrawal"/>
+ <xsd:enumeration value="EarningsEffectiveDate"/>
+ <xsd:enumeration value="Education"/>
+ <xsd:enumeration value="EducationBegin"/>
+ <xsd:enumeration value="EducationEndDate"/>
+ <xsd:enumeration value="EducationStartDate"/>
+ <xsd:enumeration value="EffectiveDateTime"/>
+ <xsd:enumeration value="EffectiveDateOfChange"/>
+ <xsd:enumeration value="Election"/>
+ <xsd:enumeration value="Eligibility"/>
+ <xsd:enumeration value="EligibilityBegin"/>
+ <xsd:enumeration value="EligibilityEnd"/>
+ <xsd:enumeration value="EmbarkationDateAndTime"/>
+ <xsd:enumeration value="EmployedInThisPosition"/>
+ <xsd:enumeration value="EmployedInThisProfession"/>
+ <xsd:enumeration value="EmployeeEffectiveDateOfCoverage"/>
+ <xsd:enumeration value="EmployeeLaidOff"/>
+ <xsd:enumeration value="EmployeeTemporaryLaidOffPeriodStartDate"/>
+ <xsd:enumeration value="EmployeeTemporaryLaidOffPeriodEndDate"/>
+ <xsd:enumeration value="EmployeeWagesCeased"/>
+ <xsd:enumeration value="EmployerKnowledgeOfTheInjury"/>
+ <xsd:enumeration value="EmployerReportedInjuryToClaimAdministrator"/>
+ <xsd:enumeration value="EmploymentPositionStartDate"/>
+ <xsd:enumeration value="EmploymentEnd"/>
+ <xsd:enumeration value="EmploymentOrHire"/>
+ <xsd:enumeration value="EmploymentPositionStartDateEstimated"/>
+ <xsd:enumeration value="EmploymentProfessionStartDate"/>
+ <xsd:enumeration value="EndDateTime"/>
+ <xsd:enumeration value="EndAvailabilityDate"/>
+ <xsd:enumeration value="EndDateOfSupport"/>
+ <xsd:enumeration value="EndDateScheduled"/>
+ <xsd:enumeration value="EndingLayDate"/>
+ <xsd:enumeration value="EndOfGrace"/>
+ <xsd:enumeration value="EndOfLastFiscalYear"/>
+ <xsd:enumeration value="EndorsedCertificateIssueDate"/>
+ <xsd:enumeration value="EndorsementDate"/>
+ <xsd:enumeration value="EngineeringChangeLevelDate"/>
+ <xsd:enumeration value="EngineeringDataList"/>
+ <xsd:enumeration value="Enrollment"/>
+ <xsd:enumeration value="EnrollmentSignatureDate"/>
+ <xsd:enumeration value="EntryDate"/>
+ <xsd:enumeration value="EntryDateEstimatedCustoms"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimeActual"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimeEarliest"/>
+ <xsd:enumeration value="EquipmentCollectionOrPickUpDateTimePlanned"/>
+ <xsd:enumeration value="EquipmentLogEntry"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeActual"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeEstimated"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeRequested"/>
+ <xsd:enumeration value="EquipmentPositioningDateTimeUltimate"/>
+ <xsd:enumeration value="EquipmentPreTripDate"/>
+ <xsd:enumeration value="EquipmentReconditioningDateTimeActual"/>
+ <xsd:enumeration value="EquipmentRepairReadyDateTimeUltimate"/>
+ <xsd:enumeration value="EquipmentReturnPeriodExpected"/>
+ <xsd:enumeration value="EquipmentStockCheckDateTime"/>
+ <xsd:enumeration value="EscalationDate"/>
+ <xsd:enumeration value="EscalationStartDate"/>
+ <xsd:enumeration value="EstablishedDate"/>
+ <xsd:enumeration value="EstimateComment"/>
+ <xsd:enumeration value="Estimated"/>
+ <xsd:enumeration value="EstimatedAcceptanceDate"/>
+ <xsd:enumeration value="ArrivalDateTimeEstimated"/>
+ <xsd:enumeration value="CompletionDateOrTimeEstimated"/>
+ <xsd:enumeration value="EstimatedCompletion-FirstPriorMonth"/>
+ <xsd:enumeration value="EstimatedCompletion-SecondPriorMonth"/>
+ <xsd:enumeration value="EstimatedCompletion-ThirdPriorMonth"/>
+ <xsd:enumeration value="ConstructionDateEstimated"/>
+ <xsd:enumeration value="DateOfBirthEstimated"/>
+ <xsd:enumeration value="DeliveryDateTimeEstimated"/>
+ <xsd:enumeration value="DepartureDateTimeEstimated"/>
+ <xsd:enumeration value="EstimatedEscrowClosing"/>
+ <xsd:enumeration value="EstimatedImmigrationDate"/>
+ <xsd:enumeration value="EstimatedPointOfArrival"/>
+ <xsd:enumeration value="EstimatedPointOfDischarge"/>
+ <xsd:enumeration value="EstimatedPortOfEntry"/>
+ <xsd:enumeration value="StartDateEstimated"/>
+ <xsd:enumeration value="EstimatedStart-FirstPriorMonth"/>
+ <xsd:enumeration value="EstimatedStart-SecondPriorMonth"/>
+ <xsd:enumeration value="EstimatedStart-ThirdPriorMonth"/>
+ <xsd:enumeration value="EstimatePreparation"/>
+ <xsd:enumeration value="EvaluationDate"/>
+ <xsd:enumeration value="EventDate"/>
+ <xsd:enumeration value="Examination"/>
+ <xsd:enumeration value="ExecutionDate"/>
+ <xsd:enumeration value="ExecutionDateTimeRequested"/>
+ <xsd:enumeration value="ExitPlantDate"/>
+ <xsd:enumeration value="ExpectedContainerHireFromDateTime"/>
+ <xsd:enumeration value="ExpectedFundingDate"/>
+ <xsd:enumeration value="ExpectedProblemResolutionDate"/>
+ <xsd:enumeration value="ExpectedReply"/>
+ <xsd:enumeration value="ExpectedValueDate"/>
+ <xsd:enumeration value="ExpeditedOn"/>
+ <xsd:enumeration value="Expiration"/>
+ <xsd:enumeration value="ExpirationDateOfExtensionToAssign"/>
+ <xsd:enumeration value="ExpirationDateOfExtensiontoForeclose"/>
+ <xsd:enumeration value="ExpirationDateTimeOfCustomsDocument"/>
+ <xsd:enumeration value="ExpirationDateToSubmitTitleEvidence"/>
+ <xsd:enumeration value="ExpirationOfExtensionToConvey"/>
+ <xsd:enumeration value="ExpirationOfExtensionToSubmitFiscalData"/>
+ <xsd:enumeration value="ExpirationOfForeclosureTimeframe"/>
+ <xsd:enumeration value="ExpiryDate"/>
+ <xsd:enumeration value="ExpiryDateOfExportLicence"/>
+ <xsd:enumeration value="ExpiryDateOfImportLicence"/>
+ <xsd:enumeration value="Explantation"/>
+ <xsd:enumeration value="ExportationDate"/>
+ <xsd:enumeration value="ExportationDateForTextiles"/>
+ <xsd:enumeration value="Exposure"/>
+ <xsd:enumeration value="ExposureSourcePeriod"/>
+ <xsd:enumeration value="Extended"/>
+ <xsd:enumeration value="Extract"/>
+ <xsd:enumeration value="FacsimileDueBy"/>
+ <xsd:enumeration value="Failed"/>
+ <xsd:enumeration value="FailureModeEffective"/>
+ <xsd:enumeration value="FeasibilitySignOff"/>
+ <xsd:enumeration value="FederalHighwayAdministrationFhwaInspectionDate"/>
+ <xsd:enumeration value="FeeCapitalization"/>
+ <xsd:enumeration value="FieldFailure"/>
+ <xsd:enumeration value="FieldTest"/>
+ <xsd:enumeration value="FileGenerationDateAndOrTime"/>
+ <xsd:enumeration value="FilingPeriod"/>
+ <xsd:enumeration value="FinalIssue"/>
+ <xsd:enumeration value="FinalReconciliationValueEstimateAsOf"/>
+ <xsd:enumeration value="FinalScheduledPayment"/>
+ <xsd:enumeration value="FinancialCoveragePeriod"/>
+ <xsd:enumeration value="FinancialInformationDate"/>
+ <xsd:enumeration value="FinancialInformationSubmissionDateTime"/>
+ <xsd:enumeration value="FinishDateOrTimeMandatory"/>
+ <xsd:enumeration value="FinishDateOrTimeEarliest"/>
+ <xsd:enumeration value="FinishDateOrTimeLatest"/>
+ <xsd:enumeration value="FirstContact"/>
+ <xsd:enumeration value="FirstDateOfOrdering"/>
+ <xsd:enumeration value="FirstInterestBearingDate"/>
+ <xsd:enumeration value="FirstInterestPaymentDue"/>
+ <xsd:enumeration value="FirstInvolvement"/>
+ <xsd:enumeration value="FirstIssue"/>
+ <xsd:enumeration value="FirstMarketed"/>
+ <xsd:enumeration value="FirstPaymentChange"/>
+ <xsd:enumeration value="FirstPaymentDue"/>
+ <xsd:enumeration value="FirstProduced"/>
+ <xsd:enumeration value="FirstPublishedDate"/>
+ <xsd:enumeration value="FirstRateAdjustment"/>
+ <xsd:enumeration value="FirstSaleDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="FirstSubmission"/>
+ <xsd:enumeration value="FirstVisitorConsultation"/>
+ <xsd:enumeration value="FiscalAnniversary"/>
+ <xsd:enumeration value="FlatExtraEnd"/>
+ <xsd:enumeration value="FlatExtraPeriod"/>
+ <xsd:enumeration value="ForecastPeriod"/>
+ <xsd:enumeration value="ForecastPeriodEndDate"/>
+ <xsd:enumeration value="ForecastPeriodStart"/>
+ <xsd:enumeration value="Formation"/>
+ <xsd:enumeration value="FreightBillDateTime"/>
+ <xsd:enumeration value="FromDateOfAwardToCompletion"/>
+ <xsd:enumeration value="FromDateOfAwardToDelivery"/>
+ <xsd:enumeration value="FromDateOfAwardToEarliestDelivery"/>
+ <xsd:enumeration value="FromDateOfAwardToLatestDelivery"/>
+ <xsd:enumeration value="FromDateOfNoticeToProceedToCommencementOf"/>
+ <xsd:enumeration value="FromDateOfNoticeToProceedToCompletion"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToDelivery"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToSampleReady"/>
+ <xsd:enumeration value="FromDateOfOrderReceiptToShipment"/>
+ <xsd:enumeration value="FromDateOfReceiptOfItemToApproval"/>
+ <xsd:enumeration value="FromDateOfReceiptOfToolingAidsToSampleReady"/>
+ <xsd:enumeration value="FromDateOfSampleApprovalToFirstProductShipment"/>
+ <xsd:enumeration value="FromDateOfToolingAuthorizationToSampleReady"/>
+ <xsd:enumeration value="FromLastBookedOrderToDelivery"/>
+ <xsd:enumeration value="FumigationDateAndOrTime"/>
+ <xsd:enumeration value="FunctionalTest"/>
+ <xsd:enumeration value="FundsAppropriation-End"/>
+ <xsd:enumeration value="FundsAppropriation-Start"/>
+ <xsd:enumeration value="FuturePeriod"/>
+ <xsd:enumeration value="GallonsPerMinuteTestPerformed"/>
+ <xsd:enumeration value="GoodsCollectionOrPickUpDateTimePlanned"/>
+ <xsd:enumeration value="GoodsPositioningDateTimeExpected"/>
+ <xsd:enumeration value="GoodsPositioningDateTimePlanned"/>
+ <xsd:enumeration value="GoodsReceiptDateTime"/>
+ <xsd:enumeration value="GraduationDate"/>
+ <xsd:enumeration value="GroupContractEffective"/>
+ <xsd:enumeration value="GroupContractExpiration"/>
+ <xsd:enumeration value="GuaranteeDate"/>
+ <xsd:enumeration value="GuaranteePeriod"/>
+ <xsd:enumeration value="GuarantorReceived"/>
+ <xsd:enumeration value="HandOverDateTimeActual"/>
+ <xsd:enumeration value="HandOverDateTimePlanned"/>
+ <xsd:enumeration value="HighCapitalYear"/>
+ <xsd:enumeration value="HighFabricationReleaseAuthorization"/>
+ <xsd:enumeration value="HighRawMaterialAuthorization"/>
+ <xsd:enumeration value="HiredFromDate"/>
+ <xsd:enumeration value="HiredUntilDate"/>
+ <xsd:enumeration value="HoldAsOf"/>
+ <xsd:enumeration value="HoldAsStockAsOf"/>
+ <xsd:enumeration value="Holiday"/>
+ <xsd:enumeration value="HolidayFinish"/>
+ <xsd:enumeration value="HolidayStart"/>
+ <xsd:enumeration value="Homestead"/>
+ <xsd:enumeration value="HorizonEndDate"/>
+ <xsd:enumeration value="HorizonPeriod"/>
+ <xsd:enumeration value="HorizonStartDate"/>
+ <xsd:enumeration value="HosesConnectedDateTime"/>
+ <xsd:enumeration value="HosesDisconnectedDateTime"/>
+ <xsd:enumeration value="HospitalAdmissionDateAndOrTime"/>
+ <xsd:enumeration value="HospitalDischargeDateAndOrTime"/>
+ <xsd:enumeration value="HydrotestDate"/>
+ <xsd:enumeration value="Illness"/>
+ <xsd:enumeration value="IllnessBegin"/>
+ <xsd:enumeration value="IllnessRecoveryDateExpected"/>
+ <xsd:enumeration value="ImmigrationDate"/>
+ <xsd:enumeration value="Implantation"/>
+ <xsd:enumeration value="ImplementationDateTimePeriod"/>
+ <xsd:enumeration value="Import"/>
+ <xsd:enumeration value="ImportationDate"/>
+ <xsd:enumeration value="ImportLicenceDate"/>
+ <xsd:enumeration value="InactivityEndDate"/>
+ <xsd:enumeration value="Inactivity"/>
+ <xsd:enumeration value="InboundMovementAuthorizationDate"/>
+ <xsd:enumeration value="Incident"/>
+ <xsd:enumeration value="Income"/>
+ <xsd:enumeration value="IncomeDocumentationExpiration"/>
+ <xsd:enumeration value="IncomeIncreasePeriod"/>
+ <xsd:enumeration value="IncomePeriod"/>
+ <xsd:enumeration value="IncorporationDate"/>
+ <xsd:enumeration value="IncorporationDissolution"/>
+ <xsd:enumeration value="IncumbencyPeriod"/>
+ <xsd:enumeration value="IndividualEducationPlanIEP"/>
+ <xsd:enumeration value="In-force"/>
+ <xsd:enumeration value="InformationReleaseAuthorizationDate"/>
+ <xsd:enumeration value="InitialClaim"/>
+ <xsd:enumeration value="InitialCompletion"/>
+ <xsd:enumeration value="InitialContactDate"/>
+ <xsd:enumeration value="InitialDisabilityPeriodEnd"/>
+ <xsd:enumeration value="InitialDisabilityPeriodLastDayWorked"/>
+ <xsd:enumeration value="InitialDisabilityPeriodReturnToWork"/>
+ <xsd:enumeration value="InitialDisabilityPeriodStart"/>
+ <xsd:enumeration value="InitialFeeDue"/>
+ <xsd:enumeration value="InitialFinancialAccountsFiledDate"/>
+ <xsd:enumeration value="PlacementDateInitial"/>
+ <xsd:enumeration value="InitialPremium"/>
+ <xsd:enumeration value="InitialPremiumEffective"/>
+ <xsd:enumeration value="InitialRequestDate"/>
+ <xsd:enumeration value="InitialTreatment"/>
+ <xsd:enumeration value="InjuryBegin"/>
+ <xsd:enumeration value="InjuryEnd"/>
+ <xsd:enumeration value="InjuryOrIllness"/>
+ <xsd:enumeration value="InlandShip"/>
+ <xsd:enumeration value="InquiryDate"/>
+ <xsd:enumeration value="InServiceSurveyDate"/>
+ <xsd:enumeration value="InsolvencyDischargeGrantedDate"/>
+ <xsd:enumeration value="InspectionDate"/>
+ <xsd:enumeration value="InstallationDateTimePeriod"/>
+ <xsd:enumeration value="InstallmentDate"/>
+ <xsd:enumeration value="InstalmentPaymentDueDate"/>
+ <xsd:enumeration value="InstructionsOriginalExecutionDate"/>
+ <xsd:enumeration value="InsufficientAssetsJudgementDate"/>
+ <xsd:enumeration value="InsuranceCard"/>
+ <xsd:enumeration value="InterestCapitalization"/>
+ <xsd:enumeration value="InterestPaidThrough"/>
+ <xsd:enumeration value="InterestPaidTo"/>
+ <xsd:enumeration value="InterestPeriod"/>
+ <xsd:enumeration value="InterestRateValidityPeriod"/>
+ <xsd:enumeration value="InternationalAssessmentApprovalForPublicationDate"/>
+ <xsd:enumeration value="InternationalReviewCycleStartDate"/>
+ <xsd:enumeration value="InterruptionEnd"/>
+ <xsd:enumeration value="InterruptionStart"/>
+ <xsd:enumeration value="InterviewedDate"/>
+ <xsd:enumeration value="InterviewerSigned"/>
+ <xsd:enumeration value="Inventory"/>
+ <xsd:enumeration value="InventoryReportDate"/>
+ <xsd:enumeration value="InvestigationEndDate"/>
+ <xsd:enumeration value="InvestigationStartDate"/>
+ <xsd:enumeration value="InvestmentNumberAllocationDate"/>
+ <xsd:enumeration value="InvitationToTenderDateTime"/>
+ <xsd:enumeration value="InvoiceDateTime"/>
+ <xsd:enumeration value="InvoiceDateRequired"/>
+ <xsd:enumeration value="InvoicePeriodEnd"/>
+ <xsd:enumeration value="InvoicePeriodStart"/>
+ <xsd:enumeration value="InvoicingPeriod"/>
+ <xsd:enumeration value="IrregularInterestPaymentDue"/>
+ <xsd:enumeration value="IssueDate"/>
+ <xsd:enumeration value="ItemContractEffective"/>
+ <xsd:enumeration value="ItemContractExpiration"/>
+ <xsd:enumeration value="JoinedEmployerDate"/>
+ <xsd:enumeration value="JoinedFundDateTime"/>
+ <xsd:enumeration value="JudgementDate"/>
+ <xsd:enumeration value="Judgment"/>
+ <xsd:enumeration value="KeyEventCalendarYear"/>
+ <xsd:enumeration value="KeyEventFiscalYear"/>
+ <xsd:enumeration value="LabourWageDeterminationDate"/>
+ <xsd:enumeration value="LastActivityDate"/>
+ <xsd:enumeration value="LastAnnualReportDate"/>
+ <xsd:enumeration value="LastCapitalChangeDate"/>
+ <xsd:enumeration value="LastCertification"/>
+ <xsd:enumeration value="LastChange"/>
+ <xsd:enumeration value="LastCheckForBalanceSheetUpdateDate"/>
+ <xsd:enumeration value="LastCivilianFlight"/>
+ <xsd:enumeration value="LastDateForAGovernmentAgencyToFileAClaim"/>
+ <xsd:enumeration value="LastDateOfAccountsFiledAtPublicRegister"/>
+ <xsd:enumeration value="LastDateOfOrdering"/>
+ <xsd:enumeration value="LastDateToFileAClaim"/>
+ <xsd:enumeration value="LastDateToObject"/>
+ <xsd:enumeration value="LastEpisode"/>
+ <xsd:enumeration value="LastFlight"/>
+ <xsd:enumeration value="LastFollow-up"/>
+ <xsd:enumeration value="LastInsuranceMedical"/>
+ <xsd:enumeration value="LastInterestBearingDate"/>
+ <xsd:enumeration value="LastItemDelivery"/>
+ <xsd:enumeration value="LastLogged"/>
+ <xsd:enumeration value="LastMarketed"/>
+ <xsd:enumeration value="LastMeal"/>
+ <xsd:enumeration value="LastMenstrualCycleStartDate"/>
+ <xsd:enumeration value="LastMenstrualPeriod"/>
+ <xsd:enumeration value="LastMilitaryFlight"/>
+ <xsd:enumeration value="LastNotification"/>
+ <xsd:enumeration value="LastOffHireDate"/>
+ <xsd:enumeration value="LastOnHireDate"/>
+ <xsd:enumeration value="LastPaidInstallmentDate"/>
+ <xsd:enumeration value="LastPaymentMade"/>
+ <xsd:enumeration value="LastPhysical"/>
+ <xsd:enumeration value="LastPremiumEffective"/>
+ <xsd:enumeration value="LastPremiumPaidDate"/>
+ <xsd:enumeration value="LastProduction"/>
+ <xsd:enumeration value="LastPublication"/>
+ <xsd:enumeration value="LastPublishedDate"/>
+ <xsd:enumeration value="LastSalaryIncrease"/>
+ <xsd:enumeration value="LastSaleDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="LastScreening"/>
+ <xsd:enumeration value="LastSeenDate"/>
+ <xsd:enumeration value="LastVisitDate"/>
+ <xsd:enumeration value="LastXRayDate"/>
+ <xsd:enumeration value="LateFinish"/>
+ <xsd:enumeration value="LatestAbsence"/>
+ <xsd:enumeration value="LateStart"/>
+ <xsd:enumeration value="LatestBalanceSheet"/>
+ <xsd:enumeration value="LatestCheckInTime"/>
+ <xsd:enumeration value="LatestDeliveryDateatPier"/>
+ <xsd:enumeration value="LatestDeliveryDateAtRailRamp"/>
+ <xsd:enumeration value="LatestFilingPeriod"/>
+ <xsd:enumeration value="LatestMaterialSafetyDataSheetDate"/>
+ <xsd:enumeration value="LatestMeterReadingDate"/>
+ <xsd:enumeration value="LatestOnBoardCarrierDate"/>
+ <xsd:enumeration value="LatestPriceAdjustmentDate"/>
+ <xsd:enumeration value="LatestReceivingDateCutoffDate"/>
+ <xsd:enumeration value="LatestVisitorConsultation"/>
+ <xsd:enumeration value="LayTimeFirstDay"/>
+ <xsd:enumeration value="LayTimeLastDay"/>
+ <xsd:enumeration value="LeadTime"/>
+ <xsd:enumeration value="LeaseCommencement"/>
+ <xsd:enumeration value="LeasePeriod"/>
+ <xsd:enumeration value="LeaseTermEndDate"/>
+ <xsd:enumeration value="LeaseTermStartDate"/>
+ <xsd:enumeration value="LeftEmployerDate"/>
+ <xsd:enumeration value="LegalActionClosedDate"/>
+ <xsd:enumeration value="LegalActionStarted"/>
+ <xsd:enumeration value="LegalSettlementTermsMetDate"/>
+ <xsd:enumeration value="LegalStructureChangeDate"/>
+ <xsd:enumeration value="LenderCreditCheck"/>
+ <xsd:enumeration value="LetterOfAgreementDate"/>
+ <xsd:enumeration value="LetterOfLiabilityDate"/>
+ <xsd:enumeration value="License"/>
+ <xsd:enumeration value="LicenseEffective"/>
+ <xsd:enumeration value="LicenseExpiration"/>
+ <xsd:enumeration value="LicenseRenewal"/>
+ <xsd:enumeration value="LicenseRequested"/>
+ <xsd:enumeration value="Lien"/>
+ <xsd:enumeration value="LiquidationDate"/>
+ <xsd:enumeration value="ListingReceived"/>
+ <xsd:enumeration value="ListPriceChange"/>
+ <xsd:enumeration value="LoadedonVessel"/>
+ <xsd:enumeration value="LoadingDateTimeActual"/>
+ <xsd:enumeration value="Loan"/>
+ <xsd:enumeration value="LoanPurchase"/>
+ <xsd:enumeration value="LoanServicingTransfer"/>
+ <xsd:enumeration value="LocationExceptionOrderNumberAssigned"/>
+ <xsd:enumeration value="Loss"/>
+ <xsd:enumeration value="LotNumberExpiration"/>
+ <xsd:enumeration value="LowestActivityPeriod"/>
+ <xsd:enumeration value="LowPeriod"/>
+ <xsd:enumeration value="MailBy"/>
+ <xsd:enumeration value="MailingDate"/>
+ <xsd:enumeration value="MailReceiptDate"/>
+ <xsd:enumeration value="Maintenance"/>
+ <xsd:enumeration value="MaintenanceComment"/>
+ <xsd:enumeration value="MaintenanceEffective"/>
+ <xsd:enumeration value="MakegoodCommercialDate"/>
+ <xsd:enumeration value="ManagementAvailableDate"/>
+ <xsd:enumeration value="ManagerNotRegisteredAsOfGivenDate"/>
+ <xsd:enumeration value="MandatoryOrTargetFinish"/>
+ <xsd:enumeration value="MandatoryOrTargetStart"/>
+ <xsd:enumeration value="ManifestShipNoticeDate"/>
+ <xsd:enumeration value="Manufacture"/>
+ <xsd:enumeration value="Map"/>
+ <xsd:enumeration value="DateOfMarriage"/>
+ <xsd:enumeration value="MasterLeaseAgreement"/>
+ <xsd:enumeration value="MaterialChangeNotice"/>
+ <xsd:enumeration value="MaterialClassification"/>
+ <xsd:enumeration value="MaterialSpecification"/>
+ <xsd:enumeration value="Maturity"/>
+ <xsd:enumeration value="MaturityDate"/>
+ <xsd:enumeration value="MaximumCreditGrantedDate"/>
+ <xsd:enumeration value="MeatAgeingPeriod"/>
+ <xsd:enumeration value="Medicaid"/>
+ <xsd:enumeration value="MedicaidBegin"/>
+ <xsd:enumeration value="MedicaidEnd"/>
+ <xsd:enumeration value="MedicalCertificate"/>
+ <xsd:enumeration value="MedicalInformationSignature"/>
+ <xsd:enumeration value="MedicalInformationSystem"/>
+ <xsd:enumeration value="Medicare"/>
+ <xsd:enumeration value="MedicareBegin"/>
+ <xsd:enumeration value="MedicareEnd"/>
+ <xsd:enumeration value="MedicarePartACoverageEffectiveDate"/>
+ <xsd:enumeration value="MedicarePartAEligibilityBeginDate"/>
+ <xsd:enumeration value="MedicarePartAEligibilityEndDate"/>
+ <xsd:enumeration value="MedicarePartATerminationDate"/>
+ <xsd:enumeration value="MedicarePartBCoverageEffectiveDate"/>
+ <xsd:enumeration value="MedicarePartBEligibilityBeginDate"/>
+ <xsd:enumeration value="MedicarePartBEligibilityEndDate"/>
+ <xsd:enumeration value="MedicarePartBTerminationDate"/>
+ <xsd:enumeration value="Medication"/>
+ <xsd:enumeration value="MeetingDate"/>
+ <xsd:enumeration value="Merger"/>
+ <xsd:enumeration value="Message"/>
+ <xsd:enumeration value="MeterReading"/>
+ <xsd:enumeration value="MidpointOfPerformance"/>
+ <xsd:enumeration value="MinimumRequiredDistribution"/>
+ <xsd:enumeration value="MinimumShelfLifeRemainingAtTimeOfDespatchPeriod"/>
+ <xsd:enumeration value="MinimumShelfLifeRemainingAtTimeOfReceipt"/>
+ <xsd:enumeration value="MonthEnding"/>
+ <xsd:enumeration value="MonthToDate"/>
+ <xsd:enumeration value="MooringDateAndTime"/>
+ <xsd:enumeration value="MortgageeOfficialSignatureDate"/>
+ <xsd:enumeration value="MortgageeReportedCurtailmentDate"/>
+ <xsd:enumeration value="MortgageNoteDate"/>
+ <xsd:enumeration value="MostLikelyEarlyFinish"/>
+ <xsd:enumeration value="MostLikelyEarlyStart"/>
+ <xsd:enumeration value="MostLikelyLateFinish"/>
+ <xsd:enumeration value="MostLikelyLateStart"/>
+ <xsd:enumeration value="MostRecentHemoglobinOrHematocritOrBoth"/>
+ <xsd:enumeration value="MostRecentRenewal"/>
+ <xsd:enumeration value="MostRecentRevisionorInitialVersion"/>
+ <xsd:enumeration value="MostRecentSerumCreatine"/>
+ <xsd:enumeration value="MovedFromLocationDate"/>
+ <xsd:enumeration value="NegotiatedExtensionDate"/>
+ <xsd:enumeration value="NegotiatedFinish"/>
+ <xsd:enumeration value="NegotiatedStart"/>
+ <xsd:enumeration value="NegotiationsStartDate"/>
+ <xsd:enumeration value="NetCreditServiceDate"/>
+ <xsd:enumeration value="NetWorthDate"/>
+ <xsd:enumeration value="NextActivity"/>
+ <xsd:enumeration value="NextAnniversary"/>
+ <xsd:enumeration value="NextAnnualMeeting"/>
+ <xsd:enumeration value="NextInstallmentDueDate"/>
+ <xsd:enumeration value="NextInterestChangeDate"/>
+ <xsd:enumeration value="NextPayIncrease"/>
+ <xsd:enumeration value="NextPaymentDue"/>
+ <xsd:enumeration value="NextReviewDate"/>
+ <xsd:enumeration value="NonWorking"/>
+ <xsd:enumeration value="NoProductionScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="NoPromiseAsOf"/>
+ <xsd:enumeration value="NoShippingScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="NotAfter"/>
+ <xsd:enumeration value="NotBefore"/>
+ <xsd:enumeration value="Note"/>
+ <xsd:enumeration value="Notice"/>
+ <xsd:enumeration value="NotificationDateTime"/>
+ <xsd:enumeration value="NotificationOfDeath"/>
+ <xsd:enumeration value="NotificationTimeLimit"/>
+ <xsd:enumeration value="Notified"/>
+ <xsd:enumeration value="NotRegistered"/>
+ <xsd:enumeration value="NotRegisteredAsOfGivenDate"/>
+ <xsd:enumeration value="NursingHome"/>
+ <xsd:enumeration value="NursingHomeFrom"/>
+ <xsd:enumeration value="NursingHomeTo"/>
+ <xsd:enumeration value="Occupancy"/>
+ <xsd:enumeration value="Occurrence"/>
+ <xsd:enumeration value="OccurrenceSpan"/>
+ <xsd:enumeration value="OccurrenceSpanFrom"/>
+ <xsd:enumeration value="OccurrenceSpanTo"/>
+ <xsd:enumeration value="OfferExpiration"/>
+ <xsd:enumeration value="OffHireSurveyDate"/>
+ <xsd:enumeration value="OffHold"/>
+ <xsd:enumeration value="OfficialRailCarInterchangeEitherActualorAgreedUpon"/>
+ <xsd:enumeration value="Off-Market"/>
+ <xsd:enumeration value="Offset"/>
+ <xsd:enumeration value="OffsetBegin"/>
+ <xsd:enumeration value="OffsetEnd"/>
+ <xsd:enumeration value="OffsetFromCoordinatedUniversalTimeUtc"/>
+ <xsd:enumeration value="OldestUnpaidInstallment"/>
+ <xsd:enumeration value="On"/>
+ <xsd:enumeration value="OnBoardDate"/>
+ <xsd:enumeration value="OnHireSurveyDate"/>
+ <xsd:enumeration value="OnHold"/>
+ <xsd:enumeration value="OnsetOfCurrentSymptomsOrIllness"/>
+ <xsd:enumeration value="OnsetOfSimilarSymptomsOrIllness"/>
+ <xsd:enumeration value="OpenHouse"/>
+ <xsd:enumeration value="OpeningDate"/>
+ <xsd:enumeration value="OperationsCeasedDate"/>
+ <xsd:enumeration value="Opinion"/>
+ <xsd:enumeration value="OptimisticEarlyFinish"/>
+ <xsd:enumeration value="OptimisticEarlyStart"/>
+ <xsd:enumeration value="OptimisticLateFinish"/>
+ <xsd:enumeration value="OptimisticLateStart"/>
+ <xsd:enumeration value="Option"/>
+ <xsd:enumeration value="Order"/>
+ <xsd:enumeration value="OrderAmendmentBindingDate"/>
+ <xsd:enumeration value="OrderCompletionDateTimeUltimate"/>
+ <xsd:enumeration value="OrderDateTime"/>
+ <xsd:enumeration value="OrderEnd"/>
+ <xsd:enumeration value="OrderReceivedDateTime"/>
+ <xsd:enumeration value="OrderStart"/>
+ <xsd:enumeration value="OrderToProceedDate"/>
+ <xsd:enumeration value="Original"/>
+ <xsd:enumeration value="OriginalDueDate"/>
+ <xsd:enumeration value="OriginalDuration"/>
+ <xsd:enumeration value="OriginalEarlyFinish"/>
+ <xsd:enumeration value="OriginalEarlyStart"/>
+ <xsd:enumeration value="OriginalEstimateDate"/>
+ <xsd:enumeration value="OriginalIssueAge"/>
+ <xsd:enumeration value="OriginalList"/>
+ <xsd:enumeration value="OriginallyScheduledShip"/>
+ <xsd:enumeration value="OriginalMaturityDate"/>
+ <xsd:enumeration value="OriginalNameChangeDate"/>
+ <xsd:enumeration value="OriginalPostingDate"/>
+ <xsd:enumeration value="OriginalReceipt"/>
+ <xsd:enumeration value="OrthodonticTreatmentPeriodRemaining"/>
+ <xsd:enumeration value="OrthodonticTreatmentPeriodTotal"/>
+ <xsd:enumeration value="Out-Of-Pocket"/>
+ <xsd:enumeration value="OutsideAuditorsReport"/>
+ <xsd:enumeration value="Overhauled"/>
+ <xsd:enumeration value="OverrideDateForSettlement"/>
+ <xsd:enumeration value="OverTargetBaselineMonth"/>
+ <xsd:enumeration value="OvertimeEndDate"/>
+ <xsd:enumeration value="OvertimeStartDate"/>
+ <xsd:enumeration value="OwnershipChangeDate"/>
+ <xsd:enumeration value="OwnershipPeriod"/>
+ <xsd:enumeration value="OxygenSaturationTest"/>
+ <xsd:enumeration value="OxygenTherapy"/>
+ <xsd:enumeration value="OxygenTherapyEvaluation"/>
+ <xsd:enumeration value="OxygenTherapyFrom"/>
+ <xsd:enumeration value="OxygenTherapyTo"/>
+ <xsd:enumeration value="PackingEndDate"/>
+ <xsd:enumeration value="PackingStartDate"/>
+ <xsd:enumeration value="PaidInFull"/>
+ <xsd:enumeration value="PaidThroughDate"/>
+ <xsd:enumeration value="Paid-ThroughDateForAccruedSickPay"/>
+ <xsd:enumeration value="PaidThroughDateForMinimumPayment"/>
+ <xsd:enumeration value="Paid-ThroughDateForSalaryContinuation"/>
+ <xsd:enumeration value="PaidThroughDateForTotalPayment"/>
+ <xsd:enumeration value="Paid-ThroughDateForVacationPay"/>
+ <xsd:enumeration value="PaidToDate"/>
+ <xsd:enumeration value="Paid-up"/>
+ <xsd:enumeration value="PaperworkMailed"/>
+ <xsd:enumeration value="PartialAnnuitization"/>
+ <xsd:enumeration value="ParticipationDate"/>
+ <xsd:enumeration value="PartTimeWorkingChangeDateTime"/>
+ <xsd:enumeration value="PastDue"/>
+ <xsd:enumeration value="PatientFirstVisitForCondition"/>
+ <xsd:enumeration value="PaymentCommencement"/>
+ <xsd:enumeration value="PaymentDate"/>
+ <xsd:enumeration value="PaymentDateTimeDeferred"/>
+ <xsd:enumeration value="PaymentDueDate"/>
+ <xsd:enumeration value="PaymentEffective"/>
+ <xsd:enumeration value="PaymentInitiated"/>
+ <xsd:enumeration value="PaymentInstructionDateTime"/>
+ <xsd:enumeration value="PaymentIssue"/>
+ <xsd:enumeration value="PaymentPeriod"/>
+ <xsd:enumeration value="PaymentPeriodEnd"/>
+ <xsd:enumeration value="PaymentPeriodStart"/>
+ <xsd:enumeration value="PaymentValuationPresentationDateTime"/>
+ <xsd:enumeration value="PayrollDeductionDateTime"/>
+ <xsd:enumeration value="PayrollPeriod"/>
+ <xsd:enumeration value="PayrollPeriodBegin"/>
+ <xsd:enumeration value="PayrollPeriodEnd"/>
+ <xsd:enumeration value="PeakActivityPeriod"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStay"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStayFrom"/>
+ <xsd:enumeration value="PeerReviewOrganizationPROApprovedStayTo"/>
+ <xsd:enumeration value="Penalty"/>
+ <xsd:enumeration value="PenaltyBegin"/>
+ <xsd:enumeration value="PenaltyEnd"/>
+ <xsd:enumeration value="PendingArchive"/>
+ <xsd:enumeration value="PercolationTest"/>
+ <xsd:enumeration value="PeriodAnEventIsLateDueToCustomer"/>
+ <xsd:enumeration value="PeriodAssigned"/>
+ <xsd:enumeration value="PeriodBetweenChanges"/>
+ <xsd:enumeration value="PeriodCoveredBySourceDocuments"/>
+ <xsd:enumeration value="PeriodEnd"/>
+ <xsd:enumeration value="PeriodExtended"/>
+ <xsd:enumeration value="PeriodicInspectionDate"/>
+ <xsd:enumeration value="PeriodOfCareEndDateAndOrTime"/>
+ <xsd:enumeration value="PeriodOfCareStartDateAndOrTime"/>
+ <xsd:enumeration value="PeriodOfIllnessEndDate"/>
+ <xsd:enumeration value="PeriodOfIllnessStartDate"/>
+ <xsd:enumeration value="PeriodOverdue"/>
+ <xsd:enumeration value="PeriodStart"/>
+ <xsd:enumeration value="PeriodWorkedForTheCompany"/>
+ <xsd:enumeration value="PermitToAdmitDate"/>
+ <xsd:enumeration value="PermitYear"/>
+ <xsd:enumeration value="PessimisticEarlyFinish"/>
+ <xsd:enumeration value="PessimisticEarlyStart"/>
+ <xsd:enumeration value="PessimisticLateFinish"/>
+ <xsd:enumeration value="PessimisticLateStart"/>
+ <xsd:enumeration value="PickUpCollectionDateTimeOfCargo"/>
+ <xsd:enumeration value="PickUpDateTimeOfEquipment"/>
+ <xsd:enumeration value="Placement"/>
+ <xsd:enumeration value="PlacementDate"/>
+ <xsd:enumeration value="PlacementDatePrevious"/>
+ <xsd:enumeration value="PlacementPeriodExpiration"/>
+ <xsd:enumeration value="Plan"/>
+ <xsd:enumeration value="PlanAnniversary"/>
+ <xsd:enumeration value="PlanBegin"/>
+ <xsd:enumeration value="PlanEnd"/>
+ <xsd:enumeration value="PlanEntry"/>
+ <xsd:enumeration value="PlannedDurationOfWorks"/>
+ <xsd:enumeration value="PlannedRelease"/>
+ <xsd:enumeration value="PlanOfTreatmentPeriod"/>
+ <xsd:enumeration value="PlanParticipationSuspension"/>
+ <xsd:enumeration value="PlanPeriodElection"/>
+ <xsd:enumeration value="PlanPeriodElectionBegin"/>
+ <xsd:enumeration value="PlanPeriodElectionEnd"/>
+ <xsd:enumeration value="PlanTermination"/>
+ <xsd:enumeration value="PluggedAndAbandoned"/>
+ <xsd:enumeration value="PolicyEffective"/>
+ <xsd:enumeration value="PolicyEffectiveOnOrAfter"/>
+ <xsd:enumeration value="PolicyEffectiveOnOrBefore"/>
+ <xsd:enumeration value="PolicyExpiration"/>
+ <xsd:enumeration value="PolicySurrender"/>
+ <xsd:enumeration value="PoolSettlement"/>
+ <xsd:enumeration value="PositioningDateTimeOfEquipment"/>
+ <xsd:enumeration value="PositioningDateTimeOfGoods"/>
+ <xsd:enumeration value="PostingDate"/>
+ <xsd:enumeration value="PostmarkDateTime"/>
+ <xsd:enumeration value="Post-Reclassification"/>
+ <xsd:enumeration value="Post-ReclassificationEndOfSecondYear"/>
+ <xsd:enumeration value="Post-ReclassificationFirstReportCard"/>
+ <xsd:enumeration value="Post-ReclassificationFirstSemi-annual"/>
+ <xsd:enumeration value="Post-ReclassificationSecondSemi-annual"/>
+ <xsd:enumeration value="PrearrangedDealMatch"/>
+ <xsd:enumeration value="Pre-AwardSurvey"/>
+ <xsd:enumeration value="PrecedingPeriod"/>
+ <xsd:enumeration value="Pre-certificationDate"/>
+ <xsd:enumeration value="PreforeclosureAcceptanceDate"/>
+ <xsd:enumeration value="PreforeclosureSaleClosingDate"/>
+ <xsd:enumeration value="PregnancyBegin"/>
+ <xsd:enumeration value="PregnancyDurationActual"/>
+ <xsd:enumeration value="PregnancyEnd"/>
+ <xsd:enumeration value="PremiumChangePeriod"/>
+ <xsd:enumeration value="PremiumPaidToDate"/>
+ <xsd:enumeration value="PremiumPaidToDateBegin"/>
+ <xsd:enumeration value="PremiumPaidToDateEnd"/>
+ <xsd:enumeration value="PreparationDateTimeOfDocument"/>
+ <xsd:enumeration value="Prescription"/>
+ <xsd:enumeration value="PrescriptionDispensingDateAndOrTime"/>
+ <xsd:enumeration value="PrescriptionFill"/>
+ <xsd:enumeration value="PrescriptionFrom"/>
+ <xsd:enumeration value="PrescriptionIssueDateAndOrTime"/>
+ <xsd:enumeration value="PrescriptionTo"/>
+ <xsd:enumeration value="PresentationDateLatest"/>
+ <xsd:enumeration value="PresentationDateOfGoodsDeclarationCustoms"/>
+ <xsd:enumeration value="PresentationToBankruptcyReceiversDate"/>
+ <xsd:enumeration value="PresentControl"/>
+ <xsd:enumeration value="PresentedToReceivers"/>
+ <xsd:enumeration value="PresentLegalStructure"/>
+ <xsd:enumeration value="PresentlyResiding"/>
+ <xsd:enumeration value="PresentmentDate"/>
+ <xsd:enumeration value="PresentName"/>
+ <xsd:enumeration value="PresentResidenceStartDate"/>
+ <xsd:enumeration value="PreviousBookingDateTime"/>
+ <xsd:enumeration value="PreviousCourtEvent"/>
+ <xsd:enumeration value="PreviousCurrentAccountDate"/>
+ <xsd:enumeration value="PreviousEmployment"/>
+ <xsd:enumeration value="PreviousEmploymentEnd"/>
+ <xsd:enumeration value="PreviousEmploymentStart"/>
+ <xsd:enumeration value="PreviousInvoiceDate"/>
+ <xsd:enumeration value="PreviouslyReportedDateOfBirth"/>
+ <xsd:enumeration value="PreviouslyResided"/>
+ <xsd:enumeration value="PreviousMeterReadingDate"/>
+ <xsd:enumeration value="PreviousMonthEnding"/>
+ <xsd:enumeration value="PreviousPeriod"/>
+ <xsd:enumeration value="PreviousReportDate"/>
+ <xsd:enumeration value="PreviousResidence"/>
+ <xsd:enumeration value="PreviousResidenceEnd"/>
+ <xsd:enumeration value="PreviousResidenceStart"/>
+ <xsd:enumeration value="PreviousTerminationDate"/>
+ <xsd:enumeration value="PriceAdjustmentDate"/>
+ <xsd:enumeration value="PriceAdjustmentLimitDate"/>
+ <xsd:enumeration value="PriceAdjustmentStartDate"/>
+ <xsd:enumeration value="PriceBaseDateTime"/>
+ <xsd:enumeration value="PriceProtection"/>
+ <xsd:enumeration value="PrimaryCareProvider"/>
+ <xsd:enumeration value="PrimaryCareProviderBegin"/>
+ <xsd:enumeration value="PrimaryCareProviderEnd"/>
+ <xsd:enumeration value="Printed"/>
+ <xsd:enumeration value="PriorContractAnniversary"/>
+ <xsd:enumeration value="PriorContractIssue"/>
+ <xsd:enumeration value="PriorHospitalizationDatesRelatedToCurrentServices"/>
+ <xsd:enumeration value="PriorIncorrectDateOfBirth"/>
+ <xsd:enumeration value="PriorNotice"/>
+ <xsd:enumeration value="PriorPlacement"/>
+ <xsd:enumeration value="PrivilegeDetailsVerificationDate"/>
+ <xsd:enumeration value="ProcessingDateTime"/>
+ <xsd:enumeration value="ProcessingDatePeriod"/>
+ <xsd:enumeration value="ProcessingEndDateTime"/>
+ <xsd:enumeration value="ProcessingStartDateTime"/>
+ <xsd:enumeration value="ProductAvailabilityDate"/>
+ <xsd:enumeration value="ProductHeldUntil"/>
+ <xsd:enumeration value="Production"/>
+ <xsd:enumeration value="ProductionDateNoScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="ProductionInspectionDate"/>
+ <xsd:enumeration value="ProductionManufactureDate"/>
+ <xsd:enumeration value="ProductLifespanAtTimeOfProduction"/>
+ <xsd:enumeration value="ProfitPeriod"/>
+ <xsd:enumeration value="ProgrammedCalendarYear"/>
+ <xsd:enumeration value="ProgrammedFiscalYear"/>
+ <xsd:enumeration value="ProgressPayment"/>
+ <xsd:enumeration value="ProjectedActionEndDate"/>
+ <xsd:enumeration value="ProjectedForeclosureSaleDate"/>
+ <xsd:enumeration value="ProjectOverTargetBaselineDate"/>
+ <xsd:enumeration value="PromisedForDelivery"/>
+ <xsd:enumeration value="PromisedForDeliveryAfterAndIncluding"/>
+ <xsd:enumeration value="PromisedForDeliveryPriorToAndIncluding"/>
+ <xsd:enumeration value="PromisedForDeliveryWeekOf"/>
+ <xsd:enumeration value="PromisedForShipment"/>
+ <xsd:enumeration value="PromisedForShipmentAfterAndIncluding"/>
+ <xsd:enumeration value="PromisedForShipmentPriortoAndIncluding"/>
+ <xsd:enumeration value="PromisedForShipmentWeekOf"/>
+ <xsd:enumeration value="PromotionDatePeriod"/>
+ <xsd:enumeration value="PromotionEndDateTime"/>
+ <xsd:enumeration value="PromotionFloorStockProtect-End"/>
+ <xsd:enumeration value="PromotionFloorStockProtect-Start"/>
+ <xsd:enumeration value="PromotionInvoicePerformance-End"/>
+ <xsd:enumeration value="PromotionInvoicePerformance-Start"/>
+ <xsd:enumeration value="PromotionOrder-End"/>
+ <xsd:enumeration value="PromotionOrder-Start"/>
+ <xsd:enumeration value="PromotionPerformance-End"/>
+ <xsd:enumeration value="PromotionPerformance-Start"/>
+ <xsd:enumeration value="PromotionRequestedDelivery-End"/>
+ <xsd:enumeration value="PromotionRequestedDelivery-Start"/>
+ <xsd:enumeration value="PromotionShip-End"/>
+ <xsd:enumeration value="PromotionShip-Start"/>
+ <xsd:enumeration value="PromotionStartDateTime"/>
+ <xsd:enumeration value="Property"/>
+ <xsd:enumeration value="PropertyAcquired"/>
+ <xsd:enumeration value="PropertyBuilt"/>
+ <xsd:enumeration value="PrototypeTest"/>
+ <xsd:enumeration value="ProviderSignatureDate"/>
+ <xsd:enumeration value="PublicationDate"/>
+ <xsd:enumeration value="PurchasedDate"/>
+ <xsd:enumeration value="PurchaseOrder"/>
+ <xsd:enumeration value="PurchaseOrderLatestPossibleChangeDate"/>
+ <xsd:enumeration value="PurchaseOrderReceived"/>
+ <xsd:enumeration value="PutIntoService"/>
+ <xsd:enumeration value="QualityRating"/>
+ <xsd:enumeration value="QuarterEnding"/>
+ <xsd:enumeration value="QuotaDate"/>
+ <xsd:enumeration value="Quote"/>
+ <xsd:enumeration value="QuoteToBeReceivedBy"/>
+ <xsd:enumeration value="RateAdjustment"/>
+ <xsd:enumeration value="RateDate"/>
+ <xsd:enumeration value="RateOfExchangeDateTime"/>
+ <xsd:enumeration value="RatePriceDateTime"/>
+ <xsd:enumeration value="ReachedTotalDepth"/>
+ <xsd:enumeration value="ReadyForInspection"/>
+ <xsd:enumeration value="RealEstateProperty"/>
+ <xsd:enumeration value="RealEstateTaxYear"/>
+ <xsd:enumeration value="Rebuilt"/>
+ <xsd:enumeration value="Recapture"/>
+ <xsd:enumeration value="ReceivablesCollectionPeriod"/>
+ <xsd:enumeration value="Received"/>
+ <xsd:enumeration value="ReceiveAtLockboxDate"/>
+ <xsd:enumeration value="ReceivedDateTime"/>
+ <xsd:enumeration value="ReceivedInTheMail"/>
+ <xsd:enumeration value="ReceiverAppointed"/>
+ <xsd:enumeration value="ReceivershipPeriod"/>
+ <xsd:enumeration value="ReceivershipResultDate"/>
+ <xsd:enumeration value="Reclassification"/>
+ <xsd:enumeration value="ReclassificationExitDate"/>
+ <xsd:enumeration value="Recompletion"/>
+ <xsd:enumeration value="RecordedDate"/>
+ <xsd:enumeration value="Recovery"/>
+ <xsd:enumeration value="RecoveryFinish"/>
+ <xsd:enumeration value="RecoveryStart"/>
+ <xsd:enumeration value="Re-entry"/>
+ <xsd:enumeration value="Re-evaluationDate"/>
+ <xsd:enumeration value="ReExportationDate"/>
+ <xsd:enumeration value="ReferenceDateTime"/>
+ <xsd:enumeration value="ReferencedItemCreationDate"/>
+ <xsd:enumeration value="ReferralDate"/>
+ <xsd:enumeration value="ReferredFrom"/>
+ <xsd:enumeration value="ReferredTo"/>
+ <xsd:enumeration value="Refinance"/>
+ <xsd:enumeration value="RefusalPeriod"/>
+ <xsd:enumeration value="Registered"/>
+ <xsd:enumeration value="RegisteredContractorNumberAssignmentDateOriginal"/>
+ <xsd:enumeration value="RegistrationDate"/>
+ <xsd:enumeration value="RegistrationDateOfPreviousCustomsDeclaration"/>
+ <xsd:enumeration value="RegistrationOfBoardOfDirectors"/>
+ <xsd:enumeration value="Rehire"/>
+ <xsd:enumeration value="ReimbursementClaimIssueDateAndOrTime"/>
+ <xsd:enumeration value="ReImportationDate"/>
+ <xsd:enumeration value="ReinstatementDate"/>
+ <xsd:enumeration value="ReinsuranceAccountingPeriod"/>
+ <xsd:enumeration value="ReinsuranceCoverageDuration"/>
+ <xsd:enumeration value="ReinsuranceCurrentAccountPeriod"/>
+ <xsd:enumeration value="ReinsuranceEffective"/>
+ <xsd:enumeration value="ReinsuranceIssueAge"/>
+ <xsd:enumeration value="ReinsurancePaidUpDate"/>
+ <xsd:enumeration value="ReinsurancePaymentFrequency"/>
+ <xsd:enumeration value="Reissue"/>
+ <xsd:enumeration value="Rejected"/>
+ <xsd:enumeration value="ReleaseDateTime"/>
+ <xsd:enumeration value="ReleaseDateCustoms"/>
+ <xsd:enumeration value="ReleaseDateOfCustomer"/>
+ <xsd:enumeration value="ReleaseDateOfSupplier"/>
+ <xsd:enumeration value="ReleasedReturnToWork"/>
+ <xsd:enumeration value="ReleasedToVessel"/>
+ <xsd:enumeration value="ReleaseFrequency"/>
+ <xsd:enumeration value="ReleaseOfInformation"/>
+ <xsd:enumeration value="Remittance"/>
+ <xsd:enumeration value="RemodelingCompleted"/>
+ <xsd:enumeration value="Removed"/>
+ <xsd:enumeration value="RenewalDate"/>
+ <xsd:enumeration value="RentalPeriod"/>
+ <xsd:enumeration value="RentStart"/>
+ <xsd:enumeration value="RentSurvey"/>
+ <xsd:enumeration value="RepairTurnaroundTime"/>
+ <xsd:enumeration value="RepaymentBegin"/>
+ <xsd:enumeration value="RepaymentScheduleSent"/>
+ <xsd:enumeration value="Replaced"/>
+ <xsd:enumeration value="Replacement"/>
+ <xsd:enumeration value="ReplacementEffective"/>
+ <xsd:enumeration value="ReplyDate"/>
+ <xsd:enumeration value="Report"/>
+ <xsd:enumeration value="ReportedDate"/>
+ <xsd:enumeration value="ReportEndDate"/>
+ <xsd:enumeration value="ReportingCycleDate"/>
+ <xsd:enumeration value="ReportPeriod"/>
+ <xsd:enumeration value="ReportStartDate"/>
+ <xsd:enumeration value="Requalification"/>
+ <xsd:enumeration value="Request"/>
+ <xsd:enumeration value="RequestedContract"/>
+ <xsd:enumeration value="RequestedDepartureDate"/>
+ <xsd:enumeration value="RequestedFinish"/>
+ <xsd:enumeration value="DeliveryDateTimeRequestedForAfterAndIncluding"/>
+ <xsd:enumeration value="DeliveryDateTimeRequestedForPriorToAndIncluding"/>
+ <xsd:enumeration value="RequestedForDeliveryWeekOf"/>
+ <xsd:enumeration value="ShipmentDateTimeRequestedForAfterAndIncluding"/>
+ <xsd:enumeration value="ShipmentDateTimeRequestedForPriorToAndIncluding"/>
+ <xsd:enumeration value="RequestedForShipmentWeekOf"/>
+ <xsd:enumeration value="RequestedOffer"/>
+ <xsd:enumeration value="RequestedPick-up"/>
+ <xsd:enumeration value="RequestedSettlement"/>
+ <xsd:enumeration value="RequestedShip"/>
+ <xsd:enumeration value="RequestedStart"/>
+ <xsd:enumeration value="RequestForQuotation"/>
+ <xsd:enumeration value="RequiredBy"/>
+ <xsd:enumeration value="RequiredDelivery"/>
+ <xsd:enumeration value="ReservationOfFacility"/>
+ <xsd:enumeration value="ResidentLicenseEffective"/>
+ <xsd:enumeration value="ResidentLicenseExpiration"/>
+ <xsd:enumeration value="ResignationDate"/>
+ <xsd:enumeration value="Resigned"/>
+ <xsd:enumeration value="ResolvedDate"/>
+ <xsd:enumeration value="RestDay"/>
+ <xsd:enumeration value="RestFinish"/>
+ <xsd:enumeration value="RestStart"/>
+ <xsd:enumeration value="Resubmission"/>
+ <xsd:enumeration value="RetentionReleaseDateTime"/>
+ <xsd:enumeration value="RetentionReleaseDateTimePartial"/>
+ <xsd:enumeration value="Retermination"/>
+ <xsd:enumeration value="Retirement"/>
+ <xsd:enumeration value="RetransmissionTimeStamp"/>
+ <xsd:enumeration value="ReturnedDate"/>
+ <xsd:enumeration value="ReturnedToCustomer"/>
+ <xsd:enumeration value="ReturnToWorkDate"/>
+ <xsd:enumeration value="ReturnToWorkPartTime"/>
+ <xsd:enumeration value="ReviewDate"/>
+ <xsd:enumeration value="ReviewPeriodEnd"/>
+ <xsd:enumeration value="RevisedAdjustedEnd"/>
+ <xsd:enumeration value="RevisedAdjustedStart"/>
+ <xsd:enumeration value="RevisedEstimateDate"/>
+ <xsd:enumeration value="Revision"/>
+ <xsd:enumeration value="Revocation"/>
+ <xsd:enumeration value="Revoked"/>
+ <xsd:enumeration value="RigArrival"/>
+ <xsd:enumeration value="RoadFundTaxExpiryDate"/>
+ <xsd:enumeration value="Sailing"/>
+ <xsd:enumeration value="SalaryChangeEffectiveDate"/>
+ <xsd:enumeration value="SalaryDeferral"/>
+ <xsd:enumeration value="SaleableStockDemandCoverPeriodExpected"/>
+ <xsd:enumeration value="SalesDateAndOrTimeAndOrPeriod"/>
+ <xsd:enumeration value="SalesPeriod"/>
+ <xsd:enumeration value="SampleAvailableDate"/>
+ <xsd:enumeration value="SampleCollected"/>
+ <xsd:enumeration value="SampleRequiredDate"/>
+ <xsd:enumeration value="SamplesToBeReturnedBy"/>
+ <xsd:enumeration value="Sanction"/>
+ <xsd:enumeration value="SatisfactionDate"/>
+ <xsd:enumeration value="Satisfied"/>
+ <xsd:enumeration value="Schedule"/>
+ <xsd:enumeration value="ScheduledFinish"/>
+ <xsd:enumeration value="ScheduledForDeliveryOnOrAfter"/>
+ <xsd:enumeration value="ScheduledForDeliveryOnOrBefore"/>
+ <xsd:enumeration value="ScheduledForDeliveryWeekOf"/>
+ <xsd:enumeration value="ScheduledForShipmentAfterAndIncluding"/>
+ <xsd:enumeration value="ScheduledForShipmentPriorToAndIncluding"/>
+ <xsd:enumeration value="ScheduledForShipmentWeekOf"/>
+ <xsd:enumeration value="ScheduledInterchangeDelivery"/>
+ <xsd:enumeration value="ScheduledStart"/>
+ <xsd:enumeration value="ScheduleRelease"/>
+ <xsd:enumeration value="SchoolRefund"/>
+ <xsd:enumeration value="Seal"/>
+ <xsd:enumeration value="SecondAdmissionDate"/>
+ <xsd:enumeration value="SecondDischargeDate"/>
+ <xsd:enumeration value="SecurityRateAdjustment"/>
+ <xsd:enumeration value="SecuritySharePriceAsOfGivenDate"/>
+ <xsd:enumeration value="Selected"/>
+ <xsd:enumeration value="SelectionPeriodEndDate"/>
+ <xsd:enumeration value="SelectionPeriodStartDate"/>
+ <xsd:enumeration value="SellByDate"/>
+ <xsd:enumeration value="SellersLocalTime"/>
+ <xsd:enumeration value="SemiannualEnding"/>
+ <xsd:enumeration value="SendingRoadTimeStamp"/>
+ <xsd:enumeration value="SepticApproval"/>
+ <xsd:enumeration value="Service"/>
+ <xsd:enumeration value="ServiceCompletionDateTimeActual"/>
+ <xsd:enumeration value="ServiceInterruption"/>
+ <xsd:enumeration value="ServicePeriodEnd"/>
+ <xsd:enumeration value="ServicePeriodStart"/>
+ <xsd:enumeration value="ServiceRequested"/>
+ <xsd:enumeration value="ServicerSignatureDate"/>
+ <xsd:enumeration value="Setoff"/>
+ <xsd:enumeration value="Settled"/>
+ <xsd:enumeration value="SettlementDate"/>
+ <xsd:enumeration value="SettlementDateAsSpecifiedByTheOriginator"/>
+ <xsd:enumeration value="SettlementDateFromInterlineSettlementSystemOnly"/>
+ <xsd:enumeration value="SettlementDatePlanned"/>
+ <xsd:enumeration value="SettlementDueDate"/>
+ <xsd:enumeration value="SettlementStatus"/>
+ <xsd:enumeration value="SharePrice"/>
+ <xsd:enumeration value="ShelfLifeExpiration"/>
+ <xsd:enumeration value="ShipDateOriginallyScheduled"/>
+ <xsd:enumeration value="ShipDuringDate"/>
+ <xsd:enumeration value="ShipmentDateTimePromisedFor"/>
+ <xsd:enumeration value="ShipmentDateTimePromisedForPriorToAndIncluding"/>
+ <xsd:enumeration value="ShipmentDateTimeRequested"/>
+ <xsd:enumeration value="ShipNotLaterThanDateTime"/>
+ <xsd:enumeration value="ShipNotBeforeDateTime"/>
+ <xsd:enumeration value="ShipNotBeforeAndNotAfterDateTime"/>
+ <xsd:enumeration value="ShipOnOrAboutDate"/>
+ <xsd:enumeration value="Shipped"/>
+ <xsd:enumeration value="ShippingDateAndOrTimeCurrentSchedule"/>
+ <xsd:enumeration value="ShippingDateNoScheduleEstablishedAsOf"/>
+ <xsd:enumeration value="ShipWeekOfDate"/>
+ <xsd:enumeration value="ShutIn"/>
+ <xsd:enumeration value="SicknessBenefitAgeLimit"/>
+ <xsd:enumeration value="SicknessBenefitPeriod"/>
+ <xsd:enumeration value="SicknessInsuranceEliminationPeriod"/>
+ <xsd:enumeration value="SicknessLifetimeBenefitQualificationAge"/>
+ <xsd:enumeration value="SidetrackedWellbore"/>
+ <xsd:enumeration value="SignatureDate"/>
+ <xsd:enumeration value="SignatureReceived"/>
+ <xsd:enumeration value="SimilarIllnessOnsetDate"/>
+ <xsd:enumeration value="SimpleInterestDue"/>
+ <xsd:enumeration value="SlaughteringEndDate"/>
+ <xsd:enumeration value="SlaughteringStartDate"/>
+ <xsd:enumeration value="SocialSecurityClaimsVerificationDate"/>
+ <xsd:enumeration value="Sold"/>
+ <xsd:enumeration value="SoldBookPublication"/>
+ <xsd:enumeration value="SoleDirectorshipRegistrationDate"/>
+ <xsd:enumeration value="Solicitation"/>
+ <xsd:enumeration value="SourceDocumentCaptureDate"/>
+ <xsd:enumeration value="SpacingOrderUnitAssigned"/>
+ <xsd:enumeration value="SponsoredDependent"/>
+ <xsd:enumeration value="SponsoredDependentBegin"/>
+ <xsd:enumeration value="SponsoredDependentEnd"/>
+ <xsd:enumeration value="SpouseRetirement"/>
+ <xsd:enumeration value="Spud"/>
+ <xsd:enumeration value="StartDateTime"/>
+ <xsd:enumeration value="StartDateOrTimeActual"/>
+ <xsd:enumeration value="StartDateOrTimeEarliest"/>
+ <xsd:enumeration value="StartDateOrTimeEstimated"/>
+ <xsd:enumeration value="StartDateOrTimeLatest"/>
+ <xsd:enumeration value="StartDateOrTimeMandatory"/>
+ <xsd:enumeration value="StartDateOrTimeNotAfter"/>
+ <xsd:enumeration value="StartDateOrTimeNotBefore"/>
+ <xsd:enumeration value="StartDateOrTimeScheduled"/>
+ <xsd:enumeration value="StartDateTimePlanned"/>
+ <xsd:enumeration value="StartedDoingBusiness"/>
+ <xsd:enumeration value="StartNoEarlierThan"/>
+ <xsd:enumeration value="StartNoLaterThan"/>
+ <xsd:enumeration value="Statement"/>
+ <xsd:enumeration value="StateResidencyDate"/>
+ <xsd:enumeration value="StateTermination"/>
+ <xsd:enumeration value="StatisticalTimeSeriesDate"/>
+ <xsd:enumeration value="Status"/>
+ <xsd:enumeration value="StatusAfterAndIncluding"/>
+ <xsd:enumeration value="StatusAssignmentDate"/>
+ <xsd:enumeration value="StatusChangeDateTime"/>
+ <xsd:enumeration value="StatusCommercial"/>
+ <xsd:enumeration value="StatusOutsideProcessor"/>
+ <xsd:enumeration value="StatusPriorAndIncluding"/>
+ <xsd:enumeration value="StopDistributionDate"/>
+ <xsd:enumeration value="StopWorkAsOfGivenDate"/>
+ <xsd:enumeration value="Stored"/>
+ <xsd:enumeration value="StudentSigned"/>
+ <xsd:enumeration value="SubcontractorPeriodOfHire"/>
+ <xsd:enumeration value="SubmissionDate"/>
+ <xsd:enumeration value="Submittal"/>
+ <xsd:enumeration value="SubsequentInterestPaymentDue"/>
+ <xsd:enumeration value="SubsequentSubmission"/>
+ <xsd:enumeration value="SupersededDateTime"/>
+ <xsd:enumeration value="SupplementalIssue"/>
+ <xsd:enumeration value="SuppliersAverageCreditPeriod"/>
+ <xsd:enumeration value="SurfaceCasingAuthorityApproval"/>
+ <xsd:enumeration value="Surgery"/>
+ <xsd:enumeration value="Surrender"/>
+ <xsd:enumeration value="SurveyYear"/>
+ <xsd:enumeration value="SuspendedDate"/>
+ <xsd:enumeration value="SuspensionEffective"/>
+ <xsd:enumeration value="SuspensionPeriod"/>
+ <xsd:enumeration value="SwornAndSubscribed"/>
+ <xsd:enumeration value="SymptomsOnsetPatientAlleged"/>
+ <xsd:enumeration value="SystemSurvey"/>
+ <xsd:enumeration value="SystemTest"/>
+ <xsd:enumeration value="TableRatingEnd"/>
+ <xsd:enumeration value="TailCoverageBegin"/>
+ <xsd:enumeration value="TailCoverageEnd"/>
+ <xsd:enumeration value="TanksAcceptedDateTime"/>
+ <xsd:enumeration value="TanksInspectedDateTime"/>
+ <xsd:enumeration value="Tax"/>
+ <xsd:enumeration value="TaxPeriod"/>
+ <xsd:enumeration value="TaxPeriodEndDate"/>
+ <xsd:enumeration value="TaxPeriodStartDate"/>
+ <xsd:enumeration value="TaxPointDate"/>
+ <xsd:enumeration value="TaxYear"/>
+ <xsd:enumeration value="TechnicalRating"/>
+ <xsd:enumeration value="TelexDate"/>
+ <xsd:enumeration value="TemporaryProsthesisDate"/>
+ <xsd:enumeration value="TenderSubmissionDateTime"/>
+ <xsd:enumeration value="TerminatedDate"/>
+ <xsd:enumeration value="Termination"/>
+ <xsd:enumeration value="TerminationOfFacility"/>
+ <xsd:enumeration value="TermsDiscountDueDateTime"/>
+ <xsd:enumeration value="TermsMet"/>
+ <xsd:enumeration value="TermsNetDueDate"/>
+ <xsd:enumeration value="TestCompletionDate"/>
+ <xsd:enumeration value="TestPerformed"/>
+ <xsd:enumeration value="TestPeriodEnding"/>
+ <xsd:enumeration value="TestStartDate"/>
+ <xsd:enumeration value="TexasLineTermination"/>
+ <xsd:enumeration value="Therapy"/>
+ <xsd:enumeration value="TimeEmployeeBeganWork"/>
+ <xsd:enumeration value="TimeInUS"/>
+ <xsd:enumeration value="TimeLimit"/>
+ <xsd:enumeration value="TimeNowDate"/>
+ <xsd:enumeration value="TimePeriod"/>
+ <xsd:enumeration value="TitleTransfer"/>
+ <xsd:enumeration value="ToolingRequiredDate"/>
+ <xsd:enumeration value="TotalShelfLifePeriod"/>
+ <xsd:enumeration value="Tour"/>
+ <xsd:enumeration value="TradeDate"/>
+ <xsd:enumeration value="TradeStyleRegistrationDate"/>
+ <xsd:enumeration value="TrainingBegin"/>
+ <xsd:enumeration value="TrainingEnd"/>
+ <xsd:enumeration value="TransactionCreationDate"/>
+ <xsd:enumeration value="TransferNoteAcceptanceDateAndTime"/>
+ <xsd:enumeration value="Transferred"/>
+ <xsd:enumeration value="TranshipmentDateTime"/>
+ <xsd:enumeration value="Transition"/>
+ <xsd:enumeration value="TransitTimeLimits"/>
+ <xsd:enumeration value="TransmissionDateTimeOfDocument"/>
+ <xsd:enumeration value="Transmitted"/>
+ <xsd:enumeration value="TransportEquipmentStrippingDateAndOrTime"/>
+ <xsd:enumeration value="TransportEquipmentStuffingDateAndOrTime"/>
+ <xsd:enumeration value="Travel"/>
+ <xsd:enumeration value="Treatment"/>
+ <xsd:enumeration value="TreatmentEnd"/>
+ <xsd:enumeration value="TreatmentStart"/>
+ <xsd:enumeration value="TrialBalancePeriod"/>
+ <xsd:enumeration value="TrialSet"/>
+ <xsd:enumeration value="TrialStartDateActual"/>
+ <xsd:enumeration value="TrialStartDateScheduled"/>
+ <xsd:enumeration value="Trust"/>
+ <xsd:enumeration value="UnderwritingYear"/>
+ <xsd:enumeration value="UnloadedDateAndTime"/>
+ <xsd:enumeration value="ValidationDate"/>
+ <xsd:enumeration value="ValidityPeriod"/>
+ <xsd:enumeration value="ValidityStartDate"/>
+ <xsd:enumeration value="ValidUntil"/>
+ <xsd:enumeration value="ValuationDateTime"/>
+ <xsd:enumeration value="ValuationDateCustoms"/>
+ <xsd:enumeration value="ValueAddedTaxClaimsVerificationDate"/>
+ <xsd:enumeration value="ValueDate"/>
+ <xsd:enumeration value="ValueDateOfIndex"/>
+ <xsd:enumeration value="VerbalReportNeeded"/>
+ <xsd:enumeration value="VerificationReceived"/>
+ <xsd:enumeration value="VerificationSent"/>
+ <xsd:enumeration value="Verified"/>
+ <xsd:enumeration value="Version"/>
+ <xsd:enumeration value="VesselRegistry"/>
+ <xsd:enumeration value="VestingService"/>
+ <xsd:enumeration value="VestingServiceBegin"/>
+ <xsd:enumeration value="VestingServiceEnd"/>
+ <xsd:enumeration value="VoluntaryTermination"/>
+ <xsd:enumeration value="VoucherDateOf"/>
+ <xsd:enumeration value="WageEffective"/>
+ <xsd:enumeration value="WagesEarned"/>
+ <xsd:enumeration value="WagePeriodEndDate"/>
+ <xsd:enumeration value="WagePeriodStartDate"/>
+ <xsd:enumeration value="WaitingTime"/>
+ <xsd:enumeration value="WarrantyExpiration"/>
+ <xsd:enumeration value="Waybill"/>
+ <xsd:enumeration value="WeekEnding"/>
+ <xsd:enumeration value="Weighed"/>
+ <xsd:enumeration value="WellLogRun"/>
+ <xsd:enumeration value="WholesaleContractEffective"/>
+ <xsd:enumeration value="WholesaleContractExpiration"/>
+ <xsd:enumeration value="WillAdviseAsOf"/>
+ <xsd:enumeration value="WithdrawnDate"/>
+ <xsd:enumeration value="WithheldDate"/>
+ <xsd:enumeration value="WorkEffectiveStartDate"/>
+ <xsd:enumeration value="WorkingPeriodEndDate"/>
+ <xsd:enumeration value="WorkingPeriodStartDate"/>
+ <xsd:enumeration value="WorkPeriod"/>
+ <xsd:enumeration value="WorksCompletionDateTimeActual"/>
+ <xsd:enumeration value="WorksCompletionDateTimePlanned"/>
+ <xsd:enumeration value="WorstTimeToCall"/>
+ <xsd:enumeration value="YearBeginning"/>
+ <xsd:enumeration value="YearDue"/>
+ <xsd:enumeration value="YearEnding"/>
+ <xsd:enumeration value="YearOfOccurrence"/>
+ <xsd:enumeration value="YearToDate"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Transport">
+ <xsd:sequence>
+ <xsd:element name="TransportID" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="TransportMode"/>
+ <xsd:element minOccurs="0" ref="TransportMeans"/>
+ <xsd:element minOccurs="0" name="CarrierName" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CarrierID">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="CustShippingContractNum" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ServiceLevelCoded" type="ServiceLevelCode"/>
+ <xsd:element minOccurs="0" name="ServiceLevelCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ShippingInstructions" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportLegCoded" type="TransportLegCode"/>
+ <xsd:element minOccurs="0" name="TransportLegCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfTransportEquipment"/>
+ <xsd:element minOccurs="0" ref="TransitDirection"/>
+ <xsd:element minOccurs="0" name="TransportNote" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Transport" type="Transport"/>
+ <xsd:complexType name="TransportMode">
+ <xsd:sequence>
+ <xsd:element name="TransportModeCoded" type="TransportModeCode"/>
+ <xsd:element minOccurs="0" name="TransportModeCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportMode" type="TransportMode"/>
+ <xsd:simpleType name="TransportModeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Air"/>
+ <xsd:enumeration value="AirCharter"/>
+ <xsd:enumeration value="AirExpress"/>
+ <xsd:enumeration value="AirFreight"/>
+ <xsd:enumeration value="AirFrieghtForwarder"/>
+ <xsd:enumeration value="AirTaxi"/>
+ <xsd:enumeration value="AirTransport"/>
+ <xsd:enumeration value="ArmedForcesCourierService"/>
+ <xsd:enumeration value="Backhaul"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BestWay-ShippersOption"/>
+ <xsd:enumeration value="BookPostal"/>
+ <xsd:enumeration value="Bus"/>
+ <xsd:enumeration value="CabOrTaxi"/>
+ <xsd:enumeration value="CommonIrregularCarrier"/>
+ <xsd:enumeration value="Consolidation"/>
+ <xsd:enumeration value="ContainerizedOcean"/>
+ <xsd:enumeration value="ContractCarrier"/>
+ <xsd:enumeration value="ConventionalOcean"/>
+ <xsd:enumeration value="CustomerPickup"/>
+ <xsd:enumeration value="CustomerPickupOrCustomersExpense"/>
+ <xsd:enumeration value="Driveaway"/>
+ <xsd:enumeration value="DriveawayService"/>
+ <xsd:enumeration value="EuropeanOrPacificDistributionSystem"/>
+ <xsd:enumeration value="ExpeditedTruck"/>
+ <xsd:enumeration value="FixedTransportInstallation"/>
+ <xsd:enumeration value="Flyaway"/>
+ <xsd:enumeration value="GeographicReceiving"/>
+ <xsd:enumeration value="GeographicReceivingOrShipping"/>
+ <xsd:enumeration value="GeographicShipping"/>
+ <xsd:enumeration value="InlandWaterTransport"/>
+ <xsd:enumeration value="InlandWaterway"/>
+ <xsd:enumeration value="Intermodal-Piggyback"/>
+ <xsd:enumeration value="LessThanTrailerLoad"/>
+ <xsd:enumeration value="Logair"/>
+ <xsd:enumeration value="Mail"/>
+ <xsd:enumeration value="MaritimeTransport"/>
+ <xsd:enumeration value="MilitaryIntratheaterAirliftService"/>
+ <xsd:enumeration value="MilitaryOfficialMail"/>
+ <xsd:enumeration value="ModeUnknown"/>
+ <xsd:enumeration value="Motor"/>
+ <xsd:enumeration value="Motor-BulkCarrier"/>
+ <xsd:enumeration value="Motor-CommonCarrier"/>
+ <xsd:enumeration value="Motor-Flatbed"/>
+ <xsd:enumeration value="Motor-PackageCarrier"/>
+ <xsd:enumeration value="Motor-Van"/>
+ <xsd:enumeration value="MutimodalTransport"/>
+ <xsd:enumeration value="Ocean"/>
+ <xsd:enumeration value="OceanConferenceCarrier"/>
+ <xsd:enumeration value="OceanNon-ConferenceCarrier"/>
+ <xsd:enumeration value="ParcelPost"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PooledAir"/>
+ <xsd:enumeration value="PooledPiggyback"/>
+ <xsd:enumeration value="PooledRail"/>
+ <xsd:enumeration value="PooledTruck"/>
+ <xsd:enumeration value="PoolToPool"/>
+ <xsd:enumeration value="PrivateCarrier"/>
+ <xsd:enumeration value="PrivateParcelService"/>
+ <xsd:enumeration value="PrivateVessel"/>
+ <xsd:enumeration value="Quicktrans"/>
+ <xsd:enumeration value="Rail"/>
+ <xsd:enumeration value="RailTransport"/>
+ <xsd:enumeration value="Roadrailer"/>
+ <xsd:enumeration value="RoadTransport"/>
+ <xsd:enumeration value="SeaOrAir"/>
+ <xsd:enumeration value="ShipperAgent"/>
+ <xsd:enumeration value="ShipperAgent-Truck"/>
+ <xsd:enumeration value="ShipperAssociation"/>
+ <xsd:enumeration value="StackTrain"/>
+ <xsd:enumeration value="Steamship"/>
+ <xsd:enumeration value="SupplierTruck"/>
+ <xsd:enumeration value="TowawayService"/>
+ <xsd:enumeration value="Vessel"/>
+ <xsd:enumeration value="WaterOrPipelineIntermodalMovement"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TransportMeans">
+ <xsd:sequence>
+ <xsd:element name="TransportMeansCoded" type="TransportMeansCode"/>
+ <xsd:element minOccurs="0" name="TransportMeansCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportMeans" type="TransportMeans"/>
+ <xsd:simpleType name="TransportMeansCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="20FtILContainer-ClosedTop"/>
+ <xsd:enumeration value="20FtILContainer-OpenTop"/>
+ <xsd:enumeration value="40FtILContainer-OpenTop"/>
+ <xsd:enumeration value="40FtILContainer-ClosedTop"/>
+ <xsd:enumeration value="Aircraft"/>
+ <xsd:enumeration value="AirFreight-BreakBulk"/>
+ <xsd:enumeration value="AirRideVan"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BargeChemicalTanker"/>
+ <xsd:enumeration value="BargeOpen"/>
+ <xsd:enumeration value="BilevelRailcarFullyEnclosed"/>
+ <xsd:enumeration value="BilevelRailcarFullyOpen"/>
+ <xsd:enumeration value="BilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="BilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Bogie"/>
+ <xsd:enumeration value="Boxcar"/>
+ <xsd:enumeration value="BoxcarCushionUnderFrameOF"/>
+ <xsd:enumeration value="Boxcar-DamageFreeEquipped"/>
+ <xsd:enumeration value="Boxcar-Insulated"/>
+ <xsd:enumeration value="Boxcar-InteriorBulkheads"/>
+ <xsd:enumeration value="Bulktruck"/>
+ <xsd:enumeration value="BulkTruckAndBulkTrailer"/>
+ <xsd:enumeration value="BulkTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="BulkTruckAndExtendableTrailer"/>
+ <xsd:enumeration value="BulkTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="BulkTruckAndTankTrailer"/>
+ <xsd:enumeration value="BulkTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Bus"/>
+ <xsd:enumeration value="Caboose"/>
+ <xsd:enumeration value="Car"/>
+ <xsd:enumeration value="CarCarrier"/>
+ <xsd:enumeration value="CargoAndPassengerVessel"/>
+ <xsd:enumeration value="CarWithCaravan"/>
+ <xsd:enumeration value="CementVessel"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="Chassis-Gooseneck"/>
+ <xsd:enumeration value="ClosedContainer"/>
+ <xsd:enumeration value="ClosedContainer-ControlledTemperature"/>
+ <xsd:enumeration value="ClosedVan"/>
+ <xsd:enumeration value="CoalVessel"/>
+ <xsd:enumeration value="CoasterChemicalTanker"/>
+ <xsd:enumeration value="Coil-CarCovered"/>
+ <xsd:enumeration value="CoilCarOpen"/>
+ <xsd:enumeration value="Container"/>
+ <xsd:enumeration value="Container-Aluminum"/>
+ <xsd:enumeration value="Container-Bulk"/>
+ <xsd:enumeration value="Container-ClosedTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-HighSideOpenTop"/>
+ <xsd:enumeration value="Container-Insulated"/>
+ <xsd:enumeration value="Container-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-LowSideOpenTop"/>
+ <xsd:enumeration value="ContainerOnlyVessel"/>
+ <xsd:enumeration value="Container-Open-Sided"/>
+ <xsd:enumeration value="Container-OpenTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-Platform"/>
+ <xsd:enumeration value="ContainerrestingonaChassis"/>
+ <xsd:enumeration value="ContainerShip"/>
+ <xsd:enumeration value="Container-Steel"/>
+ <xsd:enumeration value="Container-Tank"/>
+ <xsd:enumeration value="Container-TankChemicals"/>
+ <xsd:enumeration value="Container-TankFoodGrade-Liquid"/>
+ <xsd:enumeration value="Container-TankGas"/>
+ <xsd:enumeration value="Container-Upgraded"/>
+ <xsd:enumeration value="Container-Vented"/>
+ <xsd:enumeration value="ContainerwithBagHangers"/>
+ <xsd:enumeration value="ContainerwithFloorSecuringRings"/>
+ <xsd:enumeration value="ContainerwithFlushDoors"/>
+ <xsd:enumeration value="ContainerwithHangarBars"/>
+ <xsd:enumeration value="ContainerWithSmoothSides"/>
+ <xsd:enumeration value="ContainerWithWavyOrRippleSides"/>
+ <xsd:enumeration value="ControlledTemperatureTrailer"/>
+ <xsd:enumeration value="ControlUnit"/>
+ <xsd:enumeration value="CoveredBarge"/>
+ <xsd:enumeration value="CrudeOilTanker"/>
+ <xsd:enumeration value="CustomerDeterminedDeansOfTransport"/>
+ <xsd:enumeration value="CustomerRailTanker"/>
+ <xsd:enumeration value="Cut-InHelper"/>
+ <xsd:enumeration value="DeepSeaChemicalTanker"/>
+ <xsd:enumeration value="Double-DropTrailer"/>
+ <xsd:enumeration value="DropBackTrailer"/>
+ <xsd:enumeration value="DryBulkCarrier"/>
+ <xsd:enumeration value="EndofTrainDevice"/>
+ <xsd:enumeration value="ExceptionalTransport"/>
+ <xsd:enumeration value="Ferry"/>
+ <xsd:enumeration value="FishingVessel"/>
+ <xsd:enumeration value="Fixed-RackDoubleDropTrailer"/>
+ <xsd:enumeration value="FixedRack-FlatBedTrailer"/>
+ <xsd:enumeration value="FixedRack-SingleDropTrailer"/>
+ <xsd:enumeration value="FlatbedSlidingTandem"/>
+ <xsd:enumeration value="FlatBedTrailer"/>
+ <xsd:enumeration value="FlatBedTrailer-RemovableSides"/>
+ <xsd:enumeration value="FlatBedTrailerwithHeadboards"/>
+ <xsd:enumeration value="FlatBedTrailerwithNoHeadboards"/>
+ <xsd:enumeration value="FlatCar"/>
+ <xsd:enumeration value="FlatCar-EndBulkheads"/>
+ <xsd:enumeration value="FlatcarWithPedestal"/>
+ <xsd:enumeration value="FreezerTruck"/>
+ <xsd:enumeration value="FreezerTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="FreezerTruckAndRefrigeratedTrailer"/>
+ <xsd:enumeration value="FreezerTruckAndTrailer"/>
+ <xsd:enumeration value="FreezerVan"/>
+ <xsd:enumeration value="FrozenFoodTrailer"/>
+ <xsd:enumeration value="FurnitureTruck"/>
+ <xsd:enumeration value="GasTanker"/>
+ <xsd:enumeration value="GeneralCargoVessel"/>
+ <xsd:enumeration value="GeneratorSet"/>
+ <xsd:enumeration value="GondolaCar-CoveredInteriorBulkheads"/>
+ <xsd:enumeration value="GondolaCar-Open"/>
+ <xsd:enumeration value="GondolaCovered"/>
+ <xsd:enumeration value="Graincarrier"/>
+ <xsd:enumeration value="GravelVessel"/>
+ <xsd:enumeration value="HalfHeightFlatRack"/>
+ <xsd:enumeration value="Head-EndHelperUnit"/>
+ <xsd:enumeration value="HeadofTrainDevice"/>
+ <xsd:enumeration value="HighCubeVan"/>
+ <xsd:enumeration value="HopperCar-Covered"/>
+ <xsd:enumeration value="HopperCar-CoveredPneumaticDischarge"/>
+ <xsd:enumeration value="HopperCar-Open"/>
+ <xsd:enumeration value="HydrantCart"/>
+ <xsd:enumeration value="IdlerCar"/>
+ <xsd:enumeration value="IsothermicTruck"/>
+ <xsd:enumeration value="IsothermicTruckAndFreezerTrailer"/>
+ <xsd:enumeration value="IsothermicTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="Isothermictruckandrefrigeratedtrailer"/>
+ <xsd:enumeration value="IsothermicVan"/>
+ <xsd:enumeration value="LiquefiedNaturalGasCarrier"/>
+ <xsd:enumeration value="LiquefiedPetroleumGasCarrier"/>
+ <xsd:enumeration value="LoadOrUnloadDeviceOnEquipment"/>
+ <xsd:enumeration value="Locomotive"/>
+ <xsd:enumeration value="OceanVessel"/>
+ <xsd:enumeration value="OilProductsTanker"/>
+ <xsd:enumeration value="Open-TopOrFlatBedTrailer"/>
+ <xsd:enumeration value="OpenTopVan"/>
+ <xsd:enumeration value="OreCarrier"/>
+ <xsd:enumeration value="PassengerVessel"/>
+ <xsd:enumeration value="PatrolVessel"/>
+ <xsd:enumeration value="Pick-UpTruck"/>
+ <xsd:enumeration value="Pipeline"/>
+ <xsd:enumeration value="PowerPack"/>
+ <xsd:enumeration value="ProtectedTrailer"/>
+ <xsd:enumeration value="RailBulkCar"/>
+ <xsd:enumeration value="RailCar"/>
+ <xsd:enumeration value="RailExpress"/>
+ <xsd:enumeration value="RailroadMaintenanceOfWayCar"/>
+ <xsd:enumeration value="RailSiloTanker"/>
+ <xsd:enumeration value="RailTanker"/>
+ <xsd:enumeration value="Rear-EndHelperUnit"/>
+ <xsd:enumeration value="RefrigeratedCar"/>
+ <xsd:enumeration value="RefrigeratedContainer"/>
+ <xsd:enumeration value="RefrigeratedTruck"/>
+ <xsd:enumeration value="RefrigeratedTruckAndFreezerTrailer"/>
+ <xsd:enumeration value="RefrigeratedTruckAndIsothermicTrailer"/>
+ <xsd:enumeration value="RefrigeratedTruckAndTrailer"/>
+ <xsd:enumeration value="RefrigeratedVan"/>
+ <xsd:enumeration value="RemovableSideTrailer"/>
+ <xsd:enumeration value="RemovalTruckAndTrailer"/>
+ <xsd:enumeration value="RigidTruckWithTank"/>
+ <xsd:enumeration value="RigidTruckWithTankAndBulkTrailer"/>
+ <xsd:enumeration value="RigidTruckWithTankAndTankTrailer"/>
+ <xsd:enumeration value="RoadRailer"/>
+ <xsd:enumeration value="RoadSiloTanker"/>
+ <xsd:enumeration value="RoadTanker"/>
+ <xsd:enumeration value="RollOn-RollOffVessel"/>
+ <xsd:enumeration value="Saddle"/>
+ <xsd:enumeration value="SellerDeterminedMeansOfTransport"/>
+ <xsd:enumeration value="ServiceCar"/>
+ <xsd:enumeration value="Ship"/>
+ <xsd:enumeration value="ShipTanker"/>
+ <xsd:enumeration value="Single-DropTrailer"/>
+ <xsd:enumeration value="StackCar"/>
+ <xsd:enumeration value="STAK-RAK"/>
+ <xsd:enumeration value="SteelProductsVessel"/>
+ <xsd:enumeration value="TankCar"/>
+ <xsd:enumeration value="Tautliner25TonneWith90CubicMeterTrailer"/>
+ <xsd:enumeration value="TautlinerTruck"/>
+ <xsd:enumeration value="TautlinerTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndExtendableTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndRemovalTrailer"/>
+ <xsd:enumeration value="TautlinerTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoof"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndExtendableTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndGondolaTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofAndRemovalTrailer"/>
+ <xsd:enumeration value="TautlinerTruckWithRemovableRoofandTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Taxi"/>
+ <xsd:enumeration value="TelescopingTrailer"/>
+ <xsd:enumeration value="TimberOrLogCarrier"/>
+ <xsd:enumeration value="Tip-UpArticulatedTruck"/>
+ <xsd:enumeration value="Tip-Uptruck"/>
+ <xsd:enumeration value="Tip-UpTruckAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="Tip-UpTruckAndGondolaTrailer"/>
+ <xsd:enumeration value="Tip-UpTruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Tractor"/>
+ <xsd:enumeration value="Trailer-Boat"/>
+ <xsd:enumeration value="Trailer-Car"/>
+ <xsd:enumeration value="Trailer-DryFreight"/>
+ <xsd:enumeration value="Trailer-ElectricHeat"/>
+ <xsd:enumeration value="Trailer-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-Insulated"/>
+ <xsd:enumeration value="Trailer-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-NotOtherwiseSpecified"/>
+ <xsd:enumeration value="Trailer-Pneumatic"/>
+ <xsd:enumeration value="Trailer-Refrigerated"/>
+ <xsd:enumeration value="Trailer-Tank-Chemicals"/>
+ <xsd:enumeration value="Trailer-Tank-FoodGradeLiquid"/>
+ <xsd:enumeration value="Trailer-Tank-Gas"/>
+ <xsd:enumeration value="TrainingVessel"/>
+ <xsd:enumeration value="TrainWith20OrMoreWagons"/>
+ <xsd:enumeration value="TrainWithMoreThanOneAndLessThan20Wagons"/>
+ <xsd:enumeration value="TrainWithOneWagon"/>
+ <xsd:enumeration value="TrilevelRailcar20Feet"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-FullyEnclosed"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithDoorsNoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Truck"/>
+ <xsd:enumeration value="TruckAndTrailerWithOpeningFloor"/>
+ <xsd:enumeration value="Truck-OpenTop"/>
+ <xsd:enumeration value="Truck-OpenTopHighSide"/>
+ <xsd:enumeration value="Truck-OpenTopLowSide"/>
+ <xsd:enumeration value="TruckOrTrailerWithTilt"/>
+ <xsd:enumeration value="Truck-Van"/>
+ <xsd:enumeration value="TruckWithOpeningFloor"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndExtendableGondolaTrailer"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndExtendableTrailer"/>
+ <xsd:enumeration value="TruckWithOpeningFloorAndGondolaTrailer"/>
+ <xsd:enumeration value="TugandOrPushboat"/>
+ <xsd:enumeration value="UnitLoadDevice"/>
+ <xsd:enumeration value="Van"/>
+ <xsd:enumeration value="Van-SpecialInsideLengthWidthOrHeightRequirements"/>
+ <xsd:enumeration value="Vessel-Lake"/>
+ <xsd:enumeration value="Vessel-Ocean"/>
+ <xsd:enumeration value="Vessel-Ocean-Containership"/>
+ <xsd:enumeration value="Vessel-Ocean-Lash"/>
+ <xsd:enumeration value="Vessel-Ocean-RollOn-RollOff"/>
+ <xsd:enumeration value="Woodchipcarrier"/>
+ <xsd:enumeration value="WorkVessel"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ServiceLevelCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BulkCommodityTrain"/>
+ <xsd:enumeration value="PremiumSurface"/>
+ <xsd:enumeration value="ThreeDayService"/>
+ <xsd:enumeration value="9AM"/>
+ <xsd:enumeration value="AirCargo"/>
+ <xsd:enumeration value="AirEconomy"/>
+ <xsd:enumeration value="AM"/>
+ <xsd:enumeration value="BusinessClass"/>
+ <xsd:enumeration value="ConsigneeBillingService"/>
+ <xsd:enumeration value="CourierExpress"/>
+ <xsd:enumeration value="Ground"/>
+ <xsd:enumeration value="ExpressService"/>
+ <xsd:enumeration value="DeliveryScheduledNextDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryScheduledSecondDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryScheduledThirdDayByCartageAgent"/>
+ <xsd:enumeration value="DeliveryConfirmation"/>
+ <xsd:enumeration value="DeferredService"/>
+ <xsd:enumeration value="DeliveryConfirmationReturn"/>
+ <xsd:enumeration value="DoorService"/>
+ <xsd:enumeration value="DeliveryNotificationOnly"/>
+ <xsd:enumeration value="ExpeditedService"/>
+ <xsd:enumeration value="ProofOfDeliveryWithSignature"/>
+ <xsd:enumeration value="FirstClass"/>
+ <xsd:enumeration value="StandardService"/>
+ <xsd:enumeration value="ExpressServicePlus"/>
+ <xsd:enumeration value="TrackingGround"/>
+ <xsd:enumeration value="Iata"/>
+ <xsd:enumeration value="ExpeditedServiceWorldwide"/>
+ <xsd:enumeration value="ExpressServiceWorldwide"/>
+ <xsd:enumeration value="Metro"/>
+ <xsd:enumeration value="Multiweight"/>
+ <xsd:enumeration value="NextDayAir"/>
+ <xsd:enumeration value="NextFlightOut"/>
+ <xsd:enumeration value="NextDayHundredWeight"/>
+ <xsd:enumeration value="NextMorning"/>
+ <xsd:enumeration value="NotServed"/>
+ <xsd:enumeration value="Overnight"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy1030AM"/>
+ <xsd:enumeration value="PriorityMail"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy930AM"/>
+ <xsd:enumeration value="PriorityMailInsured"/>
+ <xsd:enumeration value="PM"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayByNoon"/>
+ <xsd:enumeration value="POBoxZipCode"/>
+ <xsd:enumeration value="PrimaryServiceAreaNextDayBy500PM"/>
+ <xsd:enumeration value="PrimaryServiceAreaSecondDayByNoon"/>
+ <xsd:enumeration value="PassengerService"/>
+ <xsd:enumeration value="QualityIntermodalHighSpeed70MilesPerHour"/>
+ <xsd:enumeration value="OtherIntermodalAndStackService"/>
+ <xsd:enumeration value="60MilesPerHourService"/>
+ <xsd:enumeration value="ManifestFreight"/>
+ <xsd:enumeration value="CircusTrain"/>
+ <xsd:enumeration value="WorkTrain"/>
+ <xsd:enumeration value="CommuterService"/>
+ <xsd:enumeration value="AuthorizedReturnService"/>
+ <xsd:enumeration value="SameDay"/>
+ <xsd:enumeration value="SecondDayAir"/>
+ <xsd:enumeration value="Saturday"/>
+ <xsd:enumeration value="SecondDay"/>
+ <xsd:enumeration value="StandardGround"/>
+ <xsd:enumeration value="SecondDayHundredWeight"/>
+ <xsd:enumeration value="StandardGroundHundredWeight"/>
+ <xsd:enumeration value="SecondMorning"/>
+ <xsd:enumeration value="SaturdayPickup"/>
+ <xsd:enumeration value="StandardClass"/>
+ <xsd:enumeration value="Express"/>
+ <xsd:enumeration value="HighSpeed"/>
+ <xsd:enumeration value="NormalSpeed"/>
+ <xsd:enumeration value="PostService"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransportLegCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="InlandTransport"/>
+ <xsd:enumeration value="AtTheStatisticalTerritoryLimit"/>
+ <xsd:enumeration value="Pre-CarriageTransport"/>
+ <xsd:enumeration value="AtBorder"/>
+ <xsd:enumeration value="AtDeparture"/>
+ <xsd:enumeration value="AtDestination"/>
+ <xsd:enumeration value="MainCarriage-FourthCarrier"/>
+ <xsd:enumeration value="MainCarriage-FifthCarrier"/>
+ <xsd:enumeration value="MainCarriage-SixthCarrier"/>
+ <xsd:enumeration value="MainCarriage-SeventhCarrier"/>
+ <xsd:enumeration value="MainCarriage-EighthCarrier"/>
+ <xsd:enumeration value="Main-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-FirstCarrier"/>
+ <xsd:enumeration value="MaiCarriage-SecondCarrier"/>
+ <xsd:enumeration value="MainCarriage-ThirdCarrier"/>
+ <xsd:enumeration value="InlandWaterwayTransport"/>
+ <xsd:enumeration value="DeliveryCarrierAllTransport"/>
+ <xsd:enumeration value="SecondPre-CarriageTransport"/>
+ <xsd:enumeration value="Pre-AcceptanceTransport"/>
+ <xsd:enumeration value="SecondOn-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-NinthCarrier"/>
+ <xsd:enumeration value="On-CarriageTransport"/>
+ <xsd:enumeration value="MainCarriage-TenthCarrier"/>
+ <xsd:enumeration value="MainCarriage-EleventhCarrier"/>
+ <xsd:enumeration value="MainCarriage-TwelfthCarrier"/>
+ <xsd:enumeration value="1stCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="2ndCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="3rdCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="4thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="5thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="6thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="7thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="8thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="9thCarrierAfterOriginCarrier"/>
+ <xsd:enumeration value="AgentsRoutingOriginCarrier"/>
+ <xsd:enumeration value="OriginDeliveryCarrier"/>
+ <xsd:enumeration value="DELY"/>
+ <xsd:enumeration value="HaulageRightsCarrierAndJunction"/>
+ <xsd:enumeration value="OriginSwitchCarrier"/>
+ <xsd:enumeration value="HaulageMovementCarrierAndJunction"/>
+ <xsd:enumeration value="OriginCarrierAirMotorOrOcean"/>
+ <xsd:enumeration value="OriginCarrierRule11Shipment"/>
+ <xsd:enumeration value="ShippersRoutingOriginCarrier"/>
+ <xsd:enumeration value="IntermediateSwitchCarrier"/>
+ <xsd:enumeration value="LastCarrierInRouteOnReturnRouteMove"/>
+ <xsd:enumeration value="JunctionSettlementCarrierFollowing"/>
+ <xsd:enumeration value="JunctionSettlementCarrierPredecessor"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfTransportEquipment">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="TransportEquipment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfTransportEquipment" type="ListOfTransportEquipment"/>
+ <xsd:complexType name="TransportEquipment">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="EquipmentProviderCoded" type="EquipmentProviderCode"/>
+ <xsd:element minOccurs="0" name="EquipmentProviderCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentOwnerCoded" type="EquipmentOwnerCode"/>
+ <xsd:element minOccurs="0" name="EquipmentOwnerCodedOther" type="xsd:string"/>
+ <xsd:element name="EquipmentID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentSizeTypeCoded" type="EquipmentSizeTypeCode"/>
+ <xsd:element minOccurs="0" name="EquipementSizeTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="EquipmentStatusCoded" type="EquipmentStatusCode"/>
+ <xsd:element minOccurs="0" name="EquipmentStatusCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FullIndicatorCoded" type="FullIndicatorCode"/>
+ <xsd:element minOccurs="0" name="FullIndicatorCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Conditions"/>
+ <xsd:element minOccurs="0" name="EquipmentNote" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfSealInfo"/>
+ <xsd:element minOccurs="0" name="ListOfEquipmentMeasurements">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransportEquipment" type="TransportEquipment"/>
+ <xsd:simpleType name="EquipmentProviderCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="ShipperSupplied"/>
+ <xsd:enumeration value="CarrierSupplied"/>
+ <xsd:enumeration value="ConsolidatorSupplied"/>
+ <xsd:enumeration value="DeconsolidatorSupplied"/>
+ <xsd:enumeration value="ThirdPartySupplied"/>
+ <xsd:enumeration value="ForwarderSuppliedFromALeasingCompany"/>
+ <xsd:enumeration value="ForwarderSuppliedFromTheRailwaysPool"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentOwnerCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="NotCustomerOwnedOrLeased"/>
+ <xsd:enumeration value="SellerOwned"/>
+ <xsd:enumeration value="CustomerOwnedOrLeased"/>
+ <xsd:enumeration value="TripLeased"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentSizeTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="20FtIlContainer-ClosedTop"/>
+ <xsd:enumeration value="20FtIlContainer-OpenTop"/>
+ <xsd:enumeration value="40FtIlContainer-ClosedTop"/>
+ <xsd:enumeration value="40FtIlContainer-OpenTop"/>
+ <xsd:enumeration value="Aircraft"/>
+ <xsd:enumeration value="AirFreight-BreakBulk"/>
+ <xsd:enumeration value="AirRideVan"/>
+ <xsd:enumeration value="Barge"/>
+ <xsd:enumeration value="BargeOpen"/>
+ <xsd:enumeration value="BilevelRailcarFullyEnclosed"/>
+ <xsd:enumeration value="BilevelRailcarFullyOpen"/>
+ <xsd:enumeration value="BilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="BilevelRailcarScreenedWithRoof"/>
+ <xsd:enumeration value="Bogie"/>
+ <xsd:enumeration value="Boxcar"/>
+ <xsd:enumeration value="BoxcarCushionUnderFrameOf"/>
+ <xsd:enumeration value="Boxcar-DamageFreeEquipped"/>
+ <xsd:enumeration value="Boxcar-Insulated"/>
+ <xsd:enumeration value="Boxcar-InteriorBulkheads"/>
+ <xsd:enumeration value="BoxPallet"/>
+ <xsd:enumeration value="Caboose"/>
+ <xsd:enumeration value="Chassis"/>
+ <xsd:enumeration value="Chassis-Gooseneck"/>
+ <xsd:enumeration value="ClosedContainer"/>
+ <xsd:enumeration value="ClosedContainer-ControlledTemperature"/>
+ <xsd:enumeration value="ClosedVan"/>
+ <xsd:enumeration value="Coil-CarCovered"/>
+ <xsd:enumeration value="CoilCarOpen"/>
+ <xsd:enumeration value="Container"/>
+ <xsd:enumeration value="Container-Aluminum"/>
+ <xsd:enumeration value="Container-Bulk"/>
+ <xsd:enumeration value="Container-ClosedTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-HighSideOpenTop"/>
+ <xsd:enumeration value="ContainerIc20Feet"/>
+ <xsd:enumeration value="ContainerIc30Feet"/>
+ <xsd:enumeration value="ContainerIc40Feet"/>
+ <xsd:enumeration value="Container-Insulated"/>
+ <xsd:enumeration value="Container-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Container-LowSideOpenTop"/>
+ <xsd:enumeration value="Container-Open-Sided"/>
+ <xsd:enumeration value="Container-OpenTop-LengthUnspecified"/>
+ <xsd:enumeration value="Container-Platform"/>
+ <xsd:enumeration value="ContainerRestingOnAChassis"/>
+ <xsd:enumeration value="Container-Steel"/>
+ <xsd:enumeration value="Container-Tank"/>
+ <xsd:enumeration value="Container-Tank-Chemicals"/>
+ <xsd:enumeration value="Container-Tank-FoodGrade-Liquid"/>
+ <xsd:enumeration value="Container-Tank-Gas"/>
+ <xsd:enumeration value="Container-Upgraded"/>
+ <xsd:enumeration value="Container-Vented"/>
+ <xsd:enumeration value="ContainerWithBagHangers"/>
+ <xsd:enumeration value="ContainerWithFloorSecuringRings"/>
+ <xsd:enumeration value="ContainerWithFlushDoors"/>
+ <xsd:enumeration value="ContainerWithHangarBars"/>
+ <xsd:enumeration value="ContainerWithSmoothSides"/>
+ <xsd:enumeration value="ContainerWithWavyOrRippleSides"/>
+ <xsd:enumeration value="ControlledTemperatureTrailer-Reefer"/>
+ <xsd:enumeration value="ControlUnit"/>
+ <xsd:enumeration value="CoveredBarge"/>
+ <xsd:enumeration value="Cut-InHelper"/>
+ <xsd:enumeration value="DimeCoatedTank"/>
+ <xsd:enumeration value="Double-DropTrailer"/>
+ <xsd:enumeration value="DropBackTrailer"/>
+ <xsd:enumeration value="DualTrailers"/>
+ <xsd:enumeration value="EndOfTrainDevice"/>
+ <xsd:enumeration value="EpoxyCoatedTank"/>
+ <xsd:enumeration value="EuroPallet"/>
+ <xsd:enumeration value="ExchangeablePallet"/>
+ <xsd:enumeration value="Fixed-Rack-DoubleDropTrailer"/>
+ <xsd:enumeration value="Fixed-Rack-Flat-BedTrailer"/>
+ <xsd:enumeration value="Fixed-Rack-Single-DropTrailer"/>
+ <xsd:enumeration value="FlatbedSlidingTandem"/>
+ <xsd:enumeration value="FlatBedTrailer"/>
+ <xsd:enumeration value="FlatBedTrailer-RemovableSides"/>
+ <xsd:enumeration value="FlatBedTrailerWithHeadboards"/>
+ <xsd:enumeration value="FlatBedTrailerWithNoHeadboards"/>
+ <xsd:enumeration value="FlatCar"/>
+ <xsd:enumeration value="FlatCar-EndBulkheads"/>
+ <xsd:enumeration value="FlatcarWithPedestal"/>
+ <xsd:enumeration value="FrozenFoodTrailer"/>
+ <xsd:enumeration value="GeneratorSet"/>
+ <xsd:enumeration value="GondolaCar-Covered-InteriorBulkheads"/>
+ <xsd:enumeration value="GondolaCar-Open"/>
+ <xsd:enumeration value="GondolaCovered"/>
+ <xsd:enumeration value="HalfHeightFlatRack"/>
+ <xsd:enumeration value="Head-EndHelperUnit"/>
+ <xsd:enumeration value="HeadOfTrainDevice"/>
+ <xsd:enumeration value="HighCubeVan"/>
+ <xsd:enumeration value="HopperCar-Covered"/>
+ <xsd:enumeration value="HopperCar-Covered-PneumaticDischarge"/>
+ <xsd:enumeration value="HopperCar-Open"/>
+ <xsd:enumeration value="Hydrant-Cart"/>
+ <xsd:enumeration value="IdlerCar"/>
+ <xsd:enumeration value="IMO1"/>
+ <xsd:enumeration value="IMO2"/>
+ <xsd:enumeration value="IMO3"/>
+ <xsd:enumeration value="LoadOrUnloadDeviceOnEquipment"/>
+ <xsd:enumeration value="Locomotive"/>
+ <xsd:enumeration value="MovableCase-Between10.90MAnd13.75M"/>
+ <xsd:enumeration value="MovableCase-Between6.15MAnd7.82M"/>
+ <xsd:enumeration value="MovableCase-Between7.82MAnd9.15M"/>
+ <xsd:enumeration value="MovableCase-Between9.15MAnd10.90M"/>
+ <xsd:enumeration value="MovableCase-LessThan6.15M"/>
+ <xsd:enumeration value="NonworkingReeferContainer20Ft"/>
+ <xsd:enumeration value="NonworkingReeferContainer40Ft"/>
+ <xsd:enumeration value="NonWorkingRefrigeratedOrReeferContainer30Ft"/>
+ <xsd:enumeration value="OceanVessel-BreakBulk"/>
+ <xsd:enumeration value="Open-TopOrFlatbedTrailer"/>
+ <xsd:enumeration value="OpenTopVan"/>
+ <xsd:enumeration value="Pick-UpTruck"/>
+ <xsd:enumeration value="PowerPack"/>
+ <xsd:enumeration value="PressurizedTank"/>
+ <xsd:enumeration value="ProtectedTrailer"/>
+ <xsd:enumeration value="RailCar"/>
+ <xsd:enumeration value="RailroadMaintenanceOfWayCar"/>
+ <xsd:enumeration value="Rear-EndHelperUnit"/>
+ <xsd:enumeration value="RefrigeratedContainer"/>
+ <xsd:enumeration value="RefrigeratedOrReeferCar"/>
+ <xsd:enumeration value="RefrigeratedTank"/>
+ <xsd:enumeration value="RefrigeratedTank20Feet"/>
+ <xsd:enumeration value="RefrigeratedTank30Feet"/>
+ <xsd:enumeration value="RefrigeratedTank40Feet"/>
+ <xsd:enumeration value="RefrigeratedTankIc20Feet"/>
+ <xsd:enumeration value="RefrigeratedTankIc40Feet"/>
+ <xsd:enumeration value="RemovableSideTrailer"/>
+ <xsd:enumeration value="Roadrailer"/>
+ <xsd:enumeration value="Saddle"/>
+ <xsd:enumeration value="ScandinavianPallet"/>
+ <xsd:enumeration value="Semi-Refrigerated"/>
+ <xsd:enumeration value="Semi-Trailer"/>
+ <xsd:enumeration value="ServiceCar"/>
+ <xsd:enumeration value="Single-DropTrailer"/>
+ <xsd:enumeration value="StackCar"/>
+ <xsd:enumeration value="StainlessSteelTank"/>
+ <xsd:enumeration value="Stak-Rak"/>
+ <xsd:enumeration value="TankCar"/>
+ <xsd:enumeration value="TankContainer20Feet"/>
+ <xsd:enumeration value="TankContainer30Feet"/>
+ <xsd:enumeration value="TankContainer40Feet"/>
+ <xsd:enumeration value="TankContainerIc20Feet"/>
+ <xsd:enumeration value="TankContainerIc30Feet"/>
+ <xsd:enumeration value="TankContainerIc40Feet"/>
+ <xsd:enumeration value="TelescopingTrailer"/>
+ <xsd:enumeration value="TemperatureControlledContainer20Ft"/>
+ <xsd:enumeration value="TemperatureControlledContainer30Ft"/>
+ <xsd:enumeration value="TemperatureControlledContainer40Ft"/>
+ <xsd:enumeration value="Totebin"/>
+ <xsd:enumeration value="Tractor"/>
+ <xsd:enumeration value="Trailer"/>
+ <xsd:enumeration value="Trailer-Boat"/>
+ <xsd:enumeration value="Trailer-Car"/>
+ <xsd:enumeration value="Trailer-DryFreight"/>
+ <xsd:enumeration value="Trailer-ElectricHeat"/>
+ <xsd:enumeration value="Trailer-HeatedOrInsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-Insulated"/>
+ <xsd:enumeration value="Trailer-InsulatedOrVentilated"/>
+ <xsd:enumeration value="Trailer-NotOtherwiseSpecified"/>
+ <xsd:enumeration value="Trailer-Pneumatic"/>
+ <xsd:enumeration value="Trailer-Refrigerated"/>
+ <xsd:enumeration value="Trailer-Tank-Chemicals"/>
+ <xsd:enumeration value="Trailer-Tank-FoodGrade-Liquid"/>
+ <xsd:enumeration value="Trailer-Tank-Gas"/>
+ <xsd:enumeration value="TrilevelRailcar20Feet"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-FullyEnclosed"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithDoors-NoRoof"/>
+ <xsd:enumeration value="TrilevelRailcarScreened-WithRoof"/>
+ <xsd:enumeration value="Truck-OpenTop"/>
+ <xsd:enumeration value="Truck-OpenTopHighSide"/>
+ <xsd:enumeration value="Truck-OpenTopLowSide"/>
+ <xsd:enumeration value="Truck-Van"/>
+ <xsd:enumeration value="UnitLoadDevice"/>
+ <xsd:enumeration value="Van-SpecialInsideLength-WidthOrHeightRequirements"/>
+ <xsd:enumeration value="Vessel-Lake"/>
+ <xsd:enumeration value="Vessel-Ocean"/>
+ <xsd:enumeration value="Vessel-Ocean-Containership"/>
+ <xsd:enumeration value="Vessel-Ocean-Lash"/>
+ <xsd:enumeration value="Vessel-Ocean-Rollon-Rolloff"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="EquipmentStatusCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Continental"/>
+ <xsd:enumeration value="Export"/>
+ <xsd:enumeration value="Import"/>
+ <xsd:enumeration value="RemainOnBoard"/>
+ <xsd:enumeration value="Shifter"/>
+ <xsd:enumeration value="Transhipment"/>
+ <xsd:enumeration value="Shortlanded"/>
+ <xsd:enumeration value="Overlanded"/>
+ <xsd:enumeration value="Domestic"/>
+ <xsd:enumeration value="Positioning"/>
+ <xsd:enumeration value="Delivery"/>
+ <xsd:enumeration value="Redelivery"/>
+ <xsd:enumeration value="Repair"/>
+ <xsd:enumeration value="Reloader"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="FullIndicatorCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Full"/>
+ <xsd:enumeration value="Empty"/>
+ <xsd:enumeration value="Partial"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="Conditions">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="RefrigerationOn" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="Residue" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ListOfConditions">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ListOfDimension"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="Conditions" type="Conditions"/>
+ <xsd:complexType name="ListOfSealInfo">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="SealInfo"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfSealInfo" type="ListOfSealInfo"/>
+ <xsd:complexType name="SealInfo">
+ <xsd:sequence>
+ <xsd:element name="SealNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="SealIssuer"/>
+ <xsd:element minOccurs="0" ref="SealStatusDescription"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealInfo" type="SealInfo"/>
+ <xsd:complexType name="SealIssuer">
+ <xsd:sequence>
+ <xsd:element name="SealIssuerCoded" type="SealIssuerCode"/>
+ <xsd:element minOccurs="0" name="SealIssuerCodedOther" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealIssuer" type="SealIssuer"/>
+ <xsd:simpleType name="SealIssuerCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Consolidator"/>
+ <xsd:enumeration value="Unknown"/>
+ <xsd:enumeration value="QuarantineAgency"/>
+ <xsd:enumeration value="Carrier"/>
+ <xsd:enumeration value="Customs"/>
+ <xsd:enumeration value="Shipper"/>
+ <xsd:enumeration value="TerminalOperator"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="SealStatusDescription">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="SealStatusCoded" type="SealStatusCode"/>
+ <xsd:element minOccurs="0" name="SealStatusCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SealStatusInfo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SealStatusDescription" type="SealStatusDescription"/>
+ <xsd:simpleType name="SealStatusCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Broken"/>
+ <xsd:enumeration value="Damaged"/>
+ <xsd:enumeration value="InRightCondition"/>
+ <xsd:enumeration value="Missing"/>
+ <xsd:enumeration value="Replaced"/>
+ <xsd:enumeration value="TheElectronicSealIsFaulty"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="TransitDirection">
+ <xsd:sequence>
+ <xsd:element name="TransitDirectionCoded" type="TransitDirectionCode"/>
+ <xsd:element minOccurs="0" name="TransitDirectionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransitTimeQualifierCoded" type="TransitTimeQualifierCode"/>
+ <xsd:element minOccurs="0" name="TransitTimeQualifierCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransitTime" type="xsd:decimal"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TransitDirection" type="TransitDirection"/>
+ <xsd:simpleType name="TransitDirectionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="BuyerToSeller"/>
+ <xsd:enumeration value="SellerToBuyer"/>
+ <xsd:enumeration value="SubcontractorToSeller"/>
+ <xsd:enumeration value="SellerToDropShipDesignatedLocation"/>
+ <xsd:enumeration value="SellerToFreightForwarder"/>
+ <xsd:enumeration value="SellerToSubcontractor"/>
+ <xsd:enumeration value="MotherVesselToLighter"/>
+ <xsd:enumeration value="LighterToMotherVessel"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransitTimeQualifierCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="AirHours"/>
+ <xsd:enumeration value="AirDays"/>
+ <xsd:enumeration value="CalendarDays"/>
+ <xsd:enumeration value="CalendarWeeks"/>
+ <xsd:enumeration value="Hours"/>
+ <xsd:enumeration value="SurfaceDays"/>
+ <xsd:enumeration value="SurfaceHours"/>
+ <xsd:enumeration value="WorkingDays"/>
+ <xsd:enumeration value="5DayWorkWeek"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ListOfShipToSubInformation">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="ShipToSubInformation"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfShipToSubInformation" type="ListOfShipToSubInformation"/>
+ <xsd:complexType name="ShipToSubInformation">
+ <xsd:sequence>
+ <xsd:element name="ShipToSubLocation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Location"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ShipToSubQuantity">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Quantity"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="SubLocationItemPackagingReference">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="ItemPackagingReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ShipToSubInformation" type="ShipToSubInformation"/>
+ <xsd:complexType name="ItemPackagingReference">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="PackageReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ItemPackagingReference" type="ItemPackagingReference"/>
+ <xsd:complexType name="PackageReference">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" ref="Quantity"/>
+ <xsd:element name="PackageIDReference" type="xsd:int"/>
+ <xsd:element minOccurs="0" ref="PackageReference"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="PackageReference" type="PackageReference"/>
+ <xsd:complexType name="TermsOfDelivery">
+ <xsd:sequence>
+ <xsd:element name="TermsOfDeliveryFunctionCoded" type="TermsOfDeliveryFunctionCode"/>
+ <xsd:element minOccurs="0" name="TermsOfDeliveryFunctionCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportTermsCoded" type="TransportTermsCode"/>
+ <xsd:element minOccurs="0" name="TransportTermsCodedOther" type="xsd:string"/>
+ <xsd:element name="ShipmentMethodOfPaymentCoded" type="ShipmentMethodOfPaymentCode"/>
+ <xsd:element minOccurs="0" name="ShipmentMethodOfPaymentCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="Location"/>
+ <xsd:element minOccurs="0" name="TermsOfDeliveryDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TransportDescription" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RiskOfLossCoded" type="RiskOfLossCode"/>
+ <xsd:element minOccurs="0" name="RiskOfLossCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="RiskOfLossDescription" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="TermsOfDelivery" type="TermsOfDelivery"/>
+ <xsd:simpleType name="TermsOfDeliveryFunctionCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="PriceCondition"/>
+ <xsd:enumeration value="DespatchCondition"/>
+ <xsd:enumeration value="PriceandDespatchCondition"/>
+ <xsd:enumeration value="CollectedByCustomer"/>
+ <xsd:enumeration value="TransportCondition"/>
+ <xsd:enumeration value="DeliveryCondition"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="TransportTermsCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Ex-Works"/>
+ <xsd:enumeration value="Free-Carrier"/>
+ <xsd:enumeration value="FreeAlongsideShip"/>
+ <xsd:enumeration value="FreeOnBoard"/>
+ <xsd:enumeration value="CostAndFreight"/>
+ <xsd:enumeration value="Cost-InsuranceAndFreight"/>
+ <xsd:enumeration value="CarriagePaidTo"/>
+ <xsd:enumeration value="Carriage-InsurancePaidTo"/>
+ <xsd:enumeration value="DeliveredAtFrontier"/>
+ <xsd:enumeration value="DeliveredEx-Ship"/>
+ <xsd:enumeration value="DeliveredEx-Quay"/>
+ <xsd:enumeration value="DeliveredDutyUnpaid"/>
+ <xsd:enumeration value="DeliveredDutyPaid"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="ShipmentMethodOfPaymentCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Account"/>
+ <xsd:enumeration value="AdvanceCollect"/>
+ <xsd:enumeration value="AdvancePrepaid"/>
+ <xsd:enumeration value="CashOnDeliveryServiceChargePaidByConsignee"/>
+ <xsd:enumeration value="CashOnDeliveryServiceChargePaidByConsignor"/>
+ <xsd:enumeration value="Collect"/>
+ <xsd:enumeration value="CollectFreightCreditedToPaymentCustomer"/>
+ <xsd:enumeration value="CollectOnDelivery"/>
+ <xsd:enumeration value="CustomerPick-UpOrBackhaul"/>
+ <xsd:enumeration value="DefinedByBuyerAndSeller"/>
+ <xsd:enumeration value="FobPortOfCall"/>
+ <xsd:enumeration value="HalfPrepaid"/>
+ <xsd:enumeration value="InformationCopy-NoPaymentDue"/>
+ <xsd:enumeration value="InsuranceCostsPaidByConsignee"/>
+ <xsd:enumeration value="InsuranceCostsPaidByConsignor"/>
+ <xsd:enumeration value="Mixed"/>
+ <xsd:enumeration value="NonRevenue"/>
+ <xsd:enumeration value="NotSpecified"/>
+ <xsd:enumeration value="PaidByBuyer"/>
+ <xsd:enumeration value="PaidBySupplierOrSeller"/>
+ <xsd:enumeration value="PayableElsewhere"/>
+ <xsd:enumeration value="PerContract"/>
+ <xsd:enumeration value="Pickup"/>
+ <xsd:enumeration value="PrepaidAndSummaryBill"/>
+ <xsd:enumeration value="PrepaidButChargedToCustomer"/>
+ <xsd:enumeration value="PrepaidByProcessor"/>
+ <xsd:enumeration value="Prepaid-BySeller"/>
+ <xsd:enumeration value="PrepaidLocalCollectOutstate"/>
+ <xsd:enumeration value="PrepaidOnly"/>
+ <xsd:enumeration value="ReturnContainerFreightFree"/>
+ <xsd:enumeration value="ReturnContainerFreightPaidByCustomer"/>
+ <xsd:enumeration value="ReturnContainerFreightPaidBySupplier"/>
+ <xsd:enumeration value="Rule11Shipment"/>
+ <xsd:enumeration value="ServiceFreight-NoCharge"/>
+ <xsd:enumeration value="ThirdPartyPay"/>
+ <xsd:enumeration value="WeightCondition"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="RiskOfLossCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="RiskOfLossInTransitToDestinationIsBuyers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToFreightEqualizationPointIsSellers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToPoolPointIsSellers"/>
+ <xsd:enumeration value="RiskOfLossInTransitToDestinationIsSellers"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="CargoClassification">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="NatureOfGoods">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Identifier"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element minOccurs="0" name="OperationalTypeCoded" type="OperationalTypeCode"/>
+ <xsd:element minOccurs="0" name="OperationalTypeCodedOther" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="TypeOfCargo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="CargoClassification" type="CargoClassification"/>
+ <xsd:simpleType name="OperationalTypeCode">
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="Other"/>
+ <xsd:enumeration value="Documents"/>
+ <xsd:enumeration value="LowValueNon-DutiableConsignments"/>
+ <xsd:enumeration value="LowValueDutiableConsignments"/>
+ <xsd:enumeration value="HighValueConsignments"/>
+ <xsd:enumeration value="OtherNon-Containerized"/>
+ <xsd:enumeration value="Vehicles"/>
+ <xsd:enumeration value="Roll-OnRoll-Off"/>
+ <xsd:enumeration value="Palletized"/>
+ <xsd:enumeration value="Containerized"/>
+ <xsd:enumeration value="Breakbulk"/>
+ <xsd:enumeration value="HazardousCargo"/>
+ <xsd:enumeration value="GeneralCargo"/>
+ <xsd:enumeration value="LiquidCargo"/>
+ <xsd:enumeration value="TemperatureControlledCargo"/>
+ <xsd:enumeration value="EnvironmentalPollutantCargo"/>
+ <xsd:enumeration value="Not-HazardousCargo"/>
+ <xsd:enumeration value="Diplomatic"/>
+ <xsd:enumeration value="Military"/>
+ <xsd:enumeration value="Obnoxious"/>
+ <xsd:enumeration value="OutOfGauge"/>
+ <xsd:enumeration value="HouseholdGoodsAndPersonalEffects"/>
+ <xsd:enumeration value="FrozenCargo"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="RoundTripInformation">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="Immutable" type="xcblBoolean"/>
+ <xsd:element minOccurs="0" name="ReLink" type="xsd:anyURI"/>
+ <xsd:element minOccurs="0" name="SupplierShoppingCartID" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="RoundTripOrder" type="xcblBoolean" fixed="true"/>
+ </xsd:complexType>
+ <xsd:element name="RoundTripInformation" type="RoundTripInformation"/>
+ <xsd:complexType name="ListOfAccountAssignment">
+ <xsd:sequence>
+ <xsd:element maxOccurs="unbounded" ref="AccountAssignment"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ListOfAccountAssignment" type="ListOfAccountAssignment"/>
+ <xsd:complexType name="AccountAssignment">
+ <xsd:sequence>
+ <xsd:element name="AccountAssignmentID" type="xsd:string"/>
+ <xsd:element name="DistributionPercentage" type="xsd:decimal"/>
+ <xsd:element minOccurs="0" name="GLAccount" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CostCenter" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="AccountAssignmentOrderNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="OperationNumber" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="SalesOrderReference" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="BusinessArea" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ControllingArea" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="ProfitCenter" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="WorkBreakdownStructure" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Network" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FixedAsset" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FixedAssetSub" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FundsCenter" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="Fund" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="CommitmentItem" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="FunctionalArea" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="GenericAccounting" type="xsd:string"/>
+ <xsd:element minOccurs="0" ref="ListOfNameValueSet"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AccountAssignment" type="AccountAssignment"/>
+ <!-- SOX format datatypes where they difer from standard XSDL datatypes-->
+ <xsd:simpleType name="xcblDate">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblTime">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="((([0-1][0-9])|(2[0-3]))(:([0-5][0-9])){2}((\+|-)(([0-1][0-9])|(2[0-3])):([0-5][0-9]))?)"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblDatetime">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{4}(((01|03|05|07|08|10|12)((0[1-9])|([1-2][0-9])|(3[0-1])))|((04|06|09|11)((0[1-9])|([1-2][0-9])|30))|((02)((0[1-9])|([1-2][0-9]))))T((([0-1][0-9])|(2[0-3]))(:([0-5][0-9])){2}((\+|-)(([0-1][0-9])|(2[0-3])):([0-5][0-9]))?)"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblBoolean">
+ <xsd:restriction base="xsd:boolean">
+ <xsd:pattern value="true|false"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblFloat">
+ <xsd:restriction base="xsd:float">
+ <xsd:pattern value="(\+|-)?[0-9]*\.?[0-9]*(E|e)?[0-9]*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="xcblDouble">
+ <xsd:restriction base="xsd:double">
+ <xsd:pattern value="(\+|-)?[0-9]*\.?[0-9]*(E|e)?[0-9]*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/cases/schema/wli/annuitynet_new.xsd b/v1/test/cases/schema/wli/annuitynet_new.xsd
new file mode 100644
index 0000000..7ef58e2
--- /dev/null
+++ b/v1/test/cases/schema/wli/annuitynet_new.xsd
@@ -0,0 +1,1348 @@
+<?xml version="1.0" ?>
+<!-- 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. -->
+<xsd:schema targetNamespace="http://www.annuitynet.com/namespace/profiles"
+
+ xmlns="http://www.annuitynet.com/namespace/profiles"
+ xmlns:cvoe="http://www.contivo.com/xmlns/2002/enrichment"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:complexType name="Type2">
+ <xsd:sequence>
+ <xsd:element name="CODE">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:length value="2"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="BEGIN_DATE" minOccurs="0" type="xsd:date"/>
+ <xsd:element name="END_DATE" minOccurs="0" type="xsd:date"/>
+ <xsd:element name="TERM_DATE" minOccurs="0" type="xsd:date"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Type1">
+ <xsd:sequence>
+ <xsd:element name="ID" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="ENVELOPE">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HEADER">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SENDING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="RECEIVING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="TRANSACTION_COUNT" type="xsd:integer"/>
+ <xsd:element name="TEST" minOccurs="0" default="0" type="xsd:boolean"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="HEADER">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EFFECTIVE_DATE" minOccurs="0" type="xsd:date"/>
+ <xsd:element name="AS_OF_DATETIME" minOccurs="0" type="xsd:dateTime"/>
+ <xsd:element name="ACTIVITY">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="ADD"/>
+ <xsd:enumeration value="MODIFY"/>
+ <xsd:enumeration value="DELETE"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION_ID" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PARTY_ID" type="xsd:string"/>
+ <xsd:element name="TRANSACTION_ID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ROUTING">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="STEP" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="RECEIVING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="SENDING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="ORDER" type="xsd:integer"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ROUTING_HISTORY">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="STEP" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="RECEIVING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="SENDING_PARTY_ID" type="xsd:string"/>
+ <xsd:element name="SEND_DATETIME" type="xsd:dateTime"/>
+ <xsd:element name="RECEIVE_DATETIME" minOccurs="0" type="xsd:dateTime"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION_TYPE">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="BUSINESS_UNIT_DEFINITION"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="REQUEST">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNITS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ACTIVE" minOccurs="0" type="xsd:boolean"/>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="NAME" type="xsd:string"/>
+ <xsd:element name="CLASS" type="xsd:string"/>
+ <xsd:element name="TIN" type="xsd:string"/>
+ <xsd:element name="ACCOUNT_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ACCOUNT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONTACT_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONTACT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="RESPONSIBILITY" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="USERS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="USER" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="ACTIVE" minOccurs="0" type="xsd:boolean"/>
+ <xsd:element name="TIN" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="USER_LOGON_ID" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="PASSWORD" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="LAST_NAME" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="FIRST_NAME" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="MIDDLE_INITIAL" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="SALUTATION_CD" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Mr"/>
+ <xsd:enumeration value="Mrs"/>
+ <xsd:enumeration value="Ms"/>
+ <xsd:enumeration value="Miss"/>
+ <xsd:enumeration value="Dr"/>
+ <xsd:enumeration value="Rev"/>
+ <xsd:enumeration value="Atty"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="SUFFIX_CD" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Jr"/>
+ <xsd:enumeration value="Sr"/>
+ <xsd:enumeration value="II"/>
+ <xsd:enumeration value="III"/>
+ <xsd:enumeration value="IV"/>
+ <xsd:enumeration value="MD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="EMAIL" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="PHONE_NUMBER" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="LICENSES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="LICENSE" maxOccurs="2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TYPE">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="FIXED"/>
+ <xsd:enumeration value="VARIABLE"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="STATES">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="APPOINTMENTS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="APPOINTMENT" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="STATUS">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="PENDING"/>
+ <xsd:enumeration value="APPOINTED"/>
+ <xsd:enumeration value="TERMINATED"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="NEW_BUSINESS" type="xsd:boolean"/>
+ <xsd:element name="COMMISSIONS" type="xsd:boolean"/>
+ <xsd:element name="WRITING_COMPANY">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="LINES_OF_BUSINESS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="LINE_OF_BUSINESS" maxOccurs="unbounded">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="INDIVIDUAL_LIFE"/>
+ <xsd:enumeration value="VARIABLE_ANNUITIES"/>
+ <xsd:enumeration value="FIXED_ANNUITIES"/>
+ <xsd:enumeration value="GROUP_LIFE"/>
+ <xsd:enumeration value="VARIABLE_LIFE"/>
+ <xsd:enumeration value="ALL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="USER_ROLES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="USER_ROLE" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="DESCRIPTION" minOccurs="0" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ACCOUNTS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ACCOUNT" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="ACCOUNT_NAME" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="OWNER_NAME" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="ABA_NUMBER" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="ACCOUNT_NUMBER" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="PURPOSE" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="PREMIUM COLLECTION"/>
+ <xsd:enumeration value="COMMISSION RECIEPTS"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONTACTS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONTACT" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="NAME" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="PHONE_NUMBER" minOccurs="0" type="xsd:string"/>
+ <xsd:element name="EMAIL" minOccurs="0" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="BUSINESS_UNIT_AVAILABILITY" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="AVAILABILITY">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCTS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_PLANS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PLAN_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PLAN_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_RIDERS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="RIDER_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="RIDER_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONFIGURATION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONFIGURATION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTIONALITY" minOccurs="0" default="OPTIONAL">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="REQUIRED"/>
+ <xsd:enumeration value="OPTIONAL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_PLANS_RIDERS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PLAN_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PLAN_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="RIDER_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="RIDER_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONFIGURATION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONFIGURATION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTIONALITY" minOccurs="0" default="OPTIONAL">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="REQUIRED"/>
+ <xsd:enumeration value="OPTIONAL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_SERVICE_PROGRAMS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SERVICE_PROGRAM_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SERVICE_PROGRAM_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OPTION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONFIGURATION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONFIGURATION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTIONALITY" minOccurs="0" default="OPTIONAL">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="REQUIRED"/>
+ <xsd:enumeration value="OPTIONAL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_PLANS_SERVICE_PROGRAMS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PLAN_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PLAN_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SERVICE_PROGRAM_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SERVICE_PROGRAM_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTION__LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OPTION__LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CONFIGURATION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="CONFIGURATION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPTIONALITY" minOccurs="0" default="OPTIONAL">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="REQUIRED"/>
+ <xsd:enumeration value="OPTIONAL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCTS_INVESTMENT_OPTIONS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="INVESTMENT_OPTIONS_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="INVESTMENT_OPTIONS_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STATES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EXCEPTION" minOccurs="0" default="0" type="xsd:boolean"/>
+ <xsd:element name="STATE" minOccurs="0" maxOccurs="unbounded" type="Type2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPERATING_PROFILES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OPERATING_PROFILE" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="NETTING_OPTION" minOccurs="0" type="xsd:boolean"/>
+ <xsd:element name="COMMISSION_OPTION_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="COMMISSION_OPTION_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION_TYPES" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TRANSACTION_TYPE" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TYPE">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="APPLICATION"/>
+ <xsd:enumeration value="INITIAL_PREMIUM"/>
+ <xsd:enumeration value="SUBSEQUENT_PREMIUM"/>
+ <xsd:enumeration value="SCHEDULED_ACH_PROGRAM"/>
+ <xsd:enumeration value="WITHDRAWAL"/>
+ <xsd:enumeration value="SURRENDER"/>
+ <xsd:enumeration value="TRANSFER"/>
+ <xsd:enumeration value="REBALANCE"/>
+ <xsd:enumeration value="SYSTEMATIC_WITHDRAWAL_PROGRAM"/>
+ <xsd:enumeration value="MRD_PROGRAM"/>
+ <xsd:enumeration value="MRD"/>
+ <xsd:enumeration value="SCHEDULED_REBALANCE_PROGRAM"/>
+ <xsd:enumeration value="DCA"/>
+ <xsd:enumeration value="DCA_PROGRAM"/>
+ <xsd:enumeration value="SYSTEMATIC_WITHDRAWAL_PROGRAM"/>
+ <xsd:enumeration value="RENEWAL"/>
+ <xsd:enumeration value="ANNUITIZATION"/>
+ <xsd:enumeration value="PAYOUT"/>
+ <xsd:enumeration value="DEATH_CLAIM_PENDING"/>
+ <xsd:enumeration value="DEATH_CLAIM"/>
+ <xsd:enumeration value="SYSTEMATIC_WITHDRAWAL"/>
+ <xsd:enumeration value="SCHEDULED_ACH"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="MONEY_FORMS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="MONEY_FORM" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION_ROUTING_LINK" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PARAMETERS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PARAMETER" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NAME" type="xsd:string"/>
+ <xsd:element name="New Character Item" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TRANSACTION_ROUTINGS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TRANSACTION_ROUTING" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="IDS" type="Type1"/>
+ <xsd:element name="NAME" type="xsd:string"/>
+ <xsd:element name="FORMAT">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="ANSI"/>
+ <xsd:enumeration value="NSCC"/>
+ <xsd:enumeration value="ANNUITYNET_PROFILE_V1.0"/>
+ <xsd:enumeration value="XMLIFE"/>
+ <xsd:enumeration value="TXMLIFE"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="PARAMETERS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PARAMETER" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="NAME" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="USER_TO_BUSINESS_UNIT_MAPPINGS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="USER_TO_BUSINESS_UNIT_MAPPING" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_LINK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="USER_LINK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="USER_ROLE_LINK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="BUSINESS_UNIT_RELATIONSHIPS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_RELATIONSHIP" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PARENT_BUSINESS_UNIT_LINK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="CHILD_BUSINESS_UNIT_LINK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="BUSINESS_UNIT_OPERATING_PROFILE_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BUSINESS_UNIT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PRODUCT_LINKS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PRODUCT_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OPERATING_PROFILE_LINKS" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OPERATING_PROFILE_LINK" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ID">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="@PARTY_LINK_ID" use="required" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="SCHEMA_VERSION" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="PARTNER_XML_INTERFACE_V1.10"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/v1/test/cases/schema/wli/cxml.xsd b/v1/test/cases/schema/wli/cxml.xsd
new file mode 100644
index 0000000..59599cb
--- /dev/null
+++ b/v1/test/cases/schema/wli/cxml.xsd
@@ -0,0 +1,1035 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="Accounting">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="Segment" ref="Segment" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="AccountingSegment" ref="AccountingSegment" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="AccountingSegment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="Description" ref="Description"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Address">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="PostalAddress" ref="PostalAddress" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Email" ref="Email" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Phone" ref="Phone" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Fax" ref="Fax" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="URL" ref="URL" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="isoCountryCode" type="xs:string"/>
+ <xs:attribute name="addressID" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="AreaOrCityCode" type="xs:string"/>
+ <xs:element name="Attachment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="BillTo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Address" ref="Address"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="BrowserFormPost">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="BuyerCookie">
+ <xs:complexType mixed="true"/>
+ </xs:element>
+ <xs:element name="CIFContent" type="xs:string"/>
+ <xs:element name="Changetime" type="xs:string"/>
+ <xs:element name="Charge">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Money" ref="Money"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="City" type="xs:string"/>
+ <xs:element name="Classification">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="domain" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Comments">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="Attachment" ref="Attachment"/>
+ </xs:choice>
+ <xs:attribute name="lang" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Contact">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="PostalAddress" ref="PostalAddress" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Email" ref="Email" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Phone" ref="Phone" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Fax" ref="Fax" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="URL" ref="URL" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="role" type="xs:NMTOKEN"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Contract">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="Comments" ref="Comments" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ItemSegment" ref="ItemSegment" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="effectiveDate" type="xs:string" use="required"/>
+ <xs:attribute name="expirationDate" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ContractItem">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ <xs:element name="UnitPrice" ref="UnitPrice" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Extrinsic" ref="Extrinsic" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Country">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="isoCountryCode" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CountryCode">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="isoCountryCode" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Credential">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Identity" ref="Identity"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element name="SharedSecret" ref="SharedSecret"/>
+ <xs:element name="DigitalSignature" ref="DigitalSignature"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="domain" type="xs:string" use="required"/>
+ <xs:attribute name="type">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="marketplace"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DeliverTo" type="xs:string"/>
+ <xs:element name="Description">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="ShortName" ref="ShortName"/>
+ </xs:choice>
+ <xs:attribute name="lang" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DigitalSignature">
+ <xs:complexType mixed="true">
+ <xs:attribute name="type" type="xs:string" default="PK7 self-contained"/>
+ <xs:attribute name="encoding" type="xs:string" default="Base64"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Distribution">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Accounting" ref="Accounting"/>
+ <xs:element name="Charge" ref="Charge"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DocumentReference">
+ <xs:complexType>
+ <xs:attribute name="payloadID" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="EffectiveDate" type="xs:string"/>
+ <xs:element name="Email">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ExpirationDate" type="xs:string"/>
+ <xs:element name="Extension" type="xs:string"/>
+ <xs:element name="Extrinsic">
+ <xs:complexType mixed="true">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Fax">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="TelephoneNumber" ref="TelephoneNumber"/>
+ <xs:element name="URL" ref="URL"/>
+ <xs:element name="Email" ref="Email"/>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Followup">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Format">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="version" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="From">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Credential" ref="Credential" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetPendingRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="MessageType" ref="MessageType" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="maxMessages" type="xs:string"/>
+ <xs:attribute name="lastReceivedTimestamp" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetPendingResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="cXML" ref="cXML" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="From" ref="From"/>
+ <xs:element name="To" ref="To"/>
+ <xs:element name="Sender" ref="Sender"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Identity">
+ <xs:complexType mixed="true">
+ <xs:attribute name="lastChangedTimestamp" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Index">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="Comments" ref="Comments" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SearchGroup" ref="SearchGroup" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="IndexItem" ref="IndexItem" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IndexItem">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="IndexItemAdd" ref="IndexItemAdd" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="IndexItemDelete" ref="IndexItemDelete" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="IndexItemPunchout" ref="IndexItemPunchout" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IndexItemAdd">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ <xs:element name="ItemDetail" ref="ItemDetail"/>
+ <xs:element name="IndexItemDetail" ref="IndexItemDetail"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IndexItemDelete">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IndexItemDetail">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="LeadTime" ref="LeadTime"/>
+ <xs:element name="ExpirationDate" ref="ExpirationDate" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="EffectiveDate" ref="EffectiveDate" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SearchGroupData" ref="SearchGroupData" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="TerritoryAvailable" ref="TerritoryAvailable" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IndexItemPunchout">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ <xs:element name="PunchoutDetail" ref="PunchoutDetail"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="InternalID">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="domain" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ItemDetail">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="UnitPrice" ref="UnitPrice"/>
+ <xs:element name="Description" ref="Description" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="UnitOfMeasure" ref="UnitOfMeasure"/>
+ <xs:element name="Classification" ref="Classification" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="ManufacturerPartID" ref="ManufacturerPartID" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ManufacturerName" ref="ManufacturerName" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="URL" ref="URL" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Extrinsic" ref="Extrinsic" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ItemID">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SupplierPartID" ref="SupplierPartID"/>
+ <xs:element name="SupplierPartAuxiliaryID" ref="SupplierPartAuxiliaryID" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ItemIn">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ <xs:element name="ItemDetail" ref="ItemDetail"/>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ShipTo" ref="ShipTo" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Shipping" ref="Shipping" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Tax" ref="Tax" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="quantity" type="xs:string" use="required"/>
+ <xs:attribute name="lineNumber" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ItemOut">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ <xs:element name="ItemDetail" ref="ItemDetail" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ShipTo" ref="ShipTo" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Shipping" ref="Shipping" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Tax" ref="Tax" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Distribution" ref="Distribution" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Contact" ref="Contact" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Comments" ref="Comments" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="quantity" type="xs:string" use="required"/>
+ <xs:attribute name="lineNumber" type="xs:string"/>
+ <xs:attribute name="requisitionID" type="xs:string"/>
+ <xs:attribute name="requestedDeliveryDate" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ItemSegment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ContractItem" ref="ContractItem" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="segmentKey" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="LeadTime" type="xs:string"/>
+ <xs:element name="ManufacturerName">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="lang" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ManufacturerPartID" type="xs:string"/>
+ <xs:element name="Message">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Status" ref="Status" minOccurs="0" maxOccurs="1"/>
+ <xs:choice>
+ <xs:element name="PunchOutOrderMessage" ref="PunchOutOrderMessage"/>
+ <xs:element name="SubscriptionChangeMessage" ref="SubscriptionChangeMessage"/>
+ <xs:element name="SupplierChangeMessage" ref="SupplierChangeMessage"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="deploymentMode" default="production">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="production"/>
+ <xs:enumeration value="test"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="inReplyTo" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="MessageType" type="xs:string"/>
+ <xs:element name="Money">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="currency" type="xs:string" use="required"/>
+ <xs:attribute name="alternateAmount" type="xs:string"/>
+ <xs:attribute name="alternateCurrency" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Name">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="lang" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Number" type="xs:string"/>
+ <xs:element name="Option">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="a-dtype" type="xs:NMTOKENS" fixed="name string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OrderMethod">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="OrderTarget" ref="OrderTarget"/>
+ <xs:element name="OrderProtocol" ref="OrderProtocol" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OrderMethods">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="OrderMethod" ref="OrderMethod" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="Contact" ref="Contact" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OrderProtocol" type="xs:string"/>
+ <xs:element name="OrderRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="OrderRequestHeader" ref="OrderRequestHeader"/>
+ <xs:element name="ItemOut" ref="ItemOut" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OrderRequestHeader">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Total" ref="Total"/>
+ <xs:element name="ShipTo" ref="ShipTo" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="BillTo" ref="BillTo"/>
+ <xs:element name="Shipping" ref="Shipping" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Tax" ref="Tax" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Payment" ref="Payment" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Contact" ref="Contact" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Comments" ref="Comments" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Followup" ref="Followup" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="DocumentReference" ref="DocumentReference" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Extrinsic" ref="Extrinsic" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="orderID" type="xs:string" use="required"/>
+ <xs:attribute name="orderDate" type="xs:string" use="required"/>
+ <xs:attribute name="type" default="new">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="new"/>
+ <xs:enumeration value="update"/>
+ <xs:enumeration value="delete"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="requisitionID" type="xs:string"/>
+ <xs:attribute name="shipComplete">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="yes"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OrderTarget">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="Phone" ref="Phone"/>
+ <xs:element name="Email" ref="Email"/>
+ <xs:element name="Fax" ref="Fax"/>
+ <xs:element name="URL" ref="URL"/>
+ <xs:element name="OtherOrderTarget" ref="OtherOrderTarget"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="OtherOrderTarget">
+ <xs:complexType mixed="true">
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PCard">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="PostalAddress" ref="PostalAddress" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="number" type="xs:string" use="required"/>
+ <xs:attribute name="expiration" type="xs:string" use="required"/>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Payment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="PCard" ref="PCard"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Phone">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="TelephoneNumber" ref="TelephoneNumber"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PostalAddress">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="DeliverTo" ref="DeliverTo" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Street" ref="Street" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="City" ref="City"/>
+ <xs:element name="State" ref="State" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="PostalCode" ref="PostalCode" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Country" ref="Country"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PostalCode" type="xs:string"/>
+ <xs:element name="ProfileRequest">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="ProfileResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Option" ref="Option" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Transaction" ref="Transaction" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="effectiveDate" type="xs:string" use="required"/>
+ <xs:attribute name="a-dtype" type="xs:NMTOKENS" fixed="effectiveDate dateTime"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PunchOutOrderMessage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="BuyerCookie" ref="BuyerCookie"/>
+ <xs:element name="PunchOutOrderMessageHeader" ref="PunchOutOrderMessageHeader"/>
+ <xs:element name="ItemIn" ref="ItemIn" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PunchOutOrderMessageHeader">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Total" ref="Total"/>
+ <xs:element name="ShipTo" ref="ShipTo" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Shipping" ref="Shipping" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Tax" ref="Tax" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ <xs:attribute name="operationAllowed" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="create"/>
+ <xs:enumeration value="inspect"/>
+ <xs:enumeration value="edit"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PunchOutSetupRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="BuyerCookie" ref="BuyerCookie"/>
+ <xs:element name="Extrinsic" ref="Extrinsic" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="BrowserFormPost" ref="BrowserFormPost" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Contact" ref="Contact" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="SupplierSetup" ref="SupplierSetup" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ShipTo" ref="ShipTo" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SelectedItem" ref="SelectedItem" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ItemOut" ref="ItemOut" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="operation" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="create"/>
+ <xs:enumeration value="inspect"/>
+ <xs:enumeration value="edit"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PunchOutSetupResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="StartPage" ref="StartPage"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PunchoutDetail">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Description" ref="Description" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="URL" ref="URL"/>
+ <xs:element name="Classification" ref="Classification" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="ManufacturerName" ref="ManufacturerName" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ManufacturerPartID" ref="ManufacturerPartID" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="ExpirationDate" ref="ExpirationDate" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="EffectiveDate" ref="EffectiveDate" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SearchGroupData" ref="SearchGroupData" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="TerritoryAvailable" ref="TerritoryAvailable" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Request">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="ProfileRequest" ref="ProfileRequest"/>
+ <xs:element name="OrderRequest" ref="OrderRequest"/>
+ <xs:element name="PunchOutSetupRequest" ref="PunchOutSetupRequest"/>
+ <xs:element name="StatusUpdateRequest" ref="StatusUpdateRequest"/>
+ <xs:element name="GetPendingRequest" ref="GetPendingRequest"/>
+ <xs:element name="SubscriptionListRequest" ref="SubscriptionListRequest"/>
+ <xs:element name="SubscriptionContentRequest" ref="SubscriptionContentRequest"/>
+ <xs:element name="SupplierListRequest" ref="SupplierListRequest"/>
+ <xs:element name="SupplierDataRequest" ref="SupplierDataRequest"/>
+ </xs:choice>
+ <xs:attribute name="deploymentMode" default="production">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="production"/>
+ <xs:enumeration value="test"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Status" ref="Status"/>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:choice>
+ <xs:element name="ProfileResponse" ref="ProfileResponse"/>
+ <xs:element name="PunchOutSetupResponse" ref="PunchOutSetupResponse"/>
+ <xs:element name="GetPendingResponse" ref="GetPendingResponse"/>
+ <xs:element name="SubscriptionListResponse" ref="SubscriptionListResponse"/>
+ <xs:element name="SubscriptionContentResponse" ref="SubscriptionContentResponse"/>
+ <xs:element name="SupplierListResponse" ref="SupplierListResponse"/>
+ <xs:element name="SupplierDataResponse" ref="SupplierDataResponse"/>
+ </xs:choice>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SearchAttribute">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SearchDataElement">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SearchGroup">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="SearchAttribute" ref="SearchAttribute" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SearchGroupData">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="SearchDataElement" ref="SearchDataElement" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Segment">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="id" type="xs:string" use="required"/>
+ <xs:attribute name="description" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SelectedItem">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ItemID" ref="ItemID"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Sender">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Credential" ref="Credential" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="UserAgent" ref="UserAgent"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SharedSecret">
+ <xs:complexType mixed="true"/>
+ </xs:element>
+ <xs:element name="ShipTo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Address" ref="Address"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Shipping">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Money" ref="Money"/>
+ <xs:element name="Description" ref="Description"/>
+ </xs:sequence>
+ <xs:attribute name="trackingDomain" type="xs:string"/>
+ <xs:attribute name="trackingId" type="xs:string"/>
+ <xs:attribute name="tracking" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ShortName" type="xs:string"/>
+ <xs:element name="StartPage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="State" type="xs:string"/>
+ <xs:element name="Status">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="code" type="xs:string" use="required"/>
+ <xs:attribute name="text" type="xs:string" use="required"/>
+ <xs:attribute name="lang" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="StatusUpdateRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="DocumentReference" ref="DocumentReference"/>
+ <xs:element name="Status" ref="Status"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Street" type="xs:string"/>
+ <xs:element name="Subscription">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="InternalID" ref="InternalID"/>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="Changetime" ref="Changetime"/>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="Format" ref="Format" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="Description" ref="Description" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubscriptionChangeMessage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Subscription" ref="Subscription" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="new"/>
+ <xs:enumeration value="update"/>
+ <xs:enumeration value="delete"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubscriptionContent">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element name="CIFContent" ref="CIFContent"/>
+ <xs:element name="Index" ref="Index"/>
+ <xs:element name="Contract" ref="Contract"/>
+ </xs:choice>
+ <xs:attribute name="filename" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubscriptionContentRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="InternalID" ref="InternalID"/>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubscriptionContentResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Subscription" ref="Subscription"/>
+ <xs:element name="SubscriptionContent" ref="SubscriptionContent" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubscriptionListRequest">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="SubscriptionListResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Subscription" ref="Subscription" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Supplier">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Name" ref="Name"/>
+ <xs:element name="Comments" ref="Comments" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ <xs:element name="SupplierLocation" ref="SupplierLocation" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="corporateURL" type="xs:string"/>
+ <xs:attribute name="storeFrontURL" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierChangeMessage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Supplier" ref="Supplier" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="new"/>
+ <xs:enumeration value="update"/>
+ <xs:enumeration value="delete"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierDataRequest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SupplierID" ref="SupplierID" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierDataResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Supplier" ref="Supplier"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierID">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="domain" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierListRequest">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="SupplierListResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Supplier" ref="Supplier" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierLocation">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Address" ref="Address"/>
+ <xs:element name="OrderMethods" ref="OrderMethods"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SupplierPartAuxiliaryID">
+ <xs:complexType mixed="true"/>
+ </xs:element>
+ <xs:element name="SupplierPartID" type="xs:string"/>
+ <xs:element name="SupplierSetup">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Tax">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Money" ref="Money"/>
+ <xs:element name="Description" ref="Description"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="TelephoneNumber">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="CountryCode" ref="CountryCode"/>
+ <xs:element name="AreaOrCityCode" ref="AreaOrCityCode"/>
+ <xs:element name="Number" ref="Number"/>
+ <xs:element name="Extension" ref="Extension" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="TerritoryAvailable" type="xs:string"/>
+ <xs:element name="To">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Credential" ref="Credential" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Total">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Money" ref="Money"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Transaction">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="URL" ref="URL"/>
+ <xs:element name="Option" ref="Option" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="requestName" type="xs:string" use="required"/>
+ <xs:attribute name="a-dtype" type="xs:NMTOKENS" fixed="requestName NMTOKEN"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="URL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="UnitOfMeasure" type="xs:string"/>
+ <xs:element name="UnitPrice">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Money" ref="Money"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="UserAgent" type="xs:string"/>
+ <xs:element name="cXML">
+ <xs:complexType>
+ <xs:choice>
+ <xs:sequence>
+ <xs:element name="Header" ref="Header"/>
+ <xs:choice>
+ <xs:element name="Message" ref="Message"/>
+ <xs:element name="Request" ref="Request"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:element name="Response" ref="Response"/>
+ </xs:choice>
+ <xs:attribute name="version" type="xs:string" default="1.1.009"/>
+ <xs:attribute name="payloadID" type="xs:string" use="required"/>
+ <xs:attribute name="timestamp" type="xs:string" use="required"/>
+ <xs:attribute name="lang" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/v1/test/cases/schema/wli/oagis_fields.xsd b/v1/test/cases/schema/wli/oagis_fields.xsd
new file mode 100644
index 0000000..67dc946
--- /dev/null
+++ b/v1/test/cases/schema/wli/oagis_fields.xsd
@@ -0,0 +1,941 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!--Generated by XML Authority. Conforms to w3c http://www.w3.org/2001/XMLSchema-->
+<xs:schema xmlns="http://www.openapplications.org/oagis_fields" targetNamespace="http://www.openapplications.org/oagis_fields" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:annotation>
+ <xs:documentation>
+
+ License information for this file is provided in LICENSE.TXT, as published
+ on the Open Applications Group web site. www.openapplications.org
+
+ For support, more information, or to report implementation bugs,
+ please contact the Open Applications Group at xml@openapplications.org
+
+ $Revision$
+ $Date$
+ Open Applications Group XML
+ Copyright 1998-2001, All Rights Reserved
+
+ $Name: $
+
+ ajw 7.2 09/14/2001 Fields to support ECatalog: CLASSFNID,CLASSFN,CLASSLEVEL,CLSSSCHMRV,FTGROUP,
+ FTVALIND,FTVALQUAL, PRICECODE, PRICETYPE,SEQNCENUM,USAGERESTN
+ ajw 7.2 09/14/2001 Fields to support Consumptn: CONSLINENUM,ROUTELEVEL1-ROUTELEVEL9
+ mlr 7.2 09/14/2001 Added fields to support updated delivery: ACKMODE, DISCRPTYPE, RECEIPTYPE.
+ ajw 7.2.1 10/31/2001 W3C Schema Release
+
+
+ Structure Overview
+
+ This schema defines the OAGI Field datatypes used throughout the specification.
+ Below is an outline depicting their placement and usage.
+
+ BOD Namespace ("http://www.openapplications.org/nnn_verb_noun_rel")
+ |
+ |--- Segments Namespace - oagis_segments.xsd (os: "http://www.openapplications.org/oagis_segments")
+ | |
+ |--- |--- Fields Namespace - oagis_fields.xsd (of:"http://www.openapplications.org/oagis_fields")
+
+
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:element name="VERB" type="VERB"/>
+ <xs:simpleType name="VERB">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ACKNOWLEDGE"/>
+ <xs:enumeration value="ALLOCATE"/>
+ <xs:enumeration value="ADD"/>
+ <xs:enumeration value="CANCEL"/>
+ <xs:enumeration value="CHANGE"/>
+ <xs:enumeration value="CONFIRM"/>
+ <xs:enumeration value="CREATE"/>
+ <xs:enumeration value="GET"/>
+ <xs:enumeration value="GETLIST"/>
+ <xs:enumeration value="ISSUE"/>
+ <xs:enumeration value="LIST"/>
+ <xs:enumeration value="LOAD"/>
+ <xs:enumeration value="POST"/>
+ <xs:enumeration value="PROCESS"/>
+ <xs:enumeration value="RECEIVE"/>
+ <xs:enumeration value="RESPOND"/>
+ <xs:enumeration value="SHOW"/>
+ <xs:enumeration value="SYNC"/>
+ <xs:enumeration value="TRANSFER"/>
+ <xs:enumeration value="UPDATE"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="NOUN">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ACTIVITY"/>
+ <xs:enumeration value="BOM"/>
+ <xs:enumeration value="BOD"/>
+ <xs:enumeration value="CATALOG"/>
+ <xs:enumeration value="COA"/>
+ <xs:enumeration value="CONSUMPTN"/>
+ <xs:enumeration value="COUNTINFO"/>
+ <xs:enumeration value="CREDIT"/>
+ <xs:enumeration value="CUSTOMER"/>
+ <xs:enumeration value="DELIVERY"/>
+ <xs:enumeration value="DSPTCHLIST"/>
+ <xs:enumeration value="ECATALOG"/>
+ <xs:enumeration value="ENGCHGORDR"/>
+ <xs:enumeration value="EXCHNGRATE"/>
+ <xs:enumeration value="FIELD"/>
+ <xs:enumeration value="INSPECTION"/>
+ <xs:enumeration value="INVENCOUNT"/>
+ <xs:enumeration value="INVENTORY"/>
+ <xs:enumeration value="INVOICE"/>
+ <xs:enumeration value="ISSUE"/>
+ <xs:enumeration value="ISSUEINFO"/>
+ <xs:enumeration value="ITEM"/>
+ <xs:enumeration value="ITEMCLASS"/>
+ <xs:enumeration value="ITEMSPECS"/>
+ <xs:enumeration value="ITEMXREF"/>
+ <xs:enumeration value="JOURNAL"/>
+ <xs:enumeration value="LDGRACTUAL"/>
+ <xs:enumeration value="LDGRBUDGET"/>
+ <xs:enumeration value="MAINTORDER"/>
+ <xs:enumeration value="MATCHDOC"/>
+ <xs:enumeration value="MATCHFAIL"/>
+ <xs:enumeration value="MATCHOK"/>
+ <xs:enumeration value="MFGTLCODE"/>
+ <xs:enumeration value="MISCITEM"/>
+ <xs:enumeration value="PAYABLE"/>
+ <xs:enumeration value="PERSONNEL"/>
+ <xs:enumeration value="PERSONTIME"/>
+ <xs:enumeration value="PICKLIST"/>
+ <xs:enumeration value="PLANSCHD"/>
+ <xs:enumeration value="PLINVOICE"/>
+ <xs:enumeration value="PO"/>
+ <xs:enumeration value="PRICELIST"/>
+ <xs:enumeration value="PRODAVAIL"/>
+ <xs:enumeration value="PRODORDER"/>
+ <xs:enumeration value="PRODUCTREQ"/>
+ <xs:enumeration value="PROJACCTNG"/>
+ <xs:enumeration value="PROJINFO"/>
+ <xs:enumeration value="QUOTE"/>
+ <xs:enumeration value="RECEIVABLE"/>
+ <xs:enumeration value="REQUISITN"/>
+ <xs:enumeration value="RESOURCE"/>
+ <xs:enumeration value="RFQ"/>
+ <xs:enumeration value="ROUTING"/>
+ <xs:enumeration value="SALESORDER"/>
+ <xs:enumeration value="SEQSCHD"/>
+ <xs:enumeration value="SHIPMENT"/>
+ <xs:enumeration value="SHIPSCHD"/>
+ <xs:enumeration value="SITELEVEL"/>
+ <xs:enumeration value="STATUS"/>
+ <xs:enumeration value="SUPPLIER"/>
+ <xs:enumeration value="UOMGROUP"/>
+ <xs:enumeration value="WIPCONFIRM"/>
+ <xs:enumeration value="WIPMERGE"/>
+ <xs:enumeration value="WIPMOVE"/>
+ <xs:enumeration value="WIPRECOVER"/>
+ <xs:enumeration value="WIPSPLIT"/>
+ <xs:enumeration value="WIPSTATUS"/>
+ <xs:enumeration value="WRKSCHDULE"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="REVISION">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="LOGICALID">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="CONFIRMATION">
+ <xs:annotation>
+ <xs:documentation>
+ 0 - No Confirm BOD requested, 1 - Send Confirm BOD only on error, 2 - Send Confirm BOD always </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ <xs:enumeration value="2"/>
+ <xs:enumeration value="NOCONFIRM"/>
+ <xs:enumeration value="ONERROR"/>
+ <xs:enumeration value="YESCONFIRM"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="LANGUAGE">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="CHARGETYPE">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="DOCTYPE">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="DOCUMENTID">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="DOCUMENTRV">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="ITEM">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="ORIGREF">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="PARTNRID">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="PARTNRTYPE">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ShipTo"/>
+ <xs:enumeration value="BillTo"/>
+ <xs:enumeration value="SoldTo"/>
+ <xs:enumeration value="PayFrom"/>
+ <xs:enumeration value="Supplier"/>
+ <xs:enumeration value="RemitTo"/>
+ <xs:enumeration value="Carrier"/>
+ <xs:enumeration value="Broker"/>
+ <xs:enumeration value="Employee"/>
+ <xs:enumeration value="JV"/>
+ <xs:enumeration value="Publisher"/>
+ <xs:enumeration value="Manufacturer"/>
+ <xs:enumeration value="ShipFrom"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="PAYMETHOD">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="REASONCODE">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="SCHLINENUM">
+ <!-- future xs:decimal -->
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="STATUSLVL">
+ <xs:annotation>
+ <xs:documentation>00 - Success, 99 - Failure</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:integer">
+ <xs:enumeration value="00"/>
+ <xs:enumeration value="99"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="SUBLINENUM">
+ <!-- future xs:decimal -->
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="TAXCODE">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="TAXJRSDCTN">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:simpleType name="TERMID">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+ <xs:element name="NOUN" type="NOUN"/>
+ <xs:element name="REVISION" type="REVISION"/>
+ <!-- AW: support BSR Type - End -->
+ <!-- AW: Below support SENDER Type - Start -->
+ <xs:element name="LOGICALID" type="LOGICALID"/>
+ <xs:element name="COMPONENT" type="xs:string"/>
+ <xs:element name="TASK" type="xs:string"/>
+ <xs:element name="REFERENCEID" type="xs:string"/>
+ <xs:element name="CONFIRMATION" type="CONFIRMATION"/>
+ <xs:element name="LANGUAGE" type="LANGUAGE"/>
+ <xs:element name="CODEPAGE" type="xs:string"/>
+ <xs:element name="AUTHID" type="xs:string"/>
+ <!-- End - Support SENDER Type -->
+ <!-- Start - Support DATETIME Type -->
+ <xs:element name="YEAR" type="xs:gYear"/>
+ <xs:element name="MONTH" type="xs:integer"/>
+ <xs:element name="DAY" type="xs:integer"/>
+ <xs:element name="HOUR" type="xs:integer"/>
+ <xs:element name="MINUTE" type="xs:integer"/>
+ <xs:element name="SECOND" type="xs:integer"/>
+ <xs:element name="SUBSECOND" type="xs:integer"/>
+ <xs:element name="TIMEZONE" type="xs:string"/>
+ <!-- End - Support DATETIME Type -->
+ <!-- Start - Alphabetical from here on -->
+ <xs:element name="ABSENCETYP" type="xs:string"/>
+ <xs:element name="ACCTPERIOD" type="xs:string"/>
+ <xs:element name="ACCTTYPE" type="xs:string"/>
+ <xs:element name="ACCTYEAR" type="xs:integer"/>
+ <xs:element name="ACKCODE" type="xs:string"/>
+ <xs:element name="ACKMODE" type="xs:string"/>
+ <xs:element name="ACKREQUEST">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ <xs:enumeration value="2"/>
+ <xs:enumeration value="NOACK"/>
+ <xs:enumeration value="ONCHANGE"/>
+ <xs:enumeration value="YESACK"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="ACTIONCODE" type="xs:string"/>
+ <xs:element name="ACTIVE" type="xs:string"/>
+ <xs:element name="ACTTYPE" type="xs:string"/>
+ <xs:element name="ADDRLINE">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ADDRTYPE" type="xs:string"/>
+ <xs:element name="ALLOWTYPE" type="xs:string"/>
+ <xs:element name="APPROVAL" type="xs:boolean"/>
+ <xs:element name="APPROVE" type="xs:boolean"/>
+ <xs:element name="APPROVED" type="xs:boolean"/>
+ <xs:element name="APPROVERID" type="xs:string"/>
+ <xs:element name="AUTHCODE" type="xs:string"/>
+ <xs:element name="BACKORDIND" type="xs:boolean"/>
+ <xs:element name="BILLOLADNG" type="xs:string"/>
+ <xs:element name="BKTYPE" type="xs:string"/>
+ <xs:element name="BOMALTID" type="xs:string"/>
+ <xs:element name="BOMID" type="xs:string"/>
+ <xs:element name="BOMNAME" type="xs:string"/>
+ <xs:element name="BOMREVISON" type="xs:string"/>
+ <xs:element name="BOMSTATUS" type="xs:string"/>
+ <xs:element name="BOMTYPE" type="xs:string"/>
+ <xs:element name="BOMUSAGE" type="xs:string"/>
+ <xs:element name="BUDGSTAT" type="xs:integer"/>
+ <xs:element name="BUDGTXN" type="xs:boolean"/>
+ <xs:element name="BUDGVER" type="xs:string"/>
+ <xs:element name="BUSNAREA" type="xs:string"/>
+ <xs:element name="BUYERID" type="xs:string"/>
+ <xs:element name="CARRIER" type="xs:string"/>
+ <xs:element name="CARRSRVLVL" type="xs:string"/>
+ <xs:element name="CATALGNAME" type="xs:string"/>
+ <xs:element name="CATALOGRV" type="xs:string"/>
+ <xs:element name="CHARGEID" type="xs:string"/>
+ <xs:element name="CHARGETYPE" type="CHARGETYPE"/>
+ <xs:element name="CHGLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="CITY" type="xs:string"/>
+ <xs:element name="CLASSFN">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CLASSFNID" type="xs:string"/>
+ <xs:element name="CLASSLEVEL" type="xs:string"/>
+ <xs:element name="CLSSSCHMRV" type="xs:string"/>
+ <xs:element name="CLSELMLVL" type="xs:string"/>
+ <xs:element name="CLSSELMT">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CLSSLMNTID" type="xs:string"/>
+ <xs:element name="CLSSSCHMID" type="xs:string"/>
+ <xs:element name="CMPRSNID" type="xs:string"/>
+ <xs:element name="CMPRSNTYPE" type="xs:string"/>
+ <xs:element name="CNTCTTYPE" type="xs:string"/>
+ <xs:element name="COMMENTS" type="xs:string"/>
+ <xs:element name="COMMODITY">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="COMPLEVEL" type="xs:string"/>
+ <xs:element name="COMPREFDES" type="xs:string"/>
+ <xs:element name="CONDSTATUS" type="xs:string"/>
+ <xs:element name="CONSLINENUM" type="xs:string"/>
+ <xs:element name="CONSUMPTN" type="xs:string"/>
+ <xs:element name="CONTAINRID" type="xs:string"/>
+ <xs:element name="CONTCTTYPE" type="xs:string"/>
+ <xs:element name="CONTNRSEAL" type="xs:string"/>
+ <xs:element name="CONTNRTYPE" type="xs:string"/>
+ <xs:element name="CONTRACTB" type="xs:string"/>
+ <xs:element name="CONTRACTID" type="xs:string"/>
+ <xs:element name="CONTRACTS" type="xs:string"/>
+ <xs:element name="COSTCENTER" type="xs:string"/>
+ <xs:element name="COSTTYPE" type="xs:string"/>
+ <xs:element name="COUNTRY" type="xs:string"/>
+ <xs:element name="COUNTRYDST" type="xs:string"/>
+ <xs:element name="COUNTRYORG" type="xs:string"/>
+ <xs:element name="COUNTY" type="xs:string"/>
+ <xs:element name="CRAFTID" type="xs:string"/>
+ <xs:element name="CTCHWCONV" type="xs:string"/>
+ <xs:element name="CTCHWFLAG" type="xs:integer"/>
+ <xs:element name="CURRENCY" type="xs:string"/>
+ <xs:element name="CURRFROM" type="xs:string"/>
+ <xs:element name="CURRTO" type="xs:string"/>
+ <xs:element name="DATETYPE" type="xs:string"/>
+ <xs:element name="DAYOFMONTH" type="xs:integer"/>
+ <xs:element name="DAYSNUM" type="xs:integer"/>
+ <xs:element name="DEFAULT" type="xs:string"/>
+ <xs:element name="DEFLTVALUE" type="xs:string"/>
+ <xs:element name="DELIVERTO" type="xs:string"/>
+ <xs:element name="DENSITYFAC" type="xs:integer"/>
+ <xs:element name="DEPARTMENT" type="xs:string"/>
+ <xs:element name="DESCRIPTN" type="xs:string"/>
+ <xs:element name="DISCRPTYPE" type="xs:string"/>
+ <xs:element name="DISPOSITN" type="xs:string"/>
+ <xs:element name="DISPOSITON" type="xs:string"/>
+ <xs:element name="DISTCENTER" type="xs:string"/>
+ <xs:element name="DIVISION" type="xs:string"/>
+ <xs:element name="DOCKID" type="xs:string"/>
+ <xs:element name="DOCTYPE" type="DOCTYPE"/>
+ <xs:element name="DOCUMENTID" type="DOCUMENTID"/>
+ <xs:element name="DOCUMENTRV" type="DOCUMENTRV"/>
+ <xs:element name="DRAWING" type="xs:string"/>
+ <xs:element name="DRCR" type="xs:string"/>
+ <xs:element name="DROPSHIP" type="xs:string"/>
+ <xs:element name="DSPSTNINV" type="xs:string"/>
+ <xs:element name="DUNSNUMBER" type="xs:string"/>
+ <xs:element name="ECOAPPSTAT" type="xs:string"/>
+ <xs:element name="ECONAME" type="xs:string"/>
+ <xs:element name="ECOPRIORITY" type="xs:string"/>
+ <xs:element name="ECOREVISON" type="xs:string"/>
+ <xs:element name="ECOTYPE" type="xs:string"/>
+ <xs:element name="ELEMENT">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="EMAIL" type="xs:string"/>
+ <xs:element name="EMPCATEGRY" type="xs:string"/>
+ <xs:element name="EMPDEPT" type="xs:string"/>
+ <xs:element name="EMPLOYEEID" type="xs:string"/>
+ <xs:element name="EMPNAME" type="xs:string"/>
+ <xs:element name="EMPQUALIF" type="xs:string"/>
+ <xs:element name="EMPSTATUS" type="xs:string"/>
+ <xs:element name="ENDITEMID" type="xs:string"/>
+ <xs:element name="EXCLUSIVE" type="xs:boolean"/>
+ <xs:element name="EXCPLINNUM" type="xs:string"/>
+ <xs:element name="EXCPTNCODE" type="xs:string"/>
+ <xs:element name="EXPIREFLAG" type="xs:string"/>
+ <xs:element name="EXPORTLIC" type="xs:boolean"/>
+ <xs:element name="FACTOR" type="xs:integer"/>
+ <xs:element name="FAILCLASS" type="xs:string"/>
+ <xs:element name="FAILCODE" type="xs:string"/>
+ <xs:element name="FAILTYPE" type="xs:string"/>
+ <xs:element name="FAILUREID" type="xs:string"/>
+ <xs:element name="FAX">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="FEATUREID" type="xs:string"/>
+ <xs:element name="FEATVAL" type="xs:string"/>
+ <xs:element name="FIELDID" type="xs:string"/>
+ <xs:element name="FIELDVALUE" type="xs:string"/>
+ <xs:element name="FILENAME" type="xs:string"/>
+ <xs:element name="FILETYPE" type="xs:string"/>
+ <xs:element name="FIXDQTYIND" type="xs:boolean"/>
+ <xs:element name="FIXEDASSET" type="xs:string"/>
+ <xs:element name="FLEXBKTID" type="xs:string"/>
+ <xs:element name="FREIGHTCLS" type="xs:string"/>
+ <xs:element name="FRGHTCLS" type="xs:string"/>
+ <xs:element name="FRGHTITEM" type="xs:string"/>
+ <xs:element name="FRGHTTERMS" type="xs:string"/>
+ <xs:element name="FRMITMCLSS" type="xs:string"/>
+ <xs:element name="FRMITMNM" type="xs:string"/>
+ <xs:element name="FRMITMNMRV" type="xs:string"/>
+ <xs:element name="FRMSITELVL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="FROMPARTY" type="xs:string"/>
+ <xs:element name="FTDATATYPE" type="xs:string"/>
+ <xs:element name="FTGROUP" type="xs:string"/>
+ <xs:element name="FTVALIND" type="xs:string"/>
+ <xs:element name="FTVALQUAL" type="xs:string"/>
+ <xs:element name="FUND" type="xs:string"/>
+ <xs:element name="GEOGRAPHY" type="xs:string"/>
+ <xs:element name="GLENTITYD" type="xs:string"/>
+ <xs:element name="GLENTITYS" type="xs:string"/>
+ <xs:element name="GLNOMACCT" type="xs:string"/>
+ <xs:element name="HAZRDMATL" type="xs:string"/>
+ <xs:element name="HDRSTATUS" type="xs:integer"/>
+ <!-- <xs:element name="HOUR" type="xs:integer"/> def'd above -->
+ <xs:element name="HRORG">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="IMPORTLIC" type="xs:boolean"/>
+ <xs:element name="INCPLANFLG" type="xs:boolean"/>
+ <xs:element name="INDLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="INMRPPLAN" type="xs:boolean"/>
+ <xs:element name="INQUEUEID" type="xs:string"/>
+ <xs:element name="INSLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="INSPDOCREV" type="xs:string"/>
+ <xs:element name="INSPECTDOC" type="xs:string"/>
+ <xs:element name="INSPECTRID" type="xs:string"/>
+ <xs:element name="INVENDISP" type="xs:string"/>
+ <xs:element name="INVLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="ITEM" type="ITEM"/>
+ <xs:element name="ITEMX" type="xs:string"/>
+ <xs:element name="ITEMCATID" type="xs:string"/>
+ <xs:element name="ITEMCLASS" type="xs:string"/>
+ <xs:element name="ITEMCLASSID" type="xs:string"/>
+ <xs:element name="ITEMDEFN" type="xs:string"/>
+ <xs:element name="ITEMDESC" type="xs:string"/>
+ <xs:element name="ITEMRV" type="xs:string"/>
+ <xs:element name="ITEMRVX" type="xs:string"/>
+ <xs:element name="ITEMSTATUS" type="xs:string"/>
+ <xs:element name="ITEMTYPE" type="xs:string"/>
+ <xs:element name="ITEMVAR" type="xs:string"/>
+ <xs:element name="ITMFTVAL" type="xs:string"/>
+ <xs:element name="ITMIDFLG" type="xs:boolean"/>
+ <xs:element name="JEID" type="xs:string"/>
+ <xs:element name="JOBCODE" type="xs:string"/>
+ <xs:element name="JPID" type="xs:string"/>
+ <xs:element name="KANBAN" type="xs:string"/>
+ <xs:element name="LABORID" type="xs:string"/>
+ <xs:element name="LEDGER" type="xs:string"/>
+ <xs:element name="LINE" type="xs:string"/>
+ <xs:element name="LINEFEED" type="xs:string"/>
+ <xs:element name="LINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="LINETYPE" type="xs:string"/>
+ <xs:element name="LOADPOINT" type="xs:string"/>
+ <xs:element name="LOCK" type="xs:integer"/>
+ <xs:element name="LOTLEVEL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="LOTSNFLAG" type="xs:string"/>
+ <xs:element name="MACHCLASS" type="xs:string"/>
+ <xs:element name="MACHID" type="xs:string"/>
+ <xs:element name="MACHINEID" type="xs:string"/>
+ <xs:element name="MACHSTATE" type="xs:boolean"/>
+ <xs:element name="MACHSUDEP" type="xs:string"/>
+ <xs:element name="MACHTYPE" type="xs:string"/>
+ <xs:element name="MAINTCALID" type="xs:string"/>
+ <xs:element name="MAINTLOCID" type="xs:string"/>
+ <xs:element name="MAINTORDID" type="xs:string"/>
+ <xs:element name="MANDATORY" type="xs:boolean"/>
+ <xs:element name="MATCHTYPE" type="xs:string"/>
+ <xs:element name="MCHDOCID" type="xs:string"/>
+ <xs:element name="MCHDOCTYPE" type="xs:string"/>
+ <xs:element name="MCHLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="MOPARENTID" type="xs:string"/>
+ <xs:element name="MOPRIORITY" type="xs:integer"/>
+ <xs:element name="MOSTATUS" type="xs:string"/>
+ <xs:element name="MOTYPE" type="xs:string"/>
+ <xs:element name="MSDSID" type="xs:string"/>
+ <xs:element name="MSGID" type="xs:string"/>
+ <xs:element name="MSGTEXT" type="xs:string"/>
+ <xs:element name="MSGTYPE" type="xs:string"/>
+ <xs:element name="NAME">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="NEWITMREV" type="xs:string"/>
+ <xs:element name="NEWREVFLAG" type="xs:string"/>
+ <xs:element name="NOTES" type="NOTES"/>
+ <xs:complexType name="NOTES">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:element name="NUMOFDEC" type="xs:integer"/>
+ <xs:element name="OILINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="OLDITMREV" type="xs:string"/>
+ <xs:element name="ONETIME" type="xs:boolean"/>
+ <xs:element name="OPENITEM" type="xs:boolean"/>
+ <xs:element name="OPERATNAME" type="xs:string"/>
+ <xs:element name="OPERATNID" type="xs:string"/>
+ <xs:element name="OPERATNSEQ" type="xs:string"/>
+ <xs:element name="OPERATTYPE" type="xs:string"/>
+ <xs:element name="OPRAMTAUTH" type="xs:string"/>
+ <xs:element name="OPRGRPNAME" type="xs:string"/>
+ <xs:element name="OPRGRPTYPE" type="xs:string"/>
+ <xs:element name="OPSTATUS" type="xs:string"/>
+ <xs:element name="OPTCLSNAME" type="xs:string"/>
+ <xs:element name="OPTCLSSID" type="xs:string"/>
+ <xs:element name="OPTIONID" type="xs:string"/>
+ <xs:element name="OPTIONNAME" type="xs:string"/>
+ <xs:element name="ORIGREF" type="ORIGREF"/>
+ <xs:element name="OTELIGIBLE" type="xs:boolean"/>
+ <xs:element name="OUTQUEUEID" type="xs:string"/>
+ <xs:element name="OVERIDPRIC" type="xs:string"/>
+ <xs:element name="OVERTIME" type="xs:boolean"/>
+ <xs:element name="OWNRSHPCDE" type="xs:string"/>
+ <xs:element name="PACKING" type="xs:string"/>
+ <xs:element name="PACKNGDESC" type="xs:string"/>
+ <xs:element name="PARCNTNRID" type="xs:string"/>
+ <xs:element name="PARENTID" type="xs:string"/>
+ <xs:element name="PARENTLOT" type="PARENTLOT"/>
+ <xs:complexType name="PARENTLOT">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:element name="PARENTSNUM" type="xs:string"/>
+ <xs:element name="PARTIALSHP" type="xs:boolean"/>
+ <xs:element name="PARTNRID" type="PARTNRID"/>
+ <xs:element name="PARTNRIDX" type="xs:string"/>
+ <xs:element name="PARTNRRATG" type="xs:string"/>
+ <xs:element name="PARTNRROLE" type="xs:integer"/>
+ <xs:element name="PARTNRTYPE" type="PARTNRTYPE"/>
+ <xs:element name="PAYMETHOD" type="PAYMETHOD"/>
+ <xs:element name="PERSONCODE" type="REASONCODE"/>
+ <xs:element name="PICLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="PLANNERID" type="xs:string"/>
+ <xs:element name="PMID" type="xs:string"/>
+ <xs:element name="POENTITY" type="xs:string"/>
+ <xs:element name="POID" type="xs:string"/>
+ <xs:element name="POLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="POLNSTATUS" type="xs:string"/>
+ <xs:element name="PORELEASE" type="xs:string"/>
+ <xs:element name="POSITION" type="xs:string"/>
+ <xs:element name="POSTALCODE" type="xs:string"/>
+ <xs:element name="POSTATUS" type="xs:string"/>
+ <xs:element name="POTYPE" type="xs:string"/>
+ <xs:element name="PRCESSCODE" type="xs:string"/>
+ <xs:element name="PRDLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="PREFERENCE" type="xs:string"/>
+ <xs:element name="PRICECODE" type="xs:string"/>
+ <xs:element name="PRICELSTID" type="xs:string"/>
+ <xs:element name="PRICELSTRV" type="xs:string"/>
+ <xs:element name="PRICETYPE" type="xs:string"/>
+ <xs:element name="PRINT" type="xs:boolean"/>
+ <xs:element name="PRINTCNTL" type="xs:string"/>
+ <xs:element name="PRIORITY" type="xs:string"/>
+ <xs:element name="PRNTCLSELM" type="xs:string"/>
+ <xs:element name="PRODCTLINE" type="xs:string"/>
+ <xs:element name="PRODORDER" type="xs:string"/>
+ <xs:element name="PRODORDID" type="xs:string"/>
+ <xs:element name="PRODOSTATS" type="xs:string"/>
+ <xs:element name="PRODOTYPE" type="xs:string"/>
+ <xs:element name="PRODSEQBEG" type="xs:string"/>
+ <xs:element name="PRODSEQEND" type="xs:string"/>
+ <xs:element name="PRODSEQNUM" type="xs:string"/>
+ <xs:element name="PROFITCTR" type="xs:string"/>
+ <xs:element name="PROJACTSTS" type="xs:string"/>
+ <xs:element name="PROJACTVTY" type="xs:string"/>
+ <xs:element name="PROJECT" type="xs:string"/>
+ <xs:element name="PROJRESEL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PROJSTATUS" type="xs:string"/>
+ <xs:element name="PROJTXTYPE" type="xs:string"/>
+ <xs:element name="PROPERTY">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="PROXMONTH" type="xs:integer"/>
+ <xs:element name="PSBLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="PSCLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="PSDLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="PSSTATUS" type="xs:string"/>
+ <xs:element name="PUBLISHER" type="xs:string"/>
+ <xs:element name="QSLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="QSLINESTAT" type="xs:string"/>
+ <xs:element name="QSLINETYPE" type="xs:string"/>
+ <xs:element name="QTEID" type="xs:string"/>
+ <xs:element name="QTEIDX" type="xs:string"/>
+ <xs:element name="QTELINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="QTELNSTAT" type="xs:string"/>
+ <xs:element name="QTEREVISON" type="xs:string"/>
+ <xs:element name="QTESTATUS" type="xs:string"/>
+ <xs:element name="QTETYPE" type="xs:string"/>
+ <xs:element name="QUALFNID" type="xs:string"/>
+ <xs:element name="QUALFNTYPE" type="xs:string"/>
+ <xs:element name="QUALFNVAL" type="xs:string"/>
+ <xs:element name="QUALIF" type="xs:string"/>
+ <xs:element name="RATETYPE" type="xs:string"/>
+ <xs:element name="REASONCODE" type="REASONCODE"/>
+ <xs:element name="RECEIPTID" type="xs:string"/>
+ <xs:element name="RECEIPTYPE" type="xs:string"/>
+ <xs:element name="RECEPTDISP" type="xs:string"/>
+ <xs:element name="RECLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="REF">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="REGION" type="xs:string"/>
+ <xs:element name="RELITEMID" type="xs:string"/>
+ <xs:element name="RELLOCID" type="xs:string"/>
+ <xs:element name="RELMACHID" type="xs:string"/>
+ <xs:element name="REMITTANCE" type="xs:string"/>
+ <xs:element name="REPRTGFLAG" type="xs:string"/>
+ <xs:element name="REQLINENUM" type="xs:string"/>
+ <xs:element name="REQLNSTAT" type="xs:string"/>
+ <xs:element name="REQUESTER" type="xs:string"/>
+ <xs:element name="REQUISTNID" type="xs:string"/>
+ <xs:element name="RESORCEUSE" type="xs:string"/>
+ <!-- Deprecated -->
+ <xs:element name="RESORCKIN" type="xs:string"/>
+ <xs:element name="RESORCUSE" type="xs:string"/>
+ <!-- Deprecated -->
+ <xs:element name="RESORCGRP" type="xs:string"/>
+ <xs:element name="RESORCLVL" type="xs:string"/>
+ <xs:element name="RESORCTYP" type="xs:string"/>
+ <xs:element name="RESOURCEID" type="xs:string"/>
+ <xs:element name="RESTRICTN" type="xs:string"/>
+ <!-- <xs:element name="REVISION"> Already defined above -->
+ <xs:element name="REVITMSTAT" type="xs:string"/>
+ <xs:element name="RFQID" type="xs:string"/>
+ <xs:element name="RFQIDX" type="xs:string"/>
+ <xs:element name="RFQLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="RFQLNSTAT" type="xs:string"/>
+ <xs:element name="RFQNAME" type="xs:string"/>
+ <xs:element name="RFQREVISON" type="xs:string"/>
+ <xs:element name="RFQSTATUS" type="xs:string"/>
+ <xs:element name="RFQTYPE" type="xs:string"/>
+ <xs:element name="ROUTEID" type="xs:string"/>
+ <xs:element name="ROUTELEVEL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ROUTETYPE" type="xs:string"/>
+ <xs:element name="ROUTEVAR" type="xs:string"/>
+ <xs:element name="ROUTINGID" type="xs:string"/>
+ <xs:element name="ROUTINGREV" type="xs:string"/>
+ <xs:element name="ROUTINGVAR" type="xs:string"/>
+ <xs:element name="RQSLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="RSBLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="RSLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="RSLINETYPE" type="xs:string"/>
+ <xs:element name="RSPLINNUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="RSPREVNUM" type="xs:string"/>
+ <xs:element name="RSPSCHEDID" type="xs:string"/>
+ <xs:element name="RSPSDLNUM" type="xs:string"/>
+ <xs:element name="SAFETYID" type="xs:string"/>
+ <xs:element name="SAFETYTYPE" type="xs:string"/>
+ <xs:element name="SAFTYCLASS" type="xs:string"/>
+ <xs:element name="SALESORDID" type="xs:string"/>
+ <xs:element name="SALESORG">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SALESPERSN" type="xs:string"/>
+ <xs:element name="SAVESETUP" type="xs:boolean"/>
+ <xs:element name="SCHDULETYP" type="xs:string"/>
+ <xs:element name="SCHEDULEID" type="xs:string"/>
+ <xs:element name="SCHLINENUM" type="SCHLINENUM"/>
+ <xs:element name="SCRAP" type="xs:boolean"/>
+ <xs:element name="SERIALNUM" type="xs:string"/>
+ <xs:element name="SEQNCENUM" type="xs:string"/>
+ <xs:element name="SHIFT" type="xs:string"/>
+ <xs:element name="SHIPMATLID" type="xs:string"/>
+ <xs:element name="SHIPNOTES" type="xs:string"/>
+ <xs:element name="SHIPPERID" type="xs:string"/>
+ <xs:element name="SHIPPERNUM" type="xs:string"/>
+ <xs:element name="SHIPPOINT" type="xs:string"/>
+ <xs:element name="SHIPPRIOR" type="xs:boolean"/>
+ <xs:element name="SHIPSRVLVL" type="xs:string"/>
+ <xs:element name="SHPMTLDESC" type="xs:string"/>
+ <xs:element name="SHPUNITSEQ" type="xs:string"/>
+ <xs:element name="SHPUNITSTS" type="xs:string"/>
+ <xs:element name="SHPUNITTOT" type="xs:string"/>
+ <xs:element name="SIGN" type="xs:string"/>
+ <xs:element name="SITELEVEL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SOLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="SOLNSTATUS" type="xs:string"/>
+ <xs:element name="SOSLINENUM" type="xs:string"/>
+ <!-- future xs:decimal -->
+ <xs:element name="SOSTATUS" type="xs:string"/>
+ <xs:element name="SPECIALHND" type="xs:string"/>
+ <xs:element name="SPLITABLE" type="xs:boolean"/>
+ <xs:element name="STAGEPOINT" type="xs:string"/>
+ <xs:element name="STATEPROVN" type="xs:string"/>
+ <xs:element name="STATUSLVL" type="STATUSLVL"/>
+ <xs:element name="STEPID" type="xs:string"/>
+ <xs:element name="STEPNUM" type="xs:string"/>
+ <xs:element name="STEPTYPE" type="xs:string"/>
+ <xs:element name="SUBLINENUM" type="SUBLINENUM"/>
+ <xs:element name="SUBSFLAG" type="xs:boolean"/>
+ <xs:element name="SUFFIX" type="xs:string"/>
+ <xs:element name="SUPERVISOR" type="xs:string"/>
+ <xs:element name="SYNCIND" type="xs:string"/>
+ <!-- See above
+ <xs:element name="TASK" type="TASK"/>
+ <xs:simpleType name="TASK">
+ <xs:restriction base="xs:string">
+ <xs:maxLength value="10"/>
+ </xs:restriction>
+ </xs:simpleType> -->
+ <xs:element name="TAXCODE" type="TAXCODE"/>
+ <xs:element name="TAXEXEMPT" type="xs:boolean"/>
+ <xs:element name="TAXID" type="xs:string"/>
+ <xs:element name="TAXJRSDCTN" type="TAXJRSDCTN"/>
+ <xs:element name="TAXLINE" type="xs:boolean"/>
+ <xs:element name="TAXWHEXMPT" type="xs:boolean"/>
+ <xs:element name="TELEPHONE">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="TERMFLAG" type="xs:boolean"/>
+ <xs:element name="TERMID" type="TERMID"/>
+ <xs:element name="TITLE" type="xs:string"/>
+ <xs:element name="TOITMCLSS" type="xs:string"/>
+ <xs:element name="TOITMNM" type="xs:string"/>
+ <xs:element name="TOITMNMRV" type="xs:string"/>
+ <xs:element name="TOOLCLASS" type="xs:string"/>
+ <xs:element name="TOOLID" type="xs:string"/>
+ <xs:element name="TOPARTY" type="xs:string"/>
+ <xs:element name="TOSITELVL">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="index" use="required" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="TRACKFLG" type="xs:boolean"/>
+ <xs:element name="TRACKINGID" type="xs:string"/>
+ <xs:element name="TRAKNGFLAG" type="xs:boolean"/>
+ <xs:element name="TRANSMETHD" type="xs:string"/>
+ <xs:element name="TRANSTERMS" type="xs:string"/>
+ <xs:element name="TRNSFRTYPE" type="xs:string"/>
+ <xs:element name="TXANALYSIS" type="xs:string"/>
+ <xs:element name="UNIT" type="xs:string"/>
+ <xs:element name="UNITTYPE" type="xs:string"/>
+ <xs:element name="UOM" type="xs:string"/>
+ <xs:element name="UOMGROUPID" type="xs:string"/>
+ <xs:element name="UOMNUMDEC" type="xs:integer"/>
+ <xs:element name="UOMVALUE" type="xs:string"/>
+ <xs:element name="UPC" type="xs:string"/>
+ <xs:element name="UPCPKGIND" type="xs:string"/>
+ <xs:element name="UPCSCC14" type="xs:string"/>
+ <xs:element name="UPDTWIPFG" type="xs:boolean"/>
+ <xs:element name="URI" type="xs:string"/>
+ <!--xs:uriReference -->
+ <xs:element name="URL" type="xs:string"/>
+ <xs:element name="USAGERESTN" type="xs:string"/>
+ <xs:element name="USERAREA" type="USERAREA"/>
+ <xs:complexType name="USERAREA" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="USERID" type="xs:string"/>
+ <xs:element name="USEUPITEM" type="xs:string"/>
+ <xs:element name="USUPINVFG" type="xs:boolean"/>
+ <xs:element name="VALUE" type="xs:decimal"/>
+ <xs:element name="VALUECLASS" type="xs:string"/>
+ <xs:element name="VOUCHER" type="xs:string"/>
+ <xs:element name="WAGEGROUP" type="xs:string"/>
+ <xs:element name="WAGETYPE" type="xs:string"/>
+ <xs:element name="WAREHOUSE" type="xs:string"/>
+ <xs:element name="WARRANTY" type="xs:string"/>
+ <xs:element name="WORKCENTER" type="xs:string"/>
+ <xs:element name="WORKORDER" type="xs:string"/>
+ <xs:element name="WRKSCHDID" type="xs:string"/>
+ <xs:element name="XREFTYPEID" type="xs:string"/>
+ <!-- End - Supporting Fields & Types -->
+</xs:schema>
diff --git a/v1/test/cases/schema/wli/oagis_segments.xsd b/v1/test/cases/schema/wli/oagis_segments.xsd
new file mode 100644
index 0000000..db865fe
--- /dev/null
+++ b/v1/test/cases/schema/wli/oagis_segments.xsd
@@ -0,0 +1,573 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xs:schema targetNamespace="http://www.openapplications.org/oagis_segments" xmlns="http://www.openapplications.org/oagis_segments" xmlns:of="http://www.openapplications.org/oagis_fields" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:import namespace="http://www.openapplications.org/oagis_fields" schemaLocation="oagis_fields.xsd"/>
+ <xs:annotation>
+ <xs:documentation>
+
+ License information for this file is provided in LICENSE.TXT, as published
+ on the Open Applications Group web site. www.openapplications.org
+
+ For support, more information, or to report implementation bugs,
+ please contact the Open Applications Group at xml@openapplications.org
+
+ $Revision$
+ $Date$
+ Open Applications Group XML
+ Copyright 1998-2001, All Rights Reserved
+
+ $Name: $
+
+ ajw 7.2.1 10/31/2001 W3C Schema Release
+
+
+ Structure Overview
+
+ This schema defines the OAGI Segment datatypes used throughout the specification.
+ Below is an outline depicting their placement and usage.
+
+ BOD Namespace ("http://www.openapplications.org/nnn_verb_noun_rel")
+ |
+ |--- Segments Namespace - oagis_segments.xsd (os: "http://www.openapplications.org/oagis_segments")
+ | |
+ |--- |--- Fields Namespace - oagis_fields.xsd (of:"http://www.openapplications.org/oagis_fields")
+
+
+
+ </xs:documentation>
+ </xs:annotation>
+ <xs:element name="CNTROLAREA" type="CNTROLAREA"/>
+ <xs:complexType name="CNTROLAREA">
+ <xs:sequence>
+ <xs:element ref="BSR"/>
+ <xs:element ref="SENDER"/>
+ <xs:element ref="DATETIMEANY"/>
+ <!-- Either DATETIME or DATETIMEISO -->
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="BSR">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="of:VERB"/>
+ <xs:element ref="of:NOUN"/>
+ <xs:element ref="of:REVISION"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SENDER">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="of:LOGICALID"/>
+ <xs:element ref="of:COMPONENT"/>
+ <xs:element ref="of:TASK"/>
+ <xs:element ref="of:REFERENCEID"/>
+ <xs:element ref="of:CONFIRMATION"/>
+ <xs:element ref="of:LANGUAGE"/>
+ <xs:element ref="of:CODEPAGE"/>
+ <xs:element ref="of:AUTHID"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DATETIMEANY" abstract="true"/>
+ <xs:element name="DATETIMEISO" type="DATETIMEISO" substitutionGroup="DATETIMEANY"/>
+ <xs:complexType name="DATETIMEISO">
+ <xs:simpleContent>
+ <xs:extension base="xs:dateTime">
+ <xs:attribute name="qualifier" type="DATETIMEqual"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <!-- DATETIMEISO -->
+ <xs:element name="DATETIME" type="DATETIME" substitutionGroup="DATETIMEANY"/>
+ <xs:complexType name="DATETIME">
+ <xs:sequence>
+ <xs:element ref="of:YEAR"/>
+ <xs:element ref="of:MONTH"/>
+ <xs:element ref="of:DAY"/>
+ <xs:element ref="of:HOUR"/>
+ <xs:element ref="of:MINUTE"/>
+ <xs:element ref="of:SECOND"/>
+ <xs:element ref="of:SUBSECOND"/>
+ <xs:element ref="of:TIMEZONE"/>
+ </xs:sequence>
+ <xs:attribute name="qualifier" type="DATETIMEqual" use="required"/>
+ </xs:complexType>
+ <xs:simpleType name="DATETIMEtype">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ACCOUNTING"/>
+ <xs:enumeration value="ACTEND"/>
+ <xs:enumeration value="ACTSTART"/>
+ <xs:enumeration value="APPREQ"/>
+ <xs:enumeration value="APPROVAL"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="DATETIMEqual">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ACCOUNTING"/>
+ <xs:enumeration value="ACTEND"/>
+ <xs:enumeration value="ACTSTART"/>
+ <xs:enumeration value="APPREQ"/>
+ <xs:enumeration value="APPROVAL"/>
+ <xs:enumeration value="AVAILABLE"/>
+ <xs:enumeration value="BKTEND"/>
+ <xs:enumeration value="BKTSTART"/>
+ <xs:enumeration value="CANCEL"/>
+ <xs:enumeration value="CHANGEDATE"/>
+ <xs:enumeration value="COMPDATE"/>
+ <xs:enumeration value="CONSUME"/>
+ <xs:enumeration value="CREATION"/>
+ <xs:enumeration value="CUMULATIVE"/>
+ <xs:enumeration value="DELIVACT"/>
+ <xs:enumeration value="DELIVSCHED"/>
+ <xs:enumeration value="DISCNT"/>
+ <xs:enumeration value="DOCUMENT"/>
+ <xs:enumeration value="DUE"/>
+ <xs:enumeration value="EARLSTEFF"/>
+ <xs:enumeration value="EARLSTSHIP"/>
+ <xs:enumeration value="EFFECTIVE"/>
+ <xs:enumeration value="ENGCHG"/>
+ <xs:enumeration value="EXECFINISH"/>
+ <xs:enumeration value="EXECSTART"/>
+ <xs:enumeration value="EXPIRATION"/>
+ <xs:enumeration value="FAILDATE"/>
+ <xs:enumeration value="FORECASTF"/>
+ <xs:enumeration value="FORECASTS"/>
+ <xs:enumeration value="FROM"/>
+ <xs:enumeration value="GENERATION"/>
+ <xs:enumeration value="JOBDUE"/>
+ <xs:enumeration value="IMPL"/>
+ <xs:enumeration value="INVOICE"/>
+ <xs:enumeration value="LABORFINSH"/>
+ <xs:enumeration value="LABORSTART"/>
+ <xs:enumeration value="LASTUSED"/>
+ <xs:enumeration value="LOADING"/>
+ <xs:enumeration value="MATCHING"/>
+ <xs:enumeration value="MSMENTDATE"/>
+ <xs:enumeration value="NEEDDELV"/>
+ <xs:enumeration value="OPFINISH"/>
+ <xs:enumeration value="OPSTART"/>
+ <xs:enumeration value="PAYEND"/>
+ <xs:enumeration value="PLANEND"/>
+ <xs:enumeration value="PLANSTART"/>
+ <xs:enumeration value="PO"/>
+ <xs:enumeration value="PROMDELV"/>
+ <xs:enumeration value="PROMSHIP"/>
+ <xs:enumeration value="PYMTTERM"/>
+ <xs:enumeration value="RECEIVED"/>
+ <xs:enumeration value="REPORTDATE"/>
+ <xs:enumeration value="REPORTNGFN"/>
+ <xs:enumeration value="REPORTNGST"/>
+ <xs:enumeration value="REQUIRED"/>
+ <xs:enumeration value="RESORCDWNF"/>
+ <xs:enumeration value="RESORCDWNS"/>
+ <xs:enumeration value="RSPDDATE"/>
+ <xs:enumeration value="RSPDOCGEN"/>
+ <xs:enumeration value="SCHEND"/>
+ <xs:enumeration value="SCHSTART"/>
+ <xs:enumeration value="SETUPFINSH"/>
+ <xs:enumeration value="SETUPSTART"/>
+ <xs:enumeration value="SHIP"/>
+ <xs:enumeration value="SHIPSCHED"/>
+ <xs:enumeration value="STATUSDATE"/>
+ <xs:enumeration value="TEARDOWNF"/>
+ <xs:enumeration value="TEARDOWNS"/>
+ <xs:enumeration value="TO"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <!-- DATETIME -->
+ <xs:element name="ADDRESS" type="ADDRESS"/>
+ <xs:complexType name="ADDRESS">
+ <xs:sequence>
+ <xs:element ref="of:ADDRLINE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:ADDRTYPE" minOccurs="0"/>
+ <xs:element ref="of:CITY" minOccurs="0"/>
+ <xs:element ref="of:COUNTRY" minOccurs="0"/>
+ <xs:element ref="of:COUNTY" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:FAX" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:POSTALCODE" minOccurs="0"/>
+ <xs:element ref="of:REGION" minOccurs="0"/>
+ <xs:element ref="of:STATEPROVN" minOccurs="0"/>
+ <xs:element ref="of:TAXJRSDCTN" minOccurs="0"/>
+ <xs:element ref="of:TELEPHONE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:URL" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="CONTACT" type="CONTACT"/>
+ <xs:complexType name="CONTACT">
+ <xs:sequence>
+ <xs:element ref="of:NAME"/>
+ <xs:element ref="of:CONTCTTYPE" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:EMAIL" minOccurs="0"/>
+ <xs:element ref="of:FAX" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:NAME" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:TELEPHONE" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="AMOUNT" type="AMOUNT"/>
+ <xs:complexType name="AMOUNT">
+ <xs:sequence>
+ <xs:element ref="of:VALUE"/>
+ <xs:element ref="of:NUMOFDEC"/>
+ <xs:element ref="of:SIGN"/>
+ <xs:element ref="of:CURRENCY"/>
+ <xs:element ref="of:DRCR"/>
+ </xs:sequence>
+ <xs:attribute name="qualifier" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="ACTUAL"/>
+ <xs:enumeration value="APPRVORD"/>
+ <xs:enumeration value="AVAILABLE"/>
+ <xs:enumeration value="BUDGET"/>
+ <xs:enumeration value="COMMISSION"/>
+ <xs:enumeration value="DECLAREVAL"/>
+ <xs:enumeration value="DSCPRCNT"/>
+ <xs:enumeration value="DSCVALUE"/>
+ <xs:enumeration value="DISCNT"/>
+ <xs:enumeration value="DOCUMENT"/>
+ <xs:enumeration value="ESTENGIMP"/>
+ <xs:enumeration value="ESTFREIGHT"/>
+ <xs:enumeration value="ESTHRS"/>
+ <xs:enumeration value="ESTIMATE"/>
+ <xs:enumeration value="ESTMANIMP"/>
+ <xs:enumeration value="ESTUCOST"/>
+ <xs:enumeration value="EXTENDED"/>
+ <xs:enumeration value="FREIGHT"/>
+ <xs:enumeration value="ITEM"/>
+ <xs:enumeration value="OPENITEM"/>
+ <xs:enumeration value="ORDER"/>
+ <xs:enumeration value="ORDLIMIT"/>
+ <xs:enumeration value="PAYRATE"/>
+ <xs:enumeration value="RATE"/>
+ <xs:enumeration value="PRCBRK"/>
+ <xs:enumeration value="TAX"/>
+ <xs:enumeration value="TAXBASE"/>
+ <xs:enumeration value="TOTAL"/>
+ <xs:enumeration value="TOTLIMIT"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="type">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="T"/>
+ <xs:enumeration value="F"/>
+ <xs:enumeration value="TAX"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="index" type="xs:string"/>
+ </xs:complexType>
+ <!-- AMOUNT -->
+ <xs:element name="ATTCHREF" type="ATTCHREF"/>
+ <xs:complexType name="ATTCHREF">
+ <xs:sequence>
+ <xs:element ref="DATETIME" minOccurs="0"/>
+ <xs:element ref="QUANTITY" minOccurs="0"/>
+ <xs:element ref="of:CMPRSNTYPE" minOccurs="0"/>
+ <xs:element ref="of:CMPRSNID" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:FILETYPE" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:TITLE" minOccurs="0"/>
+ <!-- <xs:element ref="of:USERAREA" minOccurs="0"/> -->
+ <xs:choice>
+ <xs:element ref="of:FILENAME"/>
+ <xs:sequence>
+ <xs:element ref="of:URI"/>
+ <xs:element ref="of:FILENAME" minOccurs="0"/>
+ </xs:sequence>
+ </xs:choice>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="CHARGE" type="CHARGE"/>
+ <xs:complexType name="CHARGE">
+ <xs:sequence>
+ <xs:element ref="OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:CHARGEID" minOccurs="0"/>
+ <xs:element ref="of:CHARGETYPE" minOccurs="0"/>
+ <xs:element ref="of:CHGLINENUM" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="DISTRIBUTN" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="DISTRIBUTN" type="DISTRIBUTN"/>
+ <xs:complexType name="DISTRIBUTN">
+ <xs:sequence>
+ <xs:element ref="OPERAMT" minOccurs="0"/>
+ <xs:element ref="of:BUSNAREA" minOccurs="0"/>
+ <xs:element ref="of:COSTCENTER" minOccurs="0"/>
+ <xs:element ref="of:DEPARTMENT" minOccurs="0"/>
+ <xs:element ref="of:DIVISION" minOccurs="0"/>
+ <xs:element ref="of:ELEMENT" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:FUND" minOccurs="0"/>
+ <xs:element ref="of:GEOGRAPHY" minOccurs="0"/>
+ <xs:element ref="of:GLENTITYS" minOccurs="0"/>
+ <xs:element ref="of:GLNOMACCT" minOccurs="0"/>
+ <xs:element ref="of:PROFITCTR" minOccurs="0"/>
+ <xs:element ref="of:PROJECT" minOccurs="0"/>
+ <xs:element ref="of:UNIT" minOccurs="0"/>
+ <xs:element ref="of:WAREHOUSE" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="OPERAMT" type="OPERAMT"/>
+ <xs:complexType name="OPERAMT">
+ <xs:sequence>
+ <xs:element ref="of:VALUE"/>
+ <xs:element ref="of:NUMOFDEC"/>
+ <xs:element ref="of:SIGN"/>
+ <xs:element ref="of:CURRENCY"/>
+ <xs:element ref="of:UOMVALUE"/>
+ <xs:element ref="of:UOMNUMDEC"/>
+ <xs:element ref="of:UOM"/>
+ </xs:sequence>
+ <xs:attribute name="qualifier" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="COST"/>
+ <xs:enumeration value="EXTENDED"/>
+ <xs:enumeration value="FREIGHT"/>
+ <xs:enumeration value="UNIT"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="T"/>
+ <xs:enumeration value="F"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:element name="PARTNER" type="PARTNER"/>
+ <xs:complexType name="PARTNER">
+ <xs:sequence>
+ <xs:element ref="of:NAME" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:ONETIME" minOccurs="0"/>
+ <xs:element ref="of:PARTNRID" minOccurs="0"/>
+ <xs:element ref="of:PARTNRTYPE" minOccurs="0"/>
+ <xs:element ref="of:SYNCIND" minOccurs="0"/>
+ <xs:element ref="of:ACTIVE" minOccurs="0"/>
+ <xs:element ref="of:CURRENCY" minOccurs="0"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:DUNSNUMBER" minOccurs="0"/>
+ <xs:element ref="of:GLENTITYS" minOccurs="0"/>
+ <xs:element ref="of:PARENTID" minOccurs="0"/>
+ <xs:element ref="of:PARTNRIDX" minOccurs="0"/>
+ <xs:element ref="of:PARTNRRATG" minOccurs="0"/>
+ <xs:element ref="of:PARTNRROLE" minOccurs="0"/>
+ <xs:element ref="of:PAYMETHOD" minOccurs="0"/>
+ <xs:element ref="of:TAXEXEMPT" minOccurs="0"/>
+ <xs:element ref="of:TAXID" minOccurs="0"/>
+ <xs:element ref="of:TERMID" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ <xs:element ref="ADDRESS" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="CONTACT" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="TEMPRATURE" type="TEMPERATURE"/>
+ <xs:complexType name="TEMPERATURE">
+ <xs:sequence>
+ <xs:element ref="of:VALUE"/>
+ <xs:element ref="of:NUMOFDEC"/>
+ <xs:element ref="of:SIGN"/>
+ </xs:sequence>
+ <xs:attribute name="qualifier" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="ACTUAL"/>
+ <xs:enumeration value="DELIVERY"/>
+ <xs:enumeration value="LOADING"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="CELSIUS"/>
+ <xs:enumeration value="FAHRENHEIT"/>
+ <xs:enumeration value="KELVIN"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <xs:element name="QUANTITY" type="QUANTITY"/>
+ <xs:complexType name="QUANTITY">
+ <xs:sequence>
+ <xs:element ref="of:VALUE"/>
+ <xs:element ref="of:NUMOFDEC"/>
+ <xs:element ref="of:SIGN"/>
+ <xs:element ref="of:UOM"/>
+ </xs:sequence>
+ <xs:attribute name="qualifier" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="ACCEPTED"/>
+ <xs:enumeration value="ACTDUR"/>
+ <xs:enumeration value="ACTHRS"/>
+ <xs:enumeration value="ALLOCATED"/>
+ <xs:enumeration value="ALLOWEDWT"/>
+ <xs:enumeration value="AVAILABLE"/>
+ <xs:enumeration value="AVGRUNSIZE"/>
+ <xs:enumeration value="BACKORDERD"/>
+ <xs:enumeration value="BATCHSIZE"/>
+ <xs:enumeration value="BATCHTIME"/>
+ <xs:enumeration value="BLOCKED"/>
+ <xs:enumeration value="BREAKTIME"/>
+ <xs:enumeration value="CAPPERCENT"/>
+ <xs:enumeration value="CATCHWEGHT"/>
+ <xs:enumeration value="COMMISSION"/>
+ <xs:enumeration value="COMPLETED"/>
+ <xs:enumeration value="CUMULATIVE"/>
+ <xs:enumeration value="DELIVERED"/>
+ <xs:enumeration value="DURATION"/>
+ <xs:enumeration value="DUROVER"/>
+ <xs:enumeration value="DURUNDER"/>
+ <xs:enumeration value="EMPLOYEES"/>
+ <xs:enumeration value="EMPREQD"/>
+ <xs:enumeration value="ESTDUR"/>
+ <xs:enumeration value="ESTHRS"/>
+ <xs:enumeration value="ESTWEIGHT"/>
+ <xs:enumeration value="FILENAME"/>
+ <xs:enumeration value="FILESIZE"/>
+ <xs:enumeration value="FIXEDTIME"/>
+ <xs:enumeration value="HEIGHT"/>
+ <xs:enumeration value="INSPECTED"/>
+ <xs:enumeration value="INSPECTION"/>
+ <xs:enumeration value="ITEM"/>
+ <xs:enumeration value="LDTMOFFSET"/>
+ <xs:enumeration value="LENGTH"/>
+ <xs:enumeration value="LABOR"/>
+ <xs:enumeration value="LOADINGWT"/>
+ <xs:enumeration value="LOTSIZEMAX"/>
+ <xs:enumeration value="LOTSIZEMIN"/>
+ <xs:enumeration value="LOTSIZEMLT"/>
+ <xs:enumeration value="LOWERLIMIT"/>
+ <xs:enumeration value="MACHINEHRS"/>
+ <xs:enumeration value="MAXIMUM"/>
+ <xs:enumeration value="MAXPARLTM"/>
+ <xs:enumeration value="MINIMUM"/>
+ <xs:enumeration value="MOVETIME"/>
+ <xs:enumeration value="MSMENT"/>
+ <xs:enumeration value="MULTIPLIER"/>
+ <xs:enumeration value="NETWEIGHT"/>
+ <xs:enumeration value="OPEN"/>
+ <xs:enumeration value="ORDERED"/>
+ <xs:enumeration value="OTHERREJ"/>
+ <xs:enumeration value="OVERSHIP"/>
+ <xs:enumeration value="PACKING"/>
+ <xs:enumeration value="PERCENT"/>
+ <xs:enumeration value="PERCENTREQ"/>
+ <xs:enumeration value="PERSHBNOPR"/>
+ <xs:enumeration value="PERSHWIOPR"/>
+ <xs:enumeration value="PLNDPRCT"/>
+ <xs:enumeration value="PRCBRK"/>
+ <xs:enumeration value="PRIOR"/>
+ <xs:enumeration value="QUEUETIME"/>
+ <xs:enumeration value="RATE"/>
+ <xs:enumeration value="RECEIVED"/>
+ <xs:enumeration value="REJECTED"/>
+ <xs:enumeration value="REJFIXED"/>
+ <xs:enumeration value="REJPERCENT"/>
+ <xs:enumeration value="REMDUR"/>
+ <xs:enumeration value="REMHRS"/>
+ <xs:enumeration value="REQUIRED"/>
+ <xs:enumeration value="RETURNED"/>
+ <xs:enumeration value="REWORK"/>
+ <xs:enumeration value="RUNTIME"/>
+ <xs:enumeration value="SCRAP"/>
+ <xs:enumeration value="SETUPTIME"/>
+ <xs:enumeration value="SHELFLIFE"/>
+ <xs:enumeration value="SHIPPED"/>
+ <xs:enumeration value="SHIPUNIT"/>
+ <xs:enumeration value="START"/>
+ <xs:enumeration value="TEARDOWN"/>
+ <xs:enumeration value="TOOLREQD"/>
+ <xs:enumeration value="TOTWEIGHT"/>
+ <xs:enumeration value="TRANSFRLOT"/>
+ <xs:enumeration value="UNDERSHIP"/>
+ <xs:enumeration value="UNIT"/>
+ <xs:enumeration value="UPPERLIMIT"/>
+ <xs:enumeration value="VOLUME"/>
+ <xs:enumeration value="WAITTIME"/>
+ <xs:enumeration value="WEIGHT"/>
+ <xs:enumeration value="WIDTH"/>
+ <xs:enumeration value="OTHER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ <!-- QUANTITY -->
+ <xs:element name="DOCUMNTREF" type="DOCUMNTREF"/>
+ <xs:complexType name="DOCUMNTREF">
+ <xs:sequence>
+ <xs:element ref="of:DOCTYPE"/>
+ <xs:element ref="of:DOCUMENTID"/>
+ <xs:element ref="of:PARTNRID"/>
+ <xs:element ref="of:PARTNRTYPE"/>
+ <xs:element ref="of:DESCRIPTN" minOccurs="0"/>
+ <xs:element ref="of:DOCUMENTRV" minOccurs="0"/>
+ <xs:element ref="of:LINENUM" minOccurs="0"/>
+ <xs:element ref="of:NOTES" minOccurs="0"/>
+ <xs:element ref="of:SCHLINENUM" minOccurs="0"/>
+ <xs:element ref="of:SUBLINENUM" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="DOCUMENT" type="DOCUMENT"/>
+ <xs:complexType name="DOCUMENT">
+ <xs:sequence>
+ <xs:element ref="of:DOCUMENTID" minOccurs="0"/>
+ <xs:element ref="of:DOCUMENTRV" minOccurs="0"/>
+ <xs:element ref="of:DOCTYPE" minOccurs="0"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+ <xs:element name="LOTSERIAL" type="LOTSERIAL"/>
+ <xs:complexType name="LOTSERIAL">
+ <xs:sequence>
+ <xs:element ref="QUANTITY" minOccurs="0"/>
+ <!--(%QUANTITY.ITEM;)? -->
+ <xs:element ref="of:LOTLEVEL" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:PARENTLOT" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:PARENTSNUM" minOccurs="0"/>
+ <xs:element ref="of:SERIALNUM" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="of:USERAREA" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="returndata" type="xs:string"/>
+ </xs:complexType>
+</xs:schema>
diff --git a/v1/test/cases/store/ConsolidateTest.xml b/v1/test/cases/store/ConsolidateTest.xml
new file mode 100644
index 0000000..8fc9eea
--- /dev/null
+++ b/v1/test/cases/store/ConsolidateTest.xml
@@ -0,0 +1,51 @@
+<!-- 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. -->
+<employees>
+ <employee>
+ <name>Fred Jones</name>
+ <address location="home">
+ <street>900 Aurora Ave.</street>
+ <city>Seattle</city>
+ <state>WA</state>
+ <zip>98109</zip>
+ </address>
+ <address location="work">
+ <street>2011 152nd Avenue NE</street>
+ <city>Redmond</city>
+ <state>WA</state>
+ <zip>98052</zip>
+ </address>
+ <phone location="work">(425)641-9385</phone>
+ <phone location="home">(206)441-1695</phone>
+ <phone location="mobile">(206)714-2515</phone>
+ </employee>
+ <employee>
+ <name>Sally Smith</name>
+ <address location="home">
+ <street>1430 Oak Place</street>
+ <city>Salem</city>
+ <state>OR</state>
+ <zip>97125</zip>
+ </address>
+ <address location="work">
+ <street>765 Main St.</street>
+ <city>Kaiser</city>
+ <state>OR</state>
+ <zip>97103</zip>
+ </address>
+ <phone location="work">(503)264-3856</phone>
+ <phone location="home">(503)416-6951</phone>
+ <phone location="mobile">(503)214-5152</phone>
+ </employee>
+</employees>
diff --git a/v1/test/cases/store/easypo1.xml b/v1/test/cases/store/easypo1.xml
new file mode 100644
index 0000000..17daf23
--- /dev/null
+++ b/v1/test/cases/store/easypo1.xml
@@ -0,0 +1,42 @@
+<!-- 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. -->
+<po:purchase-order xmlns:po="http://openuri.org/easypo">
+ <po:customer>
+ <po:name>David Bau</po:name>
+ <po:address>Gladwyne, PA</po:address>
+ </po:customer>
+ <po:date>2002-09-30T14:16:00-05:00</po:date>
+ <po:line-item>
+ <po:description>Burnham's Celestial Handbook, Vol 1</po:description>
+ <po:per-unit-ounces>5</po:per-unit-ounces>
+ <po:price>21.79</po:price>
+ <po:quantity>2</po:quantity>
+ </po:line-item>
+ <po:line-item>
+ <po:description>Burnham's Celestial Handbook, Vol 2</po:description>
+ <po:per-unit-ounces>5</po:per-unit-ounces>
+ <po:price>19.89</po:price>
+ <po:quantity>2</po:quantity>
+ </po:line-item>
+ <po:line-item>
+ <po:description>Burnham's Celestial Handbook, Vol 3</po:description>
+ <po:per-unit-ounces>5</po:per-unit-ounces>
+ <po:price>19.89</po:price>
+ <po:quantity>1</po:quantity>
+ </po:line-item>
+ <po:shipper>
+ <po:name>UPS</po:name>
+ <po:per-ounce-rate>0.74</po:per-ounce-rate>
+ </po:shipper>
+</po:purchase-order>
diff --git a/v1/test/cases/store/erictest.xml b/v1/test/cases/store/erictest.xml
new file mode 100644
index 0000000..86cff30
--- /dev/null
+++ b/v1/test/cases/store/erictest.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<bar><foo>1</foo><foo>2</foo></bar>
\ No newline at end of file
diff --git a/v1/test/cases/store/small.xml b/v1/test/cases/store/small.xml
new file mode 100644
index 0000000..edf4b78
--- /dev/null
+++ b/v1/test/cases/store/small.xml
@@ -0,0 +1,25 @@
+<?xml
+
+ version
+=
+
+
+"
+"
+standalone='yes' ?>
+<!-- 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. -->
+<aaaa a="a_value" b:a = 'b_value' xmlns:b="b_ns">
+ <?pi tab tesxt rt?>
+</aaaa>
diff --git a/v1/test/cases/store/test.xml b/v1/test/cases/store/test.xml
new file mode 100644
index 0000000..75d928a
--- /dev/null
+++ b/v1/test/cases/store/test.xml
@@ -0,0 +1 @@
+<foo x="y">ab</foo>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_0_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_0_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_0_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_10_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_10_0.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_10_0.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_10_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_10_1.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_10_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_10_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_10_2.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_10_2.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_10_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_10_3.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_10_3.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_11_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_11_0.xml
new file mode 100644
index 0000000..ec53354
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_11_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_12_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_12_0.xml
new file mode 100644
index 0000000..c6e7051
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_12_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment><!-- --></xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_13_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_13_0.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_13_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_13_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_13_1.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_13_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_14_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_14_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_14_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_14_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_14_1.xml
new file mode 100644
index 0000000..71a9946
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_14_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr1="a1" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_14_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_14_2.xml
new file mode 100644
index 0000000..027e1fa
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_14_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_15_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_15_0.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_15_0.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_15_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_15_1.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_15_1.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_15_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_15_2.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_15_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_16_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_16_0.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_16_0.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_0.xml
new file mode 100644
index 0000000..86a8909
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_0.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_1.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_2.xml
new file mode 100644
index 0000000..86a8909
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_2.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_3.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_3.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_4.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_4.xml
new file mode 100644
index 0000000..eff78d1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_4.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+</xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_5.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_5.xml
new file mode 100644
index 0000000..06a6a9a
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_5.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_6.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_6.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_6.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_7.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_7.xml
new file mode 100644
index 0000000..abc545d
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_7.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_18_8.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_18_8.xml
new file mode 100644
index 0000000..a184f05
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_18_8.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_19_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_19_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_19_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_0.xml
new file mode 100644
index 0000000..4d48ff7
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_0.xml
@@ -0,0 +1,20 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
+<!-- -->
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_1.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_1.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_10.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_10.xml
new file mode 100644
index 0000000..abc545d
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_10.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_11.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_11.xml
new file mode 100644
index 0000000..a184f05
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_11.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_2.xml
new file mode 100644
index 0000000..c6e7051
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment><!-- --></xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_3.xml
new file mode 100644
index 0000000..86a8909
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_3.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_4.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_4.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_4.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_5.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_5.xml
new file mode 100644
index 0000000..86a8909
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_5.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_6.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_6.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_6.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_7.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_7.xml
new file mode 100644
index 0000000..eff78d1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_7.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment>
+</xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_8.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_8.xml
new file mode 100644
index 0000000..06a6a9a
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_8.xml
@@ -0,0 +1,15 @@
+<!-- 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. -->
+<xml-fragment xmlns:ext="http://somebody.elses.extension">
+ </xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_1_9.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_1_9.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_1_9.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_20_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_20_0.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_20_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_20_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_20_1.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_20_1.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_20_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_20_2.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_20_2.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_20_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_20_3.xml
new file mode 100644
index 0000000..4d48ff7
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_20_3.xml
@@ -0,0 +1,20 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
+<!-- -->
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_21_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_21_0.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_21_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_21_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_21_1.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_21_1.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_21_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_21_2.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_21_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_22_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_22_0.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_22_0.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_22_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_22_1.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_22_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_23_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_23_0.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_23_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_24_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_24_0.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_24_0.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_2_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_2_0.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_2_0.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_3_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_3_0.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_3_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_4_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_4_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_4_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_4_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_4_1.xml
new file mode 100644
index 0000000..71a9946
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_4_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr1="a1" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_4_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_4_2.xml
new file mode 100644
index 0000000..027e1fa
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_4_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_5_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_5_0.xml
new file mode 100644
index 0000000..4d48ff7
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_5_0.xml
@@ -0,0 +1,20 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
+<!-- -->
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_6_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_6_0.xml
new file mode 100644
index 0000000..4d48ff7
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_6_0.xml
@@ -0,0 +1,20 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
+<!-- -->
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_6_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_6_1.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_6_1.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_6_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_6_2.xml
new file mode 100644
index 0000000..3bfbc8f
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_6_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_6_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_6_3.xml
new file mode 100644
index 0000000..3fb35e0
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_6_3.xml
@@ -0,0 +1,16 @@
+<!-- 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. -->
+<b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension">
+ <a/>
+</b>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_6_4.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_6_4.xml
new file mode 100644
index 0000000..b02ace1
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_6_4.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<a xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_7_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_7_0.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_7_0.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_8_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_8_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_8_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_8_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_8_1.xml
new file mode 100644
index 0000000..71a9946
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_8_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr1="a1" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_9_0.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_9_0.xml
new file mode 100644
index 0000000..73b3dab
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_9_0.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment test="test" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_9_1.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_9_1.xml
new file mode 100644
index 0000000..71a9946
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_9_1.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr1="a1" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_9_2.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_9_2.xml
new file mode 100644
index 0000000..027e1fa
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_9_2.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment attr2="a2" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ext="http://somebody.elses.extension"/>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_9_3.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_9_3.xml
new file mode 100644
index 0000000..ba9fc49
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_9_3.xml
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test"/>
+ <b attr1="a1" attr2="a2" xmlns:java="http://xml.apache.org/xslt/java">
+ <a/>
+ </b>
+</doc>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/expected/JaxenXPathTest_9_4.xml b/v1/test/cases/xpath/expected/JaxenXPathTest_9_4.xml
new file mode 100644
index 0000000..c6e7051
--- /dev/null
+++ b/v1/test/cases/xpath/expected/JaxenXPathTest_9_4.xml
@@ -0,0 +1,14 @@
+<!-- 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. -->
+<xml-fragment><!-- --></xml-fragment>
\ No newline at end of file
diff --git a/v1/test/cases/xpath/much_ado.xml b/v1/test/cases/xpath/much_ado.xml
new file mode 100644
index 0000000..f008fad
--- /dev/null
+++ b/v1/test/cases/xpath/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, &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, &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/v1/test/cases/xpath/testXPath.xml b/v1/test/cases/xpath/testXPath.xml
new file mode 100644
index 0000000..6f92a76
--- /dev/null
+++ b/v1/test/cases/xpath/testXPath.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<doc xmlns:ext="http://somebody.elses.extension">
+ <a test="test" />
+ <b attr1="a1" attr2="a2"
+ xmlns:java="http://xml.apache.org/xslt/java">
+ <a>
+ </a>
+ </b>
+</doc><!-- -->
diff --git a/v1/test/src/drt/drtcases/AllTests.java b/v1/test/src/drt/drtcases/AllTests.java
new file mode 100644
index 0000000..8525716
--- /dev/null
+++ b/v1/test/src/drt/drtcases/AllTests.java
@@ -0,0 +1,35 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+public class AllTests extends TestCase
+{
+ public AllTests(String name) { super(name); }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(QNameSetTest.suite());
+ suite.addTest(SmokeTests.suite());
+ //suite.addTestSuite(JavelinTests.class);
+
+ return suite;
+ }
+}
diff --git a/v1/test/src/drt/drtcases/AnnotationsTests.java b/v1/test/src/drt/drtcases/AnnotationsTests.java
new file mode 100644
index 0000000..dd8c441
--- /dev/null
+++ b/v1/test/src/drt/drtcases/AnnotationsTests.java
@@ -0,0 +1,83 @@
+/* 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 drtcases;
+
+import java.io.File;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AnnotationsTests extends TestCase
+{
+ public AnnotationsTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(AnnotationsTests.class); }
+
+ static String[] _args;
+ static String _test;
+
+ public static File getCaseFile(String theCase)
+ {
+ return TestEnv.xbeanCase("store/" + theCase);
+ }
+
+ static XmlCursor loadCase(String theCase) throws Exception
+ {
+ return XmlObject.Factory.parse(getCaseFile(theCase), null).newCursor();
+ }
+
+ static class TestBookmark extends XmlCursor.XmlBookmark
+ {
+ }
+
+ //
+ // Basic load up a file and iterate through it
+ //
+
+ public void testBasicXml( )
+ throws Exception
+ {
+ XmlCursor c = loadCase("test.xml");
+
+ TestBookmark a1 = new TestBookmark();
+
+ c.setBookmark( a1 );
+
+ TestBookmark a2 = new TestBookmark();
+
+ c.toNextToken();
+ c.toNextToken();
+
+ c.setBookmark( a2 );
+
+ c.toPrevToken();
+ c.toPrevToken();
+
+ Assert.assertEquals( c.getBookmark( TestBookmark.class ), a1 );
+
+ c.toNextToken();
+ c.toNextToken();
+
+ Assert.assertEquals( c.getBookmark( TestBookmark.class ), a2 );
+
+ c.toNextToken();
+
+ Assert.assertTrue( c.getBookmark( TestBookmark.class ) == null );
+ }
+}
diff --git a/v1/test/src/drt/drtcases/AssortedTests.java b/v1/test/src/drt/drtcases/AssortedTests.java
new file mode 100644
index 0000000..322100f
--- /dev/null
+++ b/v1/test/src/drt/drtcases/AssortedTests.java
@@ -0,0 +1,233 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlTime;
+import com.easypo.XmlPurchaseOrderDocumentBean;
+import com.easypo.XmlCustomerBean;
+import com.easypo.XmlLineItemBean;
+
+import java.math.BigInteger;
+
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import xint.test.PositionDocument;
+
+public class AssortedTests extends TestCase
+{
+ public AssortedTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(AssortedTests.class); }
+
+ // bug 27489
+ public static void testSaverCharEscaping() throws XmlException
+ {
+ String newLine = System.getProperty( "line.separator" );
+ XmlObject xdoc = XmlObject.Factory.parse("<test>something</test>");
+ XmlCursor cur = xdoc.newCursor();
+ cur.toFirstChild();
+ // valid chars
+ cur.setTextValue("<something or other:\u03C0\uD7FF>");
+ Assert.assertEquals("<test><something or other:\u03C0\uD7FF></test>" + newLine, xdoc.toString());
+
+ // invalid chars - control chars, unicode surrogates, FFFF/FFFE, etc
+ cur.setTextValue("<something\0or\1other:\u0045\uFFFE\uD800\uDFFF\uDB80\uDC00\u03C0\uD7FF\u001F>");
+ Assert.assertEquals("<test><something?or?other:\u0045?????\u03C0\uD7FF?></test>" + newLine, xdoc.toString());
+ }
+
+ // bug 26140/26104
+ public static void testNoTypeInvalid() throws XmlException
+ {
+ XmlObject xdoc = XmlObject.Factory.parse("<test-no-type>something</test-no-type>");
+ Assert.assertTrue("Untyped document should be invalid", !xdoc.validate());
+
+ xdoc = XmlObject.Factory.parse("<x:blah xmlns:x=\"http://no-type.com/\"/>");
+ Assert.assertTrue("Untyped document should be invalid", !xdoc.validate());
+ }
+
+ // bug 26790
+ public static void testComplexSetter() throws XmlException
+ {
+ XmlPurchaseOrderDocumentBean xdoc = XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-order xmlns='http://openuri.org/easypo'>" +
+ "<customer>" +
+ "<name>David Bau</name>" +
+ "<address>100 Main Street</address>" +
+ "</customer>" +
+ "<date>2003-05-18T11:50:00</date>" +
+ "<line-item>" +
+ "<description>Red Candy</description>" +
+ "<per-unit-ounces>0.423</per-unit-ounces>" +
+ "<quantity>4</quantity>" +
+ "</line-item>" +
+ "<line-item>" +
+ "<description>Blue Candy</description>" +
+ "<per-unit-ounces>5.0</per-unit-ounces>" +
+ "<quantity>1</quantity>" +
+ "</line-item>" +
+ "</purchase-order>");
+ // test copy-within doc
+ XmlLineItemBean newItem = xdoc.getPurchaseOrder().addNewLineItem();
+ newItem.set(xdoc.getPurchaseOrder().getLineItemArray(0));
+ Assert.assertEquals(BigInteger.valueOf(4), xdoc.getPurchaseOrder().getLineItemArray(2).getQuantity());
+ xdoc.getPurchaseOrder().setLineItemArray(0, xdoc.getPurchaseOrder().getLineItemArray(1));
+ Assert.assertEquals(BigInteger.valueOf(1), xdoc.getPurchaseOrder().getLineItemArray(0).getQuantity());
+
+ // test copy-between docs
+ XmlLineItemBean anotherItem = XmlLineItemBean.Factory.parse(
+ "<xml-fragment xmlns:ep='http://openuri.org/easypo' xmlns:xsi='http://wwww.w3.org/2001/XMLSchema-instance' xsi:type='line-item'>" +
+ "<ep:description>Yellow Balloon</ep:description>" +
+ "<ep:per-unit-ounces>0.001</ep:per-unit-ounces>" +
+ "<ep:quantity>200</ep:quantity>" +
+ "</xml-fragment>");
+
+ Assert.assertEquals("Yellow Balloon", anotherItem.getDescription());
+ xdoc.getPurchaseOrder().setLineItemArray(1, anotherItem);
+
+ Assert.assertEquals("Yellow Balloon", xdoc.getPurchaseOrder().getLineItemArray(1).getDescription());
+ Assert.assertEquals(BigInteger.valueOf(1), xdoc.getPurchaseOrder().getLineItemArray(0).getQuantity());
+ Assert.assertEquals(BigInteger.valueOf(200), xdoc.getPurchaseOrder().getLineItemArray(1).getQuantity());
+ Assert.assertEquals(BigInteger.valueOf(4), xdoc.getPurchaseOrder().getLineItemArray(2).getQuantity());
+
+ // test copy-to-self
+ xdoc.getPurchaseOrder().setLineItemArray(1, xdoc.getPurchaseOrder().getLineItemArray(1));
+ Assert.assertEquals("Yellow Balloon", xdoc.getPurchaseOrder().getLineItemArray(1).getDescription());
+ Assert.assertEquals(BigInteger.valueOf(1), xdoc.getPurchaseOrder().getLineItemArray(0).getQuantity());
+ Assert.assertEquals(BigInteger.valueOf(200), xdoc.getPurchaseOrder().getLineItemArray(1).getQuantity());
+ Assert.assertEquals(BigInteger.valueOf(4), xdoc.getPurchaseOrder().getLineItemArray(2).getQuantity());
+ }
+
+ // bug 45338
+ public static void testComplexGetter() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean xdoc =
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-order xmlns='http://openuri.org/easypo'" +
+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
+ " xsi:type='foo'>" +
+ "<customer xsi:type='bar'>" +
+ "<name>David Bau</name>" +
+ "<address>100 Main Street</address>" +
+ "</customer>" +
+ "<date>2003-05-18T11:50:00</date>" +
+ "<line-item>" +
+ "<description>Blue Candy</description>" +
+ "<per-unit-ounces>5.0</per-unit-ounces>" +
+ "<quantity>1</quantity>" +
+ "</line-item>" +
+ "</purchase-order>");
+
+ Assert.assertEquals(false, xdoc.validate());
+ Assert.assertEquals(XmlPurchaseOrderDocumentBean.type, xdoc.schemaType());
+
+ // check type of element when xsi:type is bad
+ XmlObject cust = xdoc.getPurchaseOrder().getCustomer();
+ Assert.assertEquals(XmlCustomerBean.type, cust.schemaType());
+
+ Assert.assertEquals("David Bau", ((XmlCustomerBean)cust).getName());
+ }
+
+ public static void donttestPrettyPrint() throws Exception
+ {
+ XmlObject xobj = XmlObject.Factory.parse("<test xmlns:x='foo'><SHOULDNOTBEATAG><a>simple<b/></a><ALSOSHOULDNOTBEATAG></test>");
+ // System.out.println(xobj);
+ System.out.println(xobj.xmlText());
+ /*
+ XmlCursor xcur = xobj.newCursor();
+ xcur.toFirstChild();
+ xobj = xcur.getObject();
+ String result = xobj.toString();
+ System.out.println(result);
+
+ xcur.toFirstChild();
+ xcur.toFirstChild();
+ xcur.toFirstContentToken();
+ xcur.insertChars("<html><body>this is a test</body></html>");
+
+ System.out.println(xobj);
+ */
+ }
+
+ public static void dontTestQNameCopy() throws Exception
+ {
+ SchemaDocument xobj = SchemaDocument.Factory.parse(
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>" +
+ "<xs:element name='foo' type='xs:string'/></xs:schema>");
+ SchemaDocument xobj2 = SchemaDocument.Factory.parse(
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'/>");
+ xobj2.getSchema().addNewElement().set(xobj.getSchema().getElementArray(0));
+ System.out.println(xobj2);
+ }
+
+ // don't run on normal drt because it's too slow: about 20-30 secs
+ public static void donttestCursorFinalize()
+ {
+ XmlObject obj = XmlObject.Factory.newInstance();
+ int i = 0;
+ try
+ {
+ for (i = 0; i < 2000 * 1000; i++)
+ {
+ XmlCursor cur = obj.newCursor();
+ // cur.dispose(); skipping this depends on finalization or else OOM
+ }
+ }
+ catch (OutOfMemoryError e)
+ {
+ System.err.println("Did " + i + " iterations before running out of memory");
+ throw e;
+ }
+ }
+
+ public static void testOutOfRange() throws Exception
+ {
+ PositionDocument doc = PositionDocument.Factory.parse("<position xmlns='java:int.test'><lat>43</lat><lon>037</lon></position>");
+ Assert.assertEquals(43, doc.getPosition().getLat());
+ Assert.assertEquals(37, doc.getPosition().getLon());
+ Assert.assertTrue(doc.validate());
+
+ doc = PositionDocument.Factory.parse("<position xmlns='java:int.test'><lat>443</lat><lon>737</lon></position>");
+ Assert.assertEquals(443, doc.getPosition().getLat());
+ Assert.assertEquals(737, doc.getPosition().getLon());
+ Assert.assertTrue(!doc.validate());
+
+ doc.getPosition().setLat((short)-300);
+ doc.getPosition().setLon((short)32767);
+ Assert.assertEquals(-300, doc.getPosition().getLat());
+ Assert.assertEquals(32767, doc.getPosition().getLon());
+ Assert.assertTrue(!doc.validate());
+
+ doc.getPosition().setLat((short)43);
+ doc.getPosition().setLon((short)127);
+ Assert.assertEquals(43, doc.getPosition().getLat());
+ Assert.assertEquals(127, doc.getPosition().getLon());
+ Assert.assertTrue(doc.validate());
+ }
+
+ public static void testParse() throws Exception
+ {
+ XmlTime xt = XmlTime.Factory.parse("<xml-fragment>12:00:00</xml-fragment>");
+ Assert.assertEquals("12:00:00", xt.calendarValue().toString());
+ }
+
+
+}
diff --git a/v1/test/src/drt/drtcases/CompilationTests.java b/v1/test/src/drt/drtcases/CompilationTests.java
new file mode 100644
index 0000000..67b6d44
--- /dev/null
+++ b/v1/test/src/drt/drtcases/CompilationTests.java
@@ -0,0 +1,272 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.apache.xmlbeans.impl.tool.CodeGenUtil;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+
+public class CompilationTests extends TestCase
+{
+ public CompilationTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(CompilationTests.class); }
+
+ public void __testJ2EE() throws Throwable
+ {
+ TestEnv.deltree(TestEnv.xbeanOutput("schema/j2ee"));
+ // First, compile schema
+ File srcdir = TestEnv.xbeanOutput("schema/j2ee/j2eeconfigxml/src");
+ File classesdir = TestEnv.xbeanOutput("schema/j2ee/j2eeconfigxml/classes");
+ File outputjar = TestEnv.xbeanOutput("schema/j2ee/j2eeconfigxml.jar");
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setXsdFiles(new File[] {
+ TestEnv.xbeanCase("schema/j2ee/application-client_1_4.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/application_1_4.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/connector_1_5.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/ejb-jar_2_1.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/j2ee_1_4.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/jsp_2_0.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/web-app_2_4.xsd"),
+ TestEnv.xbeanCase("schema/j2ee/XML.xsd"),
+ });
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ Assert.assertTrue("Build failed", SchemaCompiler.compile(params));
+ Assert.assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+
+
+ /* test not needed because bootstrap build tests this better
+ public void testNewBuild()
+ {
+ TestEnv.deltree(TestEnv.xbeanOutput("schema/s4s"));
+ File inputfile1 = TestEnv.xbeanCase("schema/s4s/XML.xsd");
+ File inputfile2 = TestEnv.xbeanCase("schema/s4s/XMLSchema.xsd");
+ File outputjar = TestEnv.xbeanOutput("schema/s4s/s4stypes.jar");
+ SchemaCompiler.compile(new File[] { inputfile1, inputfile2 }, new File[0], new File[0], new File[0], null, outputjar, "schema.s4s", null, null, null, true, false, false);
+ Assert.assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+ */
+
+ public void __testSimple() throws Throwable
+ {
+ TestEnv.deltree(TestEnv.xbeanOutput("schema/simple"));
+ // First, compile schema
+ File inputfile1 = TestEnv.xbeanCase("schema/simple/person.xsd");
+ File inputfile2 = TestEnv.xbeanCase("schema/simple/simplec.xsd");
+ File srcdir = TestEnv.xbeanOutput("schema/simple/simpletypes/src");
+ File classesdir = TestEnv.xbeanOutput("schema/simple/simpletypes/classes");
+ File outputjar = TestEnv.xbeanOutput("schema/simple/simpletypes.jar");
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setXsdFiles(new File[] { inputfile1, inputfile2 });
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ Assert.assertTrue("Build failed", SchemaCompiler.compile(params));
+
+ // Then, compile java classes
+ File javasrc = TestEnv.xbeanCase("schema/simple/javasrc");
+ File javaclasses = TestEnv.xbeanOutput("schema/simple/javaclasses");
+ javaclasses.mkdirs();
+ List testcp = new ArrayList();
+ testcp.addAll(Arrays.asList(CodeGenUtil.systemClasspath()));
+ testcp.add(outputjar);
+ CodeGenUtil.externalCompile(Arrays.asList(new File[] { javasrc }), javaclasses, (File[])testcp.toArray(new File[testcp.size()]), true);
+
+ // Then run the test
+ testcp.add(javaclasses);
+ TestRunUtil.run("SimplePersonTest", new File[] { outputjar, javaclasses });
+ }
+
+ public void __testDownload() throws Throwable
+ {
+ TestEnv.deltree(TestEnv.xbeanOutput("schema/include"));
+
+ {
+ // First, compile schema without download and verify failure
+ File srcdir = TestEnv.xbeanOutput("schema/include/shouldfail/src");
+ File classesdir = TestEnv.xbeanOutput("schema/include/shouldfail/classes");
+ File outputjar = TestEnv.xbeanOutput("schema/include/shouldfail.jar");
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setXsdFiles(new File[] {
+ TestEnv.xbeanCase("schema/j2ee/j2ee_1_4.xsd"),
+ });
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ Assert.assertTrue("Build should have failed", !SchemaCompiler.compile(params));
+ Assert.assertTrue("Should not have created " + outputjar, !outputjar.exists());
+ }
+
+ {
+ // now turn on download and verify success
+ File srcdir = TestEnv.xbeanOutput("schema/include/shouldsucceed/src");
+ File classesdir = TestEnv.xbeanOutput("schema/include/shouldsucceed/classes");
+ File outputjar = TestEnv.xbeanOutput("schema/include/shouldsucceed.jar");
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setDownload(true);
+ params.setXsdFiles(new File[] {
+ TestEnv.xbeanCase("schema/j2ee/j2ee_1_4.xsd"),
+ });
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ Assert.assertTrue("Build failed", SchemaCompiler.compile(params));
+ Assert.assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+ }
+
+ public void testPricequote() throws Throwable
+ {
+ TestEnv.deltree(TestEnv.xbeanOutput("schema/pricequote"));
+ // First, compile schema
+ File srcdir = TestEnv.xbeanOutput("schema/pricequote/src");
+ File classesdir = TestEnv.xbeanOutput("schema/pricequote/classes");
+ File outputjar = TestEnv.xbeanOutput("schema/pricequote/pricequote.jar");
+ SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+ params.setXsdFiles(new File[] { TestEnv.xbeanCase("schema/pricequote/PriceQuote.xsd") });
+ params.setSrcDir(srcdir);
+ params.setClassesDir(classesdir);
+ params.setOutputJar(outputjar);
+ Assert.assertTrue("Build failed", SchemaCompiler.compile(params));
+ Assert.assertTrue("Cannout find " + outputjar, outputjar.exists());
+ }
+
+ static String [] invalidSchemas = {
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:complexType name='base' final='extension'/>\n" +
+ " <xs:complexType name='ext'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:complexType name='base' final='#all'/>\n" +
+ " <xs:complexType name='ext'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='#all'>\n" +
+ " <xs:complexType name='base'/>\n" +
+ " <xs:complexType name='rest'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:restriction base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='restriction'>\n" +
+ " <xs:complexType name='base'/>\n" +
+ " <xs:complexType name='rest'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:restriction base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+ };
+
+ static String [] validSchemas = {
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:complexType name='base' final='extension'/>\n" +
+ " <xs:complexType name='rest'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:restriction base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:complexType name='base' final='restriction'/>\n" +
+ " <xs:complexType name='ext'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='restriction'>\n" +
+ " <xs:complexType name='base'/>\n" +
+ " <xs:complexType name='ext'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='extension'>\n" +
+ " <xs:complexType name='base'/>\n" +
+ " <xs:complexType name='rest'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:restriction base='base'/>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n",
+ };
+
+ public void testFinal() throws Throwable
+ {
+ SchemaDocument[] schemas = new SchemaDocument[invalidSchemas.length];
+
+ // Parse the invalid schema files
+ for (int i = 0 ; i < invalidSchemas.length ; i++)
+ schemas[i] = SchemaDocument.Factory.parse(invalidSchemas[i]);
+
+ // Now compile the invalid schemas, test that they fail
+ for (int i = 0 ; i < schemas.length ; i++)
+ {
+ try {
+ XmlBeans.loadXsd(new XmlObject[] {schemas[i]});
+ fail("Schema should have failed to compile:\n" + invalidSchemas[i]);
+ }
+ catch (XmlException success) {}
+ }
+
+ // Parse the valid schema files
+ schemas = new SchemaDocument[validSchemas.length];
+ for (int i = 0 ; i < validSchemas.length ; i++)
+ schemas[i] = SchemaDocument.Factory.parse(validSchemas[i]);
+
+ // Compile the valid schemas. They should not fail
+ for (int i = 0 ; i < schemas.length ; i++)
+ {
+ try {
+ XmlBeans.loadXsd(new XmlObject[]{schemas[i]});
+ }
+ catch (XmlException fail) {
+ fail("Failed to compile schema:\n" + validSchemas[i]);
+ }
+ }
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/CreationTests.java b/v1/test/src/drt/drtcases/CreationTests.java
new file mode 100644
index 0000000..15be338
--- /dev/null
+++ b/v1/test/src/drt/drtcases/CreationTests.java
@@ -0,0 +1,88 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import junit.framework.Assert;
+import com.easypo.XmlPurchaseOrderDocumentBean;
+import com.easypo.XmlPurchaseOrderDocumentBean.PurchaseOrder;
+import com.easypo.XmlLineItemBean;
+import com.easypo.XmlShipperBean;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public class CreationTests extends TestCase
+{
+ public CreationTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(CreationTests.class); }
+
+ public void testCreatePo() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean doc =
+ XmlPurchaseOrderDocumentBean.Factory.newInstance();
+
+ PurchaseOrder order = doc.addNewPurchaseOrder();
+ order.addNewCustomer().setName("David Bau");
+ order.getCustomer().setAddress("Gladwyne, PA");
+ XmlLineItemBean li;
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 1");
+ li.setPrice(new BigDecimal("21.79"));
+ li.setQuantity(BigInteger.valueOf(2));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 2");
+ li.setPrice(new BigDecimal("19.89"));
+ li.setQuantity(BigInteger.valueOf(2));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 3");
+ li.setPrice(new BigDecimal("19.89"));
+ li.setQuantity(BigInteger.valueOf(1));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ XmlShipperBean sh = order.addNewShipper();
+ sh.setName("UPS");
+ sh.setPerOunceRate(new BigDecimal("0.74"));
+
+// System.out.println(doc.xmlText());
+
+ Assert.assertEquals("David Bau", order.getCustomer().getName());
+ Assert.assertEquals("Gladwyne, PA", order.getCustomer().getAddress());
+ Assert.assertEquals(3, order.sizeOfLineItemArray());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 1", order.getLineItemArray(0).getDescription());
+ Assert.assertEquals(new BigDecimal("21.79"), order.getLineItemArray(0).getPrice());
+ Assert.assertEquals(new BigInteger("2"), order.getLineItemArray(0).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(0).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 2", order.getLineItemArray(1).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), order.getLineItemArray(1).getPrice());
+ Assert.assertEquals(new BigInteger("2"), order.getLineItemArray(1).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(1).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 3", order.getLineItemArray(2).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), order.getLineItemArray(2).getPrice());
+ Assert.assertEquals(new BigInteger("1"), order.getLineItemArray(2).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(2).getPerUnitOunces());
+
+ Assert.assertEquals(true, order.isSetShipper());
+ Assert.assertEquals("UPS", order.getShipper().getName());
+ Assert.assertEquals(new BigDecimal("0.74"), order.getShipper().getPerOunceRate());
+ }
+}
diff --git a/v1/test/src/drt/drtcases/DomTests.java b/v1/test/src/drt/drtcases/DomTests.java
new file mode 100644
index 0000000..7d3bb6c
--- /dev/null
+++ b/v1/test/src/drt/drtcases/DomTests.java
@@ -0,0 +1,156 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.impl.store.Root;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+public class DomTests extends TestCase
+{
+ public DomTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(DomTests.class); }
+
+ static String[] _args;
+ static String _test;
+
+ public static File getCaseFile(String theCase)
+ {
+ return TestEnv.xbeanCase("store/" + theCase);
+ }
+
+ static XmlCursor loadCase(String theCase) throws Exception
+ {
+ return XmlObject.Factory.parse(getCaseFile(theCase), null).newCursor();
+ }
+
+ public void doTestDomImport ( String xml )
+ throws Exception
+ {
+ DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
+ f.setNamespaceAware(true);
+ DocumentBuilder parser = f.newDocumentBuilder();
+
+ Document doc = parser.parse( new InputSource( new StringReader( xml ) ) );
+
+ XmlObject x = XmlObject.Factory.parse( doc );
+
+ Assert.assertTrue( x.xmlText().equals( xml ) );
+ }
+
+ public void doTestDomExport ( String xml )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( XmlObject.Factory.parse( xml ).newDomNode() );
+ Assert.assertTrue( x.xmlText().equals( xml ) );
+ }
+
+ public void doTest ( String xml )
+ throws Exception
+ {
+ doTestDomImport( xml );
+ doTestDomExport( xml );
+ }
+
+// public void testDom2 ( )
+// throws Exception
+// {
+// DOMParser parser = new DOMParser();
+//
+// parser.setFeature( "http://xml.org/sax/features/namespaces", true );
+//
+// parser.parse( new InputSource( new StringReader( "<foo a='x\n\ny'></foo>" ) ) );
+//
+// XmlObject x = XmlLoader.Factory.parse( parser.getDocument() );
+//
+// System.out.println( x.xmlText() );
+// }
+
+ public void testDom ( )
+ throws Exception
+ {
+ doTest( "<foo xmlns=\"x\"/>" );
+ doTest( "<foo xmlns=\"x\" xmlns:e=\"v\"/>" );
+ doTest( "<foo>a<?X?>b</foo>" );
+ doTest( "<foo>a<!--X-->b</foo>" );
+ doTest( "<!--X--><foo/>" );
+ doTest( "<foo/>" );
+ doTest( "<foo x=\"y\"/>" );
+ doTest( "<foo><a/><b>moo</b></foo>" );
+
+ String xx =
+ "<!--gg--><?a b?><foo>sdsd<a/>sdsd<b>moo</b>sd<!--asas-->sd</foo><!--hh-->";
+
+ doTest( xx );
+
+ String xml =
+ "<xml-fragment>" +
+ "foo" +
+ "</xml-fragment>";
+
+ doTestDomExport( xml );
+
+ try
+ {
+ xml =
+ "<xml-fragment " +
+ " foo='bar'>" +
+ "</xml-fragment>";
+
+ doTestDomExport( xml );
+
+ Assert.assertTrue( false );
+ }
+ catch ( Exception e )
+ {
+ }
+
+ XmlObject x = XmlObject.Factory.parse( xx );
+
+ XmlCursor c = x.newCursor();
+
+ for ( ; ; )
+ {
+ Node n = c.newDomNode();
+ XmlObject.Factory.parse( n );
+
+ if (c.toNextToken().isNone())
+ break;
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/EasyPoTests.java b/v1/test/src/drt/drtcases/EasyPoTests.java
new file mode 100644
index 0000000..27448e4
--- /dev/null
+++ b/v1/test/src/drt/drtcases/EasyPoTests.java
@@ -0,0 +1,129 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import com.easypo.XmlPurchaseOrderDocumentBean;
+import com.easypo.XmlPurchaseOrderDocumentBean.PurchaseOrder;
+
+public class EasyPoTests extends TestCase
+{
+ public EasyPoTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(EasyPoTests.class); }
+
+ public void testEasyPo() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean doc = (XmlPurchaseOrderDocumentBean)
+ XmlObject.Factory.parse(TestEnv.xbeanCase("store/easypo1.xml"));
+ Assert.assertEquals(false, doc.isNil());
+ PurchaseOrder order = doc.getPurchaseOrder();
+ Assert.assertEquals("David Bau", order.getCustomer().getName());
+ Assert.assertEquals("Gladwyne, PA", order.getCustomer().getAddress());
+ Assert.assertEquals(3, order.sizeOfLineItemArray());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 1", order.getLineItemArray(0).getDescription());
+ Assert.assertEquals(new BigDecimal("21.79"), order.getLineItemArray(0).getPrice());
+ Assert.assertEquals(new BigInteger("2"), order.getLineItemArray(0).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(0).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 2", order.getLineItemArray(1).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), order.getLineItemArray(1).getPrice());
+ Assert.assertEquals(new BigInteger("2"), order.getLineItemArray(1).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(1).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 3", order.getLineItemArray(2).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), order.getLineItemArray(2).getPrice());
+ Assert.assertEquals(new BigInteger("1"), order.getLineItemArray(2).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), order.getLineItemArray(2).getPerUnitOunces());
+
+ Assert.assertEquals(true, order.isSetShipper());
+ Assert.assertEquals("UPS", order.getShipper().getName());
+ Assert.assertEquals(new BigDecimal("0.74"), order.getShipper().getPerOunceRate());
+
+ Assert.assertEquals(3, order.sizeOfLineItemArray());
+ }
+
+
+ public void testSimpleAutoValidaiton() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-order xmlns='http://openuri.org/easypo'/>" );
+
+ try
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-orde xmlns='http://openuri.org/easypo'/>" );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+
+ try
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<purchase-order xmlns='http://openuri.org/easyp'/>" );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+
+ try
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<f:fragment xmlns:f='http://www.openuri.org/fragment'/>" );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+
+ try
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<f:fragment xmlns:f='http://www.openuri.org/fragment'><a/></f:fragment>" );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+
+ try
+ {
+ XmlPurchaseOrderDocumentBean.Factory.parse(
+ "<f:fragment xmlns:f='http://www.openuri.org/fragment'><a/><a/></f:fragment>" );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/EnumTests.java b/v1/test/src/drt/drtcases/EnumTests.java
new file mode 100644
index 0000000..94f34d1
--- /dev/null
+++ b/v1/test/src/drt/drtcases/EnumTests.java
@@ -0,0 +1,134 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.xmlbeans.XmlObject;
+import com.enumtest.StatusreportDocument;
+import com.enumtest.SalesreportDocument;
+import com.enumtest.SalesreportDocument.Salesreport.Unit;
+import com.enumtest.Quantity;
+import com.enumtest.Data;
+
+public class EnumTests extends TestCase
+{
+ public EnumTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(EnumTests.class); }
+
+ public static void testReport1() throws Exception
+ {
+ StatusreportDocument doc = (StatusreportDocument)
+ XmlObject.Factory.parse(TestEnv.xbeanCase("enumtest/report1.xml"));
+
+ Quantity.Enum[] contents = new Quantity.Enum[]
+ {
+ Quantity.ALL,
+ Quantity.ALL,
+ Quantity.FEW,
+ Quantity.ALL,
+ Quantity.MOST,
+ Quantity.NONE,
+ Quantity.NONE,
+ Quantity.NONE,
+ };
+ Data[] data = doc.getStatusreport().getStatusArray();
+ int t = 0;
+ for (int i = 0; i < data.length; i++)
+ {
+ Assert.assertEquals(contents[t++], data[i].enumValue());
+ // System.out.println("Target: " + data[i].getTarget() + ", value: " + data[i].enumValue());
+ Assert.assertEquals(contents[t++], data[i].getTarget());
+ }
+ }
+
+ public static void testReport2() throws Exception
+ {
+ StatusreportDocument doc = StatusreportDocument.Factory.newInstance();
+ StatusreportDocument.Statusreport report = doc.addNewStatusreport();
+
+ Data d = report.addNewStatus();
+ d.set(Quantity.ALL);
+ d.setTarget(Quantity.ALL);
+
+ d = report.addNewStatus();
+ d.set(Quantity.FEW);
+ d.setTarget(Quantity.ALL);
+
+ d = report.addNewStatus();
+ d.set(Quantity.MOST);
+ d.setTarget(Quantity.NONE);
+
+ d = report.addNewStatus();
+ d.set(Quantity.NONE);
+ d.setTarget(Quantity.NONE);
+
+ Quantity.Enum[] contents = new Quantity.Enum[]
+ {
+ Quantity.ALL,
+ Quantity.ALL,
+ Quantity.FEW,
+ Quantity.ALL,
+ Quantity.MOST,
+ Quantity.NONE,
+ Quantity.NONE,
+ Quantity.NONE,
+ };
+ Data[] data = doc.getStatusreport().getStatusArray();
+ int t = 0;
+ for (int i = 0; i < data.length; i++)
+ {
+ Assert.assertEquals(contents[t++], data[i].enumValue());
+ // System.out.println("Target: " + data[i].getTarget() + ", value: " + data[i].enumValue());
+ Assert.assertEquals(contents[t++], data[i].getTarget());
+ }
+ }
+
+ public static void testReport3() throws Exception
+ {
+ SalesreportDocument doc = SalesreportDocument.Factory.newInstance();
+ SalesreportDocument.Salesreport report = doc.addNewSalesreport();
+
+ report.addUnit(Unit.ONE);
+ report.addUnit(Unit.TWO);
+ report.addUnit(Unit.NINETY_NINE);
+ report.addUnit(Unit.ONE_HUNDRED);
+
+ Unit.Enum[] contents = new Unit.Enum[]
+ {
+ Unit.ONE,
+ Unit.TWO,
+ Unit.NINETY_NINE,
+ Unit.ONE_HUNDRED,
+ };
+
+ Unit[] xunits = report.xgetUnitArray();
+ for (int i = 0; i < xunits.length; i++)
+ {
+ Assert.assertEquals(contents[i], xunits[i].enumValue());
+ }
+
+ Unit.Enum[] units = report.getUnitArray();
+ for (int i = 0; i < units.length; i++)
+ {
+ Assert.assertEquals(contents[i], units[i]);
+ }
+ }
+
+
+}
diff --git a/v1/test/src/drt/drtcases/GDateTests.java b/v1/test/src/drt/drtcases/GDateTests.java
new file mode 100644
index 0000000..92d4210
--- /dev/null
+++ b/v1/test/src/drt/drtcases/GDateTests.java
@@ -0,0 +1,545 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.GDateBuilder;
+import org.apache.xmlbeans.GDuration;
+import org.apache.xmlbeans.GDurationBuilder;
+import org.apache.xmlbeans.XmlCalendar;
+
+import java.util.GregorianCalendar;
+import java.util.Date;
+import java.util.Calendar;
+
+public class GDateTests extends TestCase
+{
+ public GDateTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(GDateTests.class); }
+
+ static String[] validDurations =
+ {
+ "PT0S",
+ "P1Y",
+ "P1M",
+ "P1D",
+ "P2Y",
+ "P2M",
+ "P2D",
+ "PT1H",
+ "PT1M",
+ "PT1S",
+ "PT3600S",
+ "P1Y1M1DT1H1M1S",
+ "P1Y1M1DT1H1M1.1S",
+ "P1Y365D",
+ "P1Y366D",
+ "PT0.1S",
+ "P1Y-364D",
+ "P1Y-365D",
+ "P1Y-366D",
+ "P1Y-367D",
+ "P1Y-12M",
+ "P1M29D",
+ "P1M-27D",
+ "P1M-28D",
+ "P1M-29D",
+ "P1M-31D",
+ "P1M-32D",
+ "P1MT-660H",
+ "P1MT-670H",
+ "P1MT-680H",
+ "P1MT-690H",
+ "P1MT-700H",
+ "P1MT-710H",
+ "P1MT-720H",
+ "P1MT-730H",
+ "P1MT-740H",
+ "PT0.1415926S",
+ "PT5233132S",
+ "PT142332M",
+ "PT98023H",
+
+ "-PT0S",
+ "-P1Y",
+ "-P1M",
+ "-P1D",
+ "-PT1H",
+ "-PT1M",
+ "-PT1S",
+ "-P1Y1M1DT1H1M1S",
+ "-P1Y1M1DT1H1M1.1S",
+ "-P27D",
+ "-P28D",
+ "-P29D",
+ "-P30D",
+ "-P31D",
+ "-P364D",
+ "-P365D",
+ "-P366D",
+ "-PT0.1S",
+ "-PT0.1415926S",
+ "-PT5233132S",
+ "-PT142332M",
+ "-PT98023H",
+
+ };
+
+ static String[] invalidDates =
+ {
+ "+14:01", // tz
+ "-14:01", // tz
+ "+15:00", // tz
+ "-15:00", // tz
+ "X",
+ ",",
+ "T",
+ "+",
+ "-",
+ ":",
+ "0",
+ "March 2",
+ "T00:00:00Z", // T not allowed
+ "-00:00:00Z", // - not allowed
+ "96-02-28T00:00:00Z", // year width
+ "100-02-28T00:00:00Z", // year width
+ "1900-2-28T00:00:00Z", // month width
+ "1900-02-8T00:00:00Z", // day width
+ "1900-02-08T0:00:00Z", // hour width
+ "1900-02-08T00:0:00Z", // hour width
+ "1900-02-08T00:00:0Z", // hour width
+ "1900-02-08T00:00Z", // time incomplete
+ "1900-02-08 T00:00:00Z", // space
+ "1900-02-08T 00:00:00Z", // space
+ "1900-02-08T00:00:00 Z", // space
+ "1900-02-29T00Z", // time incomplete
+ "00:00", // time incomplete
+ "00", // incomplete
+ "2100-02-29", // not leap
+ "-9999999-02-28T00:00:00Z", // too long ago
+ "9999999-02-28T00:00:00Z", // too long from now
+ "9999999999999999999999999999999-02-28T00:00:00Z", // overflow?
+ "1996-00-28T00:00:00Z", // month
+ "1996-13-28T00:00:00Z", // month
+ "1996-02-00T00:00:00Z", // day
+ "2000-02-30T00:00:00Z", // day
+ "1996-02-29T24:00:00Z", // hr
+ "1996-02-29T00:60:00Z", // min
+ "1996-02-29T00:00:60Z", // sec
+ "1996-02-29T00:00:00+14:01", // tz
+ "1996-02-29T00:00:00-14:01", // tz
+ "1996-02-29T00:00:00+15:00", // tz
+ "1996-02-29T00:00:00-15:00", // tz
+ "1996-00-29", // month
+ "1996-13-29", // month
+ "1996-02-00", // day
+ "2000-02-30", // day
+ "--00", // month
+ "--13", // month
+ "--00-01", // month
+ "--13-01", // month
+ "--02-00", // day
+ "--02-30", // day
+ "--01-32", // day
+ "--11-31", // day
+ "---00", // day
+ "---32", // day
+ "24:00:00Z", // hr
+ "00:60:00Z", // min
+ "00:00:60Z", // sec
+ "00:00:00+14:01", // tz
+ "00:00:00-14:01", // tz
+ "00:00:00+15:00", // tz
+ "00:00:00-15:00", // tz
+ };
+
+ static String[] validDates =
+ {
+ "",
+ "Z", // timezone only
+ "-14:00", // timezone only
+ "999999-12-31T23:59:59.999Z",
+ "1970-12-31T23:59:59.990+14:00",
+ "1996-02-29T00:00:00Z", // leap
+ "2000-02-29T00:00:00Z", // leap
+ "2004-02-29T00:00:00Z", // leap
+ "2008-02-29T00:00:00Z", // leap
+ "2012-02-29T00:00:00Z", // leap
+ "1900-02-28T00:00:00Z", // not leap
+ "2100-02-28T00:00:00Z", // not leap
+ "1900-03-28T00:00:00Z", // not leap
+ "-4712-01-01T00:00:00Z",
+ "1999-01-01T00:00:00+01:00",
+ "2001-12-31T23:59:59.010",
+ "2001-12-31T23:59:59.999901000",
+ "1999-12-31T23:59:59.1234567890-14:00",
+ "1992-12-31T23:59:59.01-14:00",
+ "1965-12-31T23:59:59.000Z",
+ "0000-12-31T04:35:22.456",
+ "1696-09-01T00:00:00Z",
+ "1697-02-01T00:00:00Z",
+ "1903-03-01T00:00:00Z",
+ "1903-07-01T00:00:00Z",
+ "1696-09-01T00:00:00+00:00",
+ "1697-02-01T00:00:00-00:00",
+ "2002",
+ "-0001",
+ "--12",
+ "-0001-11",
+ "2002-01",
+ "---31",
+ "1554--31",
+ "-0004--31",
+ "--02-29",
+ "--12-31",
+ "2002-04-18",
+ "-0423-12-31",
+ "23:59:59",
+ "00:00:00",
+ "2010T23:59:59",
+ "-0001T00:00:00",
+ "--12T23:59:59",
+ "-0001-11T00:00:00",
+ "2011-01T23:59:59",
+ "---31T00:00:00",
+ "2002--31T23:59:59",
+ "-0004--31T00:00:00",
+ "2002-02-18T23:59:59",
+ "-0423-12-31T00:00:00",
+ "2002Z",
+ "-0001+01:30",
+ "--12-14:00",
+ "-0001-11Z",
+ "1970-12-01:00",
+ "---31+01:30",
+ "2002--31Z",
+ "--03-31-03:00",
+ "--04-30+05:00",
+ "-0004--31-01:00",
+ "2002-04-18-14:00",
+ "-0423-12-31Z",
+ "23:59:59-01:00",
+ "00:00:00Z",
+ "00:00:00+01:30",
+ "1776T23:59:59-14:00",
+ "-0001T00:00:00Z",
+ "--12T23:59:59+01:30",
+ "-0001-11T00:00:00-01:00",
+ "2002-02T23:59:59Z",
+ "---31T00:00:00-14:00",
+ "2002--31T23:59:59-01:00",
+ "-0004--31T00:00:00+01:30",
+ "2002-04-18T23:59:59Z",
+ "-0423-12-31T00:00:00-05:00",
+ };
+
+ private static boolean hasTime(GDuration gd)
+ {
+ return gd.getHour() != 0 || gd.getMinute() != 0 || gd.getSecond() != 0 || gd.getFraction().signum() != 0;
+ }
+
+ public static void testGregorianCalendar()
+ {
+ // this is a check of DST offsets
+ Date date = new GDate("2002-04-18T23:59:59Z").getDate();
+ GregorianCalendar gcal = new XmlCalendar(date);
+ Assert.assertEquals(date, gcal.getTime());
+
+ // now check out some things
+ GDate gd = new GDate("2001-12-31T07:00:59.010");
+ GregorianCalendar gc = gd.getCalendar();
+ Date gdd = gd.getDate();
+ Date gcd = gc.getTime();
+ Assert.assertEquals(gdd, gcd);
+
+ // set up 2/29, and read out Feb 29 in the year 1 BC.
+ Calendar gregcal = new GDate("--02-29").getCalendar();
+ Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
+ Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
+ Assert.assertEquals(1, gregcal.get(Calendar.YEAR));
+ Assert.assertEquals(0, gregcal.get(Calendar.ERA));
+ // repeat some tests to make sure it's stable.
+ Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
+ Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
+
+ // now try some setters
+ gregcal = new GDate("--02-29").getCalendar();
+ gregcal.set(Calendar.MONTH, 10);
+ Assert.assertEquals("--11-29", gregcal.toString());
+ // repeat to ensure it's stable.
+ Assert.assertEquals("--11-29", gregcal.toString());
+ }
+
+ public static void testValidDuration()
+ {
+ for (int i = 0; i < validDurations.length; i++)
+ {
+ GDuration gd = null;
+ String str = validDurations[i];
+ try
+ {
+ gd = new GDuration(str);
+ }
+ catch (IllegalArgumentException e)
+ {
+ Assert.assertTrue("Problem with " + str + ": " + e.getMessage(), false);
+ }
+
+ Assert.assertEquals(str, gd.toString());
+
+ for (int j = 0; j < validDurations.length; j++)
+ {
+ GDuration gd2 = null;
+ String str2 = validDurations[j];
+ try
+ {
+ gd2 = new GDuration(str2);
+ }
+ catch (IllegalArgumentException e)
+ {
+ Assert.assertTrue("Problem with " + str2 + ": " + e.getMessage(), false);
+ }
+
+ // subtracting two ways works
+ GDuration diff = gd.subtract(gd2);
+ GDurationBuilder gdb = new GDurationBuilder(gd2);
+ gdb.setSign(-gdb.getSign());
+ gdb.addGDuration(gd);
+ GDuration sum2 = gdb.toGDuration();
+ Assert.assertEquals(0, diff.compareToGDuration(sum2));
+ gdb.normalize();
+ GDurationBuilder gdb1 = new GDurationBuilder(diff);
+ gdb1.normalize();
+ Assert.assertEquals("Problem: " + gd + " and " + gd2, gdb.toString(), gdb1.toString());
+
+
+ // comparing is reversible
+ int comp1 = gd.compareToGDuration(gd2);
+ int comp2 = gd2.compareToGDuration(gd);
+ if (comp1 == 2)
+ Assert.assertEquals(2, comp2);
+ else
+ Assert.assertEquals(-comp1, comp2);
+
+ // comparing translates to addition to dates
+ boolean[] seen = new boolean[3];
+
+ for (int k = 0; k < validDates.length; k++)
+ {
+ GDate date = new GDate(validDates[k]);
+ if (!date.hasDate() || date.getYear() > 99999 || date.getYear() < -4000)
+ continue;
+ if ((hasTime(gd) || hasTime(gd2)) && !date.hasTime())
+ continue;
+ // System.out.println("Adding " + gd + " and " + gd2 + " to " + date + ", expecting " + comp1);
+ GDate date1 = date.add(gd);
+ GDate date2 = date.add(gd2);
+
+ comp2 = date1.compareToGDate(date2);
+ if (comp1 != 2)
+ {
+ Assert.assertEquals("Adding " + date + " + " + gd + " -> " + date1 + ", " + gd2 + " -> " + date2 + ", expecting " + comp1, comp1, comp2);
+ }
+ else
+ {
+ Assert.assertTrue(comp2 != 2);
+ seen[comp2 + 1] = true;
+ }
+
+ // subtraction should yeild the same result
+ if (comp1 != 2)
+ {
+ GDate date3 = date.add(diff);
+ Assert.assertEquals(comp1, date3.compareToGDate(date));
+ }
+ }
+
+ if (comp1 == 2)
+ {
+ int seencount = 0;
+ for (int k = 0; k < seen.length; k++)
+ if (seen[k])
+ seencount += 1;
+ Assert.assertTrue("Not ambiguous as advertised" /* + gd + ", " + gd2 + " d: " + diff */, seencount > 1);
+ }
+ }
+ }
+ }
+
+ public static void testOrder()
+ {
+ Assert.assertEquals(-1, new GDate("1998-08-26").compareToGDate(new GDate("2001-08-06")));
+ Assert.assertEquals(-1, new GDate("1970-12-20T04:14:22Z").compareToGDate(new GDate("1971-04-18T12:51:41Z")));
+ Assert.assertEquals(2, new GDate("2001-08-06").compareToGDate(new GDate("2001-08-06Z")));
+ Assert.assertEquals(2, new GDate("2001-08-06").compareToGDate(new GDate("2001-08-07+10:00")));
+ Assert.assertEquals(2, new GDate("2001-08-06").compareToGDate(new GDate("2001-08-05-10:00")));
+ Assert.assertEquals(2, new GDate("2001-02-28").compareToGDate(new GDate("2001-03-01+10:00")));
+ Assert.assertEquals(2, new GDate("2001-03-01").compareToGDate(new GDate("2001-02-28-10:00")));
+ Assert.assertEquals(-1, new GDate("2000-02-28").compareToGDate(new GDate("2000-03-01+10:00")));
+ Assert.assertEquals(1, new GDate("2000-03-01").compareToGDate(new GDate("2000-02-28-10:00")));
+ Assert.assertEquals(-1, new GDate("2001-08-06Z").compareToGDate(new GDate("2001-08-06-00:01")));
+ Assert.assertEquals(0, new GDate("00:00:00Z").compareToGDate(new GDate("00:01:00+00:01")));
+ Assert.assertEquals(0, new GDate("12:00:00-05:00").compareToGDate(new GDate("09:00:00-08:00")));
+ Assert.assertEquals(-1, new GDate("09:00:00-05:00").compareToGDate(new GDate("09:00:00-08:00"))); // the east coast rises before the west
+ Assert.assertEquals(-1, new GDate("2003-05-05T09:00:00-05:00").compareToGDate(new GDate("2003-05-05T09:00:00-08:00"))); // the east coast rises before the west
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---31")));
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---31+14:00")));
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---31-14:00")));
+ Assert.assertEquals(1, new GDate("---31").compareToGDate(new GDate("---01")));
+ Assert.assertEquals(1, new GDate("---31").compareToGDate(new GDate("---01+14:00")));
+ Assert.assertEquals(1, new GDate("---31").compareToGDate(new GDate("---01-14:00")));
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---02")));
+ Assert.assertEquals(1, new GDate("---02").compareToGDate(new GDate("---01")));
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---02Z")));
+ Assert.assertEquals(1, new GDate("---02").compareToGDate(new GDate("---01Z")));
+ Assert.assertEquals(2, new GDate("---02").compareToGDate(new GDate("---01-10:00")));
+ Assert.assertEquals(2, new GDate("---01").compareToGDate(new GDate("---02+10:00")));
+ Assert.assertEquals(1, new GDate("---02").compareToGDate(new GDate("---01-09:00")));
+ Assert.assertEquals(-1, new GDate("---01").compareToGDate(new GDate("---02+09:00")));
+ Assert.assertEquals(0, new GDate("---01").compareToGDate(new GDate("---01")));
+ Assert.assertEquals(-1, new GDate("2003").compareToGDate(new GDate("2004")));
+ Assert.assertEquals(-1, new GDate("--11").compareToGDate(new GDate("--12")));
+ Assert.assertEquals(-1, new GDate("2003-12").compareToGDate(new GDate("2004-01")));
+ Assert.assertEquals(-1, new GDate("--11-30").compareToGDate(new GDate("--12-01")));
+ Assert.assertEquals(-1, new GDate("--02-28").compareToGDate(new GDate("--02-29")));
+ Assert.assertEquals(-1, new GDate("--02-29").compareToGDate(new GDate("--03-01")));
+ Assert.assertEquals(2, new GDate("--02-29").compareToGDate(new GDate("--03-01+10:00")));
+ Assert.assertEquals(2, new GDate("--02-28").compareToGDate(new GDate("--03-01+10:00")));
+ Assert.assertEquals(2, new GDate("--03-01").compareToGDate(new GDate("--02-28-10:00")));
+ Assert.assertEquals(2, new GDate("--03-01").compareToGDate(new GDate("--02-29-10:00")));
+ Assert.assertEquals(-1, new GDate("--02-29").compareToGDate(new GDate("--03-01+09:00")));
+ Assert.assertEquals(-1, new GDate("--02-28").compareToGDate(new GDate("--03-01+09:00")));
+ Assert.assertEquals(1, new GDate("--03-01").compareToGDate(new GDate("--02-28-09:00")));
+ Assert.assertEquals(1, new GDate("--03-01").compareToGDate(new GDate("--02-29-09:00")));
+ Assert.assertEquals(-1, new GDate("00:00:00").compareToGDate(new GDate("23:59:59")));
+ Assert.assertEquals(-1, new GDate("00:00:00").compareToGDate(new GDate("23:59:59+09:59")));
+ Assert.assertEquals(-1, new GDate("00:00:00").compareToGDate(new GDate("23:59:01+09:59")));
+ Assert.assertEquals(2, new GDate("00:00:00").compareToGDate(new GDate("23:59:00+09:59")));
+ Assert.assertEquals(2, new GDate("00:00:00").compareToGDate(new GDate("23:59:59+10:00")));
+ Assert.assertEquals(-1, new GDate("00:00:00").compareToGDate(new GDate("23:59:59-14:00")));
+ Assert.assertEquals(1, new GDate("23:59:59").compareToGDate(new GDate("00:00:00-09:59")));
+ Assert.assertEquals(1, new GDate("23:59:59").compareToGDate(new GDate("00:00:58-09:59")));
+ Assert.assertEquals(2, new GDate("23:59:59").compareToGDate(new GDate("00:00:59-09:59")));
+ Assert.assertEquals(2, new GDate("23:59:59").compareToGDate(new GDate("00:00:00-10:00")));
+ Assert.assertEquals(1, new GDate("23:59:59").compareToGDate(new GDate("00:00:00+14:00")));
+ }
+
+ public static void testAPI() throws Exception
+ {
+ GDateBuilder builder = new GDateBuilder("1970-12-20T04:14:22Z");
+ builder.normalizeToTimeZone(1, 0, 0);
+ Assert.assertEquals("1970-12-20T04:14:22+00:00", builder.toString());
+ builder.setTimeZone(615);
+ Assert.assertEquals("1970-12-20T04:14:22+10:15", builder.toString());
+ builder.setTimeZone(-345);
+ Assert.assertEquals("1970-12-20T04:14:22-05:45", builder.toString());
+ builder.normalizeToTimeZone(-300);
+ Assert.assertEquals("1970-12-20T04:59:22-05:00", builder.toString());
+ }
+
+
+ public static void testFailure() throws Exception
+ {
+ for (int i = 0; i < invalidDates.length; i++)
+ {
+ String str = invalidDates[i];
+ try
+ {
+ new GDate(str);
+ }
+ catch (IllegalArgumentException e)
+ {
+ continue;
+ }
+ Assert.assertTrue("Missing exception for GDate " + str, false);
+ }
+ }
+
+ public static void testSuccess() throws Exception
+ {
+ for (int i = 0; i < validDates.length; i++)
+ {
+ String str = validDates[i];
+ GDate gdate = null;
+ try
+ {
+ gdate = new GDate(str);
+ }
+ catch (IllegalArgumentException e)
+ {
+ Assert.assertTrue("Problem with " + str + ": " + e.getMessage(), false);
+ }
+
+ // must round-trip to string
+ Assert.assertEquals(str, gdate.toString());
+
+ // must round-trip to GregorianCalendar if fractions-of-seconds <=3 digits
+ if (gdate.getFraction() == null || gdate.getFraction().scale() <= 3)
+ if (!gdate.toString().equals("--02-29")) // bug in gcal -> 03-01
+ {
+ GregorianCalendar gcal = gdate.getCalendar();
+ GDate gdate2 = new GDate(gcal);
+ Assert.assertEquals(gdate, gdate2);
+
+ // and if fractions-of-seconds is 3 digits, stringrep must round-trip
+ if (gdate.getFraction() == null || gdate.getFraction().scale() == 3 || gdate.getFraction().scale() == 0)
+ Assert.assertEquals(gdate.toString(), gdate2.toString());
+ }
+
+ // must round-trip to Date if absolute time+timezone + fractions-of-seconds <= 3
+ if (gdate.hasTimeZone() && gdate.getYear() > -4000 && gdate.getYear() < 99999 && gdate.getBuiltinTypeCode() == SchemaType.BTC_DATE_TIME && gdate.getFraction().scale() <= 3)
+ {
+ Date date = gdate.getDate();
+ GDate gdate2 = new GDate(date);
+ Assert.assertEquals(gdate, gdate2);
+
+ // normalize to UTC fractions-of-seconds is 0 or 3 digits [not 000], stringrep must round-trip
+ if (gdate.getTimeZoneSign() == 0 && ((gdate.getFraction().scale() == 3 && gdate.getFraction().signum() != 0) || gdate.getFraction().scale() == 0))
+ {
+ GDateBuilder gdb = new GDateBuilder(gdate2);
+ gdb.normalizeToTimeZone(0, 0, 0);
+ Assert.assertEquals(gdate.toString(), gdb.toString());
+ }
+
+ // verify that going through gcal gives us the same thing
+ GregorianCalendar gcal = gdate.getCalendar();
+ Assert.assertEquals(date, gcal.getTime());
+
+ // double-check XmlCalendar constructor
+ gcal = new XmlCalendar(date);
+ Assert.assertEquals("Doing " + gdate, date, gcal.getTime());
+ }
+ else if (gdate.hasDate() && (gdate.getFraction() == null || gdate.getFraction().scale() <= 3))
+ {
+ // must be able to get a date if time+timezone is unset (midnight, ltz are assumed)
+ Date date = gdate.getDate();
+ GDateBuilder gdate1 = new GDateBuilder(gdate);
+ if (!gdate1.hasTime())
+ gdate1.setTime(0, 0, 0, null);
+ Assert.assertEquals(gdate1.getDate(), date);
+
+ // verify that going through gcal gives us the same thing
+ GregorianCalendar gcal = gdate.getCalendar();
+ Assert.assertEquals("Comparing " + gdate + " and " + gcal, date, gcal.getTime());
+ }
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/IDECursorUsageTest.java b/v1/test/src/drt/drtcases/IDECursorUsageTest.java
new file mode 100644
index 0000000..903f820
--- /dev/null
+++ b/v1/test/src/drt/drtcases/IDECursorUsageTest.java
@@ -0,0 +1,97 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests a simple usage of the cursor I'm having trouble with in IDE code.
+ */
+public class IDECursorUsageTest extends TestCase
+{
+ public IDECursorUsageTest(String name) { super(name); }
+ public static Test suite() { return new TestSuite(IDECursorUsageTest.class); }
+
+ public static File getCaseFile(String theCase)
+ {
+ return TestEnv.xbeanCase("store/" + theCase);
+ }
+
+ static XmlCursor loadCase(String theCase) throws Exception
+ {
+ return XmlObject.Factory.parse(getCaseFile(theCase)).newCursor();
+ }
+
+ public void testScanElement() throws Exception
+ {
+ XmlCursor cursor = loadCase("ConsolidateTest.xml");
+ cursor.toFirstChild();
+
+ XmlCursor cur = cursor.newCursor();
+
+ // back up to previous start or end tag
+ while (!isStartOrEnd(cur.toPrevToken())) { System.out.println("Backing up: at " + cur.currentTokenType()); }
+ // then forward to first start or comment (may end up where we started)
+ while (!isStartOrComment(cur.toNextToken())) { System.out.println("Advancing: at " + cur.currentTokenType()); }
+ // then grab the "start" javelin annotation, and grab the start token and the first char
+ // _firstToken = ((JavelinAnnotation)cur.getAnnotation(JavelinAnnotation.class)).getStartToken();
+
+ // now peek at the end tag (it may be unplaced for the <a/> case, so use the start tag if needed
+ cur.toCursor(cursor);
+ // _lastToken = ((JavelinAnnotation)cur.getAnnotation(JavelinAnnotation.class)).getEndToken();
+ cur.toEndToken();
+ // JavelinAnnotation endAnn = (JavelinAnnotation)cur.getAnnotation(JavelinAnnotation.class);
+ // if (endAnn != null)
+ // _lastToken = endAnn.getEndToken();
+ }
+
+ boolean isStartOrEnd(XmlCursor.TokenType tokType)
+ {
+ switch (tokType.intValue())
+ {
+ case XmlCursor.TokenType.INT_END:
+ case XmlCursor.TokenType.INT_ENDDOC:
+ case XmlCursor.TokenType.INT_START:
+ case XmlCursor.TokenType.INT_STARTDOC:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ boolean isStartOrComment(XmlCursor.TokenType tokType)
+ {
+ switch (tokType.intValue())
+ {
+ case XmlCursor.TokenType.INT_START:
+ case XmlCursor.TokenType.INT_STARTDOC:
+ case XmlCursor.TokenType.INT_COMMENT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/IntTests.java b/v1/test/src/drt/drtcases/IntTests.java
new file mode 100644
index 0000000..85ceed7
--- /dev/null
+++ b/v1/test/src/drt/drtcases/IntTests.java
@@ -0,0 +1,42 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import junit.framework.Assert;
+
+import xint.test.PositionDocument;
+
+public class IntTests extends TestCase
+{
+ public IntTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(IntTests.class); }
+
+ public static void testLatLong() throws Exception
+ {
+ PositionDocument doc = PositionDocument.Factory.parse(
+ "<p:position xmlns:p='java:int.test'><p:lat>43</p:lat><p:lon>020</p:lon></p:position>");
+ Assert.assertEquals(43, doc.getPosition().getLat());
+ Assert.assertEquals(20, doc.getPosition().getLon());
+ doc.getPosition().xgetLat().set("07");
+ doc.getPosition().xgetLon().set("040");
+ Assert.assertEquals(7, doc.getPosition().getLat());
+ Assert.assertEquals(40, doc.getPosition().getLon());
+ doc.getPosition().setLat((short)22);
+ }
+}
diff --git a/v1/test/src/drt/drtcases/JaxenXPathTests.java b/v1/test/src/drt/drtcases/JaxenXPathTests.java
new file mode 100644
index 0000000..6bbc295
--- /dev/null
+++ b/v1/test/src/drt/drtcases/JaxenXPathTests.java
@@ -0,0 +1,192 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class JaxenXPathTests extends TestCase
+{
+ public JaxenXPathTests(String name) { super(name); }
+ public static Test suite()
+ {
+ try
+ {
+ Class.forName("org.jaxen.XPath");
+ return new TestSuite(JaxenXPathTests.class);
+ }
+ catch (ClassNotFoundException e)
+ {
+ System.out.println("\n\nWARNING!!!\n\nJaxen.jar not on classpath skipping JaxenXPathTests.\n\n");
+ return new TestSuite();
+ }
+ }
+
+ public void testConformance() throws Exception
+ {
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(TestEnv.xbeanCase("xpath/testXPath.xml"));
+
+ String[] xpath = new String[25];
+ xpath[0] = "/doc/a/@test";
+ xpath[1] = "//.";
+ xpath[2] = "/doc";
+ xpath[3] = "/doc/a";
+ xpath[4] = "//@*";
+ xpath[5] = ".";
+ xpath[6] = "//ancestor-or-self::*";
+ xpath[7] = "./child::*[1]";
+ xpath[8] = "//descendant-or-self::*/@*[1]";
+ xpath[9] = "//@* | * | node()";
+ xpath[10] = "//*";
+ xpath[11] = "/doc/namespace::*";
+ xpath[12] = "//descendant::comment()";
+ xpath[13] = "//*[local-name()='a']";
+ xpath[14] = "//*/@*";
+ xpath[15] = "//*[last()]";
+ xpath[16] = "doc/*[last()]";
+ xpath[17] = "/doc/a/*/@*";
+ xpath[18] = "doc/descendant::node()";
+ xpath[19] = "doc/a/@*";
+ xpath[20] = "doc/b/a/ancestor-or-self::*";
+ xpath[21] = "doc/b/a/preceding::*";
+ xpath[22] = "doc/a/following::*";
+ xpath[23] = "/doc/b/preceding-sibling::*";
+ xpath[24] = "/doc/a/following-sibling::*";
+
+ runAll(doc, xpath);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static void runAll(XmlObject doc, String[] xpathes)
+ {
+ for (int i=0; i<xpathes.length; i++)
+ {
+ runXpath2(doc, xpathes[i], i);
+ }
+ }
+
+// private static void runXpath(XmlObject doc, String xpathStr, int i)
+// {
+// try
+// {
+// XmlCursor xc = doc.newCursor();
+// XPath xpath = new XBeansXPath(xpathStr);
+// List results = xpath.selectNodes( xc );
+//
+// Iterator resultIter = results.iterator();
+//
+// int j = 0;
+// while ( resultIter.hasNext() )
+// {
+// xc = (XmlCursor)resultIter.next(); //it's the same object as previous xc
+// // generateExpected(i, j, xc.toString());
+// check(i, j, xc);
+// j++;
+// }
+//
+// xc.dispose();
+// }
+// catch (XPathSyntaxException e)
+// {
+// System.err.println( e.getMultilineMessage() );
+// throw new RuntimeException(e);
+// }
+// catch (JaxenException e)
+// {
+// throw new RuntimeException(e);
+// }
+// }
+
+ private static void runXpath2(XmlObject doc, String xpathStr, int i)
+ {
+ XmlCursor xc = doc.newCursor();
+ xc.selectPath( xpathStr );
+
+ int j = 0;
+ while ( xc.toNextSelection() )
+ {
+ // generateExpected(i, j, xc.toString());
+ check(i, j, xc);
+ j++;
+ }
+
+ xc.dispose();
+ }
+
+ private static void check(int expresionNumber, int resultNumber, XmlCursor actual)
+ {
+ try
+ {
+ XmlCursor expected = XmlObject.Factory.parse(TestEnv.xbeanCase("xpath/expected/JaxenXPathTest_" + expresionNumber +
+ "_" + resultNumber + ".xml")).newCursor();
+
+ XmlComparator.Diagnostic diag = new XmlComparator.Diagnostic();
+ boolean match = XmlComparator.lenientlyCompareTwoXmlStrings(actual.toString(), expected.toString(), diag);
+
+ Assert.assertTrue("------------ Found difference:" + expresionNumber + " " + resultNumber +
+ " actual=\n'" + actual + "'\nexpected=\n'" + expected + "'\ndiagnostic=" + diag , match);
+ }
+ catch (XmlException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * This is only used to regen the expected files.
+ */
+ private static void generateExpected(int expresionNumber, int resultNumber, String content)
+ {
+ try
+ {
+ FileWriter fw = new FileWriter(TestEnv.xbeanCase("xpath/expected/JaxenXPathTest_" + expresionNumber +
+ "_" + resultNumber + ".xml"));
+
+ fw.write(content);
+ fw.close();
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/ListAndUnionTests.java b/v1/test/src/drt/drtcases/ListAndUnionTests.java
new file mode 100644
index 0000000..710425f
--- /dev/null
+++ b/v1/test/src/drt/drtcases/ListAndUnionTests.java
@@ -0,0 +1,181 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.openuri.lut.ListsDocument;
+import org.openuri.lut.UnionsDocument;
+import org.openuri.lut.IncidentReportsDocument;
+import org.openuri.lut.DateOrDateTime;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.math.BigInteger;
+
+import org.apache.xmlbeans.GDate;
+import org.apache.xmlbeans.SimpleValue;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlDate;
+import org.apache.xmlbeans.XmlDateTime;
+import org.apache.xmlbeans.XmlCalendar;
+
+public class ListAndUnionTests extends TestCase
+{
+ public ListAndUnionTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(ListAndUnionTests.class); }
+
+ public void testListGetters() throws Exception
+ {
+ ListsDocument lists = ListsDocument.Factory.parse(
+ "<lut:lists xmlns:lut='http://openuri.org/lut'><lut:int-list>2 4 8 16 32</lut:int-list><lut:nni-list>unbounded 3 unbounded 6</lut:nni-list></lut:lists>");
+ List intList = lists.getLists().getIntList();
+ Assert.assertEquals(new Integer(2), intList.get(0));
+ Assert.assertEquals(new Integer(4), intList.get(1));
+ Assert.assertEquals(new Integer(8), intList.get(2));
+ Assert.assertEquals(new Integer(16), intList.get(3));
+ Assert.assertEquals(new Integer(32), intList.get(4));
+ Assert.assertEquals(5, intList.size());
+
+ List nniList = lists.getLists().getNniList();
+ Assert.assertEquals("unbounded", nniList.get(0));
+ Assert.assertEquals(BigInteger.valueOf(3), nniList.get(1));
+ Assert.assertEquals("unbounded", nniList.get(2));
+ Assert.assertEquals(BigInteger.valueOf(6), nniList.get(3));
+ Assert.assertEquals(4, nniList.size());
+ }
+
+ public void testListSetters() throws Exception
+ {
+ ListsDocument doc = ListsDocument.Factory.newInstance();
+ ListsDocument.Lists lists = doc.addNewLists();
+ lists.setIntList(Arrays.asList(new Object[] { new Integer(4), new Integer(18) }));
+ lists.setNniList(Arrays.asList(new Object[] { BigInteger.valueOf(1), BigInteger.valueOf(2), "unbounded" }));
+ String xtext = doc.xmlText();
+
+ ListsDocument docrt = ListsDocument.Factory.parse(xtext);
+ List intList = docrt.getLists().getIntList();
+ Assert.assertEquals(new Integer(4), intList.get(0));
+ Assert.assertEquals(new Integer(18), intList.get(1));
+ Assert.assertEquals(2, intList.size());
+
+ List nniList = docrt.getLists().getNniList();
+ Assert.assertEquals(BigInteger.valueOf(1), nniList.get(0));
+ Assert.assertEquals(BigInteger.valueOf(2), nniList.get(1));
+ Assert.assertEquals("unbounded", nniList.get(2));
+ Assert.assertEquals(3, nniList.size());
+ }
+
+ public void testUnionGetters() throws Exception
+ {
+ UnionsDocument unions = UnionsDocument.Factory.parse(
+ "<lut:unions xmlns:lut='http://openuri.org/lut'><lut:nni>unbounded</lut:nni><lut:sizes>2 3 5 7 11</lut:sizes></lut:unions>");
+
+ Assert.assertEquals("unbounded", unions.getUnions().getNni());
+
+ Assert.assertTrue(unions.getUnions().getSizes() instanceof List);
+ List sizes = (List)unions.getUnions().getSizes();
+ Assert.assertEquals(new Integer(2), sizes.get(0));
+ Assert.assertEquals(new Integer(3), sizes.get(1));
+ Assert.assertEquals(new Integer(5), sizes.get(2));
+ Assert.assertEquals(new Integer(7), sizes.get(3));
+ Assert.assertEquals(new Integer(11), sizes.get(4));
+ Assert.assertEquals(5, sizes.size());
+
+ UnionsDocument unions2 = UnionsDocument.Factory.parse(
+ "<lut:unions xmlns:lut='http://openuri.org/lut'><lut:nni>37</lut:nni><lut:sizes>all</lut:sizes></lut:unions>");
+
+ Assert.assertEquals(BigInteger.valueOf(37), unions2.getUnions().getNni());
+ Assert.assertEquals("all", unions2.getUnions().getSizes());
+ }
+
+ public void testUnionSetters() throws Exception
+ {
+
+ // create a document
+ UnionsDocument doc = UnionsDocument.Factory.newInstance();
+ UnionsDocument.Unions unions = doc.addNewUnions();
+ unions.setNni("unbounded");
+ unions.setSizes(Arrays.asList(new Object[] { new Integer(5), new Integer(22) }));
+
+ // round trip to s text
+ String xtext = doc.xmlText();
+ UnionsDocument docrt = UnionsDocument.Factory.parse(xtext);
+
+ // verify contents
+ Assert.assertEquals("unbounded", docrt.getUnions().getNni());
+ List sizes = (List)docrt.getUnions().getSizes();
+ Assert.assertEquals(new Integer(5), sizes.get(0));
+ Assert.assertEquals(new Integer(22), sizes.get(1));
+ Assert.assertEquals(2, sizes.size());
+
+ // change the original document
+ unions.setNni(new Integer(11));
+ unions.setSizes("unknown");
+
+ // round trip it again
+ xtext = doc.xmlText();
+ docrt = UnionsDocument.Factory.parse(xtext);
+
+ // verify contents again
+ Assert.assertEquals(BigInteger.valueOf(11), docrt.getUnions().getNni());
+ Assert.assertEquals("unknown", docrt.getUnions().getSizes());
+ }
+
+ public void testUnionArray() throws Exception
+ {
+ IncidentReportsDocument doc = IncidentReportsDocument.Factory.parse(
+ "<lut:incident-reports xmlns:lut='http://openuri.org/lut'><lut:when>2001-08-06T03:34:00</lut:when><lut:when>2002-01-04</lut:when><lut:when>2002-08-26T23:10:00</lut:when></lut:incident-reports>");
+ IncidentReportsDocument.IncidentReports reports = doc.getIncidentReports();
+ DateOrDateTime[] dt = reports.xgetWhenArray();
+ Calendar[] gd = reports.getWhenArray();
+ Assert.assertEquals(3, dt.length);
+ Assert.assertEquals(3, gd.length);
+ for (int i = 0; i < 3; i++)
+ {
+ Assert.assertEquals(((SimpleValue)dt[i]).gDateValue(), new GDate(gd[i]));
+ Assert.assertEquals(gd[i], dt[i].objectValue());
+ }
+
+ Assert.assertEquals(new XmlCalendar("2001-08-06T03:34:00"), gd[0]);
+ Assert.assertEquals(new XmlCalendar("2002-01-04"), gd[1]);
+ Assert.assertEquals(new XmlCalendar("2002-08-26T23:10:00"), gd[2]);
+
+ Assert.assertEquals(XmlDateTime.type, dt[0].instanceType());
+ Assert.assertEquals(XmlDate.type, dt[1].instanceType());
+ Assert.assertEquals(XmlDateTime.type, dt[2].instanceType());
+
+ reports.setWhenArray(0, new XmlCalendar("1980-04-18"));
+ reports.setWhenArray(1, new XmlCalendar("1970-12-20T04:33:00"));
+
+ dt = reports.xgetWhenArray();
+ gd = reports.getWhenArray();
+
+ Assert.assertEquals(new XmlCalendar("1980-04-18"), gd[0]);
+ Assert.assertEquals(new XmlCalendar("1970-12-20T04:33:00"), gd[1]);
+ Assert.assertEquals(new XmlCalendar("2002-08-26T23:10:00"), gd[2]);
+
+ Assert.assertEquals(XmlDate.type, dt[0].instanceType());
+ Assert.assertEquals(XmlDateTime.type, dt[1].instanceType());
+ Assert.assertEquals(XmlDateTime.type, dt[2].instanceType());
+
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/NameworldTest.java b/v1/test/src/drt/drtcases/NameworldTest.java
new file mode 100644
index 0000000..cf0df6e
--- /dev/null
+++ b/v1/test/src/drt/drtcases/NameworldTest.java
@@ -0,0 +1,111 @@
+/* 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 drtcases;
+
+import org.openuri.nameworld.NameworldDocument;
+import org.openuri.nameworld.NameworldDocument.Nameworld;
+import org.openuri.nameworld.Loc;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class NameworldTest extends TestCase
+{
+ public NameworldTest(String name) { super(name); }
+ public static Test suite() { return new TestSuite(NameworldTest.class); }
+
+ public static void testWorld1() throws Exception
+ {
+ NameworldDocument doc = (NameworldDocument)
+ XmlObject.Factory.parse(TestEnv.xbeanCase("nameworld/world1.xml"));
+
+ Assert.assertEquals(new QName("http://openuri.org/nameworld", "nameworld"), doc.schemaType().getDocumentElementName());
+
+ QName[] contents = new QName[]
+ {
+ new QName("http://bar.com/", "barcity"),
+ new QName("http://foo.com/", "footown"),
+ new QName("http://bar.com/", "barvillage"),
+ new QName("http://bar.com/", "bartown"),
+ new QName("http://foo.com/", "foovillage"),
+ new QName("http://bar.com/", "barvillage"),
+ new QName("http://foo.com/", "foocity"),
+ new QName("http://bar.com/", "bartown"),
+ new QName("http://foo.com/", "foovillage"),
+ new QName("http://foo.com/", "footown"),
+ new QName("http://bar.com/", "barvillage"),
+ new QName("http://foo.com/", "foovillage"),
+ };
+ int t = 0;
+
+ Nameworld world = doc.getNameworld();
+ Nameworld.Island[] islands = world.getIslandArray();
+ for (int i = 0; i < islands.length; i++)
+ {
+ Loc[] locs = islands[i].getLocationArray();
+ for (int j = 0; j < locs.length; j++)
+ {
+ Loc.Reference[] refs = locs[j].getReferenceArray();
+ for (int k = 0; k < refs.length; k++)
+ {
+ Assert.assertEquals(contents[t++], refs[k].getTo());
+ }
+ }
+ }
+ }
+
+ /*
+ public static void testAccessByName() throws Exception
+ {
+ NameworldDocument doc = (NameworldDocument)
+ XmlLoader.Factory.parse(TestEnv.xbeanCase("nameworld/world1.xml"),
+ NameworldDocument.type);
+ String[] contents = new String[]
+ {
+ "http://foo.com/",
+ "foocity",
+ "footown",
+ "foovillage",
+ "http://bar.com/",
+ "barcity",
+ "bartown",
+ "barvillage",
+ };
+ int t = 0;
+ Nameworld world = (Nameworld)doc.elementByName(new Name("http://openuri.org/nameworld", "nameworld"), 0);
+ for (int i = 0; i < world.countOfElementByName(new Name("http://openuri.org/nameworld", "island")); i++)
+ {
+ Nameworld.Island island = (Nameworld.Island)world.elementByName(new Name("http://openuri.org/nameworld", "island"), i);
+ Assert.assertEquals(contents[t++], ((SimpleValue)island.attributeByName(new Name("targetNamespace"))).stringValue());
+ for (int j = 0; j < island.countOfElementByName(new Name( "http://openuri.org/nameworld", "location")); j++)
+ {
+ Loc loc = (Loc)island.elementByName(new Name("http://openuri.org/nameworld", "location"), j);
+ Assert.assertEquals(contents[t++], ((SimpleValue)loc.attributeByName(new Name("name"))).stringValue());
+ }
+ }
+ }
+ */
+
+}
diff --git a/v1/test/src/drt/drtcases/NumeralsTests.java b/v1/test/src/drt/drtcases/NumeralsTests.java
new file mode 100644
index 0000000..6041e0b
--- /dev/null
+++ b/v1/test/src/drt/drtcases/NumeralsTests.java
@@ -0,0 +1,272 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.openuri.testNumerals.DocDocument;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Nov 23, 2003
+ */
+public class NumeralsTests extends TestCase
+{
+ public NumeralsTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(NumeralsTests.class); }
+
+ private static DocDocument.Doc doc;
+ static
+ {
+ String inst =
+ "<doc xmlns='http://openuri.org/testNumerals'>\n" +
+ " <string> this is a long string \n" +
+ " ... </string>\n" +
+ " <int>\n" +
+ " +5\n" +
+ " </int>\n" +
+ " <int>\n" +
+ " -6\n" +
+ " </int>\n" +
+ " <int>\n" +
+ " +00000000015\n" +
+ " </int>\n" +
+ " <int>7<!--this has to be a 77 int value-->7</int>\n" +
+ " <boolean>\n" +
+ " true\n" +
+ " </boolean>\n" +
+ " <boolean>\n" +
+ " false\n" +
+ " </boolean>\n" +
+ " <boolean>\n" +
+ " 0\n" +
+ " </boolean>\n" +
+ " <boolean>\n" +
+ " 1\n" +
+ " </boolean>\n" +
+ " <boolean>\n" +
+ " true is not\n" +
+ " </boolean>\n" +
+ " <short>\n" +
+ " +03\n" +
+ " </short>\n" +
+ " <byte>\n" +
+ " +001\n" +
+ " </byte>\n" +
+ " <long>-0500000</long>\n" +
+ " <long>\n" +
+ " 001\n" +
+ " </long>\n" +
+ " <long>\n" +
+ " +002\n" +
+ " </long>\n" +
+ " <double>\n" +
+ " +001\n" +
+ " </double>\n" +
+ " <double>\n" +
+ " -002.007000\n" +
+ " </double>\n" +
+ " <double>\n" +
+ " INF\n" +
+ " </double>\n" +
+ " <double>\n" +
+ " -INF\n" +
+ " </double>\n" +
+ " <double>\n" +
+ " NaN\n" +
+ " </double>\n" +
+ " <float>\n" +
+ " +12.325\n" +
+ " </float>\n" +
+ " <float>\n" +
+ " NaN\n" +
+ " </float>\n" +
+ " <float>\n" +
+ " INF\n" +
+ " </float>\n" +
+ " <float>\n" +
+ " -INF\n" +
+ " </float>\n" +
+ " <decimal>\n" +
+ " +001.001\n" +
+ " </decimal>\n" +
+ " <integer>\n" +
+ " +001<!--comments-->000000000\n" +
+ " </integer>\n" +
+ "</doc>";
+
+ try
+ {
+ doc = DocDocument.Factory.parse(inst).getDoc();
+ }
+ catch (XmlException e)
+ {
+ throw new IllegalStateException(e.getMessage());
+ }
+ }
+
+ public void test1() throws XmlException
+ {
+ String s = " this is a long string \n" + " ... ";
+ Assert.assertTrue("String expected:\n'" + s + "' actual:\n'" +
+ doc.getStringArray()[0] + "'", s.equals(doc.getStringArray()[0]));
+ }
+
+ public void test2() throws XmlException
+ {
+ Assert.assertTrue("int expected:" + 5 + " actual:" + doc.getIntArray()[0], doc.getIntArray()[0]==5);
+ }
+
+ public void test3() throws XmlException
+ {
+ Assert.assertTrue("int expected:" + (-6) + " actual:" + doc.getIntArray()[1], doc.getIntArray()[1]==-6);
+ }
+
+ public void test4() throws XmlException
+ {
+ Assert.assertTrue("int expected:" + 15 + " actual:" + doc.getIntArray()[2], doc.getIntArray()[2]==15);
+ }
+
+ public void test5() throws XmlException
+ {
+ Assert.assertTrue("int expected:" + 77 + " actual:" + doc.getIntArray()[3], doc.getIntArray()[3]==77);
+ }
+
+ public void test6() throws XmlException
+ {
+ Assert.assertTrue(doc.getBooleanArray(0)==true);
+ }
+
+ public void test7() throws XmlException
+ {
+ Assert.assertTrue(doc.getBooleanArray(1)==false);
+ }
+
+ public void test8() throws XmlException
+ {
+ Assert.assertTrue(doc.getBooleanArray(2)==false);
+ }
+
+ public void test9() throws XmlException
+ {
+ Assert.assertTrue(doc.getBooleanArray(3)==true);
+ }
+
+ public void test10() throws XmlException
+ {
+ try { boolean b = doc.getBooleanArray()[4]; Assert.assertTrue(false); }
+ catch(XmlValueOutOfRangeException e)
+ { Assert.assertTrue(true); }
+ }
+
+ public void test11() throws XmlException
+ {
+ Assert.assertTrue(doc.getShortArray()[0]==3);
+ }
+
+ public void test12() throws XmlException
+ {
+ Assert.assertTrue(doc.getByteArray()[0]==1);
+ }
+
+ public void test13() throws XmlException
+ {
+ Assert.assertTrue("long expected:" + (-50000) + " actual:" + doc.getLongArray()[0],
+ doc.getLongArray()[0]==-500000);
+ }
+
+ public void test14() throws XmlException
+ {
+ Assert.assertTrue("long expected:" + 1 + " actual:" + doc.getLongArray()[1],
+ doc.getLongArray()[1]==1);
+ }
+
+ public void test15() throws XmlException
+ {
+ Assert.assertTrue("long expected:" + 2 + " actual:" + doc.getLongArray()[2],
+ doc.getLongArray()[2]==2);
+ }
+
+ public void test16() throws XmlException
+ {
+ Assert.assertTrue(doc.getDoubleArray()[0]==1);
+ }
+
+ public void test17() throws XmlException
+ {
+ Assert.assertTrue("double expected:" + -2.007d + " actual:" + doc.getDoubleArray()[1],
+ doc.getDoubleArray()[1]==-2.007d);
+ }
+
+ public void test18() throws XmlException
+ {
+ Assert.assertTrue(new Double(Double.POSITIVE_INFINITY).
+ equals(new Double(doc.getDoubleArray()[2])));
+ }
+
+ public void test19() throws XmlException
+ {
+ Assert.assertTrue(new Double(Double.NEGATIVE_INFINITY).
+ equals(new Double(doc.getDoubleArray()[3])));
+ }
+
+ public void test20() throws XmlException
+ {
+ Assert.assertTrue(new Double(Double.NaN).
+ equals(new Double(doc.getDoubleArray()[4])));
+ }
+
+ public void test21() throws XmlException
+ {
+ Assert.assertTrue("fload expected:" + 12.325f + " actual:" + doc.getFloatArray()[0],
+ doc.getFloatArray()[0]==12.325f);
+ }
+
+ public void test22() throws XmlException
+ {
+ Assert.assertTrue(new Float(Float.NaN).
+ equals(new Float(doc.getFloatArray()[1])));
+ }
+
+ public void test23() throws XmlException
+ {
+ Assert.assertTrue("fload expected:" + Float.POSITIVE_INFINITY + " actual:" + doc.getFloatArray()[2],
+ new Float(Float.POSITIVE_INFINITY).equals(new Float(doc.getFloatArray()[2])));
+ }
+
+ public void test24() throws XmlException
+ {
+ Assert.assertTrue(new Float(Float.NEGATIVE_INFINITY).
+ equals(new Float(doc.getFloatArray()[3])));
+ }
+
+ public void test25() throws XmlException
+ {
+ Assert.assertTrue(new BigDecimal("1.001").equals(doc.getDecimalArray()[0]));
+ }
+
+ public void test26() throws XmlException
+ {
+ Assert.assertTrue(new BigInteger("1000000000").equals(doc.getIntegerArray(0)));
+ }
+}
diff --git a/v1/test/src/drt/drtcases/QNameSetTest.java b/v1/test/src/drt/drtcases/QNameSetTest.java
new file mode 100644
index 0000000..101e852
--- /dev/null
+++ b/v1/test/src/drt/drtcases/QNameSetTest.java
@@ -0,0 +1,314 @@
+/* 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 drtcases;
+
+import javax.xml.namespace.QName;
+
+import java.text.DecimalFormat;
+import java.util.Random;
+import java.util.Stack;
+
+import org.apache.xmlbeans.QNameSetBuilder;
+import org.apache.xmlbeans.QNameSetSpecification;
+import junit.framework.TestCase;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class QNameSetTest extends TestCase
+{
+ public QNameSetTest(String name) { super(name); }
+ public static Test suite() { return new TestSuite(QNameSetTest.class); }
+
+ public static String format(int indent, int iter, String p, QNameSetBuilder set)
+ {
+ /*
+ System.err.print(new DecimalFormat("00000 ").format(iter));
+ while (indent-- > 0)
+ System.err.print(' ');
+ System.err.print(p);
+ System.err.print(" = ");
+ System.err.println(set.dump());
+ */
+
+ return "case# " + iter + " " + p + " " + set.toString();
+
+ }
+
+
+ public void testQNameSets()
+ {
+ int iterations = 10000;
+ int seed = 0;
+ int stopat = -1;
+
+ Random rnd = new Random(seed);
+ String[] localname = {"a", "b", "c", "d", "e"};
+ String[] namespace = {"n1", "n2", "n3", "n4", "n5"};
+ int width = localname.length;
+
+ QName[] name = new QName[width * namespace.length];
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < namespace.length; j++)
+ {
+ name[i + width * j] = new QName(namespace[j], localname[i]);
+ }
+ }
+
+ Stack teststack = new Stack(); // stack of sets
+ Stack trackstack = new Stack(); // stack of boolean arrays
+
+ QNameSetBuilder current = new QNameSetBuilder();
+ boolean[] contents = new boolean[width * namespace.length];
+ boolean[] temp;
+ int i = 0;
+ int j = 0;
+
+ for (int l = 0; l < iterations; l++)
+ {
+ // for debugging
+
+ if (l == stopat)
+ System.err.println("We're here");
+
+ // apply a random operation
+
+ if (rnd.nextInt(3) != 0)
+ {
+ i = rnd.nextInt(width - 1); // don't do the last one for isAll test
+ j = rnd.nextInt(namespace.length - 1); // don't do the last one for isAll test
+ }
+
+ String label;
+
+ switch (teststack.size() < 1 ? 24 : rnd.nextInt(iterations - l > teststack.size() ? 24 : 5))
+ {
+ default:
+ teststack.push(current);
+ trackstack.push(contents);
+ current = new QNameSetBuilder();
+ contents = new boolean[width * namespace.length];
+ label = "new";
+ break;
+
+ case 19:
+ case 20:
+ case 22:
+ teststack.push(current);
+ trackstack.push(contents);
+ current = new QNameSetBuilder();
+ contents = new boolean[width * namespace.length];
+
+ if (rnd.nextInt(2) == 0)
+ {
+ current.invert();
+ for (int k = 0; k < width; k++)
+ {
+ contents[k + width * (namespace.length - 1)] = true;
+ }
+ }
+
+ for (int h = 0; h < namespace.length - 1; h++)
+ {
+ if (rnd.nextInt(2) == 0)
+ current.removeNamespace(namespace[h]);
+ else
+ {
+ current.addNamespace(namespace[h]);
+ contents[width - 1 + width * h] = true;
+ }
+ for (int k = 0; k < width - 1; k++)
+ {
+ if (rnd.nextInt(2) == 0)
+ current.remove(name[k + width * h]);
+ else
+ {
+ current.add(name[k + width * h]);
+ contents[k + width * h] = true;
+ }
+ }
+ }
+ label = "random";
+ break;
+
+ case 0:
+ current.addAll((QNameSetSpecification)teststack.pop());
+ temp = (boolean[])trackstack.pop();
+ for (int k = 0; k < width * namespace.length; k++)
+ if (temp[k])
+ contents[k] = true;
+ label = "add set";
+ break;
+
+ case 1:
+ current.removeAll((QNameSetSpecification)teststack.pop());
+ temp = (boolean[])trackstack.pop();
+ for (int k = 0; k < width * namespace.length; k++)
+ if (temp[k])
+ contents[k] = false;
+ label = "remove set";
+ break;
+
+ case 2:
+ current.restrict((QNameSetSpecification)teststack.pop());
+ temp = (boolean[])trackstack.pop();
+ for (int k = 0; k < width * namespace.length; k++)
+ if (!temp[k])
+ contents[k] = false;
+ label = "restrict set";
+ break;
+
+ case 3:
+ label = "union";
+ current = new QNameSetBuilder(current.union((QNameSetSpecification)teststack.pop()));
+ temp = (boolean[])trackstack.pop();
+ for (int k = 0; k < width * namespace.length; k++)
+ if (temp[k])
+ contents[k] = true;
+ label = "union";
+ break;
+
+ case 4:
+ label = "intersect";
+ current = new QNameSetBuilder(current.intersect((QNameSetSpecification)teststack.pop()));
+ temp = (boolean[])trackstack.pop();
+ for (int k = 0; k < width * namespace.length; k++)
+ if (!temp[k])
+ contents[k] = false;
+ label = "intersect";
+ break;
+
+ case 5:
+ current = new QNameSetBuilder(current);
+ label = "copy";
+ break;
+
+ case 6:
+ case 7:
+ case 8:
+ current.add(name[i + width * j]);
+ contents[i + width * j] = true;
+ label = "add one " + name[i + width * j];
+ break;
+
+ case 9:
+ case 10:
+ case 11:
+ current.remove(name[i + width * j]);
+ contents[i + width * j] = false;
+ label = "remove one " + name[i + width * j];
+ break;
+
+ case 12:
+ case 13:
+ current.addNamespace(namespace[j]);
+ for (int k = 0; k < width; k++)
+ contents[k + width * j] = true;
+ label = "add namespace " + namespace[j];
+ break;
+
+ case 14:
+ case 15:
+ current.removeNamespace(namespace[j]);
+ for (int k = 0; k < width; k++)
+ contents[k + width * j] = false;
+ label = "remove namespace " + namespace[j];
+ break;
+
+ case 16:
+ case 17:
+ current.invert();
+ for (int k = 0; k < width * namespace.length; k++)
+ contents[k] = !contents[k];
+ label = "invert";
+ break;
+
+ case 18:
+ current = new QNameSetBuilder(current.inverse());
+ for (int k = 0; k < width * namespace.length; k++)
+ contents[k] = !contents[k];
+ label = "inverse";
+ break;
+
+ }
+
+ // System.out.println(format(teststack.size(), l, label, current));
+
+ // then, verify current matches contents
+ int count = 0;
+ for (int k = 0; k < width * namespace.length; k++)
+ {
+ Assert.assertTrue(format(0, l, "Content mismatch " + name[k], current), (current.contains(name[k]) == contents[k]));
+ {
+ // testprint(0, l, "ERROR ON " + name[k], current);
+ // testprint(0, l, "expected " + contents[k] + ", got " + !contents[k], current);
+ // System.exit(1);
+ }
+ if (contents[k])
+ count++;
+ }
+
+ Assert.assertTrue(format(0, l, "ERROR: isEmpty is wrong", current), ((count == 0) == current.isEmpty()));
+ {
+ // testprint(0, l, "ERROR: isEmpty is wrong", current);
+ // testprint(0, l, "expected " + (count == 0) + ", got " + !(count == 0), current);
+ // System.exit(1);
+ }
+
+ Assert.assertTrue(format(0, l, "ERROR: isAll is wrong", current), (count == width * namespace.length) == current.isAll());
+ {
+ // testprint(0, l, "ERROR: isAll is wrong", current);
+ // testprint(0, l, "expected " + (count == width * namespace.length) + ", got " + !(count == width * namespace.length), current);
+ // System.exit(1);
+ }
+
+ // test isDisjoint and containsAll
+ if (teststack.size() >= 1)
+ {
+ boolean disjoint = true;
+ temp = (boolean[])trackstack.peek();
+ for (int k = 0; k < width * namespace.length; k++)
+ {
+ if (temp[k] && contents[k])
+ {
+ disjoint = false;
+ break;
+ }
+ }
+ Assert.assertTrue(format(0, l, "ERROR: disjoint is wrong", current), disjoint == current.isDisjoint((QNameSetSpecification)teststack.peek()));
+ {
+ // testprint(0, l, "ERROR: disjoint is wrong", current);
+ // testprint(0, l, "expected " + disjoint + ", got " + !disjoint, (QNameSetBuilder)teststack.peek());
+ // System.exit(1);
+ }
+
+
+ boolean containsAll = true;
+ for (int k = 0; k < width * namespace.length; k++)
+ {
+ if (temp[k] && !contents[k])
+ {
+ containsAll = false;
+ break;
+ }
+ }
+ Assert.assertTrue(format(0, l, "ERROR: containsAll is wrong", current), containsAll == current.containsAll((QNameSetSpecification)teststack.peek()));
+ }
+
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/QNameTests.java b/v1/test/src/drt/drtcases/QNameTests.java
new file mode 100644
index 0000000..4b958e4
--- /dev/null
+++ b/v1/test/src/drt/drtcases/QNameTests.java
@@ -0,0 +1,120 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlQName;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class QNameTests extends TestCase
+{
+ public QNameTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(QNameTests.class); }
+
+ static String[] _args;
+ static String _test;
+
+ public void testQName ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ "" +
+ " <xs:element name='any'>\n" +
+ " </xs:element>\n" +
+ "" +
+ "</xs:schema>\n" +
+ "";
+
+ SchemaTypeLoader stl =
+ XmlBeans.loadXsd( new XmlObject[] {
+ XmlObject.Factory.parse(schema) } );
+
+
+ //
+ // Test the set_XMLName function on XmlQNameImpl
+ //
+
+ String ns =
+ "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
+ "xmlns:xs='http://www.w3.org/2001/XMLSchema'";
+
+ XmlObject sourceDocument =
+ stl.parse(
+ "<any " + ns + " xsi:type='xs:QName' xmlns:xxx='xxx.com'>" +
+ "xxx:abc</any>", null, null );
+
+ XmlCursor sourceCursor = sourceDocument.newCursor();
+
+ sourceCursor.toFirstChild();
+
+ XmlQName sourceQName = (XmlQName) sourceCursor.getObject();
+
+ XmlObject targetDocument =
+ stl.parse(
+ "<any " + ns + " xsi:type='xs:QName'>" +
+ "</any>", null, null );
+
+ XmlCursor targetCursor = targetDocument.newCursor();
+
+ targetCursor.toFirstChild();
+
+ XmlQName targetQName = (XmlQName) targetCursor.getObject();
+
+ targetQName.set( sourceQName );
+
+ Assert.assertTrue(
+ targetQName.qNameValue().getNamespaceURI().equals( "xxx.com" ) );
+
+ //
+ // Test the set_text function on XmlQNameImpl
+ //
+
+ targetDocument =
+ stl.parse(
+ "<any " + ns + " xsi:type='xs:QName' xmlns:xxx='xxx.com'>" +
+ "</any>", null, null );
+
+ targetCursor = targetDocument.newCursor();
+
+ targetCursor.toFirstChild();
+
+ targetQName = (XmlQName) targetCursor.getObject();
+
+ try
+ {
+ targetQName.set( "zzz:abc" );
+
+ Assert.assertTrue( false ); // Must fail
+ }
+ catch ( Throwable t )
+ {
+ }
+
+ targetQName.set( "xxx:abc" );
+
+ Assert.assertTrue(
+ targetQName.qNameValue().getNamespaceURI().equals( "xxx.com" ) );
+ }
+}
diff --git a/v1/test/src/drt/drtcases/RuntimeSchemaLoaderTest.java b/v1/test/src/drt/drtcases/RuntimeSchemaLoaderTest.java
new file mode 100644
index 0000000..a362b80
--- /dev/null
+++ b/v1/test/src/drt/drtcases/RuntimeSchemaLoaderTest.java
@@ -0,0 +1,68 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+import javax.xml.namespace.QName;
+
+import java.io.File;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.w3.x2001.xmlSchema.SchemaDocument.Schema;
+
+public class RuntimeSchemaLoaderTest extends TestCase
+{
+ public RuntimeSchemaLoaderTest(String name) { super(name); }
+ public static Test suite() { return new TestSuite(RuntimeSchemaLoaderTest.class); }
+
+ public void testDynamicLoad() throws Throwable
+ {
+ File inputfile1 = TestEnv.xbeanCase("schema/dynamic/dyntest.xsd");
+ SchemaTypeLoader loader = XmlBeans.loadXsd(new XmlObject[] { XmlObject.Factory.parse(inputfile1) });
+ XmlObject result = loader.parse(TestEnv.xbeanCase("schema/dynamic/dyntest.xml"), null, null);
+ Assert.assertEquals("D=wrappedinstance@http://openuri.org/test/dyntest", result.schemaType().toString());
+ Assert.assertEquals(loader.findDocumentType(new QName("http://openuri.org/test/dyntest", "wrappedinstance" )),
+ result.schemaType());
+ }
+
+ public void testDynamicLoad2() throws Throwable
+ {
+ File inputfile1 = TestEnv.xbeanCase("schema/dynamic/dyntest2.xsd");
+ SchemaTypeLoader loader = XmlBeans.loadXsd(new XmlObject[] { XmlObject.Factory.parse(inputfile1) });
+ XmlObject result = loader.parse(TestEnv.xbeanCase("schema/dynamic/dyntest2.xml"), null, null);
+ Assert.assertEquals("D=wrappedwildcard@http://openuri.org/test/dyntest", result.schemaType().toString());
+ Assert.assertEquals(loader.findDocumentType(new QName("http://openuri.org/test/dyntest", "wrappedwildcard")),
+ result.schemaType());
+ XmlCursor cur = result.newCursor();
+ Assert.assertTrue("Should have a root element", cur.toFirstChild());
+ result = cur.getObject();
+ Assert.assertEquals("E=wrappedwildcard|D=wrappedwildcard@http://openuri.org/test/dyntest", result.schemaType().toString());
+ Assert.assertEquals(loader.findElement(new QName("http://openuri.org/test/dyntest", "wrappedwildcard")).getType(),
+ result.schemaType());
+ Assert.assertTrue("Should have a first child", cur.toFirstChild());
+ Assert.assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "schema"), cur.getName());
+ XmlObject obj = cur.getObject();
+ Assert.assertEquals(Schema.type, obj.schemaType());
+ }
+}
diff --git a/v1/test/src/drt/drtcases/SchemaTypesTests.java b/v1/test/src/drt/drtcases/SchemaTypesTests.java
new file mode 100644
index 0000000..4612cfa
--- /dev/null
+++ b/v1/test/src/drt/drtcases/SchemaTypesTests.java
@@ -0,0 +1,208 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlCalendar;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import java.util.Date;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.io.InputStream;
+
+import org.openuri.xstypes.test.*;
+import org.openuri.def.DefaultsDocument;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+
+import javax.xml.namespace.QName;
+
+public class SchemaTypesTests extends TestCase
+{
+ public SchemaTypesTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(SchemaTypesTests.class); }
+
+ private CustomerDocument doc;
+
+ private void ensureDoc()
+ throws Exception
+ {
+ if( doc==null )
+ {
+ doc = (CustomerDocument)
+ XmlObject.Factory.parse(TestEnv.xbeanCase("../src/xstypes/xstypes.xml"));
+ }
+ }
+
+ public void testDefaults() throws Throwable
+ {
+ DefaultsDocument doc = DefaultsDocument.Factory.newInstance();
+ DefaultsDocument.Defaults defs = doc.addNewDefaults();
+ Assert.assertEquals(783, defs.getCool()); // this is the default value
+ }
+
+ public void testSourceName() throws Throwable
+ {
+ String name = DefaultsDocument.type.getSourceName();
+ Assert.assertEquals("defaults.xsd", name);
+ InputStream str = XmlBeans.getContextTypeLoader().getSourceAsStream("defaults.xsd");
+ SchemaDocument doc = SchemaDocument.Factory.parse(str);
+ Assert.assertTrue(doc.validate());
+ }
+
+ public void testRead() throws Throwable
+ {
+ ensureDoc();
+
+ // Move from the root to the root customer element
+ Person person = doc.getCustomer();
+ Assert.assertEquals("Howdy", person.getFirstname());
+ Assert.assertEquals(4, person.sizeOfNumberArray());
+ Assert.assertEquals(436, person.getNumberArray(0));
+ Assert.assertEquals(123, person.getNumberArray(1));
+ Assert.assertEquals(44, person.getNumberArray(2));
+ Assert.assertEquals(933, person.getNumberArray(3));
+ Assert.assertEquals(2, person.sizeOfBirthdayArray());
+ Assert.assertEquals(new XmlCalendar("1998-08-26Z"),
+ person.getBirthdayArray(0));
+ Assert.assertEquals(new XmlCalendar("2000-08-06-08:00"),
+ person.getBirthdayArray(1));
+
+ Person.Gender.Enum g = person.getGender();
+ Assert.assertEquals(Person.Gender.MALE, g);
+
+ Assert.assertEquals("EGIQTWYZJ", new String(person.getHex()));
+ Assert.assertEquals("This string is base64Binary encoded!",
+ new String(person.getBase64()));
+
+ Assert.assertEquals("GGIQTWYGG", new String(person.getHexAtt()));
+ Assert.assertEquals("This string is base64Binary encoded!",
+ new String(person.getBase64Att()));
+
+ Assert.assertEquals("{some_uri}localname", person.getQnameAtt().toString());
+ Assert.assertEquals("{http://openuri.org/xstypes/test}openuri_org_localname", person.getQname().toString());
+
+ Assert.assertEquals("http://dmoz.org/World/Fran\u00e7ais/", person.getAnyuriAtt().toString());
+ Assert.assertEquals("http://3space.org/space%20space/", person.getAnyuri().toString());
+
+ //RuntimeException: src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java(1537): ns != null && ns.length() > 0 failed
+ //Assert.assertEquals("JPEG", person.getNotationAtt().toString());
+ //Assert.assertEquals("GIF", person.getNotation().toString());
+ }
+
+ public void testWriteRead() throws Throwable
+ {
+ ensureDoc();
+ // Move from the root to the root customer element
+ Person person = doc.getCustomer();
+
+ person.setFirstname("George");
+ Assert.assertEquals("George", person.getFirstname());
+
+ person.setHex("hex encoding".getBytes());
+ Assert.assertEquals("hex encoding", new String(person.getHex()));
+
+ person.setBase64("base64 encoded".getBytes());
+ Assert.assertEquals("base64 encoded",
+ new String(person.getBase64()));
+
+ person.setHexAtt("hex encoding in attributes".getBytes());
+ Assert.assertEquals("hex encoding in attributes",
+ new String(person.getHexAtt()));
+
+ person.setBase64Att("This string is base64Binary encoded!".getBytes());
+ Assert.assertEquals("This string is base64Binary encoded!",
+ new String(person.getBase64Att()));
+
+ person.setAnyuri("a.c:7001");
+ Assert.assertEquals("a.c:7001", person.getAnyuri());
+
+ person.setAnyuriAtt("b.d:7002");
+ Assert.assertEquals("b.d:7002", person.getAnyuriAtt());
+
+ person.setQnameAtt(new QName("aaa","bbb"));
+ Assert.assertEquals("{aaa}bbb", person.getQnameAtt().toString());
+
+ person.setQname(new QName("ddd","eee"));
+ Assert.assertEquals("{ddd}eee", person.getQname().toString());
+
+ //Exception: src/xmlstore/org/apache/xmlbeans/impl/store/Type.java(189): user == _user failed
+// person.setAnyuriAtt(URI.create("b.d:7002"));
+// Assert.assertEquals("b.d:7002", person.getAnyuriAtt().toString());
+
+ //XmlNOTATION notation = (XmlNOTATION)Person.Notation.type.createNode();
+ //notation.setValue("JPEG");
+ //person.setNotation( notation );
+ //Assert.assertEquals("JPEG", person.getNotation().toString());
+
+ //XmlNOTATION notationAtt = (XmlNOTATION)Person.NotationAtt.type.createNode();
+ //notationAtt.setValue("GIF");
+ //person.setNotationAtt( notationAtt );
+ //person.setNotationAtt(notation);
+ //Assert.assertEquals("GIF", person.getNotationAtt().toString());
+ }
+
+ public void testStoreWrite() throws Throwable
+ {
+ ensureDoc();
+ // Move from the root to the root customer element
+ Person person = doc.getCustomer();
+
+ XmlObject xmlobj;
+ XmlCursor xmlcurs;
+
+ person.setFirstname("George");
+ xmlobj = person.xgetFirstname();
+ xmlcurs = xmlobj.newCursor();
+ Assert.assertEquals("George", xmlcurs.getTextValue() );
+
+ person.setQnameAtt( new QName("http://ggg.com","hhh") );
+ xmlobj = person.xgetQnameAtt();
+ xmlcurs = xmlobj.newCursor();
+ Assert.assertEquals("ggg:hhh", xmlcurs.getTextValue() );
+
+ person.setQname( new QName("http://ggg.com/gggAgain","kkk") );
+ xmlobj = person.xgetQname();
+ xmlcurs = xmlobj.newCursor();
+ Assert.assertEquals("ggg1:kkk", xmlcurs.getTextValue() );
+
+ person.setAnyuri( "crossgain.com" );
+ xmlobj = person.xgetAnyuri();
+ xmlcurs = xmlobj.newCursor();
+ Assert.assertEquals("crossgain.com", xmlcurs.getTextValue() );
+
+ person.setAnyuriAtt( "www.crossgain.com" );
+ xmlobj = person.xgetAnyuriAtt();
+ xmlcurs = xmlobj.newCursor();
+ Assert.assertEquals("www.crossgain.com", xmlcurs.getTextValue() );
+
+ //person.setNotation("GIF");
+ //xmlobj = person.getNotation();
+ //xmlcurs = xmlobj.newXmlCursor();
+ //Assert.assertEquals("GIF", xmlcurs.getText() );
+
+ //person.setNotationAtt("JPEGu");
+ //xmlobj = person.xgetNotationAtt();
+ //xmlcurs = xmlobj.newXmlCursor();
+ //Assert.assertEquals("JPEG", xmlcurs.getText() );
+ }
+}
diff --git a/v1/test/src/drt/drtcases/SerializationTests.java b/v1/test/src/drt/drtcases/SerializationTests.java
new file mode 100644
index 0000000..1ea5885
--- /dev/null
+++ b/v1/test/src/drt/drtcases/SerializationTests.java
@@ -0,0 +1,131 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import junit.framework.Assert;
+import com.easypo.XmlPurchaseOrderDocumentBean.PurchaseOrder;
+import com.easypo.XmlLineItemBean;
+import com.easypo.XmlShipperBean;
+import com.easypo.XmlPurchaseOrderDocumentBean;
+import org.apache.xmlbeans.XmlObject;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+
+public class SerializationTests extends TestCase
+{
+ public SerializationTests (String name) { super(name); }
+ public static Test suite() { return new TestSuite(SerializationTests.class); }
+
+ public void testXmlObjectSerialization() throws Exception
+ {
+ String simpleDocument = "<simpleDoc><nestedTag attr=\"sample\">43</nestedTag></simpleDoc>";
+ XmlObject doc = XmlObject.Factory.parse(simpleDocument);
+
+ // baseline test
+ Assert.assertEquals(simpleDocument, doc.xmlText());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(doc);
+ oos.close();
+
+ byte[] byteArray = out.toByteArray();
+ ByteArrayInputStream in = new ByteArrayInputStream(byteArray);
+ ObjectInputStream ois = new ObjectInputStream(in);
+ XmlObject newdoc = (XmlObject)ois.readObject();
+ ois.close();
+
+ Assert.assertEquals(simpleDocument, newdoc.xmlText());
+ }
+
+ public void testXBeanSerialization() throws Exception
+ {
+ XmlPurchaseOrderDocumentBean doc = XmlPurchaseOrderDocumentBean.Factory.newInstance();
+ PurchaseOrder order = doc.addNewPurchaseOrder();
+ order.addNewCustomer().setName("David Bau");
+ order.getCustomer().setAddress("Gladwyne, PA");
+ XmlLineItemBean li;
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 1");
+ li.setPrice(new BigDecimal("21.79"));
+ li.setQuantity(BigInteger.valueOf(2));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 2");
+ li.setPrice(new BigDecimal("19.89"));
+ li.setQuantity(BigInteger.valueOf(2));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ li = order.addNewLineItem();
+ li.setDescription("Burnham's Celestial Handbook, Vol 3");
+ li.setPrice(new BigDecimal("19.89"));
+ li.setQuantity(BigInteger.valueOf(1));
+ li.setPerUnitOunces(new BigDecimal("5"));
+ XmlShipperBean sh = order.addNewShipper();
+ sh.setName("UPS");
+ sh.setPerOunceRate(new BigDecimal("0.74"));
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(doc.getPurchaseOrder().getLineItemArray(1));
+ oos.writeObject(doc);
+ oos.writeObject(doc.getPurchaseOrder().getLineItemArray(2));
+ oos.close();
+
+ byte[] byteArray = out.toByteArray();
+ ByteArrayInputStream in = new ByteArrayInputStream(byteArray);
+ ObjectInputStream ois = new ObjectInputStream(in);
+ XmlLineItemBean newli1 = (XmlLineItemBean)ois.readObject();
+ XmlPurchaseOrderDocumentBean newdoc = (XmlPurchaseOrderDocumentBean)ois.readObject();
+ XmlLineItemBean newli2 = (XmlLineItemBean)ois.readObject();
+ ois.close();
+
+ PurchaseOrder neworder = newdoc.getPurchaseOrder();
+
+ Assert.assertEquals(newli1, neworder.getLineItemArray(1));
+ Assert.assertEquals(newli2, neworder.getLineItemArray(2));
+
+ Assert.assertEquals("David Bau", neworder.getCustomer().getName());
+ Assert.assertEquals("Gladwyne, PA", neworder.getCustomer().getAddress());
+ Assert.assertEquals(3, neworder.sizeOfLineItemArray());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 1", neworder.getLineItemArray(0).getDescription());
+ Assert.assertEquals(new BigDecimal("21.79"), neworder.getLineItemArray(0).getPrice());
+ Assert.assertEquals(new BigInteger("2"), neworder.getLineItemArray(0).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), neworder.getLineItemArray(0).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 2", neworder.getLineItemArray(1).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), neworder.getLineItemArray(1).getPrice());
+ Assert.assertEquals(new BigInteger("2"), neworder.getLineItemArray(1).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), neworder.getLineItemArray(1).getPerUnitOunces());
+
+ Assert.assertEquals("Burnham's Celestial Handbook, Vol 3", neworder.getLineItemArray(2).getDescription());
+ Assert.assertEquals(new BigDecimal("19.89"), neworder.getLineItemArray(2).getPrice());
+ Assert.assertEquals(new BigInteger("1"), neworder.getLineItemArray(2).getQuantity());
+ Assert.assertEquals(new BigDecimal("5"), neworder.getLineItemArray(2).getPerUnitOunces());
+
+ Assert.assertEquals(true, neworder.isSetShipper());
+ Assert.assertEquals("UPS", neworder.getShipper().getName());
+ Assert.assertEquals(new BigDecimal("0.74"), neworder.getShipper().getPerOunceRate());
+ }
+}
diff --git a/v1/test/src/drt/drtcases/SmokeTests.java b/v1/test/src/drt/drtcases/SmokeTests.java
new file mode 100644
index 0000000..e136105
--- /dev/null
+++ b/v1/test/src/drt/drtcases/SmokeTests.java
@@ -0,0 +1,51 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+
+public class SmokeTests extends TestCase
+{
+ SmokeTests(String name) { super(name); }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(SmokeTests.class.getName());
+ suite.addTest(AssortedTests.suite());
+ suite.addTest(IntTests.suite());
+ suite.addTest(RuntimeSchemaLoaderTest.suite());
+ suite.addTest(StoreTests.suite());
+ suite.addTest(QNameTests.suite());
+ suite.addTest(ValidationTests.suite());
+ suite.addTest(CompilationTests.suite());
+ suite.addTest(AnnotationsTests.suite());
+ suite.addTest(EasyPoTests.suite());
+ suite.addTest(NameworldTest.suite());
+ suite.addTest(SchemaTypesTests.suite());
+ suite.addTest(EnumTests.suite());
+ suite.addTest(CreationTests.suite());
+ suite.addTest(ThreadingTest.suite());
+ suite.addTest(SerializationTests.suite());
+ suite.addTest(DomTests.suite());
+ suite.addTest(GDateTests.suite());
+ suite.addTest(SubstGroupTests.suite());
+ suite.addTest(JaxenXPathTests.suite());
+ suite.addTest(NumeralsTests.suite());
+ return suite;
+ }
+}
diff --git a/v1/test/src/drt/drtcases/StandaloneTests.java b/v1/test/src/drt/drtcases/StandaloneTests.java
new file mode 100644
index 0000000..2033d12
--- /dev/null
+++ b/v1/test/src/drt/drtcases/StandaloneTests.java
@@ -0,0 +1,49 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+
+public class StandaloneTests extends TestCase
+{
+ StandaloneTests(String name) { super(name); }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(StandaloneTests.class.getName());
+ suite.addTest(AssortedTests.suite());
+ suite.addTest(IntTests.suite());
+ suite.addTest(RuntimeSchemaLoaderTest.suite());
+ suite.addTest(StoreTests.suite());
+ suite.addTest(QNameTests.suite());
+ suite.addTest(ValidationTests.suite());
+ suite.addTest(CompilationTests.suite());
+ suite.addTest(AnnotationsTests.suite());
+ suite.addTest(EasyPoTests.suite());
+ suite.addTest(NameworldTest.suite());
+ suite.addTest(SchemaTypesTests.suite());
+ suite.addTest(EnumTests.suite());
+ suite.addTest(CreationTests.suite());
+ suite.addTest(ThreadingTest.suite());
+ suite.addTest(SerializationTests.suite());
+ suite.addTest(DomTests.suite());
+ suite.addTest(GDateTests.suite());
+ suite.addTest(SubstGroupTests.suite());
+ return suite;
+ }
+}
diff --git a/v1/test/src/drt/drtcases/StoreTests.java b/v1/test/src/drt/drtcases/StoreTests.java
new file mode 100644
index 0000000..9c8d6a8
--- /dev/null
+++ b/v1/test/src/drt/drtcases/StoreTests.java
@@ -0,0 +1,2610 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlSaxHandler;
+import org.apache.xmlbeans.XmlLineNumber;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.common.XmlNameImpl;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.Iterator;
+import java.util.TreeSet;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.apache.xmlbeans.xml.stream.Attribute;
+import org.apache.xmlbeans.xml.stream.AttributeIterator;
+import org.apache.xmlbeans.xml.stream.ChangePrefixMapping;
+import org.apache.xmlbeans.xml.stream.CharacterData;
+import org.apache.xmlbeans.xml.stream.Comment;
+import org.apache.xmlbeans.xml.stream.EndDocument;
+import org.apache.xmlbeans.xml.stream.EndElement;
+import org.apache.xmlbeans.xml.stream.EndPrefixMapping;
+import org.apache.xmlbeans.xml.stream.StartDocument;
+import org.apache.xmlbeans.xml.stream.StartElement;
+import org.apache.xmlbeans.xml.stream.StartPrefixMapping;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLName;
+
+public class StoreTests extends TestCase
+{
+ public StoreTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(StoreTests.class); }
+
+ static String[] _args;
+ static String _test;
+
+ public static File getCaseFile(String theCase)
+ {
+ return TestEnv.xbeanCase("store/" + theCase);
+ }
+
+ static XmlCursor loadCase(String theCase) throws Exception
+ {
+ return XmlObject.Factory.parse(getCaseFile(theCase), null).newCursor();
+ }
+
+ public void testReplaceContents ( )
+ throws Exception
+ {
+ XmlObject xDst = XmlObject.Factory.newInstance();
+ XmlObject xSrc = XmlObject.Factory.parse( "<foo/>" );
+ XmlObject newDst = xDst.set( xSrc );
+ Assert.assertTrue( newDst.xmlText().equals( "<foo/>" ) );
+
+ xDst = XmlObject.Factory.parse( "<bar/>" );
+ xSrc = XmlObject.Factory.parse( "<foo/>" );
+ XmlCursor c = xDst.newCursor();
+ c.toNextToken();
+ xDst = c.getObject();
+ xDst.set( xSrc );
+ c.toStartDoc();
+ xDst = c.getObject();
+ Assert.assertTrue( xDst.xmlText().equals( "<bar><foo/></bar>" ) );
+
+ xDst = XmlObject.Factory.parse( "<bar x='y'/>" );
+ xSrc = XmlObject.Factory.parse( "<foo>moo</foo>" );
+ c = xDst.newCursor();
+ c.toNextToken();
+ c.toNextToken();
+ xDst = c.getObject();
+ xDst.set( xSrc );
+ c.toStartDoc();
+ xDst = c.getObject();
+ Assert.assertTrue( xDst.xmlText().equals( "<bar x=\"moo\"/>" ) );
+ }
+
+ public void testSniffing ( )
+ throws Exception
+ {
+ XmlObject x;
+
+ x = XmlObject.Factory.parse( "<xoo/>" );
+ Assert.assertTrue( x.schemaType() == XmlBeans.NO_TYPE );
+
+ x = XmlObject.Factory.parse(
+ "<schema xmlns='http://www.w3.org/2001/XMLSchema'/>" );
+ Assert.assertTrue(
+ x.schemaType() == org.w3.x2001.xmlSchema.SchemaDocument.type );
+
+ x = XmlObject.Factory.parse(
+ "<schema xmlns='http://www.w3.org/2001/XMLSchema/moo'/>" );
+ Assert.assertTrue( x.schemaType() == XmlBeans.NO_TYPE );
+
+ x = XmlObject.Factory.parse(
+ "<schema xmlns='http://www.w3.org/2001/XMLSchema'/>" );
+ Assert.assertTrue(
+ x.schemaType() == org.w3.x2001.xmlSchema.SchemaDocument.type );
+
+ x = org.w3.x2001.xmlSchema.SchemaDocument.Factory.parse(
+ "<schema xmlns='http://www.w3.org/2001/XMLSchema'/>" );
+ Assert.assertTrue(
+ x.schemaType() == org.w3.x2001.xmlSchema.SchemaDocument.type );
+
+ try {
+ x =
+ org.w3.x2001.xmlSchema.SchemaDocument.Factory.parse(
+ "<schema xmlns='http://www.w3.org/2001/XMLSchema/moo'/>" );
+ Assert.assertTrue( false );
+ }
+ catch ( Throwable e ) { }
+ }
+
+ public void testCursorStack ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo x='y'/>" );
+ XmlCursor c = x.newCursor();
+ c.push();
+ c.toNextToken();
+ c.push();
+ c.toNextToken();
+ Assert.assertTrue( c.isAttr() );
+ c.pop();
+ Assert.assertTrue( c.isStart() );
+ c.pop();
+ Assert.assertTrue( c.isStartdoc() );
+ }
+
+ public void testImplicitNamespaces ( )
+ throws Exception
+ {
+ Map namespaces = new HashMap();
+ namespaces.put( "foo", "foo.com" );
+ namespaces.put( "bar", "bar.com" );
+ namespaces.put( "", "default.com" );
+
+ XmlOptions options = new XmlOptions();
+ options.put( XmlOptions.SAVE_IMPLICIT_NAMESPACES, namespaces );
+
+ XmlObject x = XmlObject.Factory.newInstance();
+ XmlCursor c = x.newCursor();
+
+ c.toNextToken();
+
+ c.beginElement( "a", "foo.com" );
+ c.beginElement( "b", "default.com" );
+ c.beginElement( "c", "bar.com" );
+
+ Assert.assertTrue(
+ x.xmlText( options ).equals( "<foo:a><b><bar:c/></b></foo:a>" ) );
+ }
+
+ private static class Content implements ContentHandler, LexicalHandler
+ {
+ public void startDocument ( ) throws SAXException
+ {
+ add( "START_DOCUMENT" );
+ }
+
+ public void endDocument ( ) throws SAXException
+ {
+ add( "END_DOCUMENT" );
+ }
+
+ public void startElement (
+ String namespaceURI, String localName,
+ String qName, Attributes atts )
+ throws SAXException
+ {
+ add( "START_ELEMENT" );
+ add( " namespaceURI: " + namespaceURI );
+ add( " localName: " + localName );
+// add( " qName: " + qName );
+
+ TreeSet sortedAttrs = new TreeSet();
+
+ for ( int i = 0 ; i < atts.getLength() ; i++ )
+ {
+ String ln = atts.getLocalName( i );
+ String uri = atts.getURI( i );
+ String qname = atts.getQName( i );
+
+ if (ln.equals("xmlns"))
+ continue;
+ if (qname.startsWith("xmlns"))
+ continue;
+
+// if (ln.equals( "xmlns" ))
+// ln = "";
+//
+// if (uri.equals( "xmlns" ))
+// uri = "";
+
+ sortedAttrs.add(
+ uri + "-" + ln + "-" +
+ atts.getQName( i ) + "-" + atts.getType( i ) + "-" +
+ atts.getValue( i ) );
+ }
+
+ for ( Iterator i = sortedAttrs.iterator() ; i.hasNext() ; )
+ add( " Attr: " + i.next() );
+ }
+
+ public void endElement (
+ String namespaceURI, String localName, String qName )
+ throws SAXException
+ {
+ add( "END_ELEMENT" );
+ add( " namespaceURI: " + namespaceURI );
+ add( " localName: " + localName );
+// add( " qName: " + qName );
+ }
+
+ public void characters ( char ch[], int start, int length )
+ throws SAXException
+ {
+ if (length > 0)
+ {
+ add( "CHARACTERS" );
+ add( ch, start, length );
+ }
+ }
+
+ public void comment ( char ch[], int start, int length )
+ throws SAXException
+ {
+ add( "COMMENT" );
+ add( " Comment: ", ch, start, length );
+ }
+
+ public void processingInstruction ( String target, String data )
+ throws SAXException
+ {
+ add( "PROCESSING_INSTRUCTION" );
+ add( "target: " + target );
+ add( "data: " + data );
+ }
+
+ public void ignorableWhitespace ( char ch[], int start, int length )
+ throws SAXException
+ {
+ if (length > 0)
+ {
+ add( "IGNORABLE_WHITESPACE" );
+ add( " whitespace: ", ch, start, length );
+ }
+ }
+
+ public void startPrefixMapping ( String prefix, String uri )
+ throws SAXException
+ {
+ add( "START_PREFIX_MAPPING" );
+// add( " prefix: " + prefix );
+ add( " uri: " + uri );
+ }
+
+ public void endPrefixMapping ( String prefix ) throws SAXException
+ {
+ add( "END_PREFIX_MAPPING" );
+// add( " prefix: " + prefix );
+ }
+
+ public void startCDATA ( ) throws SAXException
+ {
+ add( "START_CDATA" );
+ }
+
+ public void endCDATA ( ) throws SAXException
+ {
+ add( "END_CDATA" );
+ }
+
+ public void startDTD ( String name, String publicId, String systemId )
+ throws SAXException
+ {
+ add( "START_DTD" );
+ add( " name: " + name );
+ add( " publicId: " + publicId );
+ add( " systemId: " + systemId );
+ }
+
+ public void endDTD ( ) throws SAXException
+ {
+ add( "END_DTD" );
+ }
+
+ public void startEntity ( String name ) throws SAXException
+ {
+ add( "START_ENTITY" );
+ add( " name: " + name );
+ }
+
+ public void endEntity ( String name ) throws SAXException
+ {
+ add( "END_ENTITY" );
+ add( " name: " + name );
+ }
+
+ public void setDocumentLocator ( Locator locator )
+ {
+ // add( "START_DOCUMENT_LOCATOR" );
+ }
+
+ public void skippedEntity ( String name ) throws SAXException
+ {
+ add( "SKIPPED_ENTITY" );
+ add( " name: " + name );
+ }
+
+ private void add ( String s )
+ {
+ _sb.append( s );
+ _sb.append( "\n" );
+ }
+
+ private void add ( String s, char[] buf, int off, int cch )
+ {
+ _sb.append( s );
+ _sb.append( buf, off, cch );
+ _sb.append( "\n" );
+ }
+
+ private void add ( char[] buf, int off, int cch )
+ {
+ _sb.append( buf, off, cch );
+ _sb.append( "\n" );
+ }
+
+ public boolean equals ( Object that )
+ {
+ return toString().equals( that.toString() );
+ }
+
+ public String toString ( )
+ {
+ return _sb.toString();
+ }
+
+ private StringBuffer _sb = new StringBuffer();
+ }
+
+ public void doTestSaxSaver ( String xml )
+ throws Exception
+ {
+ // ME
+
+ Content content2 = new Content();
+
+ XmlObject x = XmlObject.Factory.parse( xml );
+
+ x.save( content2, content2 );
+
+ // THEM
+
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+
+ XMLReader xr = sp.getXMLReader();
+
+ Content content1 = new Content();
+
+ xr.setProperty( "http://xml.org/sax/properties/lexical-handler", content1 );
+ xr.setFeature( "http://xml.org/sax/features/namespace-prefixes", true );
+ xr.setFeature( "http://xml.org/sax/features/namespaces", true );
+ xr.setFeature( "http://xml.org/sax/features/validation", false );
+
+ xr.setContentHandler( content1 );
+
+ InputSource is = new InputSource( new StringReader( xml ) );
+
+ xr.parse( is );
+
+
+ if (!content1.equals( content2 ))
+ {
+ System.err.println( "SAX save failure: " );
+ System.err.println( xml );
+ System.err.println();
+
+ System.err.println( "SAX: " );
+ System.err.println( content1.toString() );
+ System.err.println();
+
+ System.err.println( "ME: " );
+ System.err.println( content2.toString() );
+ System.err.println();
+
+ Assert.assertTrue( false );
+ }
+ }
+
+ public void testSaxSaver ( )
+ throws Exception
+ {
+ doTestSaxSaver( "<a xmlns='nnn'></a>" );
+ doTestSaxSaver( "<a x='y'><!---->x<b/><c p='q'>z</c></a>" );
+ doTestSaxSaver( "<a x='y'><!----><b>moo</b><c p='q'></c></a>" );
+ doTestSaxSaver( "<a>asa<b/>sdsd<c>aaz</c>adsasd</a>" );
+ doTestSaxSaver( "<a><?target value?></a>" );
+ doTestSaxSaver( "<n:a xmlns:n='nnn'></n:a>" );
+ doTestSaxSaver( "<j:a x='y' p='q' xmlns:j='k'></j:a>" );
+ }
+
+ public void __testParsing ( )
+ throws Exception
+ {
+ Random r = new Random( 1 );
+
+ for ( int i = 0 ; i < 100000 ; i++ )
+ {
+ String xml = makeRandomDocument( r );
+
+// System.err.println( "Starting..." );
+//
+// System.err.println( xml );
+
+ try
+ {
+ XmlObject.Factory.parse( xml );
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Failed parse test:" );
+ e.printStackTrace();
+ System.err.println( xml );
+
+ OutputStream os = new FileOutputStream( "c:\\ee.xml" );
+ PrintStream ps = new PrintStream( os );
+ ps.println( xml );
+ ps.close();
+ os.close();
+
+ throw (RuntimeException) e;
+ }
+
+// System.err.println( "Finished..." );
+ }
+ }
+
+ public void doTestLineNumbers ( String xml )
+ throws Exception
+ {
+ int line = 1;
+ int col = 1;
+
+ XmlCursor c =
+ XmlObject.Factory.parse(
+ xml, new XmlOptions().setLoadLineNumbers() ).
+ newCursor();
+
+ for ( int i = 0 ; i < xml.length() ; i++ )
+ {
+ char ch = xml.charAt( i );
+
+ if (ch == '<' && Character.isLetter( xml.charAt( i + 1 ) ) )
+ {
+ while (!c.currentTokenType().isStart())
+ c.toNextToken();
+
+ Assert.assertTrue( c.currentTokenType().isStart() );
+
+ XmlLineNumber ln =
+ (XmlLineNumber)
+ c.getBookmark( XmlLineNumber.class );
+
+ Assert.assertTrue( ln != null );
+
+ Assert.assertTrue( ln.getLine() == -1 || ln.getLine() == line );
+ Assert.assertTrue( ln.getColumn() == -1 || ln.getColumn() == col );
+ Assert.assertTrue( ln.getOffset() == -1 || ln.getOffset() == i );
+
+ c.toNextToken();
+ }
+
+ if (ch == '\n')
+ {
+ line++;
+ col= 1;
+ }
+ else
+ col++;
+ }
+ }
+
+ public void __testLineNumbers ( )
+ throws Exception
+ {
+ Random r = new Random( 1 );
+
+ for ( int i = 0 ; i < 1000 ; i++ )
+ {
+ String xml = makeRandomDocument( r );
+
+// System.err.println( "Starting..." );
+//
+// System.err.println( xml );
+
+ try
+ {
+ doTestLineNumbers( xml );
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Failed line number test:" );
+ System.err.println( xml );
+
+ OutputStream os = new FileOutputStream( "c:\\ee.xml" );
+ PrintStream ps = new PrintStream( os );
+ ps.println( xml );
+ ps.close();
+ os.close();
+
+ throw (RuntimeException) e;
+ }
+
+// System.err.println( "Finished..." );
+ }
+ }
+
+ private static class DocBuilder
+ {
+ Random r;
+ StringBuffer sb;
+
+ DocBuilder ( Random _r, StringBuffer _sb )
+ {
+ r = _r;
+ sb = _sb;
+ }
+
+ void append ( char ch )
+ {
+ sb.append( ch );
+ }
+
+ void append ( String s )
+ {
+ sb.append( s );
+ }
+
+ public void whitespace ( )
+ {
+ int p = r.nextInt( 100 );
+
+ if (p < 20)
+ append( '\t' );
+ else if (p < 40)
+ append( '\n' );
+ else
+ append( ' ' );
+ }
+
+ public void whitespaces ( )
+ {
+ for ( int i = r.nextInt( 8 ) ; i > 0 ; i-- )
+ whitespace();
+ }
+
+ public char makeLetter ( )
+ {
+ return (char) (((int) 'a') + r.nextInt( 26 ));
+ }
+
+ public void letter ( )
+ {
+ append( makeLetter() );
+ }
+
+ public void charEntity ( )
+ {
+ switch ( r.nextInt( 5 ) )
+ {
+ case 0 : append( "<" ); break;
+ case 1 : append( ">" ); break;
+ case 2 : append( "&" ); break;
+ case 3 : append( "'" ); break;
+ case 4 : append( """ ); break;
+ }
+ }
+
+ public void text ( )
+ {
+ for ( int i = r.nextInt( 20 ) ; i > 0 ; i-- )
+ {
+ int p = r.nextInt( 100 );
+
+ if (p < 70)
+ letter();
+ else if (p < 74)
+ charEntity();
+ else
+ whitespace();
+ }
+ }
+
+ public String makeNcName ( )
+ {
+ StringBuffer name = new StringBuffer();
+
+ for ( ; ; )
+ {
+ char ch = makeLetter();
+
+ if (ch == 'x' || ch == 'X')
+ continue;
+
+ name.append( ch );
+
+ break;
+ }
+
+ for ( int i = r.nextInt( 20 ) ; i > 0 ; i-- )
+ name.append( makeLetter() );
+
+ return name.toString();
+ }
+
+ public void ncName ( )
+ {
+ append( makeNcName() );
+ }
+
+ public void comment ( )
+ {
+ append( "<!--" );
+ text();
+ append( "-->" );
+ }
+
+ public void procinst ( )
+ {
+ append( "<?" );
+ ncName();
+
+ if (r.nextInt( 100 ) < 90)
+ {
+ whitespace();
+ text();
+ }
+
+ append( "?>" );
+ }
+
+ public void whiteContent ( )
+ {
+ for ( ; ; )
+ {
+ int p = r.nextInt( 100 );
+
+ if (p < 20)
+ break;
+ else if (p < 50)
+ whitespaces();
+ else if (p < 70)
+ comment();
+ else
+ procinst();
+ }
+ }
+
+ public void xmlDecl ( )
+ {
+ append( "<?xml version=\"1.0\"?>" );
+ }
+
+ public void content ( int depth )
+ {
+ for ( int i = r.nextInt( 10 ) ; i > 0 ; i-- )
+ {
+ switch ( r.nextInt( 4 ) )
+ {
+ case 0 :
+ elementContent( depth + 1 );
+ break;
+
+ case 1 : text(); break;
+ case 2 : comment(); break;
+ case 3 : procinst(); break;
+ }
+ }
+ }
+
+ public void attribute ( )
+ {
+ ncName();
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ append( '=' );
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ char q = r.nextInt( 2 ) == 0 ? '\'' : '"';
+
+ append( q );
+
+ text();
+
+ append( q );
+ }
+
+ public void elementContent ( int depth )
+ {
+ // If depth == 0, guarantee an element, otherwise, as depth
+ // increases, the probablility we'll spit out an element
+ // gets smaller.
+
+ if (r.nextInt( depth + 1 ) <= 1)
+ {
+ String name = makeNcName();
+
+ append( '<' );
+ append( name );
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ HashMap attrs = new HashMap();
+
+ for ( int i = r.nextInt( 3 ) ; i > 0 ; i-- )
+ {
+ append( ' ' );
+
+ String aname;
+
+ for ( ; ; )
+ {
+ aname = makeNcName();
+
+ if (!attrs.containsKey( aname ))
+ break;
+ }
+
+ attrs.put( aname, null );
+
+ append( aname );
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ append( '=' );
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ char q = r.nextInt( 2 ) == 0 ? '\'' : '"';
+
+ append( q );
+
+ text();
+
+ append( q );
+
+ if (r.nextInt( 10 ) == 0)
+ whitespaces();
+ }
+
+ append( '>' );
+
+ content( depth );
+
+ append( "</" );
+ append( name );
+
+ if (r.nextInt( 100 ) == 0)
+ whitespaces();
+
+ append( '>' );
+ }
+ }
+
+ public void document ( )
+ {
+ if (r.nextInt( 2 ) == 0)
+ xmlDecl();
+
+ whiteContent();
+
+ elementContent( 0 );
+
+ whiteContent();
+ }
+ }
+
+ public String makeRandomDocument ( Random r )
+ {
+ StringBuffer sb = new StringBuffer();
+
+ DocBuilder db = new DocBuilder( r, sb );
+
+ db.document();
+
+ return sb.toString();
+ }
+
+ public void testThatAssertIsOn ( )
+ {
+ try
+ {
+ assert false;
+
+ Assert.assertTrue( false );
+ }
+ catch ( Throwable e )
+ {
+ }
+ }
+
+ static class MyMark extends XmlBookmark
+ {
+ }
+
+ public void testBookmarks ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo x='y'>abcdefg<!---->xy</foo>" );
+
+ XmlCursor c = x.newCursor();
+ MyMark m1 = new MyMark(); c.setBookmark( m1 );
+
+ c.toNextToken();
+ MyMark m2 = new MyMark(); c.setBookmark( m2 );
+
+ c.toNextToken();
+ MyMark m3 = new MyMark(); c.setBookmark( m3 );
+
+ c.toNextToken();
+ MyMark m4 = new MyMark(); c.setBookmark( m4 );
+
+ c.toNextChar( 1 );
+ MyMark m5 = new MyMark(); c.setBookmark( m5 );
+
+ c.toNextChar( 3 );
+ MyMark m6 = new MyMark(); c.setBookmark( m6 );
+
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ MyMark m7 = new MyMark(); c.setBookmark( m7 );
+
+ c.toNextToken();
+ MyMark m8 = new MyMark(); c.setBookmark( m8 );
+
+ c.toStartDoc();
+
+ Assert.assertTrue( c.getBookmark ( MyMark.class ) == m1 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m2 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m3 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m4 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m5 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m6 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m7 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == m8 );
+ Assert.assertTrue( c.toNextBookmark( MyMark.class ) == null );
+
+ c.toEndDoc();
+
+ Assert.assertTrue( c.getBookmark ( MyMark.class ) == m8 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m7 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m6 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m5 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m4 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m3 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m2 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == m1 );
+ Assert.assertTrue( c.toPrevBookmark( MyMark.class ) == null );
+ }
+
+ public void testSetName( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo x='a'/>" );
+ XmlCursor c = x.newCursor();
+ c.toNextToken();
+ c.setName( new QName( "bar" ) );
+ c.toNextToken();
+ c.setName( new QName( "y" ) );
+
+ Assert.assertTrue( x.xmlText().equals( "<bar y=\"a\"/>" ) );
+ }
+
+ //
+ // Basic load up a file and iterate through it
+ //
+
+
+ public void testBasicXml( )
+ throws Exception
+ {
+ XmlCursor c = loadCase("test.xml");
+
+ int n = 0;
+
+ for ( ; ; )
+ {
+ TokenType t = c.toNextToken();
+
+ n++;
+
+ if (t == TokenType.NONE)
+ break;
+ }
+
+ Assert.assertTrue( n == 6 );
+ }
+
+ //
+ // Make sure the tokens going forward the the reverse of the tokens
+ // going backward
+ //
+
+ public void testConsistentTokenOrder( )
+ throws Exception
+ {
+ ArrayList l = new ArrayList();
+
+ XmlCursor c = loadCase("test.xml");
+
+ for ( ; ; )
+ {
+ // System.err.println(c.currentTokenType());
+ l.add(c.currentTokenType());
+
+ if (c.toNextToken() == TokenType.NONE)
+ break;
+ }
+
+ c.toEndDoc();
+ // System.err.println("Reversing");
+
+ for ( int i = l.size() - 1 ; ; i-- )
+ {
+ // System.err.println(c.currentTokenType());
+ Assert.assertEquals(l.get(i), c.currentTokenType());
+
+ if (c.toPrevToken() == TokenType.NONE)
+ break;
+ }
+ }
+
+ //
+ // Make sure you can't insert text before the doc begin
+ // going backward
+ //
+
+ public void testIllegalTextInsert( )
+ throws Exception
+ {
+ XmlCursor c = loadCase("test.xml");
+
+ try
+ {
+ c.insertChars( "Ho ho ho" );
+ }
+ catch (IllegalStateException e)
+ {
+ return;
+ }
+
+ Assert.assertTrue("Did not catch IllegalStateException", false);
+ }
+
+ //
+ // Make sure getText works in a basic way
+ //
+
+ public void testgetText( )
+ throws Exception
+ {
+ XmlCursor c = loadCase("test.xml");
+
+ Assert.assertTrue( c.getTextValue().equals( "ab" ) ); // Doc node
+
+ c.toNextToken();
+ Assert.assertTrue( c.getTextValue().equals( "ab" ) ); // Doc elem
+
+ c.toNextToken();
+ Assert.assertTrue( c.getTextValue().equals( "y" ) ); // Attr x
+
+ c.toNextToken();
+ Assert.assertTrue( c.getChars().equals( "ab" ) ); // Text
+
+ c.toNextChar( 1 );
+ Assert.assertTrue( c.getChars().equals( "b" ) ); // Text
+
+ c.toNextToken();
+ Assert.assertTrue( c.getChars().length() == 0 ); // End tag
+
+ c.toNextToken();
+ Assert.assertTrue( c.getChars().length() == 0 ); // End doc
+ }
+
+ //
+ // Text XMLInputStream support
+ //
+
+ private void assertName (
+ XMLName name, String uri, String local, String prefix )
+ {
+ Assert.assertTrue( local != null );
+
+ String nameUri = name.getNamespaceUri();
+ String nameLocal = name.getLocalName();
+ String namePrefix = name.getPrefix();
+
+ if (uri == null)
+ Assert.assertTrue( nameUri == null );
+ else
+ Assert.assertTrue( nameUri.equals( uri ) );
+
+ if (local == null)
+ Assert.assertTrue( nameLocal == null );
+ else
+ Assert.assertTrue( nameLocal.equals( local ) );
+
+ if (prefix == null)
+ Assert.assertTrue( namePrefix == null );
+ else
+ Assert.assertTrue( namePrefix.equals( prefix ) );
+
+ if (prefix != null)
+ {
+ String qName = prefix + ":" + local;
+ Assert.assertTrue( name.getQualifiedName().equals( qName ) );
+ }
+ else
+ Assert.assertTrue( name.getQualifiedName().equals( local ) );
+ }
+
+ private void doXmlStreamTest ( String xml )
+ throws Exception
+ {
+ XmlCursor c = XmlObject.Factory.parse( xml ).newCursor();
+ XMLInputStream xmlStream = c.newXMLInputStream();
+ XmlObject o = XmlObject.Factory.parse( xmlStream );
+ Assert.assertTrue( o.xmlText().equals( xml ) );
+ }
+
+ private void doSaverTest ( String xml )
+ throws Exception
+ {
+ XmlCursor c = XmlObject.Factory.parse( xml ).newCursor();
+ Assert.assertTrue( c.xmlText().equals( xml ) );
+ }
+
+ private void doSaveTest ( String xml )
+ throws Exception
+ {
+ doXmlStreamTest( xml );
+ doSaverTest( xml );
+ }
+
+ public void testSaving ( )
+ throws Exception
+ {
+ doSaveTest( "<foo xmlns=\"foo.com\"><bar>1</bar></foo>" );
+ doSaveTest( "<foo><!--comment--><?target foo?></foo>" );
+ doSaveTest( "<foo>a<bar>b</bar>c<bar>d</bar>e</foo>" );
+ doSaveTest( "<foo xmlns:x=\"y\"><bar xmlns:x=\"z\"/></foo>" );
+ doSaveTest( "<foo x=\"y\" p=\"r\"/>" );
+
+ String s = "<foo>aaa</foo>bbb";
+ s = s + s + s + s + s + s + s + s + s + s + s + s + s + s + s;
+ s = "<bar>xxxx" + s + "</bar>";
+
+ doSaveTest( s );
+
+ XmlObject x =
+ XmlObject.Factory.parse( "<foo xmlns:a='a.com'><bar xmlns:a='b.com'/></foo>" );
+
+ XmlCursor c = x.newCursor();
+
+ c.toFirstChild();
+ c.toFirstChild();
+
+ Assert.assertTrue( c.xmlText().equals( "<bar xmlns:a=\"b.com\"/>" ) );
+
+ x = XmlObject.Factory.parse( "<foo xmlns:a='a.com'><bar/></foo>" );
+
+ c = x.newCursor();
+
+ c.toFirstChild();
+ c.toFirstChild();
+
+ Assert.assertTrue( c.xmlText().equals( "<bar xmlns:a=\"a.com\"/>" ) );
+ }
+
+ public void testXMLStream ( )
+ throws Exception
+ {
+ XmlObject o =
+ XmlObject.Factory.parse(
+ "<foo x=\"y\" xmlns=\"default.com\">" +
+ "<!-- x -->bar</foo>" );
+
+ XmlCursor c = o.newCursor();
+
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+
+ c.insertElement( "bar", "bar.com" );
+
+ c.toStartDoc();
+
+ XMLInputStream xis = c.newXMLInputStream();
+
+ XMLEvent xev;
+ StartDocument startDocument;
+ EndDocument endDocument;
+ StartElement startElement;
+ AttributeIterator attributeIterator;
+ StartPrefixMapping startPrefixMapping;
+ EndPrefixMapping endPrefixMapping;
+ ChangePrefixMapping cpm;
+ EndElement endElement;
+ Attribute attribute;
+ Comment comment;
+ CharacterData characterData;
+ XMLName name;
+ String str;
+ Map map;
+
+ xev = startDocument = (StartDocument) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.START_DOCUMENT );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( startDocument.isStartDocument() );
+
+ xev = startPrefixMapping = (StartPrefixMapping) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.START_PREFIX_MAPPING );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isStartPrefixMapping() );
+ str = startPrefixMapping.getNamespaceUri();
+ Assert.assertTrue( str.equals( "default.com" ) );
+ Assert.assertTrue( startPrefixMapping.getPrefix().length() == 0 );
+
+ xev = startElement = (StartElement) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.START_ELEMENT );
+ Assert.assertTrue( xev.hasName() );
+ Assert.assertTrue( xev.isStartElement() );
+ assertName( startElement.getName(), "default.com", "foo", null );
+ attributeIterator = startElement.getAttributes();
+ attribute = attributeIterator.next();
+ assertName( attribute.getName(), null, "x", null );
+ Assert.assertTrue( attribute.getValue().equals( "y" ) );
+ Assert.assertTrue( attributeIterator.next() == null );
+ attributeIterator = startElement.getNamespaces();
+ attribute = attributeIterator.next();
+ assertName( attribute.getName(), null, "xmlns", null );
+ Assert.assertTrue( attribute.getValue().equals( "default.com" ) );
+ Assert.assertTrue( attributeIterator.next() == null );
+ attributeIterator = startElement.getAttributesAndNamespaces();
+ Assert.assertTrue( attributeIterator.next() != null );
+ Assert.assertTrue( attributeIterator.next() != null );
+ Assert.assertTrue( attributeIterator.next() == null );
+ name = new XmlNameImpl( null, "x", null );
+ attribute = startElement.getAttributeByName( name );
+ Assert.assertTrue( attribute != null );
+ Assert.assertTrue( attribute.getValue().equals( "y" ) );
+ name = new XmlNameImpl( null, "xmlns", null );
+ attribute = startElement.getAttributeByName( name );
+ Assert.assertTrue( attribute == null );
+ str = startElement.getNamespaceUri( null );
+ Assert.assertTrue( str.equals( "default.com" ) );
+
+ xev = startPrefixMapping = (StartPrefixMapping) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.START_PREFIX_MAPPING );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isStartPrefixMapping() );
+ str = startPrefixMapping.getNamespaceUri();
+ Assert.assertTrue( str.equals( "bar.com" ) );
+ Assert.assertTrue( startPrefixMapping.getPrefix().equals( "bar" ) );
+
+ xev = startElement = (StartElement) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.START_ELEMENT );
+ Assert.assertTrue( xev.hasName() );
+ Assert.assertTrue( xev.isStartElement() );
+ assertName( startElement.getName(), "bar.com", "bar", "bar" );
+ attributeIterator = startElement.getAttributes();
+ Assert.assertTrue( attributeIterator.next() == null );
+ attributeIterator = startElement.getNamespaces();
+ attribute = attributeIterator.next();
+ assertName( attribute.getName(), null, "bar", "xmlns" );
+ Assert.assertTrue( attribute.getValue().equals( "bar.com" ) );
+ Assert.assertTrue( attributeIterator.next() == null );
+ attributeIterator = startElement.getAttributesAndNamespaces();
+ Assert.assertTrue( attributeIterator.next() != null );
+ Assert.assertTrue( attributeIterator.next() == null );
+ str = startElement.getNamespaceUri( "bar" );
+ Assert.assertTrue( str.equals( "bar.com" ) );
+ map = startElement.getNamespaceMap();
+ Assert.assertTrue( map.get( "bar" ).equals( "bar.com" ) );
+
+ xev = endElement = (EndElement) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.END_ELEMENT );
+ Assert.assertTrue( xev.hasName() );
+ Assert.assertTrue( xev.isEndElement() );
+ assertName( endElement.getName(), "bar.com", "bar", "bar" );
+
+ xev = endPrefixMapping = (EndPrefixMapping) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.END_PREFIX_MAPPING );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isEndPrefixMapping() );
+ Assert.assertTrue( endPrefixMapping.getPrefix().equals( "bar" ) );
+
+ xev = comment = (Comment) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.COMMENT );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( comment.hasContent() );
+ Assert.assertTrue( comment.getContent().equals( " x " ) );
+
+ xev = characterData = (CharacterData) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.CHARACTER_DATA );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isCharacterData() );
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "bar" ) );
+
+ xev = endElement = (EndElement) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.END_ELEMENT );
+ Assert.assertTrue( xev.hasName() );
+ Assert.assertTrue( xev.isEndElement() );
+ assertName( endElement.getName(), "default.com", "foo", null );
+
+ xev = cpm = (ChangePrefixMapping) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.CHANGE_PREFIX_MAPPING );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isChangePrefixMapping() );
+ Assert.assertTrue( cpm.getPrefix().length() == 0 );
+ Assert.assertTrue( cpm.getOldNamespaceUri().equals( "default.com" ) );
+ Assert.assertTrue( cpm.getNewNamespaceUri().equals( "" ) );
+
+ xev = endDocument = (EndDocument) xis.next();
+ Assert.assertTrue( xev.getType() == XMLEvent.END_DOCUMENT );
+ Assert.assertTrue( !xev.hasName() );
+ Assert.assertTrue( xev.isEndDocument() );
+
+ xev = xis.next();
+ Assert.assertTrue( xev == null );
+
+ //
+ // Test ChangePrefixMapping event
+ //
+
+ o = XmlObject.Factory.parse( "<foo xmlns:x=\"y\"><bar xmlns:x=\"z\"/></foo>" );
+ c = o.newCursor();
+ xis = c.newXMLInputStream();
+
+ startDocument = (StartDocument) xis.next();
+
+ startPrefixMapping = (StartPrefixMapping) xis.next();
+ str = startPrefixMapping.getNamespaceUri();
+ Assert.assertTrue( str.equals( "y" ) );
+ Assert.assertTrue( startPrefixMapping.getPrefix().equals( "x" ) );
+
+ startElement = (StartElement) xis.next();
+
+ startPrefixMapping = (StartPrefixMapping) xis.next();
+ str = startPrefixMapping.getNamespaceUri();
+ Assert.assertTrue( str.equals( "z" ) );
+ Assert.assertTrue( startPrefixMapping.getPrefix().equals( "x" ) );
+
+ startElement = (StartElement) xis.next();
+
+ endElement = (EndElement) xis.next();
+
+ cpm = (ChangePrefixMapping) xis.next();
+ str = cpm.getOldNamespaceUri();
+ Assert.assertTrue( str.equals( "z" ) );
+ str = cpm.getNewNamespaceUri();
+ Assert.assertTrue( str.equals( "y" ) );
+ str = cpm.getPrefix();
+ Assert.assertTrue( str.equals( "x" ) );
+
+ endElement = (EndElement) xis.next();
+
+ endPrefixMapping = (EndPrefixMapping) xis.next();
+ Assert.assertTrue( endPrefixMapping.getPrefix().equals( "x" ) );
+
+ endDocument = (EndDocument) xis.next();
+
+ xev = xis.next();
+ Assert.assertTrue( xev == null );
+
+ //
+ // Test CharacterData events
+ //
+
+ o = XmlObject.Factory.parse( "<foo>a<bar>b<baz>c</baz>d</bar>e</foo>" );
+ c = o.newCursor();
+ xis = c.newXMLInputStream();
+
+ startDocument = (StartDocument) xis.next();
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "a" ) );
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "b" ) );
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "c" ) );
+
+ endElement = (EndElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "d" ) );
+
+ endElement = (EndElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "e" ) );
+
+ endElement = (EndElement) xis.next();
+
+ endDocument = (EndDocument) xis.next();
+
+ xev = xis.next();
+ Assert.assertTrue( xev == null );
+
+ //
+ // Test SubStreams
+ //
+
+ o = XmlObject.Factory.parse( "<foo>a<bar>b<baz>c</baz>d</bar>e</foo>" );
+ c = o.newCursor();
+ xis = c.newXMLInputStream();
+
+ startDocument = (StartDocument) xis.next();
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "a" ) );
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "b" ) );
+
+ XMLInputStream xis2 = xis.getSubStream();
+
+ startElement = (StartElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "c" ) );
+
+ endElement = (EndElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "d" ) );
+
+ startElement = (StartElement) xis2.next();
+
+ characterData = (CharacterData) xis2.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "c" ) );
+
+ endElement = (EndElement) xis2.next();
+
+ xev = xis2.next();
+ Assert.assertTrue( xev == null );
+
+ endElement = (EndElement) xis.next();
+
+ characterData = (CharacterData) xis.next();
+ Assert.assertTrue( characterData.hasContent() );
+ Assert.assertTrue( characterData.getContent().equals( "e" ) );
+
+ endElement = (EndElement) xis.next();
+
+ endDocument = (EndDocument) xis.next();
+
+ xev = xis.next();
+ Assert.assertTrue( xev == null );
+ }
+
+ private XmlCursor navDoc ( XmlObject x, String dirs )
+ {
+ return navCursor( x.newCursor(), dirs );
+ }
+
+ private XmlCursor navNewCursor ( XmlCursor c, String dirs )
+ {
+ return navCursor( c.newCursor(), dirs );
+ }
+
+ //
+ // Format:
+ //
+ // ( [-][N] type ) *
+ //
+ // type:
+ //
+ // c - character
+ // t - token
+ // p - parent element
+ // s - sibling element
+ // d - descendent (child) element
+ // r - end of the doc (root)
+ // b - begin of the doc
+ //
+
+ private XmlCursor navCursor ( XmlCursor c, String dirs )
+ {
+ int n = 0;
+ boolean prev = false;
+
+ for ( int i = 0 ; i < dirs.length() ; i++ )
+ {
+ char ch = dirs.charAt( i );
+
+ if (ch == '-')
+ {
+ prev = ! prev;
+ continue;
+ }
+ else if (ch >= '0' && ch <= '9')
+ {
+ n = n * 10 + (ch - '0');
+ continue;
+ }
+
+ if (n == 0)
+ n = 1;
+
+ if (ch == 'c')
+ {
+ if (prev)
+ Assert.assertTrue( c.toPrevChar( n ) == n );
+ else
+ Assert.assertTrue( c.toNextChar( n ) == n );
+ }
+ else if (ch == 't')
+ {
+ while ( n-- > 0 )
+ {
+ if (prev)
+ Assert.assertTrue( c.toPrevToken() != TokenType.NONE );
+ else
+ Assert.assertTrue( c.toNextToken() != TokenType.NONE );
+ }
+ }
+ else if (ch == 'p')
+ {
+ Assert.assertTrue( ! prev );
+
+ while ( n-- > 0 )
+ Assert.assertTrue( c.toParent() );
+ }
+ else if (ch == 'r')
+ {
+ Assert.assertTrue( ! prev );
+ Assert.assertTrue( n == 1 );
+
+ c.toEndDoc();
+ }
+ else if (ch == 'b')
+ {
+ Assert.assertTrue( ! prev );
+ Assert.assertTrue( n == 1 );
+
+ c.toStartDoc();
+ }
+ else if (ch == 's')
+ {
+ while ( n-- > 0 )
+ {
+ if (prev)
+ Assert.assertTrue( c.toPrevSibling() );
+ else
+ Assert.assertTrue( c.toNextSibling() );
+ }
+ }
+ else if (ch == 'd')
+ {
+ Assert.assertTrue( ! prev );
+
+ while ( n-- > 0 )
+ Assert.assertTrue( c.toFirstChild() );
+ }
+ else
+ {
+ Assert.assertTrue( false );
+ }
+
+ n = 0;
+ prev = false;
+ }
+
+ return c;
+ }
+
+ public void testOps ( )
+ throws Exception
+ {
+ XmlObject x, x2, y;
+ XmlCursor cFrom, cTo, cTemp, cTemp2, c, d;
+ XmlBookmark anno;
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+ cFrom = navDoc( x, "d" );
+ cTo = navNewCursor( cFrom, "" );
+ Assert.assertTrue( !cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ XmlOptions options = new XmlOptions();
+
+ options.put(
+ XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT,
+ new QName( null, "bar" ) );
+
+ Assert.assertTrue(
+ x.xmlText( options ).equals( "<bar>[FROM][TO]<foo>abcdef</foo></bar>" ) ||
+ x.xmlText( options ).equals( "<bar>[TO][FROM]<foo>abcdef</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+
+ cFrom = navDoc( x, "d" );
+ cTo = navNewCursor( cFrom, "ttt" );
+ Assert.assertTrue( !cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText( options ).equals( "<bar>[FROM]<foo>abcdef</foo>[TO]</bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+
+ cFrom = navDoc( x, "d" );
+ cTo = navNewCursor( cFrom, "t3c" );
+ Assert.assertTrue( !cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText( options ).equals( "<bar>[FROM]<foo>abc[TO]def</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b></r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navNewCursor( cFrom, "r-1t" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<r>[FROM]<b>pqr</b><a>xyz</a>[TO]</r>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navNewCursor( cFrom, "r-1t-1c" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<r>[FROM]<b>pqr</b>A<a>xyz</a>[TO]B</r>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navNewCursor( cFrom, "stc" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<r>[FROM]<b>p<a>xyz</a>[TO]qr</b>AB</r>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navDoc( x, "d" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ testTextFrag( x.xmlText(), "<a>xyz</a>[TO]<r>[FROM]<b>pqr</b>AB</r>" );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navDoc( x, "r" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText( options ).equals( "<bar><r>[FROM]<b>pqr</b>AB</r><a>xyz</a>[TO]</bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a></r>" );
+ x2 = XmlObject.Factory.parse( "<s></s>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navDoc( x2, "dt" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue( x.xmlText().equals( "<r>[FROM]</r>" ) );
+ Assert.assertTrue( x2.xmlText().equals( "<s><a>xyz</a>[TO]</s>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>pq</a><b></b></r>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navDoc( x, "ddst" );
+ cTemp = navDoc( x, "ddt1c" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+ cTemp.insertChars( "[TEMP]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<r>[FROM][TEMP]<b><a>pq</a>[TO]</b></r>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+
+ cFrom = navDoc( x, "2t2c" );
+ cTo = navNewCursor( cFrom, "-1c" );
+ cFrom.moveChars( 2, cTo );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<foo>acd[TO]b[FROM]ef</foo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+
+ cFrom = navDoc( x, "2t2c" );
+ cTo = navNewCursor( cFrom, "3c" );
+ cFrom.moveChars( 2, cTo );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<foo>ab[FROM]ecd[TO]f</foo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<bar><foo>abcdef</foo><foo>123456</foo></bar>" );
+
+ cFrom = navDoc( x, "3t2c" );
+ cTo = navNewCursor( cFrom, "3t3c" );
+ cFrom.moveChars( 2, cTo );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar><foo>ab[FROM]ef</foo><foo>123cd[TO]456</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<bar><foo>abcdef</foo><foo>123456</foo></bar>" );
+
+ cFrom = navDoc( x, "2d" );
+ cTo = navDoc( x, "2dst2c" );
+ Assert.assertTrue( cFrom.copyXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar>[FROM]<foo>abcdef</foo><foo>12" +
+ "<foo>abcdef</foo>[TO]3456</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<r><a>xyz</a></r>" );
+ x2 = XmlObject.Factory.parse( "<s></s>" );
+
+ cFrom = navDoc( x, "dd" );
+ cTo = navDoc( x2, "dt" );
+ Assert.assertTrue( cFrom.copyXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue( x.xmlText().equals( "<r>[FROM]<a>xyz</a></r>" ) );
+ Assert.assertTrue( x2.xmlText().equals( "<s><a>xyz</a>[TO]</s>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse(
+ "<bar><foo>abcdef</foo>blah<foo>123456</foo></bar>" );
+
+ cFrom = navDoc( x, "2d" );
+ cTo = navDoc( x, "2dst2c" );
+ Assert.assertTrue( cFrom.copyXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar>[FROM]<foo>abcdef</foo>blah<foo>12" +
+ "<foo>abcdef</foo>[TO]3456</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse(
+ "<bar><foo x='y'>abcdef</foo><foo>123456</foo>7890</bar>" );
+
+ cFrom = navDoc( x, "2dt" );
+ cTo = navDoc( x, "2dst" );
+ cTemp = navDoc( x, "2dst3c" );
+ cTemp2 = navDoc( x, "2ds3t2c" );
+ Assert.assertTrue( cFrom.copyXml( cTo ) );
+ cTemp.insertChars( "[TEMP]" );
+ cTemp2.insertChars( "[TEMP2]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar><foo x=\"y\">abcdef</foo>" +
+ "<foo x=\"y\">123[TEMP]456</foo>78[TEMP2]90</bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse(
+ "<bar>xy<foo x='y'>abcdef</foo>pqr<foo>123456</foo></bar>" );
+
+ cFrom = navDoc( x, "2d" );
+ cTo = navDoc( x, "2ds-2c" );
+
+ Assert.assertTrue( cFrom.removeXml() );
+
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar>xy[FROM]p[TO]qr<foo>123456</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse(
+ "<bar>xy<foo x='y'>abcdef</foo>pqr<foo>123456</foo></bar>" );
+
+ cFrom = navDoc( x, "2d2t2c" );
+ cTo = navDoc( x, "2d2t5c" );
+
+ cFrom.removeChars( 2 );
+
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue(
+ x.xmlText().equals(
+ "<bar>xy<foo x=\"y\">ab[FROM]e[TO]f" +
+ "</foo>pqr<foo>123456</foo></bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<bar><!---->abc</bar>" );
+
+ cFrom = navDoc( x, "tt" );
+ cTo = navDoc( x, "tttc" );
+
+ Assert.assertTrue( cFrom.removeXml() );
+
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+
+ Assert.assertTrue( x.xmlText().equals( "<bar>[FROM]a[TO]bc</bar>" ) );
+
+ //
+
+ x = XmlObject.Factory.newInstance();
+
+ cTo = navDoc( x, "t" );
+ cTo.insertElement( "boo" );
+ cTo.toPrevToken();
+ cTo.insertElement( "moo" );
+ cTo.toPrevToken();
+ cTo.insertElement( "goo" );
+
+ Assert.assertTrue( x.xmlText().equals(
+ "<boo><moo><goo/></moo></boo>" ) );
+
+ //
+
+ x = XmlObject.Factory.newInstance();
+
+ cTo = navDoc( x, "t" );
+ cTo.insertElement( "boo" );
+ cTo.toPrevToken();
+ cTo.insertElement( "moo" );
+ cTo.toPrevToken();
+ cTo.insertAttributeWithValue( "x", "y" );
+
+ Assert.assertTrue( x.xmlText().equals(
+ "<boo><moo x=\"y\"/></boo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<bar x='y'>abc</bar>" );
+ cTo = navDoc( x, "tt" );
+ cTo.insertAttributeWithValue( "p", "q" );
+
+ Assert.assertTrue( x.xmlText().equals(
+ "<bar p=\"q\" x=\"y\">abc</bar>" ) );
+
+ // Text XmlBookmark
+
+ x = XmlObject.Factory.parse( "<r><foo>abc</foo><bar></bar></r>" );
+ cFrom = navDoc( x, "tt" );
+ anno = new Anno();
+ cFrom.setBookmark( anno );
+ cTo = navDoc( x, "6t" );
+ Assert.assertTrue( cFrom.moveXml( cTo ) );
+ cFrom.insertChars( "[FROM]" );
+ cTo.insertChars( "[TO]" );
+ anno.createCursor().insertChars( "[ANNO]" );
+
+ Assert.assertTrue( x.xmlText().equals(
+ "<r>[FROM]<bar>[ANNO]<foo>abc</foo>[TO]</bar></r>" ) );
+
+ // Test content ops
+
+ x = XmlObject.Factory.parse( "<foo x='y'>abc</foo>" );
+ y = XmlObject.Factory.newInstance();
+ d = y.newCursor();
+ d.toNextToken();
+ x.newCursor().moveXmlContents( d );
+ Assert.assertTrue( y.xmlText().equals( "<foo x=\"y\">abc</foo>" ) );
+
+ x = XmlObject.Factory.parse( "<bar><foo x='y'>abc</foo></bar>" );
+ y = XmlObject.Factory.newInstance();
+ c = x.newCursor();
+ c.toNextToken();
+ d = y.newCursor();
+ d.toNextToken();
+ c.moveXmlContents( d );
+ Assert.assertTrue( y.xmlText().equals( "<foo x=\"y\">abc</foo>" ) );
+
+ x = XmlObject.Factory.parse( "<bar><foo x='y'>abc</foo></bar>" );
+ c = x.newCursor();
+ c.toNextToken();
+ c.removeXmlContents();
+ Assert.assertTrue( x.xmlText().equals( "<bar/>" ) );
+
+ x = XmlObject.Factory.parse( "<foo x='y'>abc</foo>" );
+ y = XmlObject.Factory.newInstance();
+ d = y.newCursor();
+ d.toNextToken();
+ x.newCursor().copyXmlContents( d );
+ Assert.assertTrue( y.xmlText().equals( "<foo x=\"y\">abc</foo>" ) );
+ }
+
+ public static class Anno extends XmlBookmark
+ {
+ }
+
+ public void testSave ( )
+ throws Exception
+ {
+ XmlObject x;
+ XmlCursor cTo;
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
+
+ Assert.assertTrue( x.xmlText().equals( "<foo>abcdef</foo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo>a<b&c</foo>" );
+
+ Assert.assertTrue( x.xmlText().equals( "<foo>a<b&c</foo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo></foo>" );
+
+ cTo = navDoc( x, "dt" );
+ cTo.insertChars( "&<" );
+
+ Assert.assertTrue( x.xmlText().equals( "<foo>&<</foo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo><boo>bar</boo></foo>" );
+
+ cTo = navDoc( x, "dt" );
+
+ Assert.assertTrue( cTo.xmlText().equals( "<boo>bar</boo>" ) );
+
+ //
+
+ x = XmlObject.Factory.parse( "<foo><boo x=\"y\">bar</boo></foo>" );
+
+ cTo = navDoc( x, "dt" );
+
+ Assert.assertTrue( cTo.xmlText().equals( "<boo x=\"y\">bar</boo>" ) );
+
+ // Tests fragment saving and loading
+
+ x = XmlObject.Factory.parse( "<foo>Eric</foo>" );
+
+ cTo = navDoc( x, "dt" );
+
+ x = XmlObject.Factory.parse( cTo.xmlText() );
+
+ cTo = navDoc( x, "" );
+
+ Assert.assertTrue( cTo.getTextValue().equals( "Eric" ) );
+
+ // test save where I replace the name of an element
+
+ x = XmlObject.Factory.parse( "<foo>Eric</foo>" );
+
+ cTo = navDoc( x, "d" );
+
+ XmlOptions options = new XmlOptions();
+
+ options.put(
+ XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT,
+ new QName( null, "bar" ) );
+
+ x = XmlObject.Factory.parse( cTo.xmlText( options ) );
+
+ cTo = navDoc( x, "" );
+
+ Assert.assertTrue( cTo.xmlText().equals( "<bar>Eric</bar>" ) );
+
+ // test save where I replace the name of the document
+
+ x = XmlObject.Factory.parse( "<foo>Eric</foo>" );
+
+ cTo = navDoc( x, "" );
+
+ options = new XmlOptions();
+
+ options.put(
+ XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT,
+ new QName( null, "bar" ) );
+
+ x = XmlObject.Factory.parse( cTo.xmlText( options ) );
+
+ cTo = navDoc( x, "" );
+
+ Assert.assertTrue(
+ cTo.xmlText().equals( "<bar><foo>Eric</foo></bar>" ) );
+
+ //
+ //
+ //
+
+ x = XmlObject.Factory.parse( "<a xmlns='foo'/>" );
+
+ XmlCursor c = x.newCursor();
+
+ c.toFirstContentToken();
+ c.toFirstContentToken();
+
+ c.insertElement( "b" );
+ c.toPrevSibling();
+ Assert.assertTrue( c.getName().getLocalPart().equals( "b" ) );
+ Assert.assertTrue( c.getName().getNamespaceURI().length() == 0 );
+
+ x = XmlObject.Factory.parse( x.xmlText() );
+
+ c = x.newCursor();
+
+ c.toFirstContentToken();
+ c.toFirstContentToken();
+
+ Assert.assertTrue( c.getName().getLocalPart().equals( "b" ) );
+ Assert.assertTrue( c.getName().getNamespaceURI().length() == 0 );
+ }
+
+ private void testTextFrag ( String actual, String expected )
+ {
+ String pre = "<xml-fragment>";
+
+ String post = "</xml-fragment>";
+
+ Assert.assertTrue( actual.startsWith( pre ) );
+ Assert.assertTrue( actual.endsWith( post ) );
+
+ Assert.assertTrue(
+ expected.equals(
+ actual.substring(
+ pre.length(), actual.length() - post.length() ) ) );
+ }
+
+ public void testSaveFrag ( )
+ throws Exception
+ {
+ XmlObject x;
+ XmlCursor c;
+
+ x = XmlObject.Factory.newInstance();
+
+ c = x.newCursor();
+
+ c.toNextToken();
+
+ c.insertChars( "Eric" );
+
+ testTextFrag( x.xmlText(), "Eric" );
+
+ //
+
+ x = XmlObject.Factory.newInstance();
+
+ c = x.newCursor();
+
+ c.toNextToken();
+
+ c.insertComment( "" );
+ c.insertChars( "x" );
+
+ testTextFrag( x.xmlText(), "<!---->x" );
+
+ //
+
+ x = XmlObject.Factory.newInstance();
+
+ c = x.newCursor();
+
+ c.toNextToken();
+
+ c.insertElement( "foo" );
+ c.insertChars( "x" );
+
+ testTextFrag( x.xmlText(), "<foo/>x" );
+
+ //
+
+ x = XmlObject.Factory.newInstance();
+
+ c = x.newCursor();
+
+ c.toNextToken();
+
+ c.insertElement( "foo" );
+ c.insertElement( "bar" );
+
+ testTextFrag( x.xmlText(), "<foo/><bar/>" );
+ }
+
+ public void testLoad ( )
+ throws Exception
+ {
+ XmlObject x;
+
+ XmlOptions options = new XmlOptions();
+
+ options.put( XmlOptions.LOAD_REPLACE_DOCUMENT_ELEMENT, null );
+
+ x =
+ XmlObject.Factory.parse(
+ "<bar p='q' x='y'>ab<foo>xy</foo>cd</bar>", options );
+
+ XmlCursor c = navDoc( x, "t" );
+
+ assertTrue( c.currentTokenType() == TokenType.ATTR );
+
+ String open = "xmlns:open='http://www.openuri.org/fragment'";
+
+ x =
+ XmlObject.Factory.parse(
+ "<open:fragment p='q' x='y' " + open +
+ ">ab<foo>xy</foo>cd</open:fragment>" );
+
+ c = navDoc( x, "t" );
+
+ assertTrue( c.currentTokenType() == TokenType.ATTR );
+ }
+
+ public void testCompare ( )
+ throws Exception
+ {
+ XmlObject x;
+ XmlCursor cFrom, cTo;
+
+ // Forward navigation
+
+ x = XmlObject.Factory.parse( "<bar p='q' x='y'>ab<foo>xy</foo>cd</bar>" );
+
+ cFrom = navDoc( x, "" );
+ cTo = navDoc( x, "" );
+
+ for ( ; ; )
+ {
+ Assert.assertTrue( cFrom.comparePosition( cTo ) == 0 );
+ Assert.assertTrue( cFrom.isAtSamePositionAs( cTo ) );
+
+ TokenType tt = cFrom.currentTokenType();
+
+ if (tt == TokenType.ENDDOC)
+ {
+ break;
+ }
+ else if (tt == TokenType.TEXT)
+ {
+ cFrom.toNextChar( 1 );
+ cTo.toNextChar( 1 );
+ }
+ else
+ {
+ cFrom.toNextToken();
+ cTo.toNextToken();
+ }
+ }
+
+ // Backward navigation
+
+ x = XmlObject.Factory.parse( "<bar p='q' x='y'>ab<foo>xy</foo>cd</bar>" );
+
+ cFrom = navDoc( x, "r" );
+ cTo = navDoc( x, "r" );
+
+ for ( ; ; )
+ {
+ Assert.assertTrue( cFrom.comparePosition( cTo ) == 0 );
+ Assert.assertTrue( cFrom.isAtSamePositionAs( cTo ) );
+
+ if (cFrom.toPrevChar( 1 ) == 1)
+ cTo.toPrevChar( 1 );
+ else if (cFrom.toPrevToken() != TokenType.NONE)
+ cTo.toPrevToken();
+ else
+ break;
+ }
+
+ //
+
+ x = XmlObject.Factory.parse(
+ "<bar p='q' x='y'>ab<foo>xy</foo>c<f y='x'>xy</f>d</bar>" );
+
+ cFrom = navDoc( x, "" );
+
+ for ( ; ; )
+ {
+ boolean passed = false;
+
+ cTo = navDoc( x, "" );
+
+ for ( ; ; )
+ {
+ if (cTo.isAtSamePositionAs( cFrom ))
+ {
+ Assert.assertTrue( !passed );
+ passed = true;
+ }
+ else if (cTo.isLeftOf( cFrom ))
+ {
+ Assert.assertTrue( !passed );
+ }
+ else
+ {
+ Assert.assertTrue( passed );
+ Assert.assertTrue( cTo.isRightOf( cFrom ) );
+ }
+
+ if (cTo.toNextChar( 1 ) != 1)
+ if (cTo.toNextToken() == TokenType.ENDDOC)
+ break;
+ }
+
+ if (cFrom.toNextChar( 1 ) != 1)
+ if (cFrom.toNextToken() == TokenType.ENDDOC)
+ break;
+ }
+ }
+
+ static class MyAnno extends XmlBookmark
+ {
+ }
+
+ public void testAnnotation ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo/>" );
+ XmlCursor c = x.newCursor();
+ c.toNextToken();
+ MyAnno a = new MyAnno();
+ c.setBookmark( a );
+ Assert.assertTrue( c.removeXml() );
+ XmlCursor c2 = a.createCursor();
+ Assert.assertTrue( c2 == null );
+ }
+
+ public void testAttrSetter ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo/>" );
+ XmlCursor c = x.newCursor();
+ c.toNextToken();
+ c.setAttributeText( new QName( null, "x" ), "hardehar" );
+ Assert.assertTrue( x.xmlText().equals( "<foo x=\"hardehar\"/>" ) );
+ }
+
+ public void testNavigation ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<a><x/><y/><z/></a>" );
+ XmlCursor c = x.newCursor();
+ Assert.assertTrue( c.toNextSibling() == false );
+ Assert.assertTrue( c.toPrevSibling() == false );
+ Assert.assertTrue( c.toFirstAttribute() == false );
+ Assert.assertTrue( c.toLastAttribute() == false );
+ c.toNextToken();
+ c.toNextToken();
+ Assert.assertTrue( c.toNextSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "y" ) );
+ Assert.assertTrue( c.toNextSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "z" ) );
+ Assert.assertTrue( c.toNextSibling() == false );
+
+ x = XmlObject.Factory.parse( "<a p='q' m='n'><x/><y/><z/></a>" );
+ c = x.newCursor();
+ c.toNextToken();
+ c.toNextToken();
+ Assert.assertTrue( c.currentTokenType().isAttr() );
+ Assert.assertTrue( c.toPrevSibling() == false );
+ Assert.assertTrue( c.currentTokenType().isAttr() );
+ Assert.assertTrue( c.toNextSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "x" ) );
+
+ c.toEndDoc();
+ c.toPrevToken();
+ Assert.assertTrue( c.toPrevSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "z" ) );
+ Assert.assertTrue( c.toPrevSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "y" ) );
+ Assert.assertTrue( c.toPrevSibling() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "x" ) );
+ Assert.assertTrue( c.toPrevSibling() == false );
+
+ c.toEndDoc();
+ c.toPrevToken();
+ Assert.assertTrue( c.toParent() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
+
+ c.toEndDoc();
+ Assert.assertTrue( c.toParent() == true );
+ Assert.assertTrue( c.currentTokenType().isStartdoc() );
+
+ x = XmlObject.Factory.parse( "<a>moo<!---->foo</a>" );
+ c = x.newCursor();
+ c.toStartDoc();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ Assert.assertTrue( c.toParent() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
+
+ c.toStartDoc();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ Assert.assertTrue( c.toParent() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
+
+ c.toStartDoc();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextChar( 2 );
+ Assert.assertTrue( c.toParent() == true );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
+
+ x = XmlObject.Factory.parse( "<foo>early<bar>text<char>zap</char></bar></foo>" );
+ c = x.newCursor();
+ c.toNextToken();
+ c.toNextToken();
+ Assert.assertTrue( c.toFirstChild() == true );
+ Assert.assertTrue( c.getTextValue().equals( "zap" ) );
+ }
+
+ public void testGetName ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<a x='y'>eric<!----><?moo?></a>" );
+ XmlCursor c = x.newCursor();
+ Assert.assertTrue( c.getName() == null );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "a" ) );
+ Assert.assertTrue( c.getName().getNamespaceURI().length() == 0 );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "x" ) );
+ Assert.assertTrue( c.getName().getNamespaceURI().length() == 0 );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName() == null );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName() == null );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName().getLocalPart().equals( "moo" ) );
+ Assert.assertTrue( c.getName().getNamespaceURI().length() == 0 );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName() == null );
+ Assert.assertTrue( !c.toNextToken().isNone() );
+ Assert.assertTrue( c.getName() == null );
+ Assert.assertTrue( c.toNextToken().isNone() );
+ }
+
+ public void testGetChars ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<foo>abcdefghijkl</foo>" );
+ XmlCursor c = x.newCursor();
+ c.toNextToken();
+ c.toNextToken();
+ c.toNextChar( 2 );
+
+ char[] buf = new char[ 3 ];
+ int n = c.getChars( buf, 0, 400 );
+
+ Assert.assertTrue( n == 3 );
+ Assert.assertTrue( buf[0] == 'c' );
+ Assert.assertTrue( buf[1] == 'd' );
+ Assert.assertTrue( buf[2] == 'e' );
+ }
+
+ public void testNamespaceSubstitution ( )
+ throws Exception
+ {
+ HashMap subs = new HashMap();
+ subs.put( "foo", "moo" );
+ subs.put( "a", "b" );
+
+ XmlOptions options = new XmlOptions();
+ options.put( XmlOptions.LOAD_SUBSTITUTE_NAMESPACES, subs );
+
+ XmlObject x =
+ XmlObject.Factory.parse(
+ "<a xmlns='foo' xmlns:a='a' a:x='y'/>",
+ options );
+
+ XmlCursor c = x.newCursor();
+
+ c.toNextToken();
+ Assert.assertTrue( c.getName().getNamespaceURI().equals( "moo" ) );
+
+ c.toNextToken();
+ Assert.assertTrue( c.getName().getNamespaceURI().equals( "moo" ) );
+
+ c.toNextToken();
+ Assert.assertTrue( c.getName().getNamespaceURI().equals( "b" ) );
+
+ c.toNextToken();
+ Assert.assertTrue( c.getName().getNamespaceURI().equals( "b" ) );
+ }
+
+ public void testNamespaceInsertion ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.newInstance();
+
+ XmlCursor c = x.newCursor();
+
+ c.toNextToken();
+ c.insertElement( "foo", "http://p.com" );
+ c.toPrevToken();
+ c.insertNamespace( "p", "http://p.com" );
+
+ Assert.assertTrue(
+ x.xmlText().equals( "<p:foo xmlns:p=\"http://p.com\"/>" ) );
+ }
+
+ private void dotestParser ( String xml, String xmlResult )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( xml );
+ String result = x.xmlText();
+ Assert.assertTrue( xmlResult.equals( result ) );
+ }
+
+ private void dotestParserErrors ( String xml )
+ {
+ try
+ {
+ XmlObject.Factory.parse( xml );
+ }
+ catch ( Throwable t )
+ {
+ return;
+ }
+
+ Assert.assertTrue( false );
+ }
+
+ public void testNil ( )
+ throws Exception
+ {
+ XmlObject x = noNamespace.CanBeNilDocument.Factory.parse( "<canBeNil/>" );
+ XmlCursor c = x.newCursor();
+ c.toFirstChild();
+ XmlObject fc = c.getObject();
+ Assert.assertTrue( ! fc.isNil() );
+ fc.setNil();
+ Assert.assertTrue( fc.isNil() );
+ Assert.assertTrue( x.xmlText().equals( "<canBeNil xsi:nil=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>" ) );
+ c.toNextToken();
+ Assert.assertTrue( c.isAttr() );
+ c.removeXml();
+ Assert.assertTrue( x.xmlText().equals( "<canBeNil/>" ) );
+ Assert.assertTrue( ! fc.isNil() );
+ }
+
+
+ public void testParser ( )
+ throws Exception
+ {
+ dotestParserErrors( "<hee yee='five'><haw>66</haw></any>" );
+ dotestParserErrors( "<foo></moo>" );
+ dotestParserErrors( "<a><foo></moo></a>" );
+ dotestParserErrors( "" );
+ dotestParserErrors( " " );
+
+ dotestParserErrors( "har" );
+ dotestParserErrors( "<!-- comment -->" );
+ dotestParserErrors( "<?moo?>" );
+ dotestParserErrors( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
+ dotestParserErrors( "<a$/>" );
+ dotestParserErrors( "<foo a='<'></foo>" );
+ dotestParserErrors( "<foo a></foo>" );
+ dotestParserErrors( "<foo>" );
+ dotestParserErrors( "</foo>" );
+// Fix the parser to make these work
+// dotestParserErrors( "<foo><!-- -- --></foo>" );
+// dotestParserErrors( "<foo><!-- ---></foo>" );
+
+ dotestParser( "<a b=\"x\n\ny\"/>", "<a b=\"x y\"/>" );
+ }
+
+ public void testSaxParser ( )
+ throws Exception
+ {
+ String xml = "<a x='y'><!---->x<b/><c p='q'>z</c></a>";
+
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+ XMLReader xr = sp.getXMLReader();
+ InputSource is = new InputSource( new StringReader( xml ) );
+ XmlSaxHandler sh = XmlObject.Factory.newXmlSaxHandler();
+
+ xr.setFeature(
+ "http://xml.org/sax/features/namespace-prefixes",
+ true );
+
+ xr.setFeature(
+ "http://xml.org/sax/features/namespaces", true );
+
+ xr.setFeature(
+ "http://xml.org/sax/features/validation", false );
+
+ xr.setContentHandler( sh.getContentHandler() );
+
+ xr.setProperty(
+ "http://xml.org/sax/properties/lexical-handler",
+ sh.getLexicalHandler() );
+
+ xr.parse( is );
+
+ XmlObject x1 = sh.getObject();
+
+ XmlObject x2 = XmlObject.Factory.parse( xml );
+
+ Assert.assertTrue( x1.xmlText().equals( x2.xmlText() ) );
+ }
+
+ public void testAdditionalNamespaces()
+ throws Exception
+ {
+ String xml = "<a xmlns:a='aNS'><a:b/></a>";
+
+ Map map = new java.util.LinkedHashMap();
+ map.put("b", "bNS");
+ map.put("c", "cNS");
+ map.put("a", "not-aNS");
+
+ XmlOptions options = new XmlOptions();
+ options.setLoadAdditionalNamespaces(map);
+
+ XmlObject x = XmlObject.Factory.parse(xml, options);
+
+ // 'a' prefix namespace is not remapped
+ String expect = "<a xmlns:c=\"cNS\" xmlns:b=\"bNS\" xmlns:a=\"aNS\"><a:b/></a>";
+ Assert.assertEquals( expect, x.xmlText() );
+
+ xml = "<a xmlns='aNS'><b/></a>";
+
+ map = new java.util.LinkedHashMap();
+ map.put("b", "bNS");
+ map.put("c", "cNS");
+ map.put("", "not-aNS");
+
+ options = new XmlOptions();
+ options.setLoadAdditionalNamespaces(map);
+
+ x = XmlObject.Factory.parse(xml, options);
+
+ // default namespace is not remapped
+ expect = "<a xmlns:c=\"cNS\" xmlns:b=\"bNS\" xmlns=\"aNS\"><b/></a>";
+ Assert.assertEquals( expect, x.xmlText() );
+
+ }
+
+ public void testCR135193()
+ throws Exception
+ {
+ String xml = "<a xmlns='aNS' xmlns:b='bNS'><b><c/></b></a>";
+
+ XmlObject x = XmlObject.Factory.parse(xml);
+
+ // get an XMLInputStream and move to XMLEvent.START_ELEMENT for 'b'
+ XmlCursor c = x.newCursor();
+ XMLInputStream xis = c.newXMLInputStream();
+ c.dispose();
+ while (xis.hasNext() && xis.next().getType() != XMLEvent.START_ELEMENT) {
+ }
+
+ // reparse from 'b' element using an sub-XMLInputStream
+ XMLInputStream xis1 = xis.getSubStream();
+ XmlObject x1 = XmlObject.Factory.parse(xis1);
+
+ // CR135193: namespaces including default are set on the 'b' child
+ String expect = "<b xmlns=\"aNS\" xmlns:b=\"bNS\"><c/></b>";
+ Assert.assertEquals( expect, x1.xmlText() );
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/SubstGroupTests.java b/v1/test/src/drt/drtcases/SubstGroupTests.java
new file mode 100644
index 0000000..7fd98d8
--- /dev/null
+++ b/v1/test/src/drt/drtcases/SubstGroupTests.java
@@ -0,0 +1,248 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlNormalizedString;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlString;
+import org.apache.xmlbeans.XmlToken;
+import org.openuri.sgs.ADocument;
+import org.openuri.sgs.BDocument;
+import org.openuri.sgs.CDocument;
+import org.openuri.sgs.RootDocument;
+import org.w3.x2001.xmlSchema.SchemaDocument;
+
+public class SubstGroupTests extends TestCase
+{
+ public SubstGroupTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(SubstGroupTests.class); }
+
+ public void test1() throws Exception {
+ String xml1 = "<root xmlns='http://openuri.org/sgs'>" +
+ "<A>\ta\ta\t</A>" +
+ "<B>\tb\tb\t</B>" +
+ "<C>\tc\tc\t</C>" +
+ "</root>";
+
+
+ RootDocument doc1 = RootDocument.Factory.parse(xml1);
+ RootDocument.Root root = doc1.getRoot();
+ assertTrue(doc1.validate());
+
+ XmlString a = root.xgetAArray(0);
+ assertTrue(a.schemaType().equals(XmlString.type));
+ assertEquals("\ta\ta\t", a.stringValue());
+
+ XmlString b = root.xgetAArray(1);
+ assertTrue(b.schemaType().equals(XmlNormalizedString.type));
+ assertEquals(" b b ", b.stringValue());
+
+ XmlString c = root.xgetAArray(2);
+ assertTrue(c.schemaType().equals(XmlToken.type));
+ assertEquals("c c", c.stringValue());
+
+ root.insertA(2, "d d");
+ assertEquals("d d", root.getAArray(2));
+ assertEquals(4, root.sizeOfAArray());
+ root.removeA(2);
+
+ root.removeA(1);
+ assertEquals("c c", root.getAArray(1));
+ assertEquals(2, root.sizeOfAArray());
+
+ root.addA("f f");
+ assertEquals(3, root.sizeOfAArray());
+ assertEquals("f f", root.getAArray(2));
+
+ // Test array setters
+
+ // test m < n case
+ String[] smaller = new String[]{ "x", "y" };
+ root.setAArray(smaller);
+ assertEquals(2, root.sizeOfAArray());
+ assertEquals("y", root.getAArray(1));
+
+ // test m > n case
+ String[] larger = new String[] { "p", "q", "r", "s" };
+ root.setAArray(larger);
+ assertEquals(4, root.sizeOfAArray());
+ assertEquals("r", root.getAArray(2));
+ }
+
+ public void test2() throws Exception {
+ String xml1 = "<A xmlns='http://openuri.org/sgs'>\ta\ta\t</A>";
+ String xml2 = "<B xmlns='http://openuri.org/sgs'>\tb\tb\t</B>";
+ String xml3 = "<C xmlns='http://openuri.org/sgs'>\tc\tc\t</C>";
+
+ ADocument d1 = ADocument.Factory.parse(xml1);
+ XmlString a = d1.xgetA();
+ assertTrue(a.schemaType().equals(XmlString.type));
+ assertEquals("\ta\ta\t", a.stringValue());
+
+ ADocument d2 = ADocument.Factory.parse(xml2);
+ XmlString b = d2.xgetA();
+ assertTrue(d2.schemaType().equals(BDocument.type));
+ assertTrue(b.schemaType().equals(XmlNormalizedString.type));
+ assertEquals(" b b ", b.stringValue());
+
+ ADocument d3 = ADocument.Factory.parse(xml3);
+ XmlString c = d3.xgetA();
+ assertTrue(d3.schemaType().equals(CDocument.type));
+ assertTrue(c.schemaType().equals(XmlToken.type));
+ assertEquals("c c", c.stringValue());
+ }
+
+ public static final String[] invalidSchemas =
+ {
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:string'/> " +
+ " <xsd:element name='B' type='xsd:int' substitutionGroup='A'/> " +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:complexType name='foo'> " +
+ " <xsd:sequence> " +
+ " <xsd:element name='bar' substitutionGroup='A'/>" +
+ " </xsd:sequence> " +
+ " </xsd:complexType>" +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:string' final='#all'/> " +
+ " <xsd:element name='B' type='xsd:string' substitutionGroup='A'/> " +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:string' final='restriction'/> " +
+ " <xsd:element name='B' type='xsd:token' substitutionGroup='A'/> " +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:string' substitutionGroup='B'/> " +
+ " <xsd:element name='B' type='xsd:string' substitutionGroup='C'/> " +
+ " <xsd:element name='C' type='xsd:string' substitutionGroup='D'/> " +
+ " <xsd:element name='D' type='xsd:string' substitutionGroup='E'/> " +
+ " <xsd:element name='E' type='xsd:string' substitutionGroup='A'/> " +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:token' substitutionGroup='B'/> " +
+ "</xsd:schema>",
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> " +
+ " <xsd:element name='A' type='xsd:string'/> " +
+ " <xsd:element name='B' type='xsd:string' substitutionGroup='A'/> " +
+ " <xsd:element name='Complex'> " +
+ " <xsd:complexType> " +
+ " <xsd:choice> " +
+ " <xsd:element ref='A'/>" +
+ " <xsd:element ref='B'/>" +
+ " </xsd:choice> " +
+ " </xsd:complexType> " +
+ " </xsd:element> " +
+ "</xsd:schema>",
+ };
+
+ public static final String[] validSchemas =
+ {
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
+ " <xsd:complexType name='base'>" +
+ " <xsd:all>" +
+ " <xsd:element ref='head'/>" +
+ " </xsd:all>" +
+ " </xsd:complexType>" +
+ " <xsd:complexType name='restr'>" +
+ " <xsd:complexContent>" +
+ " <xsd:restriction base='base'>" +
+ " <xsd:all>" +
+ " <xsd:element ref='tail'/>" +
+ " </xsd:all>" +
+ " </xsd:restriction>" +
+ " </xsd:complexContent>" +
+ " </xsd:complexType>" +
+ " <xsd:element name='head' type='xsd:string'/>" +
+ " <xsd:element name='tail' substitutionGroup='head'/>" +
+ "</xsd:schema>",
+ };
+
+ public void test3() throws Exception {
+ SchemaDocument[] schemas = new SchemaDocument[invalidSchemas.length];
+
+ // Parse the invalid schema files
+ for (int i = 0 ; i < invalidSchemas.length ; i++)
+ schemas[i] = SchemaDocument.Factory.parse(invalidSchemas[i]);
+
+ // Now compile the invalid schemas, test that they fail
+ for (int i = 0 ; i < schemas.length ; i++)
+ {
+ try {
+ XmlBeans.loadXsd(new XmlObject[] {schemas[i]});
+ fail("Schema should have failed to compile:\n" + invalidSchemas[i]);
+ }
+ catch (XmlException success) { /* System.out.println(success); */ }
+ }
+
+
+ // Parse the valid schema files
+ schemas = new SchemaDocument[validSchemas.length];
+ for (int i = 0 ; i < validSchemas.length ; i++)
+ schemas[i] = SchemaDocument.Factory.parse(validSchemas[i]);
+
+ // Now compile the valid schemas, test that they succeed
+ for (int i = 0 ; i < schemas.length ; i++)
+ {
+ try {
+ XmlBeans.loadXsd(new XmlObject[] {schemas[i]});
+ }
+ catch (XmlException fail)
+ {
+ fail("Failed to compile schema: " + schemas[i] + " with error: " + fail);
+ }
+ }
+ }
+
+ public static String[] invalidDocs =
+ {
+ "<abstractTest xmlns='http://openuri.org/sgs'>" +
+ " <abstract>content</abstract> " +
+ "</abstractTest> ",
+ };
+
+ public static String[] validDocs =
+ {
+ "<abstractTest xmlns='http://openuri.org/sgs'>" +
+ " <concrete>content</concrete> " +
+ "</abstractTest> ",
+ };
+
+ public void test4() throws Exception
+ {
+
+ for (int i = 0 ; i < invalidDocs.length ; i++)
+ {
+ XmlObject xo = XmlObject.Factory.parse(invalidDocs[i]);
+ assertTrue("Doc was valid. Should be invalid: " + invalidDocs[i],
+ ! xo.validate());
+ }
+
+ for (int i = 0 ; i < validDocs.length ; i++)
+ {
+ XmlObject xo = XmlObject.Factory.parse(validDocs[i]);
+ assertTrue("Doc was invalid. Should be valid: " + validDocs[i],
+ xo.validate());
+ }
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/TestEnv.java b/v1/test/src/drt/drtcases/TestEnv.java
new file mode 100644
index 0000000..b6b2ed2
--- /dev/null
+++ b/v1/test/src/drt/drtcases/TestEnv.java
@@ -0,0 +1,66 @@
+/* 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 drtcases;
+
+import java.io.File;
+import java.io.IOException;
+
+public class TestEnv
+{
+ private static File fwroot = getRootFile();
+ private static File caseroot = new File(fwroot, "test/cases");
+ private static File outputroot = new File(fwroot, "build/test/output");
+
+ public static File getRootFile() throws IllegalStateException
+ {
+ try
+ {
+ return new File( System.getProperty( "xbean.rootdir" ) ).getCanonicalFile();
+ }
+ catch( IOException e )
+ {
+ throw new IllegalStateException(e.toString());
+ }
+ }
+
+ public static File xbeanCase(String str)
+ {
+ return (new File(caseroot, str));
+ }
+
+ public static File xbeanOutput(String str)
+ {
+ File result = (new File(outputroot, str));
+ File parentdir = result.getParentFile();
+ parentdir.mkdirs();
+ return result;
+ }
+
+ public static void deltree(File dir)
+ {
+ if (dir.exists())
+ {
+ if (dir.isDirectory())
+ {
+ String[] list = dir.list();
+ for (int i = 0; i < list.length; i++)
+ deltree(new File(dir, list[i]));
+ }
+ if (!dir.delete())
+ throw new IllegalStateException("Could not delete " + dir);
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/TestRunUtil.java b/v1/test/src/drt/drtcases/TestRunUtil.java
new file mode 100644
index 0000000..cacf738
--- /dev/null
+++ b/v1/test/src/drt/drtcases/TestRunUtil.java
@@ -0,0 +1,88 @@
+/* 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 drtcases;
+
+import java.io.File;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+public class TestRunUtil
+{
+ /**
+ * Runs method that must be declared "static void test()" on the given
+ * class, with the given additional jars or directories on the classpath.
+ */
+ public static void run(String classname, File[] classpath) throws Throwable
+ {
+ // System.err.println("Running " + classname + " with classpath:");
+ for (int i = 0; i < classpath.length; i++)
+ {
+ // System.err.println(classpath[i]);
+ if (!classpath[i].exists())
+ throw new IllegalArgumentException("Classpath component " + classpath + " cannot be found!");
+ }
+
+ URL[] extracp = new URL[classpath.length];
+ for (int i = 0; i < classpath.length; i++)
+ {
+ try
+ {
+ extracp[i] = classpath[i].toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Malformed classpath filename");
+ }
+ }
+
+ ClassLoader curcl = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ ClassLoader childcl = new URLClassLoader(extracp);
+ Class javaClass = childcl.loadClass(classname);
+ Class testClass = childcl.loadClass("org.openuri.mytest.CustomerDocument");
+ if (testClass == null)
+ throw new IllegalStateException();
+ Method meth = javaClass.getMethod("test", new Class[0]); // should be static
+ Thread.currentThread().setContextClassLoader(childcl);
+ meth.invoke(null, new Object[0]);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("class not found");
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException("no test() method found");
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalArgumentException("could not invoke static public test method");
+ }
+ catch (InvocationTargetException e)
+ {
+ throw e.getCause();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(curcl);
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/ThreadingTest.java b/v1/test/src/drt/drtcases/ThreadingTest.java
new file mode 100644
index 0000000..e4a6ec2
--- /dev/null
+++ b/v1/test/src/drt/drtcases/ThreadingTest.java
@@ -0,0 +1,96 @@
+/* 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 drtcases;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import junit.framework.Assert;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+
+import javax.xml.namespace.QName;
+
+public class ThreadingTest extends TestCase
+{
+ public ThreadingTest(String name) { super(name); }
+ public static Test suite() { return new TestSuite(ThreadingTest.class); }
+
+ public static final int THREAD_COUNT = 4;
+ public static final int ITERATION_COUNT = 1;
+
+ public class CompilationThread extends Thread
+ {
+ private Throwable _throwable;
+ private boolean _result;
+
+ public Throwable getException()
+ {
+ return _throwable;
+ }
+
+ public boolean getResult()
+ {
+ return _result;
+ }
+
+ public void run()
+ {
+ try
+ {
+ for (int i = 0; i < ITERATION_COUNT; i++)
+ {
+ SchemaTypeLoader loader = XmlBeans.loadXsd(new XmlObject[] { XmlObject.Factory.parse(TestEnv.xbeanCase("schema/XmlSignature/xmldsig-core-schema.xsd")) });
+ XmlObject result = loader.parse(TestEnv.xbeanCase("schema/XmlSignature/signature-example.xml"), null, null);
+ Assert.assertEquals(loader.findDocumentType(new QName("http://www.w3.org/2000/09/xmldsig#", "Signature")), result.schemaType());
+ }
+ _result = true;
+ }
+ catch (Throwable t)
+ {
+ _throwable = t;
+ t.printStackTrace();
+ }
+ }
+ }
+
+ public void testThreadedCompilation() throws Throwable
+ {
+ CompilationThread[] threads = new CompilationThread[THREAD_COUNT];
+ for (int i = 0; i < threads.length; i++)
+ {
+ threads[i] = new CompilationThread();
+ }
+
+ for (int i = 0; i < threads.length; i++)
+ {
+ threads[i].start();
+ }
+
+ for (int i = 0; i < threads.length; i++)
+ {
+ threads[i].join();
+ }
+
+ for (int i = 0; i < threads.length; i++)
+ {
+ Assert.assertNull(threads[i].getException());
+ Assert.assertTrue("Thread " + i + " didn't succeed", threads[i].getResult());
+ }
+ }
+}
diff --git a/v1/test/src/drt/drtcases/TypedSettersTests.java b/v1/test/src/drt/drtcases/TypedSettersTests.java
new file mode 100644
index 0000000..4b1d0e1
--- /dev/null
+++ b/v1/test/src/drt/drtcases/TypedSettersTests.java
@@ -0,0 +1,168 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlSaxHandler;
+import org.apache.xmlbeans.XmlLineNumber;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XmlInt;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.lang.Comparable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.Iterator;
+import java.util.TreeSet;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class TypedSettersTests extends TestCase
+{
+ public TypedSettersTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(TypedSettersTests.class); }
+
+ private static final String schemaNs ="xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
+ private static final String instanceNs = "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"";
+
+ private static final String fmt ( String s )
+ {
+ StringBuffer sb = new StringBuffer();
+
+ for ( int i = 0 ; i < s.length() ; i++ )
+ {
+ char ch = s.charAt( i );
+
+ if (ch != '$')
+ {
+ sb.append( ch );
+ continue;
+ }
+
+ ch = s.charAt( ++i );
+
+ String id = "";
+
+ while ( (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
+ {
+ id = id + ch;
+ ch = s.charAt( ++i );
+ }
+
+ String arg = "";
+
+ if (ch == '(')
+ {
+ ch = s.charAt( ++i );
+
+ while ( ch != ')' )
+ {
+ arg += ch;
+ ch = s.charAt( ++i );
+ }
+ }
+ else
+ i--;
+
+ if (id.equals( "schema" ))
+ sb.append( schemaNs );
+ else if (id.equals( "xsi" ))
+ sb.append( instanceNs );
+ else if (id.equals( "type" ))
+ {
+ Assert.assertTrue( arg.length() > 0 );
+ sb.append( "xsi:type=\"" + arg + "\"" );
+ }
+ else
+ Assert.assertTrue( false );
+ }
+
+ return sb.toString();
+ }
+
+ private static final String nses = schemaNs + " " + instanceNs;
+
+ public void testJavaNoTypeSingletonElement ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<xyzzy/>" );
+ XmlObject x2 = XmlObject.Factory.parse( "<bubba>moo</bubba>" );
+ XmlCursor c = x.newCursor();
+ XmlCursor c2 = x2.newCursor();
+
+ c.toNextToken();
+ c2.toNextToken();
+
+ c.getObject().set( c2.getObject() );
+
+ Assert.assertTrue( x.xmlText().equals( "<xyzzy>moo</xyzzy>" ) );
+ }
+
+ public void testJavaNoTypeSingletonAttribute ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<xyzzy a=''/>" );
+ XmlObject x2 = XmlObject.Factory.parse( "<bubba b='moo'/>" );
+ XmlCursor c = x.newCursor();
+ XmlCursor c2 = x2.newCursor();
+
+ c.toNextToken();
+ c.toNextToken();
+ c2.toNextToken();
+ c2.toNextToken();
+
+ c.getObject().set( c2.getObject() );
+
+ Assert.assertTrue( x.xmlText().equals( "<xyzzy a=\"moo\"/>" ) );
+ }
+
+ public void testJavaNoTypeSingletonElementWithXsiType ( )
+ throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( "<xyzzy/>", new XmlOptions().setDocumentType( XmlObject.type ) );
+ XmlObject x2 = XmlObject.Factory.parse( fmt( "<bubba $type(xs:int) $xsi $schema>69</bubba>" ) );
+ XmlCursor c = x.newCursor();
+ XmlCursor c2 = x2.newCursor();
+
+ c.toNextToken();
+ c2.toNextToken();
+
+ XmlObject xyzzy = c.getObject();
+ XmlObject bubba = c2.getObject();
+
+ Assert.assertTrue( bubba.schemaType() == XmlInt.type );
+
+// xyzzy.set( bubba );
+
+// Assert.assertTrue( x.xmlText().equals( fmt( "<xyzzy $type(xs:int) $xsi $schema>moo</xyzzy>" ) ) );
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/ValidationTests.java b/v1/test/src/drt/drtcases/ValidationTests.java
new file mode 100644
index 0000000..a630f69
--- /dev/null
+++ b/v1/test/src/drt/drtcases/ValidationTests.java
@@ -0,0 +1,1602 @@
+/* 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 drtcases;
+
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.impl.store.Root;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.XMLStreamValidationException;
+import org.apache.xmlbeans.XmlDecimal;
+import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import javax.xml.namespace.QName;
+
+public class ValidationTests extends TestCase
+{
+ public ValidationTests(String name) { super(name); }
+ public static Test suite() { return new TestSuite(ValidationTests.class); }
+
+ static String[] _args;
+ static String _test;
+
+ public static File getCaseFile(String theCase)
+ {
+ return TestEnv.xbeanCase("store/" + theCase);
+ }
+
+ static XmlCursor loadCase(String theCase) throws Exception
+ {
+ return
+ XmlObject.Factory.parse(
+ getCaseFile( theCase ) ).newCursor();
+ }
+
+ public SchemaTypeLoader makeSchemaTypeLoader ( String[] schemas )
+ throws Exception
+ {
+ XmlObject[] schemaDocs = new XmlObject [ schemas.length ];
+
+ for ( int i = 0 ; i < schemas.length ; i++ )
+ {
+ schemaDocs[ i ] =
+ XmlObject.Factory.parse(
+ schemas[ i ] );
+ }
+
+ return XmlBeans.loadXsd( schemaDocs );
+ }
+
+ public SchemaTypeLoader makeSchemaTypeLoader ( File[] schemas )
+ throws Exception
+ {
+ XmlObject[] schemaDocs = new XmlObject [ schemas.length ];
+
+ for ( int i = 0 ; i < schemas.length ; i++ )
+ {
+ schemaDocs[ i ] =
+ XmlObject.Factory.parse(
+ schemas[ i ], new XmlOptions().setLoadLineNumbers().setLoadMessageDigest() );
+ }
+
+ return XmlBeans.loadXsd( schemaDocs );
+ }
+
+ public void v ( String xml ) throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( xml );
+ Assert.assertTrue( x.schemaType() != XmlObject.type );
+ Assert.assertTrue( x.validate() );
+ }
+
+ public void nv ( String xml ) throws Exception
+ {
+ XmlObject x = XmlObject.Factory.parse( xml );
+ Assert.assertTrue( x.schemaType() != XmlObject.type );
+ Assert.assertTrue( !x.validate() );
+ }
+
+ public void ___testDefault ( ) throws Exception
+ {
+ // Default
+
+// v( "<validElemDefault/>" );
+// v( "<validAttrDefault/>" );
+//
+// nv( "<invalidElemDefault/>" );
+ nv( "<invalidAttrDefault/>" );
+
+ v( "<invalidElemDefault>11<invalidElemDefault>" );
+ v( "<invalidAttrDefault attr='22'>" );
+
+ // Fixed
+
+ v( "<validElemFixed/>" );
+ v( "<validAttrFixed/>" );
+
+ nv( "<invalidElemFixed/>" );
+ nv( "<invalidAttrFixed/>" );
+
+ v( "<invalidElemFixed>33<invalidElemFixed>" );
+ v( "<invalidAttrFixed attr='44'/>" );
+ }
+
+ public void doTest (
+ String[] schemas, QName docType,
+ String[] validInstances, String[] invalidInstances)
+ throws Exception
+ {
+ doTest(schemas, docType, validInstances, invalidInstances, true);
+ }
+
+ public void doTest (
+ String[] schemas, QName docType,
+ String[] validInstances, String[] invalidInstances, boolean startOnDocument )
+ throws Exception
+ {
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ XmlOptions options = new XmlOptions();
+
+ if (docType != null)
+ {
+ SchemaType docSchema = stl.findDocumentType( docType );
+
+ Assert.assertTrue( docSchema != null );
+
+ options.put( XmlOptions.DOCUMENT_TYPE, docSchema );
+ }
+
+ for ( int i = 0 ; i < validInstances.length ; i++ )
+ {
+ XmlObject x =
+ stl.parse( (String) validInstances[ i ], null, options );
+
+ if (!startOnDocument)
+ {
+ XmlCursor c = x.newCursor();
+ c.toFirstChild();
+ x = c.getObject();
+ c.dispose();
+ }
+
+ List xel = new ArrayList();
+
+ options.put( XmlOptions.ERROR_LISTENER, xel );
+
+ boolean isValid = x.validate( options );
+
+ if (!isValid)
+ {
+ System.err.println( "Invalid doc, expected a valid doc: " );
+ System.err.println( "Instance(" + i + "): " );
+ System.err.println( x.xmlText() );
+ Root.dump( x );
+ System.err.println( "Errors: " );
+ for ( int j = 0 ; j < xel.size() ; j++ )
+ System.err.println( xel.get( j ) );
+ System.err.println();
+ }
+
+ Assert.assertTrue( isValid );
+ }
+
+ for ( int i = 0 ; i < invalidInstances.length ; i++ )
+ {
+ XmlObject x;
+
+ try
+ {
+ x = stl.parse( (String) invalidInstances[ i ], null, options );
+
+ if (! startOnDocument)
+ {
+ XmlCursor c = x.newCursor();
+ c.toFirstChild();
+ x = c.getObject();
+ c.dispose();
+ }
+
+ boolean isValid = x.validate();
+
+ if (isValid)
+ {
+ System.err.println( "Valid doc, expected a invalid doc: " );
+ System.err.println( "Instance(" + i + "): " );
+ System.err.println( x.xmlText() );
+ Root.dump( x );
+ System.err.println();
+ }
+
+ Assert.assertTrue( !isValid );
+ }
+ catch ( XmlException e )
+ {
+ }
+ }
+ }
+
+ // Just compile a schema, good and bad
+
+ public void testValidate0 ( )
+ throws Exception
+ {
+ //
+ // The most basic schema
+ //
+
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ "</xs:schema>" +
+ "";
+
+ String[] schemas = { schema };
+
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ //
+ // One which uses ##targetNamespace on a wildcard
+ //
+
+ schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:complexType name='foo'>\n" +
+ " <xs:sequence>\n" +
+ " <xs:any namespace='##targetNamespace'/>\n" +
+ " </xs:sequence>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>" +
+ "";
+
+ String[] schemas99 = { schema };
+
+ stl = makeSchemaTypeLoader( schemas99 );
+
+ //
+ // A big, nasty schema :-)
+ //
+
+ File file = TestEnv.getRootFile();
+ File schemeFile = new File( file, "src/xsdschema/schema/XMLSchema.xsd" );
+ File xmlFile = new File( file, "src/xmlschema/schema/XML.xsd" );
+
+ File[] schemasF = { schemeFile, xmlFile };
+
+ Root.disableStoreValidation();
+ try
+ {
+ stl = makeSchemaTypeLoader( schemasF );
+ }
+ finally
+ {
+ Root.enableStoreValidation();
+ }
+
+ SchemaType type =
+ stl.findDocumentType(
+ new QName( "http://www.w3.org/2001/XMLSchema", "schema" ) );
+
+ Assert.assertTrue( type != null );
+
+
+ //
+ // A good piece from a J2EE schema
+ //
+
+ schema =
+ "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<xsd:schema xmlns='http://www.w3.org/2001/XMLSchema'\n" +
+ " xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+ " elementFormDefault='qualified'\n" +
+ " attributeFormDefault='unqualified'>\n" +
+ "<xsd:annotation>\n" +
+ "<xsd:documentation>\n" +
+ "@(#)application-client_1_4.xsds 1.7 07/08/02\n" +
+ "</xsd:documentation>\n" +
+ "</xsd:annotation>\n" +
+ "</xsd:schema>\n";
+
+ String[] schemas5 = { schema };
+
+ stl = makeSchemaTypeLoader( schemas5 );
+
+ //
+ // A bad schema
+ //
+
+ schema = "<foo/>";
+
+ String[] schemas2 = { schema };
+
+ try
+ {
+ stl = makeSchemaTypeLoader( schemas2 );
+ Assert.assertTrue( false );
+ }
+ catch ( Exception e )
+ {
+ }
+
+ //
+ // A bad schema
+ //
+ schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <foo/>\n" +
+ "</xs:schema>" +
+ "";
+
+ String[] schemas3 = { schema };
+
+ try
+ {
+ makeSchemaTypeLoader( schemas3 );
+
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+ }
+
+ public void testValidate1 ( )
+ throws Exception
+ {
+ String ericSchema =
+ "<xs:schema\n" +
+ " xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+ " xmlns:nw='http://openuri.org/ericschema'\n" +
+ " targetNamespace='http://openuri.org/ericschema'\n" +
+ " elementFormDefault='qualified'>\n" +
+ "\n" +
+ " <xs:complexType name='foo'>\n" +
+ " </xs:complexType>\n" +
+ "\n" +
+ " <xs:element name='foo' type='nw:foo'>\n" +
+ " </xs:element>\n" +
+ "\n" +
+ " <xs:element name='eric'>\n" +
+ " <xs:complexType>\n" +
+ " <xs:sequence>\n" +
+ " <xs:element name='a' maxOccurs='unbounded'/>\n" +
+ " <xs:element name='b' />\n" +
+ " <xs:any namespace='yaya' minOccurs='0' maxOccurs='1' processContents='lax'/>\n" +
+ " <xs:element name='c' />\n" +
+ " <xs:any minOccurs='0' maxOccurs='unbounded' processContents='strict'/>\n" +
+ " </xs:sequence>\n" +
+ " <xs:attribute name='x' use='optional'/>\n" +
+ " <xs:attribute name='y' use='required'/>\n" +
+ " <xs:attribute name='z' use='prohibited'/>\n" +
+ " </xs:complexType>\n" +
+ " </xs:element>\n" +
+ "" +
+ "</xs:schema>\n";
+
+ String eric2Schema =
+ "<xs:schema\n" +
+ " xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+ " xmlns:nw='http://openuri.org/ericschema2'\n" +
+ " xmlns:eric='http://openuri.org/ericschema'\n" +
+ " targetNamespace='http://openuri.org/ericschema2'\n" +
+ " elementFormDefault='qualified'>\n" +
+ "\n" +
+ " <xs:complexType name='eric2'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='eric:foo'>\n" +
+ " <xs:sequence>\n" +
+ " <xs:element name='a' maxOccurs='unbounded'/>\n" +
+ " </xs:sequence>\n" +
+ " </xs:extension>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "</xs:schema>\n";
+
+ String eric = "<eric y='Y' xmlns='http://openuri.org/ericschema'>";
+ String eric2 = "<eric xmlns='http://openuri.org/ericschema2'>";
+ String xsi = "xmlns:eric2='http://openuri.org/ericschema2' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'";
+
+ String[] valid = {
+ eric + "<a/><b/><c/><foo xsi:type='eric2:eric2' " +
+ xsi + "><a xmlns=\"http://openuri.org/ericschema2\"/></foo></eric>",
+ eric + "<a/><b/><boo xmlns='yaya'/><c/></eric>",
+ eric + "<a/><b/><c/></eric>",
+ eric + "<a x='y'/><b/><c/></eric>",
+ "<eric y='Y' x='X' xmlns='http://openuri.org/ericschema'>" +
+ "<a/><b/><c/></eric>"
+ };
+
+ String ericSansY =
+ "<eric xmlns='http://openuri.org/ericschema'>";
+
+ String[] invalid = {
+ "<foo/>",
+ "<eric><a/><foo/><c/></eric>",
+ eric + "text<a/><b/><c/></eric>",
+ eric + "<a/>text<b/><c/></eric>",
+ eric + "<a/><b/>text<c/></eric>",
+ eric + "<a/><b/><c/>text</eric>",
+ eric + "<a x='y'/><b/><c/>text</eric>",
+ eric + "<a/><b/><boo xmlns='yaya'/><moo xmlns='yaya'/><c/></eric>",
+ ericSansY + "<a/><b/><c/></eric>",
+ "<eric y='' z='' xmlns='http://openuri.org/ericschema'>" +
+ "<a/><b/><c/></eric>"
+ };
+
+ String[] schemas = { ericSchema, eric2Schema };
+
+ doTest(
+ schemas,
+ new QName( "http://openuri.org/ericschema", "eric" ),
+ valid, invalid );
+ }
+
+ public void testValidate2 ( )
+ throws Exception
+ {
+ String bobSchema =
+ "<xs:schema\n" +
+ " xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+ " xmlns:bob='http://openuri.org/bobschema'\n" +
+ " targetNamespace='http://openuri.org/bobschema'\n" +
+ " elementFormDefault='qualified'>\n" +
+ "\n" +
+ " <xs:complexType name='biff'>\n" +
+ " <xs:complexContent>\n" +
+ " <xs:extension base='bob:foo'>\n" +
+ " <xs:sequence>\n" +
+ " <xs:element name='a' minOccurs='0' maxOccurs='unbounded'/>\n" +
+ " </xs:sequence>\n" +
+ " </xs:extension>\n" +
+ " </xs:complexContent>\n" +
+ " </xs:complexType>\n" +
+ "" +
+ " <xs:complexType name='foo'>\n" +
+ " </xs:complexType>\n" +
+ "" +
+ " <xs:element name='foo' type='bob:foo'>\n" +
+ " </xs:element>\n" +
+ "" +
+ "</xs:schema>\n";
+
+ String xsiType = "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'";
+
+ String[] valid = {
+ "<bob:foo xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:bob='http://openuri.org/bobschema' " +
+ "xsi:type='bob:biff'><bob:a/><bob:a/><bob:a/></bob:foo>"
+ };
+
+ String[] invalid = {
+ "<bob:foo xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:bob='http://openuri.org/bobschema' " +
+ "xsi:type='bob:biff'><bob:q/></bob:foo>",
+ "<bob:foo a='b' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:bob='http://openuri.org/bobschema' " +
+ "xsi:type='bob:biff'><bob:a/><bob:a/><bob:a/></bob:foo>"
+ };
+
+ String[] schemas = { bobSchema };
+
+ doTest( schemas, null, valid, invalid );
+ }
+
+ String ns =
+ "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
+ "xmlns:xs='http://www.w3.org/2001/XMLSchema'";
+
+ public void testValidate3 ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ "" +
+ " <xs:simpleType name='allNNI'>\n" +
+ " <xs:annotation><xs:documentation>\n" +
+ " for maxOccurs</xs:documentation></xs:annotation>\n" +
+ " <xs:union memberTypes='xs:nonNegativeInteger'>\n" +
+ " <xs:simpleType>\n" +
+ " <xs:restriction base='xs:NMTOKEN'>\n" +
+ " <xs:enumeration value='unbounded'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ " </xs:union>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='ericBase64Binary'>\n" +
+ " <xs:restriction base='xs:base64Binary'>\n" +
+ " <xs:enumeration value='Eric'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='abcdHexBinary'>\n" +
+ " <xs:restriction base='xs:hexBinary'>\n" +
+ " <xs:enumeration value='abcd'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='zeroNumber'>\n" +
+ " <xs:restriction base='number'>\n" +
+ " <xs:enumeration value='Zero'/>\n" +
+ " <xs:enumeration value='0'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='number'>\n" +
+ " <xs:union>\n" +
+ " <xs:simpleType>\n" +
+ " <xs:restriction base='xs:decimal'/>\n" +
+ " </xs:simpleType>\n" +
+ " <xs:simpleType>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:whiteSpace value='collapse'/>\n" +
+ " <xs:enumeration value='Zero'/>\n" +
+ " <xs:enumeration value='One'/>\n" +
+ " <xs:enumeration value='Two'/>\n" +
+ " <xs:enumeration value='Three'/>\n" +
+ " <xs:enumeration value='Many'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ " </xs:union>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='listOfInt'>\n" +
+ " <xs:list itemType='xs:int'/>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='listOfPrime'>\n" +
+ " <xs:list itemType='prime'/>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='ericBrother'>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:whiteSpace value='collapse'/>\n" +
+ " <xs:enumeration value='Brian'/>\n" +
+ " <xs:enumeration value='Kevin'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='ericBrothers'>\n" +
+ " <xs:list itemType='ericBrother'/>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='weekString'>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:whiteSpace value='collapse'/>\n" +
+ " <xs:enumeration value='Monday'/>\n" +
+ " <xs:enumeration value='Tuesday'/>\n" +
+ " <xs:enumeration value='Wednesday'/>\n" +
+ " <xs:enumeration value='Thursday'/>\n" +
+ " <xs:enumeration value='Friday'/>\n" +
+ " <xs:enumeration value='Saturday'/>\n" +
+ " <xs:enumeration value='Sunday'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='aYear'>\n" +
+ " <xs:restriction base='xs:duration'>\n" +
+ " <xs:enumeration value='P1Y'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='ericBDay'>\n" +
+ " <xs:restriction base='xs:date'>\n" +
+ " <xs:enumeration value='1965-06-10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='youngerThanEric'>\n" +
+ " <xs:restriction base='xs:date'>\n" +
+ " <xs:minExclusive value='1965-06-10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='fiveCharQname'>\n" +
+ " <xs:restriction base='xs:QName'>\n" +
+ " <xs:length value='5'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='wackyQname'>\n" +
+ " <xs:restriction base='xs:QName'>\n" +
+ " <xs:minLength value='3'/>\n" +
+ " <xs:maxLength value='10'/>\n" +
+ " <xs:pattern value='[xs:abcde]*'/>\n" +
+ " <xs:enumeration value='xs:abc'/>\n" +
+ " <xs:enumeration value='xs:bcd'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='fiveCharAnyURI'>\n" +
+ " <xs:restriction base='xs:anyURI'>\n" +
+ " <xs:length value='5'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='wackyAnyURI'>\n" +
+ " <xs:restriction base='xs:anyURI'>\n" +
+ " <xs:minLength value='3'/>\n" +
+ " <xs:maxLength value='10'/>\n" +
+ " <xs:enumeration value='foo'/>\n" +
+ " <xs:enumeration value='bar'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='bit'>\n" +
+ " <xs:restriction base='xs:boolean'>\n" +
+ " <xs:pattern value='1|0'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='evenInteger'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:pattern value='[0-9]*[02468]'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='prime'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:pattern value='[0-9]*[13579]'/>\n" +
+ " <xs:enumeration value='3'/>\n" +
+ " <xs:enumeration value='5'/>\n" +
+ " <xs:enumeration value='7'/>\n" +
+ " <xs:enumeration value='11'/>\n" +
+ " <xs:enumeration value='13'/>\n" +
+ " <xs:enumeration value='17'/>\n" +
+ " <xs:enumeration value='19'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='fourCharString'>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:length value='4'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='threeOrMoreCharString'>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:minLength value='3'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='fiveOrLessCharString'>\n" +
+ " <xs:restriction base='xs:string'>\n" +
+ " <xs:maxLength value='5'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='fiveTotalDigits'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:totalDigits value='5'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='threeFractionDigits'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:fractionDigits value='3'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMinExclusive'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:minExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxExclusive'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:maxExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxInclusive'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:maxInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMinInclusive'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:minInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMinExclusiveFloat'>\n" +
+ " <xs:restriction base='xs:float'>\n" +
+ " <xs:minExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxExclusiveFloat'>\n" +
+ " <xs:restriction base='xs:float'>\n" +
+ " <xs:maxExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxInclusiveFloat'>\n" +
+ " <xs:restriction base='xs:float'>\n" +
+ " <xs:maxInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMinInclusiveFloat'>\n" +
+ " <xs:restriction base='xs:float'>\n" +
+ " <xs:minInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "\n" +
+ " <xs:simpleType name='tenMinExclusiveDouble'>\n" +
+ " <xs:restriction base='xs:double'>\n" +
+ " <xs:minExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxExclusiveDouble'>\n" +
+ " <xs:restriction base='xs:double'>\n" +
+ " <xs:maxExclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMaxInclusiveDouble'>\n" +
+ " <xs:restriction base='xs:double'>\n" +
+ " <xs:maxInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "" +
+ " <xs:simpleType name='tenMinInclusiveDouble'>\n" +
+ " <xs:restriction base='xs:double'>\n" +
+ " <xs:minInclusive value='10'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "\n" +
+ " <xs:element name='any'>\n" +
+ " </xs:element>\n" +
+ "" +
+ " <xs:element name='default_12345' default='12345'>\n" +
+ " </xs:element>\n" +
+ "" +
+ " <xs:element name='default_1234' default='1234'>\n" +
+ " </xs:element>\n" +
+ "" +
+ " <xs:element name='default_eric' default='eric'>\n" +
+ " </xs:element>\n" +
+ "" +
+ "</xs:schema>\n";
+
+ String[] valid = {
+ "<any " + ns + " xsi:type='threeFractionDigits'>.1</any>",
+ "<any " + ns + " xsi:type='threeFractionDigits'>.12</any>",
+ "<any " + ns + " xsi:type='threeFractionDigits'>.123</any>",
+
+ "<any " + ns + " xsi:type='allNNI'>unbounded</any>",
+ "<any " + ns + " xsi:type='allNNI'>0</any>",
+ "<any " + ns + " xsi:type='allNNI'>1</any>",
+
+ "<any " + ns + " xsi:type='xs:base64Binary'>CAFEBABE</any>",
+ "<any " + ns + " xsi:type='abcdHexBinary'>abcd</any>",
+
+ "<any " + ns + " xsi:type='xs:base64Binary'>abcdefgh</any>",
+ "<any " + ns + " xsi:type='ericBase64Binary'>Eric</any>",
+
+ "<any " + ns + " xsi:type='zeroNumber'> Zero</any>",
+ "<any " + ns + " xsi:type='zeroNumber'>Zero</any>",
+ "<any " + ns + " xsi:type='zeroNumber'>0</any>",
+
+ "<any " + ns + " xsi:type='number'>1</any>",
+ "<any " + ns + " xsi:type='number'> 1 </any>",
+ "<any " + ns + " xsi:type='number'>Two</any>",
+ "<any " + ns + " xsi:type='number'> Three </any>",
+
+ "<any " + ns + " xsi:type='ericBrothers'></any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Brian</any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Kevin</any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Kevin Brian</any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Brian Kevin</any>",
+
+ "<any " + ns + " xsi:type='listOfInt'> 1 22 333 4444 </any>",
+ "<any " + ns + " xsi:type='listOfInt'></any>",
+ "<any " + ns + " xsi:type='listOfInt'>5999</any>",
+
+ "<any " + ns + " xsi:type='aYear'>P1Y</any>",
+
+ "<any " + ns + " xsi:type='fiveCharAnyURI'>abcde</any>",
+ "<any " + ns + " xsi:type='xs:anyURI'>foo</any>",
+ "<any " + ns + " xsi:type='wackyAnyURI'>foo</any>",
+
+ "<any " + ns + " xsi:type='youngerThanEric'>1965-06-11</any>",
+ "<any " + ns + " xsi:type='ericBDay'>1965-06-10</any>",
+ "<any " + ns + " xsi:type='xs:dateTime'>1999-05-31T13:20:00-05:00</any>",
+ "<any " + ns + " xsi:type='xs:time'>00:00:00</any>",
+ "<any " + ns + " xsi:type='xs:time'>13:20:00-05:00</any>",
+
+ "<any " + ns + " xsi:type='wackyQname'>xs:abc</any>",
+ "<any " + ns + " xsi:type='fiveCharQname'>abcde</any>",
+ "<any " + ns + " xsi:type='fiveCharQname'>xs:ab</any>",
+ "<any " + ns + " xsi:type='prime'>3</any>",
+ "<any " + ns + " xsi:type='prime'>11</any>",
+ "<any " + ns + " xsi:type='xs:integer'>+45</any>",
+ "<any " + ns + " xsi:type='xs:integer'>1</any>",
+ "<any " + ns + " xsi:type='xs:integer'>0</any>",
+ "<any " + ns + " xsi:type='xs:integer'>-1</any>",
+ "<any " + ns + " xsi:type='xs:integer'>-1</any>",
+ "<any " + ns + " xsi:type='xs:integer'>489743579837589743434</any>",
+ "<any " + ns + " xsi:type='xs:boolean'>1</any>",
+ "<default_1234 " + ns + " xsi:type='evenInteger'></default_1234>",
+ "<any " + ns + " xsi:type='evenInteger'>12</any>",
+ "<any " + ns + " xsi:type='bit'>1</any>",
+ "<any " + ns + " xsi:type='bit'>0</any>",
+ "<any " + ns + " xsi:type='xs:boolean'>false</any>",
+ "<any " + ns + " xsi:type='evenInteger'>0</any>",
+ "<any " + ns + " xsi:type='weekString'>Monday</any>",
+ "<any " + ns + " xsi:type='weekString'>Sunday</any>",
+ "<any " + ns + " xsi:type='weekString'> Thursday </any>",
+
+ "<any " + ns + " xsi:type='tenMinExclusive'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusive'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusive'>10</any>",
+ "<any " + ns + " xsi:type='tenMinInclusive'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusive'>10</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusive'>9.9</any>",
+
+ "<any " + ns + " xsi:type='tenMinExclusiveFloat'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusiveFloat'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveFloat'>10</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveFloat'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveFloat'>10</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveFloat'>9.9</any>",
+
+ "<any " + ns + " xsi:type='tenMinExclusiveDouble'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusiveDouble'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveDouble'>10</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveDouble'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveDouble'>10</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveDouble'>9.9</any>",
+
+ "<any " + ns + " xsi:type='fourCharString'>eric</any>",
+ "<any " + ns + " xsi:type='threeOrMoreCharString'>12345</any>",
+ "<any " + ns + " xsi:type='fiveOrLessCharString'>1234</any>",
+ "<any " + ns + " xsi:type='fiveTotalDigits'>12345</any>",
+ "<any " + ns + " xsi:type='fiveTotalDigits'>1234</any>",
+ "<default_1234 " + ns + " xsi:type='evenInteger'>\n\n</default_1234>"
+ };
+
+ String[] invalid = {
+ "<any " + ns + " xsi:type='allNNI'>foo</any>",
+ "<any " + ns + " xsi:type='xs:hexBinary'>P</any>",
+ "<any " + ns + " xsi:type='xs:hexBinary'>CAFEBABP</any>",
+ "<any " + ns + " xsi:type='abcdHexBinary'>abce</any>",
+
+ "<any " + ns + " xsi:type='xs:base64Binary'>abcde</any>",
+ "<any " + ns + " xsi:type='ericBase64Binary'>Erik</any>",
+
+ "<any " + ns + " xsi:type='zeroNumber'>One</any>",
+ "<any " + ns + " xsi:type='zeroNumber'>Twenty</any>",
+
+ "<any " + ns + " xsi:type='number'>Seven</any>",
+ "<any " + ns + " xsi:type='number'>Bob</any>",
+ "<any " + ns + " xsi:type='number'></any>",
+
+ "<any " + ns + " xsi:type='ericBrothers'>1</any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Bob</any>",
+ "<any " + ns + " xsi:type='ericBrothers'>Ralph Frank</any>",
+
+ "<any " + ns + " xsi:type='listOfInt'> 1 22 333 Eric </any>",
+ "<any " + ns + " xsi:type='listOfInt'>Eric</any>",
+ "<any " + ns + " xsi:type='listOfInt'>-</any>",
+
+ "<any " + ns + " xsi:type='aYear'>P2Y</any>",
+
+ "<any " + ns + " xsi:type='youngerThanEric'>1965-06-10</any>",
+ "<any " + ns + " xsi:type='ericBDay'>1985-06-10</any>",
+ "<any " + ns + " xsi:type='xs:dateTime'>xx1999-05-31T13:20:00-05:00</any>",
+ "<any " + ns + " xsi:type='xs:dateTime'>eric</any>",
+ "<any " + ns + " xsi:type='xs:time'>99:99:00</any>",
+ "<any " + ns + " xsi:type='xs:time'>13:20:00-99:00</any>",
+
+ "<any " + ns + " xsi:type='wackyAnyURI'>moo</any>",
+ "<any " + ns + " xsi:type='fiveCharAnyURI'>ab</any>",
+
+ "<any " + ns + " xsi:type='wackyQname'>xs:abcdefghijk</any>",
+ "<any " + ns + " xsi:type='wackyQname'>xs:pqr</any>",
+ "<any " + ns + " xsi:type='xs:QName'>foo:bar</any>",
+ "<any " + ns + " xsi:type='fiveCharQname'>xs:abc</any>",
+ "<any " + ns + " xsi:type='prime'>12</any>",
+ "<any " + ns + " xsi:type='prime'>6</any>",
+ "<any " + ns + " xsi:type='xs:integer'>foo</any>",
+ "<any " + ns + " xsi:type='xs:integer'>.1</any>",
+ "<any " + ns + " xsi:type='evenInteger'>1</any>",
+ "<any " + ns + " xsi:type='bit'>true</any>",
+ "<any " + ns + " xsi:type='bit'>false</any>",
+ "<any " + ns + " xsi:type='bit'>nibble</any>",
+ "<any " + ns + " xsi:type='bit'>2</any>",
+ "<any " + ns + " xsi:type='xs:boolean'>blurf</any>",
+ "<any " + ns + " xsi:type='xs:boolean'></any>",
+ "<any " + ns + " xsi:type='evenInteger'></any>",
+ "<any " + ns + " xsi:type='weekString'>Monday Sucks</any>",
+
+ "<any " + ns + " xsi:type='tenMaxExclusive'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusive'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusive'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusive'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusive'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusive'>10.1</any>",
+
+ "<any " + ns + " xsi:type='tenMaxExclusiveFloat'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusiveFloat'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusiveFloat'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusiveFloat'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveFloat'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveFloat'>10.1</any>",
+
+ "<any " + ns + " xsi:type='tenMaxExclusiveDouble'>10.1</any>",
+ "<any " + ns + " xsi:type='tenMaxExclusiveDouble'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusiveDouble'>10</any>",
+ "<any " + ns + " xsi:type='tenMinExclusiveDouble'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMinInclusiveDouble'>9.9</any>",
+ "<any " + ns + " xsi:type='tenMaxInclusiveDouble'>10.1</any>",
+
+ "<any " + ns + " xsi:type='fiveOrLessCharString'> 1234 </any>",
+ "<any " + ns + " xsi:type='fiveTotalDigits'>123456</any>",
+ "<any " + ns + " xsi:type='fourCharString'>vasilik</any>",
+ "<any " + ns + " xsi:type='threeOrMoreCharString'>1</any>",
+ "<any " + ns + " xsi:type='fiveOrLessCharString'>1234567</any>",
+ "<any " + ns + " xsi:type='threeFractionDigits'>.1234</any>",
+ "<any " + ns + " xsi:type='fourCharString'> eric </any>",
+
+ "<default_12345 " + ns + " xsi:type='evenInteger'></default_12345>",
+ "<default_12345 " + ns + " xsi:type='evenInteger'>\n\n</default_12345>"
+ };
+
+ String[] schemas = { schema };
+
+ doTest( schemas, null, valid, invalid );
+ }
+
+ public void testValidate4 ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ "\n" +
+ " <xs:element name='any'>\n" +
+ " </xs:element>\n" +
+ "\n" +
+ " <xs:simpleType name='kindaPrime'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:pattern value='[0-9]*[13579]'/>\n" +
+ " <xs:enumeration value='3'/>\n" +
+ " <xs:enumeration value='5'/>\n" +
+ " <xs:enumeration value='7'/>\n" +
+ " <xs:enumeration value='11'/>\n" +
+ " <xs:enumeration value='13'/>\n" +
+ " <xs:enumeration value='17'/>\n" +
+ " <xs:enumeration value='19'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "\n" +
+ "</xs:schema>\n" +
+ "";
+
+ String[] schemas = { schema };
+
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ XmlObject x =
+ stl.parse(
+ "<any " + ns + " xsi:type='kindaPrime'>100</any>",
+ null, null );
+
+ // Make sure the unvalidated stream is OK
+
+ XMLInputStream xis = x.newXMLInputStream();
+
+ while ( xis.hasNext() )
+ xis.next();
+
+ // Make sure the validated stream fails
+
+ boolean blewChunks = false;
+
+ xis =
+ stl.newValidatingXMLInputStream(
+ x.newXMLInputStream(), null, null );
+
+ try
+ {
+ while ( xis.hasNext() )
+ xis.next();
+ }
+ catch ( XMLStreamValidationException e )
+ {
+ blewChunks = true;
+ }
+
+ Assert.assertTrue( blewChunks );
+ }
+
+ public void testValidate5 ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ "\n" +
+ " <xs:element name='hee'>\n" +
+ " <xs:complexType>\n" +
+ " <xs:sequence>\n" +
+ " <xs:element name='haw' type='xs:int'/>\n" +
+ " </xs:sequence>\n" +
+ " <xs:attribute name='yee' type='xs:int'/>\n" +
+ " </xs:complexType>\n" +
+ " </xs:element>\n" +
+ "\n" +
+ " <xs:simpleType name='kindaPrime'>\n" +
+ " <xs:restriction base='xs:decimal'>\n" +
+ " <xs:pattern value='[0-9]*[13579]'/>\n" +
+ " <xs:enumeration value='3'/>\n" +
+ " <xs:enumeration value='5'/>\n" +
+ " <xs:enumeration value='7'/>\n" +
+ " <xs:enumeration value='11'/>\n" +
+ " <xs:enumeration value='13'/>\n" +
+ " <xs:enumeration value='17'/>\n" +
+ " <xs:enumeration value='19'/>\n" +
+ " </xs:restriction>\n" +
+ " </xs:simpleType>\n" +
+ "\n" +
+ "</xs:schema>\n" +
+ "";
+
+ String[] schemas = { schema };
+
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ XmlObject x =
+ stl.parse(
+ "<hee yee='3'><haw>66</haw></hee>",
+ null, null );
+
+ XmlCursor c = x.newCursor();
+
+ for ( ; ; )
+ {
+ XmlObject obj = c.getObject();
+
+ if (obj != null)
+ obj.validate();
+
+ if (c.toNextToken().isNone())
+ break;
+ }
+
+ // invalid
+
+ x =
+ stl.parse(
+ "<hee yee='five'><haw>66</haw></hee>",
+ null, null );
+
+ Assert.assertTrue( ! x.validate() );
+
+ c = x.newCursor();
+ c.toNextToken();
+ c.toNextToken();
+
+ Assert.assertTrue( ! c.getObject().validate() );
+
+ // No schema
+
+ x = XmlObject.Factory.parse( "<foo x='y'>asas<bar>asas</bar></foo>" );
+
+ c = x.newCursor();
+
+ for ( ; ; )
+ {
+ XmlObject obj = c.getObject();
+
+ if (obj != null)
+ obj.validate();
+
+ if (c.toNextToken().isNone())
+ break;
+ }
+ }
+
+ public void testValidate6 ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:element name='hee'>\n" +
+ " </xs:element>\n" +
+ "</xs:schema>\n" +
+ "";
+
+ String[] schemas = { schema, schema };
+
+
+ // Should get a schema compile error
+
+ try
+ {
+ makeSchemaTypeLoader( schemas );
+ Assert.assertTrue( false );
+ }
+ catch ( XmlException e )
+ {
+ }
+ }
+
+ public void testValidate7 ( )
+ throws Exception
+ {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>" +
+ "" +
+ " <xs:element name='base' type='base'/>" +
+ "" +
+ " <xs:complexType name='base'>" +
+ " <xs:sequence>" +
+ " <xs:element name='foo'/>" +
+ " </xs:sequence>" +
+ " </xs:complexType>" +
+ "" +
+ " <xs:complexType name='derived'>" +
+ " <xs:complexContent>" +
+ " <xs:extension base='base'>" +
+ " <xs:sequence>" +
+ " <xs:element name='bar'/>" +
+ " </xs:sequence>" +
+ " </xs:extension>" +
+ " </xs:complexContent>" +
+ " </xs:complexType>" +
+ "" +
+ "</xs:schema>" +
+ "";
+
+ String[] schemas = { schema };
+
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ XmlObject x =
+ stl.parse(
+ "<base><foo/></base>", null, null );
+
+ Assert.assertTrue( x.validate() );
+
+ XmlCursor c = x.newCursor();
+
+ c.toFirstChild();
+
+ XmlObject base = c.getObject();
+
+ c.toEndToken();
+ c.insertElement( "bar" );
+
+ Assert.assertTrue( !x.validate() );
+
+ c.toPrevSibling();
+
+ c.removeXml();
+
+ Assert.assertTrue( x.validate() );
+
+ base.changeType( stl.findType( new QName( "derived" ) ) );
+
+ c.insertElement( "bar" );
+
+ Assert.assertTrue( x.validate() );
+ }
+
+ // Tests abstract & block attributes on ComplexType
+ public void testValidate8() throws Exception
+ {
+ String[] schemas = {
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>" +
+ "" +
+ " <xs:element name='abstract' type='abstract'/>" +
+ " <xs:element name='base' type='base'/>" +
+ "" +
+ " <xs:complexType name='abstract' abstract='true'/>" +
+ "" +
+ " <xs:complexType name='concrete'>" +
+ " <xs:complexContent>" +
+ " <xs:extension base='abstract'/>" +
+ " </xs:complexContent>" +
+ " </xs:complexType>" +
+ "" +
+ " <xs:complexType name='base' block='extension'/>" +
+ "" +
+ " <xs:complexType name='ext'>" +
+ " <xs:complexContent>" +
+ " <xs:extension base='base'/>" +
+ " </xs:complexContent>" +
+ " </xs:complexType>" +
+ "" +
+ " <xs:complexType name='rest'>" +
+ " <xs:complexContent>" +
+ " <xs:restriction base='base'/>" +
+ " </xs:complexContent>" +
+ " </xs:complexType>" +
+ "" +
+ "</xs:schema>" +
+ "",
+ };
+
+ String xsiType = " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
+
+ String[] valid = {
+ "<abstract" + xsiType + "xsi:type='concrete'/>",
+ "<base/>",
+ "<base" + xsiType + "xsi:type='rest'/>",
+ };
+ String[] invalid = {
+ "<abstract/>",
+ "<base" + xsiType + "xsi:type='ext'/>",
+ };
+
+ doTest(schemas, null, valid, invalid);
+ }
+
+ public void testValidate9() throws Exception
+ {
+
+ String[] schemas = {
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>" +
+ " <xs:element name='order' type='OrderType'>" +
+ " <xs:keyref name='prodNumKeyRef' refer='prodNumKey'>" +
+ " <xs:selector xpath='items/*'/>" +
+ " <xs:field xpath='@number'/>" +
+ " </xs:keyref>" +
+ " <xs:key name='prodNumKey'>" +
+ " <xs:selector xpath='.//product'/>" +
+ " <xs:field xpath='number'/>" +
+ " </xs:key>" +
+ " </xs:element>" +
+
+ " <xs:complexType name='OrderType'>" +
+ " <xs:sequence>" +
+ " <xs:element name='items'>" +
+ " <xs:complexType>" +
+ " <xs:sequence>" +
+ " <xs:element name='item' type='ItemType' minOccurs='0' maxOccurs='unbounded'/>" +
+ " </xs:sequence>" +
+ " </xs:complexType>" +
+ " </xs:element>" +
+ " <xs:element name='products'>" +
+ " <xs:complexType>" +
+ " <xs:sequence>" +
+ " <xs:element name='product' type='ProductType' maxOccurs='unbounded' minOccurs='0'/>" +
+ " </xs:sequence>" +
+ " </xs:complexType>" +
+ " </xs:element>" +
+ " </xs:sequence>" +
+ " <xs:attribute name='number' type='xs:string'/>" +
+ " </xs:complexType>" +
+
+ " <xs:complexType name='ItemType'>" +
+ " <xs:sequence>" +
+ " <xs:element name='quantity' type='xs:int'/>" +
+ " </xs:sequence>" +
+ " <xs:attribute name='number' type='xs:int'/>" +
+ " </xs:complexType>" +
+
+ " <xs:complexType name='ProductType'>" +
+ " <xs:sequence>" +
+ " <xs:element name='number' type='xs:int' minOccurs='0'/>" +
+ " <xs:element name='name' type='xs:string'/>" +
+ " <xs:element name='price'>" +
+ " <xs:complexType>" +
+ " <xs:simpleContent>" +
+ " <xs:extension base='xs:decimal'>" +
+ " <xs:attribute name='currency' type='xs:string'/>" +
+ " </xs:extension>" +
+ " </xs:simpleContent>" +
+ " </xs:complexType>" +
+ " </xs:element>" +
+ " </xs:sequence>" +
+ " </xs:complexType>" +
+ "</xs:schema> ",
+
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
+
+ " <xsd:element name='root' type='RootType'>" +
+ " <xsd:key name='FooId'>" +
+ " <xsd:selector xpath='.//string|.//token|.//int'/>" +
+ " <xsd:field xpath='@id'/>" +
+ " </xsd:key>" +
+ " </xsd:element>" +
+
+ " <xsd:group name='group'>" +
+ " <xsd:choice>" +
+ " <xsd:element ref='string'/>" +
+ " <xsd:element ref='token'/>" +
+ " <xsd:element ref='int'/>" +
+ " </xsd:choice>" +
+ " </xsd:group>" +
+
+ " <xsd:complexType name='RootType'>" +
+ " <xsd:group ref='group' minOccurs='0' maxOccurs='unbounded'/>" +
+ " </xsd:complexType>" +
+
+ " <xsd:element name='string'>" +
+ " <xsd:complexType>" +
+ " <xsd:group ref='group' minOccurs='0' maxOccurs='unbounded'/>" +
+ " <xsd:attribute name='id' type='xsd:string'/>" +
+ " </xsd:complexType>" +
+ " </xsd:element>" +
+
+ " <xsd:element name='int'>" +
+ " <xsd:complexType>" +
+ " <xsd:group ref='group' minOccurs='0' maxOccurs='unbounded'/>" +
+ " <xsd:attribute name='id' type='xsd:int'/>" +
+ " </xsd:complexType>" +
+ " </xsd:element>" +
+
+ " <xsd:element name='token'>" +
+ " <xsd:complexType>" +
+ " <xsd:group ref='group' minOccurs='0' maxOccurs='unbounded'/>" +
+ " <xsd:attribute name='id' type='xsd:token'/>" +
+ " </xsd:complexType>" +
+ " </xsd:element>" +
+
+ "</xsd:schema>",
+
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' " +
+ " targetNamespace='http://www.tim-hanson.com/' xmlns:th='http://www.tim-hanson.com/' " +
+ " attributeFormDefault='qualified' elementFormDefault='qualified'>" +
+
+ " <xsd:element name='root'>" +
+ " <xsd:complexType>" +
+ " <xsd:sequence>" +
+ " <xsd:element name='foo' maxOccurs='unbounded'>" +
+ " <xsd:complexType>" +
+ " <xsd:attribute name='id' type='xsd:int'/>" +
+ " </xsd:complexType>" +
+ " </xsd:element>" +
+ " </xsd:sequence>" +
+ " </xsd:complexType>" +
+ " <xsd:key name='id'>" +
+ " <xsd:selector xpath='./th:foo'/>" +
+ " <xsd:field xpath='@th:id'/>" +
+ " </xsd:key>" +
+ " </xsd:element>" +
+ "</xsd:schema>",
+
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >" +
+ " <xsd:element name='idtest'>" +
+ " <xsd:complexType>" +
+ " <xsd:sequence maxOccurs='unbounded'>" +
+ " <xsd:choice>" +
+ " <xsd:element name='id' maxOccurs='unbounded' type='xsd:ID'/>" +
+ " <xsd:element name='idref' maxOccurs='unbounded' type='xsd:IDREF'/>" +
+ " <xsd:element name='idrefs' maxOccurs='unbounded' type='xsd:IDREFS'/>" +
+ " </xsd:choice>" +
+ " </xsd:sequence>" +
+ " </xsd:complexType>" +
+ " </xsd:element>" +
+ "</xsd:schema>",
+
+ };
+
+ String[] valid = {
+ "<order>" +
+ " <items>" +
+ " <item number='124 '>" +
+ " <quantity>1</quantity>" +
+ " </item>" +
+ " <item number='563'>" +
+ " <quantity>1</quantity>" +
+ " </item>" +
+ " </items>" +
+ " <products>" +
+ " <product>" +
+ " <number> 124</number>" +
+ " <name>Shirt</name>" +
+ " <price currency='USD'>29.99</price>" +
+ " </product>" +
+ " <product>" +
+ " <number>563</number>" +
+ " <name>Hat</name>" +
+ " <price currency='USD'>69.99</price>" +
+ " </product>" +
+ " <product>" +
+ " <number>443</number>" +
+ " <name>Umbrella</name>" +
+ " <price currency='USD'>49.99</price>" +
+ " </product>" +
+ " </products>" +
+ "</order>",
+
+ "<root>" +
+ " <string id='foo1'>" +
+ " <string id='foo2'>" +
+ " <string id='foo3'>" +
+ " <string id='foo6'>" +
+ " <string id='foo7'>" +
+ " <string id='foo8'/>" +
+ " </string>" +
+ " </string>" +
+ " </string>" +
+ " <string id='foo4'/>" +
+ " </string>" +
+ " <string id='foo9'/>" +
+ " </string>" +
+ "</root>",
+
+ "<root>" +
+ " <int id='1'/>" +
+ " <string id='1'/>" +
+ "</root>",
+
+ "<xyz:root xmlns:xyz='http://www.tim-hanson.com/'>" +
+ " <xyz:foo xyz:id='1'/>" +
+ " <xyz:foo xyz:id='2'/>" +
+ " <xyz:foo xyz:id='3'/>" +
+ "</xyz:root>",
+
+ "<idtest>" +
+ " <idref>xyz</idref>" +
+ " <idrefs>abc def</idrefs>" +
+ " <id>abc</id>" +
+ " <id>def</id>" +
+ " <id>xyz</id>" +
+ " <idref>abc</idref>" +
+ " <idrefs>xyz abc</idrefs>" +
+ "</idtest>",
+ };
+
+ String[] invalid = {
+ "<order>" +
+ " <items>" +
+ " <item number='125 '>" +
+ " <quantity>1</quantity>" +
+ " </item>" +
+ " <item number='563'>" +
+ " <quantity>1</quantity>" +
+ " </item>" +
+ " </items>" +
+ " <products>" +
+ " <product>" +
+ " <number> 124</number>" +
+ " <name>Shirt</name>" +
+ " <price currency='USD'>29.99</price>" +
+ " </product>" +
+ " <product>" +
+ " <number>563</number>" +
+ " <name>Hat</name>" +
+ " <price currency='USD'>69.99</price>" +
+ " </product>" +
+ " <product>" +
+ " <number>443</number>" +
+ " <name>Umbrella</name>" +
+ " <price currency='USD'>49.99</price>" +
+ " </product>" +
+ " </products>" +
+ "</order>",
+
+ "<root>" +
+ " <token token=' blah blah'/>" +
+ " <string id='blah blah'/>" +
+ "</root>",
+
+ "<root>" +
+ " <string id='foo1'>" +
+ " <string id='foo2'>" +
+ " <string id='foo3'>" +
+ " <string id='foo6'>" +
+ " <string id='foo7'>" +
+ " <string id='foo3'/>" +
+ " </string>" +
+ " </string>" +
+ " </string>" +
+ " </string>" +
+ " </string>" +
+ "</root>",
+
+ "<xyz:root xmlns:xyz='http://www.tim-hanson.com/'>" +
+ " <xyz:foo xyz:id='1'/>" +
+ " <xyz:foo xyz:id='2'/>" +
+ " <xyz:foo xyz:id='2'/>" +
+ "</xyz:root>",
+ };
+
+ String[] invalidOnDocOnly = new String[]
+ {
+
+ "<idtest>" +
+ " <idref>foo</idref>" +
+ " <id>abc</id>" +
+ " <id>def</id>" +
+ " <id>xyz</id>" +
+ "</idtest>",
+
+ "<idtest>" +
+ " <idrefs>abc foo</idrefs>" +
+ " <id>abc</id>" +
+ " <id>def</id>" +
+ " <id>xyz</id>" +
+ "</idtest>",
+ };
+
+
+ doTest(schemas, null, valid, invalid, true);
+ doTest(schemas, null, valid, invalid, false);
+
+ // IDRefs are validated only if starting at the very root of the world
+ doTest(schemas, null, new String[0], invalidOnDocOnly, true);
+ doTest(schemas, null, invalidOnDocOnly, new String[0], false);
+ }
+
+ // Test validation of setting with the ValidateOnSet option
+ public void testValidate10() throws Exception {
+ String schema =
+ "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+ " <xs:simpleType name='dec-restriction'>" +
+ " <xs:restriction base='xs:decimal'>" +
+ " <xs:maxExclusive value='100'/>" +
+ " </xs:restriction>" +
+ " </xs:simpleType>" +
+ "</xs:schema>" +
+ "";
+
+ String[] schemas = { schema };
+
+ SchemaTypeLoader stl = makeSchemaTypeLoader( schemas );
+
+ XmlOptions validate = new XmlOptions().setValidateOnSet();
+ XmlOptions noValidate = new XmlOptions();
+
+ SchemaType st = stl.findType(new QName("", "dec-restriction"));
+
+ XmlDecimal dec = (XmlDecimal)stl.newInstance(st, validate);
+
+ try {
+ dec.set("200");
+ fail("Expected XmlValueOutOfRangeException");
+ }
+ catch (XmlValueOutOfRangeException e) {}
+
+ dec = (XmlDecimal)stl.newInstance(st, noValidate);
+
+ try {
+ dec.set("200");
+ }
+ catch (XmlValueOutOfRangeException e) {
+ fail("Should not throw exception");
+ }
+
+ }
+
+ // Bugzilla bug #26105: validate derived type from base type enumeration
+ public void testValidate11() throws Exception {
+ String schemas[] = {
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+
+ "<xsd:element name='enumDef' type='enumDefType'/>\n" +
+ "<xsd:complexType name='enumDefType'>\n" +
+ " <xsd:simpleContent>\n" +
+ " <xsd:extension base='enumType'/>\n" +
+ " </xsd:simpleContent>\n" +
+ "</xsd:complexType>\n" +
+
+ "<xsd:simpleType name='enumType'>\n" +
+ " <xsd:restriction base='xsd:token'>\n" +
+ " <xsd:enumeration value='enum1'/>\n" +
+ " </xsd:restriction>\n" +
+ "</xsd:simpleType>\n" +
+ "</xsd:schema>\n",
+ };
+
+ String[] valid = {
+ "<enumDef>enum1</enumDef>",
+ };
+
+ String[] invalid = {
+ "<enumDef>enum2/enumDef>",
+ };
+
+ doTest(schemas, null, valid, invalid);
+ }
+
+}
diff --git a/v1/test/src/drt/drtcases/XmlComparator.java b/v1/test/src/drt/drtcases/XmlComparator.java
new file mode 100644
index 0000000..772f8cd
--- /dev/null
+++ b/v1/test/src/drt/drtcases/XmlComparator.java
@@ -0,0 +1,213 @@
+/* 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 drtcases;
+
+import org.apache.xmlbeans.impl.common.QNameHelper;
+import org.apache.xmlbeans.impl.common.XmlWhitespace;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 30, 2003
+ */
+public class XmlComparator
+{
+ public static class Diagnostic
+ {
+ private StringBuffer message = null;
+
+ private void add(String s)
+ {
+ if (message==null)
+ message = new StringBuffer();
+
+ message.append(s).append("\n");
+ }
+
+ public boolean hasMessage()
+ {
+ return message!=null;
+ }
+
+ public String toString()
+ {
+ return (message==null ? null : message.toString());
+ }
+
+ public static void add(Diagnostic diag, String s)
+ {
+ if ( diag!=null)
+ diag.add(s);
+ }
+ }
+
+ public static boolean wsCollapseEqual(String s1, String s2)
+ {
+ String s1c = XmlWhitespace.collapse(s1);
+ String s2c = XmlWhitespace.collapse(s2);
+ return (s1c.equals(s2c));
+ }
+
+ public static boolean compareNamesAndAttributes(XmlCursor cur1, XmlCursor cur2, Diagnostic diag)
+ {
+ if (!cur1.getName().equals(cur2.getName()))
+ {
+ Diagnostic.add(diag, "Element names " + QNameHelper.pretty(cur1.getName()) + " and " + QNameHelper.pretty(cur2.getName()) + " do not match");
+ return false;
+ }
+
+ boolean more = cur1.toFirstAttribute();
+ if (more)
+ {
+ for (; more; more = cur1.toNextAttribute())
+ {
+ String text1 = cur1.getTextValue();
+ String text2 = cur2.getAttributeText(cur1.getName());
+ if (text2 == null)
+ {
+ Diagnostic.add(diag, "Attribute " + QNameHelper.pretty(cur1.getName()) + " not present");
+ return false;
+ }
+
+ if (!wsCollapseEqual(text1, text2))
+ {
+ Diagnostic.add(diag, "Attribute values for " + QNameHelper.pretty(cur1.getName()) + " do not match");
+ return false;
+ }
+ }
+ cur1.toParent();
+ }
+
+ more = cur2.toFirstAttribute();
+ if (more)
+ {
+ for (; more; more = cur2.toNextAttribute())
+ {
+ String text1 = cur1.getAttributeText(cur2.getName());
+ if (text1 == null)
+ {
+ Diagnostic.add(diag, "Attribute " + QNameHelper.pretty(cur2.getName()) + " not present");
+ return false;
+ }
+ }
+ cur2.toParent();
+ }
+
+ return true;
+ }
+
+ public static Diagnostic lenientlyCompareTwoXmlStrings(String actual, String expect)
+ throws XmlException
+ {
+ Diagnostic diag = new Diagnostic();
+ lenientlyCompareTwoXmlStrings(actual, expect, diag);
+ return diag;
+ }
+
+ /**
+ * Provides an utility to compare the xml inside the two strings
+ * @return true if the xml inside the two strings is leniently the same
+ * otherwise false
+ */
+ public static boolean lenientlyCompareTwoXmlStrings(String actual, String expect, Diagnostic diag)
+ throws XmlException
+ {
+ XmlObject xobj1 = XmlObject.Factory.parse(actual);
+ XmlObject xobj2 = XmlObject.Factory.parse(expect);
+
+ XmlCursor cur1 = xobj1.newCursor();
+ XmlCursor cur2 = xobj2.newCursor();
+
+ cur1.toFirstChild();
+ cur2.toFirstChild();
+
+ return lenientlyCompareTwoXmlStrings(cur1, cur2, diag);
+ }
+
+ /**
+ * Provides an utility to compare the xml inside the two cursors
+ * @return true if the xml inside the two strings is leniently the same
+ * otherwise false
+ */
+ public static boolean lenientlyCompareTwoXmlStrings(XmlCursor cur1, XmlCursor cur2, Diagnostic diag)
+ {
+ boolean match = true;
+ int depth = 0;
+ while (cur1.currentTokenType() != XmlCursor.TokenType.STARTDOC)
+ {
+ if (!compareNamesAndAttributes(cur1, cur2, diag))
+ {
+ match = false;
+ }
+
+ boolean hasChildren1 = cur1.toFirstChild();
+ boolean hasChildren2 = cur2.toFirstChild();
+ depth++;
+ if (hasChildren1 != hasChildren2)
+ {
+ Diagnostic.add(diag, "Topology differs: one document has children where the other does not (" + QNameHelper.pretty(cur1.getName()) + ", " + QNameHelper.pretty(cur2.getName()) + ")"); // TODO: where?
+ match = false;
+ if (hasChildren1)
+ {
+ cur1.toParent();
+ hasChildren1 = false;
+ }
+ if (hasChildren2)
+ {
+ cur2.toParent();
+ hasChildren2 = false;
+ }
+ }
+ else if (hasChildren1 == false)
+ {
+ if (!wsCollapseEqual(cur1.getTextValue(), cur2.getTextValue()))
+ {
+ Diagnostic.add(diag, "Value " + cur1.getTextValue() + " differs from value " + cur2.getTextValue());
+ match = false;
+ }
+ }
+
+ if (hasChildren1)
+ continue;
+
+ for (;;)
+ {
+ boolean hasSibling1 = cur1.toNextSibling();
+ boolean hasSibling2 = cur2.toNextSibling();
+
+ if (hasSibling1 != hasSibling2)
+ {
+ Diagnostic.add(diag, "Topology differs: one document has siblings where the other does not"); // TODO: where?
+ hasSibling1 = false;
+ hasSibling2 = false;
+ }
+
+ if (hasSibling1)
+ break;
+
+ cur1.toParent();
+ cur2.toParent();
+ depth--;
+
+ if (cur1.currentTokenType() == XmlCursor.TokenType.STARTDOC || depth<=0)
+ break;
+ }
+ }
+ return match;
+ }
+}
diff --git a/v1/test/src/easypo/easypo.xml b/v1/test/src/easypo/easypo.xml
new file mode 100644
index 0000000..a430661
--- /dev/null
+++ b/v1/test/src/easypo/easypo.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<purchase-order xmlns="http://openuri.org/easypo">
+ <customer age="34">
+ <name>Gladys Kravitz</name>
+ <address>Anytown, PA</address>
+ </customer>
+ <date>2003-01-07T14:16:00-05:00</date>
+ <line-item>
+ <description>Burnham's Celestial Handbook, Vol 1</description>
+ <per-unit-ounces>5</per-unit-ounces>
+ <price>21.79</price>
+ <quantity>2</quantity>
+ </line-item>
+ <line-item>
+ <description>Burnham's Celestial Handbook, Vol 2</description>
+ <per-unit-ounces>5</per-unit-ounces>
+ <price>19.89</price>
+ <quantity>2</quantity>
+ </line-item>
+ <shipper>
+ <name>ZipShip</name>
+ <per-ounce-rate>0.74</per-ounce-rate>
+ </shipper>
+</purchase-order>
diff --git a/v1/test/src/easypo/easypo.xsd b/v1/test/src/easypo/easypo.xsd
new file mode 100644
index 0000000..40e8373
--- /dev/null
+++ b/v1/test/src/easypo/easypo.xsd
@@ -0,0 +1,57 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:po="http://openuri.org/easypo"
+ targetNamespace="http://openuri.org/easypo"
+ elementFormDefault="qualified">
+
+ <xs:element name="purchase-order">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="customer" type="po:customer"/>
+ <xs:element name="date" type="xs:dateTime"/>
+ <xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="shipper" type="po:shipper" minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="customer">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="address" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="age" type="xs:int"/>
+ <xs:attribute name="moo" type="xs:int" default="100"/>
+ <xs:attribute name="poo" type="xs:int" fixed="200"/>
+ </xs:complexType>
+
+ <xs:complexType name="line-item">
+ <xs:sequence>
+ <xs:element name="description" type="xs:string"/>
+ <xs:element name="per-unit-ounces" type="xs:decimal"/>
+ <xs:element name="price" type="xs:decimal"/>
+ <xs:element name="quantity" type="xs:integer"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="shipper">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="per-ounce-rate" type="xs:decimal"/>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/v1/test/src/easypo/easypo.xsdconfig b/v1/test/src/easypo/easypo.xsdconfig
new file mode 100644
index 0000000..50e0220
--- /dev/null
+++ b/v1/test/src/easypo/easypo.xsdconfig
@@ -0,0 +1,29 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ xmlns:ep="http://openuri.org/easypo">
+
+ <xb:namespace uri="http://openuri.org/easypo">
+ <xb:package>com.easypo</xb:package>
+ </xb:namespace>
+
+ <xb:namespace uriprefix="http://openuri">
+ <xb:prefix>Xml</xb:prefix>
+ </xb:namespace>
+
+ <xb:namespace uriprefix="http://openuri.org/easy">
+ <xb:suffix>Bean</xb:suffix>
+ </xb:namespace>
+
+</xb:config>
diff --git a/v1/test/src/easypouse/com/bea/test/LoadAndUsePo.java b/v1/test/src/easypouse/com/bea/test/LoadAndUsePo.java
new file mode 100644
index 0000000..1dd118e
--- /dev/null
+++ b/v1/test/src/easypouse/com/bea/test/LoadAndUsePo.java
@@ -0,0 +1,63 @@
+/* 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 com.bea.test;
+
+import xml.util.*;
+import org.openuri.easypo.*;
+
+import java.io.File;
+
+public class LoadAndUsePo
+{
+ public static void main(String[] args) throws Exception
+ {
+ for (int i = 0; i < args.length; i++)
+ {
+ System.out.println("======================");
+ System.out.println("Loading file " + args[i]);
+ summarizePoDocument(PurchaseOrderDocument.Factory.parse(new File(args[i])));
+ }
+ }
+
+ public static void summarizePoDocument(PurchaseOrderDocument doc)
+ {
+ PurchaseOrder order = doc.getPurchaseOrder();
+ System.out.println("Customer: " + order.getCustomer().getName());
+ System.out.println("Address: " + order.getCustomer().getAddress());
+ LineItem[] item = order.getLineItem();
+ for (int i = 0; i < item.length; i++)
+ {
+ System.out.println("----------------------");
+ System.out.println("Item description: " + item[i].getDescription());
+ System.out.println(" Price: " + item[i].getPrice());
+ System.out.println(" Quantity: " + item[i].getQuantity());
+ System.out.println(" Ounces: " + item[i].getPerUnitOunces());
+ System.out.println(" ----------------");
+ System.out.println(" Amount: " + item[i].getAmount());
+ System.out.println(" Weight: " + item[i].getLineItemOunces());
+ }
+ System.out.println("----------------------");
+ if (order.isSetShipper())
+ {
+ System.out.println("Shipper: " + order.getShipper().getName());
+ System.out.println(" Per-ounce rate: " + order.getShipper().getPerOunceRate());
+ }
+ System.out.println("----------------------");
+ System.out.println("Total weight in ounces: " + order.getTotalOunces());
+ System.out.println("Shipping amount: " + order.getShippingAmount());
+ System.out.println("Total amount: " + order.getTotalAmount());
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/enumtest/enumtest.xsd b/v1/test/src/enumtest/enumtest.xsd
new file mode 100644
index 0000000..56b6545
--- /dev/null
+++ b/v1/test/src/enumtest/enumtest.xsd
@@ -0,0 +1,80 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:et="http://openuri.org/enumtest"
+ targetNamespace="http://openuri.org/enumtest"
+ elementFormDefault="qualified">
+
+ <xs:simpleType name="quantity">
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="all"/>
+ <xs:enumeration value="most"/>
+ <xs:enumeration value="some"/>
+ <xs:enumeration value="few"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="allOrNone">
+ <xs:restriction base="et:quantity">
+ <xs:enumeration value="all"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="data">
+ <xs:simpleContent>
+ <xs:extension base="et:quantity">
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="target" type="et:allOrNone"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="statusreport">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="status" type="et:data" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="salesreport">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="unit" minOccurs="0" maxOccurs="unbounded">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="one"/>
+ <xs:enumeration value="two"/>
+ <!-- skip a few -->
+ <xs:enumeration value="ninety-nine"/>
+ <xs:enumeration value="one-hundred"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- bug CR128906: gen'd java code must qualify java.lang.* types -->
+ <xs:simpleType name="object">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="abc"/>
+ <xs:enumeration value="def"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
diff --git a/v1/test/src/enumtest/enumtest.xsdconfig b/v1/test/src/enumtest/enumtest.xsdconfig
new file mode 100755
index 0000000..60de8cb
--- /dev/null
+++ b/v1/test/src/enumtest/enumtest.xsdconfig
@@ -0,0 +1,7 @@
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:namespace uriprefix="http://openuri.org/enum">
+ <xb:package>com.enumtest</xb:package>
+ </xb:namespace>
+
+</xb:config>
diff --git a/v1/test/src/ericschema/ericschema.xsd b/v1/test/src/ericschema/ericschema.xsd
new file mode 100644
index 0000000..ec0e663
--- /dev/null
+++ b/v1/test/src/ericschema/ericschema.xsd
@@ -0,0 +1,21 @@
+<!-- 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. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="asdasd">
+ <xs:complexType>
+ <xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/v1/test/src/erictest/EricTest.java b/v1/test/src/erictest/EricTest.java
new file mode 100644
index 0000000..c2d78a7
--- /dev/null
+++ b/v1/test/src/erictest/EricTest.java
@@ -0,0 +1,94 @@
+/* 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.
+ */
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.apache.xmlbeans.impl.store.Root;
+import org.apache.xmlbeans.impl.tool.CodeGenUtil;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlCursor.TokenType;
+import org.apache.xmlbeans.XmlCursor.XmlBookmark;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.GDateBuilder;
+import org.apache.xmlbeans.XmlDate;
+import org.apache.xmlbeans.XmlDocumentProperties;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlInt;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.XmlLineNumber;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.w3.x2001.xmlSchema.*;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xml.xmlbeans.x2004.x02.xbean.config.ConfigDocument;
+
+public class EricTest
+{
+ public static void main ( String[] args ) throws Exception
+ {
+ HashMap nses = new HashMap();
+ nses.put( "x", "x.com" );
+ nses.put( "y", "y.com" );
+ XmlOptions options = new XmlOptions();
+ options.setLoadAdditionalNamespaces( nses );
+
+ XmlObject x = XmlObject.Factory.parse( "<a></a>", options );
+ x.save( System.out );
+ }
+}
+
diff --git a/v1/test/src/extensions/averageCase/existing/FooHandler.java b/v1/test/src/extensions/averageCase/existing/FooHandler.java
new file mode 100644
index 0000000..016f8e6
--- /dev/null
+++ b/v1/test/src/extensions/averageCase/existing/FooHandler.java
@@ -0,0 +1,35 @@
+/* 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 averageCase.existing;
+
+import org.apache.xmlbeans.XmlObject;
+
+import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderDocument ;
+import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderType;
+import interfaceFeature.xbean.averageCase.purchaseOrder.Items.Item;
+
+public class FooHandler
+{
+ public static int getTotal(XmlObject xo)
+ {
+ PurchaseOrderDocument poDoc= (PurchaseOrderDocument)xo;
+ int sum=0;
+ Item[] items=poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ for (int i=0; i<items.length; i++)
+ sum+=items[i].getUSPrice().intValue();
+ return sum;
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/averageCase/existing/IFoo.java b/v1/test/src/extensions/averageCase/existing/IFoo.java
new file mode 100644
index 0000000..d106a5a
--- /dev/null
+++ b/v1/test/src/extensions/averageCase/existing/IFoo.java
@@ -0,0 +1,20 @@
+/* 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 averageCase.existing;
+
+public interface IFoo
+{
+ int getTotal();
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/averageCase/po.xsd b/v1/test/src/extensions/averageCase/po.xsd
new file mode 100644
index 0000000..eba58d6
--- /dev/null
+++ b/v1/test/src/extensions/averageCase/po.xsd
@@ -0,0 +1,60 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:po="http://xbean.interface_feature/averageCase/PurchaseOrder"
+targetNamespace="http://xbean.interface_feature/averageCase/PurchaseOrder"
+elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Purchase order schema for Example.com.
+ Copyright 2000 Example.com. All rights reserved.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="purchaseOrder" type="po:PurchaseOrderType"/>
+ <xsd:element name="comment" type="xsd:string"/>
+ <xsd:complexType name="PurchaseOrderType">
+ <xsd:sequence>
+ <xsd:element name="shipTo" type="po:USAddress"/>
+ <xsd:element name="billTo" type="po:USAddress"/>
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="items" type="po:Items"/>
+ </xsd:sequence>
+ <xsd:attribute name="orderDate" type="xsd:date"/>
+ </xsd:complexType>
+ <xsd:complexType name="USAddress">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" nillable="true"/>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ <xsd:element name="state" type="xsd:string"/>
+ <xsd:element name="zip" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
+ </xsd:complexType>
+ <xsd:complexType name="Items">
+ <xsd:sequence>
+ <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="productName" type="xsd:string"/>
+ <xsd:element name="quantity">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:positiveInteger">
+ <xsd:maxExclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="USPrice" type="xsd:decimal"/>
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="partNum" type="po:SKU" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <xsd:simpleType name="SKU">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d{3}-[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/src/extensions/averageCase/po.xsdconfig b/v1/test/src/extensions/averageCase/po.xsdconfig
new file mode 100644
index 0000000..d3d8c4a
--- /dev/null
+++ b/v1/test/src/extensions/averageCase/po.xsdconfig
@@ -0,0 +1,22 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:extension for="interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderDocument">
+ <xb:interface name="averageCase.existing.IFoo">
+ <xb:staticHandler>averageCase.existing.FooHandler</xb:staticHandler>
+ </xb:interface>
+ </xb:extension>
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensions/fixedAttrBean/existing/FooHandler.java b/v1/test/src/extensions/fixedAttrBean/existing/FooHandler.java
new file mode 100644
index 0000000..db627c4
--- /dev/null
+++ b/v1/test/src/extensions/fixedAttrBean/existing/FooHandler.java
@@ -0,0 +1,45 @@
+/* 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 fixedAttrBean.existing;
+
+import org.apache.xmlbeans.XmlObject;
+
+import interfaceFeature.xbean.fixedAttrBean.purchaseOrder.PurchaseOrderDocument;
+import interfaceFeature.xbean.fixedAttrBean.purchaseOrder.Items.Item;
+import java.math.BigDecimal;
+
+public class FooHandler
+{
+ public static void setPrice(XmlObject xo, int price)
+ {
+ PurchaseOrderDocument poDoc = (PurchaseOrderDocument) xo;
+ Item[] items = poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ BigDecimal o=new BigDecimal(price+"");
+ try
+ {
+ for (int i=0; i<items.length; i++)
+ items[i].setUSPrice(o);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
+
+ public static void getPrice(XmlObject xo)
+ {
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/fixedAttrBean/existing/IFoo.java b/v1/test/src/extensions/fixedAttrBean/existing/IFoo.java
new file mode 100644
index 0000000..5be39d5
--- /dev/null
+++ b/v1/test/src/extensions/fixedAttrBean/existing/IFoo.java
@@ -0,0 +1,21 @@
+/* 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 fixedAttrBean.existing;
+
+public interface IFoo
+{
+ void setPrice(int price);
+ void getPrice();
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/fixedAttrBean/po.xsd b/v1/test/src/extensions/fixedAttrBean/po.xsd
new file mode 100644
index 0000000..7070a9c
--- /dev/null
+++ b/v1/test/src/extensions/fixedAttrBean/po.xsd
@@ -0,0 +1,60 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:po="http://xbean.interface_feature/fixedAttrBean/PurchaseOrder"
+targetNamespace="http://xbean.interface_feature/fixedAttrBean/PurchaseOrder"
+elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Purchase order schema for Example.com.
+ Copyright 2000 Example.com. All rights reserved.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="purchaseOrder" type="po:PurchaseOrderType"/>
+ <xsd:element name="comment" type="xsd:string"/>
+ <xsd:complexType name="PurchaseOrderType">
+ <xsd:sequence>
+ <xsd:element name="shipTo" type="po:USAddress"/>
+ <xsd:element name="billTo" type="po:USAddress"/>
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="items" type="po:Items"/>
+ </xsd:sequence>
+ <xsd:attribute name="orderDate" type="xsd:date"/>
+ </xsd:complexType>
+ <xsd:complexType name="USAddress">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" nillable="true"/>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ <xsd:element name="state" type="xsd:string"/>
+ <xsd:element name="zip" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
+ </xsd:complexType>
+ <xsd:complexType name="Items">
+ <xsd:sequence>
+ <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="productName" type="xsd:string"/>
+ <xsd:element name="quantity">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:positiveInteger">
+ <xsd:maxExclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="USPrice" type="xsd:decimal" fixed="30" />
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="partNum" type="po:SKU" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <xsd:simpleType name="SKU">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d{3}-[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/src/extensions/fixedAttrBean/po.xsdconfig b/v1/test/src/extensions/fixedAttrBean/po.xsdconfig
new file mode 100644
index 0000000..9899c0b
--- /dev/null
+++ b/v1/test/src/extensions/fixedAttrBean/po.xsdconfig
@@ -0,0 +1,22 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:extension for="interfaceFeature.xbean.fixedAttrBean.purchaseOrder.PurchaseOrderDocument">
+ <xb:interface name="fixedAttrBean.existing.IFoo">
+ <xb:staticHandler>fixedAttrBean.existing.FooHandler</xb:staticHandler>
+ </xb:interface>
+ </xb:extension>
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensions/multInterfaces/existing/IReport.java b/v1/test/src/extensions/multInterfaces/existing/IReport.java
new file mode 100644
index 0000000..a66a338
--- /dev/null
+++ b/v1/test/src/extensions/multInterfaces/existing/IReport.java
@@ -0,0 +1,26 @@
+/* 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 multInterfaces.existing;
+
+import org.apache.xmlbeans.XmlObject;
+
+public interface IReport extends ISum
+{
+ int getMinPrice();
+
+ XmlObject getCheapestItem();
+
+ void setMinPrice(double price);
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/multInterfaces/existing/ISum.java b/v1/test/src/extensions/multInterfaces/existing/ISum.java
new file mode 100644
index 0000000..8e5b7df
--- /dev/null
+++ b/v1/test/src/extensions/multInterfaces/existing/ISum.java
@@ -0,0 +1,20 @@
+/* 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 multInterfaces.existing;
+
+public interface ISum
+{
+ int getTotal();
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/multInterfaces/existing/ReportHandler.java b/v1/test/src/extensions/multInterfaces/existing/ReportHandler.java
new file mode 100644
index 0000000..d52850f
--- /dev/null
+++ b/v1/test/src/extensions/multInterfaces/existing/ReportHandler.java
@@ -0,0 +1,89 @@
+/* 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 multInterfaces.existing;
+
+import org.apache.xmlbeans.XmlObject;
+
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.PurchaseOrderDocument;
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.Items.Item;
+
+
+import java.math.BigDecimal;
+
+public class ReportHandler
+{
+ public static int getTotal(XmlObject xo)
+ {
+
+ int sum = 0;
+ PurchaseOrderDocument poDoc = (PurchaseOrderDocument) xo;
+ Item[] items = poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ for (int i = 0; i < items.length; i++)
+ sum += items[i].getUSPrice().intValue();
+ return sum;
+ }
+
+ public static int getMinPrice(XmlObject xo)
+ {
+ PurchaseOrderDocument poDoc = (PurchaseOrderDocument) xo;
+ Item[] items = poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ int min = Integer.MAX_VALUE;
+ for (int i = 0; i < items.length; i++)
+ {
+ int tmp = items[i].getUSPrice().intValue();
+
+ min = min > tmp ? tmp : min;
+ }
+ return min;
+ }
+
+ public static XmlObject getCheapestItem(XmlObject xo)
+ {
+ PurchaseOrderDocument poDoc = (PurchaseOrderDocument) xo;
+ Item[] items = poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ int min = Integer.MAX_VALUE;
+ XmlObject item = null;
+
+ for (int i = 0; i < items.length; i++)
+ {
+ int tmp = items[i].getUSPrice().intValue();
+ if (min > tmp)
+ {
+ min = tmp;
+ item = items[i];
+ }
+ }
+ return item;
+ }
+
+ public static void setMinPrice(XmlObject xo, double min_price)
+ {
+ PurchaseOrderDocument poDoc = (PurchaseOrderDocument) xo;
+ Item[] items = poDoc.getPurchaseOrder().getItems().getItemArray();
+
+ BigDecimal newPrice = new BigDecimal(min_price);
+
+ for (int i = 0; i < items.length; i++)
+ {
+
+ int tmp = items[i].getUSPrice().intValue();
+ if (min_price > tmp)
+ items[i].setUSPrice(newPrice);
+ }
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/multInterfaces/po.xsd b/v1/test/src/extensions/multInterfaces/po.xsd
new file mode 100644
index 0000000..8a57dd1
--- /dev/null
+++ b/v1/test/src/extensions/multInterfaces/po.xsd
@@ -0,0 +1,60 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:po="http://xbean.interface_feature/multInterfaces/PurchaseOrder"
+targetNamespace="http://xbean.interface_feature/multInterfaces/PurchaseOrder"
+elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Purchase order schema for Example.com.
+ Copyright 2000 Example.com. All rights reserved.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="purchaseOrder" type="po:PurchaseOrderType"/>
+ <xsd:element name="comment" type="xsd:string"/>
+ <xsd:complexType name="PurchaseOrderType">
+ <xsd:sequence>
+ <xsd:element name="shipTo" type="po:USAddress"/>
+ <xsd:element name="billTo" type="po:USAddress"/>
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="items" type="po:Items"/>
+ </xsd:sequence>
+ <xsd:attribute name="orderDate" type="xsd:date"/>
+ </xsd:complexType>
+ <xsd:complexType name="USAddress">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" nillable="true"/>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ <xsd:element name="state" type="xsd:string"/>
+ <xsd:element name="zip" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
+ </xsd:complexType>
+ <xsd:complexType name="Items">
+ <xsd:sequence>
+ <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="productName" type="xsd:string"/>
+ <xsd:element name="quantity">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:positiveInteger">
+ <xsd:maxExclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="USPrice" type="xsd:decimal" fixed="30" />
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="partNum" type="po:SKU" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <xsd:simpleType name="SKU">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d{3}-[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/src/extensions/multInterfaces/po.xsdconfig b/v1/test/src/extensions/multInterfaces/po.xsdconfig
new file mode 100644
index 0000000..c56f91e
--- /dev/null
+++ b/v1/test/src/extensions/multInterfaces/po.xsdconfig
@@ -0,0 +1,24 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <!-- for="interfaceFeature.xbean.multInterfaces.PurchaseOrder.PurchaseOrderDocument"-->
+ <xb:extension for="interfaceFeature.xbean.multInterfaces.purchaseOrder.PurchaseOrderDocument">
+ <xb:interface name="multInterfaces.existing.IReport">
+ <xb:staticHandler>multInterfaces.existing.ReportHandler</xb:staticHandler>
+ </xb:interface>
+
+ </xb:extension>
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensions/myPackage/Bar.java b/v1/test/src/extensions/myPackage/Bar.java
new file mode 100644
index 0000000..bcfffb9
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/Bar.java
@@ -0,0 +1,29 @@
+/* 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 myPackage;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+
+public interface Bar
+{
+ byte[] bar(String s) throws MyException;
+
+ public static class MyException extends Exception
+ {
+ }
+}
diff --git a/v1/test/src/extensions/myPackage/BarHandler.java b/v1/test/src/extensions/myPackage/BarHandler.java
new file mode 100644
index 0000000..bc8bbd0
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/BarHandler.java
@@ -0,0 +1,35 @@
+/* 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 myPackage;
+
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+
+public class BarHandler
+{
+ public static byte[] bar(XmlObject xo, String s) throws Bar.MyException
+ {
+ String msg = "{in BarHandler.handleBar(s: " + s + ")}";
+
+ if (s==null)
+ throw new Bar.MyException();
+
+ return msg.getBytes();
+ }
+}
diff --git a/v1/test/src/extensions/myPackage/Foo.java b/v1/test/src/extensions/myPackage/Foo.java
new file mode 100644
index 0000000..310ccd9
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/Foo.java
@@ -0,0 +1,26 @@
+/* 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 myPackage;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+
+public interface Foo
+{
+ String foo(String s);
+ String getName();
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/myPackage/FooHandler.java b/v1/test/src/extensions/myPackage/FooHandler.java
new file mode 100644
index 0000000..ccf71eb
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/FooHandler.java
@@ -0,0 +1,84 @@
+/* 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 myPackage;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Apr 25, 2004
+ */
+
+public class FooHandler
+{
+ public static String foo(XmlObject xo, String s)
+ {
+ return "{in FooHandler.handleFoo(s: " + s + ")}";
+ }
+
+ public static String getName(XmlObject xo)
+ {
+ return "{name in FooHandler}";
+ }
+
+ // for testing pre and post calls
+ public static class PreBookmark extends XmlCursor.XmlBookmark
+ {
+ String _msg;
+
+ PreBookmark(String msg)
+ {
+ _msg = msg;
+ }
+
+ public String getMsg()
+ {
+ return _msg;
+ }
+ }
+
+ public static class PostBookmark extends XmlCursor.XmlBookmark
+ {
+ String _msg;
+
+ PostBookmark(String msg)
+ {
+ _msg = msg;
+ }
+
+ public String getMsg()
+ {
+ return _msg;
+ }
+ }
+
+ public static boolean preSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {
+ XmlCursor xc = xo.newCursor();
+ xc.setBookmark(new PreBookmark("{preSet in FooHandler: " + opType + ", " + xo + ", " + prop + ", " + isAttr + ", " + index + "}"));
+ xc.dispose();
+ return true;
+ }
+
+ public static void postSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {
+ XmlCursor xc = xo.newCursor();
+ xc.setBookmark(new PostBookmark("{postSet in FooHandler: " + opType + ", " + xo + ", " + prop + ", " + isAttr + ", " + index + "}"));
+ xc.dispose();
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/extensions/myPackage/company.xsd b/v1/test/src/extensions/myPackage/company.xsd
new file mode 100644
index 0000000..baaabc2
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/company.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<xsd:schema targetNamespace="company.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:company="company.xsd">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="consultantOfTheMonth" type="xsd:string"/>
+ <xsd:anyAttribute namespace="http://www.omg.org/XMI" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="department" type="company:DepartmentType"/>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="deptID" type="xsd:int"/>
+ <xsd:anyAttribute namespace="http://www.omg.org/XMI" processContents="lax"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/v1/test/src/extensions/myPackage/company.xsdconfig b/v1/test/src/extensions/myPackage/company.xsdconfig
new file mode 100644
index 0000000..9002289
--- /dev/null
+++ b/v1/test/src/extensions/myPackage/company.xsdconfig
@@ -0,0 +1,31 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:extension for="*">
+ <xb:interface name="myPackage.Foo">
+ <xb:staticHandler>myPackage.FooHandler</xb:staticHandler>
+ </xb:interface>
+ <xb:prePostSet>
+ <xb:staticHandler>myPackage.FooHandler</xb:staticHandler>
+ </xb:prePostSet>
+ </xb:extension>
+
+ <xb:extension for="xsd.company.CompanyDocument">
+ <xb:interface name="myPackage.Bar">
+ <xb:staticHandler>myPackage.BarHandler</xb:staticHandler>
+ </xb:interface>
+ </xb:extension>
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsd b/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsd
new file mode 100644
index 0000000..25e5608
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsd
@@ -0,0 +1,51 @@
+<!-- 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. -->
+<!--this is schema company.xsd stripped down and modified to have a value restriction on the employees age-->
+
+<xsd:schema
+targetNamespace="prePostFeature/xbean/ValueRestriction/company"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:company="prePostFeature/xbean/ValueRestriction/company">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+
+ <xsd:anyAttribute namespace="http://www.omg.org/XMI" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="department" type="company:DepartmentType"/>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="consultant" type="company:ConsultantType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="http://www.omg.org/XMI" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:complexType name="ConsultantType">
+
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="age" type="company:age"/>
+ <xsd:anyAttribute namespace="http://www.omg.org/XMI" processContents="lax"/>
+
+ </xsd:complexType>
+
+
+ <xsd:simpleType name="age">
+ <xsd:restriction base="xsd:integer">
+ <xsd:minInclusive value="0"/>
+ <xsd:maxInclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsdconfig b/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsdconfig
new file mode 100644
index 0000000..eb1c07d
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/ValueRestriction/company.xsdconfig
@@ -0,0 +1,26 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:extension for="*">
+ <xb:interface name="prePostFeature.ValueRestriction.existing.ISetter">
+ <xb:staticHandler>prePostFeature.ValueRestriction.existing.SetterHandler</xb:staticHandler>
+ </xb:interface>
+ <xb:prePostSet>
+ <xb:staticHandler>prePostFeature.ValueRestriction.existing.SetterHandler</xb:staticHandler>
+ </xb:prePostSet>
+ </xb:extension>
+
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/ISetter.java b/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/ISetter.java
new file mode 100644
index 0000000..19d21fc
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/ISetter.java
@@ -0,0 +1,24 @@
+/* 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 prePostFeature.ValueRestriction.existing;
+
+/**
+ * User: ykadiysk
+ * Date: May 5, 2004
+ */
+public interface ISetter
+{
+ public void setEmployeeAge(int age);
+}
diff --git a/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/SetterHandler.java b/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/SetterHandler.java
new file mode 100644
index 0000000..cfbd6a3
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/ValueRestriction/existing/SetterHandler.java
@@ -0,0 +1,52 @@
+/* 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 prePostFeature.ValueRestriction.existing;
+
+import org.apache.xmlbeans.XmlObject;
+import prePostFeature.xbean.valueRestriction.company.ConsultantType;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author ykadiysk
+ */
+public class SetterHandler
+{
+
+ public static boolean bReady = false;
+
+ public static void setEmployeeAge(XmlObject xo, int age)
+ {
+ ((ConsultantType) xo).setAge(age);
+ }
+
+ private static XmlObject origValue;
+
+ public static boolean preSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {
+ origValue = xo.copy();
+ return true;
+ }
+
+ public static void postSet(int opType, XmlObject xo, QName propertyName, boolean isAttr, int index)
+ {
+ if (!xo.validate() && (opType == org.apache.xmlbeans.impl.config.PrePostExtension.OPERATION_SET) && bReady)
+ xo.set(origValue);
+ xo.validate();
+ }
+
+
+}
diff --git a/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/FooHandler.java b/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/FooHandler.java
new file mode 100644
index 0000000..81733b3
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/FooHandler.java
@@ -0,0 +1,53 @@
+/* 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 prePostFeature.readOnlyBean.existing;
+
+import org.apache.xmlbeans.XmlObject;
+
+
+import prePostFeature.xbean.readOnlyBean.purchaseOrder.PurchaseOrderDocument;
+import prePostFeature.xbean.readOnlyBean.purchaseOrder.Items.Item;
+
+import javax.xml.namespace.QName;
+import java.math.BigDecimal;
+
+public class FooHandler
+{
+ public static boolean preSet(int opType, XmlObject xo, QName prop, boolean isAttr, int index)
+ {
+ if (opType == org.apache.xmlbeans.impl.config.PrePostExtension.OPERATION_SET)
+ return false;
+ return true;
+ }
+
+ public static void postSet(int opType, XmlObject xo, QName propertyName, boolean isAttr, int index)
+ {
+ if (opType == org.apache.xmlbeans.impl.config.PrePostExtension.OPERATION_SET)
+ System.err.println("No setters are allowed for this bean:" + " value unchanged" + propertyName);
+ }
+
+ public static void setPrice(XmlObject xo, int price)
+ {
+ Item it = (Item) xo;
+ BigDecimal o = new BigDecimal(price + "");
+ it.setUSPrice(o);
+ }
+
+ public static double getPrice(XmlObject xo)
+ {
+ Item it = (Item) xo;
+ return it.getUSPrice().doubleValue();
+ }
+}
diff --git a/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/IFoo.java b/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/IFoo.java
new file mode 100644
index 0000000..0cc4e34
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/readOnlyBean/existing/IFoo.java
@@ -0,0 +1,27 @@
+/* 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 prePostFeature.readOnlyBean.existing;
+
+/**
+ * User: ykadiysk
+ * Date: May 4, 2004
+ */
+public interface IFoo
+{
+ void setPrice(int price);
+
+ double getPrice();
+}
+
diff --git a/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsd b/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsd
new file mode 100644
index 0000000..189d6e5
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsd
@@ -0,0 +1,60 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:po="http://xbean.prePost_feature/readOnlyBean/PurchaseOrder"
+targetNamespace="http://xbean.prePost_feature/readOnlyBean/PurchaseOrder"
+elementFormDefault="qualified">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Purchase order schema for Example.com.
+ Copyright 2000 Example.com. All rights reserved.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="purchaseOrder" type="po:PurchaseOrderType"/>
+ <xsd:element name="comment" type="xsd:string"/>
+ <xsd:complexType name="PurchaseOrderType">
+ <xsd:sequence>
+ <xsd:element name="shipTo" type="po:USAddress"/>
+ <xsd:element name="billTo" type="po:USAddress"/>
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="items" type="po:Items"/>
+ </xsd:sequence>
+ <xsd:attribute name="orderDate" type="xsd:date"/>
+ </xsd:complexType>
+ <xsd:complexType name="USAddress">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" nillable="true"/>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ <xsd:element name="state" type="xsd:string"/>
+ <xsd:element name="zip" type="xsd:decimal"/>
+ </xsd:sequence>
+ <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
+ </xsd:complexType>
+ <xsd:complexType name="Items">
+ <xsd:sequence>
+ <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="productName" type="xsd:string"/>
+ <xsd:element name="quantity">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:positiveInteger">
+ <xsd:maxExclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="USPrice" type="xsd:decimal" fixed="30" />
+ <xsd:element ref="po:comment" minOccurs="0"/>
+ <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="partNum" type="po:SKU" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <xsd:simpleType name="SKU">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="\d{3}-[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
diff --git a/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsdconfig b/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsdconfig
new file mode 100644
index 0000000..c764fcb
--- /dev/null
+++ b/v1/test/src/extensions/prePostFeature/readOnlyBean/po.xsdconfig
@@ -0,0 +1,25 @@
+<!-- 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+ <xb:extension for="*">
+ <xb:interface name="prePostFeature.readOnlyBean.existing.IFoo">
+ <xb:staticHandler>prePostFeature.readOnlyBean.existing.FooHandler</xb:staticHandler>
+ </xb:interface>
+ <xb:prePostSet>
+ <xb:staticHandler>prePostFeature.readOnlyBean.existing.FooHandler</xb:staticHandler>
+ </xb:prePostSet>
+ </xb:extension>
+
+</xb:config>
\ No newline at end of file
diff --git a/v1/test/src/extensionsuse/drtcases/AverageCaseTest.java b/v1/test/src/extensionsuse/drtcases/AverageCaseTest.java
new file mode 100644
index 0000000..bdb1e6e
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/AverageCaseTest.java
@@ -0,0 +1,47 @@
+package drtcases;
+
+import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderDocument;
+import interfaceFeature.xbean.averageCase.purchaseOrder.PurchaseOrderType;
+import interfaceFeature.xbean.averageCase.purchaseOrder.Items;
+
+import junit.framework.*;
+
+import java.math.BigDecimal;
+
+
+public class AverageCaseTest extends TestCase
+{
+ public AverageCaseTest(String s)
+ {
+ super(s);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(AverageCaseTest.class);
+ }
+
+ public void test()
+ {
+ PurchaseOrderDocument poDoc;
+
+ poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+ int LEN = 20;
+
+ Items.Item[] it = new Items.Item[LEN];
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i] = Items.Item.Factory.newInstance();
+ it[i].setUSPrice(new BigDecimal("" + 2));
+ }
+ Items items = Items.Factory.newInstance();
+ items.setItemArray(it);
+ po.setItems(items);
+ // System.out.println("poDoc: " + poDoc);
+
+ int i = poDoc.getTotal();
+//20 items @ $2
+ assertEquals(40, i);
+ }
+}
diff --git a/v1/test/src/extensionsuse/drtcases/ExtensionsTest.java b/v1/test/src/extensionsuse/drtcases/ExtensionsTest.java
new file mode 100644
index 0000000..faade19
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/ExtensionsTest.java
@@ -0,0 +1,47 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import drtcases.prePostFeature.readOnlyBean.ReadOnlyTest;
+import drtcases.prePostFeature.ValueRestriction.ValueRestrictionTest;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Mar 28, 2004
+ */
+public class ExtensionsTest extends TestCase
+{
+ public ExtensionsTest(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.addTest(SimpleTest.suite());
+ suite.addTest(AverageCaseTest.suite());
+ suite.addTest(FixedAttrTest.suite());
+ suite.addTest(MultInterfacesTest.suite());
+ suite.addTest(ReadOnlyTest.suite());
+ suite.addTest(ValueRestrictionTest.suite());
+
+ return suite;
+ }
+}
diff --git a/v1/test/src/extensionsuse/drtcases/FixedAttrTest.java b/v1/test/src/extensionsuse/drtcases/FixedAttrTest.java
new file mode 100644
index 0000000..6f1fe5a
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/FixedAttrTest.java
@@ -0,0 +1,74 @@
+package drtcases;
+
+import interfaceFeature.xbean.fixedAttrBean.purchaseOrder.PurchaseOrderDocument;
+import interfaceFeature.xbean.fixedAttrBean.purchaseOrder.PurchaseOrderType;
+import interfaceFeature.xbean.fixedAttrBean.purchaseOrder.Items;
+
+
+import java.math.BigDecimal;
+
+import junit.framework.*;
+
+public class FixedAttrTest extends TestCase
+{
+ public FixedAttrTest(String s)
+ {
+ super(s);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(FixedAttrTest.class);
+ }
+
+ public void test()
+ {
+
+ PurchaseOrderDocument poDoc;
+
+ poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+ int LEN = 20;
+
+ Items.Item[] it = new Items.Item[LEN];
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i] = Items.Item.Factory.newInstance();
+ it[i].setUSPrice(new BigDecimal("" + 4));
+ }
+ Items items = Items.Factory.newInstance();
+ items.setItemArray(it);
+ po.setItems(items);
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("<pur:purchaseOrder xmlns:pur=\"http://xbean.interface_feature/fixedAttrBean/PurchaseOrder\">");
+
+ sb.append("<pur:items>");
+
+ StringBuffer sbContent = new StringBuffer();
+ for (int i = 0; i < LEN; i++)
+ sbContent.append("<pur:item><pur:USPrice>4</pur:USPrice></pur:item>");
+
+ int pos = sb.length();
+ sb.append("</pur:items></pur:purchaseOrder>");
+
+ String sExpected = sb.subSequence(0, pos) + sbContent.toString() + sb.subSequence(pos, sb.length());
+
+ assertEquals(sExpected, poDoc.xmlText());
+
+ try
+ {
+ poDoc.setPrice(10);
+
+ }
+ catch (Exception t)
+ {
+ t.printStackTrace(System.err);
+ System.exit(-1);
+ }
+
+
+ assertTrue(!poDoc.validate());
+ }
+
+}
diff --git a/v1/test/src/extensionsuse/drtcases/MultInterfacesTest.java b/v1/test/src/extensionsuse/drtcases/MultInterfacesTest.java
new file mode 100644
index 0000000..674834d
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/MultInterfacesTest.java
@@ -0,0 +1,88 @@
+package drtcases;
+
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.PurchaseOrderDocument;
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.PurchaseOrderType;
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.Items;
+import interfaceFeature.xbean.multInterfaces.purchaseOrder.Items.Item;
+
+import java.math.BigDecimal;
+
+import org.apache.xmlbeans.XmlObject;
+
+import junit.framework.*;
+
+public class MultInterfacesTest extends TestCase
+{
+ public MultInterfacesTest(String s)
+ {
+ super(s);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(MultInterfacesTest.class);
+ }
+
+ public void test()
+ {
+
+
+ PurchaseOrderDocument poDoc = null;
+
+ poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+ int LEN = 20;
+
+ Items.Item[] it = new Items.Item[LEN];
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i] = Items.Item.Factory.newInstance();
+ it[i].setUSPrice(new BigDecimal("" + i));
+ }
+ Items items = Items.Factory.newInstance();
+ items.setItemArray(it);
+ po.setItems(items);
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("<pur:purchaseOrder xmlns:pur=\"http://xbean.interface_feature/multInterfaces/PurchaseOrder\">");
+
+ sb.append("<pur:items>");
+
+ StringBuffer sbContent = new StringBuffer();
+ for (int i = 0; i < LEN; i++)
+ sbContent.append("<pur:item><pur:USPrice>" + i + "</pur:USPrice></pur:item>");
+
+ int pos = sb.length();
+ sb.append("</pur:items></pur:purchaseOrder>");
+
+ String sExpected = sb.subSequence(0, pos) + sbContent.toString() + sb.subSequence(pos, sb.length());
+ assertEquals(sExpected, poDoc.xmlText());
+
+
+ assertEquals(0, poDoc.getMinPrice());
+ int price = 10;
+
+ poDoc.setMinPrice((double) price);
+
+ sbContent = new StringBuffer();
+ for (int i = 0; i < LEN; i++)
+ if (i < price)
+ sbContent.append("<pur:item><pur:USPrice>" + price + "</pur:USPrice></pur:item>");
+ else
+ sbContent.append("<pur:item><pur:USPrice>" + i + "</pur:USPrice></pur:item>");
+ sExpected = sb.subSequence(0, pos) + sbContent.toString() + sb.subSequence(pos, sb.length());
+ assertEquals(sExpected, poDoc.xmlText());
+
+ assertEquals(price, poDoc.getMinPrice());
+
+ int expTotal = (price - 1) * price + (price + 1 + LEN) * (LEN - price) / 2;
+ assertEquals(expTotal, poDoc.getTotal());
+
+ XmlObject item = poDoc.getCheapestItem();
+
+ Item expected = it[0];
+ expected.setUSPrice(new BigDecimal(30d));
+ // assertEquals(expected, item );
+ }
+
+}
diff --git a/v1/test/src/extensionsuse/drtcases/SimpleTest.java b/v1/test/src/extensionsuse/drtcases/SimpleTest.java
new file mode 100644
index 0000000..13ff1fb
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/SimpleTest.java
@@ -0,0 +1,145 @@
+/* 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 drtcases;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import xsd.company.CompanyDocument;
+import xsd.company.CompanyType;
+import myPackage.Foo;
+import myPackage.Bar;
+import myPackage.FooHandler;
+import myPackage.FooHandler.PreBookmark;
+import myPackage.FooHandler.PostBookmark;
+import org.apache.xmlbeans.XmlCursor;
+
+/**
+ * Author: Cezar Andrei ( cezar.andrei at bea.com )
+ * Date: Mar 28, 2004
+ */
+public class SimpleTest extends TestCase
+{
+ public SimpleTest(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(SimpleTest.class);
+ }
+
+ public void testInterfaces()
+ {
+ String expected;
+ String actual;
+
+ CompanyDocument cDoc = CompanyDocument.Factory.newInstance();
+
+ CompanyType co = cDoc.addNewCompany();
+ co.setName2("xbean name");
+
+ expected = "xbean name";
+ actual = co.getName2();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+ expected = "{name in FooHandler}";
+ actual = co.getName();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+ Foo foo = cDoc;
+
+ expected = "{in FooHandler.handleFoo(s: param)}";
+ actual = foo.foo("param");
+ Assert.assertTrue("Expected: '" + expected + "'\n actual: '" + actual + "'", expected.equals(actual));
+
+
+ Bar bar = null;
+
+ try
+ {
+ bar = cDoc;
+ byte[] ba = bar.bar("param for bar");
+
+ expected = "{in BarHandler.handleBar(s: param for bar)}";
+ actual = new String(bar.bar("param for bar"));
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+ }
+ catch (Bar.MyException e)
+ {
+ Assert.assertTrue(false);
+ }
+
+ try
+ {
+ bar.bar(null);
+ Assert.assertTrue(false);
+ }
+ catch (Bar.MyException e)
+ {
+ Assert.assertTrue(true);
+ }
+ }
+
+ public void testPrePost()
+ {
+ String expected;
+ String actual;
+ XmlCursor xc;
+
+ CompanyDocument cDoc = CompanyDocument.Factory.newInstance();
+
+ // add new
+ CompanyType co = cDoc.addNewCompany();
+
+ xc = cDoc.newCursor();
+ PreBookmark prebk = (PreBookmark) xc.getBookmark(PreBookmark.class);
+
+ expected = "{preSet in FooHandler: 2, <xml-fragment></xml-fragment>, {company.xsd}company, false, -1}";
+ actual = prebk.getMsg();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+
+ PostBookmark postbk = (PostBookmark) xc.getBookmark(PostBookmark.class);
+
+ expected = "{postSet in FooHandler: 2, " + cDoc + ", {company.xsd}company, false, -1}";
+ actual = postbk.getMsg();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+ xc.dispose();
+
+
+ // set
+ co.setName2("xbean name");
+
+ xc = co.newCursor();
+ prebk = (PreBookmark) xc.getBookmark(PreBookmark.class);
+
+ expected = "{preSet in FooHandler: 1, <xml-fragment/>, name, true, -1}";
+ actual = prebk.getMsg();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+
+ postbk = (PostBookmark) xc.getBookmark(PostBookmark.class);
+
+ expected = "{postSet in FooHandler: 1, " + co + ", name, true, -1}";
+ actual = postbk.getMsg();
+ Assert.assertTrue("Expected: " + expected + "\n actual: " + actual, expected.equals(actual));
+
+ xc.dispose();
+ }
+}
diff --git a/v1/test/src/extensionsuse/drtcases/prePostFeature/ValueRestriction/ValueRestrictionTest.java b/v1/test/src/extensionsuse/drtcases/prePostFeature/ValueRestriction/ValueRestrictionTest.java
new file mode 100644
index 0000000..4dc1836
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/prePostFeature/ValueRestriction/ValueRestrictionTest.java
@@ -0,0 +1,74 @@
+package drtcases.prePostFeature.ValueRestriction;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import prePostFeature.xbean.valueRestriction.company.*;
+import org.apache.xmlbeans.XmlString;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ykadiysk
+ * Date: May 5, 2004
+ * Time: 11:23:35 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ValueRestrictionTest extends TestCase
+{
+ public ValueRestrictionTest(String s)
+ {
+ super(s);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ValueRestrictionTest.class);
+ }
+
+ public void test() throws Exception
+ {
+ CompanyDocument poDoc;
+
+ poDoc = CompanyDocument.Factory.newInstance();
+ CompanyType po = poDoc.addNewCompany();
+
+ int LEN = 20;
+
+ StringBuffer sExpected = new StringBuffer();
+ sExpected.append("<com:company xmlns:com=\"prePostFeature/xbean/ValueRestriction/company\"><departments>");
+ DepartmentType dept = po.addNewDepartments();
+ ConsultantType[] it = new ConsultantType[LEN];
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i] = dept.addNewConsultant();
+ XmlString s = XmlString.Factory.newInstance();
+ it[i].setAge(50);
+ sExpected.append("<consultant age=\"50\"/>");
+ }
+
+ sExpected.append("</departments></com:company>");
+
+ assertEquals(sExpected.toString(), poDoc.xmlText());
+ assertTrue(poDoc.validate());
+
+
+ prePostFeature.ValueRestriction.existing.SetterHandler.bReady = true;
+
+
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i].setAge(150);
+ }
+
+ assertEquals(sExpected.toString(), poDoc.xmlText());
+ assertTrue(poDoc.validate());
+
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i].setEmployeeAge(150);
+ }
+ assertTrue(sExpected.toString().equals(poDoc.xmlText()));
+ assertTrue(poDoc.validate());
+ }
+}
+
diff --git a/v1/test/src/extensionsuse/drtcases/prePostFeature/readOnlyBean/ReadOnlyTest.java b/v1/test/src/extensionsuse/drtcases/prePostFeature/readOnlyBean/ReadOnlyTest.java
new file mode 100644
index 0000000..372c8ac
--- /dev/null
+++ b/v1/test/src/extensionsuse/drtcases/prePostFeature/readOnlyBean/ReadOnlyTest.java
@@ -0,0 +1,55 @@
+package drtcases.prePostFeature.readOnlyBean;
+
+import prePostFeature.xbean.readOnlyBean.purchaseOrder.PurchaseOrderDocument;
+import prePostFeature.xbean.readOnlyBean.purchaseOrder.PurchaseOrderType;
+import prePostFeature.xbean.readOnlyBean.purchaseOrder.Items;
+
+
+import java.math.BigDecimal;
+
+import junit.framework.*;
+import drtcases.FixedAttrTest;
+
+public class ReadOnlyTest extends TestCase
+{
+ public ReadOnlyTest(String s)
+ {
+ super(s);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(FixedAttrTest.class);
+ }
+
+ public void test()
+ {
+ PurchaseOrderDocument poDoc;
+
+ poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderType po = poDoc.addNewPurchaseOrder();
+
+
+ int LEN = 20;
+
+ Items.Item[] it = new Items.Item[LEN];
+ for (int i = 0; i < LEN; i++)
+ {
+ it[i] = Items.Item.Factory.newInstance();
+ it[i].setUSPrice(new BigDecimal("" + 4));
+ }
+ Items items = Items.Factory.newInstance();
+ items.setItemArray(it);
+ po.setItems(items);
+
+
+ String sExpected = "<pur:purchaseOrder xmlns:pur=\"http://xbean.prePost_feature/readOnlyBean/PurchaseOrder\"/>";
+
+
+ it[0].setPrice(10);
+
+ assertEquals(sExpected, poDoc.xmlText());
+
+ assertTrue(!poDoc.validate());
+ }
+}
diff --git a/v1/test/src/nameworlduse/com/bea/test/DumpNameworld.java b/v1/test/src/nameworlduse/com/bea/test/DumpNameworld.java
new file mode 100644
index 0000000..0ad2197
--- /dev/null
+++ b/v1/test/src/nameworlduse/com/bea/test/DumpNameworld.java
@@ -0,0 +1,56 @@
+/* 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 com.bea.test;
+
+import org.openuri.nameworld.*;
+
+import java.io.File;
+
+import org.apache.xmlbeans.XmlBeans;
+
+public class DumpNameworld
+{
+ public static void main(String[] args) throws Exception
+ {
+ for (int i = 0; i < args.length; i++)
+ {
+ System.out.println("======================");
+ System.out.println("Loading file " + args[i]);
+ dumpDocument(NameworldDocument.Factory.parse(new File(args[i])));
+ }
+ }
+
+ public static void dumpDocument(NameworldDocument doc)
+ {
+ Nameworld world = doc.getNameworld();
+ Nameworld.Island[] islands = world.getIsland();
+ for (int i = 0; i < islands.length; i++)
+ {
+ System.out.println("----------------------");
+ System.out.println("Island target namespace: " + islands[i].getTargetNamespace());
+ Loc[] locs = islands[i].getLocation();
+ for (int j = 0; j < locs.length; j++)
+ {
+ System.out.println(" Location: " + locs[j].getName());
+ Loc.Reference[] refs = locs[j].getReference();
+ for (int k = 0; k < refs.length; k++)
+ {
+ System.out.println(" Reference: " + refs[k].getTo());
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/numerals/numerals.xsd b/v1/test/src/numerals/numerals.xsd
new file mode 100644
index 0000000..2347059
--- /dev/null
+++ b/v1/test/src/numerals/numerals.xsd
@@ -0,0 +1,43 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs='http://www.w3.org/2001/XMLSchema'
+ targetNamespace='http://openuri.org/testNumerals'
+ elementFormDefault='qualified'>
+ <xs:element name='doc'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs='0' maxOccurs='unbounded'>
+ <xs:element name='int' type='xs:int' />
+ <xs:element name='short' type='xs:short' />
+ <xs:element name='byte' type='xs:byte' />
+ <xs:element name='double' type='xs:double' />
+ <xs:element name='float' type='xs:float' />
+ <xs:element name='boolean' type='xs:boolean' />
+ <xs:element name='string' type='xs:string' />
+ <xs:element name='decimal' type='xs:decimal' />
+ <xs:element name='integer' type='xs:integer' />
+ <xs:element name='long' type='xs:long' />
+ <xs:element name='hexBinary' type='xs:hexBinary' />
+ <xs:element name='base64Binary' type='xs:base64Binary' />
+ <xs:element name='date' type='xs:date' />
+ <xs:element name='dateTime' type='xs:dateTime' />
+ <xs:element name='gYearMonth' type='xs:gYearMonth' />
+ <xs:element name='duration' type='xs:duration' />
+ <xs:element name='QName' type='xs:QName' />
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
diff --git a/v1/test/src/random/Random.java b/v1/test/src/random/Random.java
new file mode 100644
index 0000000..546cb40
--- /dev/null
+++ b/v1/test/src/random/Random.java
@@ -0,0 +1,864 @@
+/* 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.
+ */
+
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.tool.CommandLine;
+import org.apache.xmlbeans.impl.values.XmlValueDisconnectedException;
+import org.apache.xmlbeans.impl.store.Cursor;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Arrays;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import javax.xml.namespace.QName;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+import com.easypo.XmlPurchaseOrderDocumentBean.PurchaseOrder;
+import com.easypo.XmlCustomerBean;
+import com.easypo.XmlLineItemBean;
+import com.easypo.XmlShipperBean;
+
+public class Random implements Runnable
+{
+ public static void main ( String[] args ) throws Exception
+ {
+ CommandLine cl = new CommandLine(args, Arrays.asList(new String[] { "seed", "i", "t", "docs", "?", "help" }));
+ long seed = System.currentTimeMillis();
+ int iterations = Integer.MAX_VALUE;
+ int threads = 1;
+ int docs = 10;
+
+ if (cl.getOpt("?") != null || cl.getOpt("help") != null || cl.args().length != 0)
+ System.out.println("Usage: random [-seed #] [-i iterations] [-t threads] [-docs docs] [-readonly] [-nosave]");
+ else
+ {
+ boolean readonly = false;
+ boolean nosave = false;
+ boolean noquery = false;
+
+ if (cl.getOpt("seed") != null)
+ seed = Long.parseLong(cl.getOpt("seed"));
+ if (cl.getOpt("i") != null)
+ iterations = Integer.parseInt(cl.getOpt("i"));
+ if (cl.getOpt("t") != null)
+ threads = Integer.parseInt(cl.getOpt("t"));
+ if (cl.getOpt("docs") != null)
+ docs = Integer.parseInt(cl.getOpt("docs"));
+ noquery = (cl.getOpt("noquery") != null);
+ readonly = (cl.getOpt("readonly") != null);
+ nosave = (cl.getOpt("nosave") != null);
+
+ System.out.println("seed=" + seed);
+ System.out.println("iterations=" + iterations );
+ System.out.println("threads=" + threads);
+ System.out.println("docs=" + docs );
+ System.out.println(readonly ? "readonly" : "read/write");
+ System.out.println(nosave ? "nosave" : "with save");
+ System.out.println(noquery ? "noquery" : "with query");
+ doTests(seed, iterations, threads, docs, readonly, nosave, noquery);
+ }
+ }
+
+ private static void doTests(long seed, int iterations, int threadCount, int docCount, boolean readonly, boolean nosave, boolean noquery)
+ {
+ long start = System.currentTimeMillis();
+
+ XmlObject[] sharedDocs = new XmlObject [docCount];
+ Thread[] threads = new Thread[threadCount];
+
+ for ( int i = 0 ; i < iterations ; i++ )
+ {
+ for (int j = 0; j < threadCount; j++)
+ {
+ Random runnable = new Random(seed, sharedDocs, readonly, nosave, noquery, threadCount > 1);
+ threads[j] = new Thread(runnable);
+ threads[j].start();
+ seed++;
+ }
+ for (int j = 0; j < threadCount; j++)
+ {
+ try
+ {
+ threads[j].join();
+ }
+ catch (InterruptedException e)
+ {
+ System.err.println("Thread interrupted");
+ }
+ }
+ }
+
+ long end = System.currentTimeMillis();
+
+ System.err.println();
+ System.err.println(
+ "Seconds to run random tests: " + (end - start) / 1000 );
+ }
+
+ public void run()
+ {
+ System.err.print( "\rSeed: " + _seed );
+
+ try
+ {
+ for ( int d = 0 ; d < _docs.length ; d++ )
+ _docs[ d ] = XmlObject.Factory.newInstance();
+
+ _cursors = new ArrayList();
+
+ int nIterations = rnd( 60000 ) + 5000;
+
+ for ( int i = 0 ; i < nIterations ; i++ )
+ {
+ boolean good = false;
+ try
+ {
+ _iter++;
+ iterate();
+ good = true;
+ }
+ finally
+ {
+ if (!good)
+ {
+ System.err.println();
+ System.err.println( "Error on iteration " + _iter );
+ System.err.println();
+ }
+ }
+ }
+ }
+ catch ( Throwable e )
+ {
+ System.err.println( "Error on seed " + _seed );
+ e.printStackTrace( System.err );
+ }
+ }
+
+ private java.util.Random _rnd;
+
+ private XmlObject[] _docs; // shared among threads!!
+ private ArrayList _cursors;
+ private long _seed;
+ private int _iter;
+ private boolean _readonly;
+ private boolean _nosave;
+ private boolean _noquery;
+ private boolean _interference;
+
+
+ private int rnd ( int n )
+ {
+ return _rnd.nextInt( n );
+ }
+
+ private int rnd ( int min, int maxPlusOne )
+ {
+ return _rnd.nextInt(maxPlusOne - min) + min;
+ }
+
+ private XmlCursor getCursor ( )
+ {
+ int n = _cursors.size();
+
+ if (n == 0 || (n < _docs.length * 3) && rnd( 4 ) == 0)
+ {
+ XmlCursor c = _docs[ rnd( _docs.length ) ].newCursor();
+ _cursors.add( c );
+ return c;
+ }
+
+ return (XmlCursor) _cursors.get( rnd( n ) );
+ }
+
+ private void iterate ( ) throws Exception
+ {
+ try
+ {
+ switch ( rnd ( 6 ) )
+ {
+ case 0 : interateHigh(); break;
+ case 1 : interateHigh(); break;
+ case 2 : interateHigh(); break;
+ case 3 : interateMedium(); break;
+ case 4 : interateMedium(); break;
+ case 5 : interateLow(); break;
+ }
+ }
+ catch (IllegalStateException e)
+ {
+ if (!_interference)
+ throw e;
+ }
+ catch (IllegalArgumentException e)
+ {
+ if (!_interference)
+ throw e;
+ }
+ catch (XmlValueDisconnectedException e)
+ {
+
+ }
+ }
+
+ private void interateHigh ( ) throws Exception
+ {
+ switch ( rnd ( 2 ) )
+ {
+ case 0 : moveCursorRightOneToken(); break;
+ case 1 : moveCursorLeftOneToken(); break;
+ }
+ }
+
+ private void interateMedium ( ) throws Exception
+ {
+ switch ( _readonly ? rnd ( 4 ) : rnd (24) )
+ {
+ case 0 : getChars(); break;
+ case 1 : getTextValue(); break;
+ case 2 : compareValue(); break;
+ case 3 : prevTokenType(); break;
+
+ case 4 : insertText(); break;
+ case 5 : moveCharsRight(); break;
+ case 6 : moveCharsLeft(); break;
+ case 7 : insertElem(); break;
+ case 8 : insertAttr(); break;
+ case 9 : removeXml(); break;
+ case 10 : removeXmlContents(); break;
+ case 11 : copyXml(); break;
+ case 12 : copyXmlContents(); break;
+ case 13 : moveXml(); break;
+ case 14 : moveXmlContents(); break;
+ case 15 : removeText(); break;
+ case 16 : moveText(); break;
+ case 17 : copyText(); break;
+ case 18 : insertComment(); break;
+ case 19 : insertProcinst(); break;
+ case 20 : setTextValue(); break;
+ case 21 : setStrong(); break;
+ case 22 : objectSet(); break;
+ case 23 : setName(); break;
+ }
+ }
+
+ private void interateLow ( ) throws Exception
+ {
+ switch ( rnd (_readonly ? 1 : 0, _nosave ? 8 : 17) )
+ {
+ case 0 : changeType(); break;
+ case 1 : createBookmark(); break;
+ case 2 : clearBookmark(); break;
+
+ case 3 : loadDoc(); break;
+ case 4 : loadSchemadDoc(); break;
+ case 5 : compareCursors(); break;
+ case 6 : getObject(); break;
+ case 7 : newCursor(); break;
+
+ case 8 : validate(); break;
+ case 9 : execQuery(); break;
+ case 10 : xmlInputStream(); break;
+ case 11 : docBytes(); break;
+ case 12 : cursorBytes(); break;
+ case 13 : newDomNode(); break;
+ case 14 : objectString(); break;
+ case 15 : cursorString(); break;
+ case 16 : prettyObject(); break;
+ }
+ }
+
+ private XmlObject findObject ( )
+ {
+ XmlCursor c = getCursor();
+ c.push();
+
+ while ( !(c.isContainer() || c.isAttr()) )
+ if (c.toNextToken().isNone())
+ break;
+
+ if (!c.isEnddoc())
+ {
+ XmlObject x = c.getObject();
+ c.pop();
+ if (x == null)
+ throw new IllegalStateException("getObject returned null - content must have changed");
+ return x;
+ }
+
+ c.pop();
+ c.push();
+
+ while ( !(c.isContainer() || c.isAttr()) )
+ if (c.toPrevToken().isNone())
+ break;
+
+ XmlObject x = c.getObject();
+ c.pop();
+ if (x == null)
+ throw new IllegalStateException("getObject returned null - content must have changed");
+ return x;
+ }
+
+ private void prettyObject ( )
+ {
+ XmlOptions options = new XmlOptions();
+ options.setSavePrettyPrint();
+ findObject().xmlText( options );
+ }
+
+ private void objectString ( )
+ {
+ findObject().toString();
+ }
+
+ private void cursorString ( )
+ {
+ getCursor().toString();
+ }
+
+ private void changeType ( )
+ {
+ XmlObject o, n;
+
+ try
+ {
+ o = findObject();
+ SchemaType type = findObject().schemaType();
+ n = o.changeType( type );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ return;
+ }
+ catch ( IllegalStateException e )
+ {
+ return;
+ }
+
+ for ( int i = 0 ; i < _docs.length ; i++ )
+ {
+ if (o == _docs[ i ])
+ {
+ _docs[ i ] = n;
+ break;
+ }
+ }
+ }
+
+ private void prevTokenType ( )
+ {
+ getCursor().prevTokenType();
+ }
+
+ private void newCursor ( )
+ {
+ findObject().newCursor();
+ }
+
+ private void setName ( )
+ {
+ XmlCursor c = findObject().newCursor();
+
+ if (!c.isStartdoc())
+ c.setName( getQName() );
+
+ c.dispose();
+ }
+
+ private void newDomNode ( )
+ {
+ if (rnd( 5 ) != 0)
+ return;
+
+ try
+ {
+ getCursor().newDomNode();
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ private void xmlInputStream ( ) throws Exception
+ {
+ if (rnd( 5 ) != 0)
+ return;
+
+ XMLInputStream xis;
+
+ try
+ {
+ xis = getCursor().newXMLInputStream();
+ }
+ catch ( IllegalStateException e )
+ {
+ return;
+ }
+
+ while ( xis.next() != null )
+ ;
+ }
+
+ private void objectSet ( )
+ {
+ findObject().set( findObject() );
+ }
+
+ private void setStrong ( )
+ {
+ XmlObject x = findObject();
+
+ if (x instanceof PurchaseOrder)
+ {
+ PurchaseOrder o = (PurchaseOrder) x;
+ o.setDate( Calendar.getInstance() );
+ }
+ else if (x instanceof XmlCustomerBean)
+ {
+ XmlCustomerBean o = (XmlCustomerBean) x;
+ o.setName( "Bob" );
+
+ if (rnd( 2 ) == 0)
+ o.setAge( 23 );
+
+ if (rnd( 2 ) == 0)
+ o.setMoo( 24 );
+
+ if (rnd( 2 ) == 0)
+ o.setPoo( 200 );
+ }
+ else if (x instanceof XmlLineItemBean)
+ {
+ XmlLineItemBean o = (XmlLineItemBean) x;
+ o.setPerUnitOunces( new BigDecimal( 122.44 ) );
+ o.setPrice( new BigDecimal( 555.33 ) );
+ o.setQuantity( BigInteger.valueOf( 111 ) );
+ }
+ else if (x instanceof XmlShipperBean)
+ {
+ XmlShipperBean o = (XmlShipperBean) x;
+ o.setPerOunceRate( new BigDecimal( 3.14159 ) );
+ o.setName( "Eric" );
+ }
+ }
+
+ private void compareValue ( )
+ {
+ findObject().compareValue( findObject() );
+ }
+
+ private void validate ( )
+ {
+ findObject().validate();
+ }
+
+ private void execQuery ( )
+ {
+ if (_noquery)
+ return;
+
+ if (rnd( 20 ) > 0)
+ return;
+
+ QName name = getQName();
+
+ String query =
+ "declare namespace xxx='" + name.getNamespaceURI() + "' " +
+ ".//xxx:" + name.getLocalPart();
+
+ XmlObject x = getCursor().execQuery( query ).getObject();
+
+ if (rnd( 3 ) == 0)
+ _docs[ rnd( _docs.length ) ] = x;
+ }
+
+ private void getObject ( )
+ {
+ getCursor().getObject();
+ }
+
+ private void getChars ( )
+ {
+ getCursor().getChars();
+ }
+
+ private void compareCursors ( )
+ {
+ try
+ {
+ getCursor().isInSameDocument( getCursor() );
+ getCursor().comparePosition( getCursor() );
+ getCursor().isAtSamePositionAs( getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ }
+
+ private String[] _xmls =
+ {
+ "<a/>",
+ };
+
+ private String[] _schema_xmls =
+ {
+ "<po:purchase-order xmlns:po='http://openuri.org/easypo'>\n" +
+ "<po:customer age='31' poo='200'>\n" +
+ "<po:name>David Bau</po:name>\n" +
+ "<po:address>Gladwyne, PA</po:address>\n" +
+ "</po:customer>\n" +
+ "<po:customer age='37'>\n" +
+ "<po:name>Eric Vasilik</po:name>\n" +
+ "<po:address>Redmond, WA</po:address>\n" +
+ "</po:customer>\n" +
+ "<po:date>2002-09-30T14:16:00-05:00</po:date>\n" +
+ "<po:line-item>\n" +
+ "<po:description>Burnham's Celestial Handbook, Vol 1</po:description>\n" +
+ "<po:per-unit-ounces>5</po:per-unit-ounces>\n" +
+ "<po:price>21.79</po:price>\n" +
+ "<po:quantity>2</po:quantity>\n" +
+ "</po:line-item>\n" +
+ "<po:line-item>\n" +
+ "<po:description>Burnham's Celestial Handbook, Vol 2</po:description>\n" +
+ "<po:per-unit-ounces>5</po:per-unit-ounces>\n" +
+ "<po:price>19.89</po:price>\n" +
+ "<po:quantity>2</po:quantity>\n" +
+ "</po:line-item>\n" +
+ "<po:line-item>\n" +
+ "<po:description>Burnham's Celestial Handbook, Vol 3</po:description>\n" +
+ "<po:per-unit-ounces>5</po:per-unit-ounces>\n" +
+ "<po:price>19.89</po:price>\n" +
+ "<po:quantity>1</po:quantity>\n" +
+ "</po:line-item>\n" +
+ "<po:shipper>\n" +
+ "<po:name>UPS</po:name>\n" +
+ "<po:per-ounce-rate>0.74</po:per-ounce-rate>\n" +
+ "</po:shipper>\n" +
+ "</po:purchase-order>\n" +
+ "",
+ };
+
+ private void loadDoc ( ) throws Exception
+ {
+ if (rnd( 15 ) == 0)
+ {
+ _docs[ rnd( _docs.length ) ] =
+ XmlObject.Factory.parse( _xmls[ rnd( _xmls.length ) ] );
+ }
+ }
+
+ private void loadSchemadDoc ( ) throws Exception
+ {
+ if (rnd( 4 ) == 0)
+ {
+ _docs[ rnd( _docs.length ) ] =
+ XmlObject.Factory.parse(
+ _schema_xmls[ rnd( _schema_xmls.length ) ] );
+ }
+ }
+
+ private void moveCursorLeftOneToken ( )
+ {
+ getCursor().toPrevToken();
+ }
+
+ private void moveCursorRightOneToken ( )
+ {
+ getCursor().toNextToken();
+ }
+
+ private char[] _chars =
+ {
+ '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 void getTextValue ( )
+ {
+ XmlCursor c = getCursor();
+
+ if (c.isFinish() || c.isNamespace() || c.isText())
+ return;
+
+ c.getTextValue();
+ }
+
+ private void setTextValue ( )
+ {
+ XmlCursor c = getCursor();
+
+ if (c.isFinish() || c.isNamespace() || c.isText())
+ return;
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( int i = rnd( 10 ) ; i >= 0 ; i-- )
+ sb.append( _chars[ rnd( _chars.length ) ] );
+
+ c.setTextValue( sb.toString() );
+ }
+
+ private void moveText ( )
+ {
+ try
+ {
+ getCursor().moveChars( rnd( 10 ), getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ private void copyText ( )
+ {
+ try
+ {
+ getCursor().copyChars( rnd( 10 ), getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ private void removeText ( )
+ {
+ getCursor().removeChars( rnd( 6 ) );
+ }
+
+ private void insertComment ( )
+ {
+ try
+ {
+ getCursor().insertComment( "poo" );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ private void insertProcinst ( )
+ {
+ try
+ {
+ getCursor().insertProcInst( "target", "val" );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ private void insertText ( )
+ {
+ XmlCursor c = getCursor();
+
+ if (c.isAnyAttr() || c.isStartdoc())
+ return;
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( int i = rnd( 10 ) ; i >= 0 ; i-- )
+ sb.append( _chars[ rnd( _chars.length ) ] );
+
+ c.insertChars( sb.toString() );
+ }
+
+ private void docChars ( )
+ {
+ _docs[ rnd( _docs.length ) ].xmlText();
+ }
+
+ private void cursorChars ( )
+ {
+ getCursor().xmlText();
+ }
+
+ private void docBytes ( ) throws Exception
+ {
+ _docs[ rnd( _docs.length ) ].save( new ByteArrayOutputStream() );
+ }
+
+ private void cursorBytes ( ) throws Exception
+ {
+ getCursor().save( new ByteArrayOutputStream() );
+ }
+
+ private void moveCharsRight ( ) throws Exception
+ {
+ getCursor().toNextChar( rnd( 10 ) );
+ }
+
+ private void moveCharsLeft ( ) throws Exception
+ {
+ getCursor().toPrevChar( rnd( 10 ) );
+ }
+
+ private QName getQName ( )
+ {
+ QName name = null;
+
+ switch ( rnd( 3 ) )
+ {
+ case 0 : name = XmlBeans.getQName( "foo.com", "foo" ); break;
+ case 1 : name = XmlBeans.getQName( "bar.com", "bar" ); break;
+ case 2 : name = XmlBeans.getQName( "moo" ); break;
+ }
+
+ return name;
+ }
+
+ private void insertElem ( ) throws Exception
+ {
+ XmlCursor c = getCursor();
+
+ if (c.isAnyAttr() || c.isStartdoc())
+ return;
+
+ c.insertElement( getQName() );
+ }
+
+ public void insertAttr ( )
+ {
+ XmlCursor c = getCursor();
+
+ while ( !c.isEnddoc() && !c.isContainer() )
+ c.toNextToken();
+
+ if (c.isEnddoc())
+ return;
+
+ c.toNextToken();
+
+ c.insertAttribute( getQName() );
+ }
+
+ public void removeXmlContents ( )
+ {
+ XmlCursor c = getCursor();
+
+ c.removeXmlContents();
+ }
+
+ public void copyXmlContents ( )
+ {
+ try
+ {
+ getCursor().copyXmlContents( getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ public void copyXml ( )
+ {
+ try
+ {
+ getCursor().copyXml( getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ public void moveXmlContents ( )
+ {
+ try
+ {
+ getCursor().moveXmlContents( getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ public void moveXml ( )
+ {
+ try
+ {
+ getCursor().moveXml( getCursor() );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ }
+ catch ( IllegalStateException e )
+ {
+ }
+ }
+
+ public void removeXml ( )
+ {
+ XmlCursor c = getCursor();
+
+ if (!c.isStartdoc() && !c.isFinish())
+ c.removeXml();
+ }
+
+ public static class Bookmark extends XmlCursor.XmlBookmark
+ {
+ }
+
+ public void createBookmark ( ) throws Exception
+ {
+ getCursor().setBookmark( new Bookmark() );
+ }
+
+ public void clearBookmark ( ) throws Exception
+ {
+ getCursor().clearBookmark( Bookmark.class );
+ }
+
+ public Random(long seed, XmlObject[] sharedDocs, boolean readonly, boolean nosave, boolean noquery, boolean interference)
+ {
+ _seed = seed;
+ _rnd = new java.util.Random(seed);
+ _docs = sharedDocs;
+ _readonly = readonly;
+ _nosave = nosave;
+ _noquery = noquery;
+ _interference = interference;
+ }
+
+}
+
diff --git a/v1/test/src/schemas/defaults.xsd b/v1/test/src/schemas/defaults.xsd
new file mode 100644
index 0000000..a64867c
--- /dev/null
+++ b/v1/test/src/schemas/defaults.xsd
@@ -0,0 +1,30 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://openuri.org/def"
+ targetNamespace="http://openuri.org/def"
+ elementFormDefault="qualified">
+
+ <xs:element name="defaults">
+ <xs:complexType>
+ <xs:sequence>
+ </xs:sequence>
+ <xs:attribute ref="tns:cool"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:attribute name="cool" type="xs:int" default="783"/>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/included.xsd b/v1/test/src/schemas/included.xsd
new file mode 100644
index 0000000..0693c54
--- /dev/null
+++ b/v1/test/src/schemas/included.xsd
@@ -0,0 +1,35 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xs:element name="chain" type="chainlink"/>
+
+ <xs:complexType name="chainlink">
+ <xs:sequence>
+ <xs:element ref="chain"/>
+ </xs:sequence>
+ <xs:attribute ref="name"/>
+ </xs:complexType>
+
+ <xs:simpleType name="token">
+ <xs:restriction base="xs:token">
+ <xs:maxLength value="5"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:attribute name="name" type="token"/>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/includer1.xsd b/v1/test/src/schemas/includer1.xsd
new file mode 100644
index 0000000..a155342
--- /dev/null
+++ b/v1/test/src/schemas/includer1.xsd
@@ -0,0 +1,30 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://openuri.org/includer1"
+ targetNamespace="http://openuri.org/includer1"
+ elementFormDefault="qualified">
+
+ <xs:include schemaLocation="included.xsd"/>
+
+ <xs:element name="onechain">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="tns:chain"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/includer2.xsd b/v1/test/src/schemas/includer2.xsd
new file mode 100644
index 0000000..2f95ddc
--- /dev/null
+++ b/v1/test/src/schemas/includer2.xsd
@@ -0,0 +1,30 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://openuri.org/includer2"
+ targetNamespace="http://openuri.org/includer2"
+ elementFormDefault="qualified">
+
+ <xs:include schemaLocation="included.xsd"/>
+
+ <xs:element name="twochains">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="tns:chain" minOccurs="2" maxOccurs="2"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/inttest.xsd b/v1/test/src/schemas/inttest.xsd
new file mode 100644
index 0000000..36f6e07
--- /dev/null
+++ b/v1/test/src/schemas/inttest.xsd
@@ -0,0 +1,60 @@
+<!-- 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. -->
+<xs:schema
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ targetNamespace="java:int.test"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="java:int.test">
+
+ <xs:simpleType name="LatitudeDegreesType">
+ <xs:annotation>
+ <xs:documentation>
+ <definition>Degrees of Latitude</definition>
+ <USMTFref>See USMTF field latitude.degrees.17.1</USMTFref>
+ <DoDXMLref>TBD</DoDXMLref>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="00"/>
+ <xs:maxInclusive value="90"/>
+ <xs:pattern value="[\d]{2}"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="LongitudeDegreesType">
+ <xs:annotation>
+ <xs:documentation>
+ <definition>Degrees of Longitude</definition>
+ <USMTFref>See USMTF field longitude.degrees.18.1</USMTFref>
+ <DoDXMLref>TBD</DoDXMLref>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:short">
+ <xs:minInclusive value="000"/>
+ <xs:maxInclusive value="180"/>
+ <xs:pattern value="[\d]{3}"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="position">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="lat" type="tns:LatitudeDegreesType"/>
+ <xs:element name="lon" type="tns:LongitudeDegreesType"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
\ No newline at end of file
diff --git a/v1/test/src/schemas/listandunion.xsd b/v1/test/src/schemas/listandunion.xsd
new file mode 100644
index 0000000..6e81399
--- /dev/null
+++ b/v1/test/src/schemas/listandunion.xsd
@@ -0,0 +1,81 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://openuri.org/lut"
+ targetNamespace="http://openuri.org/lut"
+ elementFormDefault="qualified">
+
+ <xs:element name="unions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="nni" type="tns:allNNI"/>
+ <xs:element name="sizes" type="tns:list-or-all"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name='list-of-int'>
+ <xs:list itemType='xs:int'/>
+ </xs:simpleType>
+
+ <xs:simpleType name="allNNI">
+ <xs:union memberTypes="xs:nonNegativeInteger">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="unbounded"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="list-or-all">
+ <xs:union memberTypes="tns:list-of-int">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="all"/>
+ <xs:enumeration value="unknown"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="list-of-allNNI">
+ <xs:list itemType="tns:allNNI"/>
+ </xs:simpleType>
+
+ <xs:element name="lists">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="int-list" type="tns:list-of-int"/>
+ <xs:element name="nni-list" type="tns:list-of-allNNI"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="date-or-dateTime">
+ <xs:union memberTypes="xs:date xs:dateTime"/>
+ </xs:simpleType>
+
+ <xs:element name="when" type="tns:date-or-dateTime"/>
+
+ <xs:element name="incident-reports">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="tns:when" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/nameworld.xsd b/v1/test/src/schemas/nameworld.xsd
new file mode 100644
index 0000000..48df6b6
--- /dev/null
+++ b/v1/test/src/schemas/nameworld.xsd
@@ -0,0 +1,46 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:nw="http://openuri.org/nameworld"
+ targetNamespace="http://openuri.org/nameworld"
+ elementFormDefault="qualified">
+
+ <xs:element name="nameworld">
+ <xs:complexType>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element name="island">
+ <xs:complexType>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element name="location" type="nw:loc"/>
+ </xs:sequence>
+ <xs:attribute name="targetNamespace" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="loc">
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element name="reference">
+ <xs:complexType>
+ <xs:attribute name="to" type="xs:QName"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/nonamespace.xsd b/v1/test/src/schemas/nonamespace.xsd
new file mode 100644
index 0000000..dfd84b5
--- /dev/null
+++ b/v1/test/src/schemas/nonamespace.xsd
@@ -0,0 +1,35 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xs:element name="nchain" type="nchainlink"/>
+
+ <xs:complexType name="nchainlink">
+ <xs:sequence>
+ <xs:element ref="nchain"/>
+ </xs:sequence>
+ <xs:attribute ref="nname"/>
+ </xs:complexType>
+
+ <xs:simpleType name="ntoken">
+ <xs:restriction base="xs:token">
+ <xs:maxLength value="5"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:attribute name="nname" type="ntoken"/>
+
+</xs:schema>
diff --git a/v1/test/src/schemas/substgroup.xsd b/v1/test/src/schemas/substgroup.xsd
new file mode 100644
index 0000000..b65bc70
--- /dev/null
+++ b/v1/test/src/schemas/substgroup.xsd
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!-- 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. -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+ targetNamespace="http://openuri.org/sgs" xmlns:sg="http://openuri.org/sgs">
+ <xsd:element name="C" type="xsd:token" substitutionGroup="sg:B"/>
+ <xsd:element name="A" type="xsd:string"/>
+ <xsd:element name="B" type="xsd:normalizedString" substitutionGroup="sg:A"/>
+
+ <xsd:element name="Z" type="sg:Ext" substitutionGroup="sg:Y" />
+ <xsd:element name="Y" substitutionGroup="sg:X" />
+ <xsd:element name="X" type="sg:Base"/>
+
+ <xsd:element name="AnyType"/>
+ <xsd:element name="AnyTypeTail" substitutionGroup="sg:AnyType"/>
+
+ <xsd:element name="AnonSimple">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:int">
+ <xsd:maxExclusive value="100"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+
+ <xsd:element name="AnonSimpleTail" substitutionGroup="sg:AnonSimple"/>
+
+ <xsd:element name="AnonComplex">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="foo" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="AnonComplexTail" substitutionGroup="sg:AnonComplex"/>
+
+ <xsd:element name="root">
+ <xsd:complexType>
+ <xsd:sequence maxOccurs="unbounded">
+ <xsd:element ref="sg:A"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="Base">
+ <xsd:sequence>
+ <xsd:element name="str" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Unrelated">
+ <xsd:sequence>
+ <xsd:element name="str" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Ext">
+ <xsd:complexContent>
+ <xsd:extension base="sg:Base">
+ <xsd:sequence>
+ <xsd:element name="int" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="abstractTest">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element ref="sg:abstract"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="abstract" type="xsd:string" abstract="true"/>
+ <xsd:element name="concrete" substitutionGroup="sg:abstract"/>
+
+ <xsd:element name="blockTest">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element ref="sg:block"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="block" type="xsd:string" block="substitution"/>
+ <xsd:element name="subblock" substitutionGroup="sg:block"/>
+
+</xsd:schema>
diff --git a/v1/test/src/streamtest/Intern.java b/v1/test/src/streamtest/Intern.java
new file mode 100644
index 0000000..f26cfba
--- /dev/null
+++ b/v1/test/src/streamtest/Intern.java
@@ -0,0 +1,303 @@
+/* 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 streamtest;
+
+import java.util.Date;
+import java.util.HashMap;
+
+public class Intern
+{
+ static final int MAX_ITER = 1000;
+ static final int MAX_CREATE = 100;
+ static final int MAX_COMP = 100;
+
+ public static void main(String[] args)
+ {
+ char[] ca = { 'a', 'a', 'a'};
+
+ System.out.println("aaa" == "aaa");
+ System.out.println("aaa" == new String("aaa"));
+ System.out.println("aaa" == new String(ca));
+ System.out.println("aaa" == new String(ca).intern());
+ System.out.println("aaa" == String.valueOf(ca));
+ System.out.println("aaa" == String.copyValueOf(ca));
+ System.out.println("aaa" == "aaa");
+
+ long start;
+ double d1 = 0;
+ double d2 = 0;
+ double d3 = 0;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ System.out.println(qn1.toString());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1 == qn2;
+ }
+ }
+ }
+ d1 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalIntern(qn2);
+ }
+ }
+ }
+ d2 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create1(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalExtern(qn2);
+ }
+ }
+ }
+ d3 = new Date().getTime() - start;
+
+ System.out.println("create1:\t" + d1 + "\t" + d2 + "\t" + d3);
+
+ //create2
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1 == qn2;
+ }
+ }
+ }
+ d1 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalIntern(qn2);
+ }
+ }
+ }
+ d2 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create2(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalExtern(qn2);
+ }
+ }
+ }
+ d3 = new Date().getTime() - start;
+
+ System.out.println("create2:\t" + d1 + "\t" + d2 + "\t" + d3);
+
+ //create3
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1 == qn2;
+ }
+ }
+ }
+ d1 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)).intern(),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)).
+ intern());
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalIntern(qn2);
+ }
+ }
+ }
+ d2 = new Date().getTime() - start;
+
+ start = new Date().getTime();
+ for( int i = 0; i<MAX_ITER; i++ )
+ {
+ Cache cache = new Cache();
+ Cache.QName qn1 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int j=0; j<MAX_CREATE; j++ )
+ {
+ Cache.QName qn2 = cache.create3(String.valueOf( Math.
+ round(Math.random()*MAX_CREATE/10)),
+ String.valueOf(Math.round(Math.random()*MAX_CREATE/10)));
+ for( int k=0; k<MAX_COMP; k++ )
+ {
+ boolean b = qn1.equalExtern(qn2);
+ }
+ }
+ }
+ d3 = new Date().getTime() - start;
+
+ System.out.println("create3:\t" + d1 + "\t" + d2 + "\t" + d3);
+ }
+}
+
+class Cache
+{
+ HashMap h1 = new HashMap();
+
+ QName create1(String l, String u)
+ {
+ return new QName(l ,u);
+ }
+
+ QName create2(String l, String u)
+ {
+ int hcode = l.hashCode() + 33*u.hashCode();
+ Integer key = new Integer(hcode);
+
+ if( h1.containsKey( key ) )
+ return (QName)h1.get(key);
+
+ QName qn = new QName(l, u);
+ h1.put(key, qn);
+ return qn;
+ }
+
+ synchronized QName create3(String l, String u)
+ {
+ return create2(l, u);
+ }
+
+ static class QName
+ {
+ private String local;
+ private String uri;
+
+ private QName()
+ {}
+ private QName(String l, String u)
+ {
+ local = l;
+ uri = u;
+ }
+
+ boolean equalIntern( QName qn )
+ {
+ return local==qn.local && uri==qn.uri;
+ }
+
+ boolean equalExtern( QName qn )
+ {
+ return local.equals(qn.local) && uri.equals(qn.uri);
+ }
+
+ public String toString()
+ {
+ return local + "," + uri;
+ }
+ }
+}
+
diff --git a/v1/test/src/streamtest/SubStreamsTest.java b/v1/test/src/streamtest/SubStreamsTest.java
new file mode 100644
index 0000000..b3da47b
--- /dev/null
+++ b/v1/test/src/streamtest/SubStreamsTest.java
@@ -0,0 +1,276 @@
+/* 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 streamtest;
+
+/*
+* Created by cezar@bea.com
+*/
+
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLInputStreamFactory;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.FileReader;
+
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.stream.XmlStreamSource;
+import org.xmlpull.stream.XppXmlStreamImpl;
+import org.xmlpull.stream.XmlStreamFactory;
+import junit.framework.TestCase;
+
+public class SubStreamsTest
+{
+ public SubStreamsTest(String name)
+ {
+ //super(name);
+ }
+
+ public void testSubStream()
+ {
+ System.out.println("It works.");
+
+ //throw new RuntimeException("Kevin's exception");
+
+ //assertTrue( true );
+ }
+
+ public static void main(String[] args)
+ throws FileNotFoundException, XMLStreamException, IOException,
+ XmlPullParserException
+ {
+ Reader reader1;
+ Reader reader2;
+ if( args.length==0 )
+ {
+ String s = "<a><b><c a1='a1v' a2='a2v' /></b><x/>" +
+ "<y>Some text</y></a>";
+ reader1 = new StringReader(s);
+ reader2 = new StringReader(s);
+ }
+ else
+ {
+ reader1 = new FileReader(args[0]);
+ reader2 = new FileReader(args[0]);
+ }
+
+ System.out.println("reader ...");
+ XmlStreamSource source = new XppXmlStreamImpl(reader1);
+ XMLInputStream myStream = XmlStreamFactory.
+ createXmlInputStream( source );
+
+ XMLInputStream babelStream = XMLInputStreamFactory.newInstance().
+ newInputStream(reader2);
+
+ System.out.println("myStream ...");
+ for(int i=0; myStream.hasNext() && i<3; i++)
+ {
+ System.out.println( "my: " + myStream.hasNext() + " '" +
+ myStream.next() + "'");
+ System.out.println( "bb: " + babelStream.hasNext() + " '" +
+ babelStream.next() + "'");
+ }
+
+ XMLInputStream myss = myStream.getSubStream();
+ XMLInputStream bbss = babelStream.getSubStream();
+
+ for(int i=0; (myss.hasNext() || bbss.hasNext()) && i<3; i++)
+ {
+ System.out.println( "my SUBStream: " + myss.hasNext() + " '" +
+ myss.next() + "'");
+ System.out.println( "bb SUBStream: " + bbss.hasNext() + " '" +
+ bbss.next() + "'");
+ }
+
+ XMLInputStream myss2 = myss.getSubStream();
+ XMLInputStream bbss2 = myss.getSubStream();
+ for(; myss2.hasNext() || bbss2.hasNext() ;)
+ {
+ System.out.println( "my SubSUBStream 2: " + myss2.hasNext() +
+ " '" + myss2.next() + "'");
+ System.out.println( "bb SubSUBStream 2: " + bbss2.hasNext() +
+ " '" + bbss2.next() + "'");
+ }
+ myss2.close();
+ bbss2.close();
+
+ for(; myss.hasNext() || bbss.hasNext() ;)
+ {
+ System.out.println( "my SUBStream: " + myss.hasNext() + " '" +
+ myss.next() + "'");
+ System.out.println( "bb SUBStream: " + bbss.hasNext() + " '" +
+ bbss.next() + "'");
+ }
+
+ for(; myStream.hasNext() || babelStream.hasNext();)
+ {
+ System.out.println( "my: " + myStream.hasNext() + " '" +
+ myStream.next() + "'");
+ System.out.println( "bb: " + babelStream.hasNext() + " '" +
+ babelStream.next() + "'");
+ }
+
+ main2();
+ }
+
+ public static void main2()
+ throws FileNotFoundException, XMLStreamException, IOException,
+ XmlPullParserException
+ {
+ Reader reader1;
+ Reader reader2;
+ String s = "<a><b><c a1='a1v' a2='a2v' /></b><x/>" +
+ "<y>Some text</y></a>";
+ reader1 = new StringReader(s);
+ reader2 = new StringReader(s);
+
+ System.out.println("reader ...");
+ XmlStreamSource source = new XppXmlStreamImpl(reader1);
+ XMLInputStream myStream = XmlStreamFactory.
+ createXmlInputStream( source );
+
+ XMLInputStream babelStream = XMLInputStreamFactory.newInstance().
+ newInputStream(reader2);
+
+ System.out.println("myStream ...");
+ for(int i=0; myStream.hasNext() && i<3; i++)
+ {
+ System.out.println( "my: " + " '" +
+ myStream.next() + "'");
+ System.out.println( "bb: " + " '" +
+ babelStream.next() + "'");
+ }
+
+ XMLInputStream myss = myStream.getSubStream();
+ XMLInputStream bbss = babelStream.getSubStream();
+
+ for(int i=0; myss.hasNext() && i<3; i++)
+ {
+ System.out.println( "my SUBStream: " + " '" +
+ myss.next() + "'");
+ System.out.println( "bb SUBStream: " + " '" +
+ bbss.next() + "'");
+ }
+
+ XMLInputStream myss2 = myss.getSubStream();
+ XMLInputStream bbss2 = myss.getSubStream();
+ for(; myss2.hasNext() ;)
+ {
+ System.out.println( "my SubSUBStream 2: " +
+ " '" + myss2.next() + "'");
+ System.out.println( "bb SubSUBStream 2: " +
+ " '" + bbss2.next() + "'");
+ }
+ myss2.close();
+ bbss2.close();
+
+ for(; myss.hasNext() || bbss.hasNext() ;)
+ {
+ System.out.println( "my SUBStream: " + " '" +
+ myss.next() + "'");
+ System.out.println( "bb SUBStream: " + " '" +
+ bbss.next() + "'");
+ }
+
+ for(; myStream.hasNext() ;)
+ {
+ System.out.println( "my: " + " '" +
+ myStream.next() + "'");
+ System.out.println( "bb: " +
+ //babelStream.hasNext() + //BABEL bugbug: un/comment this
+ //line you'll get different behavior for next()
+ " '" +
+ babelStream.next() + "'");
+ }
+
+ main3();
+ }
+
+ public static void main3()
+ throws FileNotFoundException, XMLStreamException, IOException,
+ XmlPullParserException
+ {
+ Reader reader1;
+ Reader reader2;
+ String s = "<?xml version='1.1.1'?><a><b xmlns='' xmlns:a='sdfsdf'><c a1='a<1v' a2='a2v' /></b><x/>" +
+ "<y>Some< and >text</y></a>";
+ reader1 = new StringReader(s);
+ reader2 = new StringReader(s);
+
+ System.out.println("reader ... in main3");
+ XmlStreamSource source = new XppXmlStreamImpl(reader1);
+ XMLInputStream myStream = XmlStreamFactory.
+ createXmlInputStream( source );
+
+ //XMLInputStream babelStream = XMLInputStreamFactory.newInstance().
+ // newInputStream(reader2);
+
+ System.out.println("myStream ...");
+ for(int i=0; myStream.hasNext() && i<0; i++)
+ {
+ System.out.println( "my: " + " '" +
+ myStream.next() + "'");
+ //System.out.println( "bb: " + " '" +
+ // babelStream.next() + "'");
+ }
+
+ XMLInputStream myss = myStream.getSubStream();
+ //XMLInputStream bbss = babelStream.getSubStream();
+
+ for(int i=0; myss.hasNext() && i<3; i++)
+ {
+ System.out.println( "my SUBStream: " + " '" +
+ myss.next() + "'");
+ //System.out.println( "bb SUBStream: " + " '" +
+ // bbss.next() + "'");
+ }
+
+ XMLInputStream myss2 = myss.getSubStream();
+ //XMLInputStream bbss2 = myss.getSubStream();
+ for(; myss2.hasNext() ;)
+ {
+ System.out.println( "my SubSUBStream 2: " +
+ " '" + myss2.next() + "'");
+ //System.out.println( "bb SubSUBStream 2: " +
+ // " '" + bbss2.next() + "'");
+ }
+ myss2.close();
+ //bbss2.close();
+
+ for(; myss.hasNext() /*|| bbss.hasNext()*/ ;)
+ {
+ System.out.println( "my SUBStream: " + " '" +
+ myss.next() + "'");
+ //System.out.println( "bb SUBStream: " + " '" +
+ // bbss.next() + "'");
+ }
+
+ for(; myStream.hasNext() ;)
+ {
+ System.out.println( "my: " + " '" +
+ myStream.next() + "'");
+ //System.out.println( "bb: " +
+ //babelStream.hasNext() + //BABEL bugbug: un/comment this
+ //line you'll get different behavior for next()
+ // " '" +
+ // babelStream.next() + "'");
+ }
+ }
+}
+
diff --git a/v1/test/src/streamtest/XmlStreamConformance.java b/v1/test/src/streamtest/XmlStreamConformance.java
new file mode 100644
index 0000000..7cffa1a
--- /dev/null
+++ b/v1/test/src/streamtest/XmlStreamConformance.java
@@ -0,0 +1,273 @@
+/* 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 streamtest;
+
+import java.io.File;
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.util.Date;
+import org.xmlpull.mxp1.MXParser;
+import org.xmlpull.mxp1.MXParserCachingStrings;
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+import org.apache.xmlbeans.xml.stream.XMLInputStreamFactory;
+import org.apache.xmlbeans.xml.stream.XMLEvent;
+import xmlext.xml.XppAdaptor;
+import org.xmlpull.stream.XppXmlStreamImpl;
+import org.xmlpull.stream.XmlStreamFactory;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Tests the conformance of the XMLInputStream produced by XppXmlStreamImpl.
+ * @author Cezar Andrei
+ */
+public class XmlStreamConformance
+{
+ final static int TIMES = 30;
+
+ public static void main(String[] args)
+ throws Exception
+ {
+ if( args.length>0 )
+ {
+ File f = new File(args[0]);
+ if( f.isDirectory() )
+ compareDir(f);
+ else
+ //compareFile(f);
+ printFile(f);
+ }
+ else
+ {
+ printUsage();
+ }
+ }
+
+ static void printUsage()
+ {
+ System.out.println("\tThis app tests the conformance of the two " +
+ "XMLInputStream \n\tproduced by Babel parser and " +
+ "Xpp3 parser.");
+ System.out.println("\n\n\tUSAGE: java ... test.XmlStreamConformance " +
+ "dir|file");
+ System.out.println("\n\t\tdir\t\tMakes the test for all the files in " +
+ "the dir.");
+ System.out.println("\t\tfile\t\tMakes the test only for that file.");
+ }
+
+ static void compareFile(File file)
+ throws Exception
+ {
+ System.out.println(file.getPath() + " size: " + file.length());
+
+ if(!file.isFile())
+ //throw new Exception("compareFile: file not a File");
+ return;
+
+ Reader r1 = new BufferedReader( new FileReader(file));
+ Reader r2 = new BufferedReader( new FileReader(file));
+
+ XMLInputStream xpp = XmlStreamFactory.
+ createXmlInputStream(new XppXmlStreamImpl(r2));
+ XMLInputStream babel = XMLInputStreamFactory.newInstance().
+ newInputStream(r1);
+
+ while( xpp.hasNext() || babel.hasNext() )
+ {
+ XMLEvent xppevent = xpp.peek();
+ XMLEvent babelevent = babel.peek();
+
+ if( !(""+xppevent).equals((""+babelevent)) )
+ printError(xppevent, babelevent);
+ else
+ {
+ //System.out.println(" `" + xppevent + "'\n `" + babelevent +
+ // "'"); System.out.flush();
+ }
+
+ xppevent = xpp.next();
+ babelevent = babel.next();
+ }
+
+ //System.out.println(" xpp overlimit: " + xpp.next() );
+ //System.out.println(" babel overlimit: " + babel.next() );
+
+ r1.close();
+ r2.close();
+
+ //comparePerf(file);
+ }
+
+ static void printFile(File file)
+ throws Exception
+ {
+ System.out.println(file.getPath() + " size: " + file.length());
+
+ if(!file.isFile())
+ //throw new Exception("compareFile: file not a File");
+ return;
+
+ Reader r2 = new BufferedReader( new FileReader(file));
+
+ XMLInputStream xpp = XmlStreamFactory.
+ createXmlInputStream(new XppXmlStreamImpl(r2));
+ XMLInputStream morphedStream;
+ try
+ {
+ System.out.println("Starting xquery");
+ XmlObject xmlObj = XmlObject.Factory.parse(xpp);
+ XmlCursor crs = xmlObj.newCursor();
+ XmlCursor resCrs = crs.execQuery("$this");
+ // not yet implemented
+ //morphedStream = resCrs.newXMLInputStream();
+ Reader reader = resCrs.newReader();
+ reader = resCrs.newReader();
+ morphedStream = XMLInputStreamFactory.newInstance().
+ newInputStream(reader);
+ System.out.print("...");
+
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ morphedStream = null;
+ }
+
+ xpp = morphedStream;
+
+ while( xpp.hasNext() )
+ {
+ XMLEvent xppevent = xpp.peek();
+
+ System.out.println(" `" + xppevent + "'"); System.out.flush();
+ xppevent = xpp.next();
+ }
+
+ r2.close();
+ }
+
+ static void printError(XMLEvent xppevent, XMLEvent babelevent)
+ {
+ String sxpp = ""+xppevent;
+ String sbab = ""+babelevent;
+
+ System.out.println("ERROR-----");
+ if( !sxpp.trim().equals(sbab.trim()) )
+ {
+ System.out.println("xpp :`" + sxpp + "'");
+ System.out.print("babel :`" + sbab + "'");
+ }
+ else
+ {
+ System.out.print("xpp :");
+ for(int i=0; i<sxpp.length(); i++)
+ {
+ byte b = (byte)sxpp.charAt(i);
+ System.out.print(" #" + b);
+ }
+ System.out.print("\nbabel :");
+ for(int i=0; i<sbab.length(); i++)
+ {
+ byte b = (byte)sbab.charAt(i);
+ System.out.print(" #" + b);
+ }
+ }
+ System.out.println("\n----------");
+ }
+
+ static void compareDir(File dir)
+ throws Exception
+ {
+ if(!dir.isDirectory())
+ throw new Exception("compareDir: dir not a Directory");
+
+ File[] files = dir.listFiles();
+ for( int i=0; i<files.length; i++)
+ compareFile(files[i]);
+ }
+
+ static void comparePerf(File file)
+ throws Exception
+ {
+ long start;
+ double xstime = 0;
+ double xrtime = 0;
+ double babeltime = 0;
+
+ //babel
+ for( int i=0; i<TIMES; i++ )
+ {
+ Reader r = new BufferedReader( new FileReader(file));
+ start = new Date().getTime();
+ XMLInputStream babel = XMLInputStreamFactory.newInstance().
+ newInputStream(r);
+ while( babel.hasNext() )
+ {
+ XMLEvent babelevent = babel.peek();
+ babelevent = babel.next();
+ }
+ babeltime += new Date().getTime() - start;
+ r.close();
+ //System.out.print(".");
+ }
+
+ //xpp with direct acces to the xpp parser
+ for( int i=0; i<TIMES; i++ )
+ {
+ Reader r = new BufferedReader( new FileReader(file));
+ start = new Date().getTime();
+ MXParser xpp = (MXParser) new MXParserCachingStrings();
+ xpp.setFeature( MXParser.FEATURE_PROCESS_NAMESPACES, true);
+ xpp.setInput( r );
+ int eventType = xpp.getEventType();
+ while ( eventType != xpp.END_DOCUMENT )
+ {
+ eventType = xpp.nextToken();
+ }
+ xrtime += new Date().getTime() - start;
+ r.close();
+ //System.out.print("'");
+ }
+
+ //xpp with XppXmlStreamImpl
+ for( int i=0; i<TIMES; i++ )
+ {
+ Reader r = new BufferedReader( new FileReader(file));
+ //XMLInputStream xpp = new XppAdaptor().getStream(r2);
+ start = new Date().getTime();
+ XMLInputStream xpp = (XMLInputStream) new XppXmlStreamImpl(r);
+
+ while( xpp.hasNext() )
+ {
+ XMLEvent xppevent = xpp.peek();
+ xppevent = xpp.next();
+ }
+ xstime += new Date().getTime() - start;
+ r.close();
+ //System.out.print("`");
+ }
+
+ System.out.println("PERF: babel/xppIS = " + dec(babeltime/xstime) +
+ " \tbabel/xppRaw = " + dec(babeltime/xrtime) );
+ }
+
+ static String dec( double f)
+ {
+ return "" + ((double)Math.round(f*100))/100;
+ }
+}
diff --git a/v1/test/src/stsschema/sts.xsd b/v1/test/src/stsschema/sts.xsd
new file mode 100644
index 0000000..655ce30
--- /dev/null
+++ b/v1/test/src/stsschema/sts.xsd
@@ -0,0 +1,62 @@
+<!-- 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. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:sts="http://xml.apache.org/xmlbeans/2004/02/xmlbean/internal/soap-test-script"
+ targetNamespace="http://xml.apache.org/xmlbeans/2004/02/xmlbean/internal/soap-test-script"
+ elementFormDefault="qualified"
+ blockDefault="#all">
+
+
+<xs:element name="soap-test-script">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="request" type="sts:requestSpec"/>
+ <xs:element name="event" type="sts:eventSpec"/>
+ <xs:element name="all" type="sts:setOfEvents"/>
+ </xs:choice>
+ <xs:attribute name="timeout" type="xs:int"/>
+ </xs:complexType>
+</xs:element>
+
+<xs:complexType name="setOfEvents">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="event" type="sts:eventSpec"/>
+ </xs:choice>
+</xs:complexType>
+
+<xs:complexType name="requestSpec">
+ <xs:sequence>
+ <xs:element name="url" type="xs:anyURI"/>
+ <xs:choice minOccurs="0">
+ <xs:element name="start" type="xs:string"/>
+ <xs:element name="continue" type="xs:string"/>
+ </xs:choice>
+ <xs:element name="send" type="xs:string"/>
+ <xs:element name="expect" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="eventSpec">
+ <xs:sequence>
+ <xs:choice>
+ <xs:element name="continue" type="xs:string"/>
+ <xs:element name="finish" type="xs:string"/>
+ </xs:choice>
+ <xs:element name="expect" type="xs:string" minOccurs="0"/>
+ <xs:element name="send" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+</xs:complexType>
+
+
+</xs:schema>
\ No newline at end of file
diff --git a/v1/test/src/teststore/com/bea/test/Test.java b/v1/test/src/teststore/com/bea/test/Test.java
new file mode 100644
index 0000000..926f742
--- /dev/null
+++ b/v1/test/src/teststore/com/bea/test/Test.java
@@ -0,0 +1,175 @@
+/* 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 com.bea.test;
+
+import weblogic.xml.schema.model.parser.XSDParserFactory;
+import weblogic.xml.schema.model.parser.XSDParser;
+import weblogic.xml.schema.model.SchemaDocument;
+import weblogic.xml.schema.model.XSDSchema;
+import weblogic.xml.schema.model.XSDException;
+import org.apache.xmlbeans.xml.stream.XMLInputStreamFactory;
+import org.apache.xmlbeans.xml.stream.XMLStreamException;
+import org.apache.xmlbeans.xml.stream.events.Name;
+
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.OutputStreamWriter;
+import java.io.IOException;
+import java.io.File;
+
+import xml.util.SchemaType;
+import xml.util.SchemaTypeSystem;
+import org.apache.xmlbeans.schema.SchemaTypeSystemBuilder;
+import org.apache.xmlbeans.schema.SchemaTypeCodePrinter;
+import org.apache.xmlbeans.tool.CommandLine;
+import org.openuri.mytest.Simplicity;
+import org.openuri.mytest.Person;
+
+public class Test
+{
+ public static void main(String[] args)
+ {
+ /*
+ CommandLine cl = new CommandLine(args, null);
+ XSDParser xsdparser = XSDParserFactory.newInstance().createXSDParser();
+ XMLInputStreamFactory xmlparser = XMLInputStreamFactory.newInstance();
+ boolean simpletest = false;
+
+ SchemaTypeSystemBuilder builder = new SchemaTypeSystemBuilder("test");
+
+ args = cl.args();
+ for (int i = 0; i < args.length; i++)
+ {
+ try
+ {
+ Reader input = new FileReader(args[i]);
+ SchemaDocument sdoc = xsdparser.parseSchema(xmlparser.newInputStream(input));
+ XSDSchema s = sdoc.getSchema();
+ builder.addAllComponents(s);
+ }
+ catch (FileNotFoundException e)
+ {
+ System.out.println("Error opening file " + args[i] + ":\n" + e);
+ }
+ catch (XMLStreamException e)
+ {
+ System.out.println("Error parsing file " + args[i] + ":\n" + e);
+ }
+ catch (XSDException e)
+ {
+ System.out.println("Error parsing schema file " + args[i] + ":\n" + e);
+ }
+ }
+
+ builder.resolveAllTypes();
+ builder.javaizeAllTypes();
+
+ // OK, here we go
+
+ SchemaType[] gtypes = builder.globalTypes();
+ for (int i = 0; i < gtypes.length; i++)
+ {
+ SchemaType type = gtypes[i];
+
+ // print only types in this type system
+ if (!type.getSchemaTypeSystem().equals(builder))
+ continue;
+
+ try
+ {
+ System.err.println("Printing type");
+ SchemaTypeCodePrinter.printType(new OutputStreamWriter(System.out), type);
+ }
+ catch (IOException e)
+ {
+ System.err.println("IO Error " + e);
+ }
+ }
+ */
+
+ boolean simpletest = false;
+
+ if (simpletest)
+ {
+ TestStore store = new TestStore(org.openuri.mytest.SimpleDocument.type);
+ TestStore.Cursor cursor = store.newCursor();
+
+ System.err.println("Got store, filling it in...");
+ cursor.addChild(new Name("http://openuri.org/mytest", "simple"));
+ cursor.toFirstChild();
+ cursor.setAttribute(new Name(null, "note"), "a smallish number");
+ cursor.setText("143");
+ cursor.toRoot();
+ cursor.toFirstChild();
+ Simplicity simp = (Simplicity)cursor.obj();
+ System.err.println("The value of simplicity: " + simp.intValue());
+ System.err.println("And a note: " + simp.getNote());
+ }
+ else
+ {
+ TestStore store = new TestStore(org.openuri.mytest.CustomerDocument.type);
+ TestStore.Cursor cursor = store.newCursor();
+ System.err.println("Got store, filling it in...");
+ cursor.addChild(new Name("http://openuri.org/mytest", "customer"));
+ cursor.toFirstChild();
+ cursor.addChild(new Name("http://openuri.org/mytest", "firstname"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "number"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "number"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "birthday"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "number"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "number"));
+ cursor.addChild(new Name("http://openuri.org/mytest", "birthday"));
+ cursor.toFirstChild();
+ cursor.setText("Howdy");
+ cursor.toNext();
+ cursor.setText("436");
+ cursor.toNext();
+ cursor.setText("123");
+ cursor.toNext();
+ cursor.setText("1998-08-26Z");
+ cursor.toNext();
+ cursor.setText("44");
+ cursor.toNext();
+ cursor.setText("933");
+ cursor.toNext();
+ cursor.setText("2000-08-06-08:00");
+ cursor.toRoot();
+ cursor.toFirstChild();
+ Person person = (Person)cursor.obj();
+ System.err.println("Person.getFirstname() = " + person.getFirstname());
+ int sum = 0;
+ for (int i = 0; i < person.countOfNumber(); i++)
+ {
+ System.err.println("Person.getNumber(" + i +") = " + person.getNumber(i));
+ sum += person.getNumber(i);
+ }
+ System.err.println("sum of numbers = " + sum);
+ for (int i = 0; i < person.countOfBirthday(); i++)
+ {
+ System.err.println("Person.getBirthday(" + i +") = " + person.getBirthday(i));
+ System.err.println("Person.xgetBirthday(" + i +") = " + person.xgetBirthday(i));
+ System.err.println("Person.xgetBirthday(" + i +").gDateValue().getDay() = " + person.xgetBirthday(i).gDateValue().getDay());
+ sum += person.getNumber(i);
+ }
+ System.err.println("Setting firstname to George");
+ person.setFirstname("George");
+ System.err.println("Person.getFirstname() = " + person.getFirstname());
+ System.err.flush();
+ }
+
+ }
+}
diff --git a/v1/test/src/teststore/com/bea/test/TestStore.java b/v1/test/src/teststore/com/bea/test/TestStore.java
new file mode 100644
index 0000000..59c729b
--- /dev/null
+++ b/v1/test/src/teststore/com/bea/test/TestStore.java
@@ -0,0 +1,276 @@
+/* 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 com.bea.test;
+
+import org.apache.xmlbeans.xml.stream.XMLName;
+import org.apache.xmlbeans.values.TypeStoreUserFactory;
+import xml.util.SchemaTypeSystem;
+import xml.util.XmlObject;
+import xml.util.SchemaType;
+
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class TestStore
+{
+ TestTypeStore _root;
+
+ public TestStore(SchemaType rootType)
+ {
+ _root = makeRootStore(rootType);
+ }
+
+ Cursor newCursor()
+ {
+ return new Cursor();
+ }
+
+ public class Cursor
+ {
+ TestTypeStore _curpos = _root;
+ int _curIndex = 0;
+
+ public XmlObject obj()
+ {
+ return (XmlObject)_curpos._user;
+ }
+
+ public boolean hasParent()
+ {
+ return _curpos._parent != null;
+ }
+
+ public boolean toRoot()
+ {
+ _curpos = _root;
+ _curIndex = 0;
+ return true;
+ }
+
+ public boolean toParent()
+ {
+ if (!hasParent())
+ return false;
+ _curpos = _curpos._parent;
+ return true;
+ }
+
+ public boolean hasNext()
+ {
+ if (_curpos._parent == null)
+ return false;
+ if (_curIndex + 1 < _curpos._parent._childElementTypeStores.size())
+ return true;
+ return false;
+ }
+
+ public boolean toNext()
+ {
+ if (!hasNext())
+ return false;
+ _curIndex++;
+ _curpos = (TestTypeStore)_curpos._parent._childElementTypeStores.get(_curIndex);
+ return true;
+ }
+
+ public boolean toPrev()
+ {
+ if (!hasPrev())
+ return false;
+ _curIndex--;
+ _curpos = (TestTypeStore)_curpos._parent._childElementTypeStores.get(_curIndex);
+ return true;
+ }
+
+ public boolean hasPrev()
+ {
+ if (_curpos._parent == null)
+ return false;
+ if (_curIndex - 1 > 0)
+ return true;
+ return false;
+ }
+
+ public boolean hasChild()
+ {
+ return _curpos._childElementTypeStores != null &&
+ _curpos._childElementTypeStores.size() > 0;
+ }
+
+ public boolean toFirstChild()
+ {
+ if (!hasChild())
+ return false;
+ _curIndex = 0;
+ _curpos = (TestTypeStore)_curpos._childElementTypeStores.get(_curIndex);
+ return true;
+ }
+
+ public boolean toLastChild()
+ {
+ if (!hasChild())
+ return false;
+ _curIndex = _curpos._childElementTypeStores.size() - 1;
+ _curpos = (TestTypeStore)_curpos._childElementTypeStores.get(_curIndex);
+ return true;
+ }
+
+ public boolean toChildNamed(XMLName name, int index)
+ {
+ if (!hasChild())
+ return false;
+ int targetindex = 0;
+ for (Iterator i = _curpos._childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+
+ if (store._name.equals(name))
+ {
+ if (index == 0)
+ {
+ _curIndex = targetindex;
+ _curpos = store;
+ return true;
+ }
+ index--;
+ }
+ targetindex++;
+ }
+ return false;
+ }
+
+ public boolean toChildAt(int index)
+ {
+ if (!hasChild())
+ return false;
+ if (index < 0 || index >= _curpos._childElementTypeStores.size())
+ return false;
+ _curIndex = index;
+ _curpos = (TestTypeStore)_curpos._childElementTypeStores.get(index);
+ return true;
+ }
+
+ public void removeChildAt(int index)
+ {
+ if (!hasChild() || index < 0 || index >= _curpos._childElementTypeStores.size())
+ throw new ArrayIndexOutOfBoundsException();
+ TestTypeStore target = (TestTypeStore)_curpos._childElementTypeStores.get(index);
+ target.disconnect();
+ _curpos._childElementTypeStores.remove(index);
+ }
+
+ public void insertChildAt(int index, XMLName name)
+ {
+ if (index < 0 ||
+ (_curpos._childElementTypeStores == null ?
+ index > 0 : index > _curpos._childElementTypeStores.size()))
+ throw new ArrayIndexOutOfBoundsException();
+ _curpos._textLeafContent = null;
+ if (_curpos._childElementTypeStores == null)
+ _curpos._childElementTypeStores = new ArrayList();
+ _curpos._childElementTypeStores.add(index, _curpos.makeNewChild(name, false));
+ }
+
+ public void addChild(XMLName name)
+ {
+ _curpos._textLeafContent = null;
+ if (_curpos._childElementTypeStores == null)
+ _curpos._childElementTypeStores = new ArrayList();
+ _curpos._childElementTypeStores.add(_curpos.makeNewChild(name, false));
+ }
+
+ public int countChild()
+ {
+ if (_curpos._childElementTypeStores == null)
+ return 0;
+ return _curpos._childElementTypeStores.size();
+ }
+
+ public String getAttribute(XMLName name)
+ {
+ if (_curpos._childAttributeTypeStores == null)
+ return null;
+
+ TestTypeStore attr = (TestTypeStore)_curpos._childAttributeTypeStores.get(name);
+ if (attr == null)
+ return null;
+
+ String result = attr._textLeafContent;
+ return result == null ? "" : result;
+ }
+
+ public void clearAttribute(XMLName name)
+ {
+ if (_curpos._childAttributeTypeStores == null)
+ return;
+ }
+
+ public void setAttribute(XMLName name, String value)
+ {
+ if (_curpos._childAttributeTypeStores == null)
+ _curpos._childAttributeTypeStores = new HashMap();
+
+ TestTypeStore attr = _curpos.makeNewChild(name, true);
+
+ attr._textLeafContent = value;
+ _curpos._childAttributeTypeStores.put(name, attr);
+ }
+
+ public void setText(String text)
+ {
+ if (_curpos._childElementTypeStores != null)
+ {
+ for (Iterator i = _curpos._childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+ store.disconnect();
+ }
+ _curpos._childElementTypeStores = null;
+ }
+ _curpos._textLeafContent = text;
+ }
+
+ public String getText()
+ {
+ if (_curpos._childElementTypeStores != null)
+ throw new IllegalStateException(); // in practice perhaps we want to concatenate flattened stripped text
+ String result = _curpos._textLeafContent;
+ return result == null ? "" : result;
+ }
+
+ Cursor newCursor()
+ {
+ Cursor result = new Cursor();
+ result._curIndex = _curIndex;
+ result._curpos = _curpos;
+ return result;
+ }
+ }
+
+ private TestTypeStore makeRootStore(SchemaType rootType)
+ {
+ TestTypeStore result = new TestTypeStore();
+ result._parent = null;
+ result._name = null;
+ result._isAttribute = false;
+ result._user = ((TypeStoreUserFactory)rootType).createTypeStoreUser();
+ if (result._user == null)
+ throw new IllegalStateException();
+ result._user.attach_store(result);
+ return result;
+ }
+}
diff --git a/v1/test/src/teststore/com/bea/test/TestTypeStore.java b/v1/test/src/teststore/com/bea/test/TestTypeStore.java
new file mode 100644
index 0000000..4ed385c
--- /dev/null
+++ b/v1/test/src/teststore/com/bea/test/TestTypeStore.java
@@ -0,0 +1,454 @@
+/* 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 com.bea.test;
+
+import org.apache.xmlbeans.values.TypeStore;
+import org.apache.xmlbeans.values.TypeStoreUser;
+import org.apache.xmlbeans.values.TypeStoreVisitor;
+import org.apache.xmlbeans.xml.stream.XMLName;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import xml.util.SchemaType;
+import xml.util.QNameSet;
+import xml.util.XmlCursor;
+
+public class TestTypeStore implements TypeStore
+{
+ TestTypeStore _parent;
+ TypeStoreUser _user;
+ XMLName _name;
+ boolean _isAttribute;
+ boolean _isNil;
+ String _textLeafContent;
+ List _childElementTypeStores;
+ Map _childAttributeTypeStores;
+
+ public XmlCursor new_cursor()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ public void invalidate_text(TypeStoreUser user)
+ {
+ assert(!hasElements());
+ }
+
+ public String fetch_text(int whitespaceRule)
+ {
+ assert(!hasElements());
+ return _textLeafContent == null ? "" : apply_wsr(_textLeafContent, whitespaceRule);
+ }
+
+ public void store_text(TypeStoreUser user, String text)
+ {
+ assert(!hasElements());
+ _textLeafContent = text;
+ }
+
+ /**
+ * Here the TypeStore is responsible for locating the default value.
+ * This is done as follows
+ * (1) go to the parent TypeStoreUser
+ * (2) ask it to get_default_element_text(qname) (or _attribute_), and return it if not null.
+ * (2) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor();
+ * (3) call v.visit(name) on _every_ element qname up to and including this one in order
+ * (4) return the result of v.get_default_text().
+ */
+ public String compute_default_text()
+ {
+ if (_parent == null)
+ return "";
+ String deftext =
+ _isAttribute ? _parent._user.get_default_attribute_text(_name) :
+ _parent._user.get_default_element_text(_name);
+ if (deftext == null)
+ {
+ TypeStoreVisitor visitor = _parent._user.new_visitor();
+ for (Iterator i = _parent._childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore sibling = (TestTypeStore)i.next();
+ visitor.visit(sibling._name);
+ if (sibling == this)
+ return visitor.get_default_text();
+ }
+ assert(false) : "Invariant error: parent doesn't have this as child.";
+ }
+ return deftext;
+ }
+
+ public int compute_elementflags()
+ {
+ if (_parent == null)
+ return 0;
+ int flags;
+ if (_isAttribute)
+ {
+ flags = _parent._user.get_attributeflags(_name);
+ }
+ else
+ {
+ flags = _parent._user.get_elementflags(_name);
+ if (flags == -1)
+ {
+ TypeStoreVisitor visitor = _parent._user.new_visitor();
+ for (Iterator i = _parent._childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore sibling = (TestTypeStore)i.next();
+ visitor.visit(sibling._name);
+ if (sibling == this)
+ return visitor.get_elementflags();
+ }
+ assert(false) : "Invariant error: parent doesn't have this as child.";
+ flags = 0;
+ }
+ }
+ return flags;
+ }
+
+ public void invalidate_nil(TypeStoreUser user)
+ {
+ // this could be done later
+ _isNil = _user.build_nil();
+ }
+
+ public boolean find_nil()
+ {
+ return _isNil;
+ }
+
+ public String find_prefix_for_nsuri(String nsuri, String suggested_prefix)
+ {
+ throw new RuntimeException("The test harness has no namespace support");
+ }
+
+ public int count_elements(XMLName name)
+ {
+ int count = 0;
+
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ if (((TestTypeStore)i.next())._name.equals(name))
+ count++;
+ }
+
+ return count;
+ }
+
+ public TypeStoreUser find_element_user(XMLName name, int index)
+ {
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+
+ if (store._name.equals(name))
+ {
+ if (index == 0)
+ return store._user;
+ index--;
+ }
+ }
+
+ return null; // no exception please
+ }
+
+ public TypeStoreUser insert_element_user(XMLName name, int index)
+ {
+ TypeStoreUser target = null;
+ int insertindex = 0;
+
+ if (_childElementTypeStores == null)
+ {
+ _childElementTypeStores = new ArrayList();
+ }
+ else
+ {
+ int lastfoundat = 0;
+
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+
+ if (store._name.equals(name))
+ {
+ lastfoundat = insertindex;
+ index--;
+ if (index < 0)
+ break;
+ }
+ insertindex++;
+ }
+
+ if (index < 0)
+ {
+ // found one; insert right before
+ insertindex = lastfoundat;
+ }
+ else if (index > 0)
+ {
+ // didn't find several; that's illegal.
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ else
+ {
+ // found all but last one: we must be appending.
+ // but where to append?
+
+ QNameSet delimiters = _parent._user.get_element_ending_delimiters(name);
+
+ for (insertindex = lastfoundat + 1; insertindex < _childElementTypeStores.size(); insertindex++)
+ {
+ TestTypeStore store = (TestTypeStore)_childElementTypeStores.get(insertindex);
+ if (delimiters.contains(store._name))
+ break; // insertindex is wherever the first delimiter is found
+ }
+
+ // if not found, insertindex is one past the end.
+ }
+ }
+
+ TestTypeStore newChild = makeNewChild(name, false);
+ _childElementTypeStores.add(insertindex, newChild);
+ return newChild._user;
+ }
+
+ TestTypeStore makeNewChild(XMLName name, boolean isAttribute)
+ {
+ TestTypeStore result = new TestTypeStore();
+ result._parent = this;
+ result._name = name;
+ result._isAttribute = isAttribute;
+ if (isAttribute)
+ result._user = _user.create_attribute_user(name);
+ else
+ result._user = _user.create_element_user(name, null); // no xsi:types for now
+ if (result._user == null)
+ throw new IllegalStateException();
+ result._user.attach_store(result);
+ return result;
+ }
+
+ void disconnect()
+ {
+ if (_childElementTypeStores != null)
+ {
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+ store.disconnect();
+ }
+ }
+ _childElementTypeStores = null;
+ if (_childAttributeTypeStores != null)
+ {
+ for (Iterator i = _childAttributeTypeStores.values().iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+ store.disconnect();
+ }
+ }
+ _childAttributeTypeStores = null;
+ _user.disconnect_store();
+ _user = null;
+ _parent = null;
+ _name = null;
+ _textLeafContent = null;
+ }
+
+ public int findInsertIndexBasedOnOrder(XMLName[] order, XMLName nameToAdd)
+ {
+ int orderindex = 0;
+ int insertindex = 0;
+
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+ while (orderindex < order.length && !order[orderindex].equals(store._name))
+ {
+ if (order[orderindex].equals(nameToAdd))
+ {
+ return insertindex;
+ }
+ orderindex++;
+ }
+ insertindex++;
+ }
+ return insertindex;
+ }
+
+ public TypeStoreUser add_element_user(XMLName name)
+ {
+ return insert_element_user(name, count_elements(name));
+ }
+
+ public void remove_element(XMLName name, int index)
+ {
+ TypeStoreUser target = null;
+ int removeindex = 0;
+ boolean found = false;
+
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+
+ if (store._name.equals(name))
+ {
+ if (index == 0)
+ {
+ _childElementTypeStores.remove(removeindex);
+ return;
+ }
+ index--;
+ }
+ removeindex++;
+ }
+
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
+ public TypeStoreUser find_attribute_user(XMLName name)
+ {
+ if (_childAttributeTypeStores == null)
+ return null;
+
+ TestTypeStore store = (TestTypeStore)_childAttributeTypeStores.get(name);
+ if (store == null)
+ return null;
+
+ return store._user;
+ }
+
+ public TypeStoreUser add_attribute_user(XMLName name)
+ {
+ if (_childAttributeTypeStores != null && _childAttributeTypeStores.containsKey(name))
+ throw new IllegalArgumentException();
+
+ if (_childAttributeTypeStores == null)
+ _childAttributeTypeStores = new HashMap();
+
+ TestTypeStore newChild = makeNewChild(name, true);
+ _childAttributeTypeStores.put(name, newChild);
+ return newChild._user;
+ }
+
+ public void remove_attribute(XMLName name)
+ {
+ if (_childAttributeTypeStores == null || !_childAttributeTypeStores.containsKey(name))
+ throw new IllegalArgumentException();
+ _childAttributeTypeStores.remove(name);
+ }
+
+ public void visit_elements(TypeStoreVisitor visitor)
+ {
+ for (Iterator i = _childElementTypeStores.iterator(); i.hasNext(); )
+ {
+ TestTypeStore store = (TestTypeStore)i.next();
+ visitor.visit(store._name);
+ }
+ visitor.visit(null);
+ }
+
+
+ private boolean hasElements()
+ {
+ return _childElementTypeStores != null;
+ }
+
+ /**
+ * The algorithm used by apply_wscanon: sometimes used in impls.
+ */
+ protected static String apply_wsr(String v, int wsr)
+ {
+ if (wsr == SchemaType.WS_PRESERVE || wsr == SchemaType.WS_UNSPECIFIED)
+ return v;
+
+ if (v.indexOf('\n') >= 0)
+ v = v.replace('\n', ' ');
+ if (v.indexOf('\t') >= 0)
+ v = v.replace('\t', ' ');
+ if (v.indexOf('\r') >= 0)
+ v = v.replace('\r', ' ');
+
+ if (wsr == SchemaType.WS_REPLACE)
+ return v;
+
+ int j = 0;
+ int len = v.length();
+ if (len == 0)
+ return v;
+
+ /* a trick: examine every other character looking for pairs of spaces */
+ examine: if (v.charAt(0) != ' ')
+ {
+ for (j = 2; j < len; j += 2)
+ {
+ if (v.charAt(j) == ' ')
+ {
+ if (v.charAt(j - 1) == ' ')
+ break examine;
+ if (j == len - 1)
+ break examine;
+ j++;
+ if (v.charAt(j) == ' ')
+ break examine;
+ }
+ }
+ if (j == len && v.charAt(j - 1) == ' ')
+ break examine;
+ return v;
+ }
+
+ /* j is pointing at the first ws to be removed, or past end */
+ char[] ch = v.toCharArray();
+ int i = j;
+
+ shifter: for (;;)
+ {
+ for (;;)
+ {
+ /* j was ws or past end */
+ j++;
+ if (j >= len)
+ break shifter;
+ if (j != ' ')
+ break;
+ }
+ for (;;)
+ {
+ /* j was nonws */
+ ch[i++] = ch[j++];
+ if (j >= len)
+ break shifter;
+ if (ch[j] == ' ')
+ {
+ ch[i++] = ch[j++];
+ if (j >= len)
+ break shifter;
+ if (ch[j] == ' ')
+ break;
+ }
+ }
+ }
+
+ return new String(ch, 0, (i == 0 || ch[i - 1] != ' ') ? i : i - 1);
+ }
+
+
+}
diff --git a/v1/test/src/unmarshal/com/bea/test/TestStructure.java b/v1/test/src/unmarshal/com/bea/test/TestStructure.java
new file mode 100644
index 0000000..8b405d4
--- /dev/null
+++ b/v1/test/src/unmarshal/com/bea/test/TestStructure.java
@@ -0,0 +1,23 @@
+/* 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 com.bea.test;
+
+public class TestStructure
+{
+ public int varInt;
+ public float varFloat;
+ public String varString;
+}
diff --git a/v1/test/src/unmarshal/com/bea/test/Unmarshal.java b/v1/test/src/unmarshal/com/bea/test/Unmarshal.java
new file mode 100644
index 0000000..dd4f9b4
--- /dev/null
+++ b/v1/test/src/unmarshal/com/bea/test/Unmarshal.java
@@ -0,0 +1,76 @@
+/* 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 com.bea.test;
+
+import org.apache.xmlbeans.unmarshal.MessagePlan;
+import org.apache.xmlbeans.unmarshal.UnmarshalPlan;
+import org.apache.xmlbeans.unmarshal.SimpleTypePlan;
+import org.apache.xmlbeans.unmarshal.StructurePlan;
+import org.apache.xmlbeans.unmarshal.UnmarshalContext;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+
+import javax.xml.namespace.QName;
+
+import java.io.File;
+
+import org.apache.xmlbeans.xml.stream.XMLInputStream;
+
+public class Unmarshal
+{
+ public static void main(String args[]) throws Exception
+ {
+ MessagePlan messagePlan = new MessagePlan(2);
+
+ SimpleTypePlan param1Plan = new SimpleTypePlan(SimpleTypePlan.JAVA_FLOAT, true, SchemaType.BTC_DOUBLE, null, 0);
+
+ StructurePlan param2Plan = new StructurePlan();
+
+ param2Plan.setTargetClass(com.bea.test.TestStructure.class);
+ param2Plan.setInfoForElement(new QName("varInt"), new StructurePlan.FieldInfo("varInt", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_INT, true, SchemaType.BTC_INTEGER, null, 0)));
+ param2Plan.setInfoForElement(new QName("varFloat"), new StructurePlan.FieldInfo("varFloat", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_FLOAT, true, SchemaType.BTC_FLOAT, null, 0)));
+ param2Plan.setInfoForElement(new QName("varString"), new StructurePlan.FieldInfo("varString", false, "com.bea.test.TestStructure", null, StructurePlan.FieldInfo.SINGLETON, new SimpleTypePlan(SimpleTypePlan.JAVA_STRING, false, SchemaType.BTC_STRING, null, 0)));
+
+ messagePlan.setInfoForElement(new QName("LastTradePrice"), new MessagePlan.ParamInfo(0, MessagePlan.ParamInfo.SINGLETON, param1Plan));
+ messagePlan.setInfoForElement(new QName("inputStruct"), new MessagePlan.ParamInfo(1, MessagePlan.ParamInfo.SINGLETON, param2Plan));
+
+ XmlObject xobj = XmlObject.Factory.parse(new File(args[0]));
+ XMLInputStream xinput = xobj.newXMLInputStream();
+ while (xinput.hasNext())
+ {
+ if (xinput.peek().isStartElement())
+ break;
+ xinput.skip();
+ }
+
+ UnmarshalContext context = new UnmarshalContext();
+ Object[] result = (Object[])messagePlan.unmarshal(xinput, context);
+ context.complete();
+
+ for (int i = 0; i < result.length; i++)
+ {
+ System.out.println("Result " + i + " = " + result[i]);
+ if (result[i] instanceof TestStructure)
+ {
+ TestStructure s = (TestStructure)result[i];
+ System.out.println(" varInt = " + s.varInt);
+ System.out.println(" varFloat = " + s.varFloat);
+ System.out.println(" varString = " + s.varString);
+ }
+ }
+ }
+}
diff --git a/v1/test/src/xmlpad/org/apache/xmlbeans/impl/xmlpad/XmlPad.java b/v1/test/src/xmlpad/org/apache/xmlbeans/impl/xmlpad/XmlPad.java
new file mode 100644
index 0000000..49297fa
--- /dev/null
+++ b/v1/test/src/xmlpad/org/apache/xmlbeans/impl/xmlpad/XmlPad.java
@@ -0,0 +1,34 @@
+/* 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.xmlbeans.impl.xmlpad;
+
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.impl.store.Root;
+
+public class XmlPad
+{
+ static public void main ( String[] args )
+ {
+ System.out.println( "Hi there!" );
+
+ new XmlPad().run();
+ }
+
+ void run ( )
+ {
+// String s = new String( System.in.read();
+ }
+}
\ No newline at end of file
diff --git a/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/TestXPath.java b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/TestXPath.java
new file mode 100644
index 0000000..c8872ef
--- /dev/null
+++ b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/TestXPath.java
@@ -0,0 +1,142 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+
+import org.jaxen.XPath;
+import org.jaxen.XPathSyntaxException;
+import org.jaxen.JaxenException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+
+import java.util.List;
+import java.util.Iterator;
+import java.io.File;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class TestXPath
+{
+ public static void main(String[] args)
+ {
+ try
+ {
+
+ XmlObject doc;
+
+ if (args.length!=1)
+ {
+ System.out.println("TestXPath test/cases/xpath/testXPath.xml");
+ return;
+ }
+ else
+ {
+ doc = XmlObject.Factory.parse(new File(args[0]));
+ }
+
+ String[] xpath = new String[25];
+ xpath[0] = "/doc/a/@test";
+ xpath[1] = "//.";
+ xpath[2] = "/doc";
+ xpath[3] = "/doc/a";
+ xpath[4] = "//@*";
+ xpath[5] = ".";
+ xpath[6] = "//ancestor-or-self::*";
+ xpath[7] = "./child::*[1]";
+ xpath[8] = "//descendant-or-self::*/@*[1]";
+ xpath[9] = "//@* | * | node()";
+ xpath[10] = "//*";
+ xpath[11] = "/doc/namespace::*";
+ xpath[12] = "//descendant::comment()";
+ xpath[13] = "//*[local-name()='a']";
+ xpath[14] = "//*/@*"; // "//*[current()]/@*";
+ xpath[15] = "//*[last()]";
+ xpath[16] = "doc/*[last()]";
+ xpath[17] = "/doc/a/*/@*"; // "/doc/a/*[current()]/@*";
+ xpath[18] = "doc/descendant::node()";
+ xpath[19] = "doc/a/@*";
+ xpath[20] = "doc/b/a/ancestor-or-self::*";
+ xpath[21] = "doc/b/a/preceding::*";
+ xpath[22] = "doc/a/following::*";
+ xpath[23] = "/doc/b/preceding-sibling::*";
+ xpath[24] = "/doc/a/following-sibling::*";
+
+ test1(doc, xpath);
+ }
+ catch (XPathSyntaxException e)
+ {
+ System.err.println( e.getMultilineMessage() );
+ }
+ catch (JaxenException e)
+ {
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test1(XmlObject doc, String[] xpathes) throws JaxenException
+ {
+ for (int i=0; i<xpathes.length; i++)
+ {
+ runXpath2(doc, xpathes[i], i);
+ }
+ }
+
+ private static void runXpath1(XmlObject doc, String xpathStr, int i)
+ throws JaxenException
+ {
+ System.out.println("\n>>>================= " + i + " " + xpathStr + " ========================<<<");
+
+ XPath xpath = new XBeansXPath(xpathStr);
+ XmlCursor xc = doc.newCursor();
+ List results = xpath.selectNodes( xc );
+
+ Iterator resultIter = results.iterator();
+
+ //System.out.println("Document :: \n" + doc );
+ int j = 0;
+ while ( resultIter.hasNext() )
+ {
+ xc = (XmlCursor)resultIter.next();
+ System.out.println("> " + (j++) + " >--------------------------------------< " + xc.currentTokenType());
+ System.out.println( xc );
+ }
+ System.out.println("\n>>>Results: " + j + " " + xpathStr + " ==========================<<<");
+ xc.dispose();
+ }
+
+ private static void runXpath2(XmlObject doc, String xpathStr, int i)
+ {
+ System.out.println("\n>>>================= " + i + " " + xpathStr + " ========================<<<");
+
+ XmlCursor xc = doc.newCursor();
+ xc.selectPath(xpathStr);
+
+ //System.out.println("Document :: \n" + doc );
+ int j = 0;
+ while ( xc.toNextSelection() )
+ {
+ System.out.println("> " + (j++) + " >--------------------------------------< " + xc.currentTokenType());
+ System.out.println( xc );
+ }
+ System.out.println("\n>>>Results: " + j + " " + xpathStr + " ==========================<<<");
+ xc.dispose();
+ }
+}
diff --git a/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansDemo.java b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansDemo.java
new file mode 100644
index 0000000..367999f
--- /dev/null
+++ b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XBeansDemo.java
@@ -0,0 +1,137 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+
+import org.jaxen.XPath;
+import org.jaxen.JaxenException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.xpath.jaxen.XBeansXPath;
+
+import java.util.List;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class XBeansDemo
+{
+ public static void main(String[] args)
+ {
+ try
+ {
+ String xpathStr;
+ File file;
+
+ if (args.length!=2)
+ {
+ System.out.println("Usage: XBeansDemo file.xml xpath");
+ return;
+ }
+ else
+ {
+ file = new File(args[0]);
+ xpathStr = args[1];
+ }
+
+ test1(xpathStr, file);
+
+ test3(xpathStr, file);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test1(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test1: XBeansXPath.selectNodes(xpathStr) Navigator: XmlBookmarks + 1 XmlCursor embeded in the bookmark -----");
+
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XPath xpath = new XBeansXPath(xpathStr);
+ XmlCursor xc = doc.newCursor();
+ List results = xpath.selectNodes(xc);
+
+ Iterator resultIter = results.iterator();
+
+ System.out.println("Document :: " + doc );
+ System.out.println(" XPath :: " + xpath );
+ System.out.println("");
+ System.out.println("Results" );
+ System.out.println("----------------------------------");
+
+ while ( resultIter.hasNext() )
+ {
+ xc = (XmlCursor)resultIter.next();
+ System.out.println( xc );
+ }
+ System.out.println("----------------------------------");
+ System.out.println(results.size() );
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ catch (JaxenException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test3(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test3: XmlCursor.selectPath(cpath) -----");
+
+ try
+ {
+ String cpath = XmlBeans.compilePath( xpathStr );
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XmlCursor speaker = doc.newCursor();
+
+ int count = 0;
+ speaker.toStartDoc();
+ speaker.selectPath(cpath);
+ speaker.getSelectionCount();
+ while ( speaker.toNextSelection() )
+ {
+ System.out.println(speaker);
+ count += (speaker == null ? 0 : 1);
+ }
+
+ System.out.println(">>> " + count + " selections");
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XPathPerf.java b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XPathPerf.java
new file mode 100644
index 0000000..e632248
--- /dev/null
+++ b/v1/test/src/xpath/org/apache/xmlbeans/impl/xpath/jaxen/XPathPerf.java
@@ -0,0 +1,335 @@
+/* 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.xmlbeans.impl.xpath.jaxen;
+
+import org.jaxen.XPath;
+import org.jaxen.JaxenException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.impl.xpath.jaxen.XBeansXPath;
+
+import java.util.List;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Author: Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Oct 10, 2003
+ */
+public class XPathPerf
+{
+ public static void main(String[] args)
+ {
+ try
+ {
+ String xpathStr;
+ File file;
+
+ if (args.length!=2)
+ {
+ System.out.println("Usage: XBeansDemo file.xml xpath");
+ return;
+ }
+ else
+ {
+ file = new File(args[0]);
+ xpathStr = args[1];
+ }
+
+ //test1(xpathStr, file);
+ //test2(xpathStr, file);
+
+// test3t(xpathStr, file);
+// test3(xpathStr, file);
+// test4(file);
+
+ test5();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test1(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test1: XBeansXPath.selectNodes(xpathStr) Navigator: XmlBookmarks + 1 XmlCursor embeded in Navigator -----");
+
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XPath xpath = new XBeansXPath(xpathStr);
+ XmlCursor xc = doc.newCursor();
+ List results = xpath.selectNodes(xc);
+
+ Iterator resultIter = results.iterator();
+
+// System.out.println("Document :: " + doc );
+ System.out.println(" XPath :: " + xpath );
+ System.out.println("");
+ System.out.println("Results" );
+ System.out.println("----------------------------------");
+
+ while ( resultIter.hasNext() )
+ {
+ xc = (XmlCursor)resultIter.next();
+ System.out.println( xc );
+ }
+ System.out.println("----------------------------------");
+ System.out.println(results.size() );
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ catch (JaxenException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test2(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test2: XBeansXPath.selectNodes(xpathStr) Navigator: XmlBookmarks + 1 XmlCursor embeded in Navigator -----");
+
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XPath xpath = new XBeansXPath(xpathStr);
+ XmlCursor docXC = doc.newCursor();
+
+ long start = System.currentTimeMillis();
+ int count = 0;
+
+ for (int j = 0; j < 10; j++)
+ {
+ long start2 = System.currentTimeMillis();
+ for (int i = 0; i < 100; i++)
+ {
+ XmlCursor speaker = (XmlCursor)xpath.selectSingleNode(docXC);
+ count += (speaker == null ? 0 : 1);
+ }
+ //System.out.println((j*100) + " \t" + (System.currentTimeMillis()-start2));
+ }
+
+ long end = System.currentTimeMillis();
+ System.out.println(">>> " + count + " selections in " + (end - start) + " ms");
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ catch (JaxenException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test3(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test3: XmlCursor.selectPath(cpath) -----");
+
+ try
+ {
+ String cpath = XmlBeans.compilePath( xpathStr );
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XmlCursor speaker = doc.newCursor();
+
+ long start = System.currentTimeMillis();
+
+ int count = 0;
+ for (int j = 0; j < 10; j++) {
+ long start2 = System.currentTimeMillis();
+ for (int i = 0; i < 100; i++)
+ {
+ speaker.toStartDoc();
+ speaker.selectPath(cpath);
+ //speaker.getSelectionCount();
+ while ( speaker.toNextSelection() ) ;
+
+ count += (speaker == null ? 0 : 1);
+ }
+ System.out.println((j*100) + " \t" + (System.currentTimeMillis()-start2));
+ }
+
+ long end = System.currentTimeMillis();
+ System.out.println(">>> " + count + " selections in " + (end - start) + " ms");
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test3t(String xpathStr, File file)
+ {
+ System.out.println("\n ----- test3: XmlCursor.selectPath(cpath) -----");
+
+ try
+ {
+ String cpath = XmlBeans.compilePath( xpathStr );
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XmlCursor speaker = doc.newCursor();
+
+ int count = 0;
+ speaker.toStartDoc();
+ speaker.selectPath(cpath);
+ //speaker.getSelectionCount();
+ while ( speaker.toNextSelection() )
+ {
+ System.out.println(speaker);
+ count += (speaker == null ? 0 : 1);
+ }
+
+ System.out.println(">>> " + count + " selections");
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void test4(File file)
+ {
+ System.out.println("\n ----- test4: 1 XmlCursor handCoded -----");
+
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(file);
+ XmlCursor xc = doc.newCursor();
+
+ long start = System.currentTimeMillis();
+
+ int count = 0;
+ for (int j = 0; j < 10; j++) {
+ long start2 = System.currentTimeMillis();
+ for (int i = 0; i < 100; i++)
+ {
+ xc.toStartDoc();
+
+ rec(new String[] {"PLAY","ACT","SCENE","SPEECH","SPEAKER"}, 0, xc);
+
+ count += (xc == null ? 0 : 1);
+ }
+ //System.out.println((j*100) + " \t" + (System.currentTimeMillis()-start2));
+ }
+
+ long end = System.currentTimeMillis();
+ System.out.println(">>> " + count + " selections in " + (end - start) + " ms");
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private static void rec(String[] xp, int i, XmlCursor xc )
+ {
+ if (i>=xp.length)
+ {
+ //System.out.println(xc);
+ return;
+ }
+
+ if (xc.toChild(xp[i])) do
+ {
+ rec(xp, i+1, xc);
+ }
+ while(xc.toNextSibling(xp[i]));
+ xc.toParent();
+ }
+
+ private static void test5()
+ {
+ System.out.println("\n ----- test5: XBeansXPath.selectNodes(xpathStr) Navigator: XmlBookmarks + 1 XmlCursor embeded in Navigator -----");
+
+ //String xmlDocStr = "<AAA> <BBB id = \"b1\"/> <BBB name = \" bbb \"/> <BBB name = \"bbb\"/> </AAA>";
+ //String xpathStr = "//BBB[normalize-space(@name)='bbb']";
+
+ String xmlDocStr =
+ "<AAA>\n" +
+ " <BCC> \n" +
+ " <BBB/>\n" +
+ " <BBB/> \n" +
+ " <BBB/> \n" +
+ " </BCC> \n" +
+ " <DDB> \n" +
+ " <BBB/>\n" +
+ " <BBB/> \n" +
+ " </DDB> \n" +
+ " <BEC> \n" +
+ " <CCC/>\n" +
+ " <DBD/> \n" +
+ " </BEC> \n" +
+ "</AAA> ";
+ String xpathStr = "//*[contains(name(),'C')]";
+
+ try
+ {
+ XmlObject doc = XmlObject.Factory.parse(xmlDocStr);
+ XPath xpath = new XBeansXPath(xpathStr);
+ XmlCursor xc = doc.newCursor();
+ List results = xpath.selectNodes(xc);
+
+ Iterator resultIter = results.iterator();
+
+// System.out.println("Document :: " + doc );
+ System.out.println(" XPath :: " + xpath );
+ System.out.println("");
+ System.out.println("Results" );
+ System.out.println("----------------------------------");
+
+ while ( resultIter.hasNext() )
+ {
+ xc = (XmlCursor)resultIter.next();
+ System.out.println( xc );
+ }
+ System.out.println("----------------------------------");
+ System.out.println(results.size() );
+ }
+ catch (XmlException e)
+ {
+ e.printStackTrace();
+ }
+ catch (JaxenException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/v1/test/src/xstypes/default.xsd b/v1/test/src/xstypes/default.xsd
new file mode 100644
index 0000000..2be1d9f
--- /dev/null
+++ b/v1/test/src/xstypes/default.xsd
@@ -0,0 +1,59 @@
+<!-- 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. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="validElemDefault" type="xs:int" default="1"/>
+<!-- BAU: we can't compile any more because it's invalid
+ <xs:element name="invalidElemDefault" type="xs:int" default="a"/>
+-->
+ <xs:element name="validElemFixed" type="xs:int" fixed="2"/>
+<!-- BAU: we can't compile any more because it's invalid
+ <xs:element name="invalidElemFixed" type="xs:int" fixed="b"/>
+-->
+
+ <xs:element name="validAttrDefault">
+ <xs:complexType>
+ <xs:attribute name="attr" type="xs:int" default="3"/>
+ </xs:complexType>
+ </xs:element>
+
+<!-- BAU: we can't compile any more because it's invalid
+ <xs:element name="invalidAttrDefault">
+ <xs:complexType>
+ <xs:attribute name="attr" type="xs:int" default="c"/>
+ </xs:complexType>
+ </xs:element>
+-->
+
+ <xs:element name="validAttrFixed">
+ <xs:complexType>
+ <xs:attribute name="aricttr" type="xs:int" fixed="4"/>
+ </xs:complexType>
+ </xs:element>
+
+<!-- BAU: we can't compile any more because it's invalid
+ <xs:element name="invalidAttrFixed">
+ <xs:complexType>
+ <xs:attribute name="attr" type="xs:int" fixed="d"/>
+ </xs:complexType>
+ </xs:element>
+-->
+ <!-- types to help test nil -->
+
+ <xs:element name="canBeNil" nillable="true">
+ <xs:complexType>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/v1/test/src/xstypes/person.xsd b/v1/test/src/xstypes/person.xsd
new file mode 100644
index 0000000..64fb085
--- /dev/null
+++ b/v1/test/src/xstypes/person.xsd
@@ -0,0 +1,117 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mt="http://openuri.org/xstypes/test"
+ targetNamespace="http://openuri.org/xstypes/test"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified" >
+
+ <xs:notation name="jpeg" public="JPEG" />
+ <xs:notation name="gif" public="GIF" />
+
+ <xs:complexType name="person">
+ <xs:sequence>
+ <xs:element name="firstname" type="xs:string"/>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="number">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="1000"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="birthday" type="xs:date"/>
+ <!-- test that int-value does not collide with getIntValue() on SimpleValue -->
+ <xs:element name="int-value" type="xs:int"/>
+ </xs:choice>
+ <xs:element name="hex" type="xs:hexBinary"/>
+ <xs:element name="base64" type="xs:base64Binary"/>
+ <xs:element name="anyuri" type="xs:anyURI"/>
+ <xs:element name="qname" type="xs:QName"/>
+ <xs:element name="notation">
+ <xs:simpleType>
+ <xs:restriction base="xs:NOTATION">
+ <xs:enumeration value="jpeg" />
+ <xs:enumeration value="gif" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="gender">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="male"/>
+ <xs:enumeration value="female"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="hexAtt">
+ <xs:simpleType>
+ <xs:restriction base="xs:hexBinary">
+ <xs:pattern value="([45][0-9A-F])*"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="base64Att">
+ <xs:simpleType>
+ <xs:restriction base="xs:base64Binary">
+ <xs:whiteSpace value="collapse"/>
+ <xs:enumeration value="VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="anyuriAtt">
+ <xs:simpleType>
+ <xs:restriction base="xs:anyURI">
+ <xs:whiteSpace value="collapse"/>
+ <xs:length value="100"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="qnameAtt">
+ <xs:simpleType>
+ <xs:restriction base="xs:QName">
+ <xs:whiteSpace value="collapse"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="notationAtt">
+ <xs:simpleType>
+ <xs:restriction base="xs:NOTATION">
+ <xs:enumeration value="jpeg"/>
+ <xs:enumeration value="gif"/>
+ <xs:length value="20"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:element name="customer" type="mt:person"/>
+
+ <xs:element name="employee">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="mt:person">
+ <xs:sequence>
+ <xs:element name="eid" type="xs:int"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
diff --git a/v1/test/src/xstypes/setters.xsd b/v1/test/src/xstypes/setters.xsd
new file mode 100644
index 0000000..55fd589
--- /dev/null
+++ b/v1/test/src/xstypes/setters.xsd
@@ -0,0 +1,19 @@
+<!-- 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. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="setters" targetNamespace="setters"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+</xs:schema>
diff --git a/v1/test/src/xstypes/simplec.xsd b/v1/test/src/xstypes/simplec.xsd
new file mode 100644
index 0000000..442cdeb
--- /dev/null
+++ b/v1/test/src/xstypes/simplec.xsd
@@ -0,0 +1,40 @@
+<!-- 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. -->
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mt="http://openuri.org/mytest"
+ targetNamespace="http://openuri.org/mytest"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+>
+
+ <xs:complexType name="simplicity">
+ <xs:simpleContent>
+ <xs:extension base="mt:thousand">
+ <xs:attribute name="note" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="thousand">
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="1"/>
+ <xs:maxInclusive value="1000"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="simple" type="mt:simplicity"/>
+
+</xs:schema>
+
diff --git a/v1/test/src/xstypes/xstypes.xml b/v1/test/src/xstypes/xstypes.xml
new file mode 100644
index 0000000..e8ca94c
--- /dev/null
+++ b/v1/test/src/xstypes/xstypes.xml
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!-- 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. -->
+<customer xmlns="http://openuri.org/xstypes/test"
+ gender="male"
+ hexAtt="474749515457594747"
+ base64Att="
+ VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh
+ "
+ anyuriAtt="http://dmoz.org/World/Français/"
+ qnameAtt="pref:localname" xmlns:pref="some_uri"
+ notationAtt="JPEG"
+ >
+ <firstname>Howdy</firstname>
+ <number>436</number>
+ <number>123</number>
+ <birthday>1998-08-26Z</birthday>
+ <number>44</number>
+ <number>933</number>
+ <birthday>2000-08-06-08:00</birthday>
+ <hex>454749515457595A4A</hex>
+ <base64>VGhpcyBzdHJpbmcgaXMgYmFzZTY0QmluYXJ5IGVuY29kZWQh</base64>
+ <anyuri>http://3space.org/space%20space/</anyuri>
+ <qname>openuri_org_localname</qname>
+ <notation>GIF</notation>
+</customer>
diff --git a/v1/xbeanenv.cmd b/v1/xbeanenv.cmd
new file mode 100644
index 0000000..0fd151f
--- /dev/null
+++ b/v1/xbeanenv.cmd
@@ -0,0 +1 @@
+SET XMLBEANS_HOME=%~dp0.
diff --git a/v1/xbeanenv.sh b/v1/xbeanenv.sh
new file mode 100755
index 0000000..93f2d79
--- /dev/null
+++ b/v1/xbeanenv.sh
@@ -0,0 +1 @@
+export XMLBEANS_HOME=`pwd`
diff --git a/v1/xdocs/changes.xml b/v1/xdocs/changes.xml
new file mode 100644
index 0000000..4b9c21d
--- /dev/null
+++ b/v1/xdocs/changes.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Changes</title>
+ <author email="s-dutta@sbcglobal.net">Dutta Satadip</author>
+ </properties>
+
+ <body>
+ <release version="1.0.0" date="2004-07-29">
+ <action dev="dutta" type="add">
+ initial version, for xmlbeans 1.0
+ </action>
+ </release>
+ </body>
+</document>
diff --git a/v1/xdocs/goals.xml b/v1/xdocs/goals.xml
new file mode 100644
index 0000000..b3bb69e
--- /dev/null
+++ b/v1/xdocs/goals.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Maven XMLBeans Plugin Goals</title>
+ </properties>
+ <body>
+ <goals>
+ <goal>
+ <name>xmlbeans:xmlbeans</name>
+ <description>Generates XMLBeans from XML Schema files.</description>
+ </goal>
+ </goals>
+ </body>
+</document>
diff --git a/v1/xdocs/index.xml b/v1/xdocs/index.xml
new file mode 100644
index 0000000..11c0f8d
--- /dev/null
+++ b/v1/xdocs/index.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>XMLBeans Maven Plug-in</title>
+ <author email="s-dutta at sbcglobal dot net">Dutta Satadip</author>
+ <author email="jhindsley at providerlink dot com">Joseph Hindsley</author>
+ </properties>
+ <body>
+ <section name="Maven XMLBeans Plug-in">
+ <p>This plugin is a wrapper to the xmlbean ant task (see
+<a href="http://xml.apache.org/xmlbeans/">http://xml.apache.org/xmlbeans/</a>
+for more information on XMLBeans) which
+generates and compiles XMLBeans from XML Schema (*.xsd) files.
+</p>
+ <p>By default the plugin looks for the XML Schema files in the src/xmlbeans
+directory. Java source files for the generated XMLBeans are put into the
+target/xmlbeans/src directory. Class files and generated resource files are
+compiled into the target/classes directory. The plugin also creates a jar
+file (containing the generated class and resource files) which is put into
+the target/xmlbeans directory.
+</p>
+ <section name="Dependencies">
+ <p>You will need the XMLBean's xbean.jar file to use this plugin. You can get the
+jar from <a href="http://xml.apache.org/xmlbeans/">http://xml.apache.org/xmlbeans/</a>.
+The project.xml currently will download the xbeans-1.0-DEV.jar from <a href="http://www.ibiblio.org/maven/xmlbeans/jars/">http://www.ibiblio.org/maven/xmlbeans/jars/</a>.
+As new releases are made the dependency will have to changed in the project.xml
+</p>
+ </section>
+ </section>
+ </body>
+</document>
diff --git a/v1/xdocs/navigation.xml b/v1/xdocs/navigation.xml
new file mode 100644
index 0000000..64f5b7d
--- /dev/null
+++ b/v1/xdocs/navigation.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="XMLBeans Maven Plugin">
+ <title>XMLBeans Maven Plugin</title>
+ <body>
+ <links>
+ <item href="http://maven.apache.org/" name="Maven">
+ </item>
+ <item href="http://xml.apache.org/xmlbeans/" name="XMLBeans">
+ </item>
+ </links>
+ <menu name="Overview">
+ <item href="/goals.html" name="Goals">
+ </item>
+ <item href="/properties.html" name="Properties">
+ </item>
+ </menu>
+ </body>
+</project>
diff --git a/v1/xdocs/properties.xml b/v1/xdocs/properties.xml
new file mode 100644
index 0000000..e82051e
--- /dev/null
+++ b/v1/xdocs/properties.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Maven XMLBeans Plugin Properties</title>
+ </properties>
+ <body>
+ <section name="Maven XMLBeans Plugin Settings">
+ <table>
+ <tr>
+ <th>Property</th>
+ <th>Optional?</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.schema</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>src/xmlbeans</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.srconly</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>false</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.debug</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>false</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.includes</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>**/*.xsd</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.classgendir</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>${maven.build.dir}/classes</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.excludes</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>
+ </code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.srcgendir</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>${maven.build.dir}/xmlbeans/src</code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>maven.xmlbeans.xmlbean.destfile</td>
+ <td>Yes</td>
+ <td>
+ <p>Default value is
+ <code>${maven.build.dir}/xmlbeans/${maven.final.name}.jar</code>.</p>
+ </td>
+ </tr>
+ </table>
+ </section>
+ </body>
+</document>
diff --git a/v1/xkit/README.txt b/v1/xkit/README.txt
new file mode 100644
index 0000000..4ca2f86
--- /dev/null
+++ b/v1/xkit/README.txt
@@ -0,0 +1,157 @@
+XMLBeans v 1.0.3 Development Kit
+
+
+Welcome to XMLBeans!
+
+
+Kit contents:
+
+(1) One copy of xbean.jar, which contains XMLBeans.
+ Should work on any JDK 1.4.x.
+ ./lib/xbean.jar
+
+(2) License information for XML Beans and included libraries
+ ./license.txt
+
+(3) One folder full of command-line scripts, pointing to the
+ useful main() functions in the JAR.
+ ./bin
+
+(4) One bit of ant task documentation.
+ ./anttask.html
+
+(5) A copy of the plain javadoc tree for org.apache.xmlbeans.*
+ ./docs/reference
+
+(6) A preliminary collection of nicely formatted user-level
+ documentation HTML (includes reformatted and nicely
+ organized javadoc as well)
+ ./docs/guide
+
+(7) A few sample schemas
+ ./schemas
+
+
+Where to start?
+
+(1) Setup.
+
+ 1. make sure you have a JDK 1.4.x installed; that java[.exe]
+ is on your path and that JAVA_HOME/bin contains java[.exe],
+ javac[.exe], and jar[.exe].
+
+ 2. set your XMLBEANS_HOME env variable to point to the directory
+ containing xbean.jar (i.e., ./lib).
+
+ 3. put the scripts in ./bin on your path.
+
+ 4. run "scomp" with no arguments. You should get a "usage"
+ message.
+
+(2) Try some schema compilation
+
+ 1. In the ./schemas directory you'll find some collections of
+ schemas you can try out.
+
+ - easypo: a contrived simple starter "purchase order"
+ - s4s: the Schema for Schema
+
+ To compile them, you can just send the whole directory to
+ scomp, for example, "cd samples"; then "scomp easypo".
+ You will get an "xmltypes.jar" out that contains all the
+ compiled XMLBeans. To pick your own JAR filename just say
+
+ scomp -out myeasypo.jar easypo
+
+
+ 2. Especially as you get started, you will want to see the
+ .java source code for the generated code. To get that,
+ use a command-line like
+
+ scomp -src mysrcdir -out myeasypo.jar easypo
+
+ The "mysrcdir" will contain all the .java source code
+ for the generated XMLBeans.
+
+(3) Try using your compiled XMLBeans
+
+ Now, armed with the XMLBeans source code and the basic
+ docs, you're ready to program. Things you need to know:
+
+ * The org.apache.xmlbeans package has all the public classes
+ for XMLBeans. Programs should not need to call anything
+ else in xbean.jar directly.
+
+ * XmlObject is the base class for all XMLBeans. It
+ corresponds to xs:anyType.
+
+ * Every schema type corresponds to an XMLBean interface,
+ e.g., XmlAnySimpleType corresponds to xs:anySimpleType, and
+ XmlInt corresponds to xs:int, etc.. And of course this
+ extends to the XMLBean classes compiled from user-defined
+ schemas.
+
+ * Every XMLBean interface has an inner Factory class for
+ creating or parsing instances, e.g., to load a file of
+ generic type, use XmlObject.Factory.parse(myfile); to
+ parse a string you expect to be a purcahse-order, use
+ PurchaseOrderDocument.Factory.parse("<ep:purchase-o...");
+
+ * XmlCursor is the API for full XML infoset treewalking.
+ It is obtained via xmlobject.newCursor(). Using it is
+ less convenient, but faster than using XML Objects,
+ because it does not create objects as it traverses
+ the XML tree.
+
+ * SchemaType is the basic "schema reflection" API (just like
+ Class, but for Schema). Get the actual schema type of any
+ instance by saying "xobj.schemaType();" get the static
+ constant schema type corresponding to any XMLBean class
+ by saying "MyPurchaseOrder.type" or "XmlInt.type".
+ (Analogous to "obj.getClass()" and "Object.class".)
+
+ * A number of utility methods are avaliable on
+ org.apache.xmlbeans.XmlBeans, including a function that can be
+ used to determine whether a Java class is an XmlBean and
+ functions to manage runtime-loading of schema type
+ systems.
+
+ With that, you're ready to navigate the javadoc and play
+ with the code. Also, try reading some of our
+ docs that are included in ./docs
+
+(4) Try some of the other utilities; you can also see a few
+ examples of XMLBean techniques in their source code.
+
+ 1. "xpretty instance.xml" pretty-prints an XML instance
+ document.
+
+ The code is in xml.apache.org.tool.PrettyPrinter and is
+ a reasonable example of how to load and save out an
+ arbitrary XML document. XmlOptions are used to produce
+ the pretty-printing.
+
+ 2. "validate instance.xml schema.xsd" will validate the
+ instance against the schema. XMLBeans is intended to
+ be a very accurate XML schema validator.
+
+ The code is in xml.apache.org.tool.InstanceValidator.
+ It is an excellent example of how to load a schema
+ type system dynamically at runtime, load and validate
+ an instance within that type system, and how to obtain
+ lists of and locations for validation errors.
+
+ 3. "xsdtree easypo" will show the inheritance hierarchy
+ of the schema types in that directory.
+
+ The code is in xml.apache.org.tool.TypeHierarchyPrinter
+ and is a good introduction to how to traverse the
+ metadata in a schema type system.
+
+ 4. "dumpxsb xbean.jar" or "dumpxsb myfile.xsb" will dump
+ the contents of "xsb" (binary schema metadata) files
+ in a human-readable form. These .xsb files contain
+ the compiled metadata resulting from the .xsd files
+ of a type system. They are analogous to .class files
+ for .java.
+