public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { WebLink rv = new WebLink(); String url = XPathHelper.getNodeValue("//url/@href", descriptor); String title = ((Element)resourceNode).getAttribute("title"); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); rv.setTitle(title); rv.setUrl(url); rv.setAbsolute(url.lastIndexOf("://") > 0); rv.setContextPath(contextPath + title); rv.setSequenceNum(priority); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { WebLink rv = new WebLink(); String href = XPathHelper.getNodeValue("./@href", resourceNode); Document factoryDocument = resourceNode.getOwnerDocument(); Element fileElement = factoryDocument.createElement("file"); fileElement.setAttribute("href", href); resourceNode.appendChild(fileElement); // String filename = href.substring(href.lastIndexOf("/"),href.length() - 1); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); String title = ((Element)resourceNode).getAttribute("title"); rv.setAbsolute(false); rv.setUrl(href); rv.setContextPath(contextPath + title); rv.setTitle(title); rv.setSequenceNum(priority); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { WebLink rv = new WebLink(); String href = XPathHelper.getNodeValue("./@href", resourceNode); Document factoryDocument = resourceNode.getOwnerDocument(); Element fileElement = factoryDocument.createElement("file"); fileElement.setAttribute("href", href); resourceNode.appendChild(fileElement); // String filename = href.substring(href.lastIndexOf("/"),href.length() - 1); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); String title = ((Element)resourceNode).getAttribute("title"); rv.setAbsolute(false); rv.setUrl(href); rv.setContextPath(contextPath + title); rv.setTitle(title); rv.setSequenceNum(priority); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { WebLink rv = new WebLink(); String url = XPathHelper.getNodeValue("//url/@href", descriptor); String title = ((Element)resourceNode).getAttribute("title"); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); rv.setTitle(title); rv.setUrl(url); rv.setAbsolute(url.lastIndexOf("://") > 0); rv.setContextPath(contextPath + title); rv.setSequenceNum(priority); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { String url = XPathHelper.getNodeValue("/CONTENT/URL/@value", descriptor); String title = XPathHelper.getNodeValue("/CONTENT/TITLE/@value", descriptor).replaceAll("/", "_"); try { contextPath = contextPath + java.net.URLEncoder.encode(url, "UTF-8"); } catch (UnsupportedEncodingException e) { return null; } String description = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); WebLink link = new WebLink(); link.setUrl(url); link.setTitle(title); link.setSequenceNum(priority); link.setContextPath(contextPath); link.setDescription(description); link.setAbsolute(url.indexOf("://") > -1); return link; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { String url = XPathHelper.getNodeValue("/EXTERNALLINK/URL/@value", descriptor); String title = XPathHelper.getNodeValue("/EXTERNALLINK/TITLE/@value", descriptor); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); contextPath = contextPath + title; //Validator.escapeResourceName(title); String description = XPathHelper.getNodeValue("/EXTERNALLINK/TEXT", descriptor); WebLink link = new WebLink(); link.setUrl(url); link.setTitle(title); link.setContextPath(contextPath); link.setDescription(description); link.setAbsolute(url.startsWith("http://")); link.setSequenceNum(priority); return link; }