Examples of DOMParser


Examples of org.apache.xerces.parsers.DOMParser

        throws SAXNotRecognizedException, SAXNotSupportedException
    {
        boolean doingValidation =
            (validate || (schemaLocationPropertyValue != null));

        DOMParser parser = new DOMParser();

        parser.setEntityResolver(entityResolver);
        parser.setErrorHandler(new ErrorHandlerImpl());
        parser.setFeature(DEFER_NODE_EXPANSION, false);
        parser.setFeature(NAMESPACES_FEATURE_ID, true);
        parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, doingValidation);
        parser.setFeature(VALIDATION_FEATURE_ID, doingValidation);

        if (schemaLocationPropertyValue != null) {
            parser.setProperty(
                SCHEMA_LOCATION,
                schemaLocationPropertyValue.replace('\\', '/'));
        }

        return parser;
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

            Constants.FILE_SEPERATOR).toString();

        String systemId = new File(systemString).toURL().toString();
        inputSource.setSystemId(systemId);

        DOMParser parser = new DOMParser();

        parser.setFeature("http://xml.org/sax/features/validation",
            getValidating(messageName, system));
        parser.setFeature("http://xml.org/sax/features/namespaces",
            getNamespaceAware(messageName, system));
        String schema = getXMLSchema(messageName, system);
        if (schema != null)
        {
          parser.setFeature("http://xml.org/sax/features/namespaces",
              true);
          parser.setFeature("http://xml.org/sax/features/validation",
              true);
          parser.setFeature(
              "http://apache.org/xml/features/validation/schema",
              true);
          parser
              .setProperty(
                  "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                  new StringBuffer().append(
                      Constants.XBUS_ETC)
                      .append("Schema").append(
                          Constants.FILE_SEPERATOR)
                      .append(schema).toString());
        }
        parser.setErrorHandler(new XParserErrorHandler());

        parser.parse(inputSource);
        retDocument = parser.getDocument();
      }
      catch (Exception e)
      {
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_COREBASE,
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

  Hashtable auxTable = null;
  String categoryName = null;

try {
  // The parser begins!
  DOMParser parser = new DOMParser();
  confFile = new File (confFile).getAbsolutePath();
  confFile = "file:" + confFile;
  parser.parse(confFile);
  Document doc = parser.getDocument();
 
  // Get the root's childs
  Element root = doc.getDocumentElement();
  String rootTag = root.getTagName();
  NodeList list = doc.getElementsByTagName(rootTag).item(0).getChildNodes();
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    */
   public Document docRead(String docName)
   {
  Document doc = null;  
try {
  DOMParser parser = new DOMParser();
  docName = this.dataDir + "/news/" + docName;
  docName = new File (docName).getAbsolutePath();
  docName = "file:" + docName;
 
  parser.parse(docName);
  doc = parser.getDocument();
}
catch (Exception e) {
  e.printStackTrace ();
}
  return (doc);
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

       
        private Document dom_from_xml( String xml throws Order_exception
        {
            try
            {
                DOMParser parser = new DOMParser();
                //parser.setIncludeIgnorableWhitespace( false );
                //parser.setErrorHandler();
                parser.parse( new org.xml.sax.InputSource( new StringReader( xml ) ) );
                   
                return parser.getDocument();
            }
            catch( Exception x )
            {
                throw new Order_exception( "Error while reading XML: " + x, x );
            }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

   
    //---------------------------------------------------------------------------------------------
   
    private static Document dom_from_xml( String xml throws Exception
    {
        DOMParser parser = new DOMParser();
        parser.parse( new org.xml.sax.InputSource( new StringReader( xml ) ) );
           
        return parser.getDocument();
    }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

   * @param pstrXPathExpr = if null, the full XML-String is loaded
   */
  public Properties LoadXML(JSXMLFile pobjXMLFile, String pstrXPathExpr) {
    @SuppressWarnings("unused")
    final String conMethodName = conClassName + "::LoadXML";
    DOMParser parser = new DOMParser();
    Properties objProp = new Properties();
    try {
      parser.setFeature("http://xml.org/sax/features/validation", false);
      // The parser will validate the document only if a grammar is specified.
      // parser.setFeature("http://xml.org/sax/features/validation/dynamic", true);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new JobSchedulerException(String.format("SAXException ", pobjXMLFile.getAbsolutePath()));
    }
    try {
      // parser.parse(new ByteArrayInputStream(pstrXMLAsString.getBytes()));
      parser.parse(pobjXMLFile.getAbsolutePath());
      Document document = parser.getDocument();
      if (isEmpty(pstrXPathExpr) == true) {
        traverse(document, objProp);
      }
      else {
        SOSXMLXPath xPath = new SOSXMLXPath(pobjXMLFile.getAbsolutePath());
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

   * @param reader
   * @return
   */
  public Collection readDOM (Reader reader) {
    Collection collection = new java.util.ArrayList ();
    DOMParser parser = new DOMParser ();
    try {
        parser.setErrorHandler(new MyErrorListener (_output));
      parser.parse (new InputSource(reader));
      Document doc = parser.getDocument();
      collection.add(doc.getDocumentElement());     
    } catch (Exception ex) {
      System.out.println ("XMLUtility::readDOM - " + ex);
    }
    return collection;
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    /**
     * Test createRuleExecutionSet from DOM.
     */
    public void testCreateFromElement( ) throws Exception
    {
        DOMParser parser = new DOMParser( );
        Document doc = null;
        try
        {
            parser.parse( new InputSource(
                RuleEngineTestBase.class.getResourceAsStream( bindUri ) ) );
            doc = parser.getDocument( );
        }
        catch ( SAXException e )
        {
            fail( "could not parse incoming data stream: " + e );
        }
View Full Code Here

Examples of org.apache.xerces.parsers.DOMParser

    }
   
    /** Set up the GISDisplay with the given configuration file */
    public static void readConfig(GISDisplay inDisplay, String inFileName) throws Exception{
        // read the XML document
        DOMParser parser = new DOMParser();
        parser.parse("file:///"+inFileName);
        Document tempDocument= parser.getDocument();
        Element tempRootElement = tempDocument.getDocumentElement();
        if (tempRootElement.getTagName().equals("GISToolkit")){
            gistoolkit.common.Node tempNode = getNode(tempRootElement);
            gistoolkit.common.Node tempDisplayNode = tempNode.getChild("GISDisplay");
            inDisplay.setNode(tempDisplayNode);
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.