本文整理汇总了Java中org.jdom.JDOMException类的典型用法代码示例。如果您正苦于以下问题:Java JDOMException类的具体用法?Java JDOMException怎么用?Java JDOMException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JDOMException类属于org.jdom包,在下文中一共展示了JDOMException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCreoleXML
import org.jdom.JDOMException; //导入依赖的package包/类
@Override
public Document getCreoleXML() throws Exception, JDOMException {
Document doc = new Document();
Element element;
doc.addContent(element = new Element("CREOLE-DIRECTORY"));
element.addContent(element = new Element("CREOLE"));
element.addContent(element = new Element("RESOURCE"));
Element classElement = new Element("CLASS");
classElement.setText(resourceClass.getName());
element.addContent(classElement);
return doc;
}
示例2: fromXSchema
import org.jdom.JDOMException; //导入依赖的package包/类
/** Creates an AnnotationSchema object from an XSchema file
* @param anXSchemaURL the URL where to find the XSchema file
*/
public void fromXSchema(URL anXSchemaURL)
throws ResourceInstantiationException {
org.jdom.Document jDom = null;
SAXBuilder saxBuilder = new SAXBuilder(false);
try {
try{
jDom = saxBuilder.build(anXSchemaURL);
}catch(JDOMException je){
throw new ResourceInstantiationException(je);
}
} catch (java.io.IOException ex) {
throw new ResourceInstantiationException(ex);
}
workWithJDom(jDom);
}
示例3: processFullCreoleXmlTree
import org.jdom.JDOMException; //导入依赖的package包/类
private void processFullCreoleXmlTree(Plugin plugin,
Document jdomDoc, CreoleAnnotationHandler annotationHandler)
throws GateException, IOException, JDOMException {
// now we can process any annotations on the new classes
// and augment the XML definition
annotationHandler.processAnnotations(jdomDoc);
// debugging
if(DEBUG) {
XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
xmlOut.output(jdomDoc, System.out);
}
// finally, parse the augmented definition with the normal parser
DefaultHandler handler =
new CreoleXmlHandler(this, plugin);
SAXOutputter outputter =
new SAXOutputter(handler, handler, handler, handler);
outputter.output(jdomDoc);
if(DEBUG) {
Out.prln("done parsing " + plugin);
}
}
示例4: getCreoleXML
import org.jdom.JDOMException; //导入依赖的package包/类
@Override
public Document getCreoleXML() throws Exception, JDOMException {
Document doc = new Document();
Element element = null;
doc.addContent(element = new Element("CREOLE-DIRECTORY"));
element.addContent(element = new Element("CREOLE"));
element.addContent(element = new Element("RESOURCE"));
Element classElement = new Element("CLASS");
classElement.setText(TestResource.class.getName());
element.addContent(classElement);
return doc;
}
示例5: test_WebookConfig
import org.jdom.JDOMException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test_WebookConfig() throws JDOMException, IOException{
SAXBuilder builder = new SAXBuilder();
List<MsTeamsNotificationConfig> configs = new ArrayList<MsTeamsNotificationConfig>();
builder.setIgnoringElementContentWhitespace(true);
Document doc = builder.build("src/test/resources/testdoc2.xml");
Element root = doc.getRootElement();
if(root.getChild("msteamsNotifications") != null){
Element child = root.getChild("msteamsNotifications");
if ((child.getAttribute("enabled") != null) && (child.getAttribute("enabled").equals("true"))){
List<Element> namedChildren = child.getChildren("msteamsNotification");
for(Iterator<Element> i = namedChildren.iterator(); i.hasNext();)
{
Element e = i.next();
MsTeamsNotificationConfig whConfig = new MsTeamsNotificationConfig(e);
configs.add(whConfig);
}
}
}
for (MsTeamsNotificationConfig c : configs){
MsTeamsNotification wh = new MsTeamsNotificationImpl();
wh.setEnabled(c.getEnabled());
//msteamsNotification.addParams(c.getParams());
System.out.println(wh.isEnabled().toString());
}
}
示例6: test_ReadXml
import org.jdom.JDOMException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test_ReadXml() throws JDOMException, IOException {
SAXBuilder builder = new SAXBuilder();
//builder.setValidation(true);
builder.setIgnoringElementContentWhitespace(true);
Document doc = builder.build("src/test/resources/testdoc1.xml");
Element root = doc.getRootElement();
System.out.println(root.toString());
if(root.getChild("msteamsNotifications") != null){
Element child = root.getChild("msteamsNotifications");
if ((child.getAttribute("enabled") != null) && (child.getAttribute("enabled").equals("true"))){
List<Element> namedChildren = child.getChildren("msteamsNotification");
for(Iterator<Element> i = namedChildren.iterator(); i.hasNext();)
{
Element e = i.next();
System.out.println(e.toString() + e.getAttributeValue("url"));
//assertTrue(e.getAttributeValue("url").equals("http://something"));
if(e.getChild("parameters") != null){
Element eParams = e.getChild("parameters");
List<Element> paramsList = eParams.getChildren("param");
for(Iterator<Element> j = paramsList.iterator(); j.hasNext();)
{
Element eParam = j.next();
System.out.println(eParam.toString() + eParam.getAttributeValue("name"));
System.out.println(eParam.toString() + eParam.getAttributeValue("value"));
}
}
}
}
}
}
示例7: createModule
import org.jdom.JDOMException; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
String languageName = myCourse.getLanguageID();
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
Project project = baseModule.getProject();
myGenerator.setSelectedCourse(myCourse);
myGenerator.generateProject(project, project.getBaseDir());
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
LOG.info("failed to generate course");
return baseModule;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
}
}
return baseModule;
}
示例8: createCourseFromCourseInfo
import org.jdom.JDOMException; //导入依赖的package包/类
public static void createCourseFromCourseInfo(@NotNull ModifiableModuleModel moduleModel,
@NotNull Project project,
@NotNull StudyProjectGenerator generator,
@NotNull Course course,
@Nullable String moduleDir) throws JDOMException, ModuleWithNameAlreadyExists, ConfigurationException, IOException {
generator.setSelectedCourse(course);
generator.generateProject(project, project.getBaseDir());
updateAdaptiveCourseTaskFileNames(project, course);
course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
LOG.info("failed to generate course");
return;
}
createCourseModuleContent(moduleModel, project, course, moduleDir);
}
示例9: createModule
import org.jdom.JDOMException; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module module = super.createModule(moduleModel);
Course course = myTask.getLesson().getCourse();
String directory = getModuleFileDirectory();
if (directory == null) {
return module;
}
VirtualFile moduleDir = VfsUtil.findFileByIoFile(new File(directory), true);
if (moduleDir == null) {
return module;
}
VirtualFile src = moduleDir.findChild(EduNames.SRC);
if (src == null) {
return module;
}
createTask(module.getProject(), course, src);
ModuleRootModificationUtil.addDependency(module, myUtilModule);
EduIntellijUtils.addJUnit(module);
return module;
}
示例10: createModule
import org.jdom.JDOMException; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel)
throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
if (mySelectedCourse != null) {
String languageName = mySelectedCourse.getLanguageID();
Language language = Language.findLanguageByID(languageName);
if (language != null) {
EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(language);
if (configurator != null) {
myGenerator.setSelectedCourse(mySelectedCourse);
Project project = baseModule.getProject();
myGenerator.generateProject(project, project.getBaseDir());
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
LOG.info("failed to generate course");
return baseModule;
}
configurator.createCourseModuleContent(moduleModel, project, course, getModuleFileDirectory());
}
}
}
return baseModule;
}
示例11: readComponent
import org.jdom.JDOMException; //导入依赖的package包/类
@Nullable
private static Element readComponent(@NotNull SAXBuilder parser, @NotNull String projectPath) {
Element component = null;
try {
String studyProjectXML = projectPath + STUDY_PROJECT_XML_PATH;
Document xmlDoc = parser.build(new File(studyProjectXML));
Element root = xmlDoc.getRootElement();
component = root.getChild("component");
}
catch (JDOMException | IOException ignored) {
}
return component;
}
示例12: doTest
import org.jdom.JDOMException; //导入依赖的package包/类
private void doTest(int version) throws IOException, JDOMException, StudySerializationUtils.StudyUnrecognizedFormatException {
final String name = PlatformTestUtil.getTestName(this.name.getMethodName(), true);
final Path before = getTestDataPath().resolve(name + ".xml");
final Path after = getTestDataPath().resolve(name + ".after.xml");
Element element = JdomKt.loadElement(before);
Element converted = element;
switch (version) {
case 1:
converted = StudySerializationUtils.Xml.convertToSecondVersion(element);
break;
case 3:
converted = StudySerializationUtils.Xml.convertToForthVersion(element);
break;
case 4:
converted = StudySerializationUtils.Xml.convertToFifthVersion(element);
break;
}
assertTrue(JDOMUtil.areElementsEqual(converted, JdomKt.loadElement(after)));
}
示例13: createModule
import org.jdom.JDOMException; //导入依赖的package包/类
@NotNull
@Override
public Module createModule(@NotNull ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {
Module baseModule = super.createModule(moduleModel);
Project project = baseModule.getProject();
EduProjectGenerator generator = new EduProjectGenerator();
if (myCourse == null) {
File courseRoot = StudyUtils.getBundledCourseRoot(DEFAULT_COURSE_NAME, EduKotlinKoansModuleBuilder.class);
final Course course = generator.addLocalCourse(FileUtil.join(courseRoot.getPath(), DEFAULT_COURSE_NAME));
if (course == null) {
LOG.info("Failed to find course " + DEFAULT_COURSE_NAME);
return baseModule;
}
}
myCourse.setLanguage("kotlin");
EduModuleBuilderUtils.createCourseFromCourseInfo(moduleModel, project, generator, myCourse, getModuleFileDirectory());
return baseModule;
}
示例14: findFirstVariable
import org.jdom.JDOMException; //导入依赖的package包/类
private String findFirstVariable(Category category, LASConfig lasConfig, HttpServletRequest request) throws JDOMException, LASException, UnsupportedEncodingException, HttpException, IOException {
String dsid = null;
if ( category.hasVariableChildrenAttribute() ) {
if ( category.getDataset() != null && category.getDataset().getID() != null ) {
return category.getDataset().getID();
}
return category.getChildren_DatasetID();
} else {
ArrayList<Category> cats = getCategories(category.getID(), lasConfig, request, true);
for (Iterator catIt = cats.iterator(); catIt.hasNext();) {
Category cat = (Category) catIt.next();
dsid = findFirstVariable(cat, lasConfig, request);
}
}
return dsid;
}
示例15: makeRegionIndex
import org.jdom.JDOMException; //导入依赖的package包/类
public String makeRegionIndex(String backendRequestXML, String cacheFileName) throws IOException, JDOMException {
LASBackendRequest lasBackendRequest = new LASBackendRequest();
JDOMUtils.XML2JDOM(backendRequestXML, lasBackendRequest);
LASBackendResponse lasBackendResponse = new LASBackendResponse();
String sample = JDOMUtils.getResourcePath(this, "resources/java/xml/region_index.xml");
String output = lasBackendRequest.getResultAsFile("index");
copyBytes(sample, output);
// Create the map scale XML file if requested.
String index_filename = lasBackendRequest.getResultAsFileByType("index");
if ( index_filename != null && !index_filename.equals("") ) {
File index = new File(index_filename);
LASRegionIndex lasRegionIndex = new LASRegionIndex(index);
lasRegionIndex.write(index);
}
lasBackendResponse.addResponseFromRequest(lasBackendRequest);
return lasBackendResponse.toString();
}