?
Solved

XML Generation wont allow me to add line (DTD)

Posted on 2010-01-12
25
Medium Priority
?
494 Views
Last Modified: 2012-06-27
If i run the attached code i get:

Server Error in '/Fixedline' Application.
--------------------------------------------------------------------------------

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 63.246.7.75:80

However if i remove the line:

doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "http://www.######/dtd/######-beans.dtd", Nothing)

It works, any ideas?
Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            xmldecl.Encoding = "UTF-8"
            xmldecl.Standalone = ""
            doc.AppendChild(xmldecl)
            ' Create DocType line
            Dim doctype As XmlDocumentType
            Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")
            Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            xmldecl.Encoding = "UTF-8"
            xmldecl.Standalone = ""
            doc.AppendChild(xmldecl)
            ' Create DocType line
            Dim doctype As XmlDocumentType
            Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")
            doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "http://www.######/dtd/######-beans.dtd", Nothing)
            doctype = doc.CreateDocumentType("beans", Nothing, Nothing, Nothing)
            doc.AppendChild(doctype)
            ' Create Comment Line
            Dim comment As XmlNode = doc.CreateComment("Devices")
            doc.AppendChild(comment)
            Dim bookNode As XmlNode = CreateBookNode(doc)
            Dim bookNode2 As XmlNode = CreateBookNode2(doc)
            Dim bookNode3 As XmlNode = CreateBookNode3(doc)
            'Append the book node to the bookstore node 
            bookstoreNode__2.AppendChild(bookNode)
            bookstoreNode__2.AppendChild(bookNode2)
            bookstoreNode__2.AppendChild(bookNode3)
            'Append the bookstore node to the document 
            doc.AppendChild(bookstoreNode__2)
            lblResult.Text = "XML Document has been successfully created"
            doctype = doc.CreateDocumentType("beans", Nothing, Nothing, Nothing)
            doc.AppendChild(doctype)
            ' Create Comment Line
            Dim comment As XmlNode = doc.CreateComment("Devices")
            doc.AppendChild(comment)
            Dim bookNode As XmlNode = CreateBookNode(doc)
            Dim bookNode2 As XmlNode = CreateBookNode2(doc)
            Dim bookNode3 As XmlNode = CreateBookNode3(doc)
            'Append the book node to the bookstore node 
            bookstoreNode__2.AppendChild(bookNode)
            bookstoreNode__2.AppendChild(bookNode2)
            bookstoreNode__2.AppendChild(bookNode3)
            'Append the bookstore node to the document 
            doc.AppendChild(bookstoreNode__2)
            lblResult.Text = "XML Document has been successfully created"

Open in new window

0
Comment
Question by:sadshead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 12
25 Comments
 
LVL 1

Author Comment

by:sadshead
ID: 26293552
Full error message:
Server Error in '/knowledge/Applications/FixedLine' Application.
--------------------------------------------------------------------------------

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Source Error: 


Line 41:             Dim doctype As XmlDocumentType
Line 42:             Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")
Line 43:             doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "http://www.###########.org/dtd/######-beans.dtd", Nothing)
Line 44:             doctype = doc.CreateDocumentType("beans", Nothing, Nothing, Nothing)
Line 45:             doc.AppendChild(doctype)
 

Source File: D:\Inetpub\CTi\knowledge\applications\fixedline\onenet\xml\Default.aspx.vb    Line: 43 

Stack Trace: 


[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1028066
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetResponse() +1529755
   System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +61
   System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +1865280
   System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +51
   System.Xml.XmlTextReaderImpl.OpenStream(Uri uri) +30
   System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId) +382
   System.Xml.DtdParserProxy.System.Xml.IDtdParserAdapter.PushExternalSubset(String systemId, String publicId) +16
   System.Xml.DtdParser.ParseExternalSubset() +18
   System.Xml.DtdParser.ParseFreeFloatingDtd() +54
   System.Xml.DtdParser.Parse(Boolean saveInternalSubset) +1331362
   System.Xml.DtdParser.Parse(XmlNameTable nt, XmlNamespaceManager nsManager, Boolean namespaces, String baseUri, String docTypeName, String publicId, String systemId, String internalSubset, Boolean useResolver, XmlResolver resolver) +239
   System.Xml.XmlLoader.ParseDocumentType(XmlDocumentType dtNode, Boolean bUseResolver, XmlResolver resolver) +105
   System.Xml.XmlLoader.ParseDocumentType(XmlDocumentType dtNode) +54
   System.Xml.XmlDocumentType..ctor(String name, String publicId, String systemId, String internalSubset, XmlDocument doc) +205
   System.Xml.XmlDocument.CreateDocumentType(String name, String publicId, String systemId, String internalSubset) +40
   onenet_xml_Default.btnSave_Click(Object sender, EventArgs e) in D:\Inetpub\CTi\knowledge\applications\fixedline\onenet\xml\Default.aspx.vb:43
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

Open in new window

0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26306368
The URL specified in systemID parameter of CreateDocumentType has to point to valid external document type definitions.
0
 
LVL 1

Author Comment

by:sadshead
ID: 26312116
I am new to XML what does the DTD file do and why do i need it?

Basically i have written this script to create a document automatically, where as we normally pay a third party to create it for us. This is the only line that i cant add.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Expert Comment

by:PaulHews
ID: 26314027
>I am new to XML what does the DTD file do and why do i need it?

The document type definition contains schema information for the XML file.  Whether you need it or not depends on who or what is the consumer of your XML, and whether it can be consumed without that extra layer of schema validation.  
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26314080
In essence, I would try leaving it out and seeing if you can still use the resulting document.  If the URL is non-functional, then it shouldn't actually be providing any extra schema validation anyway.
0
 
LVL 1

Author Comment

by:sadshead
ID: 26321995
Apparently that line must be in the outputted XML document but whenever i try to add it in i get:

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ##.246.7.75:80"

If i change it to:

doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "", Nothing)

it goes through fine so its the http:// bit
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26323230
>it goes through fine so its the http:// bit

That is what I said in http:#a26306368  That has to be a valid URL.

Either leave it out, or add it in through string manipulation, as in this sample.


doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing)

doc.AppendChild(doctype)
doc.AppendChild(doc.CreateElement("root"))

'String replacement to add URL to doctype
Dim doctypestring As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">"
Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.###########.org/dtd/######-beans.dtd"">"
'We can't parse the document with the changed doctype, because it will result in the same error.  
'So instead, write the XML to file or to stream or whereever it needs to go
My.Computer.FileSystem.WriteAllText("C:\temp\test.xml", doc.InnerXml.Replace(doctypestring, doctypestringURL), False)

Open in new window

0
 
LVL 1

Author Comment

by:sadshead
ID: 26323722
Thanks Paul,
This looks like exactly what i need i have added it into my code as per the code attached below

I'm now getting "This document already has a 'DocumentElement' node. "

            Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            xmldecl.Encoding = "UTF-8"
            xmldecl.Standalone = ""
            doc.AppendChild(xmldecl)
            ' Create DocType line
            Dim doctype As XmlDocumentType
            Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")
           
            doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing)

            doc.AppendChild(doctype)
            doc.AppendChild(doc.CreateElement("root"))

            'String replacement to add URL to doctype 
            Dim doctypestring As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">"
            Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.#######.org/dtd/spring-beans.dtd"">"
            'We can't parse the document with the changed doctype, because it will result in the same error.   
            'So instead, write the XML to file or to stream or whereever it needs to go 
            My.Computer.FileSystem.WriteAllText("C:\temp\test.xml", doc.InnerXml.Replace(doctypestring, doctypestringURL), False)
            ' Create Comment Line
            Dim comment As XmlNode = doc.CreateComment("Devices")
            doc.AppendChild(comment)
            Dim bookNode As XmlNode = CreateBookNode(doc)
            Dim bookNode2 As XmlNode = CreateBookNode2(doc)
            Dim bookNode3 As XmlNode = CreateBookNode3(doc)
            'Append the book node to the bookstore node 
            bookstoreNode__2.AppendChild(bookNode)
            bookstoreNode__2.AppendChild(bookNode2)
            bookstoreNode__2.AppendChild(bookNode3)
            'Append the bookstore node to the document 
            doc.AppendChild(bookstoreNode__2)
            lblResult.Text = "XML Document has been successfully created"
        doc.Save(xmlPath)

Open in new window

0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 26323943
>I'm now getting "This document already has a 'DocumentElement' node. "

This means you are adding multiple root nodes.  You pasted my code in without understanding what it was doing.  What I specified in my code should be the very last thing you do, because you can't manipulate the document any more afterwards.


Dim xmldecl As XmlDeclaration
        xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
        xmldecl.Encoding = "UTF-8"
        xmldecl.Standalone = ""
        doc.AppendChild(xmldecl)
        ' Create DocType line
        Dim doctype As XmlDocumentType
        Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")

        doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing)

        doc.AppendChild(doctype)
        
        'String replacement to add URL to doctype 
       
        ' Create Comment Line
        Dim comment As XmlNode = doc.CreateComment("Devices")
        doc.AppendChild(comment)
        Dim bookNode As XmlNode = CreateBookNode(doc)
        Dim bookNode2 As XmlNode = CreateBookNode2(doc)
        Dim bookNode3 As XmlNode = CreateBookNode3(doc)
        'Append the book node to the bookstore node 
        bookstoreNode__2.AppendChild(bookNode)
        bookstoreNode__2.AppendChild(bookNode2)
        bookstoreNode__2.AppendChild(bookNode3)
        'Append the bookstore node to the document 
        doc.AppendChild(bookstoreNode__2)
        lblResult.Text = "XML Document has been successfully created"

        Dim doctypestring As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">"
        Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.#######.org/dtd/spring-beans.dtd"">"
        'We can't parse the document with the changed doctype, because it will result in the same error.   
        'So instead, write the XML to file or to stream or whereever it needs to go 
        My.Computer.FileSystem.WriteAllText(xmlpath, doc.InnerXml.Replace(doctypestring, doctypestringURL), False)

Open in new window

0
 
LVL 1

Author Comment

by:sadshead
ID: 26324519
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
An XML element is not allowed inside a DTD. Error processing resource 'http://www./#######.org/dtd/spring-beans.dtd'.
0
 
LVL 1

Author Comment

by:sadshead
ID: 26324531
opens up and is correct in notepad but generates the above error if opened in IE
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26324708
If you are using #### to hide the actual URL, try using the proper URL instead in your code.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26324733
doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "http://www.springframework.org/dtd/spring-beans.dtd", Nothing)

This doesn't create the error....
0
 
LVL 1

Author Comment

by:sadshead
ID: 26351617
Hi Paul
I have attached my current code... appologies for the delay in following this up.

What i am now getting in my xml document is:

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">

Many thanks for all your assistance so far.



           Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            xmldecl.Encoding = "UTF-8"
            xmldecl.Standalone = ""
            doc.AppendChild(xmldecl)
            ' Create DocType line
            Dim doctype As XmlDocumentType
            Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")

            doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing)

            doc.AppendChild(doctype)


            'String replacement to add URL to doctype 

            ' Create Comment Line
            Dim comment As XmlNode = doc.CreateComment("Devices")
            doc.AppendChild(comment)
            Dim bookNode As XmlNode = CreateBookNode(doc)
            Dim bookNode2 As XmlNode = CreateBookNode2(doc)
            Dim bookNode3 As XmlNode = CreateBookNode3(doc)
            'Append the book node to the bookstore node 
            bookstoreNode__2.AppendChild(bookNode)
            bookstoreNode__2.AppendChild(bookNode2)
            bookstoreNode__2.AppendChild(bookNode3)
            'Append the bookstore node to the document 
            doc.AppendChild(bookstoreNode__2)
            lblResult.Text = "XML Document has been successfully created"

            Dim doctypestring As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">"
            Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.#######.org/dtd/spring-beans.dtd"">"
            'We can't parse the document with the changed doctype, because it will result in the same error.   
            'So instead, write the XML to file or to stream or whereever it needs to go 
            My.Computer.FileSystem.WriteAllText(xmlPath, doc.InnerXml.Replace(doctypestring, doctypestringURL), False)

Open in new window

0
 
LVL 1

Author Comment

by:sadshead
ID: 26351633
Apologies Line 32 should read:

Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.springframework.org/dtd/spring-beans.dtd"">"

Same outcome.
 
Steve
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26353064
What are the problems when you use this?
Dim xmldecl As XmlDeclaration
xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
xmldecl.Encoding = "UTF-8"
xmldecl.Standalone = ""
doc.AppendChild(xmldecl)
' Create DocType line
Dim doctype As XmlDocumentType
Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")
doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", "http://www.springframework.org/dtd/spring-beans.dtd", Nothing)

doc.AppendChild(doctype)

' Create Comment Line
Dim comment As XmlNode = doc.CreateComment("Devices")
doc.AppendChild(comment)
Dim bookNode As XmlNode = CreateBookNode(doc)
Dim bookNode2 As XmlNode = CreateBookNode2(doc)
Dim bookNode3 As XmlNode = CreateBookNode3(doc)
'Append the book node to the bookstore node 
bookstoreNode__2.AppendChild(bookNode)
bookstoreNode__2.AppendChild(bookNode2)
bookstoreNode__2.AppendChild(bookNode3)
'Append the bookstore node to the document 
doc.AppendChild(bookstoreNode__2)
lblResult.Text = "XML Document has been successfully created"
doc.Save(xmlPath)

Open in new window

0
 
LVL 1

Author Comment

by:sadshead
ID: 26357868
The same as i had originally:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 63.###.7.75:80
0
 
LVL 1

Author Comment

by:sadshead
ID: 26357986
I have debugged the following line:


My.Computer.FileSystem.WriteAllText(xmlPath, doc.InnerXml.Replace(doctypestring, doctypestringURL), False)
And the value of  doctypestringURL is:
"<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"http://www.springframework.org/dtd/spring-beans.dtd">"
 
So its either not doc.InnerXml.Replacing or not WriteAllTexting i would assume the latter as what is written to the resulting file is effectivly doctypestring (<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">)
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26361016
>The same as i had originally:

That's an issue with connectivity with that address.  It works fine here.

The string replace code I posted above works, as I tested it.
0
 
LVL 1

Author Comment

by:sadshead
ID: 26361337
... but i can access that address if i paste it into my browser, i even added msgbox's in to display xmlpath, doctypestring and doctypestringURL all look absolutly fine.
I have tried a different URL and it still doesnt work!

Heres my code again:



Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            xmldecl.Encoding = "UTF-8"
            xmldecl.Standalone = ""
            doc.AppendChild(xmldecl)
            ' Create DocType line
            Dim doctype As XmlDocumentType
            Dim bookstoreNode__2 As XmlNode = doc.CreateElement("beans")

            doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing)

            doc.AppendChild(doctype)

            'String replacement to add URL to doctype 

            ' Create Comment Line
            Dim comment As XmlNode = doc.CreateComment("Devices")
            doc.AppendChild(comment)
            Dim bookNode As XmlNode = CreateBookNode(doc)
            Dim bookNode2 As XmlNode = CreateBookNode2(doc)
            Dim bookNode3 As XmlNode = CreateBookNode3(doc)
            'Append the book node to the bookstore node 
            bookstoreNode__2.AppendChild(bookNode)
            bookstoreNode__2.AppendChild(bookNode2)
            bookstoreNode__2.AppendChild(bookNode3)
            'Append the bookstore node to the document 
            doc.AppendChild(bookstoreNode__2)
            lblResult.Text = "XML Document has been successfully created"
            Dim doctypestring As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">"
            Dim doctypestringURL As String = "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.bbc.co.uk"">"
            MsgBox(xmlPath)
            MsgBox(doctypestring)
            MsgBox(doctypestringURL)
            My.Computer.FileSystem.WriteAllText(xmlPath, doc.InnerXml.Replace(doctypestring, doctypestringURL), False)

Open in new window

0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26361532
>... but i can access that address if i paste it into my browser

Likely a configuration problem with your system then.  Browser could be accessing the web via proxy, or security software blocking your application's network access.

The replacement code only works if the search string is contained properly in the document XML.  Do a debug.print for doc.InnerXML and compare the doctypestring variable with what is declared as the doctype within that.

If you are looking in Notepad, and the XML is properly formed, but it fails in IE, that could go back to the connectivity issue.
0
 
LVL 1

Author Comment

by:sadshead
ID: 26361751
As an example:

xmlpath = D:\Document and Settings\username\visual studio 2005\xml\snon--20-01-10.txt

doctypestring=<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">

doctypestringURL =<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.bbc.co.uk">

The resulting txt file when open in notepad displays the line as <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">

I think you may be correct and that it is not finding doctypestring to match anyline in the document created but i cannot see any difference between <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" ""> and doctype = doc.CreateDocumentType("beans", "-//SPRING//DTD BEAN//EN", Nothing, Nothing) apart from the quotation marks (").

0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26362085
Use this to check:

MsgBox(doc.InnerXml.Contains(doctypestring))

Should be true.
0
 
LVL 1

Author Closing Comment

by:sadshead
ID: 31676111
I decied to look at a different way of replacing the string in the txt document and got it working:

        Dim fso, inputFile, outputFile
        Dim str As String
        fso = CreateObject("Scripting.FileSystemObject")
        '1 means for reading
        inputFile = fso.OpenTextFile(xmlPath, 1)
        str = inputFile.ReadAll
        str = Replace(str, "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" """">", "<!DOCTYPE beans PUBLIC ""-//SPRING//DTD BEAN//EN"" ""http://www.springframework.org/dtd/spring-beans.dtd"">")
        inputFile.Close()
        'write back
        outputFile = fso.CreateTextFile(xmlPath, True)
        outputFile.Write(str)
        outputFile.close()

Many thanks for all your help and assistance Paul i wouldnt have got there without you!
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 26370144
Glad you got it sorted... I'm still confused why it wasn't working from the .NET environment.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question