Package com.sun.xml.parser

Examples of com.sun.xml.parser.Parser$DocLocator


        return parse(is, DefaultXMLValidate);
    }

    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;
View Full Code Here


        return parse(is, DefaultXMLValidate);
    }

    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;
View Full Code Here

   */
  public void onMessage(Message message)
  {
    try {
      // obtain a DOM parser and associate the resolver and document builder
      Parser parser = new com.sun.xml.parser.Parser();

      // 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) {
View Full Code Here

   */
  public void onMessage(Message message)
  {
    try {
      // obtain a DOM parser and associate the resolver and document builder
      Parser parser = new com.sun.xml.parser.Parser();

      // 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)));

      // 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!");
View Full Code Here

        return parse(is, DefaultXMLValidate);
    }

    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;
View Full Code Here

    }

    public void indexDocument(URL docURL, String title) throws Exception {
  InputSource source = new InputSource(docURL.openStream());
  source.setSystemId(docURL.toString());
  Parser sourceParser = new ValidatingParser();
  sourceParser.setFastStandalone(true);
  XMLProcessorEx sourceLoader = new XMLProcessorImpl(sourceParser);
  //  long start = System.currentTimeMillis();
  Node root = sourceLoader.load(source, 0,
              _transformEngine.getSourceLoadContext(),
              _transformEngine.getNameTable());
View Full Code Here

    public ACSProjectElement load(URL location) throws IOException {
        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();
View Full Code Here

        return parse(is, DefaultXMLValidate);
    }

    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;
View Full Code Here

    }

    public void indexDocument(URL docURL, String title) throws Exception {
  InputSource source = new InputSource(docURL.openStream());
  source.setSystemId(docURL.toString());
  Parser sourceParser = new ValidatingParser();
  sourceParser.setFastStandalone(true);
  XMLProcessorEx sourceLoader = new XMLProcessorImpl(sourceParser);
  //  long start = System.currentTimeMillis();
  Node root = sourceLoader.load(source, 0,
              _transformEngine.getSourceLoadContext(),
              _transformEngine.getNameTable());
View Full Code Here

    public static XmlDocument createXmlDocument (
  InputSource in,
  boolean doValidate
    ) throws IOException, SAXException
    {
  Parser      parser;
  XmlDocumentBuilder  builder;

  try {
      if (doValidate)
    parser = new ValidatingParser (true);
      else
    parser = new Parser ();
      parser.setEntityResolver (new Resolver ());
      builder = new XmlDocumentBuilder ();
      builder.setDisableNamespaces (true);

  } catch (Exception e) {
      throw new SAXException (e);
  }

  builder.setParser (parser);
  parser.parse (in);
  return builder.getDocument ();
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.parser.Parser$DocLocator

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.