Schema validation in custom processor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Schema validation in custom processor

Henrik Pettersen
All,

does anyone know what the preferred method of performing schema
validation for input and output data in custom processors ('...
extends SimpleProcessor'). I could of course just roll something
inside 'generateData(...), but perhaps there is a more standard way of
doing this?

Looking at some of the other Orbeon processor definitions, they have
something like this:

public class ImageServer extends ProcessorImpl {
    ...
    public static final String IMAGE_SERVER_CONFIG_NAMESPACE_URI =
"http://orbeon.org/oxf/xml/image-server-config";
    public static final String IMAGE_SERVER_IMAGE_NAMESPACE_URI =
"http://orbeon.org/oxf/xml/image-server-image";
    ...
    public ImageServer() {
        addInputInfo(new ProcessorInputOutputInfo(INPUT_CONFIG,
IMAGE_SERVER_CONFIG_NAMESPACE_URI));
        addInputInfo(new ProcessorInputOutputInfo(INPUT_IMAGE,
IMAGE_SERVER_IMAGE_NAMESPACE_URI));
    }
    ...
}

and

public class SchemaRepository {
    ...
    static {
        schemas.put(PipelineProcessor.PIPELINE_NAMESPACE_URI,
"schemas/pipeline.rng");
        schemas.put(AggregatorProcessor.AGGREGATOR_NAMESPACE_URI,
"schemas/aggregator.rng");
        ...
        schemas.put(ImageServer.IMAGE_SERVER_IMAGE_NAMESPACE_URI,
"schemas/image-server-image.rng");
        ...
    }
....
}

Any ideas? Has anyone done this before?

Many thanks!

Henrik Pettersen


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Schema validation in custom processor

Alessandro Vernet
Administrator
On Tue, Sep 2, 2008 at 6:33 AM, Henrik Pettersen
<[hidden email]> wrote:
> does anyone know what the preferred method of performing schema
> validation for input and output data in custom processors ('...
> extends SimpleProcessor'). I could of course just roll something
> inside 'generateData(...), but perhaps there is a more standard way of
> doing this?

The API assumes that you will map an input to a URI when you declare
your processor and then map that URI to a schema in SchemaRepository.
Ideally, we should using something like XML Catalogs
(http://www.oasis-open.org/committees/entity/spec-2001-08-06.html),
rather than have this in a static XML file. At this point it looks like
you would need to modify SchemaRepository to register your own schema.
So I think you would have either to do the validation in your processor,
or to implement some system (like XML Catalogs) where the URI to schema
file mapping is done through an XML configuration. If you wish to do the
latter, let us know if you need any help with that; this is something
that we would certainly be interested in adding to Orbeon Forms.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws