Source Code Cross Referenced for DOM2Helper.java in  » XML » xalan » org » apache » xml » serializer » utils » 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 » xalan » org.apache.xml.serializer.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004 The Apache Software Foundation.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        /*
017:         * $Id: DOM2Helper.java,v 1.1 2004/10/14 18:30:53 minchau Exp $
018:         */
019:        package org.apache.xml.serializer.utils;
020:
021:        import java.io.IOException;
022:
023:        import javax.xml.parsers.DocumentBuilder;
024:        import javax.xml.parsers.DocumentBuilderFactory;
025:        import javax.xml.parsers.ParserConfigurationException;
026:        import javax.xml.transform.TransformerException;
027:
028:        import org.w3c.dom.Attr;
029:        import org.w3c.dom.Document;
030:        import org.w3c.dom.Element;
031:        import org.w3c.dom.Node;
032:
033:        import org.xml.sax.InputSource;
034:
035:        /**
036:         * This class provides a DOM level 2 "helper", which provides services currently 
037:         * not provided be the DOM standard.
038:         * 
039:         * This class is a copy of the one in org.apache.xml.utils. 
040:         * It exists to cut the serializers dependancy on that package.
041:         * 
042:         * The differences from the original class are:
043:         * it doesn't extend DOMHelper, not depricated, 
044:         * dropped method isNodeAfter(Node node1, Node node2)
045:         * dropped method parse(InputSource)
046:         * dropped method supportSAX()
047:         * dropped method setDocument(doc) 
048:         * dropped method checkNode(Node)
049:         * dropped method getDocument()
050:         * dropped method getElementByID(String id, Document doc)
051:         * dropped method getParentOfNode(Node node)
052:         * dropped field Document m_doc;
053:         * made class non-public
054:         *   
055:         * This class is not a public API, it is only public because it is 
056:         * used in org.apache.xml.serializer.
057:         * 
058:         * @xsl.usage internal
059:         */
060:        public final class DOM2Helper {
061:
062:            /**
063:             * Construct an instance.
064:             */
065:            public DOM2Helper() {
066:            }
067:
068:            /**
069:             * Returns the local name of the given node, as defined by the
070:             * XML Namespaces specification. This is prepared to handle documents
071:             * built using DOM Level 1 methods by falling back upon explicitly
072:             * parsing the node name.
073:             *
074:             * @param n Node to be examined
075:             *
076:             * @return String containing the local name, or null if the node
077:             * was not assigned a Namespace.
078:             */
079:            public String getLocalNameOfNode(Node n) {
080:
081:                String name = n.getLocalName();
082:
083:                return (null == name) ? getLocalNameOfNodeFallback(n) : name;
084:            }
085:
086:            /**
087:             * Returns the local name of the given node. If the node's name begins
088:             * with a namespace prefix, this is the part after the colon; otherwise
089:             * it's the full node name.
090:             * 
091:             * This method is copied from org.apache.xml.utils.DOMHelper
092:             *
093:             * @param n the node to be examined.
094:             *
095:             * @return String containing the Local Name
096:             */
097:            private String getLocalNameOfNodeFallback(Node n) {
098:
099:                String qname = n.getNodeName();
100:                int index = qname.indexOf(':');
101:
102:                return (index < 0) ? qname : qname.substring(index + 1);
103:            }
104:
105:            /**
106:             * Returns the Namespace Name (Namespace URI) for the given node.
107:             * In a Level 2 DOM, you can ask the node itself. Note, however, that
108:             * doing so conflicts with our decision in getLocalNameOfNode not
109:             * to trust the that the DOM was indeed created using the Level 2
110:             * methods. If Level 1 methods were used, these two functions will
111:             * disagree with each other.
112:             * <p>
113:             * TODO: Reconcile with getLocalNameOfNode.
114:             *
115:             * @param n Node to be examined
116:             *
117:             * @return String containing the Namespace URI bound to this DOM node
118:             * at the time the Node was created.
119:             */
120:            public String getNamespaceOfNode(Node n) {
121:                return n.getNamespaceURI();
122:            }
123:
124:            /** Field m_useDOM2getNamespaceURI is a compile-time flag which
125:             *  gates some of the parser options used to build a DOM -- but 
126:             * that code is commented out at this time and nobody else
127:             * references it, so I've commented this out as well. */
128:            //private boolean m_useDOM2getNamespaceURI = false;
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.