Source Code Cross Referenced for GenericSAXImpl.java in  » Web-Framework » RSF » uk » org » ponder » saxalizer » 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 » Web Framework » RSF » uk.org.ponder.saxalizer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package uk.org.ponder.saxalizer;
002:
003:        import java.util.ArrayList;
004:        import java.util.Enumeration;
005:        import java.util.HashMap;
006:        import java.util.List;
007:        import java.util.Map;
008:        import java.util.TreeMap;
009:        import java.util.Vector;
010:
011:        import uk.org.ponder.util.EnumerationConverter;
012:
013:        //import uk.org.ponder.stringutil.CharWrap;
014:
015:        // This class is similar to the DOM ElementNode!
016:        // It maintains a tree of children all of type GenericSax, and also keeps
017:        // hold of data for arbitary attributes.
018:
019:        /** The class <code>GenericSAXImpl</code> is useful as a base class for SAXalizable
020:         * classes that wish to store the information from arbitrary XML subtags. 
021:         * <code>GenericSAXImpl</code> stores all attributes and all subtags that are
022:         * seen for the tag that corresponds to it, and in addition will create
023:         * <code>GenericSAXImpl</code> children so that subtags are also stored
024:         * recursively. 
025:         * <p>Ultimately we will arrive at a <code>GenericSAXImpl</code> leaf node, which
026:         * has no children (although it may have attributes), and contains a <code>String</code>
027:         * representing the text of the node.
028:         */
029:
030:        public class GenericSAXImpl implements  GenericSAX {
031:            // There are no specific SAX methods that a GenericSAXImpl provides --- 
032:            // the SAXalizer directly recognises it and sends it other GenericSAXImpl objects. 
033:            public SAXAccessMethodSpec[] getSAXSetMethods() {
034:                return null;
035:            }
036:
037:            public SAXAccessMethodSpec[] getSAXSetAttrMethods() {
038:                return null;
039:            }
040:
041:            public SAXAccessMethodSpec[] getSAXGetMethods() {
042:                return null;
043:            }
044:
045:            public SAXAccessMethodSpec[] getSAXGetAttrMethods() {
046:                return null;
047:            }
048:
049:            String tagname;
050:            String data; // wtf is this data - only meaningful for leaf nodes.
051:            TreeMap attrs;
052:            String comment;
053:            // A heterogeneous vector. 
054:            List children; // not a hash, since tags may be identical - also, order should be preserved.
055:
056:            // The child will be another GenericSax. Leaf nodes will just have data.
057:            /** Add the specified child object to the collection.
058:             * @param child The child object to add.
059:             */
060:            public void addChild(GenericSAX child) {
061:                if (children == null)
062:                    children = new ArrayList();
063:                children.add(child);
064:            }
065:
066:            /** Return the number of child objects.
067:             * @return The number of child objects.
068:             */
069:            public int size() {
070:                return (children == null ? 0 : children.size());
071:            }
072:
073:            /** Return an enumeration of all child objects.
074:             @return The required child object.
075:             */
076:            public Enumeration getChildEnum() {
077:                return children == null ? null : EnumerationConverter
078:                        .getEnumeration(children);
079:            }
080:
081:            /** Return the child object corresponding to the tag with the given name.
082:             @param tagname The tag name that the child object is required for.
083:             @return The required child object, or <code>null</code> if not found.
084:             */
085:            public GenericSAXImpl findChild(String tagname) {
086:                //    System.out.println("Tagname: "+ tagname +" required");
087:                for (int i = 0; i < children.size(); ++i) {
088:                    GenericSAXImpl childi = (GenericSAXImpl) children.get(i);
089:                    //      System.out.println("Passing child with tag: "+childi.tagname);
090:                    if (childi.tagname.equals(tagname))
091:                        return childi;
092:                }
093:                return null;
094:            }
095:
096:            /** Set the data for this node to the specified string - only used if this
097:             * is a leaf node.
098:             *  @param s The new node data.
099:             */
100:            public void setData(String s) {
101:                data = s;
102:            }
103:
104:            /** Return the stored data for this node.
105:             * @return The stored data.
106:             */
107:            public String getData() {
108:                return data;
109:            }
110:
111:            /** Set the tag name for this node to the specified string.
112:             * @param s The new tag name.
113:             */
114:            public void setTag(String s) {
115:                tagname = s;
116:            }
117:
118:            /** Gets the tag name for this node.
119:             * @return The required tag name
120:             */
121:            public String getTag() {
122:                return tagname;
123:            }
124:
125:            public Map getAttributes() {
126:                if (attrs == null) {
127:                    attrs = new TreeMap();
128:                }
129:                return attrs;
130:            }
131:
132:            // The data attribute will only be used if this is a leaf node.
133:
134:            /*  GenericSAXImpl(String tagname, String data, AttributeList attrs) {
135:              this.tagname = tagname;
136:              this.data = data;
137:              this.attrs = new SAXAttributeHash(attrs);
138:              }*/
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.