You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/10/31 17:49:44 UTC

DO NOT REPLY [Bug 14139] New: - NamespaceDeclaration's are not used during the serialization of MessageElement.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14139

NamespaceDeclaration's are not used during the serialization of MessageElement.

           Summary: NamespaceDeclaration's are not used during the
                    serialization of MessageElement.
           Product: Axis
           Version: 1.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: chrisw@wolfram.com


When addNamespaceDeclaration(String prefix, String namespaceURI) is called on a 
MessageElement, the namespace declarataion is added within the MessageElement, 
but not used during Serialization.

Example....

### AddNamespaceDeclarationTest.java ###

import org.apache.axis.message.MessageElement;
import javax.xml.namespace.QName;
import java.util.Iterator;

public class AddNamespaceDeclarationTest
{
  public AddNamespaceDeclarationTest()
  {
  }
  
  public static void main(String[] args)
  { 
    try
    {
      MessageElement me = 
        new MessageElement("http://www.wolfram.com","Test");
      me.addNamespaceDeclaration("pre", "http://www.wolfram2.com");
      me.addAttribute(
        "http://www.w3.org/2001/XMLSchema-instance", 
		"type",
		"pre:test1");
      System.out.println(me.toString());
      Iterator it = me.getNamespacePrefixes();
      while(it.hasNext())
      { 
        String prefix = (String)it.next();
        System.out.println(prefix + ":" + me.getNamespaceURI(prefix));
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}

Result (I fixed up the xml to make it more readible)...

<ns1:Test xsi:type="pre:test1" 
          xmlns:ns1="http://www.wolfram.com" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
pre:http://www.wolfram2.com

You will notice that even though the namespace declaration is explicitly set, 
it is not used during serialization.