Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Thu, 11 Sep 2008 12:29:15 -0500,    group: microsoft.public.xml        back       


Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
What? I have the atom namespace declared correctly and I'm wondering why the 
XmlWriter has a problem with this element? Does anybody have suggestions how 
to write XML that supports the Atom Publishing Protocol?

Are some writers in the framework "better" than others in this context? 
Which please...
date: Thu, 11 Sep 2008 12:29:15 -0500   author:   Hillbilly

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
Hillbilly wrote:
> What? I have the atom namespace declared correctly and I'm wondering why 
> the XmlWriter has a problem with this element? 

Can you show us your exact code that gives the error?


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Thu, 11 Sep 2008 19:33:36 +0200   author:   Martin Honnen

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
// some statements wrapped for NNTP clarity...

XmlWriterSettings settings =
new XmlWriterSettings();
settings.CheckCharacters = true;
settings.CloseOutput = true;

using (XmlWriter writer =
XmlWriter.Create(writerFileMapPath, settings))
{

writer.WriteStartDocument();
writer.WriteStartElement("rss");
writer.WriteAttributeString("version", "2.0");

// Atom namespace
writer.WriteAttributeString("xmlns",
       "atom", null,
       "http://www.w3.org/2005/Atom");
...
// W3C recommended usage for link element
#region Task: <link> element...
if (link.Length != 0)
    writer.WriteStartElement("atom:link");
    writer.WriteAttributeString("href", link);
    writer.WriteAttributeString("rel", "self");
    writer.WriteAttributeString("type",
           "application/rss+xml");
    writer.WriteEndElement();
#endregion
...
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
}


"Martin Honnen"  wrote in message 
news:OpaDGSDFJHA.1460@TK2MSFTNGP03.phx.gbl...
> Hillbilly wrote:
>> What? I have the atom namespace declared correctly and I'm wondering why 
>> the XmlWriter has a problem with this element?
>
> Can you show us your exact code that gives the error?
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
date: Thu, 11 Sep 2008 13:22:11 -0500   author:   Hillbilly

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
BTW, I'm working on conformance with the current W3C recommendations...

// W3C validator recommendation
http://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html


// W3C example
<atom:link href="http://somewhere.com/rss.xml" rel="self" 
type="application/rss+xml" />

What remains ambiguous is the former link element has been used to refer to 
the location of the channel itself and not neccessarily a file, i.e. 
<link>http://mydomain.com/</link> but this documentation is FUBAR AFIC and 
apparently gives an example for a linked item of a feed which is always a 
file and not perhaps the channel's link element?

Still, how to write this with the XmlWriter has alluded me all day...



"Martin Honnen"  wrote in message 
news:OpaDGSDFJHA.1460@TK2MSFTNGP03.phx.gbl...
> Hillbilly wrote:
>> What? I have the atom namespace declared correctly and I'm wondering why 
>> the XmlWriter has a problem with this element?
>
> Can you show us your exact code that gives the error?
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
date: Thu, 11 Sep 2008 16:02:40 -0500   author:   Hillbilly

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
The documentation sucks, there is an overload. Intellisense gave me the clue 
but it wouldn't give me the list of overload constructors(is there a 
keystroke or some way to get the list of overloads from Intellisense?)

// This is how conformance to W3C atom:link element is written using the 
XmlWriter...

#region Task: <atom:link> element...
if (link.Length != 0)
    writer.WriteStartElement("atom", "link", null);
    writer.WriteAttributeString("href", link);
    writer.WriteAttributeString("rel", "self");
    writer.WriteAttributeString("type", "application/rss+xml");
    writer.WriteEndElement();
#endregion

// generates the following
<atom:link href="http://somewhere.com/" rel="self" 
type="application/rss+xml"/>

//still working on how to use XmlWriter using writer.WriteFullEndElement()
<atom:value>inner text</atom:value>


"Martin Honnen"  wrote in message 
news:OpaDGSDFJHA.1460@TK2MSFTNGP03.phx.gbl...
> Hillbilly wrote:
>> What? I have the atom namespace declared correctly and I'm wondering why 
>> the XmlWriter has a problem with this element?
>
> Can you show us your exact code that gives the error?
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
date: Thu, 11 Sep 2008 16:44:19 -0500   author:   Hillbilly

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
Hillbilly wrote:

   const string atom = "http://www.w3.org/2005/Atom";

> using (XmlWriter writer =
> XmlWriter.Create(writerFileMapPath, settings))
> {
> 
> writer.WriteStartDocument();
> writer.WriteStartElement("rss");
> writer.WriteAttributeString("version", "2.0");
> 
> // Atom namespace
> writer.WriteAttributeString("xmlns",
>       "atom", null,
>       "http://www.w3.org/2005/Atom");

  writer.WriteAttributeString("xmlns",
        "atom", null,
        atom);
> ...
> // W3C recommended usage for link element
> #region Task: <link> element...
> if (link.Length != 0)
>    writer.WriteStartElement("atom:link");

Use
      writer.WriteStartElement("atom", "link", atom);




-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Fri, 12 Sep 2008 14:33:55 +0200   author:   Martin Honnen

Re: Invalid name character in 'atom:link'. The ':' character cannot be included in a name   
Thank you Martin.

"Martin Honnen"  wrote in message 
news:uHPFUPNFJHA.616@TK2MSFTNGP06.phx.gbl...
> Hillbilly wrote:
>
>   const string atom = "http://www.w3.org/2005/Atom";
>
>> using (XmlWriter writer =
>> XmlWriter.Create(writerFileMapPath, settings))
>> {
>>
>> writer.WriteStartDocument();
>> writer.WriteStartElement("rss");
>> writer.WriteAttributeString("version", "2.0");
>>
>> // Atom namespace
>> writer.WriteAttributeString("xmlns",
>>       "atom", null,
>>       "http://www.w3.org/2005/Atom");
>
>  writer.WriteAttributeString("xmlns",
>        "atom", null,
>        atom);
>> ...
>> // W3C recommended usage for link element
>> #region Task: <link> element...
>> if (link.Length != 0)
>>    writer.WriteStartElement("atom:link");
>
> Use
>      writer.WriteStartElement("atom", "link", atom);
>
>
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
date: Fri, 12 Sep 2008 10:07:46 -0500   author:   Hillbilly

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us