Cocoon 3
  1. Cocoon 3
  2. COCOON3-2

Add an XSchema Validator as PipelineComponent

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-2
    • Fix Version/s: 3.0.0-alpha-2
    • Component/s: cocoon-pipeline
    • Labels:
      None

      Description

      XSchema Validation can be performed as an Identity Transformer where the input will be filter by the XSchema validation.
      An error occurs - and the pipeline will be break - when the input is not valid against the declared XML Schema.
      1. XSchemaProcessor.patch
        7 kB
        Simone Tripodi
      2. SchemaProcessorInSiteMap.patch
        4 kB
        Simone Tripodi

        Activity

        Hide
        Simone Tripodi added a comment -
        The provided implementation uses JAXP APIs to realize XSchema validation.
        Simple testcase contained in the patch
        Show
        Simone Tripodi added a comment - The provided implementation uses JAXP APIs to realize XSchema validation. Simple testcase contained in the patch
        Hide
        Reinhard Poetz added a comment -
        I've applied the patch. Thanks Simone.

        This patch has reminded me that we have to do something about error handling. In the case of invalid XML, a RuntimeException is thrown ATM which isn't really helpful. OTOH, checked exceptions all over the place might not be helpful either.
        Show
        Reinhard Poetz added a comment - I've applied the patch. Thanks Simone. This patch has reminded me that we have to do something about error handling. In the case of invalid XML, a RuntimeException is thrown ATM which isn't really helpful. OTOH, checked exceptions all over the place might not be helpful either.
        Hide
        Reinhard Poetz added a comment -
        Simone, can you explain what the SchemaErrorHandler is supposed to do? Steven and I don't understand why it keeps references to raised exceptions. Also the getThrowable() method isn't used (which is actually not possible because the SchemaErrorHandler is created inline without keeping a reference to it in the transformer.
        Show
        Reinhard Poetz added a comment - Simone, can you explain what the SchemaErrorHandler is supposed to do? Steven and I don't understand why it keeps references to raised exceptions. Also the getThrowable() method isn't used (which is actually not possible because the SchemaErrorHandler is created inline without keeping a reference to it in the transformer.
        Hide
        Simone Tripodi added a comment -
        Hi Reinhard,
        in the private mail I sent you days ago, about the Validator, I asked your help on this because I didn't understand how did you use the handler, so I prepared the handler to be managed in a similar way you did with the Transformer.
        So, at this time, as you noticed, is not meaningful :(
        Show
        Simone Tripodi added a comment - Hi Reinhard, in the private mail I sent you days ago, about the Validator, I asked your help on this because I didn't understand how did you use the handler, so I prepared the handler to be managed in a similar way you did with the Transformer. So, at this time, as you noticed, is not meaningful :(
        Hide
        Steven Dolg added a comment -
        Ah, never mind.
        This is some code we took from Cocoon 2.2 without changes.
        We will have a look at this and probably rework it someday.

        Thanks Simone.
        Show
        Steven Dolg added a comment - Ah, never mind. This is some code we took from Cocoon 2.2 without changes. We will have a look at this and probably rework it someday. Thanks Simone.
        Hide
        Reinhard Poetz added a comment -
        The SchemaErrorHandler throws a specific unchecked exception (SchemaValidationException) when the XML is invalid now.
        Show
        Reinhard Poetz added a comment - The SchemaErrorHandler throws a specific unchecked exception (SchemaValidationException) when the XML is invalid now.
        Hide
        Simone Tripodi added a comment -
        The second uploaded patch contains the fix to use the SchemaProcessorTransformer in the SiteMap.

        Example included, plugged in the cocoon-samples, main page also updated.
        Show
        Simone Tripodi added a comment - The second uploaded patch contains the fix to use the SchemaProcessorTransformer in the SiteMap. Example included, plugged in the cocoon-samples, main page also updated.
        Hide
        Reinhard Poetz added a comment -
        Thanks for your contribution. I will have a look at it asap.
        Show
        Reinhard Poetz added a comment - Thanks for your contribution. I will have a look at it asap.
        Hide
        Reinhard Poetz added a comment -
        Patch applied. Thanks Simone!
        Show
        Reinhard Poetz added a comment - Patch applied. Thanks Simone!

          People

          • Assignee:
            Reinhard Poetz
            Reporter:
            Simone Tripodi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development