<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JAXB code snippets for beginners</title>
	<atom:link href="http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jaxb-code-snippets-for-beginners</link>
	<description>Java, Web 2.0 and other Tech topics</description>
	<lastBuildDate>Thu, 09 Feb 2012 08:01:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: darshan</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-82725</link>
		<dc:creator>darshan</dc:creator>
		<pubDate>Thu, 26 Jan 2012 20:06:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-82725</guid>
		<description>with namespace declaration</description>
		<content:encoded><![CDATA[<p>with namespace declaration</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darshan</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-82724</link>
		<dc:creator>darshan</dc:creator>
		<pubDate>Thu, 26 Jan 2012 20:05:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-82724</guid>
		<description>Hi Vineet

This blog is very much helpful for me for maven implementation project from converting ant to maven script.
This plugin works great but only problem i am facing right now is 
java source file generating from xsd is like this

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = &quot;AccountBaseType&quot;, propOrder = {
    &quot;accountId&quot;,
    &quot;accountSummary&quot;

but I want to generate like this

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = &quot;AccountBaseType&quot;, namespace = &quot;http://services.com/11/basetypes/account&quot;, propOrder = {
    &quot;accountId&quot;,
    &quot;accountSummary&quot;
})

Thanks,
Darshan</description>
		<content:encoded><![CDATA[<p>Hi Vineet</p>
<p>This blog is very much helpful for me for maven implementation project from converting ant to maven script.<br />
This plugin works great but only problem i am facing right now is<br />
java source file generating from xsd is like this</p>
<p>@XmlAccessorType(XmlAccessType.FIELD)<br />
@XmlType(name = &#8220;AccountBaseType&#8221;, propOrder = {<br />
    &#8220;accountId&#8221;,<br />
    &#8220;accountSummary&#8221;</p>
<p>but I want to generate like this</p>
<p>@XmlAccessorType(XmlAccessType.FIELD)<br />
@XmlType(name = &#8220;AccountBaseType&#8221;, namespace = &#8220;http://services.com/11/basetypes/account&#8221;, propOrder = {<br />
    &#8220;accountId&#8221;,<br />
    &#8220;accountSummary&#8221;<br />
})</p>
<p>Thanks,<br />
Darshan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Roytenberg</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-74317</link>
		<dc:creator>David Roytenberg</dc:creator>
		<pubDate>Tue, 13 Dec 2011 20:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-74317</guid>
		<description>Thanks for this site.  FYI, I tried the workaround described in your December 9th 2009, 5:18 post involving using the JAXBElement and QName classes.  Worked very well.  Thanks for your trouble.</description>
		<content:encoded><![CDATA[<p>Thanks for this site.  FYI, I tried the workaround described in your December 9th 2009, 5:18 post involving using the JAXBElement and QName classes.  Worked very well.  Thanks for your trouble.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vineet</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-68570</link>
		<dc:creator>vineet</dc:creator>
		<pubDate>Wed, 16 Nov 2011 16:47:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-68570</guid>
		<description>Hi Narendra, what was the exact command line that you used?</description>
		<content:encoded><![CDATA[<p>Hi Narendra, what was the exact command line that you used?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra Verma</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-68547</link>
		<dc:creator>Narendra Verma</dc:creator>
		<pubDate>Wed, 16 Nov 2011 12:20:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-68547</guid>
		<description>Hi vineet,

Nice post you put. I liked it and want to use in my application.
But when i followed your steps and try to build the project got the below error.

Could you please help me out?

Exception:
----------

INFO] The schemaLanguage setting was not defined, assuming &#039;AUTODETECT&#039;.
Using java.util.ServiceLoader
Cannot find CatalogManager.properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.891s
[INFO] Finished at: Wed Nov 16 17:46:18 IST 2011
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.4:generate (sitemap) on project eating-well: Error parsing the command line [[Ljava.lang.String;@11daa0e]: grammar is not specified -&gt; [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.4:generate (sitemap) on project eating-well: Error parsing the command line [[Ljava.lang.String;@11daa0e]
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error parsing the command line [[Ljava.lang.String;@11daa0e]
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:487)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:250)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:135)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: com.sun.tools.xjc.BadCommandLineException: grammar is not specified
	at com.sun.tools.xjc.Options.parseArguments(Options.java:809)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:483)
	... 23 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException</description>
		<content:encoded><![CDATA[<p>Hi vineet,</p>
<p>Nice post you put. I liked it and want to use in my application.<br />
But when i followed your steps and try to build the project got the below error.</p>
<p>Could you please help me out?</p>
<p>Exception:<br />
&#8212;&#8212;&#8212;-</p>
<p>INFO] The schemaLanguage setting was not defined, assuming &#8216;AUTODETECT&#8217;.<br />
Using java.util.ServiceLoader<br />
Cannot find CatalogManager.properties<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[INFO] BUILD FAILURE<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[INFO] Total time: 0.891s<br />
[INFO] Finished at: Wed Nov 16 17:46:18 IST 2011<br />
[INFO] Final Memory: 2M/5M<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.4:generate (sitemap) on project eating-well: Error parsing the command line [[Ljava.lang.String;@11daa0e]: grammar is not specified -&gt; [Help 1]<br />
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.4:generate (sitemap) on project eating-well: Error parsing the command line [[Ljava.lang.String;@11daa0e]<br />
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)<br />
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)<br />
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)<br />
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)<br />
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)<br />
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)<br />
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)<br />
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)<br />
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)<br />
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)<br />
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)<br />
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)<br />
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
	at java.lang.reflect.Method.invoke(Method.java:597)<br />
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)<br />
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)<br />
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)<br />
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)<br />
Caused by: org.apache.maven.plugin.MojoExecutionException: Error parsing the command line [[Ljava.lang.String;@11daa0e]<br />
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:487)<br />
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:250)<br />
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:135)<br />
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)<br />
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)<br />
	&#8230; 19 more<br />
Caused by: com.sun.tools.xjc.BadCommandLineException: grammar is not specified<br />
	at com.sun.tools.xjc.Options.parseArguments(Options.java:809)<br />
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.setupOptions(RawXJC2Mojo.java:483)<br />
	&#8230; 23 more<br />
[ERROR]<br />
[ERROR] Re-run Maven using the -X switch to enable full debug logging.<br />
[ERROR]<br />
[ERROR] For more information about the errors and possible solutions, please read the following articles:<br />
[ERROR] [Help 1] <a href="http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException" rel="nofollow">http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kumar</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-59248</link>
		<dc:creator>Kumar</dc:creator>
		<pubDate>Fri, 23 Sep 2011 01:43:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-59248</guid>
		<description>Okay fine I will edit the xml it this way .. sorry again..TesteraInterface</description>
		<content:encoded><![CDATA[<p>Okay fine I will edit the xml it this way .. sorry again..TesteraInterface</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kumar</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-59247</link>
		<dc:creator>Kumar</dc:creator>
		<pubDate>Fri, 23 Sep 2011 01:41:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-59247</guid>
		<description>sorry the XML didn&#039;t go through....&lt;code&gt;
Tester
a
Interface
 &lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>sorry the XML didn&#8217;t go through&#8230;.<code><br />
Tester<br />
a<br />
Interface<br />
 </code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kumar</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-59246</link>
		<dc:creator>Kumar</dc:creator>
		<pubDate>Fri, 23 Sep 2011 01:38:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-59246</guid>
		<description>Hi Vineet, 

I have limited experience with JAXB, I have an issue which is boggling me for over some time. 

I have a XSD which looks something like this(Forgive my xsd typos, In essence CustomerList can have many customers...) :

#######################################################################################################################################################################


	
	
		
			
				
			
		
	
	



		
				
					
					
					
					
					
				
			
		
	
########################################################################################################################################################################

I use the jaxb2-maven-plugin - xjc goal - to generate the sources

The generated Class CustomerList.java has @XmlRootElement annotation to it, but the generated  class Customer.java has no @XmlRootElement annotation to it.

Now, get the Customer data in XML in the following sample format :
 ****************************************************************


Tester
a
Interface
.
.
.

****************************************************************** 

I cannot unmarshall that by providing Customer.java as input to the following code....

&lt;code&gt;
 Customer cust =(Customer) EncodeUtils.DecodeString(xmlRequest, Customer.class);


public static Object DecodeString(String input, Class objectClass)
			throws Exception {
		
		if (input == null &#124;&#124; input.isEmpty()) {
			return null;
		}

		JAXBContext context = JAXBContext.newInstance(objectClass);
		StringReader strReader = new StringReader(input);
		Unmarshaller un = context.createUnmarshaller();
		return un.unmarshal(strReader);
	}
&lt;/code&gt;


it would throw up a javax.xml.bind.UnmarshalException: unexpected element (uri:”&quot;, local:....  ... ... error.

So in essence my req has come down to be able to unmarshal the string the Customer XML to string to Customer.java which doean&#039;t contain @XMLRootElement annotation. If I add that manually the problem is solved, but my use case won&#039;t allow me to do that. Somehow I should be able think of a way programmatically to do that.



What would be my options to solve the issue(I cannot change the XSD, If I have to I must have a strong argument towards that).

Any help or input would be greatly appreciated, Although I googled for this, I couldn&#039;t make mush sense of options there. 


Thank you very much. Sorry for the long post.</description>
		<content:encoded><![CDATA[<p>Hi Vineet, </p>
<p>I have limited experience with JAXB, I have an issue which is boggling me for over some time. </p>
<p>I have a XSD which looks something like this(Forgive my xsd typos, In essence CustomerList can have many customers&#8230;) :</p>
<p>#######################################################################################################################################################################</p>
<p>########################################################################################################################################################################</p>
<p>I use the jaxb2-maven-plugin &#8211; xjc goal &#8211; to generate the sources</p>
<p>The generated Class CustomerList.java has @XmlRootElement annotation to it, but the generated  class Customer.java has no @XmlRootElement annotation to it.</p>
<p>Now, get the Customer data in XML in the following sample format :<br />
 ****************************************************************</p>
<p>Tester<br />
a<br />
Interface<br />
.<br />
.<br />
.</p>
<p>****************************************************************** </p>
<p>I cannot unmarshall that by providing Customer.java as input to the following code&#8230;.</p>
<p><code><br />
 Customer cust =(Customer) EncodeUtils.DecodeString(xmlRequest, Customer.class);</p>
<p>public static Object DecodeString(String input, Class objectClass)<br />
			throws Exception {</p>
<p>		if (input == null || input.isEmpty()) {<br />
			return null;<br />
		}</p>
<p>		JAXBContext context = JAXBContext.newInstance(objectClass);<br />
		StringReader strReader = new StringReader(input);<br />
		Unmarshaller un = context.createUnmarshaller();<br />
		return un.unmarshal(strReader);<br />
	}<br />
</code></p>
<p>it would throw up a javax.xml.bind.UnmarshalException: unexpected element (uri:”&#8221;, local:&#8230;.  &#8230; &#8230; error.</p>
<p>So in essence my req has come down to be able to unmarshal the string the Customer XML to string to Customer.java which doean&#8217;t contain @XMLRootElement annotation. If I add that manually the problem is solved, but my use case won&#8217;t allow me to do that. Somehow I should be able think of a way programmatically to do that.</p>
<p>What would be my options to solve the issue(I cannot change the XSD, If I have to I must have a strong argument towards that).</p>
<p>Any help or input would be greatly appreciated, Although I googled for this, I couldn&#8217;t make mush sense of options there. </p>
<p>Thank you very much. Sorry for the long post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vineet</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-57598</link>
		<dc:creator>vineet</dc:creator>
		<pubDate>Wed, 14 Sep 2011 01:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-57598</guid>
		<description>Your XML file did not appear correctly in the comment that you posted. 

Anyway, I think the XML might be invalid. Can you use an XML validation tool (like Eclipse, XMLSpy) or an online tool and confirm if the XML is valid when validated against the schema.</description>
		<content:encoded><![CDATA[<p>Your XML file did not appear correctly in the comment that you posted. </p>
<p>Anyway, I think the XML might be invalid. Can you use an XML validation tool (like Eclipse, XMLSpy) or an online tool and confirm if the XML is valid when validated against the schema.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Soma Reddy</title>
		<link>http://www.vineetmanohar.com/2009/09/jaxb-code-snippets-for-beginners/comment-page-1/#comment-57582</link>
		<dc:creator>Soma Reddy</dc:creator>
		<pubDate>Tue, 13 Sep 2011 23:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.vineetmanohar.com/?p=482#comment-57582</guid>
		<description>I am new to Java and trying to use JAXB to deserialize a simple .xml file. But is giving fits. Here is the exception that I am getting
Any help is greatly appreciated. Sorry, to post a long message

 ExceptionBegin============================================================================================================================

javax.xml.bind.UnmarshalException: unexpected element (uri:&quot;&quot;, local:&quot;APIWebServicesClientConfig&quot;). Expected elements are (none)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
	at com.collab.examples.XMLSerializationUtils.DeSerializeFromFile3(XMLSerializationUtils.java:114)
	at com.collab.examples.LoginTF.main(LoginTF.java:132)
ExceptionEnd==========================================================================================================

XMLfileBegin===========================================================================================================


  C:\Temp
  V3 1 6 _Open_Issues_SPRs_Latest.xml
  C:\Temp
  APIWebServicesClient1.log
  ProjectForge.mil
  ProjectForge.mil
  5
  proj1077
  tracker1467
  true

XMLFileEnd=================================================================================

CodeBegin========================================================================
public static APIWebServicesClientConfig DeSerializeFromFile3(String pathSpec) 
	    {
	      
			APIWebServicesClientConfig pDetails = null;
			
			try 
			{
				JAXBContext context = JAXBContext.newInstance(com.collab.examples.APIWebServicesClientConfig.class);
				Unmarshaller  unmarshaller = context.createUnmarshaller();
				pDetails  = (APIWebServicesClientConfig) unmarshaller.unmarshal(new File(pathSpec));
			} 
			catch (JAXBException ex)
			{
				ex.printStackTrace();
				 
			}
			catch (Exception ex)
			{
				ex.printStackTrace(); 
			} 
			 
			
			return pDetails;
	    }
CodeEnd====================================================

APIWebServicesClientConfig.java Begin=================================================================
package com.collab.examples;
import java.io.Serializable;
import javax.xml.bind.*;

 
public class APIWebServicesClientConfig implements Serializable {
	
	  // Private members
    private String ArtifactDataFileDir;
	private String ArtifactDataFile;
	private String LogFileDir;
	private String LogFileName;
	private String ProjectForgeContextName;
	private String ProjectForgeServerHost;
	private Boolean UseSSL;
	private Integer TotalNoOfIssuesToBeImported;
	private String TrackerIdTobeUsed;
	private String ProjectId;
	
	public APIWebServicesClientConfig()
	{
		
	}
	// Properties
    public String getArtifactDataFileDir()
    {
    	return ArtifactDataFileDir;
    }
    public void setArtifactDataFileDir(String ArtifactDataFileDir)
    {
    	this.ArtifactDataFileDir = ArtifactDataFileDir;
    }
     

    public String getArtifactDataFile()
    {
    	return ArtifactDataFile;
    }
    public void setArtifactDataFile(String ArtifactDataFile)
    {
    	this.ArtifactDataFile = ArtifactDataFile;
    }  
    
    
    public String getLogFileDir()
    {
        return LogFileDir;
    }
    public void setLogFileDir(String LogFileDir)
    {
        this.LogFileDir = LogFileDir;
    }
    
    public String getLogfileName()
    {
    	return LogFileName;
    }
    public void setLogfileName(String LogFileName)
    {
    	this.LogFileName = LogFileName;
    }

    
    public String getProjectForgeContextName()
    {
    	return ProjectForgeContextName;
    }
    public void setProjectForgeContextName(String ProjectForgeContextName)
    {

    	this.ProjectForgeContextName =  ProjectForgeContextName;
    }

    public String getProjectForgeServerHost()
    {
    	return ProjectForgeContextName;
    }
    public String setProjectForgeServerHost(String ProjectForgeServerHost)
    {
    	return ProjectForgeContextName;
    }

    public Boolean getUseSSL()
    {
    	return UseSSL;
    }

    public void setUseSSL(Boolean UseSSL)
    {
    	this.UseSSL = UseSSL;
    }

    public Integer getTotalNoOfIssuesToBeImported()
    {
    	return TotalNoOfIssuesToBeImported;
    }

    public String getTrackerIdTobeUsed()
    {
    	return TrackerIdTobeUsed;
    }
    public void setTrackerIdTobeUsed(String TrackerIdTobeUsed)
    {
    	this.TrackerIdTobeUsed = TrackerIdTobeUsed;
    }
     
    public String getProjectId()
    {
    	return ProjectId;
    }
    public void setProjectId(String ProjectId)
    {
    	this.ProjectId = ProjectId;
    }
}

APIWebServicesClientConfig.Java End============================================================</description>
		<content:encoded><![CDATA[<p>I am new to Java and trying to use JAXB to deserialize a simple .xml file. But is giving fits. Here is the exception that I am getting<br />
Any help is greatly appreciated. Sorry, to post a long message</p>
<p> ExceptionBegin============================================================================================================================</p>
<p>javax.xml.bind.UnmarshalException: unexpected element (uri:&#8221;", local:&#8221;APIWebServicesClientConfig&#8221;). Expected elements are (none)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)<br />
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)<br />
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)<br />
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)<br />
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)<br />
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)<br />
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)<br />
	at com.collab.examples.XMLSerializationUtils.DeSerializeFromFile3(XMLSerializationUtils.java:114)<br />
	at com.collab.examples.LoginTF.main(LoginTF.java:132)<br />
ExceptionEnd==========================================================================================================</p>
<p>XMLfileBegin===========================================================================================================</p>
<p>  C:\Temp<br />
  V3 1 6 _Open_Issues_SPRs_Latest.xml<br />
  C:\Temp<br />
  APIWebServicesClient1.log<br />
  ProjectForge.mil<br />
  ProjectForge.mil<br />
  5<br />
  proj1077<br />
  tracker1467<br />
  true</p>
<p>XMLFileEnd=================================================================================</p>
<p>CodeBegin========================================================================<br />
public static APIWebServicesClientConfig DeSerializeFromFile3(String pathSpec)<br />
	    {</p>
<p>			APIWebServicesClientConfig pDetails = null;</p>
<p>			try<br />
			{<br />
				JAXBContext context = JAXBContext.newInstance(com.collab.examples.APIWebServicesClientConfig.class);<br />
				Unmarshaller  unmarshaller = context.createUnmarshaller();<br />
				pDetails  = (APIWebServicesClientConfig) unmarshaller.unmarshal(new File(pathSpec));<br />
			}<br />
			catch (JAXBException ex)<br />
			{<br />
				ex.printStackTrace();</p>
<p>			}<br />
			catch (Exception ex)<br />
			{<br />
				ex.printStackTrace();<br />
			} </p>
<p>			return pDetails;<br />
	    }<br />
CodeEnd====================================================</p>
<p>APIWebServicesClientConfig.java Begin=================================================================<br />
package com.collab.examples;<br />
import java.io.Serializable;<br />
import javax.xml.bind.*;</p>
<p>public class APIWebServicesClientConfig implements Serializable {</p>
<p>	  // Private members<br />
    private String ArtifactDataFileDir;<br />
	private String ArtifactDataFile;<br />
	private String LogFileDir;<br />
	private String LogFileName;<br />
	private String ProjectForgeContextName;<br />
	private String ProjectForgeServerHost;<br />
	private Boolean UseSSL;<br />
	private Integer TotalNoOfIssuesToBeImported;<br />
	private String TrackerIdTobeUsed;<br />
	private String ProjectId;</p>
<p>	public APIWebServicesClientConfig()<br />
	{</p>
<p>	}<br />
	// Properties<br />
    public String getArtifactDataFileDir()<br />
    {<br />
    	return ArtifactDataFileDir;<br />
    }<br />
    public void setArtifactDataFileDir(String ArtifactDataFileDir)<br />
    {<br />
    	this.ArtifactDataFileDir = ArtifactDataFileDir;<br />
    }</p>
<p>    public String getArtifactDataFile()<br />
    {<br />
    	return ArtifactDataFile;<br />
    }<br />
    public void setArtifactDataFile(String ArtifactDataFile)<br />
    {<br />
    	this.ArtifactDataFile = ArtifactDataFile;<br />
    }  </p>
<p>    public String getLogFileDir()<br />
    {<br />
        return LogFileDir;<br />
    }<br />
    public void setLogFileDir(String LogFileDir)<br />
    {<br />
        this.LogFileDir = LogFileDir;<br />
    }</p>
<p>    public String getLogfileName()<br />
    {<br />
    	return LogFileName;<br />
    }<br />
    public void setLogfileName(String LogFileName)<br />
    {<br />
    	this.LogFileName = LogFileName;<br />
    }</p>
<p>    public String getProjectForgeContextName()<br />
    {<br />
    	return ProjectForgeContextName;<br />
    }<br />
    public void setProjectForgeContextName(String ProjectForgeContextName)<br />
    {</p>
<p>    	this.ProjectForgeContextName =  ProjectForgeContextName;<br />
    }</p>
<p>    public String getProjectForgeServerHost()<br />
    {<br />
    	return ProjectForgeContextName;<br />
    }<br />
    public String setProjectForgeServerHost(String ProjectForgeServerHost)<br />
    {<br />
    	return ProjectForgeContextName;<br />
    }</p>
<p>    public Boolean getUseSSL()<br />
    {<br />
    	return UseSSL;<br />
    }</p>
<p>    public void setUseSSL(Boolean UseSSL)<br />
    {<br />
    	this.UseSSL = UseSSL;<br />
    }</p>
<p>    public Integer getTotalNoOfIssuesToBeImported()<br />
    {<br />
    	return TotalNoOfIssuesToBeImported;<br />
    }</p>
<p>    public String getTrackerIdTobeUsed()<br />
    {<br />
    	return TrackerIdTobeUsed;<br />
    }<br />
    public void setTrackerIdTobeUsed(String TrackerIdTobeUsed)<br />
    {<br />
    	this.TrackerIdTobeUsed = TrackerIdTobeUsed;<br />
    }</p>
<p>    public String getProjectId()<br />
    {<br />
    	return ProjectId;<br />
    }<br />
    public void setProjectId(String ProjectId)<br />
    {<br />
    	this.ProjectId = ProjectId;<br />
    }<br />
}</p>
<p>APIWebServicesClientConfig.Java End============================================================</p>
]]></content:encoded>
	</item>
</channel>
</rss>

