Package org.codehaus.stax2

Examples of org.codehaus.stax2.LocationInfo


                }
                return;
               
            case DTD:
                {
                    DTDInfo info = sr.getDTDInfo();
                    if (info == null) {
                        // Hmmmh. It is legal for this to happen, for
                        // non-DTD-aware readers. But what is the right
                        // thing to do here?
                        throwOutputError("Current state DOCTYPE, but not DTDInfo Object returned -- reader doesn't support DTDs?");
View Full Code Here


                    char c = (text.length() == 0) ? ' ': text.charAt(text.length()-1);
                    if (c != '\r' && c != '\n') {
                        System.out.println();
                    }
                } else if (type == DTD) {
                    DTDInfo info = sr.getDTDInfo();
                    System.out.println(" DTD (root "
                                       +getNullOrStr(info.getDTDRootName())
                                       +", sysid "+getNullOrStr(info.getDTDSystemId())
                                       +", pubid "+getNullOrStr(info.getDTDPublicId())
                                       +");");
                    List<?> entities = (List<?>) sr.getProperty("javax.xml.stream.entities");
                    List<?> notations = (List<?>) sr.getProperty("javax.xml.stream.notations");
                    int entCount = (entities == null) ? -1 : entities.size();
                    int notCount = (notations == null) ? -1 : notations.size();
View Full Code Here

            return mStreamReader.getLocalName();
        case XMLStreamConstants.PROCESSING_INSTRUCTION:
            return mStreamReader.getPITarget();
        case XMLStreamConstants.DTD:
            {
                DTDInfo dtd = mStreamReader.getDTDInfo();
                return (dtd == null) ? null : dtd.getDTDRootName();
            }
        }

        return null;
    }
View Full Code Here

            ln = mStreamReader.getPITarget();
            uri = null;
            break;
        case XMLStreamConstants.DTD:
            {
                DTDInfo dtd = mStreamReader.getDTDInfo();
                ln = (dtd == null) ? null : dtd.getDTDRootName();
            }
            uri = null;
            break;
        default:
            return false;
View Full Code Here

    {
        if (!readerAccessible()) {
            throw _notAccessible("getLocation");
        }
        // Let's try to get actual exact location via Stax2 first:
        LocationInfo li = mStreamReader.getLocationInfo();
        if (li != null) {
            Location loc = li.getStartLocation();
            if (loc != null) {
                return loc;
            }
        }
        // If not, fall back to regular method
View Full Code Here

     *   to (independent of whether this cursor points to that event)
     */
    public Location getStreamLocation()
    {
        // Let's try to get actual exact location via Stax2 first:
        LocationInfo li = mStreamReader.getLocationInfo();
        if (li != null) {
            Location loc = li.getCurrentLocation();
            if (loc != null) {
                return loc;
            }
        }
        // If not, fall back to regular method
View Full Code Here

     * pointed-to event, within input stream.
     */
    public Location getEventLocation()
    {
        // Let's try to get actual exact location via Stax2 first:
        LocationInfo li = _streamReader.getLocationInfo();
        if (li != null) {
            Location loc = li.getStartLocation();
            if (loc != null) {
                return loc;
            }
        }
        // If not, fall back to regular method
View Full Code Here

     * location, for example.
     */
    public Location getStreamLocation()
    {
        // Let's try to get actual exact location via Stax2 first:
        LocationInfo li = _streamReader.getLocationInfo();
        if (li != null) {
            Location loc = li.getCurrentLocation();
            if (loc != null) {
                return loc;
            }
        }
        // If not, fall back to regular method
View Full Code Here

                    System.out.println(" Text("+text.length()+" = '"+text+"'.");
                    if (text.length() >= 1) {
                        System.out.println(" [first char code: 0x"+Integer.toHexString(text.charAt(0))+"]");
                    }

                    LocationInfo li = sr.getLocationInfo();
                    System.out.println(" [Loc, start: "+li.getStartLocation()+", end: "+li.getEndLocation()+"]");

                } else if (type == SPACE) {
                    System.out.print(" Ws = '"+text+"'.");
                    char c = (text.length() == 0) ? ' ': text.charAt(text.length()-1);
                    if (c != '\r' && c != '\n') {
View Full Code Here

            +"<!NOTATION not PUBLIC 'some-public-id'>\n"
            +"]>"
            +"<root/>";
 
        // Need to disable coalescing though for test to work:
        XMLEventReader2 er = getReader(XML, false);
        // Need to set Base URI; can do it for factory or instance
        er.setProperty(WstxInputProperties.P_BASE_URL, new URL(URI));
        assertTrue(er.nextEvent().isStartDocument());
        XMLEvent evt = er.nextEvent(); // DTD
        assertTokenType(DTD, evt.getEventType());

        DTD dtd = (DTD) evt;
        List<?> nots = dtd.getNotations();
        assertEquals(1, nots.size());
View Full Code Here

TOP

Related Classes of org.codehaus.stax2.LocationInfo

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.