本文整理汇总了Java中net.sf.saxon.lib.NamespaceConstant类的典型用法代码示例。如果您正苦于以下问题:Java NamespaceConstant类的具体用法?Java NamespaceConstant怎么用?Java NamespaceConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamespaceConstant类属于net.sf.saxon.lib包,在下文中一共展示了NamespaceConstant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNamespaceURI
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
public String getNamespaceURI(String prefix){
switch (prefix) {
case SaxonEnvironment.FOX_NS_PREFIX:
return SaxonEnvironment.FOX_NS_URI;
case Mod.FOX_MODULE_NS_PREFIX:
return Mod.FOX_MODULE_URI;
case SaxonEnvironment.XML_SCHEMA_NS_PREFIX:
return NamespaceConstant.SCHEMA;
case FO_PREFIX:
return FO_URI;
case MATH_PREFIX:
return MATH_URI;
case FN_PREFIX:
return FN_URI;
default:
return "";
}
}
示例2: isContained
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private boolean isContained(TestAssertion assertion, String fileLocation)
throws XPathExpressionException,
XPathFactoryConfigurationException, XPathException {
XPathFactory xpathFactory = XPathFactory
.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
XPathEvaluator xpath = (XPathEvaluator) xpathFactory.newXPath();
xpath.getConfiguration().setLineNumbering(true);
xpath.setNamespaceContext(new BpelNamespaceContext());
XPathExpression expr = xpath.compile(assertion.getTarget());
InputSource inputSource = new InputSource(
new File(fileLocation).toString());
SAXSource saxSource = new SAXSource(inputSource);
NodeInfo doc = xpath.getConfiguration().buildDocument(saxSource);
@SuppressWarnings("unchecked")
List<NodeInfo> matchedLines = (List<NodeInfo>) expr.evaluate(doc,
XPathConstants.NODESET);
if (matchedLines.size() > 0) {
return true;
}
return false;
}
示例3: getPrefix
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
public String getPrefix(String namespace){
if(Mod.FOX_MODULE_URI.equals(namespace)) {
return Mod.FOX_MODULE_NS_PREFIX;
}
else if (NamespaceConstant.SCHEMA.equals(namespace)){
return SaxonEnvironment.XML_SCHEMA_NS_PREFIX;
}
else if (FO_URI.equals(namespace)){
return FO_PREFIX;
}
else {
return SaxonEnvironment.FOX_NS_PREFIX;
}
}
示例4: createXPathEvaluator
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private void createXPathEvaluator()
throws XPathFactoryConfigurationException {
XPathFactory xpathFactory = XPathFactory
.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
xpath = (XPathEvaluator) xpathFactory.newXPath();
xpath.getConfiguration().setLineNumbering(true);
xpath.setNamespaceContext(new BpmnNamespaceContext());
}
示例5: AdaptabilityAnalyzer
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
public AdaptabilityAnalyzer() {
System.setProperty("javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON,
"net.sf.saxon.xpath.XPathFactoryImpl");
nodeCounter = new XPathNodeCounter();
inspector = new BpmnInspector();
testMetrics = new ArrayList<>(5);
testMetrics.add(new BinaryAdaptabilityMetric(0.2));
testMetrics.add(new BinaryAdaptabilityMetric(0.4));
testMetrics.add(new BinaryAdaptabilityMetric(0.6));
testMetrics.add(new BinaryAdaptabilityMetric(0.8));
testMetrics.add(new WeightedAdaptabilityMetric());
}
示例6: beforeClass
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
System.setProperty("javax.xml.xpath.XPathFactory:"
+ NamespaceConstant.OBJECT_MODEL_SAXON,
"net.sf.saxon.xpath.XPathFactoryImpl");
elements = new AdaptableElements().getElementsByName();
}
示例7: isContained
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private boolean isContained(AdaptableElement element, String fileLocation) {
try {
XPathFactory xpathFactory = XPathFactory
.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
XPathEvaluator xpath = (XPathEvaluator) xpathFactory.newXPath();
xpath.getConfiguration().setLineNumbering(true);
xpath.setNamespaceContext(new BpmnNamespaceContext());
XPathExpression expr = xpath
.compile(element.getLocatorExpression());
InputSource inputSource = new InputSource(
new File(fileLocation).toString());
SAXSource saxSource = new SAXSource(inputSource);
NodeInfo doc = xpath.getConfiguration().buildDocument(saxSource);;
@SuppressWarnings("unchecked")
List<NodeInfo> matchedLines = (List<NodeInfo>) expr.evaluate(doc,
XPathConstants.NODESET);
if (matchedLines.size() > 0) {
return true;
}
return false;
} catch (XPathFactoryConfigurationException | XPathExpressionException
| XPathException e) {
e.printStackTrace();
return false;
}
}
示例8: setPrefixNamespaceMappings
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
/**
* Set the namespaces in the XPathCompiler.
*
* @param xpathCompiler
* @param namespaceMappings Namespace prefix to Namespace uri mappings
*/
private void setPrefixNamespaceMappings(XPathCompiler xpathCompiler, HashMap<String,String> namespaceMappings) {
if (namespaceMappings != null) {
// Get the mappings
Set<Entry<String, String>> mappings = namespaceMappings.entrySet();
// If mappings exist, set the namespaces
if (mappings != null) {
Iterator<Entry<String, String>> it = mappings.iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
xpathCompiler.declareNamespace(entry.getKey(), entry.getValue());
}
}
}
// Add in the defaults
xpathCompiler.declareNamespace("xml",NamespaceConstant.XML);
xpathCompiler.declareNamespace("xs",NamespaceConstant.SCHEMA);
xpathCompiler.declareNamespace("fn",NamespaceConstant.FN);
}
示例9: setPrefixNamespaceMappings
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
/**
* Set the namespaces in the XQueryCompiler.
*
* @param xqueryCompiler
* @param namespaceMappings Namespace prefix to Namespace uri mappings
*/
private void setPrefixNamespaceMappings(XQueryCompiler xqueryCompiler, HashMap<String,String> namespaceMappings) {
if (namespaceMappings != null) {
// Get the mappings
Set<Entry<String, String>> mappings = namespaceMappings.entrySet();
// If mappings exist, set the namespaces
if (mappings != null) {
Iterator<Entry<String, String>> it = mappings.iterator();
while (it.hasNext()) {
Entry<String, String> entry = it.next();
xqueryCompiler.declareNamespace(entry.getKey(),entry.getValue());
}
}
}
// Add in the defaults
xqueryCompiler.declareNamespace("xml",NamespaceConstant.XML);
xqueryCompiler.declareNamespace("xs",NamespaceConstant.SCHEMA);
xqueryCompiler.declareNamespace("fn",NamespaceConstant.FN);
}
示例10: createXPathEvaluator
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private void createXPathEvaluator()
throws XPathFactoryConfigurationException {
XPathFactory xpathFactory = XPathFactory
.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
xpath = (XPathEvaluator) xpathFactory.newXPath();
xpath.getConfiguration().setLineNumbering(true);
xpath.setNamespaceContext(new BpelNamespaceContext());
}
示例11: isContained
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private boolean isContained(AdaptableElement element, String fileLocation) {
try {
XPathFactory xpathFactory = XPathFactory
.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
XPathEvaluator xpath = (XPathEvaluator) xpathFactory.newXPath();
xpath.getConfiguration().setLineNumbering(true);
xpath.setNamespaceContext(new BpmnNamespaceContext());
XPathExpression expr = xpath
.compile(element.getLocatorExpression());
InputSource inputSource = new InputSource(
new File(fileLocation).toString());
SAXSource saxSource = new SAXSource(inputSource);
NodeInfo doc = xpath.setSource(saxSource);
@SuppressWarnings("unchecked")
List<NodeInfo> matchedLines = (List<NodeInfo>) expr.evaluate(doc,
XPathConstants.NODESET);
if (matchedLines.size() > 0) {
return true;
}
return false;
} catch (XPathFactoryConfigurationException | XPathExpressionException
| XPathException e) {
e.printStackTrace();
return false;
}
}
示例12: initXpathFactory
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private static XPathFactory initXpathFactory() {
try {
sysinit();
return XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
} catch (Exception e) {
return die("initXpathFactory: "+e, e);
}
}
示例13: sysinit
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
private static void sysinit () {
synchronized (initialized) {
if (!initialized.get()) {
final String name = "javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON;
System.setProperty(name, "net.sf.saxon.xpath.XPathFactoryImpl");
initialized.set(true);
}
}
}
示例14: FileAnalyzer
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
public FileAnalyzer(String filePath, boolean isStrict) {
System.setProperty("javax.xml.xpath.XPathFactory:" + NamespaceConstant.OBJECT_MODEL_SAXON,
"net.sf.saxon.xpath.XPathFactoryImpl");
this.isStrict = isStrict;
createRawResult(filePath);
try {
createXPathEvaluator();
createSourceDocument(filePath);
} catch (XPathFactoryConfigurationException | XPathException e) {
throw new AnalysisException(e);
}
}
示例15: beforeClass
import net.sf.saxon.lib.NamespaceConstant; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
System.setProperty("javax.xml.xpath.XPathFactory:"
+ NamespaceConstant.OBJECT_MODEL_SAXON,
"net.sf.saxon.xpath.XPathFactoryImpl");
}