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

How to suppress Namespace in XmlBeans Object ?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Critical
    • Resolution: Invalid
    • Version 1.0.4
    • Version 2.1
    • Binding
    • None
    • TEST

    Description

      Hi....

      Im using XmlBeans for paste 1yr, i dont know much on this topics, but i got one requirement for that want to suppress total Namespace
      from input xml. My scenario im getting xml like this....

      <?xml version="1.0" encoding="UTF-8"?>
      <XSDPaymentRequestMsg xmlns="urn:XSD:xsd:XSDPaymentRequestMsg.00.03.00"
      xmlns:HE2E="urn:XSD:xsd:XSDHdrSrv.001.07"
      xmlns:HTRT="urn:XSD:xsd:XSDHdrTrt.001.07"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <XSDBdyPaymentRequest
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SSRD="urn:XSD:xsd:XSDBdyPaymentRequest.00.03.00"
      xmlns:SGNT="urn:XSD:xsd:XSDSgnInf.001.04"
      xmlns:GPRS="urn:XSD:xsd:XSDPaymentRequest.00.03.00">
      <SSRD:XSDEnvelPaymentRequest>
      <SSRD:XSDPaymentRequest>
      <GPRS:GrpHdr>
      <GPRS:MsgId>2008013100010</GPRS:MsgId>
      <GPRS:CreDtTm>2008-01-31T15:14:53</GPRS:CreDtTm>
      <GPRS:NbOfTxs>2</GPRS:NbOfTxs>
      <GPRS:CtrlSum>27.00</GPRS:CtrlSum>
      <GPRS:Grpg>GRPD</GPRS:Grpg>
      <GPRS:InitgPty>
      <GPRS:Nm>Fortunati Maria Grazia</GPRS:Nm>
      <GPRS:Id>
      <GPRS:OrgId>
      <GPRS:TaxIdNb>
      FRTMGR70D60G337W
      </GPRS:TaxIdNb>
      <GPRS:PrtryId>
      <GPRS:Id>0031885X</GPRS:Id>
      <GPRS:Issr>ACBI</GPRS:Issr>
      </GPRS:PrtryId>
      </GPRS:OrgId>
      </GPRS:Id>
      </GPRS:InitgPty>
      </GPRS:GrpHdr>
      </SSRD:XSDPaymentRequest>
      </SSRD:XSDEnvelPaymentRequest>
      </XSDBdyPaymentRequest>
      </XSDPaymentRequestMsg>

      if i get object like this...

      final XSDPaymentRequestMsgDocument requestMsgDocument =
      XSDPaymentRequestMsgDocument.Factory.parse(inputXml,new XmlOptions().setSaveAggresiveNamespaces());
      XSDBdyPaymentRequest000305 request000305 =
      requestMsgDocument.getXSDPaymentRequestMsg().getXSDBdyPaymentRequest();
      XSDPaymentRequest000305 request0003052 =
      request000305.getXSDEnvelPaymentRequestArray(0).getXSDPaymentRequest();

      XSDGenericIdentification1 pmtrequest = request0003052.getGrpHdr().getInitgPty().getId().getOrgId().getPrtryId();

      System.out.println(">>> pmtrequest = "+pmtrequest );

      OUTPUT
      ========

      I will get like this.....

      <xml-fragment
      xmlns:urn="urn:XSD:xsd:XSDPaymentRequest.00.03.05"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:HTRT="urn:XSD:xsd:XSDHdrTrt.001.07"
      xmlns:HE2E="urn:XSD:xsd:XSDHdrSrv.001.07\"
      xmlns:BODY="urn:XSD:xsd:XSDBdyPaymentRequest.00.03.05">
      <GPRS:Id>0031885X</GPRS:Id>
      <GPRS:Issr>ACBI</GPRS:Issr>
      </xml-fragment>

      but i Expect output is like this.........

      <xml-fragment>
      <Id>0031885X</Id>
      <Issr>ACBI</Issr>
      </xml-fragment>

      Can you please suggest me to how to do get this scenario?

      Regards,
      Rajesh.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vbtperk Rajeshkumar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: