We're nearly there now! All we need to do is to get rid of the custom tag itself from the DOM. We can do that using the very handy API macro method removeIntermediateNode(). Add this just before the break point in the tag processor method:

 s ok=$$removeIntermediateNode^%zewdDOM(nodeOID)

Now save and recompile the class, re-run EWD's compiler and output the DOM as before and you should now see the following:

      <h2>
         This is a test of our new custom tag
      </h2>
      <h4>
         Message for Today
      </h4>
      <div class="messagePanel">
         Hello World!
      </div>

This is now exactly what we want! Our tag processor is ready for use. We just need to remove that break command. The completed tag processor method should look like this:

ClassMethod todaysMessage(nodeOID As %String, ByRef attrValues, docOID As %String, technology As %String)
{
	s h4OID=$$addElementToDOM^%zewdDOM("h4",nodeOID,,,"Message for Today")
	s attr("class")="messagePanel"
	s text=$g(attrValues("message"))
	s text=$$removeQuotes^%zewdAPI(text)
	s divOID=$$addElementToDOM^%zewdDOM("div",nodeOID,,.attr,text)
	d removeIntermediateNode^%zewdDOM(nodeOID)
	QUIT
}

Save and compile the class and re-compile the EWD application. You should now see it run to completion without any interuption:

USER 19d1>q
 
USER>k

USER>d compileAll^%zewdAPI("mgwTest",,"csp")
d:\ewdApps\mgwTest\ewdAjaxError.ewd
d:\ewdApps\mgwTest\ewdAjaxErrorRedirect.ewd
d:\ewdApps\mgwTest\ewdErrorRedirect.ewd
d:\ewdApps\mgwTest\tagTest.ewd
d:\cachesys\csp\extc\mgwTest\ewdLogout.csp
 
USER>

EWD automatically deletes the page DOM when the page is fully compiled, so you won't be able to view the DOM after compilation. That's why we added the break command, so we could stop the compiler in its tracks and view the DOM.

So that's it! You've now created your first EWD custom tag! Try changing the text in the message attribute and you should see the compiled page change accordingly. Try running the compiled page in your browser to see the results.