Re: [xml] xmlSchemaNewParserCtxt coredump



Hi,

If sometimes you have segfaults and sometimes not, it's probably not because of your schema but memory allocation. Maybe gdb could help you, I encountered once such problems with xmlDocDumpxxx functions, and I thought it was weird, but after a while, I found that I used a wrong pointer of pointer somewhere.

Have a good day,

Rem

_____________________________________________
Remy HAREL          -        Teamlog        |
____________________________________________|
Linux registered user #224740               |
France Telecom Recherche & Developpement    |
____________________________________________| __________________@ http://www.chezrem.org @|




Espen Ekeroth wrote:


Hi, we are having a problem with the xmlSchemaNewParserCtxt function. Some of our schemas are creating coredumps in the xmlSchemaNewParserCtxt function, and some are not. Could this be a problem in the schema?


int mcxml_ValidateAgainstSchema(XML_SETTINGS settings, xmlDocPtr doc, char *caller,
                                char *schema_file, MCXML_STATUS *status)
{
  xmlSchemaPtr schema = NULL;
  xmlSchemaParserCtxtPtr ctxt;
char *schema_file_fp = mcxml_GetSchemaWithLocation(settings, schema_file, status);

  if (status->status == XML_OK) {
    ctxt = xmlSchemaNewParserCtxt(schema_file_fp);

<cut>


Schema that fails:
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--
        $Author: hansg $
        $Revision: 1.1 $
        $Date: 2005/07/12 14:54:02 $
 -->
<xs:schema targetNamespace="http://www.nordpool.com/np/dam/DamEnvelope.xsd"; xmlns:msg="http://www.nordpool.com/np/dam/DamEnvelope.xsd"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:element name="DamEnvelope">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="Header">
                                        <xs:complexType>
                                                <xs:sequence>
<xs:element name="MessageHeader"> <xs:complexType> <xs:sequence> <xs:element name="From"> <xs:complexType> <xs:sequence> <xs:element name="PartyId" type="msg:NonEmptyString"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="To"> <xs:complexType> <xs:sequence> <xs:element name="PartyId" type="msg:NonEmptyString"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ConversationId" type="msg:MessageId"/> <xs:element name="Service" type="msg:NonEmptyString"/> <xs:element name="Action" type="msg:NonEmptyString"/> <xs:element name="MessageData"> <xs:complexType> <xs:sequence> <xs:element name="MessageId" type="msg:MessageId"/> <xs:element name="Timestamp" type="xs:dateTime"/> <xs:element name="RefToMessageId" type="msg:MessageId" nillable="true" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType>
                                                        </xs:element>
                                                </xs:sequence>
                                        </xs:complexType>
                                </xs:element>
                                <xs:element name="Body">
                                        <xs:complexType>
                                                <xs:sequence>
<xs:any processContents="strict" minOccurs="0"/>
                                                </xs:sequence>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:simpleType name="NonEmptyString">
                <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="MessageId">
                <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="30"/>
                </xs:restriction>
        </xs:simpleType>
</xs:schema>
---------------------------------------


Schema that works:
---------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:element name="ATC">
                <xs:complexType>
                        <xs:sequence>
<xs:element name="MessageVersion" type="xs:int"/> <xs:element name="TSOId" type="xs:string"/> <xs:element name="ExchangeId" type="xs:string"/> <xs:element name="DeliveryDate" type="xs:date"/>
                                <xs:element name="Capacities">
                                        <xs:complexType>
                                                <xs:sequence>
<xs:element name="Capacity" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="FromArea"/> <xs:element name="ToArea"/> <xs:element name="Periods"> <xs:complexType> <xs:sequence> <xs:element name="Period" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="PeriodId" type="xs:int"/> <xs:element name="Quantity" type="DecimalValue"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType>
                                                        </xs:element>
                                                </xs:sequence>
                                        </xs:complexType>
                                </xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:complexType name="DecimalValue">
                <xs:sequence>
                        <xs:element name="Value" type="xs:long"/>
                        <xs:element name="Decimals" type="xs:int"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>


I do see that there are some differences in how the schemas are written, but I do not know that much about xml schemas. Could anybody tell me what to look for?


/Espen

Phone: +47 69215581 / + 47 92499076
email: espen ekeroth omxgroup com
MSN: espene halden net

********************************************************************************
This e-mail and the information it contains may be privileged and/or
confidential. It is for the intended addressee(s) only.
The unauthorised use, disclosure or copying of this e-mail, or any information it contains, is prohibited. If you are not an intended recipient, please contact the sender and delete the material from your computer.
********************************************************************************

------------------------------------------------------------------------

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]