All of lore.kernel.org
 help / color / mirror / Atom feed
* XmlFormatter: space isn't allowed in xml tag
@ 2017-01-12  5:27 liuchang0812
  2017-01-12  6:15 ` liuchang0812
  2017-01-12  9:20 ` Robin H. Johnson
  0 siblings, 2 replies; 9+ messages in thread
From: liuchang0812 @ 2017-01-12  5:27 UTC (permalink / raw)
  To: ceph-devel

hi, all

an XML tag cannot contains space in it. see
https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.

Ceph uses `xmlformatter` to dump XML text, and there are a lot of
space in xml tag currently. so, need we fix this?

We could fix this as :
1. simple solution: replace `space` with `_`
2. urlencode: \n = 
 \r = 
 \t = 	 space =  

any comments are appreciated!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12  5:27 XmlFormatter: space isn't allowed in xml tag liuchang0812
@ 2017-01-12  6:15 ` liuchang0812
  2017-01-12 10:34   ` John Spray
  2017-01-12  9:20 ` Robin H. Johnson
  1 sibling, 1 reply; 9+ messages in thread
From: liuchang0812 @ 2017-01-12  6:15 UTC (permalink / raw)
  To: ceph-devel

sorry, Our XMLFormatter has this feature, but lowercased_underscored
is false default.


XMLFormatter(bool pretty = false, bool lowercased_underscored = false);

2017-01-12 13:27 GMT+08:00 liuchang0812 <liuchang0812@gmail.com>:
> hi, all
>
> an XML tag cannot contains space in it. see
> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
>
> Ceph uses `xmlformatter` to dump XML text, and there are a lot of
> space in xml tag currently. so, need we fix this?
>
> We could fix this as :
> 1. simple solution: replace `space` with `_`
> 2. urlencode: \n = &#xA; \r = &#xD; \t = &#x9; space = &#x20;
>
> any comments are appreciated!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12  5:27 XmlFormatter: space isn't allowed in xml tag liuchang0812
  2017-01-12  6:15 ` liuchang0812
@ 2017-01-12  9:20 ` Robin H. Johnson
  2017-01-12 10:03   ` liuchang0812
  1 sibling, 1 reply; 9+ messages in thread
From: Robin H. Johnson @ 2017-01-12  9:20 UTC (permalink / raw)
  To: liuchang0812; +Cc: ceph-devel

On Thu, Jan 12, 2017 at 01:27:33PM +0800, liuchang0812 wrote:
> hi, all
> 
> an XML tag cannot contains space in it. see
> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
Where are spaces leaking into the element names?

I did a refactor of Formatter parters when I was introducing the
HTMLFormatter used by s3website mode, and I don't recall seeing any
cases of accidental space in XML element names, at least in the RGW
side.

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
E-Mail   : robbat2@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12  9:20 ` Robin H. Johnson
@ 2017-01-12 10:03   ` liuchang0812
  2017-01-12 13:35     ` Sage Weil
  0 siblings, 1 reply; 9+ messages in thread
From: liuchang0812 @ 2017-01-12 10:03 UTC (permalink / raw)
  To: ceph-devel

./bin/ceph daemon out/osd.0.asok dump_historic_ops -f xml
<OpHistory><num to keep>20</num to keep><duration to
keep>600</duration to keep><Ops></Ops></OpHistory>

I'm not sure whether XML library could decode it, I will have a try

2017-01-12 17:20 GMT+08:00 Robin H. Johnson <robbat2@gentoo.org>:
> On Thu, Jan 12, 2017 at 01:27:33PM +0800, liuchang0812 wrote:
>> hi, all
>>
>> an XML tag cannot contains space in it. see
>> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
> Where are spaces leaking into the element names?
>
> I did a refactor of Formatter parters when I was introducing the
> HTMLFormatter used by s3website mode, and I don't recall seeing any
> cases of accidental space in XML element names, at least in the RGW
> side.
>
> --
> Robin Hugh Johnson
> Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
> E-Mail   : robbat2@gentoo.org
> GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12  6:15 ` liuchang0812
@ 2017-01-12 10:34   ` John Spray
  2017-01-12 12:00     ` liuchang0812
  0 siblings, 1 reply; 9+ messages in thread
From: John Spray @ 2017-01-12 10:34 UTC (permalink / raw)
  To: liuchang0812; +Cc: ceph-devel

On Thu, Jan 12, 2017 at 6:15 AM, liuchang0812 <liuchang0812@gmail.com> wrote:
> sorry, Our XMLFormatter has this feature, but lowercased_underscored
> is false default.
>
>
> XMLFormatter(bool pretty = false, bool lowercased_underscored = false);

I see this was added in this commit:
commit 4ea0c7c65d9e627acb73524afdc7f51ac02aa25d
Author: Radoslaw Zarzynski <rzarzynski@mirantis.com>
Date:   Thu Oct 22 18:56:14 2015 +0200

    rgw: XMLFormatter may print XML tags lowercased and underscored now.


...but I can't see why the parameter was ever optional -- I think we
should just always do this transformation?

John


>
> 2017-01-12 13:27 GMT+08:00 liuchang0812 <liuchang0812@gmail.com>:
>> hi, all
>>
>> an XML tag cannot contains space in it. see
>> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
>>
>> Ceph uses `xmlformatter` to dump XML text, and there are a lot of
>> space in xml tag currently. so, need we fix this?
>>
>> We could fix this as :
>> 1. simple solution: replace `space` with `_`
>> 2. urlencode: \n = &#xA; \r = &#xD; \t = &#x9; space = &#x20;
>>
>> any comments are appreciated!
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12 10:34   ` John Spray
@ 2017-01-12 12:00     ` liuchang0812
  0 siblings, 0 replies; 9+ messages in thread
From: liuchang0812 @ 2017-01-12 12:00 UTC (permalink / raw)
  To: John Spray; +Cc: ceph-devel

hi, i have a try with lxml. It couldn't be decoded.

In [8]: etree.XML("<OpHistory><num to keep>20</num to keep><duration
to keep>600</duration to keep><Ops></Ops></OpHistory>")
  File "<string>", line 1
XMLSyntaxError: Specification mandate value for attribute to, line 1, column 20


It's OK without spaces.

In [6]: etree.XML("<OpHistory><num>20</num><Ops></Ops><?OpHistory>")
  File "<string>", line 1
XMLSyntaxError: ParsePI: PI OpHistory space expected, line 1, column 47

2017-01-12 18:34 GMT+08:00 John Spray <jspray@redhat.com>:
> On Thu, Jan 12, 2017 at 6:15 AM, liuchang0812 <liuchang0812@gmail.com> wrote:
>> sorry, Our XMLFormatter has this feature, but lowercased_underscored
>> is false default.
>>
>>
>> XMLFormatter(bool pretty = false, bool lowercased_underscored = false);
>
> I see this was added in this commit:
> commit 4ea0c7c65d9e627acb73524afdc7f51ac02aa25d
> Author: Radoslaw Zarzynski <rzarzynski@mirantis.com>
> Date:   Thu Oct 22 18:56:14 2015 +0200
>
>     rgw: XMLFormatter may print XML tags lowercased and underscored now.
>
>
> ...but I can't see why the parameter was ever optional -- I think we
> should just always do this transformation?
>
> John
>
>
>>
>> 2017-01-12 13:27 GMT+08:00 liuchang0812 <liuchang0812@gmail.com>:
>>> hi, all
>>>
>>> an XML tag cannot contains space in it. see
>>> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
>>>
>>> Ceph uses `xmlformatter` to dump XML text, and there are a lot of
>>> space in xml tag currently. so, need we fix this?
>>>
>>> We could fix this as :
>>> 1. simple solution: replace `space` with `_`
>>> 2. urlencode: \n = &#xA; \r = &#xD; \t = &#x9; space = &#x20;
>>>
>>> any comments are appreciated!
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12 10:03   ` liuchang0812
@ 2017-01-12 13:35     ` Sage Weil
  2017-01-12 13:56       ` liuchang0812
  0 siblings, 1 reply; 9+ messages in thread
From: Sage Weil @ 2017-01-12 13:35 UTC (permalink / raw)
  To: liuchang0812; +Cc: ceph-devel

On Thu, 12 Jan 2017, liuchang0812 wrote:
> ./bin/ceph daemon out/osd.0.asok dump_historic_ops -f xml
> <OpHistory><num to keep>20</num to keep><duration to
> keep>600</duration to keep><Ops></Ops></OpHistory>

Any instance where a Formatter element name has a space in it (and 
probably uppercase, for that matter) should be considered a bug and fixed 
(for this very reason).  Please just submit a PR that adds _'s for this 
one.

Thanks!
sage


> 
> I'm not sure whether XML library could decode it, I will have a try
> 
> 2017-01-12 17:20 GMT+08:00 Robin H. Johnson <robbat2@gentoo.org>:
> > On Thu, Jan 12, 2017 at 01:27:33PM +0800, liuchang0812 wrote:
> >> hi, all
> >>
> >> an XML tag cannot contains space in it. see
> >> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
> > Where are spaces leaking into the element names?
> >
> > I did a refactor of Formatter parters when I was introducing the
> > HTMLFormatter used by s3website mode, and I don't recall seeing any
> > cases of accidental space in XML element names, at least in the RGW
> > side.
> >
> > --
> > Robin Hugh Johnson
> > Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
> > E-Mail   : robbat2@gentoo.org
> > GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> > GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12 13:35     ` Sage Weil
@ 2017-01-12 13:56       ` liuchang0812
  2017-01-13  8:04         ` liuchang0812
  0 siblings, 1 reply; 9+ messages in thread
From: liuchang0812 @ 2017-01-12 13:56 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel

I'm working on it, Thanks for all comments

2017-01-12 21:35 GMT+08:00 Sage Weil <sage@newdream.net>:
> On Thu, 12 Jan 2017, liuchang0812 wrote:
>> ./bin/ceph daemon out/osd.0.asok dump_historic_ops -f xml
>> <OpHistory><num to keep>20</num to keep><duration to
>> keep>600</duration to keep><Ops></Ops></OpHistory>
>
> Any instance where a Formatter element name has a space in it (and
> probably uppercase, for that matter) should be considered a bug and fixed
> (for this very reason).  Please just submit a PR that adds _'s for this
> one.
>
> Thanks!
> sage
>
>
>>
>> I'm not sure whether XML library could decode it, I will have a try
>>
>> 2017-01-12 17:20 GMT+08:00 Robin H. Johnson <robbat2@gentoo.org>:
>> > On Thu, Jan 12, 2017 at 01:27:33PM +0800, liuchang0812 wrote:
>> >> hi, all
>> >>
>> >> an XML tag cannot contains space in it. see
>> >> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
>> > Where are spaces leaking into the element names?
>> >
>> > I did a refactor of Formatter parters when I was introducing the
>> > HTMLFormatter used by s3website mode, and I don't recall seeing any
>> > cases of accidental space in XML element names, at least in the RGW
>> > side.
>> >
>> > --
>> > Robin Hugh Johnson
>> > Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
>> > E-Mail   : robbat2@gentoo.org
>> > GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
>> > GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XmlFormatter: space isn't allowed in xml tag
  2017-01-12 13:56       ` liuchang0812
@ 2017-01-13  8:04         ` liuchang0812
  0 siblings, 0 replies; 9+ messages in thread
From: liuchang0812 @ 2017-01-13  8:04 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel

Hi, all

https://github.com/ceph/ceph/pull/12916

Please take a look

2017-01-12 21:56 GMT+08:00 liuchang0812 <liuchang0812@gmail.com>:
> I'm working on it, Thanks for all comments
>
> 2017-01-12 21:35 GMT+08:00 Sage Weil <sage@newdream.net>:
>> On Thu, 12 Jan 2017, liuchang0812 wrote:
>>> ./bin/ceph daemon out/osd.0.asok dump_historic_ops -f xml
>>> <OpHistory><num to keep>20</num to keep><duration to
>>> keep>600</duration to keep><Ops></Ops></OpHistory>
>>
>> Any instance where a Formatter element name has a space in it (and
>> probably uppercase, for that matter) should be considered a bug and fixed
>> (for this very reason).  Please just submit a PR that adds _'s for this
>> one.
>>
>> Thanks!
>> sage
>>
>>
>>>
>>> I'm not sure whether XML library could decode it, I will have a try
>>>
>>> 2017-01-12 17:20 GMT+08:00 Robin H. Johnson <robbat2@gentoo.org>:
>>> > On Thu, Jan 12, 2017 at 01:27:33PM +0800, liuchang0812 wrote:
>>> >> hi, all
>>> >>
>>> >> an XML tag cannot contains space in it. see
>>> >> https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.
>>> > Where are spaces leaking into the element names?
>>> >
>>> > I did a refactor of Formatter parters when I was introducing the
>>> > HTMLFormatter used by s3website mode, and I don't recall seeing any
>>> > cases of accidental space in XML element names, at least in the RGW
>>> > side.
>>> >
>>> > --
>>> > Robin Hugh Johnson
>>> > Gentoo Linux: Dev, Infra Lead, Foundation Trustee & Treasurer
>>> > E-Mail   : robbat2@gentoo.org
>>> > GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
>>> > GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-13  8:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12  5:27 XmlFormatter: space isn't allowed in xml tag liuchang0812
2017-01-12  6:15 ` liuchang0812
2017-01-12 10:34   ` John Spray
2017-01-12 12:00     ` liuchang0812
2017-01-12  9:20 ` Robin H. Johnson
2017-01-12 10:03   ` liuchang0812
2017-01-12 13:35     ` Sage Weil
2017-01-12 13:56       ` liuchang0812
2017-01-13  8:04         ` liuchang0812

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.