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

Namespace verbosity when serialized with AXIOM API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • Version 2.3, Version 2.3.1
    • None
    • Binding, XmlObject
    • None

    Description

      XMLBeans used with Axis2 generates lot of namespaces declaration.
      Is it a bug or is there a way to reduce it ?

      With this code:
      GetLocatedProductsDocument document = GetLocatedProductsDocument.Factory
      .newInstance(new XmlOptions().setSaveAggressiveNamespaces());
      GetLocatedProductsDocument.GetLocatedProducts getLocatedProducts = document
      .addNewGetLocatedProducts();
      for (int i = 0; i < 10; i++)

      { ProductRequest productRequest = getLocatedProducts.addNewParam0(); productRequest.setCallType(1); productRequest.setFamilyCode(1); productRequest.setModuleCode(1); productRequest.setSubFamilyCode(1); }

      XmlOptions xmlOptions = new XmlOptions();
      xmlOptions.setSaveNamespacesFirst();
      xmlOptions.setSaveAggressiveNamespaces();

      org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new org.apache.axiom.om.impl.builder.StAXOMBuilder(
      OMAbstractFactory.getOMFactory(),
      new org.apache.axis2.util.StreamWrapper(document.newXMLStreamReader(xmlOptions)));
      org.apache.axiom.om.OMElement documentElement = builder
      .getDocumentElement();
      ((org.apache.axiom.om.impl.OMNodeEx)documentElement).setParent(null);
      documentElement.serialize(System.out, new OMOutputFormat());

      Here is an example:
      <getLocatedProducts xmlns="http://v1.product.ws.store.kingfisher.com"><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0></getLocatedProducts>

      Thank you

      Attachments

        1. NamespaceBug.zip
          48 kB
          Philippe Mouawad

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pmouawad Philippe Mouawad
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: