Merging XML Files After Debatching - 10.1.3.4

I have a large fixed-width file which I am debatching and transforming to XML files:
bigfile.txt (~52MB) -> file_%SEQ%.xml (~4MB each)
resulting in:
file_2001.xml (~4MB)
file_2002.xml (~4MB)
file_2003.xml (~4MB)
file_2004.xml (~4MB)
I would like to merge these resulting XML files back into one XML file:
bigfile.xml (~52MB)
I know the [Append="true"] attribute in the file adapter used to write the file won't "work" with XML files. I've tested this anyway and received "out of memory" errors while appending. This removes post-processing options.
I'm new to BPEL and feel that I must be missing something simple. Any advice would be appreciated.
Thanks in advance,
Rob

Hi Rob,
You can create a temp variable of xsd type of bigfile.xml, read all below files one by one and within assign activity use append operation to append all xml files, when all read is complete, dispatch this message to file adapter to write file.
file_2001.xml (~4MB)
file_2002.xml (~4MB)
file_2003.xml (~4MB)
file_2004.xml (~4MB)
Here, there is a possibility of out of memory error.
Please try it,
Regards

Similar Messages

  • SAP PI 7.1. Splitting XMl file after 998 rows.

    I need to split the XML file for FI interface after 998 rows. How I can use File content conversion with XML file at sender adapter?
    Please suggest me a solution.

    Hi Nirman,
    If it is an XML file then you need to handle that in mapping. Below is the sample code.
    int count  = 0;
    int count1  = 0;
    for(int j = 0; j< a.length; j++)
         count  = count + 1;
         count1 = count1+ 1;
         result.addValue(a[j]);
         if (count == 998)
    //     if (count == var998)
              if (a.length - count1==0)
                        count = 0;
              else
                        result.addContextChange();
                        count = 0;

  • Junk Characters in the output XML file after Parsing

    Hi
    I am using DOM parser to parse an XML file.
    After parsing the input XML file, i am fetching some contents
    from the same and also putting the same contents in the parsed output file which is also an XML file.
    The problem here is that the after putting the contents to the output XML file from the input XML file,
    some junk character appears at the end of each and every tag in the outputfile.
    The junk character is some thing like this : " ampersand hash thirteen and a semicolon "
    (*THE MESSAGE DID NOT ACCEPT THE SYMBOLS KINDLY TRANSLATE THE ABOVE WORDINGS*
    INTO SYMBOLS)
    This character gets appended at the end of each and every tag in the output file due to which the output file
    is not recognised as an XML file.
    Please let me know as to why is this character appearing and also please suggest some solution
    for the same.
    -Thanks in Advance.
    Edited by: itskarthik on Oct 10, 2008 7:16 AM
    Edited by: itskarthik on Oct 10, 2008 7:18 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM

    Wierd.
    Try this piece of code. (You can always change it to use input file and output file instead of string if you want)
    What is your output?
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    public class XMLTest {
         public static void main(String[] args) throws Exception {
              String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
                                  "<test>\r\n" +
                                  "</test>";
              System.out.println("Input:");
              lookForCR(input);
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document doc = factory.newDocumentBuilder().parse( new ByteArrayInputStream(input.getBytes()) );
              Source source = new DOMSource(doc);
              ByteArrayOutputStream bArrOut = new ByteArrayOutputStream();
              Result result = new StreamResult( new StripOutputStream( bArrOut ) );
              Transformer xformer = TransformerFactory.newInstance().newTransformer();
              xformer.transform(source, result);     
              System.out.println("\nResult:");
              lookForCR(bArrOut.toString());
              System.out.println("\nDone");
         public static void lookForCR(String input) throws Exception {
              char[] chars =input.toCharArray();
              for ( char chr : chars ) {
                   if (chr == 13 ) {
                        System.out.println("Has 0x0D character!!");
    class StripOutputStream extends OutputStream {
         OutputStream out = null;
         public StripOutputStream(OutputStream out) {
              this.out = out;
         @Override
         public void write(int b) throws IOException {
              if ( b != 13 )
                   out.write(b);
    }- Roy

  • Looking for a way to move a rejected xml file after loading it

    Hi all,
    I'm currently looking for a solution to do the following:
    I've loaded multiple xml files into an external table and after firing a few queries on that external table, I've moved the xml data into a normal oracle table
    depending on a few values which need to be met (e.g. last two digits of column a need to be the same as the last two digits of column b)
    All of this works fine, but I'd like to be able to move the xml files which don't meet these requirements to another folder on the filesystem named e.g. 'rejected'
    now, my shell script just moves all the xml files to a processed folder after loading them into an external table.
    I've looked at utl_file.frename but I need to be able to automatically move more than one file if neccesary instead of filling in one filename in the frename statement.
    (maybe the filenames need to be entered into a separate table?)
    Thanks in advance and your help is much appreciated!

    You can look through some of the different Layouts available.
    Select your page.
    Click the "Layout" icon on the lower right hand of the application window.
    Above it will appear a "BACKGROUND" section and a "LAYOUT" section.
    Immediately below the "LAYOUT" is a drop down menu which will show you all the different options.

  • Changes in the xml file AFTER submitting to store

    hi,
    I recently added a Podcast for BMWGroup.com to the iTunes store, which hasn't been released yet.
    What I want to know is, whether changes in the xml file, that i made AFTER submitting it will be taken over when the feeds are going to be released.
    For example a different categorie or image..
    and if not? how can i change categorie or image later? does it update from the xml?
    does anyone know?
    thx,
    best regards,
    oliver
    thx,

    Oliver:
    The simple answer is yes. Any changes you make to your RSS feed file (xml file) will eventually be updated by ITMS. Usually ITMS updates feed changes within 24 hours. However, the most recent changes I made in my feed files took almost 8 days before ITMS refreshed my listing.
    One issue is clear. If you make changes to your image file, there is a high probability that when ITMS updates your database record, your listing in ITMS will show the broken link image for awhile. I've changed my image file twice, and each time, my ITMS listing showed the broken link image. Eventually the new image shows up, but it does take a long time for this day and age.
    Good luck!

  • Merging XML files

    Hi All,
    I want to merge two XML files using XSL under Apache's Xalan.
    Or If there is any way to merge two XMI documents (XML For Metadata Ineterchange) then it is well.

    sure, use the document() function in XSL to call the content of another XML.
    <xsl:apply-templates select="document('http://myfile1.xml')"/>
    <xsl:apply-templates select="document('http://myfile2.xml')"/>

  • Merging xml files element by lement

    Hi, I have two xml files of dept and emp tables. I want to merg these two xml files in such a way that the output should be grouped by deptnos.
    i.e., under dept deptno 10 child node, i should get all emp child nodes who have deptno 10. How can I do this using DBMS_XMLDOM. Please help. Thank you.
    dept xml -
    <?xml version="1.0"?>
    <DEPT_SET>
    <DEPT>
    <DEPTNO>10</DEPTNO>
    <DNAME>ACCOUNTING</DNAME>
    <LOC>NEW YORK</LOC>
    </DEPT>
    <DEPT>
    <DEPTNO>20</DEPTNO>
    <DNAME>RESEARCH</DNAME>
    <LOC>DALLAS</LOC>
    </DEPT>
    <DEPT>
    <DEPTNO>30</DEPTNO>
    <DNAME>SALES</DNAME>
    <LOC>CHICAGO</LOC>
    </DEPT>
    <DEPT>
    <DEPTNO>40</DEPTNO>
    <DNAME>OPERATIONS</DNAME>
    <LOC>BOSTON</LOC>
    </DEPT>
    </DEPT_SET>
    emp xml -
    <?xml version="1.0"?>
    <EMP_SET>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7902</MGR>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    <MGR>7698</MGR>
    <HIREDATE>20-FEB-81</HIREDATE>
    <SAL>1600</SAL>
    <COMM>300</COMM>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7521</EMPNO>
    <ENAME>WARD</ENAME>
    <JOB>SALESMAN</JOB>
    <MGR>7698</MGR>
    <HIREDATE>22-FEB-81</HIREDATE>
    <SAL>1250</SAL>
    <COMM>500</COMM>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7566</EMPNO>
    <ENAME>JONES</ENAME>
    <JOB>MANAGER</JOB>
    <MGR>7839</MGR>
    <HIREDATE>02-APR-81</HIREDATE>
    <SAL>2975</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7654</EMPNO>
    <ENAME>MARTIN</ENAME>
    <JOB>SALESMAN</JOB>
    <MGR>7698</MGR>
    <HIREDATE>28-SEP-81</HIREDATE>
    <SAL>1250</SAL>
    <COMM>1400</COMM>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7698</EMPNO>
    <ENAME>BLAKE</ENAME>
    <JOB>MANAGER</JOB>
    <MGR>7839</MGR>
    <HIREDATE>01-MAY-81</HIREDATE>
    <SAL>2850</SAL>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7782</EMPNO>
    <ENAME>CLARK</ENAME>
    <JOB>MANAGER</JOB>
    <MGR>7839</MGR>
    <HIREDATE>09-JUN-81</HIREDATE>
    <SAL>2450</SAL>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7788</EMPNO>
    <ENAME>SCOTT</ENAME>
    <JOB>ANALYST</JOB>
    <MGR>7566</MGR>
    <HIREDATE>09-DEC-82</HIREDATE>
    <SAL>3000</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7839</EMPNO>
    <ENAME>KING</ENAME>
    <JOB>PRESIDENT</JOB>
    <HIREDATE>17-NOV-81</HIREDATE>
    <SAL>5000</SAL>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7844</EMPNO>
    <ENAME>TURNER</ENAME>
    <JOB>SALESMAN</JOB>
    <MGR>7698</MGR>
    <HIREDATE>08-SEP-81</HIREDATE>
    <SAL>1500</SAL>
    <COMM>0</COMM>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7876</EMPNO>
    <ENAME>ADAMS</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7788</MGR>
    <HIREDATE>12-JAN-83</HIREDATE>
    <SAL>1100</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7900</EMPNO>
    <ENAME>JAMES</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7698</MGR>
    <HIREDATE>03-DEC-81</HIREDATE>
    <SAL>950</SAL>
    <DEPTNO>30</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7902</EMPNO>
    <ENAME>FORD</ENAME>
    <JOB>ANALYST</JOB>
    <MGR>7566</MGR>
    <HIREDATE>03-DEC-81</HIREDATE>
    <SAL>3000</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <EMP>
    <EMPNO>7934</EMPNO>
    <ENAME>MILLER</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7782</MGR>
    <HIREDATE>23-JAN-82</HIREDATE>
    <SAL>1300</SAL>
    <DEPTNO>10</DEPTNO>
    </EMP>
    </EMP_SET>
    Required output is -
    <?xml version="1.0"?>
    <DEPT_SET>
    <DEPT>
    <DEPTNO>10</DEPTNO>
    <DNAME>ACCOUNTING</DNAME>
    <LOC>NEW YORK</LOC>
    </DEPT>
    <DEPT>
    <DEPTNO>20</DEPTNO>
    <DNAME>RESEARCH</DNAME>
    <LOC>DALLAS</LOC>
    </DEPT>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7902</MGR>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    <DEPTNO>20</DEPTNO>
    </EMP>
    <DEPT>
    <DEPTNO>30</DEPTNO>
    <DNAME>SALES</DNAME>
    <LOC>CHICAGO</LOC>
    </DEPT>
    <DEPT>
    <DEPTNO>40</DEPTNO>
    <DNAME>OPERATIONS</DNAME>
    <LOC>BOSTON</LOC>
    </DEPT>
    </DEPT_SET>

    Well, if you are building the dept and emp XML files yourself, then the easiest solution is to use one SQL/XML (XMLElement, XMLForest, XMLAgg) statement to build the required XML instead of building two pieces and trying to merge.
    If you can't go that option, then you can use importNode and appendChild to insert your selected nodes into the correct spot in the main XML.
    As a starter, here is a snippet of code that takes a single node from a temp DOMDocument and inserts it into the master DOMDocument at a certain location.
        l_inq_nodelist := dbms_xmldom.getelementsbytagname(l_temp_domdoc,
                                                           'theDesiredNode');
        l_inq_nl_len := xmldom.getlength(l_inq_nodelist);
        IF l_inq_nl_len > 0 THEN
           -- Take the node above and adopt it into the response document
           l_temp2_nd := dbms_xmldom.importNode(o_response_doc,
                                                dbms_xmldom.item(l_inq_nodelist, 0),
                                                TRUE);
           -- Put the node in the correct position in the response document                                          
           l_temp2_nd := xdb.dbms_xmldom.appendChild(l_rsp_msg_nd, l_temp2_nd);
        END IF;I know your situation is slightly different as you need to take multiple nodes but once you can select out your nodes from the emp XML, you can use the above to insert into the dept XML. I would provide more samples but it has been a while since I've read XML via DOMDocument as I use XMLType when reading XML. Feel free to post what you have if you get stuck.

  • Windows Phone 8 Can't Update listbox item in XML file after using hardware back button?

    Hi All i have a list box and i am saving list box selected item in XML file thats working fine but the problem is that when i will close my app and reopen and add more value to list box my previous value is removed form the xml file and listbox also how
    i can save my current added value and previous value in xml file i am using following code :
    and iam using following code
    <Grid x:Name="ContentPanel" Grid.Row="2" Margin="15,10,15,0">
    <ListBox Name="list_location" Tap="list_location_Tap" Foreground="Black">
    <ListBox.ItemTemplate>
    <DataTemplate>
    <TextBlock x:Name="item_name" Text="{Binding description, Mode=OneWay}" Padding="5,15,5,15" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeLarge}"/>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
    <ListBox Name="list_locationAdd" Background="Red" Foreground="Black" Visibility="Collapsed">
    <ListBox.ItemTemplate>
    <DataTemplate>
    <TextBlock x:Name="item_name" Text="{Binding description, Mode=OneWay}" Padding="5,15,5,15" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeLarge}"/>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
    </Grid>
    and my back end code is follow:
    XmlWriterSettings x_W_Settings = new XmlWriterSettings();
    x_W_Settings.Indent = true;
    using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
    using (IsolatedStorageFileStream stream = ISF.OpenFile(filename, FileMode.Create))
    XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<Prediction>));
    using (XmlWriter xmlWriter = XmlWriter.Create(stream, x_W_Settings))
    data.Add(new Prediction() { description = App.professionalId });
    list_locationAdd.ItemsSource = data;
    serializer.Serialize(xmlWriter, data);
    protected override void OnNavigatedTo(NavigationEventArgs e)
    try
    if (list_locationAdd != null)
    using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
    using (IsolatedStorageFileStream str = ISF.OpenFile(filename, FileMode.Open))
    XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<Prediction>));
    ObservableCollection<Prediction> data = (ObservableCollection<Prediction>)serializer.Deserialize(str);
    if (list_locationAdd != null)
    this.list_locationAdd.ItemsSource = data;
    list_locationAdd.Visibility = Visibility.Visible;
    catch (Exception ex)

    Can you provide a working sample?  Upload to Onedrive and share it with us.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • How read the PDF and XML files after Unzipping the folder

    Hi Gurus,
    I have a zipped folder and i this two types of files .XML and .PDF files.
    I am able to unzip the folder and reading the .XML files, unable to read the PDF files.
    I want to send this PDF file to the target as it is.
    Please help me.
    Regards
    Sreeni

    Hi,
    Hi ,
    Plse see the below thread
    PI 7.1 : Taking a input PDF file and mapping it to a hexBinary attribute
    It will help you.
    You can write custom adapter modules:
    Java Mappingh;
    SAP Conversion agent:
    http://www.riyaz.net/blog/parsing-pdf-files-using-sap-conversion-agent-part-i/technology/sap/628/
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/content.htm

  • 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());

  • Pacnew_scripts: scripts to merge some .pacnew files after an upgrade

    info page: http://xyne.archlinux.ca/info/pacnew_scripts
    I was updating my old system which doesn't get turned on that often and had to deal with about 15 pacnew files. Most only required a simple "mv /path/to/file{.pacnew,}" but some required merging. I found a script that I had written a while ago to merge /etc/group.pacnew, made some changes, made a copy which can handle gshadow, then wrote scripts to handle the pacman mirrorlist and locale.gen.
    Thus the pacnew_scripts package was born.
    infopage wrote:
    This package contains scripts which can help merge .pacnew files after a pacman upgrade. These scripts print their results to STDOUT and thus do NOT make any changes to the files. It is up to the user to inspect the output and, if satisfied, redirect it to the original file and then delete the .pacnew file.
    The scripts accept "-c" and "--compare" as options and will display relevant information about differences between the files. For group and gshadow, this will display 3 columns to compare the original, .pacnew and merged files and will use colors to highlight changes. For the mirrorlist and locale.gen, it will check that all settings in the original file are available in the new file and print out a list of any that aren't (e.g. if one of your current mirrors has been dropped from the mirrorlist, it will be listed in the output).
    I'll probably add scripts as I go. I might also merge the scripts to avoid some redundancy but I decided to keep them simple for now. merge_pacnew_locale_gen is actually very generic and works on the mirrorlist and probably other files as well. If you find any, let me know.
    Last edited by Xyne (2010-03-21 13:03:34)

    beroal wrote:
    I'm really astonished that you interpreted my post as an advertisement of "diffpac".
    Xyne wrote:Have you even tried these scripts and compared them to the alternatives that you've proposed? … you can at least post comments based on an informed comparison.
    I expected such a comparison from you. If "pacnew_scripts" merges files automatically, what algorithm does it use?
    I didn't interpret it as advertisement. It seemed that you read the basic description of what this does and concluded that something else already does the same thing. Following on the tail of the previous posts I felt that your post was somewhat rude because it implies that this is useless. Obviously that is relative, but even so I see no point of posting in this thread to express it, even indirectly.
    I admit that I may have interpreted your post the wrong way and if I did then I apologize, but even then I don't understand why you felt the need to post what you did in a contribution thread.
    As for algorithms, there are different scripts and they use different algorithms. The group and gshadow scripts create hash representations of the groups in the original and .pacnew files. Groups which only exist in one of the files pass through untouched. Groups which exist in both have their members combined, which usually means that the original simply passes through. Using the "--compare" option, three aligned columns are displayed which clearly shows existing groups, new groups and the results of merging, with colors used to highlight all changes.
    The mirrorlist script creates a list of selected servers in the current mirrorlist and generates a new mirrorlist from the .pacnew mirrorlist with all servers in the generated list uncommented, if they exist. Passing the "--compare" option will simply check if all the currently selected mirrors still exist in the new mirrorlist (they might not if they're dropped) and prints out a list of any that aren't.
    The locale_gen script does the same thing for currently enabled locales.
    Also note that all of the results are printed to STDOUT so no files are actually changes. It isn't fully "automatic" and the user is expected to sanity-check the results before overwriting the target files.

  • Error while uploading .xml file for Customer/Vendor List for Italy

    Hi All,
    We are facing problem while uploading the .xml file in DMEE transaction for the new Customer/Vendor List for Italy.
    We have followed the entire process given in the OSS Note(1090857).
    We have SAP 4.6c and followed the below steps:
    1. Created ID-FI-IT Development class
    2. Added domains
    3. Added Data elements
    4. Tried to upload the given .xml file and got any error saying ".xml file could not be interpreted".
    Also there is a .SAR file mentioned to upload if we receive any errors while uploading .xml file.
    Tried uploading the .SAR file also. STill we are recieving the same Error.
    Can any one of you help us out.
    Thanks in Advance.
    Ramesh

    Ok, we upload .SAR file in this way:
    1. unpack .SAR file with SAPCAR.EXE program. Yuo obtain 2 files
    R492445.P9C and K492445.P9C
    2. put K492445.P9C in directory \SAPMNT\TRANS\COFILES and put R492445.P9C in directory \SAPMNT\TRANS\DATA of your system (DEV, TST or PRD)
    3. Use Tx STMS. If You want create DMEE tree in DEV system, go to DEV import queue. Choose menu Extras | Other requests | Add. Insert P9CK492445 in Transp. request field.
    4. Import the request. This creates the DMEE tree. You don't need ti upload XML file after. You can see the DMEE tree created with Tx DMEE and inserting
    Tree type        UMS1            
    Format tree     IT_CUST_VEN_LIST
    5. after continue follow the note
    I hope this help you
    Roberto

  • URGENT - Posting a XML file to a listener URL

    Hi all,
    I have a situation like this: A servlet Client should post a XML file
    to a listener URL, and the listener responds back with a XML file
    after the processing the posted XML file.
    1. Before posting, the servlet client should establish a session with
    the server on which the listener URL is sitting and the Server will
    return a cookie with the authentication credentials to the servlet
    client.
    2. That cookie should be added to the HTTPResponse and then the
    posting of the file should happen.
    The first part is happening okay ..and i could add that cookie to the
    HTTPresponse.
    Now, did anyone successfully post a XML file to a listener URL like this from a servlet?
    I tried using URLConnection, but my cookie got lost and i got back a 401 error. The key there is i should use the same HTTPrequest and HTTPresponse objects, as the cokie needs to be retained!
    Any example code please!!
    thanks a lot
    Rox

    Thanks for your response, but i dont think using authenticator would work. To tell you exactly what is happening there, the url to which the sevlet posts the XML file is protected by Siteminder ( a Enterprise securty platform) and all it requires is a cookie with authenticated credentials on the httprequest/httpresponse objects which are trying to post to that URL. If it find the cookie with the credentials, then the requestor will not be challenged for credentials.
    Here is what i am doing:
    String urlString = "http://webservicesURL.com/ws";
    Cookie SMSESSION = setSMSession();
              if(SMSESSION != null)
                   response.addCookie(SMSESSION);     
              System.out.println("\n..Cookie confirmation..\n"+SMSESSION.getName()+" : "+SMSESSION.getValue());
    URL u = new URL(urlString);
              URLConnection conn = u.openConnection();
              conn.setDoOutput(true);
              conn.setDoInput(true);
              conn.setRequestProperty(SMSESSION.getName(),SMSESSION.getValue());
              OutputStream out = conn.getOutputStream();
    BufferedReader in = new BufferedReader(new FileReader(file));
              while((s = in.readLine())!= null)
                   xml_line = xml_line+s;
              writer.println("The XML file is ..\n");
              writer.println(xml_line);
              writer.println("\n\n\n");
              out.write(xml_line.getBytes());
              InputStream ins = conn.getInputStream();
    when i execute the servlet, i get a tomcat error 401 on the last line above.
    So the new URLConnection that is being opened, is not carying the credentials with it, or the siteminder is unable to read the credentails from the URLConnection. But i am positive that it can read the credentials from the cookie from the HttpResponse object.
    Do you have any more ideas, please?
    thanks

  • Reading an XML file and write the contents to another xml file in java

    Hi,
    I am new to xml parsing.My requirement is that I am getting a message (xml) using ibm MQ in the ByteArrayInputStream format.I have to read this xml message and write to another file.
    I am creating a POC for this.
    First I used simple reading and writing concept but the output is "java.io.FileInputStream@3e25a5 "
    Sample xml file
    - <Client>
    <ClientId>1234</ClientId>
    <ClientName>STechnology</ClientName>
    <DTU_ID>567</DTU_ID>
    <ClientStatus>ACTIVE</ClientStatus>
    - <LEAccount>
    <ClientLE>678989</ClientLE>
    <LEId>56743</LEId>
    - <Account>
    <AccountNumber>9876543678</AccountNumber>
    </Account>
    </LEAccount>
    - <Service>
    <Cindicator>Y2Y</Cindicator>
    <PrefCode>980</PrefCode>
    <BSCode>876</BSCode>
    <MandatoryContent>MSP</MandatoryContent>
    </Service>
    </Client>
    code:
    import java.io.ByteArrayInputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public class ByteArrayInputStreamToXml {
         public static void main(String srg[]) throws IOException{
              InputStream inputStream= new FileInputStream("C:\\soft\\test2\\sample1.xml");
              byte currentXMLBytes[] = inputStream.toString().getBytes();
              ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(currentXMLBytes);
              OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
              int read=0;
              byte[] bytes = new byte[1024];
              while((read = byteArrayInputStream.read(bytes))!= -1){
              out.write(bytes, 0, read);
              out.write( '\n' );
              inputStream.close();
              out.flush();
              out.close();
              System.out.println("New file created!");
    Please suggest me how can I use DOM/SAX parser ,I can see several code on net for reading xml file using SAX/DOM parser but writing an xml file after reading it using ByteArrayInputStream I am not getting .A help through some example Link will also be helpful for me.
    Thanks
    Sumit
    Edited by: user8687839 on Apr 30, 2012 2:37 AM
    Edited by: user8687839 on Apr 30, 2012 2:43 AM

    Thanks I got the result.
    package com.sumit.collections;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public class ByteArrayInputStreamToXml {
         public static void main(String srg[]) throws IOException{
              InputStream inputStream= new FileInputStream("C:\\soft\\test2\\sample1.xml");
              ByteArrayOutputStream buffer = new ByteArrayOutputStream();
              int nRead; byte[] data = new byte[1024];
              while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
              buffer.write(data, 0, nRead); } buffer.flush();
              byte currentXMLBytes[]= buffer.toByteArray();
              /* byte currentXMLBytes[] = inputStream.toString().getBytes();*/
              ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(currentXMLBytes);
              OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
              int read=0;
              byte[] bytes = new byte[1024];
              while((read = byteArrayInputStream.read(bytes))!= -1){
              out.write(bytes, 0, read);
              out.write( '\n' );
              inputStream.close();
              out.flush();
              out.close();
              System.out.println("New file created!");
    }

  • Periodic autosave of XML file

    Hi guys, 
    I'm having quite simple task, but no idea how to achieve it. A have a While loop, inside it I have som form to fill in and the output of this form is saved into xml file (using older MSXML library) and OK button for running parser and writting data into right place in XML file. All I need to do is to save XML file after the Stop button is hit, or after e.g. five minutes of application run. Just simple autosave feature.
    For better ilustration, please see picture, or example.vi file. 
    I am running LV 2012
    Thank you for your answers.
    Attachments:
    Example.vi ‏9 KB

    You could put these functions in an event structure within the loop. Have a shift register on the loop, passing the value through the various states of the event stucture. Have the "save" button trigger an event to save your data, and at the same time (bad pun) put the current millisecond timer value onto the shift register. In the time out case of the event structure (with a time out value of, say, 100mS wired to it to cause the timeout case to trigger regularly), compare the value of the shift register with the current millisecond count and when enough time (x) has passed have it: 1) put the new time count on the shift register, 2) save the file. This should ensure that the file is saved every x within a 100mS window of time error.  
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

Maybe you are looking for

  • Deploying Adobe Creative Cloud via GPO

    A few months ago my long and lasting journey with Adobe CC started and I was pretty eager to deploy the software in our enterprise. As it comes out, with a little help from Adobe, that just made me crazy and a few pretty pointless and sensless tests

  • How to add a field in data entry section of cat2 transaction

    hi friends, i just want to know how i can add one more field in the data entry section of the cat2 transaction.would appreciate if u help me asap. thanks, sakshi

  • Will there be problems if I move referenced iphoto pics in aperture 3

    If haven't imported my pictures from iphoto because I want to keep it around and don't want to have double libraries. But what if I move or delete pics in aperture - which will be my main editor? Will they move in iphoto as well? I'm thinking this ma

  • Sync Occasionally connected feature

    HI all, I am new in the SAP MI. Currently, I am trying to create custom mobile application (occassionally connected) using webdynpro mobile handheld perspective in SAP Netweaver MI 7.1. I would like to ask your suggestion about how to code and call s

  • Fixing Gamma in the ScreenFlow App. A How Too...

    Sometimes when using the ScreenFlow App you might need to send the footage to FCP or Motion. The exported video from ScreenFlow will have an incorrect gamma, video will be (a lot) lighter. This is easily fixed... In the export setting window click on