Using VBNet 2002:
Any idea how I can get System.Xml.XmlDocument to ignore the !DocType referance in an XML string, without just deleting the offending referance prior to .LoadXml ?
Error Message: Could not find file "C:\Documents and Settings\lou\My Documents\Visual Studio Projects\Micro_Manage_AutoSubmit\bin\xpif-v2000.dtd".VB Code:
Dim mInFile As String Dim mPrepend As String Dim XMLReader As New System.Xml.XmlDocument() Dim mSpot1 As Integer Dim mSpot2 As Integer Dim mStrip1 As String Dim mStrip2 As String Dim mStrip3 As String mStrip1 = "<!DOCTYPE xpif SYSTEM " mStrip2 = ".dtd"">" mInFile = "G:\LuLu_Past_Jobs-Lou\LULU_INVESTIGATIONS_LOU\CC271100\Processed\CC271100-1_Cover_Libbed.pdf.prepended" If GET_XML_FROM_PREPENDED_FILE(mInFile, mPrepend) Then 'mSpot1 = mPrepend.IndexOf("<!DOCTYPE xpif SYSTEM ") 'If mSpot1 > -1 Then ' mSpot2 = mPrepend.IndexOf(mStrip2, mSpot1) ' If mSpot2 > -1 Then ' mStrip3 = mPrepend.Substring(mSpot1, mSpot2 + mStrip2.Length - mSpot1) ' mPrepend = mPrepend.Replace(mStrip3, "") ' End If 'End If XMLReader.LoadXml(mPrepend) If XMLReader.GetElementsByTagName("job-message-to-operator").Count = 1 Then MessageBox.Show(XMLReader.GetElementsByTagName("job-message-to-operator").ItemOf(0).InnerText) Else MessageBox.Show("MESSAGE TO OPERATOR {QUEUE} NOT FOUND") End If If XMLReader.GetElementsByTagName("autosend").Count = 1 Then MessageBox.Show("AUTOSEND=" & XMLReader.GetElementsByTagName("autosend").ItemOf(0).InnerText) Else MessageBox.Show("AUTOSEND NOT FOUND") End If Else MessageBox.Show("Failed! " & mPrepend) End If XMLReader = Nothing




Reply With Quote