01: package org.kohsuke.rngom.digested;
02:
03: import org.kohsuke.rngom.ast.builder.BuildException;
04: import org.kohsuke.rngom.ast.builder.CommentList;
05: import org.kohsuke.rngom.ast.builder.ElementAnnotationBuilder;
06: import org.kohsuke.rngom.ast.om.Location;
07: import org.kohsuke.rngom.ast.om.ParsedElementAnnotation;
08: import org.w3c.dom.Element;
09:
10: /**
11: * @author Kohsuke Kawaguchi (kk@kohsuke.org)
12: */
13: class ElementAnnotationBuilderImpl implements ElementAnnotationBuilder {
14:
15: private final Element e;
16:
17: public ElementAnnotationBuilderImpl(Element e) {
18: this .e = e;
19: }
20:
21: public void addText(String value, Location loc, CommentList comments)
22: throws BuildException {
23: e.appendChild(e.getOwnerDocument().createTextNode(value));
24: }
25:
26: public ParsedElementAnnotation makeElementAnnotation()
27: throws BuildException {
28: return new ElementWrapper(e);
29: }
30:
31: public void addAttribute(String ns, String localName,
32: String prefix, String value, Location loc)
33: throws BuildException {
34: e.setAttributeNS(ns, localName, value);
35: }
36:
37: public void addElement(ParsedElementAnnotation ea)
38: throws BuildException {
39: e.appendChild(((ElementWrapper) ea).element);
40: }
41:
42: public void addComment(CommentList comments) throws BuildException {
43: }
44:
45: public void addLeadingComment(CommentList comments)
46: throws BuildException {
47: }
48: }
|