diff --git a/internal/matchers/signature.go b/internal/matchers/signature.go index a3364de4..75267090 100644 --- a/internal/matchers/signature.go +++ b/internal/matchers/signature.go @@ -109,6 +109,9 @@ func (xSig xmlSig) detect(in []byte) bool { if len(xSig.localName) == 0 { return bytes.Index(in, xSig.xmlns) > 0 } + if len(xSig.xmlns) == 0 { + return bytes.Index(in, xSig.localName) > 0 + } localNameIndex := bytes.Index(in, xSig.localName) return localNameIndex != -1 && localNameIndex < bytes.Index(in, xSig.xmlns) diff --git a/internal/matchers/text.go b/internal/matchers/text.go index 958a7f65..1e3d33a9 100644 --- a/internal/matchers/text.go +++ b/internal/matchers/text.go @@ -29,6 +29,12 @@ var ( xmlSigs = []sig{ markupSig(" + + + Copyright (c) 2015 3MF Consortium. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testdata/amf.amf b/testdata/amf.amf new file mode 100644 index 00000000..2c0c2dab --- /dev/null +++ b/testdata/amf.amf @@ -0,0 +1,109 @@ + + + Split Pyramid + John Smith + + + + + + 0 + 0 + 0 + + + + + 1 + 0 + 0 + + + + + 0 + 1 + 0 + + + + + 1 + 1 + 0 + + + + + 0.5 + 0.5 + 1 + + + + + Hard side + + 2 + 1 + 0 + + + 0 + 1 + 4 + + + 4 + 1 + 2 + + + 0 + 4 + 2 + + + + Soft side + + 2 + 3 + 1 + + + 1 + 3 + 4 + + + 4 + 3 + 2 + + + 4 + 2 + 1 + + + + + + Hard material + + 0.1 + 0.1 + 0.1 + + + + Soft material + + 0 + 0.9 + 0.9 + 0.5 + + + diff --git a/testdata/atom.atom b/testdata/atom.atom new file mode 100644 index 00000000..548468c1 --- /dev/null +++ b/testdata/atom.atom @@ -0,0 +1,17 @@ + + + Example Feed + + 2003-12-13T18:30:02Z + + John Doe + + urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 + + Atom-Powered Robots Run Amok + + urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a + 2003-12-13T18:30:02Z + Some text. + + diff --git a/testdata/rss.rss b/testdata/rss.rss new file mode 100644 index 00000000..44feb13c --- /dev/null +++ b/testdata/rss.rss @@ -0,0 +1,18 @@ + + + + RSS Title + This is an example of an RSS feed + http://www.example.com/main.html + Mon, 06 Sep 2010 00:01:00 +0000 + Sun, 06 Sep 2009 16:20:00 +0000 + 1800 + + Example entry + Here is some text containing an interesting description. + http://www.example.com/blog/post/1 + 7bd204c6-1655-4c27-aeee-53f933c5395f + Sun, 06 Sep 2009 16:20:00 +0000 + + + diff --git a/tree.go b/tree.go index c94a30f3..d86e7414 100644 --- a/tree.go +++ b/tree.go @@ -35,7 +35,7 @@ var ( fits = newNode("application/fits", "fits", matchers.Fits) ogg = newNode("application/ogg", "ogg", matchers.Ogg) txt = newNode("text/plain", "txt", matchers.Txt, html, svg, xml, php, js, lua, perl, python, json, rtf, tcl, csv, tsv, vCard) - xml = newNode("text/xml; charset=utf-8", "xml", matchers.Xml, x3d, kml, xliff, collada, gml, gpx, tcx) + xml = newNode("text/xml; charset=utf-8", "xml", matchers.Xml, rss, atom, x3d, kml, xliff, collada, gml, gpx, tcx, amf, threemf) json = newNode("application/json", "json", matchers.Json, geoJson) csv = newNode("text/csv", "csv", matchers.Csv) tsv = newNode("text/tab-separated-values", "tsv", matchers.Tsv) @@ -50,6 +50,8 @@ var ( tcl = newNode("text/x-tcl", "tcl", matchers.Tcl) vCard = newNode("text/vcard", "vcf", matchers.VCard) svg = newNode("image/svg+xml", "svg", matchers.Svg) + rss = newNode("application/rss+xml", "rss", matchers.Rss) + atom = newNode("application/atom+xml", "atom", matchers.Atom) x3d = newNode("model/x3d+xml", "x3d", matchers.X3d) kml = newNode("application/vnd.google-earth.kml+xml", "kml", matchers.Kml) xliff = newNode("application/x-xliff+xml", "xlf", matchers.Xliff) @@ -57,6 +59,8 @@ var ( gml = newNode("application/gml+xml", "gml", matchers.Gml) gpx = newNode("application/gpx+xml", "gpx", matchers.Gpx) tcx = newNode("application/vnd.garmin.tcx+xml", "tcx", matchers.Tcx) + amf = newNode("application/x-amf", "amf", matchers.Amf) + threemf = newNode("application/vnd.ms-package.3dmanufacturing-3dmodel+xml", "3mf", matchers.Threemf) png = newNode("image/png", "png", matchers.Png) jpg = newNode("image/jpeg", "jpg", matchers.Jpg) bpg = newNode("image/bpg", "bpg", matchers.Bpg)