How to remove empty lines from xml files after removing nodes from document

<pre>
Hi
<b>i have xml document, which is shown below
after removing some nodes from the document ,i am getting empty lines in place of removed nodes,how to resolve this and get the proper xml document without any errors</b>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE Message SYSTEM "TRD01.dtd">
<Message>
<Header>
<CounterPartyType>CLIENT</CounterPartyType>
<CreationTime>20134455</CreationTime>
<ErrorCode>363 </ErrorCode>
<ErrorEnterPriseId>N</ErrorEnterPriseId>
<ErrorStatus>1</ErrorStatus>
<ErrorSystemId>STL</ErrorSystemId>
<ErrorTimes>31</ErrorTimes>
<MessageType>T</MessageType>
<RecipientEnterpriseId>N</RecipientEnterpriseId>
<RecipentSystemId>EXM</RecipentSystemId>
<Remarks>REMARSK</Remarks>
<SenderEnterpriseId>N</SenderEnterpriseId>
<SenderSystemId>TR</SenderSystemId>
</Header>
</Message>
<ErrorCode>363 </ErrorCode>
<ErrorEnterPriseId>NIHK</ErrorEnterPriseId>
<ErrorStatus>1</ErrorStatus>
<ErrorSystemId>STL</ErrorSystemId>
<ErrorTimes>31</ErrorTimes>
XPathExpression expression5 = xpath.compile(xmlpath5);
Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
Node node5 = (Node) result5;
node5.getParentNode().removeChild(node5);
XPathExpression expression6 = xpath.compile(xmlpath6);
Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
Node node6=(Node) result6;
node6.getParentNode().removeChild(node6);
XPathExpression expression7 = xpath.compile(xmlpath7);
Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
Node node7=(Node) result7;
node7.getParentNode().removeChild(node7);
doc.normalize();
doc.normalizeDocument();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
t.setOutputProperty(OutputKeys.METHOD,"xml");
t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
the xml output i am getting is
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Message>
<Header>
<CounterPartyType>CLIENT</CounterPartyType>
<CreationTime>20134455</CreationTime>
<MessageType>TRD01</MessageType>
<RecipientEnterpriseId>N</RecipientEnterpriseId>
<RecipentSystemId>STL</RecipentSystemId>
<Remarks>REMARSK</Remarks>
<SenderEnterpriseId>N</SenderEnterpriseId>
<SenderSystemId>T</SenderSystemId>
</Header>
</Message>
<b>could you please let me know how to avoid empty lines in the xml doucment output</b>
this is the method i am using to get the result
public void ValidateRecord(String xml){
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
//parse file into DOM
/*DOMParser parser = new DOMParser();
parser.setErrorStream(System.err);
parser.setValidationMode(DTD_validation);
parser.showWarnings(true);*/
System.out.println ("HI THIS xml is validation "+xml);
Resolver res = new Resolver();
db.setEntityResolver(res);
Document doc = db.parse(new InputSource(new StringReader(xml)));
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
// XPathExpression expression = xpath.compile("//A/B[C/E/text()=13]");
String xmlpath="/Message/Header/CounterPartyType/text()";
String xmlpath1="/Message/Header/RecipentSystemId/text()";
String xmlpath2="/Message/Header/ErrorSystemId/text()";
XPathExpression expression = xpath.compile(xmlpath);
XPathExpression expression1 = xpath.compile(xmlpath2);
Object result = expression.evaluate(doc, XPathConstants.NODE);
Object result1 = expression1.evaluate(doc, XPathConstants.NODE);
Node node = (Node) result;
Node node1 = (Node) result1;
System.out.println("the values of the string is " +node.getNodeValue());
System.out.println("the values of the string is " +node1.getNodeValue());
// for (int i = 0; i < nodes.getLength(); i++) {
//System.out.println(nodes.item(i).getNodeValue());
// CAHNGING THE RECEIPENT NODE
XPathExpression expression2 = xpath.compile(xmlpath1);
Object result2 = expression2.evaluate(doc, XPathConstants.NODE);
Node node2 = (Node) result2;
System.out.println(node2);
node2.setNodeValue(node1.getNodeValue());
System.out.println(node2);
//removing the nodes from document
String xmlpath3="/Message/Header/ErrorCode";
String xmlpath4="/Message/Header/ErrorEnterPriseId";
String xmlpath5="/Message/Header/ErrorStatus";
String xmlpath6="/Message/Header/ErrorSystemId";
String xmlpath7="/Message/Header/ErrorTimes";
XPathExpression expression3 = xpath.compile(xmlpath3);
Object result3 = expression3.evaluate(doc, XPathConstants.NODE);
Node node3 = (Node) result3;
node3.getParentNode().removeChild(node3);
XPathExpression expression4 = xpath.compile(xmlpath4);
Object result4 = expression4.evaluate(doc, XPathConstants.NODE);
Node node4 = (Node) result4;
System.out.println("node value");
System.out.println(node4.getParentNode().getNodeName());
node4.getParentNode().removeChild(node4);
XPathExpression expression5 = xpath.compile(xmlpath5);
Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
Node node5 = (Node) result5;
node5.getParentNode().removeChild(node5);
XPathExpression expression6 = xpath.compile(xmlpath6);
Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
Node node6=(Node) result6;
node6.getParentNode().removeChild(node6);
XPathExpression expression7 = xpath.compile(xmlpath7);
Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
Node node7=(Node) result7;
node7.getParentNode().removeChild(node7);
// Node b13Node = (Node) expression.evaluate(doc, XPathConstants.NODE);
//b13Node.getParentNode().removeChild(b13Node);
doc.normalize();
doc.normalizeDocument();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
t.setOutputProperty(OutputKeys.METHOD,"xml");
t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
t.transform(new DOMSource(doc), new StreamResult(System.out));
catch (Exception e) {
     e.printStackTrace();
System.out.println(e.getMessage());
</pre>
Edited by: user12185243 on Apr 6, 2013 6:38 AM
Edited by: user12185243 on Apr 6, 2013 6:41 AM
Edited by: user12185243 on Apr 6, 2013 6:43 AM
Edited by: user12185243 on Apr 6, 2013 6:45 AM
Edited by: user12185243 on Apr 6, 2013 9:00 AM

either this way we can do this
1)
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
<b> factory.setIgnoringElementContentWhitespace(true); </b>
DocumentBuilder db = factory.newDocumentBuilder();
or
2)
java.io.StringWriter sw = new java.io.StringWriter();
StreamResult sr = new StreamResult(sw);
t.transform(new DOMSource(doc), sr);
String xml1 = sw.toString().trim();
<b> xml1=xml1.replaceAll("\\s",""); </b>
System.out.println(xml1.trim());

Similar Messages

  • How to eliminate empty lines in Flat file.

    Hi All,
    How to delete the empty lines in flat file,i am explaining below with data
    Here we have 3 fields with field lengths 30,10,34  i am checking the condition in message mapping if the middle field containing 9999999999 i am deleting the total record but in output file i am getting empty line how to eleminate empy lines in file please suggest me is it possible through Content Convertion.
    Thanks,
    Sudheer.
    0500189175247200000500003141700000142888073108000009640566210000
    0500189175247200000500012449050000142889072908000009623017230000
    0500189175247200000500000496210000142890073008000009631840760000
    0500189175247200000500000162130000142891072808000009613028730000
    0500189175247200000500001356750000142892072908000009621443430000
    0500189175247200000500012982910000142893072908000009622158440000
    0500189175247200000500001380990000142894073008000009631876720000
    0500189175247200000500000074560000142895072808000009613904430000
    0500189175247200000500003351650000142896072908000009623005030000
    0500189175247200000500000061170000142898072808000009613026140000
    0500189175247200000500000060590000142900073008000009630862400000
    0500189175247200000500000155320000142901072908000009623234640000
    0500189175247200000500043425220000142903072808000009612752160000
    0500189175247200000500000517450000142904073108000009640911680000
    0500189175247200000500006901140000142905073008000009630927540000
    0500189175247200000500001565590000142906073008000009630938540000
    0500189175247200000500000210440000142907073108000009640765850000
    0500189175247200000500000187500000142908072908000009622980650000
    0500189175247200000500000069240000142909072908000009622980660000

    Hi,
    I think we could handle this with may be usage of Advanced UDF in Graphical mapping only.
    Here as per the condition you are deleting the particular record but unknowingly blank value i.e. " " is getting passed so on target side blank node is created for this record.
    You need to just avoid this blank Node.
    If you can share the logic you have applied for Middle field as well the source and target structure I will be able to try the UDF code..based on it
    Thanks
    swarup

  • How to write empty line in text file

    hey
    i want to insert one empty line in text file.
    how to write this.
    i declared
    data: emptyrec(240) type c value space,
    and used
    TRANSFER emptyrec to e_file.
    but its not inserting empty line in the record.
    is there any special way have to do.
    ambichan.

    hai anand,
    I am posting the code snippet.
    i have commented that transfer line in '----
    ' like this
    pls refer below.
    ambichan
    DATA: PAGENO(4) TYPE N VALUE 1,
          DATAKBN(2) TYPE N VALUE 1,
          SUBNO(3) TYPE N VALUE 1,
          VPAGENO(4) TYPE C,
          VDATAKBN(2) TYPE C,
          VSUBNO(3) TYPE C,
          VREC(255) TYPE C,
          VRECORD(255) TYPE C,
          EMPTYREC(255) TYPE C VALUE SPACE,
          VCODE(10) TYPE C,
          VNAME2(35) TYPE C,
          VPAYDAT(10) TYPE C,
          VSGTXT(60) TYPE C VALUE SPACE,
          VSGTXT1(10) TYPE C,
          VKINGAKU(15) TYPE C VALUE SPACE,
          VBIKKO(30) TYPE C VALUE SPACE,
          VBELNR(10) TYPE C VALUE SPACE,
          VDMBTR(15) TYPE C,
          VGLT0-KSLVT(15) TYPE C,
          VGLT0-TSL01(15) TYPE C,
          VGLT0-TSL02(15) TYPE C,
          VGLT0-TSL03(15) TYPE C,
          VGLT0-TSL04(15) TYPE C,
          VGLT0-TSL05(15) TYPE C,
          VKIN(15) TYPE C,
          VTEGA(15) TYPE C.
    FORM FRM_OUTPUT_DATA.
      SORT ITAB_OUTPUT_SUMMARY BY LIFNR DTYPE.
      SORT ITAB_OUTPUT_ITEMS   BY LIFNR DTYPE BELNR.
    IF P_DISP = 'X'."check&#12508;&#12463;&#12473;&#12434;&#36984;&#12406;&#22580;&#21512;&#12289;&#12501;&#12449;&#12452;&#12523;&#20316;&#25104;&#20966;&#29702;&#12408;&#34892;&#12367;
    OPEN DATASET E_FILE FOR OUTPUT IN TEXT MODE.
      IF SY-SUBRC <> 0.
      WRITE: 'error',SY-SUBRC.
      EXIT.
      ENDIF.
    LOOP AT ITAB_LIFNR.
      PERFORM LISTDATA.
      PAGENO = PAGENO + 1.
      SUBNO = 1.
    ENDLOOP.
    CLOSE DATASET E_FILE."&#12501;&#12449;&#12452;&#12523;&#12463;&#12525;&#12540;&#12474;
    ENDFORM.                               " End of frm_output_data
    FORM LISTDATA.
      DATA:
        WK_PAY_AMOUNT  LIKE  BSEG-DMBTR,   " &#32020;&#25903;&#25173;&#38989;&#31639;&#20986;&#29992;
        VWK_PAY_AMOUNT(15) TYPE C,
        GLT0-TSL05_VAL LIKE GLT0-TSL05.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 1.
    BSIK-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      GLT0-TSL01  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 2. " &#21306;&#20998;&#65306;2
      GLT0-TSL02  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 3. " &#21306;&#20998;&#65306;3
      GLT0-TSL03  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 4. " &#21306;&#20998;&#65306;4
      GLT0-TSL04  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 5. " &#21306;&#20998;&#65306;5
      GLT0-TSL05  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
    glt0-tsl05  =  glt0-tsl05  +  glt0-tsl04.
      WK_PAY_AMOUNT  =  GLT0-TSL05  +  GLT0-TSL04.
    CHECK WK_SUBRC = 0.                
      BSEG-KOART = ' '.                    &#24773;&#22577;&#19981;&#35201;
      CLEAR: BSEG-SGTXT, BSEG-DMBTR, TGSBT-GTEXT, BKPF-BELNR.
      BSEG-KOART = 'Y'.                    " &#12501;&#12521;&#12464;&#65306;&#12504;&#12483;&#12480;&#12395;&#30456;&#27578;&#38989;&#12434;&#20986;&#21147;
    CLEAR: BSAK-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 6.  " &#21306;&#20998;&#65306;6
      BSAK-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSAK-DMBTR.
      WRITE : / PAGENO,
               SUBNO,
               DATAKBN,
               ITAB_LIFNR-LIFNR,
               ITAB_LIFNR-NAME2(25),
               P_PAY_T,
               GLT0-TSL01,
               GLT0-TSL02,
               GLT0-TSL03,
               GLT0-TSL04,
               GLT0-TSL05.
    VPAGENO = PAGENO.
    VSUBNO = SUBNO.
    DATAKBN = 1.
    VDATAKBN = DATAKBN.
    VCODE = ITAB_LIFNR-LIFNR.
    VNAME2 = ITAB_LIFNR-NAME2.
    VPAYDAT = P_PAY_T.
    VGLT0-TSL01 = GLT0-TSL01.
    VGLT0-TSL02 = GLT0-TSL02.
    VGLT0-TSL03 = GLT0-TSL03.
    VGLT0-TSL04 = GLT0-TSL04.
    VGLT0-TSL05 = GLT0-TSL05.
    CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT VKINGAKU
    VBIKKO VBELNR VGLT0-TSL01 VGLT0-TSL02 VGLT0-TSL03
    VGLT0-TSL04 VGLT0-TSL05 INTO VREC SEPARATED BY ','.
    CLEAR: BSAK-DMBTR, BSID-DMBTR, BSAD-DMBTR, BSEG-DMBTR, BSIK-DMBTR,
             WK_10 , WK_11 , GLT0-TSL05.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 7.  " &#21306;&#20998;&#65306;7
      BSID-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSID-DMBTR.
    &#37109;&#36865;&#26009;&#12398;&#20986;&#21147;&#20966;&#29702;
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 8.  " &#21306;&#20998;&#65306;8
      BSAD-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSAD-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
           WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 9.  " &#21306;&#20998;&#65306;9
      BSEG-DMBTR  =  ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  BSEG-DMBTR.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 10.
      WK_10 =     ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      READ TABLE ITAB_OUTPUT_SUMMARY
             WITH KEY   LIFNR  =  ITAB_LIFNR-LIFNR  DTYPE = 11.
      WK_11 =     ITAB_OUTPUT_SUMMARY-DMBTR * WK_RATIO.
      GLT0-TSL05  =   WK_PAY_AMOUNT - WK_10 - WK_11.
      WK_PAY_AMOUNT  =  WK_PAY_AMOUNT  -  GLT0-TSL05.
       VWK_PAY_AMOUNT = WK_PAY_AMOUNT.
       VKIN = WK_10.
       VTEGA = WK_11.
       CONCATENATE VREC VWK_PAY_AMOUNT VKIN VTEGA INTO
             VRECORD SEPARATED BY ','.
       TRANSFER VRECORD TO E_FILE.
        WRITE :
                VWK_PAY_AMOUNT,
                WK_10,
                WK_11.
       WRITE:/.
      BSEG-KOART  = 'X'.                   " &#12501;&#12521;&#12464;&#65306;&#35531;&#27714;&#37329;&#38989;&#12434;&#20986;&#21147;
      LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
                                AND   DTYPE = 5.          " &#21306;&#20998;&#65306;5
        BSEG-SGTXT   =  ITAB_OUTPUT_ITEMS-SGTXT.          " &#26126;&#32048;&#12486;&#12461;&#12473;&#12488;
        GLT0-KSLVT   =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.     " &#37329;&#38989;
        TGSBT-GTEXT  =  ITAB_OUTPUT_ITEMS-GTEXT.              BKPF-BELNR   =  ITAB_OUTPUT_ITEMS-BELNR.         
       SUBNO = SUBNO + 1.
       VSUBNO = SUBNO.
       DATAKBN = 2.
       VDATAKBN = DATAKBN.
       VGLT0-KSLVT = GLT0-KSLVT.
       VBIKKO = TGSBT-GTEXT.
       VBELNR = BKPF-BELNR.
       VSGTXT1 ='&#35531;&#27714;&#37329;&#38989;:'.
       CLEAR VRECORD.
      CONCATENATE  VSGTXT1 BSEG-SGTXT INTO VSGTXT.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
    VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
       WRITE :/ VPAGENO,VSUBNO,VDATAKBN,'&#35531;&#27714;&#37329;&#38989;:', VSGTXT, VGLT0-KSLVT,
                VBIKKO,VBELNR.
      ENDLOOP.
      CLEAR: BSEG-SGTXT,GLT0-KSLVT,BKPF-BELNR.
    LOOP AT ITAB_OUTPUT_ITEMS WHERE LIFNR = ITAB_LIFNR-LIFNR
                                AND   DTYPE = 6.          " &#21306;&#20998;&#65306;6
        BSEG-SGTXT   =  ITAB_OUTPUT_ITEMS-SGTXT.          " &#26126;&#32048;&#12486;&#12461;&#12473;&#12488;
        IF  ITAB_OUTPUT_ITEMS-SHKZG  =  CNS_CREDIT.       " &#37329;&#38989;
          GLT0-KSLVT  =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO.
        ELSEIF  ITAB_OUTPUT_ITEMS-SHKZG  =  CNS_DEBIT.
          GLT0-KSLVT  =  ITAB_OUTPUT_ITEMS-DMBTR * WK_RATIO * -1.
        ENDIF.
      TGSBT-GTEXT  =  ITAB_OUTPUT_ITEMS-GTEXT.          " &#20107;&#26989;&#38936;&#22495;&#12486;&#12461;&#12473;&#12488;
      BKPF-BELNR   =  ITAB_OUTPUT_ITEMS-BELNR.          " &#20253;&#31080;&#30058;&#21495;
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      DATAKBN = 3.
      VDATAKBN = DATAKBN.
      VGLT0-KSLVT = GLT0-KSLVT.
      VBIKKO = TGSBT-GTEXT.
      VBELNR = BKPF-BELNR.
      VSGTXT1 ='&#30456;&#27578;&#37329;&#38989;:'.
      CLEAR VRECORD.
      CONCATENATE  VSGTXT1 BSEG-SGTXT INTO VSGTXT.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VGLT0-KSLVT VBIKKO VBELNR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
    concatenate vpageno vsubno vdatakbn
      WRITE :/ PAGENO,SUBNO,DATAKBN,'&#30456;&#27578;&#37329;&#38989;',BSEG-SGTXT, GLT0-KSLVT,
             TGSBT-GTEXT, BKPF-BELNR.
      ENDLOOP.
       CLEAR VRECORD.
    *Insert empty line.
      TRANSFER EMPTYREC TO E_FILE.
      DATAKBN = 3.
      VDATAKBN = DATAKBN.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT ='&#28304;&#27849;&#37329;&#38989;'.
      VDMBTR = BSID-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO, SUBNO,DATAKBN, ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
             P_PAY_T,'&#28304;&#27849;&#37329;&#38989;', BSID-DMBTR.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#37109;&#36865;&#26009;'.
      VDMBTR = BSAD-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO, SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
             P_PAY_T,'&#37109;&#36865;&#26009;', BSAD-DMBTR.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#25391;&#36796;&#12415;&#25163;&#25968;&#26009;'.
      VDMBTR = BSEG-DMBTR.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      CLEAR: VDMBTR, VSGTXT, VRECORD.
      WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
            P_PAY_T,'&#25391;&#36796;&#12415;&#25163;&#25968;&#26009;',BSEG-DMBTR.
    *&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;&#12398;&#20966;&#29702;
      SUBNO = SUBNO + 1.
      VSUBNO = SUBNO.
      VSGTXT = '&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;'.
      VDMBTR = GLT0-TSL05.
      CONCATENATE VPAGENO VSUBNO VDATAKBN VCODE VNAME2 VPAYDAT VSGTXT
      VDMBTR INTO VRECORD SEPARATED BY ','.
      TRANSFER VRECORD TO E_FILE.
      WRITE :/ PAGENO,SUBNO,DATAKBN,ITAB_LIFNR-LIFNR,ITAB_LIFNR-NAME2,
            P_PAY_T, '&#12381;&#12398;&#20182;&#12398;&#25903;&#25173;&#12356;',GLT0-TSL05.
                                     glt0-tsl05.
    ULINE.
    CLEAR: VREC, VRECORD,VCODE,VNAME2,VPAYDAT,VSGTXT,VSGTXT1,VKINGAKU.
    CLEAR: VBIKKO,VBELNR,VDMBTR,VGLT0-KSLVT,VGLT0-TSL01,VGLT0-TSL02.
    CLEAR: VGLT0-TSL03,VGLT0-TSL04,VGLT0-TSL05,VKIN,VTEGA,VWK_PAY_AMOUNT.
    ENDFORM.

  • How to Suppress Empty Field in XML File

    My xml file sometimes has fields that are empty. No problem
    in ie, but in Firefox the Spry tabbed panel displays the data as
    "undefined".
    Any suggestions would be helpful.
    Thanks!

    You can check for it:
    <span spry:if=" '{your_dataref}' !=
    undefined">{your_dataref}</span>
    You may have to put 'undefined' in single quotes. I can never
    remember...

  • How to remove Unicode from XML file

    I get following error when unmarshal xml:
    [java] org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    Anyone know how to remove Unicode from xml file? Can I remove the unicode by rebuild the file?
    Thanks

    These sort of error usually occur when you're using a different character encoding to read the file than the one you wrote it with. Perhaps if you were to post the problem section of the file and/or the code that created it in the first place.

  • How to retrieve image from XML  file

    Hi All,
    I am new to XML. So any best guidance is appreciated.
    The application requirement is to display image retrived from uploaded xml file in file upload section of our application. And store that image in database.
    In my XML file , images & strings & numbers & booleans are there . I am able to save everything in database except images .
    I am using JSF, Seam & Hibernate combination. In my Hibernate entity class i took BLOB datatype for image.
    I am using following tags in my Xhtml file to display image
    <s:graphicImage value="#{hibernateentitybean.picBlobtype}" height="200" width="200">
    <s:transformImageSize width="200" height="200" />
    <s:transformImageType contentType="image/jpeg"/>
    But image is not displayed in Xhtml file
    I am using org.w3c.dom.Document for retrieving node name & corresponding value in that node in XML file.
    I am getting code like below for Image when i am logging all values from XML files in my bean class .
    x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl
    I want to convert this value to image. So i can convert image to bytes and store in BLOB.
    Can anyone guide me ? or any other approach .
    Thanks in advance for any reply.
    Regards,
    Naresh

    Dan_Koldyr wrote:
    agree, it's really odd. Just reread OP and it says:
    NareshDharmiVatsal  wrote:
    want to convert this value to image. In any case it doesn't get worth then another single code line:
    final String cdata = "x0lGQRQAAAABAAAAAAAAAFJHAQARAAAAVwBhAHQAZQByACAAbABpAGwAaQBlAHMALgBqAHAAZwAAAP/Y/+AAEEpGSUYAAQIBAGAAYAAA/+0YLl";
    final sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
    final byte[] data = decoder.decodeBuffer(cdata);
    Blob blob = new SerialBlob(data);//or what ever other DB-specific blob implementaiton Did i answered original question? Any more comments to my first replay?I can comment on this latest code. The package sun.misc is private to Sun (Oracle now of course). It is undocumented and may change or be removed altogether in a future release. There is a good free open source Base64 decoder in the Jakarta Commons Codec library.

  • HT1660 My "itunes library" folder is empty.  My libray music (prior to upgrading itunes) is now in an .xml file in my itunes location under my music.  How do I extract/convert this .xml file to a Itunes database and restore my Itunes music library??? Than

    My "itunes library" folder is empty.  My libray music (prior to upgrading itunes) is now in an .xml file in my itunes location under my music.  How do I extract/convert this .xml file to a Itunes database and restore my Itunes music library??? Thanks, Tom

    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

  • Removing Incorrect data from .xml files

    How do I remove info in the .xml files.
    When I 1st got my kit it read my fastest km as 4.55mins/km
    This is way too fast as my average is 6.00mins/km.
    Because the info is incorrect I am not getting congratulated by Paula or being able to improve slowly as I will never get to 4.55.
    HELP

    Haplogroup k,
    I think you have understood me. The file was created
    when the unit wasn't callibrated and recorded a false
    reading which was way too fast for me and a lot of
    runners also.
    I want to post best results now that the machine
    works right.
    Most people have said that they were amazed by how accurate the Nike+ was right from the box without calibration. But I'll take your word for it.
    I can get to the .xml files but it won't delete
    records, that's all I want to do.
    I don't know what you mean by "it won't delete records." Are you talking about your Personal Bests? No you cannot edit that fle. But you can delete a run from your Nano.
    However, you can save all your run data to your computer hard-drive, then RESTORE your Nano. But that will also wipe your calibration data and everything else (personal bests). I guess you could then recalibrate before doing any runs. Then put your old run data (your old xml files) back in your "latest" folder.

  • How to read the contents of XML file from my java code

    All,
    I created an rtf report for one of my EBS reports. Now I want to email this report to several people. Using Tim's blog I implemented the email part. I am sending emails to myself based on the USERID logic.
    However I want to email to different people other then me. My email addresses are in the XML file.
    From the java program which sends the email, how can I read the fields from XML file. If any one has done this, Please point me to the right examples.
    Please let me know if there are any exmaples/BLOG's which explain how to do this(basically read the contents of XML file in the Java program).
    Thank You,
    Padma

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • I want to load a sales order from xml file. How can I do.

    Hi,
    I want to load a sales order from XML  file. How can I do ? how can i create the sales order?
    what are the necessary  setting for  create the sales orders.
    with Regards,
    Prakesh.

    Three options come to my mind.
    Option 1: Use SAP transaction SXDA_TOOLS (Object Type BUS2032), Program Type (BAPI) and Program (CREATEFROMDAT2).
    Option 2: Use SAP transaction SXDA_TOOLS (Object Type BUS2032), Program Type (DINP) and Program (RVINVB10).
    Option 3: Translate the xml to IDoc so that ORDER04 / ORDER05 Idoc can be used to create Sales order (WEDI transaction).

  • How to retrieve value from xml file

    hi all,
    can somebody pls tell me how to retrieve value from xml file using SAXParser.
    I want to retrieve value of only one tag and have to perform some validation with that value.
    it's urgent .
    pls help me out
    thnx in adv.
    ritu

    hi shanu,
    the pbm is solved, now i m able to access XXX no. in action class & i m able to validate it. The only thing which i want to know is it ok to declare static ArrayList as i have done in this code. i mean will it affect the performance or functionality of the system.
    pls have a look at the following code snippet.
    public class XMLValidator {
    static ArrayList strXXX = new ArrayList();
    public void validate(){
    factory.setValidating(true);
    parser = factory.newSAXParser();
    //all factory code is here only
    parser.parse(xmlURI, new XMLErrorHandler());     
    public void setXXX(String pstrXXX){          
    strUpn.add(pstrXXX);
    public ArrayList getXXX(){
    return strXXX;
    class XMLErrorHandler extends DefaultHandler {
    String tagName = "";
    String tagValue = "";
    String applicationRefNo = "";
    String XXXValue ="";
    String XXXNo = "";          
    XMLValidator objXmlValidator = new XMLValidator();
    public void startElement(String uri, String name, String qName, Attributes atts) {
    tagName = qName;
    public void characters(char ch[], int start, int length) {
    if ("Reference".equals(tagName)) {
    tagValue = new String(ch, start, length).trim();
    if (tagValue.length() > 0) {
    RefNo = new String(ch, start, length);
    if ("XXX".equals(tagName)) {
    XXXValue = new String(ch, start, length).trim();
    if (XXXValue.length() > 0) {
    XXXNo = new String(ch, start, length);
    public void endElement(String uri, String localName, String qName) throws SAXException {                    
    if(qName.equalsIgnoreCase("XXX")) {     
    objXmlValidator.setXXX(XXXNo);
    thnx & Regards,
    ritu

  • How to remove element namespaces in XML file using DOM or SAX?

    Hi Guys,
    I developed a JAVA mapping in XI to add name spaces for XML file, after mapping,name spaces xmlns="http://www.mro.com/mx/integration" and xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" were added correctly, but for some nodes, such as <Header> and <Content>, a name space xmlns="" was added automatically.Please check below files to compare.
    It looks like be added automatically by XI. I didn't process anything for these nodes in JAVA program.
    Now the issue is, how can I remove these redundant namespaces? Such as xmlns="".
    Can I remove them using DOM or SAX in JAVA Mapping?
    Thanks in advance.
    ====>Original XML file
    <?xml version="1.0" encoding="UTF-8"?>
    <LLYLPPInterface language="EN">
       <Header>
          <SenderID>GBIP</SenderID>
          <CreationDateTime>2008-02-13T22:49:34-05:00</CreationDateTime>
          <RecipientID/>
          <MessageID/>
       </Header>
       <Content>
          <LLY-LPP>
             <INVOICE>
                <INVOICELINE>
                   <PONUM>4780000008</PONUM>
                   <POLINENUM>1</POLINENUM>
                   <INVOICEQTY>1</INVOICEQTY>
                   <LOADEDCOST>68</LOADEDCOST>
                </INVOICELINE>
             </INVOICE>
          </LLY-LPP>
       </Content>
    </LLYLPPInterface>
    ===>Target XML file after JAVA mapping
    <?xml version="1.0" encoding="utf-8"?>
    <LLYLPPInterface language="EN" xmlns="http://www.mro.com/mx/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header xmlns="">
              <SenderID>GBIP</SenderID>
              <CreationDateTime>2008-02-13T23:11:55-05:00</CreationDateTime>
              <RecipientID/>
              <MessageID/>
         </Header>
         <Content xmlns="">
              <LLY-LPP>
                   <INVOICE>
                        <INVOICELINE>
                             <PONUM>4780000008</PONUM>
                             <POLINENUM>0</POLINENUM>
                             <INVOICEQTY>1</INVOICEQTY>
                             <LOADEDCOST>68</LOADEDCOST>
                        </INVOICELINE>
                   </INVOICE>
              </LLY-LPP>
         </Content>
    </LLYLPPInterface>
    Edited by: Eddie Zhang on Feb 14, 2008 9:22 AM
    Edited by: Eddie Zhang on Feb 14, 2008 9:24 AM

    Hi Milan,
    Thanks for your replay.
    Actually when I used module XMLAnonymizerBean to convert namespaces, the header of XML, such as <?xml version="1.0" encoding="UTF-8"?> was converted to format <?xml version='1.0' encoding='UTF-8'?>, quote was converted to single quote. Although I set parameter anonymizer.quote = ", it still didn't work, single quote appeared instead of quote.
    I'm not sure why this happened. Can anyone help to clarify this?
    Thanks
    Edited by: Eddie Zhang on Feb 15, 2008 2:11 AM

  • How to parse contents from XML file in Java

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

    Hi All,
    I have a scenario like this . I have one xml file with key value pairs of ( name , URL ) . I have retrieved contents from XML file , now I want to parse these contents and store in a bean object.
    How to parse Contents of XML file??
    Thanks in advance,
    Rajendra.

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • How to extract data from XML file with JavaScript

    HI All
    I am new to this group.
    Can anybody help me regarding XML.
    I want to know How to extract data from XML file with JavaScript.
    And also how to use API for XML
    regards
    Nagaraju

    This is a Java forum.
    JavaScript is something entirely different than Java, even though the names are similar.
    Try another website with forums about JavaScript.
    For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3

Maybe you are looking for