users@jaxb.java.net

Re: sitemap

From: Arun <arun.george.1981_at_gmail.com>
Date: Mon, 22 Oct 2007 18:58:33 +0530

Can I do it other way around.
My sitemap xml should be like

<urlset>

<url>
<loc> </loc>
<lastmod> </loastmod>
<changefreq> </changefreq>
<priority> </priority>
</url>

</urlset>

Can I annotate a java class and marshal it.?

SitemapList.java


@XmlRootElement(name="urlset")
public class SitemapList
{

 public class SitemapURL
 {

  String loc;
  String lastmod;
  String changefreq;
  String priority;
 }
@XmlElement(name="url")
List<SitemapURL> urlList;






}


And If I marshal this will I get the xml, assuming I do not have an xsd. I
this case, using annotation do I need to pass in a binding file
when marshalling. I just want to convert this java object to xml.
I can create a marshaller from context and write to an xml file right? I am
missing anything?

On 10/22/07, Raymond Wold <raymond.wold_at_teletopia.com> wrote:
>
> Arun wrote:
> > Hi,
> >
> > I have a sitemap.xsd . I am using java1.5 and tomcat 6. I would like to
> > generate java class from it and do marshalling and unmarshalling.
> > In what level annotaions can be used..Where will I specify the
> annotations?
> > Can you point me to a startup link on this.
> > Thanks in advance.
> >
>
> When you generate classes from an .xsd file, it will be generated with
> annotations so JAXB can marshall and unmarshall according to the schema.
> If
> you need customizations, rather than annotate the .xsd file (which
> typically
> comes from an external source, and might be overwritten by a new version),
> you
> typically use a custom binding file that you feed to your binding compiler
> as
> you generate the classes.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Thanks
Arun George