# Why is this xml not loading into my html on a mac



## yavarsity (Aug 10, 2005)

I'm trying to display xml text in a html table. This code below works on a PC but not on a mac. Could someone please give me a clue why this is happening?


HTML Doc:
<!-- File Name: Inventory Table.htm -->

<HTML>

<HEAD>
<TITLE> Book Inventory</TITLE>
</HEAD>
<BODY>
<XML ID="dsoInventory" SRC="Inventory.xml"></XML>

<H2> Book Inventory</H2>

<TABLE DATASRC="#dsoInventory" BORDER="1" CELLPADDING="5">
			<THEAD>
				<TH>Title</TH>
				<TH>Author</TH>
				<TH>Binding</TH>
				<TH>Pages</TH>
				<TH>Price</TH>
			</THEAD>
			<TR ALIGN="center">
				<TD><SPAN DATAFLD="TITLE"</SPAN></TD>
				<TD> <SPAN DATAFLD="AUTHOR"</SPAN></TD>
				<TD> <SPAN DATAFLD="BINDING"</SPAN></TD>
				<TD> <SPAN DATAFLD="PAGES"</SPAN></TD>
				<TD> <SPAN DATAFLD="PRICE"</SPAN></TD>
				</TR>
			</TABLE>
		</BODY>
	</HTML>


XML Doc:

<?xml version="1.0"?>

<!-- File Name: Inventory.xml -->

<INVENTORY>
	<BOOK>
		<TITLE>The Adventures of Huckleberry Finn</TITLE>
		<AUTHOR>Mark Twain</AUTHOR>
		<BINDING>mass marketing paperback</BINDING>
		<PAGES>298</PAGES>
		<PRICE>$5.49</PRICE>
	</BOOK>

</INVENTORY>

Thanks for anyones help.
Michael


----------



## kainjow (Aug 10, 2005)

Hmm I've never seen the "XML" element before. You sure it's not some IE-specific thing?

OK I just tested on IE for Windows, and it does work, but it doesn't work on Firefox (Mac and Windows) or Safari, or IE on Mac, so I'm 99% sure it's some IE Windows only thing, which means you want to avoid it. If you're working with XML, the safest way is to do it all through a CGI script, but if you're just learning, stay away from non-standard HTML elements!


----------



## yavarsity (Aug 10, 2005)

Thanks for getting back to me.
What I'm trying to do is help out a person with little or no knowledge of HTML. He wants to be able to add content and up date his web site. So I heard that I could use an xml doc, which can be created with a text ap, and have it linked to an html table. This way he can make changes to the xml doc "Text Doc" which would then automatically be made to the html doc, without him having to learn HTML.
Am I explaining myself that you understand?
Michael
PS could you give me another way to handle this?


----------



## yavarsity (Aug 10, 2005)

kainjow
Do you know anything about XHTML?


----------



## barhar (Aug 10, 2005)

I tested your '.html' / '.xml' code on a Windoze98 PC (It was copied from the web page, pasted into and save via 'Text Edit', and then copied via a local network to the PC). The PC's copy of 'Internet Explorer' displayed the table and book related information correctly.

I then tested the same code on a PowerMac running 'Tiger' 10.4.0 (and then 'Panther' 10.3.4) with 'Camino', 'Firefox', 'iCab', 'Internet Explorer', 'OmniWeb', 'Opera', and 'Shiira'.  Only the '.html' text and table were displayed; not the book's actual title, author, binding, number of pages, or price (that is the data in the '.xml' file).  When the same files were tested running 'Jaguar' 10.2.0, with just 'Internet Explorer, and - the results were the same ... text and table; but, no data displayed.

Nice catch, dude!

Time permitting, I may look into this further - myself.


----------



## yavarsity (Aug 11, 2005)

Thanks for doing all that extra leg work but yes, that was also happening to me. Just a thought I had... If I were to change the html to xhtml do you think that might work...since xhtml is based on xml?
I would be very greatful if you would let me know if you figure-out what's going wrong. I will keep plugging away on my end. I'll let you know if I find-out anything.
Thanks again, yaVarsity


----------



## barhar (Aug 11, 2005)

"If I were to change the html to xhtml do you think that might work...since xhtml is based on xml?"
I do not know. If you provide the code, I may give it a try.


----------



## yavarsity (Aug 11, 2005)

I have spent all day on this... going from forum to forum. I think I have found out I sould try something all together different.
Thanks for your help
Michael


----------



## kainjow (Aug 11, 2005)

The highly preferred way of working with XML files and HTML is not client side, but server side. You will have 100% control of your web page if you handle the XML all via the server, like through PHP or something. We've basically said that the code above will not work on anything but IE for Windows, so don't use it.


----------



## yavarsity (Aug 11, 2005)

OK... sound like a plan.
Thanks for your help
Michael


----------



## Krevinek (Aug 29, 2005)

Another route is XSLT. It allows you to run an app over the XML document, and it will create another document using this scripted template. So, it is very possible to create a standard HTML document from the XML document which can be run when he makes a change to the XML document.

(I use a similar technique for some HTML/PDF stuff I do, where XML is a more effective an efficient storage medium for my data...)


----------



## yavarsity (Aug 29, 2005)

thanks, I will have to give it a try


----------



## andehlu (Aug 29, 2005)

no itll never work on a mac. internet explorer pc uses msxml to parse xml and can be incorporated into a table the way you are doing it... EVIL. The best way to ensure that this gets done properly cross platform would be to write a php/asp/jsp script to parse the xml and to build the table dynamically.


----------



## andehlu (Aug 29, 2005)

whoops, didnt realize there was a second page before i posted ..


----------



## yavarsity (Aug 30, 2005)

Thanks for your reply. I figured out this cross platform problem after many tries and errors. I decided to use Flash (I know that better than php/asp/jsp). It is working fine now but thanks for all your input.


----------

