Using Find/Replace - Do I need to use Regular Expressions?
Questions about XML that are not covered by the other forums should go here.
			- 
				Douha
 - Posts: 17
 - Joined: Fri Aug 19, 2005 6:02 pm
 
Using Find/Replace - Do I need to use Regular Expressions?
Hi All,
I have a need to do a mass replace on a certain tag in an xml file.
I need to replace the value in a tag from whatever it is to a null.
For example, I have an element with the following tags.
<tag1 Attribute="Y"><![CDATA[41]]></tag1>.
The cdata section for this tag through out the whole file can contain many different values. I need to change them all to null regardless of the current value.
Can anyone point me in the right direction? I have done some searching on the web for perl regular expressions because that is what the user guide says oXygen uses for it's regular expressions.
What I am seeing at the moment isn't helping me much.
Thanks,
Doug
State of Utah
			
			
									
									
						I have a need to do a mass replace on a certain tag in an xml file.
I need to replace the value in a tag from whatever it is to a null.
For example, I have an element with the following tags.
<tag1 Attribute="Y"><![CDATA[41]]></tag1>.
The cdata section for this tag through out the whole file can contain many different values. I need to change them all to null regardless of the current value.
Can anyone point me in the right direction? I have done some searching on the web for perl regular expressions because that is what the user guide says oXygen uses for it's regular expressions.
What I am seeing at the moment isn't helping me much.
Thanks,
Doug
State of Utah
- 
				sorin_ristache
 - Posts: 4141
 - Joined: Fri Mar 28, 2003 2:12 pm
 
Post by sorin_ristache »
Hello,
Check the option Regular expression in the Find/Replace dialog, enter <tag1(.*?)>(.*?)<!\[CDATA\[(.*?)\]\]>(.*?)</tag1> in the Text to find area and enter <tag1$1>$2<![CDATA[]]>$4</tag1> in the Replace with area. The find and replace operations will remove only the content of the CDATA section from tag1 elements. For example it will replace <tag1 Attribute="Y"> abc <![CDATA[41]]> def </tag1> with <tag1 Attribute="Y"> abc <![CDATA[]]> def </tag1>.
Regards,
Sorin
			
			
									
									
						Check the option Regular expression in the Find/Replace dialog, enter <tag1(.*?)>(.*?)<!\[CDATA\[(.*?)\]\]>(.*?)</tag1> in the Text to find area and enter <tag1$1>$2<![CDATA[]]>$4</tag1> in the Replace with area. The find and replace operations will remove only the content of the CDATA section from tag1 elements. For example it will replace <tag1 Attribute="Y"> abc <![CDATA[41]]> def </tag1> with <tag1 Attribute="Y"> abc <![CDATA[]]> def </tag1>.
Regards,
Sorin
Return to “General XML Questions”
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ SDK-API, Frameworks - Document Types
 - ↳ DocBook
 - ↳ TEI
 - ↳ XHTML
 - ↳ Other Issues
 - Oxygen XML Web Author
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Content Fusion
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen JSON Editor
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen PDF Chemistry
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Feedback
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen XML WebHelp
 - ↳ Feature Request
 - ↳ Common Problems
 - XML
 - ↳ General XML Questions
 - ↳ XSLT and FOP
 - ↳ XML Schemas
 - ↳ XQuery
 - NVDL
 - ↳ General NVDL Issues
 - ↳ oNVDL Related Issues
 - XML Services Market
 - ↳ Offer a Service