List of usage examples for org.w3c.dom Node getLocalName
public String getLocalName();
From source file:de.betterform.xml.xforms.action.SetFocusAction.java
/** * Performs element init.//from ww w. j av a 2s.c o m */ public void init() throws XFormsException { super.init(); // check if setfocus elem has NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (NamespaceConstants.XFORMS_NS.equals(node.getNamespaceURI()) && node.getLocalName().equals("control") && node.getNodeType() == Node.ELEMENT_NODE) { Element elementImpl = (Element) node; XFormsElement xfElem = (XFormsElement) this.element.getUserData(""); if (elementImpl.hasAttributeNS(null, "value")) { String xpath = elementImpl.getAttributeNS(null, "value"); this.referencedControl = XPathCache.getInstance().evaluateAsString( xfElem.getModel().getDefaultInstance().getRootContext(), "string(" + xpath + ")"); } else { this.referencedControl = elementImpl.getTextContent(); } } } if (this.referencedControl == null) { this.referencedControl = getXFormsAttribute(CONTROL_ATTRIBUTE); } if (this.referencedControl == null) { throw new XFormsBindingException( "missing control attribute at " + DOMUtil.getCanonicalPath(this.getElement()), this.target, null); } }
From source file:de.ingrid.interfaces.csw.catalog.impl.TransactionManager.java
/** * Get the Action instance for the given node. * @param actionNode/*from ww w . jav a2s . c o m*/ * @return Action * @throws Exception */ protected Action getAction(Node actionNode) throws Exception { ActionName actionName = ActionName.getByName(actionNode.getLocalName()); switch (actionName) { case INSERT: return new InsertAction(actionNode); case UPDATE: return new UpdateAction(actionNode); case DELETE: return new DeleteAction(actionNode); } return null; }
From source file:org.xmatthew.spy2servers.config.CoreComponentParser.java
protected void doParse(Element element, BeanDefinitionBuilder builder) { super.doParse(element, builder); NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { String localName = child.getLocalName(); if (SIMPLE_ALERT_ELEMENT.equals(localName)) { builder.addPropertyValue("alertRule", parseSimpleAlertRule((Element) child)); }/*from w w w . j a v a 2s . co m*/ } } }
From source file:org.xmatthew.spy2servers.config.CoreComponentParser.java
@SuppressWarnings("unchecked") protected Set parseChannels(Element element, SimpleAlertRule simpleAlertRule) { Set channels = new HashSet(); NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { String localName = child.getLocalName(); if (CHANNEL_ELEMENT.equals(localName)) { channels.add(parseChannel((Element) child)); }/* www.java2 s.c o m*/ } } return channels; }
From source file:org.brekka.phalanx.webservices.SoapExceptionResolver.java
private void resolveDetail(final MessageContext messageContext, final Throwable ex, final SoapFault soapFault) { SoapMessage request = (SoapMessage) messageContext.getRequest(); DOMSource payloadSource = (DOMSource) request.getPayloadSource(); Node node = payloadSource.getNode(); String localName = node.getLocalName(); String namespace = node.getNamespaceURI(); String faultName = StringUtils.removeEnd(localName, "Request") + "Fault"; QName faultQName = new QName(namespace, faultName); SchemaType schemaType = XmlBeans.getContextTypeLoader().findDocumentType(faultQName); if (schemaType != null) { try {/*from w w w . ja v a2 s.c o m*/ XmlObject faultDocument = prepareFaultDetail(messageContext, faultName, schemaType, ex); if (faultDocument != null) { // Add detailed StringWriter writer = new StringWriter(); faultDocument.save(writer, SAVE_OPTIONS); Transformer transformer = transformerFactory.newTransformer(); SoapFaultDetail faultDetail = soapFault.addFaultDetail(); Result result = faultDetail.getResult(); transformer.transform(new StreamSource(new StringReader(writer.toString())), result); } } catch (Exception e) { if (log.isWarnEnabled()) { log.warn(format("Failed to create custom fault message of type '%s'", schemaType), e); } } } }
From source file:com.clican.pluto.dataprocess.spring.parser.IBatisExecProcessorParser.java
public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) { String sqlMapClient = element.getAttribute("sqlMapClient"); beanDef.getPropertyValues().addPropertyValue("sqlMapClient", new RuntimeBeanReference(sqlMapClient)); List<IBatisExecBean> ibatisExecBeanList = new ArrayList<IBatisExecBean>(); NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { String localName = node.getLocalName(); if ("exec".equals(localName)) { IBatisExecBean bean = new IBatisExecBean(); Element ibatisExecElement = (Element) node; String batch = ibatisExecElement.getAttribute("batch"); String statement = ibatisExecElement.getAttribute("statement"); String insertStatement = ibatisExecElement.getAttribute("insertStatement"); String updateStatement = ibatisExecElement.getAttribute("updateStatement"); String ibatisExecType = ibatisExecElement.getAttribute("ibatisExecType"); String paramName = ibatisExecElement.getAttribute("paramName"); String keyProp = ibatisExecElement.getAttribute("keyProp"); String valueProp = ibatisExecElement.getAttribute("valueProp"); String resultName = ibatisExecElement.getAttribute("resultName"); String paramNameMap = ibatisExecElement.getAttribute("paramNameMap"); if (StringUtils.isNotEmpty(paramNameMap)) { Map<String, String> map = new HashMap<String, String>(); for (String pnm : paramNameMap.split(";")) { String contextName = pnm.split("=>")[0].trim(); String ibatisName = pnm.split("=>")[1].trim(); map.put(contextName, ibatisName); }//from w w w . j a v a2 s .co m bean.setParamNameMap(map); } if (StringUtils.isNotEmpty(batch)) { bean.setBatch(Boolean.parseBoolean(batch)); } bean.setStatement(statement); bean.setInsertStatement(insertStatement); bean.setUpdateStatement(updateStatement); bean.setIbatisExecType(IBatisExecType.convert(ibatisExecType)); bean.setKeyProp(keyProp); bean.setValueProp(valueProp); bean.setParamName(paramName); bean.setResultName(resultName); ibatisExecBeanList.add(bean); } } } beanDef.getPropertyValues().addPropertyValue("ibatisExecBeanList", ibatisExecBeanList); }
From source file:com.hp.autonomy.searchcomponents.idol.view.IdolViewServerService.java
private String parseFieldValue(final String referenceField, final List<Hit> documents) { final Hit document = documents.get(0); String referenceFieldValue = null; // Assume the field names are case insensitive final DocContent documentContent = document.getContent(); if (documentContent != null && CollectionUtils.isNotEmpty(documentContent.getContent())) { final NodeList fields = ((Node) documentContent.getContent().get(0)).getChildNodes(); for (int i = 0; i < fields.getLength(); i++) { final Node field = fields.item(i); if (field.getLocalName().equalsIgnoreCase(referenceField)) { referenceFieldValue = field.getFirstChild() == null ? null : field.getFirstChild().getNodeValue(); break; }/*from w ww . j ava 2 s . co m*/ } } return referenceFieldValue; }
From source file:com.clican.pluto.dataprocess.spring.parser.ExcelProcessorParser.java
@SuppressWarnings("unchecked") public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) { List excelBeanList = new ManagedList(); NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { String localName = node.getLocalName(); if ("write".equals(localName) || "read".equals(localName)) { RootBeanDefinition bean = new RootBeanDefinition(); bean.setAbstract(false); bean.setBeanClass(ExcelExecBean.class); bean.setLazyInit(false); bean.setAutowireMode(Autowire.BY_NAME.value()); Element paramElement = (Element) node; String paramName = paramElement.getAttribute("paramName"); String resultName = paramElement.getAttribute("resultName"); String resource = paramElement.getAttribute("resource"); String sheetName = paramElement.getAttribute("sheetName"); String columns = paramElement.getAttribute("columns"); String columnsVarName = paramElement.getAttribute("columnsVarName"); String sheetVarName = paramElement.getAttribute("sheetVarName"); String typeMapStr = paramElement.getAttribute("typeMap"); String resourceVarName = paramElement.getAttribute("resourceVarName"); Map<String, String> typeMap = new HashMap<String, String>(); if ("read".equals(localName)) { for (String type : typeMapStr.split(";")) { typeMap.put(type.split("=>")[0], type.split("=>")[1]); }/*from w w w. j a va 2s . c o m*/ } bean.getPropertyValues().addPropertyValue("paramName", paramName); bean.getPropertyValues().addPropertyValue("resultName", resultName); bean.getPropertyValues().addPropertyValue("sheetName", sheetName); if (StringUtils.isNotEmpty(columns)) { bean.getPropertyValues().addPropertyValue("columns", columns.split(",")); } bean.getPropertyValues().addPropertyValue("resource", resource); bean.getPropertyValues().addPropertyValue("typeMap", typeMap); bean.getPropertyValues().addPropertyValue("columnsVarName", columnsVarName); bean.getPropertyValues().addPropertyValue("sheetVarName", sheetVarName); bean.getPropertyValues().addPropertyValue("resourceVarName", resourceVarName); if ("write".equals(localName)) { bean.getPropertyValues().addPropertyValue("read", false); } excelBeanList.add(bean); } } } beanDef.getPropertyValues().addPropertyValue("excelExecBeanList", excelBeanList); }
From source file:org.xmatthew.spy2servers.config.CoreComponentParser.java
@SuppressWarnings("unchecked") protected Channel parseChannel(Element element) { Channel channel = new Channel(); Set from = new HashSet(); Set to = new HashSet(); NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { String localName = child.getLocalName(); if (FROM_ELEMENT.equals(localName)) { String ref = ((Element) child).getAttribute("value"); from.add(ref);//from www.j a v a 2 s . c o m } else if (TO_ELEMENT.equals(localName)) { String ref = ((Element) child).getAttribute("value"); to.add(ref); } } } channel.setFrom(from); channel.setTo(to); return channel; }
From source file:org.xmatthew.spy2servers.component.config.SunJVMJmxSpyComponentParser.java
protected void doParse(Element element, BeanDefinitionBuilder builder) { super.doParse(element, builder); String host = element.getAttribute("host"); builder.addPropertyValue("host", host); if (element.hasAttribute("port")) { String port = element.getAttribute("port"); builder.addPropertyValue("port", port); }//from ww w . j a va2s . co m if (element.hasAttribute("detectInterval")) { String detectInterval = element.getAttribute("detectInterval"); builder.addPropertyValue("detectInterval", detectInterval); } if (element.hasAttribute("queueSuspendNotifyTime")) { String queueSuspendNotifyTime = element.getAttribute("queueSuspendNotifyTime"); builder.addPropertyValue("queueSuspendNotifyTime", queueSuspendNotifyTime); } MemorySpy heapMemorySpy = null; MemorySpy noneHeapMemorySpy = null; FileSpy fileSpy = null; NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { String localName = child.getLocalName(); if (HEAP_MEMORY_ELEMENT.equals(localName)) { heapMemorySpy = IntegrationNamespaceUtils.parseMemorySpy((Element) child); } else if (NONE_HEAP_MEMORY_ELEMENT.equals(localName)) { noneHeapMemorySpy = IntegrationNamespaceUtils.parseMemorySpy((Element) child); } else if (FILE_SPY_ELEMENT.equals(localName)) { fileSpy = IntegrationNamespaceUtils.parseFileSpy((Element) child); } } } if (heapMemorySpy != null) { builder.addPropertyValue("heapMemorySpy", heapMemorySpy); } if (noneHeapMemorySpy != null) { builder.addPropertyValue("noneHeapMemorySpy", noneHeapMemorySpy); } if (fileSpy != null) { builder.addPropertyValue(FILE_SPY_ELEMENT, fileSpy); } builder.setScope(BeanDefinition.SCOPE_SINGLETON); }