List of usage examples for org.w3c.dom Attr getValue
public String getValue();
From source file:org.openmeetings.cli.ConnectionPropertiesPatcher.java
protected Attr patchAttribute(Attr attr, String host, String port, String db, String user, String pass) { String[] tokens = attr.getValue().split(","); processBasicProperties(tokens, user, pass, connectionProperties); patchDb(tokens, host, port, db);//ww w . j av a2 s . com attr.setValue(StringUtils.join(tokens, ",")); return attr; }
From source file:org.opensingular.form.io.SFormXMLUtil.java
private static void lerAtributos(SInstance instancia, MElement xml) { NamedNodeMap atributos = xml.getAttributes(); if (atributos != null) { for (int i = 0; i < atributos.getLength(); i++) { Attr at = (Attr) atributos.item(i); if (at.getName().equals(ATRIBUTO_ID)) { instancia.setId(Integer.valueOf(at.getValue())); } else if (!at.getName().equals(ATRIBUTO_LAST_ID)) { getInternalAccess().setAttributeValueSavingForLatter(instancia, at.getName(), at.getValue()); }/* w w w . ja v a 2s .c o m*/ } } }
From source file:org.openspaces.core.config.LocalTxManagerBeanDefinitionParser.java
protected void doParse(Element element, BeanDefinitionBuilder builder) { log.warn(// ww w . j a va 2 s . c o m "Local transaction manager is deprecated, use distributed transaction manager instead ('distributed-tx-manager')"); super.doParse(element, builder); NamedNodeMap attributes = element.getAttributes(); for (int x = 0; x < attributes.getLength(); x++) { Attr attribute = (Attr) attributes.item(x); String name = attribute.getLocalName(); if (ID_ATTRIBUTE.equals(name)) { continue; } String propertyName = extractPropertyName(name); if (SPACE.equals(name)) { continue; } if (CLUSTERED.equals(name)) { continue; } Assert.state(StringUtils.hasText(propertyName), "Illegal property name returned from 'extractPropertyName(String)': cannot be null or empty."); builder.addPropertyValue(propertyName, attribute.getValue()); } }
From source file:org.osaf.cosmo.xml.DomWriter.java
private static void writeAttribute(Attr a, XMLStreamWriter writer) throws XMLStreamException { //if (log.isDebugEnabled()) //log.debug("Writing attribute " + a.getNodeName()); String local = a.getLocalName(); if (local == null) local = a.getNodeName();/*ww w . j av a 2s .c o m*/ String ns = a.getNamespaceURI(); String value = a.getValue(); // was handled by writing the default namespace in writeElement if (local.equals("xmlns")) return; if (ns != null) { String prefix = a.getPrefix(); if (prefix != null) writer.writeAttribute(prefix, ns, local, value); else writer.writeAttribute(ns, local, value); } else { writer.writeAttribute(local, value); } }
From source file:org.regenstrief.util.XMLUtil.java
/** * Strips namespaces and prefixes from a Node tree * // ww w.j a v a2 s . c o m * @param n the root Node * @return the stripped Node **/ public final static Node stripNamespaces(final Node n) { if (n == null) { return null; } final Document doc = n.getOwnerDocument(); if (n instanceof Element) { final Element eOld = (Element) n; final Element eNew = doc.createElement(getLocalName(eOld)); final NamedNodeMap map = eOld.getAttributes(); for (int i = 0, size = size(map); i < size; i++) { final Attr attr = (Attr) map.item(i); String name = attr.getName(); if (name == null) { name = attr.getLocalName(); } if (!("xmlns".equals(name) || ((name != null) && name.startsWith("xmlns:")) || "xmlns".equals(attr.getPrefix()))) { final int j = name.indexOf(':'); eNew.setAttribute(j < 0 ? name : name.substring(j + 1), attr.getValue()); } } final NodeList list = n.getChildNodes(); for (int i = 0, size = size(list); i < size; i++) { appendChild(eNew, stripNamespaces(list.item(i))); } return eNew; } else if (n instanceof Attr) { return null; } return n.cloneNode(false); }
From source file:org.sd.xml.DomElement.java
public String getAttribute(String name) { String result = null;//from ww w .ja v a2 s. c om final Attr attr = getAttributeNode(name); if (attr != null) { result = attr.getValue(); } return result; }
From source file:org.sd.xml.DomElement.java
public String getAttributeNS(String namespaceURI, String localName) { String result = null;/* w w w.j av a 2 s . c om*/ final Attr attr = getAttributeNodeNS(namespaceURI, localName); if (attr != null) { result = attr.getValue(); } return result; }
From source file:org.soybeanMilk.core.config.parser.ConfigurationParser.java
/** * ?/* w w w . j a v a2 s.c om*/ * @param element * @param attrName * @return */ protected String getAttributeValue(Element element, String attrName) { Attr attr = element.getAttributeNode(attrName); return attr == null ? null : attr.getValue(); }
From source file:org.springframework.ws.transport.http.LocationTransformerObjectSupport.java
/** * Transforms the locations of the given definition document using the given XPath expression. * @param xPathExpression the XPath expression * @param definitionDocument the definition document * @param request the request, used to determine the location to transform to *//* w ww . ja v a 2s . c o m*/ protected void transformLocations(XPathExpression xPathExpression, Document definitionDocument, HttpServletRequest request) { Assert.notNull(xPathExpression, "'xPathExpression' must not be null"); Assert.notNull(definitionDocument, "'definitionDocument' must not be null"); Assert.notNull(request, "'request' must not be null"); List<Node> locationNodes = xPathExpression.evaluateAsNodeList(definitionDocument); for (Node locationNode : locationNodes) { if (locationNode instanceof Attr) { Attr location = (Attr) locationNode; if (StringUtils.hasLength(location.getValue())) { String newLocation = transformLocation(location.getValue(), request); if (logger.isDebugEnabled()) { logger.debug("Transforming [" + location.getValue() + "] to [" + newLocation + "]"); } location.setValue(newLocation); } } } }
From source file:org.structr.web.entity.dom.DOMElement.java
@Override public Attr setAttributeNode(final Attr attr) throws DOMException { // save existing attribute node Attr attribute = getAttributeNode(attr.getName()); // set value//from w w w.j a va 2s.co m setAttribute(attr.getName(), attr.getValue()); // set parent of attribute node if (attr instanceof DOMAttribute) { ((DOMAttribute) attr).setParent(this); } return attribute; }