Hi Justin,

SaxRepresentation can be used for both parsing and writing of a streamable
XML document. 
 - use the parse(ContentHandler) method for parsing.
 - use the write(XmlWriter) method for writing.

The org.restlet.util.XmlWriter class has everything you need to write XML
elements, attributes, etc. It is based on source code in public domain from
SAX's creator, David Megginson.

Best regards,
Jerome  

> -----Message d'origine-----
> De : Stanczak Group [mailto:[EMAIL PROTECTED] 
> Envoyé : vendredi 31 août 2007 04:31
> À : [email protected]
> Objet : Re: SaxRepresentation Use?
> 
> Ok, I think I see what I'm not understanding. You don't use the 
> SaxRepresentation to create the xml. You use it to parse the 
> events on 
> the fly. Is that correct? I can't find a way to write xml 
> with it. I was 
> looking a using a pullparser, does that mean I need to use 
> streams instead?
> 
> Stanczak Group wrote:
> > Ok, so I need to create a document on the server side? Then just 
> > return the SaxRepresentation? That simple?
> >
> > public SaxRepresentation(MediaType mediaType, Document 
> xmlDocument) {
> >
> > Stanczak Group wrote:
> >> Little confused on how to use the SaxRepresentation. I have this:
> >> @Override
> >>    public Representation getRepresentation(Variant variant) {
> >>        Representation result = null;
> >>        if 
> (variant.getMediaType().equals(MediaType.APPLICATION_XML)) {
> >>            ???? SaxRepresentation sax = new 
> >> SaxRepresentation(MediaType.APPLICATION_XML); ???? What do I do?
> >>        }
> >>        return result;
> >>    }
> >>
> >> I'm not sure how to use it. I understand I need to create 
> a subclass 
> >> of ContentHandler correct? But say I have a User object to 
> parse, how 
> >> to I return this SaxRepresentation with that content 
> handler and User 
> >> object?
> >>
> >
> 
> -- 
> Justin Stanczak
> Stanczak Group
> 812-735-3600
> 
> "All that is necessary for the triumph of evil is that good 
> men do nothing."
> Edmund Burke

Reply via email to