You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2006/07/16 21:31:52 UTC

svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Author: spepping
Date: Sun Jul 16 12:31:52 2006
New Revision: 422509

URL: http://svn.apache.org/viewvc?rev=422509&view=rev
Log:
A W3C schema for FOP user configuration files

Added:
    xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd   (with props)

Added: xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?rev=422509&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd (added)
+++ xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd Sun Jul 16 12:31:52 2006
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  elementFormDefault="qualified">
+
+  <xsd:annotation>
+    <xsd:documentation>This W3C schema document documents and validates the expected
+      structure of a configuration file for FOP.</xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:element name="fop">
+    <xsd:complexType>
+      <xsd:all>
+        <xsd:element name="base" type="xsd:anyURI" minOccurs="0"></xsd:element>
+        <xsd:element name="font-base" type="xsd:anyURI" minOccurs="0"></xsd:element>
+        <xsd:element name="hyphenation-base" type="xsd:anyURI" minOccurs="0"></xsd:element>
+        <xsd:element name="source-resolution"
+          type="xsd:positiveInteger" minOccurs="0">
+        </xsd:element>
+        <xsd:element name="target-resolution"
+          type="xsd:positiveInteger" minOccurs="0">
+        </xsd:element>
+        <xsd:element name="strict-validation" type="xsd:boolean" minOccurs="0"></xsd:element>
+        <xsd:element name="break-indent-inheritance"
+          type="xsd:boolean" minOccurs="0">
+        </xsd:element>
+        <xsd:element name="default-page-settings" minOccurs="0">
+          <xsd:complexType>
+            <xsd:attribute name="width" type="xsd:string"></xsd:attribute>
+            <xsd:attribute name="height" type="xsd:string"></xsd:attribute>
+          </xsd:complexType>
+        </xsd:element>
+        <xsd:element name="renderers" minOccurs="0">
+          <xsd:complexType>
+            <xsd:sequence>
+              <xsd:element name="renderer" maxOccurs="unbounded"
+                type="rendererType">
+              </xsd:element>
+            </xsd:sequence>
+          </xsd:complexType>
+        </xsd:element>
+      </xsd:all>
+      <xsd:attribute name="version" use="optional">
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="1.0"></xsd:enumeration>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:attribute>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:complexType name="rendererType">
+  <xsd:annotation>
+    <xsd:documentation>This type is stricter than required by FOP, in that it imposes an
+      order of the elements, which is not required by FOP.</xsd:documentation>
+  </xsd:annotation>
+  <xsd:sequence>
+      <xsd:choice minOccurs="0">
+        <xsd:element name="filterList" maxOccurs="2">
+        <xsd:annotation>
+          <xsd:documentation>filterLists are used by the PDF renderer, MIME type
+            application/pdf.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexType>
+            <xsd:sequence>
+              <xsd:element name="value" type="xsd:string"
+                maxOccurs="unbounded">
+              </xsd:element>
+            </xsd:sequence>
+            <xsd:attribute name="type" use="optional">
+              <xsd:simpleType>
+                <xsd:restriction base="xsd:string">
+                  <xsd:enumeration value="image"></xsd:enumeration>
+                </xsd:restriction>
+              </xsd:simpleType>
+            </xsd:attribute>
+          </xsd:complexType>
+        </xsd:element>
+        <xsd:element name="auto-rotate-landscape">
+        <xsd:annotation>
+          <xsd:documentation>auto-rotate-landscape is used by the PostScript renderer,
+          MIME type application/postscript.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:simpleType>
+            <xsd:restriction base="xsd:string">
+              <xsd:enumeration value="false"></xsd:enumeration>
+              <xsd:enumeration value="true"></xsd:enumeration>
+            </xsd:restriction>
+          </xsd:simpleType>
+        </xsd:element>
+        <xsd:sequence>
+        <xsd:annotation>
+          <xsd:documentation>rendering and text-rendering are used by the PCL renderer,
+          MIME type application/vnd.hp-PCL</xsd:documentation>
+        </xsd:annotation>
+        <xsd:element name="rendering" minOccurs="0">
+            <xsd:simpleType>
+              <xsd:restriction base="xsd:string">
+                <xsd:enumeration value="speed"></xsd:enumeration>
+                <xsd:enumeration value="quality"></xsd:enumeration>
+              </xsd:restriction>
+            </xsd:simpleType>
+          </xsd:element>
+          <xsd:element name="text-rendering" minOccurs="0">
+            <xsd:simpleType>
+              <xsd:restriction base="xsd:string">
+                <xsd:enumeration value="auto"></xsd:enumeration>
+                <xsd:enumeration value="bitmap"></xsd:enumeration>
+              </xsd:restriction>
+            </xsd:simpleType>
+          </xsd:element>
+        </xsd:sequence>
+      </xsd:choice>
+      <xsd:element name="fonts" minOccurs="0">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element name="font" type="fontType"
+              maxOccurs="unbounded">
+            </xsd:element>
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+    </xsd:sequence>
+    <xsd:attribute name="mime" type="MimeConstants" use="required"></xsd:attribute>
+  </xsd:complexType>
+
+  <xsd:complexType name="fontType">
+    <xsd:sequence>
+      <xsd:element name="font-triplet" type="fontTripletType" maxOccurs="unbounded"></xsd:element>
+    </xsd:sequence>
+    <xsd:attribute name="metrics-url" type="xsd:anyURI" use="required"></xsd:attribute>
+    <xsd:attribute name="embed-url" type="xsd:anyURI" use="optional"></xsd:attribute>
+    <xsd:attribute name="kerning" use="optional">
+      <xsd:simpleType>
+        <xsd:restriction base="xsd:string">
+          <xsd:enumeration value="yes"></xsd:enumeration>
+        </xsd:restriction>
+      </xsd:simpleType>
+    </xsd:attribute>
+  </xsd:complexType>
+
+  <xsd:complexType name="fontTripletType">
+    <xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
+    <xsd:attribute name="style" type="xsd:string" use="required"></xsd:attribute>
+    <xsd:attribute name="weight" type="xsd:string" use="required"></xsd:attribute>
+  </xsd:complexType>
+
+  <xsd:simpleType name="MimeConstants">
+    <xsd:restriction base="xsd:string">
+      <xsd:enumeration value="application/pdf"></xsd:enumeration>
+      <xsd:enumeration value="application/postscript"></xsd:enumeration>
+      <xsd:enumeration value="application/x-pcl"></xsd:enumeration>
+      <xsd:enumeration value="application/vnd.hp-PCL"></xsd:enumeration>
+      <xsd:enumeration value="application/x-afp"></xsd:enumeration>
+      <xsd:enumeration value="application/vnd.ibm.modcap"></xsd:enumeration>
+      <xsd:enumeration value="text/plain"></xsd:enumeration>
+      <xsd:enumeration value="application/rtf"></xsd:enumeration>
+      <xsd:enumeration value="text/richtext"></xsd:enumeration>
+      <xsd:enumeration value="text/rtf"></xsd:enumeration>
+      <xsd:enumeration value="application/mif"></xsd:enumeration>
+      <xsd:enumeration value="application/X-fop-awt-preview"></xsd:enumeration>
+      <xsd:enumeration value="application/X-fop-print"></xsd:enumeration>
+      <xsd:enumeration value="application/X-fop-areatree"></xsd:enumeration>
+    </xsd:restriction>
+  </xsd:simpleType>
+
+</xsd:schema>

Propchange: xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Yeah, looks like a bug in XMLSpy. In Eclipse this validates just fine
when I follow your suggestion. However, there's no error message if the
file violates the schema and the schema is specified as a plain file
name instead of as an URI. Another nit is that you can't validate a file
if you open it from a external folder. You only get to validate the file
if you have it in a tree inside Eclipse. :-(

Thanks!

On 18.07.2006 20:56:17 Simon Pepping wrote:
> On Mon, Jul 17, 2006 at 10:48:55PM +0200, Jeremias Maerki wrote:
> > The attached file fails to validate with the XSD as found in the repo.
> > But then, it's probably just one more of these cases that software does
> > not really want to just work. Probably just a bug in my editor.
> 
> Apparently. On my system it validates nicely. I use xerces, or I use
> Eclipse Web Tools Platform. Would it help if you change the path in
> the noNamespaceSchemaLocation attribute to a URI?


Jeremias Maerki


Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Mon, Jul 17, 2006 at 10:48:55PM +0200, Jeremias Maerki wrote:
> The attached file fails to validate with the XSD as found in the repo.
> But then, it's probably just one more of these cases that software does
> not really want to just work. Probably just a bug in my editor.

Apparently. On my system it validates nicely. I use xerces, or I use
Eclipse Web Tools Platform. Would it help if you change the path in
the noNamespaceSchemaLocation attribute to a URI?

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The attached file fails to validate with the XSD as found in the repo.
But then, it's probably just one more of these cases that software does
not really want to just work. Probably just a bug in my editor.

On 17.07.2006 21:22:13 Simon Pepping wrote:
> On Mon, Jul 17, 2006 at 10:32:30AM +0200, Jeremias Maerki wrote:
> > Hmm, XML Schema might not be a suitable enough means to map our
> > configuration schema. I've just tried to make my main debug config file
> > validate with your schema. I've had to extend it a bit but still ended
> > up having a validation error I did not quite understand. It kept asking
> > for the "fonts" or "xml-handler" elements although they are both
> > optional. I've never done much XML Schema and never liked it much. I
> > don't know much about RelaxNG either, but I repeatedly hear that it's
> > more flexible. I know that you can define several variants of the same
> > element by chosing the type using an attribute (renderer with mime
> > attribute). I don't know if that can be done in XML Schema. Shrug.
> 
> I think XML Schema is the usual schema language for this sort of
> files. I would have been happy to use Relax-NG, but it is less
> popular, and the number of validators is smaller. In fact, Relax-NG
> allows one to express that filterList is only valid with the mime
> attribute value "application/pdf", etc.
> 
> In my version fonts is optional. xml-handler does not occur. What does
> your config file contain?


Jeremias Maerki

Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Mon, Jul 17, 2006 at 10:32:30AM +0200, Jeremias Maerki wrote:
> Hmm, XML Schema might not be a suitable enough means to map our
> configuration schema. I've just tried to make my main debug config file
> validate with your schema. I've had to extend it a bit but still ended
> up having a validation error I did not quite understand. It kept asking
> for the "fonts" or "xml-handler" elements although they are both
> optional. I've never done much XML Schema and never liked it much. I
> don't know much about RelaxNG either, but I repeatedly hear that it's
> more flexible. I know that you can define several variants of the same
> element by chosing the type using an attribute (renderer with mime
> attribute). I don't know if that can be done in XML Schema. Shrug.

I think XML Schema is the usual schema language for this sort of
files. I would have been happy to use Relax-NG, but it is less
popular, and the number of validators is smaller. In fact, Relax-NG
allows one to express that filterList is only valid with the mime
attribute value "application/pdf", etc.

In my version fonts is optional. xml-handler does not occur. What does
your config file contain?

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hmm, XML Schema might not be a suitable enough means to map our
configuration schema. I've just tried to make my main debug config file
validate with your schema. I've had to extend it a bit but still ended
up having a validation error I did not quite understand. It kept asking
for the "fonts" or "xml-handler" elements although they are both
optional. I've never done much XML Schema and never liked it much. I
don't know much about RelaxNG either, but I repeatedly hear that it's
more flexible. I know that you can define several variants of the same
element by chosing the type using an attribute (renderer with mime
attribute). I don't know if that can be done in XML Schema. Shrug.

I can upload my changes but due to the fact that they don't work for me
makes me hesitant to upload them.

On 16.07.2006 21:40:22 Simon Pepping wrote:
> On Sun, Jul 16, 2006 at 07:31:52PM -0000, spepping@apache.org wrote:
> > Author: spepping
> > Date: Sun Jul 16 12:31:52 2006
> > New Revision: 422509
> > 
> > URL: http://svn.apache.org/viewvc?rev=422509&view=rev
> > Log:
> > A W3C schema for FOP user configuration files
> > 
> > Added:
> >     xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd   (with props)
> 
> Once too often I lost time due to a slightly wrong configuration
> file. FOP tries to find the elements it knows about; it does not give
> feedback on elements that it does not know about. This schema should
> help users discover which of their elements FOP does not
> recognize. Probably the content of some elements can be constrained
> further. Please, do so if you see such an element. If this schema is a
> good idea, I will document it on the configuration page of the web
> site.


Jeremias Maerki


Re: svn commit: r422509 - /xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Sun, Jul 16, 2006 at 07:31:52PM -0000, spepping@apache.org wrote:
> Author: spepping
> Date: Sun Jul 16 12:31:52 2006
> New Revision: 422509
> 
> URL: http://svn.apache.org/viewvc?rev=422509&view=rev
> Log:
> A W3C schema for FOP user configuration files
> 
> Added:
>     xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd   (with props)

Once too often I lost time due to a slightly wrong configuration
file. FOP tries to find the elements it knows about; it does not give
feedback on elements that it does not know about. This schema should
help users discover which of their elements FOP does not
recognize. Probably the content of some elements can be constrained
further. Please, do so if you see such an element. If this schema is a
good idea, I will document it on the configuration page of the web
site.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu