Proper Case In XML

Proper Case In XML

1
NewbieNewbie
1

    Jan 20, 2009#1

    Howdy all!

    First, I want to let everyone know that I did search the forum, and I did try everything that looked even remotely close to what I was looking for. The problem, I'm afraid, is that it's just not making much sense to me. It could be the late hour, or it could be that I'm just mentally challenged. At this point I'm not going to rule either out.

    What I need to do is this: I have nearly 10,000 lines of XML code and I need to change a snippet in each to proper case. Each line contains the following syntax:

    <![CDATA[This is some sample text]]></phrase>

    How can I find and select that part from each line? So that I can change the text between <![CDATA[ and ]]></phrase> to proper case, like this:

    <![CDATA[This Is Some Sample Text]]></phrase>

    I really do appreciate any help I can get in figuring this out.

    236
    MasterMaster
    236

      Jan 20, 2009#2

      I'm no macro expert, but this works on my PC (using UE 14.20.1.1006):

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      Top
      PerlReOn
      Loop 0
      Find RegExp "(?<=<!\[CDATA\[)[^]]+(?=\]\]></phrase>)"
      IfNotFound
      ExitLoop
      Else
      ToCaps
      EndIf
      EndLoop
      The macro property "Continue if a Find with Replace not found" or "Continue if search string not found" should be checked.

      The regex looks for any block of text that doesn't contain a "]" character and that is situated between the two delimiters you specified. It then applies the command "ToCaps" to it until it can't find any more occurences of the text.

      If you need to be able to handle escaped brackets like <![CDATA[This is some \[sample\] text]]></phrase>, that could also be worked into the regex - let me know if that's necessary.

      Cheers,
      Tim