Package javax.xml.stream

Examples of javax.xml.stream.XMLStreamException


        writeDocumentType((DocumentType) n);

        break;

      default:
        throw new XMLStreamException("Unsupported DOM4J Node: " + n);
    }
  }
View Full Code Here


    msg = "Required " + msg + ":'" + expected + "', actual " + msg + ":'" + actual + "'";
    throwXMLStreamException(msg);
  }
 
  private void throwXMLStreamException(String msg) throws XMLStreamException {
    throw new XMLStreamException(msg, getLocation());
  }
View Full Code Here

    } else if (event.isAttribute()) {
      return readAttribute(reader);
    } else if (event.isNamespace()) {
      return readNamespace(reader);
    } else {
      throw new XMLStreamException("Unsupported event: " + event);
    }
  }
View Full Code Here

              doc = factory.createDocument();
            }
          } else {
            // duplicate or misplaced xml declaration
            String msg = "Unexpected StartDocument event";
            throw new XMLStreamException(msg, event.getLocation());
          }

          break;

        case XMLStreamConstants.END_DOCUMENT:
View Full Code Here

      // read element content
      while (true) {
        if (!eventReader.hasNext()) {
          String msg = "Unexpected end of stream while reading"
              + " element content";
          throw new XMLStreamException(msg);
        }

        XMLEvent nextEvent = eventReader.peek();

        if (nextEvent.isEndElement()) {
          EndElement endElem = eventReader.nextEvent().asEndElement();

          if (!endElem.getName().equals(startTag.getName())) {
            throw new XMLStreamException("Expected "
                + startTag.getName() + " end-tag, but found"
                + endElem.getName());
          }

          break;
        }

        Node child = readNode(eventReader);
        elem.add(child);
      }

      return elem;
    } else {
      throw new XMLStreamException("Expected Element event, found: "
          + event);
    }
  }
View Full Code Here

    if (event.isAttribute()) {
      Attribute attr = (Attribute) reader.nextEvent();

      return createAttribute(null, attr);
    } else {
      throw new XMLStreamException("Expected Attribute event, found: "
          + event);
    }
  }
View Full Code Here

    if (event.isNamespace()) {
      Namespace ns = (Namespace) reader.nextEvent();

      return createNamespace(ns);
    } else {
      throw new XMLStreamException("Expected Namespace event, found: "
          + event);
    }
  }
View Full Code Here

    if (event.isCharacters()) {
      Characters characters = reader.nextEvent().asCharacters();

      return createCharacterData(characters);
    } else {
      throw new XMLStreamException("Expected Characters event, found: "
          + event);
    }
  }
View Full Code Here

    XMLEvent event = reader.peek();

    if (event instanceof Comment) {
      return createComment((Comment) reader.nextEvent());
    } else {
      throw new XMLStreamException("Expected Comment event, found: "
          + event);
    }
  }
View Full Code Here

    if (event.isEntityReference()) {
      EntityReference entityRef = (EntityReference) reader.nextEvent();

      return createEntity(entityRef);
    } else {
      throw new XMLStreamException("Expected EntityRef event, found: "
          + event);
    }
  }
View Full Code Here

TOP

Related Classes of javax.xml.stream.XMLStreamException

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.