Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 30th, 2003, 03:02 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Island vs. XSL?

I am having problem displaying data using Data Island ... When the user first enter data and the XML file is first craeted, it will display the data. But if the XML file already existed and user enter data to update the XML file, data island seem can't get all the data and display in html form. However, that works fine in XSL. I am not sure why ... Data island suppose to get data from the generated XML file and display the data ... :( Reason I hope to use Data Island is because I really just want to display it only, and not have any fancy layout, so I try to avoid using XSL. To my understanding, Data Island and XSL are same to display data ... I hope I am right.

In my form (profile.html, it will generate XML file in process.asp, then redirect to profile.html). I assume that I have to "reload" the window everytime I visit profile.html, but it doens't work either.


Display data using Data Island (not working)
=============================================
<xml id="name" src="name.xml"></xml>

<table border="0" datasrc="#name">
<tr>
<td><td><span datafld="Name"></span></td></td>
</tr>
</table>
=============================================

Display data using XSL (works prefectly)
=========================================

  <XML id="source" src="name.xml"></XML>
    <XML id="style" src="name.xsl"></XML>

    <SCRIPT FOR="window" EVENT="onload">
        xslTarget2.innerHTML = source.transformNode(style.XMLDocument);
    </SCRIPT>
 <DIV id="xslTarget2"></DIV>

=========================================

 
Old October 31st, 2003, 05:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Sounds like the data may be cached on the client. Try ctrl+F5 as a manual test after an update, if this works then you need to stop caching. There are not any guaranteed ways to do this in HTML pages but it's easier with dynamic pages such as ASP. One trick is to use a different url each time. When you redirect to profile.html how do you do it? If using Response.Redirect try:

Code:
Response.Redirect"profile.html?" & Rnd()
--

Joe
 
Old November 4th, 2003, 01:01 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, it doesn't work either I redirect and produce diff URL (&Rnd) or press the ctrl f5 ... :( I really not sure why it doesn't work like that. If I put a simple example and it just works well. But not in my application while it generate xml file in ASP page and redirect to display all the data from the generated xml file :(

 
Old November 5th, 2003, 01:56 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Show us the code when you use data island, are you saving the changes?

--

Joe
 
Old November 5th, 2003, 07:54 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My code is very straight forward ... here is the code:
================================================== =======
<html>
<body>

<xml id="data" src="name.xml"></xml>

<table border="1" datasrc="#data">
<tr>
<td><span datafld="Name"></span></td>
<td><span datafld="Phone"></span></td>
</tr>
</table>

</body>
</html>

=========================================
My XML file:
=========================================
<?xml version="1.0"?>
<Data>
  <Each_Person>
      <Name>Professor Mike</Name>
      <Phone>905-992-0293</Phone>
  </Each_Person>

  <Each_Person>
      <Name>Professor Satton</Name>
      <Phone>416-991-9999</Phone>
  </Each_Person>
</Data>
==================================================

 
Old November 7th, 2003, 04:25 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

A really simple test like this works. Send me your files via email, click icon above message and I'll have a proper look.
Code:
<html>
<head><title>Simple Data Bind</title>
<script type="text/javascript">

function addPerson()
{
  var oDoc = document.getElementById("data").XMLDocument;
  var oPerson = oDoc.createElement("Each_Person");
  (oPerson.appendChild(oDoc.createElement("Name"))).text = document.getElementById("txtName").value;
  (oPerson.appendChild(oDoc.createElement("Phone"))).text = document.getElementById("txtPhone").value;
  oDoc.documentElement.appendChild(oPerson);
}
</script>
<xml id="data" src="name.xml"></xml>
</head>
<body>
Name:&nbsp;<input type="text" id="txtName" size="20">
Phone:<input type="text" id="txtPhone" size="20">
<input type="button" onclick="addPerson();" value="Add Person">


<table border="1" datasrc="#data">
<tr>
<td><span datafld="Name"></span></td>
<td><span datafld="Phone"></span></td>
</tr>
</table>

</body>
</html>
Joe (MVP - xml)
 
Old November 11th, 2003, 04:04 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, did you received my files? Have you get a chance to take a look at it? Thanks.

 
Old November 12th, 2003, 04:35 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm afraid I haven't. Send them again and I'll be extra careful. I was getting so much rubbish with sobig etc. taht I deleted quite a few legitimate emails.

--

Joe
 
Old November 12th, 2003, 12:08 PM
Authorized User
 
Join Date: Oct 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, I just send you my codes. Kindly check it out. Thanks, looking forward to hear from you soon.

 
Old November 19th, 2003, 05:35 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Two things appear to be wrong, firstly your tables and stuff are incorrect, this means IE is struggling to parse the document, make sure that td tags match, input elements do not have closing tag, head is ended etc.
Secondly the structure of your xml is strange, a stray name element surrounds the details. IE can only cope with very tabular xml docs.

Joe (MVP - xml)





Similar Threads
Thread Thread Starter Forum Replies Last Post
data island nerssi Javascript 1 February 14th, 2008 08:47 AM
Data Island Problem musa100 XML 1 August 5th, 2005 01:53 AM
Problem with Data Island when it has empty data pmcxs XML 4 December 2nd, 2003 10:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.