Refine search
public String peekNextChild() { List list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(((Element) list.get(0)).getName()); } }
final String ename = ((Element) content).getName(); final List<?> sibs = pnt == null ? null : pnt .getChildren(ename); return getPositionPath(content, sibs, ename, buffer); pnt.getChildren(emt.getName(), emt.getNamespace()); String xps = "*[local-name() = '" + emt.getName() + "' and namespace-uri() = '" + emt.getNamespaceURI() + "']";
public static Set<QName> getProps(Document doc, Namespace propNs) { Element elProp = doc.getRootElement().getChild("prop", propNs); if (elProp == null) { throw new RuntimeException("No prop element"); } Set<QName> set = new HashSet<QName>(); for (Object o : elProp.getChildren()) { if (o instanceof Element) { Element el = (Element) o; String local = el.getName(); String ns = el.getNamespaceURI(); set.add(new QName(ns, local, el.getNamespacePrefix())); } } return set; } }
private Class<?> findTypeOfField() { Class<?> type = field.getType(); if (isInterface(type)) { for (Element subElement : (List<Element>) e.getChildren()) { Class<?> concreteType = findConcreteTypeFrom(subElement, type); if (concreteType != null) { return concreteType; } } boolean optional = annotationFor(field, ConfigSubtag.class).optional(); if (optional) { return null; } throw bomb("Unable to find a tag of type '" + type.getSimpleName() + "' under element '" + e.getName() + "'"); } return field.getType(); }
private Set<QName> getProps(Document doc) { Element elProp = doc.getRootElement().getChild("prop", NS_DAV); if (elProp == null) { throw new RuntimeException("No prop element"); } Set<QName> set = new HashSet<QName>(); for (Object o : elProp.getChildren()) { if (o instanceof Element) { Element el = (Element) o; String local = el.getName(); String ns = el.getNamespaceURI(); set.add(new QName(ns, local, el.getNamespacePrefix())); } } return set; } }
@SuppressWarnings("unchecked") private Collection parseCollection(Element e, Class<?> collectionType) { ConfigCollection collection = collectionType.getAnnotation(ConfigCollection.class); Class<?> type = collection.value(); Object o = newInstance(collectionType); bombUnless(o instanceof Collection, "Must be some sort of list. Was: " + collectionType.getName()); Collection baseCollection = (Collection) o; for (Element childElement : (List<Element>) e.getChildren()) { if (isInCollection(childElement, type)) { baseCollection.add(parseType(childElement, type)); } } bombIf(baseCollection.size() < collection.minimum(), "Required at least " + collection.minimum() + " subelements to '" + e.getName() + "'. " + "Found " + baseCollection.size() + "."); return baseCollection; }
private Set<QName> getProps(Document doc) { Element elProp = doc.getRootElement().getChild("prop", NS_DAV); if (elProp == null) { throw new RuntimeException("No prop element"); } Set<QName> set = new HashSet<QName>(); for (Object o : elProp.getChildren()) { if (o instanceof Element) { Element el = (Element) o; String local = el.getName(); String ns = el.getNamespaceURI(); set.add(new QName(ns, local, el.getNamespacePrefix())); } } return set; } }
@SuppressWarnings("unchecked") private void parseCollection(Collection collection) { ConfigCollection collectionAnnotation = annotationFor(aClass, ConfigCollection.class); Class<?> elementType = collectionAnnotation.value(); for (Element childElement : (List<Element>) e.getChildren()) { if (isInCollection(childElement, elementType)) { Class<?> collectionType = findConcreteType(childElement, elementType); collection.add(classParser(childElement, collectionType, configCache, new GoCipher(), registry, configReferenceElements).parse()); } } int minimumSize = collectionAnnotation.minimum(); bombIf(collection.size() < minimumSize, "Required at least " + minimumSize + " subelements to '" + e.getName() + "'. " + "Found " + collection.size() + "."); }
private Set<QName> getProps(Document doc) { Element elProp = doc.getRootElement().getChild("prop", NS_DAV); if (elProp == null) { throw new RuntimeException("No prop element"); } Set<QName> set = new HashSet<QName>(); for (Object o : elProp.getChildren()) { if (o instanceof Element) { Element el = (Element) o; String local = el.getName(); String ns = el.getNamespaceURI(); set.add(new QName(ns, local, el.getNamespacePrefix())); } } return set; } }
public static void loadFormat(String folderPath, List<MessageObject> list) throws JDOMException, IOException{ File file = FileUtil.getFile(folderPath); if(!file.exists() || file.isFile()){ return ; } folderPath = file.getPath(); String[] xmlFileNames = file.list(); for(String xmlFileName : xmlFileNames){ Document doc = new SAXBuilder().build(new File(folderPath, xmlFileName)); Element root = doc.getRootElement(); if(!"messages".equals(root.getName())){ continue; } for(Element message : root.getChildren()){ list.add(new MessageObject(message)); } } } }
public static void loadMacro(String folderPath) throws JDOMException, IOException{ File file = FileUtil.getFile(folderPath); // File file = new File(url.getFile()); if(!file.exists() || file.isFile()){ return; } folderPath = file.getPath(); String[] xmlFileNames = file.list(); for(String xmlFileName : xmlFileNames){ Document doc = new SAXBuilder().build(new File(folderPath,xmlFileName)); Element root = doc.getRootElement(); if(!"macros".equals(root.getName())){ continue; } for(Element macro : root.getChildren()){ new MacroObject(macro); } } }
public void assignTo(Element element) { if (!element.getName().equals(GeoTiffConstants.GEOTIFF_IIO_ROOT_ELEMENT_NAME)) { throw new IllegalArgumentException( "root not found: " + GeoTiffConstants.GEOTIFF_IIO_ROOT_ELEMENT_NAME); } final Element ifd1 = element.getChild(GeoTiffConstants.GEOTIFF_IFD_TAG); if (ifd1 == null) { throw new IllegalArgumentException( "Unable to find child " + GeoTiffConstants.GEOTIFF_IFD_TAG); } final Element ifd2 = createIFD(); ifd1.setAttribute( GeoTiffConstants.GEOTIFF_TAGSETS_ATT_NAME, ifd2.getAttributeValue(GeoTiffConstants.GEOTIFF_TAGSETS_ATT_NAME)); final Element[] childElems = (Element[]) ifd2.getChildren().toArray(new Element[0]); for (int i = 0; i < childElems.length; i++) { final Element child = childElems[i]; ifd2.removeContent(child); ifd1.addContent(child); } }
@Override public String peekNextChild() { final List<Element> list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(list.get(0).getName()); } }
public String peekNextChild() { List list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(((Element) list.get(0)).getName()); } }
public String peekNextChild() { List list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(((Element) list.get(0)).getName()); } }
public String peekNextChild() { List list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(((Element) list.get(0)).getName()); } }
private List<Element> getElements(Document inputDocument) { List<Element> elements = new ArrayList<>(); Element root = inputDocument.getRootElement(); if (BwmetaStrings.E_BWMETA.equals(root.getName())) { elements.addAll(root.getChildren()); } else { elements.add(root); } return elements; }
protected List getChildrenElements(String name, Element element, Namespace ns, boolean required) throws ObservationParsingException { List children = element.getChildren(name, ns); if (required && children.isEmpty()) { String error = name + " element not found in " + element.getName(); throw new ObservationParsingException(error); } return children; }
public String peekNextChild() { List list = currentElement.getChildren(); if (null == list || list.isEmpty()) { return null; } return decodeNode(((Element) list.get(0)).getName()); } }
private void readProperties(Representation resource, Element element) { List<Element> properties = element.getChildren(); for (Element property : properties) { if (!property.getName().matches("(link|resource)")) { if (property.getAttribute("nil", XSI_NAMESPACE) != null) { resource.withProperty(property.getName(), null); } else { resource.withProperty(property.getName(), property.getValue()); } } } }