@Override public T get() { String valueStr = document.getAttribute(element, valueAttrName); return serializer.fromString(valueStr); }
@Override public V get(K name) { String valueStr = document.getAttribute(element, name.toString()); return serializer.fromString(valueStr); }
@Override public String getAttribute(E element, String name) { return getDelegate().getAttribute(element, name); }
@Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { for (E el : DocIterate.deepElements(doc, doc.getDocumentElement(), null)) { if (Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(doc.getTagName(el))) { String threadId = doc.getAttribute(el, Blips.THREAD_INLINE_ANCHOR_ID_ATTR); if ((threadId != null) && !anchors.containsKey(threadId)) { anchors.put(threadId, doc.getLocation(el)); } } } } });
private static <E> String getManifestAttributeInner(MutableDocument<? super E, E, ?> doc, String attribute) { E top = DocHelper.expectAndGetFirstTopLevelElement(doc, DocumentBasedManifest.MANIFEST_TOP_TAG); return doc.getAttribute(top, attribute); }
private static <E> String getManifestAttributeInner(MutableDocument<? super E, E, ?> doc, String attribute) { E top = DocHelper.expectAndGetFirstTopLevelElement(doc, DocumentBasedManifest.MANIFEST_TOP_TAG); return doc.getAttribute(top, attribute); }
@Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { List<E> elementsToDelete = CollectionUtils.newArrayList(); for (E el : DocIterate.deepElements(doc, doc.getDocumentElement(), null)) { if (Blips.THREAD_INLINE_ANCHOR_TAGNAME.equals(doc.getTagName(el))) { String elId = doc.getAttribute(el, Blips.THREAD_INLINE_ANCHOR_ID_ATTR); if (threadIds.contains(elId)) { elementsToDelete.add(el); } } } // Reverse elements to delete so we always delete bottom up if one // contains another (which would be really weird anyway). Collections.reverse(elementsToDelete); for (E el : elementsToDelete) { doc.deleteNode(el); } } });
public void testAppendLineWithAttributes() { getDocWithSchema(""); LineContainers.appendLine(doc, XmlStringBuilder.createText("hi"), new AttributesImpl("t", "h2")); assertEquals("h2", doc.getAttribute(DocHelper.getElementWithTagName(doc, "line"), "t")); getDocWithSchema("<body><line/>abc</body>"); LineContainers.appendLine(doc, XmlStringBuilder.createText("hi"), new AttributesImpl("id", "2", "t", "h2")); assertEquals("h2", doc.getAttribute(DocHelper.findElementById(doc, "2"), "t")); }
public void testAppendLineWithAttributes() { getDocWithSchema(""); LineContainers.appendLine(doc, XmlStringBuilder.createText("hi"), new AttributesImpl("t", "h2")); assertEquals("h2", doc.getAttribute(DocHelper.getElementWithTagName(doc, "line"), "t")); getDocWithSchema("<body><line/>abc</body>"); LineContainers.appendLine(doc, XmlStringBuilder.createText("hi"), new AttributesImpl("id", "2", "t", "h2")); assertEquals("h2", doc.getAttribute(DocHelper.findElementById(doc, "2"), "t")); }