Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing html taq from string

Status
Not open for further replies.

deejayAr

Technical User
Mar 20, 2008
126
0
0
US
I have a string
<ul id="workFlowList">
<li id="Daily"><h4 >Daily Tasks</h4><ul id="Daily_Sortable_List" name="Daily_Sortable_List" style="cursor: move"><li id="D_li_1" class="messages "><label class="cbl" for="D_chk_1"><input class="Tasks" TaskId="1" type="checkbox" name="D_chk_1" id="D_chk_1" checked /></label><label>Message Center</label></li>
<li id="D_li_2" class="send "><label class="cbl" for="D_chk_2"><input class="Tasks" TaskId="2" type="checkbox" name="D_chk_2" id="D_chk_2" checked /></label><label>Send/Receive</label></li>
<li id="D_li_3" class="work "><label class="cbl" for="D_chk_3"><input class="Tasks" TaskId="3" type="checkbox" name="D_chk_3" id="D_chk_3" checked /></label><label>Work Rejected Claims</label></li>
<li id="D_li_20" class="work "><label class="cbl" for="D_chk_20"><input class="Tasks" TaskId="20" type="checkbox" name="D_chk_20" id="D_chk_20" checked /></label><label>Gateway EDI Direct</label></li>
<li id="D_li_4" class="manage "><label class="cbl" for="D_chk_4"><input class="Tasks" TaskId="4" type="checkbox" name="D_chk_4" id="D_chk_4" checked /></label><label>View Insurance Payments</label></li>
<li id="D_li_5" class="check "><label class="cbl" for="D_chk_5"><input class="Tasks" TaskId="5" type="checkbox" name="D_chk_5" id="D_chk_5" checked /></label><label>Check Patient Eligibility</label></li>
<li id="D_li_6" class="payments "><label class="cbl" for="D_chk_6"><input class="Tasks" TaskId="6" type="checkbox" name="D_chk_6" id="D_chk_6" checked /></label><label>Accept Patient Payments</label></li>
<li id="D_li_7" class="npi "><label class="cbl" for="D_chk_7"><input class="Tasks" TaskId="7" type="checkbox" name="D_chk_7" id="D_chk_7" checked /></label><label>NPI Look-up</label></li>
<li id="D_li_18" class="reimbursements "><label class="cbl" for="D_chk_18"><input class="Tasks" TaskId="18" type="checkbox" name="D_chk_18" id="D_chk_18" checked /></label><label>Manage Reimbursements</label></li>
<li id="D_li_11" class="reconcile notSelected"><label class="cbl" for="D_chk_11"><input class="Tasks" TaskId="11" type="checkbox" name="D_chk_11" id="D_chk_11" /></label><label>View Claim File Reconciliation</label></li>
<li id="D_li_19" class="patientEx notSelected"><label class="cbl" for="D_chk_19"><input class="Tasks" TaskId="19" type="checkbox" name="D_chk_19" id="D_chk_19" /></label><label>Monitor Patient Exchange</label></li>
<li id="D_li_21" class="rtpa notSelected"><label class="cbl" for="D_chk_21"><input class="Tasks" TaskId="21" type="checkbox" name="D_chk_21" id="D_chk_21" /></label><label>Real Time Payment Assurance</label></li>
<li id="D_li_10" class="safetynet notSelected"><label class="cbl" for="D_chk_10"><input class="Tasks" TaskId="10" type="checkbox" name="D_chk_10" id="D_chk_10" /></label><label>Run Safety Net Report</label></li>
<li id="D_li_17" class="productivity notSelected"><label class="cbl" for="D_chk_17"><input class="Tasks" TaskId="17" type="checkbox" name="D_chk_17" id="D_chk_17" /></label><label>Run Staff Productivity Report</label></li>
<li id="D_li_12" class="summary notSelected"><label class="cbl" for="D_chk_12"><input class="Tasks" TaskId="12" type="checkbox" name="D_chk_12" id="D_chk_12" /></label><label>Run Transaction Summary</label></li>
<li id="D_li_9" class="analyze notSelected"><label class="cbl" for="D_chk_9"><input class="Tasks" TaskId="9" type="checkbox" name="D_chk_9" id="D_chk_9" /></label><label>Analyze Rejections</label></li>
</ul>
</li>
<li id="Weekly"><h4 >Weekly Tasks</h4><ul id="Weekly_Sortable_List" name="Weekly_Sortable_List" style="cursor: move"><li id="W_li_1" class="messages notSelected"><label class="cbl" for="W_chk_1"><input class="Tasks" TaskId="1" type="checkbox" name="W_chk_1" id="W_chk_1" /></label><label>Message Center</label></li>
<li id="W_li_2" class="send notSelected"><label class="cbl" for="W_chk_2"><input class="Tasks" TaskId="2" type="checkbox" name="W_chk_2" id="W_chk_2" /></label><label>Send/Receive</label></li>
<li id="W_li_3" class="work notSelected"><label class="cbl" for="W_chk_3"><input class="Tasks" TaskId="3" type="checkbox" name="W_chk_3" id="W_chk_3" /></label><label>Work Rejected Claims</label></li>
<li id="W_li_20" class="work notSelected"><label class="cbl" for="W_chk_20"><input class="Tasks" TaskId="20" type="checkbox" name="W_chk_20" id="W_chk_20" /></label><label>Gateway EDI Direct</label></li>
<li id="W_li_4" class="manage notSelected"><label class="cbl" for="W_chk_4"><input class="Tasks" TaskId="4" type="checkbox" name="W_chk_4" id="W_chk_4" /></label><label>View Insurance Payments</label></li>
<li id="W_li_5" class="check notSelected"><label class="cbl" for="W_chk_5"><input class="Tasks" TaskId="5" type="checkbox" name="W_chk_5" id="W_chk_5" /></label><label>Check Patient Eligibility</label></li>
<li id="W_li_6" class="payments notSelected"><label class="cbl" for="W_chk_6"><input class="Tasks" TaskId="6" type="checkbox" name="W_chk_6" id="W_chk_6" /></label><label>Accept Patient Payments</label></li>
<li id="W_li_7" class="npi notSelected"><label class="cbl" for="W_chk_7"><input class="Tasks" TaskId="7" type="checkbox" name="W_chk_7" id="W_chk_7" /></label><label>NPI Look-up</label></li>
<li id="W_li_18" class="reimbursements notSelected"><label class="cbl" for="W_chk_18"><input class="Tasks" TaskId="18" type="checkbox" name="W_chk_18" id="W_chk_18" /></label><label>Manage Reimbursements</label></li>
<li id="W_li_11" class="reconcile "><label class="cbl" for="W_chk_11"><input class="Tasks" TaskId="11" type="checkbox" name="W_chk_11" id="W_chk_11" checked /></label><label>View Claim File Reconciliation</label></li>
<li id="W_li_19" class="patientEx "><label class="cbl" for="W_chk_19"><input class="Tasks" TaskId="19" type="checkbox" name="W_chk_19" id="W_chk_19" checked /></label><label>Monitor Patient Exchange</label></li>
<li id="W_li_21" class="rtpa notSelected"><label class="cbl" for="W_chk_21"><input class="Tasks" TaskId="21" type="checkbox" name="W_chk_21" id="W_chk_21" /></label><label>Real Time Payment Assurance</label></li>
<li id="W_li_10" class="safetynet notSelected"><label class="cbl" for="W_chk_10"><input class="Tasks" TaskId="10" type="checkbox" name="W_chk_10" id="W_chk_10" /></label><label>Run Safety Net Report</label></li>
<li id="W_li_17" class="productivity notSelected"><label class="cbl" for="W_chk_17"><input class="Tasks" TaskId="17" type="checkbox" name="W_chk_17" id="W_chk_17" /></label><label>Run Staff Productivity Report</label></li>
<li id="W_li_12" class="summary notSelected"><label class="cbl" for="W_chk_12"><input class="Tasks" TaskId="12" type="checkbox" name="W_chk_12" id="W_chk_12" /></label><label>Run Transaction Summary</label></li>
<li id="W_li_9" class="analyze notSelected"><label class="cbl" for="W_chk_9"><input class="Tasks" TaskId="9" type="checkbox" name="W_chk_9" id="W_chk_9" /></label><label>Analyze Rejections</label></li>
</ul>
</li>
<li id="Monthly"><h4 >Monthly Tasks</h4><ul id="Monthly_Sortable_List" name="Monthly_Sortable_List" style="cursor: move"><li id="M_li_1" class="messages notSelected"><label class="cbl" for="M_chk_1"><input class="Tasks" TaskId="1" type="checkbox" name="M_chk_1" id="M_chk_1" /></label><label>Message Center</label></li>
<li id="M_li_2" class="send notSelected"><label class="cbl" for="M_chk_2"><input class="Tasks" TaskId="2" type="checkbox" name="M_chk_2" id="M_chk_2" /></label><label>Send/Receive</label></li>
<li id="M_li_3" class="work notSelected"><label class="cbl" for="M_chk_3"><input class="Tasks" TaskId="3" type="checkbox" name="M_chk_3" id="M_chk_3" /></label><label>Work Rejected Claims</label></li>
<li id="M_li_20" class="work notSelected"><label class="cbl" for="M_chk_20"><input class="Tasks" TaskId="20" type="checkbox" name="M_chk_20" id="M_chk_20" /></label><label>Gateway EDI Direct</label></li>
<li id="M_li_4" class="manage notSelected"><label class="cbl" for="M_chk_4"><input class="Tasks" TaskId="4" type="checkbox" name="M_chk_4" id="M_chk_4" /></label><label>View Insurance Payments</label></li>
<li id="M_li_5" class="check notSelected"><label class="cbl" for="M_chk_5"><input class="Tasks" TaskId="5" type="checkbox" name="M_chk_5" id="M_chk_5" /></label><label>Check Patient Eligibility</label></li>
<li id="M_li_6" class="payments notSelected"><label class="cbl" for="M_chk_6"><input class="Tasks" TaskId="6" type="checkbox" name="M_chk_6" id="M_chk_6" /></label><label>Accept Patient Payments</label></li>
<li id="M_li_7" class="npi notSelected"><label class="cbl" for="M_chk_7"><input class="Tasks" TaskId="7" type="checkbox" name="M_chk_7" id="M_chk_7" /></label><label>NPI Look-up</label></li>
<li id="M_li_18" class="reimbursements notSelected"><label class="cbl" for="M_chk_18"><input class="Tasks" TaskId="18" type="checkbox" name="M_chk_18" id="M_chk_18" /></label><label>Manage Reimbursements</label></li>
<li id="M_li_11" class="reconcile notSelected"><label class="cbl" for="M_chk_11"><input class="Tasks" TaskId="11" type="checkbox" name="M_chk_11" id="M_chk_11" /></label><label>View Claim File Reconciliation</label></li>
<li id="M_li_19" class="patientEx notSelected"><label class="cbl" for="M_chk_19"><input class="Tasks" TaskId="19" type="checkbox" name="M_chk_19" id="M_chk_19" /></label><label>Monitor Patient Exchange</label></li>
<li id="M_li_21" class="rtpa "><label class="cbl" for="M_chk_21"><input class="Tasks" TaskId="21" type="checkbox" name="M_chk_21" id="M_chk_21" checked /></label><label>Real Time Payment Assurance</label></li>
<li id="M_li_10" class="safetynet "><label class="cbl" for="M_chk_10"><input class="Tasks" TaskId="10" type="checkbox" name="M_chk_10" id="M_chk_10" checked /></label><label>Run Safety Net Report</label></li>
<li id="M_li_17" class="productivity "><label class="cbl" for="M_chk_17"><input class="Tasks" TaskId="17" type="checkbox" name="M_chk_17" id="M_chk_17" checked /></label><label>Run Staff Productivity Report</label></li>
<li id="M_li_12" class="summary "><label class="cbl" for="M_chk_12"><input class="Tasks" TaskId="12" type="checkbox" name="M_chk_12" id="M_chk_12" checked /></label><label>Run Transaction Summary</label></li>
<li id="M_li_9" class="analyze notSelected"><label class="cbl" for="M_chk_9"><input class="Tasks" TaskId="9" type="checkbox" name="M_chk_9" id="M_chk_9" /></label><label>Analyze Rejections</label></li>
</ul>
</li>
</ul>

all I want to remove specific taq

<li>..... </li> node that has lable abel>Real Time Payment Assurance</label>

e.g
<li id="W_li_21" class="rtpa notSelected"><label class="cbl" for="W_chk_21"><input class="Tasks" TaskId="21" type="checkbox" name="W_chk_21" id="W_chk_21" /></label><label>Real Time Payment Assurance</label></li>


any help will be great

thanks,
 
I would search the web for regex and html tags. I'm sure there are a number of examples. then it's just a matter of tweaking the regex to match what you need.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Looks like I was wrong :) regex isn't the way to go

So with that you would either:
1. use a 3rd party html parser
2. if you know the html is properly formatted. load it into a xmlreader, navigate the nodes you require, and perform the necessary operations.


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
I'm still un able to do that
you mind to share some sample
thanks,
 
I need to delete any <li>....</li> taq that contain
<label>Real Time Payment Assurance</label>

I couldn't find the right solution
please help
 
what are you unable to do? what have you tried? what is not yielding the expected results?

I would approach it this way:
assuming the html is properly formatted xml
1. load the text into an xml reader
2. read the nodes into an xmlwriter
3. read each node
4. skip over the nodes you don't want
5. use the result of the xmlwriter for the processing needs you have.

another option is to load the text into an XmlDocument, manipulate the document and then use the results of the manipulation. very similar to the first option, except the first option uses immutable objects and is forward-only operations.

you may also be able to use Linq2Xml and avoid the .net Xml documents all together.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top