PDA

View Full Version : XML Woes - Confused


tdeprato
08-18-2006, 11:11 AM
Hi.

I have been coding on my OX 10.3.9 Ibook for over a year now. Before that I was on Windows. I have had no issues with php, html, css, java script, java, or python. I was editing a few XML files off and on but nothing complex.

Recently I have been studying XML more and trying to use it more. I am a very bad Java programmer, but I have seen some Java XML stuff that I would like to try.

So I bought a book on XML and it came with a CD. Basically 100% of the code will run in Explorer or Firefox on XP but only about 40% will run on OS X. is this normal?

Any ideas on fixing this would be great!

Here is a sample - this is the xml file the second set of code will be its style sheet. Save this one as squares_z.xml and the second as squares_z.css .
Then if they are in the same directory they should run in the browser.
-------------------------------------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="squares_z.css"?>

<squares>
<square class="one">
Square One
</square>
<square class="two">
Square Two
</square>
<square class="three">
Square Three
</square>
<square class="four">
Square Four
</square>
</squares>
-------------------------------------------------------------------------
square {
display:block;
position:absolute;
width:100px;
height:100px;
color:black;
text-align:center;
}

square.one {
background-color:red;
z-index:0;
left:0px;
top:0px;
}

square.two {
background-color:green;
z-index:3;
left:75px;
top:25px;
}

square.three {
background-color:blue;
z-index:2;
left:150px;
top:50px;
}

square.four {
background-color:yellow;
z-index:1;
left:225px;
top:75px;
}
--------------------------------------------------------------------------

hayne
08-18-2006, 11:53 AM
You neglected to tell us what goes wrong when you try those files.
It seems that your problems are more likely connected with CSS than with XML. You should check that the CSS you are using is valid (standards-conforming) by using the W3C validator: http://validator.w3.org/

tdeprato
08-18-2006, 12:00 PM
I will check that- although CSS has been fine all year until now.
What happens is nothing. The XML doesn't seem to get parsed and
I do not get any error messages. With the files I posted, I get only the TEXT not the "graphics", although they aren't really graphics.

If it works on your MAC let me know.

Tony D

hayne
08-18-2006, 12:09 PM
What happens is nothing. The XML doesn't seem to get parsed

I think you are expecting a feature to be present in the browser that isn't there. You need to read more about CSS and what capabilities it provides. I suspect that what you are trying to do is not part of standard CSS and as such is not supported by Safari.

tdeprato
08-18-2006, 12:22 PM
I am not running safari.

I program on the MAC and show my examples to my students. I have never ran into any OS specific compatibilty issues with Firefox and CSS, but I might need to read more. BUT actually, I won't matter if Firefox or IE (I did try Safari but it is the same result) on OS X can't deliver I will just use the Windows Desktop.

All th student work is done on Windows anyway, I just prefer my MAC and I use the Terminal alot as well. So maybe I need to read more.

Once I solve my WIFI craziness I will allot more reading time for CSS and XML on firefox.

Tony D

hayne
08-18-2006, 12:34 PM
Using Firefox and IE 5.2
I am not running safari.
You definitely don't want to use Internet Explorer on the Mac for anything. It is no longer supported (since a long time) and has several known security problems. That browser is obsolete on current systems and should never be used.

I program on the MAC and show my examples to my students. I have never ran into any OS specific compatibilty issues with Firefox and CSS, but I might need to read more. BUT actually, I won't matter if Firefox or IE (I did try Safari but it is the same result) on OS X can't deliver I will just use the Windows Desktop.

You are doing the students (and the world) a disservice if you teach them non-standards-conforming things that only work on Windows.

tdeprato
08-18-2006, 12:47 PM
Listen so far everything I have done is cross platform. School doesn't start for a few more weeks. I just read a few articles explaining a header that needs to be in the style sheet when using XML with Firefox.

I have 40% of the lessons done with cross compatible code. No errors. But some of the interesting stuff that works on Windows does not seem to conform.
So I need to find a away to do it.

Anyway Java script is the same - somethings differ in Firefox. However, IE is the testing platform at school- and at most schools - so I normally only show them what works in both browsers.

I really just wanted some people to run the code I posted on their MAC in Firefox or Safari and tell me if it worked for them. Cause if it does then the problem is something else.

So - if anyone has time run the code and tell if it works.

Back to the wifi nightmare.


Tony D