Source Code Cross Referenced for TypeInfoImpl.java in  » XML » XPath-Saxon » net » sf » saxon » dom » 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 » XML » XPath Saxon » net.sf.saxon.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package net.sf.saxon.dom;
02:
03:        import net.sf.saxon.type.SchemaType;
04:        import net.sf.saxon.type.AnyType;
05:        import net.sf.saxon.Configuration;
06:        import org.w3c.dom.TypeInfo;
07:
08:        /**
09:         * This class implements the DOM TypeInfo interface as a wrapper over the Saxon SchemaType
10:         * interface.
11:         */
12:
13:        public class TypeInfoImpl implements  TypeInfo {
14:
15:            private Configuration config;
16:            private SchemaType schemaType;
17:
18:            /**
19:             * Construct a TypeInfo based on a SchemaType
20:             */
21:
22:            public TypeInfoImpl(Configuration config, SchemaType type) {
23:                this .config = config;
24:                this .schemaType = type;
25:            }
26:
27:            /**
28:             * Get the local name of the type (a system-allocated name if anonymous). Needed to implement the
29:             * DOM level 3 TypeInfo interface.
30:             */
31:
32:            public String getTypeName() {
33:                return config.getNamePool().getLocalName(
34:                        schemaType.getNameCode());
35:            }
36:
37:            /**
38:             * Get the namespace name of the type (a system-allocated name if anonymous). Needed to implement the
39:             * DOM level 3 TypeInfo interface.
40:             */
41:
42:            public String getTypeNamespace() {
43:                return config.getNamePool().getURI(schemaType.getNameCode());
44:            }
45:
46:            /**
47:             * This method returns true if there is a derivation between the reference type definition, that is the TypeInfo
48:             * on which the method is being called, and the other type definition, that is the one passed as parameters.
49:             * This method implements the DOM Level 3 TypeInfo interface. It must be called only on a valid type.
50:             * @param typeNamespaceArg the namespace of the "other" type
51:             * @param typeNameArg the local name of the "other" type
52:             * @param derivationMethod the derivation method: zero or more of {@link SchemaType#DERIVATION_RESTRICTION},
53:             * {@link SchemaType#DERIVATION_EXTENSION}, {@link SchemaType#DERIVATION_LIST}, or {@link SchemaType#DERIVATION_UNION}.
54:             * Zero means derived by any possible route.
55:             */
56:
57:            public boolean isDerivedFrom(String typeNamespaceArg,
58:                    String typeNameArg, int derivationMethod)
59:                    throws IllegalStateException {
60:                SchemaType base = schemaType.getBaseType();
61:                int fingerprint = config.getNamePool().allocate("",
62:                        typeNamespaceArg, typeNameArg);
63:                if (derivationMethod == 0
64:                        || (derivationMethod & schemaType.getDerivationMethod()) != 0) {
65:                    if (base.getFingerprint() == fingerprint) {
66:                        return true;
67:                    } else if (base instanceof  AnyType) {
68:                        return false;
69:                    } else {
70:                        return new TypeInfoImpl(config, base)
71:                                .isDerivedFrom(typeNamespaceArg, typeNameArg,
72:                                        derivationMethod);
73:                    }
74:                }
75:                return false;
76:                // Note: if derivationMethod is RESTRICTION, this interpretation requires every step to be derived
77:                // by restriction. An alternative interpretation is that at least one step must be derived by restriction.
78:            }
79:
80:        }
81:
82:        //
83:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
84:        // you may not use this file except in compliance with the License. You may obtain a copy of the
85:        // License at http://www.mozilla.org/MPL/
86:        //
87:        // Software distributed under the License is distributed on an "AS IS" basis,
88:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
89:        // See the License for the specific language governing rights and limitations under the License.
90:        //
91:        // The Original Code is: all this file.
92:        //
93:        // The Initial Developer of the Original Code is Saxonica Limited
94:        //
95:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
96:        //
97:        // Contributor(s): none
98:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.