use the xmlwriter or dom, they will handle the incoding.
-- bruce (sqlwork.com)
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
> use the xmlwriter or dom, they will handle the incoding.
>
[quoted text clipped - 25 lines]
>>
>> ~yamazed
Rainier [MCT] - 21 Oct 2005 20:04 GMT
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 ??

Signature
Rainier van Slingerlandt
www.slingerlandt.com
Please hit the Yes button If my effort is helpfull.
> Hi,
>
[quoted text clipped - 38 lines]
> >>
> >> ~yamazed
Yama - 21 Oct 2005 20:32 GMT
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
> Let me just try to recap the story.
>
[quoted text clipped - 62 lines]
>> >>
>> >> ~yamazed
Bruce Barker - 21 Oct 2005 22:12 GMT
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)
> Excellent point! In fact yes this is a factory behavior as there are a
> family of scripts all deriving from a single source.
[quoted text clipped - 96 lines]
>>> >>
>>> >> ~yamazed