XMLBeans schema compilation - scomp utility

1.2k Views Asked by At

I have a set of schemas which are not JAXB compatible but are XMLBeans compatible.

According to the documentation on XMLBeans, I can use scomp to compile my schema. But I can't find this tool anywhere or documentation on its versions.

I can use a maven plugin to compile my schema but it is dependent on an older version of XMLBean (2.4 rather than 2.6).

Does anyone know what features I am missing out on/bugs in place by having my schema compiled with 2.4 rather than 2.6 and if I can use the compiled classes with the 2.6 dependency (is it backwards compatible - it appears to be?)

My question is where is the scomp utility?

1

There are 1 best solutions below

0
On

I created this BATCH to automate the process. Hope it helps!

(in XMLBeans 2.6 you just need xbean.jar)

@echo off
echo ***
echo * https://xmlbeans.apache.org/docs/2.0.0/guide/tools.html
echo ***
setlocal

SET SOURCE=
if exist %1.xsd SET SOURCE=%1.xsd
if exist %1.wsdl SET SOURCE=%1.wsdl
if not "%SOURCE%"=="" goto JAVA
echo USAGE: COMP XSD/WSDL FILENAME
goto END

:JAVA
if exist "%JAVA_HOME%\bin\javac.exe" goto XMLBEANS
echo JAVA SDK NOT FOUND! PLEASE configure JAVA_HOME
echo %JAVA_HOME%
goto END

:XMLBEANS
SET BEANS_HOME=.
SET BEANS_SRC=%BEANS_HOME%\src
SET BEANS_JAR=%BEANS_HOME%\jars
SET BEANS_LIB=%BEANS_HOME%\lib-2.6
SET BEANS_CP=%BEANS_LIB%\xbean.jar
echo JAVA HOME  @ %JAVA_HOME%
echo BEANS HOME @ %BEANS_HOME%
echo BEANS SRC  @ %BEANS_SRC%
echo BEANS JAR  @ %BEANS_JAR%
echo BEANS LIB  @ %BEANS_LIB%
echo BEANS CP   @ %BEANS_CP%
if exist %BEANS_LIB% goto COMPILE
echo XMLBEANS LIB NOT FOUND @ %BEANS_LIB%
goto END

:COMPILE
SET JAVA=%JAVA_HOME%\bin\java.exe
SET JAVAC=%JAVA_HOME%\bin\javac.exe
echo ***COMPILING*** %SOURCE%
if not exist %1.xsdconfig goto WITHOUT_CONFIG

"%JAVA%" -classpath %BEANS_CP% org.apache.xmlbeans.impl.tool.SchemaCompiler -src %BEANS_SRC% -out %BEANS_JAR%\%1.jar %SOURCE% %1.xsdconfig -compiler "%JAVAC%" -javasource "1.5"
goto END

:WITHOUT_CONFIG
echo %1.xsdconfig NOT FOUND! Compiling without xsdconfig
"%JAVA%" -classpath %BEANS_CP% org.apache.xmlbeans.impl.tool.SchemaCompiler -src %BEANS_SRC% -out %BEANS_JAR%\%1.jar %SOURCE% -compiler "%JAVAC%" -javasource "1.5"

:END