jump to navigation

Namespace prefix ‘ns1’ is not defined. XMLDocument June 17, 2016

Posted by juanpablo1manrique in SharePoint.
Tags: , ,
trackback

Para solucionar este toca agregar todos los namespaces del mensaje

 

XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());

nsm.AddNamespace(“SOAP-ENV”, “http://schemas.xmlsoap.org/soap/envelope/”);
nsm.AddNamespace(“ns1”, “http://schemas.xmlsoap.org/wsdl/soap/”);
nsm.AddNamespace(“xsd”, “http://www.w3.org/2001/XMLSchema”);
nsm.AddNamespace(“xsi”, “http://www.w3.org/2001/XMLSchema-instance”);
nsm.AddNamespace(“SOAP-ENC”, “http://schemas.xmlsoap.org/soap/encoding/”);
nsm.AddNamespace(“ns2”, “http://xml.apache.org/xml-soap”);
nsm.AddNamespace(“ns3”, “http://www.example.org/myns/”);

XmlNode node = xdoc.SelectSingleNode(“/SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:metodo1/return/property1”,nsm);

 

Saludos

PD. Recomendado

http://www.freeformatter.com/xpath-tester.html#ad-output

 

Errores relacionados

‘XElement’ does not contain a definition for ‘XPathSelectElements’ and no extension method ‘XPathSelectElements’ accepting a first argument of type ‘XElement’ could be found (are you missing a using directive or an assembly reference?

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: