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

Elements for Image are serialized out of order. #28

Open
johnelliott opened this issue Mar 3, 2019 · 0 comments
Open

Elements for Image are serialized out of order. #28

johnelliott opened this issue Mar 3, 2019 · 0 comments

Comments

@johnelliott
Copy link

I am new to go but not sitemaps. I am not very experienced writing go so there may be something I do not understand that I am doing causing the behavior.

Context:

Generating a sitemap with URLs and Images.

Problem:

XML that elements are out of order. The XML fails to validate with xmllint: ./mymappath/sitemap/sitemap1.xml:72: element caption: Schemas validity error : Element '{http://www.google.com/schemas/sitemap-image/1.1}caption': This element is not expected. Expected is ( {http://www.google.com/schemas/sitemap-image/1.1}loc ).

Here is the offending xml:

  <image:image>
    <image:caption>hellothecaption</image:caption>
    <image:loc>https://example.com/img</image:loc>
  </image:image>

I would expect that the xml elements are in the same order for all urls, but instead sometimes they are out of order.

Different runs produce different numbers of the problem on different data. I first blamed my code and hard-coded the image data map, but I still got the same varying order. I wonder if it is the way etree is used or the way xml is used in etree.

@johnelliott johnelliott changed the title Elements for Image serialized out of order. Elements for Image are serialized out of order. Mar 3, 2019
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