Generating dynamic XML

We have a flash load of information from an XML file. Right now we have to hard-code the XML content and put it in a relative location wrt Flash. Is there a way to make XML dynamics other than being written to the output stream to modify the stored xml. I want the xml to serve the content like JSP. The approach I can think of is to tell Flash to JSP instead of XML, but we don't have any flash guys to do that. Any suggestions???

0


a source to share


2 answers


Well you can serve xml requests as well (sample web.xml

)

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

      



Then you can write an HttpServlet that will make an XML document (I would recommend using it dom4j

for that) and then you serialize it outside (see HttpServletRequest.getWriter()

) using the Transformer

(TrAX) api.

You can also serve requests like this with jsp, but I would not recommend that. Make a servlet.

+1


a source


If you just need to update some of the values ​​in your XML file, it might be best to highlight some of the values ​​and store them in a properties file, which may be easier to update.

Essentially your XML file will 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"

      

+1


a source







All Articles