CndImporter { protected void parse( String content ) { Tokenizer tokenizer = new CndTokenizer(false, true); TokenStream tokens = new TokenStream(content, tokenizer, false); tokens.start(); while (tokens.hasNext()) { if (tokens.matches("<", ANY_VALUE, "=", ANY_VALUE, ">")) { parseNamespaceMapping(tokens); } else if (tokens.matches("[", ANY_VALUE, "]")) { parseNodeTypeDefinition(tokens); } else { Position position = tokens.previousPosition(); throw new ParsingException(position, CndI18n.expectedNamespaceOrNodeDefinition.text(tokens.consume(), position.getLine(), position.getColumn())); } } } CndImporter( ExecutionContext context ); void importFrom( InputStream stream,
                            Problems problems,
                            String resourceName ); void importFrom( File file,
                            Problems problems ); void importFrom( String content,
                            Problems problems,
                            String resourceName ); void importBuiltIns( Problems problems ); Set<NamespaceRegistry.Namespace> getNamespaces(); List<NodeTypeDefinition> getNodeTypeDefinitions(); static final boolean DEFAULT_USE_VENDOR_EXTENSIONS; static final boolean DEFAULT_COMPATIBLE_WITH_PREJCR2; }
@Test( expected = ParsingException.class ) public void shouldReportErrorIfTheNodeTypeNameIsEmpty() { String cnd = "<ns = 'http: importer.parse(cnd); }
@Test( expected = ParsingException.class ) public void shouldReportErrorIfTheNodeTypeNameIsBlank() { String cnd = "<ns = 'http: importer.parse(cnd); }
@Test( expected = ParsingException.class ) public void shouldReportErrorIfTheNodeTypeNameIsNotFollowedByClosingBracket() { String cnd = "<ns = 'http: importer.parse(cnd); }
@Test( expected = NamespaceException.class ) @FixFor( "MODE-1962" ) public void shouldReportErrorIfTheNodeTypeNameUsesInvalidNamespace() { String cnd = "<ns = 'http: importer.parse(cnd); }
@Test public void shouldParseNamespaceDeclarationWithQuotedUriAndQuotedPrefix() { String cnd = "<'ns' = 'http: importer.parse(cnd); }
@Test public void shouldParseNamespaceDeclarationWithUnquotedUriAndQuotedPrefix() { String cnd = "<'ns' = http_namespace.com_ns>"; importer.parse(cnd); }
@Test public void shouldParseNamespaceDeclarationWithQuotedUriAndUnquotedPrefix() { String cnd = "<ns = 'http: importer.parse(cnd); }
@Test public void shouldParseNamespaceDeclarationWithUnquotedUriAndUnquotedPrefix() { String cnd = "<ns = http_namespace.com_ns>"; importer.parse(cnd); }
@Test public void shouldParseMinimalNodeDefinition() { String cnd = "[nodeTypeName]"; importer.parse(cnd); }
@Test public void shouldParseMinimalNodeDefinitionWithSupertype() { String cnd = "[nodeTypeName] > supertype"; importer.parse(cnd); }
@Test public void shouldParseMinimalNodeDefinitionWithSupertypes() { String cnd = "[nodeTypeName] > supertype1, supertype2"; importer.parse(cnd); }
@Test public void shouldParseNodeDefinitionWithNameThatIsKeyword() { String cnd = "[abstract] > supertype1, supertype2"; importer.parse(cnd); }