Exemple #1
0
        public static XPathPathExpr getPathExpr(System.String nodeset)
        {
            XPathExpression path;
            bool            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)
                {
                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                    throw new XPathTypeMismatchException("Expected XPath path, got XPath expression: [" + nodeset + "]," + xse.Message);
                }
                else
                {
                    SupportClass.WriteStackTrace(xse, Console.Error);
                    //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                    throw new XPathException("Parse error in XPath path: [" + nodeset + "]." + (xse.Message == null?"":"\n" + xse.Message));
                }
            }

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