Examples of DocumentHandler


Examples of org.xml.sax.DocumentHandler

        if (serializer == null)
            throw new IOException("Unable to obtain serailizer");

        serializer.setOutputCharStream( writer );

        DocumentHandler handler = serializer.asDocumentHandler();

        if ( handler == null ) {
            String err = "The following serializer is not SAX capable: ";
            err += serializer.getClass().getName();
            err += "; cannot proceed.";
View Full Code Here

Examples of org.xml.sax.DocumentHandler

      if ( ! _insideRoot )
    throw new SAXException( Messages.format( "dsml.expectingOpeningTag",
               XML.Namespace.Root, tagName ) );
      if ( tagName.equals( XML.Schema.Element ) ||
     tagName.equals( XML.Entries.Element ) ) {
    DocumentHandler entry;

    entry = getEntryConsumer();
    entry.startElement( tagName, attr );
    _redirect = entry;
      } else {
    throw new SAXException( Messages.format( "dsml.openingTagNotRecognized",
               tagName ) );
      }
View Full Code Here

Examples of org.xml.sax.DocumentHandler

            // page and folder menu definition menu elements ordered
            // polymorphic collection to strip artifical <menu-element>
            // tags enabling Castor XML binding; see JETSPEED-INF/castor/page-mapping.xml
            writer = new OutputStreamWriter(new FileOutputStream(f), PSML_DOCUMENT_ENCODING);
            Serializer serializer = new XMLSerializer(writer, this.format);
            final DocumentHandler handler = serializer.asDocumentHandler();
            Marshaller marshaller = new Marshaller(new DocumentHandler()
                {
                    private int menuDepth = 0;

                    public void characters(char[] ch, int start, int length) throws SAXException
                    {
                        handler.characters(ch, start, length);
                    }

                    public void endDocument() throws SAXException
                    {
                        handler.endDocument();
                    }
                   
                    public void endElement(String name) throws SAXException
                    {
                        // track menu depth
                        if (name.equals("menu"))
                        {
                            menuDepth--;
                        }

                        // filter menu-element noded within menu definition
                        if ((menuDepth == 0) || !name.equals("menu-element"))
                        {
                            handler.endElement(name);
                        }
                    }
                   
                    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
                    {
                        handler.ignorableWhitespace(ch, start, length);
                    }
                   
                    public void processingInstruction(String target, String data) throws SAXException
                    {
                        handler.processingInstruction(target, data);
                    }
                   
                    public void setDocumentLocator(Locator locator)
                    {
                        handler.setDocumentLocator(locator);
                    }
                   
                    public void startDocument() throws SAXException
                    {
                        handler.startDocument();
                    }
                   
                    public void startElement(String name, AttributeList atts) throws SAXException
                    {
                        // filter menu-element noded within menu definition
                        if ((menuDepth == 0) || !name.equals("menu-element"))
                        {
                            handler.startElement(name, atts);
                        }

                        // track menu depth
                        if (name.equals("menu"))
                        {
View Full Code Here

Examples of org.xml.sax.DocumentHandler

            Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
            document = (Document) unmarshaller.unmarshal(new EventProducer()
                {
                    public void setDocumentHandler(final DocumentHandler handler)
                    {
                        readerAdapter.setDocumentHandler(new DocumentHandler()
                            {
                                private int menuDepth = 0;

                                public void characters(char[] ch, int start, int length) throws SAXException
                                {
View Full Code Here

Examples of org.xml.sax.DocumentHandler

    if(null == flistener)
    {
      String mkdirsExpr = ((ElemExtensionCall)elem).getAttribute ("mkdirs", context.sourceNode, context.processor);
      boolean mkdirs = (mkdirsExpr != null)
                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
      DocumentHandler fl = makeFormatterListener(context, fileName, true, mkdirs);
      // fl.startDocument();
    }
  }
View Full Code Here

Examples of org.xml.sax.DocumentHandler

           java.io.IOException,
           org.xml.sax.SAXException
  {
    String fileName = getFilename(context, elem);
    Object flObject = m_formatterListeners.get(fileName);
    DocumentHandler formatter;
    boolean inTable = false;
    if(null == flObject)
    {
      String mkdirsExpr = ((ElemExtensionCall)elem).getAttribute ("mkdirs", context.sourceNode, context.processor);
      boolean mkdirs = (mkdirsExpr != null)
                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
      formatter = makeFormatterListener(context, fileName, true, mkdirs);
    }
    else
    {
      inTable = true;
      formatter = (DocumentHandler)flObject;
    }

    context.processor.writeChildren( formatter, context.stylesheetTree,
                                     (ElemTemplateElement)elem,
                                     context.sourceTree, context.sourceNode, context.mode);
    if(!inTable)
    {
      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
      if(null != ostream)
      {
        formatter.endDocument();
        ostream.close();
        m_outputStreams.remove(fileName);
        m_formatterListeners.remove(fileName);
      }
    }
View Full Code Here

Examples of org.xml.sax.DocumentHandler

  {
    String fileName = getFilename(context, elem);
    Object formatterObj = m_formatterListeners.get(fileName);
    if(null != formatterObj)
    {
      DocumentHandler fl = (DocumentHandler)formatterObj;
      fl.endDocument();
      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
      if(null != ostream)
      {
        ostream.close();
        m_outputStreams.remove(fileName);
View Full Code Here

Examples of org.xml.sax.DocumentHandler

    StylesheetRoot sr = context.stylesheetTree.m_stylesheetRoot;
    OutputFormat formatter = sr.getOutputFormat();

    FileOutputStream ostream = new FileOutputStream(file);

    DocumentHandler flistener
      = sr.makeSAXSerializer(ostream, formatter);

    flistener.startDocument();
    if(shouldPutInTable)
    {
      m_outputStreams.put(fileName, ostream);
      m_formatterListeners.put(fileName, flistener);
    }
View Full Code Here

Examples of org.xml.sax.DocumentHandler

     */
    public static DocumentHandler getDefaultSerializer( OutputStream output )
        throws IOException
    {
        Serializer      serializer;
        DocumentHandler docHandler;

        serializer = getDefaultSerializer();
        serializer.setOutputByteStream( output );
        docHandler = serializer.asDocumentHandler();
        if ( docHandler == null )
View Full Code Here

Examples of org.xml.sax.DocumentHandler

     */
    public static DocumentHandler getDefaultSerializer( Writer output )
        throws IOException
    {
        Serializer      serializer;
        DocumentHandler docHandler;

        serializer = getDefaultSerializer();
        serializer.setOutputCharStream( output );
        docHandler = serializer.asDocumentHandler();
        if ( docHandler == null )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.