List of usage examples for org.w3c.dom Element getAttributeNode
public Attr getAttributeNode(String name);
From source file:com.twinsoft.convertigo.beans.core.TransactionWithVariables.java
@Override public void parseInputDocument(Context context) throws EngineException { super.parseInputDocument(context); if (context.inputDocument != null && Engine.logContext.isInfoEnabled()) { Document printDoc = (Document) Visibility.Logs.replaceVariables(getVariablesList(), context.inputDocument);/*from w w w . j ava 2 s. c om*/ XMLUtils.logXml(printDoc, Engine.logContext, "Input document"); } NodeList variableNodes = context.inputDocument.getElementsByTagName("variable"); Element variableNode; Attr valueAttrNode; int len = variableNodes.getLength(); String variableName, variableValue, variableMethod; RequestableVariable variable; boolean bMulti; // TODO: grer les variables dites persistantes variables.clear(); for (int i = 0; i < len; i++) { bMulti = false; variableNode = (Element) variableNodes.item(i); variableName = variableNode.getAttribute("name"); variableValue = (variableNode.hasAttribute("value") ? variableNode.getAttribute("value") : null); valueAttrNode = variableNode.getAttributeNode("value"); variableMethod = null; // Test case for transaction if (variableName.indexOf(Parameter.Testcase.getName()) == 0) { TestCase testcase = getTestCaseByName(variableValue); if (testcase != null) { String testCaseVariableName; Object testCaseVariableValue; // Add test case variables default value(s) for (TestCaseVariable testCaseVariable : testcase.getVariables()) { testCaseVariableName = testCaseVariable.getName(); testCaseVariableValue = testcase.getVariableValue(testCaseVariableName); if (testCaseVariableValue != null) { variables.put(testCaseVariableName, testCaseVariableValue); } } } else { Engine.logBeans.warn("Transaction: there's no testcase named '" + variableValue + "' for '" + getName() + "' transaction"); } continue; } // May be a dynamic transaction variable definition else if ((variableName.indexOf(Parameter.DynamicVariablePost.getName()) == 0) || (variableName.indexOf(Parameter.DynamicVariableGet.getName()) == 0)) { bMulti = variableNode.getAttribute("multi").equalsIgnoreCase("true"); if (variableName.indexOf(Parameter.DynamicVariablePost.getName()) == 0) { variableName = variableName.substring(Parameter.DynamicVariablePost.getName().length()); variableMethod = "POST"; } else if (variableName.indexOf(Parameter.DynamicVariableGet.getName()) == 0) { variableName = variableName.substring(Parameter.DynamicVariableGet.getName().length()); variableMethod = "GET"; } // retrieve variable definition variable = (RequestableVariable) getVariable(variableName); if (variableMethod != null) { setDynamicVariable(variableName, variableValue, Boolean.valueOf(bMulti), variableMethod); } } // Serialized variables definition else { variable = (RequestableVariable) getVariable(variableName); } // Structured value? Object scopeValue = null; if (getProject().isStrictMode()) { scopeValue = (variableValue != null) ? variableValue : variableNode.getChildNodes(); } else { if (variableValue != null) { scopeValue = variableValue; } else { String sValue = XMLUtils.prettyPrintElement(variableNode, true, false); sValue = sValue.replaceAll("<variable name=\"" + variableName + "\">", ""); sValue = sValue.replaceAll("</variable>", ""); scopeValue = sValue; } } // Multivalued variable ? if ((variable != null) && (variable.isMultiValued())) { List<Object> current = GenericUtils.cast(variables.get(variableName)); if (current == null) { current = new ArrayList<Object>(); variables.put(variableName, current); } if (variableValue == null || valueAttrNode != null) { current.add(scopeValue); } } else { variables.put(variableName, scopeValue); } } // Enumeration of all transaction variables if (Engine.logBeans.isDebugEnabled()) Engine.logBeans.debug("Transaction variables: " + (variables == null ? "none" : Visibility.Logs.replaceVariables(getVariablesList(), variables))); }
From source file:it.cnr.icar.eric.server.profile.ws.wsdl.cataloger.WSDLCatalogerEngine.java
/** * Catalogs XMLSchema when submitted as an ExtrinsicObject - RepositoryItem pair. * *///ww w . j a v a2 s.co m private void catalogXMLSchemaExtrinsicObject(RegistryObjectType ro, InputSource source) throws CatalogingException { try { registryObjects.add(ro); Document document = parseXML(source); Element schemaElement = document.getDocumentElement(); String documentLocalName = schemaElement.getLocalName(); String documentNamespaceURI = schemaElement.getNamespaceURI(); if (documentLocalName.equalsIgnoreCase("schema") && documentNamespaceURI.endsWith("XMLSchema")) { Attr attribute = schemaElement.getAttributeNode("targetNamespace"); String namespaceURI = attribute.getValue(); // Set the id for the XMLSchema EO updateRegistryObjectId(namespaceURI, ro, false); // Check if this XSD file imports another file (usually XSD) NodeList nodeList = schemaElement.getChildNodes(); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { Node node = nodeList.item(i); String localName = node.getLocalName(); if (localName != null && localName.equalsIgnoreCase("import")) { // This XSD imports another file NamedNodeMap importNamedNodeMap = node.getAttributes(); Node namespaceNode = importNamedNodeMap.getNamedItem("namespace"); String importNamespace = null; if (namespaceNode != null) { importNamespace = namespaceNode.getNodeValue(); } String schemaLocation = null; Node schemaLocationNode = importNamedNodeMap.getNamedItem("schemaLocation"); if (schemaLocationNode != null) { schemaLocation = schemaLocationNode.getNodeValue(); } RegistryObjectType importedObject = catalogImportStatement(ro, importNamespace, schemaLocation); createImportsAssociation(ro, importedObject); } } } } catch (CatalogingException e) { throw e; } catch (Exception e) { log.error(e, e); CatalogingException ce = new CatalogingException(e); throw ce; } }
From source file:com.twinsoft.convertigo.beans.core.Sequence.java
@Override public void parseInputDocument(Context context) throws EngineException { super.parseInputDocument(context); if (context.inputDocument != null && Engine.logContext.isInfoEnabled()) { Document printDoc = (Document) Visibility.Logs.replaceVariables(getVariablesList(), context.inputDocument);/* w w w. j a va 2s . c o m*/ XMLUtils.logXml(printDoc, Engine.logContext, "Input document"); } NodeList variableNodes = context.inputDocument.getElementsByTagName("variable"); int len = variableNodes.getLength(); variables.clear(); for (int i = 0; i < len; i++) { Element variableNode = (Element) variableNodes.item(i); String variableName = variableNode.getAttribute("name"); String variableValue = (variableNode.hasAttribute("value") ? variableNode.getAttribute("value") : null); Attr valueAttrNode = variableNode.getAttributeNode("value"); // Test case for sequence if (variableName.indexOf(Parameter.Testcase.getName()) == 0) { TestCase testcase = getTestCaseByName(variableValue); if (testcase != null) { String testCaseVariableName; Object testCaseVariableValue; // Add test case variables default value(s) for (TestCaseVariable testCaseVariable : testcase.getVariables()) { testCaseVariableName = testCaseVariable.getName(); testCaseVariableValue = testcase.getVariableValue(testCaseVariableName); if (testCaseVariableValue != null) { variables.put(testCaseVariableName, testCaseVariableValue); } } } else { if (Engine.logBeans.isInfoEnabled()) Engine.logBeans.warn("Sequence: there's no testcase named '" + variableValue + "' for '" + getName() + "' sequence"); } continue; } // Standard variable case RequestableVariable variable = (RequestableVariable) getVariable(variableName); // Structured value? Object scopeValue = (variableValue != null) ? variableValue : variableNode.getChildNodes(); // Multivalued variable ? if ((variable != null) && (variable.isMultiValued())) { List<Object> current = GenericUtils.cast(variables.get(variableName)); if (current == null) { current = new LinkedList<Object>(); variables.put(variableName, current); } if (variableValue == null || valueAttrNode != null) { current.add(scopeValue); } } else { variables.put(variableName, scopeValue); } } // Enumeration of all sequence variables if (Engine.logBeans.isDebugEnabled()) Engine.logBeans.debug("Sequence variables: " + (variables == null ? "none" : Visibility.Logs.replaceVariables(getVariablesList(), variables))); }
From source file:com.android.tools.lint.checks.AndroidAutoDetector.java
private void checkAutomotiveAppElement(XmlContext context, Element element) { // Indicates whether the current file matches the resource that was registered // in AndroidManifest.xml. boolean isMetadataResource = mAutomotiveResourceFileName != null && mAutomotiveResourceFileName.equals(context.file.getName()); for (Element child : LintUtils.getChildren(element)) { if (TAG_USES.equals(child.getTagName())) { String attrValue = child.getAttribute(ATTR_NAME); if (VAL_NAME_MEDIA.equals(attrValue)) { mIsAutomotiveMediaApp |= isMetadataResource; } else if (!VAL_NAME_NOTIFICATION.equals(attrValue) && context.isEnabled(INVALID_USES_TAG_ISSUE)) { // Error invalid value for attribute. Attr node = child.getAttributeNode(ATTR_NAME); if (node == null) { // no name specified continue; }//from w ww .j av a 2s. c o m context.report(INVALID_USES_TAG_ISSUE, node, context.getLocation(node), "Expecting one of `" + VAL_NAME_MEDIA + "` or `" + VAL_NAME_NOTIFICATION + "` for the name " + "attribute in " + TAG_USES + " tag."); } } } // Report any errors that we have collected that can be shown to the user // once we determine that this is an Automotive Media App. if (mIsAutomotiveMediaApp && !context.getProject().isLibrary() && mMainApplicationHandle != null && mDoAutomotiveAppCheck) { Element node = (Element) mMainApplicationHandle.getClientData(); if (!mMediaIntentFilterFound && context.isEnabled(MISSING_MEDIA_BROWSER_SERVICE_ACTION_ISSUE)) { context.report(MISSING_MEDIA_BROWSER_SERVICE_ACTION_ISSUE, node, mMainApplicationHandle.resolve(), "Missing `intent-filter` for action " + "`android.media.browse.MediaBrowserService` that is required for " + "android auto support"); } if (!mMediaSearchIntentFilterFound && context.isEnabled(MISSING_INTENT_FILTER_FOR_MEDIA_SEARCH)) { context.report(MISSING_INTENT_FILTER_FOR_MEDIA_SEARCH, node, mMainApplicationHandle.resolve(), "Missing `intent-filter` for action " + "`android.media.action.MEDIA_PLAY_FROM_SEARCH`."); } } }
From source file:org.alfresco.web.forms.xforms.Schema2XForms.java
@SuppressWarnings("unchecked") public static void rebuildInstance(final Node prototypeNode, final Node oldInstanceNode, final Node newInstanceNode, final HashMap<String, String> schemaNamespaces) { final JXPathContext prototypeContext = JXPathContext.newContext(prototypeNode); prototypeContext.registerNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI); final JXPathContext instanceContext = JXPathContext.newContext(oldInstanceNode); instanceContext.registerNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI); for (final String prefix : schemaNamespaces.keySet()) { prototypeContext.registerNamespace(prefix, schemaNamespaces.get(prefix)); instanceContext.registerNamespace(prefix, schemaNamespaces.get(prefix)); }//from www .ja v a 2 s .co m // Evaluate non-recursive XPaths for all prototype elements at this level final Iterator<Pointer> it = prototypeContext.iteratePointers("*"); while (it.hasNext()) { final Pointer p = it.next(); Element proto = (Element) p.getNode(); String path = p.asPath(); // check if this is a prototype element with the attribute set boolean isPrototype = proto.hasAttributeNS(NamespaceService.ALFRESCO_URI, "prototype") && proto.getAttributeNS(NamespaceService.ALFRESCO_URI, "prototype").equals("true"); // We shouldn't locate a repeatable child with a fixed path if (isPrototype) { path = path.replaceAll("\\[(\\d+)\\]", "[position() >= $1]"); if (LOGGER.isDebugEnabled()) { LOGGER.debug("[rebuildInstance] evaluating prototyped nodes " + path); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("[rebuildInstance] evaluating child node with positional path " + path); } } Document newInstanceDocument = newInstanceNode.getOwnerDocument(); // Locate the corresponding nodes in the instance document List<Node> l = (List<Node>) instanceContext.selectNodes(path); // If the prototype node isn't a prototype element, copy it in as a missing node, complete with all its children. We won't need to recurse on this node if (l.isEmpty()) { if (!isPrototype) { LOGGER.debug("[rebuildInstance] copying in missing node " + proto.getNodeName() + " to " + XMLUtil.buildXPath(newInstanceNode, newInstanceDocument.getDocumentElement())); // Clone the prototype node and all its children Element clone = (Element) proto.cloneNode(true); newInstanceNode.appendChild(clone); if (oldInstanceNode instanceof Document) { // add XMLSchema instance NS addNamespace(clone, NamespaceConstants.XMLSCHEMA_INSTANCE_PREFIX, NamespaceConstants.XMLSCHEMA_INSTANCE_NS); } } } else { // Otherwise, append the matches from the old instance document in order for (Node old : l) { Element oldEl = (Element) old; // Copy the old instance element rather than cloning it, so we don't copy over attributes Element clone = null; String nSUri = oldEl.getNamespaceURI(); if (nSUri == null) { clone = newInstanceDocument.createElement(oldEl.getTagName()); } else { clone = newInstanceDocument.createElementNS(nSUri, oldEl.getTagName()); } newInstanceNode.appendChild(clone); if (oldInstanceNode instanceof Document) { // add XMLSchema instance NS addNamespace(clone, NamespaceConstants.XMLSCHEMA_INSTANCE_PREFIX, NamespaceConstants.XMLSCHEMA_INSTANCE_NS); } // Copy over child text if this is not a complex type boolean isEmpty = true; for (Node n = old.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Text) { clone.appendChild(newInstanceDocument.importNode(n, false)); isEmpty = false; } else if (n instanceof Element) { break; } } // Populate the nil attribute. It may be true or false if (proto.hasAttributeNS(NamespaceConstants.XMLSCHEMA_INSTANCE_NS, "nil")) { clone.setAttributeNS(NamespaceConstants.XMLSCHEMA_INSTANCE_NS, NamespaceConstants.XMLSCHEMA_INSTANCE_PREFIX + ":nil", String.valueOf(isEmpty)); } // Copy over attributes present in the prototype NamedNodeMap attributes = proto.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attribute = (Attr) attributes.item(i); String localName = attribute.getLocalName(); if (localName == null) { String name = attribute.getName(); if (oldEl.hasAttribute(name)) { clone.setAttributeNode( (Attr) newInstanceDocument.importNode(oldEl.getAttributeNode(name), false)); } else { LOGGER.debug("[rebuildInstance] copying in missing attribute " + attribute.getNodeName() + " to " + XMLUtil.buildXPath(clone, newInstanceDocument.getDocumentElement())); clone.setAttributeNode((Attr) attribute.cloneNode(false)); } } else { String namespace = attribute.getNamespaceURI(); if (!((!isEmpty && (namespace.equals(NamespaceConstants.XMLSCHEMA_INSTANCE_NS) && localName.equals("nil")) || (namespace.equals(NamespaceService.ALFRESCO_URI) && localName.equals("prototype"))))) { if (oldEl.hasAttributeNS(namespace, localName)) { clone.setAttributeNodeNS((Attr) newInstanceDocument .importNode(oldEl.getAttributeNodeNS(namespace, localName), false)); } else { LOGGER.debug("[rebuildInstance] copying in missing attribute " + attribute.getNodeName() + " to " + XMLUtil.buildXPath(clone, newInstanceDocument.getDocumentElement())); clone.setAttributeNodeNS((Attr) attribute.cloneNode(false)); } } } } // recurse on children rebuildInstance(proto, oldEl, clone, schemaNamespaces); } } // Now add in a new copy of the prototype if (isPrototype) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("[rebuildInstance] appending " + proto.getNodeName() + " to " + XMLUtil.buildXPath(newInstanceNode, newInstanceDocument.getDocumentElement())); } newInstanceNode.appendChild(proto.cloneNode(true)); } } }
From source file:org.apache.ode.utils.DOMUtils.java
/** * Returns the value of an attribute of an element. Returns null if the * attribute is not found (whereas Element.getAttribute returns "" if an * attrib is not found).// w w w. j a v a 2 s.c o m * * @param el Element whose attrib is looked for * @param attrName name of attribute to look for * * @return the attribute value */ static public String getAttribute(Element el, String attrName) { String sRet = null; Attr attr = el.getAttributeNode(attrName); if (attr != null) { sRet = attr.getValue(); } return sRet; }
From source file:org.apache.openmeetings.cli.ConnectionPropertiesPatcher.java
private static Attr getConnectionProperties(Document doc) throws Exception { XPath xPath = XPathFactory.newInstance().newXPath(); XPathExpression expr = xPath// w w w. j a v a 2 s . co m .compile("/persistence/persistence-unit/properties/property[@name='openjpa.ConnectionProperties']"); Element element = (Element) expr.evaluate(doc, XPathConstants.NODE); return element.getAttributeNode("value"); }
From source file:org.apache.shindig.gadgets.templates.XmlTemplateLibrary.java
private void processTemplateDef(Builder<TagHandler> handlers, Element defElement) throws TemplateParserException { Attr tagAttribute = defElement.getAttributeNode(TAG_ATTRIBUTE); if (tagAttribute == null) { throw new TemplateParserException("Missing tag attribute on TemplateDef"); }//from www . j a va 2 s . c o m ImmutableSet.Builder<TemplateResource> resources = ImmutableSet.builder(); Element scriptElement = (Element) DomUtil.getFirstNamedChildNode(defElement, JAVASCRIPT_TAG); if (scriptElement != null) { resources.add(TemplateResource.newJavascriptResource(scriptElement.getTextContent(), this)); } Element styleElement = (Element) DomUtil.getFirstNamedChildNode(defElement, STYLE_TAG); if (styleElement != null) { resources.add(TemplateResource.newStyleResource(styleElement.getTextContent(), this)); } Element templateElement = (Element) DomUtil.getFirstNamedChildNode(defElement, TEMPLATE_TAG); TagHandler handler = createHandler(tagAttribute.getNodeValue(), templateElement, resources.build()); if (handler != null) { handlers.add(handler); } }
From source file:org.apache.shindig.gadgets.templates.XmlTemplateLibrary.java
private void processTemplate(Builder<TagHandler> handlers, Element templateElement) throws TemplateParserException { Attr tagAttribute = templateElement.getAttributeNode(TAG_ATTRIBUTE); if (tagAttribute == null) { throw new TemplateParserException("Missing tag attribute on Template"); }/*w w w. j a v a2 s . c o m*/ TagHandler handler = createHandler(tagAttribute.getNodeValue(), templateElement, ImmutableSet.<TemplateResource>of()); if (handler != null) { handlers.add(handler); } }
From source file:org.apache.xml.security.Init.java
/** * Initialise the library from a configuration file *//*from ww w . jav a2 s .co m*/ private static void fileInit(InputStream is) { try { /* read library configuration file */ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(false); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(is); Node config = doc.getFirstChild(); for (; config != null; config = config.getNextSibling()) { if ("Configuration".equals(config.getLocalName())) { break; } } if (config == null) { log.error("Error in reading configuration file - Configuration element not found"); return; } for (Node el = config.getFirstChild(); el != null; el = el.getNextSibling()) { if (el == null || Node.ELEMENT_NODE != el.getNodeType()) { continue; } String tag = el.getLocalName(); if (tag.equals("ResourceBundles")) { Element resource = (Element) el; /* configure internationalization */ Attr langAttr = resource.getAttributeNode("defaultLanguageCode"); Attr countryAttr = resource.getAttributeNode("defaultCountryCode"); String languageCode = (langAttr == null) ? null : langAttr.getNodeValue(); String countryCode = (countryAttr == null) ? null : countryAttr.getNodeValue(); I18n.init(languageCode, countryCode); } if (tag.equals("CanonicalizationMethods")) { Element[] list = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "CanonicalizationMethod"); for (int i = 0; i < list.length; i++) { String URI = list[i].getAttributeNS(null, "URI"); String JAVACLASS = list[i].getAttributeNS(null, "JAVACLASS"); try { Canonicalizer.register(URI, JAVACLASS); if (log.isDebugEnabled()) { log.debug("Canonicalizer.register(" + URI + ", " + JAVACLASS + ")"); } } catch (ClassNotFoundException e) { Object exArgs[] = { URI, JAVACLASS }; log.error(I18n.translate("algorithm.classDoesNotExist", exArgs)); } } } if (tag.equals("TransformAlgorithms")) { Element[] tranElem = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "TransformAlgorithm"); for (int i = 0; i < tranElem.length; i++) { String URI = tranElem[i].getAttributeNS(null, "URI"); String JAVACLASS = tranElem[i].getAttributeNS(null, "JAVACLASS"); try { Transform.register(URI, JAVACLASS); if (log.isDebugEnabled()) { log.debug("Transform.register(" + URI + ", " + JAVACLASS + ")"); } } catch (ClassNotFoundException e) { Object exArgs[] = { URI, JAVACLASS }; log.error(I18n.translate("algorithm.classDoesNotExist", exArgs)); } catch (NoClassDefFoundError ex) { log.warn("Not able to found dependencies for algorithm, I'll keep working."); } } } if ("JCEAlgorithmMappings".equals(tag)) { Node algorithmsNode = ((Element) el).getElementsByTagName("Algorithms").item(0); if (algorithmsNode != null) { Element[] algorithms = XMLUtils.selectNodes(algorithmsNode.getFirstChild(), CONF_NS, "Algorithm"); for (int i = 0; i < algorithms.length; i++) { Element element = algorithms[i]; String id = element.getAttribute("URI"); JCEMapper.register(id, new JCEMapper.Algorithm(element)); } } } if (tag.equals("SignatureAlgorithms")) { Element[] sigElems = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "SignatureAlgorithm"); for (int i = 0; i < sigElems.length; i++) { String URI = sigElems[i].getAttributeNS(null, "URI"); String JAVACLASS = sigElems[i].getAttributeNS(null, "JAVACLASS"); /** $todo$ handle registering */ try { SignatureAlgorithm.register(URI, JAVACLASS); if (log.isDebugEnabled()) { log.debug("SignatureAlgorithm.register(" + URI + ", " + JAVACLASS + ")"); } } catch (ClassNotFoundException e) { Object exArgs[] = { URI, JAVACLASS }; log.error(I18n.translate("algorithm.classDoesNotExist", exArgs)); } } } if (tag.equals("ResourceResolvers")) { Element[] resolverElem = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver"); for (int i = 0; i < resolverElem.length; i++) { String JAVACLASS = resolverElem[i].getAttributeNS(null, "JAVACLASS"); String Description = resolverElem[i].getAttributeNS(null, "DESCRIPTION"); if ((Description != null) && (Description.length() > 0)) { if (log.isDebugEnabled()) { log.debug("Register Resolver: " + JAVACLASS + ": " + Description); } } else { if (log.isDebugEnabled()) { log.debug("Register Resolver: " + JAVACLASS + ": For unknown purposes"); } } try { ResourceResolver.register(JAVACLASS); } catch (Throwable e) { log.warn("Cannot register:" + JAVACLASS + " perhaps some needed jars are not installed", e); } } } if (tag.equals("KeyResolver")) { Element[] resolverElem = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver"); List<String> classNames = new ArrayList<String>(resolverElem.length); for (int i = 0; i < resolverElem.length; i++) { String JAVACLASS = resolverElem[i].getAttributeNS(null, "JAVACLASS"); String Description = resolverElem[i].getAttributeNS(null, "DESCRIPTION"); if ((Description != null) && (Description.length() > 0)) { if (log.isDebugEnabled()) { log.debug("Register Resolver: " + JAVACLASS + ": " + Description); } } else { if (log.isDebugEnabled()) { log.debug("Register Resolver: " + JAVACLASS + ": For unknown purposes"); } } classNames.add(JAVACLASS); } KeyResolver.registerClassNames(classNames); } if (tag.equals("PrefixMappings")) { if (log.isDebugEnabled()) { log.debug("Now I try to bind prefixes:"); } Element[] nl = XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "PrefixMapping"); for (int i = 0; i < nl.length; i++) { String namespace = nl[i].getAttributeNS(null, "namespace"); String prefix = nl[i].getAttributeNS(null, "prefix"); if (log.isDebugEnabled()) { log.debug("Now I try to bind " + prefix + " to " + namespace); } ElementProxy.setDefaultPrefix(namespace, prefix); } } } } catch (Exception e) { log.error("Bad: ", e); e.printStackTrace(); } }