jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • castor
  • CASTOR-3203

Marshaller adds Java namespace regardless of one being passed via the setNamespaceMapping method

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.3.2
  • Fix Version/s: 1.3.3rc1
  • Component/s: XML
  • Labels:
    None

Description

This is related to issue 2231. We added our own namespace called temp-java-xsd for the java prefix because Castor did not do this before 1.3.2.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    JavaNamespaceTest.zip
    22/Dec/11 5:11 AM
    2 kB
    Hein Stolle
    1. File
      JavaNamespaceTest/.project 0.2 kB
    2. XML File
      JavaNamespaceTest/example.xml 0.6 kB
    3. XML File
      JavaNamespaceTest/java.xsd 0.8 kB
    4. XML File
      JavaNamespaceTest/main.xsd 1.0 kB
    5. Text File
      JavaNamespaceTest/readme.txt 0.1 kB
    6. File
      JavaNamespaceTest/test.xmlcatalog 0.4 kB
    Download Zip
    Show
    Zip Archive
    JavaNamespaceTest.zip
    22/Dec/11 5:11 AM
    2 kB
    Hein Stolle

Issue Links

depends upon

Bug - A problem which impairs or prevents the functions of the product. CASTOR-2231 No namespace defined by castor for the automatically generated one "java:" on xsi:type attributes

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Werner Guttmann added a comment - 19/Dec/11 2:34 PM

I'd appreciate any sample documents that show how things look at your side.

Show
Werner Guttmann added a comment - 19/Dec/11 2:34 PM I'd appreciate any sample documents that show how things look at your side.
Hide
Permalink
Werner Guttmann added a comment - 19/Dec/11 2:39 PM - edited

Without really knowing what you are trying to achieve, here's a patch for what I believe the problem could be.

Index: xml/src/main/java/org/exolab/castor/xml/Marshaller.java
===================================================================
--- xml/src/main/java/org/exolab/castor/xml/Marshaller.java	(revision 9081)
+++ xml/src/main/java/org/exolab/castor/xml/Marshaller.java	(working copy)
@@ -1626,8 +1626,10 @@
             //-- save type information
             atts.addAttribute(XSI_NAMESPACE, TYPE_ATTR, XSI_TYPE, CDATA, typeName);
             if (useJavaPrefix) {
-                //-- declare Java namespace, if necessary
-                declareNamespace("java", "http://java.sun.com");
+               if (_namespaces.getNamespaceURI("java") == null) {
+                  //-- declare Java namespace, if necessary
+                  declareNamespace("java", "http://java.sun.com");
+               }
             }
         }
Show
Werner Guttmann added a comment - 19/Dec/11 2:39 PM - edited Without really knowing what you are trying to achieve, here's a patch for what I believe the problem could be.
Index: xml/src/main/java/org/exolab/castor/xml/Marshaller.java
===================================================================
--- xml/src/main/java/org/exolab/castor/xml/Marshaller.java	(revision 9081)
+++ xml/src/main/java/org/exolab/castor/xml/Marshaller.java	(working copy)
@@ -1626,8 +1626,10 @@
             //-- save type information
             atts.addAttribute(XSI_NAMESPACE, TYPE_ATTR, XSI_TYPE, CDATA, typeName);
             if (useJavaPrefix) {
-                //-- declare Java namespace, if necessary
-                declareNamespace("java", "http://java.sun.com");
+               if (_namespaces.getNamespaceURI("java") == null) {
+                  //-- declare Java namespace, if necessary
+                  declareNamespace("java", "http://java.sun.com");
+               }
             }
         }
Hide
Permalink
Hein Stolle added a comment - 22/Dec/11 4:58 AM

I have attached a test project to demonstrate that validation fails when there are two different java: namespaces declared in one XML document.

Show
Hein Stolle added a comment - 22/Dec/11 4:58 AM I have attached a test project to demonstrate that validation fails when there are two different java: namespaces declared in one XML document.
Hide
Permalink
Werner Guttmann added a comment - 16/Apr/12 2:59 PM

Hein, have you been able to put above patch at some use ?

Show
Werner Guttmann added a comment - 16/Apr/12 2:59 PM Hein, have you been able to put above patch at some use ?
Hide
Permalink
Hein Stolle added a comment - 16/Apr/12 3:09 PM

Certainly, it solved our problem. Is it possible to include it in the next release?

Show
Hein Stolle added a comment - 16/Apr/12 3:09 PM Certainly, it solved our problem. Is it possible to include it in the next release?
Hide
Permalink
Werner Guttmann added a comment - 16/Apr/12 4:54 PM

yes, it will be shipped as part of 1.3.3.

Show
Werner Guttmann added a comment - 16/Apr/12 4:54 PM yes, it will be shipped as part of 1.3.3.

People

  • Assignee:
    Werner Guttmann
    Reporter:
    Hein Stolle
Vote (0)
Watch (1)

Dates

  • Created:
    19/Dec/11 10:25 AM
    Updated:
    16/Apr/12 4:54 PM
    Resolved:
    16/Apr/12 4:54 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.