remove xmlbeans source

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832256 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2018-05-25 17:29:39 +00:00
parent 8c06c5f51a
commit 70055b806d
1888 changed files with 0 additions and 343561 deletions

View File

@ -1,197 +0,0 @@
Changes in V2.6.4 since V2.6.3
* Remove Piccolo support
* Apply XML Entity Expansion security checks
Changes in V2.6.3 since V2.6.2
* ArrayIndexOutOfBoundsException when writing CDATA (https://issues.apache.org/jira/browse/XMLBEANS-404)
Changes in V2.6.2 since V2.6.1
* Duplicate classes in jar (https://issues.apache.org/jira/browse/XMLBEANS-499)
Changes in V2.6.1 since V2.6.0
* Fix for Unicode Surrogate chars being lost when writing XML (https://bz.apache.org/bugzilla/show_bug.cgi?id=54084 & https://issues.apache.org/jira/browse/XMLBEANS-332)
Changes in V2.6.0 since V2.5.0
* Add new xml option CopyUseNewSynchronizationDomain used for copy.
This fixes the scenario when copy and access (ex. selectPath) are used
in a multithreading environment.
* Entitize \r when not in pretty print, this helps with maintainig \r
entities.
* Fix validation of integer value containing dot char.
* Fix chars in comments to avoid errors in IntelliJ under linux.
* Update durations to latest spec.
* Fix for compiling schema that contains complex type with simple
content that has facets defined in the base simple type
* Fix for Piccolo lexer when read method returns 0.
* Fix to preserve the CDATA bookmarks when copy from one xmlobject to
another.
* Fix bug when resizing circular buffer in saver's output stream
implementation.
* Fix for bug when not specifing type for a particle in derived schema
type and when minOccurs is 0.
* Fixed error messages when contain base and derived type names.
* Introducing a default maximum entity replacement limit of 10kb, it can
be controled by using the option XmlOptions.setLoadEntityBytesLimit.
* Fixed javadoc for inst2xsd and xsd2inst tools.
* Fix NPE in SchemaTypeImpl.getEnumJavaClass().
* Added multiple entry points and refactored code for xsd2inst code.
* Remove org.w3c.dom files from xbean.jar.
* Add another xpath and xquery interface implementation.
* Add src/xmlinputstream classes org.apache.xmlbeans.xml.stream.* to
xmlpublic.jar.
* Make bootstrap run twice to avoid GUMP error emails.
* Fix for bug XMLBEANS-396: GML 3.1.1 generated code fails to compile.
* Fix for bug XMLBEANS-412: Pattern facet regex requires dash - to be
escaped.
* Fix for bug XMLBEANS-414: error cvc-complex-type.2.1: Element 'XXXX'
with empty content type cannot have text or element content.
Changes in V2.5.0 since V2.4.0
* Exit codes for InstanceValidator
* Decimal precision handling fix in xsd2inst
* Option to perform additional, stricter Schema validation checks: XMLBEANS-350
* updated pattern for dayTimeDuration
* Extended year min/max value limitations
* Support for date and time types with hour 24.
* NOTATION built-in type
* DocType fix when root element is changed
* "User types" feature - allows mapping of Schema simple types to custom user Java classes
http://wiki.apache.org/xmlbeans/UserTypes
* Nested enumeration type compilation error fix: XMLBEANS-381
* Deadlock fix in generated impl setter simple and array
* Required attribute fix in streaming validator
* Many other fixes and optimizations
Changes in V2.4.0 since V2.3.0
* Pluggable XPath/XQuery engine support
* Upgraded support for Saxon 9
* Added Schema compilation option to skip errors in case duplicate component declarations are encountered.
* Finer grained support for CDATA
* Tool to generate XPath for a given cursor position in a document
* added more fine-grained control over XML to Java name mapping
* Add support for JVM-supported encodings
* Adding XmlError codes
* Replace static HashMaps with WeakHashMaps
* Fix for XMLBEANS-309 Warnings on Generated code
* Fix for XMLBEANS-361 invalid NaN comparisons
* Fix qname marshaling when empty namespace
* Various other bug fixes
Changes in V2.3.0 since V2.2.0
* Improved Saxon support, Saxon 8.8 became the recommended version
* Added options to control use of CDATA sections when saving to XML
* Added support for QNames in Schema annotations
* Added support for new encodings: UTF-16LE, UTF-16BE, CP936/GBK.
* Fix: overzealous whitespace cropping after parsing entities like & (XMLBEANS-274)
* Fix: selectPath() with setXqueryCurrentNodeVar() option does not work for Saxon (XMLBEANS-276)
* Fix: synchronization problem with array setters
* Fix: Saver$TextSaver.replace method throws java.lang.ArrayIndexOutOfBoundsException (XMLBEANS-209)
* Fix: QNameSet generated by QNameSet.forArray(QName[]) can't be unioned with other QNameSets (XMLBEANS-290)
* Fix: java.lang.ArrayIndexOutOfBoundsException when saving XML (XMLBEANS-291)
* Fix: XQuery gives wrong result with Saxon 8.6.1 (XMLBEANS-275)
* Fix: bug during generation of complex types with simple content
* Fix: improved error handling during loading of Schema type system
* Fix: bugs in Duration serialization
* Fix: XMLCursor.getTextValue()
* Fix: Remove year zero from GDate, GDateBuilder and XmlCalendar per XMLSchema spec D.3.2
Changes in v2.2.0 since v2.1.0:
* Allow polymorphism in Extension Interfaces Feature
* Fix for circular buffer in TextSaver
* Tuned synchronization for multithreaded validation
* Updated to the latest XMLSchema.xsd - January 25, 2006
* Better QName validation
* Fix insertion positions when using substitution groups with arrays
* Updated XmlBeans to work with SaxonB-8.6.1 in place of SaxonB8.1
* Fix for regex validation in multi-threaded, multi-processor environment
* Fix for schema compilation error when restricting complex type with simple content
* Implemented XMLInputStream interface for saving a store
* XQuery external variable binding support
* Various other bug fixes
Changes in v2.1.0 since v2.0.0:
* Fixed the issue whereby some IDEs would have problems with the TypeSystemHolder class being generated in the classes directory
* Better integration with Maven
* Implemented support for ID/IDREF in DTDs via DOM's .getElementByID()
* Integrated a patch that makes XmlBeans work in a sandboxed environment
* Added the ability to control entitization of characters when saving documents
* Fixed issue with memory reclamation in multi-threaded environments, which was delayed too much so it could be mistaken for a memory leak
* Added numerous new test cases and performance tests
* Continued improving performance, especially in the DOM support and XmlCursor areas
* Added column numbers support in our snapshot of Piccolo; validation and XMLSchema error reporting benefit from this and is of course usable from user code
* Line/column number is now also available for end-tags
* Solved a legal inconsistency surrounding our use of JSR173 APIs
* Fixed a lot of reported issues in various areas of the product
Changes in v2.0.0 since v2.0.0-beta1:
* many performance related changes, especialy in the DOM and Cursor areas
* rewrite of the <xs:redefine> support
* Completed the implementation of Filer
* new documentation on xs:any, validation plus updates of the old docs
* many bug fixes, including perm gen memory bug
Changes in v2.0.0-beta1:
* new store implementation, including native DOM implementation
* Piccolo is now the default parser.XmlOptions.setLoadUseXMLReader (XMLReader xmlReader) can be used when a diffrent parser is required.
* Sample xml generation from an schema file
* New failfast behavior for simple types, more consistent
* EntityResolver is setable in SchemaCompiler
* XPath 2.0 and Xquery support through Saxon
* java 1.5 generics for array properties added to generated source
* Simplified working with substitution groups by adding XmlObject.substitute() method
* "-noVDoc" command-line option for scomp to skip validation of <xs:documentation> contents
* uniform access to the getSourceName() method in Schema Object Model
* Cleaned up schema compilation APIs with a XmlBeans.compileXmlBeans()
* Added error codes and improved validation error messages
* Changed .xsb format and loading strategy to improve performance
* Ability to pass URLs instead of Files for Wsdl/Schemas
* Added option to pass in "##local" to -allowmdef
* Inst2xsd: support for xsi:nil and qname fix.
* adding getCurrentElementSchemaType in Validator for finding schema types of elements with xsi:type attribute
* adding ValidatingInfoXMLStreamReader for PSVI access on XMLStreamReaders
* added Location to streaming validation errors
* Instance 2 schema tool
* Support for arbitrarily nesting <xsd:redefine>s
* New "schema bookmark" mechanism allowing one to tag user data on Schema Object Model entities
* Add ability for XmlSaxHandler to insert bookmarks while loading
* Added a diff utility that compares two jars (or directories) containing compiled Schema types
* Interface and pre-post extensions
* Enabled ValidatingXMLStreamReader to start validating from both current and next event in the XMLStreamReader
* Functionality to retrieve xml validation errors programatically
* Added saver options to not save xml decl
* Added ability to compile Schemas containing references to SOAP11 encoded arrays
* selectChildren and selectAttributes for dynamic getters and some wildcard scenarios
* Location in ValidatingXmlStreamReader
* Added a wrapper over jsr173's XMLStreamReader
* Added support for default value in XMLStreamReaderExt interface and implementation
* Adding typed value for QName case in the Validator
* Adding an utility for validation of simple schema types
* Improved the Validator to ofer PSVI info
* Exposed some of the XMLSchema validator functionality in the public interfaces
* Added support for XML Catalog, based on Apache Commons CatalogResolver
* Added XMLStreamReaderExt an extention of XMLStreamReader which alowes getting strongly typed java values from a stream
* Adds support for annotations in XMLSchema
* Added JSR 173 support
* performance tests
* various feature tests
* samples and documentation
* packaging, licencing changes

View File

@ -1,194 +0,0 @@
This file contains the PGP&GPG keys of various Apache developers.
Please don't use them for email unless you have to. Their main
purpose is code signing.
Apache users: pgp < KEYS
Apache developers:
(pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
or
(gpg --fingerprint --list-sigs <your name>
&& gpg --armor --export <your name>) >> this file.
Apache developers: please ensure that your key is also available via the
PGP keyservers (such as pgpkeys.mit.edu).
pub 1024D/4159EADB 2004-04-21 Cliff Schmidt <cliffs@apache.org>
Key fingerprint = 1275 9844 8970 06D9 E4CD FB35 CBA7 46B2 4159 EADB
sig 3 4159EADB 2004-04-21 Cliff Schmidt <cliffs@apache.org>
sub 1024g/1312BCCC 2004-04-21
sig 4159EADB 2004-04-21 Cliff Schmidt <cliffs@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.3 (MingW32)
mQGiBECGsxcRBACoWau6x33CV1aCbiCfFLFJd0N8WLM6Vf3ez98Nu9jzj7yeP50G
oZg/vuu/ncDXCfii8O80LtVF16rWKG3xG40k+pQLytAdj2Gi0zj9vX9hSMY/+PJT
g24WVTWVkzqMP0jPGFZNoK/CC71o328R4NreJp/gPH7SPHxTm+Ogs9+1WwCgoICF
qDvSqFMrvHgoYRsmo03IZFkD/A1Q43sJcuiUkGnrq7VfhhHEIW6lK9pnGI3e72en
sO05HYpPvrpjhew9o/+av1xqb51EEZdbsvX02yWKa0k4tto6F8yh+yr/GdQcVK2t
dZ0OQ/ev05zUo/xbFlYiHuuiNg2ewLHCJNwUd1iqgljQfeC4XmrIB9EZJ9HJ/wAe
6c9iA/9vU7AUGXytShUYcvhKBlUSA6xm7X30lAb0RhiCuhT9T41C8ZBsYpeWdkbS
NdjxiXD1If4ukl0O65WssgS9x7H5iTUY0hRzBktt37GdAGj/bvTrsj8yKdJQLQEh
oAEkA+cyFCfeQuinzUAqUkAWpKIsFTLchpf611wEnASNeb/JUrQhQ2xpZmYgU2No
bWlkdCA8Y2xpZmZzQGFwYWNoZS5vcmc+iF4EExECAB4FAkCGsxcCGwMGCwkIBwMC
AxUCAwMWAgECHgECF4AACgkQy6dGskFZ6tvlHwCfRG+HMKTfkOP7cmtWUWLIdSXy
GhsAnR3oTuY9WvkTH4VmTAl9KnL6Z6GTiEYEExECAAYFAkCGtngACgkQaFp3yu5W
VQ7FTgCfWgsMYa8i+VYKxkX8fxNbdGmlQBcAoLJa1nvtbsFuByx6ZXc0Ew/nMIzV
uQENBECGsxgQBADuVMst3u8Z4dMy/opqS+P4zG/PpCbrvfragICglTyaSqEjnSiZ
G09Ojm5OwzikLLcme9CGnGY4lcxhREmpJDRp7Ga3RfvAKo2VkWPM/nRnoCGzkCbA
lQWuuShhc88oPgyTYzXmuLvhEeqcBD/GgT/Pl6pJNG5VDY95DbUvtgXBowADBQP/
ds6xSj9y9o7jFcgc3laQlhieSxNQmlNw9eUG8X0kxu1rv9sputW8pF42Vom+AnwF
TsEySNx/ndeRXHn4HTtYnl4CFFlsPM2tEyfQIKV2k6Zxi5RG7/sGDHJaEtB0KGDV
Gv3yIc3158eJTAjDaDMvEJEjlB9dgTnD7V2H9ik/RwqISQQYEQIACQUCQIazGAIb
DAAKCRDLp0ayQVnq263NAJ9pTbtt8MlxS3SdsAsO8GYf+xEq4gCeM8qnD/hze4Co
BNHsPbcuKm4vDKQ=
=zpFH
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/2EA8205C 2003/11/13 David Bau (III) <david@bau.to>
Key fingerprint = D1EC 3541 EDC3 740D 2659 0EE6 2D21 6C84 2EA8 205C
sig F88341D9 Lars Eilebrecht <lars@hyperreal.org>
sig 75A67692 Erik Abele <erik@codefaktor.de>
sig EE65E321 Martin Kraemer <martin@apache.org>
sig 88C3A5A5 Philippe M. Chiasson (Canonical) <gozer@cpan.org>
sig CC78C893 Rich Bowen <rbowen@rcbowen.com>
sig 2EA8205C David Bau (III) <david@bau.to>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP Key Server 0.9.6
mQGiBD+z458RBADHgCoHKddKwHPuuBWP0h/Nk7cXoD5qBWXAn7Ps7K1PG0rsE2+c
2PRaNZLyeL23BbCJAq/oGcU+Hc2mzToaxv8WLFqszXZwtjG/wHJ3ug6Klbo2oOWl
XPYYLEOBppuqvbt8fel4SjfcsI0CBVeOs2KCg/htyU1HvbQFBn112PdLwwCg2Fv8
TyLHJnf5VyhVdLVecqWMQ+MD/0x7ckZgoZ2nkHJVxRvsYOQYsi4jj3C55R9QDOzI
aevlvBWbb+bRmevA6hl3irHVxDVsP5KfzDE0dB5zvaBTCSKE1YFevzekRn9P7vRJ
hXjUxjd/tot+BQVZ5hX7ghIHpakIAwI6mCC3MS33gt1/Bb1s4g7yUw16rtmdClZE
XY13BACVSgO9LOg5pBFEopVEwLQLY5IYU04tojuCl7LbNQxLRBFaWM3S/dN0hr3V
wxk3UNdamOJshDq6QMqYSJ8S7wOwFP23YNdMvasGVayKG0EQBflRL3RC/QsvQ1W1
PLNFU5WALBiSsNTpcRwn3VJm6xCSrI93QFzj78IDsIcNSXLQFbQeRGF2aWQgQmF1
IChJSUkpIDxkYXZpZEBiYXUudG8+iJkEEgECAAYFAj/KcwcACgkQPo+38viDQdmL
nwPnYWiW7DBgZ1++NypQd7eckUqaj1NFOYSUxlxhaUQc5BLViQVEkfqNqFPkga26
NdpVbJB6OK2hE4plIqkt442f4hxXtRCf7Vcht8xLcQy75PfqsFRI48lSixaUOvxp
vOVaQW9fDyjzmmxqn4r+P5Kg4gSes6XhNZ0+/or3KNqIRgQSEQIABgUCQBXdagAK
CRAVP6DNdaZ2knA9AKCokQmPF9Y3Cwm4xGcTsQbS7vqpywCdGcXkTBrjGcPA1FSt
hHgt3JDJrs2InAQTAQIABgUCP8d1mQAKCRA34/Rf7mXjIWbRBAC3+u6jEGB0E9K2
6m2ft7hi/RrQ40qeyCinlXqsu/hmEXcMk1zrWw5UUvC3/VRyrsd9L/Tk+kaY/6+C
JJcju1zCDAJ8KoD96+V/CYBty8SFQAajHQnMo7VbNY3BAfZwnj4nGj7XgH2SqCJa
hFJoRHSafXpRLXHadyU+NffWgdw+D4hGBBMRAgAGBQI/umtMAAoJEMsyoQeIw6Wl
s/wAn02w9mkD+vbD8tHjRDVfIjxmy6krAKCOdlmoLtGw4E2jZ82cFNLr4kjrxIhG
BBMRAgAGBQI/uqDgAAoJEFz9N/rMeMiTHnIAoIMy5OTayTDGO83hbqREfyNs5CAF
AKCqZO8d1xWtzO2epkd0f968bos+I4heBBMRAgAeBQI/s+OfAhsDBgsJCAcDAgMV
AgMDFgIBAh4BAheAAAoJEC0hbIQuqCBcrjwAn0hY/JRGtht7aqOODA+6EwKheQT4
AJ0S2EyVs+TR2pB61LgdyvkUVMJrpbkBDQQ/s+OgEAQAvK17K65ZLVg3BuVgl39l
Ha40tQgxX5MLf4j2/ztYRL3ZZzu43C+JCWBNPiO+Eo+j2kWekxnCfXWyU2RC3bI+
ZeG4aMw7nhL9xboXI2Tc6/3kYyFHCOCqqwWJdXthUzbVKTx2+ySIemTME0gpyT3G
acFVusngeoMoo+Tz1s0XGrcAAwUEAJxgRmo0uIMr+Wn9s93oBc1wKVOZ+Wh4Qugi
52bmhB641Vtm8hPJcfEKpQFrMClaedsbMPANpJKHOq+D2QwG5tOKpJ1cQlDzVZ7u
ZDnrsInOIFZHBaiKVwlwTZylfQCpPoQtJGf30u6tLM9bLTU8wrASpwWC64S19yZX
73TyDV56iEkEGBECAAkFAj+z46ACGwwACgkQLSFshC6oIFzqmACeOQ7MmJn79fVh
qGs4bG1L93LlDPQAoIEhnRFsgSzaf6uq3Gb1dKJuIUui
=CkKL
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/65B0150D 2005-02-23 Kevin Krouse <kkrouse@apache.org>
Key fingerprint = 7F2C 0925 C047 10E5 7F8F 1545 FE5A 3279 65B0 150D
sig 3 65B0150D 2005-02-23 Kevin Krouse <kkrouse@apache.org>
sub 1024g/8E15E963 2005-02-23
sig 65B0150D 2005-02-23 Kevin Krouse <kkrouse@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)
mQGiBEIb4QARBACpfmwVKHLZQIB9VCxVLRkdf+UbZEdD+doj18rXtrYTc5gTOGCs
dHcS7XYs7Tr9+NOX+9EZm/6GZDmNGhRRAAUslqCTDxxtABp4AbKZTrDFDi2QCHSw
k2hPESljKXT/+GWr6UFsJWCzy68wPwJ+pxb+ZFGWA+6LE2/1bPmzoVTytwCgwIib
6R8fFMf+OmjRzSmS1rcIx+cD/iI+JCApblPNqVFNlefyfrFugXMCX1z6/UhPsUGH
hZyweF9XeyaKCy7ukdsqUNzJxP3l3A/n37n1Mxjh3vamkBXd5tNF9SeBbITKgTPR
p8THya8LQbDqL1yuKbVqvwaLnxTX+891/QxogSg7u7oGJeTWbNXwxQjxFx1ND3y7
NKSkBACRlXtkh0k3xAy1bl2r/0YL2+sAP3YB9TbqqtRO1Pfy4dcyVn8Hz9b59HWU
AijHWbpgPXz1Kbym04Z952dSVfKtkBh6hmblxiNdMgNSMKlO5Oaov+1LY63KYEUv
eUgfxcFNy/JA8GyXoeh3izZkqC54XYgOAyfMoyevY8dLEEE+bbQhS2V2aW4gS3Jv
dXNlIDxra3JvdXNlQGFwYWNoZS5vcmc+iF4EExECAB4FAkIb4QACGwMGCwkIBwMC
AxUCAwMWAgECHgECF4AACgkQ/loyeWWwFQ2NQACggwJmOmylcszNu2f8y4ASgDeg
Ip4AniBqiSnGnZTJHGuN+zgWWgLNzb3PuQENBEIb4QMQBAD91lo6ba0wJr2tMAe+
ftFFxWgAms53qscYlhoIJR2OnuF+2R+b9q1iYSrWaXXPTVxC7e8U/dbxKEjYLor+
CBsHBavnFqd7HrFk1/FJMCeqHAm+hAUmRmuC9OrJHJqJWxAX0+T1j/8z4qSsCuMQ
Bd2c3IDrSWZRfh1LsL3NKSe7bwADBQP/VCX61WJ9zo0cHWNV4UEJjMALJFyqHE0p
+07P63g8hIcVHrNzI2qlnhPVlqTrX6JWHemUoEbZ9YbCGTw9qJvcJxdq2SoVOIJh
aRjmPbVIXnHII6a2pFqBIpJGny1ZRUMp6l5Xj9iZlii2/JGPB/9hrLuU8q/nQGwq
IuD+IE6nxIOISQQYEQIACQUCQhvhAwIbDAAKCRD+WjJ5ZbAVDfsYAJ4iFexRxVa/
j7lg/9yNMHQAb5kWgACcCdYb4OWys4cLbAcXyNSQ0CD7AQI=
=wadS
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/3926D7DD 2005-06-27 Radu Preotiuc <radup@apache.org>
Key fingerprint = A004 7A3C 02DA 01B5 7974 1890 6899 C8E2 3926 D7DD
sig 3 3926D7DD 2005-06-27 Radu Preotiuc <radup@apache.org>
sig 4159EADB 2005-07-10 Cliff Schmidt <cliffs@apache.org>
sig 46914992 2005-07-13 Cezar Cristian Andrei <cezar@apache.org>
sub 1024g/408A5399 2005-06-27
sig 3926D7DD 2005-06-27 Radu Preotiuc <radup@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.1 (GNU/Linux)
mQGiBELAU70RBACoxk1aD4TCJ/o41BTXGdWCzIESuf1ph2V8jk/cLMBzxAUkl15V
2dQnrf/BUmcBIMx4HfTiNg9nevV+IpClFKZ2lZmAW3nuzc1uK7j7kI8Ba2BlOHLA
Vcg+2vGr2okKrR2tZv24brbXMnnECy9t7OY/O/AqIXE1mOV0/rPd3JayywCgzjCw
UJMFlXQimb/ICUIX0eqZWJ0D/2ozLxhHjfN2A8kIL39crXhYdgHbm6L7OrW5FYST
Yly0f5qDuPRmUubZiI33uglKTCfh5xu/MfKVtAeHjBu9AItWoybR43M8BINlB061
Oef5jrl7hljAyP1YgEhM8gkeTtk0uC4RLH0sjLQUm1DtRU3Bkrzw7GsF3VhE+k2N
AxUSA/wJ+Gc/HkgpIWCyB7KAOZLlOXky5Mcgvygxx8ySn6q+mL9CrlI1qb9cWM5x
gPhRmPiIq8sQMfE/vSbgCjz3QcA6HZ/O7MRZNpse4pwyvDMiPTCQnYe1BK1mcuwx
rToZ2LMUfzz+qUu3Oge5eFZ51eeOGrv/Qef52FS3Ga9Je3TB8bQgUmFkdSBQcmVv
dGl1YyA8cmFkdXBAYXBhY2hlLm9yZz6IWQQTEQIAGQUCQsBTvQQLBwMCAxUCAwMW
AgECHgECF4AACgkQaJnI4jkm193QzwCgxTgw+XpEt43xDjDqEjCg8e9f5PYAoIdk
J2sGim/GtWLFMHfDxBl2K5e7iEYEEBECAAYFAkLRnZcACgkQy6dGskFZ6tvITgCe
JfYK7YGds2qTENfTECUO1eBssm0AnA0YBvDZgamgF01AvIF8HGOwTmq7uQENBELA
U74QBACLhAQWU5vv1O3gK4RonRBo3GmDCtPZNv5fKI20w4Si/nkh5sdmXfX4+ngF
lEsrpS0gr57cqJ6fEvRG9GSg2MyDKkvi3XuUEyMpFVAyOIBSjYZKT/NZMNtf7AAw
P5FUvo664UYYT2D4iBA1vXcerr/ak3pFpdkb1Fqd8H2KuD0NZwADBwP/e00tWaj0
dqH1nN2dePkASlTXethFpkau20zuYsJ+6V52Hyqundj3UfrQUWW7KU+Qv5oAuEys
OJgbSWNwICIzXKZaSC2tlGwQa19410czAUoGfY6qfuIEcjvI2Byinj6aDekxAD66
PUDu5raaGru8YBqtsG2N/JR8myBIiO1V6v+IRgQYEQIABgUCQsBTvgAKCRBomcji
OSbX3RcWAJ9dQxYs8U0xNrG1Ro9tYlNBjENzGACgk5KWLkU/aig/Ze77HCNYTg1M
VIk=
=UTi5
-----END PGP PUBLIC KEY BLOCK-----
pub 1024D/669C4AB5 2006-06-27 Cezar Cristian Andrei <cezar@apache.org>
sig 3 669C4AB5 2006-06-27 Cezar Cristian Andrei <cezar@apache.org>
sub 2048g/B3895278 2006-06-27
sig 669C4AB5 2006-06-27 Cezar Cristian Andrei <cezar@apache.org>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.1 (MingW32)
mQGiBEShFMIRBACP3XKE6an9nGr8OcBZAsMtTxpktCX1Xhbt3n17T9zhxR1gWSFx
nKCPf0VbAvu6TU059Xy1OMtNPYfa4aYE+GC2Gf1Du/2B/bRG4TORHtufubKnL7bx
Pw16DuBx+eyGWCrCfx/AfLKsYpgwsJLFj2972+FEY0XhKcDE2R6DKJQ6AwCgt8rF
8WRDkfsfFvzInGf0oIpBAPsD/jKKstZw8XGNp/net8fXWFoDTRxdMiRBanY6nAln
dQ8+vciRay22xQuSork3Fv2N5PdE7tLc93tAfwOd42ixP5jft2nxfMoAnN0N0Lby
f6I8052Q6P2tnGechSNWILGlUMH5eOeUhFuQRA0ijUD5iArz+4OAfAbIGCzm4uZ3
vn1WA/46hKk07TUzV0/4NL5IpoZsBt5eZkquNCwNU5TijLglMp0DP0Fn2SH9R+0a
9IxDhO8rFXI2yf6SLI90GJYgxSCH1/JH/tWeGjditqqTdUky9Ji70ooviGvPwqa3
0mjTqsJc7UtOUT0fcc2vX/OgWxOyJAqjDTm8MJ5nd8/1/1+tsrQoQ2V6YXIgQ3Jp
c3RpYW4gQW5kcmVpIDxjZXphckBhcGFjaGUub3JnPohZBBMRAgAZBQJEoRTCBAsH
AwIDFQIDAxYCAQIeAQIXgAAKCRB4voXZZpxKtaqKAKCtk1G98B2+0Wk3GWw+2VHz
FtJn2ACfcyrQmNHq/JAm/T+N97/eh/+y0R25Ag0ERKEUyRAIAMbRmykqZ4DAArqa
hIlK7ERu7Q34CdMnPl/+VA3buxq8AnBVw3oCAogm8UB/mx7lQjgBbHPSNwfrQfjq
1uSJrqrmSuyYwkjOmH1C0Gn2rODY6XDTzjcNA9bmO7CeY9ViblpQ2jnlPJtgwYi4
96gz1hHEVayvpEPO+pLIc3mqQrNZWUP04vDrX2MSuTMjpX0wUd+1sq7jsknOjZ6D
No++mAJKgoqMGzWTVy32qqNNMmQf3+hopkqDTo3ngd5IW668yfliCehCSVYXihun
1avPFwcecuHYn3OBeYVAeTUzLaK1QePlbjB0MR/4ugT7ewHmHvNQJJNRNmlPBQPd
Ixj18EsAAwUIAKWK+8joa/S378yldSz4TN22DwJLUs84xawWs3iiYe6dlXyF1+eN
onz4IB/7U2B/x06LLK5bYN87qak16yAP4lxv9Wq/g3nZskjWyVTnQzyphhksWgkP
1CwR4+mGm3ayXbZhtpGiPjb4KJKg7evuimDgHplryV29QmGvmH6zIJkodYF1a/Q5
SVuIdoC9XMy+avxBCgNaxfnUMk+NNihv+qD7hHPk81XiNdYpZbE4zUvIlBhGwJ8f
PRF/b9mla7AYDe5JAm1zux+WXyQ2BZyx6KFT0XaMm69HxUWapSi7COK+Qfu0m8sj
gSDDPNu9F6CiIgFf8XJV4CzDCj1X5GW/5zmIRgQYEQIABgUCRKEUyQAKCRB4voXZ
ZpxKtegFAJ4xHox0haKD6Ln4/2ntqS7p59Ni7gCfY599gXS/U+fQClWsZwnuXC/u
o3s=
=ZMn1
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,202 +0,0 @@
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.

View File

@ -1,29 +0,0 @@
=========================================================================
== NOTICE file corresponding to section 4(d) of the Apache License, ==
== Version 2.0, in this case for the Apache XmlBeans distribution. ==
=========================================================================
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Portions of this software were originally based on the following:
- software copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
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
- 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)
- resolver.jar from Apache Xml Commons project,
Copyright (c) 2001-2003 Apache Software Foundation
- Piccolo XML Parser for Java from http://piccolo.sourceforge.net/,
Copyright 2002 Yuval Oren under the terms of the Apache Software License 2.0
- JSR-173 Streaming API for XML from http://sourceforge.net/projects/xmlpullparser/,
Copyright 2005 BEA under the terms of the Apache Software License 2.0

View File

@ -1,24 +0,0 @@
# xmlbeans
[![Build Status](https://travis-ci.org/pjfanning/xmlbeans.svg?branch=trunk)](https://travis-ci.org/pjfanning/xmlbeans)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pjfanning/xmlbeans/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pjfanning/xmlbeans)
Latest source from ```http://svn.apache.org/repos/asf/xmlbeans/trunk/```. Some changes have been made to get the build working.
The core use case is to help users of Apache Poi, which depends on the no longer maintained Apache XMLBeans library.
* Release 2.6.1 includes a fix for an issue where Unicode Surrogate chars were replaced with `?` chars ?when outputting files - https://bz.apache.org/bugzilla/show_bug.cgi?id=54084
* fixes an issue affecting usage on Android: https://issues.apache.org/jira/browse/XMLBEANS-499
## Sample
https://github.com/pjfanning/poi-xmlbeans-patch-test
## Build
```
./xbeanenv.sh
ant
ant checkintest
```
Output jar is found at ```build/lib/xbean.jar```

View File

@ -1,57 +0,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.
*/
Welcome to XMLBeans!
Layout of the tree:
- README.txt this file
- build.xml ant build file for building XmlBeans code and utilities
- testbuild.xml ant build file for building and running tests
- STATUS essential info about the project
- xbeanenv.cmd sets the XMLBEANS_HOME environment variable on Windows
- xbeanenv.sh sets the XMLBEANS_HOME environment variable on Unix
- bin contains useful command-line scripts for Win and Unix
- docs contains several documentation files
- external contains external jars upon which XmlBeans depends
- samples contains ... samples
- src the source code for XmlBeans, organized by area
- test contains test cases and infrastructure
- xkit contains the README file for the binary distribution
To quickly get started run:
"ant" to build XmlBeans or
"ant usage" to see the most useful build targets or
"cd bin" and then "<tool_name> -help" for a description of what the
tool does and what parameters it accepts
For further information check out:
http://xmlbeans.apache.org
http://wiki.apache.org/xmlbeans
./samples/<sample_name>/README.txt for running samples
./test/docs/* for running tests
XmlBeans depends on the following external libraries:
- jsr173_1.0_api.jar
- jam-0.1.0-src.jar [http://annogen.codehaus.org/JAM] for the extension
feature using plain .java files
- tools.jar (O) from the JDK, dependency of jam-0.1.0-src
- resolver.jar (O) [http://xml.apache.org/commons/components/resolver/]
for apache-commons catalog files that are used in entity resolving
- saxon9.0.0.4j (O) [http://sourceforge.net/projects/saxon/]
for XPath/XQuery in XmlBeans
(O) means that the library is optional
For licensing information, see ./src/license/LICENSE.txt
Updated: 11/25/09.

View File

@ -1,16 +0,0 @@
Project Homepage:
http://xmlbeans.apache.org/
Active committers:
Cezar Andrei cezar at apache dot org
Radu Preotiuc-Pietro radu.preotiuc-pietro at oracle dot com
Jacob Danner jacob dot danner at gmail.com
Wing Yew Poon wing.yew.poon at oracle dot com
FAQ:
http://wiki.apache.org/xmlbeans/XmlBeansFaq

View File

@ -1,32 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
if [ -z "$XMLBEANS_HOME" ]; then
XMLBEANS_HOME=`dirname $0`/..
fi
XMLBEANS_LIB=
if [ -f "$XMLBEANS_HOME"/build/lib/xbean.jar ]; then
XMLBEANS_LIB=$XMLBEANS_HOME/build/lib
fi
if [ -f "$XMLBEANS_HOME"/lib/xbean.jar ]; then
XMLBEANS_LIB=$XMLBEANS_HOME/lib
fi
if [ -z "$XMLBEANS_LIB" ]; then
echo "ERROR: Could not find xbean.jar, try set XMLBEANS_LIB to the directory containing xbean.jar"
fi

View File

@ -1,28 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Common script to set the XMLBEANS_LIB variable
@rem to the directory containing xbean.jar
@echo off
if "%XMLBEANS_HOME%" EQU "" (set XMLBEANS_HOME=%~dp0..)
set XMLBEANS_LIB=
if exist "%XMLBEANS_HOME%\build\lib\xbean.jar" set XMLBEANS_LIB=%XMLBEANS_HOME%\build\lib
if exist "%XMLBEANS_HOME%\lib\xbean.jar" set XMLBEANS_LIB=%XMLBEANS_HOME%\lib
if "%XMLBEANS_LIB%" EQU "" echo "ERROR: Could not find xbean.jar, try setting XMLBEANS_LIB to the directory containing xbean.jar"

View File

@ -1,33 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#XSB file dumper
#Prints the contents of an xsb file in human-readmble form
echo `dirname $0`
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.tool.XsbDumper "$@"

View File

@ -1,30 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem XSB file dumper
@rem
@rem Prints the contents of an xsb file in human-readable form
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar;%XMLBEANS_LIB%\jsr173_1.0_api.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.XsbDumper %*
:done

View File

@ -1,31 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#Instance to Schema tool
#Builds xsd files from xml instance files.
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.inst2xsd.Inst2Xsd "$@"

View File

@ -1,33 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Instance to Schema tool
@rem
@rem Builds xsd files from xml instance files.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
set cp=%cp%;%XMLBEANS_LIB%\resolver.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.inst2xsd.Inst2Xsd %*
:done

View File

@ -1,31 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#Schema compiler
#Builds XBean types from xsd files.
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$JAVA_HOME/lib/tools.jar:$XMLBEANS_LIB/resolver.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -Xmx256m -classpath "$cp" org.apache.xmlbeans.impl.tool.SchemaCompiler "$@"

View File

@ -1,35 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Schema compiler
@rem
@rem Builds XBean types from xsd files.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
set cp=%cp%;%JAVA_HOME%\lib\tools.jar
set cp=%cp%;%XMLBEANS_LIB%\resolver.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.SchemaCompiler %*
:done

View File

@ -1,31 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Schema compiler
@rem
@rem Builds XBean types from xsd files.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar;%XMLBEANS_LIB%\jsr173_1.0_api.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.SchemaCopy %*
:done

View File

@ -1,31 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#Schema downloader
#Tool to download Schema files
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.tool.SchemaResourceManager "$@"

View File

@ -1,34 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Schema downloader
@rem
@rem Tool to download schemas.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
set cp=%cp%;%XMLBEANS_LIB%\resolver.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.SchemaResourceManager %*
:done

View File

@ -1,34 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## Schema Factoring tool
##
## Factors redundant definitions out of a set of schemas and
## uses imports instead.
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$XMLBEANS_LIB/resolver.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -Xmx256m -classpath "$cp" org.apache.xmlbeans.impl.tool.FactorImports "$@"

View File

@ -1,31 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Schema Factoring tool
@rem
@rem Factores redundant definitions out of a set of schemas and uses imports instead.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar;%XMLBEANS_LIB%\jsr173_1.0_api.jar;%XMLBEANS_LIB%\resolver.jar;
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.FactorImports %*
:done

View File

@ -1,32 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#
# Streaming Instance Validator
#
# Validates an instance against a schema.
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$XMLBEANS_LIB/jsr173_1.0_ri.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.tool.StreamInstanceValidator "$@"

View File

@ -1,34 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Streaming Instance Validator
@rem
@rem Validates an instance against a schema.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_ri.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.StreamInstanceValidator %*
:done

View File

@ -1,32 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#
# Instance Validator
#
# Validates an instance against a schema.
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
exec java -classpath "$cp" org.apache.xmlbeans.impl.tool.InstanceValidator "$@"

View File

@ -1,33 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Instance Validator
@rem
@rem Validates an instance against a schema.
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.InstanceValidator %*
:done

View File

@ -1,30 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#Invokes pretty printer
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.tool.PrettyPrinter "$@"

View File

@ -1,27 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@echo off
@rem Invokes pretty printer
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar;%XMLBEANS_LIB%\jsr173_1.0_api.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.PrettyPrinter %*

View File

@ -1,30 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#Schema to instance tool
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator "$@"

View File

@ -1,32 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@rem Schema to instance tool
@rem
@echo off
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator %*
:done

View File

@ -1,30 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
# Invokes type hierarchy printer
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -Xmx256m -classpath "$cp" org.apache.xmlbeans.impl.tool.TypeHierarchyPrinter "$@"

View File

@ -1,27 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@echo off
@rem Invokes type hierarchy printer
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar;%XMLBEANS_LIB%\xmlbeans-qname.jar;%XMLBEANS_LIB%\jsr173_1.0_api.jar;
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.TypeHierarchyPrinter %*

View File

@ -1,30 +0,0 @@
#!/bin/sh
##
## Copyright 2004 The Apache Software Foundation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
# Invokes XSTC
if [ -z "$XMLBEANS_LIB" ]; then . `dirname $0`/_setlib; fi
cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/xmlbeans-qname.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$XMLBEANS_LIB/resolver.jar
case "`uname`" in
CYGWIN*)
cp=`cygpath -w -p $cp`
;;
esac
java -classpath "$cp" org.apache.xmlbeans.impl.tool.XSTCTester "$@"

View File

@ -1,30 +0,0 @@
@REM
@REM Copyright 2004 The Apache Software Foundation
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@echo off
@rem Invokes XSTC
setlocal
if "%XMLBEANS_LIB%" EQU "" call "%~dp0_setlib"
set cp=
set cp=%cp%;%XMLBEANS_LIB%\xbean.jar
set cp=%cp%;%XMLBEANS_LIB%\xmlbeans-qname.jar
set cp=%cp%;%XMLBEANS_LIB%\jsr173_1.0_api.jar
set cp=%cp%;%XMLBEANS_LIB%\resolver.jar
java -classpath "%cp%" org.apache.xmlbeans.impl.tool.XSTCTester %*

File diff suppressed because it is too large Load Diff

View File

@ -1,346 +0,0 @@
<!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 two external libraries not
included in the Ant distribution: one called xbean.jar, one called jsr173_1.0_api.jar.
Both 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>&lt;taskdef name="xmlbean"<br> classname="org.apache.xmlbeans.impl.tool.XMLBean"<br> classpath="path/to/xbean.jar:path/to/jsr173_1.0_api.jar" /&gt;</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>&lt;fileset&gt;</code> (<code>dir</code>
becomes <code>basedir</code>) as well as the nested <code>&lt;include&gt;</code>,
<code>&lt;exclude&gt;</code> and <code>&lt;patternset&gt;</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. &nbsp;Not a path reference. &nbsp;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.&nbsp; 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.&nbsp; 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">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">javasource<br> </td>
<td valign="top">Generate java source compatible with the given
version. Currently only "1.4" and "1.5" are supported. <br> </td>
<td valign="top" align="center">No, Default is "1.4"</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 &gt;= 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=&quot;yes&quot;</code>. Defaults to the compiler
of the Java version that is currently running Ant. Ignored if <code>fork=&quot;no&quot;</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">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">quiet<br> </td>
<td valign="top">Controls the amount of build message output.<br> </td>
<td valign="top" align="center">No, default is false.</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.&nbsp; 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">noupa</td>
<td valign="top">Do not enforce the unique particle attribution rule.<br> </td>
<td align="center" valign="top">No, default is false.</td>
</tr>
<td valign="top">nopvr</td>
<td valign="top">Do not enforce the particle valid (restriction) rule.<br> </td>
<td align="center" valign="top">No, default is false.</td>
</tr>
<tr>
<td valign="top">noann</td>
<td valign="top">Skip over schema &lt;annotation&gt; elements<br> </td>
<td align="center" valign="top">No, default is false.</td>
</tr>
<tr>
<td valign="top">nopvr</td>
<td valign="top">Do not validate the contents of schema &lt;documentation&gt; elements.<br> </td>
<td align="center" valign="top">No, default is false.</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>&lt;taskdef name="xmlbean"<br> classname="org.apache.xmlbeans.impl.tool.XMLBean"<br> classpath="path/to/xbean.jar:path/to/jsr173_1.0_api.jar" /&gt;</pre>
<p>The following builds all the schemas in the schemas directory and creates
a jar called &quot;Schemas.jar&quot;. (Note: both xbean.jar and
jsr173_1.0_api.jar must be on the classpath when the task executes).</p>
</div>
<div>
<pre>
&lt;xmlbean schema="schemas" destfile="Schemas.jar"
classpath="path/to/xbean.jar:path/to/jsr173_1.0_api.jar" /&gt;</pre>
The following compiles the schema &quot;ourSchema.xsd&quot; into the default
jar &quot;xmltypes.jar&quot;. &nbsp;If &nbsp;any imports and includes are defined
by remote URLs, they are downloaded during the build.
<div>
<pre>&lt;xmlbean schema="schemas/ourSchema.xsd" download="true"<br> classpath="path/to/xbean.jar:path/to/jsr173_1.0_api.jar" /&gt;</pre>
</div>
<div>
<h4>Using a fileset</h4>
</div>
<div>
<pre>&lt;xmlbean classgendir="${build.dir}" classpath="${class.path}"<br> failonerror="true"&gt;<br> &lt;fileset basedir="src" excludes="**/*.xsd"/&gt;<br> &lt;fileset basedir="schemas" includes="**/*.*"/&gt;<br>&lt;/xmlbean&gt;</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.&nbsp; The
fileset can also contain JAVA files.&nbsp; The classpath parameter defines
the classpath necessary to resolve compiled schema and java references (and must include xbean.jar and jsr173_1.0_api.jar).<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>

View File

@ -1,531 +0,0 @@
<!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 &#8212; 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>
&lt;po:purchase-order xmlns:po="http://openuri.org/easypo"&gt;
&lt;po:customer&gt;
&lt;po:name&gt;Gladys Kravitz&lt;/po:name&gt;
&lt;po:address&gt;Anytown, PA&lt;/po:address&gt;
&lt;/po:customer&gt;
&lt;po:date&gt;2003-01-07T14:16:00-05:00&lt;/po:date&gt;
&lt;po:line-item&gt;
&lt;po:description&gt;Burnham's Celestial Handbook, Vol 1&lt;/po:description&gt;
&lt;po:per-unit-ounces&gt;5&lt;/po:per-unit-ounces&gt;
&lt;po:price&gt;21.79&lt;/po:price&gt;
&lt;po:quantity&gt;2&lt;/po:quantity&gt;
&lt;/po:line-item&gt;
&lt;po:line-item&gt;
&lt;po:description&gt;Burnham's Celestial Handbook, Vol 2&lt;/po:description&gt;
&lt;po:per-unit-ounces&gt;5&lt;/po:per-unit-ounces&gt;
&lt;po:price&gt;19.89&lt;/po:price&gt;
&lt;po:quantity&gt;2&lt;/po:quantity&gt;
&lt;/po:line-item&gt;
&lt;po:shipper&gt;
&lt;po:name&gt;ZipShip&lt;/po:name&gt;
&lt;po:per-ounce-rate&gt;0.74&lt;/po:per-ounce-rate&gt;
&lt;/po:shipper&gt;
&lt;/po:purchase-order&gt;</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 &quot;shape&quot; &#8212; what its elements are, what
order they appear in, which are children of which, and so on.</p>
</div>
<div>
<pre>
&lt;xs:schema targetNamespace="http://openuri.org/easypo"
xmlns:po="http://openuri.org/easypo"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"&gt;
&lt;xs:element name="purchase-order"&gt;
&lt;xs:complexType&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="customer" type="po:customer"/&gt;
&lt;xs:element name="date" type="xs:dateTime"/&gt;
&lt;xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/&gt;
&lt;xs:element name="shipper" type="po:shipper" minOccurs="0"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;
&lt;xs:complexType name="customer"&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="name" type="xs:string"/&gt;
&lt;xs:element name="address" type="xs:string"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;xs:complexType name="line-item"&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="description" type="xs:string"/&gt;
&lt;xs:element name="per-unit-ounces" type="xs:decimal"/&gt;
&lt;xs:element name="price" type="xs:double"/&gt;
&lt;xs:element name="quantity" type="xs:int"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;xs:complexType name="shipper"&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="name" type="xs:string"/&gt;
&lt;xs:element name="per-ounce-rate" type="xs:decimal"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;/xs:schema&gt;</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 &#8212; 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 &quot;xs&quot;
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 &quot;factory&quot; 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()
{
&nbsp;&nbsp;&nbsp;&nbsp;PurchaseOrderDocument newPODoc = PurchaseOrderDocument.Factory.newInstance();
&nbsp;&nbsp;&nbsp;&nbsp;PurchaseOrder newPO = newPODoc.addNewPurchaseOrder();
&nbsp;&nbsp;&nbsp;&nbsp;Customer newCustomer = newPO.addNewCustomer();
&nbsp;&nbsp;&nbsp;&nbsp;newCustomer.setName(&quot;Doris Kravitz&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;newCustomer.setAddress(&quot;Bellflower, CA&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;return newPODoc;
}
</pre>
<p>The following is the XML that results. Note that XMLBeans assigns the correct
namespace based on the schema, using an &quot;ns1&quot; (or, &quot;namespace
1&quot;) prefix. For practical purposes, the prefix itself doesn't really
matter &#8212; it's the namespace URI (http://openuri.org/easypo) that defines
the namespace. The prefix is merely a marker that represents it.</p>
<pre>&lt;ns1:purchase-order xmlns:ns1=&quot;http://openuri.org/easypo&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;ns1:customer&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ns1:name&gt;Doris Kravitz&lt;/ns1:name&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ns1:address&gt;Bellflower, CA&lt;/ns1:address&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ns1:customer&gt;
&lt;/ns1:purchase-order&gt;
</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 &quot;SQL for XML&quot; 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, &quot;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.&quot; The <span class="langinline">$this</span>
variable means &quot;the current position.&quot;</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>

File diff suppressed because one or more lines are too long

View File

@ -1,229 +0,0 @@
<!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 &quot;meta-API,&quot; 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 &quot;Signatures&quot;</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 &quot;signature&quot; 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 &#8212; 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=&lt;localname&gt;@&lt;targetNamespace&gt;</pre>
</div>
</div>
<p>The &quot;T&quot; is for &quot;type,&quot; of course. &quot;localname&quot;
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 &lt;element&gt; or &lt;attribute&gt; 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=&lt;document-element-name&gt;@&lt;targetNamespace&gt;
R=&lt;attribute-type-name&gt;@&lt;targetNamespace&gt;
</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=&quot;qualified&quot;</span>
(the usual default):</p>
</li>
</ul>
</li>
<blockquote>
<div>
<pre>E=&lt;eltname&gt;|&lt;signature of the type within which the elt is defined&gt;</pre>
</div>
<div>If the element is <span class="langinline" style="langinline">form=&quot;unqualified&quot;</span>:</div>
<div>
<pre>U=&lt;eltname&gt;|&lt;signature of the type within which the elt is defined&gt;</pre>
</div>
<div>If the attribute is <span class="langinline" style="langline">form=&quot;unqualified&quot;</span>
(the usual default):</div>
<div>
<pre>A=&lt;attrname&gt;|&lt;signature of the type within the attr is defined&gt;</pre>
</div>
<div>if the attribute is <span class="langinline" style="langinline">form=&quot;qualified&quot;</span>:</div>
<div>
<pre>Q=&lt;attrname&gt;|&lt;signature of the type within the attr is defined&gt;</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=#|&lt;signature of the containing union type&gt;</pre>
<p>(The # is a number indicating which union member it is, by source order
&#8212; such as 0,1,2, etc.)</p>
<pre>B=|&lt;signature of the containing base type for a restriction&gt;</pre>
<pre>I=|&lt;signature of the containing list type&gt;</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> &lt;root mylist=&quot;432 999 143 123&quot;/&gt;</pre>
</div>
</blockquote>
<div> The schema, if done with lots of nested types, could look something like
this:</div>
<blockquote>
<div>
<pre>
&lt;schema targetNamespace=&quot;myNamespace&quot; elementFormDefault=&quot;qualified&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;element name=&quot;root&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;complexType&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;attribute name=&quot;mylist&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;simpleType&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;list&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;simpleType&gt; &lt;!--This is the type that the signature is for --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;restriction base=&quot;xs:nonNegativeInteger&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;totalDigits value=&quot;3&quot;/&gt;..
</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>&quot;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
&lt;root&gt; documents | in the myNamespace namespace&quot;.</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>

View File

@ -1,471 +0,0 @@
<!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 &#8212;
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>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
&lt;xs:element name="price-quote"&gt;
&lt;xs:complexType&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="stock-symbol" type="xs:string"/&gt;
&lt;xs:element name="stock-price" type="xs:float"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;
&lt;/xs:schema&gt;
</pre>
<p>The following is an example of XML that conforms to this schema.</p>
<pre>&lt;price-quote&gt;
&lt;stock-symbol&gt;BEAS&lt;/stock-symbol&gt;
&lt;stock-price&gt;59.21&lt;/stock-price&gt;
&lt;/price-quote&gt;</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 &quot;document&quot; 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 &quot;Document.&quot; This is because an XML schema has no
way of defining a &quot;root&quot; 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&nbsp;— 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>
&lt;xs:schema targetNamespace=&quot;http://openuri.org/samples/creditReport&quot;
xmlns:cr=&quot;http://openuri.org/samples/creditReport&quot;
xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
elementFormDefault=&quot;qualified&quot;
attributeFormDefault=&quot;unqualified&quot;&gt;
&lt;xs:complexType name=&quot;creditReportType&quot;&gt;
&lt;xs:sequence&gt;
&lt;xs:element name=&quot;bankReport&quot; type=&quot;xs:string&quot;/&gt;
&lt;xs:element name=&quot;taxReport&quot; type=&quot;xs:string&quot;/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;xs:element name=&quot;creditReport&quot; type=&quot;cr:creditReportType&quot;/&gt;
&lt;/xs:schema&gt;</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 &quot;Document&quot; (for
elements) or &quot;Attribute&quot; (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>
&lt;xs:complexType name=&quot;itemType&quot;&gt;
&lt;xs:sequence&gt;
&lt;xs:element name=&quot;name&quot; type=&quot;xs:string&quot;/&gt;
&lt;xs:element name=&quot;amount&quot; type=&quot;xs:int&quot;/&gt;
&lt;xs:element name=&quot;price&quot; type=&quot;xs:double&quot;/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;xs:complexType name=&quot;priceType&quot;&gt;
&lt;xs:sequence&gt;
&lt;xs:element name=&quot;item&quot; type=&quot;ps:itemType&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;xs:element name=&quot;price&quot; type=&quot;ps:priceType&quot;/&gt;
</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(&quot;bicycle&quot;);
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>
&lt;xs:complexType name="person"&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="name" type="xs:string"/&gt;
&lt;xs:element name="gender"&gt;
&lt;xs:simpleType&gt;
&lt;xs:restriction base="xs:NMTOKEN"&gt;
&lt;xs:enumeration value="male"/&gt;
&lt;xs:enumeration value="female"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;/xs:element&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
</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>
&lt;xs:simpleType name=&quot;intOrString&quot;&gt;
&lt;xs:union memberTypes=&quot;xs:int xs:string&quot;&gt;
&lt;/xs:simpleType&gt;
</pre>
<p>Given the preceding schema snippet, you could set the intOrString value
to, say, 6 or &quot;six&quot;. 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(&quot;5&quot;);
// 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>
&lt;xs:element name="number"&gt;
&lt;xs:simpleType&gt;
&lt;xs:restriction base="xs:integer"&gt;
&lt;xs:minInclusive value="1"/&gt;
&lt;xs:maxInclusive value="1000000"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;/xs:element&gt;
</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 &lt;=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 &lt;=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>&lt;xs:complexType name=&quot;priceType&quot;&gt;
&lt;xs:sequence&gt;
&lt;xs:element name=&quot;item&quot; type=&quot;ps:itemType&quot; minOccurs=&quot;0&quot;
maxOccurs=&quot;unbounded&quot;/&gt;
&lt;/xs:sequence&gt;
&lt;xs:attribute name=&quot;threshold&quot;&gt;
&lt;xs:simpleType&gt;
&lt;xs:restriction base=&quot;xs:string&quot;&gt;
&lt;xs:enumeration value=&quot;Below10Dollars&quot;/&gt;
&lt;xs:enumeration value=&quot;Between10And20Dollars&quot;/&gt;
&lt;xs:enumeration value=&quot;Above20Dollars&quot;/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;/xs:attribute&gt;
&lt;/xs:complexType&gt;</pre>
<p>Using types generated from the schema, you would be able to write the following
Java code to &quot;switch&quot; 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() + &quot;\n&quot;);
break;
case PriceType.Threshold.INT_BETWEEN_10_AND_20_DOLLARS:
tenBuffer.append(item.getTitle() + &quot;\n&quot;);
break;
case PriceType.Threshold.INT_ABOVE_20_DOLLARS:
twentyBuffer.append(item.getTitle() + &quot;\n&quot;);
break;
default:
System.out.println(&quot;Yo! Something unexpected happened!&quot;);
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>

View File

@ -1,275 +0,0 @@
<!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 &quot;properties&quot;
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 &quot;customer&quot; element), setId(String) (where you
have an &quot;id&quot; 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
&#8212; 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 &quot;x&quot;. An &quot;x&quot; 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 &quot;x&quot;
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 &quot;x&quot; 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=&quot;1&quot;.
An attribute is singular if it was not declared with use=&quot;prohibited&quot;.</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,
&quot;null&quot; in schema terms), meaning it can be empty. A nil element
looks something like this:</div>
<div>
<pre>&lt;foo/&gt;</pre>
</div>
<div>These methods are only generated when an element type is declared as
nillable in schema &#8212; it has a nillable=&quot;true&quot; 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 &quot;0&quot;; an optional attribute has a <span class="langinline">use</span>
attribute set to &quot;optional&quot;.</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 &quot;unbounded&quot; 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>

View File

@ -1,222 +0,0 @@
<!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&nbsp;attributes, the start and end of elements,
comments, and so on.&nbsp;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&nbsp;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(&quot;item&quot;, &quot;http://openuri.org/&quot;);
// Insert an ID attribute on the item element, along with an attribute value.
cursor.insertAttributeWithValue(&quot;id&quot;, &quot;4056404&quot;);
// Insert "bicycle" as an element value.
cursor.insertChars(&quot;bicycle&quot;);
cursor.dispose();
</pre>
<p>This example results in something like the following:</p>
<pre>&lt;ns1:item id=&quot;4056404&quot; xmlns:ns1=&quot;http://openuri.org/&quot;&gt;bicycle&lt;/ns1:item&gt;
</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 &lt;employee&gt; element, used in the
example below.</p>
<pre>
&lt;employee&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;Gladys Kravitz&lt;/name&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;address location=&quot;home&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;street&gt;1313 Mockingbird Lane&lt;/street&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;city&gt;Seattle&lt;/city&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;state&gt;WA&lt;/state&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;zip&gt;98115&lt;/zip&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/address&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;address location=&quot;work&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;street&gt;2011 152nd Avenue NE&lt;/street&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;city&gt;Redmond&lt;/city&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;state&gt;WA&lt;/state&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;zip&gt;98052&lt;/zip&gt;
&nbsp;&nbsp; &nbsp;&lt;/address&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;phone location=&quot;work&quot;&gt;(425) 555-6897&lt;/phone&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;phone location=&quot;home&quot;&gt;(206) 555-6594&lt;/phone&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;phone location=&quot;mobile&quot;&gt;(206) 555-7894&lt;/phone&gt;
&lt;/employee&gt;
</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 &lt;employee&gt;
cursor.toFirstChild();
// Pushes the cursor's current location onto the stack.
cursor.push();
// Moves the cursor to just before the &quot;work&quot; &lt;phone&gt; element.
cursor.toChild(2);
// Moves the cursor to just before the &quot;home&quot; &lt;phone&gt; element.
cursor.toNextSibling();
// Moves the cursor back to just before &lt;employee&gt;
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>
&#8212; 1, 2, 3 &#8212; calling <span class="langinline">pop</span> three
times would get those locations in reverse order &#8212; 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>

View File

@ -1,340 +0,0 @@
<!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 XPath and XQuery 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 ways to use them. The methods are <span class="langinline">selectPath</span>
for XPath and <span class="langinline">execQuery</span> for XQuery. </p>
<p>You can call them from and <a href="../reference/org/apache/xmlbeans/XmlObject.html"><span class="langinline"> XmlObject</span></a> instance (or a generated type inheriting from it) or an <a href="../reference/org/apache/xmlbeans/XmlCursor.html"><span class="langinline">XmlCursor</span></a> instance.
As noted below, each of the four methods works slightly differently; be sure to keep these differences in mind when choosing your approach.</p>
<p class="notepara"><strong>Note:</strong> Both XQuery and complex XPath expressions require additional classes on the class path, as noted in the sections that follow. Also, be sure to see the XMLBeans <a href="../../../documentation/conInstallGuide.html">installation instructions</a>. </p>
<h2><a name="xpath_selectpath"></a>Using XPath with the selectPath Method</h2>
</div>
<div>
<p>You can execute XPath expressions use the <span class="langinline">selectPath</span> method. When you use XPath with the <span class="langinline">selectPath</span>
method, the value returned is view of values from the <em>current document</em> &#8212; not a copy of those values. In other words, changes your code makes to XML returned by the selectPath method change the XML in the document queried against. In contrast, with XQuery executed using the <span class="langinline">execQuery</span> method, the value returned is a <em>copy of values in the XML queried against</em>.</p>
<p> Note that XPath itself does not provide syntax for declaring prefix to URI bindings. For user convenience, we allow XQuery syntax to be used for such purposes. You can consult the latest XQuery draft when using syntax for declaring namespaces.</p>
<blockquote>
<p><strong>Note:</strong> By default, XMLBeans supports only very simple XPath expressions. To execute complex expressions &#8212; such as those with predicates, function calls, and the like &#8212; you will need xbean_xpath.jar and the Saxon jars (see <a href="#saxon_jars">below</a>) on your class path. xbean_xpath.jar is among those created when you build XMLBeans from source. You may need to download the Saxon jars yourself.</p>
</blockquote>
<h3>Calling XmlObject.selectPath</h3>
<p>When called from <span class="langinline">XmlObject</span> (or a type that
inherits from it), the <code>selectPath</code> 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, and you can cast it accordingly. </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>
&lt;xq:employees xmlns:xq=&quot;http://xmlbeans.apache.org/samples/xquery/employees&quot;&gt;
&lt;xq:employee&gt;
&lt;xq:name&gt;Fred Jones&lt;/xq:name&gt;
&lt;xq:address location=&quot;home&quot;&gt;
&lt;xq:street&gt;900 Aurora Ave.&lt;/xq:street&gt;
&lt;xq:city&gt;Seattle&lt;/xq:city&gt;
&lt;xq:state&gt;WA&lt;/xq:state&gt;
&lt;xq:zip&gt;98115&lt;/xq:zip&gt;
&lt;/xq:address&gt;
&lt;xq:address location=&quot;work&quot;&gt;
&lt;xq:street&gt;2011 152nd Avenue NE&lt;/xq:street&gt;
&lt;xq:city&gt;Redmond&lt;/xq:city&gt;
&lt;xq:state&gt;WA&lt;/xq:state&gt;
&lt;xq:zip&gt;98052&lt;/xq:zip&gt;
&lt;/xq:address&gt;
&lt;xq:phone location=&quot;work&quot;&gt;(425)555-5665&lt;/xq:phone&gt;
&lt;xq:phone location=&quot;home&quot;&gt;(206)555-5555&lt;/xq:phone&gt;
&lt;xq:phone location=&quot;mobile&quot;&gt;(206)555-4321&lt;/xq:phone&gt;
&lt;/xq:employee&gt;
&lt;/xq:employees&gt;
</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 =
&quot;declare namespace xq='http://xmlbeans.apache.org/samples/xquery/employees';&quot; +
&quot;$this/xq:employees/xq:employee/xq:phone[contains(., '(206)')]&quot;;
</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 XmlCursor.selectPath</h3>
<p>When called from an <span class="langinline">XmlCursor</span> instance, the
<span class="langinline">selectPath</span> method retrieves a list of <em>selections</em>,
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 cursor instance from which you called <code>selectPath</code> 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 &quot;selection&quot;-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 =
&quot;declare namespace xq='http://xmlbeans.apache.org/samples/xquery/employees';&quot;;
// 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 + &quot;$this//xq:zip&quot;);
// 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 + &quot;$this//xq:phone[@location='work']&quot;);
// Move the cursor to the first selection, then 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 &#8212; 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 &quot;live&quot;. 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><a name="xquery_execquery"></a>Using XQuery with the execQuery Method</h2>
<p>You use the <span class="langinline">execQuery</span> method to execute XQuery
expressions. With XQuery expressions, XML returned is a copy of XML in the document queried against. In other words, changes your code makes to the values returned by <code>execQuery</code> are not reflected in the document queried against.</p>
<blockquote>
<p><a name="saxon_jars"></a><strong>Note:</strong> To execute XQuery expressions, you must have the SaxonB 8.6.1 versions of the saxon8.jar and saxon8-dom.jar files on your classpath. These are two of the jars from inside the zip file saxonb8-6-1.zip
which can be downloaded from the <a href="http://sourceforge.net/project/showfiles.php?group_id=29872&package_id=21888">Saxon web site</a>.
If you build XMLBeans from source then the saxonb8-6-1.zip file and the two Saxon jar files are available in the external/lib directory.</p>
</blockquote>
<h3>Calling XmlObject.execQuery</h3>
<p>As with <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.</p>
<p> The following example retrieves work <code>&lt;zip&gt;</code> elements from the incoming XML, adding the elements as children to a new <code>&lt;zip-list&gt;</code> element.</p>
<pre>public boolean collectZips(XmlObject empDoc)
{
String namespaceDeclaration =
"declare namespace xq='http://xmlbeans.apache.org/samples/xquery/employees';";
// The query is designed to return results, so return
// true if it does.
boolean hasResults = false;
// The expression: Get the &lt;zip> elements and return them as children
// of a new &lt;zip-list> element.
String queryExpression =
"let $e := $this/xq:employees " +
"return " +
"&lt;zip-list> " +
"{for $z in $e/xq:employee/xq:address/xq:zip " +
"return $z} " +
"&lt;/zip-list>";
// Execute the query. Results will be copies of the XML queried against,
// stored as members of an XmlObject array.
XmlObject[] results =
empDoc.execQuery(namespaceDeclaration + queryExpression);
// Print the results.
if (results.length > 0)
{
hasResults = true;
System.out.println("The query results: \n");
System.out.println(results[0].toString() + "\n");
}
return hasResults;
}</pre>
<h3>Calling XmlCursor.execQuery</h3>
</div>
<div>
<p>Unlike the <code>selectPath</code> method called from a cursor, the <span class="langinline">execQuery</span> method doesn't return <code>void</code>. Instead it returns an <span class="langinline">XmlCursor</span> instance positioned at the beginning of a new XML document representing
the query results. Rather than accessing results as selections, you use the cursor to move through the results in typical cursor fashion (for more information, see <a href="conNavigatingXMLwithCursors.html">Navigating
XML with Cursors</a>). The models are very different.</p>
<p>As always, you can cast the results to a type generated from schema if you know that the results conform to that type.</p>
<p>The following example retrieves work <code>&lt;phone&gt;</code> elements from the incoming XML, then changes the number in the results.</p>
<pre>public boolean updateWorkPhone(XmlObject empDoc)
{
boolean hasResults = false;
// A cursor instance to query with.
XmlCursor empCursor = empDoc.newCursor();
empCursor.toNextToken();
// The expression: Get the <employee> elements with <state> elements whose
// value is "WA".
String queryExpression =
"for $e in $this/xq:employees/xq:employee " +
"let $s := $e/xq:address/xq:state " +
"where $s = 'WA' " +
"return $e//xq:phone[@location='work']";
// Execute the query. Results, if any, will be available at
// the position of the resultCursor in a new XML document.
XmlCursor resultCursor =
empCursor.execQuery(namespaceDeclaration + queryExpression);
System.out.println("The query results, element copies made " +
"from the received document: \n");
System.out.println(resultCursor.getObject().toString() + "\n");
// If there are results, the results will be children of the fragment root
// where the new cursor is positioned. This statement tests for children
// and moves the cursor if to the first if it exists.
if (resultCursor.toFirstChild())
{
hasResults = true;
// Use the cursor to loop through the results, printing each sibling
// <employee>element returned by the query.
int i = 0;
do
{
// Change the phone numbers.
XmlCursor editCursor = resultCursor.newCursor();
editCursor.toLastAttribute();
editCursor.toNextToken();
editCursor.removeXml();
editCursor.insertChars("(206)555-1234");
} while (resultCursor.toNextSibling());
resultCursor.toStartDoc();
System.out.println("The query results after changes: \n");
System.out.println(resultCursor.getObject().toString() + "\n");
System.out.println("The received document -- note that it is unchanged. " +
"Changes were made to the copy created by the execQuery method. \n");
System.out.println(empDoc + "\n");
}
return hasResults;
}</pre>
<h2>Related Topics</h2>
</div>
<p><a href="conGettingStartedwithXMLBeans.html">Getting Started with XMLBeans</a></p>
<!-- InstanceEndEditable -->
<script language="JavaScript">
</script>
</body>
</html>

View File

@ -1,189 +0,0 @@
<!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>&nbsp;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">&lt;/batchWidgetOrder&gt;</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>

View File

@ -1,97 +0,0 @@
<!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>

File diff suppressed because one or more lines are too long

View File

@ -1,343 +0,0 @@
<!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>
interfaces 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>

View File

@ -1,542 +0,0 @@
<!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>
XMLBeans Tools
</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">
<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 Tools </h1>
<p> XMLBeans includes several command-line tools you might find handy as shortcuts
for common tasks. You'll find these tools in the bin directory of the XMLBeans
installation or source tree.</p>
<dl>
<dt> <a href="#dumpxsb">dumpxsb (XSB File Dumper)</a> </dt>
<dd> Prints the contents of an XSB file in human-readable form. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#inst2xsd">inst2xsd (Instance to Schema Tool)</a> </dt>
<dd> Generates XML schema from XML instance files. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#scomp">scomp (Schema Compiler)</a> </dt>
<dd> Compiles a schema into XMLBeans classes and metadata. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#scopy">scopy (Schema Copier)</a> </dt>
<dd> Copies the XML schema at the specified URL to the specified file. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#sdownload">sdownload (Schema Downloader)</a> </dt>
<dd> Maintains &quot;xsdownload.xml,&quot; an index of locally downloaded XSD
files. URLs that are specified are downloaded if they aren't already cached.
If no files or URLs are specified, all indexed files are relevant. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#sfactor">sfactor (Schema Factoring Tool)</a> </dt>
<dd> Factors redundant definitions out of a set of schemas and uses imports
instead. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#svalidate">svalidate (Streaming Instance Validator)</a> </dt>
<dd> Validates a schema definition and instances within the schema. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#validate">validate (Instance Validator)</a> </dt>
<dd> Validates an instance against a schema. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#xpretty">xpretty (XML Pretty Printer)</a> </dt>
<dd> Pretty prints the specified XML to the console. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#xsd2inst">xsd2inst (Schema to Instance Tool)</a> </dt>
<dd> Prints an XML instance from the specified global element using the specified
schema. </dd>
<dt>&nbsp; </dt>
<dt> <a href="#xsdtree">xsdtree (Schema Type Hierarchy Printer)</a> </dt>
<dd> Prints an inheritance hierarchy of the types defined in a schema. </dd>
<dt>&nbsp; </dt>
<dt> <a href="antXmlbean.html">xmlbean Ant task</a> </dt>
<dd> Compiles a set of XSD and/or WSDL files into XMLBeans types. </dd>
</dl>
<h2> <a name="dumpxsb"></a>dumpxsb (XSB File Dumper) </h2>
<p> Prints the contents of an XSB file in human-readable form. An XSB file contains
schema meta information needed to perform tasks such as binding and validation.
&quot;XSB&quot; stands for XML Schema Binary.</p>
<h3> Syntax </h3>
<pre><strong>dumpxsb </strong><em>myfile.xsb</em></pre>
<h4> Options </h4>
<dl>
<dt> <em>myfile.xsb</em> </dt>
<dd> The name of an XSB file. </dd>
</dl>
<h3> Example </h3>
<p> The following command and output example use an XSB file generated by compiling
the schema (in EasyPo.xsd) that accompanies the SubstitutionGroup sample. </p>
<pre>dumpxsb PurchaseOrderDocument.xsb</pre>
<p> Output: </p>
<pre>PurchaseOrderDocument.xsb
Magic cookie: da7ababe
Major version: 2
Minor version: 22
Release number: 0
Filetype: FILETYPE_SCHEMAPOINTER
String pool (2):
1 = &quot;schema.system.s633ECC92E6CC0ACA137B11B7B38CA3A8&quot;
Type system: schema.system.s633ECC92E6CC0ACA137B11B7B38CA3A8</pre>
<h2> <a name="inst2xsd"></a>inst2xsd (Instance to Schema Tool) </h2>
<p> Generates XML schema from XML instance files. </p>
<h3> Syntax </h3>
<pre><strong>inst2xsd </strong>[<em>options</em>] <em>instance.xml</em>*</pre>
<h4> Options </h4>
<dl>
<dt> <strong>-design </strong>[<strong>rd </strong>|<strong> ss </strong>|<strong>
vb</strong>] </dt>
<dd> The XML schema design type to use for the generated schema. </dd>
<dd> <strong>rd</strong> &#8212; Use russian doll design; local elements and
local types. </dd>
<dd> <strong>ss</strong> &#8212; Use salami slice design; global elements and
local types. </dd>
<dd> <strong>vb</strong> (default) &#8212; Use venetian blind design; local
elements and global complex types. </dd>
</dl>
<dt> <strong>-simple-content-types</strong> [<strong>smart</strong> | <strong>string</strong>]
</dt>
<dd> The manner for detecting content types (leaf text) </dd>
<dd> <strong>smart</strong> (default) &#8212; Use a likely type, such as xs:byte
for a value of &quot;123&quot;. </dd>
<dd> <strong>string</strong> &#8212; Use xs:string as the type. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-enumerations</strong> [<strong>never</strong> | <em>number</em>]
</dt>
<dd> Whether to use enumerations. </dd>
<dd> <strong>never</strong> &#8212; Never use enumerations. </dd>
<dd> <em>number</em> (default: 10) &#8212; Use <em>number</em> as the threshold
for enumerations. Specifying &quot;2&quot; will create enumerations for elements
with no more than two different values. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-outDir</strong> [<em>dir</em>] </dt>
<dd> The directory for output files. </dd>
<dd> <em>dir</em> &#8212; Directory path. Default is '.' (the current directory).
</dd>
<dt>&nbsp; </dt>
<dt> <strong>-outPrefix</strong> [<em>file_name_prefix</em>] </dt>
<dd> The prefix for output file names. </dd>
<dd> <em>file_name_prefix</em> &#8212; Prefix to use. Default is &quot;schema&quot;.
</dd>
<dt>&nbsp; </dt>
<dt> <strong>-validate</strong> </dt>
<dd> Validate input instances against generated schemas. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-verbose</strong> </dt>
<dd> Print more informational messages. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-help</strong> </dt>
<dd> Print help information. </dd>
<h3> Example </h3>
<p> The following example generates schema0.xsd from Purchase-Order.xml, with
salami slice schema design, simple content types detected where possible, and
enumerations limited to elements with four different values. </p>
<pre>inst2xsd -design ss -simple-content-types smart -enumerations 4 Purchase-Order.xml</pre>
<h2> <a name="scomp"></a>scomp (Schema Compiler) </h2>
<p> Compiles schema into Java XMLBeans classes and metadata. Schema-related work
with XMLBeans begins by compiling schema to generated Java types. You can use
scomp to compile schema from the command line. XMLBeans also provides an Ant
task, <a href="antXmlbean.html">xmlbeans</a>, which you can use to compile schemas.
For run-time schema compilation that doesn't generate files, see the org.apache.xmlbeans.XmlBeans.compileXsd
methods.</p>
<p>For more information about the types resulting from compiling schema, see <a href="conJavaTypesGeneratedFromUserDerived.html">Java
Types Generated from User-Derived Schema Types</a>, <a href="conXMLBeansSupportBuiltInSchemaTypes.html">XMLBeans
Support for Built-In Schema Types</a>, and <a href="conMethodsForGeneratedJavaTypes.html">Methods
for Types Generated From Schema</a>. </p>
<p>For more information on getting started with XMLBeans, see <a href="conGettingStartedwithXMLBeans.html">Getting
Started with XMLBeans</a>.</p>
<h3> Syntax </h3>
<pre><strong>scomp</strong> [<em>options</em>] [<em>dirs</em>]* [<em>schemaFile.xsd</em>]* [<em>service.wsdl</em>]* [<em>config.xsdconfig</em>]*</pre>
<h4> Options </h4>
<dl>
<dt> <strong>-cp</strong> [<em>pathA;pathB;pathC</em>] </dt>
<dd> Classpath specifying classes to include during compilation. </dd>
<dd> <em>pathA;pathB;pathC</em> &#8212; Class search path of directories and
JAR files. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-d</strong> [<em>dir</em>] </dt>
<dd> Target directory for CLASS and XSB files. </dd>
<dd> <em>dir</em> &#8212; The directory path. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-src</strong> [<em>dir</em>] </dt>
<dd> Target directory for generated JAVA files. </dd>
<dd> <em>dir</em> &#8212; The directory path. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-srconly</strong> </dt>
<dd> Do not compile JAVA files or jar the output. </dd>
<dt>&nbsp; </dt>
<dd> Note that XSB files are needed in order for CLASS files compiled from the
sources to be useful as XMLBeans classes. To get <em>only JAVA files</em>,
use -src to specify a directory for the JAVA files. To get <em>JAVA and XSB
files in the same directory</em>, use -d to specify a directory that will
include both. To get <em>JAVA and XSB files in separate directories</em>,
use -src for the JAVA file destination and -d for the XSB file destination.
</dd>
<dt>&nbsp; </dt>
<dt> <strong>-out</strong> [<em>jarFileName</em>] </dt>
<dd> The name of the output JAR that will contain the result of compilation.
The default is &quot;xmltypes.jar&quot;. </dd>
<dd> <em>jarFileName</em> &#8212; The name for the JAR containing generated
files. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-dl</strong> </dt>
<dd> Permit network downloads for imports and includes (this permission is off
by default). </dd>
<dt>&nbsp; </dt>
<dt> <strong>-noupa</strong> </dt>
<dd> Do not enforce the unique particle attribution rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-nopvr</strong> </dt>
<dd> Do not enforce the particle valid (restriction) rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-noann</strong> </dt>
<dd> Ignore annotations. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-novdoc</strong> </dt>
<dd> Do not validate contents of &lt;documentation&gt; elements. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-compiler</strong> </dt>
<dd> Path to external Java compiler. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-javasource</strong> [<em>version</em>] </dt>
<dd> Generate Java source compatible for the specified Java version (1.4 or
1.5). </dd>
<dt>&nbsp; </dt>
<dt> <strong>-ms</strong> </dt>
<dd> Initial memory for external Java compiler; the default is &quot;8m&quot;.
</dd>
<dt>&nbsp; </dt>
<dt> <strong>-mx</strong> </dt>
<dd> Maximum memory for external Java compiler; the default is &quot;256m&quot;.
</dd>
<dt>&nbsp; </dt>
<dt> <strong>-debug</strong> </dt>
<dd> Compile with debug symbols. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-quiet</strong> </dt>
<dd> Print fewer informational messages. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-verbose</strong> </dt>
<dd> Print more informational messages. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-version</strong> </dt>
<dd> Print version information. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-allowmdef</strong> &quot;[<em>namespace</em>] [<em>namespace</em>]
[<em>namespace</em>]&quot; </dt>
<dd> Ignore multiple defs in given namespaces. Use <code> ##local </code> to
specify the no-namespace in that list. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-catalog</strong> [<em>fileName</em>] </dt>
<dd> Catalog file to use for resolving external entities. With this option,
scomp uses <code> org.apache.xml.resolver.tools.CatalogResolver </code> for
resolving. Note that to use this option, your classpath must include resolver.jar
from http://xml.apache.org/commons/components/resolver/index.html). Copy resolver.jar
to the XMLBEANS_HOME/lib directory, so that the script can pick it up from
there. You can use the <a href="#sdownload">sdownload</a> tool to ensure that
required schemas are present for compilation. </dd>
<dd> <em>fileName &#8212; </em>A path to the catalog file. </dd>
<dt>&nbsp; </dt>
<dt> <em>dirs</em> </dt>
<dd> Directories containing XSD (and possibly XSDCONFIG) files that should be
compiled. </dd>
<dt>&nbsp; </dt>
<dt> <em>schemaFile.xsd</em> </dt>
<dd> The names of XSD files that should be compiled. </dd>
<dt>&nbsp; </dt>
<dt> <em>service.wsdl</em> </dt>
<dd> A WSDL file for which types should be generated. </dd>
<dt>&nbsp; </dt>
<dt> <em>config.xsdconfig</em> </dt>
<dd> The name of an XSDCONFIG file. Use an XSDCONFIG file to guide the naming
of generated classes and packages. Without an XSDCONFIG file, scomp uses the
schema's type names and URI for classes and packages. </dd>
</dl>
<h3> Example </h3>
<p> In the following example, scomp compiles EasyPO.xsd, guiding type naming with
po.xsdconfig. scomp puts generated CLASS and XSB files into a classes directory
one level up, and JAVA source files into a src directory one level up. Source
files will be compatible with Java version 1.5. </p>
<pre>scomp -d ..\classes -src ..\src -javasource 1.5 EasyPO.xsd po.xsdconfig</pre>
<p> Here, scomp compiles all of the contents of the schemas directory and puts
the generated files into poschema.jar one level up. </p>
<pre>scomp -out ..\poschema.jar schemas</pre>
<p> The following example generates JAVA source and XSB files from the schema
in EasyPO.xsd. No CLASS files are generated, and the JAVA and XSB files are
put into src and xsb directories, respectively. </p>
<pre>scomp -srconly -src ..\src -d ..\xsb EasyPO.xsd</pre>
<p> When the schema features imports or includes and you want to use a catalog,
you can tell scomp to use the default catalog resolver (<code>org.apache.xml.resolver.tools.CatalogResolver</code>);
you specify a catalog file with the -catalog option, as in the example below.
(Note that this requires resolver.jar, as noted above for the -catalog option.)
In this example, scomp compiles schemaThatUsesRequiredSchema.xsd into myschemas.jar,
resolving imports from requiredSchema.xsd through xsdownload.xml. The <a href="#sdownload">sdownload</a>
tool is executed first &#8212; this ensures that requiredSchema.xsd is present
for compilation, but does not actually download requiredSchema.xsd unless the
URL at which it's found isn't already cached. This is more efficient than using
scomp's -dl option, which attempts to download every time.</p>
<pre>sdownload "http://some.org/requiredSchema.xsd"
scomp -out ..\myschemas.jar -catalog xsdownload.xml schemaThatUsesRequiredSchema.xsd</pre>
<p> When a schema features multiple element declarations of the same qname, such
as multiple &lt;xs:any&gt; particles, you might want to disable to &quot;unique
particle validation&quot; rule, which would ordinarily invalidate the schema.
To do this, use the -noupa option, as in the following example. </p>
<pre>scomp -out ..\myschemas.jar -noupa schemas</pre>
<h2> <a name="scopy"></a>scopy (Schema Copier) </h2>
<p> Copies the XML schema at the specified URL to the specified file. </p>
<h3> Syntax </h3>
<pre><strong>schemacopy</strong> <em>sourceurl</em> [<em>targetfile</em>]</pre>
<h4> Options </h4>
<dl>
<dt> <strong>sourceurl</strong> </dt>
<dd> The URL at which the schema is located. </dd>
<dt>&nbsp; </dt>
<dt> <em>targetfile</em> </dt>
<dd> The file to which the schema should be copied. </dd>
</dl>
<h2> <a name="sdownload"></a>sdownload (Schema Downloader) </h2>
<p> Maintains &quot;xsdownload.xml,&quot; an index of locally downloaded XSD files.
URLs that are specified are downloaded if they aren't already cached. If no
files or URLs are specified, all indexed files are relevant. </p>
<p> You can use this tool when using <a href="#scomp">scomp</a>, in conjunction
with scomp's -catalog option, to ensure the presence of schemas that are required
for compilation because they're imported or included. This is an alternative
to using scomp's -dl option, which would hit the Internet on every invocation
of scomp. When you use sdownload with -catalog, the download occurs only if
the URL is not already cached. See the scomp section for an example.</p>
<h3> Syntax </h3>
<pre><strong>sdownload</strong> [<strong>-dir</strong> <em>directory</em>] [<strong>-refresh</strong>] [<strong>-recurse</strong>] [<strong>-sync</strong>] [<em>url/file</em>]</pre>
<h4> Options </h4>
<dl>
<dt> <strong>-dir </strong><em>directory</em> </dt>
<dd> The directory for the xsdownload.xml file (the default is &quot;.&quot;).
</dd>
<dd> <em>directory</em> &#8212; The directory path. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-sync</strong> </dt>
<dd> Synchronize the index to any local XSD files in the tree. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-recurse</strong> </dt>
<dd> Recursively download imported and included XSD files. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-refresh</strong> </dt>
<dd> Re-download all indexed XSD files. </dd>
</dl>
<h2> <a name="sfactor"></a>sfactor (Schema Factoring Tool) </h2>
<p> Factors redundant definitions out of a set of schemas and uses imports instead.
</p>
<h3> Syntax </h3>
<pre><strong>sfactor</strong> [<strong>-import</strong> <em>common.xsd</em>] [<strong>-out</strong> <em>outputdir</em>] <em>inputdir [-license]</em></pre>
<h4> Options </h4>
<dl>
<dt> <strong>-import</strong> </dt>
<dd> The XSD file to contain redundant definitions for importing. </dd>
<dd> <em>common.xsd</em> &#8212; A path to the file. </dd>
<dt> <strong>-out</strong> <em>outputdir</em> </dt>
<dd> The directory into which to place XSD files resulting from refactoring,
plus a commonly imported common.xsd. </dd>
<dt> inputdir </dt>
<dd> The directory containing the XSD files with redundant definitions. </dd>
<dt> -license </dt>
<dd> Print license information. </dd>
</dl>
<h2> <a name="svalidate"></a>svalidate (Streaming Instance Validator) </h2>
<p> Validates the specified instance against the specified schema. Unlike the
<a href="#validate">validate</a> tool, svalidate uses a streaming model through
which you can validate much larger instances with less memory (if the schema
permits it).</p>
<h3> Syntax </h3>
<pre><strong>svalidate</strong> [<em>options</em>] <em>schema.xsd</em> <em>instance.xml</em></pre>
<h4> Options </h4>
<dl>
<dt> <strong>-dl</strong> </dt>
<dd> Enable network downloads for imports and includes. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-nopvr</strong> </dt>
<dd> Disable particle valid (restriction) rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-noupa</strong> </dt>
<dd> Disable unique particle attribution rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
<dt>&nbsp; </dt>
<dt> <em>schema.xsd</em> </dt>
<dd> The schema against which to validate. </dd>
<dt>&nbsp; </dt>
<dt> <em>instance.xm</em>l </dt>
<dd> The instance to validate. </dd>
</dl>
<h2> <a name="validate" id="validate"></a>validate (Instance Validator) </h2>
<p> Validates a the specified instance against the specified schema. Compare this
tool with the <a href="#svalidate">svalidate</a> tool, which is useful for validating
very large documents. </p>
<h3> Syntax </h3>
<pre><strong>validate</strong> [<em>options</em>] <em>schema.xsd</em> <em>instance.xml</em></pre>
<h4> Options </h4>
<dl>
<dt> <strong>-dl</strong> </dt>
<dd> Enable network downloads for imports and includes. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-nopvr</strong> </dt>
<dd> Disable particle valid (restriction) rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-noupa</strong> </dt>
<dd> Disable unique particle attribution rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
<dt>&nbsp; </dt>
<dt> <em>schema.xsd</em> </dt>
<dd> The schema against which to validate. </dd>
<dt>&nbsp; </dt>
<dt> <em>instance.xml</em> </dt>
<dd> The instance to validate. </dd>
</dl>
<h3> Example </h3>
<p> The following simple example validates PurchaseOrder.xml against EasyPO.xsd.
</p>
<pre>validate ..\schemas\EasyPO.xsd PurchaseOrder.xml</pre>
<p> In this example, MySchema imports types from another schema and also includes
multiple particles defined as &lt;xsd:any&gt; types. The validate command here
locates the external schemas for importing (providing there is network access
to the schemas) and ignores the validation rule whereby multiple particles of
the same qname render the schema invalid. </p>
<pre>validate -dl -noupa ..\schemas\MySchema.xsd AnInstance.xml</pre>
<h2> <a name="xpretty"></a>xpretty (XML Pretty Printer) </h2>
<p> Pretty prints the specified XML to the console. </p>
<h3> Syntax </h3>
<pre><strong>xpretty</strong> [<em>options</em>] <em>file.xml</em></pre>
<h4> Options </h4>
<dl>
<dt> <strong>-indent</strong> <em>numberOfSpaces</em> </dt>
<dd> Indent the specified number of spaces. </dd>
<dd> <em>numberOfSpaces</em> &#8212; The number of spaces to indent. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
</dl>
<h2> <a name="xsd2inst"></a>xsd2inst (Schema to Instance Tool) </h2>
<p> Prints an XML instance from the specified global element using the specified
schema. </p>
<h3> Syntax </h3>
<pre><strong>xsd2inst</strong> <em>schemafile.xsd</em> <strong>-name</strong> <em>globalElementName</em></pre>
<h4> Options </h4>
<dl>
<dt> <em>schemafile.xsd</em> </dt>
<dd> The schema file defining the element to print. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-name</strong> </dt>
<dd> The name of the global element </dd>
<dd> <em>globalElementName </em>&#8212; The local name of the global element
to use as the root of the printed instance. </dd>
</dl>
<h3> Example </h3>
<p> The following command and output use the schema that accompanies the SubstitutionGroup
sample. </p>
<pre>xsd2inst easypo.xsd -name invoice-header</pre>
<p> Output </p>
<pre>&lt;eas:invoice-header xmlns:eas=&quot;http://xmlbeans.apache.org/samples/substitutiongroup/easypo&quot;&gt;
&lt;eas:ship-to&gt;
&lt;eas:name&gt;string&lt;/eas:name&gt;
&lt;eas:address&gt;string&lt;/eas:address&gt;
&lt;/eas:ship-to&gt;
&lt;eas:bill-to&gt;
&lt;eas:name&gt;string&lt;/eas:name&gt;
&lt;eas:address&gt;string&lt;/eas:address&gt;
&lt;/eas:bill-to&gt;
&lt;!--Optional:--&gt;
&lt;eas:product id=&quot;3&quot;/&gt;
&lt;!--Optional:--&gt;
&lt;eas:comment&gt;string&lt;/eas:comment&gt;
&lt;/eas:invoice-header&gt;</pre>
<h2> <a name="xsdtree"></a>xsdtree (Schema Type Hierarchy Printer) </h2>
<p> Prints inheritance hierarchy of types defined in a schema. </p>
<h3> Syntax </h3>
<pre><strong>xsdtree</strong> [<strong>-noanon</strong>] [<strong>-nopvr</strong>] [<strong>-noupa</strong>] [<strong>-partial</strong>] [<strong>-license</strong>] <em>schemafile.xsd*</em></pre>
<h4> Options </h4>
<dl>
<dt> <strong>-noanon</strong> </dt>
<dd> Don't include anonymous types in the tree. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-nopvr</strong> </dt>
<dd> Disable particle valid (restriction) rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-noupa</strong> </dt>
<dd> Disable unique particle attribution rule. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-partial</strong> </dt>
<dd> Print only part of the hierarchy. </dd>
<dt>&nbsp; </dt>
<dt> <strong>-license</strong> </dt>
<dd> Print license information. </dd>
<dt>&nbsp; </dt>
<dt> <em>schemafile.xsd</em> </dt>
<dd> The file containing the schema whose hierarchy should be printed. </dd>
</dl>
<h3> Example </h3>
<p> The following command and output use the schema that accompanies the SubstitutionGroup
sample. </p>
<pre>xsdtree easypo.xsd</pre>
<p> Output: </p>
<pre>xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
xmlns:eas=&quot;http://xmlbeans.apache.org/samples/substitutiongroup/easypo&quot;
+-xs:anyType (builtin)
+-xs:anySimpleType (builtin)
| +-xs:string (builtin)
| +-xs:normalizedString (builtin)
| +-xs:token (builtin)
| +-type of color element in eas:clothing-type (enumeration)
+-type of element eas:invoice-header
+-type of element eas:purchase-order
+-eas:product-type
| +-eas:clothing-type
| +-eas:book-type
+-eas:name-address</pre>
<h2> <a name="xmlbeans_ant"></a>xmlbean Ant task </h2>
<p> Compiles a set of XSD and/or WSDL files into XMLBeans types. See <a href="antXmlbean.html">xmlbean
Ant Task</a> for more complete documentation on the task. </p>
<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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,53 +0,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.
*/
/* 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;}

View File

@ -1,496 +0,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.
*/
/* 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;
}

Binary file not shown.

View File

@ -1,202 +0,0 @@
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.

View File

@ -1,221 +0,0 @@
Common Public License Version 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and
documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates'
from a Contributor if it was added to the Program by such Contributor
itself or anyone acting on such Contributor's behalf. Contributions do not
include additions to the Program which: (i) are separate modules of
software distributed in conjunction with the Program under their own
license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such Contributor,
if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code and
object code form. This patent license shall apply to the combination of
the Contribution and the Program if, at the time the Contribution is added
by the Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Contribution.
No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are provided
by any Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor
disclaims any liability to Recipient for claims brought by any other
entity based on infringement of intellectual property rights or otherwise.
As a condition to exercising the rights and licenses granted hereunder,
each Recipient hereby assumes sole responsibility to secure any other
intellectual property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to distribute the Program,
it is Recipient's responsibility to acquire that license before
distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of
title and non-infringement, and implied warranties or conditions of
merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and consequential
damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable manner
on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the
Program.
Contributors may not remove or alter any copyright notices contained within
the Program.
Each Contributor must identify itself as the originator of its Contribution,
if any, in a manner that reasonably allows subsequent Recipients to identify
the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor who
includes the Program in a commercial product offering should do so in a manner
which does not create potential liability for other Contributors. Therefore,
if a Contributor includes the Program in a commercial product offering, such
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
every other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits and
other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such Commercial
Contributor in connection with its distribution of the Program in a commercial
product offering. The obligations in this section do not apply to any claims
or Losses relating to any actual or alleged intellectual property
infringement. In order to qualify, an Indemnified Contributor must: a)
promptly notify the Commercial Contributor in writing of such claim, and b)
allow the Commercial Contributor to control, and cooperate with the Commercial
Contributor in, the defense and any related settlement negotiations. The
Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each
Recipient is solely responsible for determining the appropriateness of using
and distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement, including but not limited to the
risks and costs of program errors, compliance with applicable laws, damage to
or loss of data, programs or equipment, and unavailability or interruption of
operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against a Contributor with respect
to a patent applicable to software (including a cross-claim or counterclaim in
a lawsuit), then any patent licenses granted by that Contributor to such
Recipient under this Agreement shall terminate as of the date such litigation
is filed. In addition, if Recipient institutes patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging that
the Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and does
not cure such failure in a reasonable period of time after becoming aware of
such noncompliance. If all Recipient's rights under this Agreement terminate,
Recipient agrees to cease use and distribution of the Program as soon as
reasonably practicable. However, Recipient's obligations under this Agreement
and any licenses granted by Recipient relating to the Program shall continue
and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in
order to avoid inconsistency the Agreement is copyrighted and may only be
modified in the following manner. The Agreement Steward reserves the right to
publish new versions (including revisions) of this Agreement from time to
time. No one other than the Agreement Steward has the right to modify this
Agreement. IBM is the initial Agreement Steward. IBM may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to distribute the Program (including its Contributions)
under the new version. Except as expressly stated in Sections 2(a) and 2(b)
above, Recipient receives no rights or licenses to the intellectual property
of any Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted under
this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury trial
in any resulting litigation.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,68 +0,0 @@
Some brief instructions for using the maven xmlbeans2 plugin
1. Include something like this in your maven.xml:
namespace declaration:
xmlns:xmlbeans="xmlbeans:maven"
<preGoal name="java:compile">
<xmlbeans:schema2java
sourcedir="${basedir}/src"
sourceschema="j2ee_1_4schema/application_1_4.xsd,j2ee_1_4schema/j2ee_jaxrpc_mapping_1_1.xsd,j2ee_1_3schema/connector_1_0.xsd"
xmlconfigs="${basedir}/src/conf/xmlconfig.xml"
targetdir="${basedir}/target/xmlbeans"
cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
</preGoal>
where
sourcedir is a base directory for the list in sourceschema
sourceschema is a comma-delimited list of all the schemas you want to compile
xmlconfigs points to your xmlconfig.xml file
targetdir is where you want generated java source to appear
cataloglocation is the location of an entity resolver catalog to use for resolving namespace to schema locations.
The generated binary files, both .xsd and the TypeHolder class, will end up in the target/classes directory.
In addition, you can add precompiled schemas to the "schema classpath" by including them as
dependencies in project.xml with a properties tag like this:
<dependency>
<groupId>geronimo</groupId>
<artifactId>geronimo-naming-builder</artifactId>
<version>${pom.currentVersion}</version>
<properties>
<xmlbeans>true</xmlbeans>
</properties>
</dependency>
You will probably also want to add a dependency on the plugin to your project.xml file and the other dependencies if you use xmlbeans in unit tests:
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.0-beta1</version>
<type>plugin</type>
</dependency>
<!-- needed for xmlbeans runtime-->
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean</artifactId>
<version>${xmlbeans_version}</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
<version>${stax_version}</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>${stax_api_version}</version>
</dependency>

View File

@ -1,203 +0,0 @@
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.

View File

@ -1,3 +0,0 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).

View File

@ -1,104 +0,0 @@
<?xml version="1.0"?>
<!--
Copyright 2004-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- ================================================================== -->
<!-- xmlbeans v2 maven plugin -->
<!-- ================================================================== -->
<project xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:define="jelly:define"
xmlns:xmlbeans="xmlbeans2:maven"
>
<define:taglib uri="xmlbeans2:maven">
<define:jellybean
name="SchemaCompilerWrapper"
className="org.apache.xmlbeans.maven.SchemaCompilerWrapper"
method="compileSchemas"/>
<define:tag name="schema2java" xmlns="jelly:ant">
<j:if test="${context.getVariable('maven.xmlbeans2.targetdir') == null}">
<fail>Missing required attribute: maven.xmlbeans2.targetdir</fail>
</j:if>
<j:if test="${context.getVariable('maven.xmlbeans2.sourcedir') == null}">
<fail>Missing required attribute: maven.xmlbeans2.sourcedir</fail>
</j:if>
<j:if test="${context.getVariable('maven.xmlbeans2.sourceschema') == null}">
<fail>Missing required attribute: maven.xmlbeans2.sourceschema</fail>
</j:if>
<j:if test="${context.getVariable('maven.xmlbeans2.xmlconfigs') == null}">
<fail>Missing required attribute: maven.xmlbeans2.xmlconfigs</fail>
</j:if>
<!-- set up classpath for already-compiled schemas -->
<j:forEach var="artifact" items="${pom.artifacts}">
<j:set var="dependency" value="${artifact.dependency}"/>
<j:if test="${dependency.getProperty('xmlbeans') == 'true'}">
<j:set var="xmlbeans.classpath" value="${xmlbeans.classpath},${artifact.path}"/>
</j:if>
</j:forEach>
<j:jelly xmlns="jelly:ant">
<j:set var="uptodatePropName" value="xmlbeans.uptodate"/>
<j:expr value="${context.setVariable(uptodatePropName, null)}"/>
<j:set var="uptodateFile" value="${maven.xmlbeans2.targetdir}/tstamp"/>
<uptodate property="${uptodatePropName}"
targetfile="${uptodateFile}">
<srcfiles dir="${maven.xmlbeans2.sourcedir}"
includes="${maven.xmlbeans2.sourceschema}"/>
</uptodate>
<xmlbeans:SchemaCompilerWrapper
sourceDir="${maven.xmlbeans2.sourcedir}"
sourceSchemas="${maven.xmlbeans2.sourceschema}"
xmlConfigs="${maven.xmlbeans2.xmlconfigs}"
javaTargetDir="${maven.xmlbeans2.targetdir}"
classTargetDir="${maven.build.dest}"
catalogLocation="${maven.xmlbeans2.cataloglocation}"
classPath="${xmlbeans.classpath}"
resources="${pom.build.resources}"
buildSchemas="${context.getVariable(uptodatePropName) == null}"
baseSchemaLocation="${maven.xmlbeans2.baseSchemaLocation}"
/>
<j:if test="${context.getVariable(uptodatePropName) == null}">
<touch file="${uptodateFile}"/>
</j:if>
<path id="maven.xmlbeans.compile.src.set"
location="${maven.xmlbeans2.targetdir}"/>
<j:if test="${context.antProject.getReference('maven.compile.src.set') != null}">
<maven:addPath id="maven.compile.src.set"
refid="maven.xmlbeans.compile.src.set"/>
</j:if>
<j:if test="${context.antProject.getReference('maven.compile.src.set') == null}">
<echo message="Maven cannot find the generated sources unless you provide a dummy source directory in project.xml"/>
</j:if>
</j:jelly>
</define:tag>
</define:taglib>
</project>

View File

@ -1,50 +0,0 @@
# Copyright 2003-2005 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#These properties can be set in a project.properties file or in an invocation in maven.xml
#dependencies marked with the property <xmlbeans>true</xmlbeans> will get included in the xmlbeans classpath
#so you can reuse your xmlbeans generated classes.
#a typical invocation looks like:
#<project default="default"
# xmlns:xmlbeans="xmlbeans2:maven">
#
# <preGoal name="java:compile">
# <xmlbeans:schema2java
# maven.xmlbeans2.sourceschema="application_1_4.xsd,j2ee_jaxrpc_mapping_1_1.xsd"
# maven.xmlbeans2.cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
# </preGoal>
#base location for schemas to compile
maven.xmlbeans2.sourcedir=${basedir}/src/schema
#comma separated list of schemas to compile, relative to sourcedir above. You must specify this explicitly
maven.xmlbeans2.sourceschema=
#location of the xmlbeans configuration file
maven.xmlbeans2.xmlconfigs=${basedir}/src/schema/xmlconfig.xml
#location of an xml catalog. If you use one, you must specify the location yourself.
maven.xmlbeans2.cataloglocation=
#target directory for generated java code. Binary artifacts are place directly into target/classes.
maven.xmlbeans2.targetdir=${basedir}/target/xmlbeans
#default base location where schemas will be copied. Unlike the ant task,
#they will include the path of the schema listed in the sourceSchemas parameter.
maven.xmlbeans2.baseSchemaLocation=schemaorg_apache_xmlbeans/src

View File

@ -1,28 +0,0 @@
# Copyright 2003-2005 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
maven.multiproject.type=plugin
maven.repo.central=apache.org
maven.repo.central.directory=/www/cvs.apache.org/repository
maven.remote.group=apcvs
maven.compile.source=1.4
maven.compile.target=1.4
#maven.compile.deprecation=true
maven.compile.debug=true
maven.compile.optimize=true

View File

@ -1,88 +0,0 @@
<?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.
-->
<project>
<pomVersion>3</pomVersion>
<groupId>xmlbeans</groupId>
<id>xmlbeans-maven-plugin</id>
<currentVersion>2.0.0-beta1</currentVersion>
<name>xmlbeans maven plugin</name>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo></logo>
</organization>
<inceptionYear>2004</inceptionYear>
<package>org.apache.xmlbeans.maven</package>
<logo></logo>
<dependencies>
<dependency>
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
</unitTest>
<resources>
<resource>
<directory>src/plugin-resources</directory>
<targetPath>plugin-resources</targetPath>
</resource>
<resource>
<directory>.</directory>
<includes>
<include>plugin.jelly</include>
<include>plugin.properties</include>
<include>project.properties</include>
<include>project.xml</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -1,270 +0,0 @@
/**
*
* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.xmlbeans.maven;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.maven.project.Resource;
import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.CatalogResolver;
import org.apache.xmlbeans.impl.tool.SchemaCompiler;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
*
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
*
* */
public class SchemaCompilerWrapper {
private String sourceDir;
private String sourceSchemas;
private String xmlConfigs;
private String javaTargetDir;
private String classTargetDir;
private String catalogLocation;
private String classPath;
private List resources;
private boolean buildSchemas;
//this copy should not end in /
private String baseSchemaLocation = "schemaorg_apache_xmlbeans/src";
public String getSourceDir() {
return sourceDir;
}
public void setSourceDir(String sourceDir) {
this.sourceDir = sourceDir;
}
public String getSourceSchemas() {
return sourceSchemas;
}
public void setSourceSchemas(String sourceSchemas) {
this.sourceSchemas = sourceSchemas;
}
public String getXmlConfigs() {
return xmlConfigs;
}
public void setXmlConfigs(String xmlConfigs) {
this.xmlConfigs = xmlConfigs;
}
public String getJavaTargetDir() {
return javaTargetDir;
}
public void setJavaTargetDir(String javaTargetDir) {
this.javaTargetDir = javaTargetDir;
}
public String getClassTargetDir() {
return classTargetDir;
}
public void setClassTargetDir(String classTargetDir) {
this.classTargetDir = classTargetDir;
}
public String getCatalogLocation() {
return catalogLocation;
}
public void setCatalogLocation(String catalogLocation) {
this.catalogLocation = catalogLocation;
}
public String getClassPath() {
return classPath;
}
public void setClassPath(String classPath) {
this.classPath = classPath;
}
public List getResources() {
return resources;
}
public void setResources(List resources) {
this.resources = resources;
}
public boolean isBuildSchemas() {
return buildSchemas;
}
public void setBuildSchemas(boolean buildSchemas) {
this.buildSchemas = buildSchemas;
}
public String getBaseSchemaLocation() {
return baseSchemaLocation;
}
public void setBaseSchemaLocation(String baseSchemaLocation) {
if (baseSchemaLocation != null && !(baseSchemaLocation.length() == 0)) {
this.baseSchemaLocation = baseSchemaLocation;
}
}
public void compileSchemas() throws Exception {
List schemas = new ArrayList();
File base = new File(sourceDir);
Resource resource = new Resource();
resource.setDirectory(sourceDir);
resource.setTargetPath(baseSchemaLocation);
for (StringTokenizer st = new StringTokenizer(sourceSchemas, ","); st.hasMoreTokens();) {
String schemaName = st.nextToken();
schemas.add(new File(base, schemaName));
resource.addInclude(schemaName);
}
resources.add(resource);
if (buildSchemas) {
List configs = new ArrayList();
if (xmlConfigs != null) {
for (StringTokenizer st = new StringTokenizer(xmlConfigs, ","); st.hasMoreTokens();) {
String configName = st.nextToken();
configs.add(new File(configName));
}
}
List classPathList = new ArrayList();
List urls = new ArrayList();
if (classPath != null) {
for (StringTokenizer st = new StringTokenizer(classPath, ","); st.hasMoreTokens();) {
String classpathElement = st.nextToken();
File file = new File(classpathElement);
classPathList.add(file);
urls.add(file.toURL());
System.out.println("Adding to classpath: " + file);
}
}
ClassLoader cl = new URLClassLoader((URL[]) urls.toArray(new URL[] {}));
EntityResolver entityResolver = null;
if (catalogLocation != null) {
CatalogManager catalogManager = CatalogManager.getStaticManager();
catalogManager.setCatalogFiles(catalogLocation);
entityResolver = new CatalogResolver();
}
URI sourceDirURI = new File(sourceDir).toURI();
entityResolver = new PassThroughResolver(cl, entityResolver, sourceDirURI, baseSchemaLocation);
SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
params.setBaseDir(null);
params.setXsdFiles((File[])schemas.toArray(new File[] {}));
params.setWsdlFiles(new File[] {});
params.setJavaFiles(new File[] {});
params.setConfigFiles((File[])configs.toArray(new File[] {}));
params.setClasspath((File[])classPathList.toArray(new File[] {}));
params.setOutputJar(null);
params.setName(null);
params.setSrcDir(new File(javaTargetDir));
params.setClassesDir(new File(classTargetDir));
params.setCompiler(null);
params.setMemoryInitialSize(null);
params.setMemoryMaximumSize(null);
params.setNojavac(true);
params.setQuiet(false);
params.setVerbose(true);
params.setDownload(false);
params.setNoUpa(false);
params.setNoPvr(false);
params.setDebug(true);
params.setErrorListener(new ArrayList());
params.setRepackage(null);
params.setExtensions(null);
params.setMdefNamespaces(null);
params.setEntityResolver(entityResolver);
boolean result = SchemaCompiler.compile(params);
if (!result) {
Collection errors = params.getErrorListener();
for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
Object o = (Object) iterator.next();
System.out.println("xmlbeans error: " + o);
}
throw new Exception("Schema compilation failed");
}
}
}
private static class PassThroughResolver implements EntityResolver {
private final ClassLoader cl;
private final EntityResolver delegate;
private final URI sourceDir;
//this copy has an / appended
private final String baseSchemaLocation;
public PassThroughResolver(ClassLoader cl, EntityResolver delegate, URI sourceDir, String baseSchemaLocation) {
this.cl = cl;
this.delegate = delegate;
this.sourceDir = sourceDir;
this.baseSchemaLocation = baseSchemaLocation + "/";
}
public InputSource resolveEntity(String publicId,
String systemId)
throws SAXException, IOException {
if (delegate != null) {
InputSource is = delegate.resolveEntity(publicId, systemId);
if (is != null) {
return is;
}
}
System.out.println("Could not resolve publicId: " + publicId + ", systemId: " + systemId + " from catalog");
String localSystemId;
try {
localSystemId = sourceDir.relativize(new URI(systemId)).toString();
} catch (URISyntaxException e) {
throw (IOException)new IOException("Could not relativeize systemId").initCause(e);
}
InputStream in = cl.getResourceAsStream(localSystemId);
if (in != null) {
System.out.println("found in classpath at: " + localSystemId);
return new InputSource(in);
}
in = cl.getResourceAsStream(baseSchemaLocation + localSystemId);
if (in != null) {
System.out.println("found in classpath at: META-INF/" + localSystemId);
return new InputSource(in);
}
System.out.println("Not found in classpath, looking in current directory: " + systemId);
return new InputSource(systemId);
}
}
}

View File

@ -1,35 +0,0 @@
Sample: AbstractTypes
Category: abstracttypes
Author: Radu Preotiuc
Last Updated: Feb. 7, 2005
Versions:
xmlbeans-v1 1.0.3
xmlbeans-v2
-----------------------------------------------------------------------------
This sample illustrates the use of abstract XmlSchema types in XmlBeans.
The scenario is simple: someone declares a generic XmlSchema containing the
basic structure of a document with abstract, generic types and delivers a .jar
file containing the compiled version of that Schema. We then define our own
customization of that schema implementing the abstract types, we compile this
XmlSchema using the .jar that was provided and create a sample instance
document using XmlBeans.
Here are the steps:
Step1. Create the schema file "abstractBase.xsd" and compile it
to abstractbase.jar.
Step2. Create a Schema that implements the abstract types defined in
"abstractBase.xsd", and compile it with "abstractbase.jar" on the classpath.
Step3. Use the jars created in steps 1 and 2 to create an instance document
using the concrete types.
To try out this sample:
1. Set XMLBEANS_HOME in your environment
2. Ant must be on your PATH
3. To compile the schemas and sample source, run "ant build"
4. To execute the sample, run "ant run"

View File

@ -1,108 +0,0 @@
<?xml version="1.0"?>
<project name="abstracttypes" basedir="." default="build-run" >
<!-- ===================================================================
- Properties
-->
<property environment="env"/>
<target name="init">
<property name="xmlbeans.home" value="${env.XMLBEANS_HOME}"/>
<echo message="xmlbeans.home: ${xmlbeans.home}"/>
<!-- check for xbean.jar from binary distribution -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/lib"
file="${xmlbeans.home}/lib/xbean.jar" />
<!-- check for xbean.jar compiled from source -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/build/lib"
file="${xmlbeans.home}/build/lib/xbean.jar" />
<fail message="Set XMLBEANS_HOME in your enviornment."
unless="xmlbeans.lib"/>
<echo message="xmlbeans.lib: ${xmlbeans.lib}"/>
<path id="xmlbeans.classpath">
<fileset dir="${xmlbeans.lib}" includes="xbean.jar,xmlbeans-qname.jar,jsr173_1.0_api.jar"/>
</path>
<taskdef name="scomp"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xmlbeans.classpath"/>
</target>
<property name="abstract.jar" value="abstractbase.jar"/>
<property name="myfigures.jar" value="mytypes.jar"/>
<target name="build-run" depends="build,run"/>
<target name="schemas.abstract.check">
<uptodate property="schemas.abstract.notRequired" targetfile="build/${abstract.jar}">
<srcfiles dir="schemas" includes="abstractBase.xsd"/>
</uptodate>
</target>
<target name="build.check">
<uptodate property="build.notRequired" targetfile="build/org/apache/xmlbeans/samples/abstracttypes/AbstractTypes.class">
<srcfiles dir="." includes="schemas/*.xsd,src/**/*.java"/>
</uptodate>
</target>
<target name="schemas.abstract" depends="init,schemas.abstract.check" unless="schemas.abstract.notRequired">
<mkdir dir="build"/>
<scomp schema="schemas/abstractBase.xsd" destfile="build/${abstract.jar}">
<classpath>
<path refid="xmlbeans.classpath"/>
</classpath>
</scomp>
</target>
<target name="build" depends="init,schemas.abstract,build.check" unless="build.notRequired">
<scomp schema="schemas/myfigures.xsd" destfile="build/${myfigures.jar}">
<classpath>
<pathelement location="build/${abstract.jar}"/>
<path refid="xmlbeans.classpath"/>
</classpath>
</scomp>
<javac srcdir="src" destdir="build" debug="on" source="1.4">
<classpath>
<path refid="xmlbeans.classpath"/>
<pathelement location="build/${abstract.jar}"/>
<pathelement location="build/${myfigures.jar}"/>
</classpath>
</javac>
</target>
<target name="run" depends="build">
<java classname="org.apache.xmlbeans.samples.abstracttypes.AbstractTypes" fork="yes">
<classpath>
<path refid="xmlbeans.classpath"/>
<pathelement location="build/${abstract.jar}"/>
<pathelement location="build/${myfigures.jar}"/>
<pathelement location="build"/>
</classpath>
</java>
</target>
<target name="test" depends="build">
<echo message="============================== testing AbstractTypes"/>
<java classname="org.apache.xmlbeans.samples.abstracttypes.AbstractTypesTest" fork="yes">
<classpath>
<path refid="xmlbeans.classpath"/>
<pathelement location="build/${abstract.jar}"/>
<pathelement location="build/${myfigures.jar}"/>
<pathelement location="build"/>
</classpath>
</java>
</target>
<target name="clean">
<delete quiet="true" dir="build"/>
</target>
</project>

View File

@ -1,30 +0,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.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="AbstractFigures" xmlns:a="AbstractFigures">
<xs:complexType name="shape" abstract="true">
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="figure" type="a:shape" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -1,39 +0,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.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="Figures" xmlns:a="AbstractFigures" xmlns:f="Figures">
<xs:import namespace="AbstractFigures"/>
<xs:complexType name="circle">
<xs:complexContent>
<xs:extension base="a:shape">
<xs:sequence>
<xs:element name="radius" type="xs:double"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="square">
<xs:complexContent>
<xs:extension base="a:shape">
<xs:sequence>
<xs:element name="side" type="xs:double"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View File

@ -1,69 +0,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.
*/
package org.apache.xmlbeans.samples.abstracttypes;
import abstractFigures.*;
import figures.*;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
/**
* Test class that builds a document using type substitution
*/
public class AbstractTypes
{
public static void main(String[] args)
{
buildDocument(true);
}
public static XmlObject buildDocument(boolean enableOutput)
{
XmlOptions opt = (new XmlOptions()).setSavePrettyPrint();
// Build a new document
RootDocument doc = RootDocument.Factory.newInstance();
RootDocument.Root figures = doc.addNewRoot();
if (enableOutput)
System.out.println("Empty document:\n" + doc.xmlText(opt) + "\n");
// Add abstract figures
Shape s1 = figures.addNewFigure();
s1.setId("001");
Shape s2 = figures.addNewFigure();
s2.setId("002");
// Document contains two shapes now
// Because the shape is abstract, the document will not yet be valid
if (enableOutput)
{
System.out.println("Document containing the abstract types:\n" + doc.xmlText(opt));
System.out.println("Valid = " + doc.validate() + "\n");
}
// Change the abstract figures to concrete ones
Circle circle = (Circle) s1.changeType(Circle.type);
circle.setRadius(10.0);
Square square = (Square) s2.changeType(Square.type);
square.setSide(20.0);
// Document contains two concrete shapes and is valid
if (enableOutput)
{
System.out.println("Final document:\n" + doc.xmlText(opt));
System.out.println("Vald = " + doc.validate());
}
return doc;
}
}

View File

@ -1,30 +0,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.
*/
package org.apache.xmlbeans.samples.abstracttypes;
import org.apache.xmlbeans.XmlObject;
/**
* Tests the AbstractTypes sample.
*/
public class AbstractTypesTest
{
public static void main(String[] args)
{
XmlObject doc = AbstractTypes.buildDocument(false);
assert doc.validate();
}
}

View File

@ -1,41 +0,0 @@
Sample: Any
Author: Steven Traut (straut@bea.com)
Last Updated: June 14, 2005
Versions:
xmlbeans-v1 1.0.3
xmlbeans-v2
-----------------------------------------------------------------------------
This sample illustrates how you can use the XMLBeans API to work with
XML based on schema that features xs:any particles. Unlike other schema
types, xs:any in schema does not result in accessors when you use XMLBeans
to compile schema. Instead, your code must use alternate means to access
and create these parts of the XML. These alternate means include:
- Using XmlCursor instances to "walk" the XML, retrieving and creating
elements.
- Using the selectPath method to retrieve XML via XPath.
- Using the selectChildren method to retrieve elements that are children
by name.
- Using the DOM API to "walk" the node tree, retrieving elements by
name and creating new elements.
When you run this sample, you'll see it print four blocks of information
in the console:
- Results of the Any.buildDocFromScratch method, which builds from scratch the
XML contents of any.xml included with this sample.
- Results of the Any.editExistingDocWithSelectChildren method, which receives
any.xml and replaces one of its elements.
- Results of the Any.editExistingDocWithDOM method, which receives
any.xml and adds an element.
- Results of the Any.editExistingDocWithSelectPath method, which receives
any.xml, promotes one of its elements, and adds a new element.
To try out this sample:
1. Set XMLBEANS_HOME in your environment
2. Ant must be on your PATH
3. To compile the schemas and sample source, run "ant build"
4. To execute the sample, run "ant run"

View File

@ -1,120 +0,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.
-->
<project name="Any" default="build">
<property environment="env"/>
<path id="Any.path">
<path refid="xmlbeans.path"/>
<fileset dir="build/lib" includes="*.jar"/>
<pathelement path="build/classes"/>
</path>
<target name="init">
<property name="xmlbeans.home" value="${env.XMLBEANS_HOME}"/>
<echo message="xmlbeans.home: ${xmlbeans.home}"/>
<!-- check for xbean.jar from binary distribution -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/lib"
file="${xmlbeans.home}/lib/xbean.jar" />
<!-- check for xbean.jar compiled from source -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/build/lib"
file="${xmlbeans.home}/build/lib/xbean.jar" />
<fail message="Set XMLBEANS_HOME in your environment."
unless="xmlbeans.lib"/>
<echo message="xmlbeans.lib: ${xmlbeans.lib}"/>
<path id="xmlbeans.path">
<fileset dir="${xmlbeans.lib}" includes="*.jar"/>
</path>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xmlbeans.path"/>
</target>
<!-- ========================== clean ==== -->
<target name="clean">
<delete dir="build"/>
</target>
<!-- ========================== build ==== -->
<target name="build" depends="init,schemas.jar,Any.classes">
</target>
<target name="schemas.check">
<uptodate property="schemas.notRequired"
targetfile="build/lib/schemas.jar">
<srcfiles dir="schemas" includes="**/*.xsd"/>
</uptodate>
</target>
<target name="schemas.jar" depends="init,schemas.check"
unless="schemas.notRequired">
<mkdir dir="build/lib"/>
<xmlbean schema="schemas"
destfile="build/lib/schemas.jar"
srcgendir="src"
classpathref="xmlbeans.path"
debug="on"
/>
</target>
<target name="Any.classes" depends="init">
<mkdir dir="build/classes"/>
<javac srcdir="src"
destdir="build/classes"
classpathref="Any.path"
debug="on"
source="1.4"
/>
</target>
<!-- ========================== run ==== -->
<target name="run" depends="init,build">
<echo message="============================== running Any"/>
<java
classname="org.apache.xmlbeans.samples.anytype.Any"
classpathref="Any.path"
fork="true">
<arg line="xml/any.xml"/>
</java>
</target>
<!-- ========================== test ==== -->
<target name="test" depends="init,build">
<echo message="============================== testing Any"/>
<java
classname="org.apache.xmlbeans.samples.anytype.AnyTest"
classpathref="Any.path"
fork="true">
<arg line="xml/any.xml"/>
</java>
</target>
</project>

View File

@ -1,42 +0,0 @@
<?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 xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://xmlbeans.apache.org/samples/any"
targetNamespace="http://xmlbeans.apache.org/samples/any" elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="stringelement"/>
<xs:any processContents="lax"/>
<xs:element name="arrayofany">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stringelement" type="xs:string"/>
<xs:complexType name="ListOfStrings">
<xs:sequence>
<xs:element ref="stringelement" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:schema>

View File

@ -1,195 +0,0 @@
/*
* XML Type: ListOfStrings
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.ListOfStrings
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any;
/**
* An XML ListOfStrings(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public interface ListOfStrings extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("listofstringse467type");
/**
* Gets array of all "stringelement" elements
*/
java.lang.String[] getStringelementArray();
/**
* Gets ith "stringelement" element
*/
java.lang.String getStringelementArray(int i);
/**
* Gets (as xml) array of all "stringelement" elements
*/
org.apache.xmlbeans.XmlString[] xgetStringelementArray();
/**
* Gets (as xml) ith "stringelement" element
*/
org.apache.xmlbeans.XmlString xgetStringelementArray(int i);
/**
* Returns number of "stringelement" element
*/
int sizeOfStringelementArray();
/**
* Sets array of all "stringelement" element
*/
void setStringelementArray(java.lang.String[] stringelementArray);
/**
* Sets ith "stringelement" element
*/
void setStringelementArray(int i, java.lang.String stringelement);
/**
* Sets (as xml) array of all "stringelement" element
*/
void xsetStringelementArray(org.apache.xmlbeans.XmlString[] stringelementArray);
/**
* Sets (as xml) ith "stringelement" element
*/
void xsetStringelementArray(int i, org.apache.xmlbeans.XmlString stringelement);
/**
* Inserts the value as the ith "stringelement" element
*/
void insertStringelement(int i, java.lang.String stringelement);
/**
* Appends the value as the last "stringelement" element
*/
void addStringelement(java.lang.String stringelement);
/**
* Inserts and returns a new empty value (as xml) as the ith "stringelement" element
*/
org.apache.xmlbeans.XmlString insertNewStringelement(int i);
/**
* Appends and returns a new empty value (as xml) as the last "stringelement" element
*/
org.apache.xmlbeans.XmlString addNewStringelement();
/**
* Removes the ith "stringelement" element
*/
void removeStringelement(int i);
/**
* Gets the "id" attribute
*/
java.lang.String getId();
/**
* Gets (as xml) the "id" attribute
*/
org.apache.xmlbeans.XmlString xgetId();
/**
* True if has "id" attribute
*/
boolean isSetId();
/**
* Sets the "id" attribute
*/
void setId(java.lang.String id);
/**
* Sets (as xml) the "id" attribute
*/
void xsetId(org.apache.xmlbeans.XmlString id);
/**
* Unsets the "id" attribute
*/
void unsetId();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.apache.xmlbeans.samples.any.ListOfStrings newInstance() {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.ListOfStrings parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.ListOfStrings 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 (org.apache.xmlbeans.samples.any.ListOfStrings) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}

View File

@ -1,198 +0,0 @@
/*
* An XML document type.
* Localname: root
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.RootDocument
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any;
/**
* A document containing one root(@http://xmlbeans.apache.org/samples/any) element.
*
* This is a complex type.
*/
public interface RootDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("root9970doctype");
/**
* Gets the "root" element
*/
org.apache.xmlbeans.samples.any.RootDocument.Root getRoot();
/**
* Sets the "root" element
*/
void setRoot(org.apache.xmlbeans.samples.any.RootDocument.Root root);
/**
* Appends and returns a new empty "root" element
*/
org.apache.xmlbeans.samples.any.RootDocument.Root addNewRoot();
/**
* An XML root(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public interface Root extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("root2a6eelemtype");
/**
* Gets the "stringelement" element
*/
java.lang.String getStringelement();
/**
* Gets (as xml) the "stringelement" element
*/
org.apache.xmlbeans.XmlString xgetStringelement();
/**
* Sets the "stringelement" element
*/
void setStringelement(java.lang.String stringelement);
/**
* Sets (as xml) the "stringelement" element
*/
void xsetStringelement(org.apache.xmlbeans.XmlString stringelement);
/**
* Gets the "arrayofany" element
*/
org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany getArrayofany();
/**
* Sets the "arrayofany" element
*/
void setArrayofany(org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany arrayofany);
/**
* Appends and returns a new empty "arrayofany" element
*/
org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany addNewArrayofany();
/**
* An XML arrayofany(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public interface Arrayofany extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("arrayofany08d6elemtype");
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany newInstance() {
return (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
private Factory() { } // No instance of this class allowed
}
}
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.apache.xmlbeans.samples.any.RootDocument.Root newInstance() {
return (org.apache.xmlbeans.samples.any.RootDocument.Root) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument.Root newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.apache.xmlbeans.samples.any.RootDocument.Root) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
private Factory() { } // No instance of this class allowed
}
}
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.apache.xmlbeans.samples.any.RootDocument newInstance() {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.apache.xmlbeans.samples.any.RootDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.RootDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.RootDocument 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 (org.apache.xmlbeans.samples.any.RootDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}

View File

@ -1,116 +0,0 @@
/*
* An XML document type.
* Localname: stringelement
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.StringelementDocument
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any;
/**
* A document containing one stringelement(@http://xmlbeans.apache.org/samples/any) element.
*
* This is a complex type.
*/
public interface StringelementDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)schema.system.s6EF7A0057B3F4CED74AE6E05BCAAB5DB.TypeSystemHolder.typeSystem.resolveHandle("stringelementc479doctype");
/**
* Gets the "stringelement" element
*/
java.lang.String getStringelement();
/**
* Gets (as xml) the "stringelement" element
*/
org.apache.xmlbeans.XmlString xgetStringelement();
/**
* Sets the "stringelement" element
*/
void setStringelement(java.lang.String stringelement);
/**
* Sets (as xml) the "stringelement" element
*/
void xsetStringelement(org.apache.xmlbeans.XmlString stringelement);
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.apache.xmlbeans.samples.any.StringelementDocument newInstance() {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.StringelementDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
public static org.apache.xmlbeans.samples.any.StringelementDocument 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 (org.apache.xmlbeans.samples.any.StringelementDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link XMLInputStream} */
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 org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}

View File

@ -1,328 +0,0 @@
/*
* XML Type: ListOfStrings
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.ListOfStrings
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any.impl;
/**
* An XML ListOfStrings(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public class ListOfStringsImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.any.ListOfStrings
{
public ListOfStringsImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
private static final javax.xml.namespace.QName STRINGELEMENT$0 =
new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/any", "stringelement");
private static final javax.xml.namespace.QName ID$2 =
new javax.xml.namespace.QName("", "id");
/**
* Gets array of all "stringelement" elements
*/
public java.lang.String[] getStringelementArray()
{
synchronized (monitor())
{
check_orphaned();
java.util.List targetList = new java.util.ArrayList();
get_store().find_all_element_users(STRINGELEMENT$0, targetList);
java.lang.String[] result = new java.lang.String[targetList.size()];
for (int i = 0, len = targetList.size() ; i < len ; i++)
result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getStringValue();
return result;
}
}
/**
* Gets ith "stringelement" element
*/
public java.lang.String getStringelementArray(int i)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, i);
if (target == null)
{
throw new IndexOutOfBoundsException();
}
return target.getStringValue();
}
}
/**
* Gets (as xml) array of all "stringelement" elements
*/
public org.apache.xmlbeans.XmlString[] xgetStringelementArray()
{
synchronized (monitor())
{
check_orphaned();
java.util.List targetList = new java.util.ArrayList();
get_store().find_all_element_users(STRINGELEMENT$0, targetList);
org.apache.xmlbeans.XmlString[] result = new org.apache.xmlbeans.XmlString[targetList.size()];
targetList.toArray(result);
return result;
}
}
/**
* Gets (as xml) ith "stringelement" element
*/
public org.apache.xmlbeans.XmlString xgetStringelementArray(int i)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, i);
if (target == null)
{
throw new IndexOutOfBoundsException();
}
return (org.apache.xmlbeans.XmlString)target;
}
}
/**
* Returns number of "stringelement" element
*/
public int sizeOfStringelementArray()
{
synchronized (monitor())
{
check_orphaned();
return get_store().count_elements(STRINGELEMENT$0);
}
}
/**
* Sets array of all "stringelement" element
*/
public void setStringelementArray(java.lang.String[] stringelementArray)
{
synchronized (monitor())
{
check_orphaned();
arraySetterHelper(stringelementArray, STRINGELEMENT$0);
}
}
/**
* Sets ith "stringelement" element
*/
public void setStringelementArray(int i, java.lang.String stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, i);
if (target == null)
{
throw new IndexOutOfBoundsException();
}
target.setStringValue(stringelement);
}
}
/**
* Sets (as xml) array of all "stringelement" element
*/
public void xsetStringelementArray(org.apache.xmlbeans.XmlString[]stringelementArray)
{
synchronized (monitor())
{
check_orphaned();
arraySetterHelper(stringelementArray, STRINGELEMENT$0);
}
}
/**
* Sets (as xml) ith "stringelement" element
*/
public void xsetStringelementArray(int i, org.apache.xmlbeans.XmlString stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, i);
if (target == null)
{
throw new IndexOutOfBoundsException();
}
target.set(stringelement);
}
}
/**
* Inserts the value as the ith "stringelement" element
*/
public void insertStringelement(int i, java.lang.String stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target =
(org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(STRINGELEMENT$0, i);
target.setStringValue(stringelement);
}
}
/**
* Appends the value as the last "stringelement" element
*/
public void addStringelement(java.lang.String stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(STRINGELEMENT$0);
target.setStringValue(stringelement);
}
}
/**
* Inserts and returns a new empty value (as xml) as the ith "stringelement" element
*/
public org.apache.xmlbeans.XmlString insertNewStringelement(int i)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().insert_element_user(STRINGELEMENT$0, i);
return target;
}
}
/**
* Appends and returns a new empty value (as xml) as the last "stringelement" element
*/
public org.apache.xmlbeans.XmlString addNewStringelement()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(STRINGELEMENT$0);
return target;
}
}
/**
* Removes the ith "stringelement" element
*/
public void removeStringelement(int i)
{
synchronized (monitor())
{
check_orphaned();
get_store().remove_element(STRINGELEMENT$0, i);
}
}
/**
* Gets the "id" attribute
*/
public java.lang.String getId()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ID$2);
if (target == null)
{
return null;
}
return target.getStringValue();
}
}
/**
* Gets (as xml) the "id" attribute
*/
public org.apache.xmlbeans.XmlString xgetId()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(ID$2);
return target;
}
}
/**
* True if has "id" attribute
*/
public boolean isSetId()
{
synchronized (monitor())
{
check_orphaned();
return get_store().find_attribute_user(ID$2) != null;
}
}
/**
* Sets the "id" attribute
*/
public void setId(java.lang.String id)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ID$2);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(ID$2);
}
target.setStringValue(id);
}
}
/**
* Sets (as xml) the "id" attribute
*/
public void xsetId(org.apache.xmlbeans.XmlString id)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(ID$2);
if (target == null)
{
target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(ID$2);
}
target.set(id);
}
}
/**
* Unsets the "id" attribute
*/
public void unsetId()
{
synchronized (monitor())
{
check_orphaned();
get_store().remove_attribute(ID$2);
}
}
}

View File

@ -1,228 +0,0 @@
/*
* An XML document type.
* Localname: root
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.RootDocument
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any.impl;
/**
* A document containing one root(@http://xmlbeans.apache.org/samples/any) element.
*
* This is a complex type.
*/
public class RootDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.any.RootDocument
{
public RootDocumentImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
private static final javax.xml.namespace.QName ROOT$0 =
new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/any", "root");
/**
* Gets the "root" element
*/
public org.apache.xmlbeans.samples.any.RootDocument.Root getRoot()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root)get_store().find_element_user(ROOT$0, 0);
if (target == null)
{
return null;
}
return target;
}
}
/**
* Sets the "root" element
*/
public void setRoot(org.apache.xmlbeans.samples.any.RootDocument.Root root)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root)get_store().find_element_user(ROOT$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.samples.any.RootDocument.Root)get_store().add_element_user(ROOT$0);
}
target.set(root);
}
}
/**
* Appends and returns a new empty "root" element
*/
public org.apache.xmlbeans.samples.any.RootDocument.Root addNewRoot()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root)get_store().add_element_user(ROOT$0);
return target;
}
}
/**
* An XML root(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public static class RootImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.any.RootDocument.Root
{
public RootImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
private static final javax.xml.namespace.QName STRINGELEMENT$0 =
new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/any", "stringelement");
private static final javax.xml.namespace.QName ARRAYOFANY$2 =
new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/any", "arrayofany");
/**
* Gets the "stringelement" element
*/
public java.lang.String getStringelement()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
return null;
}
return target.getStringValue();
}
}
/**
* Gets (as xml) the "stringelement" element
*/
public org.apache.xmlbeans.XmlString xgetStringelement()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, 0);
return target;
}
}
/**
* Sets the "stringelement" element
*/
public void setStringelement(java.lang.String stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(STRINGELEMENT$0);
}
target.setStringValue(stringelement);
}
}
/**
* Sets (as xml) the "stringelement" element
*/
public void xsetStringelement(org.apache.xmlbeans.XmlString stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(STRINGELEMENT$0);
}
target.set(stringelement);
}
}
/**
* Gets the "arrayofany" element
*/
public org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany getArrayofany()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany)get_store().find_element_user(ARRAYOFANY$2, 0);
if (target == null)
{
return null;
}
return target;
}
}
/**
* Sets the "arrayofany" element
*/
public void setArrayofany(org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany arrayofany)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany)get_store().find_element_user(ARRAYOFANY$2, 0);
if (target == null)
{
target = (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany)get_store().add_element_user(ARRAYOFANY$2);
}
target.set(arrayofany);
}
}
/**
* Appends and returns a new empty "arrayofany" element
*/
public org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany addNewArrayofany()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany target = null;
target = (org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany)get_store().add_element_user(ARRAYOFANY$2);
return target;
}
}
/**
* An XML arrayofany(@http://xmlbeans.apache.org/samples/any).
*
* This is a complex type.
*/
public static class ArrayofanyImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany
{
public ArrayofanyImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
}
}
}

View File

@ -1,94 +0,0 @@
/*
* An XML document type.
* Localname: stringelement
* Namespace: http://xmlbeans.apache.org/samples/any
* Java type: org.apache.xmlbeans.samples.any.StringelementDocument
*
* Automatically generated - do not modify.
*/
package org.apache.xmlbeans.samples.any.impl;
/**
* A document containing one stringelement(@http://xmlbeans.apache.org/samples/any) element.
*
* This is a complex type.
*/
public class StringelementDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.any.StringelementDocument
{
public StringelementDocumentImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType);
}
private static final javax.xml.namespace.QName STRINGELEMENT$0 =
new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/any", "stringelement");
/**
* Gets the "stringelement" element
*/
public java.lang.String getStringelement()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
return null;
}
return target.getStringValue();
}
}
/**
* Gets (as xml) the "stringelement" element
*/
public org.apache.xmlbeans.XmlString xgetStringelement()
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, 0);
return target;
}
}
/**
* Sets the "stringelement" element
*/
public void setStringelement(java.lang.String stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.SimpleValue target = null;
target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(STRINGELEMENT$0);
}
target.setStringValue(stringelement);
}
}
/**
* Sets (as xml) the "stringelement" element
*/
public void xsetStringelement(org.apache.xmlbeans.XmlString stringelement)
{
synchronized (monitor())
{
check_orphaned();
org.apache.xmlbeans.XmlString target = null;
target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(STRINGELEMENT$0, 0);
if (target == null)
{
target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(STRINGELEMENT$0);
}
target.set(stringelement);
}
}
}

View File

@ -1,457 +0,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.
*/
package org.apache.xmlbeans.samples.anytype;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.samples.any.ListOfStrings;
import org.apache.xmlbeans.samples.any.RootDocument;
import org.apache.xmlbeans.samples.any.StringelementDocument;
import org.apache.xmlbeans.samples.any.RootDocument.Root.Arrayofany;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import javax.xml.namespace.QName;
/**
* A sample that illustrates various ways to manipulate XML whose
* schema defines elements as type xs:any. Unlike its treatment of
* other schema types, XMLBeans does not generate accessors for the
* xs:any particle when compiling schema. Instead, your code
* handles instances of this type through any of several alternative
* means, including XPath queries, the selectChildren method,
* XmlCursor instances and the DOM API. This samples illustrates
* these alternative approaches.
*/
public class Any
{
private static final String m_namespaceUri = "http://xmlbeans.apache.org/samples/any";
/**
* Receives <root> XML instance, executing methods that
* edit the received instance or create a new one.
*
* @param args An array in which the first item is a
* path to the XML instance file.
*/
public static void main(String[] args)
{
Any thisSample = new Any();
System.out.println("Running Any.buildDocFromScratch\n");
thisSample.buildDocFromScratch();
RootDocument rootDoc = (RootDocument)thisSample.parseXml(args[0]);
System.out.println("Running Any.editExistingDocWithSelectChildren\n");
thisSample.editExistingDocWithSelectChildren(rootDoc);
System.out.println("Running Any.editExistingDocWithDOM\n");
thisSample.editExistingDocWithDOM(rootDoc);
System.out.println("Running Any.editExistingDocWithSelectPath\n");
thisSample.editExistingDocWithSelectPath(rootDoc);
}
/**
* Creates a new <root> document from scratch.
*
* This method illustrates how you can use XmlCursor instances
* to build XML that is defined in schema as xs:any.
*
* @return <code>true</code> if the new document is valid;
* otherwise, <code>false</code>.
*/
public boolean buildDocFromScratch()
{
// Start by creating a <root> element that will contain
// the children built by this method.
RootDocument rootDoc = RootDocument.Factory.newInstance();
RootDocument.Root root = rootDoc.addNewRoot();
// Add the first element, <stringelement>.
root.setStringelement("some text");
// Create an XmlObject in which to build the second
// element in the sequence, <anyfoo>. Here, the
// XmlObject instance is simply a kind of incubator
// for the XML. Later the XML will be moved into the
// document this code is building.
XmlObject anyFoo = XmlObject.Factory.newInstance();
// Add a cursor to do the work of building the XML.
XmlCursor childCursor = anyFoo.newCursor();
childCursor.toNextToken();
// Add the element in the schema's namespace, then add
// element content.
childCursor.beginElement(new QName(m_namespaceUri, "anyfoo"));
childCursor.insertChars("some text");
// Move the cursor back to the new element's top, where
// it can grab the element's XML.
childCursor.toStartDoc();
childCursor.toNextToken();
// Move the XML into the <root> document by moving it
// from a position at one cursor to a position at
// another.
XmlCursor rootCursor = root.newCursor();
rootCursor.toEndToken();
childCursor.moveXml(rootCursor);
// Add the fourth element, <arrayofany>, by building it
// elsewhere, then moving the new XML into place under
// <root>.
Arrayofany arrayOfAny = root.addNewArrayofany();
if (buildArrayOfAny(arrayOfAny) == null)
{
return false;
}
childCursor.dispose();
rootCursor.dispose();
// Print and validate the result.
System.out.println("Output: The <root> document built from scratch.\n");
System.out.println(rootDoc + "\n");
return validateXml(rootDoc);
}
/**
* Replaces the <anyfoo> element with an <anybar> element in the
* incoming XML.
*
* This method illustrates how you can use the XmlCursor.selectChildren
* method to retrieve child elements whose type is defined as
* xs:any in schema.
*
* @param rootDoc An instance of the <root> XML document.
* @return <code>true</code> if the editing XML is valid;
* otherwise, <code>false</code>.
*/
public boolean editExistingDocWithSelectChildren(RootDocument rootDoc)
{
RootDocument.Root root = rootDoc.getRoot();
// Select the <anyfoo> children of <root>.
XmlObject[] stringElements =
root.selectChildren(new QName(m_namespaceUri, "anyfoo"));
// If the element is there, replace it with another element.
if (stringElements.length > 0)
{
XmlCursor editCursor = stringElements[0].newCursor();
editCursor.removeXml();
editCursor.beginElement(new QName(m_namespaceUri, "anybar"));
editCursor.insertChars("some other text");
editCursor.dispose();
}
System.out.println("Output: The <anyfoo> element has been replaced\n" +
"by an <anybar> element.\n");
System.out.println(rootDoc + "\n");
return validateXml(rootDoc);
}
/**
* Adds a new <bar> element between the first and second
* children of the <arrayofany> element.
*
* This method illustrates how you can use DOM methods to
* retrieve and edit elements whose type is defined as
* xs:any in schema.
*
* @param rootDoc An instance of the <root> XML document.
* @return <code>true</code> if the editing XML is valid;
* otherwise, <code>false</code>.
*/
public boolean editExistingDocWithDOM(RootDocument rootDoc)
{
RootDocument.Root root = rootDoc.getRoot();
// Get the DOM nodes for the <arrayofany> element's children.
Node arrayOfAnyNode = root.getArrayofany().getDomNode();
// You don't have get* accessors for any of the <arrayofany>
// element's children, so use DOM to identify the first
// and second elements while looping through the child list.
NodeList childList = arrayOfAnyNode.getChildNodes();
Element firstElementChild = null;
Element secondElementChild = null;
// Find the first child element and make sure it's
// <stringelement>.
for (int i = 0; i < childList.getLength(); i++)
{
Node node = childList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
if (node.getLocalName().equals("stringelement"))
{
firstElementChild = (Element)node;
break;
}
}
}
if (firstElementChild == null) {return false;}
// Find the second child element and make sure it's
// <someelement>.
Node node = firstElementChild.getNextSibling();
do {
if (node.getNodeType() == Node.ELEMENT_NODE)
{
if (node.getLocalName().equals("someelement"))
{
secondElementChild = (Element)node;
break;
}
}
node = node.getNextSibling();
} while (node != null);
if (secondElementChild == null) {return false;}
// Create and insert a new <bar> element.
Element fooElement =
secondElementChild.getOwnerDocument().createElementNS("http://openuri.org","bar");
Node valueNode =
fooElement.getOwnerDocument().createTextNode("some text");
fooElement.appendChild(valueNode);
arrayOfAnyNode.insertBefore(fooElement, secondElementChild);
System.out.println("Output: <arrayofany> has a new <bar> child element.\n");
System.out.println(rootDoc + "\n");
return validateXml(rootDoc);
}
/**
* Edits incoming <root> XML to make the following changes: replace
* <somelement> with its <stringlist> child; add a new <foo>
* element as the second child of <arrayofany>.
*
* This method illustrates how you can use the selectPath method
* to find an element defined as xs:any in schema, then use
* XmlCursor instances to edit the XML.
*
* @param rootDoc An instance of the <root> XML document.
* @return <code>true</code> if the editing XML is valid;
* otherwise, <code>false</code>.
*/
public boolean editExistingDocWithSelectPath(RootDocument rootDoc)
{
String namespaceDecl = "declare namespace any='" +
m_namespaceUri + "'; ";
XmlCursor selectionCursor = rootDoc.getRoot().getArrayofany().newCursor();
// Save the cursor's position for later, then use XPath
// and cursor movement to position the cursor at
// the <stringlist> element.
selectionCursor.push();
selectionCursor.selectPath(namespaceDecl +
"$this//any:someelement/any:stringlist");
selectionCursor.toNextSelection();
// Create a new cursor and move it to the selection
// cursor's <someelement> parent. Moving the
// <stringlist> element to this position, displacing
// the <someelement> downward, then removing the
// <someelement> XML effectively replaces <someelement>
// with <stringlist>.
XmlCursor editCursor = selectionCursor.newCursor();
editCursor.toParent();
selectionCursor.moveXml(editCursor);
editCursor.removeXml();
editCursor.dispose();
// Return the cursor to the <arrayofany> element so you
// can do more editing. Then move the cursor to the second
// child and insert a new element as second child.
selectionCursor.pop();
selectionCursor.toFirstChild();
selectionCursor.toNextSibling();
selectionCursor.beginElement("foo", "http://openuri.org");
selectionCursor.insertChars("some text");
selectionCursor.dispose();
System.out.println("Output: <stringlist> has been promoted to replace \n" +
"<someelement>, and there's a new <foo> element.\n");
System.out.println(rootDoc + "\n");
return validateXml(rootDoc);
}
/**
* Like the code in the buildDocFromScratch method, this code
* uses the XmlCursor to build XML piece by piece, building
* out the Arrayofany instance it receives.
*
* @return A valid <arrayofany> element bound to an
* Arrrayofany instance.
*/
private Arrayofany buildArrayOfAny(Arrayofany arrayOfAny)
{
// Create a simple <stringelement> and move it into place
// under <arrayofany>.
StringelementDocument stringElementDoc =
StringelementDocument.Factory.newInstance();
stringElementDoc.setStringelement("some text");
XmlCursor childCursor = stringElementDoc.newCursor();
childCursor.toFirstContentToken();
// Add a cursor to mark the position at which the new child
// XML will be moved.
XmlCursor arrayCursor = arrayOfAny.newCursor();
arrayCursor.toNextToken();
childCursor.moveXml(arrayCursor);
childCursor.dispose();
// Create a <someelement> that contains a <stringlist>
// child element, then get the XmlObject representing the new
// <stringlist>. Note that the XmlCursor.beginElement method
// leaves the cursor between START and END tokens -- where
// content can be placed.
arrayCursor.beginElement("someelement", m_namespaceUri);
arrayCursor.beginElement("stringlist", m_namespaceUri);
arrayCursor.toPrevToken();
XmlObject stringList = arrayCursor.getObject();
// The cursor's no longer needed.
arrayCursor.dispose();
// Create the <stringlist> element's value and set it.
ListOfStrings stringListValue = buildListOfStrings();
if (stringListValue == null)
{
return null;
}
stringList.set(stringListValue);
// Validate the new XML.
if (!validateXml(arrayOfAny))
{
return null;
}
return arrayOfAny;
}
/**
* Creates an instance of the ListOfStrings complex type defined
* in the schema. The instance returned by this method can be
* inserted using either a set* operation or a cursor, as in
* {@link #buildArrayOfAny()}.
*
* @return A valid instance of ListOfStrings.
*/
private ListOfStrings buildListOfStrings()
{
// Create an instance of the ListOfStrings complex type.
ListOfStrings stringList = ListOfStrings.Factory.newInstance();
stringList.setId("001");
// Add two children for the instance's root.
XmlString stringElement = stringList.addNewStringelement();
stringElement.setStringValue("string1");
stringElement = stringList.addNewStringelement();
stringElement.setStringValue("string2");
// Validate the new XML.
if (!validateXml(stringList))
{
return null;
}
return stringList;
}
/**
* <p>Validates the XML, printing error messages when the XML is invalid. Note
* that this method will properly validate any instance of a compiled schema
* type because all of these types extend XmlObject.</p>
*
* <p>Note that in actual practice, you'll probably want to use an assertion
* when validating if you want to ensure that your code doesn't pass along
* invalid XML. This sample prints the generated XML whether or not it's
* valid so that you can see the result in both cases.</p>
*
* @param xml The XML to validate.
* @return <code>true</code> if the XML is valid; otherwise, <code>false</code>
*/
public static boolean validateXml(XmlObject xml)
{
boolean isXmlValid = false;
// A collection instance to hold validation error messages.
ArrayList validationMessages = new ArrayList();
// Validate the XML, collecting messages.
isXmlValid = xml.validate(
new XmlOptions().setErrorListener(validationMessages));
// If the XML isn't valid, print the messages.
if (!isXmlValid)
{
printErrors(validationMessages);
}
return isXmlValid;
}
/**
* Receives the collection containing errors found during
* validation and print the errors to the console.
*
* @param validationErrors The validation errors.
*/
public static void printErrors(ArrayList validationErrors)
{
Iterator iter = validationErrors.iterator();
while (iter.hasNext())
{
System.out.println(">> " + iter.next() + "\n");
}
}
/**
* <p>Creates a File from the XML path provided in main arguments, then
* parses the file's contents into a type generated from schema.</p>
* <p/>
* <p>Note that this work might have been done in main. Isolating it here
* makes the code separately available from outside this class.</p>
*
* @param xmlFilePath A path to XML based on the schema in inventory.xsd.
* @return An instance of a generated schema type that contains the parsed
* XML.
*/
public XmlObject parseXml(String xmlFilePath)
{
File xmlFile = new File(xmlFilePath);
XmlObject xml = null;
try
{
xml = XmlObject.Factory.parse(xmlFile);
} catch (XmlException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
return xml;
}
}

View File

@ -1,45 +0,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.
*/
package org.apache.xmlbeans.samples.anytype;
import org.apache.xmlbeans.samples.any.RootDocument;
/**
* A class with which to test the Any sample.
*/
public class AnyTest
{
/**
* Tests the Any sample.
*/
public static void main(String[] args)
{
Any sample = new Any();
boolean newDocIsValid = sample.buildDocFromScratch();
// assert !newDocIsValid;
RootDocument rootDoc = (RootDocument)sample.parseXml(args[0]);
boolean domEditsAreValid = sample.editExistingDocWithDOM(rootDoc);
// assert !domEditsAreValid;
boolean selectPathEditsAreValid = sample.editExistingDocWithSelectPath(rootDoc);
// assert !selectPathEditsAreValid;
boolean selectChildrenEditsAreValid = sample.editExistingDocWithSelectChildren(rootDoc);
// assert !selectChildrenEditsAreValid;
}
}

View File

@ -1,28 +0,0 @@
<?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.-->
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlbeans.apache.org/samples/any">
<stringelement>some text</stringelement>
<anyfoo>some text</anyfoo>
<arrayofany>
<stringelement>some text</stringelement>
<someelement>
<stringlist id="001">
<stringelement>string1</stringelement>
<stringelement>string2</stringelement>
</stringlist>
</someelement>
</arrayofany>
</root>

View File

@ -1,47 +0,0 @@
Sample: DateTime
Author: Rashmi Banthia (rjain29@gmail.com)
Last Updated: Oct. 11, 2004
Versions:
xmlbeans-1.0.3
-----------------------------------------------------------------------------
This sample demonstrates how you can work with XML Schema primitive types date,
dateTime, time, duration, gDay.
This sample illustrates how you can
(1) Convert org.apache.xmlbeans.XmlDate to java.util.Calendar,org.apache.xmlbeans.GDate, java.util.Date
(2) Convert org.apache.xmlbeans.XmlTime to java.util.Calendar,org.apache.xmlbeans.GDate, java.util.Date
(3) Convert org.apache.xmlbeans.XmlDuration to org.apache.xmlbeans.GDuration
(4) Convert org.apache.xmlbeans.XmlGday to java.util.Calendar,org.apache.xmlbeans.GDate, Day - primitive java int
(5) Get/Set XML Schema primitive types date, dateTime, time, duration, and gDay.
XMLBean Types provide mapping between natural Java classes and W3C Schema types.
For eg:
Schema Type Formal Class Natural Java Class
xs:date XmlDate java.util.Calendar (XmlCalendar)
xs:duration XmlDuration org.apache.xmlbeans.GDuration
xs:dateTime XmlDateTime java.util.Calendar (XmlCalendar)
xs:time XmlTime java.util.Calendar (XmlCalendar)
The XmlCalendar is a subclass of GregorianCalendar that modifies several key
details in the behavior of GregorianCalendar to make it more useful when
dealing with XML dates.
When you run this sample:
(1) It will print element values using different formats ie. Calendar, Date, GDate. Please
note it prints only first occurence of element's value for the purpose of simplicity.
(2) It will create a new <important-date> element and saves the same in a XML Document.
To try out this sample:
1. Set XMLBEANS_HOME in your environment
2. Ant must be on your PATH
3. To compile the schemas and sample source, run "ant build"
4. To execute the sample, run "ant run"

View File

@ -1,121 +0,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.
-->
<project name="DateTime" default="build">
<property environment="env"/>
<path id="DateTime.path">
<path refid="xmlbeans.path"/>
<fileset dir="build/lib" includes="*.jar"/>
<pathelement path="build/classes"/>
</path>
<target name="init">
<property name="xmlbeans.home" value="${env.XMLBEANS_HOME}"/>
<echo message="xmlbeans.home: ${xmlbeans.home}"/>
<!-- check for xbean.jar from binary distribution -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/lib"
file="${xmlbeans.home}/lib/xbean.jar" />
<!-- check for xbean.jar compiled from source -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/build/lib"
file="${xmlbeans.home}/build/lib/xbean.jar" />
<fail message="Set XMLBEANS_HOME in your enviornment."
unless="xmlbeans.lib"/>
<echo message="xmlbeans.lib: ${xmlbeans.lib}"/>
<path id="xmlbeans.path">
<fileset dir="${xmlbeans.lib}" includes="*.jar"/>
</path>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xmlbeans.path"/>
</target>
<!-- ========================== clean ==== -->
<target name="clean">
<delete dir="build"/>
</target>
<!-- ========================== build ==== -->
<target name="build" depends="init,schemas.jar,DateTime.classes">
</target>
<target name="schemas.check">
<uptodate property="schemas.notRequired"
targetfile="build/lib/schemas.jar">
<srcfiles dir="schemas" includes="**/*.xsd"/>
</uptodate>
</target>
<target name="schemas.jar" depends="init,schemas.check"
unless="schemas.notRequired">
<mkdir dir="build/lib"/>
<xmlbean schema="schemas"
destfile="build/lib/schemas.jar"
srcgendir="build/src"
classpathref="xmlbeans.path"
debug="on"
/>
</target>
<target name="DateTime.classes" depends="init">
<mkdir dir="build/classes"/>
<javac srcdir="src"
destdir="build/classes"
classpathref="DateTime.path"
debug="on"
source="1.4"
/>
</target>
<!-- ========================== run ==== -->
<target name="run" depends="init,build">
<echo message="============================== running DateTime"/>
<java
classname="org.apache.xmlbeans.samples.datetime.DateTime"
classpathref="DateTime.path"
fork="true">
<arg line="xml/datetimesample.xml xml/newdatetimesample.xml"/>
</java>
</target>
<!-- ========================== test ==== -->
<target name="test" depends="init,build">
<echo message="============================== testing DateTime"/>
<java
classname="org.apache.xmlbeans.samples.datetime.DateTimeTest"
classpathref="DateTime.path"
fork="true">
<arg line="xml/datetimesample.xml xml/newdatetimesample.xml"/>
</java>
</target>
</project>

View File

@ -1,42 +0,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.
-->
<xs:schema targetNamespace="http://xmlbeans.apache.org/samples/datetime"
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
xmlns:dt = "http://xmlbeans.apache.org/samples/datetime"
elementFormDefault="qualified" >
<xs:element name="datetime">
<xs:complexType>
<xs:sequence>
<xs:element name="important-date" type="dt:important-date" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="important-date" >
<xs:sequence>
<xs:element name="holiday" type="xs:date" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="fun-begin-time" type="xs:time" minOccurs="1" maxOccurs="1" />
<xs:element name="fun-end-time" type="xs:time" minOccurs="1" maxOccurs="1" />
<xs:element name="job-duration" type="xs:duration" minOccurs="1" maxOccurs="1" />
<xs:element name="birthdatetime" type="xs:dateTime" minOccurs="1" maxOccurs="1" />
<xs:element name="payday" type="xs:gDay" minOccurs="1" maxOccurs="1" />
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -1,308 +0,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.
*/
package org.apache.xmlbeans.samples.datetime;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.ArrayList;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlError;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.GDuration;
import org.apache.xmlbeans.XmlDate;
import org.apache.xmlbeans.XmlCalendar;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.xmlbeans.samples.datetime.ImportantDate;
import org.apache.xmlbeans.samples.datetime.DatetimeDocument;
/**
* The sample illustrates how you can work with XML Schema types date,
* dateTime, time, duration, gDay.
* It parses the XML Document, prints first occurence of <important-date>
* value, creates a new <important-date> element and saves it in a new XML Document.
* This sample illustrates how you can convert XMLBean types to Java types
* (java.util.Date, java.util.Calendar).
* It uses the schema defined in datetime.xsd.
*/
public class DateTime {
/**
* Receives an XML Instance and prints the element values,
* Also creates a new XML Instance.
*
* @param args An array containing
* (a)Path to the XML Instance conforming to the XML schema in datetime.xsd.
* (b)Path for creating a new XML Instance.
*/
public static void main(String args[]){
// Create an instance of this class to work with.
DateTime dt = new DateTime();
// Create an instance of a Datetime type based on the received XML's schema
DatetimeDocument doc = dt.parseXml(args[0]);
// Prints the element values from the XML
dt.printInstance(doc);
// Creates a new XML and saves the file
dt.createDocument(doc,args[1]);
}
/**
* Creates a File from the XML path provided in main arguments, then
* parses the file's contents into a type generated from schema.
*/
public DatetimeDocument parseXml(String file){
// Get the XML instance into a file using the path provided.
File xmlfile = new File(file);
// Create an instance of a type generated from schema to hold the XML.
DatetimeDocument doc = null;
try {
// Parse the instance into the type generated from the schema.
doc = DatetimeDocument.Factory.parse(xmlfile);
}
catch(XmlException e){
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
return doc;
}
/**
* This method prints first occurence of <important-date>
* value. It also prints converted values from XMLBean types to Java types
* (java.util.Date, java.util.Calendar) and org.apache.xmlbeans.GDate.
*/
public void printInstance(DatetimeDocument doc){
// Retrieve the <datetime> element and get an array of
// the <important-date> elements it contains.
DatetimeDocument.Datetime dtelement = doc.getDatetime();
ImportantDate[] impdate = dtelement.getImportantDateArray();
// Loop through the <important-date> elements, printing the
// values for each.
for (int i=0;i<impdate.length;i++){
//For purpose of simplicity in output, only first occurrence is printed.
if (i==0){
//Retrieving all <holiday> elements within <important-date> element
XmlDate[] holiday = impdate[i].xgetHolidayArray();
System.out.println("Holiday(xs:date): ");
for (int j=0;j<holiday.length;j++){
if (j==0){
//XmlDate to java.util.Calendar,org.apache.xmlbeans.GDate, java.util.Date
System.out.println("Calendar:" + holiday[j].getCalendarValue() );
System.out.println("Date:"+holiday[j].getDateValue() );
System.out.println("GDate:"+holiday[j].getGDateValue() +"\n");
}
}
//XmlTime to java.util.Calendar, org.apache.xmlbeans.GDate, java.util.Date
System.out.println("Fun Begin Time(xs:time): ");
System.out.println("Calendar:"+impdate[i].getFunBeginTime());
System.out.println("GDate:"+impdate[i].xgetFunBeginTime().getGDateValue() );
//To convert java.util.Calendar to java.util.Date
SimpleDateFormat sdf = new SimpleDateFormat("H:mm:ss");
Date dt = impdate[i].getFunBeginTime().getTime();
System.out.println("Date:"+ sdf.format(dt) +"\n" );
//XmlDuration to org.apache.xmlbeans.GDuration
System.out.println("Job Duration(xs:duration): ");
System.out.println("GDuration:"+impdate[i].getJobDuration() +"\n" );
//XmlDate to Calendar,GDate, Date
System.out.println("Birth DateTime(xs:dateTime): ");
System.out.println("Calendar:"+impdate[i].getBirthdatetime());
System.out.println("Date:"+impdate[i].xgetBirthdatetime().getDateValue());
System.out.println("GDate:"+impdate[i].xgetBirthdatetime().getGDateValue() +"\n" );
//XmlGday to Calendar,GDate, Day - primitive java int
System.out.println("Pay Day(xs:gDay): ");
System.out.println("Calendar:"+impdate[i].getPayday());
System.out.println("GDate:"+impdate[i].xgetPayday().getGDateValue());
System.out.println("Day:"+ impdate[i].xgetPayday().getGDateValue().getDay() +"\n" );
System.out.println("\n\n");
}
}
}
/**
* This method creates an new <important-date> element and attaches to the existing XML Instance, and saves the
* new Instance to a file(args[1]).
*/
public void createDocument(DatetimeDocument doc , String file){
// Retrieve the <datetime> element and add a new <important-date> element.
DatetimeDocument.Datetime dtelement = doc.getDatetime();
//
// add an important date using XmlCalendar
//
ImportantDate impdate = dtelement.addNewImportantDate();
//Creating value for <holiday> element
Calendar holiday = new XmlCalendar("2004-07-04");
//Creating value for <fun-begin-time> element
Calendar funbegintime = new XmlCalendar("10:30:33");
//Creating value for <fun-end-time> element
Calendar funendtime = new XmlCalendar("12:40:12");
//Creating value for <birthdatetime> element
Calendar birthdatetime = new XmlCalendar("1977-11-29T10:10:12");
//Creating value for <job-duration> element
GDuration jobduration = new GDuration(1,2,4,5,10,12,15,null);
//Creating value for <payday> element
Calendar payday = new XmlCalendar("---12");
//Setting all the elements
impdate.addHoliday(holiday);
impdate.setFunBeginTime(funbegintime);
impdate.setFunEndTime(funendtime);
impdate.setJobDuration(jobduration);
impdate.setBirthdatetime(birthdatetime);
impdate.setPayday(payday);
impdate.setDescription("Using XmlCalendar");
//
// add another important date using Calendar
//
impdate = dtelement.addNewImportantDate();
//Creating value for <holiday> element using XmlCalendar
holiday = new XmlCalendar("2004-07-04");
//Creating value for <fun-begin-time> element using GregorianCalendar
funbegintime = Calendar.getInstance();
funbegintime.clear();
funbegintime.set(Calendar.AM_PM , Calendar.AM);
funbegintime.set(Calendar.HOUR, 10);
funbegintime.set(Calendar.MINUTE, 30 );
funbegintime.set(Calendar.SECOND, 35 );
//Creating value for <fun-end-time> element
funendtime = Calendar.getInstance();
funendtime.clear();
funendtime.set(Calendar.AM_PM , Calendar.AM);
funendtime.set(Calendar.HOUR, 12);
funendtime.set(Calendar.MINUTE, 40 );
funendtime.set(Calendar.SECOND, 12 );
//Creating value for <birthdatetime> element
birthdatetime = Calendar.getInstance();
birthdatetime.clear();
birthdatetime.set(1977,10,29,10,10,12);
//Creating value for <job-duration> element
jobduration = new GDuration(1,2,4,5,10,12,15,null);
//Creating value for <payday> element
payday = Calendar.getInstance();
payday.clear();
payday.set(Calendar.DAY_OF_MONTH,12);
//Setting all the elements
impdate.addHoliday(holiday);
impdate.setFunBeginTime(funbegintime);
impdate.setFunEndTime(funendtime);
impdate.setJobDuration(jobduration);
impdate.setBirthdatetime(birthdatetime);
impdate.setPayday(payday);
impdate.setDescription("Using Calendar");
XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSavePrettyPrint();
// Validate the new XML
boolean isXmlValid = validateXml(doc);
if (isXmlValid) {
File f = new File(file);
try{
//Writing the XML Instance to a file.
doc.save(f,xmlOptions);
}
catch(IOException e){
e.printStackTrace();
}
System.out.println("\nXML Instance Document saved at : " + f.getPath());
}
}
/**
* <p>Validates the XML, printing error messages when the XML is invalid. Note
* that this method will properly validate any instance of a compiled schema
* type because all of these types extend XmlObject.</p>
*
* <p>Note that in actual practice, you'll probably want to use an assertion
* when validating if you want to ensure that your code doesn't pass along
* invalid XML. This sample prints the generated XML whether or not it's
* valid so that you can see the result in both cases.</p>
*
* @param xml The XML to validate.
* @return <code>true</code> if the XML is valid; otherwise, <code>false</code>
*/
public boolean validateXml(XmlObject xml)
{
boolean isXmlValid = false;
// A collection instance to hold validation error messages.
ArrayList validationMessages = new ArrayList();
// Validate the XML, collecting messages.
isXmlValid = xml.validate(new XmlOptions().setErrorListener(validationMessages));
if (!isXmlValid)
{
System.out.println("Invalid XML: ");
for (int i = 0; i < validationMessages.size(); i++)
{
XmlError error = (XmlError) validationMessages.get(i);
System.out.println(error.getMessage());
System.out.println(error.getObjectLocation());
}
}
return isXmlValid;
}
}

View File

@ -1,49 +0,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.
*/
package org.apache.xmlbeans.samples.datetime;
import org.apache.xmlbeans.samples.datetime.DatetimeDocument ;
/**
* A class with which to test the DateTime sample.
*/
public class DateTimeTest
{
/**
* Tests the DateTime sample.
*
* @param args An array in which the first item is a path to an XML file
* based on the schema in datetime.xsd.
*/
public static void main(String[] args)
{
// Create an instance of this sample to work with.
DateTime sample = new DateTime();
// Create an schema type instance from the XML indicated by the path.
DatetimeDocument doc = sample.parseXml(args[0]);
sample.printInstance(doc);
// Validate the XML.
boolean exampleIsValid = sample.validateXml(doc);
assert exampleIsValid;
//Creating a new XML document
sample.createDocument(doc,args[1]);
}
}

View File

@ -1,37 +0,0 @@
<?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.
-->
<datetime xmlns="http://xmlbeans.apache.org/samples/datetime">
<important-date>
<holiday>2004-11-02</holiday>
<fun-begin-time>18:00:00</fun-begin-time>
<fun-end-time>23:00:00</fun-end-time>
<job-duration>P1Y1DT20H25M30S</job-duration>
<birthdatetime>2001-04-16T15:23:15</birthdatetime>
<payday>---15</payday>
<description>2nd-Nov-2004, 6:00PM, 11:00PM, 1Yr and a day - 20hours, 16th Apr 2001 3:23 and 15 seconds</description>
</important-date>
<important-date>
<holiday>2004-07-04</holiday>
<fun-begin-time>10:30:35</fun-begin-time>
<fun-end-time>12:40:12</fun-end-time>
<job-duration>P2Y4M5DT10H12M15S</job-duration>
<birthdatetime>1977-11-29T10:10:12</birthdatetime>
<payday>---30</payday>
<description>Description</description>
</important-date>
</datetime>
<!-- Professional XML pgno.201 = duration = 11Y0M1DT20:25:30 -->

View File

@ -1,53 +0,0 @@
<?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.-->
<datetime xmlns="http://xmlbeans.apache.org/samples/datetime">
<important-date>
<holiday>2004-11-02</holiday>
<fun-begin-time>18:00:00</fun-begin-time>
<fun-end-time>23:00:00</fun-end-time>
<job-duration>P1Y1DT20H25M30S</job-duration>
<birthdatetime>2001-04-16T15:23:15</birthdatetime>
<payday>---15</payday>
<description>2nd-Nov-2004, 6:00PM, 11:00PM, 1Yr and a day - 20hours, 16th Apr 2001 3:23 and 15 seconds</description>
</important-date>
<important-date>
<holiday>2004-07-04</holiday>
<fun-begin-time>10:30:35</fun-begin-time>
<fun-end-time>12:40:12</fun-end-time>
<job-duration>P2Y4M5DT10H12M15S</job-duration>
<birthdatetime>1977-11-29T10:10:12</birthdatetime>
<payday>---30</payday>
<description>Description</description>
</important-date>
<important-date>
<holiday>2004-07-04</holiday>
<fun-begin-time>10:30:33</fun-begin-time>
<fun-end-time>12:40:12</fun-end-time>
<job-duration>P2Y4M5DT10H12M15S</job-duration>
<birthdatetime>1977-11-29T10:10:12</birthdatetime>
<payday>---12</payday>
<description>Using XmlCalendar</description>
</important-date>
<important-date>
<holiday>2004-07-04</holiday>
<fun-begin-time>10:30:35</fun-begin-time>
<fun-end-time>12:40:12</fun-end-time>
<job-duration>P2Y4M5DT10H12M15S</job-duration>
<birthdatetime>1977-11-29T10:10:12</birthdatetime>
<payday>---12</payday>
<description>Using Calendar</description>
</important-date>
</datetime>
<!--Professional XML pgno.201 = duration = 11Y0M1DT20:25:30-->

View File

@ -1,34 +0,0 @@
Sample: MixedContent
Author: Steven Traut (straut@bea.com)
Last Updated: Sept. 6, 2004
Versions:
xmlbeans-1.0.3
xmlbeans-v2
-----------------------------------------------------------------------------
This sample illustrates how you can work with mixed content XML by combining
strong types generated from schema with an XmlCursor instance. The XmlCursor
interface is provided with XMLBeans for just this kind of use. With strong types
you can only get or set the full value of an element; by using a cursor you can
"dive into" the contents of an element, manipulating child elements that are
embedded in the content and surrounded by other text.
The sample's XML is a pseudo-inventory of nonsensical items, each with a unique
ID and a description. Where the name of one item is mentioned in the description
of another, the sample code wraps the name with a <link> element whose id
attribute is the ID of the named item.
When you run this sample, you'll see it print potentially three blocks of
information:
- The XML it got from the inventoryitems.xml file.
- The XML it generated by associating cross-mentioned items.
- The results from validating the resulting XML, if the XML is invalid.
To try out this sample:
1. Set XMLBEANS_HOME in your environment
2. Ant must be on your PATH
3. To compile the schemas and sample source, run "ant build"
4. To execute the sample, run "ant run"

View File

@ -1,120 +0,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.
-->
<project name="MixedContent" default="build">
<property environment="env"/>
<path id="MixedContent.path">
<path refid="xmlbeans.path"/>
<fileset dir="build/lib" includes="*.jar"/>
<pathelement path="build/classes"/>
</path>
<target name="init">
<property name="xmlbeans.home" value="${env.XMLBEANS_HOME}"/>
<echo message="xmlbeans.home: ${xmlbeans.home}"/>
<!-- check for xbean.jar from binary distribution -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/lib"
file="${xmlbeans.home}/lib/xbean.jar" />
<!-- check for xbean.jar compiled from source -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/build/lib"
file="${xmlbeans.home}/build/lib/xbean.jar" />
<fail message="Set XMLBEANS_HOME in your enviornment."
unless="xmlbeans.lib"/>
<echo message="xmlbeans.lib: ${xmlbeans.lib}"/>
<path id="xmlbeans.path">
<fileset dir="${xmlbeans.lib}" includes="*.jar"/>
</path>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xmlbeans.path"/>
</target>
<!-- ========================== clean ==== -->
<target name="clean">
<delete dir="build"/>
</target>
<!-- ========================== build ==== -->
<target name="build" depends="init,schemas.jar,MixedContent.classes">
</target>
<target name="schemas.check">
<uptodate property="schemas.notRequired"
targetfile="build/lib/schemas.jar">
<srcfiles dir="schemas" includes="**/*.xsd"/>
</uptodate>
</target>
<target name="schemas.jar" depends="init,schemas.check"
unless="schemas.notRequired">
<mkdir dir="build/lib"/>
<xmlbean schema="schemas"
destfile="build/lib/schemas.jar"
srcgendir="build/src"
classpathref="xmlbeans.path"
debug="on"
/>
</target>
<target name="MixedContent.classes" depends="init">
<mkdir dir="build/classes"/>
<javac srcdir="src"
destdir="build/classes"
classpathref="MixedContent.path"
debug="on"
source="1.4"
/>
</target>
<!-- ========================== run ==== -->
<target name="run" depends="init,build">
<echo message="============================== running MixedContent"/>
<java
classname="org.apache.xmlbeans.samples.cursor.MixedContent"
classpathref="MixedContent.path"
fork="true">
<arg line="xml/inventoryitems.xml"/>
</java>
</target>
<!-- ========================== test ==== -->
<target name="test" depends="init,build">
<echo message="============================== testing MixedContent"/>
<java
classname="org.apache.xmlbeans.samples.cursor.MixedContentTest"
classpathref="MixedContent.path"
fork="true">
<arg line="xml/inventoryitems.xml"/>
</java>
</target>
</project>

View File

@ -1,49 +0,0 @@
<?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://xmlbeans.apache.org/samples/cursor/mixedcontent"
xmlns:mc="http://xmlbeans.apache.org/samples/cursor/mixedcontent"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:complexType name="descriptionType" mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="link" type="mc:linkType"/>
</xs:choice>
</xs:complexType>
<xs:element name="inventory">
<xs:complexType>
<xs:sequence>
<xs:element name="item" type="mc:itemType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="itemType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="mc:descriptionType"/>
<xs:element name="price" type="xs:double"/>
<xs:element name="quantity" type="xs:int"/>
</xs:sequence>
<xs:attribute name="id" type="xs:int" use="required"/>
</xs:complexType>
<xs:complexType name="linkType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:int" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@ -1,263 +0,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
*
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Unless required by applicable law or agreed to in writing, software
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.xmlbeans.samples.cursor;
import org.apache.xmlbeans.*;
import org.apache.xmlbeans.samples.cursor.mixedcontent.DescriptionType;
import org.apache.xmlbeans.samples.cursor.mixedcontent.InventoryDocument;
import org.apache.xmlbeans.samples.cursor.mixedcontent.ItemType;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
/**
* <p>This sample illustrates how you can use an XML cursor
* to manipulate the content of an element. Even though
* working with strongly-typed XML (in which you are accessing
* the XML through an API generated from schema) provides easy
* access for getting and setting the entire value of an
* element or attribute, it does not easily provide finer
* grained access to an element's content. This sample
* shows how you can use an XML cursor to "dive into" an
* element's content, manipulating it on a character-by-
* character level.</p>
* <p/>
* <p>The code in this sample is designed to look at the
* description of each item in an inventory list, creating
* a link wherever the description contains a reference
* to another item in the inventory list. This alters the
* &lt;description&gt; element so that it contains a mix of text and
* link elements. Such an element is said to have "mixed
* content."</p>
* <p/>
* This sample uses the schema defined in inventory.xsd.
*/
public class MixedContent
{
/**
* Receives an inventory XML instance and rewrites it so that items listed
* in the inventory point to one another via &lt;link&gt; elements.
*
* @param args An array containing one argument: the path to an XML instance
* conforming to the schema in inventory.xsd.
*/
public static void main(String[] args)
{
// Create an instance of this sample to work with.
MixedContent thisSample = new MixedContent();
// Create an schema type instance from the XML indicated by the path.
InventoryDocument inventoryDoc = thisSample.parseXml(args[0]);
// Print what was received.
System.out.println("Received XML: \n\n" + inventoryDoc.toString());
// Edit the XML, adding <link> elements to associate related items.
InventoryDocument linkedResultDoc = thisSample.linkItems(inventoryDoc);
// Print the updated XML.
System.out.println("XML with linked items: \n\n" + linkedResultDoc.toString());
// Validate the result.
System.out.println("New XML is valid: " +
thisSample.validateXml(linkedResultDoc));
}
/**
* <p>Creates "links" between items in an inventory list by inserting
* a &lt;link&gt; element for each linked item. An XmlCursor
* instance passes through each &lt;description&gt; element, looking
* for text matching the name of an item.</p>
*
* @param inventoryDoc An XML document conforming to the schema in
* inventory.xsd.
*/
public InventoryDocument linkItems(InventoryDocument inventoryDoc)
{
// Retrieve the &lt;inventory&gt; element and get an array of
// the &lt;item&gt; elements it contains.
InventoryDocument.Inventory inventory = inventoryDoc.getInventory();
ItemType[] items = inventory.getItemArray();
// Loop through the &lt;item&gt; elements, examining the
// description for each to see if another inventory item
// is mentioned.
for (int i = 0; i < items.length; i++)
{
// Get details about the current item, including
// its length. This will be used to measure text
// while exploring the description.
String itemName = items[i].getName();
String itemId = new Integer(items[i].getId()).toString();
int itemCharCount = itemName.length();
// Loop through the item descriptions, looking at each
// for the name of the current item.
for (int j = 0; j < items.length; j++)
{
DescriptionType description = items[j].getDescription();
// Insert an XmlCursor instance and set it at
// the beginning of the <&lt;description&gt; element's text,
// just after the start tag.
XmlCursor cursor = description.newCursor();
cursor.toLastAttribute();
cursor.toNextToken();
// Get a String containing the characters to the
// immediate right of the cursor, up to the next
// token (in this case, the next element after
// the description element). Get the number of
// characters to the right of the cursor; this will
// be used to mark the distance the cursor should move
// before trying another item's description. Also,
// create a charCount variable to mark the cursor's
// current position.
String cursorChars = cursor.getChars();
int descCharCount = cursorChars.length();
int charCount = 0;
// As long at the cursor hasn't reached the end of the
// description text, check to see if the text to the
// cursor's immediate right matches the item name sought.
// If it does match, remove the text and create a link
// element to replace it.
while (charCount < descCharCount)
{
// A char array to hold the characters currently being
// checked.
char[] chars = new char[itemCharCount];
// Pass the char array with the getChars method. This
// method will find the chars from the cursor's
// immediate right to the char at itemCharCount (the
// length of the item name currently sought). The
// method's second argument indicates where in the char
// array the found text should begin -- in this case, at the
// beginning.
int charsReturned = cursor.getChars(chars, 0, itemCharCount);
// If the characters in chars match the item name, then
// make a link from the text.
if (new String(chars).equals(itemName))
{
// Remove the found item name.
cursor.removeChars(itemCharCount);
// Begin a new link element whose namespace is the
// same as the rest of the inventory document. The
// beginElement method creates a new element with the
// name specified around the current cursor.
cursor.beginElement("link",
"http://xmlbeans.apache.org/samples/cursor/mixedcontent");
// Insert an id attribute and make its value the id of
// the item sought.
cursor.insertAttributeWithValue("id", itemId);
// Insert the item name as the element's value.
cursor.insertChars(itemName);
}
// Move on to the next character in the description.
cursor.toNextChar(1);
// Increment the counter tracking the cursor's position.
charCount++;
}
// Be sure to dispose of a cursor that's no longer needed.
// This allows it to be garbage collected.
cursor.dispose();
}
}
// Return the edited document.
return inventoryDoc;
}
/**
* <p>Validates the XML, printing error messages when the XML is invalid. Note
* that this method will properly validate any instance of a compiled schema
* type because all of these types extend XmlObject.</p>
*
* <p>Note that in actual practice, you'll probably want to use an assertion
* when validating if you want to ensure that your code doesn't pass along
* invalid XML. This sample prints the generated XML whether or not it's
* valid so that you can see the result in both cases.</p>
*
* @param xml The XML to validate.
* @return <code>true</code> if the XML is valid; otherwise, <code>false</code>
*/
public boolean validateXml(XmlObject xml)
{
boolean isXmlValid = false;
// A collection instance to hold validation error messages.
ArrayList validationMessages = new ArrayList();
// Validate the XML, collecting messages.
isXmlValid = xml.validate(
new XmlOptions().setErrorListener(validationMessages));
// If the XML isn't valid, print the messages.
if (!isXmlValid)
{
System.out.println("Invalid XML: ");
for (int i = 0; i < validationMessages.size(); i++)
{
XmlError error = (XmlError) validationMessages.get(i);
System.out.println(error.getMessage());
System.out.println(error.getObjectLocation());
}
}
return isXmlValid;
}
/**
* <p>Creates a File from the XML path provided in main arguments, then
* parses the file's contents into a type generated from schema.</p>
*
* <p>Note that this work might have been done in main. Isolating it here
* makes the code separately available from outside this class.</p>
*
* @param xmlFilePath A path to XML based on the schema in inventory.xsd.
* @return An instance of a generated schema type that contains the parsed
* XML.
*/
public InventoryDocument parseXml(String xmlFilePath)
{
// Get the XML instance into a file using the path provided.
File inventoryFile = new File(xmlFilePath);
// Create an instance of a type generated from schema to hold the XML.
InventoryDocument inventoryDoc = null;
try
{
// Parse the instance into the type generated from the schema.
inventoryDoc = InventoryDocument.Factory.parse(inventoryFile);
} catch (XmlException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
return inventoryDoc;
}
}

View File

@ -1,50 +0,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.
*/
package org.apache.xmlbeans.samples.cursor;
import org.apache.xmlbeans.samples.cursor.mixedcontent.InventoryDocument;
/**
* A class with which to test the MixedContent sample.
*/
public class MixedContentTest
{
/**
* Tests the MixedContent sample.
*
* @param args An array in which the first item is a path to an XML file
* based on the schema in inventory.xsd.
*/
public static void main(String[] args)
{
// Create an instance of this sample to work with.
MixedContent sample = new MixedContent();
// Create an schema type instance from the XML indicated by the path.
InventoryDocument inventoryDoc = sample.parseXml(args[0]);
// Validate the XML.
boolean exampleIsValid = sample.validateXml(inventoryDoc);
assert exampleIsValid;
// Edit the XML, adding <link> elements to associate related items.
InventoryDocument linkedResultDoc = sample.linkItems(inventoryDoc);
// Validate the XML.
boolean newXmlIsValid = sample.validateXml(linkedResultDoc);
assert newXmlIsValid;
}
}

View File

@ -1,36 +0,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.
-->
<inventory xmlns="http://xmlbeans.apache.org/samples/cursor/mixedcontent">
<item id="897946">
<name>locking flange harbinger</name>
<description>Completely myopic gyrating mill-flange.</description>
<price>21.79</price>
<quantity>4594</quantity>
</item>
<item id="745621">
<name>protaic calliphange</name>
<description>Asymmetrical flared-gill spongimass. Complements the locking flange harbinger
with perfect precision.</description>
<price>19.95</price>
<quantity>2</quantity>
</item>
<item id="784269">
<name>gyrating mill-flange</name>
<description>Polymorphic atrophical mylobium. Not compatible with any other device ever made.</description>
<price>.99</price>
<quantity>1205987</quantity>
</item>
</inventory>

View File

@ -1,29 +0,0 @@
Sample: MixedContent
Author: Eric Vasilik (ericvas@bea.com)
Last Updated: Oct. 28, 2004
Versions:
xmlbeans-1.0.3
xmlbeans-v2
-----------------------------------------------------------------------------
This samples gives an quick overview of how to use XmlBeans with both the
strongly typed XmlObjects (StatementDocument, Transaction) and with the
XmlCursor.
In the sample, a instance of a statement is iterated over twice --
once using the strongly typed array approach and once with an XmlCursor. When
walking over the array the programmer naivly adds up deposit amounts before
the withdrawal amounts. The end result is a positive balance. When walking
over the array using XmlCursor, the transaction amounts are processed in order
and the end result is a negative balance.
In this situation, the order of the xml elements matters!
To try out this sample:
1. Set XMLBEANS_HOME in your environment
2. Ant must be on your PATH
3. To compile the schemas and sample source, run "ant build"
4. To execute the sample, run "ant run"

View File

@ -1,120 +0,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.
-->
<project name="OrderMatters" default="build">
<property environment="env"/>
<path id="OrderMatters.path">
<path refid="xmlbeans.path"/>
<fileset dir="build/lib" includes="*.jar"/>
<pathelement path="build/classes"/>
</path>
<target name="init">
<property name="xmlbeans.home" value="${env.XMLBEANS_HOME}"/>
<echo message="xmlbeans.home: ${xmlbeans.home}"/>
<!-- check for xbean.jar from binary distribution -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/lib"
file="${xmlbeans.home}/lib/xbean.jar" />
<!-- check for xbean.jar compiled from source -->
<available
property="xmlbeans.lib"
value="${xmlbeans.home}/build/lib"
file="${xmlbeans.home}/build/lib/xbean.jar" />
<fail message="Set XMLBEANS_HOME in your enviornment."
unless="xmlbeans.lib"/>
<echo message="xmlbeans.lib: ${xmlbeans.lib}"/>
<path id="xmlbeans.path">
<fileset dir="${xmlbeans.lib}" includes="*.jar"/>
</path>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="xmlbeans.path"/>
</target>
<!-- ========================== clean ==== -->
<target name="clean">
<delete dir="build"/>
</target>
<!-- ========================== build ==== -->
<target name="build" depends="init,schemas.jar,OrderMatters.classes">
</target>
<target name="schemas.check">
<uptodate property="schemas.notRequired"
targetfile="build/lib/schemas.jar">
<srcfiles dir="schemas" includes="**/*.xsd"/>
</uptodate>
</target>
<target name="schemas.jar" depends="init,schemas.check"
unless="schemas.notRequired">
<mkdir dir="build/lib"/>
<xmlbean schema="schemas"
destfile="build/lib/schemas.jar"
srcgendir="build/src"
classpathref="xmlbeans.path"
debug="on"
/>
</target>
<target name="OrderMatters.classes" depends="init">
<mkdir dir="build/classes"/>
<javac srcdir="src"
destdir="build/classes"
classpathref="OrderMatters.path"
debug="on"
source="1.4"
/>
</target>
<!-- ========================== run ==== -->
<target name="run" depends="init,build">
<echo message="============================== running OrderMatters"/>
<java
classname="org.apache.xmlbeans.samples.cursor.OrderMatters"
classpathref="OrderMatters.path"
fork="true">
<arg line="xml/stmt.xml"/>
</java>
</target>
<!-- ========================== test ==== -->
<target name="test" depends="init,build">
<echo message="============================== testing OrderMatters"/>
<java
classname="org.apache.xmlbeans.samples.cursor.OrderMattersTest"
classpathref="OrderMatters.path"
fork="true">
<arg line="xml/stmt.xml"/>
</java>
</target>
</project>

View File

@ -1,38 +0,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.
-->
<xs:schema
targetNamespace="http://statement"
elementFormDefault="qualified"
xmlns:tns="http://statement"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="statement">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="deposit" type="tns:transaction"/>
<xs:element name="withdrawal" type="tns:transaction"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name="transaction">
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element name="amount" type="xs:float"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -1,102 +0,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.
*/
package org.apache.xmlbeans.samples.cursor;
import statement.StatementDocument;
import statement.StatementDocument.Statement;
import statement.Transaction;
import java.io.File;
import org.apache.xmlbeans.XmlCursor;
import javax.xml.namespace.QName;
public class OrderMatters
{
private static QName deposit = new QName( "http://statement", "deposit" );
public static void main ( String[] args ) throws Exception
{
// load the xml instance into the store and return a
// strongly typed instance of StatementDocument
StatementDocument stmtDoc = StatementDocument.Factory.parse( new File( args[ 0 ] ) );
System.out.println( "Valid statement instance? " + stmtDoc.validate() );
float balance = balanceOutOfOrder(stmtDoc);
System.out.println( "Ending balance: $" + balance );
balance = balanceInOrder(stmtDoc);
System.out.println( "Ending balance: $" + balance );
}
/**
* Out of order balance: the ease of stronly-typed XmlObjects!
*/
public static float balanceOutOfOrder(StatementDocument stmtDoc)
{
Statement stmt = stmtDoc.getStatement();
float balance = 0;
Transaction[] deposits = stmt.getDepositArray();
Transaction[] withdrawals = stmt.getWithdrawalArray();
for ( int i = 0 ; i < deposits.length ; i++ )
balance += deposits[ i ].getAmount();
for ( int i = 0 ; i < withdrawals.length ; i++ )
balance -= withdrawals[ i ].getAmount();
return balance;
}
/**
* In order balance: the power of XmlCursor!
*/
public static float balanceInOrder(StatementDocument stmtDoc)
{
float balance = 0;
XmlCursor cursor = stmtDoc.newCursor();
// use xpath to select elements
cursor.selectPath( "*/*" );
// iterate over the selection
while ( cursor.toNextSelection() )
{
// two views of the same data:
// move back and forth between XmlObject <-> XmlCursor
Transaction trans = (Transaction) cursor.getObject();
float amount = trans.getAmount();
if (cursor.getName().equals( deposit ))
balance += amount;
else if ((balance -= amount) < 0)
{
// doh!
System.out.println( "Negative balance: $" + balance );
balance -= 50;
}
}
return balance;
}
}

View File

@ -1,46 +0,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.
*/
package org.apache.xmlbeans.samples.cursor;
import statement.StatementDocument;
import statement.StatementDocument.Statement;
import statement.Transaction;
import java.io.File;
import org.apache.xmlbeans.XmlCursor;
import javax.xml.namespace.QName;
public class OrderMattersTest
{
private static QName deposit = new QName( "http://statement", "deposit" );
public static void main ( String[] args ) throws Exception
{
StatementDocument stmtDoc = StatementDocument.Factory.parse( new File( args[ 0 ] ) );
if (!stmtDoc.validate())
throw new RuntimeException("expected valid instance: " + args[0]);
float balance = OrderMatters.balanceOutOfOrder(stmtDoc);
if (1010F != balance)
throw new RuntimeException("expected out of order to return $1010.0: " + balance);
balance = OrderMatters.balanceInOrder(stmtDoc);
if (960F != balance)
throw new RuntimeException("expected in order to return $960.0: " + balance);
}
}

Some files were not shown because too many files have changed in this diff Show More