EDN Admin
Well-known member
HI
I am trying to build a dynamic iTunes feed, reading from a database. Ive got stuck on the document declaration. It needs to be in this format:
<pre class="prettyprint <?xml version="1.0” encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0
...document nodes
</rss>[/code]
<br/>
<br/>
I keep getting the error:
<span>
The namespace declaration attribute has an incorrect namespaceURI: http://www.itunes.com/dtds/podcast-1.0.dtd
Could someone tell me what I am doing wrong, Im well and truly stuck!
Here is my code:
Dim xmlDoc As New XmlDocument()<br/>
<pre class="prettyprint lang-vb XML declaration
original doc declaration
Dim xmldecl As XmlDeclaration
xmldecl = xmlDoc.CreateXmlDeclaration("1.0", Nothing, Nothing)
xmldecl.Encoding = "UTF-8"
xmldecl.Standalone = "yes"
Dim root As XmlElement = xmlDoc.DocumentElement
xmlDoc.InsertBefore(xmldecl, root)
Dim nsmgr As New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd")
nsmgr.AddNamespace("vers", "2.0")
Dim xRoot As XmlElement = xmlDoc.CreateElement("rss")
Dim schemaLocation As XmlAttribute = xmlDoc.CreateAttribute("xmlns:itunes", nsmgr.LookupNamespace("itunes"))
schemaLocation.InnerText = "http://www.itunes.com/dtds/podcast-1.0.dtd"
xRoot.Attributes.Append(schemaLocation)
Dim ver As XmlAttribute = xmlDoc.CreateAttribute("version")
ver.InnerText = "2.0"
xRoot.Attributes.Append(ver)
xmlDoc.AppendChild(xRoot)[/code]
<br/>
<br/>
View the full article
I am trying to build a dynamic iTunes feed, reading from a database. Ive got stuck on the document declaration. It needs to be in this format:
<pre class="prettyprint <?xml version="1.0” encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0
...document nodes
</rss>[/code]
<br/>
<br/>
I keep getting the error:
<span>
The namespace declaration attribute has an incorrect namespaceURI: http://www.itunes.com/dtds/podcast-1.0.dtd
Could someone tell me what I am doing wrong, Im well and truly stuck!
Here is my code:
Dim xmlDoc As New XmlDocument()<br/>
<pre class="prettyprint lang-vb XML declaration
original doc declaration
Dim xmldecl As XmlDeclaration
xmldecl = xmlDoc.CreateXmlDeclaration("1.0", Nothing, Nothing)
xmldecl.Encoding = "UTF-8"
xmldecl.Standalone = "yes"
Dim root As XmlElement = xmlDoc.DocumentElement
xmlDoc.InsertBefore(xmldecl, root)
Dim nsmgr As New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd")
nsmgr.AddNamespace("vers", "2.0")
Dim xRoot As XmlElement = xmlDoc.CreateElement("rss")
Dim schemaLocation As XmlAttribute = xmlDoc.CreateAttribute("xmlns:itunes", nsmgr.LookupNamespace("itunes"))
schemaLocation.InnerText = "http://www.itunes.com/dtds/podcast-1.0.dtd"
xRoot.Attributes.Append(schemaLocation)
Dim ver As XmlAttribute = xmlDoc.CreateAttribute("version")
ver.InnerText = "2.0"
xRoot.Attributes.Append(ver)
xmlDoc.AppendChild(xRoot)[/code]
<br/>
<br/>
View the full article