Package com.sun.xml.tree

Examples of com.sun.xml.tree.XmlDocumentBuilder$DtdListener


    private XMLTree parse(InputSource is, boolean validate)
    throws IOException, SAXParseException, SAXException {
        Parser parser = (validate) ?
      new ValidatingParser(true) : new Parser();
  Resolver resolver = new Resolver();
  XmlDocumentBuilder builder = new XmlDocumentBuilder();
  // Server.xml is not validated and has no DTD ( and will change for a while)
  //   URL serverURL = this.getClass().getResource(
  //             Constants.DTD.Server.Resource);
  URL webApplicationURL = this.getClass().getResource(
            Constants.WEB_XML_Resource);

//   resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
//             serverURL.toString());
  resolver.registerCatalogEntry(
      Constants.WEB_XML_PublicId,
      webApplicationURL.toString());

  try {
      // parser.setFastStandalone(true);
      parser.setEntityResolver(resolver);
      builder.setDisableNamespaces(true);
      builder.setParser(parser);
      parser.parse(is);

      doc = builder.getDocument();
  } catch (Exception e) {
      String systemId = "";
      int lineNumber = -1;
      String message = "";
      String publicId = "";
View Full Code Here


    private XMLTree parse(InputSource is, boolean validate)
    throws IOException, SAXParseException, SAXException {
        Parser parser = (validate) ?
      new ValidatingParser(true) : new Parser();
  Resolver resolver = new Resolver();
  XmlDocumentBuilder builder = new XmlDocumentBuilder();
  // Server.xml is not validated and has no DTD ( and will change for a while)
  //   URL serverURL = this.getClass().getResource(
  //             Constants.DTD.Server.Resource);
  URL webApplicationURL = this.getClass().getResource(
            WEB_XML_Resource);

//   resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
//             serverURL.toString());
  resolver.registerCatalogEntry(
      WEB_XML_PublicId,
      webApplicationURL.toString());

  try {
      // parser.setFastStandalone(true);
      parser.setEntityResolver(resolver);
      builder.setDisableNamespaces(true);
      builder.setParser(parser);
      parser.parse(is);

      doc = builder.getDocument();
  } catch (Exception e) {
      String systemId = "";
      int lineNumber = -1;
      String message = "";
      String publicId = "";
View Full Code Here

      // use custom entity resolver to locate the DTD when parsing
      ResourceEntityResolver rer = new ResourceEntityResolver();
      rer.addEntityResource("weblogic-examples-xml-jms-dtd", "workflow.dtd", getClass());
      parser.setEntityResolver(rer);

      XmlDocumentBuilder builder = new XmlDocumentBuilder();
      builder.setDisableNamespaces(true);
      builder.setParser(parser);

      // get the message and parse
      String msgText = ((TextMessage) message).getText();
      parser.parse(new InputSource(new StringReader(msgText)));
      XmlDocument doc =  (XmlDocument) builder.getDocument();
      Element root =  doc.getDocumentElement();

      if (root.getAttribute("message").equalsIgnoreCase("quit")) {
        synchronized(this) {
          quit = true;
View Full Code Here

        "weblogic-examples-xml-jms-dtd",
        "workflow.dtd",
        getClass());
      parser.setEntityResolver(rer);

      XmlDocumentBuilder builder = new XmlDocumentBuilder();
      builder.setDisableNamespaces(true);
      builder.setParser(parser);
     
      // get the message and parse
      String msgText = ((TextMessage) message).getText();
      parser.parse(new InputSource(new StringReader(msgText)));

      // get document data and display results to console
      Document doc =  builder.getDocument();
      Element root = doc.getDocumentElement();
      System.out.println("\nYou have a message in you inbox!");
      System.out.println("From: "+ root.getAttribute("sender"));
      System.out.println("Message: "+ root.getAttribute("message"));
      System.out.println("Status of message: "+ root.getAttribute("status"));
View Full Code Here

    private XMLTree parse(InputSource is, boolean validate)
    throws IOException, SAXParseException, SAXException {
        Parser parser = (validate) ?
      new ValidatingParser(true) : new Parser();
  Resolver resolver = new Resolver();
  XmlDocumentBuilder builder = new XmlDocumentBuilder();
  URL serverURL = this.getClass().getResource(
            Constants.DTD.Server.Resource);
  URL webApplicationURL = this.getClass().getResource(
            Constants.DTD.WebApplication.Resource);

  resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
            serverURL.toString());
  resolver.registerCatalogEntry(
      Constants.DTD.WebApplication.PublicId,
      webApplicationURL.toString());

  try {
      // parser.setFastStandalone(true);
      parser.setEntityResolver(resolver);
      builder.setDisableNamespaces(true);
      builder.setParser(parser);
      parser.parse(is);

      doc = builder.getDocument();
  } catch (Exception e) {
      String systemId = "";
      int lineNumber = -1;
      String message = "";
      String publicId = "";
View Full Code Here

        XmlDocument doc = null;

        try {
            SAXParser sax = SAXParserFactory.newInstance().newSAXParser();
            Parser parser = (Parser) sax.getParser();
            XmlDocumentBuilder builder = new XmlDocumentBuilder();
            builder.setIgnoringLexicalInfo(false);
            SimpleElementFactory fact = new SimpleElementFactory();
            fact.addMapping(_elementMap, ACSFactory.class.getClassLoader());

            builder.setElementFactory(fact);
           
            parser.setDocumentHandler(builder);
            parser.setEntityResolver(new Resolver());
            //parser.setErrorHandler();

            sax.parse(location.openStream(), null);

            doc = builder.getDocument();

        }
        catch(ParserConfigurationException ex) {
            ex.printStackTrace();
            throw new IOException(ex.getMessage());
View Full Code Here

    private XMLTree parse(InputSource is, boolean validate)
    throws IOException, SAXParseException, SAXException {
        Parser parser = (validate) ?
      new ValidatingParser(true) : new Parser();
  Resolver resolver = new Resolver();
  XmlDocumentBuilder builder = new XmlDocumentBuilder();
  // Server.xml is not validated and has no DTD ( and will change for a while)
  //   URL serverURL = this.getClass().getResource(
  //             Constants.DTD.Server.Resource);
  URL webApplicationURL = this.getClass().getResource(
            WEB_XML_Resource);

//   resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
//             serverURL.toString());
  resolver.registerCatalogEntry(
      WEB_XML_PublicId,
      webApplicationURL.toString());

  try {
      // parser.setFastStandalone(true);
      parser.setEntityResolver(resolver);
      builder.setDisableNamespaces(true);
      builder.setParser(parser);
      parser.parse(is);

      doc = builder.getDocument();
  } catch (Exception e) {
      String systemId = "";
      int lineNumber = -1;
      String message = "";
      String publicId = "";
View Full Code Here

TOP

Related Classes of com.sun.xml.tree.XmlDocumentBuilder$DtdListener

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.