"Daniel Cazzulino [MVP XML]" <kzuAT@NOaspnet2SPAMPLZ.com> wrote in message
news:#3Im7LXLEHA.3324@TK2MSFTNGP10.phx.gbl...
> You can get rid of the xsd and xsi namespace declarations by using the
> technique explained here:
>
http://weblogs.asp.net/cazzu/archive/2004/01/23/62141.aspx, at the very
> beginning of the post.
>
> HTH
> --
> Daniel Cazzulino [MVP XML]
> Clarius Consulting SA
>
http://weblogs.asp.net/cazzu >
http://aspnet2.com > "Derek Harmon" <loresayer@msn.com> wrote in message
> news:eQT4yeLLEHA.268@TK2MSFTNGP11.phx.gbl...
> > "AP" <adamp@indra.com> wrote in message
> news:OAU8iiJLEHA.3808@TK2MSFTNGP12.phx.gbl...
> > > I have a class that I wish to serialize to XML, part of which looks
like
> > > this:
> > >
> > > public class TitleNotification {
> > > [XmlAttributeAttribute(Namespace="xsi",
> > > AttributeName="noNameSpaceSchemaLocation")]
> >
> > The Namespace property represents a namespace URI -- not a prefix.
> >
> > [XmlAttribute(
Namespace="
http://www.w3.org/2001/XMLSchema-instance",
> > AttributeName="noNamespaceSchemaLocation")]
> >
> > Also observe that the QName, xsi:noNamespaceSchemaLocation, is
> > case-sensitive.
> >
> > : :
> > > How can I get it to generate xsi:noNameSpaceSchemaLocation instead of
> doing
> > > the d1p1 substitution thing it's doing now?
> >
> > Try using the namespace URI, XmlSerializer may re-use the xsi prefix.
> > If it doesn't, then it's choice of prefix is arbitrary. Correct
> implementations
> > that honor xsi:noNamespaceSchemaLocation are actually looking for:
> >
> >
{
http://www.w3.org/2001/XMLSchema-instance,noNamespaceSchemaLocation}
> >
> > Therefore, it doesn't matter what prefix it's given.
> >
> > Ordinarily, you would use a public field of type
XmlSerializerNamespaces,
> > and mark it with the [XmlNamespaceDeclarations] attribute. You could
> > initialize this field by Add'ing prefix and namespaceURI pairings into
it.
> >
> > However, the XML Schema namespace declarations are emitted by the
> > XmlSerializer prior to consulting the XmlNamespaceDeclarations field,
> > so you cannot count on your xsi namespace declaration appearing early
> > enough in the root element (it'll be there, though, because
XmlSerializer
> > needs the XMLSchema-instance namespace itself.)
> >
> >
> > Derek Harmon
> >
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (
http://www.grisoft.com).
> Version: 6.0.665 / Virus Database: 428 - Release Date: 23/04/2004
>
>
Outgoing mail is certified Virus Free.
).