Private Sub ExtractText_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles
ExtractText.Click
Dim xTractee As New Xml.XmlDocument
Dim xTraction As New Xml.XmlDocument
Dim xTractionNode As Xml.XmlNode
Dim resultNodes As Xml.XmlNodeList
Dim xtractorStatus As String
'Set
the properties of the Extraction Request ...
xTractee.LoadXml("<ExtractionRequest " & _
"ActivateHTML=""OFF"" " & _
"ActivateEmail=""OFF"" " & _
"PhrasesRequested=""10"" " & _
"LanguageID=""1"" " & _
"CharCodeID=""1"">" & _
"<EXTRACTEE >" & _
Me.Extractee.Text & _
"</EXTRACTEE>" & _
"</ExtractionRequest>")
'Process the Extraction Request.
'NOTE: Web Services by nature marshal
XML Documents as XML Nodes.
'
Pass in the first (and only) node in the document to the web
service.
'NOTE: Place your unique Application ID in the call below.
xTractionNode = Xtractor.ProcessXtraction("<Application ID From
DBI>", xTractee.FirstChild)
'Place the returned XML Node into the xTraction Document.
xTraction.AppendChild(xTraction.ImportNode(xTractionNode, True))
'Check the status of the Extraction
Request
xtractorStatus = xTractionNode.Attributes("ExtractionStatus").Value
If xtractorStatus = "1" Then
'Extraction
Successful
'Get
all of the Result Nodes.
'NOTE: In the
Extraction Request above we set PhrasesRequested to
resultNodes = xTraction.GetElementsByTagName("Result")
'Iterate
through the Result Nodes and print out the Key Phrases and Highlights.
Dim resultNode As Xml.XmlNode
For Each resultNode In resultNodes
Me.Extraction.Text = Me.Extraction.Text & _
"Key Word/Phrase: " & resultNode.Item("KeyPhrase").InnerText &
vbCrLf & _
"Highlight: " & resultNode.Item("KeyHighlight").InnerText &
vbCrLf & vbCrLf
Next ResultNode
Else
Me.Extraction.Text = "Error Encountered" & vbCrLf & vbCrLf
Me.Extraction.Text = Me.Extraction.Text & vbCrLf & "Extractor
returned a code of " + xtractorStatus
Me.Extraction.Text = Me.Extraction.Text & vbCrLf & vbCrLf &
xTractionNode.InnerText
End If
End Sub