1 /*
2
3    Licensed to the Apache Software Foundation (ASF) under one or more
4    contributor license agreements.  See the NOTICE file distributed with
5    this work for additional information regarding copyright ownership.
6    The ASF licenses this file to You under the Apache License, Version 2.0
7    (the "License"); you may not use this file except in compliance with
8    the License.  You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17
18  */

19 package org.apache.batik.anim.dom;
20
21 import java.net.URL;
22 import java.util.HashMap;
23
24 import org.apache.batik.css.dom.CSSOMSVGViewCSS;
25 import org.apache.batik.css.engine.CSSContext;
26 import org.apache.batik.css.engine.CSSEngine;
27 import org.apache.batik.css.engine.SVGCSSEngine;
28 import org.apache.batik.css.engine.value.ShorthandManager;
29 import org.apache.batik.css.engine.value.ValueManager;
30 import org.apache.batik.css.parser.ExtendedParser;
31 import org.apache.batik.dom.AbstractDocument;
32 import org.apache.batik.dom.AbstractStylableDocument;
33 import org.apache.batik.dom.ExtensibleDOMImplementation;
34 import org.apache.batik.dom.events.DOMTimeEvent;
35 import org.apache.batik.dom.events.DocumentEventSupport;
36 import org.apache.batik.dom.svg.SVGOMEvent;
37 import org.apache.batik.dom.util.CSSStyleDeclarationFactory;
38 import org.apache.batik.dom.util.DOMUtilities;
39
40 import org.apache.batik.i18n.LocalizableSupport;
41 import org.apache.batik.util.ParsedURL;
42 import org.apache.batik.util.SVGConstants;
43
44 import org.w3c.css.sac.InputSource;
45 import org.w3c.dom.DOMException;
46 import org.w3c.dom.DOMImplementation;
47 import org.w3c.dom.Document;
48 import org.w3c.dom.DocumentType;
49 import org.w3c.dom.Element;
50 import org.w3c.dom.Node;
51 import org.w3c.dom.css.CSSStyleDeclaration;
52 import org.w3c.dom.css.CSSStyleSheet;
53 import org.w3c.dom.css.ViewCSS;
54 import org.w3c.dom.events.Event;
55 import org.w3c.dom.stylesheets.StyleSheet;
56
57 /**
58  * This class implements the {@link DOMImplementation} interface.
59  * It provides support the SVG 1.1 documents.
60  *
61  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
62  * @version $Id: SVGDOMImplementation.java 1831630 2018-05-15 12:56:55Z ssteiner $
63  */

64 public class SVGDOMImplementation
65     extends    ExtensibleDOMImplementation
66     implements CSSStyleDeclarationFactory {
67
68     /**
69      * The SVG namespace uri.
70      */

71     public static final String SVG_NAMESPACE_URI =
72         SVGConstants.SVG_NAMESPACE_URI;
73
74     /**
75      * The error messages bundle class name.
76      */

77     protected static final String RESOURCES =
78         "org.apache.batik.dom.svg.resources.Messages";
79
80     protected HashMap<String, ElementFactory> factories;
81
82     /**
83      * Returns the default instance of this class.
84      */

85     public static DOMImplementation getDOMImplementation() {
86         return DOM_IMPLEMENTATION;
87     }
88
89     /**
90      * Creates a new SVGDOMImplementation object.
91      */

92     public SVGDOMImplementation() {
93         factories = svg11Factories;
94         registerFeature("CSS",            "2.0");
95         registerFeature("StyleSheets",    "2.0");
96         registerFeature("SVG",            new String[] {"1.0""1.1"});
97         registerFeature("SVGEvents",      new String[] {"1.0""1.1"});
98     }
99
100     protected void initLocalizable() {
101         localizableSupport = new LocalizableSupport
102             (RESOURCES, getClass().getClassLoader());
103     }
104
105     public CSSEngine createCSSEngine(AbstractStylableDocument doc,
106                                      CSSContext               ctx,
107                                      ExtendedParser           ep,
108                                      ValueManager     []      vms,
109                                      ShorthandManager []      sms) {
110
111         ParsedURL durl = ((SVGOMDocument)doc).getParsedURL();
112         CSSEngine result = new SVGCSSEngine(doc, durl, ep, vms, sms, ctx);
113
114         URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
115         if (url != null) {
116             ParsedURL purl = new ParsedURL(url);
117             InputSource is = new InputSource(purl.toString());
118             result.setUserAgentStyleSheet
119                 (result.parseStyleSheet(is, purl, "all"));
120         }
121
122         return result;
123     }
124
125     /**
126      * Creates a ViewCSS.
127      */

128     public ViewCSS createViewCSS(AbstractStylableDocument doc) {
129         return new CSSOMSVGViewCSS(doc.getCSSEngine());
130     }
131
132     /**
133      * <b>DOM</b>: Implements {@link
134      * DOMImplementation#createDocument(String,String,DocumentType)}.
135      */

136     public Document createDocument(String namespaceURI,
137                                    String qualifiedName,
138                                    DocumentType doctype)
139         throws DOMException {
140         Document result = new SVGOMDocument(doctype, this);
141         // BUG 32108: return empty document if qualifiedName is null.
142         if (qualifiedName != null)
143             result.appendChild(result.createElementNS(namespaceURI,
144                                                       qualifiedName));
145         return result;
146     }
147
148     // DOMImplementationCSS /////////////////////////////////////////////////
149
150     /**
151      * <b>DOM</b>: Implements {@link
152      * org.w3c.dom.css.DOMImplementationCSS#createCSSStyleSheet(String,String)}.
153      */

154     public CSSStyleSheet createCSSStyleSheet(String title, String media) {
155         throw new UnsupportedOperationException
156             ("DOMImplementationCSS.createCSSStyleSheet is not implemented"); // XXX
157     }
158
159     // CSSStyleDeclarationFactory ///////////////////////////////////////////
160
161     /**
162      * Creates a style declaration.
163      * @return a CSSOMStyleDeclaration instance.
164      */

165     public CSSStyleDeclaration createCSSStyleDeclaration() {
166         throw new UnsupportedOperationException
167             ("CSSStyleDeclarationFactory.createCSSStyleDeclaration is not implemented"); // XXX
168     }
169
170     // StyleSheetFactory /////////////////////////////////////////////
171
172     /**
173      * Creates a stylesheet from the data of an xml-stylesheet
174      * processing instruction or return null.
175      */

176     public StyleSheet createStyleSheet(Node n, HashMap<String, String> attrs) {
177         throw new UnsupportedOperationException
178             ("StyleSheetFactory.createStyleSheet is not implemented"); // XXX
179     }
180
181     /**
182      * Returns the user-agent stylesheet.
183      */

184     public CSSStyleSheet getUserAgentStyleSheet() {
185         throw new UnsupportedOperationException
186             ("StyleSheetFactory.getUserAgentStyleSheet is not implemented"); // XXX
187     }
188
189     /**
190      * Implements the behavior of Document.createElementNS() for this
191      * DOM implementation.
192      */

193     public Element createElementNS(AbstractDocument document,
194                                    String           namespaceURI,
195                                    String           qualifiedName) {
196         if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) {
197             String name = DOMUtilities.getLocalName(qualifiedName);
198             ElementFactory ef = factories.get(name);
199             if (ef != null)
200                 return ef.create(DOMUtilities.getPrefix(qualifiedName),
201                                  document);
202             throw document.createDOMException
203                 (DOMException.NOT_FOUND_ERR, "invalid.element",
204                  new Object[] { namespaceURI, qualifiedName });
205         }
206
207         return super.createElementNS(document, namespaceURI, qualifiedName);
208     }
209
210     /**
211      * Creates an DocumentEventSupport object suitable for use with
212      * this implementation.
213      */

214     public DocumentEventSupport createDocumentEventSupport() {
215         DocumentEventSupport result =  new DocumentEventSupport();
216         result.registerEventFactory("SVGEvents",
217                                     new DocumentEventSupport.EventFactory() {
218                                             public Event createEvent() {
219                                                 return new SVGOMEvent();
220                                             }
221                                         });
222         result.registerEventFactory("TimeEvent",
223                                     new DocumentEventSupport.EventFactory() {
224                                             public Event createEvent() {
225                                                 return new DOMTimeEvent();
226                                             }
227                                         });
228         return result;
229     }
230
231     // The element factories /////////////////////////////////////////////////
232
233     /**
234      * The SVG element factories.
235      */

236     protected static HashMap<String, ElementFactory> svg11Factories = new HashMap<String, ElementFactory>();
237
238     static {
239         svg11Factories.put(SVGConstants.SVG_A_TAG,
240                            new AElementFactory());
241
242         svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_TAG,
243                            new AltGlyphElementFactory());
244
245         svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_DEF_TAG,
246                            new AltGlyphDefElementFactory());
247
248         svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_ITEM_TAG,
249                            new AltGlyphItemElementFactory());
250
251         svg11Factories.put(SVGConstants.SVG_ANIMATE_TAG,
252                            new AnimateElementFactory());
253
254         svg11Factories.put(SVGConstants.SVG_ANIMATE_COLOR_TAG,
255                            new AnimateColorElementFactory());
256
257         svg11Factories.put(SVGConstants.SVG_ANIMATE_MOTION_TAG,
258                            new AnimateMotionElementFactory());
259
260         svg11Factories.put(SVGConstants.SVG_ANIMATE_TRANSFORM_TAG,
261                            new AnimateTransformElementFactory());
262
263         svg11Factories.put(SVGConstants.SVG_CIRCLE_TAG,
264                            new CircleElementFactory());
265
266         svg11Factories.put(SVGConstants.SVG_CLIP_PATH_TAG,
267                            new ClipPathElementFactory());
268
269         svg11Factories.put(SVGConstants.SVG_COLOR_PROFILE_TAG,
270                            new ColorProfileElementFactory());
271
272         svg11Factories.put(SVGConstants.SVG_CURSOR_TAG,
273                            new CursorElementFactory());
274
275         svg11Factories.put(SVGConstants.SVG_DEFINITION_SRC_TAG,
276                            new DefinitionSrcElementFactory());
277
278         svg11Factories.put(SVGConstants.SVG_DEFS_TAG,
279                            new DefsElementFactory());
280
281         svg11Factories.put(SVGConstants.SVG_DESC_TAG,
282                            new DescElementFactory());
283
284         svg11Factories.put(SVGConstants.SVG_ELLIPSE_TAG,
285                            new EllipseElementFactory());
286
287         svg11Factories.put(SVGConstants.SVG_FE_BLEND_TAG,
288                            new FeBlendElementFactory());
289
290         svg11Factories.put(SVGConstants.SVG_FE_COLOR_MATRIX_TAG,
291                            new FeColorMatrixElementFactory());
292
293         svg11Factories.put(SVGConstants.SVG_FE_COMPONENT_TRANSFER_TAG,
294                            new FeComponentTransferElementFactory());
295
296         svg11Factories.put(SVGConstants.SVG_FE_COMPOSITE_TAG,
297                            new FeCompositeElementFactory());
298
299         svg11Factories.put(SVGConstants.SVG_FE_CONVOLVE_MATRIX_TAG,
300                            new FeConvolveMatrixElementFactory());
301
302         svg11Factories.put(SVGConstants.SVG_FE_DIFFUSE_LIGHTING_TAG,
303                            new FeDiffuseLightingElementFactory());
304
305         svg11Factories.put(SVGConstants.SVG_FE_DISPLACEMENT_MAP_TAG,
306                            new FeDisplacementMapElementFactory());
307
308         svg11Factories.put(SVGConstants.SVG_FE_DISTANT_LIGHT_TAG,
309                            new FeDistantLightElementFactory());
310
311         svg11Factories.put(SVGConstants.SVG_FE_FLOOD_TAG,
312                            new FeFloodElementFactory());
313
314         svg11Factories.put(SVGConstants.SVG_FE_FUNC_A_TAG,
315                            new FeFuncAElementFactory());
316
317         svg11Factories.put(SVGConstants.SVG_FE_FUNC_R_TAG,
318                            new FeFuncRElementFactory());
319
320         svg11Factories.put(SVGConstants.SVG_FE_FUNC_G_TAG,
321                            new FeFuncGElementFactory());
322
323         svg11Factories.put(SVGConstants.SVG_FE_FUNC_B_TAG,
324                            new FeFuncBElementFactory());
325
326         svg11Factories.put(SVGConstants.SVG_FE_GAUSSIAN_BLUR_TAG,
327                            new FeGaussianBlurElementFactory());
328
329         svg11Factories.put(SVGConstants.SVG_FE_IMAGE_TAG,
330                            new FeImageElementFactory());
331
332         svg11Factories.put(SVGConstants.SVG_FE_MERGE_TAG,
333                            new FeMergeElementFactory());
334
335         svg11Factories.put(SVGConstants.SVG_FE_MERGE_NODE_TAG,
336                            new FeMergeNodeElementFactory());
337
338         svg11Factories.put(SVGConstants.SVG_FE_MORPHOLOGY_TAG,
339                            new FeMorphologyElementFactory());
340
341         svg11Factories.put(SVGConstants.SVG_FE_OFFSET_TAG,
342                            new FeOffsetElementFactory());
343
344         svg11Factories.put(SVGConstants.SVG_FE_POINT_LIGHT_TAG,
345                            new FePointLightElementFactory());
346
347         svg11Factories.put(SVGConstants.SVG_FE_SPECULAR_LIGHTING_TAG,
348                            new FeSpecularLightingElementFactory());
349
350         svg11Factories.put(SVGConstants.SVG_FE_SPOT_LIGHT_TAG,
351                            new FeSpotLightElementFactory());
352
353         svg11Factories.put(SVGConstants.SVG_FE_TILE_TAG,
354                            new FeTileElementFactory());
355
356         svg11Factories.put(SVGConstants.SVG_FE_TURBULENCE_TAG,
357                            new FeTurbulenceElementFactory());
358
359         svg11Factories.put(SVGConstants.SVG_FILTER_TAG,
360                            new FilterElementFactory());
361
362         svg11Factories.put(SVGConstants.SVG_FONT_TAG,
363                            new FontElementFactory());
364
365         svg11Factories.put(SVGConstants.SVG_FONT_FACE_TAG,
366                            new FontFaceElementFactory());
367
368         svg11Factories.put(SVGConstants.SVG_FONT_FACE_FORMAT_TAG,
369                            new FontFaceFormatElementFactory());
370
371         svg11Factories.put(SVGConstants.SVG_FONT_FACE_NAME_TAG,
372                            new FontFaceNameElementFactory());
373
374         svg11Factories.put(SVGConstants.SVG_FONT_FACE_SRC_TAG,
375                            new FontFaceSrcElementFactory());
376
377         svg11Factories.put(SVGConstants.SVG_FONT_FACE_URI_TAG,
378                            new FontFaceUriElementFactory());
379
380         svg11Factories.put(SVGConstants.SVG_FOREIGN_OBJECT_TAG,
381                            new ForeignObjectElementFactory());
382
383         svg11Factories.put(SVGConstants.SVG_G_TAG,
384                            new GElementFactory());
385
386         svg11Factories.put(SVGConstants.SVG_GLYPH_TAG,
387                            new GlyphElementFactory());
388
389         svg11Factories.put(SVGConstants.SVG_GLYPH_REF_TAG,
390                            new GlyphRefElementFactory());
391
392         svg11Factories.put(SVGConstants.SVG_HKERN_TAG,
393                            new HkernElementFactory());
394
395         svg11Factories.put(SVGConstants.SVG_IMAGE_TAG,
396                            new ImageElementFactory());
397
398         svg11Factories.put(SVGConstants.SVG_LINE_TAG,
399                            new LineElementFactory());
400
401         svg11Factories.put(SVGConstants.SVG_LINEAR_GRADIENT_TAG,
402                            new LinearGradientElementFactory());
403
404         svg11Factories.put(SVGConstants.SVG_MARKER_TAG,
405                            new MarkerElementFactory());
406
407         svg11Factories.put(SVGConstants.SVG_MASK_TAG,
408                            new MaskElementFactory());
409
410         svg11Factories.put(SVGConstants.SVG_METADATA_TAG,
411                            new MetadataElementFactory());
412
413         svg11Factories.put(SVGConstants.SVG_MISSING_GLYPH_TAG,
414                            new MissingGlyphElementFactory());
415
416         svg11Factories.put(SVGConstants.SVG_MPATH_TAG,
417                            new MpathElementFactory());
418
419         svg11Factories.put(SVGConstants.SVG_PATH_TAG,
420                            new PathElementFactory());
421
422         svg11Factories.put(SVGConstants.SVG_PATTERN_TAG,
423                            new PatternElementFactory());
424
425         svg11Factories.put(SVGConstants.SVG_POLYGON_TAG,
426                            new PolygonElementFactory());
427
428         svg11Factories.put(SVGConstants.SVG_POLYLINE_TAG,
429                            new PolylineElementFactory());
430
431         svg11Factories.put(SVGConstants.SVG_RADIAL_GRADIENT_TAG,
432                            new RadialGradientElementFactory());
433
434         svg11Factories.put(SVGConstants.SVG_RECT_TAG,
435                            new RectElementFactory());
436
437         svg11Factories.put(SVGConstants.SVG_SET_TAG,
438                            new SetElementFactory());
439
440         svg11Factories.put(SVGConstants.SVG_SCRIPT_TAG,
441                            new ScriptElementFactory());
442
443         svg11Factories.put(SVGConstants.SVG_STOP_TAG,
444                            new StopElementFactory());
445
446         svg11Factories.put(SVGConstants.SVG_STYLE_TAG,
447                            new StyleElementFactory());
448
449         svg11Factories.put(SVGConstants.SVG_SVG_TAG,
450                            new SvgElementFactory());
451
452         svg11Factories.put(SVGConstants.SVG_SWITCH_TAG,
453                            new SwitchElementFactory());
454
455         svg11Factories.put(SVGConstants.SVG_SYMBOL_TAG,
456                            new SymbolElementFactory());
457
458         svg11Factories.put(SVGConstants.SVG_TEXT_TAG,
459                            new TextElementFactory());
460
461         svg11Factories.put(SVGConstants.SVG_TEXT_PATH_TAG,
462                            new TextPathElementFactory());
463
464         svg11Factories.put(SVGConstants.SVG_TITLE_TAG,
465                            new TitleElementFactory());
466
467         svg11Factories.put(SVGConstants.SVG_TREF_TAG,
468                            new TrefElementFactory());
469
470         svg11Factories.put(SVGConstants.SVG_TSPAN_TAG,
471                            new TspanElementFactory());
472
473         svg11Factories.put(SVGConstants.SVG_USE_TAG,
474                            new UseElementFactory());
475
476         svg11Factories.put(SVGConstants.SVG_VIEW_TAG,
477                            new ViewElementFactory());
478
479         svg11Factories.put(SVGConstants.SVG_VKERN_TAG,
480                            new VkernElementFactory());
481     }
482
483     /**
484      * To create a 'a' element.
485      */

486     protected static class AElementFactory implements ElementFactory {
487         public AElementFactory() {}
488         /**
489          * Creates an instance of the associated element type.
490          */

491         public Element create(String prefix, Document doc) {
492             return new SVGOMAElement(prefix, (AbstractDocument)doc);
493         }
494     }
495
496     /**
497      * To create a 'altGlyph' element.
498      */

499     protected static class AltGlyphElementFactory implements ElementFactory {
500         public AltGlyphElementFactory() {}
501         /**
502          * Creates an instance of the associated element type.
503          */

504         public Element create(String prefix, Document doc) {
505             return new SVGOMAltGlyphElement(prefix, (AbstractDocument)doc);
506         }
507     }
508
509     /**
510      * To create a 'altGlyphDef' element.
511      */

512     protected static class AltGlyphDefElementFactory
513         implements ElementFactory {
514         public AltGlyphDefElementFactory() {}
515         /**
516          * Creates an instance of the associated element type.
517          */

518         public Element create(String prefix, Document doc) {
519             return new SVGOMAltGlyphDefElement(prefix, (AbstractDocument)doc);
520         }
521     }
522
523     /**
524      * To create a 'altGlyphItem' element.
525      */

526     protected static class AltGlyphItemElementFactory
527         implements ElementFactory {
528         public AltGlyphItemElementFactory() {}
529         /**
530          * Creates an instance of the associated element type.
531          */

532         public Element create(String prefix, Document doc) {
533             return new SVGOMAltGlyphItemElement(prefix, (AbstractDocument)doc);
534         }
535     }
536
537     /**
538      * To create a 'animate' element.
539      */

540     protected static class AnimateElementFactory implements ElementFactory {
541         public AnimateElementFactory() {}
542         /**
543          * Creates an instance of the associated element type.
544          */

545         public Element create(String prefix, Document doc) {
546             return new SVGOMAnimateElement(prefix, (AbstractDocument)doc);
547         }
548     }
549
550     /**
551      * To create a 'animateColor' element.
552      */

553     protected static class AnimateColorElementFactory
554         implements ElementFactory {
555         public AnimateColorElementFactory() {}
556         /**
557          * Creates an instance of the associated element type.
558          */

559         public Element create(String prefix, Document doc) {
560             return new SVGOMAnimateColorElement(prefix, (AbstractDocument)doc);
561         }
562     }
563
564     /**
565      * To create a 'animateMotion' element.
566      */

567     protected static class AnimateMotionElementFactory
568         implements ElementFactory {
569         public AnimateMotionElementFactory() {}
570         /**
571          * Creates an instance of the associated element type.
572          */

573         public Element create(String prefix, Document doc) {
574             return new SVGOMAnimateMotionElement(prefix,
575                                                  (AbstractDocument)doc);
576         }
577     }
578
579     /**
580      * To create a 'animateTransform' element.
581      */

582     protected static class AnimateTransformElementFactory
583         implements ElementFactory {
584         public AnimateTransformElementFactory() {}
585         /**
586          * Creates an instance of the associated element type.
587          */

588         public Element create(String prefix, Document doc) {
589             return new SVGOMAnimateTransformElement(prefix,
590                                                     (AbstractDocument)doc);
591         }
592     }
593
594     /**
595      * To create a 'circle' element.
596      */

597     protected static class CircleElementFactory implements ElementFactory {
598         public CircleElementFactory() {}
599         /**
600          * Creates an instance of the associated element type.
601          */

602         public Element create(String prefix, Document doc) {
603             return new SVGOMCircleElement(prefix, (AbstractDocument)doc);
604         }
605     }
606
607     /**
608      * To create a 'clip-path' element.
609      */

610     protected static class ClipPathElementFactory implements ElementFactory {
611         public ClipPathElementFactory() {}
612         /**
613          * Creates an instance of the associated element type.
614          */

615         public Element create(String prefix, Document doc) {
616             return new SVGOMClipPathElement(prefix, (AbstractDocument)doc);
617         }
618     }
619
620     /**
621      * To create a 'color-profile' element.
622      */

623     protected static class ColorProfileElementFactory
624         implements ElementFactory {
625         public ColorProfileElementFactory() {}
626         /**
627          * Creates an instance of the associated element type.
628          */

629         public Element create(String prefix, Document doc) {
630             return new SVGOMColorProfileElement(prefix, (AbstractDocument)doc);
631         }
632     }
633
634     /**
635      * To create a 'cursor' element.
636      */

637     protected static class CursorElementFactory implements ElementFactory {
638         public CursorElementFactory() {}
639         /**
640          * Creates an instance of the associated element type.
641          */

642         public Element create(String prefix, Document doc) {
643             return new SVGOMCursorElement(prefix, (AbstractDocument)doc);
644         }
645     }
646
647     /**
648      * To create a 'definition-src' element.
649      */

650     protected static class DefinitionSrcElementFactory
651         implements ElementFactory {
652         public DefinitionSrcElementFactory() {}
653         /**
654          * Creates an instance of the associated element type.
655          */

656         public Element create(String prefix, Document doc) {
657             return new SVGOMDefinitionSrcElement(prefix,
658                                                  (AbstractDocument)doc);
659         }
660     }
661
662     /**
663      * To create a 'defs' element.
664      */

665     protected static class DefsElementFactory implements ElementFactory {
666         public DefsElementFactory() {}
667         /**
668          * Creates an instance of the associated element type.
669          */

670         public Element create(String prefix, Document doc) {
671             return new SVGOMDefsElement(prefix, (AbstractDocument)doc);
672         }
673     }
674
675     /**
676      * To create a 'desc' element.
677      */

678     protected static class DescElementFactory implements ElementFactory {
679         public DescElementFactory() {}
680         /**
681          * Creates an instance of the associated element type.
682          */

683         public Element create(String prefix, Document doc) {
684             return new SVGOMDescElement(prefix, (AbstractDocument)doc);
685         }
686     }
687
688     /**
689      * To create an 'ellipse' element.
690      */

691     protected static class EllipseElementFactory implements ElementFactory {
692         public EllipseElementFactory() {}
693         /**
694          * Creates an instance of the associated element type.
695          */

696         public Element create(String prefix, Document doc) {
697             return new SVGOMEllipseElement(prefix, (AbstractDocument)doc);
698         }
699     }
700
701     /**
702      * To create a 'feBlend' element.
703      */

704     protected static class FeBlendElementFactory implements ElementFactory {
705         public FeBlendElementFactory() {}
706         /**
707          * Creates an instance of the associated element type.
708          */

709         public Element create(String prefix, Document doc) {
710             return new SVGOMFEBlendElement(prefix, (AbstractDocument)doc);
711         }
712     }
713
714     /**
715      * To create a 'feColorMatrix' element.
716      */

717     protected static class FeColorMatrixElementFactory
718         implements ElementFactory {
719         public FeColorMatrixElementFactory() {}
720         /**
721          * Creates an instance of the associated element type.
722          */

723         public Element create(String prefix, Document doc) {
724             return new SVGOMFEColorMatrixElement(prefix,
725                                                  (AbstractDocument)doc);
726         }
727     }
728
729     /**
730      * To create a 'feComponentTransfer' element.
731      */

732     protected static class FeComponentTransferElementFactory
733         implements ElementFactory {
734         public FeComponentTransferElementFactory() {}
735         /**
736          * Creates an instance of the associated element type.
737          */

738         public Element create(String prefix, Document doc) {
739             return new SVGOMFEComponentTransferElement(prefix,
740                                                        (AbstractDocument)doc);
741         }
742     }
743
744     /**
745      * To create a 'feComposite' element.
746      */

747     protected static class FeCompositeElementFactory
748         implements ElementFactory {
749         public FeCompositeElementFactory() {}
750         /**
751          * Creates an instance of the associated element type.
752          */

753         public Element create(String prefix, Document doc) {
754             return new SVGOMFECompositeElement(prefix, (AbstractDocument)doc);
755         }
756     }
757
758     /**
759      * To create a 'feConvolveMatrix' element.
760      */

761     protected static class FeConvolveMatrixElementFactory
762         implements ElementFactory {
763         public FeConvolveMatrixElementFactory() {}
764         /**
765          * Creates an instance of the associated element type.
766          */

767         public Element create(String prefix, Document doc) {
768             return new SVGOMFEConvolveMatrixElement(prefix,
769                                                     (AbstractDocument)doc);
770         }
771     }
772
773     /**
774      * To create a 'feDiffuseLighting' element.
775      */

776     protected static class FeDiffuseLightingElementFactory
777         implements ElementFactory {
778         public FeDiffuseLightingElementFactory() {}
779         /**
780          * Creates an instance of the associated element type.
781          */

782         public Element create(String prefix, Document doc) {
783             return new SVGOMFEDiffuseLightingElement(prefix,
784                                                      (AbstractDocument)doc);
785         }
786     }
787
788     /**
789      * To create a 'feDisplacementMap' element.
790      */

791     protected static class FeDisplacementMapElementFactory
792         implements ElementFactory {
793         public FeDisplacementMapElementFactory() {}
794         /**
795          * Creates an instance of the associated element type.
796          */

797         public Element create(String prefix, Document doc) {
798             return new SVGOMFEDisplacementMapElement(prefix,
799                                                      (AbstractDocument)doc);
800         }
801     }
802
803     /**
804      * To create a 'feDistantLight' element.
805      */

806     protected static class FeDistantLightElementFactory
807         implements ElementFactory {
808         public FeDistantLightElementFactory() {}
809         /**
810          * Creates an instance of the associated element type.
811          */

812         public Element create(String prefix, Document doc) {
813             return new SVGOMFEDistantLightElement(prefix,
814                                                   (AbstractDocument)doc);
815         }
816     }
817
818     /**
819      * To create a 'feFlood' element.
820      */

821     protected static class FeFloodElementFactory implements ElementFactory {
822         public FeFloodElementFactory() {}
823         /**
824          * Creates an instance of the associated element type.
825          */

826         public Element create(String prefix, Document doc) {
827             return new SVGOMFEFloodElement(prefix, (AbstractDocument)doc);
828         }
829     }
830
831     /**
832      * To create a 'feFuncA' element.
833      */

834     protected static class FeFuncAElementFactory implements ElementFactory {
835         public FeFuncAElementFactory() {}
836         /**
837          * Creates an instance of the associated element type.
838          */

839         public Element create(String prefix, Document doc) {
840             return new SVGOMFEFuncAElement(prefix, (AbstractDocument)doc);
841         }
842     }
843
844     /**
845      * To create a 'feFuncR' element.
846      */

847     protected static class FeFuncRElementFactory implements ElementFactory {
848         public FeFuncRElementFactory() {}
849         /**
850          * Creates an instance of the associated element type.
851          */

852         public Element create(String prefix, Document doc) {
853             return new SVGOMFEFuncRElement(prefix, (AbstractDocument)doc);
854         }
855     }
856
857     /**
858      * To create a 'feFuncG' element.
859      */

860     protected static class FeFuncGElementFactory implements ElementFactory {
861         public FeFuncGElementFactory() {}
862         /**
863          * Creates an instance of the associated element type.
864          */

865         public Element create(String prefix, Document doc) {
866             return new SVGOMFEFuncGElement(prefix, (AbstractDocument)doc);
867         }
868     }
869
870
871     /**
872      * To create a 'feFuncB' element.
873      */

874     protected static class FeFuncBElementFactory
875         implements ElementFactory {
876         public FeFuncBElementFactory() {}
877         /**
878          * Creates an instance of the associated element type.
879          */

880         public Element create(String prefix, Document doc) {
881             return new SVGOMFEFuncBElement(prefix, (AbstractDocument)doc);
882         }
883     }
884
885     /**
886      * To create a 'feGaussianBlur' element.
887      */

888     protected static class FeGaussianBlurElementFactory
889         implements ElementFactory {
890         public FeGaussianBlurElementFactory() {}
891         /**
892          * Creates an instance of the associated element type.
893          */

894         public Element create(String prefix, Document doc) {
895             return new SVGOMFEGaussianBlurElement(prefix,
896                                                   (AbstractDocument)doc);
897         }
898     }
899
900     /**
901      * To create a 'feImage' element.
902      */

903     protected static class FeImageElementFactory implements ElementFactory {
904         public FeImageElementFactory() {}
905         /**
906          * Creates an instance of the associated element type.
907          */

908         public Element create(String prefix, Document doc) {
909             return new SVGOMFEImageElement(prefix, (AbstractDocument)doc);
910         }
911     }
912
913     /**
914      * To create a 'feMerge' element.
915      */

916     protected static class FeMergeElementFactory
917         implements ElementFactory {
918         public FeMergeElementFactory() {}
919         /**
920          * Creates an instance of the associated element type.
921          */

922         public Element create(String prefix, Document doc) {
923             return new SVGOMFEMergeElement(prefix, (AbstractDocument)doc);
924         }
925     }
926
927     /**
928      * To create a 'feMergeNode' element.
929      */

930     protected static class FeMergeNodeElementFactory
931         implements ElementFactory {
932         public FeMergeNodeElementFactory() {}
933         /**
934          * Creates an instance of the associated element type.
935          */

936         public Element create(String prefix, Document doc) {
937             return new SVGOMFEMergeNodeElement(prefix, (AbstractDocument)doc);
938         }
939     }
940
941     /**
942      * To create a 'feMorphology' element.
943      */

944     protected static class FeMorphologyElementFactory
945         implements ElementFactory {
946         public FeMorphologyElementFactory() {}
947         /**
948          * Creates an instance of the associated element type.
949          */

950         public Element create(String prefix, Document doc) {
951             return new SVGOMFEMorphologyElement(prefix,
952                                                 (AbstractDocument)doc);
953         }
954     }
955
956     /**
957      * To create a 'feOffset' element.
958      */

959     protected static class FeOffsetElementFactory implements ElementFactory {
960         public FeOffsetElementFactory() {}
961         /**
962          * Creates an instance of the associated element type.
963          */

964         public Element create(String prefix, Document doc) {
965             return new SVGOMFEOffsetElement(prefix, (AbstractDocument)doc);
966         }
967     }
968
969     /**
970      * To create a 'fePointLight' element.
971      */

972     protected static class FePointLightElementFactory
973         implements ElementFactory {
974         public FePointLightElementFactory() {}
975         /**
976          * Creates an instance of the associated element type.
977          */

978         public Element create(String prefix, Document doc) {
979             return new SVGOMFEPointLightElement(prefix, (AbstractDocument)doc);
980         }
981     }
982
983     /**
984      * To create a 'feSpecularLighting' element.
985      */

986     protected static class FeSpecularLightingElementFactory
987         implements ElementFactory {
988         public FeSpecularLightingElementFactory() {}
989         /**
990          * Creates an instance of the associated element type.
991          */

992         public Element create(String prefix, Document doc) {
993             return new SVGOMFESpecularLightingElement(prefix,
994                                                       (AbstractDocument)doc);
995         }
996     }
997
998     /**
999      * To create a 'feSpotLight' element.
1000      */

1001     protected static class FeSpotLightElementFactory
1002         implements ElementFactory {
1003         public FeSpotLightElementFactory() {}
1004         /**
1005          * Creates an instance of the associated element type.
1006          */

1007         public Element create(String prefix, Document doc) {
1008             return new SVGOMFESpotLightElement(prefix, (AbstractDocument)doc);
1009         }
1010     }
1011
1012     /**
1013      * To create a 'feTile' element.
1014      */

1015     protected static class FeTileElementFactory implements ElementFactory {
1016         public FeTileElementFactory() {}
1017         /**
1018          * Creates an instance of the associated element type.
1019          */

1020         public Element create(String prefix, Document doc) {
1021             return new SVGOMFETileElement(prefix, (AbstractDocument)doc);
1022         }
1023     }
1024
1025     /**
1026      * To create a 'feTurbulence' element
1027      */

1028     protected static class FeTurbulenceElementFactory
1029         implements ElementFactory{
1030         public FeTurbulenceElementFactory() {}
1031         /**
1032          * Creates an instance of the associated element type.
1033          */

1034         public Element create(String prefix, Document doc) {
1035             return new SVGOMFETurbulenceElement(prefix, (AbstractDocument)doc);
1036         }
1037     }
1038
1039     /**
1040      * To create a 'filter' element.
1041      */

1042     protected static class FilterElementFactory implements ElementFactory {
1043         public FilterElementFactory() {}
1044         /**
1045          * Creates an instance of the associated element type.
1046          */

1047         public Element create(String prefix, Document doc) {
1048             return new SVGOMFilterElement(prefix, (AbstractDocument)doc);
1049         }
1050     }
1051
1052     /**
1053      * To create a 'font' element.
1054      */

1055     protected static class FontElementFactory implements ElementFactory {
1056         public FontElementFactory() {}
1057         /**
1058          * Creates an instance of the associated element type.
1059          */

1060         public Element create(String prefix, Document doc) {
1061             return new SVGOMFontElement(prefix, (AbstractDocument)doc);
1062         }
1063     }
1064
1065     /**
1066      * To create a 'font-face' element.
1067      */

1068     protected static class FontFaceElementFactory implements ElementFactory {
1069         public FontFaceElementFactory() {}
1070         /**
1071          * Creates an instance of the associated element type.
1072          */

1073         public Element create(String prefix, Document doc) {
1074             return new SVGOMFontFaceElement(prefix, (AbstractDocument)doc);
1075         }
1076     }
1077
1078     /**
1079      * To create a 'font-face-format' element.
1080      */

1081     protected static class FontFaceFormatElementFactory
1082         implements ElementFactory {
1083         public FontFaceFormatElementFactory() {}
1084         /**
1085          * Creates an instance of the associated element type.
1086          */

1087         public Element create(String prefix, Document doc) {
1088             return new SVGOMFontFaceFormatElement(prefix,
1089                                                   (AbstractDocument)doc);
1090         }
1091     }
1092
1093     /**
1094      * To create a 'font-face-name' element.
1095      */

1096     protected static class FontFaceNameElementFactory
1097         implements ElementFactory {
1098         public FontFaceNameElementFactory() {}
1099         /**
1100          * Creates an instance of the associated element type.
1101          */

1102         public Element create(String prefix, Document doc) {
1103             return new SVGOMFontFaceNameElement(prefix, (AbstractDocument)doc);
1104         }
1105     }
1106
1107     /**
1108      * To create a 'font-face-src' element.
1109      */

1110     protected static class FontFaceSrcElementFactory
1111         implements ElementFactory {
1112         public FontFaceSrcElementFactory() {}
1113         /**
1114          * Creates an instance of the associated element type.
1115          */

1116         public Element create(String prefix, Document doc) {
1117             return new SVGOMFontFaceSrcElement(prefix, (AbstractDocument)doc);
1118         }
1119     }
1120
1121     /**
1122      * To create a 'font-face-uri' element.
1123      */

1124     protected static class FontFaceUriElementFactory
1125         implements ElementFactory {
1126         public FontFaceUriElementFactory() {}
1127         /**
1128          * Creates an instance of the associated element type.
1129          */

1130         public Element create(String prefix, Document doc) {
1131             return new SVGOMFontFaceUriElement(prefix, (AbstractDocument)doc);
1132         }
1133     }
1134
1135     /**
1136      * To create a 'foreignObject' element.
1137      */

1138     protected static class ForeignObjectElementFactory
1139         implements ElementFactory {
1140         public ForeignObjectElementFactory() {}
1141         /**
1142          * Creates an instance of the associated element type.
1143          */

1144         public Element create(String prefix, Document doc) {
1145             return new SVGOMForeignObjectElement(prefix,
1146                                                  (AbstractDocument)doc);
1147         }
1148     }
1149
1150     /**
1151      * To create a 'g' element.
1152      */

1153     protected static class GElementFactory implements ElementFactory {
1154         public GElementFactory() {}
1155         /**
1156          * Creates an instance of the associated element type.
1157          */

1158         public Element create(String prefix, Document doc) {
1159             return new SVGOMGElement(prefix, (AbstractDocument)doc);
1160         }
1161     }
1162
1163     /**
1164      * To create a 'glyph' element.
1165      */

1166     protected static class GlyphElementFactory implements ElementFactory {
1167         public GlyphElementFactory() {}
1168         /**
1169          * Creates an instance of the associated element type.
1170          */

1171         public Element create(String prefix, Document doc) {
1172             return new SVGOMGlyphElement(prefix, (AbstractDocument)doc);
1173         }
1174     }
1175
1176     /**
1177      * To create a 'glyphRef' element.
1178      */

1179     protected static class GlyphRefElementFactory implements ElementFactory {
1180         public GlyphRefElementFactory() {}
1181         /**
1182          * Creates an instance of the associated element type.
1183          */

1184         public Element create(String prefix, Document doc) {
1185             return new SVGOMGlyphRefElement(prefix, (AbstractDocument)doc);
1186         }
1187     }
1188
1189     /**
1190      * To create a 'hkern' element.
1191      */

1192     protected static class HkernElementFactory implements ElementFactory {
1193         public HkernElementFactory() {}
1194         /**
1195          * Creates an instance of the associated element type.
1196          */

1197         public Element create(String prefix, Document doc) {
1198             return new SVGOMHKernElement(prefix, (AbstractDocument)doc);
1199         }
1200     }
1201
1202     /**
1203      * To create a 'image' element.
1204      */

1205     protected static class ImageElementFactory implements ElementFactory {
1206         public ImageElementFactory() {}
1207         /**
1208          * Creates an instance of the associated element type.
1209          */

1210         public Element create(String prefix, Document doc) {
1211             return new SVGOMImageElement(prefix, (AbstractDocument)doc);
1212         }
1213     }
1214
1215     /**
1216      * To create a 'line' element.
1217      */

1218     protected static class LineElementFactory implements ElementFactory {
1219         public LineElementFactory() {}
1220         /**
1221          * Creates an instance of the associated element type.
1222          */

1223         public Element create(String prefix, Document doc) {
1224             return new SVGOMLineElement(prefix, (AbstractDocument)doc);
1225         }
1226     }
1227
1228     /**
1229      * To create a 'linearGradient' element.
1230      */

1231     protected static class LinearGradientElementFactory
1232         implements ElementFactory {
1233         public LinearGradientElementFactory() {}
1234         /**
1235          * Creates an instance of the associated element type.
1236          */

1237         public Element create(String prefix, Document doc) {
1238             return new SVGOMLinearGradientElement(prefix,
1239                                                   (AbstractDocument)doc);
1240         }
1241     }
1242
1243     /**
1244      * To create a 'marker' element.
1245      */

1246     protected static class MarkerElementFactory implements ElementFactory {
1247         public MarkerElementFactory() {}
1248         /**
1249          * Creates an instance of the associated element type.
1250          */

1251         public Element create(String prefix, Document doc) {
1252             return new SVGOMMarkerElement(prefix, (AbstractDocument)doc);
1253         }
1254     }
1255
1256     /**
1257      * To create a 'mask' element.
1258      */

1259     protected static class MaskElementFactory implements ElementFactory {
1260         public MaskElementFactory() {}
1261         /**
1262          * Creates an instance of the associated element type.
1263          */

1264         public Element create(String prefix, Document doc) {
1265             return new SVGOMMaskElement(prefix, (AbstractDocument)doc);
1266         }
1267     }
1268
1269     /**
1270      * To create a 'metadata' element.
1271      */

1272     protected static class MetadataElementFactory implements ElementFactory {
1273         public MetadataElementFactory() {}
1274         /**
1275          * Creates an instance of the associated element type.
1276          */

1277         public Element create(String prefix, Document doc) {
1278             return new SVGOMMetadataElement(prefix, (AbstractDocument)doc);
1279         }
1280     }
1281
1282     /**
1283      * To create a 'missing-glyph' element.
1284      */

1285     protected static class MissingGlyphElementFactory
1286         implements ElementFactory {
1287         public MissingGlyphElementFactory() {}
1288         /**
1289          * Creates an instance of the associated element type.
1290          */

1291         public Element create(String prefix, Document doc) {
1292             return new SVGOMMissingGlyphElement(prefix, (AbstractDocument)doc);
1293         }
1294     }
1295
1296     /**
1297      * To create a 'mpath' element.
1298      */

1299     protected static class MpathElementFactory implements ElementFactory {
1300         public MpathElementFactory() {}
1301         /**
1302          * Creates an instance of the associated element type.
1303          */

1304         public Element create(String prefix, Document doc) {
1305             return new SVGOMMPathElement(prefix, (AbstractDocument)doc);
1306         }
1307     }
1308
1309     /**
1310      * To create a 'path' element.
1311      */

1312     protected static class PathElementFactory implements ElementFactory {
1313         public PathElementFactory() {}
1314         /**
1315          * Creates an instance of the associated element type.
1316          */

1317         public Element create(String prefix, Document doc) {
1318             return new SVGOMPathElement(prefix, (AbstractDocument)doc);
1319         }
1320     }
1321
1322     /**
1323      * To create a 'pattern' element.
1324      */

1325     protected static class PatternElementFactory implements ElementFactory {
1326         public PatternElementFactory() {}
1327         /**
1328          * Creates an instance of the associated element type.
1329          */

1330         public Element create(String prefix, Document doc) {
1331             return new SVGOMPatternElement(prefix, (AbstractDocument)doc);
1332         }
1333     }
1334
1335     /**
1336      * To create a 'polygon' element.
1337      */

1338     protected static class PolygonElementFactory implements ElementFactory {
1339         public PolygonElementFactory() {}
1340         /**
1341          * Creates an instance of the associated element type.
1342          */

1343         public Element create(String prefix, Document doc) {
1344             return new SVGOMPolygonElement(prefix, (AbstractDocument)doc);
1345         }
1346     }
1347
1348     /**
1349      * To create a 'polyline' element.
1350      */

1351     protected static class PolylineElementFactory implements ElementFactory {
1352         public PolylineElementFactory() {}
1353         /**
1354          * Creates an instance of the associated element type.
1355          */

1356         public Element create(String prefix, Document doc) {
1357             return new SVGOMPolylineElement(prefix, (AbstractDocument)doc);
1358         }
1359     }
1360
1361     /**
1362      * To create a 'radialGradient' element.
1363      */

1364     protected static class RadialGradientElementFactory
1365         implements ElementFactory {
1366         public RadialGradientElementFactory() {}
1367         /**
1368          * Creates an instance of the associated element type.
1369          */

1370         public Element create(String prefix, Document doc) {
1371             return new SVGOMRadialGradientElement(prefix,
1372                                                   (AbstractDocument)doc);
1373         }
1374     }
1375
1376     /**
1377      * To create a 'rect' element.
1378      */

1379     protected static class RectElementFactory implements ElementFactory {
1380         public RectElementFactory() {}
1381         /**
1382          * Creates an instance of the associated element type.
1383          */

1384         public Element create(String prefix, Document doc) {
1385             return new SVGOMRectElement(prefix, (AbstractDocument)doc);
1386         }
1387     }
1388
1389     /**
1390      * To create a 'script' element.
1391      */

1392     protected static class ScriptElementFactory implements ElementFactory {
1393         public ScriptElementFactory() {}
1394         /**
1395          * Creates an instance of the associated element type.
1396          */

1397         public Element create(String prefix, Document doc) {
1398             return new SVGOMScriptElement(prefix, (AbstractDocument)doc);
1399         }
1400     }
1401
1402     /**
1403      * To create a 'set' element.
1404      */

1405     protected static class SetElementFactory implements ElementFactory {
1406         public SetElementFactory() {}
1407         /**
1408          * Creates an instance of the associated element type.
1409          */

1410         public Element create(String prefix, Document doc) {
1411             return new SVGOMSetElement(prefix, (AbstractDocument)doc);
1412         }
1413     }
1414
1415     /**
1416      * To create a 'stop' element.
1417      */

1418     protected static class StopElementFactory implements ElementFactory {
1419         public StopElementFactory() {}
1420         /**
1421          * Creates an instance of the associated element type.
1422          */

1423         public Element create(String prefix, Document doc) {
1424             return new SVGOMStopElement(prefix, (AbstractDocument)doc);
1425         }
1426     }
1427
1428     /**
1429      * To create a 'style' element.
1430      */

1431     protected static class StyleElementFactory implements ElementFactory {
1432         public StyleElementFactory() {}
1433         /**
1434          * Creates an instance of the associated element type.
1435          */

1436         public Element create(String prefix, Document doc) {
1437             return new SVGOMStyleElement(prefix, (AbstractDocument)doc);
1438         }
1439     }
1440
1441     /**
1442      * To create an 'svg' element.
1443      */

1444     protected static class SvgElementFactory implements ElementFactory {
1445         public SvgElementFactory() {}
1446         /**
1447          * Creates an instance of the associated element type.
1448          */

1449         public Element create(String prefix, Document doc) {
1450             return new SVGOMSVGElement(prefix, (AbstractDocument)doc);
1451         }
1452     }
1453
1454     /**
1455      * To create a 'switch' element.
1456      */

1457     protected static class SwitchElementFactory implements ElementFactory {
1458         public SwitchElementFactory() {}
1459         /**
1460          * Creates an instance of the associated element type.
1461          */

1462         public Element create(String prefix, Document doc) {
1463             return new SVGOMSwitchElement(prefix, (AbstractDocument)doc);
1464         }
1465     }
1466
1467     /**
1468      * To create a 'symbol' element.
1469      */

1470     protected static class SymbolElementFactory implements ElementFactory {
1471         public SymbolElementFactory() {}
1472         /**
1473          * Creates an instance of the associated element type.
1474          */

1475         public Element create(String prefix, Document doc) {
1476             return new SVGOMSymbolElement(prefix, (AbstractDocument)doc);
1477         }
1478     }
1479
1480     /**
1481      * To create a 'text' element.
1482      */

1483     protected static class TextElementFactory implements ElementFactory {
1484         public TextElementFactory() {}
1485         /**
1486          * Creates an instance of the associated element type.
1487          */

1488         public Element create(String prefix, Document doc) {
1489             return new SVGOMTextElement(prefix, (AbstractDocument)doc);
1490         }
1491     }
1492
1493     /**
1494      * To create a 'textPath' element.
1495      */

1496     protected static class TextPathElementFactory implements ElementFactory {
1497         public TextPathElementFactory() {}
1498         /**
1499          * Creates an instance of the associated element type.
1500          */

1501         public Element create(String prefix, Document doc) {
1502             return new SVGOMTextPathElement(prefix, (AbstractDocument)doc);
1503         }
1504     }
1505
1506     /**
1507      * To create a 'title' element.
1508      */

1509     protected static class TitleElementFactory implements ElementFactory {
1510         public TitleElementFactory() {}
1511         /**
1512          * Creates an instance of the associated element type.
1513          */

1514         public Element create(String prefix, Document doc) {
1515             return new SVGOMTitleElement(prefix, (AbstractDocument)doc);
1516         }
1517     }
1518
1519     /**
1520      * To create a 'tref' element.
1521      */

1522     protected static class TrefElementFactory implements ElementFactory {
1523         public TrefElementFactory() {}
1524         /**
1525          * Creates an instance of the associated element type.
1526          */

1527         public Element create(String prefix, Document doc) {
1528             return new SVGOMTRefElement(prefix, (AbstractDocument)doc);
1529         }
1530     }
1531
1532     /**
1533      * To create a 'tspan' element.
1534      */

1535     protected static class TspanElementFactory implements ElementFactory {
1536         public TspanElementFactory() {}
1537         /**
1538          * Creates an instance of the associated element type.
1539          */

1540         public Element create(String prefix, Document doc) {
1541             return new SVGOMTSpanElement(prefix, (AbstractDocument)doc);
1542         }
1543     }
1544
1545     /**
1546      * To create a 'use' element.
1547      */

1548     protected static class UseElementFactory implements ElementFactory {
1549         public UseElementFactory() {}
1550         /**
1551          * Creates an instance of the associated element type.
1552          */

1553         public Element create(String prefix, Document doc) {
1554             return new SVGOMUseElement(prefix, (AbstractDocument)doc);
1555         }
1556     }
1557
1558     /**
1559      * To create a 'view' element.
1560      */

1561     protected static class ViewElementFactory implements ElementFactory {
1562         public ViewElementFactory() {}
1563         /**
1564          * Creates an instance of the associated element type.
1565          */

1566         public Element create(String prefix, Document doc) {
1567             return new SVGOMViewElement(prefix, (AbstractDocument)doc);
1568         }
1569     }
1570
1571     /**
1572      * To create a 'vkern' element.
1573      */

1574     protected static class VkernElementFactory implements ElementFactory {
1575         public VkernElementFactory() {}
1576         /**
1577          * Creates an instance of the associated element type.
1578          */

1579         public Element create(String prefix, Document doc) {
1580             return new SVGOMVKernElement(prefix, (AbstractDocument)doc);
1581         }
1582     }
1583
1584     /**
1585      * The default instance of this class.
1586      */

1587     protected static final DOMImplementation DOM_IMPLEMENTATION =
1588         new SVGDOMImplementation();
1589
1590 }
1591