Source Code Cross Referenced for JaxpXmlElement.java in  » XML-UI » XUI » net » xoetrope » xml » jaxp » 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 UI » XUI » net.xoetrope.xml.jaxp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.xml.jaxp;
002:
003:        import java.util.Enumeration;
004:        import java.util.Vector;
005:
006:        import org.w3c.dom.Element;
007:        import org.w3c.dom.NamedNodeMap;
008:        import org.w3c.dom.NodeList;
009:        import net.xoetrope.xml.XmlElement;
010:        import org.w3c.dom.Node;
011:
012:        /**
013:         * <p>A customization of the XmlElement to interface with Xerces</p>
014:         * <p>Copyright (c) Xoetrope Ltd., 1998-2003<br>
015:         * License:      see license.txt
016:         * @version $Revision: 1.11 $
017:         */
018:        public class JaxpXmlElement implements  XmlElement {
019:            protected Element element;
020:            protected Vector children;
021:
022:            public JaxpXmlElement() {
023:            }
024:
025:            public JaxpXmlElement(Element e) {
026:                element = e;
027:            }
028:
029:            public JaxpXmlElement(String name) {
030:                //    ElementImpl ei = new ElementImpl();
031:                //    element = new Element( name );
032:                throw new java.lang.UnsupportedOperationException(
033:                        "Method XercesXmlElement(String) not yet implemented.");
034:            }
035:
036:            public XmlElement elementAt(int i) {
037:                if (children == null)
038:                    getChildren();
039:                Object obj = children.elementAt(i);
040:                if (obj instanceof  Element)
041:                    return new JaxpXmlElement((Element) obj);
042:                else if (obj instanceof  JaxpXmlElement)
043:                    return (JaxpXmlElement) obj;
044:
045:                return null;
046:            }
047:
048:            public String getAttribute(String name) {
049:                return element.getAttribute(name);
050:            }
051:
052:            public Vector getChildren() {
053:                return getChildren("*");
054:            }
055:
056:            /**
057:             * Get the children of this element
058:             * @param path
059:             * @return a vector of child elements
060:             */
061:            public Vector getChildren(String path) {
062:                children = new Vector();
063:                NodeList childElements = element.getChildNodes();
064:                int numChildren = childElements.getLength();
065:                for (int i = 0; i < numChildren; i++) {
066:                    Object obj = childElements.item(i);
067:                    if (obj instanceof  Element) {
068:                        Element e = (Element) obj;
069:                        if ((path == null) || (path.charAt(0) == '*')
070:                                || (path.equals(e.getNodeName())))
071:                            children.addElement(new JaxpXmlElement(e));
072:                    }
073:                }
074:
075:                return children;
076:            }
077:
078:            public String getName() {
079:                return element.getTagName();
080:            }
081:
082:            public void setName(String newName) {
083:                //    element.setName( newName );
084:                throw new java.lang.UnsupportedOperationException(
085:                        "Method setName( String newName ) not yet implemented.");
086:            }
087:
088:            public String getContent() {
089:                return element.getNodeValue();
090:            }
091:
092:            public Enumeration enumerateAttributeNames() {
093:                Vector attribs = new Vector();
094:                NamedNodeMap nnm = element.getAttributes();
095:                int numAttributes = nnm.getLength();
096:                for (int i = 0; i < numAttributes; i++)
097:                    attribs.add(nnm.item(i).getNodeName());
098:
099:                return attribs.elements();
100:            }
101:
102:            public void setAttribute(String name, String value) {
103:                element.setAttribute(name, value);
104:            }
105:
106:            public void addChild(XmlElement child) {
107:                if (child instanceof  JaxpXmlElement)
108:                    element.appendChild((Element) child.getImplementation());
109:            }
110:
111:            public XmlElement createElement(String name) {
112:                Element eleChild = element.getOwnerDocument().createElement(
113:                        name);
114:                element.appendChild(eleChild);
115:                return new JaxpXmlElement(eleChild);
116:            }
117:
118:            public XmlElement getFirstChildNamed(String name) {
119:                Element ele = (Element) element.getElementsByTagName(name)
120:                        .item(0);
121:
122:                return ele == null ? null : new JaxpXmlElement(ele);
123:            }
124:
125:            public String getNamespace() {
126:                return element.getNamespaceURI();
127:            }
128:
129:            public int getAttributeCount() {
130:                return element.getAttributes().getLength();
131:            }
132:
133:            public String getAttributeNamespace(String name) {
134:                return element.getAttributeNode(name).getOwnerElement()
135:                        .getNamespaceURI();
136:            }
137:
138:            /**
139:             * Returns an instance of the implementing NanoXml element (XMLElement)
140:             * @return
141:             */
142:            public Object getImplementation() {
143:                return element;
144:            }
145:
146:            public Element getElement() {
147:                return element;
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.