javax.xml.parsers.FactoryConfigurationError Java Examples

The following examples show how to use javax.xml.parsers.FactoryConfigurationError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 */
private void doConfigure(final InputSource inputSource, final LoggerRepository repository)
        throws FactoryConfigurationError {

   if (inputSource.getSystemId() == null) {
      inputSource.setSystemId("dummy://log4j.dtd");
   }
   final ParseAction action = new ParseAction() {

      public Document parse(final DocumentBuilder parser) throws SAXException, IOException {

         return parser.parse(inputSource);
      }


      public String toString() {

         //noinspection ObjectToString
         return "input source [" + inputSource + ']';
      }
   };
   doConfigure(action, repository);
}
 
Example #2
Source File: XMLParserActivator.java    From concierge with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Register DOM Parser Factory Services with the framework.
 * 
 * @param parserFactoryClassNames - a {@code List} of {@code String} objects
 *        containing the names of the parser Factory Classes
 * @throws FactoryConfigurationError if thrown from {@code getFactory}
 */
private void registerDOMParsers(List parserFactoryClassNames) throws FactoryConfigurationError {
	Iterator e = parserFactoryClassNames.iterator();
	int index = 0;
	while (e.hasNext()) {
		String parserFactoryClassName = (String) e.next();
		// create a dom parser factory just to get it's default
		// properties. It will never be used since
		// this class will operate as a service factory and give each
		// service requestor it's own DocumentBuilderFactory
		DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
		Hashtable properties = new Hashtable(7);
		// figure out the default properties of the parser
		setDefaultDOMProperties(factory, properties, index);
		// store the parser factory class name in the properties so that
		// it can be retrieved when getService is called
		// to return a parser factory
		properties.put(FACTORYNAMEKEY, parserFactoryClassName);
		// register the factory as a service
		context.registerService(DOMFACTORYNAME, this, properties);
		index++;
	}
}
 
Example #3
Source File: TrackWriterTest.java    From mytracks with Apache License 2.0 6 votes vote down vote up
/**
 * Parses the given XML contents and returns a DOM {@link Document} for it.
 */
protected Document parseXmlDocument(String contents)
    throws FactoryConfigurationError, ParserConfigurationException,
        SAXException, IOException {
  DocumentBuilderFactory builderFactory =
      DocumentBuilderFactory.newInstance();
  builderFactory.setCoalescing(true);
  // TODO: Somehow do XML validation on Android
  // builderFactory.setValidating(true);
  builderFactory.setNamespaceAware(true);
  builderFactory.setIgnoringComments(true);
  builderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder();
  Document doc = documentBuilder.parse(
      new InputSource(new StringReader(contents)));
  return doc;
}
 
Example #4
Source File: PacketParserUtilsTest.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Test
public void parseElementMultipleNamespace()
                throws ParserConfigurationException,
                FactoryConfigurationError, XmlPullParserException,
                IOException, TransformerException, SAXException {
    // @formatter:off
    final String stanza = XMLBuilder.create("outer", "outerNamespace").a("outerAttribute", "outerValue")
                    .element("inner", "innerNamespace").a("innerAttribute", "innerValue")
                        .element("innermost")
                            .t("some text")
                    .asString();
    // @formatter:on
    XmlPullParser parser = TestUtils.getParser(stanza, "outer");
    CharSequence result = PacketParserUtils.parseElement(parser, true);
    assertXmlSimilar(stanza, result.toString());
}
 
Example #5
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   Configure log4j by reading in a log4j.dtd compliant XML
   configuration file.

*/
public
void doConfigure(final InputStream inputStream, LoggerRepository repository) 
                                        throws FactoryConfigurationError {
    ParseAction action = new ParseAction() {
        public Document parse(final DocumentBuilder parser) throws SAXException, IOException {
            InputSource inputSource = new InputSource(inputStream);
            inputSource.setSystemId("dummy://log4j.dtd");
            return parser.parse(inputSource);
        }
        public String toString() { 
            return "input stream [" + inputStream.toString() + "]"; 
        }
    };
    doConfigure(action, repository);
}
 
Example #6
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   Configure log4j by reading in a log4j.dtd compliant XML
   configuration file.

*/
public
void doConfigure(final Reader reader, LoggerRepository repository) 
                                        throws FactoryConfigurationError {
    ParseAction action = new ParseAction() {
        public Document parse(final DocumentBuilder parser) throws SAXException, IOException {
            InputSource inputSource = new InputSource(reader);
            inputSource.setSystemId("dummy://log4j.dtd");
            return parser.parse(inputSource);
        }
        public String toString() { 
            return "reader [" + reader.toString() + "]"; 
        }
    };
  doConfigure(action, repository);
}
 
Example #7
Source File: TableAdmin.java    From incubator-retired-blur with Apache License 2.0 6 votes vote down vote up
private void reloadConfig() throws MalformedURLException, FactoryConfigurationError, BException {
  String blurHome = System.getenv("BLUR_HOME");
  if (blurHome != null) {
    File blurHomeFile = new File(blurHome);
    if (blurHomeFile.exists()) {
      File log4jFile = new File(new File(blurHomeFile, "conf"), "log4j.xml");
      if (log4jFile.exists()) {
        LOG.info("Reseting log4j config from [{0}]", log4jFile);
        LogManager.resetConfiguration();
        DOMConfigurator.configure(log4jFile.toURI().toURL());
        return;
      }
    }
  }
  URL url = TableAdmin.class.getResource("/log4j.xml");
  if (url != null) {
    LOG.info("Reseting log4j config from classpath resource [{0}]", url);
    LogManager.resetConfiguration();
    DOMConfigurator.configure(url);
    return;
  }
  throw new BException("Could not locate log4j file to reload, doing nothing.");
}
 
Example #8
Source File: Util.java    From openxds with Apache License 2.0 6 votes vote down vote up
public static OMElement parse_xml(InputStream is) throws FactoryConfigurationError, XdsInternalException {

		//		create the parser
		XMLStreamReader parser=null;

		try {
			parser = XMLInputFactory.newInstance().createXMLStreamReader(is);
		} catch (XMLStreamException e) {
			throw new XdsInternalException("Could not create XMLStreamReader from InputStream");
		} 

		//		create the builder
		StAXOMBuilder builder = new StAXOMBuilder(parser);

		//		get the root element (in this case the envelope)
		OMElement documentElement =  builder.getDocumentElement();	
		if (documentElement == null)
			throw new XdsInternalException("No document element");
		return documentElement;
	}
 
Example #9
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 */
public void doConfigure(final InputStream inputStream, final LoggerRepository repository)
        throws FactoryConfigurationError {

   final ParseAction action = new ParseAction() {

      public Document parse(final DocumentBuilder parser) throws SAXException, IOException {

         final InputSource inputSource = new InputSource(inputStream);
         inputSource.setSystemId("dummy://log4j.dtd");
         return parser.parse(inputSource);
      }


      public String toString() {

         //noinspection ObjectToString
         return "input stream [" + inputStream + ']';
      }
   };
   doConfigure(action, repository);
}
 
Example #10
Source File: XMLUtil.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates a SAX parser.
 *
 * <p>See {@link #parse} for hints on setting an entity resolver.
 *
 * @param validate if true, a validating parser is returned
 * @param namespaceAware if true, a namespace aware parser is returned
 *
 * @throws FactoryConfigurationError Application developers should never need to directly catch errors of this type.
 * @throws SAXException if a parser fulfilling given parameters can not be created
 *
 * @return XMLReader configured according to passed parameters
 */
public static synchronized XMLReader createXMLReader(boolean validate, boolean namespaceAware)
throws SAXException {
    SAXParserFactory factory = saxes[validate ? 0 : 1][namespaceAware ? 0 : 1];
    if (factory == null) {
        try {
            factory = SAXParserFactory.newInstance();
        } catch (FactoryConfigurationError err) {
            Exceptions.attachMessage(
                err, 
                "Info about thread context classloader: " + // NOI18N
                Thread.currentThread().getContextClassLoader()
            );
            throw err;
        }
        factory.setValidating(validate);
        factory.setNamespaceAware(namespaceAware);
        saxes[validate ? 0 : 1][namespaceAware ? 0 : 1] = factory;
    }

    try {
        return factory.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException ex) {
        throw new SAXException("Cannot create parser satisfying configuration parameters", ex); //NOI18N                        
    }
}
 
Example #11
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Configure log4j by reading in a log4j.dtd compliant XML configuration file.
 */
public void doConfigure(final Reader reader, final LoggerRepository repository)
        throws FactoryConfigurationError {

   final ParseAction action = new ParseAction() {

      public Document parse(final DocumentBuilder parser) throws SAXException, IOException {

         final InputSource inputSource = new InputSource(reader);
         inputSource.setSystemId("dummy://log4j.dtd");
         return parser.parse(inputSource);
      }


      public String toString() {

         //noinspection ObjectToString
         return "reader [" + reader + ']';
      }
   };
   doConfigure(action, repository);
}
 
Example #12
Source File: PacketParserUtilsTest.java    From Smack with Apache License 2.0 6 votes vote down vote up
@Disabled
@Test
public void duplicateMessageBodiesTest2()
        throws FactoryConfigurationError, XmlPullParserException, IOException, Exception {
    String defaultLanguage = Stanza.getDefaultLanguage();
    String otherLanguage = determineNonDefaultLanguage();

    // message has no language, first body no language, second body no language
    String control = XMLBuilder.create("message")
        .namespace(StreamOpen.CLIENT_NAMESPACE)
        .a("xml:lang", defaultLanguage)
        .a("from", "[email protected]/orchard")
        .a("to", "[email protected]/balcony")
        .a("id", "zid615d9")
        .a("type", "chat")
        .e("body")
            .t(defaultLanguage)
        .up()
        .e("body")
            .t(otherLanguage)
        .asString(outputProperties);

    PacketParserUtils.parseMessage(PacketParserUtils.getParserFor(control));
}
 
Example #13
Source File: DefaultAttributes.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Reads itself from XML format
 * New added - for Sandwich project (XML format instead of serialization) .
 * @param is input stream (which is parsed)
 * @return Table
 */
public void readFromXML(InputStream is, boolean validate)
throws SAXException {
    StringBuffer fileName = new StringBuffer();
    ElementHandler[] elmKeyService = { parseFirstLevel(), parseSecondLevel(fileName), parseThirdLevel(fileName) }; //
    String dtd = getClass().getClassLoader().getResource(DTD_PATH).toExternalForm();
    InnerParser parser = new InnerParser(PUBLIC_ID, dtd, elmKeyService);

    try {
        parser.parseXML(is, validate);
    } catch (Exception ioe) {
        throw (SAXException) ExternalUtil.copyAnnotation(
            new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), ioe
        );
    } catch (FactoryConfigurationError fce) {
        // ??? see http://openide.netbeans.org/servlets/ReadMsg?msgId=340881&listName=dev
        throw (SAXException) ExternalUtil.copyAnnotation(
            new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), fce
        );
    }
}
 
Example #14
Source File: XMLParserActivator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Register SAX Parser Factory Services with the framework.
 * 
 * @param parserFactoryClassNames - a <code>List</code> of
 *        <code>String</code> objects containing the names of the parser
 *        Factory Classes
 * @throws FactoryConfigurationError if thrown from <code>getFactory</code>
 */
private void registerSAXParsers(List parserFactoryClassNames)
		throws FactoryConfigurationError {
	Iterator e = parserFactoryClassNames.iterator();
	int index = 0;
	while (e.hasNext()) {
		String parserFactoryClassName = (String) e.next();
		// create a sax parser factory just to get it's default
		// properties. It will never be used since
		// this class will operate as a service factory and give each
		// service requestor it's own SaxParserFactory
		SAXParserFactory factory = (SAXParserFactory) getFactory(parserFactoryClassName);
		Hashtable properties = new Hashtable(7);
		// figure out the default properties of the parser
		setDefaultSAXProperties(factory, properties, index);
		// store the parser factory class name in the properties so that
		// it can be retrieved when getService is called
		// to return a parser factory
		properties.put(FACTORYNAMEKEY, parserFactoryClassName);
		// register the factory as a service
		context.registerService(SAXFACTORYNAME, this, properties);
		index++;
	}
}
 
Example #15
Source File: XMLParserActivator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Register DOM Parser Factory Services with the framework.
 * 
 * @param parserFactoryClassNames - a <code>List</code> of
 *        <code>String</code> objects containing the names of the parser
 *        Factory Classes
 * @throws FactoryConfigurationError if thrown from <code>getFactory</code>
 */
private void registerDOMParsers(List parserFactoryClassNames)
		throws FactoryConfigurationError {
	Iterator e = parserFactoryClassNames.iterator();
	int index = 0;
	while (e.hasNext()) {
		String parserFactoryClassName = (String) e.next();
		// create a dom parser factory just to get it's default
		// properties. It will never be used since
		// this class will operate as a service factory and give each
		// service requestor it's own DocumentBuilderFactory
		DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
		Hashtable properties = new Hashtable(7);
		// figure out the default properties of the parser
		setDefaultDOMProperties(factory, properties, index);
		// store the parser factory class name in the properties so that
		// it can be retrieved when getService is called
		// to return a parser factory
		properties.put(FACTORYNAMEKEY, parserFactoryClassName);
		// register the factory as a service
		context.registerService(DOMFACTORYNAME, this, properties);
		index++;
	}
}
 
Example #16
Source File: XMLParserActivator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Register SAX Parser Factory Services with the framework.
 * 
 * @param parserFactoryClassNames - a {@code List} of {@code String} objects
 *        containing the names of the parser Factory Classes
 * @throws FactoryConfigurationError if thrown from {@code getFactory}
 */
private void registerSAXParsers(List parserFactoryClassNames) throws FactoryConfigurationError {
	Iterator e = parserFactoryClassNames.iterator();
	int index = 0;
	while (e.hasNext()) {
		String parserFactoryClassName = (String) e.next();
		// create a sax parser factory just to get it's default
		// properties. It will never be used since
		// this class will operate as a service factory and give each
		// service requestor it's own SaxParserFactory
		SAXParserFactory factory = (SAXParserFactory) getFactory(parserFactoryClassName);
		Hashtable properties = new Hashtable(7);
		// figure out the default properties of the parser
		setDefaultSAXProperties(factory, properties, index);
		// store the parser factory class name in the properties so that
		// it can be retrieved when getService is called
		// to return a parser factory
		properties.put(FACTORYNAMEKEY, parserFactoryClassName);
		// register the factory as a service
		context.registerService(SAXFACTORYNAME, this, properties);
		index++;
	}
}
 
Example #17
Source File: FontConfigReaderTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void testFontConfigParser( ) throws IOException,
		FactoryConfigurationError, ParserConfigurationException,
		SAXException
{
	fontMappingManager = getFontMappingManager( "fontsConfigParser.xml" );
	Map fontAliases = fontMappingManager.getFontAliases( );
	assertEquals( 1, fontAliases.size( ) );
	assertEquals( "Times-Roman", fontAliases.get( "test alias" ) );

	Map compositeFonts = fontMappingManager.getCompositeFonts( );
	assertEquals( 1, compositeFonts.size( ) );
	CompositeFont testFont = (CompositeFont) compositeFonts
			.get( "test font" );
	assertEquals( "Symbol", testFont.getUsedFont( (char) 0 ) );
	assertEquals( "Symbol", testFont.getUsedFont( (char) 0x7F ) );
	assertEquals( "Helvetica", testFont.getDefaultFont( ) );
}
 
Example #18
Source File: XMLParserActivator.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Register DOM Parser Factory Services with the framework.
 * 
 * @param parserFactoryClassNames - a {@code List} of {@code String} objects
 *        containing the names of the parser Factory Classes
 * @throws FactoryConfigurationError if thrown from {@code getFactory}
 */
private void registerDOMParsers(List parserFactoryClassNames) throws FactoryConfigurationError {
	Iterator e = parserFactoryClassNames.iterator();
	int index = 0;
	while (e.hasNext()) {
		String parserFactoryClassName = (String) e.next();
		// create a dom parser factory just to get it's default
		// properties. It will never be used since
		// this class will operate as a service factory and give each
		// service requestor it's own DocumentBuilderFactory
		DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
		Hashtable properties = new Hashtable(7);
		// figure out the default properties of the parser
		setDefaultDOMProperties(factory, properties, index);
		// store the parser factory class name in the properties so that
		// it can be retrieved when getService is called
		// to return a parser factory
		properties.put(FACTORYNAMEKEY, parserFactoryClassName);
		// register the factory as a service
		context.registerService(DOMFACTORYNAME, this, properties);
		index++;
	}
}
 
Example #19
Source File: DOMUtil.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example #20
Source File: CoreTestSpringModuleConfig.java    From herd with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void initialize() throws MalformedURLException, FactoryConfigurationError
{
    /*
     * Explicitly set the log4j configuration file location. This configuration is only necessary at the core layer of the application. The higher layers
     * will use the configurer override provided by the DAO layer test configurations.
     */
    loggingHelper.initLogging("test", "classpath:herd-log4j-test.xml");
}
 
Example #21
Source File: JAXBContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
static Document createDom(boolean disableSecurityProcessing) {
    synchronized(JAXBContextImpl.class) {
        if(db==null) {
            try {
                DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(disableSecurityProcessing);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // impossible
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example #22
Source File: TestValidatorTest2.java    From openxds with Apache License 2.0 5 votes vote down vote up
public void testTopElement() throws XdsInternalException, FactoryConfigurationError, IOException {
	List<ZipEntry> content = getContentEntries(zip);
	for (int i=0; i<content.size(); i++) {
		ZipEntry entry = content.get(i);
		String entryName = entry.toString();
		InputStream is = zip.getInputStream(entry);
		String entryString = Io.getStringFromInputStream(is);
		System.out.println("entryString = " + entryString.substring(0, min(entryString.length(), 25)));
		OMElement entryElement = Util.parse_xml(entryString);
		assertTrue("name is " + entryElement.getLocalName(),
				entryElement.getLocalName().equals("TestResults"));
	}
}
 
Example #23
Source File: FontConfigReaderTest.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void testFontMapWhenAllFontsNotDefined( ) throws IOException,
		FactoryConfigurationError, ParserConfigurationException,
		SAXException
{
	fontMappingManager = getFontMappingManager( "fontsConfig2.xml" );

	// alias: defined; composite-font: defined; block: defined; character:
	// defined by the block font.
	assertTrue( isMappedTo( '1', "alias1", "Courier" ) );
	// alias: defined; composite-font: defined; block: defined; character:
	// not defined by the block font.
	assertTrue( isMappedTo( (char) 0xe81, "alias1", "Courier" ) );
	// alias: defined; composite-font: defined; block: not; character:
	// not defined by the logical font.
	assertTrue( isMappedTo( (char) 0x80, "alias1", "Times Roman" ) );
	// alias: defined; composite-font: not; character: defined by the
	// logical font.
	assertTrue( isMappedTo( '1', "alias2", "Helvetica" ) );

	// alias: not; composite-font: defined; block: defined; character:
	// defined by the block font.
	assertTrue( isMappedTo( '1', "Symbol", "Courier" ) );
	// alias: not; composite-font: defined; block: defined; character:
	// not defined by the block font.
	assertTrue( isMappedTo( (char) 0xe81, "Symbol", "Courier" ) );
	// alias: not; composite-font: defined; block: not; character:
	// not defined by the logical font.
	assertTrue( isMappedTo( (char) 0x80, "Symbol", "Times Roman" ) );
	// alias: not; composite-font: not; character: defined by the logical
	// font.
	assertTrue( isMappedTo( '1', "Helvetica", "Helvetica" ) );
}
 
Example #24
Source File: ServiceFinder.java    From openxds with Apache License 2.0 5 votes vote down vote up
public ServiceFinder(String endpoint, String action) throws FactoryConfigurationError, Exception {
	services = Util.parse_xml(serviceFile);
	Class<?>[] parmTypes = { Class.forName("org.apache.axiom.om.OMElement") };
	clas = getClass(endpoint, action);
	String serviceName = getServiceName(endpoint);
	OMElement serviceEle = getServiceDef(serviceName);
	methodName = getMethodName(serviceEle, action);
	try {
	meth = clas.getMethod(methodName, parmTypes);
	} catch (NoSuchMethodException e) {
		log.error(ExceptionUtil.exception_details(e));
		throw new Exception("ServiceFinder: endpoint=" + endpoint + " action=" + action + " class=" + clas.getName() + " method=" + methodName, e);
	}
	//System.out.println("ServiceFinder: launching " + clas.getName() + "#" + meth.getName());
}
 
Example #25
Source File: Shibboleth3ConfService.java    From oxTrust with MIT License 5 votes vote down vote up
protected void initProfileConfiguration(GluuSAMLTrustRelationship trustRelationship)
		throws FactoryConfigurationError {
	try {
		filterService.parseFilters(trustRelationship);
		profileConfigurationService.parseProfileConfigurations(trustRelationship);
	} catch (Exception e) {
		log.error("Failed to parse stored metadataFilter configuration for trustRelationship "
				+ trustRelationship.getDn(), e);
	}
}
 
Example #26
Source File: JAXBContextImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
static Document createDom(boolean disableSecurityProcessing) {
    synchronized(JAXBContextImpl.class) {
        if(db==null) {
            try {
                DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(disableSecurityProcessing);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // impossible
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example #27
Source File: TestkitWalker.java    From openxds with Apache License 2.0 5 votes vote down vote up
void walkTestPlan(File testPlanFile) throws FactoryConfigurationError, Exception {
	OMElement testplanEle = Util.parse_xml(testPlanFile);

	List<OMElement> steps = MetadataSupport.childrenWithLocalName(testplanEle, "TestStep");

	for(int i=0; i<steps.size(); i++) {
		OMElement stepEle = steps.get(i);
		doStep(stepEle.getLocalName());
	}

}
 
Example #28
Source File: JAXBContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
static Document createDom(boolean disableSecurityProcessing) {
    synchronized(JAXBContextImpl.class) {
        if(db==null) {
            try {
                DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(disableSecurityProcessing);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // impossible
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example #29
Source File: DOMUtil.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
public static Document createDom() {
    synchronized (DOMUtil.class) {
        if (db == null) {
            try {
                DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
                dbf.setNamespaceAware(true);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}
 
Example #30
Source File: JAXBContextImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new DOM document.
 */
static Document createDom(boolean disableSecurityProcessing) {
    synchronized(JAXBContextImpl.class) {
        if(db==null) {
            try {
                DocumentBuilderFactory dbf = XmlFactory.createDocumentBuilderFactory(disableSecurityProcessing);
                db = dbf.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // impossible
                throw new FactoryConfigurationError(e);
            }
        }
        return db.newDocument();
    }
}