You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Rick Roen <Ri...@LakeValleySeed.com> on 2006/06/12 20:33:51 UTC

schema validation

FOP trunk

 

I'm using the batch file on Win-XP to run xml + xsl = fo ->pdf.

 

Is there some switch I can include in the batch file to allow schema
validation for the xml?

 

I'm using Saxon-B 8.7.1 for the xslt which does not process schema, so I
need an alternative.

 

Thanks,

 

Rick


Re: schema validation

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Rick Roen wrote:
> The free Saxon is an XSLT processor, but the one you pay for does include
> schema support.  When you assign a schema in the XSLT, you get a message
> from Saxon that you need the other version.

You seem to confuse validating against a schema with XSLT 2.0 schema 
support for data typing. I talked about the former, while you seem to
want the latter (or not). In this case you might want to ask on a Saxon
specific forum for more help (the commercial Saxon is currently the only
usable XSLT 2.0 processor with schema support).

This is becoming OT for this list.

J.Pietschmann

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


RE: schema validation

Posted by Rick Roen <Ri...@LakeValleySeed.com>.
Thank you.

The free Saxon is an XSLT processor, but the one you pay for does include
schema support.  When you assign a schema in the XSLT, you get a message
from Saxon that you need the other version.

I'll check with Xerces group for the switch.

Rick

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: Tuesday, June 13, 2006 4:10 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: schema validation

Rick Roen wrote:
> I have
> substituted Saxon for Xalan so I could get XSLT 2.0 and XPath 2.0 support,
> but other than that, I think its pretty standard.

Saxon is an XSLT processor. XSLT processors don't do the validation.
XML parsers or specific validation processors are responsible for
validation.

> Do you notice anything else wrong with anything? I checked the Xerces site
> and didn't notice anything.

It's common that XSLT processors disable validation if they allocate
the XML parser, although I thought this only disables to validation
against a DTD. Maybe Xerces has to be told explicitly to validate
against an XSchema. There ought to be ways to do this without hacking
the code, I vaguely remember setting a Java system property (which can
bo done on the command line). Maybe you should ask on the Xerces user
list for more help.

J.Pietschmann

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



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


Re: schema validation

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Rick Roen wrote:
> I have
> substituted Saxon for Xalan so I could get XSLT 2.0 and XPath 2.0 support,
> but other than that, I think its pretty standard.

Saxon is an XSLT processor. XSLT processors don't do the validation.
XML parsers or specific validation processors are responsible for
validation.

> Do you notice anything else wrong with anything? I checked the Xerces site
> and didn't notice anything.

It's common that XSLT processors disable validation if they allocate
the XML parser, although I thought this only disables to validation
against a DTD. Maybe Xerces has to be told explicitly to validate
against an XSchema. There ought to be ways to do this without hacking
the code, I vaguely remember setting a Java system property (which can
bo done on the command line). Maybe you should ask on the Xerces user
list for more help.

J.Pietschmann

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


RE: schema validation

Posted by Rick Roen <Ri...@LakeValleySeed.com>.
Thank you, that's what I thought, but I can't get it working...


My batch file is below in case you can see something in that.  I have
substituted Saxon for Xalan so I could get XSLT 2.0 and XPath 2.0 support,
but other than that, I think its pretty standard.

I am specifying the XSD in the XML like this:

	<?xml version="1.0" encoding="iso-8859-1"?>
<salesdocument doctype="6" docnum="919"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="salesdocument.xsd">

I know its not validating because when I purposely introduce an illegal
value into an attribute, it will fail when I run it in Altova Spy, but runs
ok from the cmd batch file (no error).

Do you notice anything else wrong with anything? I checked the Xerces site
and didn't notice anything.

Rick



---- Batch file ------
@ECHO OFF

rem %~dp0 is the expanded pathname of the current script under NT
set LOCAL_FOP_HOME=
if "%OS%"=="Windows_NT" set LOCAL_FOP_HOME=%~dp0

rem Code from Apache Ant project
rem Slurp the command line arguments. This loop allows for an unlimited
number
rem of arguments (up to the command line limit, anyway).
rem Could also do a "shift" and "%*" for all params, but apparently doesn't
work 
rem with Win9x.
set FOP_CMD_LINE_ARGS=%1
if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
set FOP_CMD_LINE_ARGS=%FOP_CMD_LINE_ARGS% %1
shift
goto setupArgs
rem This label provides a place for the argument list loop to break out 
rem and for NT handling to skip to.
:doneStart

set LOGCHOICE=
rem The default commons logger for JDK1.4 is JDK1.4Logger.
rem To use a different logger, uncomment the one desired below
rem set
LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.N
oOpLog
rem set
LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.S
impleLog
rem set
LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.L
og4JLogger

set LOGLEVEL=
rem Logging levels
rem Below option is only if you are using SimpleLog instead of the default
JDK1.4 Logger.
rem To set logging levels for JDK 1.4 Logger, edit the
%JAVA_HOME%\JRE\LIB\logging.properties 
rem file instead.
rem Possible SimpleLog values:  "trace", "debug", "info" (default), "warn",
"error", or "fatal".
rem set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO

set LIBDIR=%LOCAL_FOP_HOME%lib

set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-sandbox.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LOCAL_FOP_HOME%build\fop-hyph.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis-1.3.02.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.7.1.jar
rem set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\saxon8.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\saxon8-dom.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\serializer-2.7.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\batik-all-1.6.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xmlgraphics-commons-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\avalon-framework-4.2.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-io-1.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\commons-logging-1.0.4.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\fop-hyph.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%FOP_HYPHENATION_PATH%

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
goto runFop

:noJavaHome
if "%JAVACMD%" == "" set JAVACMD=java

:runFop
ECHO "%JAVACMD%"
"%JAVACMD%" %LOGCHOICE% %LOGLEVEL%
-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl
-cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: Monday, June 12, 2006 3:26 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: schema validation

Rick Roen wrote:
> I'm using the batch file on Win-XP to run xml + xsl = fo ->pdf.
...
> Is there some switch I can include in the batch file to allow schema
> validation for the xml?

Not directly.

> I'm using Saxon-B 8.7.1 for the xslt which does not process schema, so I
> need an alternative.

Saxon is an XSLT processor. Schema validation for the input XML is
generally done by the XML parser. BTW Saxon 8 is schema aware and
can use type information read from a schema.

If you want to validate the input XML using XSchema, make sure you
use a schema aware XML parser like Xerces, and provide a schema
location in the XML file. IIRC Xerces is the default parser in the Sun
JDK since 1.5.0. You can get more details, in particular on how to
put in the schema location, from the Xerces docs (on the xerces web
site) and/or the relevant W3C spec.

Validating against schemas in another language like RNG is a bit more
difficult.

J.Pietschmann

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



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


Re: schema validation

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Rick Roen wrote:
> I'm using the batch file on Win-XP to run xml + xsl = fo ->pdf.
...
> Is there some switch I can include in the batch file to allow schema
> validation for the xml?

Not directly.

> I'm using Saxon-B 8.7.1 for the xslt which does not process schema, so I
> need an alternative.

Saxon is an XSLT processor. Schema validation for the input XML is
generally done by the XML parser. BTW Saxon 8 is schema aware and
can use type information read from a schema.

If you want to validate the input XML using XSchema, make sure you
use a schema aware XML parser like Xerces, and provide a schema
location in the XML file. IIRC Xerces is the default parser in the Sun
JDK since 1.5.0. You can get more details, in particular on how to
put in the schema location, from the Xerces docs (on the xerces web
site) and/or the relevant W3C spec.

Validating against schemas in another language like RNG is a bit more
difficult.

J.Pietschmann

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