public class XmlSchemaParser extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPOSITE_XPATH_EXPR |
static String |
ENUM_XPATH_EXPR |
static String |
ERROR_HANDLER_KEY
Key for storing
ErrorHandler as user data in XML document |
static String |
MESSAGE_SCHEMA_XPATH_EXPR |
static String |
MESSAGE_XPATH_EXPR |
static String |
SET_XPATH_EXPR |
static String |
TYPE_XPATH_EXPR |
| Constructor and Description |
|---|
XmlSchemaParser() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkForValidName(Node node,
String name)
Check name against validity for C++ and Java naming.
|
static Map<Long,Message> |
findMessages(Document document,
XPath xPath,
Map<String,Type> typeByNameMap)
Scan XML for all message definitions and save in map
|
static Map<String,Type> |
findTypes(Document document,
XPath xPath)
Scan XML for all types (encodedDataType, compositeType, enumType, and setType) and save in map
|
static String |
getAttributeValue(Node elementNode,
String attrName)
Helper function that throws an exception when the attribute is not set.
|
static String |
getAttributeValue(Node elementNode,
String attrName,
String defValue)
Helper function that uses a default value when value not set.
|
static String |
getAttributeValueOrNull(Node elementNode,
String attrName)
Helper function that hides the null return from
NamedNodeMap.getNamedItem(String) |
static ByteOrder |
getByteOrder(String byteOrderName)
Helper function to convert a schema byteOrderName into a
ByteOrder |
static void |
handleError(Node node,
String msg)
Handle an error condition as consequence of parsing.
|
static void |
handleWarning(Node node,
String msg)
Handle a warning condition as a consequence of parsing.
|
static MessageSchema |
parse(InputStream in,
ParserOptions options)
Take an
InputStream and parse it generating map of template ID to Message objects, types, and schema
Input could be from FileInputStream, ByteArrayInputStream, etc. |
static void |
validate(String xsdFilename,
BufferedInputStream in)
Validate the document against a given schema.
|
public static final String ERROR_HANDLER_KEY
ErrorHandler as user data in XML documentpublic static final String TYPE_XPATH_EXPR
public static final String COMPOSITE_XPATH_EXPR
public static final String ENUM_XPATH_EXPR
public static final String SET_XPATH_EXPR
public static final String MESSAGE_SCHEMA_XPATH_EXPR
public static final String MESSAGE_XPATH_EXPR
public static void validate(String xsdFilename, BufferedInputStream in) throws Exception
System.errxsdFilename - schema to validate against.in - document to be validated.Exception - if an error occurs when parsing the document or schema.public static MessageSchema parse(InputStream in, ParserOptions options) throws Exception
InputStream and parse it generating map of template ID to Message objects, types, and schema
Input could be from FileInputStream, ByteArrayInputStream, etc.
Exceptions are passed back up for any problems.in - stream from which schema is read.options - to be applied during parsing.MessageSchema encoding for the schema.Exception - on parsing error.public static Map<String,Type> findTypes(Document document, XPath xPath) throws Exception
public static Map<Long,Message> findMessages(Document document, XPath xPath, Map<String,Type> typeByNameMap) throws Exception
public static void handleError(Node node, String msg)
node - that is the context of the warning.msg - associated with the error.public static void handleWarning(Node node, String msg)
node - as the context for the warning.msg - associated with the warning.public static String getAttributeValue(Node elementNode, String attrName)
elementNode - that should have the attributeattrName - that is to be looked upIllegalArgumentException - if the attribute is not presentpublic static String getAttributeValue(Node elementNode, String attrName, String defValue)
elementNode - that should have the attributeattrName - that is to be looked updefValue - String to return if not setpublic static String getAttributeValueOrNull(Node elementNode, String attrName)
NamedNodeMap.getNamedItem(String)elementNode - that could be nullattrName - that is to be looked uppublic static ByteOrder getByteOrder(String byteOrderName)
ByteOrderbyteOrderName - specified as a FIX SBE stringCopyright © 2013 Real Logic Ltd. All Rights Reserved.