Source Code Cross Referenced for Schemas.java in  » IDE-Netbeans » xml » org » netbeans » modules » xml » jaxb » cfg » schema » 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 » IDE Netbeans » xml » org.netbeans.modules.xml.jaxb.cfg.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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