Atom XML Parsing Error: prefix not bound to a namespace
Atom XML Parsing Error: prefix not bound to a namespace
我正在尝试根据 Laracasts 教程编写一个 XML 馈线。我需要添加博客 post 缩略图作为媒体元素,但我在 media:content
开头收到错误消息
XML Parsing Error: prefix not bound to a namespace
<media:content url="https:/sirtcantalilar.com/uploads/img/posts/2/Paris_train_station.jpg">
--------------^
我的 XML 视图与 Laracast 中的一样:
{{ '<?xml version="1.0" encoding="utf-8" ?>' }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Sirtcantalilar Topluluğu</title>
<subtitle></subtitle>
<updated>{{ Carbon\Carbon::now()->toATOMString() }}</updated>
<author>
<name></name>
</author>
<id>tag:sirtcantalilar.com, {{date('Y')}}:/feed</id>
@foreach($posts as $post)
<entry>
<author>
<name>{{$post->author->name}}</name>
</author>
<title>{{ $post->title }}</title>
<link> {{ URL::route('view-post', $post->slug) }}</link>
<id>{{ post_tag_uri($post)}}</id>
<summary>{{$post->minicontent}}</summary>
<category term="Blog"/>
<content type="html"><![CDATA[{{$post->content}}]]></content>
<media:content url="https:/sirtcantalilar.com/uploads/img/posts/{{$post->id}}/{{$post->thumbnail->name}}">
<media:thumbnail url="https:/sirtcantalilar.com/uploads/img/posts/{{$post->id}}/thumb-{{$post->thumbnail->name}}" type="image/jpeg"/>
<media:credit>Image{{$post->id}} attribution</media:credit>
<media:title>Image{{$post->id}} caption</media:title>
<media:text>Image{{$post->id}} alt-text</media:text>
</media:content>
</entry>
@endforeach
</feed>
你能帮帮我吗?
Atom 提要中的 media
前缀应引用 MediaRSS namespace。您将默认命名空间定义为带有 xmlns="http://www.w3.org/2005/Atom"
的 Atom,但没有定义 media
前缀。您需要添加定义..
<feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/">
我正在尝试根据 Laracasts 教程编写一个 XML 馈线。我需要添加博客 post 缩略图作为媒体元素,但我在 media:content
开头收到错误消息 XML Parsing Error: prefix not bound to a namespace
<media:content url="https:/sirtcantalilar.com/uploads/img/posts/2/Paris_train_station.jpg">
--------------^
我的 XML 视图与 Laracast 中的一样:
{{ '<?xml version="1.0" encoding="utf-8" ?>' }}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Sirtcantalilar Topluluğu</title>
<subtitle></subtitle>
<updated>{{ Carbon\Carbon::now()->toATOMString() }}</updated>
<author>
<name></name>
</author>
<id>tag:sirtcantalilar.com, {{date('Y')}}:/feed</id>
@foreach($posts as $post)
<entry>
<author>
<name>{{$post->author->name}}</name>
</author>
<title>{{ $post->title }}</title>
<link> {{ URL::route('view-post', $post->slug) }}</link>
<id>{{ post_tag_uri($post)}}</id>
<summary>{{$post->minicontent}}</summary>
<category term="Blog"/>
<content type="html"><![CDATA[{{$post->content}}]]></content>
<media:content url="https:/sirtcantalilar.com/uploads/img/posts/{{$post->id}}/{{$post->thumbnail->name}}">
<media:thumbnail url="https:/sirtcantalilar.com/uploads/img/posts/{{$post->id}}/thumb-{{$post->thumbnail->name}}" type="image/jpeg"/>
<media:credit>Image{{$post->id}} attribution</media:credit>
<media:title>Image{{$post->id}} caption</media:title>
<media:text>Image{{$post->id}} alt-text</media:text>
</media:content>
</entry>
@endforeach
</feed>
你能帮帮我吗?
Atom 提要中的 media
前缀应引用 MediaRSS namespace。您将默认命名空间定义为带有 xmlns="http://www.w3.org/2005/Atom"
的 Atom,但没有定义 media
前缀。您需要添加定义..
<feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/">