public String getFilePathForNode(Node node, String basePath) { return XPathHelper.getNodeValue("./@href", node); } }
protected String getFilePathForNode(Node node) { String basePath = XPathHelper.getNodeValue("./attribute::baseurl",node.getParentNode()); String fileName = XPathHelper.getNodeValue("./attribute::href", node); return basePath + "/" + fileName; }
protected String getAnswerImageText(Node answerNode) { String imageUri = XPathHelper.getNodeValue(".//matapplication[1]/@uri", answerNode); // no more back slashes! return imageUri.replaceAll("\\\\", "/"); }
public String getFilePathForNode(Node node, String contextPath) { // for files that are part of an assessment, we're going to // tack on an extra container folder to the path. String parentType = XPathHelper.getNodeValue("../@type", node); if ("assessment/x-bb-qti-pool".equals(parentType) || "assessment/x-bb-qti-test".equals(parentType)) { contextPath = contextPath + "/" + ASSESSMENT_FILES_DIRECTORY; } String fileHref = XPathHelper.getNodeValue("./@href", node); return contextPath + "/" + fileHref.replaceAll("\\\\", "/"); }
private String createHtmlImageReference(Node imageNode, String referenceType) { String imageFileName = XPathHelper.getNodeValue("./@source", imageNode); if ("link".equals(referenceType)) { return "<a href=\"" + imageFileName + "\" target=\"_blank\">Link to file</a>"; } else if ("embed".equals(referenceType)) { return "<img src=\"" + imageFileName +"\" alt=\"" + imageFileName + "\" />"; } else return ""; }
protected String getFilenameForNode(Node node) { String sourceFilePath = XPathHelper.getNodeValue("./attribute::href", node); return (sourceFilePath.lastIndexOf("/") < 0) ? sourceFilePath : sourceFilePath.substring(sourceFilePath.lastIndexOf("/") + 1); }
public byte[] getFileBytesForNode(Node node, String contextPath) throws IOException { // for Bb, we ignore the context path String basePath = XPathHelper.getNodeValue("./@baseurl",node.getParentNode()); String fileName = XPathHelper.getNodeValue("./@href", node); String filePath = basePath + "/" + fileName; return getBytesFromFile(new File(pathToData + "/" + filePath)); }
protected boolean isCompoundDocument(Node node, Document resourceDescriptor) { // the rule we're observing is that any document of type resource/x-bb-document // that has more than one child will be treated as a compound document return "resource/x-bb-document".equals(XPathHelper.getNodeValue("./@type",node)) && node.hasChildNodes() && (node.getChildNodes().getLength() > 1); }
public String getFilenameForNode(Node node) { String sourceFilePath = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", "/"); return (sourceFilePath.lastIndexOf("/") < 0) ? sourceFilePath : sourceFilePath.substring(sourceFilePath.lastIndexOf("/") + 1); } }
public Document getDescriptor(Node resourceNode) { String descriptorFilename = XPathHelper.getNodeValue("./@file",resourceNode); DocumentBuilder docBuilder; try { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputStream fis = new FileInputStream(pathToData + "/" + descriptorFilename); return (Document) docBuilder.parse(fis); } catch (Exception e) { return null; } }
public byte[] getFileBytesForNode(Node node, String contextPath) throws IOException { //for Bb we ignore the contextPath... String basePath = XPathHelper.getNodeValue("./@identifier",node.getParentNode()); String fileHref = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", "/"); String filePath = basePath + "/" + fileHref; return getBytesFromFile(new File(pathToData + "/" + filePath)); }
public String getDescription(Node resourceNode) { Document descriptor = resourceHelper.getDescriptor(resourceNode); String desc = XPathHelper.getNodeValue("//TEXT", descriptor); return desc; }
public String getDescription(Node resourceNode) { Document descriptor = resourceHelper.getDescriptor(resourceNode); String desc = XPathHelper.getNodeValue("//TEXT", descriptor); return desc; }
public String getTitle(Node resourceNode) { Document descriptor = getDescriptor(resourceNode); return XPathHelper.getNodeValue("/CONTENT/TITLE",descriptor); }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { DiscussionTopic rv = new DiscussionTopic(); rv.setTitle(XPathHelper.getNodeValue("//title[1]", descriptor)); rv.setDescription(XPathHelper.getNodeValue("//text[1]", descriptor)); return rv; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { String content = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor); String title = XPathHelper.getNodeValue("/CONTENT/TITLE/@value", descriptor).replaceAll("/", "_"); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); contextPath = contextPath + title; //Validator.escapeResourceName(title); TextDocument text = new TextDocument(); text.setContent(content); text.setTitle(title); text.setContextPath(contextPath); text.setSequenceNum(priority); return text; }
public String getDescription(Node itemNode) { String resourceId = XPathHelper.getNodeValue("./@identifierref", itemNode); Node resourceNode = manifestHelper.getResourceForId(resourceId, archiveManifest); return resourceHelper.getDescription(resourceNode); }
public String getDescription(Node itemNode) { String resourceId = XPathHelper.getNodeValue("./@identifierref", itemNode); Node resourceNode = manifestHelper.getResourceForId(resourceId, archiveManifest); return resourceHelper.getDescription(resourceNode); }
public String getDescription(Node itemNode) { String resourceId = XPathHelper.getNodeValue("./@identifierref", itemNode); Node resourceNode = manifestHelper.getResourceForId(resourceId, archiveManifest); return resourceHelper.getDescription(resourceNode); }
protected Collection getImportableItemsFromArchive(String pathToData) { Collection items = new ArrayList(); LBCCResource file = new LBCCResource(); String fileName = ""; file.setFileName(pathToData); file.setDescription(""); file.setContentType("lessonbuilder-cc-file"); String title = XPathHelper.getNodeValue("/manifest/metadata/lom/general/title", this.archiveManifest); file.setTitle(title); file.setLegacyGroup(""); items.add(file); return items; }