static SoyMsgBundle parseXliffTargetMsgs ( String xliffContent ) throws SAXException { // Get a SAX parser. SAXParserFactory saxParserFactory = SAXParserFactory . newInstance ( ) ; SAXParser saxParser ; try { saxParser = saxParserFactory . newSAXParser ( ) ; } catch ( ParserConfigurationException pce ) { throw new AssertionError ( "Could not get SAX parser for XML." ) ; } // Construct the handler for SAX parsing. XliffSaxHandler xliffSaxHandler = new XliffSaxHandler ( ) ; // Parse the XLIFF content. try { saxParser . parse ( new InputSource ( new StringReader ( xliffContent ) ) , xliffSaxHandler ) ; } catch ( IOException e ) { throw new AssertionError ( "Should not fail in reading a string." ) ; } // Build a SoyMsgBundle from the parsed data (stored in xliffSaxHandler). return new SoyMsgBundleImpl ( xliffSaxHandler . getTargetLocaleString ( ) , xliffSaxHandler . getMsgs ( ) ) ; }
Parses the content of a translated XLIFF file and creates a SoyMsgBundle .