本文整理汇总了Java中com.evolveum.midpoint.util.DOMUtil.parse方法的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil.parse方法的具体用法?Java DOMUtil.parse怎么用?Java DOMUtil.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evolveum.midpoint.util.DOMUtil
的用法示例。
在下文中一共展示了DOMUtil.parse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@NotNull
@Override
public RootXNode read(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) throws SchemaException, IOException {
if (source instanceof ParserElementSource) {
return read(((ParserElementSource) source).getElement());
}
InputStream is = source.getInputStream();
try {
Document document = DOMUtil.parse(is);
return read(document);
} finally {
if (source.closeStreamAfterParsing()) {
IOUtils.closeQuietly(is);
}
}
}
示例2: readObjects
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@NotNull
@Override
public List<RootXNode> readObjects(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) throws SchemaException, IOException {
InputStream is = source.getInputStream();
try {
Document document = DOMUtil.parse(is);
return readObjects(document);
} finally {
if (source.closeStreamAfterParsing()) {
IOUtils.closeQuietly(is);
}
}
}
示例3: parseWsdlResource
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static List<SchemaDescription> parseWsdlResource(final String resourcePath) throws SchemaException {
List<SchemaDescription> schemaDescriptions = new ArrayList<>();
InputStream inputStream = SchemaRegistry.class.getClassLoader().getResourceAsStream(resourcePath);
if (inputStream == null) {
throw new IllegalStateException("Cannot fetch system resource for schema " + resourcePath);
}
Node node;
try {
node = DOMUtil.parse(inputStream);
} catch (IOException e) {
throw new SchemaException("Cannot parse schema from system resource " + resourcePath, e);
}
Element rootElement = node instanceof Element ? (Element)node : DOMUtil.getFirstChildElement(node);
QName rootElementQName = DOMUtil.getQName(rootElement);
if (WSDLConstants.QNAME_DEFINITIONS.equals(rootElementQName)) {
Element types = DOMUtil.getChildElement(rootElement, WSDLConstants.QNAME_TYPES);
if (types == null) {
LOGGER.warn("No <types> section in WSDL document in system resource " + resourcePath);
return schemaDescriptions;
}
List<Element> schemaElements = DOMUtil.getChildElements(types, DOMUtil.XSD_SCHEMA_ELEMENT);
if (schemaElements.isEmpty()) {
LOGGER.warn("No schemas in <types> section in WSDL document in system resource " + resourcePath);
return schemaDescriptions;
}
int number = 1;
for (Element schemaElement : schemaElements) {
SchemaDescription desc = new SchemaDescription("schema #" + (number++) + " in system resource " + resourcePath);
desc.node = schemaElement;
desc.fetchBasicInfoFromSchema();
schemaDescriptions.add(desc);
LOGGER.trace("Schema registered from {}", desc.getSourceDescription());
}
return schemaDescriptions;
} else {
throw new SchemaException("WSDL system resource "+resourcePath+" does not start with wsdl:definitions element");
}
}
示例4: parseFromInputStream
import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private void parseFromInputStream() throws SchemaException {
InputStream inputStream = streamable.openInputStream();
try {
node = DOMUtil.parse(inputStream);
} catch (IOException e) {
throw new SchemaException("Cannot parse schema from " + sourceDescription, e);
}
fetchBasicInfoFromSchema();
}