• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SAXPathException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jaxen.saxpath.SAXPathException的典型用法代码示例。如果您正苦于以下问题:Java SAXPathException类的具体用法?Java SAXPathException怎么用?Java SAXPathException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SAXPathException类属于org.jaxen.saxpath包,在下文中一共展示了SAXPathException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addXPath

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private void addXPath(Expression compiledExpr) throws SAXPathException{
    expressions.add(compiledExpr);

    switch(compiledExpr.scope()){
        case Scope.DOCUMENT:
            searchDocExpressions(compiledExpr, compiledExpr);
            break;
        case Scope.GLOBAL:
            assert compiledExpr instanceof Literal;
            globalExpressions.add(compiledExpr);
            break;
        default:
            throw new ImpossibleException("scope of "+compiledExpr.getXPath()+" can't be"+compiledExpr.scope());
    }
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:17,代码来源:XMLDog.java


示例2: startNameStep

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
@Override
public void startNameStep(int axis, String prefix, String localName) throws SAXPathException{
    Constraint constraint;

    boolean star = localName.equals("*");
    if(star && prefix.length()==0)
        constraint = Star.INSTANCE;
    else{
        String uri = !allowDefaultPrefixMapping && prefix.length()==0 ? "" : nsContext.getNamespaceURI(prefix);
        if(uri==null)
            throw new SAXPathException("undeclared prefix: " + prefix);
        if(star)
            constraint = namespaceURIStub.get(uri);
        else{
            if("*".equals(uri))
                constraint = localNameStub.get(localName);
            else
                constraint = qnameStub.get(uri, localName);
        }
    }
    startStep(axis, constraint);
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:23,代码来源:XPathParser.java


示例3: endFunction

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
@Override
public void endFunction() throws SAXPathException{
    ArrayDeque params = popFrame();
    javax.xml.namespace.QName name = (javax.xml.namespace.QName)params.pollFirst();
    if(name.getNamespaceURI().length()==0)
        push(createFunction(name.getLocalPart(), params).simplify());
    else{
        int noOfParams = params.size();
        XPathFunction function = functionResolver.resolveFunction(name, noOfParams);
        if(function==null)
            throw new SAXPathException("Unknown Function: "+name);
        FunctionCall functionCall = new FunctionCall(new Functions.UserFunction(name.getNamespaceURI(), name.getLocalPart(), function), noOfParams);
        for(int i=0; i<noOfParams; i++)
            functionCall.addMember(params.pollFirst(), i);
        push(functionCall);
    }
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:18,代码来源:XPathParser.java


示例4: createReader

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
/** Create an <code>XPathReader</code> using the value of
 *  the <code>org.saxpath.driver</code> system property.
 *
 *  @return an instance of the <code>XPathReader</code> specified
 *          by the <code>org.saxpath.driver</code> property
 *
 *  @throws SAXPathException if the property is  not set, or if
 *          the class can not be instantiated for some reason,
 *          or if the class doesn't implement the <code>XPathReader</code>
 *          interface
 */
public static XPathReader createReader() throws SAXPathException
{
    String className = null;

    try
    {
        className = System.getProperty( DRIVER_PROPERTY );
    }
    catch (SecurityException e)
    {
        // we'll use the default
    }

    if ( className == null
         ||
         className.length() == 0 )
    {
        className = DEFAULT_DRIVER;
    }

    return createReader( className );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:34,代码来源:XPathReaderFactory.java


示例5: parse

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
public void parse(String xpath) throws SAXPathException
{
    setUpParse( xpath );

    getXPathHandler().startXPath();

    expr();

    getXPathHandler().endXPath();

    if ( LA(1) != TokenTypes.EOF )
    {
        XPathSyntaxException ex = createSyntaxException( "Unexpected '" + LT(1).getTokenText() + "'" );
        throw ex;
    }

    lexer  = null;
    tokens = null;
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:20,代码来源:XPathReader.java


示例6: variableReference

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void variableReference() throws SAXPathException
{
    match( TokenTypes.DOLLAR );

    String prefix       = null;
    String variableName = null;

    if ( LA(2) == TokenTypes.COLON )
    {
        prefix = match( TokenTypes.IDENTIFIER ).getTokenText();
        match( TokenTypes.COLON );
    }
    else
    {
        prefix = "";
    }

    variableName = match( TokenTypes.IDENTIFIER ).getTokenText();

    getXPathHandler().variableReference( prefix,
                                         variableName );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:23,代码来源:XPathReader.java


示例7: relativeLocationPath

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void relativeLocationPath() throws SAXPathException
{
    getXPathHandler().startRelativeLocationPath();

    switch ( LA(1) )
    {
        case TokenTypes.SLASH:
        {
            match( TokenTypes.SLASH );
            break;
        }
        case TokenTypes.DOUBLE_SLASH:
        {
            getXPathHandler().startAllNodeStep( Axis.DESCENDANT_OR_SELF );
            getXPathHandler().endAllNodeStep();

            match( TokenTypes.DOUBLE_SLASH );

            break;
        }
    }

    steps();

    getXPathHandler().endRelativeLocationPath();
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:27,代码来源:XPathReader.java


示例8: abbrStep

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void abbrStep() throws SAXPathException
{
    switch ( LA(1) )
    {
        case TokenTypes.DOT:
        {
            match( TokenTypes.DOT );
            getXPathHandler().startAllNodeStep( Axis.SELF );
            predicates();
            getXPathHandler().endAllNodeStep();
            break;
        }
        case TokenTypes.DOT_DOT:
        {
            match( TokenTypes.DOT_DOT );
            getXPathHandler().startAllNodeStep( Axis.PARENT );
            predicates();
            getXPathHandler().endAllNodeStep();
            break;
        }
    }
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:23,代码来源:XPathReader.java


示例9: orExpr

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void orExpr() throws SAXPathException
{
    getXPathHandler().startOrExpr();
    
    andExpr();

    boolean create = false;

    switch ( LA(1) )
    {
        case TokenTypes.OR:
        {
            create = true;
            match( TokenTypes.OR );
            orExpr();
            break;
        }
    }

    getXPathHandler().endOrExpr( create );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:22,代码来源:XPathReader.java


示例10: andExpr

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void andExpr() throws SAXPathException
{
    getXPathHandler().startAndExpr();

    equalityExpr();

    boolean create = false;

    switch ( LA(1) )
    {
        case TokenTypes.AND:
        {
            create = true;
            match( TokenTypes.AND );
            andExpr();
            break;
        }
    }

    getXPathHandler().endAndExpr( create );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:22,代码来源:XPathReader.java


示例11: unaryExpr

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void unaryExpr() throws SAXPathException
{
    switch ( LA(1) )
    {
        case TokenTypes.MINUS:
        {
            getXPathHandler().startUnaryExpr();
            match( TokenTypes.MINUS );
            unaryExpr();
            getXPathHandler().endUnaryExpr( Operator.NEGATIVE );
            break;
        }
        default:
        {
            unionExpr();
            break;
        }
    }

    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:22,代码来源:XPathReader.java


示例12: unionExpr

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
private void unionExpr() throws SAXPathException
{
    getXPathHandler().startUnionExpr();

    pathExpr();

    boolean create = false;

    switch ( LA(1) )
    {
        case TokenTypes.PIPE:
        {
            match( TokenTypes.PIPE );
            create = true;
            expr();
            break;
        }
    }

    getXPathHandler().endUnionExpr( create );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:22,代码来源:XPathReader.java


示例13: testPriority

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
protected void testPriority(String expr, double priority, short nodeType) 
 throws JaxenException, SAXPathException  
{
    
    Pattern pattern = PatternParser.parse( expr );
    double d = pattern.getPriority();
    short nt = pattern.getMatchType();
    
    assertEquals( "expr: " + expr,
                  new Double( priority ),
                  new Double( d ) );

    assertEquals( "nodeType: " + expr,
                  nodeType, 
                  nt );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:17,代码来源:PriorityTest.java


示例14: testBogusPaths

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
public void testBogusPaths() throws SAXPathException
{

    for( int i = 0; i < bogusPaths.length; ++i )
    {
        final String[] bogusPath = bogusPaths[i];

        try
        {
            reader.parse( bogusPath[0] );
            fail( "Should have thrown XPathSyntaxException for " + bogusPath[0]);
        }
        catch( XPathSyntaxException e )
        {
            assertEquals( bogusPath[1], e.getMessage() );
        }
    }
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:19,代码来源:XPathReaderTest.java


示例15: getPathQuery

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
static Query getPathQuery(String path) throws SAXPathException
{
    ApplicationContext ac = ApplicationContextHelper.getApplicationContext();
    XPathReader reader = new XPathReader();
    LuceneXPathHandler handler = new LuceneXPathHandler();
    handler.setNamespacePrefixResolver((NamespaceService) ac.getBean("namespaceService"));
    handler.setDictionaryService((DictionaryService) ac.getBean("dictionaryService"));
    reader.setXPathHandler(handler);
    reader.parse(path);
    PathQuery pathQuery = handler.getQuery();
    pathQuery.setRepeats(false);
    return pathQuery;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:IndexInfo.java


示例16: main

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
/**
 * @param args String[]
 * @throws SAXPathException
 */
public static void main(String[] args) throws SAXPathException
{
    XPathReader reader = new XPathReader();
    reader.setXPathHandler(new DebugXPathHandler());
    reader
            .parse("/ns:one[@woof='dog']/two/./../two[functionTest(@a, @b, $woof:woof)]/three/*/four//*/five/six[@exists1 and @exists2]");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:DebugXPathHandler.java


示例17: CachedVariableContext

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
public CachedVariableContext(Collection<Variable> variables, XPath xpath, XmlElement contextNode) throws SAXPathException {
    for (Variable variable : variables) {
        if (variable.getName().length() == 0) {
            continue;
        } 
        final String expression = variable.getExpression();
        // empty expression evaluates to empty nodeset
        final XPath xPath = xpath.getNavigator().parseXPath(expression.length() == 0 ? "/.." : expression);
        myMap.put(variable.getName(), xPath.evaluate(contextNode));
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CachedVariableContext.java


示例18: addForEach

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
public Expression addForEach(String forEach, String xpath) throws SAXPathException{
    Expression forEachExpr = parser.parse(forEach, true);
    LocationPath union = new LocationPath(Scope.LOCAL, 0);
    if(forEachExpr instanceof LocationExpression)
        union.addToContext(((LocationExpression)forEachExpr).locationPath);
    else
        union.addToContext(((PathExpression)forEachExpr).union);

    Expression relativeExpr = parser.parse(xpath, false);
    PathExpression compiledExpr = new PathExpression(union, relativeExpr, true);
    compiledExpr.setXPath("#for-each "+forEach+" #eval "+xpath);
    addXPath(compiledExpr);
    return compiledExpr;
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:15,代码来源:XMLDog.java


示例19: parse

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
public Expression parse(String xpath, boolean documentContext) throws SAXPathException{
    this.documentContext = documentContext; 
    frames.clear();
    peekFrame = null;
    stepStack.clear();
    predicateDepth = 0;
    expr = null;

    reader.parse(xpath);
    return expr;
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:12,代码来源:XPathParser.java


示例20: startFunction

import org.jaxen.saxpath.SAXPathException; //导入依赖的package包/类
@Override
public void startFunction(String prefix, String name) throws SAXPathException{
    String uri = prefix.length()==0 ? "": nsContext.getNamespaceURI(prefix);
    if(uri==null)
        throw new SAXPathException("undeclared prefix: " + prefix);

    if(uri.length()>0 && functionResolver==null)
        throw new SAXPathException("FunctionResolver is required");
    
    pushFrame();
    push(new javax.xml.namespace.QName(uri, name));
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:13,代码来源:XPathParser.java



注:本文中的org.jaxen.saxpath.SAXPathException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Server类代码示例发布时间:2022-05-22
下一篇:
Java SoftValueSortedMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap