Source Code Cross Referenced for ComplexContentEntry.java in  » GIS » geonetwork » org » fao » geonet » kernel » 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 » GIS » geonetwork » org.fao.geonet.kernel.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //==============================================================================
002:        //===
003:        //===   ComplexContentEntry
004:        //===
005:        //==============================================================================
006:        //===	Copyright (C) 2001-2005 Food and Agriculture Organization of the
007:        //===	United Nations (FAO-UN), United Nations World Food Programme (WFP)
008:        //===	and United Nations Environment Programme (UNEP)
009:        //===
010:        //===	This program is free software; you can redistribute it and/or modify
011:        //===	it under the terms of the GNU General Public License as published by
012:        //===	the Free Software Foundation; either version 2 of the License, or (at
013:        //===	your option) any later version.
014:        //===
015:        //===	This program is distributed in the hope that it will be useful, but
016:        //===	WITHOUT ANY WARRANTY; without even the implied warranty of
017:        //===	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
018:        //===	General Public License for more details.
019:        //===
020:        //===	You should have received a copy of the GNU General Public License
021:        //===	along with this program; if not, write to the Free Software
022:        //===	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
023:        //===
024:        //===	Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
025:        //===	Rome - Italy. email: geonetwork@osgeo.org
026:        //==============================================================================
027:
028:        package org.fao.geonet.kernel.schema;
029:
030:        import java.util.ArrayList;
031:        import java.util.List;
032:        import java.io.*;
033:
034:        import org.jdom.Attribute;
035:        import org.jdom.Element;
036:
037:        //==============================================================================
038:
039:        class ComplexContentEntry {
040:            public String base;
041:            public ArrayList alAttribGroups = new ArrayList();
042:            public ArrayList alElements = new ArrayList();
043:            public ArrayList alAttribs = new ArrayList();
044:            boolean restriction = false;
045:
046:            //---------------------------------------------------------------------------
047:            //---
048:            //--- Constructor
049:            //---
050:            //---------------------------------------------------------------------------
051:
052:            public ComplexContentEntry(Element el, String file,
053:                    String targetNS, String targetNSPrefix) {
054:                this (new ElementInfo(el, file, targetNS, targetNSPrefix));
055:            }
056:
057:            //---------------------------------------------------------------------------
058:
059:            public ComplexContentEntry(ElementInfo ei) {
060:                handleAttribs(ei);
061:                handleChildren(ei);
062:            }
063:
064:            //---------------------------------------------------------------------------
065:            //---
066:            //--- Private methods
067:            //---
068:            //---------------------------------------------------------------------------
069:
070:            private void handleAttribs(ElementInfo ei) {
071:                List attribs = ei.element.getAttributes();
072:
073:                for (int i = 0; i < attribs.size(); i++) {
074:                    Attribute at = (Attribute) attribs.get(i);
075:
076:                    String attrName = at.getName();
077:
078:                    if (attrName.equals("mixed"))
079:                        Logger
080:                                .log("Skipping 'mixed' attribute in <complexContent> element");
081:                    else
082:                        Logger.log("Unknown attribute '" + attrName
083:                                + "' in <complexContent> element", ei);
084:                }
085:            }
086:
087:            //---------------------------------------------------------------------------
088:
089:            private void handleChildren(ElementInfo ei) {
090:                List children = ei.element.getChildren();
091:
092:                for (int i = 0; i < children.size(); i++) {
093:                    Element elChild = (Element) children.get(i);
094:                    String elName = elChild.getName();
095:
096:                    if (elChild.getName().equals("extension"))
097:                        handleExtension(elChild, ei);
098:
099:                    else if (elChild.getName().equals("restriction")) {
100:                        handleRestriction(elChild, ei);
101:                        restriction = true;
102:                    }
103:
104:                    else
105:                        Logger.log("Unknown child '" + elName
106:                                + "' in <complexContent> element", ei);
107:                }
108:            }
109:
110:            //---------------------------------------------------------------------------
111:
112:            private void handleExtension(Element el, ElementInfo ei) {
113:                base = el.getAttributeValue("base");
114:
115:                List extension = el.getChildren();
116:
117:                for (int j = 0; j < extension.size(); j++) {
118:                    Element elExt = (Element) extension.get(j);
119:
120:                    if (elExt.getName().equals("sequence")) {
121:                        List sequence = elExt.getChildren();
122:
123:                        for (int k = 0; k < sequence.size(); k++) {
124:                            Element elSeq = (Element) sequence.get(k);
125:
126:                            if (elSeq.getName().equals("element")
127:                                    || elSeq.getName().equals("choice")
128:                                    || elSeq.getName().equals("group")
129:                                    || elSeq.getName().equals("sequence"))
130:                                alElements.add(new ElementEntry(elSeq, ei.file,
131:                                        ei.targetNS, ei.targetNSPrefix));
132:
133:                            else
134:                                Logger.log("Unknown child '" + elSeq.getName()
135:                                        + "' in <sequence> element" + ei);
136:                        }
137:                    } else if (elExt.getName().equals("group")) {
138:                        alElements.add(new ElementEntry(elExt, ei.file,
139:                                ei.targetNS, ei.targetNSPrefix));
140:                    } else if (elExt.getName().equals("choice")) {
141:                        alElements.add(new ElementEntry(elExt, ei.file,
142:                                ei.targetNS, ei.targetNSPrefix));
143:                    } else if (elExt.getName().equals("attribute"))
144:                        alAttribs.add(new AttributeEntry(elExt, ei.file,
145:                                ei.targetNS, ei.targetNSPrefix));
146:                    else if (elExt.getName().equals("attributeGroup")) {
147:                        String attribGroup = elExt.getAttributeValue("ref");
148:
149:                        if (attribGroup == null)
150:                            throw new IllegalArgumentException(
151:                                    "'ref' is null for element in <attributeGroup> of ComplexContent with extension base "
152:                                            + base);
153:                        alAttribGroups.add(attribGroup);
154:                    }
155:
156:                    else
157:                        Logger.log("Unknown child '" + elExt.getName()
158:                                + "' in <extension> element " + ei);
159:                }
160:            }
161:
162:            //---------------------------------------------------------------------------
163:
164:            private void handleRestriction(Element el, ElementInfo ei) {
165:                base = el.getAttributeValue("base");
166:
167:                //--- handle children
168:
169:                List restriction = el.getChildren();
170:
171:                for (int i = 0; i < restriction.size(); i++) {
172:                    Element elRes = (Element) restriction.get(i);
173:                    String elName = elRes.getName();
174:
175:                    if (elRes.getName().equals("sequence")) {
176:                        List sequence = elRes.getChildren();
177:
178:                        for (int k = 0; k < sequence.size(); k++) {
179:                            Element elSeq = (Element) sequence.get(k);
180:
181:                            if (elSeq.getName().equals("element")
182:                                    || elSeq.getName().equals("choice")
183:                                    || elSeq.getName().equals("group")
184:                                    || elSeq.getName().equals("sequence"))
185:                                alElements.add(new ElementEntry(elSeq, ei.file,
186:                                        ei.targetNS, ei.targetNSPrefix));
187:                            else
188:                                Logger.log("Unknown child '" + elSeq.getName()
189:                                        + "' in <sequence> element" + ei);
190:                        }
191:                    }
192:
193:                    else if (elRes.getName().equals("group")) {
194:                        alElements.add(new ElementEntry(elRes, ei.file,
195:                                ei.targetNS, ei.targetNSPrefix));
196:                    }
197:
198:                    else if (elName.equals("attribute"))
199:                        alAttribs.add(new AttributeEntry(elRes, ei.file,
200:                                ei.targetNS, ei.targetNSPrefix));
201:
202:                    else if (elName.equals("attributeGroup")) {
203:                        String attribGroup = elRes.getAttributeValue("ref");
204:
205:                        if (attribGroup == null)
206:                            throw new IllegalArgumentException(
207:                                    "'ref' is null for element in <attributeGroup> of ComplexContent with restriction base "
208:                                            + base);
209:                        alAttribGroups.add(attribGroup);
210:                    }
211:
212:                    else
213:                        Logger.log("Unknown child '" + elName
214:                                + "' in <restriction> element", ei);
215:
216:                }
217:            }
218:        }
219:
220:        //==============================================================================
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.