forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: r555156 - /forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java
Date Wed, 11 Jul 2007 04:06:45 GMT
Author: crossley
Date: Tue Jul 10 21:06:44 2007
New Revision: 555156

URL: http://svn.apache.org/viewvc?view=rev&rev=555156
Log:
RDF files need to check the namespace of more than just the root element.
Contributed by: Sina K. Heshmati
Issue: FOR-1018

Modified:
    forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java

Modified: forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java
URL: http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java?view=diff&rev=555156&r1=555155&r2=555156
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java Tue Jul 10
21:06:44 2007
@@ -42,6 +42,7 @@
 {
     protected List sourceTypes = new ArrayList();
     protected static final String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
+    protected static final String RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
 
     public void configure(Configuration configuration) throws ConfigurationException
     {
@@ -97,6 +98,12 @@
                 else if (event.type == XMLEvent.ELEMENT)
                 {
                     ElementEvent elementEvent = (ElementEvent)event;
+		    if (elementEvent.element.uri == RDF_NAMESPACE) 
+		    {
+			while ((event = parser.nextEvent()) != null && 
+				elementEvent.element.uri == RDF_NAMESPACE)
+			    event = parser.nextEvent();
+		    }
                     sourceInfo.setDocumentElementLocalName(elementEvent.element.localpart);
                     sourceInfo.setDocumentElementNamespace(elementEvent.element.uri);
 
@@ -104,7 +111,7 @@
                     sourceInfo.setXsiNoNamespaceSchemaLocation(elementEvent.attributes.getValue(XSI_NAMESPACE,
"noNamespaceSchemaLocation"));
 
                     // stop parsing after the root element
-                    break;
+		    break;
                 }
             }
         }



Mime
View raw message