Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Rendering

Reply
Thread Tools

Rendering

 
 
Yama
Guest
Posts: n/a
 
      10-21-2005
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


 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      10-21-2005
use the xmlwriter or dom, they will handle the incoding.

-- bruce (sqlwork.com)

"Yama" <> wrote in message
news:%23LYA$...
> 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
>
>



 
Reply With Quote
 
 
 
 
Yama
Guest
Posts: n/a
 
      10-21-2005
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" <brubar_nospamplease_@safeco.com> wrote in message
news:uk$...
> use the xmlwriter or dom, they will handle the incoding.
>
> -- bruce (sqlwork.com)
>
> "Yama" <> wrote in message
> news:%23LYA$...
>> 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
>>
>>

>
>



 
Reply With Quote
 
=?Utf-8?B?UmFpbmllciBbTUNUXQ==?=
Guest
Posts: n/a
 
      10-21-2005
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" <brubar_nospamplease_@safeco.com> wrote in message
> news:uk$...
> > use the xmlwriter or dom, they will handle the incoding.
> >
> > -- bruce (sqlwork.com)
> >
> > "Yama" <> wrote in message
> > news:%23LYA$...
> >> 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
> >>
> >>

> >
> >

>
>
>

 
Reply With Quote
 
Yama
Guest
Posts: n/a
 
      10-21-2005
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]" <> wrote in message
news:FB31C1F8-9DC0-4E07-BCC2-...
> 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" <brubar_nospamplease_@safeco.com> wrote in message
>> news:uk$...
>> > use the xmlwriter or dom, they will handle the incoding.
>> >
>> > -- bruce (sqlwork.com)
>> >
>> > "Yama" <> wrote in message
>> > news:%23LYA$...
>> >> 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
>> >>
>> >>
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      10-21-2005
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" <> wrote in message
news:...
> 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]" <> wrote in message
> news:FB31C1F8-9DC0-4E07-BCC2-...
>> 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" <brubar_nospamplease_@safeco.com> wrote in message
>>> news:uk$...
>>> > use the xmlwriter or dom, they will handle the incoding.
>>> >
>>> > -- bruce (sqlwork.com)
>>> >
>>> > "Yama" <> wrote in message
>>> > news:%23LYA$...
>>> >> 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
>>> >>
>>> >>
>>> >
>>> >
>>>
>>>
>>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE6 SP1 rendering vs IE6 SP2 rendering Peter Mount HTML 4 01-31-2006 08:01 AM
Help with Firefox Webpage Rendering BAF Firefox 1 11-10-2004 07:58 AM
perl module for rendering molecular interaction network graph?? Yu Zhou Perl 0 05-20-2004 12:43 PM
Problem with Mozilla's rendering? Chris Firefox 7 11-28-2003 06:02 PM
Strange Problem Rendering Image in DataGrid Ron ASP .Net 0 07-01-2003 04:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57