Source Code Cross Referenced for XmlSchema.java in  » 6.0-JDK-Modules » jaxb-api » javax » xml » bind » annotation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » jaxb api » javax.xml.bind.annotation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
003:         * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
004:         */
005:
006:        package javax.xml.bind.annotation;
007:
008:        import java.lang.annotation.Retention;
009:        import java.lang.annotation.Target;
010:
011:        import static java.lang.annotation.ElementType.*;
012:        import static java.lang.annotation.RetentionPolicy.*;
013:
014:        /**
015:         * <p> Maps a package name to a XML namespace. </p>
016:         *
017:         * <h3>Usage</h3>
018:         * <p>
019:         * The XmlSchema annotation can be used with the following program
020:         * elements:
021:         * <ul> 
022:         *   <li>package</li>
023:         * </ul>
024:         *
025:         * <p>
026:         * This is a package level annotation and follows the recommendations
027:         * and restrictions contained in JSR 175, section III, "Annotations".
028:         * Thus the usage is subject to the following constraints and
029:         * recommendations.
030:         * <ul>
031:         *   <li> There can only be one package declaration as noted in JSR
032:         *        175, section III, "Annotations". </li>
033:         *   <li> JSR 175 recommends package-info.java for package level
034:         *        annotations. JAXB Providers that follow this recommendation
035:         *        will allow the package level annotations to be defined in
036:         *        package-info.java.
037:         * </ul>
038:         * <p>
039:         *
040:         * <p><b>Example 1:</b> Customize name of XML namespace to which 
041:         * package is mapped.</p>
042:         *
043:         * <pre>
044:         *    &#64;javax.xml.bind.annotation.XmlSchema (
045:         *      namespace = "http://www.example.com/MYPO1"
046:         *    )
047:         *    
048:         *    &lt;!-- XML Schema fragment -->
049:         *    &lt;schema
050:         *      xmlns=...
051:         *      xmlns:po=....
052:         *      targetNamespace="http://www.example.com/MYPO1"
053:         *    >
054:         *    &lt;!-- prefixes generated by default are implementation
055:         *            depedenent -->
056:         * </pre>
057:         *
058:         * <p><b>Example 2:</b> Customize namespace prefix, namespace URI
059:         * mapping</p>
060:         *
061:         * <pre>
062:         *    // Package level annotation
063:         *    &#64;javax.xml.bind.annotation.XmlSchema (
064:         *      xmlns = { 
065:         *        &#64;javax.xml.bind.annotation.XmlNs(prefix = "po", 
066:         *                   namespaceURI="http://www.example.com/myPO1"),
067:         *
068:         *        &#64;javax.xml.bind.annotation.XmlNs(prefix="xs",
069:         *                   namespaceURI="http://www.w3.org/2001/XMLSchema")
070:         *      )
071:         *    )
072:         * 
073:         *    &lt;!-- XML Schema fragment -->
074:         *    &lt;schema
075:         *        xmlns:xs="http://www.w3.org/2001/XMLSchema"
076:         *        xmlns:po="http://www.example.com/PO1"
077:         *        targetNamespace="http://www.example.com/PO1">
078:         * 
079:         * </pre>
080:         *
081:         * <p><b>Example 3:</b> Customize elementFormDefault</p>
082:         * <pre>
083:         *    &#64;javax.xml.bind.annotation.XmlSchema (
084:         *      elementFormDefault=XmlNsForm.UNQUALIFIED
085:         *      ...
086:         *    )
087:         * 
088:         *    &lt;!-- XML Schema fragment -->
089:         *    &lt;schema
090:         *        xmlns="http://www.w3.org/2001/XMLSchema"
091:         *        xmlns:po="http://www.example.com/PO1"
092:         *        elementFormDefault="unqualified">
093:         * 
094:         * </pre>
095:
096:         * @author Sekhar Vajjhala, Sun Microsystems, Inc.
097:         * @since JAXB2.0
098:         * @version $Revision: 1.10 $
099:         */
100:
101:        @Retention(RUNTIME)
102:        @Target(PACKAGE)
103:        public @interface XmlSchema {
104:
105:            /**
106:             * Customize the namespace URI, prefix associations. By default,
107:             * the namespace prefixes for a XML namespace are generated by a
108:             * JAXB Provider in an implementation dependent way.
109:             */
110:            XmlNs[] xmlns() default {};
111:
112:            /**
113:             * Name of the XML namespace.
114:             */
115:            String namespace() default "";
116:
117:            /**
118:             * Namespace qualification for elements. By default, element 
119:             * default attribute will be absent from the XML Schema fragment.
120:             */
121:            XmlNsForm elementFormDefault() default XmlNsForm.UNSET;
122:
123:            /**
124:             * Namespace qualification for attributes. By default,
125:             * attributesFormDefault will be absent from the XML Schema fragment.
126:             */
127:            XmlNsForm attributeFormDefault() default XmlNsForm.UNSET;
128:
129:            /**
130:             * Indicates that this namespace (specified by {@link #namespace()})
131:             * has a schema already available exeternally, available at this location.
132:             *
133:             * <p>
134:             * This instructs the JAXB schema generators to simply refer to
135:             * the pointed schema, as opposed to generating components into the schema.
136:             * This schema is assumed to match what would be otherwise produced
137:             * by the schema generator (same element names, same type names...)
138:             *
139:             * <p>
140:             * This feature is intended to be used when a set of the Java classes
141:             * is originally generated from an existing schema, hand-written to
142:             * match externally defined schema, or the generated schema is modified
143:             * manually.
144:             *
145:             * <p>
146:             * Value could be any absolute URI, like <tt>http://example.org/some.xsd</tt>.
147:             * It is also possible to specify the empty string, to indicate
148:             * that the schema is externally available but the location is
149:             * unspecified (and thus it's the responsibility of the reader of the generate
150:             * schema to locate it.) Finally, the default value of this property
151:             * <tt>"##generate"</tt> indicates that the schema generator is going
152:             * to generate components for this namespace (as it did in JAXB 2.0.)
153:             *
154:             * <p>
155:             * Multiple {@link XmlSchema} annotations on multiple packages are allowed
156:             * to govern the same {@link #namespace()}. In such case, all of them
157:             * must have the same {@link #location()} values.
158:             *
159:             *
160:             * <h3>Note to implementor</h3>
161:             * <p>
162:             * More precisely, the value must be either <tt>""</tt>, <tt>"##generate"</tt>, or
163:             * <a href="http://www.w3.org/TR/xmlschema-2/#anyURI">
164:             * a valid lexical representation of <tt>xs:anyURI</tt></a> that begins
165:             * with <tt>&lt;scheme>:</tt>.
166:             *
167:             * <p>
168:             * A schema generator is expected to generate a corresponding
169:             * <tt>&lt;xs:import namespace="..." schemaLocation="..."/></tt> (or
170:             * no <tt>schemaLocation</tt> attribute at all if the empty string is specified.)
171:             * However, the schema generator is allowed to use a different value in
172:             * the <tt>schemaLocation</tt> attribute (including not generating
173:             * such attribute), for example so that the user can specify a local
174:             * copy of the resource through the command line interface.
175:             *
176:             * @since JAXB2.1
177:             */
178:            String location() default NO_LOCATION;
179:
180:            /**
181:             * The default value of the {@link #location()} attribute,
182:             * which indicates that the schema generator will generate
183:             * components in this namespace.
184:             */
185:            // the actual value is chosen because ## is not a valid
186:            // sequence in xs:anyURI.
187:            static final String NO_LOCATION = "##generate";
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.