@Override
 public void apply(Element e) {
   if (e.getTagName().equals("property")) {
     Element parent = (Element) e.getParentNode();
     if (parent != null && parent.getTagName().equals("ndbx")) {
       Attr name = e.getAttributeNode("name");
       Attr value = e.getAttributeNode("value");
       if (name != null && name.getValue().equals("oscPort")) {
         if (value != null) {
           Element device = e.getOwnerDocument().createElement("device");
           device.setAttribute("name", "osc1");
           device.setAttribute("type", "osc");
           Element portProperty = e.getOwnerDocument().createElement("property");
           portProperty.setAttribute("name", "port");
           portProperty.setAttribute("value", value.getValue());
           device.appendChild(portProperty);
           Element autostartProperty = e.getOwnerDocument().createElement("property");
           autostartProperty.setAttribute("name", "autostart");
           autostartProperty.setAttribute("value", "true");
           device.appendChild(autostartProperty);
           parent.replaceChild(device, e);
         } else {
           parent.removeChild(e);
         }
       }
     }
   }
 }
 private void validateImports(Element parent) {
   NodeList list = getChildrenByName(parent, "import"); // $NON-NLS-1$
   for (int i = 0; i < list.getLength(); i++) {
     if (fMonitor.isCanceled()) return;
     Element element = (Element) list.item(i);
     Attr plugin = element.getAttributeNode("plugin"); // $NON-NLS-1$
     Attr feature = element.getAttributeNode("feature"); // $NON-NLS-1$
     if (plugin == null && feature == null) {
       assertAttributeDefined(element, "plugin", CompilerFlags.ERROR); // $NON-NLS-1$
     } else if (plugin != null && feature != null) {
       reportExclusiveAttributes(
           element, "plugin", "feature", CompilerFlags.ERROR); // $NON-NLS-1$//$NON-NLS-2$
     } else if (plugin != null) {
       validatePluginID(element, plugin, false);
     } else if (feature != null) {
       validateFeatureID(element, feature);
     }
     NamedNodeMap attributes = element.getAttributes();
     for (int j = 0; j < attributes.getLength(); j++) {
       Attr attr = (Attr) attributes.item(j);
       String name = attr.getName();
       if (name.equals("version")) { // $NON-NLS-1$
         validateVersionAttribute(element, attr);
       } else if (name.equals("match")) { // $NON-NLS-1$
         if (element.getAttributeNode("patch") != null) { // $NON-NLS-1$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchedMatch, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else {
           validateMatch(element, attr);
         }
       } else if (name.equals("patch")) { // $NON-NLS-1$
         if ("true".equalsIgnoreCase(attr.getValue()) && feature == null) { // $NON-NLS-1$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchPlugin, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else if ("true".equalsIgnoreCase(attr.getValue())
             && element.getAttributeNode("version") == null) { // $NON-NLS-1$ //$NON-NLS-2$
           report(
               NLS.bind(PDECoreMessages.Builders_Feature_patchedVersion, attr.getValue()),
               getLine(element, attr.getValue()),
               CompilerFlags.ERROR,
               PDEMarkerFactory.CAT_FATAL);
         } else {
           validateBoolean(element, attr);
         }
       } else if (!name.equals("plugin")
           && !name.equals("feature")
           && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         reportUnknownAttribute(element, name, CompilerFlags.ERROR);
       }
     }
   }
 }
 @Override
 public void apply(Element e) {
   if (e.getTagName().equals("property")) {
     Element parent = (Element) e.getParentNode();
     if (parent != null && parent.getTagName().equals("device")) {
       Attr type = parent.getAttributeNode("type");
       if (type != null && type.getValue().equals(this.deviceType)) {
         Attr name = e.getAttributeNode("name");
         if (name != null && name.getValue().equals(oldPropertyName))
           name.setValue(newPropertyName);
       }
     }
   }
 }
 private static void removeNodeInput(Element node, String input) {
   for (Element port : childElementsWithName(node, "port")) {
     Attr nameAttr = port.getAttributeNode("name");
     String portName = nameAttr.getValue();
     if (portName.equals(input)) {
       node.removeChild(port);
     }
   }
   if (node.getAttributeNode("name") != null) {
     Element parent = (Element) node.getParentNode();
     String child = node.getAttributeNode("name").getValue();
     removeConnection(parent, child, input);
     String publishedInput = getParentPublishedInput(parent, child, input);
     if (publishedInput != null) removeNodeInput(parent, publishedInput);
   }
 }
 private static String getParentPublishedInput(Element parent, String child, String input) {
   for (Element port : childElementsWithName(parent, "port")) {
     Attr childRef = port.getAttributeNode("childReference");
     if (childRef != null && childRef.getValue().equals(String.format("%s.%s", child, input))) {
       return port.getAttribute("name");
     }
   }
   return null;
 }
 private static boolean isNodeWithPrototype(Element e, String nodePrototype) {
   if (e.getTagName().equals("node")) {
     Attr prototype = e.getAttributeNode("prototype");
     if (prototype != null && prototype.getValue().equals(nodePrototype)) {
       return true;
     }
   }
   return false;
 }
 private static List<String> getParentPublishedInputs(Element parent, String child) {
   ImmutableList.Builder<String> builder = ImmutableList.builder();
   for (Element port : childElementsWithName(parent, "port")) {
     Attr childRef = port.getAttributeNode("childReference");
     if (childRef != null && childRef.getValue().split("\\.")[0].equals(child)) {
       builder.add(port.getAttribute("name"));
     }
   }
   return builder.build();
 }
 private static void renameNodeReference(
     List<Element> elements, String attributeName, String oldNodeName, String newNodeName) {
   for (Element c : elements) {
     Attr nodeRef = c.getAttributeNode(attributeName);
     String nodeName = nodeRef.getValue();
     if (oldNodeName.equals(nodeName)) {
       nodeRef.setValue(newNodeName);
     }
   }
 }
 /**
  * Runs the test case.
  *
  * @throws Throwable Any uncaught exception causes test to fail
  */
 public void runTest() throws Throwable {
   Document doc;
   NodeList elementList;
   Element testEmployee;
   Attr domesticAttr;
   doc = (Document) load("staff", true);
   elementList = doc.getElementsByTagName("address");
   testEmployee = (Element) elementList.item(0);
   domesticAttr = testEmployee.getAttributeNode("invalidAttribute");
   assertNull("elementGetAttributeNodeNullAssert", domesticAttr);
 }
 private static void renameRenderedChildReference(
     Element element, String oldNodeName, String newNodeName) {
   Attr renderedChildReference = element.getAttributeNode("renderedChild");
   if (renderedChildReference == null) return;
   String oldRenderedChild = renderedChildReference.getValue();
   if (oldRenderedChild.equals(oldNodeName)) {
     if (newNodeName == null || newNodeName.length() == 0)
       element.removeAttributeNode(renderedChildReference);
     else renderedChildReference.setValue(newNodeName);
   }
 }
 @Override
 public void apply(Element e) {
   if (isNodeWithPrototype(e, nodePrototype)) {
     Element port = portWithName(e, portName);
     if (port != null) {
       Attr type = port.getAttributeNode("type");
       type.setValue(newType);
       Attr value = port.getAttributeNode("value");
       if (value != null) {
         String newValue = valueMappings.get(value.getValue());
         checkState(
             newValue != null,
             "Change port type (%s.%s -> %s): value %s not found in value mappings.",
             nodePrototype,
             portName,
             newType,
             value.getValue());
         value.setValue(newValue);
       }
     }
   }
 }
 private static void renamePortReference(
     List<Element> elements, String attributeName, String oldNodeName, String newNodeName) {
   for (Element c : elements) {
     Attr portReference = c.getAttributeNode(attributeName);
     if (portReference == null) continue;
     Iterator<String> portRefIterator =
         NodeLibrary.PORT_NAME_SPLITTER.split(portReference.getValue()).iterator();
     String nodeName = portRefIterator.next();
     String portName = portRefIterator.next();
     if (oldNodeName.equals(nodeName)) {
       portReference.setValue(String.format("%s.%s", newNodeName, portName));
     }
   }
 }
    @Override
    public void apply(Element e) {
      if (isNodeWithPrototype(e, nodePrototype)) {
        Element parent = (Element) e.getParentNode();
        String child = e.getAttributeNode("name").getValue();
        removedNodes.add(child);

        List<String> publishedInputs = getParentPublishedInputs(parent, child);
        for (String publishedInput : publishedInputs) removeNodeInput(parent, publishedInput);

        removeConnections(parent, child);
        renameRenderedChildReference(parent, child, null);
        e.getParentNode().removeChild(e);
      }
    }
    @Override
    public void apply(Element e) {
      if (e.getTagName().equals("node")) {
        Attr name = e.getAttributeNode("name");
        if (name != null && name.getValue().startsWith(oldPrefix)) {
          String oldNodeName = name.getValue();
          Set<String> childNames = getChildNodeNames((Element) e.getParentNode());
          String newNodeName = uniqueName(newPrefix, childNames);
          name.setValue(newNodeName);

          Element parent = (Element) e.getParentNode();
          renameRenderedChildReference(parent, oldNodeName, newNodeName);
          List<Element> connections = childElementsWithName(parent, "conn");
          renamePortReference(connections, "input", oldNodeName, newNodeName);
          renameNodeReference(connections, "output", oldNodeName, newNodeName);

          List<Element> ports = childElementsWithName(parent, "port");
          renamePortReference(ports, "childReference", oldNodeName, newNodeName);
        }
      }
    }
  private void validateIncludes(Element parent) {
    NodeList list = getChildrenByName(parent, "includes"); // $NON-NLS-1$
    for (int i = 0; i < list.getLength(); i++) {
      if (fMonitor.isCanceled()) return;
      Element include = (Element) list.item(i);
      if (assertAttributeDefined(include, "id", CompilerFlags.ERROR) // $NON-NLS-1$
          && assertAttributeDefined(
              include,
              "version", //$NON-NLS-1$
              CompilerFlags.ERROR)) {

        validateFeatureID(include, include.getAttributeNode("id")); // $NON-NLS-1$
      }
      NamedNodeMap attributes = include.getAttributes();
      for (int j = 0; j < attributes.getLength(); j++) {
        Attr attr = (Attr) attributes.item(j);
        String name = attr.getName();
        if (name.equals("version")) { // $NON-NLS-1$
          validateVersionAttribute(include, attr);
        } else if (name.equals("optional")) { // $NON-NLS-1$
          validateBoolean(include, attr);
        } else if (name.equals("search-location")) { // $NON-NLS-1$
          String value = include.getAttribute("search-location"); // $NON-NLS-1$
          if (!value.equals("root")
              && !value.equals("self")
              && !value.equals("both")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            reportIllegalAttributeValue(include, attr);
          }
        } else if (!name.equals("id")
            && !name.equals("name")
            && !name.equals("os")
            && !name.equals("ws") // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            && !name.equals("nl")
            && !name.equals("arch")
            && !name.equals("filter")) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          reportUnknownAttribute(include, name, CompilerFlags.ERROR);
        }
      }
    }
  }
Exemple #16
0
  private static String getAttributeValueFrom(
      Element element, String uri, String localName, String prefix, String qualifiedName) {

    String nonzeroLengthUri = (uri == null || uri.length() == 0) ? null : uri;

    boolean mustUseGetAttributeNodeNS = (nonzeroLengthUri != null);

    if (mustUseGetAttributeNodeNS) {

      if (!element.hasAttributeNS(uri, localName)) {
        return null;
      }

      String attrValue = element.getAttributeNS(nonzeroLengthUri, localName);

      return attrValue;
    }

    Attr attribute = null;
    attribute = element.getAttributeNode(qualifiedName);

    return attribute == null ? null : attribute.getValue();
  }
 private void validateDiscoveryURL(Element parent) {
   NodeList list = getChildrenByName(parent, "discovery"); // $NON-NLS-1$
   if (list.getLength() > 0) {
     if (fMonitor.isCanceled()) return;
     Element discovery = (Element) list.item(0);
     assertAttributeDefined(discovery, "url", CompilerFlags.ERROR); // $NON-NLS-1$
     NamedNodeMap attributes = discovery.getAttributes();
     for (int i = 0; i < attributes.getLength(); i++) {
       String name = attributes.item(i).getNodeName();
       if (name.equals("url")) { // $NON-NLS-1$
         validateURL(discovery, "url"); // $NON-NLS-1$
       } else if (name.equals("type")) { // $NON-NLS-1$
         String value = discovery.getAttribute("type"); // $NON-NLS-1$
         if (!value.equals("web") && !value.equals("update")) { // $NON-NLS-1$ //$NON-NLS-2$
           reportIllegalAttributeValue(discovery, (Attr) attributes.item(i));
         }
         reportDeprecatedAttribute(discovery, discovery.getAttributeNode("type")); // $NON-NLS-1$
       } else if (!name.equals("label")) { // $NON-NLS-1$
         reportUnknownAttribute(discovery, name, CompilerFlags.ERROR);
       }
     }
   }
 }
  private void validateRequiredExtensionAttributes(Element element, ISchemaElement schemaElement) {
    int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_NO_REQUIRED_ATT);
    if (severity == CompilerFlags.IGNORE) return;

    ISchemaAttribute[] attInfos = schemaElement.getAttributes();
    for (int i = 0; i < attInfos.length; i++) {
      ISchemaAttribute attInfo = attInfos[i];
      if (attInfo.getUse() == ISchemaAttribute.REQUIRED) {
        boolean found = element.getAttributeNode(attInfo.getName()) != null;
        if (!found && attInfo.getKind() == IMetaAttribute.JAVA) {
          NodeList children = element.getChildNodes();
          for (int j = 0; j < children.getLength(); j++) {
            if (attInfo.getName().equals(children.item(j).getNodeName())) {
              found = true;
              break;
            }
          }
        }
        if (!found) {
          reportMissingRequiredAttribute(element, attInfo.getName(), severity);
        }
      }
    }
  }
Exemple #19
0
 /** @deprecated use Element.getAttribute(String val) */
 public static String attrValFromElement(Element element, String attrName) throws DOMException {
   Attr attr = element.getAttributeNode(attrName);
   return (attr == null ? null : attr.getValue());
 }
Exemple #20
0
  // 主にnodamushiがEclipseから起動してなんやかんややってるときのメソッド。
  private static void testMain() throws Exception {
    String file = "testdataMain.tex";
    LamuriyanEngine e = new LamuriyanEngine(file, "testdata");
    e.setFileSearchDirectories(Paths.get("."));
    e.setInitFiles(Paths.get("testdata\\_init_test.tex"));
    e.evaluate();
    // Lamuriyanの変換完了
    RootDocument root = e.getDocument();
    // コンバート
    HTMLConverter hcon = new HTMLConverter(root, new File("testdata\\convsetting.hcv").toPath());
    hcon.convert();
    List<PageLinkObject> plos = hcon.refs();
    Document document = hcon.getDocument();

    NodeList chapters = document.getElementsByTagName("chapter");
    ArrayList<Element> chapterlist = new ArrayList<>();
    for (int i = chapters.getLength() - 1; i >= 0; i--) {
      Node node = chapters.item(i);
      node.getParentNode().removeChild(node);
      chapterlist.add(0, (Element) node);

      Element el = (Element) node;
      hcon.fixLink(el, "index_chapter" + (i + 1) + ".html");
    }

    NodeList headcontentlist = document.getElementsByTagName("headcontent");

    StringBuilder headcontent = new StringBuilder();
    for (int i = 0, end = headcontentlist.getLength(); i < end; i++) {
      Node node = headcontentlist.item(i);
      HTMLConverter.toStringChildNode(headcontent, node, "", 0, "\n");
      Attr numbera = ((Element) node).getAttributeNode("number");
    }
    StringBuilder contents = new StringBuilder();
    Node documentcontent = document.getElementById("document");

    HTMLConverter.toStringChildNode(contents, documentcontent, "", 0, "\n");

    // テンプレートファイル読み込み
    String templatefile = "testdata\\template.html";
    List<String> template = Files.readAllLines(Paths.get(templatefile), Charset.forName("utf-8"));

    String title = root.getProperty("title");
    if (title == null) {
      title = "";
    }

    ArrayList<String> lis = new ArrayList<>(template.size());

    File write = new File("testdata\\output\\index.html");
    //        System.out.println(e.current);
    PrintStream s = new PrintStream(write, "UTF-8");
    //        s.print(hcon.toHTML());
    for (String str : template) {
      if (str.equals("<!--{PAGETITLE}-->")) {
        //                lis.add(title);
        //                System.out.println(title);
        s.println(title);
      } else if (str.equals("<!--{HEADCONTENT}-->")) {
        //                lis.add(headcontent.toString());
        //                System.out.println(headcontent.toString());
        s.println(headcontent);
      } else if (str.equals("<!--{CONTENTS}-->")) {
        //                lis.add(contents.toString());
        //                System.out.println(contents);
        s.println(contents);
      } else {
        //                lis.add(str);
        s.println(str);
      }
    }
    s.close();
    for (int i = 0, end = chapterlist.size(); i < end; i++) {
      Element node = chapterlist.get(i);
      write = new File("testdata\\output\\index_chapter" + (i + 1) + ".html");
      //        System.out.println(e.current);
      s = new PrintStream(write, "UTF-8");
      contents.setLength(0);
      HTMLConverter.toStringChildNode(contents, node, "", 0, "\n");
      Attr numbera = node.getAttributeNode("number");
      Attr titla = node.getAttributeNode("title");
      //            System.out.println(contents);
      title = numbera.getValue() + "  " + titla.getValue();
      for (String str : template) {
        if (str.equals("<!--{PAGETITLE}-->")) {
          //                    lis.add(title);
          //                    System.out.println(title);
          s.println(title);
        } else if (str.equals("<!--{HEADCONTENT}-->")) {
          //                    lis.add(headcontent.toString());
          //                    System.out.println(headcontent.toString());
          s.println(headcontent);
        } else if (str.equals("<!--{CONTENTS}-->")) {
          //                    lis.add(contents.toString());
          //                    System.out.println(contents);
          s.println(contents);
        } else {
          //                    lis.add(str);
          s.println(str);
        }
      }
      s.close();
    }
  }
  protected void validateElement(Element element, ISchema schema, boolean isTopLevel) {
    String elementName = element.getNodeName();
    ISchemaElement schemaElement = schema.findElement(elementName);

    // Validate element occurrence violations
    if ((schemaElement != null) && (schemaElement.getType() instanceof ISchemaComplexType)) {
      validateMaxElementMult(element, schemaElement);
      validateMinElementMult(element, schemaElement);
    }

    ISchemaElement parentSchema = null;
    if (!"extension".equals(elementName)) { // $NON-NLS-1$
      Node parent = element.getParentNode();
      parentSchema = schema.findElement(parent.getNodeName());
    } else if (isTopLevel == false) {
      // This is an "extension" element; but, not a top level one.
      // It is nested within another "extension" element somewhere
      // e.g. "extension" element is a child element of another element
      // that is not a "plugin" elment
      // element
      // Report illegal element
      int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_ELEMENT);
      reportIllegalElement(element, severity);
      return;
    }

    if (parentSchema != null) {
      int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_ELEMENT);
      if (severity != CompilerFlags.IGNORE) {
        HashSet allowedElements = new HashSet();
        computeAllowedElements(parentSchema.getType(), allowedElements);
        if (!allowedElements.contains(elementName)) {
          reportIllegalElement(element, severity);
          return;
        }
      }
    }
    if (schemaElement == null && parentSchema != null) {
      ISchemaAttribute attr = parentSchema.getAttribute(elementName);
      if (attr != null && attr.getKind() == IMetaAttribute.JAVA) {
        if (attr.isDeprecated())
          reportDeprecatedAttribute(element, element.getAttributeNode("class")); // $NON-NLS-1$
        validateJavaAttribute(element, element.getAttributeNode("class")); // $NON-NLS-1$			
      }
    } else {
      if (schemaElement != null) {
        validateRequiredExtensionAttributes(element, schemaElement);
        validateExistingExtensionAttributes(element, element.getAttributes(), schemaElement);
        validateInternalExtensionAttribute(element, schemaElement);
        if (schemaElement.isDeprecated()) {
          if (schemaElement instanceof ISchemaRootElement)
            reportDeprecatedRootElement(
                element, ((ISchemaRootElement) schemaElement).getDeprecatedSuggestion());
          else reportDeprecatedElement(element);
        }
        if (schemaElement.hasTranslatableContent()) validateTranslatableElementContent(element);
        // Bug 213457 - look up elements based on the schema in which the parent is found
        schema = schemaElement.getSchema();
      }
      NodeList children = element.getChildNodes();
      for (int i = 0; i < children.getLength(); i++) {
        validateElement((Element) children.item(i), schema, false);
      }
    }
  }
  protected void validateExtensionPoint(Element element) {
    if (assertAttributeDefined(element, "id", CompilerFlags.ERROR)) { // $NON-NLS-1$
      Attr idAttr = element.getAttributeNode("id"); // $NON-NLS-1$
      double schemaVersion = getSchemaVersion();
      String message = null;
      if (schemaVersion < 3.2 && !IdUtil.isValidSimpleID(idAttr.getValue()))
        message = NLS.bind(MDECoreMessages.Builders_Manifest_simpleID, idAttr.getValue());
      else if (schemaVersion >= 3.2) {
        if (!IdUtil.isValidCompositeID(idAttr.getValue())) {
          message = NLS.bind(MDECoreMessages.Builders_Manifest_compositeID, idAttr.getValue());
        }
      }

      if (message != null)
        report(
            message,
            getLine(element, idAttr.getName()),
            CompilerFlags.WARNING,
            MDEMarkerFactory.CAT_OTHER);
    }

    assertAttributeDefined(element, "name", CompilerFlags.ERROR); // $NON-NLS-1$

    int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_ATTRIBUTE);
    NamedNodeMap attrs = element.getAttributes();
    for (int i = 0; i < attrs.getLength(); i++) {
      Attr attr = (Attr) attrs.item(i);
      String name = attr.getName();
      if ("name".equals(name)) { // $NON-NLS-1$
        validateTranslatableString(element, attr, true);
      } else if (!"id".equals(name)
          && !"schema".equals(name)
          && severity != CompilerFlags.IGNORE) { // $NON-NLS-1$ //$NON-NLS-2$
        reportUnknownAttribute(element, name, severity);
      }
    }

    severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_ELEMENT);
    if (severity != CompilerFlags.IGNORE) {
      NodeList children = element.getChildNodes();
      for (int i = 0; i < children.getLength(); i++)
        reportIllegalElement((Element) children.item(i), severity);
    }

    // Validate the "schema" attribute of the extension point
    Attr attr = element.getAttributeNode(IMonitorExtensionPoint.P_SCHEMA);
    // Only validate the attribute if it was defined
    if (attr != null) {
      String schemaValue = attr.getValue();
      IResource res = getFile().getProject().findMember(schemaValue);
      String errorMessage = null;
      // Check to see if the value specified is an extension point schema and it exists
      if (!(res instanceof IFile
          && (res.getName().endsWith(".exsd")
              || //$NON-NLS-1$
              res.getName().endsWith(".mxsd")))) // $NON-NLS-1$
      errorMessage = MDECoreMessages.ExtensionsErrorReporter_InvalidSchema;
      // Report an error if one was found
      if (errorMessage != null) {
        severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_RESOURCE);
        if (severity != CompilerFlags.IGNORE)
          report(
              NLS.bind(errorMessage, schemaValue),
              getLine(element),
              severity,
              MDEMarkerFactory.CAT_OTHER);
      }
    }
  }
 public void apply(Element e) {
   if (isNodeWithPrototype(e, oldPrototype)) {
     Attr prototype = e.getAttributeNode("prototype");
     prototype.setValue(newPrototype);
   }
 }