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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter out tag name in cdata sections or comments

Status
Not open for further replies.

kanghao

IS-IT--Management
Joined
Jul 4, 2004
Messages
68
Location
KR
how can I filter out xml elements in cdata sections or comments.

I have to parse xml elements and manupulate their attributes.

but I want the text in the form of <TAG> ... </TAG> or <TAG/> in the cdata sections or comments untouched.

help me.

Thanks.
 
I have to modify attributes values in the xml document below
to a string-added value.

<DOC>
<Drawing id="2"><![CDATA[<EMI id="1" height="95" width="95" file="utm00004.jpg">]]>
<EMI id="2" height="95" width="95" file="utm00004.jpg">ads</EMI>
</Drawing>
<!-- bla... <EMI id="3" height="95" width="95" file="utm00004.jpg"> ... bla -->
</DOC>

to

<DOC>
<Drawing id="2"><![CDATA[<EMI id="1" height="95" width="95" file="utm00004.jpg">]]>
<EMI id="2" height="95" width="95" file="56789-utm00004.jpg">ads</EMI>
</Drawing>
<!-- bla... <EMI id="3" height="95" width="95" file="utm00004.jpg"> ... bla -->
</DOC>

the value 56789 is from a database on the id value 2.

I can <EMI part using regex <EMI[\w\s\"\=\.\-\/]{0,}>.
how can I filter out the tags in the comments or cdata sections?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top