Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: xpathnavigator.setvalue error >Thread Next - Re: xpathnavigator.setvalue error Re: xpathnavigator.setvalue errorTo: NULL Date: 1/19/2009 1:44:00 AM Thanks,
I'm having a problem trying to navugate with it:
I'm reading an XMLDocument in from a file:
Dim document As XmlDocument = New XmlDocument()
document.Load("ChimneyFire.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim manager As XmlNamespaceManager = New
XmlNamespaceManager(navigator.NameTable)
manager.AddNamespace("IncidentDetails",
"http://www.fire.gov.uk/schemas/Incident")
I then need to change the value of an element several levels down
I think the XPath expression is something like:
"/IncidentDetails:Incident/IncidentDetails:Identifier" _
& "/IncidentDetails:FRSIncidentNumber"
I can't see how to get the position of the navigator to move to the right
place.
"Martin Honnen" wrote:
> John S wrote:
> > Using VB 2005 I'm getting -"Specified method is not supported" when I try to
> > use the xpathnavigator.setvalue method.
> >
> > Can anyone explain?
>
> You need to create an XPathNavigator over an XmlDocument/XmlElement if
> you want to be able to use editing features like SetValue. An
> XPathNavigator over an XPathDocument is readonly.
>
> So this works:
>
> XmlDocument doc = new XmlDocument();
> doc.LoadXml("<foo>bar</foo>");
> doc.DocumentElement.CreateNavigator().SetValue("baz");
> doc.Save(Console.Out);
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
