public class CsdlParser
extends java.lang.Object
Constructor and Description |
---|
CsdlParser() |
Modifier and Type | Method and Description |
---|---|
CsdlFetcher |
getCsdlFetcher()
(nullable) A callback which will be used to resolve any CSDL Reference that is encountered during parsing, in order to fetch the referenced metadata.
|
int |
getCsdlOptions()
A bitmask of CSDL parser options.
|
XmlElementList |
getIncludeReferences()
Supplementary edmx:Reference elements.
|
DataSchemaList |
getIncludeSchemas()
Pre-parsed schemas.
|
boolean |
getLogErrors()
Should parser errors be logged before they are thrown?
|
boolean |
getLogWarnings()
Should parser warnings be logged?
|
java.lang.String |
getServiceName()
(nullable) Data service name.
|
boolean |
getTraceRequests()
Should parsing requests be traced?
|
void |
includeNamespace(java.lang.String ns)
|
void |
includeNamespace(java.lang.String ns,
java.lang.String alias)
Add to
CsdlParser.includeReferences a supplementary CSDL edmx:Reference (with embedded edmx:Include). |
void |
includeReference(java.lang.String uri,
java.lang.String ns)
|
void |
includeReference(java.lang.String uri,
java.lang.String ns,
java.lang.String alias)
Add to
CsdlParser.includeReferences a supplementary CSDL edmx:Reference (with embedded edmx:Include). |
void |
includeSchema(DataSchema schema)
Include the definitions of a pre-parsed schema into the document to be parsed.
|
CsdlDocument |
parse(java.lang.String text,
java.lang.String url)
|
CsdlDocument |
parseInProxy(java.lang.String text,
java.lang.String url)
For internal use only.
|
static java.lang.String |
resolveToLocalSAPVocabulary(java.lang.String ns)
For internal use only.
|
void |
setCsdlFetcher(CsdlFetcher value)
A callback which will be used to resolve any CSDL Reference that is encountered during parsing, in order to fetch the referenced metadata.
|
void |
setCsdlOptions(int value)
A bitmask of CSDL parser options.
|
void |
setIncludeReferences(XmlElementList value)
Supplementary edmx:Reference elements.
|
void |
setIncludeSchemas(DataSchemaList value)
Pre-parsed schemas.
|
void |
setLogErrors(boolean value)
Should parser errors be logged before they are thrown?
|
void |
setLogWarnings(boolean value)
Should parser warnings be logged?
|
void |
setServiceName(java.lang.String value)
Data service name.
|
void |
setTraceRequests(boolean value)
Should parsing requests be traced?
|
public CsdlFetcher getCsdlFetcher()
(nullable) A callback which will be used to resolve any CSDL Reference that is encountered during parsing, in order to fetch the referenced metadata.
Must be set before CsdlParser.parse
is called, or else any CSDL Reference that is encountered during parsing will result in a CsdlException
being thrown.
public int getCsdlOptions()
A bitmask of CSDL parser options.
public XmlElementList getIncludeReferences()
Supplementary edmx:Reference elements. Defaults to an empty list.
public DataSchemaList getIncludeSchemas()
Pre-parsed schemas. Defaults to an empty list.
public boolean getLogErrors()
Should parser errors be logged before they are thrown?
public boolean getLogWarnings()
Should parser warnings be logged?
public java.lang.String getServiceName()
(nullable) Data service name. If data metrics are required, this property should be set before CsdlParser.parse
is called,
so that all DataMethod
and EntitySet
in the parsed document will have appropriately named metrics.
public boolean getTraceRequests()
Should parsing requests be traced?
public void includeNamespace(java.lang.String ns)
public void includeNamespace(java.lang.String ns, java.lang.String alias)
Add to CsdlParser.includeReferences
a supplementary CSDL edmx:Reference (with embedded edmx:Include).
Call this function before CsdlParser.parse
if the document to be parsed is missing expected edmx:Reference elements for well-known schemas.
This function generates an edmx:Reference with a fabricated "Uri" (with value "include/ns
.xml").
It can be used together with a CsdlParser.csdlFetcher
which resolves documents either by fabricated location (include/ns
.xml) or by namespace (ns
).
ns
- For the "Namespace" attribute of "edmx:Include".alias
- (nullable) For the "Alias" attribute of "edmx:Include".public void includeReference(java.lang.String uri, java.lang.String ns)
public void includeReference(java.lang.String uri, java.lang.String ns, java.lang.String alias)
Add to CsdlParser.includeReferences
a supplementary CSDL edmx:Reference (with embedded edmx:Include).
Call this function before CsdlParser.parse
if the document to be parsed is missing expected edmx:Reference elements for well-known schemas.
This function generates an edmx:Reference with a caller-specified "Uri".
It can be used together with a CsdlParser.csdlFetcher
which resolves documents either by caller-specified location (uri
) or by namespace (ns
).
uri
- For the "Uri" attribute of "edmx:Reference".ns
- For the "Namespace" attribute of "edmx:Include".alias
- (nullable) For the "Alias" attribute of "edmx:Include".public void includeSchema(DataSchema schema)
Include the definitions of a pre-parsed schema into the document to be parsed.
Call this function before CsdlParser.parse
if the document to be parsed has an edmx:Reference element for a well-known schema,
and the pre-parsed schema should be used rather than loading the referenced schema over the network.
schema
- Pre-parsed schema.public CsdlDocument parse(java.lang.String text, java.lang.String url)
Parse the text of an Open Data Protocol (OData) service metadata (CSDL) document. Supports OData versions 1.0 to 4.0.
text
- Text of the service metadata document.url
- URL of the service metadata document. Used for resolving relative URLs if any CSDL Reference is encountered during parsing. May also be included in exception messages.public CsdlDocument parseInProxy(java.lang.String text, java.lang.String url)
For internal use only.
public static java.lang.String resolveToLocalSAPVocabulary(java.lang.String ns)
For internal use only.
public void setCsdlFetcher(CsdlFetcher value)
A callback which will be used to resolve any CSDL Reference that is encountered during parsing, in order to fetch the referenced metadata.
Must be set before CsdlParser.parse
is called, or else any CSDL Reference that is encountered during parsing will result in a CsdlException
being thrown.
public void setCsdlOptions(int value)
A bitmask of CSDL parser options.
public void setIncludeReferences(XmlElementList value)
Supplementary edmx:Reference elements. Defaults to an empty list.
public void setIncludeSchemas(DataSchemaList value)
Pre-parsed schemas. Defaults to an empty list.
public void setLogErrors(boolean value)
Should parser errors be logged before they are thrown?
public void setLogWarnings(boolean value)
Should parser warnings be logged?
public void setServiceName(java.lang.String value)
Data service name. If data metrics are required, this property should be set before CsdlParser.parse
is called,
so that all DataMethod
and EntitySet
in the parsed document will have appropriately named metrics.
public void setTraceRequests(boolean value)
Should parsing requests be traced?