Inlined XSD with Excel (Office 2003) problems


XML & Web services: Inlined XSD with Excel (Office 2003) problems

  1. Inlined XSD with Excel (Office 2003) problems (2 messages)

    Hi, We currently mail out reports to clients as XML files, which also need to have their corresponding XSD files so that columns are properly formatted when they open them in Excel. Since we send them out as attachments, we would like to include only one file, instead of the XML file and the XSD file. To do this, I am trying to inline the XSD. I created the following sample, which validates as proper XML, which I have tested by opening in Firefox, Internet Explorer, and the "XMLstarlet" toolkit (unix). When I try to open it in Excel 2003, it gives me an error, and doesn't tell me why....Here is the code. Has anyone had any success with this? <!--?xml version="1.0" encoding="ISO-8859-1"?--> 10 John Doe 11 Jane Smith Many thanks, -Esko
  2. Unfortunately, W3C XML Schema validators don't support having Schemas embedded in the input document (in the way that you can embed a DTD in an instance document). Your best bet might be to put the Schema on a Web server and refer to the Schema from each instance using an "xsi:schemaLocation" (or "xsi:noNamespaceSchemaLocation") via a URL. Excel should then be able to download the Schema from the Web site, as long as your clients' Web access isn't restricted. Cheers, Tony. ---- Author, "XML APIs" chapter, "Advanced XML Applications from the Experts at The XML Guild"
  3. Yeah that's what I originally had however the schemaLocation directive behaves according to how the XML file was opened. What I mean is that if the user types in the url to the XML file into Excel in the "Open Location" dialog, and in my XML file I have a reference to an xsd like: then it will look at the URL where it was opened, in a directory called "xsd", and successfully load Reports.xsd. However, if the user loads the exact same content, except it is from a local file, the system will try to load Report.xsd in directory "xsd" within the directory where the xml file resides. So, if it's not possible to embed the schema within the document, I guess the next question is: is there a way to load an external XSD file from a locally-loaded XML file? -Esko