06-24-2009 01:08 PM
var xmlStr = args.xmlData;
var xmlDoc = new XML(xmlStr);
model.xmlDoc=xmlDoc.toString(); // tried with removing toString(), but the same error
$(xmlDoc.Member}
<Family><Member>John</Member></Family>
<message>Error during processing of the template 'Expected hash. xmlDoc evaluated instead to freemarker.template.SimpleScalar on line 1, column 3 in test.post.xml.ftl.'. Please contact your system administrator.</message>
<exception>org.alfresco.service.cmr.repository.TemplateException - Error during processing of the template 'Expected hash. xmlDoc evaluated instead to freemarker.template.SimpleScalar on line 1, column 3 in test.post.xml.ftl.'. Please contact your system administrator.</exception>
06-24-2009 02:35 PM
06-25-2009 08:39 AM
08-13-2009 07:08 AM
08-18-2009 08:38 AM
<#assign xml_doc=node.xmlNodeModel>
<content>${xml_doc.@@markup}</content>
In this case I'm grabbing the XML from a node in the repo and then snagging all of the markup in that node, but you can look at a Freemarker reference for how to navigate the DOM object to extract specific elements and attributes.08-18-2009 11:12 AM
08-18-2009 03:39 PM
var xmlString = "<Family><Member>John</Member></Family>";
var xmlDom = new XML(xmlString);
logger.log(xmlDom.Member);
model.xml = xmlDom;
08-23-2009 04:46 PM
/service/prototype/alfGetXsd?flatten=t&path=/Company%20Home/Data%20Dictionary/Web%20Forms/form1/form1.xsd
<webscript>
<shortname>Loads content into a freemarker model</shortname>
<description>Loads the contents of a file into a model</description>
<url>/prototype/alfGetXsd?nodeid={nodeid}</url>
<url>/prototype/alfGetXsd?storeid={storeid}&path={path}</url>
<url>/prototype/alfGetXsd?flatten={flatten}&path={path}</url>
<format default="xml">argument</format>
<transaction>required</transaction>
<authentication>guest</authentication>
</webscript>
// parse arguments and retrieve primary content node
if ((args.nodeid) && (args.nodeid != "")) {
// use doc mgt nodeid
model.node = search.findNode("workspace://SpacesStore/" + args.nodeid);
model.emailid=model.node.properties["{http://www.alfresco.org/model/system/1.0}node-dbid"];
} else if ( (args.storeid) && (args.storeid != "") && (args.path) && (args.path != "") ) {
// use avm storeid and path
var store = avm.lookupStore(args.storeid);
if (store != null) {
var pathWithStore = args.storeid + ":" + args.path;
model.node = avm.lookupNode(pathWithStore);
model.emailid = "";
}
} else {
// use doc mgt path
if ((args.path) && (args.path != "")) {
model.node = roothome.childByNamePath(args.path);
model.emailid=model.node.properties["{http://www.alfresco.org/model/system/1.0}node-dbid"];
}
}
// make our copy
model.nodecpy = new Array();
var raw_content = new String(model.node.content);
// remove xml document declaration
index1 = raw_content.indexOf("?>");
if (index1 > -1) {
raw_content = raw_content.substring(index1+2);
}
// add our adjusted copy to the model
model.nodecpy.content = new XML(new String(raw_content)).toXMLString();
// modify xml document if desired
var re = new RegExp(/<([\w]+):/);
if (model.nodecpy.content.match(re)) {
var s = new String(model.nodecpy.content);
if ((args.flatten) && (args.flatten == "t")) {
s = s.replace(/<([\w]+):/g, "<$1_");
s = s.replace(/<\/([\w]+):/g, "</$1_");
}
var x = new XML(s);
model.nodecpy.content = x.toXMLString();
} else {
model.noparse = "true";
}
${nodecpy.content}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.