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

duplicate elements dropped during parse #409

Open
javamonkey79 opened this issue Oct 25, 2023 · 0 comments
Open

duplicate elements dropped during parse #409

javamonkey79 opened this issue Oct 25, 2023 · 0 comments

Comments

@javamonkey79
Copy link

Given the following example atom file:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ed="http://www.edmunds.com/content">
    <id></id>
    <title type="text">Lorem Ipsum Dolor Sit Amet</title>
    <subtitle type="text" />
    <updated>2013-01-08T12:04:00.000Z</updated>
    <category term="value1" />
    <category term="value2" />
    <category term="value3" />
    <ed:metadata name="titleTag">Lorem Ipsum Dolor Sit Amet</ed:metadata>
    <ed:metadata name="metaKeywords">placeholder, Placeholder, Placeholder Placeholder, Placeholder Placeholder</ed:metadata>
    <ed:metadata name="metaDescription">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.</ed:metadata>
    <ed:metadata name="canonical" />
    <entry>
        <title type="text" />
        <summary type="text" />
        <content type="html">
            &lt;h3>Lorem Ipsum Dolor Sit Amet&lt;/h3>
            &lt;p>August 19, 2009&lt;/p>
            &lt;p>&lt;img alt="placeholder.jpg" class="mt-image-none" src="//static.placeholder.com/img/placeholder.jpg" width="618" />&lt;/p>
            &lt;p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.&lt;/p>
            &lt;p>Donec nec efficitur tellus. Aenean non lorem sit.&lt;/p>
            &lt;p>Nulla facilisi. Sed cursus, justo et auctor vehicula, lorem metus lacinia velit, nec ullamcorper risus ligula nec ligula.&lt;/p>
            &lt;p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.&lt;/p>
            &lt;p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.&lt;/p>
            &lt;p>Lorem Ipsum&lt;/p&gt;</content>
    </entry>
</feed>

When it is parsed, I get the following back from feedparser:

{
    "bozo": false,
    "entries": [
        {
            "title": "",
            "title_detail": {
                "type": "text/plain",
                "language": null,
                "base": "",
                "value": ""
            },
            "summary": "",
            "summary_detail": {
                "type": "text/plain",
                "language": null,
                "base": "",
                "value": ""
            },
            "content": [
                {
                    "type": "text/html",
                    "language": null,
                    "base": "",
                    "value": "<h3>Lorem Ipsum Dolor Sit Amet</h3>\n            <p>August 19, 2009</p>\n            <p><img alt=\"placeholder.jpg\" class=\"mt-image-none\" src=\"//static.placeholder.com/img/placeholder.jpg\" width=\"618\" /></p>\n            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.</p>\n            <p>Donec nec efficitur tellus. Aenean non lorem sit.</p>\n            <p>Nulla facilisi. Sed cursus, justo et auctor vehicula, lorem metus lacinia velit, nec ullamcorper risus ligula nec ligula.</p>\n            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.</p>\n            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum.</p>\n            <p>Lorem Ipsum, Placeholder Editor @ Placeholder miles</p>"
                }
            ]
        }
    ],
    "feed": {
        "id": "",
        "guidislink": true,
        "link": "",
        "title": "Lorem Ipsum Dolor Sit Amet",
        "title_detail": {
            "type": "text/plain",
            "language": null,
            "base": "",
            "value": "Lorem Ipsum Dolor Sit Amet"
        },
        "subtitle": "",
        "subtitle_detail": {
            "type": "text/plain",
            "language": null,
            "base": "",
            "value": ""
        },
        "updated": "2013-01-08T12:04:00.000Z",
        "updated_parsed": [
            2013,
            1,
            8,
            12,
            4,
            0,
            1,
            8,
            0
        ],
        "tags": [
            {
                "term": "value1",
                "scheme": null,
                "label": null
            },
            {
                "term": "value2",
                "scheme": null,
                "label": null
            },
            {
                "term": "value3",
                "scheme": null,
                "label": null
            }
        ],
        "ed_metadata": {
            "name": "canonical"
        }
    },
    "headers": {},
    "encoding": "utf-8",
    "version": "atom10",
    "namespaces": {
        "": "http://www.w3.org/2005/Atom",
        "ed": "http://www.edmunds.com/content"
    }
}

So, the category elements show up even though they are duplicated, but the "ed_metadata" (ed:metadata from the original) elements are overwritten by the last one. I've also tested it without that last "canonical" one and the data in the metaDescription Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum. is dropped too.

Is this a bug or intended functionality?

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