I'm extremely tired, so I may be off here, but is there any reason why you
can't parse every attribute, after you get inside Director, to replace a
unique string with quotes?

Warning: The find and replace code can undoubtedly be optimized, and I
haven't tested this. (Like I said, I'm very tired.)

If this works, this would presumably mean you would only have to add one
handler in Director, and not have to massage your XML more than you already
intended.

--trying to reproduce in an XML attribute
--  command="baMsgBox(\"Complete this Tutorial before starting the next
Tutorial.\", \"Advisory\", \"OK\", \"Info\", 1)"

--start with unique character string to replace quotes with, that will not
choke XML
--  command="baMsgBox(**Complete this Tutorial before starting the next
Tutorial.**, **Advisory**, **OK**, **Info**, 1)"

--assumes this is what Director will see
--  baMsgBox(**Complete this Tutorial before starting the next Tutorial.**,
**Advisory**, **OK**, **Info**, 1)

--process all attributes when they come in, which yields:
--  parseAttributes "baMsgBox(**Complete this Tutorial before starting the
next Tutorial.**, **Advisory**, **OK**, **Info**, 1)"

--this gets returned to where it was needed:
--  baMsgBox("Complete this Tutorial before starting the next Tutorial.",
"Advisory", "OK", "Info", 1)

on parseAttributes whichAttribute
  repeat while whichAttribute contains "**"
    pos = offset("**",whichAttribute)
    if pos > 1 then
      newAttribute = newAttribute & whichAttribute.char[1..pos-1] & QUOTE
      delete whichAttribute.char[1..pos+1]
    else
      newAttribute = newAttribute & QUOTE
      delete whichAttribute.char[1..2]
    end if
  end repeat
  --note: following line may break due to email
  if whichAttribute.char.count > 0 then newAttribute = newAttribute &
whichAttribute.char[1..whichAttribute.char.count]
  return newAttribute
end

--test:
--  put parseAttributes "baMsgBox(**Complete this Tutorial before starting
the next Tutorial.**, **Advisory**, **OK**, **Info**, 1)"

--can then do something like:
--  do parseAttributes(myAttribute)
--  if you want to execute the results of the quote replacement



> From: "Mendelsohn, Michael" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Wed, 28 Apr 2004 15:43:59 -0400
> To: <[EMAIL PROTECTED]>
> Subject: <lingo-l> Quotes within quotes in a do statement
> 
> Hi list...
> 
> I have a handler that trudges through XML at a particular node and looks
> for a parameter called command="someLingoStuff".  If that param is there
> in the node, the handler takes what's in the quotes and puts it in a do
> statement:
> 
> do(someLingoStuff)
> 
> It's no problem for something like command="gTools.mRenderReport()".
> 
> However, I'd like to pass in something like this:
> command="baMsgBox(\"Complete this Tutorial before starting the next
> Tutorial.\", \"Advisory\", \"OK\", \"Info\", 1)"
> 
> Well, escaping the quotes chokes the XML.  Single quotes don't
> work...that's javascript, and QUOTE would still need the quotes on the
> pieces to concatenate.  Anyone have an idea of how to pass quotes that
> are within quotes?
> 
> Thanks,
> Michael M.

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to