private static void removeXmlBase(Element e) { e.removeAttributeNS("http://www.w3.org/XML/1998/namespace", "base"); // NOI18N e.removeAttribute("xml:base"); // NOI18N }
protected void namespace(Element element, String prefix, String uri) { String qname; if ("".equals(prefix) || prefix == null) { qname = "xmlns"; } else { qname = "xmlns:" + prefix; } // older version of Xerces (I confirmed that the bug is gone with Xerces 2.4.0) // have a problem of re-setting the same namespace attribute twice. // work around this bug removing it first. if (element.hasAttributeNS("http://www.w3.org/2000/xmlns/", qname)) { // further workaround for an old Crimson bug where the removeAttribtueNS // method throws NPE when the element doesn't have any attribute. // to be on the safe side, check the existence of attributes before // attempting to remove it. // for details about this bug, see org.apache.crimson.tree.ElementNode2 // line 540 or the following message: // https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=2767 element.removeAttributeNS("http://www.w3.org/2000/xmlns/", qname); } // workaround until here element.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, uri); }
protected void setLocalIdAttribute(String attrName, String value) { if (value != null) { Attr attr = getDocument().createAttributeNS(null, attrName); attr.setValue(value); getElement().setAttributeNodeNS(attr); getElement().setIdAttributeNode(attr, true); } else { getElement().removeAttributeNS(null, attrName); } }
public static void deleteAttr(Element e, String namespaceURI, String localName) { if (e.hasAttributeNS(namespaceURI, localName)) e.removeAttributeNS(namespaceURI, localName); }
protected void namespace(Element element, String prefix, String uri) { String qname; if ("".equals(prefix) || prefix == null) { qname = "xmlns"; } else { qname = "xmlns:" + prefix; } // older version of Xerces (I confirmed that the bug is gone with Xerces 2.4.0) // have a problem of re-setting the same namespace attribute twice. // work around this bug removing it first. if (element.hasAttributeNS("http://www.w3.org/2000/xmlns/", qname)) { // further workaround for an old Crimson bug where the removeAttribtueNS // method throws NPE when the element doesn't have any attribute. // to be on the safe side, check the existence of attributes before // attempting to remove it. // for details about this bug, see org.apache.crimson.tree.ElementNode2 // line 540 or the following message: // https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=2767 element.removeAttributeNS("http://www.w3.org/2000/xmlns/", qname); } // workaround until here element.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, uri); }
public void removeAttribute(String namespaceUri, String localName) { synchronized(document) { XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); if (xmlQName.hasLocalNamespace()) { element.removeAttributeNS(null, xmlQName.getLocalName()); } else { element.removeAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName()); } } }
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { final CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element)); parserContext.pushContainingComponent(compDefinition); final String metricRegistryBeanName = element.getAttribute("metric-registry"); if (!StringUtils.hasText(metricRegistryBeanName)) { throw new RuntimeException(); // TODO } final RuntimeBeanReference metricRegistryBeanRef = new RuntimeBeanReference(metricRegistryBeanName); final List<Element> metricElements = DomUtils.getChildElementsByTagName(element, new String[] { "bean", "ref" }); for (Element metricElement : metricElements) { // Get the name attribute and remove it (to prevent Spring from looking for a BeanDefinitionDecorator) final String name = metricElement.getAttributeNS(METRICS_NAMESPACE, "name"); if (name != null) { metricElement.removeAttributeNS(METRICS_NAMESPACE, "name"); } final Object metric = parserContext.getDelegate().parsePropertySubElement(metricElement, null); final RootBeanDefinition metricRegistererDef = new RootBeanDefinition(MetricRegisterer.class); metricRegistererDef.setSource(parserContext.extractSource(metricElement)); metricRegistererDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); final ConstructorArgumentValues args = metricRegistererDef.getConstructorArgumentValues(); args.addIndexedArgumentValue(0, metricRegistryBeanRef); args.addIndexedArgumentValue(1, name); args.addIndexedArgumentValue(2, metric); final String beanName = parserContext.getReaderContext().registerWithGeneratedName(metricRegistererDef); parserContext.registerComponent(new BeanComponentDefinition(metricRegistererDef, beanName)); } parserContext.popAndRegisterContainingComponent(); return null; }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(namespace != null) { element.removeAttributeNS(namespace, localPart); } else { element.removeAttribute(localPart); } } }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(namespace != null) { element.removeAttributeNS(namespace, localPart); } else { element.removeAttribute(localPart); } } }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(namespace != null) { element.removeAttributeNS(namespace, localPart); } else { element.removeAttribute(localPart); } } }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { if(namespace != null) { element.removeAttributeNS(namespace, localPart); } else { element.removeAttribute(localPart); } } }
/** * Sets the <code>xsi:nil</code> attribute to the passed value. */ public static void setXsiNil(Element elem, boolean isNil) { if (isNil) elem.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil", "true"); else elem.removeAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "nil"); }
public static void removeAttribute(Element e, QName qn) { String ns = qn.getNamespaceURI(); String ln = qn.getLocalPart(); if ((ns == null) || (ns.length() == 0)) e.removeAttribute(ln); else e.removeAttributeNS(ns, ln); }
public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { try { _delegate.removeAttributeNS(namespaceURI, localName); } catch (org.w3c.dom.DOMException ex) { throw wrap(ex); } }
@Override public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { final Element elem = getElement(); if (elem != null) elem.removeAttributeNS(namespaceURI, localName); }
/** * @see org.w3c.dom.Element#removeAttributeNS(String, String) */ @Override public void removeAttributeNS(String arg0, String arg1) { original.get().removeAttributeNS(arg0, arg1); }
@Override public Element removeAttrNS(String namespaceURI, String name) { if (namespaceURI == null) { return removeAttr(name); } Params.notNullOrEmpty(name, "Attribute name"); node.removeAttributeNS(namespaceURI, name); return this; }
public void removeAttribute(String namespaceUri, String localName) { synchronized(document) { XmlQName xmlQName = new XmlQName(this, namespaceUri, localName); if (xmlQName.hasLocalNamespace()) { element.removeAttributeNS(null, xmlQName.getLocalName()); } else { element.removeAttributeNS(xmlQName.getNamespaceUri(), xmlQName.getLocalName()); } } }
protected void setLocalIdAttribute(String attrName, String value) { if (value != null) { Attr attr = getDocument().createAttributeNS(null, attrName); attr.setValue(value); getElement().setAttributeNodeNS(attr); getElement().setIdAttributeNode(attr, true); } else { getElement().removeAttributeNS(null, attrName); } }
protected void setLocalIdAttribute(String attrName, String value) { if (value != null) { Attr attr = getDocument().createAttributeNS(null, attrName); attr.setValue(value); getElement().setAttributeNodeNS(attr); getElement().setIdAttributeNode(attr, true); } else { getElement().removeAttributeNS(null, attrName); } }