0
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"   
           xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/">
  <xs:import namespace="http://ns.adobe.com/AdobeInDesign/4.0/"
             schemaLocation="aid.xsd"/>
  <xs:element name="Table">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Cell"/>
      </xs:sequence>
      <xs:attribute ref="aid:table" use="required"/>
      <xs:attribute ref="aid:tcols" use="required"/>
      <xs:attribute ref="aid:trows" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Cell">
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element minOccurs="0" 
                    maxOccurs="unbounded" 
                    ref="mathImage"/>
      </xs:sequence>
      <xs:attribute ref="aid:ccols" use="required"/>
      <xs:attribute ref="aid:ccolwidth" use="required"/>
      <xs:attribute ref="aid:crows" use="required"/>
      <xs:attribute ref="aid:table" use="required"/>
      <xs:attribute ref="aid:theader"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="mathImage">
    <xs:complexType>
      <xs:attribute name="href" 
        use="required" 
        type="xs:anyURI"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

The problem I'm encountering is that the namespace for the Adobe InDesign is not valid nor is the schema location. Does anyone have an alternative to this situation?

Here's the gist of my problem: I'm trying to validate Tables from Adobe InDesign in a schema I've written. We decided to export the tables as InDesign tables, and not CALS, due to our need to capture styling information. I've already written an validated the remainder of my schema, but this portion is giving me trouble.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • When you say "the namespace ... is not valid", you mean what exactly? Are you looking for an XSD schema that describes the XML exported from InDesign, or looking to write such a schema yourself? It's not clear exactly what problem you are looking to solve here. More details will help would-be answerers. – C. M. Sperberg-McQueen Dec 18 '12 at 19:03
  • Sorry for not being clear. I am writing my own schema for validating XMl (using the Styles to Tags feature in InDesign) generated when exporting from InDesign. The main problem I'm running into is that I cannot manage to import the schema above into my overall schema and am wondering what's the best way to proceed. – Berman647 Dec 18 '12 at 20:34
  • What error message are you getting? What different things have you tried? Do you have a schema document for namespace `http://ns.adobe.com/AdobeInDesign/4.0/` located at `aid.xsd` in the same directory as the schema document you show above? You may find it helpful to review the FAQ's guidance on [asking good questions on Stack Overflow](http://stackoverflow.com/faq#howtoask). [Eric Raymond's advice](http://www.catb.org/esr/faqs/smart-questions.html) on that topic is also highly thought of, for good reason. – C. M. Sperberg-McQueen Dec 18 '12 at 21:35
  • Error Message: schema_reference.4: Failed to read schema document 'Table_ASVAB.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not (Table_ASVAB.xsd is the file name). Different approaches: I've moved the two XSD files into the same folder. Instead of using xs:import, I've tried xs:include. I've tried removing the "http://ns.adobe.com/AdobeInDesign/4.0/". – Berman647 Dec 19 '12 at 15:26
  • "ns.adobe.com/AdobeInDesign/4.0/": There is not a file associated with the namespace. The reason is that I don't think Adobe is supporting this version of ID anymore. I'm working with our team on using a newer version, but am wondering if there are alternatives to this approach. – Berman647 Dec 19 '12 at 15:27

1 Answers1

0

If I understand your problem description correctly, you are attempting to construct a schema from three schema documents:

  1. your main schema document (not shown), which includes, or imports, the schema document shown in your problem description.
  2. the schema document shown in the problem description, which
    • declares the elements Table, Cell, and mathImage, which it does not bind to a namespace
    • imports the namespace http://ns.adobe.com/AdobeInDesign/4.0/ and points to the local schema document aid.xsd as a place to find appropriate declarations
  3. the schema document aid.xsd, which is not shown but is referred to from schema document 2. From the declarations in schema document 2, we can infer that this schema document
    • should be located locally (in the same directory as schema document 2, given that a relative reference is used to point to it)
    • should declare http://ns.adobe.com/AdobeInDesign/4.0/ as its target namespace
    • should declare top-level attributes named table, tcol, trows, ccol, ccolwidth, crows, and theader

Your error messages refer to problems reading a schema document named 'Table_ASVAB.xsd'; it's not clear to me from your description whether this file name denotes schema document 1 or schema document 2.

If Table_ASVAB.xsd is the schema document shown in your problem description, then the possible causes of the problem are those given in the error message, minus the ones we can see are not the case:

  • could not find the document. Quite possible: different validators look for schema documents in different places, and you will need to consult the documentation for your validator to see how to tell it where to find your schema documents. It's not clear from your description how you are currently telling, or trying to tell, the validator where to find the schema documents.

  • document could not be read. Also possible: check that the process running the validator has read permissions for the schema document.

  • root element of the document is not xsd:schema. Not the cause of this error message; we can see that the root element of the schema document shown in your problem description is schema, and that it is in the XSD namespace.

If Table_ASVAB.xsd is not the schema document shown in your problem description, but your main schema document, then the same possible causes apply (and you should also check to make sure it's got the right namespace binding and name for its root element).

A couple of remarks on side issues:

If you are supplying the schema document aid.xsd yourself, it doesn't matter whether Adobe is supporting the product or not: the schema validator will read a schema document for the given namespace as happily from your hard disk as from a URI at adobe.com. If you're not supplying aid.xsd yourself, then you have two problems (at least): you have to find an existing schema document for that namespace, and you have to provide an appropriate URI for it in the schemaLocation attribute on the import.

The difference between import and include is straightforward: include fetches schema documents which declare additional components in the calling schema document's target namespace; import declares that the importing schema document depends on components in the imported namespace (this dependency typically takes the form of references to those components; in the case of the schema document you show, it's the references to the attributes aid:table etc. It's an error to include schema documents which specify a different target namespace; it's an error to import namespaces which are the same as the current schema document's target namespace. If you are suffering from confusion on this point, you might find it helpful to consult a good tutorial introduction to XSD.

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
  • Sorry for the delay in replying. First, thank you for your comment. I wrote an XSLT that stripped away the styling information provided by the INDD for tables since it was not necessary for storage in my CMS. Next I will be writing an XSLT to reapply the styling information when reimporting into INDD. Again, thank you for your help. – Berman647 Feb 20 '13 at 16:30