Interface LexicalProcessor<T>
-
- All Known Implementing Classes:
AbstractJsonLexicalProcessor
,DomLexicalProcessor
,JsonLexicalProcessor
,NullLexicalProcessor
,YamlLexicalProcessor
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(File file)
Checks if the processor can read from a given file.boolean
canRead(String dataString)
Checks if the processor can read from a given string.RootXNodeImpl
read(ParserSource source, ParsingContext parsingContext)
List<RootXNodeImpl>
readObjects(ParserSource source, ParsingContext parsingContext)
void
readObjectsIteratively(ParserSource source, ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler)
T
write(RootXNode xnode, SerializationContext serializationContext)
Serializes a root node into XNode tree.T
write(XNode xnode, QName rootElementName, SerializationContext serializationContext)
Serializes a non-root node into XNode tree.T
write(List<RootXNodeImpl> roots, QName aggregateElementName, SerializationContext context)
TODO Not supported for NullLexicalProcessor, though.
-
-
-
Method Detail
-
read
@NotNull RootXNodeImpl read(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
readObjects
@NotNull List<RootXNodeImpl> readObjects(@NotNull ParserSource source, @NotNull ParsingContext parsingContext) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
readObjectsIteratively
void readObjectsIteratively(@NotNull ParserSource source, @NotNull ParsingContext parsingContext, LexicalProcessor.RootXNodeHandler handler) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
canRead
boolean canRead(@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 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 RootXNode xnode, @Nullable SerializationContext serializationContext) throws SchemaException
Serializes a root node into XNode tree.- Throws:
SchemaException
-
write
@NotNull T write(@NotNull XNode xnode, @NotNull QName rootElementName, @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 List<RootXNodeImpl> roots, @Nullable QName aggregateElementName, @Nullable SerializationContext context) throws SchemaException
TODO Not supported for NullLexicalProcessor, though.- Parameters:
roots
-aggregateElementName
-context
-- Returns:
- Throws:
SchemaException
-
-