Code example for InputSource

Methods: setEncoding

0
                        && systemId.equals("systemB")) {
                    /* 
                     * Explicitly set the encoding here or else the parser will 
                     * try to use the parent parser's encoding which is utf-16. 
                     */ 
                    InputSource inputSource = new InputSource(
                            new ByteArrayInputStream("bob".getBytes("utf-8")));
                    inputSource.setEncoding("utf-8");
                    return inputSource;
                } 
 
                throw new AssertionError();
            } 
 
            @Override 
            public void startElement(String uri, String localName, String qName,
                    Attributes attributes) throws SAXException {
                elementNames.add(localName);
            } 
 
            @Override