1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-08-17 06:20:23 +03:00

- The error dialog should now appear if a local dependency cannot be loaded.

- Fix the "use" field of an attribute with a reference (Thanks Christelle S.).
This commit is contained in:
dgis 2016-07-06 18:17:38 +02:00
parent ad920317b9
commit 81a4b39e74
3 changed files with 32 additions and 6 deletions

View File

@ -826,7 +826,7 @@ namespace XSDDiagram
}
}
private void ParseAttribute(string nameSpace, List<XSDAttribute> listAttributes, XMLSchema.attribute attribute, bool isRestriction)
private XSDAttribute ParseAttribute(string nameSpace, List<XSDAttribute> listAttributes, XMLSchema.attribute attribute, bool isRestriction)
{
bool isReference = false;
string filename = "";
@ -839,8 +839,13 @@ namespace XSDDiagram
if (o is XSDAttribute)
{
XSDAttribute xsdAttributeInstance = o as XSDAttribute;
ParseAttribute(nameSpace, listAttributes, xsdAttributeInstance.Tag, isRestriction);
return;
XSDAttribute refXSDAttribute = ParseAttribute(nameSpace, listAttributes, xsdAttributeInstance.Tag, isRestriction);
if(refXSDAttribute != null)
{
// Override the "use" field with
refXSDAttribute.Use = attribute.use.ToString();
}
return null;
}
else // Reference not found!
{
@ -900,7 +905,10 @@ namespace XSDDiagram
{
XSDAttribute xsdAttribute = new XSDAttribute(filename, name, nameSpace, type, isReference, attribute.@default, attribute.use.ToString(), attribute);
listAttributes.Insert(0, xsdAttribute);
}
return xsdAttribute;
}
return null;
}
private void ParseAttributeGroup(string nameSpace, List<XSDAttribute> listAttributes, XMLSchema.attributeGroup attributeGroup, bool isRestriction)

View File

@ -123,6 +123,8 @@ CHANGES:
version 1.1 (Not released yet)
- Fix SVG page size.
- The error dialog should now appear if a local dependency cannot be loaded.
- Fix the "use" field of an attribute with a reference (Thanks Christelle S.).
version 1.0 (2016-02-28)
- Add the documentation in the diagram.

View File

@ -121,7 +121,15 @@ namespace XSDDiagram
}
catch (InvalidOperationException ex)
{
this.loadError.Add(ex.Message + "\r\n" + ex.InnerException.Message);
this.loadError.Add(ex.Message + "\r\n" + (ex.InnerException != null ? ex.InnerException.Message : ex.Message));
}
catch (UriFormatException ex)
{
this.loadError.Add(ex.Message + "\r\n" + (ex.InnerException != null ? ex.InnerException.Message : ex.Message));
}
catch (Exception ex)
{
this.loadError.Add(ex.Message + "\r\n" + (ex.InnerException != null ? ex.InnerException.Message : ex.Message));
}
finally
{
@ -247,7 +255,15 @@ namespace XSDDiagram
{
loadedFilename = null;
baseUrl = "";
Uri uri = new Uri(url);
Uri uri;
try
{
uri = new Uri(url);
}
catch (UriFormatException ex)
{
throw new Exception("Cannot read the URL '" + url + "'!");
}
if (uri.Segments.Length > 0)
{
string fileNameToImport = uri.Segments[uri.Segments.Length - 1];