problem validating xml against schema

Discussion in 'ASP .Net' started by Mike P, Dec 6, 2004.

  1. Mike P

    Mike P Guest

    I have a web app that has been running happily for months, and on
    Saturday it suddenly decided that it no longer wanted to validate my
    XML. Here is my code and sample schema, and example XML :

    public void ValidateAgainstSchema(object sender, ValidationEventArgs
    args)
    {
    blnInvalidXML = true;
    }

    //in page load :

    XmlTextReader tr = new XmlTextReader(new
    StringReader(strReceivedXmlDoc));
    XmlValidatingReader trv = new XmlValidatingReader(tr);

    trv.ValidationType = ValidationType.Schema;

    trv.ValidationEventHandler +=
    new ValidationEventHandler(this.ValidateAgainstSchema);

    while (trv.Read())
    {
    }

    if (blnInvalidXML == false)
    {
    //do stuff
    }

    Schema :

    <?xml version="1.0" encoding="iso-8859-1" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="rsp-vcn">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="auth">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="cug" type="xs:long" />
    <xs:element name="pasw" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="service">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="countrycode" type="xs:string" minOccurs="1" />
    <xs:element name="number" type="xs:string" minOccurs="1" />
    </xs:sequence>
    <xs:attribute name="type" use="required">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="query" />
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="message_id" type="xs:byte" use="required" />
    </xs:complexType>
    </xs:element>
    </xs:schema>

    XML :

    <?xml version="1.0" encoding="iso-8859-1" ?>
    <rsp-vcn message_id="0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://www.calluk.com/vcn/query.xsd">
    <auth>
    <cug>5790</cug>
    <pasw>****</pasw>
    </auth>
    <service type="query">
    <countrycode>1</countrycode>
    <number>7813941801</number>
    </service>
    </rsp-vcn>

    I can navigate to the schema in IE, and when I send through XML that the
    schema should validate, it doesn't. I am stumped as this code has
    worked fine for months.


    Can anybody please shed any light on this?


    Cheers,

    Mike



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mike P, Dec 6, 2004
    #1
    1. Advertising

  2. Mike P

    Mike P Guest

    Found the problem - the security certificate had expired.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mike P, Dec 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. simon ames
    Replies:
    1
    Views:
    512
    Joerg Jooss
    Apr 11, 2004
  2. Ben Jessel
    Replies:
    0
    Views:
    422
    Ben Jessel
    Aug 5, 2004
  3. Jim Higson

    Validating DHTML against a schema

    Jim Higson, Dec 19, 2005, in forum: HTML
    Replies:
    4
    Views:
    430
    Toby Inkster
    Dec 19, 2005
  4. srujana
    Replies:
    2
    Views:
    2,445
    Soren Kuula
    Dec 31, 2005
  5. First_step_to_xml
    Replies:
    0
    Views:
    715
    First_step_to_xml
    Jun 28, 2006
Loading...

Share This Page