Java 8 LSInput - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LSInput class.

This code example shows how to use the following methods:setStringData
        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS domLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSParser lsParser = domLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
 
        LSInput input = domLS.createLSInput();
        input.setStringData(xml);
        Document document = lsParser.parse(input);
 
        LSSerializer lsSerializer = domLS.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("comments", Boolean.FALSE);
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        return lsSerializer.writeToString(document);
    } 
 
    public static void compareXml(final String original, final String marshalled, final boolean ignoreNamespace) throws Exception {
        final String xmlOriginal;
        final String xmlMarshalled;
        if (ignoreNamespace) {
            xmlOriginal = XMLUtils.removeNamespace(original);
            xmlMarshalled = XMLUtils.removeNamespace(marshalled);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setStringData
        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS domLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSParser lsParser = domLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
 
        LSInput input = domLS.createLSInput();
        input.setStringData(xml);
        Document document = lsParser.parse(input);
 
        LSSerializer lsSerializer = domLS.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("comments", Boolean.TRUE);
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        return lsSerializer.writeToString(document);
    } 
 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setByteStream, setEncoding, setPublicId, setSystemId
    LSInput input = ls.createLSInput();
    String systemId = is.getSystemId();
    InputStream in = is.getByteStream();
    if (in != null)
      { 
        input.setByteStream(in);
      } 
    else 
      { 
        Reader reader = is.getCharacterStream();
        if (reader != null)
          { 
            input.setCharacterStream(reader);
          } 
        else 
          { 
            try 
              { 
                URL url = new URL(systemId);
                input.setByteStream(url.openStream());

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBaseURI, setByteStream, setPublicId, setSystemId
        } 
        catch( Exception e )
        { 
            throw new UnsupportedOperationException( "Internal problem. Please report to qi4j-dev forum at Google Groups.", e  );
        } 
        input.setBaseURI( baseURI );
        input.setByteStream( resource );
        input.setPublicId( publicId );
        input.setSystemId( systemId );
        return input;
    } 
 
    private LSInput getLSInput() throws Exception {
        DOMImplementationLS impl;
        DOMImplementation docImpl = builder.getDOMImplementation();
        // Try to get the DOMImplementation from doc first before 
        // defaulting to the sun implementation. 
        if (docImpl != null && docImpl.hasFeature("LS", "3.0")) {
            impl = (DOMImplementationLS)docImpl.getFeature("LS", "3.0");
        } else { 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getBaseURI, getByteStream, getCharacterStream, getEncoding, getPublicId
                        resourceIdentifier.getNamespace(),
                        resourceIdentifier.getPublicId(),
                        resourceIdentifier.getLiteralSystemId(),
                        resourceIdentifier.getBaseSystemId());
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = inputSource.getBaseURI();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                String data = inputSource.getStringData();
 
                /** 
                 * An LSParser looks at inputs specified in LSInput in 
                 * the following order: characterStream, byteStream, 
                 * stringData, systemId, publicId. 
                 */           
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getByteStream, getPublicId, getSystemId
        assertThat(outcome, is(nullValue()));
    } 
 
    private void assertCommon(LSInput outcome)
    { 
        assertThat(outcome.getByteStream(), is(not(nullValue())));
        assertThat(outcome.getSystemId(), is(not(nullValue())));
        assertThat(outcome.getPublicId(), is(IDENTIFIER_PUBLIC_ID));
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getBaseURI, getByteStream, getCharacterStream, getEncoding, getPublicId
                        resourceIdentifier.getNamespace(),
                        resourceIdentifier.getPublicId(),
                        resourceIdentifier.getLiteralSystemId(),
                        resourceIdentifier.getBaseSystemId());
            if (inputSource != null) {
                String publicId = inputSource.getPublicId();
                String systemId = inputSource.getSystemId();
                String baseSystemId = inputSource.getBaseURI();
                InputStream byteStream = inputSource.getByteStream();
                Reader charStream = inputSource.getCharacterStream();
                String encoding = inputSource.getEncoding();
                String data = inputSource.getStringData();
 
                /** 
                 * An LSParser looks at inputs specified in LSInput in 
                 * the following order: characterStream, byteStream, 
                 * stringData, systemId, publicId. 
                 */           
                XMLInputSource xmlInputSource =
                    new XMLInputSource(publicId, systemId, baseSystemId);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setByteStream, setEncoding, setPublicId, setSystemId
    LSInput input = ls.createLSInput();
    String systemId = is.getSystemId();
    InputStream in = is.getByteStream();
    if (in != null)
      { 
        input.setByteStream(in);
      } 
    else 
      { 
        Reader reader = is.getCharacterStream();
        if (reader != null)
          { 
            input.setCharacterStream(reader);
          } 
        else 
          { 
            try 
              { 
                URL url = new URL(systemId);
                input.setByteStream(url.openStream());

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getSystemId
        eventSink = null;
        throw new DomLSException(LSException.PARSE_ERR, e);
      } 
    // return document 
    Document ret = eventSink.doc;
    String systemId = input.getSystemId();
    if (systemId != null && ret instanceof DomDocument)
      { 
        ((DomDocument) ret).setDocumentURI(systemId);
      } 
    eventSink = null;
    return ret;
  } 
 
  private XMLReader getXMLReader()
    throws LSException 
  { 
    if (reader == null)
      { 
        factory.setNamespaceAware(namespaceAware);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setByteStream, setSystemId
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 LSInput Methods: