Skip to content

Commit

Permalink
getSchemaType() does not return null on 9.7.
Browse files Browse the repository at this point in the history
getSchemaType() does not return null on Saxon 9.7, when the node has not
been validated.  But it returns the type for xs:untyped.  So use its
name if present, to see if it is xs:untyped.  This change is compatible
with 9.7, but remains compatible with earlier releases as well.
  • Loading branch information
fgeorges committed Nov 6, 2016
1 parent c7c646a commit d8c9dbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/xmlcalabash/library/ValidateWithSCH.java
Expand Up @@ -27,6 +27,8 @@
import java.util.Vector;
import java.util.Hashtable;
import java.util.Iterator;
import net.sf.saxon.om.StructuredQName;
import net.sf.saxon.type.SchemaType;

/**
* Created by IntelliJ IDEA.
Expand All @@ -41,6 +43,7 @@
type = "{http://www.w3.org/ns/xproc}validate-with-schematron")

public class ValidateWithSCH extends DefaultStep {
private static final StructuredQName _untyped = StructuredQName.fromClarkName("{http://www.w3.org/2001/XMLSchema}untyped");
private static final QName _assert_valid = new QName("", "assert-valid");
private static final QName _phase = new QName("", "phase");
private InputStream skeleton = null;
Expand Down Expand Up @@ -90,7 +93,8 @@ public void run() throws SaxonApiException {
XdmNode sourceXML = source.read();

// If we're dealing with a typed document, we must compile the XSLT in schema-aware mode
schemaAware = (sourceXML.getUnderlyingNode().getSchemaType() != null);
SchemaType type = sourceXML.getUnderlyingNode().getSchemaType();
schemaAware = ! ( type == null || type.getStructuredQName().equals(_untyped) );

XdmNode schemaXML = schema.read();

Expand Down

0 comments on commit d8c9dbc

Please sign in to comment.