本文整理匯總了Java中edu.mit.blocks.codeblocks.Constants類的典型用法代碼示例。如果您正苦於以下問題:Java Constants類的具體用法?Java Constants怎麽用?Java Constants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Constants類屬於edu.mit.blocks.codeblocks包,在下文中一共展示了Constants類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSaveNode
import edu.mit.blocks.codeblocks.Constants; //導入依賴的package包/類
/**
* Returns a DOM node for the entire workspace. This includes the block
* workspace, any custom factories, canvas view state and position, pages
*
* @param validate If {@code true}, perform a validation of the output
* against the code blocks schema
* @return the DOM node for the entire workspace.
*/
public Node getSaveNode(final boolean validate) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Element documentElement = document.createElementNS(Constants.XML_CODEBLOCKS_NS, "cb:CODEBLOCKS");
// schema reference
documentElement.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:schemaLocation", Constants.XML_CODEBLOCKS_NS+" "+Constants.XML_CODEBLOCKS_SCHEMA_URI);
Node workspaceNode = workspace.getSaveNode(document);
if (workspaceNode != null) {
documentElement.appendChild(workspaceNode);
}
document.appendChild(documentElement);
//if (validate) {
// validate(document);
//}
return document;
}
catch (ParserConfigurationException e) {
throw new RuntimeException(e);
}
}