当前位置: 首页>>代码示例>>Java>>正文


Java SAXPathException类代码示例

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


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


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