Re: target namespace

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Richard Blewett [DevelopMentor] (richardb_at_NOSPAMdevelop.com)
Date: 01/18/05


To: microsoft.public.biztalk.general
Date: Tue, 18 Jan 2005 15:07:23 -0800

Can you provide a document as well as the code so I can test this and find a solution?

 Regards

 Richard Blewett - DevelopMentor
 http://www.dotnetconsult.co.uk/weblog
 http://www.dotnetconsult.co.uk

   Thank you for bringing this up. We have come as far as you describe, but get
 nothing at SelectSingleNode (code provided below).
 
 1) We fail to extract the prefix.
 (It could be "ns0", "ns1" or something else set by Biztalk.)
 Other discussions outside technet assume you know the prefix, but since this
 is set by Biztalk, any common parser would have to read it.
 
 2) We fail to select a node with a namespace even if providing prefix.
 
 ( Probably not an option, but how did you remove the namespaces from the
 XML? )
 
 Does this relate to the following bug? The workaround also fails.
 http://support.microsoft.com/default.aspx?scid=kb;en-us;324996
 
 Regards,
 David
 
 Function GetXMLData(ByRef xmlDoc As Xml.XmlDocument, ByVal strXPath As
 String, ByVal strTag As String) As String
 Dim strReturn As String
 Dim nsmgr As XmlNamespaceManager = New
 XmlNamespaceManager(xmlDoc.NameTable)
 Dim objXmlNode As XmlNode
 Dim strPrefix As String
 Dim strUri As String
 Try
 strPrefix = xmlDoc.Prefix ' ""
 strUri = xmlDoc.DocumentElement.NamespaceURI() ' will return
 actual URI
 'nsmgr.AddNamespace(strPrefix, strUri)
 nsmgr.AddNamespace("ns0", strUri)
 'objXmlNode = xmlDoc.SelectSingleNode(strXPath & strTag, nsmgr)
 'Nothing
 'objXmlNode = xmlDoc.SelectSingleNode("TransactionId") 'Nothing
 'objXmlNode = xmlDoc.SelectSingleNode("ns0:TransactionId",
 nsmgr) 'Nothing
 objXmlNode = xmlDoc.SelectSingleNode("TransactionId", nsmgr)
 'Nothing
 If objXmlNode Is Nothing Then
 Throw New Exception("")
 Else
 strReturn = objXmlNode.InnerText.ToString
 End If
 Return strReturn
 Catch ex As Exception
 Throw New Exception("")
 End Try
 End Function
 
 
 --
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005

 
 [microsoft.public.biztalk.general]



Relevant Pages

  • Re: Put parentheses around figures
    ... numbers in brackets are typically regarded as -ve. ... Regards, Andreas ... Dim ws As Worksheet ... Function fnRegEx(str As String, ...
    (microsoft.public.excel.programming)
  • RE: Save As in a Macro
    ... Il mio ultimo lavoro ... ... Dim s As String ... sNew As String) As String ...
    (microsoft.public.excel.programming)
  • Re: Save Excel file into PDF file............
    ... Best regards. ... "Tom Ogilvy" wrote: ... >> Dim Boring As String ... >> Dim sFilename As String ...
    (microsoft.public.excel.programming)
  • Re: Selecting multiple files and send them via email??
    ... >Here is some VBA that will work if you are using Outlook ... >Function GetAttachments(strIn As String) As String ... >Dim oApp As Outlook.Application ... >> kind regards ...
    (microsoft.public.access.formscoding)
  • Re: Header/Footer question
    ... > Dim szSheetName As String ... >> Regards. ... >> Outgoing mail is certified Virus Free. ...
    (microsoft.public.excel.printing)