@Test public void shouldParseDocumentTest() { DocumentTest result = parser.parseDocumentTest(tokenize("document-node(element(foo:bar))")); assertThat(result, is(notNullValue())); assertThat(result.getElementTest().getElementName(), is(nameTest("foo", "bar"))); assertThat(result.getElementTest().getTypeName(), is(wildcard())); assertThat(result.getSchemaElementTest(), is(nullValue())); result = parser.parseDocumentTest(tokenize("document-node(schema-element(foo))")); assertThat(result, is(notNullValue())); assertThat(result.getSchemaElementTest().getElementDeclarationName(), is(nameTest("foo"))); assertThat(result.getElementTest(), is(nullValue())); }
protected DocumentTest parseDocumentTest( TokenStream tokens ) { if (tokens.canConsume("document-node", "(")) { ElementTest elementTest = parseElementTest(tokens); DocumentTest result = null; if (elementTest != null) { result = new DocumentTest(elementTest); } else { SchemaElementTest schemaTest = parseSchemaElementTest(tokens); result = schemaTest != null ? new DocumentTest(schemaTest) : null; } tokens.consume(")"); return result; } return null; }
XPathParser { protected DocumentTest parseDocumentTest( TokenStream tokens ) { if (tokens.canConsume("document-node", "(")) { ElementTest elementTest = parseElementTest(tokens); DocumentTest result = null; if (elementTest != null) { result = new DocumentTest(elementTest); } else { SchemaElementTest schemaTest = parseSchemaElementTest(tokens); result = schemaTest != null ? new DocumentTest(schemaTest) : null; } tokens.consume(")"); return result; } return null; } }
XPathParser { protected DocumentTest parseDocumentTest( TokenStream tokens ) { if (tokens.canConsume("document-node", "(")) { ElementTest elementTest = parseElementTest(tokens); DocumentTest result = null; if (elementTest != null) { result = new DocumentTest(elementTest); } else { SchemaElementTest schemaTest = parseSchemaElementTest(tokens); result = schemaTest != null ? new DocumentTest(schemaTest) : null; } tokens.consume(")"); return result; } return null; } XPathParser( TypeSystem context ); }
XPathParser { protected DocumentTest parseDocumentTest( TokenStream tokens ) { if (tokens.canConsume("document-node", "(")) { ElementTest elementTest = parseElementTest(tokens); DocumentTest result = null; if (elementTest != null) { result = new DocumentTest(elementTest); } else { SchemaElementTest schemaTest = parseSchemaElementTest(tokens); result = schemaTest != null ? new DocumentTest(schemaTest) : null; } tokens.consume(")"); return result; } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath ); }
XPathParser { protected DocumentTest parseDocumentTest( TokenStream tokens ) { if (tokens.canConsume("document-node", "(")) { ElementTest elementTest = parseElementTest(tokens); DocumentTest result = null; if (elementTest != null) { result = new DocumentTest(elementTest); } else { SchemaElementTest schemaTest = parseSchemaElementTest(tokens); result = schemaTest != null ? new DocumentTest(schemaTest) : null; } tokens.consume(")"); return result; } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }