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
Modifier and TypeInterfaceDescriptionstatic interface
Note that this interface does not contain handleError method. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the processor can read from a given file.boolean
Checks if the processor can read from a given string.@NotNull RootXNodeImpl
read
(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) @NotNull List<RootXNodeImpl>
readObjects
(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) void
readObjectsIteratively
(@NotNull ParserSource source, @NotNull ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler) write
(@NotNull RootXNode xnode, @Nullable SerializationContext serializationContext) Serializes a root node into XNode tree.write
(@NotNull XNode xnode, @NotNull QName rootElementName, @Nullable SerializationContext serializationContext) Serializes a non-root node into XNode tree.write
(@NotNull List<RootXNodeImpl> roots, @Nullable SerializationContext context) TODO Not supported for NullLexicalProcessor, though.
-
Method Details
-
read
@NotNull @NotNull RootXNodeImpl read(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext) throws SchemaException, IOException - Throws:
SchemaException
IOException
-
readObjects
@NotNull @NotNull List<RootXNodeImpl> readObjects(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext) throws SchemaException, IOException - Throws:
SchemaException
IOException
-
readObjectsIteratively
void readObjectsIteratively(@NotNull @NotNull ParserSource source, @NotNull @NotNull ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler) throws SchemaException, IOException - Throws:
SchemaException
IOException
-
canRead
Checks if the processor can read from a given file. (Guessed by file extension, for now.) Used for autodetection of language.- Throws:
IOException
-
canRead
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
-