Project

Profile

Help

Revision 7e5a6d8a

Added by Michael Kay about 1 year ago

Fix bug #4544

View differences:

latest10/hej/net/sf/saxon/trans/packages/PackageInspector.java
8 8
package net.sf.saxon.trans.packages;
9 9

  
10 10
import net.sf.saxon.Configuration;
11
import net.sf.saxon.Version;
11 12
import net.sf.saxon.event.PipelineConfiguration;
12 13
import net.sf.saxon.event.ProxyReceiver;
13 14
import net.sf.saxon.event.Sender;
14 15
import net.sf.saxon.event.Sink;
16
import net.sf.saxon.lib.NamespaceConstant;
15 17
import net.sf.saxon.lib.ParseOptions;
16 18
import net.sf.saxon.lib.Validation;
19
import net.sf.saxon.om.AttributeInfo;
17 20
import net.sf.saxon.om.AttributeMap;
18 21
import net.sf.saxon.om.NamespaceMap;
19 22
import net.sf.saxon.om.NodeName;
......
34 37

  
35 38
public class PackageInspector extends ProxyReceiver {
36 39

  
40
    private boolean isSefFile;
37 41
    private String packageName;
38 42
    private String packageVersion = "1";
39 43
    private int elementCount = 0;
......
54 58
            // abort the parse when the second start element tag is found
55 59
            throw new XPathException("#start#");
56 60
        }
61
        isSefFile = elemName.hasURI(NamespaceConstant.SAXON_XSLT_EXPORT);
57 62
        if (attributes.get("", "name") != null) {
58 63
            packageName = attributes.get("", "name").getValue();
59 64
        }
......
63 68
        if (attributes.get("", "packageVersion") != null) {
64 69
            packageVersion = attributes.get("", "packageVersion").getValue();
65 70
        }
71
        AttributeInfo saxonVersion = attributes.get("", "saxonVersion");
72
        if (saxonVersion != null) {
73
            if (saxonVersion.getValue().startsWith("9")) {
74
                throw new XPathException("Saxon " + Version.getProductVersion() + " cannot load a SEF file created using version " + saxonVersion.getValue());
75
            }
76
        }
66 77
    }
67 78
    
68 79
    private VersionedPackageName getNameAndVersion() {
......
95 106
        } else {
96 107
            PackageDetails details = new PackageDetails();
97 108
            details.nameAndVersion = vp;
98
            details.sourceLocation = new StreamSource(top);
109
            if (inspector.isSefFile) {
110
                details.exportLocation = new StreamSource(top);
111
            } else {
112
                details.sourceLocation = new StreamSource(top);
113
            }
99 114
            return details;
100 115
        }
101 116
    }

Also available in: Unified diff