private static void removeXmlBase(Element e) { e.removeAttributeNS("http://www.w3.org/XML/1998/namespace", "base"); // NOI18N e.removeAttribute("xml:base"); // NOI18N }
private static void fixupAttrsSingle(Element e) throws DOMException { removeXmlBase(e); Map<String, String> replace = new HashMap<String, String>(); NamedNodeMap attrs = e.getAttributes(); for (int j = 0; j < attrs.getLength(); j++) { Attr attr = (Attr) attrs.item(j); if (attr.getNamespaceURI() == null && !attr.getName().equals("xmlns")) { // NOI18N replace.put(attr.getName(), attr.getValue()); } } for (Map.Entry<String, String> entry : replace.entrySet()) { e.removeAttribute(entry.getKey()); e.setAttributeNS(null, entry.getKey(), entry.getValue()); } } private static void removeXmlBase(Element e) {
private void transformBody(Element node) throws IOException { for(Element e: elementsOf(node)) { String id = id(e); if (id != null && id.startsWith("debug_")) { if (!retainDebug) { node.removeChild(e); } } else if (id != null && id.startsWith("importflame_")) { String flameName = id.substring("importflame_".length()); e.removeAttribute("id"); e.removeAttribute("src"); importDataSet(flameName, e); } else { transformBody(e); } } }
@Signature public void __unset(String name) { getWrappedObject().removeAttribute(name); }
root.removeAttribute(rootAttribute);
e.removeAttribute("src"); importJs(href, e); e.removeAttribute("id"); e.removeAttribute("src"); importDataSet(flameName, e);
private void mtuPostlex(Document doc) throws DOMException { TreeWalker tw = ((DocumentTraversal) doc).createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, new NameNodeFilter(MaryXML.MTU), false); Element m = null; while ((m = (Element) tw.nextNode()) != null) { if (MaryDomUtils.hasAncestor(m, MaryXML.MTU)) // not highest-level continue; // Now m is a highest-level mtu element // Search for the token whose accent is retained; // all other accents will be deleted. Element c = m; while (c != null && !c.getTagName().equals(MaryXML.TOKEN)) { String whatToAccent = c.getAttribute("accent"); if (whatToAccent != null && whatToAccent.equals("first")) c = MaryDomUtils.getFirstChildElement(c); else c = MaryDomUtils.getLastChildElement(c); } Element retainAccentToken = c; // Now all token below m except retainAccentToken get // their accent deleted. NodeList tokens = m.getElementsByTagName(MaryXML.TOKEN); for (int i = 0; i < tokens.getLength(); i++) { Element t = (Element) tokens.item(i); if (t != retainAccentToken) // not the same *Object*! t.removeAttribute("accent"); } } // for all highest-level mtu elements }
private void mtuPostlex(Document doc) throws DOMException { TreeWalker tw = ((DocumentTraversal) doc).createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, new NameNodeFilter(MaryXML.MTU), false); Element m = null; while ((m = (Element) tw.nextNode()) != null) { if (MaryDomUtils.hasAncestor(m, MaryXML.MTU)) // not highest-level continue; // Now m is a highest-level mtu element // Search for the token whose accent is retained; // all other accents will be deleted. Element c = m; while (c != null && !c.getTagName().equals(MaryXML.TOKEN)) { String whatToAccent = c.getAttribute("accent"); if (whatToAccent != null && whatToAccent.equals("first")) c = MaryDomUtils.getFirstChildElement(c); else c = MaryDomUtils.getLastChildElement(c); } Element retainAccentToken = c; // Now all token below m except retainAccentToken get // their accent deleted. NodeList tokens = m.getElementsByTagName(MaryXML.TOKEN); for (int i = 0; i < tokens.getLength(); i++) { Element t = (Element) tokens.item(i); if (t != retainAccentToken) // not the same *Object*! t.removeAttribute("accent"); } } // for all highest-level mtu elements }
token.removeAttribute("accent"); // doesn't receive an accent } else { // default behaviour: determine by rule whether to assign an accent getAccentPosition(token, tokens, i, sentenceType, specialPositionType); token.removeAttribute("accent"); token.removeAttribute("accent"); // if there is no accent, the accent attribute can be removed
token.removeAttribute("accent"); // doesn't receive an accent } else { // default behaviour: determine by rule whether to assign an accent getAccentPosition(token, tokens, i, sentenceType, specialPositionType); token.removeAttribute("accent"); token.removeAttribute("accent"); // if there is no accent, the accent attribute can be removed
@Test public void testGobalContactDefault() throws Exception { GeoServerInfo g1 = factory.createGlobal(); ContactInfo contact = factory.createContact(); g1.setContact(contact); ByteArrayOutputStream out = out(); persister.save(g1, out); ByteArrayInputStream in = in(out); Document dom = dom(in); Element e = (Element) dom.getElementsByTagName("contact").item(0); e.removeAttribute("class"); in = in(dom); GeoServerInfo g2 = persister.load(in, GeoServerInfo.class); assertEquals(g1, g2); }
/** * Removes all attributes of the given element. * * @param elem the element */ private static void clearAttributes(final Element elem) { final NamedNodeMap attributes = elem.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { elem.removeAttribute(attributes.item(i).getNodeName()); } }
for (int i = 0; i < attrs.getLength(); i++) { Attr attr = (Attr) attrs.item(i); root.removeAttribute(attr.getName()); root.removeAttribute("xmlns:xsi");
dom.getDocumentElement().removeAttribute("resultType");
protected void processNameAttribute(Element element, ParserContext ctx, BeanDefinitionBuilder bean, String val) { bean.addPropertyValue("name", val); element.removeAttribute("name"); if (!element.hasAttribute("id")) { val = "cxf.workqueue." + val; element.setAttribute("id", val); } } });
private static void renameAttribute(Element element, String oldName, String newName) { String value = element.getAttribute(oldName); if (value == null || value.isEmpty()) { return; } element.removeAttribute(oldName); element.setAttribute(newName, value); }
private static void removeAttributes(Element element, String namesCSV) { Set<String> names = toSet(namesCSV); for (String name : names) { String value = element.getAttribute(name); if (value != null) { element.removeAttribute(name); } } }
@Override public void handleEvent(Event evt) { if(checked ^= true) { checkmark.removeAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE); } else { checkmark.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, SVGConstants.CSS_DISPLAY_PROPERTY + ":" + SVGConstants.CSS_NONE_VALUE); } fireSwitchEvent(new ChangeEvent(SVGCheckbox.this)); } }, false);
@Override protected void preProcess(Element element) { //This causes the Bean framework to process the "ref" as a string rather than a ref to another object if(StringUtils.isNotEmpty(element.getAttribute("ref"))) { element.setAttribute("reference", element.getAttribute("ref")); element.removeAttribute("ref"); } super.preProcess(element); } }
private void handleParentAttribute(Element element, BeanDefinitionBuilder builder) { final String parentAttribute = element.getAttribute(PARENT_ATTRIBUTE); if (StringUtils.isNotBlank(parentAttribute)) { builder.setParentName(parentAttribute); } element.removeAttribute(PARENT_ATTRIBUTE); }