bool ToXpath1(string xpath2, out string xpath1) { var builder = new XPath2Rewriter(); xpath1 = new XPathParser<string>().Parse(xpath2, builder); return builder.RewriteRequired; }
public void Unions() { var xpath2 = "exists(@a | @b)"; var builder = new XPath2Rewriter(); var xpath1 = new XPathParser<string>().Parse(xpath2, builder); Console.WriteLine(xpath2); Console.WriteLine(xpath1); Assert.IsFalse(builder.RewriteRequired); }
public void NumericCompare() { var xpath2 = "foo[count(@a) > 0]"; var builder = new XPath2Rewriter(); var xpath1 = new XPathParser<string>().Parse(xpath2, builder); Console.WriteLine(xpath2); Console.WriteLine(xpath1); Assert.IsFalse(builder.RewriteRequired); }
public void ParsingErrors() { var big = "not(starts-with(f:reference/@value, '#')) or exists(ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]|/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')])"; var p1 = "not(starts-with(f:reference/@value, '#'))"; var p2 = "ancestor::a:content/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]"; var p3 = "/f:*/f:contained/f:*[@id=substring-after(current()/f:reference/@value, '#')]"; var p4 = "/f:*[@id='#']"; var p5 = "/f:foo[@id='#']"; var xpath2 = p4; var builder = new XPath2Rewriter(); var xpath1 = new XPathParser<string>().Parse(xpath2, builder); Console.WriteLine(xpath2); Console.WriteLine(xpath1); }