Examples of LocatorImpl


Examples of org.xml.sax.helpers.LocatorImpl

  public void setDocumentLocator(Locator locator)
  {
    this.locator = locator;
    if (locator!=null)
    {
      this.locatorImpl = new LocatorImpl(locator);
      contentHandler.setDocumentLocator(locatorImpl);
    }
  }
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

  {
    this.locator = locator;

    if (locator!=null)
    {
      this.locatorImpl = new LocatorImpl(locator);
      contentHandler.setDocumentLocator(locatorImpl);
    }
  }
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

        return handler.root;
    }

    public XmlParser() {
        this.setDocumentLocator(new LocatorImpl());
    }
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

   /** Returns a locator implementation. */
   private LocatorImpl getLocatorImpl(LocatorImpl fillin) {

      Locator here = fErrorReporter.getLocator();
      if (fillin == null)
         return new LocatorImpl(here);
      fillin.setPublicId(here.getPublicId());
      fillin.setSystemId(here.getSystemId());
      fillin.setLineNumber(here.getLineNumber());
      fillin.setColumnNumber(here.getColumnNumber());
      return fillin;
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

        Assert.assertTrue("Invalid response from interceptor", result);
    }

    @Test
    public void testCreateRequestValidationFaultAxiom() throws Exception {
        LocatorImpl locator = new LocatorImpl();
        locator.setLineNumber(0);
        locator.setColumnNumber(0);
        SAXParseException[] exceptions = new SAXParseException[]{new SAXParseException("Message 1", locator),
                new SAXParseException("Message 2", locator),};
        MessageContext messageContext = new DefaultMessageContext(new AxiomSoapMessageFactory());
        interceptor.handleRequestValidationErrors(messageContext, exceptions);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

        catch (XMLParseException e) {
            Exception ex = e.getException();
            if (ex == null || ex instanceof CharConversionException) {
                // must be a parser exception; mine it for locator info and throw
                // a SAXParseException
                LocatorImpl locatorImpl = new LocatorImpl();
                locatorImpl.setPublicId(e.getPublicId());
                locatorImpl.setSystemId(e.getExpandedSystemId());
                locatorImpl.setLineNumber(e.getLineNumber());
                locatorImpl.setColumnNumber(e.getColumnNumber());
                throw (ex == null) ?
                        new SAXParseException(e.getMessage(), locatorImpl) :
                        new SAXParseException(e.getMessage(), locatorImpl, ex);
            }
            if (ex instanceof SAXException) {
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

        catch (XMLParseException e) {
            Exception ex = e.getException();
            if (ex == null || ex instanceof CharConversionException) {
                // must be a parser exception; mine it for locator info and throw
                // a SAXParseException
                LocatorImpl locatorImpl = new LocatorImpl();
                locatorImpl.setPublicId(e.getPublicId());
                locatorImpl.setSystemId(e.getExpandedSystemId());
                locatorImpl.setLineNumber(e.getLineNumber());
                locatorImpl.setColumnNumber(e.getColumnNumber());
                throw (ex == null) ?
                        new SAXParseException(e.getMessage(), locatorImpl) :
                        new SAXParseException(e.getMessage(), locatorImpl, ex);
            }
            if (ex instanceof SAXException) {
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

    static void convertToSAXParseException(XMLParseException e) throws SAXException {
        Exception ex = e.getException();
        if (ex == null) {
            // must be a parser exception; mine it for locator info and throw
            // a SAXParseException
            LocatorImpl locatorImpl = new LocatorImpl();
            locatorImpl.setPublicId(e.getPublicId());
            locatorImpl.setSystemId(e.getExpandedSystemId());
            locatorImpl.setLineNumber(e.getLineNumber());
            locatorImpl.setColumnNumber(e.getColumnNumber());
            throw new SAXParseException(e.getMessage(), locatorImpl);
        }
        if (ex instanceof SAXException) {
            // why did we create an XMLParseException?
            throw (SAXException) ex;
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

     */
    public void parse(InputSource source,
                      ContentHandler contentHandler)
                        throws SAXException, IOException {

        LocatorImpl locator = new LocatorImpl();

        locator.setPublicId(source.getPublicId());
        locator.setSystemId(source.getSystemId());
        locator.setLineNumber(1);
        locator.setColumnNumber(1);

        contentHandler.setDocumentLocator(locator);
        contentHandler.startDocument();
        contentHandler.startPrefixMapping("", URI);

        AttributesImpl atts = new AttributesImpl();

        contentHandler.startElement(URI, "text", "text", atts);

        LineNumberReader reader = null;

        if (source.getCharacterStream()!=null) {
            reader = new LineNumberReader(source.getCharacterStream());
        } else {
            reader = new LineNumberReader(new InputStreamReader(source.getByteStream()));
        }

        String line, newline = null;
        String separator = System.getProperty("line.separator");

        while (true) {
            if (newline==null) {
                line = reader.readLine();
            } else {
                line = newline;
            }

            if (line==null) {
                break;
            }

            newline = reader.readLine();

            line = (newline!=null) ? line+separator : line;

            locator.setLineNumber(reader.getLineNumber());
            locator.setColumnNumber(1);
            contentHandler.characters(line.toCharArray(), 0, line.length());

            if (newline==null) {
                break;
            }
View Full Code Here

Examples of org.xml.sax.helpers.LocatorImpl

        } catch (SourceException se) {
            throw new ProcessingException("Error during resolving of '"+
                                          this.source+"'.", se);
        }

        LocatorImpl locator = new LocatorImpl();

        locator.setSystemId(this.inputSource.getURI());
        locator.setLineNumber(1);
        locator.setColumnNumber(1);

        contentHandler.setDocumentLocator(locator);
        contentHandler.startDocument();
        contentHandler.startPrefixMapping("", URI);

        AttributesImpl atts = new AttributesImpl();

        contentHandler.startElement(URI, "text", "text", atts);

        LineNumberReader reader = new LineNumberReader(in);
        String line, newline = null;
        String separator = System.getProperty("line.separator");

        while (true) {
            if (newline==null) {
                line = reader.readLine();
            } else {
                line = newline;
            }

            if (line==null) {
                break;
            }

            newline = reader.readLine();

            line = (newline!=null) ? line+separator : line;

            locator.setLineNumber(reader.getLineNumber());
            locator.setColumnNumber(1);
            contentHandler.characters(line.toCharArray(), 0, line.length());

            if (newline==null) {
                break;
            }
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.