Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamSource


        return props;
    }

    private List<Source> createMetadata() {
        List<Source> metadata = new ArrayList<Source>();
        metadata.add(new StreamSource(wsdlModel.getDocumentBaseURI()));
        return metadata;
    }
View Full Code Here


  public Vector buildSite(String sBasePath, String sOutputPath, Properties oEnvironmentProps, Properties oUserProps)
      throws FileNotFoundException,IOException, DOMException, TransformerException, TransformerConfigurationException {

    Transformer oTransformer;
    StreamResult oStreamResult;
    StreamSource oStreamSrcXML;
    InputStream oXMLStream = null;
    String sMedia;
    Page oCurrentPage;
    long lElapsed = 0;

    final String sSep = System.getProperty("file.separator");

    if (DebugFile.trace) {
      lElapsed = System.currentTimeMillis();

      DebugFile.writeln("Begin PageSet.buildSite(" + sBasePath + "," + sOutputPath + "...)");
      DebugFile.incIdent();
    }

    oLastXcpt = null;

    if (!sBasePath.endsWith(sSep)) sBasePath += sSep;

    Vector vPages = pages();

    // Move to containers node
    if (DebugFile.trace)
      DebugFile.writeln("seekChildByName(,[Node], \"containers\")");

    Node oContainers = oMSite.seekChildByName(oMSite.getRootNode().getFirstChild(), "containers");

    if (oContainers==null) {
      if (DebugFile.trace)
        DebugFile.writeln("ERROR: <containers> node not found.");

      throw new DOMException(DOMException.NOT_FOUND_ERR, "<containers> node not found");
    }

    // Load XML data stream only once for all containers
    if (DebugFile.trace)
      DebugFile.writeln("oXMLStream = new FileInputStream(" + sURI + ")");

    // For each Page do XSL Transformation
    for (int c=0; c<vPages.size(); c++) {
      oCurrentPage = (Page) vPages.get(c);

      oXMLStream = new FileInputStream(sURI);
      oStreamSrcXML = new StreamSource(oXMLStream);

      // XSL Transformation
      try {
        if (DebugFile.trace)
          DebugFile.writeln("oTransformer = StylesheetCache.newTransformer(" + sBasePath + "xslt" + sSep + "templates" + sSep + oMSite.name() + sSep + oCurrentPage.template() + ")");
View Full Code Here

    throws FileNotFoundException, IOException, DOMException, TransformerException,
           TransformerConfigurationException, MalformedURLException {

    Transformer oTransformer;
    StreamResult oStreamResult;
    StreamSource oStreamSrcXML;
    StringWriter oStrWritter;
    File oXMLFile,oXSLFile;
    InputStream oXMLStream = null;
    String sTransformed;
    StringBuffer oPostTransform;
    String sKey;
    String sMedia;
    String sXSLFile;
    Object sVal;
    Page oCurrentPage;

    int iCloseHead, iOpenBody, iCloseBody;
    int iReaded;
    char CharBuffer[] = new char[8192];
    String sCharBuffer;
    long lElapsed = 0;

    final String sSep = System.getProperty("file.separator");

    if (DebugFile.trace) {
      lElapsed = System.currentTimeMillis();

      DebugFile.writeln("Begin Pageset.buildPageForEdit(" + sBasePath + "," + sOutputPath + "," + sCtrlPath + "," + sMenuPath + ")");
      DebugFile.incIdent();
    }

    FileSystem oFS = new FileSystem();

    if (!sBasePath.endsWith(sSep)) sBasePath += sSep;

    String sWebServer = oEnvironmentProps.getProperty("webserver", "");

    if (DebugFile.trace && sWebServer.length()==0) DebugFile.writeln("WARNING: webserver property not set at EnvironmentProperties");

    if (!sWebServer.endsWith("/")) sWebServer+="/";


    // Posicionarse en el nodo de contenedores
    Node oContainers = oMSite.seekChildByName(oMSite.getRootNode().getFirstChild(), "containers");

    if (oContainers==null) {
      if (DebugFile.trace)
        DebugFile.writeln("ERROR: <containers> node not found.");

      throw new DOMException(DOMException.NOT_FOUND_ERR, "<containers> node not found");
    }

    // Cagar el stream de datos XML una sola vez
    if (DebugFile.trace)
      DebugFile.writeln("new FileInputStream(" + (sURI.startsWith("file://") ? sURI.substring(7) : sURI) + ")");

    // Para cada contenedor (página) realizar la transformación XSLT

      oCurrentPage = this.page(sPageGUID);

    oXMLFile = new File (sURI.startsWith("file://") ? sURI.substring(7) : sURI);
    if (!oXMLFile.exists()) {
        if (DebugFile.trace) DebugFile.decIdent();
      throw new FileNotFoundException("PageSet.buildPageForEdit() File not found "+sURI);
    }

      oXMLStream = new FileInputStream(oXMLFile);
      oStreamSrcXML = new StreamSource(oXMLStream);

      // Asignar cada stream de salida a su stream temporal
      oStrWritter = new StringWriter();
      oStreamResult = new StreamResult(oStrWritter);
View Full Code Here

    throws IOException, DOMException, TransformerException,
           TransformerConfigurationException, MalformedURLException {

    Transformer oTransformer;
    StreamResult oStreamResult;
    StreamSource oStreamSrcXML;
    StringWriter oStrWritter;
    InputStream oXMLStream = null;
    String sTransformed;
    StringBuffer oPostTransform;
    String sKey;
    String sMedia;
    Object sVal;
    Page oCurrentPage;

    int iCloseHead, iOpenBody, iCloseBody;
    int iReaded;
    char CharBuffer[] = new char[8192];
    String sCharBuffer;
    long lElapsed = 0;

    final String sSep = System.getProperty("file.separator");

    if (DebugFile.trace) {
      lElapsed = System.currentTimeMillis();

      DebugFile.writeln("Begin Pageset.buildSiteForEdit(" + sBasePath + "," + sOutputPath + "," + sCtrlPath + "," + sMenuPath + ")");
      DebugFile.incIdent();
    }

    FileSystem oFS = new FileSystem();

    Vector vPages = pages();

    if (!sBasePath.endsWith(sSep)) sBasePath += sSep;

    String sWebServer = oEnvironmentProps.getProperty("webserver", "");

    if (DebugFile.trace && sWebServer.length()==0) DebugFile.writeln("WARNING: webserver property not set at EnvironmentProperties");

    if (!sWebServer.endsWith("/")) sWebServer+="/";


    // Posicionarse en el nodo de contenedores
    Node oContainers = oMSite.seekChildByName(oMSite.getRootNode().getFirstChild(), "containers");

    if (oContainers==null) {
      if (DebugFile.trace)
        DebugFile.writeln("ERROR: <containers> node not found.");

      throw new DOMException(DOMException.NOT_FOUND_ERR, "<containers> node not found");
    }

    // Cagar el stream de datos XML una sola vez
    if (DebugFile.trace)
      DebugFile.writeln("new FileInputStream(" + (sURI.startsWith("file://") ? sURI.substring(7) : sURI) + ")");


    // Para cada contenedor (página) realizar la transformación XSLT
    for (int c=0; c<vPages.size(); c++) {

      oCurrentPage = (Page) vPages.get(c);

      oXMLStream = new FileInputStream(sURI.startsWith("file://") ? sURI.substring(7) : sURI);
      oStreamSrcXML = new StreamSource(oXMLStream);

      // Asignar cada stream de salida a su stream temporal
      oStrWritter = new StringWriter();
      oStreamResult = new StreamResult(oStrWritter);
View Full Code Here

  static XMLEventReader createXmlEventReaderOnXmlString( String xml, String docBaseUri )
          throws XMLStreamException
  {
    Reader stringReader = new StringReader( xml );
    Source source = new StreamSource( stringReader, docBaseUri.toString() );
    XMLInputFactory factory = XMLInputFactory.newInstance();
    factory.setProperty( "javax.xml.stream.isCoalescing", Boolean.TRUE );
    factory.setProperty( "javax.xml.stream.supportDTD", Boolean.FALSE );

    return factory.createXMLEventReader( source );
View Full Code Here

  {
    executor = Executors.newCachedThreadPool();
    TransformerFactory transFact = TransformerFactory.newInstance();
    ClassLoader cl = RDFaParser.class.getClassLoader();
    InputStream xslt = cl.getResourceAsStream(RDFaParser.XSLT);
    transformer = transFact.newTransformer(new StreamSource(xslt));
  }
View Full Code Here

    throws TransformerConfigurationException
  {
    executor = Executors.newSingleThreadExecutor();
    TransformerFactory transFact = TransformerFactory.newInstance();
    ClassLoader cl = RDFaParser.class.getClassLoader();
    transformer = transFact.newTransformer(new StreamSource(cl.getResourceAsStream(XSLT)));
  }
View Full Code Here

  }

  public void parse(InputStream in, final String baseURI)
    throws IOException, RDFParseException, RDFHandlerException
  {
    parse(new StreamSource(in), baseURI);
  }
View Full Code Here

  }

  public void parse(Reader reader, String baseURI)
    throws IOException, RDFParseException, RDFHandlerException
  {
    parse(new StreamSource(reader), baseURI);
  }
View Full Code Here

  {
    String xml = CatalogXmlUtils.wrapThreddsXmlInCatalog( "<serviceName>OPeNDAP</serviceName>", null, null, null );
    String baseUriString = "http://test.metadata.parser/tmd.xml";

    Reader reader = new StringReader( xml );
    Source source = new StreamSource( reader, baseUriString );
    XMLEventReader eventReader = factory.createXMLEventReader( source );

    StringWriter writer = new StringWriter();

    while ( eventReader.hasNext() )
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamSource

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.