~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to xml/jaxb/src/org/netbeans/modules/xml/jaxb/cfg/schema/Schemas.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
/**
 
42
 *      This generated bean class Schemas
 
43
 *      matches the schema element 'schemas'.
 
44
 *
 
45
 *      Generated on Thu Apr 05 11:55:09 PDT 2007
 
46
 *
 
47
 *      This class matches the root element of the XML Schema,
 
48
 *      and is the root of the bean graph.
 
49
 *
 
50
 *      schemas <schemas> : Schemas
 
51
 *              [attr: destdir CDATA #IMPLIED  : java.lang.String]
 
52
 *              [attr: projectName CDATA #IMPLIED  : java.lang.String]
 
53
 *              schema <schema> : Schema[0,n]
 
54
 *                      [attr: type CDATA #IMPLIED  : java.lang.String]
 
55
 *                      [attr: package CDATA #IMPLIED  : java.lang.String]
 
56
 *                      [attr: name CDATA #REQUIRED  : java.lang.String]
 
57
 *                      xjcOptions <xjc-options> : XjcOptions[0,1]
 
58
 *                              xjcOption <xjc-option> : XjcOption[0,n]
 
59
 *                                      [attr: name CDATA #IMPLIED  : java.lang.String]
 
60
 *                                      [attr: value CDATA #IMPLIED  : java.lang.String]
 
61
 *                      schemaSources <schema-sources> : SchemaSources[0,1]
 
62
 *                              schemaSource <schema-source> : SchemaSource[0,n]
 
63
 *                                      [attr: location CDATA #IMPLIED  : java.lang.String]
 
64
 *                                      [attr: origLocation CDATA #IMPLIED  : java.lang.String]
 
65
 *                                      [attr: origLocationType CDATA #IMPLIED  : java.lang.String]
 
66
 *                      bindings <bindings> : Bindings[0,1]
 
67
 *                              binding <binding> : Binding[0,n]
 
68
 *                                      [attr: origLocation CDATA #IMPLIED  : java.lang.String]
 
69
 *                                      [attr: location CDATA #IMPLIED  : java.lang.String]
 
70
 *                      catalog <catalog> : Catalog[0,1]
 
71
 *                              [attr: location CDATA #IMPLIED  : java.lang.String]
 
72
 *                              [attr: origLocation CDATA #IMPLIED  : java.lang.String]
 
73
 *
 
74
 * @Generated
 
75
 */
 
76
 
 
77
package org.netbeans.modules.xml.jaxb.cfg.schema;
 
78
 
 
79
public class Schemas {
 
80
        public static final String DESTDIR = "Destdir"; // NOI18N
 
81
        public static final String PROJECTNAME = "ProjectName"; // NOI18N
 
82
        public static final String SCHEMA = "Schema";   // NOI18N
 
83
 
 
84
        private java.lang.String _Destdir;
 
85
        private java.lang.String _ProjectName;
 
86
        private java.util.List _Schema = new java.util.ArrayList();     // List<Schema>
 
87
        private java.lang.String schemaLocation;
 
88
 
 
89
        /**
 
90
         * Normal starting point constructor.
 
91
         */
 
92
        public Schemas() {
 
93
        }
 
94
 
 
95
        /**
 
96
         * Deep copy
 
97
         */
 
98
        public Schemas(org.netbeans.modules.xml.jaxb.cfg.schema.Schemas source) {
 
99
                this(source, false);
 
100
        }
 
101
 
 
102
        /**
 
103
         * Deep copy
 
104
         * @param justData just copy the XML relevant data
 
105
         */
 
106
        public Schemas(org.netbeans.modules.xml.jaxb.cfg.schema.Schemas source, boolean justData) {
 
107
                _Destdir = source._Destdir;
 
108
                _ProjectName = source._ProjectName;
 
109
                for (java.util.Iterator it = source._Schema.iterator(); 
 
110
                        it.hasNext(); ) {
 
111
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schema srcElement = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it.next();
 
112
                        _Schema.add((srcElement == null) ? null : newSchema(srcElement, justData));
 
113
                }
 
114
                schemaLocation = source.schemaLocation;
 
115
        }
 
116
 
 
117
        // This attribute is optional
 
118
        public void setDestdir(java.lang.String value) {
 
119
                _Destdir = value;
 
120
        }
 
121
 
 
122
        public java.lang.String getDestdir() {
 
123
                return _Destdir;
 
124
        }
 
125
 
 
126
        // This attribute is optional
 
127
        public void setProjectName(java.lang.String value) {
 
128
                _ProjectName = value;
 
129
        }
 
130
 
 
131
        public java.lang.String getProjectName() {
 
132
                return _ProjectName;
 
133
        }
 
134
 
 
135
        // This attribute is an array, possibly empty
 
136
        public void setSchema(org.netbeans.modules.xml.jaxb.cfg.schema.Schema[] value) {
 
137
                if (value == null)
 
138
                        value = new Schema[0];
 
139
                _Schema.clear();
 
140
                ((java.util.ArrayList) _Schema).ensureCapacity(value.length);
 
141
                for (int i = 0; i < value.length; ++i) {
 
142
                        _Schema.add(value[i]);
 
143
                }
 
144
        }
 
145
 
 
146
        public void setSchema(int index,org.netbeans.modules.xml.jaxb.cfg.schema.Schema value) {
 
147
                _Schema.set(index, value);
 
148
        }
 
149
 
 
150
        public org.netbeans.modules.xml.jaxb.cfg.schema.Schema[] getSchema() {
 
151
                Schema[] arr = new Schema[_Schema.size()];
 
152
                return (Schema[]) _Schema.toArray(arr);
 
153
        }
 
154
 
 
155
        public java.util.List fetchSchemaList() {
 
156
                return _Schema;
 
157
        }
 
158
 
 
159
        public org.netbeans.modules.xml.jaxb.cfg.schema.Schema getSchema(int index) {
 
160
                return (Schema)_Schema.get(index);
 
161
        }
 
162
 
 
163
        // Return the number of schema
 
164
        public int sizeSchema() {
 
165
                return _Schema.size();
 
166
        }
 
167
 
 
168
        public int addSchema(org.netbeans.modules.xml.jaxb.cfg.schema.Schema value) {
 
169
                _Schema.add(value);
 
170
                int positionOfNewItem = _Schema.size()-1;
 
171
                return positionOfNewItem;
 
172
        }
 
173
 
 
174
        /**
 
175
         * Search from the end looking for @param value, and then remove it.
 
176
         */
 
177
        public int removeSchema(org.netbeans.modules.xml.jaxb.cfg.schema.Schema value) {
 
178
                int pos = _Schema.indexOf(value);
 
179
                if (pos >= 0) {
 
180
                        _Schema.remove(pos);
 
181
                }
 
182
                return pos;
 
183
        }
 
184
 
 
185
        public void _setSchemaLocation(String location) {
 
186
                schemaLocation = location;
 
187
        }
 
188
 
 
189
        public String _getSchemaLocation() {
 
190
                return schemaLocation;
 
191
        }
 
192
 
 
193
        /**
 
194
         * Create a new bean using it's default constructor.
 
195
         * This does not add it to any bean graph.
 
196
         */
 
197
        public org.netbeans.modules.xml.jaxb.cfg.schema.Schema newSchema() {
 
198
                return new org.netbeans.modules.xml.jaxb.cfg.schema.Schema();
 
199
        }
 
200
 
 
201
        /**
 
202
         * Create a new bean, copying from another one.
 
203
         * This does not add it to any bean graph.
 
204
         */
 
205
        public org.netbeans.modules.xml.jaxb.cfg.schema.Schema newSchema(Schema source, boolean justData) {
 
206
                return new org.netbeans.modules.xml.jaxb.cfg.schema.Schema(source, justData);
 
207
        }
 
208
 
 
209
        public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException {
 
210
                org.openide.filesystems.FileLock lock = fo.lock();
 
211
                try {
 
212
                        java.io.OutputStream out = fo.getOutputStream(lock);
 
213
                        write(out);
 
214
                        out.close();
 
215
                } finally {
 
216
                        lock.releaseLock();
 
217
                }
 
218
        }
 
219
 
 
220
        public void write(org.openide.filesystems.FileObject dir, String filename) throws java.io.IOException {
 
221
                org.openide.filesystems.FileObject file = dir.getFileObject(filename);
 
222
                if (file == null) {
 
223
                        file = dir.createData(filename);
 
224
                }
 
225
                write(file);
 
226
        }
 
227
 
 
228
        public void write(java.io.File f) throws java.io.IOException {
 
229
                java.io.OutputStream out = new java.io.FileOutputStream(f);
 
230
                try {
 
231
                        write(out);
 
232
                } finally {
 
233
                        out.close();
 
234
                }
 
235
        }
 
236
 
 
237
        public void write(java.io.OutputStream out) throws java.io.IOException {
 
238
                write(out, null);
 
239
        }
 
240
 
 
241
        public void write(java.io.OutputStream out, String encoding) throws java.io.IOException {
 
242
                java.io.Writer w;
 
243
                if (encoding == null) {
 
244
                        encoding = "UTF-8";     // NOI18N
 
245
                }
 
246
                w = new java.io.BufferedWriter(new java.io.OutputStreamWriter(out, encoding));
 
247
                write(w, encoding);
 
248
                w.flush();
 
249
        }
 
250
 
 
251
        /**
 
252
         * Print this Java Bean to @param out including an XML header.
 
253
         * @param encoding is the encoding style that @param out was opened with.
 
254
         */
 
255
        public void write(java.io.Writer out, String encoding) throws java.io.IOException {
 
256
                out.write("<?xml version='1.0'");       // NOI18N
 
257
                if (encoding != null)
 
258
                        out.write(" encoding='"+encoding+"'");  // NOI18N
 
259
                out.write(" ?>\n");     // NOI18N
 
260
                writeNode(out, "schemas", "");  // NOI18N
 
261
        }
 
262
 
 
263
        public void writeNode(java.io.Writer out) throws java.io.IOException {
 
264
                String myName;
 
265
                myName = "schemas";
 
266
                writeNode(out, myName, "");     // NOI18N
 
267
        }
 
268
 
 
269
        public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException {
 
270
                writeNode(out, nodeName, null, indent, new java.util.HashMap());
 
271
        }
 
272
 
 
273
        /**
 
274
         * It's not recommended to call this method directly.
 
275
         */
 
276
        public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException {
 
277
                out.write(indent);
 
278
                out.write("<");
 
279
                if (namespace != null) {
 
280
                        out.write((String)namespaceMap.get(namespace));
 
281
                        out.write(":");
 
282
                }
 
283
                out.write(nodeName);
 
284
                out.write(" xmlns='");  // NOI18N
 
285
                out.write("http://xml.netbeans.org/schema/JAXBWizConfig");      // NOI18N
 
286
                out.write("'"); // NOI18N
 
287
                if (schemaLocation != null) {
 
288
                        namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
 
289
                        out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
 
290
                        out.write(schemaLocation);
 
291
                        out.write("'"); // NOI18N
 
292
                }
 
293
                writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap);
 
294
                out.write(">\n");
 
295
                writeNodeChildren(out, nodeName, namespace, indent, namespaceMap);
 
296
                out.write(indent);
 
297
                out.write("</");
 
298
                if (namespace != null) {
 
299
                        out.write((String)namespaceMap.get(namespace));
 
300
                        out.write(":");
 
301
                }
 
302
                out.write(nodeName);
 
303
                out.write(">\n");
 
304
        }
 
305
 
 
306
        protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException {
 
307
                // destdir is an attribute with namespace http://xml.netbeans.org/schema/JAXBWizConfig
 
308
                if (_Destdir != null) {
 
309
                        out.write(" destdir='");
 
310
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schemas.writeXML(out, _Destdir, true);
 
311
                        out.write("'"); // NOI18N
 
312
                }
 
313
                // projectName is an attribute with namespace http://xml.netbeans.org/schema/JAXBWizConfig
 
314
                if (_ProjectName != null) {
 
315
                        out.write(" projectName='");
 
316
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schemas.writeXML(out, _ProjectName, true);
 
317
                        out.write("'"); // NOI18N
 
318
                }
 
319
        }
 
320
 
 
321
        protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException {
 
322
                String nextIndent = indent + "  ";
 
323
                for (java.util.Iterator it = _Schema.iterator(); it.hasNext(); ) {
 
324
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schema element = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it.next();
 
325
                        if (element != null) {
 
326
                                element.writeNode(out, "schema", null, nextIndent, namespaceMap);
 
327
                        }
 
328
                }
 
329
        }
 
330
 
 
331
        public static Schemas read(org.openide.filesystems.FileObject fo) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException {
 
332
                java.io.InputStream in = fo.getInputStream();
 
333
                try {
 
334
                        return read(in);
 
335
                } finally {
 
336
                        in.close();
 
337
                }
 
338
        }
 
339
 
 
340
        public static Schemas read(java.io.File f) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException {
 
341
                java.io.InputStream in = new java.io.FileInputStream(f);
 
342
                try {
 
343
                        return read(in);
 
344
                } finally {
 
345
                        in.close();
 
346
                }
 
347
        }
 
348
 
 
349
        public static Schemas read(java.io.InputStream in) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException {
 
350
                return read(new org.xml.sax.InputSource(in), false, null, null);
 
351
        }
 
352
 
 
353
        /**
 
354
         * Warning: in readNoEntityResolver character and entity references will
 
355
         * not be read from any DTD in the XML source.
 
356
         * However, this way is faster since no DTDs are looked up
 
357
         * (possibly skipping network access) or parsed.
 
358
         */
 
359
        public static Schemas readNoEntityResolver(java.io.InputStream in) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException {
 
360
                return read(new org.xml.sax.InputSource(in), false,
 
361
                        new org.xml.sax.EntityResolver() {
 
362
                        public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) {
 
363
                                java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(new byte[0]);
 
364
                                return new org.xml.sax.InputSource(bin);
 
365
                        }
 
366
                }
 
367
                        , null);
 
368
        }
 
369
 
 
370
        public static Schemas read(org.xml.sax.InputSource in, boolean validate, org.xml.sax.EntityResolver er, org.xml.sax.ErrorHandler eh) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException {
 
371
                javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
 
372
                dbf.setValidating(validate);
 
373
                dbf.setNamespaceAware(true);
 
374
                javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
 
375
                if (er != null) db.setEntityResolver(er);
 
376
                if (eh != null) db.setErrorHandler(eh);
 
377
                org.w3c.dom.Document doc = db.parse(in);
 
378
                return read(doc);
 
379
        }
 
380
 
 
381
        public static Schemas read(org.w3c.dom.Document document) {
 
382
                Schemas aSchemas = new Schemas();
 
383
                aSchemas.readFromDocument(document);
 
384
                return aSchemas;
 
385
        }
 
386
 
 
387
        protected void readFromDocument(org.w3c.dom.Document document) {
 
388
                readNode(document.getDocumentElement());
 
389
        }
 
390
 
 
391
        public void readNode(org.w3c.dom.Node node) {
 
392
                readNode(node, new java.util.HashMap());
 
393
        }
 
394
 
 
395
        public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) {
 
396
                if (node.hasAttributes()) {
 
397
                        org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
 
398
                        org.w3c.dom.Attr attr;
 
399
                        java.lang.String attrValue;
 
400
                        boolean firstNamespaceDef = true;
 
401
                        for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
 
402
                                attr = (org.w3c.dom.Attr) attrs.item(attrNum);
 
403
                                String attrName = attr.getName();
 
404
                                if (attrName.startsWith("xmlns:")) {
 
405
                                        if (firstNamespaceDef) {
 
406
                                                firstNamespaceDef = false;
 
407
                                                // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
 
408
                                                namespacePrefixes = new java.util.HashMap(namespacePrefixes);
 
409
                                        }
 
410
                                        String attrNSPrefix = attrName.substring(6, attrName.length());
 
411
                                        namespacePrefixes.put(attrNSPrefix, attr.getValue());
 
412
                                }
 
413
                        }
 
414
                        String xsiPrefix = "xsi";
 
415
                        for (java.util.Iterator it = namespacePrefixes.keySet().iterator(); 
 
416
                                it.hasNext(); ) {
 
417
                                String prefix = (String) it.next();
 
418
                                String ns = (String) namespacePrefixes.get(prefix);
 
419
                                if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
 
420
                                        xsiPrefix = prefix;
 
421
                                        break;
 
422
                                }
 
423
                        }
 
424
                        attr = (org.w3c.dom.Attr) attrs.getNamedItem(""+xsiPrefix+":schemaLocation");
 
425
                        if (attr != null) {
 
426
                                attrValue = attr.getValue();
 
427
                                schemaLocation = attrValue;
 
428
                        }
 
429
                        readNodeAttributes(node, namespacePrefixes, attrs);
 
430
                }
 
431
                readNodeChildren(node, namespacePrefixes);
 
432
        }
 
433
 
 
434
        protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) {
 
435
                org.w3c.dom.Attr attr;
 
436
                java.lang.String attrValue;
 
437
                attr = (org.w3c.dom.Attr) attrs.getNamedItem("destdir");
 
438
                if (attr != null) {
 
439
                        attrValue = attr.getValue();
 
440
                        _Destdir = attrValue;
 
441
                }
 
442
                attr = (org.w3c.dom.Attr) attrs.getNamedItem("projectName");
 
443
                if (attr != null) {
 
444
                        attrValue = attr.getValue();
 
445
                        _ProjectName = attrValue;
 
446
                }
 
447
        }
 
448
 
 
449
        protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) {
 
450
                org.w3c.dom.NodeList children = node.getChildNodes();
 
451
                for (int i = 0, size = children.getLength(); i < size; ++i) {
 
452
                        org.w3c.dom.Node childNode = children.item(i);
 
453
                        String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
 
454
                        String childNodeValue = "";
 
455
                        if (childNode.getFirstChild() != null) {
 
456
                                childNodeValue = childNode.getFirstChild().getNodeValue();
 
457
                        }
 
458
                        if (childNodeName == "schema") {
 
459
                                Schema aSchema = newSchema();
 
460
                                aSchema.readNode(childNode, namespacePrefixes);
 
461
                                _Schema.add(aSchema);
 
462
                        }
 
463
                        else {
 
464
                                // Found extra unrecognized childNode
 
465
                        }
 
466
                }
 
467
        }
 
468
 
 
469
        /**
 
470
         * Takes some text to be printed into an XML stream and escapes any
 
471
         * characters that might make it invalid XML (like '<').
 
472
         */
 
473
        public static void writeXML(java.io.Writer out, String msg) throws java.io.IOException {
 
474
                writeXML(out, msg, true);
 
475
        }
 
476
 
 
477
        public static void writeXML(java.io.Writer out, String msg, boolean attribute) throws java.io.IOException {
 
478
                if (msg == null)
 
479
                        return;
 
480
                int msgLength = msg.length();
 
481
                for (int i = 0; i < msgLength; ++i) {
 
482
                        char c = msg.charAt(i);
 
483
                        writeXML(out, c, attribute);
 
484
                }
 
485
        }
 
486
 
 
487
        public static void writeXML(java.io.Writer out, char msg, boolean attribute) throws java.io.IOException {
 
488
                if (msg == '&')
 
489
                        out.write("&amp;");
 
490
                else if (msg == '<')
 
491
                        out.write("&lt;");
 
492
                else if (msg == '>')
 
493
                        out.write("&gt;");
 
494
                else if (attribute) {
 
495
                        if (msg == '"')
 
496
                                out.write("&quot;");
 
497
                        else if (msg == '\'')
 
498
                                out.write("&apos;");
 
499
                        else if (msg == '\n')
 
500
                                out.write("&#xA;");
 
501
                        else if (msg == '\t')
 
502
                                out.write("&#x9;");
 
503
                        else
 
504
                                out.write(msg);
 
505
                }
 
506
                else
 
507
                        out.write(msg);
 
508
        }
 
509
 
 
510
        public void changePropertyByName(String name, Object value) {
 
511
                if (name == null) return;
 
512
                name = name.intern();
 
513
                if (name == "destdir")
 
514
                        setDestdir((java.lang.String)value);
 
515
                else if (name == "projectName")
 
516
                        setProjectName((java.lang.String)value);
 
517
                else if (name == "schema")
 
518
                        addSchema((Schema)value);
 
519
                else if (name == "schema[]")
 
520
                        setSchema((Schema[]) value);
 
521
                else
 
522
                        throw new IllegalArgumentException(name+" is not a valid property name for Schemas");
 
523
        }
 
524
 
 
525
        public Object fetchPropertyByName(String name) {
 
526
                if (name == "destdir")
 
527
                        return getDestdir();
 
528
                if (name == "projectName")
 
529
                        return getProjectName();
 
530
                if (name == "schema[]")
 
531
                        return getSchema();
 
532
                throw new IllegalArgumentException(name+" is not a valid property name for Schemas");
 
533
        }
 
534
 
 
535
        public String nameSelf() {
 
536
                return "/Schemas";
 
537
        }
 
538
 
 
539
        public String nameChild(Object childObj) {
 
540
                return nameChild(childObj, false, false);
 
541
        }
 
542
 
 
543
        /**
 
544
         * @param childObj  The child object to search for
 
545
         * @param returnSchemaName  Whether or not the schema name should be returned or the property name
 
546
         * @return null if not found
 
547
         */
 
548
        public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) {
 
549
                return nameChild(childObj, returnConstName, returnSchemaName, false);
 
550
        }
 
551
 
 
552
        /**
 
553
         * @param childObj  The child object to search for
 
554
         * @param returnSchemaName  Whether or not the schema name should be returned or the property name
 
555
         * @return null if not found
 
556
         */
 
557
        public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
 
558
                if (childObj instanceof Schema) {
 
559
                        Schema child = (Schema) childObj;
 
560
                        int index = 0;
 
561
                        for (java.util.Iterator it = _Schema.iterator(); it.hasNext(); 
 
562
                                ) {
 
563
                                org.netbeans.modules.xml.jaxb.cfg.schema.Schema element = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it.next();
 
564
                                if (child == element) {
 
565
                                        if (returnConstName) {
 
566
                                                return SCHEMA;
 
567
                                        } else if (returnSchemaName) {
 
568
                                                return "schema";
 
569
                                        } else if (returnXPathName) {
 
570
                                                return "schema[position()="+index+"]";
 
571
                                        } else {
 
572
                                                return "Schema."+Integer.toHexString(index);
 
573
                                        }
 
574
                                }
 
575
                                ++index;
 
576
                        }
 
577
                }
 
578
                if (childObj instanceof java.lang.String) {
 
579
                        java.lang.String child = (java.lang.String) childObj;
 
580
                        if (child == _Destdir) {
 
581
                                if (returnConstName) {
 
582
                                        return DESTDIR;
 
583
                                } else if (returnSchemaName) {
 
584
                                        return "destdir";
 
585
                                } else if (returnXPathName) {
 
586
                                        return "@destdir";
 
587
                                } else {
 
588
                                        return "Destdir";
 
589
                                }
 
590
                        }
 
591
                        if (child == _ProjectName) {
 
592
                                if (returnConstName) {
 
593
                                        return PROJECTNAME;
 
594
                                } else if (returnSchemaName) {
 
595
                                        return "projectName";
 
596
                                } else if (returnXPathName) {
 
597
                                        return "@projectName";
 
598
                                } else {
 
599
                                        return "ProjectName";
 
600
                                }
 
601
                        }
 
602
                }
 
603
                return null;
 
604
        }
 
605
 
 
606
        /**
 
607
         * Return an array of all of the properties that are beans and are set.
 
608
         */
 
609
        public java.lang.Object[] childBeans(boolean recursive) {
 
610
                java.util.List children = new java.util.LinkedList();
 
611
                childBeans(recursive, children);
 
612
                java.lang.Object[] result = new java.lang.Object[children.size()];
 
613
                return (java.lang.Object[]) children.toArray(result);
 
614
        }
 
615
 
 
616
        /**
 
617
         * Put all child beans into the beans list.
 
618
         */
 
619
        public void childBeans(boolean recursive, java.util.List beans) {
 
620
                for (java.util.Iterator it = _Schema.iterator(); it.hasNext(); ) {
 
621
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schema element = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it.next();
 
622
                        if (element != null) {
 
623
                                if (recursive) {
 
624
                                        element.childBeans(true, beans);
 
625
                                }
 
626
                                beans.add(element);
 
627
                        }
 
628
                }
 
629
        }
 
630
 
 
631
        public boolean equals(Object o) {
 
632
                return o instanceof org.netbeans.modules.xml.jaxb.cfg.schema.Schemas && equals((org.netbeans.modules.xml.jaxb.cfg.schema.Schemas) o);
 
633
        }
 
634
 
 
635
        public boolean equals(org.netbeans.modules.xml.jaxb.cfg.schema.Schemas inst) {
 
636
                if (inst == this) {
 
637
                        return true;
 
638
                }
 
639
                if (inst == null) {
 
640
                        return false;
 
641
                }
 
642
                if (!(_Destdir == null ? inst._Destdir == null : _Destdir.equals(inst._Destdir))) {
 
643
                        return false;
 
644
                }
 
645
                if (!(_ProjectName == null ? inst._ProjectName == null : _ProjectName.equals(inst._ProjectName))) {
 
646
                        return false;
 
647
                }
 
648
                if (sizeSchema() != inst.sizeSchema())
 
649
                        return false;
 
650
                // Compare every element.
 
651
                for (java.util.Iterator it = _Schema.iterator(), it2 = inst._Schema.iterator(); 
 
652
                        it.hasNext() && it2.hasNext(); ) {
 
653
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schema element = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it.next();
 
654
                        org.netbeans.modules.xml.jaxb.cfg.schema.Schema element2 = (org.netbeans.modules.xml.jaxb.cfg.schema.Schema)it2.next();
 
655
                        if (!(element == null ? element2 == null : element.equals(element2))) {
 
656
                                return false;
 
657
                        }
 
658
                }
 
659
                return true;
 
660
        }
 
661
 
 
662
        public int hashCode() {
 
663
                int result = 17;
 
664
                result = 37*result + (_Destdir == null ? 0 : _Destdir.hashCode());
 
665
                result = 37*result + (_ProjectName == null ? 0 : _ProjectName.hashCode());
 
666
                result = 37*result + (_Schema == null ? 0 : _Schema.hashCode());
 
667
                return result;
 
668
        }
 
669
 
 
670
}
 
671
 
 
672
 
 
673
/*
 
674
                The following schema file has been used for generation:
 
675
 
 
676
<?xml version="1.0" encoding="UTF-8"?>
 
677
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 
678
            targetNamespace="http://xml.netbeans.org/schema/JAXBWizConfig"
 
679
            xmlns:tns="http://xml.netbeans.org/schema/JAXBWizConfig"
 
680
            elementFormDefault="qualified">
 
681
                
 
682
    <xsd:element name="schemas">
 
683
        <xsd:complexType>
 
684
            <xsd:sequence>
 
685
                <xsd:element ref="tns:schema" maxOccurs="unbounded" minOccurs="0"/>
 
686
            </xsd:sequence>
 
687
            <xsd:attribute name="destdir" type="xsd:string"/>
 
688
            <xsd:attribute name="projectName" type="xsd:string"/>
 
689
        </xsd:complexType>
 
690
    </xsd:element>
 
691
    
 
692
    <xsd:element name="schema">
 
693
        <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
694
            <xsd:sequence>
 
695
                <xsd:element ref="tns:xjc-options" minOccurs="0"/>
 
696
                <xsd:element ref="tns:schema-sources" minOccurs="0"/>
 
697
                <xsd:element ref="tns:bindings" minOccurs="0"/>
 
698
                <xsd:element ref="tns:catalog" minOccurs="0"/>
 
699
            </xsd:sequence>
 
700
            <xsd:attribute name="type" type="xsd:string"/>
 
701
            <xsd:attribute name="package" type="xsd:string"/>
 
702
            <xsd:attribute name="name" type="xsd:string" use="required"/>
 
703
        </xsd:complexType>
 
704
    </xsd:element>
 
705
    
 
706
    <xsd:element name="xjc-options">
 
707
        <xsd:complexType>
 
708
            <xsd:sequence>
 
709
                <xsd:element ref="tns:xjc-option" maxOccurs="unbounded" minOccurs="0"/>
 
710
            </xsd:sequence>
 
711
        </xsd:complexType>
 
712
    </xsd:element>
 
713
    
 
714
    <xsd:element name="xjc-option">
 
715
        <xsd:complexType>
 
716
            <xsd:sequence/>
 
717
            <xsd:attribute name="name" type="xsd:string"/>
 
718
            <xsd:attribute name="value" type="xsd:string"/>
 
719
        </xsd:complexType>
 
720
    </xsd:element>
 
721
    
 
722
    <xsd:element name="schema-sources">
 
723
        <xsd:complexType>
 
724
            <xsd:sequence>
 
725
                <xsd:element ref="tns:schema-source" maxOccurs="unbounded" minOccurs="0"/>
 
726
            </xsd:sequence>
 
727
        </xsd:complexType>
 
728
    </xsd:element>
 
729
    
 
730
    <xsd:element name="schema-source">
 
731
        <xsd:complexType>
 
732
            <xsd:sequence/>
 
733
            <xsd:attribute name="location" type="xsd:string">
 
734
                <xsd:annotation>
 
735
                    <xsd:documentation>location is relative to Project Root. origLocation is either local file path or URL</xsd:documentation>
 
736
                </xsd:annotation>
 
737
            </xsd:attribute>
 
738
            <xsd:attribute name="origLocation" type="xsd:string"/>
 
739
            <xsd:attribute name="origLocationType" type="xsd:string"/>
 
740
        </xsd:complexType>
 
741
    </xsd:element>
 
742
    
 
743
    <xsd:element name="bindings">
 
744
        <xsd:complexType>
 
745
            <xsd:sequence>
 
746
                <xsd:element ref="tns:binding" maxOccurs="unbounded" minOccurs="0"/>
 
747
            </xsd:sequence>
 
748
        </xsd:complexType>
 
749
    </xsd:element>
 
750
    
 
751
    <xsd:element name="binding">
 
752
        <xsd:complexType>
 
753
            <xsd:sequence/>
 
754
            <xsd:attribute name="origLocation" type="xsd:string"/>
 
755
            <xsd:attribute name="location" type="xsd:string"/>
 
756
        </xsd:complexType>
 
757
    </xsd:element>
 
758
    
 
759
    <xsd:element name="catalog">
 
760
        <xsd:complexType>
 
761
            <xsd:sequence/>
 
762
            <xsd:attribute name="location" type="xsd:string"/>
 
763
            <xsd:attribute name="origLocation" type="xsd:string"/>
 
764
        </xsd:complexType>
 
765
    </xsd:element>
 
766
</xsd:schema>
 
767
 
 
768
*/