Package org.jasig.portal.serialize

Examples of org.jasig.portal.serialize.XMLSerializer


            }

            if (serOut == null) {
                // default to XML serializer
                final OutputFormat frmt = new OutputFormat("XML", "UTF-8", true);
                serOut = new XMLSerializer(printWriter, frmt);
            }

            localRenderXML(serOut);
        }
    }
View Full Code Here


          OutputFormat outputFormat = null;
          if (printXMLToLog) {
            sw = new StringWriter();
            outputFormat = new OutputFormat();
            outputFormat.setIndenting(true);
            XMLSerializer debugSerializer = new XMLSerializer(sw, outputFormat);
            SAX2DuplicatingFilterImpl dupFilter = new SAX2DuplicatingFilterImpl(th, debugSerializer);
            dupFilter.setParent(saif);
          }

          // Incorporate channel registry document into userLayout if user is in the subscribe process
View Full Code Here

          OutputFormat outputFormat = null;
          if (printXMLToLog) {
            sw = new StringWriter();
            outputFormat = new OutputFormat();
            outputFormat.setIndenting(true);
            XMLSerializer debugSerializer = new XMLSerializer(sw, outputFormat);
            SAX2DuplicatingFilterImpl dupFilter = new SAX2DuplicatingFilterImpl(th, debugSerializer);
            dupFilter.setParent(saif);
          }

          // Incorporate channel registry document into userLayout if user is in the subscribe process
View Full Code Here

                    OutputFormat outputFormat = null;
                    if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
                        dbwr1 = new StringWriter();
                        outputFormat = new OutputFormat();
                        outputFormat.setIndenting(true);
                        XMLSerializer dbser1 = new XMLSerializer(dbwr1, outputFormat);
                        SAX2DuplicatingFilterImpl dupl1 = new SAX2DuplicatingFilterImpl(ssth, dbser1);
                        dupl1.setParent(saif);
                    }

                    // if operating in the detach mode, need wrap everything
                    // in a document node and a <layout_fragment> node
                    boolean detachMode = !rootNodeId.equals(UPFileSpec.USER_LAYOUT_ROOT_NODE);
                    if (detachMode) {
                        saif.startDocument();
                        saif.startElement("",
                                "layout_fragment",
                                "layout_fragment",
                                new org.xml.sax.helpers.AttributesImpl());

                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult(new ChannelSAXStreamFilter((ContentHandler)saif)));
                        if (rElement == null) {
                            ulm.getUserLayout(new ChannelSAXStreamFilter((ContentHandler) saif));
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), new ChannelSAXStreamFilter((ContentHandler) saif));
                        }

                        saif.endElement("", "layout_fragment", "layout_fragment");
                        saif.endDocument();
                    }
                    else {
                        if (rElement == null) {
                            ulm.getUserLayout(saif);
                        }
                        else {
                            ulm.getUserLayout(rElement.getId(), saif);
                        }
                        //                            emptyt.transform(new DOMSource(rElement),new SAXResult((ContentHandler)saif));
                    }
                    // all channels should be rendering now

                    // Debug piece to print out the recorded pre-structure transformation XML
                    if (logXMLBeforeStructureTransformation && log.isDebugEnabled()) {
                            log.debug("XML incoming to the structure transformation :\n\n"
                                            + dbwr1.toString() + "\n\n");
                    }

                    // prepare for the theme transformation

                    // set up of the parameters
                    tst.setParameter("baseActionURL", uPElement.getUPFile());
                    tst.setParameter("baseIdempotentActionURL", uPIdempotentElement.getUPFile());
                    if (externalLoginUrl != null) {
                        tst.setParameter("EXTERNAL_LOGIN_URL", externalLoginUrl);
                    }

                    Hashtable<String, String> tupTable = userPreferences.getThemeStylesheetUserPreferences()
                            .getParameterValues();
                    for (Map.Entry<String, String> param : tupTable.entrySet()) {
                        String pName = param.getKey();
                        String pValue = param.getValue();
                        if (log.isDebugEnabled())
                            log.debug("setting tparam \"" + pName + "\"=\"" + pValue
                                    + "\".");
                        tst.setParameter(pName, pValue);
                    }

                    VersionsManager versionsManager = VersionsManager.getInstance();
                    Version[] versions = versionsManager.getVersions();

                    for (Version version : versions) {
                        String paramName = "version-" + version.getFname();
                        tst.setParameter(paramName, version.dottedTriple());
                    }

                    // the uP_productAndVersion stylesheet parameter is deprecated
                    // instead use the more generic "version-UP_VERSION" generated from the
                    // framework's functional name when all versions are pulled immediately
                    // above.
                    Version uPortalVersion = versionsManager.getVersion(IPermission.PORTAL_FRAMEWORK);
                    tst.setParameter("uP_productAndVersion", "uPortal " + uPortalVersion.dottedTriple());

                    final Locale[] locales = localeManager.getLocales();
                    if (locales != null && locales.length > 0 && locales[0] != null) {
                        tst.setParameter("USER_LANG", locales[0].toString().replace('_', '-'));
                    }

                    // initialize a filter to fill in channel attributes for the "theme" (second) transformation.
                    // attach it downstream of the channel rendering buffer
                    ThemeAttributesIncorporationFilter taif = new ThemeAttributesIncorporationFilter(
                            (XMLReader) crb, userPreferences.getThemeStylesheetUserPreferences());
                    // attach theme transformation downstream of the theme attribute incorporation filter
                    taif.setAllHandlers(tsth);

                    // This is a debug statement that will print out XML incoming to the
                    // theme transformation to a log file serializer to a printstream
                    StringWriter dbwr2 = null;
                    if (logXMLBeforeThemeTransformation && log.isDebugEnabled()) {
                        dbwr2 = new StringWriter();
                        XMLSerializer dbser2 = new XMLSerializer(dbwr2, outputFormat);
                        SAX2DuplicatingFilterImpl dupl2 = new SAX2DuplicatingFilterImpl(tsth, dbser2);
                        dupl2.setParent(taif);
                    }

                    if (CACHE_ENABLED && !ccaching) {
View Full Code Here

   * @return a nicely formatted String suitable for printing
   */
  public static String serializeNode(Node node, OutputFormat format ) {
    String returnString = null;
    StringWriter outString = new StringWriter();
    XMLSerializer xsl = new XMLSerializer(outString, format);
    try {
      if (node.getNodeType() == Node.DOCUMENT_NODE) {
        xsl.serialize((Document)node);
        returnString = outString.toString();
      } else if (node.getNodeType() == Node.ELEMENT_NODE) {
        xsl.serialize((Element)node);
        returnString = outString.toString();
      } else {
        returnString = "The node you passed to getNodeAsString() must be of type org.w3c.dom.Document or org.w3c.dom.Element in order to be serialized.";
      }
    } catch (IOException ioe) {
View Full Code Here

   */
  public BaseMarkupSerializer getSerializerByName (String serializerName, java.io.Writer out) {
    if (serializerName != null && serializerName.equals("WML")) {
      OutputFormat frmt = new OutputFormat("wml", "UTF-8", true);
      frmt.setDoctype(WMLPublicId, WMLSystemId);
      return  new XMLSerializer(out, frmt);
    } /* else if (serializerName != null && serializerName.equals("PalmHTML")) {
      OutputFormat frmt = new OutputFormat("HTML", "UTF-8", true);
      return  new PalmHTMLSerializer(out, frmt);
      } */ else if (serializerName != null && serializerName.equals("XML")) {
      OutputFormat frmt = new OutputFormat("XML", "UTF-8", true);
      return  new XMLSerializer(out, frmt);
    } else if (serializerName != null && serializerName.equals("XHTML")) {
      OutputFormat frmt = new OutputFormat("XHTML", "UTF-8", true);
      frmt.setPreserveSpace(true);
      frmt.setIndenting(outputIndenting);
      frmt.setDoctype(XHTMLPublicId, XHTMLSystemId);
View Full Code Here

   */
  public BaseMarkupSerializer getSerializerByName (String serializerName, java.io.Writer out) {
    if (serializerName != null && serializerName.equals("WML")) {
      OutputFormat frmt = new OutputFormat("wml", "UTF-8", true);
      frmt.setDoctype("-//WAPFORUM//DTD WML 1.1//EN", "http://www.wapforum.org/DTD/wml_1.1.xml");
      return  new XMLSerializer(out, frmt);
    } /* else if (serializerName != null && serializerName.equals("PalmHTML")) {
      OutputFormat frmt = new OutputFormat("HTML", "UTF-8", true);
      return  new PalmHTMLSerializer(out, frmt);
      } */ else if (serializerName != null && serializerName.equals("XML")) {
      OutputFormat frmt = new OutputFormat("XML", "UTF-8", true);
      return  new XMLSerializer(out, frmt);
    } else if (serializerName != null && serializerName.equals("XHTML")) {
      OutputFormat frmt = new OutputFormat("XHTML", "UTF-8", true);
      frmt.setPreserveSpace(true);
      frmt.setIndenting(outputIndenting);
      frmt.setDoctype("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
View Full Code Here

        }

        if (serOut == null) {
            // default to XML serializer
            OutputFormat frmt = new OutputFormat("XML", "UTF-8", true);
            serOut = new XMLSerializer(out, frmt);
        }

        localRenderXML(serOut);
    }
View Full Code Here

          OutputFormat outputFormat = null;
          if (printXMLToLog) {
            sw = new StringWriter();
            outputFormat = new OutputFormat();
            outputFormat.setIndenting(true);
            XMLSerializer debugSerializer = new XMLSerializer(sw, outputFormat);
            SAX2DuplicatingFilterImpl dupFilter = new SAX2DuplicatingFilterImpl(th, debugSerializer);
            dupFilter.setParent(saif);
          }

          // Incorporate channel registry document into userLayout if user is in the subscribe process
View Full Code Here

          OutputFormat outputFormat = null;
          if (printXMLToLog) {
            sw = new StringWriter();
            outputFormat = new OutputFormat();
            outputFormat.setIndenting(true);
            XMLSerializer debugSerializer = new XMLSerializer(sw, outputFormat);
            SAX2DuplicatingFilterImpl dupFilter = new SAX2DuplicatingFilterImpl(th, debugSerializer);
            dupFilter.setParent(saif);
          }

          // Incorporate channel registry document into userLayout if user is in the subscribe process
View Full Code Here

TOP

Related Classes of org.jasig.portal.serialize.XMLSerializer

Copyright © 2018 www.massapicom. 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.