tags:

views:

76

answers:

2

We have a flash retrieving information from an XML file. Right now we are having to hard code the XML contents and put it at a relative location w.r.t. the flash. Is there any way of making the XML dynamic other than writing to a outputstream to change the stored xml. I want the xml to serve up content just like a JSP. The approach I can think of is to point the flash to a JSP instead of the XML but we don't have the any flash guys around to do it. Any suggestions???

+1  A: 

Well, you can serve xml requests as well (a sample web.xml fragment)

<servlet-mapping>
  <servlet-name>some your servlet</servlet-name>
  <url-pattern>*.xml</url-pattern>
</servlet-mapping>

Then, you can write a HttpServlet that would make a XML Document (I would recommend using dom4j for that) and then you will serialize it to out (see HttpServletRequest.getWriter()) using Transformer (TrAX) api.

You can also serve such requests with jsp, but I wouldn't recommend that. Make a servlet.

alamar
+1  A: 

If you simply need to update some values in your XML file, it may be best to tokenize some values and have them stored in a properties file, which may be easier to update.

Essentially your XML file would contain lines like:

<node value="${name.of.variable}" />
<!-- imagine a large xml file continuing here, most of which doesn't need to be edited  -->

and your properties file can contain lines like:

name.of.variable="customize this value"
name.of.variable2="customize this value2"
name.of.variable3="customize this value3"
Cuga
They can't change flash, they can't do that.
alamar