Package javax.xml.parsers

Examples of javax.xml.parsers.SAXParserFactory.newSAXParser()


    list = new LinkedList<DefaultItem>();
    // Use the default (non-validating) parser
    final SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
      // Parse the input
      final SAXParser saxParser = factory.newSAXParser();

      final InputStream is = ItemsXMLLoader.class.getResourceAsStream(uri.getPath());

      if (is == null) {
        throw new FileNotFoundException("cannot find resource '" + uri
View Full Code Here


    list = new LinkedList<DefaultCreature>();
    // Use the default (non-validating) parser
    final SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
      // Parse the input
      final SAXParser saxParser = factory.newSAXParser();

      InputStream is = CreaturesXMLLoader.class.getResourceAsStream(ref.getPath());

      if (is == null) {
        throw new FileNotFoundException("cannot find resource '" + ref
View Full Code Here

    loadedSpells = new LinkedList<DefaultSpell>();
    // Use the default (non-validating) parser
    final SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
      // Parse the input
      final SAXParser saxParser = factory.newSAXParser();

      final InputStream is = SpellXMLLoader.class.getResourceAsStream(uri.getPath());

      if (is == null) {
        throw new FileNotFoundException("cannot find resource '" + uri
View Full Code Here

                + keyword.replace(' ', '_').replace("%", "%25")
                + "&prop=revisions&rvprop=content&format=xml");
        final SAXParserFactory factory = SAXParserFactory.newInstance();

        // Parse the input
        final SAXParser saxParser = factory.newSAXParser();
        saxParser.parse(httpClient.getInputStream(), this);

        final String response = getText();

        if (response.startsWith("#REDIRECT")) {
View Full Code Here

        SAXParser parser;

        // Use the default (non-validating) parser
        final SAXParserFactory factory = SAXParserFactory.newInstance();
        try {
          parser = factory.newSAXParser();
          parser.parse(in, this);
        } catch (final Exception e) {
          logger.error(e);
        } finally {
          try {
View Full Code Here

   public void parse(InputStream io) throws ParserException {
      try {
         SAXParserFactory factory = SAXParserFactory.newInstance();
         factory.setValidating(true);
         factory.setNamespaceAware(true);
         SAXParser parser = factory.newSAXParser();
         XMLReader reader = parser.getXMLReader();

         reader.setContentHandler(this);
         reader.setErrorHandler(new Frame2ParseErrorHandler());
         reader.setEntityResolver(new Frame2EntityResolver());
View Full Code Here

   * @return The handler for chaining
   */
  public static <CTX extends XMLContext, D extends IXMLDocument<CTX>> CTX parse (IInputSource input, D handler, CTX context) {
    try {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      SAXParser parser = factory.newSAXParser();
     
      XMLReader<CTX> xmlHandler = new XMLReader<CTX>(handler, context);
     
      org.xml.sax.XMLReader reader = parser.getXMLReader();
      reader.setContentHandler(xmlHandler);
View Full Code Here

    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
    spf.setValidating(true);

    // Create a JAXP SAXParser
    SAXParser saxParser = spf.newSAXParser();

    // Set the schema language
    saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);

    // Set the schema source.
View Full Code Here

   * @return The same instance that was used by the document
   */
  public static Object read (InputStream in, XMLDocument document) {
    try {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      SAXParser parser = factory.newSAXParser();
     
      parser.parse(in, new XMLDocumentParser(document));
     
      return document.instance.getInstance();
    } catch (ParserConfigurationException e) {
View Full Code Here

    }

    protected void parseXml(String xmlText) throws ParserConfigurationException, SAXException, IOException {
        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
        parserFactory.setNamespaceAware(true);
        SAXParser parser = parserFactory.newSAXParser();
        XMLReader xmlReader = parser.getXMLReader();
        xmlReader.setContentHandler(filter);
        xmlReader.setDTDHandler(filter);
        xmlReader.parse(new InputSource(new StringReader(xmlText)));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.