Here's a suggestion:
Go ahead and generate your XML (call a test script or something) and 
validate the results.  I realize you may have to do this for several 
possible setups.  However, that might still be easier (depending on the 
number of possible result types) than writing something to validate for you.

Sorry, I'm not that familiar with XML validators/tidiers.

--Ben Doom

Peter Boughton wrote:
> Mmm, I was thinking I might need to write a script, but hoping for a less
> time-consuming solution.
> 
> Is there an XML tidier than will ignore CF?
> I forgot to mention initially, but this is for CF custom tags, so I wouldn't
> want things like <cfelse> getting picked up - although since the tags all
> use the same prefix, if I could just specify that they had to start with
> that then it might be fine.
> I probably want more a validator than a tidier I guess - something that
> reports problems and lets me fix them, rather than trying to be clever.
> 
> 
> On 11/2/07, Ben Doom <[EMAIL PROTECTED]> wrote:
>> This kind of thing (parsing) is pretty hard in regex.  I think it's
>> possible, but I can't think offhand of an easy way to do it and be sure
>> your XML is valid (ie, you could have three open tags and one close tag).
>>
>> What I would probably do (if I were doing it from scratch) is build
>> something that loops over the document, reading each tag and building a
>> "stack" where you add open tags and remove the top tag when you find the
>> matching close tag.
>>
>> In reality, what I would do is run it through an XML tidyer like the XML
>> codesweeper in HS+.
>>
>> --Ben Doom
>>
>> Peter Boughton wrote:
>>> Can anyone provide a regex that will identify any <prefix:tag...> which
>> isn't followed by its own </prefix:tag>
>>> Getting the initial tag is easy enough ( <prefix:([a-z_]+)[^>]*[^/]> ),
>> but I can't think how to check for a lack of closing tag.
>>>
>>> (This is just for a one-off check/fix, so if anyone knows of a
>> tool/editor that can do this (for a little under two thousand files),
>> without getting muddled up by CF tags, that would work too)
>>>
>>> Thanks.
>>>
>>>
>>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1077
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to