jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r155688 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
Date Mon, 28 Feb 2005 15:04:21 GMT
Author: stefan
Date: Mon Feb 28 07:03:54 2005
New Revision: 155688

URL: http://svn.apache.org/viewcvs?view=rev&rev=155688
Log:
fixing export: endPrefixMapping event was never generated

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java?view=diff&r1=155687&r2=155688
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java
Mon Feb 28 07:03:54 2005
@@ -81,26 +81,43 @@
      *                             to the content handler
      */
     public void serialize() throws RepositoryException, SAXException {
+        // start document and declare namespaces
         contentHandler.startDocument();
-        // namespace declarations
-        documentPrefixMappings();
-        // start serializing node and sub tree
+        startNamespaceDeclarations();
+
+        // serialize node and subtree
         process(startNode, 0);
 
+        // clear namespace declarations and end document 
+        endNamespaceDeclarations();
         contentHandler.endDocument();
     }
 
     /**
-     * @throws javax.jcr.RepositoryException
-     * @throws org.xml.sax.SAXException
+     * @throws RepositoryException
+     * @throws SAXException
      */
-    protected void documentPrefixMappings() throws RepositoryException, SAXException {
-        // namespace declarations
+    protected void startNamespaceDeclarations()
+            throws RepositoryException, SAXException {
+        // start namespace declarations
         String[] prefixes = session.getNamespacePrefixes();
         for (int i = 0; i < prefixes.length; i++) {
             String prefix = prefixes[i];
             String uri = session.getNamespaceURI(prefix);
             contentHandler.startPrefixMapping(prefix, uri);
+        }
+    }
+
+    /**
+     * @throws RepositoryException
+     * @throws SAXException
+     */
+    protected void endNamespaceDeclarations()
+            throws RepositoryException, SAXException {
+        // end namespace declarations
+        String[] prefixes = session.getNamespacePrefixes();
+        for (int i = 0; i < prefixes.length; i++) {
+            contentHandler.endPrefixMapping(prefixes[i]);
         }
     }
 



Mime
View raw message