-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in processing messages (2) #44
Comments
Original comment by: niko-rodrigue |
Did you get a NullPointerException ?? The original XMLNode of the message is set in the SBMLCoreParser when an element message is encountered, the same way as the typeOfNotes is set earlier. Also, I close the first bug report but it is open for comments so you could have put your comment there. Original comment by: niko-rodrigue |
Original comment by: sebfroh |
Okay, I think I get it. The namespace used for messages is The Code in SBMLCoreParser for a message tag in constraint is never executed. Original comment by: sebfroh |
Then this was your SBML file that was wrong ? Original comment by: niko-rodrigue |
I think its a bit difficult. The specification L3V1 §4.10 says, that the content of the message-tag has the namespace xhtml. the following fragment would be parsed by SBMLCoreParser: while the first fragment with namespace would be parsed by StringParser. Original comment by: sebfroh |
Yes, written like that, the first fragment should be valid and the message element should be processed by the SBMLCoreParser. I will have a look at it. Original comment by: niko-rodrigue |
Original comment by: niko-rodrigue |
I don't understand why it is necessary to access the parentSBMLElement? This might be null in some cases. What is it needed for? It seems the code fragment above should be placed in some child of Constraint, but where? Original comment by: draeger |
Andreas, this code is a part of the parsing, in StringParser.processStartElement and it is working fine. The problem is happening if you define the xhtml namespace in the message element instead of in the actual html code like it is done in general. Something like that : For me, the parsing is working fine but the namespace is not written out again on the message element when writting back the sbml model, the problem is that in general we are not trying to check if there is any namespaces to write in standard element which we will nee to do anyway to support the SBML level 3 packages where a namespace declaration could happen more or less anywhere. Original comment by: niko-rodrigue |
Original comment by: niko-rodrigue |
Original comment by: niko-rodrigue |
Thank you for the quick fix of the bug "Error in processing messages - ID: 3196638". Unfortunately there is still a problem in the method processStartElement in the class StringParser. If you want to import a message it causes an error, because the method getMessage from the class constraint returns null if it isn't set. I would suggest the following code fragment for the method processStartElement :
if (typeOfNotes.equals("notes")) {
parentSBMLElement.getNotes().addChild(xmlNode);
} else if (typeOfNotes.equals("message") && parentSBMLElement instanceof Constraint) {
XMLNode message = ((Constraint) parentSBMLElement).getMessage();
if(message!=null)
message.addChild(xmlNode);
else
{
((Constraint) parentSBMLElement).setMessage(xmlNode);
}
With this change in the code you insure that a message wil be set even if there was no one before.
Reported by: *anonymous
The text was updated successfully, but these errors were encountered: