use of com.enonic.xp.xml.XmlException in project xp by enonic.
the class AbstractGetAdminToolDescriptorCommand method parseXml.
protected void parseXml(final Resource resource, final AdminToolDescriptor.Builder builder) {
try {
final XmlAdminToolDescriptorParser parser = new XmlAdminToolDescriptorParser();
parser.builder(builder);
parser.source(resource.readString());
parser.parse();
} catch (final Exception e) {
throw new XmlException(e, "Could not load admin app descriptor [" + resource.getUrl() + "]: " + e.getMessage());
}
}
use of com.enonic.xp.xml.XmlException in project xp by enonic.
the class LayoutDescriptorLoader method parseXml.
private void parseXml(final Resource resource, final LayoutDescriptor.Builder builder) {
try {
final XmlLayoutDescriptorParser parser = new XmlLayoutDescriptorParser();
parser.builder(builder);
parser.currentApplication(resource.getKey().getApplicationKey());
parser.source(resource.readString());
parser.parse();
} catch (final Exception e) {
throw new XmlException(e, "Could not load layout descriptor [" + resource.getUrl() + "]: " + e.getMessage());
}
}
use of com.enonic.xp.xml.XmlException in project xp by enonic.
the class PartDescriptorLoader method parseXml.
private void parseXml(final Resource resource, final PartDescriptor.Builder builder) {
try {
final XmlPartDescriptorParser parser = new XmlPartDescriptorParser();
parser.builder(builder);
parser.currentApplication(resource.getKey().getApplicationKey());
parser.source(resource.readString());
parser.parse();
} catch (final Exception e) {
throw new XmlException(e, "Could not load part descriptor [" + resource.getUrl() + "]: " + e.getMessage());
}
}
use of com.enonic.xp.xml.XmlException in project xp by enonic.
the class NodeImporter method processNodeSource.
private Node processNodeSource(final VirtualFile nodeFolder, final ProcessNodeSettings.Builder processNodeSettings) {
final VirtualFile nodeSource = this.exportReader.getNodeSource(nodeFolder);
final CharSource nodeCharSource;
try {
nodeCharSource = transformer == null ? nodeSource.getCharSource() : CharSource.wrap(this.transformer.transform(nodeSource.getCharSource()));
} catch (Exception e) {
throw new ImportNodeException("Error during XSLT pre-processing for node in '" + nodeSource.getUrl() + "'", e);
}
final Node.Builder newNodeBuilder = Node.create();
try {
final XmlNodeParser parser = new XmlNodeParser();
parser.builder(newNodeBuilder);
parser.source(nodeCharSource);
parser.parse();
} catch (final Exception e) {
throw new XmlException(e, "Could not load source node [" + nodeSource.getUrl() + "]: ", e);
}
final Node newNode = newNodeBuilder.build();
final NodePath importNodePath = NodeImportPathResolver.resolveNodeImportPath(nodeFolder, this.exportRoot, this.importRoot);
final ImportNodeResult importNodeResult = importNode(nodeFolder, processNodeSettings, newNode, importNodePath);
if (nodeImportListener != null) {
nodeImportListener.nodeImported(1L);
}
if (importNodeResult.isPreExisting()) {
result.updated(importNodeResult.getNode().path());
} else {
result.added(importNodeResult.getNode().path());
}
return importNodeResult.getNode();
}
use of com.enonic.xp.xml.XmlException in project xp by enonic.
the class MacroDescriptorServiceImpl method parseXml.
private void parseXml(final Resource resource, final MacroDescriptor.Builder builder) {
try {
final XmlMacroDescriptorParser parser = new XmlMacroDescriptorParser();
parser.builder(builder);
parser.currentApplication(resource.getKey().getApplicationKey());
parser.source(resource.readString());
parser.parse();
} catch (final Exception e) {
throw new XmlException(e, "Could not load macro descriptor [" + resource.getUrl() + "]: " + e.getMessage());
}
}
Aggregations