5 Replies - 2938 Views - Last Post: 07 August 2009 - 02:07 PM Rate Topic: -----

#1 greatdragon   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 08-November 06

How to load a code inside XML config file?

Posted 07 August 2009 - 07:51 AM

I want to load a code that is inside XML app config file to a textBox, I tryed but appears that xml recognizes java and html as xml, crazy! I don't know much about xml, well here is the code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
<add key="Key1" value="<script type="text/javascript" src="popupDiv.js"></script>
  <div align="center">
</div><br /><script language="javascript">
function AbreImagem(imagem)
{
	var url = 'pop_up.html?foto=' + imagem;
	popup = window.open(url,'_blank','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=50,height=50');
	popup.focus();
}
function AbreInfo()
{

	var url = 'pop_up2.html';
window.open(url,'_blank','scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no,width=50,height=50');
	popup.focus();
}
function Layer()
{

  if (document.getElementById("mensagem_layer").style.visibility == 'visible')  
	document.getElementById("mensagem_layer").style.visibility = 'hidden';
  else				
	document.getElementById("mensagem_layer").style.visibility = 'visible';
}
</script>
<div align="center" class="tableBikes">
  <table width="400" border="0" align="center">
	<tr>
	  <td><div align="center">
		<table width="402" height="auto" border="0" align="center">
		  <tr> 
			<td rowspan="3">
			  <div align="center">
				<a href="java script:AbreImagem('$path');"><img src="$path" width="110" height="85" border="0"></a></div>
			  <div align="bottom"><center> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>clique  para aumentar a foto</strong></font>
			  </center></div></td>
			<td width="183"><div class="nameBike">$nome</div></td>
			</tr>
		  <tr> 
			<td height="44"><div align="bottom"><center>
			  <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Marca</strong>: $marca</font>
			</center></div><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Modelo</strong>: $modelo</font></div><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Aro</strong>: $aro</font></div></td>
			</tr>
		  <tr> 
			<td rowspan="2"><div align="center"><font size="2" face="Verdana"><a href="#" target="_self" onclick="Layer()"><img src="images/www.STADTAUS.com_btn4831336126.png" alt="" width="100" height="35" onclick="setVisible('layer1');return false" target="_self" class="buttonDetalhes" /></a></font></div></td>
			</tr> 
		  <td height="22"><center>
			<font size="4" face="Verdana, Arial, Helvetica, sans-serif">$preco</font>
			</center></td>
			</tr>
		  </table>
		</div>
		</td>
	  </tr>
  </table>
</div>
<div id="layer1">
  <span id="close"><a href="java script:setVisible('layer1')" style="text-decoration: none"><strong>Fechar</strong></a></span>
  <p>$descricao</p>
</div>
</code>" />
</appSettings>
</configuration>



If you guys need more information, just ask.
Thanks in advance!!

Is This A Good Question/Topic? 0
  • +

Replies To: How to load a code inside XML config file?

#2 Smurphy   User is offline

  • D.I.C Regular
  • member icon

Reputation: 35
  • View blog
  • Posts: 367
  • Joined: 07-July 08

Re: How to load a code inside XML config file?

Posted 07 August 2009 - 08:49 AM

Well the interesting thing about XML is that it is nothing but TEXT. You have to tell the program to read the code as code because now it is nothing but text. XML is not able to say what data looks like. It is only a way to structure data to which you then tell the program what that means. What are you trying to do this for anyway? Also here is a link that is really really nice http://www.w3schools.../xml_whatis.asp.
Was This Post Helpful? 1
  • +
  • -

#3 greatdragon   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 08-November 06

Re: How to load a code inside XML config file?

Posted 07 August 2009 - 11:43 AM

thanks for the tutorial now I know a bit about XML, so what is the best way too do it?
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to load a code inside XML config file?

Posted 07 August 2009 - 11:47 AM

Why is this in the C# Forum when all I see is HTML and Javascript?
Was This Post Helpful? 0
  • +
  • -

#5 greatdragon   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 67
  • Joined: 08-November 06

Re: How to load a code inside XML config file?

Posted 07 August 2009 - 01:05 PM

View PostPsychoCoder, on 7 Aug, 2009 - 10:47 AM, said:

Why is this in the C# Forum when all I see is HTML and Javascript?

Becouse my C# application works with html and I want to load a specific script into a textBox when I run the program cuz the script may change, understand?
Sorry if I wasn't specific!

This post has been edited by greatdragon: 07 August 2009 - 01:07 PM

Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades   User is online

  • Saucy!
  • member icon

Reputation: 6248
  • View blog
  • Posts: 24,015
  • Joined: 23-August 08

Re: How to load a code inside XML config file?

Posted 07 August 2009 - 02:07 PM

I'm pretty sure that's all going to have to be escaped, as in

<add key="Key1" value="lt;script type="text/javascript" src="...<


It's ugly, but trying to store HTML in XML is probably not the best idea.

EDIT: Actually, I think those are entities (lt; for <, gt; for >)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1