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

Default behavior of Factory.parse (or set )

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Version 1.0.3
    • Fix Version/s: TBD
    • Component/s: XmlObject
    • Labels:
      None

      Description

      Dear XmlBeaner,

      I find the following behavior rather 'unnatural':

      if you do have a DOM element (likely to come from another library
      which doesnot use xmlbean) and you want to 'plug'-it with your
      XML-Bean structure it does not work 'out of the box' (even if the types
      are compatible !?!) and moreover produce non valid XML !

      It looks trivial:

      let's imagine that you want to add a signature (using xml-security):

      myXMLBean.setSignature( SignatureType.Factory.parse(sig.getElement())); // compile

      this will generate :

      <myXMLBean>
      <xd:Signature xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      ...
      </myXMLBean>

      while you expect :

      <myXMLBean>
      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      ...
      </myXMLBean>

      in order to make it you should use

      XmlOptions opts = new XmlOptions();
      opts.setLoadReplaceDocumentElement(null);

      myXMLBean.setSignature( SignatureType.Factory.parse(sig.getElement(),xmlopts));

      looks rather odd to me ...

      jc

        Attachments

        1. Jira93.java
          6 kB
          jean-christophe.pazzaglia
        2. Jira93.java
          0.9 kB
          Yana Kadiyska
        3. jira-93.xsd
          0.6 kB
          Yana Kadiyska

          Activity

            People

            • Assignee:
              cezar Cezar Cristian Andrei
              Reporter:
              jean-christophe.pazzaglia jean-christophe.pazzaglia
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: