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

Cannot instantiate type-specific XmlBean from DOM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.2.1
    • None
    • Binding
    • None

    Description

      I couldn't get the XmlObject.Factory.parse(Node) to create type-specific XMLBean. The test code is

      public class DOM2BeanTest {
      public static void main(String[] args) throws Exception

      { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInsta nce(); DocumentBuilder db = dbf.newDocumentBuilder(); File file = new File("test/testshib-metadata.xml"); // SAML2.0 Metadata file Document doc = db.parse(file); XmlObject xbean = XmlObject.Factory.parse(doc.getDocumentElement()); XmlObject xbean2 = XmlObject.Factory.parse(file); System.out.println("Type of xbean: "+xbean.getClass()); System.out.println("Type of xbean2: "+xbean2.getClass()); }

      }

      Type of xbean: class org.apache.xmlbeans.impl.values.XmlAnyTypeImpl
      Type of xbean2: class x0Metadata.oasisNamesTcSAML2.impl.EntitiesDescriptorDocumentImpl

      xbean2 is of correct user-derived type EntitiesDescriptorDocument but the xbean, parsed from a DOM Node, is always of generic type XmlAnyType.

      Attachments

        Activity

          People

            cezar Cezar Cristian Andrei
            hackingbear@gmail.com Hacking Bear
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: