Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
Y

yonidebest

@yonidebest
About
Posts
17
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Special characters in XML properties
    Y yonidebest

    Thanks. For some reason, the ISO-8859-1 wasn't enough, so I changed it to ISO-8859-8. Yoni

    C# xml help question

  • Special characters in XML properties
    Y yonidebest

    I have an XML with non-english characters in the property name. My XML is something like this: 10,000,000 Now, instead of "New York", I have "ניו יורק", which is NY in Hebrew. Unfortunately, I cannot change this, and the problem is that the code won't recognize it. The code: XmlDocument doc = new XmlDocument(); doc.Load("C:\pop.xml"); XmlNode xml = doc.DocumentElement; string pop = xml.SelectSingleNode("/file/city[@name='" + cityName + "']/pop").InnerText; Where cityName is New York in Hebrew. I tried changing the NY in all places to English - and the code worked, so I guess it's the Hebrew that is doing the problem. Any idea how I can resolve this? Thanks, Yoni

    C# xml help question

  • Reading an XML file
    Y yonidebest

    ahhh Thanks! Indeed - it did have a position - I looked it up in the XML and found a name with a quote in it :-) I'll escape it. Many thanks, Yoni

    C# question xml

  • Reading an XML file
    Y yonidebest

    No, it isn't just six lines. It's similar tho - many more cities and many more elements. Now that you mention it - it has a first line: Could it be this? -- modified at 21:29 Tuesday 12th December, 2006

    C# question xml

  • Reading an XML file
    Y yonidebest

    Thanks. New problem :-) I get a "XmlException: '?' is an unexpected token. Expecting white space" exception. doh. Any ideas? Thanks again, Yoni

    C# question xml

  • Reading an XML file
    Y yonidebest

    Thanks, but I can't change the XML so easily - I found a VB code on the net that converts an excel file to an xml file. It isn't flexible. the city tags represent a row in an excel. can't rename them. Thanks anyway, I might use this in the future. Yoni

    C# question xml

  • Reading an XML file
    Y yonidebest

    Thanks - this looks like what I was looking for. Problem is that I have a problem: My XML is a file, not a string variable. i.e. this doesn't work: XmlDocument doc = new XmlDocument(); doc.LoadXml(@"c:\myfile.xml"); String PopOfMiami = doc.SelectSingleNode("/cities/city[@name='Miami']/population").InnerText; I looked around for a way around this, trying to give LoadXml a XmlReader and XmlTextReader, but nothing. How can I load my XML file and then do the select? Thanks, Yoni

    C# question xml

  • Reading an XML file
    Y yonidebest

    I looked all over the web for an easy way to read an XML file, with no success. Most places I found used the XmlTextReader.Read() method, which I don't find easy to use if I dont wanna go thru the whole file. This is what I am looking for. Say I have the following XML file: 10,000,000 1.2 7,000,000 2.4 and I would like to access Miami's population element (and get the 7,000,000 string) something like this (I have invent the names of the methods - the final question follows these exampls): string PopulationOfMiami = xmlfile["Miami"].population; or perhaps: string PopulationOfMiami = xmlfile["Miami"].population.value; or perhaps: string PopulationOfMiami = xmlfile["Miami"].ElementSon("population").value; or perhaps: string PopulationOfMiami = xmlfile.findNameAttribute("Miami").population.value; I want access to my XML file in a similar form in one of the above fashioned-way. Does anyone know of real methods and class that work like above? I hope I explained myself OK :doh:. Thanks, Yoni

    C# question xml

  • Run query in MS Access and get requested data
    Y yonidebest

    Thanks, Yoni

    C# database question help

  • Run query in MS Access and get requested data
    Y yonidebest

    Hi, I have an MS Access table and I wish to get information into a DataSet or DataTable using a SQL query. This is my code:

    string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"DataSource=C:\Program Files\Wiki\WikiProject.mdb";
    // All_Data is the name of the table; City is the name of the Column; and New York is the row I want
    string commandString = "SELECT All_Data.* FROM All_Data WHERE ((All_Data.City)=New_York)";
    OleDbConnection con = new OleDbConnection(connectionString);
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(commandString, con);

    DataSet ds = new DataSet();
    dataAdapter.Fill(ds, "All_Data");

    The error I get is "Could not find installable ISAM". How can I solve this error? or - Is there another way to get a specific line from a MS Access table? Thanks, Yoni

    C# database question help

  • Out-of-memory Exception
    Y yonidebest

    Thanks for the tip, I'll check out Microsoft's site.. Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    Thanks, I am aware of the try-catch statement, tho it didnt help me so much. Anyway, the problem with the regex has been fixed. The VC# Express is actually a VC++ Express, but I guess C# will work there as well. Thanks for your help, Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    Thanks for your help. It turns out the regex was a problem. Indeed - the "\\|" in the regex worked. And regarding 3 you were also correct, just a | did the job as well and made the code more readable. Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    Hi, Thanks for your help. What do you mean "Just print the length or the content"? lenght of content of what? p.text? Regarding the regular expression, I have pipes because the text has pipes. i.e. that's what I want to replace. When I tried to escape them using "\", the compiler gave me an error - unrecognized escape character. I then tried using "@" but it jammed with an Out-of-memory Exception. I then moved on to a Hex escape, which also gives me this exepction. Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    I am using the DotNetWikiBot framework[^]. p is of type Page. I dont think this is the problem, since p.text is of type String. Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    I am new to C#. I use a text writer called EditPlus to edit the code; and MSDOS to compile it and make an exe out of it. All I get is the exception. I do not know what the "call stack for the exception" or else enything else. I do know that the OutOfMemoryException apears every time I run the program, and every time at i=3. I can also add that i=0 and i=1 goes through quick, less than half a second; i=2 has a small delay, of like half a second, and then i=3 just stalls. I have the free Visual C++ 2005 Express but I have no idea how to use it (i.e. how to load my .cs file). I know this sound hopeless, but I really do not see a way out of this... Thanks, Yoni

    C# data-structures regex performance help question

  • Out-of-memory Exception
    Y yonidebest

    Hi, I get the above exception while using my code and I really do not know why. The code creates a jagged string array which includes two arrays. Each array holds 20 string items. (In the following code I removed some of it as to not overload this page...). I then use a for statement (it made en exception using foreach as well), inwhich I create a new Regex variable and use it to replace text. The code is:

    string[][] newInfo = new string[2][];
    newInfo[0] = new string[20] {"string 1", "string 2", "string 3", ... }; // 20 of them
    newInfo[1] = new string[20] {"string 1", "string 2", "string 3", ... }; // 20 of them
    for (int i = 0; i < newInfo[0].Length; i++) {
    string parameter = newInfo[0][i];
    string value = newInfo[1][Array.IndexOf(newInfo[0], parameter)];
    if (value != "-")
    {
    Regex rxParameter = new Regex("\x7C" + parameter + "=" + ".*" + "\x7C"); // \x7C is a pipe (|)
    p.text = rxParameter.Replace(p.text, "\x7C" + parameter + "=" + value + "\x7C");
    }
    }

    After compiling and running this, the program get stuck at i=3, at the replace function. I dont know why the program is out of memory. Does anyone know what I should do? Thanks, Yoni

    C# data-structures regex performance help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups