Refine search
public String getAttribute(Element e, String attribute) { Attribute attr = e.getAttribute(attribute); if(attr == null) { throw bomb("Error finding attribute '" + attribute + "' in config: " + configFile + elementOutput(e)); } return attr.getValue(); }
public FieldObject(Element element){ this.type = element.getAttributeValue("type"); this.name = element.getAttributeValue("name"); this.comment =element.getAttributeValue("comment"); Attribute genericAttr = element.getAttribute("generic"); if(genericAttr != null){ this.generic = genericAttr.getValue(); } MacroObject macroObj = MacroObject.getAllMacros().get(this.type); if(macroObj != null){ this.selfObj = macroObj; } macroObj = MacroObject.getAllMacros().get(this.generic); if(macroObj != null){ this.genericObj = macroObj; } }
/** * Return URL string of Atom link element under parent element. Link with no rel attribute is * considered to be rel="alternate" * * @param parent Consider only children of this parent element * @param rel Consider only links with this relationship */ private String findAtomLink(final Element parent, final String rel) { String ret = null; final List<Element> linksList = parent.getChildren("link", ATOM_10_NS); if (linksList != null) { for (final Element element : linksList) { final Element link = element; final Attribute relAtt = getAttribute(link, "rel"); final Attribute hrefAtt = getAttribute(link, "href"); if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) { ret = hrefAtt.getValue(); break; } } } return ret; }
/** Use feed links and/or xml:base attribute to determine baseURI of feed */ private static URL findBaseURI(final Element root) { URL baseURI = null; final List<Element> linksList = root.getChildren("link", OS_NS); if (linksList != null) { for (final Element element : linksList) { final Element link = element; if (!root.equals(link.getParent())) { break; } String href = link.getAttribute("href").getValue(); if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) { href = resolveURI(null, link, href); try { baseURI = new URL(href); break; } catch (final MalformedURLException e) { System.err.println("Base URI is malformed: " + href); } } } } return baseURI; } }
protected void parseCategoriesElement(final Element catsElem) { if (catsElem.getAttribute("href", AtomService.ATOM_PROTOCOL) != null) { setHref(catsElem.getAttribute("href", AtomService.ATOM_PROTOCOL).getValue()); } if (catsElem.getAttribute("fixed", AtomService.ATOM_PROTOCOL) != null) { if ("yes".equals(catsElem.getAttribute("fixed", AtomService.ATOM_PROTOCOL).getValue())) { setFixed(true); } } if (catsElem.getAttribute("scheme", AtomService.ATOM_PROTOCOL) != null) { setScheme(catsElem.getAttribute("scheme", AtomService.ATOM_PROTOCOL).getValue()); } // Loop to parse <atom:category> elemenents to Category objects final List<Element> catElems = catsElem.getChildren("category", AtomService.ATOM_FORMAT); for (final Element catElem : catElems) { final Category cat = new Category(); cat.setTerm(catElem.getAttributeValue("term", AtomService.ATOM_FORMAT)); cat.setLabel(catElem.getAttributeValue("label", AtomService.ATOM_FORMAT)); cat.setScheme(catElem.getAttributeValue("scheme", AtomService.ATOM_FORMAT)); addCategory(cat); } }
attributes.add(new Attribute(a.getName(), a.getValue())); final List<Element> children = e.getChildren("outline"); outline.setModules(parseItemModules(e, locale)); outline.setChildren(parseOutlines(children, validate, locale));
/** * A convienience function used for displaying information in _Debug mode. * Prints an XML element's name, content (if any) and Attributes to * System.out */ private void showXMLElement(Element e, String indent) { System.out.print(parseLevel + indent + "Element: " + e.getName() + " "); String text = e.getTextNormalize(); if (!text.equals("")) System.out.print(" = " + text + " "); //System.out.println(""); for (Attribute att : e.getAttributes()) { //System.out.print(parseLevel + indent + " "); System.out.print(att.getName() + ": " + att.getValue() + " "); } System.out.println(""); for (Element kid : e.getChildren()) { showXMLElement(kid, indent + " "); } }
/** Use feed links and/or xml:base attribute to determine baseURI of feed */ private static URL findBaseURI(final Element root) { URL baseURI = null; final List<Element> linksList = root.getChildren("link", OS_NS); if (linksList != null) { for (final Element element : linksList) { final Element link = element; if (!root.equals(link.getParent())) { break; } String href = link.getAttribute("href").getValue(); if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) { href = resolveURI(null, link, href); try { baseURI = new URL(href); break; } catch (final MalformedURLException e) { System.err.println("Base URI is malformed: " + href); } } } } return baseURI; } }
List<Element> encryptedPasswordElements = xpathExpression.evaluate(document); for (Element element : encryptedPasswordElements) { Attribute encryptedPassword = element.getAttribute(attributeName); encryptedPassword.setValue(reEncryptUsingNewKey(decodeHex(oldCipher), decodeHex(newCipher), encryptedPassword.getValue())); LOGGER.debug("Replaced encrypted value at {}", element.toString());
Element rootNode = doc.getRootElement(); Iterator<Element> cs = rootNode.getChildren().iterator(); while (cs.hasNext()) { Element concept = cs.next(); List<Element> variants = concept.getChild("synonyms").getChildren(); for (Element variant : variants) { if (variant.getAttribute("synonymLanguage").getValue() .matches("Latin|English")) {
str.append(attr.getName()); str.append("=\""); str.append(attr.getValue()); str.append('"'); if (i < attrs.size() - 1) { if (!e.getChildren().isEmpty() || !"".equals(e.getText())) { str.append('>'); if (depth < maxDepth) { str.append('\n'); for (final Element child : e.getChildren()) { getElementString(child, str, depth + 1, maxDepth, showDots);
/** * Checks if given user is exists. * * @param nodes the user element * @return true on exists or false if not */ public static boolean userExists(final List<Element> nodes) { final Element user = nodes.get(0); final String userName = user.getAttributeValue("name"); final String realmId = user.getAttribute("realm").getValue(); LOGGER.debug("check user exists " + userName + " " + realmId); return MCRUserManager.exists(userName, realmId); } }
/** * Return URL string of Atom link element under parent element. Link with no rel attribute is * considered to be rel="alternate" * * @param parent Consider only children of this parent element * @param rel Consider only links with this relationship */ private String findAtomLink(final Element parent, final String rel) { String ret = null; final List<Element> linksList = parent.getChildren("link", ATOM_10_NS); if (linksList != null) { for (final Element element : linksList) { final Element link = element; final Attribute relAtt = getAttribute(link, "rel"); final Attribute hrefAtt = getAttribute(link, "href"); if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) { ret = hrefAtt.getValue(); break; } } } return ret; }
/** Use feed links and/or xml:base attribute to determine baseURI of feed */ private static URL findBaseURI(Element root) { URL baseURI = null; List linksList = root.getChildren("link", OS_NS); if (linksList != null) { for (Iterator links = linksList.iterator(); links.hasNext(); ) { Element link = (Element)links.next(); if (!root.equals(link.getParent())) break; String href = link.getAttribute("href").getValue(); if ( link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) { href = resolveURI(null, link, href); try { baseURI = new URL(href); break; } catch (MalformedURLException e) { System.err.println("Base URI is malformed: " + href); } } } } return baseURI; } }
public T parse() { bombUnless(atElement(), "Unable to parse element <" + e.getName() + "> for class " + aClass.getSimpleName()); T o = createInstance(); if (isAnnotationPresent(aClass, ConfigReferenceCollection.class)) { ConfigReferenceCollection referenceCollection = aClass.getAnnotation(ConfigReferenceCollection.class); String collectionName = referenceCollection.collectionName(); String idFieldName = referenceCollection.idFieldName(); if (e.getAttribute(idFieldName) != null) { String id = e.getAttribute(idFieldName).getValue(); configReferenceElements.add(collectionName, id, o); } } for (GoConfigFieldLoader field : allFields(o)) { field.parse(); } if (isConfigCollection()) { parseCollection((Collection) o); } //check whether there are public PostConstruct methods and call them postConstruct(o); return o; }
final AnimationItem animationItemRoot) { if (animationRoot.getChild("animation") != null) { Attribute nameAttribute = animationRoot.getAttribute("name"); if (nameAttribute == null) { nameAttribute = animationRoot.getAttribute("id"); final String name = nameAttribute != null ? nameAttribute.getValue() : "Default"; for (final Element animationElement : animationRoot.getChildren("animation")) { parseAnimations(channelMap, animationElement, animationItem); logger.fine("\n-- Parsing animation channels --"); final List<Element> channels = animationRoot.getChildren("channel"); for (final Element channel : channels) { final String source = channel.getAttributeValue("source");
private static void addDomToMetadata(Element childDE, String name, MetadataElement parentME) { if (childDE.getChildren().size() > 0 || childDE.getAttributes().size() > 0) { final MetadataElement childME = new MetadataElement(name); addDomToMetadata(childDE, childME); parentME.addElement(childME); if (childDE.getAttributes().size() != 0) { List attrList = childDE.getAttributes(); for (Object o : attrList) { Attribute attribute = (Attribute) o; String attributeName = attribute.getName(); String attributeValue = attribute.getValue(); final ProductData valueMEAtrr = ProductData.createInstance(attributeValue); final MetadataAttribute mdAttribute = new MetadataAttribute(attributeName, valueMEAtrr, true); childME.addAttribute(mdAttribute); } } } else { String valueDE = childDE.getValue(); if (valueDE == null) { valueDE = ""; } final ProductData valueME = ProductData.createInstance(valueDE); final MetadataAttribute attribute = new MetadataAttribute(name, valueME, true); parentME.addAttribute(attribute); } }
private static StoredResponseItem parseAnswerElement( final Element element ) { final String answerValue = element.getText(); final String salt = element.getAttribute( XML_ATTRIBUTE_SALT ) == null ? "" : element.getAttribute( XML_ATTRIBUTE_SALT ).getValue(); final String hashCount = element.getAttribute( XML_ATTRIBUTE_HASH_COUNT ) == null ? "1" : element.getAttribute( XML_ATTRIBUTE_HASH_COUNT ).getValue(); int saltCount = 1; try { saltCount = Integer.parseInt( hashCount ); } catch ( NumberFormatException e ) { /* noop */ } final String formatStr = element.getAttributeValue( XML_ATTRIBUTE_CONTENT_FORMAT ) == null ? "" : element.getAttributeValue( XML_ATTRIBUTE_CONTENT_FORMAT ); return StoredResponseItem.builder() .format( formatStr ) .salt( salt ) .hash( answerValue ) .iterations( saltCount ) .build(); }
/** * Return URL string of Atom link element under parent element. * Link with no rel attribute is considered to be rel="alternate" * @param parent Consider only children of this parent element * @param rel Consider only links with this relationship */ private String findAtomLink(Element parent, String rel) { String ret = null; List linksList = parent.getChildren("link", ATOM_10_NS); if (linksList != null) { for (Iterator links = linksList.iterator(); links.hasNext(); ) { Element link = (Element)links.next(); Attribute relAtt = getAttribute(link, "rel"); Attribute hrefAtt = getAttribute(link, "href"); if ( (relAtt == null && "alternate".equals(rel)) || (relAtt != null && relAtt.getValue().equals(rel))) { ret = hrefAtt.getValue(); break; } } } return ret; }
/** Use feed links and/or xml:base attribute to determine baseURI of feed */ private static URL findBaseURI(Element root) { URL baseURI = null; List linksList = root.getChildren("link", OS_NS); if (linksList != null) { for (Object aLinksList : linksList) { Element link = (Element) aLinksList; if (!root.equals(link.getParent())) break; String href = link.getAttribute("href").getValue(); if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) { href = resolveURI(null, link, href); try { baseURI = new URL(href); break; } catch (MalformedURLException e) { System.err.println("Base URI is malformed: " + href); } } } } return baseURI; } }