本文整理汇总了Java中org.oclc.purl.dsdl.svrl.SchematronOutputType类的典型用法代码示例。如果您正苦于以下问题:Java SchematronOutputType类的具体用法?Java SchematronOutputType怎么用?Java SchematronOutputType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchematronOutputType类属于org.oclc.purl.dsdl.svrl包,在下文中一共展示了SchematronOutputType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onStart
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Override
public void onStart (@Nonnull final PSSchema aSchema,
@Nullable final PSPhase aActivePhase,
@Nullable final String sBaseURI) throws SchematronValidationException
{
final SchematronOutputType aSchematronOutput = new SchematronOutputType ();
if (aActivePhase != null)
aSchematronOutput.setPhase (aActivePhase.getID ());
aSchematronOutput.setSchemaVersion (aSchema.getSchemaVersion ());
aSchematronOutput.setTitle (_getTitleAsString (aSchema.getTitle ()));
// Add namespace prefixes
for (final Map.Entry <String, String> aEntry : aSchema.getAsNamespaceContext ()
.getPrefixToNamespaceURIMap ()
.entrySet ())
{
final NsPrefixInAttributeValues aNsPrefix = new NsPrefixInAttributeValues ();
aNsPrefix.setPrefix (aEntry.getKey ());
aNsPrefix.setUri (aEntry.getValue ());
aSchematronOutput.getNsPrefixInAttributeValues ().add (aNsPrefix);
}
m_aSchematronOutput = aSchematronOutput;
m_aSchema = aSchema;
m_sBaseURI = sBaseURI;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:26,代码来源:PSXPathValidationHandlerSVRL.java
示例2: getAllFailedAssertionsMoreOrEqualSevereThan
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
/**
* Get a list of all failed assertions in a given schematron output, with an
* error level equally or more severe than the passed error level.
*
* @param aSchematronOutput
* The schematron output to be used. May not be <code>null</code>.
* @param aErrorLevel
* Minimum error level to be queried
* @return A non-<code>null</code> list with all failed assertions.
*/
@Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLFailedAssert> getAllFailedAssertionsMoreOrEqualSevereThan (@Nonnull final SchematronOutputType aSchematronOutput,
@Nonnull final IErrorLevel aErrorLevel)
{
final ICommonsList <SVRLFailedAssert> ret = new CommonsArrayList <> ();
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert)
{
final SVRLFailedAssert aFA = new SVRLFailedAssert ((FailedAssert) aObj);
if (aFA.getFlag ().isGE (aErrorLevel))
ret.add (aFA);
}
return ret;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:26,代码来源:SVRLHelper.java
示例3: getAllSuccessfulReportsMoreOrEqualSevereThan
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
/**
* Get a list of all successful reports in a given schematron output, with an
* error level equally or more severe than the passed error level.
*
* @param aSchematronOutput
* The schematron output to be used. May not be <code>null</code>.
* @param aErrorLevel
* Minimum error level to be queried
* @return A non-<code>null</code> list with all successful reports.
*/
@Nonnull
@ReturnsMutableCopy
public static ICommonsList <SVRLSuccessfulReport> getAllSuccessfulReportsMoreOrEqualSevereThan (@Nonnull final SchematronOutputType aSchematronOutput,
@Nonnull final IErrorLevel aErrorLevel)
{
final ICommonsList <SVRLSuccessfulReport> ret = new CommonsArrayList <> ();
for (final Object aObj : aSchematronOutput.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof SuccessfulReport)
{
final SVRLSuccessfulReport aFA = new SVRLSuccessfulReport ((SuccessfulReport) aObj);
if (aFA.getFlag ().isGE (aErrorLevel))
ret.add (aFA);
}
return ret;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:26,代码来源:SVRLHelper.java
示例4: applySchematron
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
/**
* Apply the passed schematron on the passed XML resource using a custom error
* handler.
*
* @param aSchematron
* The Schematron resource. May not be <code>null</code>.
* @param aXML
* The XML resource. May not be <code>null</code>.
* @return <code>null</code> if either the Schematron or the XML could not be
* read.
* @throws IllegalStateException
* if the processing throws an unexpected exception.
*/
@Nullable
public static SchematronOutputType applySchematron (@Nonnull final ISchematronResource aSchematron,
@Nonnull final IReadableResource aXML)
{
ValueEnforcer.notNull (aSchematron, "SchematronResource");
ValueEnforcer.notNull (aXML, "XMLSource");
try
{
// Apply Schematron on XML
return aSchematron.applySchematronValidationToSVRL (aXML);
}
catch (final Exception ex)
{
throw new IllegalArgumentException ("Failed to apply Schematron " +
aSchematron.getID () +
" onto XML resource " +
aXML.getResourceID (),
ex);
}
}
开发者ID:phax,项目名称:ph-schematron,代码行数:35,代码来源:SchematronHelper.java
示例5: validateAndProduceSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
public static void validateAndProduceSVRL (@Nonnull final File aSchematron, final File aXML) throws Exception
{
// Create the custom parameters
final ICommonsMap <String, Object> aCustomParameters = new CommonsHashMap <> ();
aCustomParameters.put ("xyz", "mobile");
aCustomParameters.put ("expected", "");
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile (aSchematron);
// Assign custom parameters
aSCH.setParameters (aCustomParameters);
if (false)
System.out.println (XMLWriter.getNodeAsString (aSCH.getXSLTProvider ().getXSLTDocument ()));
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML));
assertNotNull (aSVRL);
if (false)
System.out.println (new SVRLMarshaller ().getAsString (aSVRL));
}
开发者ID:phax,项目名称:ph-schematron,代码行数:22,代码来源:Issue8Test.java
示例6: validateAndProduceSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@SuppressFBWarnings ("BC_IMPOSSIBLE_INSTANCEOF")
public static void validateAndProduceSVRL (final File schematron, final File xml) throws Exception
{
final IReadableResource aSchematron = new FileSystemResource (schematron.getAbsoluteFile ());
final IReadableResource anXMLSource = new FileSystemResource (xml.getAbsoluteFile ());
final AbstractSchematronResource aSCH = new SchematronResourceSCH (aSchematron);
if (aSCH instanceof SchematronResourcePure)
((SchematronResourcePure) aSCH).setErrorHandler (new LoggingPSErrorHandler ());
else
System.out.println (XMLWriter.getNodeAsString (((SchematronResourceSCH) aSCH).getXSLTProvider ()
.getXSLTDocument ()));
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (anXMLSource);
assertNotNull (aSVRL);
if (false)
System.out.println (new SVRLMarshaller ().getAsString (aSVRL));
}
开发者ID:phax,项目名称:ph-schematron,代码行数:17,代码来源:Issue6Test.java
示例7: validateAndProduceSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
public static void validateAndProduceSVRL (@Nonnull final File aSchematron, final File aXML) throws Exception
{
final PSSchema aSchema = new PSReader (new FileSystemResource (aSchematron)).readSchema ();
final PSPreprocessor aPreprocessor = new PSPreprocessor (PSXPathQueryBinding.getInstance ());
final PSSchema aPreprocessedSchema = aPreprocessor.getAsPreprocessedSchema (aSchema);
final String sSCH = new PSWriter (new PSWriterSettings ().setXMLWriterSettings (new XMLWriterSettings ())).getXMLString (aPreprocessedSchema);
if (false)
System.out.println (sSCH);
final SchematronResourceSCH aSCH = new SchematronResourceSCH (new ReadableResourceString (sSCH,
StandardCharsets.UTF_8));
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML));
assertNotNull (aSVRL);
if (false)
System.out.println (new SVRLMarshaller ().getAsString (aSVRL));
}
开发者ID:phax,项目名称:ph-schematron,代码行数:20,代码来源:Issue48Test.java
示例8: validateXmlUsingSchematron
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nullable
static SchematronOutputType validateXmlUsingSchematron (@Nonnull final IReadableResource aRes)
{
SchematronOutputType ob = null;
// Must use the XSLT based version, because of "key" usage
final ISchematronResource aResSCH = new SchematronResourcePure (new ClassPathResource ("issues/github29/pbs.sch"));
if (!aResSCH.isValidSchematron ())
throw new IllegalArgumentException ("Invalid Schematron!");
try
{
final Document aDoc = aResSCH.applySchematronValidation (new ResourceStreamSource (aRes));
if (aDoc != null)
{
final SVRLMarshaller marshaller = new SVRLMarshaller ();
ob = marshaller.read (aDoc);
}
}
catch (final Exception pE)
{
pE.printStackTrace ();
}
return ob;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:25,代码来源:Issue29Test.java
示例9: testWriteValid
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Test
public void testWriteValid () throws Exception
{
final Document aDoc = SchematronResourceSCH.fromClassPath (VALID_SCHEMATRON)
.applySchematronValidation (new ClassPathResource (VALID_XMLINSTANCE));
assertNotNull (aDoc);
final SchematronOutputType aSO = new SVRLMarshaller ().read (aDoc);
// Create XML
final Document aDoc2 = new SVRLMarshaller ().getAsDocument (aSO);
assertNotNull (aDoc2);
assertEquals (CSVRL.SVRL_NAMESPACE_URI, aDoc2.getDocumentElement ().getNamespaceURI ());
// Create String
final String sDoc2 = new SVRLMarshaller ().getAsString (aSO);
assertTrue (StringHelper.hasText (sDoc2));
assertTrue (sDoc2.contains (CSVRL.SVRL_NAMESPACE_URI));
}
开发者ID:phax,项目名称:ph-schematron,代码行数:19,代码来源:SVRLMarshallerTest.java
示例10: validateXMLSchematron
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
public static boolean validateXMLSchematron (@Nonnull final File schPath,
@Nonnull final EMode eMode,
@Nonnull final File xmlPath,
@Nullable final File svrlPath)
{
final FileSystemResource aXML = new FileSystemResource (xmlPath);
final FileSystemResource aSCH = new FileSystemResource (schPath);
// Use pure implementation or XSLT to do the conversion?
final ISchematronResource aSchematron = eMode == EMode.PURE ? new SchematronResourcePure (aSCH)
: eMode == EMode.XSLT ? new SchematronResourceXSLT (aSCH)
: new SchematronResourceSCH (aSCH);
final SchematronOutputType aSOT = SchematronHelper.applySchematron (aSchematron, aXML);
if (aSOT == null)
{
s_aLogger.info ("Schematron file " + aSchematron + " is malformed!");
return false;
}
// Write SVRL
if (svrlPath != null)
new SVRLMarshaller (false).write (aSOT, new FileSystemResource (svrlPath));
final ICommonsList <SVRLFailedAssert> aFailedAsserts = SVRLHelper.getAllFailedAssertions (aSOT);
if (aFailedAsserts.isNotEmpty ())
{
s_aLogger.info ("XML does not comply to Schematron!" +
(svrlPath != null ? " See SVRL for details: " + svrlPath : ""));
return false;
}
s_aLogger.info ("XML complies to Schematron!");
return true;
}
开发者ID:CenPC434,项目名称:java-tools,代码行数:35,代码来源:XMLValidator.java
示例11: validateResource
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Override
public void validateResource(ValidationContext<IResource> theCtx) {
ISchematronResource sch = getSchematron(theCtx);
StreamSource source = new StreamSource(new StringReader(theCtx.getXmlEncodedResource()));
SchematronOutputType results = SchematronHelper.applySchematron(sch, source);
if (results == null) {
return;
}
IResourceErrorGroup errors = SchematronHelper.convertToResourceErrorGroup(results, theCtx.getFhirContext().getResourceDefinition(theCtx.getResource()).getBaseDefinition().getName());
if (errors.getAllErrors().containsOnlySuccess()) {
return;
}
for (IResourceError next : errors.getAllErrors().getAllResourceErrors()) {
BaseIssue issue = theCtx.getOperationOutcome().addIssue();
switch (next.getErrorLevel()) {
case ERROR:
issue.getSeverityElement().setValue("error");
break;
case FATAL_ERROR:
issue.getSeverityElement().setValue("fatal");
break;
case WARN:
issue.getSeverityElement().setValue("warning");
break;
case INFO:
case SUCCESS:
continue;
}
issue.getDetailsElement().setValue(next.getAsString(Locale.getDefault()));
}
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:39,代码来源:SchematronBaseValidator.java
示例12: validate
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
public void validate(BPMNProcess process, ValidationResult validationResult)
throws ValidationException {
LOGGER.info("Validating {}", process.getBaseURI());
try {
// EXT.002 checks whether there are ID duplicates - as ID
// duplicates in a single file are already detected during XSD
// validation this is only relevant if other processes are imported
if(!process.getChildren().isEmpty()) {
ext002Checker.checkConstraint002(process, validationResult);
}
org.jdom2.Document documentToCheck = preProcessor.preProcess(process);
DOMOutputter domOutputter = new DOMOutputter();
Document w3cDoc = domOutputter
.output(documentToCheck);
DOMSource domSource = new DOMSource(w3cDoc);
for(ISchematronResource schematronFile : schemaToCheck) {
SchematronOutputType schematronOutputType = schematronFile
.applySchematronValidationToSVRL(domSource);
schematronOutputType.getActivePatternAndFiredRuleAndFailedAssert().stream()
.filter(obj -> obj instanceof FailedAssert)
.forEach(obj -> handleSchematronErrors(process, validationResult, (FailedAssert) obj));
}
} catch (Exception e) { // NOPMD
LOGGER.debug("exception during schematron validation. Cause: {}", e);
throw new ValidationException(
"Something went wrong during schematron validation!");
}
LOGGER.info("Validating process successfully done, file is valid: {}",
validationResult.isValid());
}
开发者ID:uniba-dsg,项目名称:BPMNspector,代码行数:36,代码来源:SchematronBPMNValidator.java
示例13: getSchematronValidity
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nonnull
public EValidity getSchematronValidity (@Nonnull final SchematronOutputType aSO)
{
for (final Object aObj : aSO.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert || aObj instanceof SuccessfulReport)
return EValidity.INVALID;
return EValidity.VALID;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:9,代码来源:SchematronXSLTValidatorDefault.java
示例14: getSchematronValidity
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nonnull
public EValidity getSchematronValidity (@Nonnull final SchematronOutputType aSO)
{
for (final Object aObj : aSO.getActivePatternAndFiredRuleAndFailedAssert ())
if (aObj instanceof FailedAssert)
return EValidity.INVALID;
return EValidity.VALID;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:9,代码来源:SchematronXSLTValidatorFailedAssertOnly.java
示例15: getSchematronValidity
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nonnull
public EValidity getSchematronValidity (@Nonnull final Node aXMLNode,
@Nullable final String sBaseURI) throws Exception
{
ValueEnforcer.notNull (aXMLNode, "XMLNode");
// We don't have a short circuit here - apply the full validation
final SchematronOutputType aSO = applySchematronValidationToSVRL (aXMLNode, sBaseURI);
if (aSO == null)
return EValidity.INVALID;
// And now filter all elements that make the passed source invalid
return m_aXSLTValidator.getSchematronValidity (aSO);
}
开发者ID:phax,项目名称:ph-schematron,代码行数:15,代码来源:AbstractSchematronXSLTBasedResource.java
示例16: applySchematronValidationToSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nullable
public SchematronOutputType applySchematronValidationToSVRL (@Nonnull final Node aXMLSource,
@Nullable final String sBaseURI) throws Exception
{
final Document aDoc = applySchematronValidation (aXMLSource, sBaseURI);
if (aDoc == null)
return null;
// Avoid NPE later on
if (aDoc.getDocumentElement () == null)
throw new IllegalStateException ("Internal error: created SVRL DOM Document has no document node!");
return new SVRLMarshaller ().read (aDoc);
}
开发者ID:phax,项目名称:ph-schematron,代码行数:14,代码来源:AbstractSchematronXSLTBasedResource.java
示例17: applySchematronValidationToSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
/**
* The main method to convert a node to an SVRL document.
*
* @param aXMLNode
* The source node to be validated. May not be <code>null</code>.
* @param sBaseURI
* Base URI of the XML document to be validated. May be
* <code>null</code>.
* @return The SVRL document. Never <code>null</code>.
* @throws SchematronException
* in case of a sever error validating the schema
*/
@Nonnull
public SchematronOutputType applySchematronValidationToSVRL (@Nonnull final Node aXMLNode,
@Nullable final String sBaseURI) throws SchematronException
{
ValueEnforcer.notNull (aXMLNode, "XMLNode");
final SchematronOutputType aSOT = getOrCreateBoundSchema ().validateComplete (aXMLNode, sBaseURI);
// Debug print the created SVRL document
if (SchematronDebug.isShowCreatedSVRL ())
s_aLogger.info ("Created SVRL:\n" + new SVRLMarshaller ().getAsString (aSOT));
return aSOT;
}
开发者ID:phax,项目名称:ph-schematron,代码行数:27,代码来源:SchematronResourcePure.java
示例18: applySchematronValidation
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nullable
public Document applySchematronValidation (@Nonnull final Node aXMLNode,
@Nullable final String sBaseURI) throws Exception
{
ValueEnforcer.notNull (aXMLNode, "XMLNode");
final SchematronOutputType aSO = applySchematronValidationToSVRL (aXMLNode, sBaseURI);
return aSO == null ? null : new SVRLMarshaller ().getAsDocument (aSO);
}
开发者ID:phax,项目名称:ph-schematron,代码行数:10,代码来源:SchematronResourcePure.java
示例19: validateComplete
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nonnull
public SchematronOutputType validateComplete (@Nonnull final Node aNode,
@Nullable final String sBaseURI) throws SchematronValidationException
{
final PSXPathValidationHandlerSVRL aValidationHandler = new PSXPathValidationHandlerSVRL (getErrorHandler ());
validate (aNode, sBaseURI, aValidationHandler);
return aValidationHandler.getSVRL ();
}
开发者ID:phax,项目名称:ph-schematron,代码行数:9,代码来源:AbstractPSBoundSchema.java
示例20: applySchematronValidationToSVRL
import org.oclc.purl.dsdl.svrl.SchematronOutputType; //导入依赖的package包/类
@Nullable
public SchematronOutputType applySchematronValidationToSVRL (@Nonnull final IHasInputStream aXMLResource) throws Exception
{
if (!isValidSchematron ())
return null;
final NodeAndBaseURI aXMLNode = getAsNode (aXMLResource);
if (aXMLNode == null)
return null;
return applySchematronValidationToSVRL (aXMLNode.m_aDoc, aXMLNode.m_sBaseURI);
}
开发者ID:phax,项目名称:ph-schematron,代码行数:13,代码来源:AbstractSchematronResource.java
注:本文中的org.oclc.purl.dsdl.svrl.SchematronOutputType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论