| Method from org.apache.xmlbeans.impl.schema.StscState Detail: |
void addAnnotation(SchemaAnnotationImpl ann,
String targetNamespace) {
if (ann != null)
{
SchemaContainer container = getContainer(targetNamespace);
assert container != null && container == ann.getContainer();
_annotations.add(ann);
container.addAnnotation(ann);
}
}
|
void addAttributeGroup(SchemaAttributeGroupImpl attributeGroup,
SchemaAttributeGroupImpl redefined) {
if (attributeGroup != null)
{
QName name = attributeGroup.getName();
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == attributeGroup.getContainer();
if (redefined != null)
{
if (_redefinedAttributeGroups.containsKey(redefined))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent) _redefinedAttributeGroups.get(redefined)).getSourceName() },
attributeGroup.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent) _redefinedAttributeGroups.get(redefined)).getSourceName() },
attributeGroup.getParseObject());
}
}
}
else
{
_redefinedAttributeGroups.put(redefined, attributeGroup);
container.addRedefinedAttributeGroup(attributeGroup.getRef());
}
}
else
{
if (_attributeGroups.containsKey( name ))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent) _attributeGroups.get(name)).getSourceName() },
attributeGroup.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "attribute group", QNameHelper.pretty(name), ((SchemaComponent) _attributeGroups.get(name)).getSourceName() },
attributeGroup.getParseObject());
}
}
}
else
{
_attributeGroups.put(attributeGroup.getName(), attributeGroup);
addSpelling(attributeGroup.getName(), attributeGroup);
container.addAttributeGroup(attributeGroup.getRef());
}
}
}
}
|
void addAttributeType(SchemaTypeImpl type,
QName name) {
if (_attributeTypes.containsKey(name))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global attribute", QNameHelper.pretty(name), ((SchemaComponent) _attributeTypes.get(name)).getSourceName() },
type.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global attribute", QNameHelper.pretty(name), ((SchemaComponent) _attributeTypes.get(name)).getSourceName() },
type.getParseObject());
}
}
}
else
{
_attributeTypes.put(name, type);
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == type.getContainer();
container.addAttributeType(type.getRef());
}
}
|
void addClassname(String classname,
SchemaType type) {
_typesByClassname.put(classname, type);
}
|
void addDocumentType(SchemaTypeImpl type,
QName name) {
if (_documentTypes.containsKey(name))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global element", QNameHelper.pretty(name), ((SchemaComponent) _documentTypes.get(name)).getSourceName() },
type.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global element", QNameHelper.pretty(name), ((SchemaComponent) _documentTypes.get(name)).getSourceName() },
type.getParseObject());
}
}
}
else
{
_documentTypes.put(name, type);
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == type.getContainer();
container.addDocumentType(type.getRef());
}
}
|
public static void addError(Collection errorListener,
String message,
int code,
XmlObject location) {
XmlError err =
XmlError.forObject(
message,
XmlError.SEVERITY_ERROR,
location);
errorListener.add(err);
}
|
public static void addError(Collection errorListener,
String code,
Object[] args,
XmlObject location) {
XmlError err =
XmlError.forObject(
code,
args,
XmlError.SEVERITY_ERROR,
location);
errorListener.add(err);
}
|
public static void addError(Collection errorListener,
String code,
Object[] args,
File location) {
XmlError err =
XmlError.forLocation(
code,
args,
XmlError.SEVERITY_ERROR,
location.toURI().toString(), 0, 0, 0);
errorListener.add(err);
}
|
public static void addError(Collection errorListener,
String code,
Object[] args,
URL location) {
XmlError err =
XmlError.forLocation(
code,
args,
XmlError.SEVERITY_ERROR,
location.toString(), 0, 0, 0);
errorListener.add(err);
}
|
void addGlobalAttribute(SchemaGlobalAttributeImpl attribute) {
if (attribute != null)
{
QName name = attribute.getName();
_globalAttributes.put(name, attribute);
addSpelling(name, attribute);
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == attribute.getContainer();
container.addGlobalAttribute(attribute.getRef());
}
}
|
void addGlobalElement(SchemaGlobalElementImpl element) {
if (element != null)
{
QName name = element.getName();
_globalElements.put(name, element);
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == element.getContainer();
container.addGlobalElement(element.getRef());
addSpelling(name, element);
}
}
|
void addGlobalType(SchemaTypeImpl type,
SchemaTypeImpl redefined) {
if (type != null)
{
QName name = type.getName();
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == type.getContainer();
if (redefined != null)
{
if (_redefinedGlobalTypes.containsKey(redefined))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType) _redefinedGlobalTypes.get(redefined)).getSourceName() } ,
type.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType) _redefinedGlobalTypes.get(redefined)).getSourceName() } ,
type.getParseObject());
}
}
}
else
{
_redefinedGlobalTypes.put(redefined, type);
container.addRedefinedType(type.getRef());
}
}
else
{
if (_globalTypes.containsKey(name))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType) _globalTypes.get(name)).getSourceName() },
type.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "global type", QNameHelper.pretty(name), ((SchemaType) _globalTypes.get(name)).getSourceName() },
type.getParseObject());
}
}
}
else
{
_globalTypes.put(name, type);
container.addGlobalType(type.getRef());
addSpelling(name, type);
}
}
}
}
|
void addIdConstraint(SchemaIdentityConstraintImpl idc) {
if (idc != null)
{
QName name = idc.getName();
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == idc.getContainer();
if (_idConstraints.containsKey(name))
{
if (!ignoreMdef(name))
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "identity constraint", QNameHelper.pretty(name), ((SchemaComponent) _idConstraints.get(name)).getSourceName() },
idc.getParseObject());
}
else
{
_idConstraints.put(name, idc);
addSpelling(idc.getName(), idc);
container.addIdentityConstraint(idc.getRef());
}
}
}
|
public static void addInfo(Collection errorListener,
String message) {
XmlError err = XmlError.forMessage(message, XmlError.SEVERITY_INFO);
errorListener.add(err);
}
|
public static void addInfo(Collection errorListener,
String code,
Object[] args) {
XmlError err = XmlError.forMessage(code, args, XmlError.SEVERITY_INFO);
errorListener.add(err);
}
|
void addModelGroup(SchemaModelGroupImpl modelGroup,
SchemaModelGroupImpl redefined) {
if (modelGroup != null)
{
QName name = modelGroup.getName();
SchemaContainer container = getContainer(name.getNamespaceURI());
assert container != null && container == modelGroup.getContainer();
if (redefined != null)
{
if (_redefinedModelGroups.containsKey(redefined))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent) _redefinedModelGroups.get(redefined)).getSourceName() },
modelGroup.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent) _redefinedModelGroups.get(redefined)).getSourceName() },
modelGroup.getParseObject());
}
}
}
else
{
_redefinedModelGroups.put(redefined, modelGroup);
container.addRedefinedModelGroup(modelGroup.getRef());
}
}
else
{
if (_modelGroups.containsKey(name))
{
if (!ignoreMdef(name)) {
if (_mdefAll) {
warning(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent) _modelGroups.get(name)).getSourceName() },
modelGroup.getParseObject());
} else {
error(XmlErrorCodes.SCHEMA_PROPERTIES$DUPLICATE,
new Object[] { "model group", QNameHelper.pretty(name), ((SchemaComponent) _modelGroups.get(name)).getSourceName() },
modelGroup.getParseObject());
}
}
}
else
{
_modelGroups.put(modelGroup.getName(), modelGroup);
addSpelling(modelGroup.getName(), modelGroup);
container.addModelGroup(modelGroup.getRef());
}
}
}
}
|
void addNamespace(String targetNamespace) {
_namespaces.add(targetNamespace);
}
|
void addNewContainer(String namespace) {
if (_containers.containsKey(namespace))
return;
SchemaContainer container = new SchemaContainer(namespace);
container.setTypeSystem(sts());
addNamespace(namespace);
_containers.put(namespace, container);
}
|
public void addSchemaDigest(byte[] digest) {
if (_noDigest)
return;
if (digest == null)
{
_noDigest = true;
_digest = null;
return;
}
if (_digest == null)
_digest = new byte[128/8]; // 128 bits.
int len = _digest.length;
if (digest.length < len)
len = digest.length;
for (int i = 0; i < len; i++)
_digest[i] ^= digest[i];
}
Accumulates a schema digest... |
public void addSourceUri(String uri,
String nameToUse) {
if (uri == null)
return;
if (nameToUse == null)
nameToUse = computeSavedFilename(uri);
_sourceForUri.put(uri, nameToUse);
}
Notes another URI that has been consumed during compilation
(this is the URI that is in the document .NAME property) |
void addSpelling(QName name,
SchemaComponent comp) {
_misspelledNames.put(crunchName(name), comp);
}
|
public static void addWarning(Collection errorListener,
String message,
int code,
XmlObject location) {
XmlError err =
XmlError.forObject(
message,
XmlError.SEVERITY_WARNING,
location);
errorListener.add(err);
}
|
public static void addWarning(Collection errorListener,
String code,
Object[] args,
XmlObject location) {
XmlError err =
XmlError.forObject(
code,
args,
XmlError.SEVERITY_WARNING,
location);
errorListener.add(err);
}
|
public boolean allowPartial() {
return _allowPartial;
}
True if a partial SchemaTypeSystem should be produced |
List annotations() {
return _annotations;
}
|
SchemaAttributeGroup[] attributeGroups() {
return (SchemaAttributeGroup[])_attributeGroups.values().toArray(new SchemaAttributeGroup[_attributeGroups.size()]);
}
|
SchemaType[] attributeTypes() {
return (SchemaType[])_attributeTypes.values().toArray(new SchemaType[_attributeTypes.size()]);
}
|
static XmlValueRef buildString(String str) {
if (str == null)
return null;
try
{
XmlStringImpl i = new XmlStringImpl();
i.set(str);
i.setImmutable();
return new XmlValueRef(i);
}
catch (XmlValueOutOfRangeException e)
{
return null;
}
}
|
static XmlValueRef build_wsstring(int wsr) {
switch (wsr)
{
case SchemaType.WS_PRESERVE:
return XMLSTR_PRESERVE;
case SchemaType.WS_REPLACE:
return XMLSTR_REPLACE;
case SchemaType.WS_COLLAPSE:
return XMLSTR_COLLAPSE;
}
return null;
}
|
public String computeSavedFilename(String uri) {
return relativize(uri, true);
}
|
SchemaType[] documentTypes() {
return (SchemaType[])_documentTypes.values().toArray(new SchemaType[_documentTypes.size()]);
}
|
public static void end() {
StscStack stscStack = (StscStack) tl_stscStack.get();
stscStack.pop();
if (stscStack.stack.size()==0)
tl_stscStack.set(null); // this is required to release all the references in this classloader
// which will enable class unloading and avoid OOM in PermGen
}
|
public void error(String message,
int code,
XmlObject loc) {
addError(_errorListener, message, code, loc);
}
Passes an error on to the current error listener.
KHK: remove this |
public void error(String code,
Object[] args,
XmlObject loc) {
addError(_errorListener, code, args, loc);
}
Passes an error on to the current error listener. |
SchemaAttributeGroupImpl findAttributeGroup(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaAttributeGroupImpl result = (SchemaAttributeGroupImpl)_attributeGroups.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaAttributeGroupImpl)_importingLoader.findAttributeGroup(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaTypeImpl findAttributeType(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaTypeImpl result = (SchemaTypeImpl)_attributeTypes.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaTypeImpl)_importingLoader.findAttributeType(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaTypeImpl findDocumentType(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaTypeImpl result = (SchemaTypeImpl)_documentTypes.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaTypeImpl)_importingLoader.findDocumentType(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaGlobalAttributeImpl findGlobalAttribute(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaGlobalAttributeImpl result = (SchemaGlobalAttributeImpl)_globalAttributes.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaGlobalAttributeImpl)_importingLoader.findAttribute(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaGlobalElementImpl findGlobalElement(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaGlobalElementImpl result = (SchemaGlobalElementImpl)_globalElements.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaGlobalElementImpl)_importingLoader.findElement(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaTypeImpl findGlobalType(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaTypeImpl result = (SchemaTypeImpl)_globalTypes.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaTypeImpl)_importingLoader.findType(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaIdentityConstraintImpl findIdConstraint(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
if (sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return (SchemaIdentityConstraintImpl)_idConstraints.get(name);
}
|
SchemaModelGroupImpl findModelGroup(QName name,
String chameleonNamespace,
String sourceNamespace) {
name = compatName(name, chameleonNamespace);
SchemaModelGroupImpl result = (SchemaModelGroupImpl)_modelGroups.get(name);
boolean foundOnLoader = false;
if (result == null)
{
result = (SchemaModelGroupImpl)_importingLoader.findModelGroup(name);
foundOnLoader = result != null;
}
if (!foundOnLoader && sourceNamespace != null)
registerDependency(sourceNamespace, name.getNamespaceURI());
return result;
}
|
SchemaAttributeGroupImpl findRedefinedAttributeGroup(QName name,
String chameleonNamespace,
SchemaAttributeGroupImpl redefinedBy) {
QName redefinitionFor = redefinedBy.getName();
name = compatName(name, chameleonNamespace);
if (name.equals(redefinitionFor))
{
return (SchemaAttributeGroupImpl)_redefinedAttributeGroups.get(redefinedBy);
// BUGBUG: should also link against _importingLoader.findRedefinedAttributeGroup
}
SchemaAttributeGroupImpl result = (SchemaAttributeGroupImpl)_attributeGroups.get(name);
if (result == null)
result = (SchemaAttributeGroupImpl)_importingLoader.findAttributeGroup(name);
return result;
}
|
SchemaTypeImpl findRedefinedGlobalType(QName name,
String chameleonNamespace,
SchemaTypeImpl redefinedBy) {
QName redefinedName = redefinedBy.getName();
name = compatName(name, chameleonNamespace);
if (name.equals(redefinedName))
{
return (SchemaTypeImpl)_redefinedGlobalTypes.get(redefinedBy);
// BUGBUG: should also link against _importingLoader.findRedefinedType
}
SchemaTypeImpl result = (SchemaTypeImpl)_globalTypes.get(name);
if (result == null)
result = (SchemaTypeImpl)_importingLoader.findType(name);
// no dependency is needed here, necause it's intra-namespace
return result;
}
|
SchemaModelGroupImpl findRedefinedModelGroup(QName name,
String chameleonNamespace,
SchemaModelGroupImpl redefinedBy) {
QName redefinitionFor = redefinedBy.getName();
name = compatName(name, chameleonNamespace);
if (name.equals(redefinitionFor))
{
return (SchemaModelGroupImpl)_redefinedModelGroups.get(redefinedBy);
// BUGBUG: should also link against _importingLoader.findRedefinedModelGroup
}
SchemaModelGroupImpl result = (SchemaModelGroupImpl)_modelGroups.get(name);
if (result == null)
result = (SchemaModelGroupImpl)_importingLoader.findModelGroup(name);
return result;
}
|
SchemaComponent findSpelling(QName name) {
return (SchemaComponent)_misspelledNames.get(crunchName(name));
}
|
void finishProcessing(Object obj) {
assert(_processingGroups.contains(obj));
_processingGroups.remove(obj);
}
|
public static StscState get() {
return ((StscStack) tl_stscStack.get()).current;
}
|
public BindingConfig getBindingConfig() throws IllegalArgumentException {
return _config;
}
|
SchemaContainer getContainer(String namespace) {
return (SchemaContainer) _containers.get(namespace);
}
|
Map getContainerMap() {
return Collections.unmodifiableMap(_containers);
}
|
Object[] getCurrentProcessing() {
return _processingGroups.toArray();
}
|
SchemaDependencies getDependencies() {
return _dependencies;
}
|
public EntityResolver getEntityResolver() {
return _entityResolver;
}
May return null if there is no custom entity resolver. |
public Collection getErrorListener() {
return _errorListener;
}
Returns the error listener being filled in during this compilation |
public String getJavaPrefix(String namespace) {
if (_config == null)
return null;
return _config.lookupPrefixForNamespace(namespace);
}
Looks up package override for a namespace URI |
public String getJavaSuffix(String namespace) {
if (_config == null)
return null;
return _config.lookupSuffixForNamespace(namespace);
}
Looks up package override for a namespace URI |
public String getJavaname(QName qname,
int kind) {
if (_config == null)
return null;
return _config.lookupJavanameForQName(qname, kind);
}
Looks up configured java name for the given qname. |
String[] getNamespaces() {
return (String[])_namespaces.toArray(new String[_namespaces.size()]);
}
|
public String getPackageOverride(String namespace) {
if (_config == null)
return null;
return _config.lookupPackageForNamespace(namespace);
}
Looks up package override for a namespace URI |
public int getRecovered() {
return _recoveredErrors;
}
Get count of recovered errors. Not for public. |
public SchemaTypeLoader getS4SLoader() {
return _s4sloader;
}
Returns the schema type loader to use for processing s4s |
public File getSchemasDir() {
return _schemasDir;
}
|
SchemaGlobalAttribute[] globalAttributes() {
return (SchemaGlobalAttribute[])_globalAttributes.values().toArray(new SchemaGlobalAttribute[_globalAttributes.size()]);
}
|
SchemaGlobalElement[] globalElements() {
return (SchemaGlobalElement[])_globalElements.values().toArray(new SchemaGlobalElement[_globalElements.size()]);
}
|
SchemaType[] globalTypes() {
return (SchemaType[])_globalTypes.values().toArray(new SchemaType[_globalTypes.size()]);
}
|
SchemaIdentityConstraintImpl[] idConstraints() {
return (SchemaIdentityConstraintImpl[])_idConstraints.values().toArray(new SchemaIdentityConstraintImpl[_idConstraints.size()]);
}
|
public void info(String message) {
addInfo(_errorListener, message);
}
Passes a warning on to the current error listener. |
public void info(String code,
Object[] args) {
addInfo(_errorListener, code, args);
}
Passes a warning on to the current error listener. |
public void initFromTypeSystem(SchemaTypeSystemImpl system,
Set newNamespaces) {
// setGivenTypeSystemName(system.getName().substring(14));
SchemaContainer[] containers = system.containers();
for (int i = 0; i < containers.length; i++)
{
if (!newNamespaces.contains(containers[i].getNamespace()))
{
// Copy data from the given container
addContainer(containers[i]);
}
}
}
Initializer for incremental compilation |
boolean isFileProcessed(String url) {
return _dependencies.isFileRepresented(url);
}
|
boolean isProcessing(Object obj) {
return _processingGroups.contains(obj);
}
|
boolean linkerDefinesNamespace(String namespace) {
return _importingLoader.isNamespaceDefined(namespace);
}
|
SchemaModelGroup[] modelGroups() {
return (SchemaModelGroup[])_modelGroups.values().toArray(new SchemaModelGroup[_modelGroups.size()]);
}
|
public boolean noAnn() {
return _noAnn;
}
True if annotations should be skipped |
public boolean noPvr() {
return _noPvr;
}
True if no particle valid (restriciton) option is set |
public boolean noUpa() {
return _noUpa;
}
True if no unique particle attribution option is set |
public void notFoundError(QName itemName,
int code,
XmlObject loc,
boolean recovered) {
String expected;
String expectedName = QNameHelper.pretty(itemName);
String found = null;
String foundName = null;
String sourceName = null;
if (recovered)
_recoveredErrors++;
switch (code)
{
case SchemaType.TYPE:
expected = "type";
break;
case SchemaType.ELEMENT:
expected = "element";
break;
case SchemaType.ATTRIBUTE:
expected = "attribute";
break;
case SchemaType.MODEL_GROUP:
expected = "model group";
break;
case SchemaType.ATTRIBUTE_GROUP:
expected = "attribute group";
break;
case SchemaType.IDENTITY_CONSTRAINT:
expected = "identity constraint";
break;
default:
assert(false);
expected = "definition";
break;
}
SchemaComponent foundComponent = findSpelling(itemName);
QName name;
if (foundComponent != null)
{
name = foundComponent.getName();
if (name != null)
{
switch (foundComponent.getComponentType())
{
case SchemaComponent.TYPE:
found = "type";
sourceName = ((SchemaType)foundComponent).getSourceName();
break;
case SchemaComponent.ELEMENT:
found = "element";
sourceName = ((SchemaGlobalElement)foundComponent).getSourceName();
break;
case SchemaComponent.ATTRIBUTE:
found = "attribute";
sourceName = ((SchemaGlobalAttribute)foundComponent).getSourceName();
break;
case SchemaComponent.ATTRIBUTE_GROUP:
found = "attribute group";
break;
case SchemaComponent.MODEL_GROUP:
found = "model group";
break;
}
if (sourceName != null)
{
sourceName = sourceName.substring(sourceName.lastIndexOf('/") + 1);
}
if (!name.equals(itemName))
{
foundName = QNameHelper.pretty(name);
}
}
}
if (found == null)
{
// error with no help
error(XmlErrorCodes.SCHEMA_QNAME_RESOLVE,
new Object[] { expected, expectedName }, loc);
}
else {
// error with help
error(XmlErrorCodes.SCHEMA_QNAME_RESOLVE$HELP,
new Object[] {
expected,
expectedName,
found,
(foundName == null ? new Integer(0) : new Integer(1)),
foundName,
(sourceName == null ? new Integer(0) : new Integer(1)),
sourceName
},
loc);
}
}
|
public void recover(String code,
Object[] args,
XmlObject loc) {
addError(_errorListener, code, args, loc); _recoveredErrors++;
}
Passes a recovered error on to the current error listener. |
SchemaAttributeGroup[] redefinedAttributeGroups() {
return (SchemaAttributeGroup[])_redefinedAttributeGroups.values().toArray(new SchemaAttributeGroup[_redefinedAttributeGroups.size()]);
}
|
SchemaType[] redefinedGlobalTypes() {
return (SchemaType[])_redefinedGlobalTypes.values().toArray(new SchemaType[_redefinedGlobalTypes.size()]);
}
|
SchemaModelGroup[] redefinedModelGroups() {
return (SchemaModelGroup[])_redefinedModelGroups.values().toArray(new SchemaModelGroup[_redefinedModelGroups.size()]);
}
|
void registerContribution(String ns,
String fileUrl) {
_dependencies.registerContribution(ns, fileUrl);
}
|
void registerDependency(String sourceNs,
String targetNs) {
_dependencies.registerDependency(sourceNs, targetNs);
}
|
public String relativize(String uri) {
return relativize(uri, false);
}
|
public void setBaseUri(URI uri) {
_baseURI = uri;
}
The base URI to use for nice filenames when saving sources. |
public void setBindingConfig(BindingConfig config) throws IllegalArgumentException {
_config = config;
}
Initializer for the schema config object. |
void setDependencies(SchemaDependencies deps) {
_dependencies = deps;
}
|
public void setErrorListener(Collection errorListener) {
_errorListener = errorListener;
}
Initializer for error handling. |
public void setGivenTypeSystemName(String name) {
_givenStsName = name;
}
|
public void setImportingTypeLoader(SchemaTypeLoader loader) {
_importingLoader = loader;
}
Initializer for schematypepath |
public void setOptions(XmlOptions options) {
if (options == null)
{
return; // defaults are all false.
}
_allowPartial = options.hasOption("COMPILE_PARTIAL_TYPESYSTEM");
_compatMap = (Map)options.get(XmlOptions.COMPILE_SUBSTITUTE_NAMES);
_noUpa = options.hasOption(XmlOptions.COMPILE_NO_UPA_RULE) ? true :
!"true".equals(SystemProperties.getProperty("xmlbean.uniqueparticleattribution", "true"));
_noPvr = options.hasOption(XmlOptions.COMPILE_NO_PVR_RULE) ? true :
!"true".equals(SystemProperties.getProperty("xmlbean.particlerestriction", "true"));
_noAnn = options.hasOption(XmlOptions.COMPILE_NO_ANNOTATIONS) ? true :
!"true".equals(SystemProperties.getProperty("xmlbean.schemaannotations", "true"));
_doingDownloads = options.hasOption(XmlOptions.COMPILE_DOWNLOAD_URLS) ? true :
"true".equals(SystemProperties.getProperty("xmlbean.downloadurls", "false"));
_entityResolver = (EntityResolver)options.get(XmlOptions.ENTITY_RESOLVER);
if (_entityResolver == null)
_entityResolver = ResolverUtil.getGlobalEntityResolver();
if (_entityResolver != null)
_doingDownloads = true;
if (options.hasOption(XmlOptions.COMPILE_MDEF_NAMESPACES))
{
_mdefNamespaces.addAll((Collection)options.get(XmlOptions.COMPILE_MDEF_NAMESPACES));
String local = "##local";
String any = "##any";
if (_mdefNamespaces.contains(local))
{
_mdefNamespaces.remove(local);
_mdefNamespaces.add("");
}
if (_mdefNamespaces.contains(any))
{
_mdefNamespaces.remove(any);
_mdefAll = true;
}
}
}
Initializer for compatMap. |
public void setSchemasDir(File _schemasDir) {
this._schemasDir = _schemasDir;
}
|
public void setTargetSchemaTypeSystem(SchemaTypeSystemImpl target) {
_target = target;
}
Initializer for references to the SchemaTypeLoader |
public boolean shouldDownloadURI(String uriString) {
if (_doingDownloads)
return true;
if (uriString == null)
return false;
try
{
URI uri = new URI(uriString);
if (uri.getScheme().equalsIgnoreCase("jar") ||
uri.getScheme().equalsIgnoreCase("zip"))
{
// It may be local or not, depending on the embedded URI
String s = uri.getSchemeSpecificPart();
int i = s.lastIndexOf('!");
return shouldDownloadURI(i > 0 ? s.substring(0, i) : s);
}
return uri.getScheme().equalsIgnoreCase("file");
}
catch (Exception e)
{
return false;
}
}
True if the given URI is a local file |
public Map sourceCopyMap() {
return Collections.unmodifiableMap(_sourceForUri);
}
Returns the whole sourceCopyMap, mapping URI's that have
been read to "sourceName" local names that have been used
to tag the types. |
public String sourceNameForUri(String uri) {
return (String)_sourceForUri.get(uri);
}
Produces the "sourceName" (to be used within the schema project
source file copies) from the URI of the original source.
Returns null if none. |
public static StscState start() {
StscStack stscStack = (StscStack) tl_stscStack.get();
if (stscStack==null)
{
stscStack = new StscStack();
tl_stscStack.set(stscStack);
}
return stscStack.push();
}
|
void startProcessing(Object obj) {
assert(!_processingGroups.contains(obj));
_processingGroups.add(obj);
}
|
public SchemaTypeSystemImpl sts() {
if (_target != null)
return _target;
String name = _givenStsName;
if (name == null && _digest != null)
name = "s" + new String(HexBin.encode(_digest));
_target = new SchemaTypeSystemImpl(name);
return _target;
}
The SchemaTypeSystem which we're building types on behalf of. |
Map typesByClassname() {
return Collections.unmodifiableMap(_typesByClassname);
}
|
public void warning(String message,
int code,
XmlObject loc) {
addWarning(_errorListener, message, code, loc);
}
Passes an error on to the current error listener. |
public void warning(String code,
Object[] args,
XmlObject loc) {
// it's OK for XMLSchema.xsd itself to have reserved type names
if (code == XmlErrorCodes.RESERVED_TYPE_NAME &&
loc.documentProperties().getSourceName() != null &&
loc.documentProperties().getSourceName().indexOf("XMLSchema.xsd") > 0)
return;
addWarning(_errorListener, code, args, loc);
}
Passes an error on to the current error listener. |