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

xml namespace is still not ok #4

Open
suntong opened this issue Mar 15, 2021 · 1 comment
Open

xml namespace is still not ok #4

suntong opened this issue Mar 15, 2021 · 1 comment

Comments

@suntong
Copy link

suntong commented Mar 15, 2021

based on subchen#5

which strips xml namespace

version="1.1"
inkscape:version="0.92.1 r15371"

as

version="1.1"
version="0.92.1 r15371"

However, with the added xml namespace support, it is still not working as expected:

https://play.golang.org/p/sNzrDX6tXwQ

func main() {
	fmt.Println(svgData)

	fmt.Println("---------------------------------")

	doc := xmldom.Must(xmldom.ParseXML(svgData))
	fmt.Println(doc.XMLPretty())
}
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   id="Logo"
   width="2139"
   height="2139"
   viewBox="0 0 2139 2139"
   version="1.1"
   sodipodi:docname="siknas07-alt03.svg"
   inkscape:version="0.92.1 r15371"
   inkscape:label="Cirkel">
  <metadata
     id="metadata30">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
...

becomes

<svg:svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" id="Logo" width="2139" height="2139" viewBox="0 0 2139 2139" version="1.1">
  <svg:metadata id="metadata30">
    <rdf:RDF>
      <cc:Work>
        <dc:format>image/svg+xml</dc:format>
        <dc:type />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </svg:metadata>
@suntong
Copy link
Author

suntong commented Mar 16, 2021

So it is still an XML v1 Dom, with simple hack to allow single namespace.

Not suitable to handle XML v2 samples that have multiple namespaces.

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

1 participant