Forum Moderators: open

Message Too Old, No Replies

XML using internet explorer

Viewing XML with Schema and XSLT in IE6?

         

FarFromHome

5:23 pm on Nov 11, 2004 (gmt 0)

10+ Year Member



I want to be able to open an XML file with IE6, have it validated against a schema, and then displayed according to an XSLT. However I'm getting the impression that IE doesn't want to actually use schemas at all. Am I trying to do the impractical / impossible?

I'm still new to XML stuff and I've been thinking of playing around with it as a simple sort of database to edit using Java but view using a browser. I figured XSL would allow me to have the viewer ready soon and use a text-editor until I get round to the Java bit. Seemed like a good idea but the browser isn't dealing with my XML as I expected.

Thank you in advance for any ideas.

James

Xmlx

7:16 pm on Nov 11, 2004 (gmt 0)

10+ Year Member



Hello FarFromHome,

I don't think its so much that IE doesn't like Schemas, its more that it adds a lot of performance overhead.

Schemas are important, but they are not necessary everytime you want to display or XSLT some XML.

As a personal rule-of-thumb, I typically only employ validating XML with a schema when I can't trust the source of the XML. But if you're building the XML to your own specifications/vocabulary - then you can trust it, and dispense with pulling in a schema everytime you want to read it.

As for XML based databases, these are neat-o, but not always practical. I've built one or two myself, when the need warrants it - but the size of XML can make it prohibitive when you need speed on a large amount of XML data. Understanding XML design is key to achieving a workable balance here.

Basically what I'm saying, is don't set your sights too high. Investigate some commerical/open sourse XML based databases if you want to push this idea to the max.

As for managing your XML with Java, and displaying with IE - note that the two platforms will use different XML Parsers, and not all Parsers are created equal.

It sounded like you were looking more for advice rather than technical help, so I hope this helps. Cheers...

FarFromHome

12:58 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



Thanks for the advice. I guess I'm not sure that this is the best way ahead at all... it's partly an excuse for a project with which to learn a bit about XML (although if I discover it's not suitable for this then I've learnt something so that's ok!). The 'database' I had in mind for now is very small - just a dozen or so entries. I didn't really plan to do anything big with it. Maybe 'database' is the wrong term. However I thought I could use this to learn about XML for a specific application at work. I have a device which will produce a log file everyday. I thought it should be relatively easy to generate the logs as XML, and view them using a common XSL: little programming needed, and everyone in my office could view the data remotely without installing extra software or learning any new skills... could even make it accessible when people are out of the office over the web (over a VPN). Ok, for this project I'd be generating the XML so I'd don't want to validate it all the time, but I'd still like it linked to a schema so I can validate it when I generate the XML.

Actually I have a technical problem as well. I have the 3 basic files (XML, XSD and XSL) which (I believe) refer to each other correctly. When I open the XML in IE it only shows me the text - without the tags, or any kind of formatting. I get no kind of error messages despite deliberately making a mistake in the XML content, but that would fit with IE not validating to the schema. When I remove all the bits about namespaces from the XML file it does use the XSL.

I've posted the relevant bits below - maybe someone can give me a hint as to where I'm going wrong. (I've snipped the namespace, but as I understand it this is only a name and not actually checked by the system - as long as it's consistent)

XML
................
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="anniversaries.xsl"?>
<anniversaries xmlns="#snipped#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="#snipped# anniversaries.xsd">
.
.
................

XSD
................
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="#snipped#"
targetNamespace="#snipped#">
.
.
................

XSL
................
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"
doctype-system="DTD/xhtml1-strict.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
.
.
................

Xmlx

3:24 pm on Nov 12, 2004 (gmt 0)

10+ Year Member



Hi FarFromHome,

I don't mean to discourage you, I enjoy working with XML and find every excuse I can to use it - but I still force myself to be practical.

By all means, as a learning experience, go for it. The benefits of being comfortable and fluent in XML dialects are huge.

When I open the XML in IE it only shows me the text - without the tags, or any kind of formatting.

This is typical of an XSLT error. Something in the XSL file is not referencing the proper nodes in the XML file.

Of course, I haven't seen any detail of your code - but your description points at this.

Hope this helps....