List of usage examples for org.w3c.dom Element getParentNode
public Node getParentNode();
From source file:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java
/** * Build a map of ResultConfig objects from below a given XML element. */// w ww . j a v a 2s .c o m protected List<ExceptionMappingConfig> buildExceptionMappings(Element element, PackageConfig.Builder packageContext) { NodeList exceptionMappingEls = element.getElementsByTagName("exception-mapping"); List<ExceptionMappingConfig> exceptionMappings = new ArrayList<ExceptionMappingConfig>(); for (int i = 0; i < exceptionMappingEls.getLength(); i++) { Element ehElement = (Element) exceptionMappingEls.item(i); if (ehElement.getParentNode().equals(element) || ehElement.getParentNode().getNodeName().equals(element.getNodeName())) { String emName = ehElement.getAttribute("name"); String exceptionClassName = ehElement.getAttribute("exception"); String exceptionResult = ehElement.getAttribute("result"); Map<String, String> params = XmlHelper.getParams(ehElement); if (StringUtils.isEmpty(emName)) { emName = exceptionResult; } ExceptionMappingConfig ehConfig = new ExceptionMappingConfig.Builder(emName, exceptionClassName, exceptionResult).addParams(params).location(DomHelper.getLocationObject(ehElement)).build(); exceptionMappings.add(ehConfig); } } return exceptionMappings; }
From source file:org.alfresco.web.config.WebConfigRuntime.java
/** * @param properties//from ww w . j a v a 2 s.c o m * @return */ public boolean syncContentWizardOptions(HashMap<String, String> properties) { boolean status = false; Element rootElement = (Element) webConfigDocument.getFirstChild(); Element contentWizardsConfigElem = XmlUtils.findFirstElement( "config[@evaluator='string-compare' and @condition='Content Wizards']", rootElement); if (contentWizardsConfigElem == null) { contentWizardsConfigElem = webConfigDocument.createElement("config"); contentWizardsConfigElem.setAttribute("evaluator", "string-compare"); contentWizardsConfigElem.setAttribute("condition", "Content Wizards"); appendChild(rootElement, contentWizardsConfigElem); status = true; } Element contentTypesElem = XmlUtils.findFirstElement("content-types", contentWizardsConfigElem); if (contentTypesElem == null) { contentTypesElem = webConfigDocument.createElement("content-types"); appendChild(contentWizardsConfigElem, contentTypesElem); status = true; } String typeName = properties.get("type"); String showOption = properties.get("show"); if (typeName != null && showOption != null) { Element typeElem = XmlUtils.findFirstElement("type[@name='" + typeName + "']", contentTypesElem); if (typeElem == null && showOption.equals("true")) { typeElem = webConfigDocument.createElement("type"); typeElem.setAttribute("name", typeName); appendChild(contentTypesElem, typeElem); status = true; } if (typeElem != null && showOption.equals("false")) { typeElem.getParentNode().removeChild(typeElem); status = true; } } return status; }
From source file:de.interactive_instruments.ShapeChange.Target.ReplicationSchema.ReplicationXmlSchema.java
/** * Process a class property.//from w w w . j a v a 2 s. com * * @param pi * property to process * @param sequenceOrChoice * element to which the property element shall be appended * @return */ public void processLocalProperty(PropertyInfo pi, Element sequenceOrChoice) { if (includeProperty(pi)) { Element piElement = addProperty(pi); if (piElement.getLocalName().equals("attribute") || piElement.getLocalName().equals("attributeGroup")) { sequenceOrChoice.getParentNode().appendChild(piElement); } else { sequenceOrChoice.appendChild(piElement); } } }
From source file:javax.microedition.ims.core.xdm.XDMServiceImpl.java
private URIListData handleListNode(Node listNode) { URIListDataBean retValue;/*from ww w .ja v a 2 s . c o m*/ if (listNode != null) { if (!LIST_NODE_NAME.equalsIgnoreCase(listNode.getLocalName())) { throw new IllegalArgumentException("Must be 'list' listNode"); } if (listNode.getNodeType() == Node.ELEMENT_NODE) { Element listElement = (Element) listNode; NodeList displayNameNode = listElement.getElementsByTagNameNS("*", "display-name"); String displayName = /* "" */null; for (int entrIndex = 0; entrIndex < displayNameNode.getLength(); entrIndex++) { if (displayNameNode.item(entrIndex).getNodeType() == Node.ELEMENT_NODE) { Element entryElement = (Element) displayNameNode.item(entrIndex); if (LIST_NODE_NAME.equalsIgnoreCase(entryElement.getParentNode().getLocalName())) { final Node firstChildNode = entryElement.getFirstChild(); if (firstChildNode != null) { displayName = firstChildNode.getNodeValue(); } break; } } } String name = listElement.getAttribute("name"); List<ListEntryData> listEntryData = new ArrayList<ListEntryData>(); // extracts single user URI { NodeList entryNode = listElement.getElementsByTagNameNS("*", "entry"); for (int entrIndex = 0; entrIndex < entryNode.getLength(); entrIndex++) { if (entryNode.item(entrIndex).getNodeType() == Node.ELEMENT_NODE) { Element entryElement = (Element) entryNode.item(entrIndex); if (LIST_NODE_NAME.equalsIgnoreCase(entryElement.getParentNode().getLocalName())) { String entryURI = entryElement.getAttribute("uri"); NodeList entryDisplayNameNode = entryElement.getElementsByTagNameNS("*", "display-name"); String entryDisplayName = null/* "" */; if (entryDisplayNameNode.getLength() > 0) { Node node = entryDisplayNameNode.item(0); final Node firstChildNode = node.getFirstChild(); if (firstChildNode != null) { entryDisplayName = firstChildNode.getNodeValue(); } } listEntryData.add( new ListEntryDataBean(ListEntryData.URI_ENTRY, entryDisplayName, entryURI)); } } } } // extracts references to an already existing URI list { NodeList externalsNode = listElement.getElementsByTagNameNS("*", "external"); for (int entrIndex = 0; entrIndex < externalsNode.getLength(); entrIndex++) { if (externalsNode.item(entrIndex).getNodeType() == Node.ELEMENT_NODE) { Element externalElement = (Element) externalsNode.item(entrIndex); if (LIST_NODE_NAME.equalsIgnoreCase(externalElement.getParentNode().getLocalName())) { String anchorURI = externalElement.getAttribute("anchor"); NodeList anchorDisplayNameNode = externalElement.getElementsByTagNameNS("*", "display-name"); String anchorDisplayName = null/* "" */; if (anchorDisplayNameNode.getLength() > 0) { Node node = anchorDisplayNameNode.item(0); final Node firstChildNode = node.getFirstChild(); if (firstChildNode != null) { anchorDisplayName = firstChildNode.getNodeValue(); } } listEntryData.add(new ListEntryDataBean(ListEntryData.URI_LIST_ENTRY, anchorDisplayName, anchorURI)); } } } } retValue = new URIListDataBean(displayName, name, listEntryData); } else { throw new IllegalArgumentException( "only " + Node.ELEMENT_NODE + " is allowed as parameter. Passed " + listNode.getNodeType()); } } else { throw new NullPointerException("listNode is null. Null is not allowed here."); } return retValue; }
From source file:com.twinsoft.convertigo.beans.core.Sequence.java
private static void traverseLevel(TreeWalker walker, Element topParent, String indent) { // describe current node: Element current = (Element) walker.getCurrentNode(); //System.out.println(indent + "- " + ((Element) current).getTagName()); // store elements which need to be moved if (topParent != null) { Element parent = (Element) current.getParentNode(); if (parent != null && !topParent.equals(parent)) { OutputFilter outputFilter = (OutputFilter) walker.getFilter(); outputFilter.getToAddList(topParent).add(current); }//from ww w . java 2 s. co m } // traverse children: for (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) { traverseLevel(walker, current, indent + '\t'); } // return position to the current (level up): walker.setCurrentNode(current); }
From source file:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.java
/** * Build a map of ResultConfig objects from below a given XML element. *///from w ww . j av a2 s . c om protected Map<String, ResultConfig> buildResults(Element element, PackageConfig.Builder packageContext) { NodeList resultEls = element.getElementsByTagName("result"); Map<String, ResultConfig> results = new LinkedHashMap<String, ResultConfig>(); for (int i = 0; i < resultEls.getLength(); i++) { Element resultElement = (Element) resultEls.item(i); if (resultElement.getParentNode().equals(element) || resultElement.getParentNode().getNodeName().equals(element.getNodeName())) { String resultName = resultElement.getAttribute("name"); String resultType = resultElement.getAttribute("type"); // if you don't specify a name on <result/>, it defaults to "success" if (StringUtils.isEmpty(resultName)) { resultName = Action.SUCCESS; } // there is no result type, so let's inherit from the parent package if (StringUtils.isEmpty(resultType)) { resultType = packageContext.getFullDefaultResultType(); // now check if there is a result type now if (StringUtils.isEmpty(resultType)) { // uh-oh, we have a problem throw new ConfigurationException( "No result type specified for result named '" + resultName + "', perhaps the parent package does not specify the result type?", resultElement); } } ResultTypeConfig config = packageContext.getResultType(resultType); if (config == null) { throw new ConfigurationException( "There is no result type defined for type '" + resultType + "' mapped with name '" + resultName + "'." + " Did you mean '" + guessResultType(resultType) + "'?", resultElement); } String resultClass = config.getClazz(); // invalid result type specified in result definition if (resultClass == null) { throw new ConfigurationException("Result type '" + resultType + "' is invalid"); } Map<String, String> resultParams = XmlHelper.getParams(resultElement); if (resultParams.size() == 0) // maybe we just have a body - therefore a default parameter { // if <result ...>something</result> then we add a parameter of 'something' as this is the most used result param if (resultElement.getChildNodes().getLength() >= 1) { resultParams = new LinkedHashMap<String, String>(); String paramName = config.getDefaultResultParam(); if (paramName != null) { StringBuilder paramValue = new StringBuilder(); for (int j = 0; j < resultElement.getChildNodes().getLength(); j++) { if (resultElement.getChildNodes().item(j).getNodeType() == Node.TEXT_NODE) { String val = resultElement.getChildNodes().item(j).getNodeValue(); if (val != null) { paramValue.append(val); } } } String val = paramValue.toString().trim(); if (val.length() > 0) { resultParams.put(paramName, val); } } else { if (LOG.isWarnEnabled()) { LOG.warn("no default parameter defined for result of type " + config.getName()); } } } } // create new param map, so that the result param can override the config param Map<String, String> params = new LinkedHashMap<String, String>(); Map<String, String> configParams = config.getParams(); if (configParams != null) { params.putAll(configParams); } params.putAll(resultParams); ResultConfig resultConfig = new ResultConfig.Builder(resultName, resultClass).addParams(params) .location(DomHelper.getLocationObject(element)).build(); results.put(resultConfig.getName(), resultConfig); } } return results; }
From source file:it.iit.genomics.cru.structures.bridges.uniprot.UniprotkbUtils.java
private Collection<MoleculeEntry> getUniprotEntriesXML(String location, boolean waitAndRetryOnFailure) throws BridgesRemoteAccessException { String url = location + "&format=xml"; ArrayList<MoleculeEntry> uniprotEntries = new ArrayList<>(); try {/* w ww. ja va2 s . c o m*/ HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, Boolean.TRUE); HttpGet request = new HttpGet(url); // add request header request.addHeader("User-Agent", USER_AGENT); HttpResponse response = client.execute(request); if (response.getEntity().getContentLength() == 0) { // No result return uniprotEntries; } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new InputSource(response.getEntity().getContent())); // optional, but recommended // read this - // http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work doc.getDocumentElement().normalize(); // interaction structure NodeList entryList = doc.getElementsByTagName("entry"); for (int i = 0; i < entryList.getLength(); i++) { Element entryElement = (Element) entryList.item(i); String dataset = entryElement.getAttribute("dataset"); String ac = entryElement.getElementsByTagName("accession").item(0).getFirstChild().getNodeValue(); MoleculeEntry uniprotEntry = new MoleculeEntry(ac); uniprotEntry.setDataset(dataset); // Taxid Element organism = (Element) entryElement.getElementsByTagName("organism").item(0); String organismCommonName = null; String organismScientificName = null; String organismOtherName = null; NodeList organismNames = organism.getElementsByTagName("name"); for (int j = 0; j < organismNames.getLength(); j++) { Element reference = (Element) organismNames.item(j); switch (reference.getAttribute("type")) { case "scientific": organismScientificName = reference.getTextContent(); break; case "common": organismCommonName = reference.getTextContent(); break; default: organismOtherName = reference.getTextContent(); break; } } if (null != organismCommonName) { uniprotEntry.setOrganism(organismCommonName); } else if (null != organismScientificName) { uniprotEntry.setOrganism(organismScientificName); } else if (null != organismOtherName) { uniprotEntry.setOrganism(organismOtherName); } NodeList organismReferences = organism.getElementsByTagName("dbReference"); for (int j = 0; j < organismReferences.getLength(); j++) { Element reference = (Element) organismReferences.item(j); if (reference.hasAttribute("type") && "NCBI Taxonomy".equals(reference.getAttribute("type"))) { String proteinTaxid = reference.getAttribute("id"); uniprotEntry.setTaxid(proteinTaxid); } } // GENE NodeList geneNames = entryElement.getElementsByTagName("gene"); for (int j = 0; j < geneNames.getLength(); j++) { Element gene = (Element) geneNames.item(j); NodeList nameList = gene.getElementsByTagName("name"); for (int k = 0; k < nameList.getLength(); k++) { Element name = (Element) nameList.item(k); uniprotEntry.addGeneName(name.getFirstChild().getNodeValue()); } } // modified residues HashMap<String, ModifiedResidue> modifiedResidues = new HashMap<>(); NodeList features = entryElement.getElementsByTagName("feature"); for (int j = 0; j < features.getLength(); j++) { Element feature = (Element) features.item(j); if (false == entryElement.equals(feature.getParentNode())) { continue; } // ensembl if (feature.hasAttribute("type") && "modified residue".equals(feature.getAttribute("type"))) { String description = feature.getAttribute("description").split(";")[0]; if (false == modifiedResidues.containsKey(description)) { modifiedResidues.put(description, new ModifiedResidue(description)); } NodeList locations = feature.getElementsByTagName("location"); for (int k = 0; k < locations.getLength(); k++) { Element loc = (Element) locations.item(k); NodeList positions = loc.getElementsByTagName("position"); for (int l = 0; l < positions.getLength(); l++) { Element position = (Element) positions.item(l); modifiedResidues.get(description).addPosition( new UniprotPosition(Integer.parseInt(position.getAttribute("position")))); } } } } uniprotEntry.getModifications().addAll(modifiedResidues.values()); // Xrefs: NodeList dbReferences = entryElement.getElementsByTagName("dbReference"); for (int j = 0; j < dbReferences.getLength(); j++) { Element dbReference = (Element) dbReferences.item(j); if (false == entryElement.equals(dbReference.getParentNode())) { continue; } NodeList molecules = dbReference.getElementsByTagName("molecule"); // ensembl if (dbReference.hasAttribute("type") && "Ensembl".equals(dbReference.getAttribute("type"))) { // transcript ID String id = dbReference.getAttribute("id"); for (int iMolecule = 0; iMolecule < molecules.getLength(); iMolecule++) { Element molecule = (Element) molecules.item(iMolecule); uniprotEntry.addXrefToVarSplice(id, molecule.getAttribute("id")); } uniprotEntry.addEnsemblGene(id); NodeList properties = dbReference.getElementsByTagName("property"); for (int k = 0; k < properties.getLength(); k++) { Element property = (Element) properties.item(k); if (property.hasAttribute("type") && "gene ID".equals(property.getAttribute("type"))) { uniprotEntry.addEnsemblGene(property.getAttribute("value")); } } } // refseq if (dbReference.hasAttribute("type") && "RefSeq".equals(dbReference.getAttribute("type"))) { NodeList properties = dbReference.getElementsByTagName("property"); for (int k = 0; k < properties.getLength(); k++) { Element property = (Element) properties.item(k); if (property.hasAttribute("type") && "nucleotide sequence ID".equals(property.getAttribute("type"))) { String id = property.getAttribute("value"); if (molecules.getLength() > 0) { for (int iMolecule = 0; iMolecule < molecules.getLength(); iMolecule++) { Element molecule = (Element) molecules.item(iMolecule); // If refseq, add also without the version uniprotEntry.addXrefToVarSplice(id, molecule.getAttribute("id")); uniprotEntry.addXrefToVarSplice(id.split("\\.")[0], molecule.getAttribute("id")); } } else { // If refseq, add also without the version uniprotEntry.addXrefToVarSplice(id, ac); uniprotEntry.addXrefToVarSplice(id.split("\\.")[0], ac); } uniprotEntry.addRefseq(id); } } } /* PDB chains will be imported from the webservice */ // PDB if (dbReference.hasAttribute("type") && "PDB".equals(dbReference.getAttribute("type"))) { NodeList properties = dbReference.getElementsByTagName("property"); String method = null; String chains = null; for (int k = 0; k < properties.getLength(); k++) { Element property = (Element) properties.item(k); if (property.hasAttribute("type") && "method".equals(property.getAttribute("type"))) { method = property.getAttribute("value"); } else if (property.hasAttribute("type") && "chains".equals(property.getAttribute("type"))) { chains = property.getAttribute("value"); } } if (method != null && "Model".equals(method)) { continue; } if (chains == null) { continue; } String pdb = dbReference.getAttribute("id"); uniprotEntry.addPDB(pdb, method); for (String chainElement : chains.split(",")) { try { String chainNames = chainElement.split("=")[0]; int start = Integer.parseInt(chainElement.split("=")[1].trim().split("-")[0]); int end = Integer .parseInt(chainElement.split("=")[1].trim().split("-")[1].replace(".", "")); for (String chainName : chainNames.split("/")) { uniprotEntry.addChain(pdb, new ChainMapping(pdb, chainName.trim(), start, end), method); } } catch (ArrayIndexOutOfBoundsException aiobe) { // IGBLogger.getInstance().warning( // "Cannot parse chain: " + chainElement // + ", skip"); } } } } // Sequence NodeList sequenceElements = entryElement.getElementsByTagName("sequence"); for (int j = 0; j < sequenceElements.getLength(); j++) { Element sequenceElement = (Element) sequenceElements.item(j); if (false == sequenceElement.getParentNode().equals(entryElement)) { continue; } String sequence = sequenceElement.getFirstChild().getNodeValue().replaceAll("\n", ""); uniprotEntry.setSequence(sequence); } // Diseases NodeList diseases = entryElement.getElementsByTagName("disease"); for (int j = 0; j < diseases.getLength(); j++) { Element disease = (Element) diseases.item(j); NodeList nameList = disease.getElementsByTagName("name"); for (int k = 0; k < nameList.getLength(); k++) { Element name = (Element) nameList.item(k); uniprotEntry.addDisease(name.getFirstChild().getNodeValue()); } } // Get fasta for all varsplice String fastaQuery = "http://www.uniprot.org/uniprot/" + uniprotEntry.getUniprotAc() + ".fasta?include=yes"; try { //HttpClient fastaClient = new DefaultHttpClient(); client.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, Boolean.TRUE); HttpGet fastaRequest = new HttpGet(fastaQuery); // add request header request.addHeader("User-Agent", USER_AGENT); HttpResponse fastaResponse = client.execute(fastaRequest); if (fastaResponse.getEntity().getContentLength() == 0) { continue; } InputStream is = fastaResponse.getEntity().getContent(); try { LinkedHashMap<String, ProteinSequence> fasta = FastaReaderHelper .readFastaProteinSequence(is); boolean mainSequence = true; for (ProteinSequence seq : fasta.values()) { // logger.info("Add sequence: " + seq.getAccession().getID() + " : " + seq.getSequenceAsString()); uniprotEntry.addSequence(seq.getAccession().getID(), seq.getSequenceAsString()); if (mainSequence) { uniprotEntry.setMainIsoform(seq.getAccession().getID()); mainSequence = false; } } } catch (Exception e) { logger.error("Cannot retrieve fasta for : " + uniprotEntry.getUniprotAc()); } } catch (IOException | IllegalStateException ex) { logger.error(null, ex); } uniprotEntries.add(uniprotEntry); } } catch (SAXParseException se) { // Nothing was return // IGBLogger.getInstance() // .error("Uniprot returns empty result: " + url); } catch (IOException | ParserConfigurationException | IllegalStateException | SAXException | DOMException | NumberFormatException e) { if (waitAndRetryOnFailure && allowedUniprotFailures > 0) { try { allowedUniprotFailures--; Thread.sleep(5000); return getUniprotEntriesXML(location, false); } catch (InterruptedException e1) { logger.error("Fail to retrieve data from " + location); throw new BridgesRemoteAccessException("Fail to retrieve data from Uniprot " + location); } } else { logger.error("Problem with Uniprot: " + url); throw new BridgesRemoteAccessException("Fail to retrieve data from Uniprot " + location); } } for (MoleculeEntry entry : uniprotEntries) { addToCache(entry); } return uniprotEntries; }
From source file:org.gvnix.web.exception.handler.roo.addon.addon.WebExceptionHandlerOperationsImpl.java
/** * Removes the definition of the selected Exception in the webmvc-config.xml * file./* ww w. ja v a2 s. c o m*/ * * @param exceptionName Exception Name to remove. */ private String removeWebMvcConfig(String exceptionName) { String webXmlPath = pathResolver.getIdentifier(LogicalPath.getInstance(Path.SRC_MAIN_WEBAPP, ""), WEB_MVC_CONFIG); Validate.isTrue(fileManager.exists(webXmlPath), WEB_MVC_CONFIG_NOT_FOUND); MutableFile webXmlMutableFile = null; Document webXml; try { webXmlMutableFile = fileManager.updateFile(webXmlPath); webXml = XmlUtils.getDocumentBuilder().parse(webXmlMutableFile.getInputStream()); } catch (Exception e) { throw new IllegalStateException(e); } Element root = webXml.getDocumentElement(); Element exceptionResolver = XmlUtils.findFirstElement(RESOLVER_BEAN_MESSAGE + "/property[@name='exceptionMappings']/props/prop[@key='" + exceptionName + "']", root); Validate.isTrue(exceptionResolver != null, "There isn't a Handled Exception with the name:\t" + exceptionName); // Remove Mapping exceptionResolver.getParentNode().removeChild(exceptionResolver); String exceptionViewName = exceptionResolver.getTextContent(); Validate.isTrue(exceptionViewName != null, "Can't remove the view for the:\t" + exceptionName + " Exception."); // Remove NameSpace bean. Element lastExceptionControlled = XmlUtils .findFirstElement("/beans/view-controller[@path='/" + exceptionViewName + "']", root); lastExceptionControlled.getParentNode().removeChild(lastExceptionControlled); XmlUtils.writeXml(webXmlMutableFile.getOutputStream(), webXml); return exceptionViewName; }
From source file:com.evolveum.midpoint.util.DOMUtil.java
private static void fixNamespaceDeclarations(Element targetElement, Element currentElement) { NamedNodeMap attributes = currentElement.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attr = (Attr) attributes.item(i); if (isNamespaceDefinition(attr)) { String prefix = getNamespaceDeclarationPrefix(attr); String namespace = getNamespaceDeclarationNamespace(attr); if (hasNamespaceDeclarationForPrefix(targetElement, prefix)) { if (targetElement != currentElement) { // We are processing parent element, while the original element already // has prefix declaration. That means it must have been processed before // we can skip the usage check continue; }/*ww w .jav a2s.c o m*/ } else { setNamespaceDeclaration(targetElement, prefix, getNamespaceDeclarationNamespace(attr)); } } } Node parentNode = currentElement.getParentNode(); if (parentNode instanceof Element) { fixNamespaceDeclarations(targetElement, (Element) parentNode); } }
From source file:com.concursive.connect.web.modules.wiki.utils.HTMLToWikiUtils.java
public static void processImage(StringBuffer sb, Node n, Element element, String appendToCRLF, String contextPath, int projectId) { // Images/* w ww . j a v a 2 s . c om*/ // [[Image:Filename.jpg]] // [[Image:Filename.jpg|A caption]] // [[Image:Filename.jpg|thumb]] // [[Image:Filename.jpg|right]] // [[Image:Filename.jpg|left]] // <img // style="float: right;" // style="display:block;margin: 0 auto;" // title="This is the title of the image" // longdesc="http://i.l.cnn.net/cnn/2008/LIVING/personal/04/08/fees/art.fees.jpg?1" // src="http://i.l.cnn.net/cnn/2008/LIVING/personal/04/08/fees/art.fees.jpg" // alt="This is an image description" // width="292" // height="219" /> // image right: float: right; margin: 3px; border: 3px solid black; // image left: float: left; margin: 3px; border: 3px solid black; // <img // src="${ctx}/show/some-company/wiki-image/Workflow+-+Ticket+Example.png" // alt="Workflow - Ticket Example.png" // width="315" // height="362" /> // See if the parent is a link String link = null; String title = null; if (hasParentNodeType(n, "a")) { // Get the attributes of the link StringBuffer linkSB = new StringBuffer(); processLink(linkSB, (Element) element.getParentNode(), appendToCRLF, contextPath, projectId); link = linkSB.substring(2, linkSB.length() - 2); } else { // tooltip (will be used as caption), but not for links title = element.getAttribute("title"); } // Determine if this is an embedded video link if (link != null && link.startsWith("http://www.youtube.com/v/")) { processVideoLink(sb, n, element, appendToCRLF, contextPath, link); } else { processImage(sb, n, element, appendToCRLF, contextPath, projectId, link, title); } }