This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have this method that accepts an empty Jdom document as an input argument. There is also a String variable which contains the XML stuff which I need to add to the Jdom document. For eg: public static Document loadXML(Document jDoc, String strTags) String will contain- strTags = "<RequestBody><first>Sumon</first><last>M</last></RequestBody>"; I add this string to my Jdom document and my method returns the modified jdom document which can later be used for other functions.
The problem is i already have the content in my string variable and dont want to create a file in the phsical memory.
One way i can think of is to create a temporary file to wrap this string and delete it on exiting. But this approach has it own problems, say if there are 100's of users logged in and my temporary file has exclusive lock on it.....the waiting time will be too much n my users will prefer not to use my site!
Is there any other way i can wrap this string/convert to File object so that i can ue the temporary Jdom document from the memory.
Any help in this regard will be highly appreciated!
I don't see why you need to create a File. I couldn't quite understand what you were trying to pass that String into, but if you want JDOM to parse the XML it contains, surely JDOM can parse from sources other than Files? (I don't have its API documentation on hand but I'm expecting you do.) For example can it parse from a Reader? Like a StringReader?