Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.LocatorImpl


   *
   * @param document DOCUMENT ME!
   * @throws SAXException DOCUMENT ME!
   */
  protected void documentLocator(Document document) throws SAXException {
    LocatorImpl locator = new LocatorImpl();

    String publicID = null;
    String systemID = null;
    DocumentType docType = document.getDocType();

    if (docType != null) {
      publicID = docType.getPublicID();
      systemID = docType.getSystemID();
    }

    if (publicID != null) {
      locator.setPublicId(publicID);
    }

    if (systemID != null) {
      locator.setSystemId(systemID);
    }

    locator.setLineNumber(-1);
    locator.setColumnNumber(-1);

    contentHandler.setDocumentLocator(locator);
  }
View Full Code Here


  private void pushTextFile(File inFile) throws Exception
  {
    try
    {
      LocatorImpl locator = new LocatorImpl();

      locator.setSystemId(inFile.toURL().toString());
      locator.setLineNumber(1);
      locator.setColumnNumber(1);

      this.parser.setDocumentLocator(locator);
      this.parser.startDocument();
      this.parser.startElement("http://chaperon.sourceforge.net/schema/text/1.0", "text", "text",
                               new AttributesImpl());

      LineNumberReader reader =
        new LineNumberReader(new InputStreamReader(new FileInputStream(inFile)));

      String line;
      String 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);
        this.parser.characters(line.toCharArray(), 0, line.length());

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

  {
    this.locator = locator;

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

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

    lexer.setContentHandler(parser);
    parser.setContentHandler(serializer);

    // Push text into this pipeline
    // Create locator, which help to find possible syntax errors
    LocatorImpl locator = new LocatorImpl();
    locator.setSystemId(inFile.toURL().toString());
    locator.setLineNumber(1);
    locator.setColumnNumber(1);
    lexer.setDocumentLocator(locator);

    // Start document
    lexer.startDocument();

    // Start 'text' element, which the parser dispatch
    lexer.startElement("http://chaperon.sourceforge.net/schema/text/1.0", "text", "text",
                       new AttributesImpl());

    LineNumberReader reader =
      new LineNumberReader(new InputStreamReader(new FileInputStream(inFile)));

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

    // Push text
    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);
      lexer.characters(line.toCharArray(), 0, line.length());

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

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

  {
    this.locator = locator;

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

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

  {
    this.locator = locator;

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

        return handler.root;
    }

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

TOP

Related Classes of org.xml.sax.helpers.LocatorImpl

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.