fa00b5e169ae64cbf37faed52104e67f3b0ac9ce
[aai/schema-service.git] / aai-schema-gen / src / main / java / org / onap / aai / schemagen / genxsd / XSDElement.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * <p>
11  * http://www.apache.org/licenses/LICENSE-2.0
12  * <p>
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aai.schemagen.genxsd;
22
23 import com.google.common.base.Joiner;
24
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.StringTokenizer;
28 import java.util.Vector;
29
30 import org.apache.commons.lang3.StringUtils;
31 import org.onap.aai.setup.SchemaVersion;
32 import org.w3c.dom.Attr;
33 import org.w3c.dom.DOMException;
34 import org.w3c.dom.Document;
35 import org.w3c.dom.Element;
36 import org.w3c.dom.NamedNodeMap;
37 import org.w3c.dom.Node;
38 import org.w3c.dom.NodeList;
39 import org.w3c.dom.TypeInfo;
40 import org.w3c.dom.UserDataHandler;
41
42 public class XSDElement implements Element {
43     Element xmlElementElement;
44     String maxOccurs;
45     private static final int VALUE_NONE = 0;
46     private static final int VALUE_DESCRIPTION = 1;
47     private static final int VALUE_INDEXED_PROPS = 2;
48     private static final int VALUE_CONTAINER = 3;
49     private static final int VALUE_REQUIRES = 4;
50     private static final int VALUE_DSLSTARTNODE = 5;
51
52     public XSDElement(Element xmlElementElement, String maxOccurs) {
53         super();
54         this.xmlElementElement = xmlElementElement;
55         this.maxOccurs = maxOccurs;
56     }
57
58     public XSDElement(Element xmlElementElement) {
59         super();
60         this.xmlElementElement = xmlElementElement;
61         this.maxOccurs = null;
62     }
63
64     public String name() {
65         return this.getAttribute("name");
66     }
67
68     public Vector<String> getAddTypes(String version) {
69         String apiVersionFmt = "." + version + ".";
70         NamedNodeMap attributes = this.getAttributes();
71         Vector<String> addTypeV = new Vector<>(); // vector of 1
72         String addType = null;
73
74         for (int j = 0; j < attributes.getLength(); ++j) {
75             Attr attr = (Attr) attributes.item(j);
76             String attrName = attr.getNodeName();
77
78             String attrValue = attr.getNodeValue();
79             if ("type".equals(attrName)) {
80                 if (attrValue.contains(apiVersionFmt)) {
81                     addType = attrValue.substring(attrValue.lastIndexOf('.') + 1);
82                     addTypeV.add(addType);
83                 }
84
85             }
86         }
87         return addTypeV;
88     }
89
90     public String getRequiresProperty() {
91         String elementAlsoRequiresProperty = null;
92         NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
93
94         for (int i = 0; i < xmlPropNodes.getLength(); ++i) {
95             Element xmlPropElement = (Element) xmlPropNodes.item(i);
96             if (!xmlPropElement.getParentNode().getAttributes().getNamedItem("name").getNodeValue()
97                 .equals(this.xmlElementElement.getAttribute("name"))) {
98                 continue;
99             }
100             NodeList childNodes = xmlPropElement.getElementsByTagName("xml-property");
101
102             for (int j = 0; j < childNodes.getLength(); ++j) {
103                 Element childElement = (Element) childNodes.item(j);
104                 // get name
105                 int useValue = VALUE_NONE;
106                 NamedNodeMap attributes = childElement.getAttributes();
107                 for (int k = 0; k < attributes.getLength(); ++k) {
108                     Attr attr = (Attr) attributes.item(k);
109                     String attrName = attr.getNodeName();
110                     String attrValue = attr.getNodeValue();
111                     if (attrName == null || attrValue == null) {
112                         continue;
113                     }
114                     if (attrName.equals("name") && attrValue.equals("requires")) {
115                         useValue = VALUE_REQUIRES;
116                     }
117                     if (useValue == VALUE_REQUIRES && attrName.equals("value")) {
118                         elementAlsoRequiresProperty = attrValue;
119                     }
120                 }
121             }
122         }
123         return elementAlsoRequiresProperty;
124     }
125
126     public String getPathDescriptionProperty() {
127         String pathDescriptionProperty = null;
128         NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
129
130         for (int i = 0; i < xmlPropNodes.getLength(); ++i) {
131             Element xmlPropElement = (Element) xmlPropNodes.item(i);
132             if (!xmlPropElement.getParentNode().getAttributes().getNamedItem("name").getNodeValue()
133                 .equals(this.xmlElementElement.getAttribute("name"))) {
134                 continue;
135             }
136             // This stopped working, replaced with above - should figure out why...
137             // if ( !xmlPropElement.getParentNode().isSameNode(this.xmlElementElement))
138             // continue;
139             NodeList childNodes = xmlPropElement.getElementsByTagName("xml-property");
140
141             for (int j = 0; j < childNodes.getLength(); ++j) {
142                 Element childElement = (Element) childNodes.item(j);
143                 // get name
144                 int useValue = VALUE_NONE;
145                 NamedNodeMap attributes = childElement.getAttributes();
146                 for (int k = 0; k < attributes.getLength(); ++k) {
147                     Attr attr = (Attr) attributes.item(k);
148                     String attrName = attr.getNodeName();
149                     String attrValue = attr.getNodeValue();
150                     if (attrName == null || attrValue == null) {
151                         continue;
152                     }
153                     if (attrName.equals("name") && attrValue.equals("description")) {
154                         useValue = VALUE_DESCRIPTION;
155                     }
156                     if (useValue == VALUE_DESCRIPTION && attrName.equals("value")) {
157                         pathDescriptionProperty = attrValue;
158                     }
159                 }
160             }
161         }
162         if (pathDescriptionProperty != null) {
163             // suppress non-printable characters in a description
164             String replaceDescription = pathDescriptionProperty.replaceAll("[^\\p{ASCII}]", "");
165             return replaceDescription;
166         }
167         return pathDescriptionProperty;
168     }
169
170     public Vector<String> getProps(int needValue) {
171         Vector<String> props = new Vector<String>();
172         NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
173
174         for (int i = 0; i < xmlPropNodes.getLength(); ++i) {
175             Element xmlPropElement = (Element) xmlPropNodes.item(i);
176             if (!xmlPropElement.getParentNode().isSameNode(this.xmlElementElement)) {
177                 continue;
178             }
179             NodeList childNodes = xmlPropElement.getElementsByTagName("xml-property");
180             for (int j = 0; j < childNodes.getLength(); ++j) {
181                 Element childElement = (Element) childNodes.item(j);
182                 // get name
183                 int useValue = VALUE_NONE;
184                 NamedNodeMap attributes = childElement.getAttributes();
185                 for (int k = 0; k < attributes.getLength(); ++k) {
186                     Attr attr = (Attr) attributes.item(k);
187                     String attrName = attr.getNodeName();
188                     String attrValue = attr.getNodeValue();
189                     if (attrName == null || attrValue == null) {
190                         continue;
191                     }
192                     if (needValue == VALUE_INDEXED_PROPS && attrValue.equals("indexedProps")) {
193                         useValue = VALUE_INDEXED_PROPS;
194                     } else if (needValue == VALUE_DSLSTARTNODE
195                         && attrValue.equals("dslStartNodeProps")) {
196                         useValue = VALUE_DSLSTARTNODE;
197                     }
198                     if (useValue != VALUE_NONE && attrName.equals("value")) {
199                         props = getProps(attrValue);
200                     }
201                 }
202             }
203         }
204         return props;
205     }
206
207     private static Vector<String> getProps(String attrValue) {
208         if (attrValue == null) {
209             return null;
210         }
211         StringTokenizer st = new StringTokenizer(attrValue, ",");
212         if (st.countTokens() == 0) {
213             return null;
214         }
215         Vector<String> result = new Vector<String>();
216         while (st.hasMoreTokens()) {
217             result.add(st.nextToken());
218         }
219         return result;
220     }
221
222     public Vector<String> getIndexedProps() {
223         return getProps(VALUE_INDEXED_PROPS);
224     }
225
226     public Vector<String> getDslStartNodeProps() {
227         return getProps(VALUE_DSLSTARTNODE);
228     }
229
230     public String getContainerProperty() {
231         NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
232         String container = null;
233         for (int i = 0; i < xmlPropNodes.getLength(); ++i) {
234             Element xmlPropElement = (Element) xmlPropNodes.item(i);
235             if (!xmlPropElement.getParentNode().isSameNode(this.xmlElementElement)) {
236                 continue;
237             }
238             NodeList childNodes = xmlPropElement.getElementsByTagName("xml-property");
239             for (int j = 0; j < childNodes.getLength(); ++j) {
240                 Element childElement = (Element) childNodes.item(j);
241                 // get name
242                 int useValue = VALUE_NONE;
243                 NamedNodeMap attributes = childElement.getAttributes();
244                 for (int k = 0; k < attributes.getLength(); ++k) {
245                     Attr attr = (Attr) attributes.item(k);
246                     String attrName = attr.getNodeName();
247                     String attrValue = attr.getNodeValue();
248                     if (attrName == null || attrValue == null) {
249                         continue;
250                     }
251                     if (useValue == VALUE_CONTAINER && attrName.equals("value")) {
252                         container = attrValue;
253                     }
254                     if (attrValue.equals("container")) {
255                         useValue = VALUE_CONTAINER;
256                     }
257                 }
258             }
259         }
260         return container;
261     }
262
263     public String getQueryParamYAML() {
264         StringBuilder sbParameter = new StringBuilder();
265         sbParameter.append("        - name: ").append(this.getAttribute("name")).append("\n");
266         sbParameter.append(("          in: query\n"));
267         if (this.getAttribute("description") != null
268             && this.getAttribute("description").length() > 0) {
269             sbParameter.append("          description: ").append(this.getAttribute("description"))
270                 .append("\n");
271         } else {
272             sbParameter.append(("          description: n/a\n"));
273         }
274         sbParameter.append(("          required: false\n"));
275         if (("java.lang.String").equals(this.getAttribute("type"))) {
276             sbParameter.append("          type: string\n");
277         }
278         if (("java.lang.Long").equals(this.getAttribute("type"))) {
279             sbParameter.append("          type: integer\n");
280             sbParameter.append("          format: int64\n");
281         }
282         if (("java.lang.Integer").equals(this.getAttribute("type"))) {
283             sbParameter.append("          type: integer\n");
284             sbParameter.append("          format: int32\n");
285         }
286         if (("java.lang.Float").equals(this.getAttribute("type"))) {
287             sbParameter.append("          type: number\n");
288             sbParameter.append("          format: float\n");
289         }
290         if (("java.lang.Double").equals(this.getAttribute("type"))) {
291             sbParameter.append("          type: number\n");
292             sbParameter.append("          format: double\n");
293         }
294         if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
295             sbParameter.append("          type: boolean\n");
296         }
297         return sbParameter.toString();
298     }
299
300     public String getPathParamYAML(String elementDescription) {
301         return getPathParamYAML(elementDescription, null);
302     }
303
304     public String getPathParamYAML(String elementDescription, String overrideName) {
305         // updated to allow caller to provide parameter name to use in API
306         StringBuilder sbParameter = new StringBuilder();
307         if (overrideName == null) {
308             overrideName = this.getAttribute("name");
309         }
310         sbParameter.append("        - name: ").append(overrideName).append("\n");
311         sbParameter.append(("          in: path\n"));
312         if (elementDescription != null && elementDescription.length() > 0) {
313             sbParameter.append("          description: ").append(elementDescription).append("\n");
314         }
315         sbParameter.append(("          required: true\n"));
316         if (("java.lang.String").equals(this.getAttribute("type"))) {
317             sbParameter.append("          type: string\n");
318         }
319         if (("java.lang.Long").equals(this.getAttribute("type"))) {
320             sbParameter.append("          type: integer\n");
321             sbParameter.append("          format: int64\n");
322         }
323         if (("java.lang.Integer").equals(this.getAttribute("type"))) {
324             sbParameter.append("          type: integer\n");
325             sbParameter.append("          format: int32\n");
326         }
327         if (("java.lang.Float").equals(this.getAttribute("type"))) {
328             sbParameter.append("          type: number\n");
329             sbParameter.append("          format: float\n");
330         }
331         if (("java.lang.Double").equals(this.getAttribute("type"))) {
332             sbParameter.append("          type: number\n");
333             sbParameter.append("          format: double\n");
334         }
335         if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
336             sbParameter.append("          type: boolean\n");
337         }
338         if (StringUtils.isNotBlank(this.getAttribute("name"))) {
339             sbParameter.append("          example: " + "__")
340                 .append(this.getAttribute("name").toUpperCase()).append("__").append("\n");
341         }
342         return sbParameter.toString();
343     }
344
345     public String getHTMLElement(SchemaVersion v, boolean useAnnotation, HTMLfromOXM driver) {
346         StringBuilder sbElement = new StringBuilder();
347         String elementName = this.getAttribute("name");
348         String elementType = this.getAttribute("type");
349         String elementContainerType = this.getAttribute("container-type");
350         String elementIsRequired = this.getAttribute("required");
351         String addType = elementType.contains("." + v.toString() + ".")
352             ? elementType.substring(elementType.lastIndexOf('.') + 1)
353             : null;
354
355         if (addType != null) {
356             sbElement.append("        <xs:element ref=\"tns:")
357                 .append(driver.getXmlRootElementName(addType)).append("\"");
358         } else {
359             sbElement.append("        <xs:element name=\"").append(elementName).append("\"");
360         }
361         if (elementType.equals("java.lang.String")) {
362             sbElement.append(" type=\"xs:string\"");
363         }
364         if (elementType.equals("java.lang.Long")) {
365             sbElement.append(" type=\"xs:unsignedInt\"");
366         }
367         if (elementType.equals("java.lang.Integer")) {
368             sbElement.append(" type=\"xs:int\"");
369         }
370         if (elementType.equals("java.lang.Float")) {
371             sbElement.append(" type=\"xs:float\"");
372         }
373         if (elementType.equals("java.lang.Double")) {
374             sbElement.append(" type=\"xs:double\"");
375         }
376         if (elementType.equals("java.lang.Boolean")) {
377             sbElement.append(" type=\"xs:boolean\"");
378         }
379         if (addType != null || elementType.startsWith("java.lang.")) {
380             sbElement.append(" minOccurs=\"0\"");
381         }
382         if (elementContainerType != null && elementContainerType.equals("java.util.ArrayList")) {
383             sbElement.append(" maxOccurs=\"").append(maxOccurs).append("\"");
384         }
385         if (useAnnotation) {
386             String annotation = new XSDElement(xmlElementElement, maxOccurs)
387                 .getHTMLAnnotation("field", "          ");
388             sbElement.append(
389                 StringUtils.isNotEmpty(annotation) ? ">" + OxmFileProcessor.LINE_SEPARATOR : "");
390             sbElement.append(annotation);
391             sbElement.append(StringUtils.isNotEmpty(annotation)
392                 ? "        </xs:element>" + OxmFileProcessor.LINE_SEPARATOR
393                 : "/>" + OxmFileProcessor.LINE_SEPARATOR);
394         } else {
395             sbElement.append("/>").append(OxmFileProcessor.LINE_SEPARATOR);
396         }
397         return this.getHTMLElementWrapper(sbElement.toString(), v, useAnnotation);
398         // return sbElement.toString();
399     }
400
401     public String getHTMLElementWrapper(String unwrappedElement, SchemaVersion v,
402         boolean useAnnotation) {
403
404         NodeList childNodes = this.getElementsByTagName("xml-element-wrapper");
405
406         String xmlElementWrapper = null;
407         if (childNodes.getLength() > 0) {
408             Element childElement = (Element) childNodes.item(0);
409             // get name
410             xmlElementWrapper = childElement == null ? null : childElement.getAttribute("name");
411         }
412         if (xmlElementWrapper == null) {
413             return unwrappedElement;
414         }
415
416         StringBuilder sbElement = new StringBuilder();
417         sbElement.append("        <xs:element name=\"").append(xmlElementWrapper).append("\"");
418         String elementType = xmlElementElement.getAttribute("type");
419         String elementIsRequired = this.getAttribute("required");
420         String addType = elementType.contains("." + v.toString() + ".")
421             ? elementType.substring(elementType.lastIndexOf('.') + 1)
422             : null;
423
424         if (elementIsRequired == null || !elementIsRequired.equals("true") || addType != null) {
425             sbElement.append(" minOccurs=\"0\"");
426         }
427         sbElement.append(">").append(OxmFileProcessor.LINE_SEPARATOR);
428         sbElement.append("          <xs:complexType>").append(OxmFileProcessor.LINE_SEPARATOR);
429         if (useAnnotation) {
430             XSDElement javaTypeElement = new XSDElement((Element) this.getParentNode(), maxOccurs);
431             sbElement.append(javaTypeElement.getHTMLAnnotation("class", "            "));
432         }
433         sbElement.append("            <xs:sequence>").append(OxmFileProcessor.LINE_SEPARATOR);
434         sbElement.append("      ");
435         sbElement.append(unwrappedElement);
436         sbElement.append("            </xs:sequence>").append(OxmFileProcessor.LINE_SEPARATOR);
437         sbElement.append("          </xs:complexType>").append(OxmFileProcessor.LINE_SEPARATOR);
438         sbElement.append("        </xs:element>").append(OxmFileProcessor.LINE_SEPARATOR);
439         return sbElement.toString();
440     }
441
442     public String getHTMLAnnotation(String target, String indentation) {
443         StringBuilder sb = new StringBuilder();
444         List<String> metadata = new ArrayList<>();
445         if ("true".equals(this.getAttribute("xml-key"))) {
446             metadata.add("isKey=true");
447         }
448
449         NodeList xmlPropTags = this.getElementsByTagName("xml-properties");
450         Element xmlPropElement = null;
451         for (int i = 0; i < xmlPropTags.getLength(); ++i) {
452             xmlPropElement = (Element) xmlPropTags.item(i);
453             if (xmlPropElement.getParentNode().getAttributes().getNamedItem("name").getNodeValue()
454                 .equals(this.xmlElementElement.getAttribute("name"))) {
455                 break;
456             }
457         }
458         if (xmlPropElement != null) {
459             NodeList xmlProperties = xmlPropElement.getElementsByTagName("xml-property");
460             for (int i = 0; i < xmlProperties.getLength(); i++) {
461                 Element item = (Element) xmlProperties.item(i);
462                 String name = item.getAttribute("name");
463                 String value = item.getAttribute("value");
464                 if (name.equals("abstract")) {
465                     name = "isAbstract";
466                 } else if (name.equals("extends")) {
467                     name = "extendsFrom";
468                 }
469                 metadata.add(name + "=\"" + value.replaceAll("&", "&amp;") + "\"");
470             }
471         }
472         if (metadata.size() == 0) {
473             return "";
474         }
475         sb.append(indentation).append("<xs:annotation>").append(OxmFileProcessor.LINE_SEPARATOR);
476         sb.append(indentation).append("  <xs:appinfo>").append(OxmFileProcessor.LINE_SEPARATOR)
477             .append(indentation).append("    <annox:annotate target=\"").append(target)
478             .append("\">@org.onap.aai.annotations.Metadata(").append(Joiner.on(",").join(metadata))
479             .append(")</annox:annotate>").append(OxmFileProcessor.LINE_SEPARATOR)
480             .append(indentation).append("  </xs:appinfo>").append(OxmFileProcessor.LINE_SEPARATOR);
481         sb.append(indentation).append("</xs:annotation>").append(OxmFileProcessor.LINE_SEPARATOR);
482         return sb.toString();
483     }
484
485     public String getTypePropertyYAML(boolean isDslStartNode) {
486         StringBuilder sbProperties = new StringBuilder();
487         sbProperties.append("      ").append(this.getAttribute("name")).append(":\n");
488         sbProperties.append("        type: ");
489
490         if (("java.lang.String").equals(this.getAttribute("type"))) {
491             sbProperties.append("string\n");
492         } else if (("java.lang.Long").equals(this.getAttribute("type"))) {
493             sbProperties.append("integer\n");
494             sbProperties.append("        format: int64\n");
495         } else if (("java.lang.Integer").equals(this.getAttribute("type"))) {
496             sbProperties.append("integer\n");
497             sbProperties.append("        format: int32\n");
498         } else if (("java.lang.Float").equals(this.getAttribute("type"))) {
499             sbProperties.append("number\n");
500             sbProperties.append("        format: float\n");
501         } else if (("java.lang.Double").equals(this.getAttribute("type"))) {
502             sbProperties.append("number\n");
503             sbProperties.append("        format: double\n");
504         } else if (("java.lang.Boolean").equals(this.getAttribute("type"))) {
505             sbProperties.append("boolean\n");
506         }
507         String attrDescription = this.getPathDescriptionProperty();
508         if (attrDescription != null && attrDescription.length() > 0) {
509             if (!isDslStartNode) {
510                 sbProperties.append("        description: ").append(attrDescription).append("\n");
511             } else {
512                 sbProperties.append("        description: |\n");
513                 sbProperties.append("          ").append(attrDescription).append("\n");
514                 sbProperties.append(
515                     "          *This property can be used as a filter to find the start node for a dsl query\n");
516             }
517         } else {
518             if (isDslStartNode) {
519                 sbProperties.append("        description: |\n");
520                 sbProperties.append("          \n");
521                 sbProperties.append(
522                     "          *This property can be used as a filter to find the start node for a dsl query\n");
523             }
524         }
525         String elementAlsoRequiresProperty = this.getRequiresProperty();
526         if (StringUtils.isNotEmpty(elementAlsoRequiresProperty)) {
527             sbProperties.append("        also requires: ").append(elementAlsoRequiresProperty)
528                 .append("\n");
529         }
530         return sbProperties.toString();
531     }
532
533     public boolean isStandardType() {
534         switch (this.getAttribute("type")) {
535             case "java.lang.String":
536             case "java.lang.Long":
537             case "java.lang.Integer":
538             case "java.lang.Float":
539             case "java.lang.Double":
540             case "java.lang.Boolean":
541                 return true;
542         }
543         return false;
544     }
545
546     @Override
547     public String getNodeName() {
548         return xmlElementElement.getNodeName();
549     }
550
551     @Override
552     public String getNodeValue() throws DOMException {
553         return xmlElementElement.getNodeValue();
554     }
555
556     @Override
557     public void setNodeValue(String nodeValue) throws DOMException {
558         xmlElementElement.setNodeValue(nodeValue);
559     }
560
561     @Override
562     public short getNodeType() {
563         return xmlElementElement.getNodeType();
564     }
565
566     @Override
567     public Node getParentNode() {
568         return xmlElementElement.getParentNode();
569     }
570
571     @Override
572     public NodeList getChildNodes() {
573         return xmlElementElement.getChildNodes();
574     }
575
576     @Override
577     public Node getFirstChild() {
578         return xmlElementElement.getFirstChild();
579     }
580
581     @Override
582     public Node getLastChild() {
583         return xmlElementElement.getLastChild();
584     }
585
586     @Override
587     public Node getPreviousSibling() {
588         return xmlElementElement.getPreviousSibling();
589     }
590
591     @Override
592     public Node getNextSibling() {
593         return xmlElementElement.getNextSibling();
594     }
595
596     @Override
597     public NamedNodeMap getAttributes() {
598         return xmlElementElement.getAttributes();
599     }
600
601     @Override
602     public Document getOwnerDocument() {
603         return xmlElementElement.getOwnerDocument();
604     }
605
606     @Override
607     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
608         return xmlElementElement.insertBefore(newChild, refChild);
609     }
610
611     @Override
612     public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
613         return xmlElementElement.replaceChild(newChild, oldChild);
614     }
615
616     @Override
617     public Node removeChild(Node oldChild) throws DOMException {
618         return xmlElementElement.removeChild(oldChild);
619     }
620
621     @Override
622     public Node appendChild(Node newChild) throws DOMException {
623         return xmlElementElement.appendChild(newChild);
624     }
625
626     @Override
627     public boolean hasChildNodes() {
628         return xmlElementElement.hasChildNodes();
629     }
630
631     @Override
632     public Node cloneNode(boolean deep) {
633         return xmlElementElement.cloneNode(deep);
634     }
635
636     @Override
637     public void normalize() {
638         xmlElementElement.normalize();
639     }
640
641     @Override
642     public boolean isSupported(String feature, String version) {
643         return xmlElementElement.isSupported(feature, version);
644     }
645
646     @Override
647     public String getNamespaceURI() {
648         return xmlElementElement.getNamespaceURI();
649     }
650
651     @Override
652     public String getPrefix() {
653         return xmlElementElement.getPrefix();
654     }
655
656     @Override
657     public void setPrefix(String prefix) throws DOMException {
658         xmlElementElement.setPrefix(prefix);
659     }
660
661     @Override
662     public String getLocalName() {
663
664         return xmlElementElement.getLocalName();
665     }
666
667     @Override
668     public boolean hasAttributes() {
669         return xmlElementElement.hasAttributes();
670     }
671
672     @Override
673     public String getBaseURI() {
674         return xmlElementElement.getBaseURI();
675     }
676
677     @Override
678     public short compareDocumentPosition(Node other) throws DOMException {
679         return xmlElementElement.compareDocumentPosition(other);
680     }
681
682     @Override
683     public String getTextContent() throws DOMException {
684         return xmlElementElement.getTextContent();
685     }
686
687     @Override
688     public void setTextContent(String textContent) throws DOMException {
689         xmlElementElement.setTextContent(textContent);
690     }
691
692     @Override
693     public boolean isSameNode(Node other) {
694         return xmlElementElement.isSameNode(other);
695     }
696
697     @Override
698     public String lookupPrefix(String namespaceURI) {
699         return xmlElementElement.lookupPrefix(namespaceURI);
700     }
701
702     @Override
703     public boolean isDefaultNamespace(String namespaceURI) {
704         return xmlElementElement.isDefaultNamespace(namespaceURI);
705     }
706
707     @Override
708     public String lookupNamespaceURI(String prefix) {
709         return xmlElementElement.lookupNamespaceURI(prefix);
710     }
711
712     @Override
713     public boolean isEqualNode(Node arg) {
714         return xmlElementElement.isEqualNode(arg);
715     }
716
717     @Override
718     public Object getFeature(String feature, String version) {
719         return xmlElementElement.getFeature(feature, version);
720     }
721
722     @Override
723     public Object setUserData(String key, Object data, UserDataHandler handler) {
724         return xmlElementElement.setUserData(key, data, handler);
725     }
726
727     @Override
728     public Object getUserData(String key) {
729         return xmlElementElement.getUserData(key);
730     }
731
732     @Override
733     public String getTagName() {
734         return xmlElementElement.getTagName();
735     }
736
737     @Override
738     public String getAttribute(String name) {
739         return xmlElementElement.getAttribute(name);
740     }
741
742     @Override
743     public void setAttribute(String name, String value) throws DOMException {
744         xmlElementElement.setAttribute(name, value);
745     }
746
747     @Override
748     public void removeAttribute(String name) throws DOMException {
749         xmlElementElement.removeAttribute(name);
750     }
751
752     @Override
753     public Attr getAttributeNode(String name) {
754         return xmlElementElement.getAttributeNode(name);
755     }
756
757     @Override
758     public Attr setAttributeNode(Attr newAttr) throws DOMException {
759         return xmlElementElement.setAttributeNode(newAttr);
760     }
761
762     @Override
763     public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
764         return xmlElementElement.removeAttributeNode(oldAttr);
765     }
766
767     @Override
768     public NodeList getElementsByTagName(String name) {
769         return xmlElementElement.getElementsByTagName(name);
770     }
771
772     @Override
773     public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
774         return xmlElementElement.getAttributeNS(namespaceURI, localName);
775     }
776
777     @Override
778     public void setAttributeNS(String namespaceURI, String qualifiedName, String value)
779         throws DOMException {
780         xmlElementElement.setAttributeNS(namespaceURI, qualifiedName, value);
781     }
782
783     @Override
784     public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
785         xmlElementElement.removeAttributeNS(namespaceURI, localName);
786     }
787
788     @Override
789     public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException {
790         return xmlElementElement.getAttributeNodeNS(namespaceURI, localName);
791     }
792
793     @Override
794     public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
795         return xmlElementElement.setAttributeNodeNS(newAttr);
796     }
797
798     @Override
799     public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
800         throws DOMException {
801         return xmlElementElement.getElementsByTagNameNS(namespaceURI, localName);
802     }
803
804     @Override
805     public boolean hasAttribute(String name) {
806         return xmlElementElement.hasAttribute(name);
807     }
808
809     @Override
810     public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException {
811         return xmlElementElement.hasAttributeNS(namespaceURI, localName);
812     }
813
814     @Override
815     public TypeInfo getSchemaTypeInfo() {
816         return xmlElementElement.getSchemaTypeInfo();
817     }
818
819     @Override
820     public void setIdAttribute(String name, boolean isId) throws DOMException {
821         xmlElementElement.setIdAttribute(name, isId);
822
823     }
824
825     @Override
826     public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
827         throws DOMException {
828         xmlElementElement.setIdAttributeNS(namespaceURI, localName, isId);
829     }
830
831     @Override
832     public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
833         xmlElementElement.setIdAttributeNode(idAttr, isId);
834     }
835
836 }