The XML file has elements in it that i search for and replace from a database. I then output the final updated XML. The reasoning for this is speed [in terms of on going dev] and simplicity [i'm not great in PHP].
If anyone can help or point me in the right direction that would be great.
For what it's worth here's the ASP that i've used:
Code: Select all
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/xml";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
//write XML here
StreamReader streamReader = new StreamReader("C:\\Inetpub\\wwwroot\\Admin\\output\\content.xml");
string strXML = streamReader.ReadToEnd();
streamReader.Close();
//get translation data for current language
string strFriendlyName;
string strTranslation;
SqlConnection SqlConn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand SqlComm = new SqlCommand("spGetTranslations", SqlConn);
SqlComm.CommandType = CommandType.StoredProcedure;
SqlComm.Parameters.Add(new SqlParameter("@LauguageID", globalFunctions.intCount));
SqlConn.Open();
SqlDataReader SqlDataReader = SqlComm.ExecuteReader();
//replace placeholders with translation data
if (SqlDataReader.HasRows)
{
while (SqlDataReader.Read())
{
strFriendlyName = SqlDataReader["FriendlyName"].ToString();
strTranslation = SqlDataReader["Translation"].ToString();
strXML = strXML.Replace("**" + strFriendlyName + "**", strTranslation);
}
}
SqlConn.Close();
SqlComm.Parameters.Clear();
SqlDataReader.Close();
context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(0));
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.Write(strXML);
}