Reading XML

braveheartleo81

New Member
I know that the following will read an XML document:<BR>dim reader as XmlTextReader<BR>reader = new XmlTextReader ("c:xmlooks.xml")<BR><BR>But, I need to be able to read a document that is online (within our intranet) as opposed to a local .xml file.. Any ideas?reader = new XmlTextReader (strURL)<BR>What if the file does not end with the .xml extension(but it is in fact an xml file)?<BR>For instance, the file that I am trying to read is something like http://doc.somedoc.com/html/documentwithextension?x=*Why don't you try it and see what happens. I just did it for:<BR>http://LocalHost/GUI35_NET/XslFile1.xsl<BR>and it worked fine.I changed the extension of an XML file and ran this wth no problems:<BR><BR> private void Page_Load(object sender, System.EventArgs e)<BR> {<BR> XmlTextReader xtr = new XmlTextReader("http://LocalHost/GUI35_NET/XmlFile1.pop?foo=fart");<BR> while(xtr.Read())<BR> {<BR> if(xtr.NodeType == XmlNodeType.Text)<BR> Response.Write(xtr.Value + "<br/>");<BR> }<BR> xtr.Close();<BR> }<BR>I have tried it that way (although I am using ASP.NET with VB instead of C#). I can't seem to get it to work. Don't know if it is because the file is so large or what. But, assuming I can either get it to work, or that I have to save the file down to the server and rename it, can you tell me how i would go about getting it into a SQL db? And then, how would I keep the info updated?/? I mean, the xml file is ever-changing. But, we need a static view of the info about once a week. So, we need to capture it, enter it into our SQL db, then manipulate it. The following week, we'll have to do it again. But, can we just compare the differences??? Alot of questions I know.. sorry, I feel like such a moron.Ok...... First, when you say "I can't seem to get it to work", are you getting an error? Can you post relevant code?<BR><BR>Second, I am a little unclear about the rest of your post. Anyway, we run Oracle here and some of our tables hold XML. The type for the field is Long. I am not sure if they are sticking an XML string into the field of the actual Xml Object. I just whipped this up to show how I can pull the XML from the DB and save it to a file on my IIS Server:<BR><BR> private void testDbXml()<BR> {<BR> string strConn = ConfigurationSettings.AppSettings["njunConn"];<BR> string strXML = null;<BR> XmlDocument objXML = new XmlDocument();<BR> OleDbConnection objConn = new OleDbConnection(strConn);<BR> OleDbCommand objCmd = new OleDbCommand("SELECT XMLRULE FROM fid_crs_Rules WHERE ID = 7986", objConn);<BR> objConn.Open();<BR> strXML = objCmd.ExecuteScalar().ToString();<BR> objConn.Close();<BR> objConn.Dispose();<BR> objXML.LoadXml(strXML);<BR> objXML.Save(Server.MapPath("gotXML.xml"));<BR> objXML = null;<BR><BR> }<BR>Here is the code I am using. It returns a 404 error. Says it cannot find.<BR><BR>Dim objXML As Xml.XmlDocument = New Xml.XmlDocument()<BR> Dim strXML<BR> strXML = "http://amrmw.acc.com/ods/int/cel?ManagementDomain=*&LastChangeTime=*"<BR> objXML.Load(strXML)<BR> objXML.Save("gotXML.xml")<BR><BR>How can I read that url into a objXML.Read or objXML.Load???
 
Back
Top