-
Notifications
You must be signed in to change notification settings - Fork 29
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
Bug, attribute name "prefixes" are dropped #5
Comments
Prefix was not the correct term Seems like the reason is this code: Lines 50 to 55 in e1029cd
More specifically this line: Line 52 in e1029cd
You are only using the https://golang.org/pkg/encoding/xml/#Name
|
Ok, so simply adding
Not sure if this is just something inherent in the golang API when parsing XML, or if it's controllable. What happens is that this is read:
As well as these attributes from the original:
When parsing this, the fully expanded Space is saved. So instead of Space being |
Seems like this is just how it works: https://golang.org/pkg/encoding/xml/#Decoder.Token
I see it was also mentioned in https://golang.org/pkg/encoding/xml/#Name
But then I don't get why chrome thinks it's an invalid XML file. The wonderful world of overly complex standards 🤕 |
Ok, so the marshalling implementation does this properly. The used the expanded That is, instead of simply outputting:
it first creates:
And then uses it properly:
So instead of using your own Lines 14 to 17 in e1029cd
You should use the
Or something similar to that. Unfortunately that breaks backwards compatability So the correct way to do this is to keep the Sorry for the spamming |
Because I cannot find a best way to support xpath for namespace, so I drop the namespace for implementation. I am trying to add full support for namespace in new branch |
added namespaces prefix |
Reading this XML file (an SVG) and then simply resaving it will write invalid characters in the CSS part.
The error that chrome gives on trying to read this SVG
Line 2:
original
rewritten file
Seems like all prefixes are dropped from the attribute names, resulting in duplicate
version
:Becomes
Small program to reproduce this:
The text was updated successfully, but these errors were encountered: