How to validate XML aganest XSD - Forum - Community Groups - Progress Community

How to validate XML aganest XSD

 Forum

How to validate XML aganest XSD

  • I tried with transformation service. But I had a problem to supply the schema. Could any one please help me figureout how to validate XML aganest an XSD. I don't want to use a custom service for this process.

    Regards,

    Swaroop Kunduru.

  • NOTE: you are posting this against Progress Communities > PSDN, but this looks like a Sonic discussion.  You should post in Progress Communities >> PSDN >> Sonic.

    The Sonic Transformation Service does have a Validate option (on Runtime and Init Parameters).  Is there a reason this is not working?   See the Workbench or online help for:

    Configuring and deploying a transformation service

    Validating

    To specify whether the transformation                      validates the incoming XML, select:

    • True to validate the                            incoming XML against a Document Type                            Definition (DTD) or schema before                            transforming it. Incoming XML                            messages must specify and provide a                            DTD or schema against which to                            validate the XML.

    • False to not                            validate incoming XML against a                            schema.

  • I worked out how to use the Validate option in an XML Transform Service. The problem is that it relies on the XML Document having a schemaLocation attribute. There are two issues with this:

    - Our trading partners do not include the schemaLocation attribute on messages.

    - Even if they did the location would be a remote location that may or may not be accessible to us.

    The simplest solution I can see would be for the XML Transform Service to have a parameter for the schmeaLocation but I guess that isn't going to happen in my time frame.

    The second solution I see is to add the schemaLocation and XSI namespace to the message before validating it, making sure to remove any existing schema location. I tested and Sonic happily accepts schemaLocation with a sonicfs prefix. I see two possible methods:

    - A generic XSL transform to add the schemaLocation (after adding the Schema Lo0cation as a parameter, message part or message property

    - A Java Service to add the schemaLocation to the message

    Sadly our experience levels for how to do either of this is lacking and working it out will be time consuming. Is anyone willing to share some code for either method?

    A third alternative is that BPEL provides a function for validation against a schema. Has anyone done something like this that they'd be willing to share?

    We're also open to other methods for validation of a message against the schema.

    Thanks

    Steve