Package javax.xml.stream

Examples of javax.xml.stream.Location


     * Build current parse input position description.
     *
     * @return text description of current parse position
     */
    public String buildPositionString() {
        Location location = m_parser.getLocation();
        String base = "(line " + location.getLineNumber() + ", col " +
            location.getColumnNumber();
        if (m_docName != null) {
            base += ", in " + m_docName;
        }
        return base + ')';
    }
View Full Code Here


    }
  }

  static String getLocationInfo( XMLEventReader xmlEventReader )
  {
    Location location = getLocation( xmlEventReader);
    StringBuilder sb = new StringBuilder()
            .append( "Location: SysId[")
            .append( location.getSystemId())
            .append( "] line[")
            .append( location.getLineNumber())
            .append( "] column[" )
            .append( location.getColumnNumber())
            .append( "] charOffset[" )
            .append( location.getCharacterOffset())
            .append( "]." );
    return sb.toString();
  }
View Full Code Here

      throw new IllegalArgumentException( "XMLEventReader may not be null." );

    // ToDo Capture as valid XML since writeAsEncodedUnicode() isn't impl-ed in Sun's JDK 6u14.
    StringWriter writerUsingWriteAsEncodedUnicode = new StringWriter();
    StringWriter writerUsingToString = new StringWriter();
    Location startLocation = null;
    try
    {
      XMLEvent event = xmlEventReader.peek();
      if ( ! event.isStartElement() )
        throw new IllegalArgumentException( "Next event in reader must be start element." );
View Full Code Here

    if ( ! xmlEventReader.hasNext())
      throw new IllegalStateException( "XMLEventReader must have next.");

    StringBuilder stringBuilder = new StringBuilder();
    Location location = null;
    try
    {
      while ( xmlEventReader.hasNext() )
      {
        XMLEvent event = xmlEventReader.peek();
View Full Code Here

    factory.finishMakingDocument(doc);
       
    // Set baseURI unless already set previously by NodeFactory
    // to ensure exact same behaviour as nu.xom.Builder.build(InputSource)
    if ("".equals(doc.getBaseURI())) {
      Location loc = reader.getLocation();
      String baseURI = loc == null ? null : loc.getSystemId();
      if (baseURI != null && baseURI.length() > 0) {
        doc.setBaseURI(baseURI);
      }
    }
   
View Full Code Here

  static void wrapException(XMLStreamException ex) throws ParsingException {
    if (DEBUG) ex.printStackTrace();
    String systemID = null;
    int lineNumber = -1;
    int columnNumber = -1;
    Location location = ex.getLocation();
    if (location != null) {
      lineNumber = location.getLineNumber();
      columnNumber = location.getColumnNumber();
      systemID = location.getSystemId();
      if ("".equals(systemID)) systemID = null;
    }
   
    throw new ParsingException(ex.getMessage(),
        systemID, lineNumber, columnNumber, ex);
View Full Code Here

                    }
                }
            }
        } catch (IllegalArgumentException iae) {
            // Need to convert to a checked stream exception
            Location loc = rep.getLocation();
            String lexical = new String(buf, start, (ptr-start));
            throw new TypedXMLStreamException(lexical, iae.getMessage(), loc, iae);
        }
        return count;
    }
View Full Code Here

        if (mIdDefs == null) {
            mIdDefs = new ElementIdMap();
        }

        int idType = datatype.getIdType();
        Location loc = mContext.getValidationLocation();
        PrefixedName elemPName = getElementPName();
        PrefixedName attrPName = getAttrPName();

        if (idType == Datatype.ID_TYPE_ID) {
            String idStr = idToken.literal.trim();
View Full Code Here

    ////////////////////////////////////////////////////////
     */

    protected String getLocationDesc()
    {
        Location loc = getLocation();
        return (loc == null) ? null : loc.toString();
    }
View Full Code Here

    }

    public static WstxValidationException create(XMLValidationProblem cause)
    {
        // Should always get a message
        Location loc = cause.getLocation();
        if (loc == null) {
            return new WstxValidationException(cause, cause.getMessage());
        }
        return new WstxValidationException(cause, cause.getMessage(), loc);
    }
View Full Code Here

TOP

Related Classes of javax.xml.stream.Location

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.