dcsimg
URGENT: Saving element data as raw in the database
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sathya_Sekar
Posted On:   Monday, March 4, 2002 03:06 AM

We have a curious requirement. We have a Java server which receives XML requests from clients. There is a requirement that the user be allowed to define certain parameters which would be sent as part of the XML request to the server. The server must not bve bothered about whats inside the particular element. All it does is blindly save it as a string/byte array. The XML doc would be : 2 3 We attempted to treat the XML document as a string, substring the user-defined properties as : // strInXml is the input XML doc int indexOfOpenUserTag = strInXml.indexOf(" "); int indexOfEndUserTag = strInXml.indexOf(   More>>


We have a curious requirement. We have a Java server which receives XML requests from clients. There is a requirement that the user be allowed to define certain parameters which would be sent as part of the XML request to the server. The server must not bve bothered about whats inside the particular element. All it does is blindly save it as a string/byte array. The XML doc would be :



			



2
3







We attempted to treat the XML document as a string, substring the user-defined properties as :




			
// strInXml is the input XML doc
int indexOfOpenUserTag = strInXml.indexOf(" ");
int indexOfEndUserTag = strInXml.indexOf(" ");
String userDefined = strInXml.substring(indexOfOpenUserTag + 6,indexOfEndUserTag);





This is then saved into the database. The problem is while retrieving the data. We tried it as :



			
// retrieved the userDefined string from the database
Element e1 = outXml.createElement("USER-DEFINED");
Text text = outXml.createTextNode(userDefined);
e1.appendChild(text);





The problem is of course with the response. The user-defined data gets the " <" and ">" symbols replaced by spring-representations which is < (dont know if it works here - my input values are getting all messed up by JGuru's XML parser !!)




Any suggestions on how to do return a valid XML format document ?



Thanks,

Sathya
   <<Less
About | Sitemap | Contact