clj-tagsoup icon indicating copy to clipboard operation
clj-tagsoup copied to clipboard

Attributes get lowercased; xmlns omitted

Open nchurch opened this issue 13 years ago • 2 comments

I tried parsing some Android XML configuration files; these have attributes, for instance, like

android:keyWidth="15%p" android:horizontalGap="0px"
android:verticalGap="0px"

clj-tagsoup lowercases the attribute names-----e.g.:

android:keywidth

so that it doesn't roundtrip through Hiccup.

Additionally, it doesn't pick up the xmlns declaration in the root element; e.g:

xmlns:android="http://schemas.android.com/apk/res/android"

This has to be put back in by hand.

(I'm using Android as an example, but presumably these issues have relevance beyond Android.)

Thanks,

Nick.

nchurch avatar Oct 22 '12 22:10 nchurch

+1

Same issue with svg parsing: viewBox is changed to viewbox, which is not valid for svg, giving an error. Could lowercasing be optional?

kurt-o-sys avatar Dec 12 '17 22:12 kurt-o-sys

You could fix the lowercase :viewbox like this:

(-> (pl.danieljanus.tagsoup/parse-string svg-string)
    (update 1 clojure.set/rename-keys {:viewbox :viewBox}))

I wonder @nathell, is the lowercasing done in clj-tagsoup or in some underlying library?

dimovich avatar Feb 06 '19 22:02 dimovich