当前位置: 首页>>代码示例>>Java>>正文


Java IDOMModel.getDocument方法代码示例

本文整理汇总了Java中org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel.getDocument方法的典型用法代码示例。如果您正苦于以下问题:Java IDOMModel.getDocument方法的具体用法?Java IDOMModel.getDocument怎么用?Java IDOMModel.getDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel的用法示例。


在下文中一共展示了IDOMModel.getDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractNamespace

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
private String extractNamespace(IFile file)
{
	IStructuredModel model = null;
	try
	{
		model = StructuredModelManager.getModelManager().getModelForRead(file);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument domDoc = domModel.getDocument();

		Node node = XpathUtil.xpathNode(domDoc, "//mapper/@namespace");
		return node == null ? null : node.getNodeValue();
	}
	catch (Exception e)
	{
		Activator.log(Status.ERROR, "Error occurred during parsing mapper:" + file.getFullPath(),
			e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:27,代码来源:MapperNamespaceCache.java

示例2: getMapperDocument

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
public static IDOMDocument getMapperDocument(IFile mapperXmlFile)
{
	if (mapperXmlFile == null)
		return null;
	IStructuredModel model = null;
	try
	{
		model = StructuredModelManager.getModelManager().getModelForRead(mapperXmlFile);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument mapperDocument = domModel.getDocument();
		return mapperDocument;
	}
	catch (Exception e)
	{
		Activator.log(Status.ERROR, e.getMessage(), e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:26,代码来源:MybatipseXmlUtil.java

示例3: validateFile

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
protected void validateFile(IValidationContext helper, IReporter reporter,
		IFile file, ValidationResult result) {
	if ((reporter != null) && (reporter.isCancelled() == true)) {
		throw new OperationCanceledException();
	}
	if (!shouldValidate(file)) {
		return;
	}
	IDOMModel model = getModel(file.getProject(), file);
	if (model == null)
		return;

	try {
		Collection dependencies = null;
		NodeImpl document = null;
		if (model.getDocument() instanceof NodeImpl) {
			document = (NodeImpl) model.getDocument();
		}
		validate(reporter, file, model);
	} finally {
		releaseModel(model);
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:24,代码来源:WebResourcesValidator.java

示例4: validateFile

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
private void validateFile(IFile file, IReporter reporter, ValidationResult result)
{
	if ((reporter != null) && (reporter.isCancelled() == true))
	{
		throw new OperationCanceledException();
	}
	IStructuredModel model = null;
	try
	{
		file.deleteMarkers(MARKER_ID, false, IResource.DEPTH_ZERO);
		model = StructuredModelManager.getModelManager().getModelForRead(file);
		IDOMModel domModel = (IDOMModel)model;
		IDOMDocument domDoc = domModel.getDocument();
		NodeList nodes = domDoc.getChildNodes();

		IJavaProject project = JavaCore.create(file.getProject());

		for (int k = 0; k < nodes.getLength(); k++)
		{
			Node child = nodes.item(k);
			if (child instanceof IDOMElement)
			{
				validateElement(project, (IDOMElement)child, file, domDoc, reporter, result);
			}
		}
	}
	catch (Exception e)
	{
		Activator.log(Status.WARNING, "Error occurred during validation.", e);
	}
	finally
	{
		if (model != null)
		{
			model.releaseFromRead();
		}
	}
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:39,代码来源:XmlValidator.java

示例5: reloadEditableWidget

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
public void reloadEditableWidget() {
	if (underLyingModel != null) {
		IDOMModel dom = (IDOMModel) underLyingModel;
		Document document = dom.getDocument();
		editableWidget.reload(document.getDocumentElement());
	}
}
 
开发者ID:eclipse,项目名称:thym,代码行数:8,代码来源:WidgetModel.java

示例6: validate

import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; //导入方法依赖的package包/类
private void validate(IReporter reporter, IFile file, IDOMModel model) {
	if (file == null || model == null)
		return; // error
	IDOMDocument document = model.getDocument();
	if (document == null)
		return; // error

	IStructuredDocumentRegion[] regions = model.getStructuredDocument()
			.getStructuredDocumentRegions();
	validateRegions(reporter, model, file, regions);
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:12,代码来源:WebResourcesValidator.java


注:本文中的org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel.getDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。