Examples of XMLStreamReaderImpl


Examples of com.caucho.xml.stream.XMLStreamReaderImpl

  private String scanEjbJarXml(Path ejbJarXml)
  {
    // XXX use Config.configure once com.caucho.ejb.cfg allows configuration
    // without a live EjbManager
    try {
      XMLStreamReaderImpl reader
        = new XMLStreamReaderImpl(ejbJarXml.openRead());

      while (reader.hasNext()) {
        if (reader.next() == XMLStreamReader.START_ELEMENT
            && "module-name".equals(reader.getLocalName()))
          return reader.getElementText();
      }
    }
    catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
View Full Code Here

Examples of com.caucho.xml.stream.XMLStreamReaderImpl

    throws WebServiceException
  {
    boolean foundBody = false;

    try {
      XMLStreamReaderImpl reader = new XMLStreamReaderImpl(in);

      // skip the Envelope
      reader.nextTag();

      if (reader.getEventType() != reader.START_ELEMENT ||
          ! "Envelope".equals(reader.getLocalName())) {
        throw new WebServiceException(L.l("Invalid response from server: No Envelope found"));
      }

      // find the body
      while (reader.hasNext()) {
        reader.next();

        if (reader.getEventType() == reader.START_ELEMENT &&
            "Body".equals(reader.getLocalName())) {

          // Copy the body contents to a StreamDataHandler
          reader.nextTag();

          XMLStreamWriterImpl xmlWriter = new XMLStreamWriterImpl(out, false);

          StaxUtil.copyReaderToWriter(reader, xmlWriter);
View Full Code Here

Examples of com.caucho.xml.stream.XMLStreamReaderImpl

    throws WebServiceException
  {
    boolean foundBody = false;

    try {
      XMLStreamReaderImpl reader = new XMLStreamReaderImpl(in);

      // skip the Envelope
      reader.nextTag();

      if (reader.getEventType() != reader.START_ELEMENT ||
          ! "Envelope".equals(reader.getLocalName())) {
        throw new WebServiceException(L.l("Invalid response from server: No Envelope found"));
      }

      // find the body
      while (reader.hasNext()) {
        reader.next();

        if (reader.getEventType() == reader.START_ELEMENT &&
            "Body".equals(reader.getLocalName())) {

          // Copy the body contents to a StreamDataHandler
          reader.nextTag();

          XMLStreamWriterImpl xmlWriter = new XMLStreamWriterImpl(out, false);

          StaxUtil.copyReaderToWriter(reader, xmlWriter);
View Full Code Here

Examples of com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl

    }
  }
 
  public static void staxCoursorParse() throws ParserConfigurationException, SAXException, IOException, XMLStreamException
  {
    XMLStreamReader staxCoursorImpl = new XMLStreamReaderImpl(new FileInputStream(xmlFile), new PropertyManager(1));
   
    int element = staxCoursorImpl.next();
    getEventTypeString(element);
    System.out.println(getEventTypeString(element));
    System.out.println(staxCoursorImpl.getLocalName());
   
//    staxCoursorImpl.getAttributeCount();
   
    while(staxCoursorImpl.hasNext())
    {
      element = staxCoursorImpl.next();
      System.out.println(getEventTypeString(element));
      if(element == XMLEvent.START_ELEMENT)
        System.out.println(staxCoursorImpl.getLocalName());
     
      if(element == XMLEvent.CHARACTERS)
        System.out.println(staxCoursorImpl.getText());
    }
   
    // Write file using StAX
//    XMLStreamWriter writer = new XMLStreamWriterImpl(new FileWriter(new File("src/modified_shipto.xml")), new PropertyManager(2));
//    writer.writeEmptyElement("EmtyTestElement");
View Full Code Here

Examples of com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl

        XMLInputSource inputSource = new XMLInputSource(null,systemId,null,reader,null);
        return getXMLStreamReaderImpl(inputSource);
    }
   
    public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
        return new XMLStreamReaderImpl(jaxpSourcetoXMLInputSource(source),
                new PropertyManager(fPropertyManager));
    }
View Full Code Here

Examples of com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl

   
    XMLStreamReader getXMLStreamReaderImpl(XMLInputSource inputSource) throws javax.xml.stream.XMLStreamException{
        //1. if the temp reader is null -- create the instance and return
        if(fTempReader == null){
            fPropertyChanged = false;
            return fTempReader = new XMLStreamReaderImpl(inputSource,
                    new PropertyManager(fPropertyManager));
        }
        //if factory is configured to reuse the instance & this instance can be reused
        //& the setProperty() hasn't been called
        if(fReuseInstance && fTempReader.canReuse() && !fPropertyChanged){
            if(DEBUG)System.out.println("Reusing the instance");
            //we can make setInputSource() call reset() and this way there wont be two function calls
            fTempReader.reset();
            fTempReader.setInputSource(inputSource);
            fPropertyChanged = false;
            return fTempReader;
        }else{
            fPropertyChanged = false;
            //just return the new instance.. note that we are not setting  fTempReader to the newly created instance
            return fTempReader = new XMLStreamReaderImpl(inputSource,
                    new PropertyManager(fPropertyManager));
        }
    }
View Full Code Here

Examples of javolution.xml.stream.XMLStreamReaderImpl

  {
    InputStream in = null;
    try
    {
      in = new FileInputStream("servername.xml");
      XMLStreamReaderImpl xpp = new XMLStreamReaderImpl();
      xpp.setInput(new UTF8StreamReader().setInput(in));
      for (int e = xpp.getEventType(); e != XMLStreamConstants.END_DOCUMENT; e = xpp.next())
      {
        if (e == XMLStreamConstants.START_ELEMENT)
        {
          if(xpp.getLocalName().toString().equals("server"))
          {
            Integer id = new Integer(xpp.getAttributeValue(null,"id").toString());
            String name = xpp.getAttributeValue(null,"name").toString();
            _serverNames.put(id,name);
          }
        }
      }
    }
View Full Code Here

Examples of javolution.xml.stream.XMLStreamReaderImpl

    spec = null;
  }

  private void loadServerNames()
  {
    XMLStreamReaderImpl xpp = new XMLStreamReaderImpl();
    UTF8StreamReader reader = new UTF8StreamReader();
   
    InputStream in = null;
    try
    {
      File conf_file = new File(FService.SERVER_NAME_FILE);
      if(!conf_file.exists()){
        //old file position
        conf_file = new File(FService.LEGACY_SERVER_NAME_FILE);
      }
     
      in = new FileInputStream(conf_file);
      xpp.setInput(reader.setInput(in));

      for(int e = xpp.getEventType(); e != XMLStreamConstants.END_DOCUMENT; e = xpp.next())
      {
        if(e == XMLStreamConstants.START_ELEMENT)
        {
          if(xpp.getLocalName().toString().equals("server"))
          {
            Integer id = new Integer(xpp.getAttributeValue(null, "id").toString());
            String name = xpp.getAttributeValue(null, "name").toString();
            _serverNames.put(id, name);

            id = null;
            name = null;
          }
        }
      }

    }
    catch(FileNotFoundException e)
    {
      if(Config.ENABLE_ALL_EXCEPTIONS)
        e.printStackTrace();
     
      _log.warning("servername.xml could not be loaded: file not found");
    }
    catch(XMLStreamException xppe)
    {
      xppe.printStackTrace();
    }
    finally
    {
      try
      {
        xpp.close();
      }
      catch(XMLStreamException e)
      {
        e.printStackTrace();
      }
View Full Code Here

Examples of javolution.xml.stream.XMLStreamReaderImpl

  {
    InputStream in = null;
    try
    {
      in = new FileInputStream("servername.xml");
      XMLStreamReaderImpl xpp = new XMLStreamReaderImpl();
      xpp.setInput(new UTF8StreamReader().setInput(in));
      for(int e = xpp.getEventType(); e != XMLStreamConstants.END_DOCUMENT; e = xpp.next())
      {
        if(e == XMLStreamConstants.START_ELEMENT)
        {
          if(xpp.getLocalName().toString().equals("server"))
          {
            Integer id = new Integer(xpp.getAttributeValue(null, "id").toString());
            String name = xpp.getAttributeValue(null, "name").toString();
            _serverNames.put(id, name);
          }
        }
      }
    }
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.