jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1149178 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
Date Thu, 21 Jul 2011 13:55:05 GMT
Author: mduerig
Date: Thu Jul 21 13:55:04 2011
New Revision: 1149178

URL: http://svn.apache.org/viewvc?rev=1149178&view=rev
Log:
JCR-3033: Provide a method for writing name space declarations in CompactNodeTypeDefWriter

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java?rev=1149178&r1=1149177&r2=1149178&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
Thu Jul 21 13:55:04 2011
@@ -225,6 +225,25 @@ public class CompactNodeTypeDefWriter {
     }
 
     /**
+     * Write a namespace declaration to this writer. This method has no effect if the
+     * writer does not include namespaces.
+     *
+     * @param prefix  namespace prefix
+     * @throws NamespaceException  if no namespace is registered for the given prefix
+     * @throws IOException  if an I/O error occurs
+     */
+    public void writeNamespaceDelclaration(String prefix) throws NamespaceException, IOException
{
+        if (!usedNamespaces.contains(prefix)) {
+            usedNamespaces.add(prefix);
+            nsWriter.write("<'");
+            nsWriter.write(prefix);
+            nsWriter.write("'='");
+            nsWriter.write(escape(resolver.getURI(prefix)));
+            nsWriter.write("'>\n");
+        }
+    }
+
+    /**
      * Flushes all pending write operations and Closes this writer. please note,
      * that the underlying writer remains open.
      *
@@ -550,14 +569,7 @@ public class CompactNodeTypeDefWriter {
             if (prefix != null && !prefix.equals(Name.NS_EMPTY_PREFIX)) {
                 // check for writing namespaces
                 if (nsWriter != null) {
-                    if (!usedNamespaces.contains(prefix)) {
-                        usedNamespaces.add(prefix);
-                        nsWriter.write("<'");
-                        nsWriter.write(prefix);
-                        nsWriter.write("'='");
-                        nsWriter.write(escape(name.getNamespaceURI()));
-                        nsWriter.write("'>\n");
-                    }
+                    writeNamespaceDelclaration(prefix);
                 }
                 prefix += ":";
             }



Mime
View raw message