Package javax.xml.transform

Examples of javax.xml.transform.SourceLocator


   */
  public static int lineNumber(ExpressionContext context)
  {
    Node contextNode = context.getContextNode();
    int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
      .getSourceLocatorFor(nodeHandler);

    if (locator != null)
      return locator.getLineNumber();
    else
      return -1;
  }
View Full Code Here


    if (nodeList == null || nodeList.getLength() == 0)
      return -1;
   
    Node node = nodeList.item(0);
    int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy)node).getDTM()
      .getSourceLocatorFor(nodeHandler);

    if (locator != null)
      return locator.getLineNumber();
    else
      return -1;
  }
View Full Code Here

        }
        throw exception;
    }

    private String getMessage( TransformerException exception ) {
        SourceLocator locator = exception.getLocator();

        if ( null != locator ) {
            // System.out.println("Parser fatal error: "+exception.getMessage());
            String id = ( locator.getPublicId() != locator.getPublicId() )
                    ? locator.getPublicId()
                    : ( null != locator.getSystemId() )
                    ? locator.getSystemId() : "SystemId Unknown";
            return new StringBuffer( "Error in TraxTransformer: " )
                    .append( id ).append( "; Line " ).append( locator.getLineNumber() )
                    .append( "; Column " ).append( locator.getColumnNumber() )
                    .append( "; " ).toString();
        }
        return "Error in TraxTransformer: " + exception;
    }
View Full Code Here

        }
        throw exception;
    }

    private String getMessage( TransformerException exception ) {
        SourceLocator locator = exception.getLocator();

        if ( null != locator ) {
            // System.out.println("Parser fatal error: "+exception.getMessage());
            String id = ( locator.getPublicId() != locator.getPublicId() )
                    ? locator.getPublicId()
                    : ( null != locator.getSystemId() )
                    ? locator.getSystemId() : "SystemId Unknown";
            return new StringBuffer( "Error in TraxTransformer: " )
                    .append( id ).append( "; Line " ).append( locator.getLineNumber() )
                    .append( "; Column " ).append( locator.getColumnNumber() )
                    .append( "; " ).toString();
        }
        return "Error in TraxTransformer: " + exception;
    }
View Full Code Here

            n.addExtraDescription("line"    , String.valueOf(saxParseException.getLineNumber())  );
            n.addExtraDescription("column"  , String.valueOf(saxParseException.getColumnNumber()));
        }
        else if (rootCauseThrowable instanceof TransformerException) {
            TransformerException transformerException = (TransformerException) rootCauseThrowable;
            SourceLocator sourceLocator = transformerException.getLocator();
            n.setMessage         (                           transformerException.getMessage());
            n.addExtraDescription("location",                sourceLocator.getSystemId()      );
            n.addExtraDescription("line"    , String.valueOf(sourceLocator.getLineNumber())   );
            n.addExtraDescription("column"  , String.valueOf(sourceLocator.getColumnNumber()) );
        }
        else{
                n.setMessage(t.getMessage());
         }
       
View Full Code Here

        if (logger == null) {
            return;
        }

        StringBuffer msg = new StringBuffer();
        SourceLocator locator = e.getLocator();
        if (locator != null) {
            String systemid = locator.getSystemId();
            if (systemid != null) {
                String url = systemid;
                if (url.startsWith("file:")) {
                    url = FileUtils.getFileUtils().fromURI(url);
                }
                msg.append(url);
            } else {
                msg.append("Unknown file");
            }
            int line = locator.getLineNumber();
            if (line != -1) {
                msg.append(":");
                msg.append(line);
                int column = locator.getColumnNumber();
                if (column != -1) {
                    msg.append(":");
                    msg.append(column);
                }
            }
View Full Code Here

  public void endElement(
          StylesheetHandler handler, String uri, String localName, String rawName)
            throws SAXException
  {
   ElemTemplateElement function = handler.getElemTemplateElement();
   SourceLocator locator = handler.getLocator();
   validate(function, handler); // may throw exception
   super.endElement(handler, uri, localName, rawName);  
  }
View Full Code Here

    if (m_traceSelection) {
        ElemTemplateElement ete = (ElemTemplateElement) ev.m_styleNode;
        Node sourceNode = ev.m_sourceNode;

        SourceLocator locator = null;
        if (sourceNode instanceof DTMNodeProxy) {
            int nodeHandler = ((DTMNodeProxy) sourceNode).getDTMNodeNumber();
            locator =
                ((DTMNodeProxy) sourceNode).getDTM().getSourceLocatorFor(
                    nodeHandler);
View Full Code Here

      ehandler.fatalError(new TransformerException(fmsg,
                              (SAXSourceLocator)xctxt.getSAXLocator()));
    }
    else
    {
      SourceLocator slocator = xctxt.getSAXLocator();
      System.out.println(fmsg + "; file " + slocator.getSystemId()
                         + "; line " + slocator.getLineNumber() + "; column "
                         + slocator.getColumnNumber());
    }
  }
View Full Code Here

          }
          vars.setStackFrame(nextFrame);
        }
      }
     
      SourceLocator savedLocator = xctxt.getSAXLocator();

      try
      {
        xctxt.setSAXLocator(m_template);
View Full Code Here

TOP

Related Classes of javax.xml.transform.SourceLocator

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.