Adds a shiro environment listener to load the shiro config file.
@param doc The xml DOM document to create the new xml elements with.
@param root The xml Element node to add the listener to.
173484
public static void addListener(Document doc, Element root) {
    Element listener = doc.createElement("listener");
    Element listenerClass = doc.createElement("listener-class");
    listener.appendChild(listenerClass);
    listenerClass.appendChild(doc
        .createTextNode("org.apache.shiro.web.env.EnvironmentLoaderListener"));

    addRelativeTo(root, listener, "listener", true);
  }
690672
public function addElement(\DomDocument $document, \DOMElement $rootElement, NodeInterface $node): void
    {
        if (!($node instanceof FeedInterface) || is_null($node->getLanguage())) {
            return;
        }
        $rootElement->appendChild($document->createElement($this->getNodeName(), $node->getLanguage()));
    }
738109
private synchronized void appendXMLProperty(Document doc, Element conf,
	                                            String propertyName) {
		// skip writing if given property name is empty or null
		if (!Strings.isNullOrEmpty(propertyName)) {
			String value = properties.getProperty(propertyName);
			if (value != null) {
				Element propNode = doc.createElement("property");
				conf.appendChild(propNode);

				Element nameNode = doc.createElement("name");
				nameNode.appendChild(doc.createTextNode(propertyName));
				propNode.appendChild(nameNode);

				Element valueNode = doc.createElement("value");
				valueNode.appendChild(doc.createTextNode(
						properties.getProperty(propertyName)));
				propNode.appendChild(valueNode);

				Element finalNode = doc.createElement("final");
				finalNode.appendChild(doc.createTextNode(
						String.valueOf(finalParameters.contains(propertyName))));
				propNode.appendChild(finalNode);

				if (updatingResource != null) {
					String[] sources = updatingResource.get(propertyName);
					if(sources != null) {
						for(String s : sources) {
							Element sourceNode = doc.createElement("source");
							sourceNode.appendChild(doc.createTextNode(s));
							propNode.appendChild(sourceNode);
						}
					}
				}
			}
		}
	}
20071
public static boolean start(RootDoc root) {
	root.printNotice("UmlGraphDoc version " + Version.VERSION +  ", running the standard doclet");
	Standard.start(root);
	root.printNotice("UmlGraphDoc version " + Version.VERSION + ", altering javadocs");
	try {
	    String outputFolder = findOutputPath(root.options());

        Options opt = UmlGraph.buildOptions(root);
	    opt.setOptions(root.options());
	    // in javadoc enumerations are always printed
	    opt.showEnumerations = true;
	    opt.relativeLinksForSourcePackages = true;
	    // enable strict matching for hide expressions
	    opt.strictMatching = true;
//	    root.printNotice(opt.toString());

	    generatePackageDiagrams(root, opt, outputFolder);
	    generateContextDiagrams(root, opt, outputFolder);
	} catch(Throwable t) {
	    root.printWarning("Error: " + t.toString());
	    t.printStackTrace();
	    return false;
	}
	return true;
    }
362101
public static function convertFromDOMDocument($root_element, DOMDocument $doc)
    {
        $xpath = new DOMXPath($doc);
        $root = new XMLElement($root_element);

        foreach ($xpath->query('.') as $node) {
            self::convertNode($root, $node);
        }

        return $root;
    }
203659
private void loadXMLResource(final File file) {

		final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
		// Ignore comments in the XML file
		docBuilderFactory.setIgnoringComments(true);
		docBuilderFactory.setNamespaceAware(true);

		try {

			final DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
			Document doc = null;
			Element root = null;

			doc = builder.parse(file);

			if (doc == null) {
				LOG.warn("Cannot load configuration: doc is null");
				return;
			}

			root = doc.getDocumentElement();
			if (root == null) {
				LOG.warn("Cannot load configuration: root is null");
				return;
			}

			if (!"configuration".equals(root.getNodeName())) {
				LOG.warn("Cannot load configuration: unknown element " + root.getNodeName());
				return;
			}

			final NodeList props = root.getChildNodes();
			int propNumber = -1;

			synchronized (this.confData) {

				for (int i = 0; i < props.getLength(); i++) {

					final Node propNode = props.item(i);
					String key = null;
					String value = null;

					// Ignore text at this point
					if (propNode instanceof Text) {
						continue;
					}

					if (!(propNode instanceof Element)) {
						LOG.warn("Error while reading configuration: " + propNode.getNodeName()
							+ " is not of type element");
						continue;
					}

					Element property = (Element) propNode;
					if (!"property".equals(property.getNodeName())) {
						LOG.warn("Error while reading configuration: unknown element " + property.getNodeName());
						continue;
					}

					propNumber++;
					final NodeList propChildren = property.getChildNodes();
					if (propChildren == null) {
						LOG.warn("Error while reading configuration: property has no children, skipping...");
						continue;
					}

					for (int j = 0; j < propChildren.getLength(); j++) {

						final Node propChild = propChildren.item(j);
						if (propChild instanceof Element) {
							if ("key".equals(propChild.getNodeName())) {
								if (propChild.getChildNodes() != null) {
									if (propChild.getChildNodes().getLength() == 1) {
										if (propChild.getChildNodes().item(0) instanceof Text) {
											final Text t = (Text) propChild.getChildNodes().item(0);
											key = t.getTextContent();
										}
									}
								}
							}

							if ("value".equals(propChild.getNodeName())) {
								if (propChild.getChildNodes() != null) {
									if (propChild.getChildNodes().getLength() == 1) {
										if (propChild.getChildNodes().item(0) instanceof Text) {
											final Text t = (Text) propChild.getChildNodes().item(0);
											value = t.getTextContent();
										}
									}
								}
							}
						}
					}

					if (key != null && value != null) {
						// Put key, value pair into the map
						LOG.debug("Loading configuration property: " + key + ", " + value);
						this.confData.put(key, value);
					} else {
						LOG.warn("Error while reading configuration: Cannot read property " + propNumber);
						continue;
					}
				}
			}

		} catch (ParserConfigurationException e) {
			LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
		} catch (IOException e) {
			LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
		} catch (SAXException e) {
			LOG.warn("Cannot load configuration: " + StringUtils.stringifyException(e));
		}
	}
228551
def add(self, root):
        
        node = Element('import', ns=self.xsdns)
        node.set('namespace', self.ns)
        if self.location is not None:
            node.set('schemaLocation', self.location)
        log.debug('%s inserted', node)
        root.insert(node)
293468
public void add(XmlReader node)
    {
        Check.notNull(node);

        final Element element = node.getElement();
        document.adoptNode(element);
        root.appendChild(element);
    }
93497
public static <E> void rootElement(WebElement root, E element) {
		if (element == null || root == null) return;
		if (element instanceof WebElement) return;
		
		for (Class<?> clazz = element.getClass(); !clazz.equals(Object.class);
				clazz = clazz.getSuperclass()) {
			
			if (Enhancer.isEnhanced(clazz)) continue;
			
			Field[] fields = clazz.getDeclaredFields();
			for (Field field : fields) {
				setRootElementField(root, element, field);
			}
		}
	}
219518
public void setRootElement(java.lang.String rootElement) {
        getStateHelper().put(PropertyKeys.rootElement, rootElement);
        handleAttribute("rootElement", rootElement);
    }
782110
public static void addAll(Document document) {
        List<Element> elementList = getElements(document);

        List<String> elementIds = getElementsId(elementList);

        addAll(elementList);
    }
55809
@Override
    public void init(ServletConfig config) throws ServletException {
        World world;
        String str;

        try {
            world = World.create();
            configure(world, "http");
            configure(world, "https");
            str = config.getInitParameter("docroot");
            docroot = Application.file(world, str != null ? str : config.getServletContext().getRealPath(""));
            docroot.checkDirectory();
            LOG.info("home: " + world.getHome());
            application = Application.load(world, config, docroot);
            LOG.info("docroot: " + docroot);
        } catch (RuntimeException | Error e) {
            error(null, "init", e);
            throw e;
        } catch (Exception e) {
            error(null, "init", e);
            throw new ServletException(e);
        } catch (Throwable e) {
            error(null, "init", e);
            throw new RuntimeException("unexpected throwable", e);
        }
    }
978416
public void startDocument() throws SAXException
  {

    int doc = addNode(DTM.DOCUMENT_NODE,
                      DTM.DOCUMENT_NODE,
                      DTM.NULL, DTM.NULL, 0, true);

    m_parents.push(doc);
    m_previous = DTM.NULL;

    m_contextIndexes.push(m_prefixMappings.size());  // for the next element.
  }
138425
public void addListener(final NodeTypeManagerListener listener)
   {
      if (!this.listeners.containsKey(listener))
      {
         this.listeners.put(listener, listener);
      }
   }
447406
public static AnimationConfig imports(Xml root)
    {
        Check.notNull(root);

        final Map<String, Animation> animations = new HashMap<>(0);

        for (final Xml node : root.getChildren(ANIMATION))
        {
            final String anim = node.readString(ANIMATION_NAME);
            final Animation animation = createAnimation(node);
            animations.put(anim, animation);
        }

        return new AnimationConfig(animations);
    }
389756
public void addRootLogListener(LogListener listener) {
        if (mParent == null) {
            addLogListener(listener);
        }
        else {
            mParent.addRootLogListener(listener);
        }
    }
1152537
public static Window showXML(Document document, BaseUIComponent parent) {
        Map<String, Object> args = Collections.singletonMap("document", document);
        boolean modal = parent == null;
        Window dialog = PopupDialog.show(XMLConstants.VIEW_DIALOG, args, modal, modal, modal, null);
        
        if (parent != null) {
            dialog.setParent(parent);
        }
        
        return dialog;
    }