Пример #1
0
        public static XPathPathExpr getPathExpr(String nodeset)
        {
            XPathExpression path;
            Boolean         validNonPathExpr = false;

            try
            {
                path = XPathParseTool.parseXPath(nodeset);
                if (!(path is XPathPathExpr))
                {
                    validNonPathExpr = true;
                    throw new XPathSyntaxException();
                }
            }
            catch (XPathSyntaxException xse)
            {
                //make these checked exceptions?
                if (validNonPathExpr)
                {
                    throw new SystemException("Expected XPath path, got XPath expression: [" + nodeset + "]");
                }
                else
                {
                    throw new SystemException("Parse error in XPath path: [" + nodeset + "]");
                }
            }

            return((XPathPathExpr)path);
        }
Пример #2
0
 private void attemptConstraintCompile()
 {
     xPathConstraintMsg = null;
     try
     {
         if (constraintMsg != null)
         {
             xPathConstraintMsg = XPathParseTool.parseXPath("string(" + constraintMsg + ")");
         }
     }
     catch (Exception e)
     {
         //Expected in probably most cases.
     }
 }