|
I have a html editor which replaces all the \r\n with <br /> . Now the problem is that it replaces every line with <br /> which make sense, But I do not want it to replace with some tags like ul, ol, li, br, hr. I'm sure I can do that with regex but you know its sort of like learning a new language. I tried many times but I'm not pro yet. In this case I have no idea where to start. So can anyone help ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
Well, I'm not trying to parse but replace the \r\n in specific places.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
That's how it starts...
Detecting the parts you don't want to affect will require parsing won't it?
|
|
|
|
|
Oh thanks that helped a lot.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Seriously, you're going to have to parse the HTML to detect if the newline characters are in the tags you specified. It would be best if you used an HTML parsing library for this.
|
|
|
|
|
aspdotnetdev wrote: Seriously, you're going to have to parse the HTML to detect if the newline characters are in the tags you specified.
Really ? what if I can do that without parsing...I just got an idea, will try it. I hope it'll work.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
If you can do it without parsing, then more power to you. Post the solution back here so we can all learn from you.
|
|
|
|
|
aspdotnetdev wrote: Post the solution back here
Of course...besides as I said its just a rough idea that came to mind, I'm not completely sure it will work but I can hope
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You may laugh on it, or say its a bad way to do but what can I do ? I have only this that works
string[] htmlLines = @"<h1>Heading 1</h1>
<p>Some paras</p>
<br />
<hr />
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<img src=""/somedirectory/abcd.png"" />
Some asdfdhjfsdkhfjk cxmvnxc,vm n,mnjshkj fsdf sdfklj xvxcvxc vx <code>asdajsdklas jdlkdalkl</code> xcjvkflj
sdf
sdf
sd
fsd
fsf
cv".Split('\n');
string[] ignoreEnds = new string[] { "ol>", "ul>", "li>", "hr />", "br />", "h1>", "h2>", "h3>", "h4>", "h5>", "h6>" };
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int a = 0; a < htmlLines.Length; a++)
{
string newLine = htmlLines[a].TrimEnd('\r');
bool appendBr = true;
for (int b = 0; b < ignoreEnds.Length; b++)
{
if (newLine.EndsWith(ignoreEnds[b]))
{
appendBr = false;
break;
}
}
if (appendBr)
newLine += "<br />";
else
newLine += "\r\n";
sb.Append(newLine);
}
string html = sb.ToString();
|
|
|
|
|
That would only work with HTML formatted in a very specific way. But if you control the HTML and it is always formatted that way, then go for it.
|
|
|
|
|
yupp thats why its a rough solution, besides it will execute on formatted html.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I'm trying to understand why part of my code will not work, on a partial class from a (service) EDM object table on the clientside. So here is the code:
public partial class tblSOM_Supplier
{
#region IDataErrorInfo Members
public string Error
{
get { return ValidationHelper.GetError(SelfValidate()); }
}
public string this[string columnName]
{
get
{
var __ValidationResults = SelfValidate();
if (__ValidationResults == null) return string.Empty;
var __ColumnResults = __ValidationResults.Errors.FirstOrDefault<ValidationFailure>(x => string.Compare(x.PropertyName, columnName, true) == 0);
return __ColumnResults != null ? __ColumnResults.ErrorMessage : string.Empty;
}
}
#endregion
} The problem is the public string this[string columnName] part. It doesn't recognise any of the properties from the table tblSOM_Supplier
If I add a property
public String ThisTestProperty { get; set; } to this partial class then it works exactly as it should! (Showing validation error on the TextBox)
How can I get the EDM properties to function correctly in this modified partial class?
|
|
|
|
|
I now worked this out. I just needed to add IDataErrorInfo to the partial class!
Simple really...
I now have a project that validates data entry using FluentValidation, on Entity Data Model tables, in a MVVM project using WCF services! yippie......
If I get the time, this will be my first article, me thinks
|
|
|
|
|
|
|
I did post yesterday and no response - and usually seem like a very long time before a response. The program I took over coding was written with Sandgrid and can't switch over to MS framework grid
This place is great almost instant responses and I love codeproject.
|
|
|
|
|
Strange - I have found that they normally respond quite quickly (normally within 24 hours)
|
|
|
|
|
Did you bothered reading post#2 on top?
|
|
|
|
|
Which post are you talking about? as in the reply to my being post #2.. Ive replied
but I have long support times for posting on Divelements forums... Im looking to see what I can do if lets say we were using MS Grid
|
|
|
|
|
"How to get answer to your question?"
"Re:", what kind of subject is that?
|
|
|
|
|
Oops forgot subject. Edited post
|
|
|
|
|
I take it you didn't see rule #6: Do not remove or empty a message if others have replied.
|
|
|
|
|
For those curious, the original question (before the author removed it) was:
o0romeo0o wrote: Currently I have a grid that fills rows a certain color when a certain condition is met (its a Grid from Divelements but similiar to MS)
protected override void DrawRowBackground(Divelements.SandGrid.Rendering.RenderingContext context)
MasterListItem M = this.DataItem as MasterListItem;
if (M.Flags == 1)
{
context.Graphics.FillRectangle(Brushes.LightYellow, this.Bounds);
}
base.DrawRowBackground(context);
How do I specify this to only drawRowBackground on 1 specified column instead of the whole row of columns.?
any example code?
|
|
|
|
|
Hi
Im playing videos using directshow but when I minimize the form and then bring it back to normal the video seems to disapear. Anyone know why?
Thanx
|
|
|
|