Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-189

namespace attributes gets lost when a XMLBean node is converted to DOM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2
    • None
    • DOM
    • None

    Description

      When I create a "Schema" object I get the name space attribute
      xmlns="http://www.w3.org/2001/XMLSchema"
      in the Object, but when I convert this to DOM node the attribute is not present. I have attached a simple program to reproduce the problem. When I run the following code:

      public static void main(String[] args) {
      SchemaDocument schema1 = SchemaDocument.Factory.newInstance();
      schema1.addNewSchema();
      System.out.println("Schema in XMLBeans" + schema1);

      System.out.println("Schema as DOM Node");
      Node node = schema1.getDomNode();
      node = node.getFirstChild();
      System.out.println("Node Name: " + node.getNodeName());
      System.out.println("Attributes: ");
      NamedNodeMap nnm = node.getAttributes();
      if (nnm != null) {
      int len = nnm.getLength();
      Attr attr;
      for (int i = 0; i < len; i++)

      { attr = (Attr) nnm.item(i); System.out.println("\t " + attr.getNodeName() + "=\"" + attr.getNodeValue() + '"'); }

      }
      System.out.println("End of Attributes");
      }

      my output is:

      Schema in XMLBeans<schema xmlns="http://www.w3.org/2001/XMLSchema"/>
      Schema as DOM Node
      Node Name: schema
      Attributes:
      End of Attributes

      I expected teh xmlns=.... to show up as attribute of the dom node.

      Attachments

        1. DOMNamespaceTest.java
          1 kB
          daryoush mehrtash

        Activity

          People

            Unassigned Unassigned
            dmehrtash daryoush mehrtash
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: