private Map<String, String> getTags(Integer max, Metadata metadata) { Map<String, String> results = new HashMap<>(); int i =0; for (Directory directory : metadata.getDirectories()) { for (Tag tag : directory.getTags()) { results.put(directory.getName() + "." + tag.getTagName(), tag.getDescription()); if(max!=null) { i++; if (i >= max) { return results; } } } } return results; } }
String tagName = tag.getTagName(); String directoryName = directory.getName(); String description = tag.getDescription();
String directoryName = directory.getName(); for (Tag tag : directory.getTags()) { String tagName = tag.getTagName(); String description = tag.getDescription();
/** * A basic representation of the tag's type and value. EG: <code>[Exif IFD0] FNumber - f/2.8</code>. * * @return the tag's type and value */ @Override @NotNull public String toString() { String description = getDescription(); if (description == null) description = _directory.getString(getTagType()) + " (unable to formulate description)"; return "[" + _directory.getName() + "] " + getTagName() + " - " + description; } }
String tagName = tag.getTagName(); String description; try {
@Override public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log) { super.onExtractionSuccess(file, metadata, relativePath, log); // Iterate through all values, calling toString to flush out any formatting exceptions for (Directory directory : metadata.getDirectories()) { directory.getName(); for (Tag tag : directory.getTags()) { tag.getTagName(); tag.getDescription(); } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.getTags() != null) { for (Tag tag : directory.getTags()) { String name = tag.getTagName(); if (!MetadataFields.isMetadataField(name) && tag.getDescription() != null) { String value = tag.getDescription().trim(); if (Boolean.TRUE.toString().equalsIgnoreCase(value)) { value = Boolean.TRUE.toString(); } else if (Boolean.FALSE.toString().equalsIgnoreCase(value)) { value = Boolean.FALSE.toString(); } metadata.set(name, value); } } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.getTags() != null) { for (Tag tag : directory.getTags()) { metadata.set(tag.getTagName(), tag.getDescription()); } } } }
public class MyLinkVisitor extends NodeVisitor { public MyLinkVisitor() { } public void visitTag(Tag tag) { if (tag.getTagName().equals("A")) { LinkTag link = (LinkTag) tag; link.setLink("http://newLink/"); //implement your logic here } } }
NodeVisitor linkvisitor = new NodeVisitor() { public void visitTag(Tag tag) { if (tag.getTagName().equals("SCRIPT")) { ScriptTag script = (ScriptTag)tag; String srcValue = script.getAttribute("src"); String text = script.getStringText(); } } };
public void visitTag(Tag tag) { if ("img".equals(tag.getTagName())) { if ("DataIcon".equals(tag.getAttribute("src"))) { tag.setAttribute("src", icon); } } }
@Override public HashMap<String, String> getTags() { HashMap<String, String> tagMap = new HashMap<String, String>(); if (directory != null) { for (Tag tag : directory.getTags()) { tagMap.put(tag.getTagName(), tag.getDescription()); } } return tagMap; }
@Override public HashMap<String, String> getTags() { HashMap<String, String> tagMap = new HashMap<String, String>(); if (directory != null) { for (Tag tag : directory.getTags()) { tagMap.put(tag.getTagName(), tag.getDescription()); } } return tagMap; }
private void populateMetadata(Metadata metadata) { for (Iterator<?> di = metadata.getDirectories().iterator(); di.hasNext();) { Directory directory = (Directory) di.next(); Map<String, String> tags = new HashMap<String, String>(); put(directory.getName(), tags); for (Iterator<?> ti = directory.getTags().iterator(); ti.hasNext();) { Tag tag = (Tag) ti.next(); try { tags.put(tag.getTagName(), directory.getDescription(tag.getTagType())); } catch (Exception error) { errors.add(error); } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.getTags() != null) { for (Tag tag : directory.getTags()) { String name = tag.getTagName(); if (!MetadataFields.isMetadataField(name) && tag.getDescription() != null) { String value = tag.getDescription().trim(); if (Boolean.TRUE.toString().equalsIgnoreCase(value)) { value = Boolean.TRUE.toString(); } else if (Boolean.FALSE.toString().equalsIgnoreCase(value)) { value = Boolean.FALSE.toString(); } metadata.set(name, value); } } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.getTags() != null) { for (Tag tag : directory.getTags()) { metadata.set(tag.getTagName(), tag.getDescription()); } } } }
public void handle(Directory directory, Metadata metadata) throws MetadataException { if (directory.getTags() != null) { for (Tag tag : directory.getTags()) { metadata.set(tag.getTagName(), tag.getDescription()); } } } }
/** * A basic representation of the tag's type and value. EG: <code>[Exif IFD0] FNumber - f/2.8</code>. * * @return the tag's type and value */ @Override @NotNull public String toString() { String description = getDescription(); if (description == null) description = _directory.getString(getTagType()) + " (unable to formulate description)"; return "[" + _directory.getName() + "] " + getTagName() + " - " + description; } }
private void processGenericMetadataDirectory(final MapWriter writer, final GenericMetadataDirectory directory) { for (Tag tag : directory.getTags()) { try { final int tagType = tag.getTagType(); if (tagType != GenericMetadataDirectory.TAG_FILE_SIZE && tagType != GenericMetadataDirectory.TAG_FILE_DATE_TIME || fileSystemMetadata) { writeValue(writer, formatName(tag.getTagName()), descriptive ? directory.getDescription(tagType) : directory.getObject(tagType)); } } catch (Exception e) { // simply skip this tag } } }
@Override public void onExtractionSuccess(@NotNull File file, @NotNull Metadata metadata, @NotNull String relativePath, @NotNull PrintStream log) { super.onExtractionSuccess(file, metadata, relativePath, log); // Iterate through all values, calling toString to flush out any formatting exceptions for (Directory directory : metadata.getDirectories()) { directory.getName(); for (Tag tag : directory.getTags()) { tag.getTagName(); tag.getDescription(); } } } }