473,699 Members | 2,835 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PLEASE explain xmlDocument on server, but the html transform on client???

If someone could just explain this to me...I just don't get it!

I have an aspx page where I retrieve several session variables and use
xmlDocument to transform xml file with xsl file into an instruction
document (not data based) - same as using an xml web control.

The resulting html is on the client? but what about the server side of
things? Trying to figure out how to change and save the xmlDocument.
It I put a button OUTSIDE of the html transform but inside the aspx
page, could I change and save the xmlDoc that way?

Sorry to be so dense about this...PLEASE help me out with explanation
and hopefully an example (again, please don't use datagrid, database
structure data, I'm using text documents as in publishing.

Many thanks,

Kathy
Nov 11 '05 #1
5 3606
You can transform the XML on the server without rendering it to the client.
If the result of the transformation is well-formed XML, then you can load it
into an XmlDocument class and save it as needed.

Can you give some more background for your question?
--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans
"KathyB" <Ka**********@a ttbi.com> wrote in message
news:75******** *************** **@posting.goog le.com...
If someone could just explain this to me...I just don't get it!

I have an aspx page where I retrieve several session variables and use
xmlDocument to transform xml file with xsl file into an instruction
document (not data based) - same as using an xml web control.

The resulting html is on the client? but what about the server side of
things? Trying to figure out how to change and save the xmlDocument.
It I put a button OUTSIDE of the html transform but inside the aspx
page, could I change and save the xmlDoc that way?

Sorry to be so dense about this...PLEASE help me out with explanation
and hopefully an example (again, please don't use datagrid, database
structure data, I'm using text documents as in publishing.

Many thanks,

Kathy

Nov 11 '05 #2

Kirk,

Thank you SO much for answering...

I have a well formed (of course) xml file that when transformed with an
xsl stylesheet presents the user with a very prettily formatted document
of mfg process steps to follow.

There are some input boxes (e.g., in the xsl if the element <measure>
exists, xsl creates an input box) where when the user enters something,
I need to save it as part of the new document file (a record of what the
user has done).

Whenever I read things about this, it always says must do that stuff
"client side" via javascript. Of course, I realize I have to use
javascript, but don't get why if I'm using a .net xml web control to
specify the xml source and xsl transform file, that I'm now on client!
Of course, I realize asp.net results in html to the browser...sort of!!!

PLEASE show me an example of saving user-entered info within the
xmlDocument class? I don't want to save a "node" but the entire
document. See what I mean? Perhaps how to save the xmlDoc from within
the html javascript code?

Again, thanks for responding! I really appreciate it.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #3
Kirk,

Also, how is "transformi ng the XML on the server without rendering it to
the client" possible, I thought if you did that (xml and xsl) it
automatically gets sent to the client as HTML...I feel so stupid!

Then "If the result of the transformation is well-formed XML, then you
can load it into an XmlDocument class and save it as needed." Again, I
thought that transforming it within xml control WAS loading it into an
xmlDoc...?

Thanks.
KathyBurke

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #4
Probably the first thing to nail down is what happens on the server versus
what happens on the client. On the server, you have an XML file and an XSLT
file. You load the XML file up into an XmlDocument class, load up an
XslTransform, and perform the transformation using XslTransform.Tr ansform.
Does your code look kind of like this? Or are you using the asp:Xml control
to do the transformation?
System.Xml.XmlD ocument doc = new System.Xml.XmlD ocument();
doc.Load(Server .MapPath("data/xmlfile1.xml")) ;
System.Xml.Xsl. XslTransform trans = new System.Xml.Xsl. XslTransform();
trans.Load(Serv er.MapPath("xsl t/xsltfile1.xslt" ));
//transform the results directly to the output stream
trans.Transform (doc,null,Respo nse.OutputStrea m,new
System.Xml.XmlU rlResolver());
From your description, I am guessing that the result of the transformation
is HTML, and you send the HTML to the client in the HTTP Response. You can
confirm this simply by viewing the page source in the browser.

Now that you have HTML in the browser, the HTML is parsed and the UI you see
with input boxes and buttons is rendered. As you input data into the UI
elements, you want that data to be sent *back to the server*, where the data
is saved? If this is the case, then this is completely possible. Or do you
want to save the data locally to the client's machine? If this is the case,
then this is not possible, since script in the browser purposefully does not
support file I/O.

Let's assume that you have an XML document that you want to update with the
values that the user was working with. There are a couple ways you can do
this.

One way is to use the Request.Form collection to read the values directly
out of the post.

System.Xml.XmlD ocument doc = new System.Xml.XmlD ocument();
doc.Load(Server .MapPath("data/xmlfile1.xml")) ;
if(!IsPostBack)
{
System.Xml.XmlD ocument doc = new System.Xml.XmlD ocument();
doc.Load(Server .MapPath("data/xmlfile1.xml")) ;
System.Xml.Xsl. XslTransform trans = new System.Xml.Xsl. XslTransform();
trans.Load(Serv er.MapPath("xsl t/xsltfile1.xslt" ));
//transform the results directly to the output stream
trans.Transform (doc,null,Respo nse.OutputStrea m,new
System.Xml.XmlU rlResolver());
}
else
{
System.Xml.XmlN ode node = doc.SelectSingl eNode("Customer/@ID");
node.Value = Request.Form["txtCustome rID"];
doc.Save(Server .MapPath("data/newxmlfile1.xml "));
}

Note that all of this code runs *completely on the server*. The net effect
of this code is to emit HTML back to the client within the HTTP response.
The client's browser knows nothing about XmlDocument.

You can also use client-side JavaScript to do lots of cool stuff, including
using a client-side IE Web Service Behavior that can call web services from
client-side JavaScript. You can also use IE Data Islands and work with XML.
You can create an MSXML.DOMDocume nt object on the client and work with XML,
then use the MSXML.XMLHTTP class to post the data to your web server. There
is lots of stuff you might do on the client, but the real question is "do
you really need to?" The example above shows how to update the XML document
using the XmlDocument class, is that enough? Or do you really need lots of
client-side JavaScript to manipulate the DOM in the client?
--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans

"Kathy Burke" <ka**********@a ttbi.com> wrote in message
news:#A******** ******@tk2msftn gp13.phx.gbl...

Kirk,

Thank you SO much for answering...

I have a well formed (of course) xml file that when transformed with an
xsl stylesheet presents the user with a very prettily formatted document
of mfg process steps to follow.

There are some input boxes (e.g., in the xsl if the element <measure>
exists, xsl creates an input box) where when the user enters something,
I need to save it as part of the new document file (a record of what the
user has done).

Whenever I read things about this, it always says must do that stuff
"client side" via javascript. Of course, I realize I have to use
javascript, but don't get why if I'm using a .net xml web control to
specify the xml source and xsl transform file, that I'm now on client!
Of course, I realize asp.net results in html to the browser...sort of!!!

PLEASE show me an example of saving user-entered info within the
xmlDocument class? I don't want to save a "node" but the entire
document. See what I mean? Perhaps how to save the xmlDoc from within
the html javascript code?

Again, thanks for responding! I really appreciate it.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 11 '05 #5
Kirk, hey I think I'm now starting to get this...thanks to you!

This is how I load my xmlDoc:

Dim xDoc As New XmlDocument()
Dim xTrans As New XslTransform()
xDoc.Load(Serve r.MapPath(varWI ))
xTrans.Load(Ser ver.MapPath("KB _Test.xsl"))
xTrans.Transfor m(xDoc, Nothing, Response.Output )

...not using an .net xml web control...does that matter?

In your example, it looks like we're loading the doc twice? once in the
first 2 lines, then again If(!IsPostBack) ?

under the else lines:

this is how I would change the node.value of the input box
element...yes? is there any way to simply save the entire doc without
having to save each node.value that is changed? (probably not, would be
too simple!).

This helps a lot, thanks. Could you possibly give me a quick example of
the Onclick javascript within the html that would perform the above?

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #6

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

Similar topics

5
1454
by: serge calderara | last post by:
dear all, I have benn going through a .net possibility such as amanging XMLDocument and xml transmorf function. In that set of features I am really swimming deep under the water, I have nearly no more heirs. In fact I do not know the real benefit of using those XMLDocument or XLS transformation files. In that my problem is that I do not really see when this can of feature can be use, and the real benefit of those, concrete examples.
1
1964
by: KathyB | last post by:
Kirk, The other day you very kindly explained how the client/server thing works. May I ask just one more question? Could you give me an example of what code I would put in the client html to post back the user input to the server xmlDocument? You gave me: One way is to use the Request.Form collection to read the values
2
6036
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
0
1276
by: KathyB | last post by:
Hi, I would be grateful for any guidance in how to achieve the following. I have an aspx page in which I transform an xmlDocument instance to the browser...so (as I understand it) that page contains the xmlDocument AND the transformed instance client-side in the browser. The main xml element used in this doc is a <step> element. For each step element I will create an "Anomaly" button using xsl to create an <input> button in html and...
3
2244
by: BrianDH | last post by:
Hi I am having a problem doing the tranform. Unlike all the examples I have found, I do not load my XML document via a path but from a datacall. I get erros when I try to do the transform (white space cannot be striped) XmlDocument DealXmlDocument = new XmlDocument(); DealXmlDocument.LoadXml(DataCalls);
1
1697
by: shapper | last post by:
Hello, For the past hours I have been trying to solve a problem which is driving me crazy. I have to different codes where the problem to solve is the same: CODE 1 (Transforms a XML document using a XSL file): Function Trans()
1
2202
by: shapper | last post by:
Hello, I am trying to convert an Asp.Net XML sitemap file in a Google XMl sitemap file using a XSL file using an HttpHandler. Everything seems well in my code but I am getting an error: XML Parsing Error: not well-formed Location: http://localhost:1132/WebSite/Google Line Number 2, Column 62:<urlset
1
2601
by: Simon Brooke | last post by:
One of the things I'm messing with at present is offloading some of my XSL processing to those browsers which claim to be able to handle it. That is to say, if the client tells me it accepts either 'text/xml' or 'application/xml' I'll send it the XML with an appropriate xml-stylesheet PI; otherwise I'll run the transform server side and ship HTML. However, I'm getting differences in the resulting HTML depending on whether the XML is...
2
3081
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the textbox value in the main page is undefined ---------------------------------------- here are code main page: ------------------------------------------- <script language="JavaScript"> var thedata; var newwin; var thenumber; function...
0
8703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9185
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8935
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8893
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4389
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.