Single xml synchronize access

I have a single XML file and my program have many calls can update it, potentially at close to the same time. ( I have [Fatal Error] Premature end of file]
How i can synchronize access to the single xml file?

Here my code:
public static void update (String id, String child, String value) {
          try {
               DocumentBuilder db = DocumentBuilderFactory.newInstance()
                         .newDocumentBuilder();
               Document doc = db.parse(NetworkManagerGUI.xmlData);
               org.w3c.dom.Node element = org.apache.xpath.XPathAPI
                         .selectSingleNode(doc.getDocumentElement(), "//node[@id='"
                                   + id + "']");
               if (element != null)
                    ((Element) element).setAttribute(child, value);
               TransformerFactory tFactory = TransformerFactory.newInstance();
               Transformer transformer = tFactory.newTransformer();
               transformer.setOutputProperty(OutputKeys.INDENT,"yes");
               DOMSource source = new DOMSource(doc);
               StreamResult result = new StreamResult(NetworkManagerGUI.xmlData);
               transformer.transform(source, result);
          } catch (Exception ex) {
How synchronize many updates?

Similar Messages

  • Writing multiple arrays to a single xml file at seperate times without overwriting the previous file?

    Hi my name is Dustin,
    I am new to labview and teststand... I am trying to right multiple arrays of data to a single xml file. I can do this with a cluster but I have to create a variable for each of those arrays (21 arrays) and I was hoping to use the same variable for each array. Meaning I obtain my array of data write it to an xml file then replace that array in that variable with a new array and then call up my VI that writes that array to an xml file and write it to the same xml file underneath the first array without overwriting it. Attached is my VI I created to write an array to an xml file. Again I am wondering if there is a way to write multiple arrays to a single xml file at different times without overwriting the previous xml file.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Write_to_XML_File.vi ‏11 KB

    Hi dlovell,
    Check the attached example. I think it may help you.
    Regards,
    Nitz
    (Give Kudos to Good Answers, Mark it as a Solution if your problem is Solved) 
    Attachments:
    Write to XML.vi ‏17 KB

  • How to save sections of a single XML Document to multiple tables ?

    Firstly, I apologise for the long e-mail but I feel it's necessary in order to clarify my problem/question.
    The XML document representation below stores information about a particular database. From the information in the XML document you can tell that there is a single database called "tst" which contains a single table called "tst_table". This table in turn has two columns called "CompanyName" & "Country".
    I want to use Oracle's XML SQL Utility to store this information into three seperate database tables. Specifically, I want to store the information pertaining to the database (i.e. name etc.) in one table, the information pertaining to the table (name, no. of columns etc.) in another and the information pertaining to the columns (name, type etc.) in yet another table.
    I have seen samples where an entire XML Document is saved to a database table but I cannot find any examples where different sections of a single XML Document are saved into different database tables using the XML SQL Utility.
    Can you please tell me the best approach to take in order to accomplish this . Does it involve creating an XMLDocument and then extracting the relevant sections as XMLDocumentFragment's, retrieving the String representations of these XMLDocumentFragment's and passing these strings to the OracleXMLSave.insertXml() method.
    Is this the best approach to take or are there any other, perhaps more efficient or elegant, ways of doing this ?
    Thanks in advance for your help
    - Garry
    <DATABASE id="1" name="tst">
    <TABLES>
    <TABLE name="tst_table">
    <NAME>Customers</NAME>
    <COLUMNS>
    <COLUMN num="1"> <COLID>2</COLID>
    <COLNAME>CompanyName</COLNAME>
    <COLTYPE>Text</COLTYPE>
    </COLUMN>
    <COLUMN num="2">
    <COLID>3</COLID>
    <COLNAME>Country</COLNAME>
    <COLTYPE>Text</COLTYPE>
    </COLUMN>
    </COLUMNS>
    </TABLE>
    </TABLES>
    </DATABASE>
    null

    See this thread;
    {thread:id=2180799}
    Jeff

  • How to loop through single XML File and send multiple RFC calls?

    I am looking for the best approach to use for making multiple RFC calls (can be sequential) using a single XML file of data.  I have been attempting to get a BPM loop working, but to no avail.  My RFC only accepts a single set of delivery input and I have been told to try to work with it as is.
    input xml sample:
    <?xml version="1.0" encoding="UTF-8"?>
    <ProofOfDelivery>
       <POD>
          <delivery_number>1</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
       <POD>
          <delivery_number>2</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
    </ProofOfDelivery>
    I need to make a synchronous RFC call for each set of POD data.
    Thanks in advance!

    Thanks for the inputs.
    I tried with a BPM and multi-mapping transformation before a ForEach block.  I am getting this error:
    Work item 000000028028: Object FLOWITEM method EXECUTE cannot be executed
    Error during result processing of work item 000000028029
    com/sap/xi/tf/_ProofOfDeliveryMultiMapping_com.sap.aii.utilxi.misc.api.BaseRuntimeExceptionRuntim
    Error: Exception CX_MERGE_SPLIT occurred (program: CL_MERGE_SPLIT_SERVICE========CP, include: CL_
    Probably because I am not making/using the container objects properly.  Here is a screenshot of my BPM.  Can anyone spot my issue or point me to an example on this sort of container use?
    [http://kdwendel.brinkster.net/images/bpm.jpg|http://kdwendel.brinkster.net/images/bpm.jpg]
    Thanks

  • Sender File (FCC) - Content of File into single XML Tag

    Hi,
    Input file
    This is Line1
    This is Line2
    Expected Sender File adapter FCC into XML
    <Document>
    .<File>
    ..<Content> This is line 1 This is line2</content>
    .</File>
    </Document>
    FCC is giving the following output with the below config,
    File.fieldNames = Content
    File.fieldSeparator = '0x1A' (HexaDecimal rep for EndOfFile)
    <Document>
    .<File>
    ..<Content>This is line 1</content>
    ..<Content>This is line 2</content>
    .</File>
    </Document>
    How can i read the complete file into a single XML tag?
    I am aware of other options (AdapterModules or Javamapping). But i want to keep it simple to FileAdapter using FCC or using MessageTransformBean (if possible)
    -SM

    FCC donse't work here, So i wrote a simple Java map inside Execute method to convert the content to the required format.
      public void execute(InputStream in, OutputStream out)  throws StreamTransformationException{
    StringBuilder sb = new StringBuilder();
           try {
           BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
           while ((line = reader.readLine()) != null) {
               sb.append(line).append("\r\n");
           } finally {
           in.close();
    After i had the input string, i formatted it to get the required output as XML ...
    <Document>
    .<File>
    ..<Content> This is line 1 This is line2</content>
    .</File>
    </Document>

  • Multiple records of table from RFC to XI in single XML file

    Hi
    My Scenario is as following -->
    <b>RFC ---> Sender RFC Adapter ---> XI -
    > Rec SOAP adapter ---> Web Service</b>
    Now we need multiple records from RFC which can be put in single XML file & XI can transport the whole XML file to Web Service. All the configuration in XI, Web Service is complete & I tested my mapping which is able to accept multiple records.
    But when ABAPer is sending the records I am not getting it in XI, I checked that in message payload from RFC.
    He put the table name in TABLE tab of RFC. But not under Import Tab, as whatever he is providing under Import parameter & exporting it through report I am getting in message payload but not the table data.
    Did anyone try such scenario, can you tell me how can we achieve this.
    Pls. provide me your mail ID in case you need an attachment of the current RFC & report code & my mapping snapshot.
    Regards
    - lalit -

    Hi
    We have created the BAPI in which we are just describing the structure of the payload & which I am importing in Integration Repository.
    And we are calling this BAPI from another program using " Call function ... " command & also provinding the data in that program.
    Actually ethically ABAPers are against the idea of provinding the data into program they would like to provide it in BAPI but that won't work, you have to provide data in program which in turn populate the fields of BAPI.
    Let me know with your mail ID in case you need snapshot of function & programs.
    Regards
    - Lalit -

  • Using Single Datasource to Access Multiple Databases

    Hi,
    We would like to know the pros and cons of accessing multiple
    databases through a single datasource, versus accessing each
    database through its own datasource. Our environment includes
    multiple web servers w/ the latest version of ColdFusion MX 7,
    clustered through a load balancer. Each web server has 800+ dsns
    pointing to different SQL databases on the same SQL server. We have
    noticed that the ColdFusion administrator is taking a long time to
    display or verify all datasources and sometimes it even times out.
    Another problem is that sometimes the neo-query file gets corrupted
    (for unknown reasons) which results in the deletion of one, or
    more, or all datasources on the web server.
    Because of the issues above we are researching the
    possibility of removing most of the datasources, and then accessing
    each database through a single bridge datasource. In that regard we
    plan to change our queries by inserting the sql db name and user in
    front of each table in the query such as:
    <cfquery name="query" datasource="single_dsn_name">
    select * from [#dbname#].dbo.tableName
    </cfquery>
    In the example above, obviously #dbname# would be a variable
    that will hold the name of the requested database. The code above
    would similarly apply to queries using, update, insert and join
    words.
    Are there any limitations or negatives from scalability,
    performance, and reliability perspective in implementing the above
    scenario versus having one datasource for each database.
    Also, if there is a better way of accomplishing this, we
    would love to hear about it.

    Here is my opinion, because I work with both schemas. The
    main advantage to use one datasource for all DBs in a SQL Server is
    the simplicity of administration.
    But the main disadvantage is security, because you are using
    a single user to access all DB in a server, you don't have
    isolation, and a user that knows your schema can access data of
    other DBs that he sould not be authorized.
    Another issue is is a user must access 2 differents DB with
    different permissions (a DB only read and the other read/write),
    you'll have to create another datasource, user, etc for it.
    But the decision depends in the enviroment. If you are a
    hosting company, I would use 1 datasource for user or DB. If the
    servers and DBs are of the same company, I could use one datasource
    for each SQL server.
    Best regards

  • How to Display number of Records in Single XML  file

    Hi,
    In My SAP MDM DataManager I have a table called Location it contains 3 Fields. And  Having 10000 Records in that.
    When I am trying to make xml file through MDM Syndication Manager it is creating 10000 xml files.
    I don't want to that much files and I need all the Records in a Single XML    File, how can I do that in MDM Syndication server.
    I have changed xsd:element attribute maxoccurs="unbound"
    but there is no property like that.
    I am using SAP MDM 5.5 with SP 4.
    how can I see all my records in single XML file.
    Thanks and Regards,
    Ashok.

    hi,
    To syndicate all XML records in single XML file:
    follow the steps:
    1. u201CIn the Destination Items pane, click on the  root ( for product repository  - Product).
    2. u201CIn the Properties pane, for the Repeatable XML Node field, uncheck its u201CInheritu201D flag and check its flag in the u201CValueu201D column as shown below.  This will cause all records to be syndicated into one XML file.u201D
    3. In the item mapping tab:
    In the Source Items page, select the root node,
    . u201CIn the Destination Items pane, select the Products node and map it,
    and do the remaining source and destination fields mapping,
    now you will get all records in single XML file.
    hope this may help you,
    Regards,
    Srinivas

  • XSLT transformation for Single XML Output

    I want to save a book to a single XML document. Is it correct that I can do this by adding an xslt to merge the standard framemaker entity type output ? Can I easily reconfigure the standard Save As XML to acheive this? or do I need to add a new menu item and call the XSLT dialogue...
    any advice appreciated.
    Thanks!

    Tracey,
       A related discussion appeared in the FrameSGML Yahoo group recently. Much of what follows is what I wrote there.
       Your XML application (defined in structapps.fm or another application definition file) can specify an XSLT post-process. No need to change Save as XML or define a new menu item. Depending on what you want, the XSLT transform can be as simple as the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml"/>
        <xsl:template match="/ | node() | @*">
            <xsl:copy>
                <xsl:apply-templates select="@* | node()"/>
            </xsl:copy>
        </xsl:template>
    </xsl:transform>
    This is an identity transform that simply copies the interpreted input to the output. I've used the word "interpreted" here because XSLT does not distinguish among some variations of how content is entered. In particular, it does not distinguish between content in referenced general entities (which is what you want) or between attribute values that happen to be the same as the attribute default value and attributes that are not explicitly specified and hence use the default value.
    There are a few things to watch out for involving use of general entities.
    First, if you are using entity attributes for graphics, you'll need to modify the above slightly. It's probably easier to replace the entity attributes with file attributes, but if you want to keep the entities, the above needs to be extended to declare the entities.
    Second, if you are using and want to preserve entity references for special characters or variables, you'll need to account for them as well. See $FMHOME\Structure\xml\PreserveEntity\readme.pdf.
        --Lynne

  • Exception caught while loading menus.xml: TypeError: Access is denied. (IE), WORKS IN Firefox

    hi iam trying to get the data into spry table(Dr-cs3) from xml file and iam using spry xml dataset.  my application is working in every browser except in IE.
    ERROR IS :  
    Exception caught while loading menus.xml: TypeError: Access is denied.

    Hi
    this error is because of spryData.js, spryXapth.js generated by Dr CS3, I used Dr CS4 generated javascript files, then the same application is working.

  • Collect IDOC into one single XML

    Hello All,
    I have done IDOC to FILE(XML) scenario.....its working fine..................now client wants to collect the IDOCs and send them in single XML.
    Any one done this requirement please help me.
    With out using BPM can we achive this requirement.
    Thanks and Regards,
    Chinna

    Thanks for the reply.
    iam checking the thread which you mentioned in the thread
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID1159744050DB00799287682272151265End?blog=/pub/wlg/4443
    as in this thread it is mention we have to create the XMLFILE port.
    I have already created all the ALE setting like RFC detstination,port (TRFC) and partner profile.
    Other then this setting again do i need to create XML FILE port and partner profile.
    Please tell me the steps i need to do.
    Thanks,
    chinna

  • Create single XML document from multiple queries

    hi all!
    being a new programmer in XML world,my question might sound a bit stupid but your answers would mean a world to me. i have to generate a single XML document from my database by querying more than one table. for example i have 3 tables i.e HR_EMP_NAME, HR_PRODUCTS_DETAIL, HR_PAYROLL_SUMMARY. all three tables have completely different columns except one ID column which is a foreign kay from HR_MASTER_LIST. i want to get any insert operation on these tables as a single document. so far as i have studied, one option is to generate XMLDoc using XSU and then add child nodes using JAXP but i am ot geting the logic right.
    please do reply.
    thanks a lot
    usman

    This is an SQL/XML based answer so how much it helps you is hard to say, but it would be one option. You can have the SQL statement build the XML for you as shown by this simple example.
    SELECT XMLElement("root",
              XMLForest(emp.dummy AS "emp_name",
                        prod.dummy AS "prod_lvl",
                        pay.dummy AS "pay_scale"))
      FROM dual emp,
           dual prod,
           dual pay
    WHERE emp.dummy = prod.dummy
      AND emp.dummy = pay.dummy;which produces (formatted for human readability)
    <root>
      <emp_name>X</emp_name>
      <prod_lvl>X</prod_lvl>
      <pay_scale>X</pay_scale>
    </root>Whether that works with what you are trying to do via Java you will have to decide.

  • Appending multiple xml files to single xml file using File channel?

    Hi Experts,
    I would like to get some pointers around xml files append.
    My sender application will send around 1000 messages through SOAP per day. But the target application needs single xml file formed by consolidation of all these 1000 files.
    I tried with txt files and the receiver file channel could append the txt files. However, since xml files allow only one root node, I am not able to achieve the requirement.
    Is there any option we can do to get the result?
    The target file location is UNIX folder. Do we need to create any shell script to run from the channel for appending the file?
    Do we need to use any XSLT mapping to strip the xml declaration tags and append the files. Once the single file is ready, using another file channel with XSLT mapping, insert a dummy root node and xml declaration tags to build an xml file?
    Any thoughts to get the result will be much appreciated.
    Thanks
    Ray..

    Hi,
    You have two options
    1)Using Receiver Sender File channel select mode append it does the job.
    Option 2:
    Using BPM we cann collect all messages per day and club them as a one message, in this case create Target data type root node occurance 1 to unbounded. so it cal hold multiples SOAP messages in only XML messages.
    search in sdn for BPM collect pattrersn,its very simple .
    Option 3:
    Create scheell script in OS level and write a logic to append all files planced in FTP.
    Regards,
    Raj

  • Merging two xml files into single xml file

    i hav to merge 2 xml files in to single xml file
    my xml files are
    input1.xml
    <?xml version="1.0"?>
    <PreVCD>
    <component name="stack">
    <subpath path="stack_environment">
    <variable var="ins" symbol="!" wireonbus="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="!" value="1"/>
    </data>
    </time>
    <time t="25">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    input2.xml
    <?xml version="1.0"?>
    <PreVCD>
    <component name="stack">
    <subpath path="stack_behavior">
    <variable var="i" symbol="@" bussize="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="@" value="0"/>
    </data>
    </time>
    <time t="5">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="@" value="0"/>
    </data>
    </time>
    <time t="20">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    The ouput should look like:
    <PreVCD>
    <component name="stack">
    <subpath path="stack_behavior">
    <variable var="i" symbol="@" bussize="1"/>
    </subpath>
    <subpath path="stack_environment">
    <variable var="ins" symbol="!" wireonbus="1"/>
    </subpath>
    </component>
    <dump>
    <time t="0">
    <data>
    <symbol sign="@" value="0"/>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    <time t="5">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="10">
    <data>
    <symbol sign="@" value="0"/>
    <symbol sign="!" value="1"/>
    </data>
    </time>
    <time t="20">
    <data>
    <symbol sign="@" value="1"/>
    </data>
    </time>
    <time t="25">
    <data>
    <symbol sign="!" value="0"/>
    </data>
    </time>
    </dump>
    </PreVCD>
    thanks for any advice

    Merge xml documents with the xslt document() function.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
    version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" />
    <xsl:template match="/">
    <xsl:copy-of select="*"/>
    <xsl:copy-of select="document('input2.xml')"/>
    </xsl:template>
    </xsl:stylesheet>

  • Single toplevel synchronization folder ?

    Hello,
    I would like to know whether I can create a single iCloud synchronization folder that's synchronized when using multiple devices: desktop + macbook + PC laptop + iPhone.
    Until now, reading webpages,  it's my impression that iCloud has several different categories to synchronize: mail, documents, etc.
    I would like to use just 1 toplevel directory that I can choose, from which all files and subdirectories are synchronized.
    Is that possible ( 1 synchronized toplevel directory ) or should I consider Wuala or SpiderOak as an alternative to do that ?
    Thanks for the feedback.

    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCug48560
    This patch did not make it in 8.62 su3

Maybe you are looking for

  • IPhone 4S Battery life issue, worth returning?

    Hi All, I have had my iPhone 4S for a few days now. I have tried all the tips and tricks posted on here (turn off locations, notifications, system restore etc....). But nothing seems to work. I just about get one days battery out of my 4S, with very

  • How to do recovery after my upgrade to Mountain Lion.

    After upgrading to Mountain Lion from Snow Leopard, I found that I couldn't access Apple Works 6 or my saved DVDs from work travels.  Does anyone know how to fix this?  It represents 10 years of work.

  • Pls tell me how to do desktop

    There is a problem in downloading the desktop software on my XP window pls tell me the solution

  • IPhones and music in corporate environment

    We have a recentley rolled out a small number of iPhones in our company. We have used the config utility to block itunes usage. I would still like the users to have the use of the iPod on the iPhone to play music. Is this possible? If so, how? Keepin

  • IPhone 4 replacement out of warrany

    Can I replace in the US a device purchased in another country? I mean by using the following process taken from Apple support site: The iPhone is totally unusable due to water damages. Out-of-Warranty Service If you own an iPhone that is ineligible f