/** * When the parser realises that it is dealign with a simplified stylesheet * it will create an empty Stylesheet object with the root element of the * stylesheet (a LiteralElement object) as its only child. The Stylesheet * object will then create this Template object and invoke this method to * force some specific behaviour. What we need to do is: * o) create a pattern matching on the root node * o) add the LRE root node (the only child of the Stylesheet) as our * only child node * o) set the empty Stylesheet as our parent * o) set this template as the Stylesheet's only child */ public void parseSimplified(Stylesheet stylesheet, Parser parser) { _stylesheet = stylesheet; setParent(stylesheet); _name = null; _mode = null; _priority = Double.NaN; _pattern = parser.parsePattern(this, "/"); final Vector contents = _stylesheet.getContents(); final SyntaxTreeNode root = (SyntaxTreeNode)contents.elementAt(0); if (root instanceof LiteralElement) { addElement(root); root.setParent(this); contents.set(0, this); parser.setTemplate(this); root.parseContents(parser); parser.setTemplate(null); } }
/** * When the parser realises that it is dealign with a simplified stylesheet * it will create an empty Stylesheet object with the root element of the * stylesheet (a LiteralElement object) as its only child. The Stylesheet * object will then create this Template object and invoke this method to * force some specific behaviour. What we need to do is: * o) create a pattern matching on the root node * o) add the LRE root node (the only child of the Stylesheet) as our * only child node * o) set the empty Stylesheet as our parent * o) set this template as the Stylesheet's only child */ public void parseSimplified(Stylesheet stylesheet, Parser parser) { _stylesheet = stylesheet; setParent(stylesheet); _name = null; _mode = null; _priority = Double.NaN; _pattern = parser.parsePattern(this, "/"); final Vector contents = _stylesheet.getContents(); final SyntaxTreeNode root = (SyntaxTreeNode)contents.elementAt(0); if (root instanceof LiteralElement) { addElement(root); root.setParent(this); contents.set(0, this); parser.setTemplate(this); root.parseContents(parser); parser.setTemplate(null); } }