Examples of XMLReader


Examples of org.tmatesoft.svn.core.internal.io.dav.http.XMLReader

                    reader.setContentHandler(this);
                    reader.setDTDHandler(this);
                    reader.setErrorHandler(this);
                    reader.setEntityResolver(this);
                    stream = new CountingInputStream(getRequestInputStream());
                    XMLReader xmlReader = new XMLReader(stream);
                    reader.parse(new InputSource(xmlReader));
                }
            } catch (ParserConfigurationException e) {
                if (stream == null || stream.getBytesRead() > 0) {
                    SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED, e), e, SVNLogType.NETWORK);
View Full Code Here

Examples of org.wso2.carbon.policybuilder.ui.internal.services.XMLReader

        */
  }


  public void start(String[] args) {
    XMLReader myFileReader = new XMLFileReader(args[0]);
    curr_element = myFileReader.getDocumentRoot();
    PolicyBehavior temp;
    Iterator behaviorSet = nestedBehaviors.iterator();
    while (behaviorSet.hasNext()) {
      temp = (PolicyBehavior) behaviorSet.next();
      temp.evaluate(curr_element);
View Full Code Here

Examples of org.xml.sax.XMLReader

      InputStream is = file.openStream();

      try{
         InputSource input = new InputSource(is);
         input.setSystemId(file.toURI().toString());
         XMLReader reader = XMLReaderFactory.createXMLReader();
         reader.setEntityResolver(new JBossEntityResolver());
         SAXSource source = new SAXSource(reader, input);
         JAXBElement<TranslatorMetaDataGroup> elem = um.unmarshal(source, TranslatorMetaDataGroup.class);
         TranslatorMetaDataGroup deployment = elem.getValue();
         return deployment;
      }     
View Full Code Here

Examples of org.xml.sax.XMLReader

    public void parse(InputStream is) throws Exception {
        //DocumentTable store = new ProfiledDocumentTable(File.createTempFile("dtm_profile", "csv"));
        IDocumentTable store = new DocumentTable();
        DocumentTableBuilder handler = new DocumentTableBuilder(store);
        XMLReader reader = getXMLReader(handler);
        reader.parse(new InputSource(new BufferedInputStream(is)));
    }
View Full Code Here

Examples of org.xml.sax.XMLReader

        XMLReader reader = getXMLReader(handler);
        reader.parse(new InputSource(new BufferedInputStream(is)));
    }

    protected static final XMLReader getXMLReader(DocumentTableBuilder handler) throws Exception {
        final XMLReader myReader;

        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        SAXParser parser = factory.newSAXParser();
        myReader = parser.getXMLReader();

        // setup handlers (requires saxHandler)
        myReader.setContentHandler(handler);
        myReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
        myReader.setFeature("http://xml.org/sax/features/validation", true);
        myReader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
        myReader.setFeature("http://apache.org/xml/features/validation/schema", true);

        return myReader;
    }
View Full Code Here

Examples of org.xml.sax.XMLReader

         */
        public LocationResponse(HttpURLConnection connection) throws IOException {
            super(connection);
            if(connection.getResponseCode() < 400) {
                try {
                    XMLReader xr=Utils.createXMLReader();
                    ;
                    LocationResponseHandler handler=new LocationResponseHandler();
                    xr.setContentHandler(handler);
                    xr.setErrorHandler(handler);

                    xr.parse(new InputSource(connection.getInputStream()));
                    this.location=handler.loc;
                }
                catch(SAXException e) {
                    throw new RuntimeException("Unexpected error parsing ListAllMyBuckets xml", e);
                }
View Full Code Here

Examples of org.xml.sax.XMLReader

        public ListBucketResponse(HttpURLConnection connection) throws IOException {
            super(connection);
            if(connection.getResponseCode() < 400) {
                try {
                    XMLReader xr=Utils.createXMLReader();
                    ListBucketHandler handler=new ListBucketHandler();
                    xr.setContentHandler(handler);
                    xr.setErrorHandler(handler);

                    xr.parse(new InputSource(connection.getInputStream()));

                    this.name=handler.getName();
                    this.prefix=handler.getPrefix();
                    this.marker=handler.getMarker();
                    this.delimiter=handler.getDelimiter();
View Full Code Here

Examples of org.xml.sax.XMLReader

        public ListAllMyBucketsResponse(HttpURLConnection connection) throws IOException {
            super(connection);
            if(connection.getResponseCode() < 400) {
                try {
                    XMLReader xr=Utils.createXMLReader();
                    ;
                    ListAllMyBucketsHandler handler=new ListAllMyBucketsHandler();
                    xr.setContentHandler(handler);
                    xr.setErrorHandler(handler);

                    xr.parse(new InputSource(connection.getInputStream()));
                    this.entries=handler.getEntries();
                }
                catch(SAXException e) {
                    throw new RuntimeException("Unexpected error parsing ListAllMyBuckets xml", e);
                }
View Full Code Here

Examples of org.xml.sax.XMLReader

   
    // Create a SAXParser
    SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setNamespaceAware(true);
        spf.setValidating(true);
        XMLReader reader = null;

    // set the features on the parser
    try{
          SAXParser parser = spf.newSAXParser();
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", nameSpaceMap.keySet().toArray())//$NON-NLS-1$
          reader = parser.getXMLReader();
    } catch (SAXException err) {
            throw new TeiidComponentException(err);
        } catch (ParserConfigurationException err) {
            throw new TeiidComponentException(err);
        }
   
    // place the schema into the customized entity resolver so that we can
    // resolve the schema elements
    EntityResolver xmlEntityResolver = new MultiEntityResolver(nameSpaceMap);
    reader.setEntityResolver(xmlEntityResolver);

    // Create the specialized error handler so that we can get any warnings,
    // errors, or fatal errors back from validation
    MMErrorHandler errorHandler = new MMErrorHandler();   
    reader.setErrorHandler(errorHandler);
   
    // create the input stream for the xml document to be parsed
    InputSource source = new InputSource(xmlStream);
   
    try{
        reader.parse(source);
    } catch(SAXException se){
      throw new TeiidComponentException(se);
    } catch(IOException io){
      throw new TeiidComponentException(io);
    }
View Full Code Here

Examples of org.xml.sax.XMLReader

    }
    byte[] b = bArray.toByteArray();
    try {
      ParseErrorHandler errHandler = new ParseErrorHandler();
      errHandler.setExitOnError(false);
      XMLReader parser = (XMLReader)Class.forName(parserName).newInstance();
      parser.setFeature("http://xml.org/sax/features/validation",true);
      parser.setErrorHandler(errHandler);
      parser.parse(new InputSource(new ByteArrayInputStream(b)));
      if (errHandler.hasErrors()) {
        return false;
      }
      logger.debug("XML Document is valid!");
      return true;
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.