xml Encoder in xsd-core does not wirte down user defined namespace declarations 
on 2.5.x.
-----------------------------------------------------------------------------------------

                 Key: GEOT-2192
                 URL: http://jira.codehaus.org/browse/GEOT-2192
             Project: GeoTools
          Issue Type: Bug
          Components:  gc worldimage
    Affects Versions: 2.5.1
            Reporter: Gabriel Roldán
            Assignee: Gabriel Roldán
             Fix For: 2.5.2


{{Encoder.getNamespaces().declarePrefix(String prefix, String uri)}} is meant 
for the client code to define any extra namespace declaration that's not 
directly obtained from the encoder's configuration {{XSDSchema}}.

On trunk this is fixed though, the following being the simple patch needed:
{code}
Index: src/main/java/org/geotools/xml/Encoder.java
===================================================================
--- src/main/java/org/geotools/xml/Encoder.java (revision 31943)
+++ src/main/java/org/geotools/xml/Encoder.java (working copy)
@@ -24,6 +24,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -566,6 +567,12 @@

         if (namespaceAware) {
             //write out all the namespace prefix value mappings
+            for ( Enumeration e = namespaces.getPrefixes(); 
e.hasMoreElements(); ) {
+                String prefix = (String) e.nextElement();
+                String uri = namespaces.getURI( prefix );
+
+                serializer.startPrefixMapping( prefix , uri );
+            }
             for (Iterator itr = 
schema.getQNamePrefixToNamespaceMap().entrySet().iterator();
                     itr.hasNext();) {
                 Map.Entry entry = (Map.Entry) itr.next();

{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to