Skip to content
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

setting notes that is invalid xml throws com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '<' #149

Open
piotr-gawron opened this issue Apr 20, 2018 · 0 comments
Assignees

Comments

@piotr-gawron
Copy link
Contributor

Here is an example that leads to this exception:

    SBMLDocument doc = new SBMLDocument(3, 1);
    Model result = doc.createModel("");
    result.setNotes("x=y<z");

The solution to such problem would be encoding the string before surrounding it with xml tags here:
https://github.com/sbmlteam/jsbml/blob/master/core/src/org/sbml/jsbml/util/StringTools.java#L651

Normally I would use something like StringEscapeUtils from the Apache Commons Lang but because you are not using external libraries (at least I don't see them), you might at least check what they are doing and apply something similar.

@piotr-gawron piotr-gawron changed the title setting notes that are invalid xml throws com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '<' setting notes that is invalid xml throws com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '<' Apr 20, 2018
@tmHamm tmHamm added bug and removed bug labels May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants