Are XMLError_t and SBMLError_t the same thing?

1 view
Skip to first unread message

Herbert M Sauro

unread,
Oct 31, 2018, 3:15:26 PM10/31/18
to libsbml-development
For the C API, am I to assume that error types XMLError_t and SBMLError_t are the same thing? 

I tried passing a SBMLError_t variable to a function that takes an XMLError_t and it worked. I did this because I couldn't find methods that would accept a SBMLError_t type so I assumed they must be the same type.

Herbert Sauro

Frank Bergmann

unread,
Nov 1, 2018, 5:00:16 PM11/1/18
to libsbml-d...@googlegroups.com
as far as C is concerned, they will be treated as just integers in any
case. So i'm not surprised this worked. Which specific functions did
you need to call?

best
Frank
> --
> You received this message because you are subscribed to the Google Groups "libsbml-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to libsbml-develop...@googlegroups.com.
> To post to this group, send email to libsbml-d...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/libsbml-development/7517c822-ffeb-4018-b6f5-0d88ffd6be06%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Herbert M Sauro

unread,
Nov 1, 2018, 5:04:13 PM11/1/18
to libsbml-d...@googlegroups.com
I figured something out in the end, I call the following sequence of methods:

   nerrors := SBMLDocument_getNumErrors (sbmlDocument);
   if nerrors > 0 then
      begin
      sbmlError := SBMLDocument_getError(SBMLDocument, 0);
      ps1 := AnsiString (XMLError_getCategoryAsString (sbmlError));
      ps2 := AnsiString (XMLError_getMessage (sbmlError));
      showmessage ('Error reading file: ' + ps1 + ' error. '+ ps2);
      exit;
      end;



For more options, visit https://groups.google.com/d/optout.


--
Herbert Sauro, Associate Professor
University of Washington, Bioengineering

Frank Bergmann

unread,
Nov 2, 2018, 2:36:38 AM11/2/18
to libsbml-d...@googlegroups.com, Herbert M Sauro
Hello Herbert,

i've had a look at the code, and indeed the SBMLError inherits all
methods from the XMLError class, thus you can pass the

SBMLError_t sbmlError; const char* message, const char* shortMessage;

sbmlError = SBMLDocument_getError(SBMLDocument, 0);
message = XMLError_getMessage((XMLError_t*)sbmlError);
shortMessage = XMLError_getShortMessage((XMLError_t*)sbmlError);

cheers
Frank
> To view this discussion on the web visit https://groups.google.com/d/msgid/libsbml-development/CAEFQOCX7_vmOYVmw%3Di_q9ijKJCkqmDAmej6973m9t8ssRavBZQ%40mail.gmail.com.

Herbert M Sauro

unread,
Nov 2, 2018, 2:29:55 PM11/2/18
to libsbml-development
Good to know, you might want to make a note of it in the API documentation. 

Herbert
>> > To unsubscribe from this group and stop receiving emails from it, send an email to libsbml-development+unsub...@googlegroups.com.
>> > To post to this group, send email to libsbml-d...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/libsbml-development/7517c822-ffeb-4018-b6f5-0d88ffd6be06%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "libsbml-development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to libsbml-development+unsub...@googlegroups.com.
>> To post to this group, send email to libsbml-d...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/libsbml-development/CAEnSYu%2BxKU72dpc9XjEX_jHPCL4uP1Mun3u%2BGMaYkY_g0CZVwg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Herbert Sauro, Associate Professor
> University of Washington, Bioengineering
> 206-685-2119, www.sys-bio.org
> hsa...@uw.edu
> Books: http://books.analogmachine.org/
>
> --
> You received this message because you are subscribed to the Google Groups "libsbml-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to libsbml-development+unsub...@googlegroups.com.

Michael Hucka

unread,
Nov 4, 2018, 12:18:04 AM11/4/18
to libsbml-development
The class relationship is, thankfully, more clear in the docs for the
other languages. Owing to how the C docs are produced, they are ... not
as good, and this is one part where it's lacking.

A minor help can be to look at the C++ docs when trying to figure out
what may be happening with the C interface.

MH
>> <javascript:>> wrote:
>>>>
>>>> as far as C is concerned, they will be treated as just integers in
>>>> any
>>>> case. So i'm not surprised this worked. Which specific functions
>>>> did
>>>> you need to call?
>>>>
>>>> best
>>>> Frank
>>>> On Wed, Oct 31, 2018 at 8:15 PM Herbert M Sauro <hsa...@uw.edu
>> <javascript:>> wrote:
>>>>>
>>>>> For the C API, am I to assume that error types XMLError_t and
>> SBMLError_t are the same thing?
>>>>>
>>>>> I tried passing a SBMLError_t variable to a function that takes an
>> XMLError_t and it worked. I did this because I couldn't find methods
>> that
>> would accept a SBMLError_t type so I assumed they must be the same
>> type.
>>>>>
>>>>> Herbert Sauro
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>> Groups "libsbml-development" group.
>>>>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to libsbml-develop...@googlegroups.com
>> <javascript:>.
>>>>> To post to this group, send email to libsbml-d...@googlegroups.com
>> <javascript:>.
>>>>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/libsbml-development/7517c822-ffeb-4018-b6f5-0d88ffd6be06%40googlegroups.com.
>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>> Groups "libsbml-development" group.
>>>> To unsubscribe from this group and stop receiving emails from it,
>>>> send
>> an email to libsbml-develop...@googlegroups.com
>> <javascript:>.
>>
>>>> To post to this group, send email to libsbml-d...@googlegroups.com
>> <javascript:>.
>>>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/libsbml-development/CAEnSYu%2BxKU72dpc9XjEX_jHPCL4uP1Mun3u%2BGMaYkY_g0CZVwg%40mail.gmail.com.
>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>> --
>>> Herbert Sauro, Associate Professor
>>> University of Washington, Bioengineering
>>> 206-685-2119, www.sys-bio.org
>>> hsa...@uw.edu <javascript:>
>>> Books: http://books.analogmachine.org/
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>> Groups "libsbml-development" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send
>> an email to libsbml-develop...@googlegroups.com
>> <javascript:>.
>>
>>> To post to this group, send email to libsbml-d...@googlegroups.com
>> <javascript:>.
> --
> You received this message because you are subscribed to the Google
> Groups "libsbml-development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to libsbml-develop...@googlegroups.com.
> To post to this group, send email to
> libsbml-d...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/libsbml-development/804148c2-207d-4367-8c75-b49f05f4ffc2%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages