Package net.sf.uadetector.datareader

Examples of net.sf.uadetector.datareader.XmlDataReader$XmlParser


      final Nifty nifty) throws Exception {
    try {
      long start = timeProvider.getMsTime();
      log.info("loading new nifty xml file with schemaId [" + schemaId + "]");

      XmlParser parser = new XmlParser(new MXParser());
      parser.read(inputStreamXml);

      NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser);
      niftyType.loadStyles(this, nifty);
      niftyType.loadControls(this);
View Full Code Here


      final String styleFilename,
      final NiftyType niftyType,
      final Nifty nifty) throws Exception {
    log.info("loading new nifty style xml file [" + styleFilename + "] with schemaId [" + schemaId + "]");

    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(styleFilename);
    try {
      parser.read(stream);
      NiftyStylesType niftyStylesType = (NiftyStylesType) getSchema(schemaId).loadXml(parser);
      niftyStylesType.loadStyles(this, niftyType, nifty, log);
    } finally {
      stream.close();
    }
View Full Code Here

      final String schemaId,
      final String controlFilename,
      final NiftyType niftyType) throws Exception {
    log.info("loading new nifty controls xml file [" + controlFilename + "] with schemaId [" + schemaId + "]");

    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(controlFilename);
    try {
      parser.read(stream);
      NiftyControlsType niftyControlsType = (NiftyControlsType) getSchema(schemaId).loadXml(parser);
      niftyControlsType.loadControls(this, niftyType);
    } finally {
      stream.close();
    }
View Full Code Here

  }

  public void registerSchema(final String schemaId, final InputStream inputStreamSchema) throws Exception {
    try {
      Schema niftyXmlSchema = new Schema();
      XmlParser parser = new XmlParser(new MXParser());
      parser.read(inputStreamSchema);
      parser.nextTag();
      parser.required("nxs", niftyXmlSchema);
      schemes.put(schemaId, niftyXmlSchema);
    } finally {
      inputStreamSchema.close();
    }
  }
View Full Code Here

      final XmlParser xmlParser,
      final Attributes attributes) throws Exception {
    String filename = attributes.get("filename");

    Schema niftyXmlSchema = new Schema();
    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(filename);
    try {
      parser.read(stream);
      parser.nextTag();
      parser.required("nxs", niftyXmlSchema);

      types.putAll(niftyXmlSchema.getTypes());
      xmlParser.nextTag();
    } finally {
      stream.close();
View Full Code Here

  @Test
  public void call_updateFails_fallbackIsNewer_differentVersion() throws IOException {
    final DataStore fallback = new TestXmlDataStore();

    final DataStoreWhichFallsBack store = new DataStoreWhichFallsBack(new XmlDataReader(),
        NotUpdateableXmlDataStore.DATA_URL_UNREACHABLE, NotUpdateableXmlDataStore.VERSION_URL_UNREACHABLE,
        DataStore.DEFAULT_CHARSET, fallback);

    final UpdateOperationWithCacheFileTask task = new UpdateOperationWithCacheFileTask(store, folder.newFile("cache_file.tmp"));
    assertThat(store.getData()).isSameAs(fallback.getData());
View Full Code Here

  @Test
  public void call_updateFails_fallbackNotNewer_sameVersion() throws IOException {
    final DataStore fallback = new SimpleXmlDataStore(TestXmlDataStore.DATA_URL, TestXmlDataStore.VERSION_URL);

    final DataStoreWhichFallsBack store = new DataStoreWhichFallsBack(new XmlDataReader(),
        NotUpdateableXmlDataStore.DATA_URL_UNREACHABLE, NotUpdateableXmlDataStore.VERSION_URL_UNREACHABLE,
        DataStore.DEFAULT_CHARSET, fallback);

    final UpdateOperationWithCacheFileTask task = new UpdateOperationWithCacheFileTask(store, folder.newFile("cache_file.tmp"));
    assertThat(store.getData()).isSameAs(fallback.getData());
View Full Code Here

    Check.notNull(charset, "charset");
    Check.notNull(dataUrl, "dataUrl");
    Check.notNull(fallback, "fallback");
    Check.notNull(versionUrl, "versionUrl");

    final DataReader reader = new XmlDataReader();
    final DataStore fallbackDataStore = readCacheFileAsFallback(reader, cacheFile, charset, fallback);
    return new CachingXmlDataStore(reader, dataUrl, versionUrl, charset, cacheFile, fallbackDataStore);
  }
View Full Code Here

  };

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_charset_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), null, url, url, FALLBACK);
  }
View Full Code Here

  }

  @Test(expected = IllegalNullArgumentException.class)
  public void construct_dataUrl_isNull() throws MalformedURLException {
    final URL url = new URL("http://localhost");
    new TestDataStore(new XmlDataReader(), CHARSET, null, url, FALLBACK);
  }
View Full Code Here

TOP

Related Classes of net.sf.uadetector.datareader.XmlDataReader$XmlParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.