Class Xsd10Schemas
java.lang.Object
org.libxmq.imp.xml.xsd10.Xsd10Schemas
Port of xml_xsd10_schemas.c: helpers, error reporting, allocation, the context lifecycle, the dict and hash tables and the public setters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Xsd10Const.ValidityErrorFuncThe function xml_xsd10_generic_error as a ValidityErrorFunc. vRaiseError compares the channel with this instance (C compares the function pointer), so pass this one, not a new method reference.static final Xsd10Const.ValidityWarningFuncThe function xml_xsd10_generic_error as a ValidityWarningFunc (C casts the warning function to the error function type; a warning channel equal to this one is the generic error channel). -
Method Summary
Modifier and TypeMethodDescriptionstatic XmlDocumentdefaultLoader(Object user_data, String uri) Port of xml_xsd10_default_loader: read and parse the file uri, problems go to stderr.static StringA C (glibc) printf for the messages of the xsd 1.0 port, usable by all its parts.static voidformatError(Xsd10Error err, Xsd10Const.ValidityErrorFunc channel, Object data) Port of xml_xsd10_format_error (libxml2 xmlFormatError).static StringPort of xml_xsd10_format_error_string: formatError into a string.static voidfree(Xsd10Schema schema) Port of xmlSchemaFree: deallocate a Schema structure.static voidPort of xmlSchemaFreeParserCtxt: free the resources associated to the schema parser context.static voidgenericError(Object ctx, String msg, Object... args) Port of xml_xsd10_generic_error: printf to stderr.static intgetParserErrors(Xsd10ParserCtxt ctxt, Xsd10Const.ValidityErrorFunc[] err, Xsd10Const.ValidityWarningFunc[] warn, Object[] ctx) Port of xmlSchemaGetParserErrors: get the callback information used to handle errors for a parser context.static intgetValidErrors(Xsd10ValidCtxt ctxt, Xsd10Const.ValidityErrorFunc[] err, Xsd10Const.ValidityWarningFunc[] warn, Object[] ctx) Port of xmlSchemaGetValidErrors: get the error and warning callback information.static intisValid(Xsd10ValidCtxt ctxt) Port of xmlSchemaIsValid: check if any error was detected during validation.static Xsd10ParserCtxtPort of xmlSchemaNewDocParserCtxt: create an XML Schemas parse context for that document.static Xsd10ParserCtxtnewMemParserCtxt(String buffer, int size) Port of xmlSchemaNewMemParserCtxt: create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.static Xsd10ParserCtxtnewParserCtxt(String URL) Port of xmlSchemaNewParserCtxt: create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.static voidsetParserErrors(Xsd10ParserCtxt ctxt, Xsd10Const.ValidityErrorFunc err, Xsd10Const.ValidityWarningFunc warn, Object ctx) Port of xmlSchemaSetParserErrors: set the callback functions used to handle errors for a validation context.static voidsetParserStructuredErrors(Xsd10ParserCtxt ctxt, Xsd10Const.StructuredErrorFunc serror, Object ctx) Port of xmlSchemaSetParserStructuredErrors: set the structured error callback.static voidsetResourceLoader(Xsd10ParserCtxt ctxt, Xsd10Const.Loader loader, Object data) Port of xmlSchemaSetResourceLoader: register a callback function that will be called to load documents or external entities.static voidsetValidErrors(Xsd10ValidCtxt ctxt, Xsd10Const.ValidityErrorFunc err, Xsd10Const.ValidityWarningFunc warn, Object ctx) Port of xmlSchemaSetValidErrors: set the error and warning callback information.static intsetValidOptions(Xsd10ValidCtxt ctxt, int options) Port of xmlSchemaSetValidOptions: sets the options to be used during the validation.static voidsetValidStructuredErrors(Xsd10ValidCtxt ctxt, Xsd10Const.StructuredErrorFunc serror, Object ctx) Port of xmlSchemaSetValidStructuredErrors: set the structured error callback.static intPort of xmlSchemaValidCtxtGetOptions: get the validation context options.
-
Field Details
-
GENERIC_ERROR
The function xml_xsd10_generic_error as a ValidityErrorFunc. vRaiseError compares the channel with this instance (C compares the function pointer), so pass this one, not a new method reference. -
GENERIC_WARNING
The function xml_xsd10_generic_error as a ValidityWarningFunc (C casts the warning function to the error function type; a warning channel equal to this one is the generic error channel).
-
-
Method Details
-
format
A C (glibc) printf for the messages of the xsd 1.0 port, usable by all its parts. Supports the flags- + space # 0, a width and a precision (digits or*), the length modifiershh h l ll z j t L q(ignored, the Java argument type decides) and the conversionsd i u o x X c s p e E f F g G %. Arguments: Integer/Long/Short/Byte (an Integer is a C int, so %u/%x of a negative Integer prints its 32 bit unsigned value, a Long its 64 bit unsigned value), Boolean (1/0), Character, Double/Float, String (null prints "(null)" like glibc, or "" if the precision is below 6), any Object for %p ("(nil)" for null). Width and precision of %s count UTF-8 bytes like C. Missing arguments are taken as null/0.- Parameters:
fmt- the C formatargs- the arguments- Returns:
- the formatted text
-
genericError
-
formatError
Port of xml_xsd10_format_error (libxml2 xmlFormatError).- Parameters:
err- the errorchannel- where to printdata- the channel data
-
formatErrorString
Port of xml_xsd10_format_error_string: formatError into a string.- Parameters:
err- the error- Returns:
- the text ("" if nothing)
-
defaultLoader
Port of xml_xsd10_default_loader: read and parse the file uri, problems go to stderr.- Parameters:
user_data- unuseduri- the uri or path- Returns:
- the document or null
-
free
Port of xmlSchemaFree: deallocate a Schema structure.- Parameters:
schema- a schema structure
-
newParserCtxt
Port of xmlSchemaNewParserCtxt: create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.- Parameters:
URL- the location of the schema- Returns:
- the parser context or null in case of error
-
newMemParserCtxt
Port of xmlSchemaNewMemParserCtxt: create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.- Parameters:
buffer- the schema textsize- its size (in UTF-8 bytes)- Returns:
- the parser context or null in case of error
-
newDocParserCtxt
Port of xmlSchemaNewDocParserCtxt: create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.- Parameters:
doc- a preparsed document tree- Returns:
- the parser context or null in case of error
-
freeParserCtxt
Port of xmlSchemaFreeParserCtxt: free the resources associated to the schema parser context.- Parameters:
ctxt- the schema parser context
-
setParserErrors
public static void setParserErrors(Xsd10ParserCtxt ctxt, Xsd10Const.ValidityErrorFunc err, Xsd10Const.ValidityWarningFunc warn, Object ctx) Port of xmlSchemaSetParserErrors: set the callback functions used to handle errors for a validation context.- Parameters:
ctxt- a schema validation contexterr- the error callbackwarn- the warning callbackctx- contextual data for the callbacks
-
setParserStructuredErrors
public static void setParserStructuredErrors(Xsd10ParserCtxt ctxt, Xsd10Const.StructuredErrorFunc serror, Object ctx) Port of xmlSchemaSetParserStructuredErrors: set the structured error callback.- Parameters:
ctxt- a schema parser contextserror- the structured error functionctx- the functions context
-
getParserErrors
public static int getParserErrors(Xsd10ParserCtxt ctxt, Xsd10Const.ValidityErrorFunc[] err, Xsd10Const.ValidityWarningFunc[] warn, Object[] ctx) Port of xmlSchemaGetParserErrors: get the callback information used to handle errors for a parser context.- Parameters:
ctxt- a XMl-Schema parser contexterr- the error callback resultwarn- the warning callback resultctx- contextual data for the callbacks result- Returns:
- -1 in case of failure, 0 otherwise
-
setResourceLoader
Port of xmlSchemaSetResourceLoader: register a callback function that will be called to load documents or external entities.- Parameters:
ctxt- schema parserloader- resource loaderdata- user data which will be passed to the loader
-
isValid
Port of xmlSchemaIsValid: check if any error was detected during validation.- Parameters:
ctxt- the schema validation context- Returns:
- 1 if valid so far, 0 if errors were detected, and -1 in case of internal error
-
setValidErrors
public static void setValidErrors(Xsd10ValidCtxt ctxt, Xsd10Const.ValidityErrorFunc err, Xsd10Const.ValidityWarningFunc warn, Object ctx) Port of xmlSchemaSetValidErrors: set the error and warning callback information.- Parameters:
ctxt- a schema validation contexterr- the error functionwarn- the warning functionctx- the functions context
-
setValidStructuredErrors
public static void setValidStructuredErrors(Xsd10ValidCtxt ctxt, Xsd10Const.StructuredErrorFunc serror, Object ctx) Port of xmlSchemaSetValidStructuredErrors: set the structured error callback.- Parameters:
ctxt- a schema validation contextserror- the structured error functionctx- the functions context
-
getValidErrors
public static int getValidErrors(Xsd10ValidCtxt ctxt, Xsd10Const.ValidityErrorFunc[] err, Xsd10Const.ValidityWarningFunc[] warn, Object[] ctx) Port of xmlSchemaGetValidErrors: get the error and warning callback information.- Parameters:
ctxt- a XML-Schema validation contexterr- the error function resultwarn- the warning function resultctx- the functions context result- Returns:
- -1 in case of error and 0 otherwise
-
setValidOptions
Port of xmlSchemaSetValidOptions: sets the options to be used during the validation.- Parameters:
ctxt- a schema validation contextoptions- a combination of xmlSchemaValidOption- Returns:
- 0 in case of success, -1 in case of an API error
-
validCtxtGetOptions
Port of xmlSchemaValidCtxtGetOptions: get the validation context options.- Parameters:
ctxt- a schema validation context- Returns:
- the option combination or -1 on error
-