Source Code Cross Referenced for Frame.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » rdf » arp » states » 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 » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.rdf.arp.states 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003:         * [See end of file]
004:         */
005:
006:        package com.hp.hpl.jena.rdf.arp.states;
007:
008:        import org.xml.sax.Attributes;
009:        import org.xml.sax.SAXParseException;
010:
011:        import com.hp.hpl.jena.rdf.arp.ARPErrorNumbers;
012:        import com.hp.hpl.jena.rdf.arp.impl.ARPString;
013:        import com.hp.hpl.jena.rdf.arp.impl.AbsXMLContext;
014:        import com.hp.hpl.jena.rdf.arp.impl.AttributeLexer;
015:        import com.hp.hpl.jena.rdf.arp.impl.ElementLexer;
016:        import com.hp.hpl.jena.rdf.arp.impl.Names;
017:        import com.hp.hpl.jena.rdf.arp.impl.ParserSupport;
018:        import com.hp.hpl.jena.rdf.arp.impl.QNameLexer;
019:        import com.hp.hpl.jena.rdf.arp.impl.Taint;
020:        import com.hp.hpl.jena.rdf.arp.impl.TaintImpl;
021:        import com.hp.hpl.jena.rdf.arp.impl.URIReference;
022:        import com.hp.hpl.jena.rdf.arp.impl.XMLHandler;
023:
024:        public abstract class Frame extends ParserSupport implements  Names,
025:                FrameI, ARPErrorNumbers {
026:            final FrameI parent;
027:
028:            protected boolean nonWhiteMsgGiven = false;
029:
030:            public Taint taint = new TaintImpl();
031:
032:            public FrameI getParent() {
033:                return parent;
034:            }
035:
036:            public Frame(FrameI p, AttributeLexer ap) throws SAXParseException {
037:                super (p.getXMLHandler(), ap.xml(p.getXMLContext()));
038:                parent = p;
039:            }
040:
041:            public Frame(FrameI p, AbsXMLContext x) {
042:                super (p.getXMLHandler(), x);
043:                parent = p;
044:            }
045:
046:            public Frame(XMLHandler a, AbsXMLContext x) {
047:                super (a, x);
048:                parent = null;
049:            }
050:
051:            protected void warning(int i, String msg) throws SAXParseException {
052:                warning(taint, i, msg);
053:            }
054:
055:            public void afterChild() {
056:                taint = new TaintImpl();
057:            }
058:
059:            public void comment(char[] ch, int start, int length)
060:                    throws SAXParseException {
061:                // generally ignore
062:            }
063:
064:            // public void checkIdSymbol(String id) throws SAXParseException {
065:            // checkIdSymbol(xml,id);
066:            // }
067:            /**
068:             * endElement is called on the state of the frame created by the matching
069:             * startElement.
070:             * 
071:             * @throws SAXParseException
072:             * 
073:             */
074:            public void endElement() throws SAXParseException {
075:                // often nothing
076:            }
077:
078:            public void processingInstruction(String target, String data)
079:                    throws SAXParseException {
080:                // generally ignored, maybe not what was intended.
081:                warning(null, WARN_PROCESSING_INSTRUCTION_IN_RDF,
082:                        "A processing instruction is in RDF content. No processing was done. "
083:                                + suggestParsetypeLiteral());
084:            }
085:
086:            void processPropertyAttributes(AttributeLexer ap, Attributes atts,
087:                    AbsXMLContext x) throws SAXParseException {
088:                if (ap.type != null) {
089:                    ((HasSubjectFrameI) this ).aPredAndObj(RDF_TYPE,
090:                            URIReference.resolve(this , x, ap.type));
091:                }
092:                int sz = atts.getLength();
093:                if (ap.count != sz) {
094:                    for (int i = 0; i < sz; i++) {
095:                        if (!ap.done(i)) {
096:                            String uri = atts.getURI(i);
097:                            String lName = atts.getLocalName(i);
098:                            URIReference pred = URIReference.fromQName(this ,
099:                                    uri, lName);
100:                            if (uri == null || uri.equals("")) {
101:                                warning(
102:                                        pred,
103:                                        WARN_UNQUALIFIED_ATTRIBUTE,
104:                                        "Unqualified property attributes are not allowed. Property treated as a relative URI.");
105:                            }
106:                            if (rdfns.equals(uri)
107:                                    && !QNameLexer.isKnownRDFProperty(lName)) {
108:                                warning(
109:                                        pred,
110:                                        WARN_UNKNOWN_RDF_ATTRIBUTE,
111:                                        atts.getQName(i)
112:                                                + " is not a recognized RDF property or type.");
113:                            }
114:                            ((HasSubjectFrameI) this ).aPredAndObj(pred,
115:                                    new ARPString(this , atts.getValue(i), x));
116:                        }
117:                    }
118:                }
119:            }
120:
121:            public void abort() {
122:                // nothing.
123:            }
124:
125:            protected FrameI rdfStartElement(String uri, String localName,
126:                    String rawName, Attributes atts) throws SAXParseException {
127:                ElementLexer el = new ElementLexer(taint, this , uri, localName,
128:                        rawName, E_RDF, 0, false);
129:                if (el.goodMatch) {
130:                    AttributeLexer ap = new AttributeLexer(this , A_XMLBASE
131:                            | A_XMLLANG | A_XML_OTHER, 0);
132:                    if (ap.processSpecials(taint, atts) != atts.getLength()) {
133:                        warning(ERR_SYNTAX_ERROR,
134:                                "Illegal attributes on rdf:RDF");
135:                    }
136:                    // TODO this may be one point to intercept xml:base.
137:                    arp.startRDF();
138:                    return new WantTopLevelDescription(this , ap);
139:                }
140:                AttributeLexer ap = new AttributeLexer(this , A_XMLBASE
141:                        | A_XMLLANG, 0);
142:                ap.processSpecials(taint, atts);
143:                return new LookingForRDF(this , ap);
144:            }
145:
146:            /**
147:             * Additional message if mixed content is found in a syntactically
148:             * disallowed place. Subclasses override to suppress message.
149:             * 
150:             */
151:            String suggestParsetypeLiteral() {
152:                return " Maybe there should be an rdf:parseType='Literal' for embedding mixed XML content in RDF.";
153:            }
154:
155:            public void characters(char[] ch, int start, int length)
156:                    throws SAXParseException {
157:                if ((!nonWhiteMsgGiven) && !isWhite(ch, start, length)) {
158:                    nonWhiteMsgGiven = true;
159:                    warning(ERR_NOT_WHITESPACE,
160:                            "Expecting XML start or end element(s). String data \""
161:                                    + new String(ch, start, length)
162:                                    + "\" not allowed."
163:                                    + suggestParsetypeLiteral()
164:                                    + " Maybe a striping error.");
165:                }
166:            }
167:
168:        }
169:
170:        /*
171:         * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP All rights
172:         * reserved.
173:         * 
174:         * Redistribution and use in source and binary forms, with or without
175:         * modification, are permitted provided that the following conditions are met:
176:         * 1. Redistributions of source code must retain the above copyright notice,
177:         * this list of conditions and the following disclaimer. 2. Redistributions in
178:         * binary form must reproduce the above copyright notice, this list of
179:         * conditions and the following disclaimer in the documentation and/or other
180:         * materials provided with the distribution. 3. The name of the author may not
181:         * be used to endorse or promote products derived from this software without
182:         * specific prior written permission.
183:         * 
184:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
185:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
186:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
187:         * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
188:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
189:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
190:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
191:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
192:         * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
193:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
194:         */
w___w_w__.j___a___v___a___2__s___.__c__om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.