Forum Moderators: open
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
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...
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" />
.
.
................
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....