Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

SelectSingleNode throwing exception:

Hi,

 

I have following XML which I need to modify and invoke a http request

I need to select a node but I am getting "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function." Error

I am trying to access the <CUSTOMER/> tag with following code:

 

requestXmlDocument.SelectSingleNode("/SOAP-ENV:Envelope/SOAP-ENV:Body/m:MT_MaterialSearchRequest/" + XmlNodeName.CUSTOMER).InnerText
                       = some value;

Please consider following tags before giving answer:

• <SOAP-ENV:Envelope

• <SOAP-ENV:Body

• <m:MT_MaterialSearchRequest

 

 

Following is the Xml:

[highlight=xml]

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

<m:MT_MaterialSearchRequest xmlns:m="http://br.eu/tl/v2">

<CUSTOMER/>

<SALES_ORG/>

<DISTR_CHAN/>

<DIVISION/>

<SEARCH_RESULT_SIZE/>

<DEFAULT_SORTING/>

<RESULT_TYPE>R</RESULT_TYPE>

<REQ_DATE/>

<REQ_QTY/>

<SALES_UNIT/>

<SEARCH_PARAM_IN>

<AGG_SEARCH/>

<COMMERCIAL_CODE/>

<DESCRIPTION/>

<WIDTH/>

<SERIE/>

<RIM/>

<LOAD_INDEX/>

<SPEED_SYMBOL/>

<PATTERN/>

<TUBE_TYPE/>

<BRAND/>

<HIERARCHY/>

</SEARCH_PARAM_IN>

<VISIBILITY_ITEM_IN>

<ITEM>

<ITM_NUMBER/>

<MATERIAL idtype=""/>

<REQ_QTY/>

<SALES_UNIT/>

<REQ_DATE/>

</ITEM>

</VISIBILITY_ITEM_IN>

</m:MT_MaterialSearchRequest>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

[/highlight]

 

I think I have to use XmlNamespaceManager, but I am not getting how do I use it in this case when there are following three tags in the xmldocument.

• <SOAP-ENV:Envelope

• <SOAP-ENV:Body

• <m:MT_MaterialSearchRequest

 

 

 

Thanks in advance,

Anup

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...