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

Error() returns false for corrupted XML (when there is no starting tag) #972

Open
asmei1 opened this issue Mar 25, 2024 · 1 comment
Open

Comments

@asmei1
Copy link

asmei1 commented Mar 25, 2024

Hi,
Error() returns false for such simple case:

<?xml version="1.0" encoding="utf-8"?>
</data>

There is no starting tag for top level one. Then, in such case:


    tinyxml2::XMLDocument document;
    document.Parse(xmlString.c_str()); 

document.RootElement(); returns nullptr.

@qcerasmus
Copy link

This is the same when using a validator. The reason is your '/' is at the start of the tag name which means there is an expected opening tag which doesn't exist.

<?xml version="1.0" encoding="utf-8"?> <data/>
That should work though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants