Please help, Urgent ! creation of xml from servlet

Hi,
I have to write a servlet that takes user input from a html form and creates a xml file from those input parameters and transform that xml file into html form using xsl program. Whenever the user adds new values to the form this newly generated xml file should overwrite the previous xml file content.
Can anybody please tell me how to create a xml file from user input in servlet so that I can pass it to a transformer object.
Thanks in advance!

why write out the XML, it seems to be only a temporary file?
Doing as you suggest is extremely risky for when several requests come in at the same time you can never be sure that the file contains the data that you just wrote to it.
Better to keep the XML all in memory.
For the XML creation, look no further than DOM. Most XML parsers provide excellent DOM support, I'll be using Xerces 2 here as that's what I'm most familiar with.
Document doc = new DocumentImpl();
Element root = doc.createElement("mydoc");
* fill in the XML
Element elem = doc.createElement("focuscontrol");
elem.appendChild(doc.createTextNode("alert('loaded')"));
root.appendChild(elem);
elem = doc.createElement("data");
elem.appendChild(doc.createTextNode("Hello World!"));
root.appendChild(elem);     
doc.appendChild(root);     creates an XML Document object like this:
<?xml version="1.0"?>
<mydoc>
  <focuscontrol>alert('loaded')</focuscontrol>
  <data>Hello World!</data>
</mydoc>This XML Document object can be easily passed to an XSLT processor to turn it into HTML.
String path = getServletContext().getRealPath("/WEB-INF/xsl/");
TransformerFactory tFactory = TransformerFactory.newInstance();
Source xslSource = new StreamSource(new File(path, "myxslfile.xsl"));
Source xmlSource = new DOMSource(doc);     
t.transform(xmlSource, new StreamResult(out));where out is the PrintWriter for the servlet and your XSL file is stored in yourwebapp/WEB-INF/xsl (thus out of sight of prying eyes).
I leave it up to you to find an encoding of your request parameters into the generated XML that you like.

Similar Messages

  • I bought an iphone 5 on 01 February 2013 from your store to use in Turkey. But the phone is sim-locked. What can I do now?  Please help urgently.

    I bought an iphone 5 from apple store in Geneva to use in Turkey. But it is sim-locked. What can I do now. Please help urgently.

    Return it to the store where you purchased & get your money back. Either that, or call the store. No one here can help you, as there is no one from Apple here.

  • I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    I have lost my iphone 4 just an hour ago... i need to delete my personal photos from it. PLease help urgently.. Thanks

    If you had find my iphone enabled follow the steps in the article below:
    http://support.apple.com/kb/ph2701

  • Please Help Urgently to refresh the report on the change in data

    We want to refresh report at runtime for the Drill Down report if any user changes the Data. We changes the data from the form which is called from the report and we want to this effect on the report on the prompt.
    Is there any method to close the report while it is in the queue of Background Engine? Can we refresh the report ? Please help urgently.
    Thanks in Advance.

    Pritesh,
    Reports goes out to the database and fetches the data (not a snapshot) and returns the information, formats it and displays it. The only way to refresh, is to rerun the report.
    If your are running from the server, you need to make sure you are not fetching from cache (you determine this from destype and set the life of the cache in the servername.ora file).
    I am unaware of any way to programatically close the report once displayed. The user must take action to close the report (unless you call the operating system to kill the display). When you rerun the report from Oracle Forms, you will get fresh data.
    Regards,
    The Oracle Reports Team jls

  • Starting tomcat problem, please help urgent

    I installed jwsdp on windowsXP . The log file gives this following error when i try to start tomcat:
    java.util.zip.ZipException: Access is denied
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:127)
         at java.util.jar.JarFile.<init>(JarFile.java:138)
         at java.util.jar.JarFile.<init>(JarFile.java:80)
         at org.apache.catalina.loader.StandardClassLoader.addRepositoryInternal(StandardClassLoader.java:1081)
         at org.apache.catalina.loader.StandardClassLoader.<init>(StandardClassLoader.java:200)
         at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:202)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:141)
         at java.lang.reflect.Method.invoke(Native Method)
         at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
    Bootstrap: Class loader creation threw exception
    java.lang.IllegalArgumentException: addRepositoryInternal: java.util.zip.ZipException: Access is denied
         at org.apache.catalina.loader.StandardClassLoader.addRepositoryInternal(StandardClassLoader.java:1109)
         at org.apache.catalina.loader.StandardClassLoader.<init>(StandardClassLoader.java:200)
         at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:202)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:141)
         at java.lang.reflect.Method.invoke(Native Method)
         at org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
    PLEASE HELP ,URGENTLY NEEDED TO SHOW SOME WORK ON THIS.
    THANKS
    jim

    Hi,
    I have a similar problem, i try to deploy a JAR file built on AIX 5.2 platform (jvm 14.1) into Tomcat 5.5.7 running on Windows platform when i try start Tomcat it's fail with the fellowing message
    SEVERE: Error deploying web application directory usi
    java.lang.IllegalArgumentException
         at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:299)
         at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:238)
         at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:73)
         at java.util.jar.JarInputStream.<init>(JarInputStream.java:58)
         at java.util.jar.JarInputStream.<init>(JarInputStream.java:43)
         at org.apache.catalina.util.ExtensionValidator.getManifest(ExtensionValidator.java:368)
         at org.apache.catalina.util.ExtensionValidator.validateApplication(ExtensionValidator.java:187)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:3942)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
         at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:909)
         at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:872)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1106)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1019)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
         at org.apache.catalina.core.StandardService.start(StandardService.java:450)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)

  • PASSWORD FOR FLODERS  PLEAse  HELP URGENT

    HI ALL
    please tell me the method of implementing password
    provision for some folders/files in the system.
    it should ask for password authentification before
    opening when i click on the folder.
    please help urgent
    thanks
    belur

    Hi Swaroopba,
    It can be very well done thru Form based Authentication.
    For eg let me explain with respect to Tomcat.
    Go to
    $TOMCAT_HOME/webapps/examples/WEB-INF directory.
    Please add the following code in it.
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Protected Area </web-resource-name>
    <!-- Define the context URL's to be protected -->
    <url-pattern>/jsp/security/protected</url-pattern>
    </web-resource-collection>
    </security-constraint>
    Please add the following code in it. And you have to specify the roles for it.
    I hope this will be helpful for you.
    Or if you want it in an application, please let me know.
    Thanks
    Bakrudeen

  • Hi there. Can someone please help me with copying photos from my old iPad to my new one? Thanks.

    Hi there. Can someone please help me with copying photos from my old iPad to my new ipad2? Thanks.

    If you have a pc, when you plug your iPad in you should see the windows pop up window offering to backup the photos. Do that and it will save all your photos and videos to your computer where you can then sync them back to your new one.
    If the pop up doesn't come up, double click on my computer and navigate your way to the iPad. Double cick on it an d navigate to the DCIM folder. Drag your photos and videos to your pc, then sync them back onto your iPad.

  • The enter key is not working in firefox but it has working fine in chrome and IE so please help me to rid out from this.

    The enter key is not working in firefox but it has working fine in chrome and IE so please help me to rid out from this.

    Hello gokulaan, '''try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Please help i bought an iphone from ebay and it is unlocked and refirbished by apple how do i know what sim card to buy for it? iPhone 3GS

    please help i bought an iphone from ebay and it is unlocked and refirbished by apple how do i know what sim card to buy for it? iPhone 3G

    Contact your chosen cellular provider to obtain a compatible SIM card.

  • I want to buy an in-app purchase but i don`t remember my security questions and i cant access my recovery email either, what can i do? i have 100$ on my account and cant use it because of that problem, please help URGENT

    I want to buy an in-app purchase but i don`t remember my security questions and i cant access my recovery email either, what can i do? i have 100$ on my account and cant use it because of that problem, please help URGENT

    If you have a rescue email address on your account then you can use that - follow steps 1 to 5 half-way down this page will give you a reset link on your account : http://support.apple.com/kb/HT5312
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact Support in your country to get the questions reset : http://support.apple.com/kb/HT5699

  • Please help URGENT : Chinese handwriting doesn't seem to work on Lion OSX. the handwriting trackpad appears but anything i write in Chinese doesn't appear in word, chrome,..... HELP PLEASE

    please help URGENT : Chinese handwriting doesn't seem to work on Lion OSX. the handwriting trackpad appears but anything i write in Chinese doesn't appear in word, chrome,..... HELP PLEASE
    And in system prefs/language and text/input languages, simplified chinese and traditional chinese are ticked as usual with handwriting options on !!!!

    Please search the forum for "chinese" to find the many other earlier posts about your issue, like
    https://discussions.apple.com/message/15746805#15746805

  • HT3702 please help to solve the violation from itunes

    please help to solve the violation from itunes

    Sorry, but the minimal amount of information you have provided does not allow us to understand what problem you are having. You will need to post a more complete description of your issue before anyone can even guess at suggestions.
    Regards.

  • Please Help - Urgent

    Hi everyone, I�m having problems with Java Mail, I have just installed it along with the java activation framework, they are located in the following directories:
    JavaMail: C:\jdk1.3.1\lib\javamail-1_2[1]
    Java activation framework: C:\jdk1.3.1\lib\jaf1_0_1[1]
    I have the classpath set as: C:\jdk1.3.1\lib\mail.jar;C:\jdk1.3.1\lib\activation.jar
    When I try to compile the sample code provided with these packages, msgsend.java using Jbuilder 2 I get the following errors:
    Error (36): cannot access directory javax\mail.
    Error (37): cannot access directory javax\mail\internet.
    Error (209): class message not found in class msgsend.
    Error (210): class MessagingException not found in class msgsend
    Error (134): class Session not found in class msgsend
    Error (134): variable Session not found in class msgsend
    Error (139): class Message not found in class msgsend
    Error (139): class MimeMessage not found in class msgsend
    Error (141): class InternetAddress not found in class msgsend
    Error (145): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (146): Variable InternetAddress not found in class msgsend
    Error (148): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (149): Variable InternetAddress not found in class msgsend
    Error (151): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (152): Variable InternetAddress not found in class msgsend
    Error (162): Variable Transport not found in class msgsend
    Error (170): class Store not found in class msgsend
    Error (172): class URLName not found in class msgsend
    Error (172): class URLName not found in class msgsend
    Error (189): class Folder not found in class msgsend
    Error (195): Variable Folder not found in class msgsend
    Error (197): class Message not found in class msgsend
    Error (197): class Message not found in class msgsend
    If I try to use another Java package to compile it I get even more errors (52), I cannot compile it by using the Javac command line compiler, it just says �Bad command or file name�.
    Can anyone tell me Why this is happening and how I might be able to fix it please, I need to start learning Java Mail quickly but at the moment I can�t even begin to do this until I can understand how to get this sample code to work.
    Thanks Everyone
    Noel

    First of all... don't post with topics like "Please Help - Urgent". The topic is supposed to reflect what the question is about.
    Secondly... think for a second. If mail.jar is in C:\jdk1.3.1\lib\javamail-1_2[1]... why are you with your classpath saying that mail.jar is in C:\jdk1.3.1\lib ?
    You classpath is supposed to point directly at you jar-files.
    /Michael

  • I have been backing up  since 2010 but my machine will only go as far back as feb 11 ... why is this? please help i need valueable info from 2010

    i have been backing up  since 2010 but my machine will only go as far back as feb 11 ... why is this? please help i need valueable info from 2010

    Welcome to the discussion area!
    When the Time Capsule disk starts to become full, Time Machine will automatically delete the oldest backups first to make room for new backups.
    For more details, I think you will get a faster and more informed response if you post in the TIme Machine forum for questions like this. We primarily handle configuration set up and networking questons about the Time Capsule as a hardware device on this forum, but it's possible that someone may see your post and respond from here as well.
    Please click the link below and then click the "Refine this list" 'button to see the Time Machine area.
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.6_snow_leopard?categ oryID=263

  • How to download garageband old version? i mean version 1.0 to install it on iphone 4s with ios 6.0.1??? please help urgently, how to download garageband old version? i mean version 1.0 to install it on iphone 4s with ios 6.0.1??? please help urgently

    how to download garageband old version? i mean version 1.0 to install it on iphone 4s with ios 6.0.1??? please help urgently, how to download garageband old version? i mean version 1.0 to install it on iphone 4s with ios 6.0.1??? please help urgently

    I did this a few weeks ago to be sure it was going to work for a young person I was giving my ipod to.  Then I reset the information for her and now it will not load.  Very sad.  She is so talented and she really needs this.   Anyone know?

Maybe you are looking for

  • Exist a Jtree node.id or something like this ?

    I would want to retrieve a node using a unique 'id', for example the absolute index (into the total nodes count) Is there something like this ? Can I add a particular property to a node ? ( for example this 'id' if it does not exist ) Another questio

  • Has anyone used Firefox Sync and Xmarks at the same time?

    Firefox is my primary desktop browser. On my desktops, I use Xmarks because I use Firefox, IE and Chrome. It enables me to keep my bookmarks synced across browsers as well as use home/work profiles, etc. However, I'd like to use Firefox Sync so I can

  • Controlling Logic's Record button via my feet? x-tempo POK?

    I want to hit record AND play guitar at the same time. So I'm thinking of picking up this wireless "Pedal Operated Keyboard" http://emusician.com/news/emproduct_news042407/index.html Has anyone used this to control Logic with one's feet? Is it easier

  • User changing position in ECC and impact on follow-on docs

    Hello all, Can any one tell me what will happen when a requestor creates a shopping cart and then moves to a different org node in org structure. The EBP users are built by distributing the positions and employees from the HR System. for Eg: 1.USER1

  • Bad logic board????.....

    Hello all- in my office, we have an "old" G4 tower (Mirrored drive doors). I was told the machine was not working, and when i started it up, it was giving me a kernel panic with what looked like to be unhandled code (like exceptions that could not be