com.sun.org.apache.xalan.internal.utils.FactoryImpl Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.utils.FactoryImpl. 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: DTMManagerDefault.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #2
Source File: XPathImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private DocumentBuilder getParser() {
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware( true );
        dbf.setValidating( false );
        return dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        // this should never happen with a well-behaving JAXP implementation.
        throw new Error(e);
    }
}
 
Example #3
Source File: DTMManagerDefault.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #4
Source File: XPathImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private DocumentBuilder getParser() {
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware( true );
        dbf.setValidating( false );
        return dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        // this should never happen with a well-behaving JAXP implementation.
        throw new Error(e);
    }
}
 
Example #5
Source File: DTMManagerDefault.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #6
Source File: XPathImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private DocumentBuilder getParser() {
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware( true );
        dbf.setValidating( false );
        return dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        // this should never happen with a well-behaving JAXP implementation.
        throw new Error(e);
    }
}
 
Example #7
Source File: DTMManagerDefault.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #8
Source File: XPathImplUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parse the input source and return a Document.
 * @param source The {@code InputSource} of the document
 * @return a DOM Document
 * @throws XPathExpressionException if there is an error parsing the source.
 */
Document getDocument(InputSource source)
    throws XPathExpressionException {
    requireNonNull(source, "Source");
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware(true);
        dbf.setValidating(false);
        return dbf.newDocumentBuilder().parse(source);
    } catch (ParserConfigurationException | SAXException | IOException e) {
        throw new XPathExpressionException (e);
    }
}
 
Example #9
Source File: DTMManagerDefault.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #10
Source File: XPathImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private DocumentBuilder getParser() {
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware( true );
        dbf.setValidating( false );
        return dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        // this should never happen with a well-behaving JAXP implementation.
        throw new Error(e);
    }
}
 
Example #11
Source File: DTMManagerDefault.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #12
Source File: XPathImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private DocumentBuilder getParser() {
    try {
        // we'd really like to cache those DocumentBuilders, but we can't because:
        // 1. thread safety. parsers are not thread-safe, so at least
        //    we need one instance per a thread.
        // 2. parsers are non-reentrant, so now we are looking at having a
        // pool of parsers.
        // 3. then the class loading issue. The look-up procedure of
        //    DocumentBuilderFactory.newInstance() depends on context class loader
        //    and system properties, which may change during the execution of JVM.
        //
        // so we really have to create a fresh DocumentBuilder every time we need one
        // - KK
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
        dbf.setNamespaceAware( true );
        dbf.setValidating( false );
        return dbf.newDocumentBuilder();
    } catch (ParserConfigurationException e) {
        // this should never happen with a well-behaving JAXP implementation.
        throw new Error(e);
    }
}
 
Example #13
Source File: AbstractTranslet.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}
 
Example #14
Source File: AbstractTranslet.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}
 
Example #15
Source File: AbstractTranslet.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}
 
Example #16
Source File: AbstractTranslet.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}
 
Example #17
Source File: AbstractTranslet.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}
 
Example #18
Source File: AbstractTranslet.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public Document newDocument(String uri, String qname)
    throws ParserConfigurationException
{
    if (_domImplementation == null) {
        DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
        _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
    }
    return _domImplementation.createDocument(uri, qname, null);
}