摘要:
A method for serving a web page uses eXtensible Markup Language (XML) server pages. The first time a page is accessed, a given flat file is parsed into an XML Document Object Model (DOM), and required tag libraries are loaded. The DOM tree is then traversed, preferably in a depth-first, inside-out manner to locate custom tags. Upon locating a custom tag, if the tag is registered as a Java object, the object is loaded. A process method is then called on the object, passing the custom tag's tree node. The Java object then examines the custom tag and replaces it with an object, e.g., script code. Alternatively, if the tag is registered as an XSL stylesheet, the stylesheet is loaded and passed, together with the DOM, to an XSL processor. The processor applies the template to the custom tag and replaces it with given script code. Once all custom tags are reduced to HTML and script code, the DOM is compiled into a Java servlet to service the client request.
摘要:
A method for processing custom tags in a document object model (DOM) representation irrespective of the case in which the tags are authored. In an illustrative embodiment, a document object model (DOM) tree is processed to identify custom tags. Upon encountering a custom tag, an appropriate tag handler (e.g., a Java object, an XSL stylesheet, or the like) is invoked. According to the invention, a tag recognition routine is used for recognizing and handling case-insensitive custom tags. As a servlet engine is examining a tag name, if the name does not match one of the registered tags, the routine converts the name to neutral case. If the tag recognition routine recognizes the name as one of the case-insensitive tags, it converts the attributes to the appropriate case, and hands the resulting element off to a correct tag handler for processing.
摘要:
Different scripting languages may reside side-by-side or nested within each other on the same web page. Thus, a new author may add code to the page, and he or she is not tied to any given subset of languages supported by the web server. Multiple scripting languages are supported by identifying a start and an end of each scripting language code block authored into the web page markup language. When the web page is later compiled into an XML Document Object Model (DOM) tree, the routine examines the DOM to identify any nodes that identify a given code block. Upon encountering a node that identifies a given code block, the DOM is adjusted to account for the script code within the given code block.
摘要:
A method of processing a document object model (DOM) tree having at least one tag located at a given node in the tree. The tag serves as a marker that initiates the invocation of a tag handler that, in turn, performs a simple macro substitution or a more complex algorithmic reorganization and manipulation of the tree. Upon encountering the tag, given information is passed to a method. In a first embodiment, the given information is a text representation of XML in the DOM tree at the given node and any child nodes of the given node. In an alternate embodiment, the given information is the given node of the DOM tree itself. The method generates an XML string, which is then parsed into a new DOM tree having a root node. The given node and any child nodes are then replaced by the new DOM tree, with the root node of the new DOM tree being positioned at the given node in the original DOM tree. The process may then be repeated for any additional tags.
摘要:
A method for processing a Document Object Model (DOM) tree to verify context between multiple related XML tags. One or more of these related XML tags are custom tags. According to the invention, contextual relationships between the related XML tags are verified using the DOM itself to indicate state. In a preferred embodiment, the inventive method begins during the processing of the DOM tree with a current element being processed replacing itself with a placeholder element. The placeholder element includes attributes indicating its state. If a clean-up element does not already exist for the element being processed, the current element creates a clean-up element and adds it to the DOM, for example, as a child node to the root position. When the clean-up element is later encountered, this element scans the entire DOM for all the related tags (now placeholders) of interest. The clean-up element loads the state information from each and processes the state information accordingly. When complete, the clean-up element removes itself from the DOM.