Skip to content

Creating invalid XML: Undefined prefix xsi found #4

Description

@onli

At https://www.onli-blogging.de/feeds/index.rss2, I have an RSS feed with an empty description:

<description></description>

OXML produces this hash element from that:

channel: {
    ...
    description: nil

Sound so far, but when then building XML from that has, the XML builder is adding xsi:nil

<description xsi:nil="true">

(And also seems to switch to a non-closed element, which would be a separate problem). The resulting XML now can not be parsed by the RSS gem, I get this error:

RSS::NotWellFormedError: This is not well formed XML
Undefined prefix xsi found

I think the RSS gem is correct here, the xsi namespace is indeed not defined and the attribute should not have been added like this.

builder.element(Utils.camelize(key), 'xsi:nil': 'true')
is the responsible line, already part of cf663ff, but I'm missing the context here why this was added.

I would propose that OXML should not add the xsi attribute at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions