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 interface
LexicalProcessor.RootXNodeHandler
Note that this interface does not contain handleError method.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canRead(@NotNull File file)
Checks if the processor can read from a given file.boolean
canRead(@NotNull String dataString)
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)
T
write(@NotNull RootXNode xnode, @Nullable SerializationContext serializationContext)
Serializes a root node into XNode tree.T
write(@NotNull XNode xnode, @NotNull QName rootElementName, @Nullable SerializationContext serializationContext)
Serializes a non-root node into XNode tree.T
write(@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:
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
boolean canRead(@NotNull @NotNull File file) throws IOException
Checks 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
-
-