public Optional<XmlElement> getOnlyChildElementWithSameNamespaceOptionally() { Optional<XmlElement> child = getOnlyChildElementOptionally(); if (child.isPresent() && child.get().getNamespaceOptionally().isPresent() && getNamespaceOptionally().isPresent() && getNamespaceOptionally().get().equals(child.get().getNamespaceOptionally().get())) { return child; } return Optional.absent(); }
public String getNamespace() throws MissingNameSpaceException { Optional<String> namespaceURI = getNamespaceOptionally(); if (!namespaceURI.isPresent()){ throw new MissingNameSpaceException(String.format("No namespace defined for %s", this), DocumentedException.ErrorType.application, DocumentedException.ErrorTag.operation_failed, DocumentedException.ErrorSeverity.error); } return namespaceURI.get(); }
public boolean hasNamespace() { if (!getNamespaceAttributeOptionally().isPresent()) { if (!getNamespaceOptionally().isPresent()) { return false; } } return true; }
public Optional<XmlElement> getOnlyChildElementWithSameNamespaceOptionally(final String childName) { Optional<String> namespace = getNamespaceOptionally(); if (namespace.isPresent()) { List<XmlElement> children = getChildElementsWithinNamespace(namespace.get()); children = Lists.newArrayList(Collections2.filter(children, new Predicate<XmlElement>() { @Override public boolean apply(XmlElement xmlElement) { return xmlElement.getName().equals(childName); } })); if (children.size() != 1){ return Optional.absent(); } return Optional.of(children.get(0)); } return Optional.absent(); }
Optional<String> namespaceOptionally = getNamespaceOptionally(); if(namespaceOptionally.isPresent()) { namespaces.put(DEFAULT_NAMESPACE_PREFIX, namespaceOptionally.get());
src.getNamespaceOptionally().equals(filter.getNamespaceOptionally()); MatchingResult result = null; if (tagMatch) {