|
XML is coming from a Legacy system which is pushing out xml for dynamic form generation.
I understand the "read the xml and iterate through the nodes concept", however, I was wondering if there is a better/simpler way, then just looping through the nodes, like maybe using Xpath or what have you. But thanks for the help I appreciate it.
|
|
|
|
|
hi
is that anyWay that convert html docs (include images,styles,...) to a single xml file ?
thanks.
|
|
|
|
|
hdv212,
Why would you want to do this?, HTML is already in a tag based language...
Regards,
Gareth.
|
|
|
|
|
hi Gareth
i want to save html files to database completely (include images,styles,...) and i can search in text
and display result corresponding to search keyword.
|
|
|
|
|
hdv212,
Didn't you already ask this question a few days ago?, Or was that someone else?
To do this would be more hassle than its worth. It would be much easier to save the HTML file to a server dir and store the location in the db and then search that file.
Regards,
Gareth.
|
|
|
|
|
There are parsers that attempt to turn HTML into XHTML. Of course, they won't 'include' any images, just tags that refer to them. It's theoretically possible to stuff images into a CDATA section, but the resultant file would no longer be HTML.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
if there is not anyWay to convert html files (include images,styles,...) to a single xml file, is that anyWay that convert html to .doc format and save in sqlServer dataBase ?
and can i search text in it ?
thanks
|
|
|
|
|
Try saving the document to an MHT format - that's the same way you do it with File / Save As in IE. This[^] article might be a starting point for you.
|
|
|
|
|
Once you save in a format other than plain text, no, you can't search it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This isn't quite true. You can use Index Server to search content in other formats, even inside SQL Server using SQL Server commands like Freetext and Contains .
|
|
|
|
|
Hi guys. I am wanting to work with text files. Basically I want to read data from a fixed width text file selecting only certain fields. I have been searching everywhere but can't find any documentation on this. Can somebody please tell me where i can read up on this? I want to only select certain fields from the file and write that to say a multinline text box.
Any help would be greatly appreciated. I can read a full file into a text box but want to only select specific fileds.
|
|
|
|
|
I assume that the fields are placed at fixed locations. If so, you can use the Substring command on a string to get the fields at the relevant locations. You can read through the file using a StreamReader with the ReadToEnd method.
|
|
|
|
|
Read the file in 1-unit width at a time, and use the string.Substring method as indicated in the previous post. Do not, however, use StreamReader.ReadToEnd, unless you are absolutely certain that the input file size will be small enough so the entire file can be loaded into memory as a string.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Google for the FileHelpers library. There is also an article on it here on CP. It allows you to link class properties to specific text file fields.
|
|
|
|
|
I need this as an example for my new server and I really don't know how to do this in VB ... if you can help me someone
c# is here:
http://www.another-search.com/search-api/c-sharp-dot-net
|
|
|
|
|
Strip out the comments and summaries and your left with just a few lines
namespace XML_Dataset
{
public partial class Form1 : Form
{
private searchTable testSearchTable = new searchTable();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.dataGridView1.DataSource = this.testSearchTable.Tables["search"];
}
private void getDataFromAS_Click(object sender, EventArgs e)
{
this.testSearchTable.Clear();
this.testSearchTable.ReadXml(this.testXMLStringAddr.Text);
}
private void generateDatasetToFile_Click(object sender, EventArgs e)
{
System.IO.StreamWriter xmlSW = new System.IO.StreamWriter("testSearchTable.xml");
this.testSearchTable.WriteXml(xmlSW, XmlWriteMode.WriteSchema);
xmlSW.Close();
MessageBox.Show("XML Schema was generatoted to the file: testSearchTable.xml");
}
}
}
Have a look at MSDN for each statement and you'll find examples for both C# and VB, if not - GOOGLE!
You'll need to have the code or dll for the searchTable class that's referenced near the top.
Dave
|
|
|
|
|
(I used Instant VB, but any converter would have been able to handle this)
Namespace XML_Dataset
Partial Public Class Form1
Inherits Form
Private testSearchTable As New searchTable()
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Me.dataGridView1.DataSource = Me.testSearchTable.Tables("search")
End Sub
Private Sub getDataFromAS_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.testSearchTable.Clear()
Me.testSearchTable.ReadXml(Me.testXMLStringAddr.Text)
End Sub
Private Sub generateDatasetToFile_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim xmlSW As New System.IO.StreamWriter("testSearchTable.xml")
Me.testSearchTable.WriteXml(xmlSW, XmlWriteMode.WriteSchema)
xmlSW.Close()
MessageBox.Show("XML Schema was generatoted to the file: testSearchTable.xml")
End Sub
End Class
End Namespace
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
Java to VB & C# Converter: convert Java to VB or C#
|
|
|
|
|
I have a windows application that sends out an email to a person when it reaches the necessarry point. Inside the email there is a link to the application, when the user clicks this the application opens. My problem is I need to be able to send this application an argument on startup so when the user clicks this link the application will open, parse the argument and show the appropriate record (this is based on the argument sent). Does anyone know if this is possible. Thanks for you help.
Thanks
Matt
|
|
|
|
|
Hi,
I need to write some log info out of my app and into a text file.
I might not be doing this the right way so let me know if im not, basically I want to write to a text file but when I deploy the package I want the text file to write to the location of the app ie like (c:/program files/my application/log).
I added a text file to resources.resx called Log.txt.
Ive set the properties(build action) of the text file as content as i want to be able to access this data.
how do i write to this file?
i got something like this but it dont work
FileInfo fi = new FileInfo(Properties.Resources.Elog);
if (fi.Exists.Equals(true))
{
ResourceManager rm = new ResourceManager();
FileStream fsWrite = new FileStream(Properties.Resources.Elog, FileMode.Append);
StreamWriter sw = new StreamWriter(fsWrite);
sw.WriteLine(DateTime.Now + ":" + xInternalError);
sw.Close();
}
|
|
|
|
|
Is "fi.Exists" always coming back as false? Why not do the following:
using (FileStream fs = new FileStream("Log.txt", FileMode.Append, FileAccess.Write, FileShare.None) {
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(...);
sw.Close();
} Won't Log.txt then appear in your application directory?
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hey, yeah it never works its always false.
I suppose what im getting at is that when I come to deploy/install the application I wont no the location to write the log file to, I mean there is some-way obviosuly, but I dont know how to do it myself.
all I want to do is say ok where ever this user installs the application I want a folder where the exe is located ie
c:/program files/myApp/app.exe
then create a folder
c:/program files/myApp/Log/
and write a log file log.txt to that folder.
I think im making a pigs ear out of this, guidance and examples are greatly welcomed.
|
|
|
|
|
Application.StartupPath will give you the folder path where the executable is present.
I suggest you to use Application.UserAppDataPath as it will provide the application data folder of the user and will be user specific.
*jaans
|
|
|
|
|
IIRC, embedded resources are read-only and you wont be able to write anything to it.
*jaans
|
|
|
|
|
|
Hi,
I am searching for some well-organized training materials that I could use to learn C# fairly rapidly. The AppDev stuff looks good, but is real expensive bought new. If anybody has any courses that they have used and found valuable that they would be willing to sell, please contact me!
Thanks to all.
John
|
|
|
|