Possible issue with multiple xs:groups

Topics: Questions
Nov 24, 2011 at 2:38 PM

Hi all.

First of all many, many thanks to Immo for an excellent tool that has the potential to be fantastically useful for me. Secondly, apologies if my question has been covered before or if I've missed something obvious... I've checked as best I can but I'm fairly new to this.

The following schema fails with an "Object reference not set to an instance of an object." error message (full stack below). When I remove the unused widgetGroup xs:group block it seems to work absolutely fine. So as far as I can tell the error relates to having two xs:groups. 

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:group name="widgetGroup">
    <xs:sequence>
      <xs:element name="foo" type="xs:string" />
      <xs:element name="bar" type="xs:string" />
    </xs:sequence>
  </xs:group>
  <xs:group name="custGroup">
    <xs:sequence>
      <xs:element name="customer" type="xs:string" />
      <xs:element name="orderdetails" type="xs:string"/>
      <xs:element name="billto" type="xs:string"/>
      <xs:element name="shipto" type="xs:string"/>
    </xs:sequence>
  </xs:group>
  <xs:element name="order" type="ordertype"/>
  <xs:complexType name="ordertype">
    <xs:group ref="custGroup"/>
  </xs:complexType>
</xs:schema>

SHFB: Error BE0029: Unexpected error while executing plug-in 'XML Schema Documenter': System.NullReferenceException: Object reference not set to an instance of an object.

at XsdDocumentation.ExceptionBuilder.UnexpectedSchemaObjectType(XmlSchemaObject schemaObject)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaObject obj)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaElement element)

at XsdDocumentation.Model.ParentFinder.Visit(XmlSchemaElement element)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaParticle particle)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaAnnotated annotated)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaObject obj)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Traverse(XmlSchemaObjectCollection objects)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaSequence particle)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaGroupBase particle)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaParticle particle)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaAnnotated annotated)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaObject obj)

at XsdDocumentation.Model.ParentFinder.Visit(XmlSchemaGroup group)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaAnnotated annotated)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaObject obj)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchema schema)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaObject obj)

at XsdDocumentation.Model.XmlSchemaSetVisitor.Visit(XmlSchemaSet schemaSet)

at XsdDocumentation.Model.SchemaSetManager.Initialize()

at XsdDocumentation.Model.Context..ctor(IMessageReporter messageReporter, Configuration configuration)

at XsdDocumentation.Model.ContentGenerator..ctor(IMessageReporter messageReporter, Configuration configuration)

at XsdDocumentation.PlugIn.XsdPlugIn.Execute(ExecutionContext executionContext)

at SandcastleBuilder.Utils.BuildEngine.BuildProcess.ExecutePlugIns(ExecutionBehaviors behavior)

Object reference not set to an instance of an object.

Can anyone advise me what I am doing wrong or how to work around this issue? If it is a bug, can I submit an issue to get it resolved? Many thanks for your attention and thanks in advance for any help,

Ben

PS It took a while to isolate this issue (in a large nested schema) by trial and error. It would have been extremely helpful if error messages contained a bit more detail on which file and line was being processed at the time of the error. Is there any chance this information could be added? Thanks.

Jan 5, 2012 at 6:40 PM

I got the exact same issue with a group. I tried to remove the group and it works fine.

Any help would be appreciated.

 

Thanks,

Hugues

Apr 21, 2012 at 6:31 PM

It seems this happens when a schema file contains unused xs:group.  This is a bug, but you do not want to have unused xs:group anyway?

Coordinator
May 26, 2012 at 8:39 PM

SGD is correct. That was an issue with unreferenced groups. I've fixed the issue in the latest release (1.9.4.0).

Jun 12, 2012 at 1:18 PM

Hi all, sorry I have been away for a while.

I just picked up and tested the new release and wanted to say a big thank you to Immo for the fix. I now get perfect documentation for my original large, ugly, nested test-case schema and couldn't be happier. I will be pushing this excellent tool to the rest of my team and am confident that it will prove extremely useful.

Thanks again Immo.

Coordinator
Jun 14, 2012 at 5:12 AM

Hi nasatyr,

thanks for following up and the kind words! Glad to hear that everything works smoothly for you.

All the best,
-Immo


Marked as answer by terrajobst on 2/15/2014 at 6:12 PM