Talk:Builder
Line 1: | Line 1: | ||
− | Created the page --[[User:Elliot Fisher|Elliot Fisher]] 23:50, 6 October 2008 (UTC) | + | >Created the page --[[User:Elliot Fisher|Elliot Fisher]] 23:50, 6 October 2008 (UTC) |
-- | -- | ||
− | Thought I might share a link to this [http://www.neocoders.com:8080/neocoders/projects/vgl/design-documentation/package-vgldocument-utils | + | Thought I might share a link to this [http://www.neocoders.com:8080/neocoders/projects/vgl/design-documentation/package-vgldocument-utils "Stateful Builder"], where a SAX parser drives a [[Builder]] that builds a [[Composite]]. The Builder implements the [[State]] pattern, and is in a particular state for each XML element that it is currently parsing. |
− | Incidentally, for a lot less code, you can also use use a kind of [[Interpreter]] pattern to parse an XML file into a Composite; where the Composite is also an Interpretor. You make yourself a SAXParser, then when you get a | + | Incidentally, for a lot less code, you can also use use a kind of [[Interpreter]] pattern to parse an XML file into a Composite; where the Composite is also an Interpretor. You make yourself a SAXParser, then when you get a "startElement" event from it (for the root XML element) you instantiate the root Composite element, passing the parser to the element's constructor. The root Composite element attaches itself as a listener to the parser. For each "startElement" event the root gets, it creates the appropriate child, to which it passes the parser. The children in turn listen to the parser and make appropriate children for each "startElement" event that they hear. Of course, this lumps the loading function into the Composite, which is a little quick-and-dirty. |
You can also pass a DOM (or a [http://www.json.org/ JSON] object) down into the construction of a Composite in the same way. | You can also pass a DOM (or a [http://www.json.org/ JSON] object) down into the construction of a Composite in the same way. | ||
[[User:Lindsay|Lindsay Kay]] | [[User:Lindsay|Lindsay Kay]] | ||
+ | |||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://ygocoqyhyv.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]= | ||
+ | ---- | ||
+ | =[http://ygocoqyhyv.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> |
Revision as of 02:30, 18 November 2010
>Created the page --Elliot Fisher 23:50, 6 October 2008 (UTC)
--
Thought I might share a link to this "Stateful Builder", where a SAX parser drives a Builder that builds a Composite. The Builder implements the State pattern, and is in a particular state for each XML element that it is currently parsing.
Incidentally, for a lot less code, you can also use use a kind of Interpreter pattern to parse an XML file into a Composite; where the Composite is also an Interpretor. You make yourself a SAXParser, then when you get a "startElement" event from it (for the root XML element) you instantiate the root Composite element, passing the parser to the element's constructor. The root Composite element attaches itself as a listener to the parser. For each "startElement" event the root gets, it creates the appropriate child, to which it passes the parser. The children in turn listen to the parser and make appropriate children for each "startElement" event that they hear. Of course, this lumps the loading function into the Composite, which is a little quick-and-dirty.
You can also pass a DOM (or a JSON object) down into the construction of a Composite in the same way.