I tried a brute-force approach in which I trapped the two calls to 
PackageCustom.getClassCustomization(String name) for the cases 
which I knew would return null, and at that point invoked 
PackageCustom.addClassCustomization(String name) and set 
m_useJavadoc=new Boolean(false) before letting each invocation 
return.  So the NPE was suppressed and execution continued.

I now see three types of log message:

-----

Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 3, col 43, in binding.xml)

This occurs for every <collection> element, even though a 
<mapping> element is present with class set to the type of the 
collection, e.g.

2 <mapping name="repository" 
class="net.uk.roos.configurator.server.domain.Repository">
3         <collection field="applications"/>
4     </mapping>
5
6     <mapping name="application" 
class="net.uk.roos.configurator.server.domain.Application">
<!-- value mappings defined here -->
9     </mapping>

In this case, line 3 refers to an attribute of class Repository 
which is of type ArrayList<Application>, and a mapping for class 
Application is defined at line 6.

-----

Warning: No schema equivalent known for type - treating as string; 
on value element at (line 62, col 81, in binding.xml)

62            <value style="attribute" name="issueRef" 
field="issue" ident="ref"/>

This defines an attribute the value of which must be separately 
declared in a different XML element.  I'm happy for that to be 
treated as unconstrained text in the .XSD if there is no 
equivalent in XML Schema.

-----

Error: Unsupported component; on value element at (line 52, col 
72, in binding.xml)

49            <collection field="revIdAttributionList">
50                <structure name="revId" 
type="net.uk.roos.configurator.server.domain.RevIdAttribution">
51                    <value name="workstream" field="workstream" 
style="attribute"/>
52                         <value field="revisionIdString" 
style="text"/>
53                </structure>
54            </collection>
55    </mapping>

Line 52 is defining the text element content for one of the two 
"structures within a collection" for which I had to force my way 
past the NPE, so it does not surprise me that there should be 
further trouble here.

-----

I think you'll all agree there is little point my continuing at 
this stage.  But if anyone has further suggestions, or if it is 
conceivable that SchemaGen could easily be extended to accommodate 
these binding constructs and at least generate a viable (albeit 
sub-optimal) .XSD then that would be great.

Cheers, Robin.


Using class loading paths:
<snip>
Using source loading paths:
 C:\projects\configurator\configurator\configurator-server\src\main\java
Starting from classes:
 
C:\projects\configurator\configurator\configurator-server\src\main\config\binding.xml
Output to directory .
Errors in binding:
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 3, col 43, in binding.xml)
Error: Unsupported component; on value element at (line 52, col 
72, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 75, col 83, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 76, col 78, in binding.xml)
Error: Unsupported component; on value element at (line 63, col 
54, in binding.xml)
Warning: No schema equivalent known for type - treating as string; 
on value element at (line 62, col 81, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 65, col 57, in binding.xml)
Warning: No schema equivalent known for type - treating as string; 
on value element at (line 60, col 62, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 14, col 63, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 15, col 61, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 16, col 55, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 17, col 51, in binding.xml)
Warning: Handling not implemented for unspecified mapping; on 
collection element at (line 21, col 48, in binding.xml)
Exception in thread "main" java.lang.RuntimeException: Errors 
found in bindings
        at 
org.jibx.schema.generator.SchemaGen.generate(SchemaGen.java:1076)
        at org.jibx.schema.generator.SchemaGen.main(SchemaGen.java:1193)




On Thu Nov 19 16:50:01 CST 2009, "Robin M. Roos" 
<ro...@roos.uk.net> wrote:

> Hi Dennis
> 
> I thought I'd try to get JiBX to generate a .XSD file from my 
> binding.   I understand SchemaGen can sometimes accomplish this, 
> but is not supported for all user-defined bindings.  I the 
> NullPointerException below in case it is easily resolved.
> 
> I have two instances in my binding where a <collection> contains 
> a <structure>.  In each of these cases I get an NPE at at 
> org.jibx.schema.generator.SchemaGen.setDocumentation(SchemaGen.java:234). 
>  It occurs because the domain class to which the <structure> is 
> mapped does not appear in the Map m_classmap within class 
> PackageCustom.  So pack.get(classname) returns null, and 
> subsequently null.isUseJavaDocs() throws the NPE.
> 
> Further details will be made available if required.
> 
> Many thanks, Robin.
> 
> 
> My binding constructs are (these are just extracts):
> 
> <mapping name="pointer" 
> class="net.uk.roos.configurator.server.domain.Pointer">
>         <value name="name" field="name"/>
>             <collection field="revIdAttributionList">
>                 <structure name="revId" 
> type="net.uk.roos.configurator.server.domain.RevIdAttribution">
>                     <value name="workstream" field="workstream" 
> style="attribute"/>
>                          <value field="revisionIdString" 
> style="text"/>
>                 </structure>
>             </collection>
>     </mapping>
> 
> <mapping name="configurator" 
> class="net.uk.roos.configurator.server.domain.Configurator">
>         <collection field="environments" name="environments"/>
>         <collection field="workstreams" name="workstreams"/>
>         <collection field="pointers" name="pointers"/>
>         <collection field="issues" name="issues"/>
>         <collection field="workstreamConfig">
>             <structure name="revisions"  
> type="net.uk.roos.configurator.server.domain.WorkstreamSpecificConfiguration">
>                 <value name="workstream" field="workstreamName" 
> style="attribute"/>
>                 <collection field="revisions"/>
>             </structure>
>         </collection>
>     </mapping>
> 
> And the NPEs are thrown during processing of the RevIdAttribution 
> and WorkstreamspecificConfiguration classes.
> 
> My command-line arguments to SchemaGen are:
> 
> -n uri=http://net.uk.roos.configurator.schema.1.0 -s 
> C:\projects\configurator\configurator\configurator-server\src\main\java 
> -v 
> C:\projects\configurator\configurator\configurator-server\src\main\config\binding.xml
> 
> The console output and exception is as follows:
> 
> Using class loading paths:
>  <snip>
> Using source loading paths:
>  C:\projects\configurator\configurator\configurator-server\src\main\java
> Starting from classes:
>  
> C:\projects\configurator\configurator\configurator-server\src\main\config\binding.xml
> Output to directory .
> Exception in thread "main" java.lang.NullPointerException
>       at 
> org.jibx.schema.generator.SchemaGen.setDocumentation(SchemaGen.java:234)
>       at 
> org.jibx.schema.generator.SchemaGen.addItemDocumentation(SchemaGen.java:283)
>       at 
> org.jibx.schema.generator.SchemaGen.fillAttributes(SchemaGen.java:804)
>       at 
> org.jibx.schema.generator.SchemaGen.buildElement(SchemaGen.java:508)
>       at 
> org.jibx.schema.generator.SchemaGen.buildCompositor(SchemaGen.java:609)
>       at 
> org.jibx.schema.generator.SchemaGen.buildCompositor(SchemaGen.java:621)
>       at 
> org.jibx.schema.generator.SchemaGen.buildComplexType(SchemaGen.java:896)
>       at 
> org.jibx.schema.generator.SchemaGen.addMapping(SchemaGen.java:1024)
>       at 
> org.jibx.schema.generator.SchemaGen.generate(SchemaGen.java:1061)
>       at org.jibx.schema.generator.SchemaGen.main(SchemaGen.java:1193)
> Disconnected from the target VM, address: '127.0.0.1:3774', 
> transport: 'socket'
> 
> Process finished with exit code 1
> 
>  
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 
> 2008 30-Day trial. Simplify your report design, integration and 
> deployment - and focus on what you do best, core application 
> coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>  _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
> 
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to