本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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();
}
}
}
示例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());
}
}
示例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);
}