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

Only one declaration is allowed #399

Closed
yleydier opened this issue Dec 4, 2015 · 6 comments
Closed

Only one declaration is allowed #399

yleydier opened this issue Dec 4, 2015 · 6 comments
Labels

Comments

@yleydier
Copy link

yleydier commented Dec 4, 2015

Tinyxml2 allows only one declaration. It prevents the reading files containing and .

Reference : http://www.xml-model.info/

Commenting out the test around line 970 of tinyxml2.cpp fixes the bug, but the correct way to do this would be to test if all previous nodes are declarations instead of testing if declaration nodes are the first node of the document.

@Dmitry-Me
Copy link
Contributor

Good! Fixing this would also resolve #340 I can craft a fix next week. @leethomason, do you have any objections?

@ajtruckle
Copy link

Not sure I am following this right. I am no XML but I am using my XML file with a XSL file, thus this is my declaration:

Andrew

Date: Fri, 4 Dec 2015 06:42:16 -0800
From: notifications@github.com
To: tinyxml2@noreply.github.com
Subject: Re: [tinyxml2] Only one declaration is allowed (#399)

Good! Fixing this will also resolve #340 I can craft a fix next week. @leethomason do you have any objections?


Reply to this email directly or view it on GitHub.

@leethomason
Copy link
Owner

#340 is a partial fix from a previous bug.

Since TinyXML-2 doesn't actually interpret the declarations, I don't think the limit (only one) is really helping. I've been leaning to the other: remove the limitation entirely and just read all the declarations it finds.

@snowkoan
Copy link

snowkoan commented Jun 2, 2016

The current code also prevents comments at the start of an XML file. It appears that this is technically not valid XML but it's a fairly common pattern, at least in our code base.

For example, this will fail to parse:

<!-- Package file for product X -->
<?xml version="1.0" encoding="UTF-8"?>
<package>
</package>

@leethomason
Copy link
Owner

Good point - flagging as bug. I agree that's something that shouldn't cause a parse failure.

@leethomason leethomason added the bug label Jun 3, 2016
leethomason added a commit that referenced this issue Aug 29, 2016
Bool true/false rather than 0/1 : #399
@Dmitry-Me
Copy link
Contributor

@leethomason This should have been resolved once #496 was merged

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

No branches or pull requests

5 participants