Parse exisitng xml file and recreate another xml file with different struct

Is it possible in java using dom parser to parse an exisiting xml file and recreate a new xml file from data obtained by parsing old xml file.
I checked on old forum threads and everywhere either parsing xml file has been explained or creating new xml file from scratch has been shown.
Any examples/guidance will be appreciated....

The general process is:
Document dom1 = ... // the parsed document
Document dom2 = ... // new document constructed on the fly
Node nD1 = ... // some random node found in dom1
// copy the node from dom1 and associate with dom2
Node nD2 = dom2.importNode(nD1, true);
// ... treat nD2 as a node which can now be inserted into dom2 ...
Node otherD2 =  ... // some other node already in dom2
otherD2.appendChild(nD2);Note, in this example the nD1 node is copied (including any sub-nodes) into a new node, nD2. You can alternately move the node from one Document to another using Document.adoptNode(), however this may fail (see the javadoc).

Similar Messages

  • A web service that returns a xml file and gets another xml file as input?

    Hi,
    I want to create a web service which gets an xml document as input then returns again an xml document.How can I create this kind of web service?
    Is this kind of implementation is possible?
    public Document mywebservice(Document input){
    Document d;
    return d;
    or do I have to use serialization processes which I don't know very much.
    I am waiting for your help.Thank you...

    If you want to deal directly with the Document and not want the SOAP engine to serialize/deserialize the XML into Java objects, then you can easliy implement this using Axis. Look at the Axis documentation (http://ws.apache.org/axis/java/user-guide.html#ServiceStylesRPCDocumentWrappedAndMessage) under the heading "Message Services". One of the provided API methods that Axis provides is in the form you want: public Document method(Document body). Hope that helps. As for how to implement the service using Axis, that is beyond the scope of this forum. Check the Axis docs for more help on that.

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read flat file and convert to xml throught OSB

    Hi ,
    Can somebody help how to read flat file and convert to xml in OSB.
    appreciate ur help.
    Thanks & Regards ,
    Siva K Divi

    if you're using the oepe with osb plugin (will be installed when you install the osb locally) and then in your osb project > rightmouseclick > new > MFL.
    that's it
    maybe you're trying to create it within an oepe installation which doesnt have the osb plugin ?

  • Upon sync or backup, I receive the message, "iTunes could not back up the iPhone "iPhone name" because and error occurred. I have deleted my backup file and tried another computer, with no success.  Also, the bluetooth function stopped working.

    Upon sync or backup, I receive the message, "iTunes could not back up the iPhone "iPhone name" because and error occurred. I have deleted my backup file and tried another computer, with no success.  Also, the bluetooth function stopped working.

    Hi, EJ13. 
    I see you are having issues with backing up you iPhone and have tried a couple troubleshooting steps.  There are a couple more steps I could recommend in the article below. 
    iOS: Troubleshooting backup issues in iTunes
    http://support.apple.com/kb/ts2529
    Regards,
    Jason H. 

  • How to release and read another external file

    My vi is set to read an external file (a previously collected force plate signal), then perform a string of analyses on it and finally save the analytical output. Currently, "Read from measurement file" is outside the while loop containing all of my analysis.
    Without completely restarting the vi, I would like to be able to release the file and load another.  How might I do this?  
    Thanks!

    I would do several things to clean up the block diagram.
    whenever you have multiple outputs that are related to each other (PF, F100, F150, F200, F250, etc...) or all of the RFDs and Impulses, you can bundle them together and then display them with one big cluster, or as an array, if that makes sense.  This will reduce your total number of outputs and maybe improve organizaiton.
    If you have a seqeunce of functions that go together, you can combine them into a SubVI to save blockdiagram space and making things more logical.
    If you have several places where the same sort of function is being done, (for example, you have Extract-Statistics-Formula several times and Extract-Integral-Statisics several times) you can make this into a sub-VI and then loop through it.  That way you can execute the function multiple times (with slight changes on each loop), but you only have to have the code written once. It also makes it much easier to improve the code because you only have to make one change instead of four. 
    The attached VI shows two ways of doing something.  On the left is your code, which is four sets of the same thing.  On the right, I've taken this code and put it into a loop so it does the same thing four times.
    Attachments:
    Simplified Code.vi ‏896 KB

  • Part 2: Flat files and Business Contents: Any issues with this scenario?

    I will appreciate some clarification on the some points made in response to my previous post "Flat files and Business Contents: Any issues with this scenario?"
    1.
    " ...you’d better analyze those cubes for data redundancy and presence of data you’ll never use. " I will appreciate some clarification on the type of analysis you are referring to. Examples will help.
    2.
    "If you want to combine several found IOs in your custom dataprovider, then again you must know (or figure out) relationships between these IOs." I will appreciate some clarification on the type of relationship you are referring to. Examples will help.
    3.
    I am a bit confused with "..include into ODS structure ALL fields required for the cube" but you also noted noted that "...except navigational attributes and chars and KFs that are going to be determined in TRs or URs."
    If you exclude ALL these, haven't you excluded all the fields you included in the ODS structure?
    4.
    "Consider carefully the ODS’ key fields selection. Their combination should not allow data aggregation that you don’t need."
    I may be missing the point here, I understand that you need to select the fields which will form the unique ID for the records in the ODS under the Key Field (please correct me if I am wrong with the purpose of the Key Field), but I don't understand the discussion of "aggregation" in the context.
    Thanks in advance

    Hallo
    I try to give some exaplanation based on the previous answer.
    1. Data redundancy - make sure you do not store the same information. does not make sense to have data redundanty across you Data Warehouse. this is also a cost. just sotre the same information one time if you get all what you need.
    2. whatwhever you build you dp, which consist of IO, you need to know with kind of relation (1:1 or 1:n - n:n and so on) exist between them. that will help you when you model you infoprovider. For example I would never pit togheter IO (n:m) in the same dimension if you expect an high number of cardinality. Sometime an IO can be an attribute of another one (depend on relation. For example
    Business Partner and his Address. Usually you have a relation 1:1, in this case address is an attribute of BParten and store it in the Masterdata instead then DP
    3. Sometime when you load from ODS to CUBE, you can fill some IO (which are in the infocube and not in the ODS)through ABAP routine in TR-Start Routine of Update Rule. Does not make sense to include these IO in the ODS as they are NULL or Blank (the deault value). This can happen when for example, you first load in the ODS (Price and Quantity) and then you calculate Sell price later (Price * Quantity). of course it could be doen also in the Bex. Depends on other factors (Performance - Loaidng -Sizing)
    4. Make sure that the KEY definition of ODS is accordingly to the data otherwise you will aggregate the data and later maybe if you need the detail you miss it.
    for example: customer - product - Distr Chan - Sell Price
    if each Customer can buy each product for any Distrution Channel, then when you build your ODS(Customer - Product and Distribution must be KEY) otherwise (if you have only Customer - Product KEY for example) you will lose the details for Distribution Channel.
    I hope eveyrhting is clear
    Regards
    Mike

  • Sequence of one sequence file called by another sequence file

    Hi,
    Is there any method by which we can call sequence of one sequence file from the another sequence file.
    Please let me know in case you know.
    Thanks in Advance,
    Vivek

    Hi,
    Yes, look at the Computer Motherboard Test Sequence.seq in TestStand\Examples\Demo.
    You have to use the SequenceCall Step Type and specify the path to the other sequence file, use the browse button. Then use the sequence control to select the sequence within that sequence file that you wish to invoke.
    Hope this helps.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How do you open a Numbers file sent from another Mac user with same operating system, i get a pop up that says I'm missing an index.hml file??? HELP PLEASE

    how do you open a Numbers file sent from another Mac user with same operating system, i get a pop up that says I'm missing an index.hml file??? HELP PLEASE

    The operating system may be the same but the Numbers applications are likely different.  You need to get the apps in sync.  Unfortunately, the Numbers (and Pages as well) saga is pretty confusing (and frustrating).  Here's some info from the iWork resident version expert (PeterBreis0807):
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed almost 100 features from Pages 5 and added many bugs.

  • I am a Windows Vista User. I updated my iTunes Version 10.3. Then, when I re-opened my iTunes, all files were gone! Good thing I consolidated the files and just imported the files again. But, this happens every time I close and open my iTunes. Help?

    I am a Windows Vista User. I updated my iTunes Version 10.3. Then, when I re-opened my iTunes, all files were gone! Good thing I consolidated the files and just imported the files again. But, this happens every time I close and open my iTunes. Help?

    In iTunes 11 uncheck the preferences setting in in the iTunes Preferences panel "Advanced > Copy Files to iTunes Media folder when adding to Library"

  • I am trying to reinstall Windows on my macbook pro.  I downloaded the support files and Windows 7 iso file to a USB drive.  However, when I try to run the setup.exe program I get the message "this program cannot be run in DOS mode."

    I am trying to reinstall Windows (would not launch).  I removed the partition and started over.  I downloaded the support files and Windows 7 iso file to a USB drive.  However, when I try to run the setup.exe program I get the message "this program cannot be run in DOS mode."  I was successful before, what am I doing wrong this time?

    Try a restart.
    If that doesn't fix the problem, shut down the computer and then power it back up. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application unistaller. For each disable/delete, you will need to restart if you don't do them all at once.
    Safe Mode
    Safe Mode - About
    General information.
    Isolating issues in Mac OS X
    Troubleshooting Permission Issues
    Step by Step to Fix Your Mac

  • Search multiple folders and muiltiple files and combine to single file

     I want to search multiple folders for muliple files and combine to single file name. The files I'm searching have same format, but where named
    differently in each of there processes. Now I want to combine based upon -SearchFor .. I'm having a problem with -Filter $SearchFor
    Code:
    Function Search-Files{
    Param([String[]]$Locations,[String[]]$SearchFor, $AppendTo)
    Begin
    If(-Not (Test-Path $AppendTo)){New-Item $AppendTo -ItemType File -Force}
    Process
    ForEach($Location in $Locations)
    $Files = Get-ChildItem -Path $Location -Filter $SearchFor -Recurse
    ForEach($File in $Files)
    Get-Content -Path $FIles.FullName | Out-File $AppendTo -Append
    End{}
    Search-Files -Locations "\\servera\public\t1\usa\saleshist\","\\serverb\public\t2\usa\saleshist\",-SearchFor "dodetail-cm.txt","somstr.txt",-AppendTo "\\virt1\Saleshist_data_load_files\saleshdr.load.csv"

    I think you might want to use -Include instead of -Filter.  Your -Include parameter accepts wildcards, i.e. *.docx or *somstr.txt
    Your command to actually append the content should be:
    Get-Content -Path $File.FullName | Out-File $AppendTo -Append
    You had $Files.FullName which might behave unexpectedly, if at all.
    Your actual command has several issues.
    Search-Files -Locations "\\servera\public\t1\usa\saleshist\","\\serverb\public\t2\usa\saleshist\" -SearchFor "dodetail-cm.txt","somstr.txt" -AppendTo "\\virt1\Saleshist_data_load_files\saleshdr.load.csv"
    You had commas following the lists of locations and searchfor terms, did that even work? Without seeing your source files or your target file I can only advise you so much, but ideally you would import-csv and export-csv.  Depending on the contents,
    you may be able to get away with get-content and out-file though.
    I hope this post has helped!

  • When you scroll to the bottom of the list of files in Finder, the left to right scrollbar doesn't let you click the last file and it covers the file for a while until it disappears. Is this a bug? How do I not make that happen?

    When you scroll to the bottom of the list of files in Finder, the left to right scrollbar doesn't let you click the last file and it covers the file for a while until it disappears. Is this a bug? How do I not make that happen?

    An odd workaround: click "Always" in System Preferences/General/Show scroll bars. The scroll bars will always show, but they won't cover your last file.
    See this other post: https://discussions.apple.com/message/20572471#20572471

  • How do I scan a photo to a file and then send the file as an attachment via email.

    How do I scan a photo to a file and then send the file as an attachment  via email.

    All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
    Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

Maybe you are looking for