473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Rendering

Hi,

I have 20 javascript files I would like to dynamically write to my rendered
web page. What I would like to do is instead of saving them into a database
table save them into a XML file then retrieve them according to user
selection. The question is how do I do that?

How can I save into a XML text and special character?

For example:

<script language=javascript>
<!--
alert("hello world") ;
// times another few 100s of line of code
-->
</script>

Question:
How can I save this into a XML file then get the row dynamically during
runtime?

Thanks,

~yamazed
Nov 19 '05 #1
5 1107
use the xmlwriter or dom, they will handle the incoding.

-- bruce (sqlwork.com)

"Yama" <ya**@yamabiz.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,

I have 20 javascript files I would like to dynamically write to my
rendered web page. What I would like to do is instead of saving them into
a database table save them into a XML file then retrieve them according to
user selection. The question is how do I do that?

How can I save into a XML text and special character?

For example:

<script language=javascript>
<!--
alert("hello world") ;
// times another few 100s of line of code
-->
</script>

Question:
How can I save this into a XML file then get the row dynamically during
runtime?

Thanks,

~yamazed

Nov 19 '05 #2
Hi,

Yes but I would prefer to copy the content of my filename.js into an XML
file then retrieve them by resding from them. I am not interested in writing
to an XML file.

Once I figured out how to save script data into an XML file I can figure out
how to read from it.

Thanks,

~yamazed

"Bruce Barker" <br******************@safeco.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
use the xmlwriter or dom, they will handle the incoding.

-- bruce (sqlwork.com)

"Yama" <ya**@yamabiz.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,

I have 20 javascript files I would like to dynamically write to my
rendered web page. What I would like to do is instead of saving them into
a database table save them into a XML file then retrieve them according
to user selection. The question is how do I do that?

How can I save into a XML text and special character?

For example:

<script language=javascript>
<!--
alert("hello world") ;
// times another few 100s of line of code
-->
</script>

Question:
How can I save this into a XML file then get the row dynamically during
runtime?

Thanks,

~yamazed


Nov 19 '05 #3
Let me just try to recap the story.

You want to select different parts of javascripts and group them together
probably using some kind of factory pattern. (Since this is great for
grouping look a lot alike things)

Then you are going to store the data in an XML file using a dom document
which you can find in System.Xml (you may have to register an extra assembly
to your project)

You can do this by simple adding a new Node and filling the .text of that
Node with your JavaScript. You may need to do something extra to make sure
the xml stays valid ( a <![CDATA[]]> something like that) tag. otherwise your
parser won't make heads or tails out of the data anymore.

Does this answer your question, or am I just blabbing away ??

--
Rainier van Slingerlandt
www.slingerlandt.com

Please hit the Yes button If my effort is helpfull.

"Yama" wrote:
Hi,

Yes but I would prefer to copy the content of my filename.js into an XML
file then retrieve them by resding from them. I am not interested in writing
to an XML file.

Once I figured out how to save script data into an XML file I can figure out
how to read from it.

Thanks,

~yamazed

"Bruce Barker" <br******************@safeco.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
use the xmlwriter or dom, they will handle the incoding.

-- bruce (sqlwork.com)

"Yama" <ya**@yamabiz.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,

I have 20 javascript files I would like to dynamically write to my
rendered web page. What I would like to do is instead of saving them into
a database table save them into a XML file then retrieve them according
to user selection. The question is how do I do that?

How can I save into a XML text and special character?

For example:

<script language=javascript>
<!--
alert("hello world") ;
// times another few 100s of line of code
-->
</script>

Question:
How can I save this into a XML file then get the row dynamically during
runtime?

Thanks,

~yamazed



Nov 19 '05 #4
Excellent point! In fact yes this is a factory behavior as there are a
family of scripts all deriving from a single source.

Okay I am not very familiar with CDATA.

Say I have something like this:

<jsScripts>
<jsScript id='ie6'>
<![CDATA[
function TestIE6(){ alert("I am using IE6"); }
]]>
</jsScript >
<jsScript id='ie5'>
<![CDATA[
function TestIE6(){ alert("I am using IE5"); }
]]>
</jsScript >
<jsScript id='nn6'>
<![CDATA[
function TestIE6(){ alert("I am using NN6"); }
]]>
</jsScript >
</jsScripts>

Save this as test.xml

Now how would I retrieve this from my application by id?

Thanks

Yama


"Rainier [MCT]" <Ra********@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
Let me just try to recap the story.

You want to select different parts of javascripts and group them together
probably using some kind of factory pattern. (Since this is great for
grouping look a lot alike things)

Then you are going to store the data in an XML file using a dom document
which you can find in System.Xml (you may have to register an extra
assembly
to your project)

You can do this by simple adding a new Node and filling the .text of that
Node with your JavaScript. You may need to do something extra to make sure
the xml stays valid ( a <![CDATA[]]> something like that) tag. otherwise
your
parser won't make heads or tails out of the data anymore.

Does this answer your question, or am I just blabbing away ??

--
Rainier van Slingerlandt
www.slingerlandt.com

Please hit the Yes button If my effort is helpfull.

"Yama" wrote:
Hi,

Yes but I would prefer to copy the content of my filename.js into an XML
file then retrieve them by resding from them. I am not interested in
writing
to an XML file.

Once I figured out how to save script data into an XML file I can figure
out
how to read from it.

Thanks,

~yamazed

"Bruce Barker" <br******************@safeco.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
> use the xmlwriter or dom, they will handle the incoding.
>
> -- bruce (sqlwork.com)
>
> "Yama" <ya**@yamabiz.com> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
>> Hi,
>>
>> I have 20 javascript files I would like to dynamically write to my
>> rendered web page. What I would like to do is instead of saving them
>> into
>> a database table save them into a XML file then retrieve them
>> according
>> to user selection. The question is how do I do that?
>>
>> How can I save into a XML text and special character?
>>
>> For example:
>>
>> <script language=javascript>
>> <!--
>> alert("hello world") ;
>> // times another few 100s of line of code
>> -->
>> </script>
>>
>> Question:
>> How can I save this into a XML file then get the row dynamically
>> during
>> runtime?
>>
>> Thanks,
>>
>> ~yamazed
>>
>>
>
>


Nov 19 '05 #5
load the xml into a dom, then use an xpath query to find the node.

XmlDocument doc = new XmlDocument();
doc.Load(new XmlReader(filename));
string script = doc.SelectSingleNode("//jsScript
[@id='ie6']").InnerText;

of course splitting the scripts by browser is not a good idea. you should
use one script that test the browser features and before using them. any
advanced client script tutorial should cover this.

-- bruce (sqlworks.com)


"Yama" <ya**@yamabiz.com> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
Excellent point! In fact yes this is a factory behavior as there are a
family of scripts all deriving from a single source.

Okay I am not very familiar with CDATA.

Say I have something like this:

<jsScripts>
<jsScript id='ie6'>
<![CDATA[
function TestIE6(){ alert("I am using IE6"); }
]]>
</jsScript >
<jsScript id='ie5'>
<![CDATA[
function TestIE6(){ alert("I am using IE5"); }
]]>
</jsScript >
<jsScript id='nn6'>
<![CDATA[
function TestIE6(){ alert("I am using NN6"); }
]]>
</jsScript >
</jsScripts>

Save this as test.xml

Now how would I retrieve this from my application by id?

Thanks

Yama


"Rainier [MCT]" <Ra********@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
Let me just try to recap the story.

You want to select different parts of javascripts and group them together
probably using some kind of factory pattern. (Since this is great for
grouping look a lot alike things)

Then you are going to store the data in an XML file using a dom document
which you can find in System.Xml (you may have to register an extra
assembly
to your project)

You can do this by simple adding a new Node and filling the .text of that
Node with your JavaScript. You may need to do something extra to make
sure
the xml stays valid ( a <![CDATA[]]> something like that) tag. otherwise
your
parser won't make heads or tails out of the data anymore.

Does this answer your question, or am I just blabbing away ??

--
Rainier van Slingerlandt
www.slingerlandt.com

Please hit the Yes button If my effort is helpfull.

"Yama" wrote:
Hi,

Yes but I would prefer to copy the content of my filename.js into an XML
file then retrieve them by resding from them. I am not interested in
writing
to an XML file.

Once I figured out how to save script data into an XML file I can figure
out
how to read from it.

Thanks,

~yamazed

"Bruce Barker" <br******************@safeco.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
> use the xmlwriter or dom, they will handle the incoding.
>
> -- bruce (sqlwork.com)
>
> "Yama" <ya**@yamabiz.com> wrote in message
> news:%2***************@tk2msftngp13.phx.gbl...
>> Hi,
>>
>> I have 20 javascript files I would like to dynamically write to my
>> rendered web page. What I would like to do is instead of saving them
>> into
>> a database table save them into a XML file then retrieve them
>> according
>> to user selection. The question is how do I do that?
>>
>> How can I save into a XML text and special character?
>>
>> For example:
>>
>> <script language=javascript>
>> <!--
>> alert("hello world") ;
>> // times another few 100s of line of code
>> -->
>> </script>
>>
>> Question:
>> How can I save this into a XML file then get the row dynamically
>> during
>> runtime?
>>
>> Thanks,
>>
>> ~yamazed
>>
>>
>
>


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
3
by: David Whitney | last post by:
All: I have a control that renders a table. As the table is rendered, each row in the table is constructed by creating a run-time (dynamic) object that is derived from an HtmlTableRow. The row...
4
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering...
0
by: Juan R. | last post by:
Since the idea of encoding mathematics using MathML is being very far from popular due to a number of factors -expensive tools, bad accesibility of generated code, unusual verbosity, lack of...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.