XmlDSig and XAdES schema validation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MarianM

    XmlDSig and XAdES schema validation

    Hi all,

    how to validate xades xml against xades and xmlsig schemas? i have
    this sample:

    XmlTextReader xmlReader = new XmlTextReader(@ "..\..\Data\xad es_zep-
    epes.xml");
    XmlReaderSettin gs settings = new XmlReaderSettin gs();
    settings.Prohib itDtd = false;
    settings.Valida tionType = ValidationType. Schema;
    settings.Valida tionFlags = settings.Valida tionFlags |
    XmlSchemaValida tionFlags.Repor tValidationWarn ings;
    settings.Valida tionEventHandle r += new
    System.Xml.Sche ma.ValidationEv entHandler(sett ings_Validation EventHandler);

    settings.Schema s.Add("http://www.w3.org/2000/09/xmldsig#",
    XmlReader.Creat e(@"..\..\Data\ xmldsig-core-schema.xsd", settings));
    settings.Schema s.Add("http://uri.etsi.org/01903/v1.3.2#", @"..\..\Data
    \XAdES.xsd");

    using (XmlReader valReader = XmlReader.Creat e(xmlReader, settings))
    {
    while (valReader.Read ()) { };
    }



    This code fails on "using (XmlReader valReader =
    XmlReader.Creat e(xmlReader, settings))" with
    XmlSchemaValida tionException saying:

    "Invalid particle derivation by restriction - 'The derived element
    http://uri.etsi.org/01903/v1.3.2#:Include at (113, 12) is not a valid
    restriction of the base choice particle at (95, 8) according to
    Elt:All/Choice/Sequence -- RecurseAsIfGrou p.'."

    Is something wrong with my code, or schema (which is from
    uri.etsi.org) or ms implementation?
    Can anybody help me?

    Many many thax...
    Marian.
  • MarianM

    #2
    Re: XmlDSig and XAdES schema validation

    The whole solution with sample xml and xsd can be downloaded from
    http://test.ditec.sk/xmlvalidation.zip.

    Thank you
    Marian

    Comment

    • MarianM

      #3
      Re: XmlDSig and XAdES schema validation

      On 4. Jún, 12:30 h., MarianM <maja...@gmail. comwrote:
      Hi all,
      >
      how to validate xades xml against xades and xmlsig schemas? i have
      this sample:
      >
      XmlTextReader xmlReader = new XmlTextReader(@ "..\..\Data\xad es_zep-
      epes.xml");
      XmlReaderSettin gs settings = new XmlReaderSettin gs();
      settings.Prohib itDtd = false;
      settings.Valida tionType = ValidationType. Schema;
      settings.Valida tionFlags = settings.Valida tionFlags |
      XmlSchemaValida tionFlags.Repor tValidationWarn ings;
      settings.Valida tionEventHandle r += new
      System.Xml.Sche ma.ValidationEv entHandler(sett ings_Validation EventHandler);
      >
      settings.Schema s.Add("http://www.w3.org/2000/09/xmldsig#",
      XmlReader.Creat e(@"..\..\Data\ xmldsig-core-schema.xsd", settings));
      settings.Schema s.Add("http://uri.etsi.org/01903/v1.3.2#", @"..\..\Data
      \XAdES.xsd");
      >
      using (XmlReader valReader = XmlReader.Creat e(xmlReader, settings))
      {
      while (valReader.Read ()) { };
      >
      }
      >
      This code fails on "using (XmlReader valReader =
      XmlReader.Creat e(xmlReader, settings))" with
      XmlSchemaValida tionException saying:
      >
      "Invalid particle derivation by restriction - 'The derived elementhttp://uri.etsi.org/01903/v1.3.2#:Include at (113, 12) is not a valid
      restriction of the base choice particle at (95, 8) according to
      Elt:All/Choice/Sequence -- RecurseAsIfGrou p.'."
      >
      Is something wrong with my code, or schema (which is from
      uri.etsi.org) or ms implementation?
      Can anybody help me?
      >
      Many many thax...
      Marian.

      The whole solution with sample xml and xsd can be downloaded from
      http://test.ditec.sk/xmlvalidation.zip.

      Thank you
      Marian

      Comment

      Working...