Interface LexicalProcessor<T>
-
- All Known Implementing Classes:
DelegatingLexicalProcessor,DomLexicalProcessor,NullLexicalProcessor
public interface LexicalProcessor<T>Takes care of converting between XNode tree and specific lexical representation (XML, JSON, YAML). As a special case, NullLexicalProcessor uses XNode tree itself as a lexical representation.- Author:
- semancik
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceLexicalProcessor.RootXNodeHandlerNote that this interface does not contain handleError method.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanRead(@NotNull File file)Checks if the processor can read from a given file.booleancanRead(@NotNull String dataString)Checks if the processor can read from a given string.@NotNull RootXNodeImplread(@NotNull ParserSource source, @NotNull ParsingContext parsingContext)@NotNull List<RootXNodeImpl>readObjects(@NotNull ParserSource source, @NotNull ParsingContext parsingContext)voidreadObjectsIteratively(@NotNull ParserSource source, @NotNull ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler)Twrite(@NotNull RootXNode xnode, @Nullable SerializationContext serializationContext)Serializes a root node into XNode tree.Twrite(@NotNull XNode xnode, @NotNull QName rootElementName, @Nullable SerializationContext serializationContext)Serializes a non-root node into XNode tree.Twrite(@NotNull List<RootXNodeImpl> roots, @Nullable SerializationContext context)TODO Not supported for NullLexicalProcessor, though.
-
-
-
Method Detail
-
read
@NotNull @NotNull RootXNodeImpl read(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext) throws SchemaException, IOException
- Throws:
SchemaExceptionIOException
-
readObjects
@NotNull @NotNull List<RootXNodeImpl> readObjects(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext) throws SchemaException, IOException
- Throws:
SchemaExceptionIOException
-
readObjectsIteratively
void readObjectsIteratively(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler) throws SchemaException, IOException- Throws:
SchemaExceptionIOException
-
canRead
boolean canRead(@NotNull @NotNull File file) throws IOExceptionChecks if the processor can read from a given file. (Guessed by file extension, for now.) Used for autodetection of language.- Throws:
IOException
-
canRead
boolean canRead(@NotNull @NotNull String dataString)Checks if the processor can read from a given string. Note this is only an approximative information (for now). Used for autodetection of language.
-
write
@NotNull T write(@NotNull @NotNull RootXNode xnode, @Nullable @Nullable SerializationContext serializationContext) throws SchemaException
Serializes a root node into XNode tree.- Throws:
SchemaException
-
write
@NotNull T write(@NotNull @NotNull XNode xnode, @NotNull @NotNull QName rootElementName, @Nullable @Nullable SerializationContext serializationContext) throws SchemaException
Serializes a non-root node into XNode tree. So, xnode SHOULD NOT be a root node (at least for now). TODO consider removing - replacing by the previous form.- Throws:
SchemaException
-
write
@NotNull T write(@NotNull @NotNull List<RootXNodeImpl> roots, @Nullable @Nullable SerializationContext context) throws SchemaException
TODO Not supported for NullLexicalProcessor, though.- Throws:
SchemaException
-
-