Android Open Source - markj Jw Xml Loader






From Project

Back to project page markj.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project markj listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.markjmind.mobile.api.android.xml;
//www .j a  va2 s. c  o m
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

import android.content.Context;

/**
 * start : 2013.11.16<br>
 * <br>
 * 
 * @author ???
 * @version 2013.11.16
 */
public class JwXmlLoader {
  public String charSet = "UTF-8";
  private DefaultHandler dataHandler;
  
  public JwXmlLoader(DefaultHandler dataHandler){
    setDataHandler(dataHandler);
  }
  
  public void setDataHandler(DefaultHandler dataHandler){
    this.dataHandler = dataHandler;
  }
  
  public DefaultHandler getDataHandler(){
    return dataHandler;
  }
  
  public String readXml(InputStream xmlInputStream) throws ParserConfigurationException, SAXException, IOException{
    SAXParserFactory saxPF = SAXParserFactory.newInstance(); 
      SAXParser saxP = saxPF.newSAXParser();
      XMLReader xmlR = saxP.getXMLReader();
      xmlR.setContentHandler(dataHandler);
      xmlR.parse(new InputSource(xmlInputStream));
      return dataHandler.toString();
  }
  
  public String readXml(Context context, int R_raw_id) throws ParserConfigurationException, SAXException, IOException{
      return readXml(JwXmlResoure.getStream(context, R_raw_id));
  }
  
  public String readXml(String xml) throws ParserConfigurationException, SAXException, IOException{
       InputStream is = new ByteArrayInputStream(xml.getBytes(charSet));
       return readXml(is);
  }
  public String readXml(URL url) throws IOException, ParserConfigurationException, SAXException{
    InputStream is = url.openStream();
    return readXml(is);
  }
  
  public static String readXml(InputStream xmlInputStream, DefaultHandler dataHandler) throws ParserConfigurationException, SAXException, IOException{
    SAXParserFactory saxPF = SAXParserFactory.newInstance(); 
      SAXParser saxP = saxPF.newSAXParser();
      XMLReader xmlR = saxP.getXMLReader();
      xmlR.setContentHandler(dataHandler);
      xmlR.parse(new InputSource(xmlInputStream));
      return dataHandler.toString();
  }
  
  public static String readXml(Context context, int R_raw_id,DefaultHandler dataHandler) throws ParserConfigurationException, SAXException, IOException{
      return readXml(JwXmlResoure.getStream(context, R_raw_id),dataHandler);
  }
  
  public static String readXml(String xml, DefaultHandler dataHandler, String charSet) throws ParserConfigurationException, SAXException, IOException{
       InputStream is = new ByteArrayInputStream(xml.getBytes(charSet));
       return readXml(is,dataHandler);
  }
  public static String readXml(String xml, DefaultHandler dataHandler) throws ParserConfigurationException, SAXException, IOException{
       InputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
       return readXml(is,dataHandler);
  }
  public static String readXml(URL url, DefaultHandler dataHandler) throws IOException, ParserConfigurationException, SAXException{
    InputStream is = url.openStream();
    return readXml(is,dataHandler);
  }
}




Java Source Code List

com.markjmind.mobile.api.android.controller.JwAsyncTask.java
com.markjmind.mobile.api.android.controller.JwMapperException.java
com.markjmind.mobile.api.android.controller.JwMemberMapper.java
com.markjmind.mobile.api.android.controller.JwStringID.java
com.markjmind.mobile.api.android.controller.JwViewController.java
com.markjmind.mobile.api.android.controller.JwViewerCache.java
com.markjmind.mobile.api.android.controller.JwViewer.java
com.markjmind.mobile.api.android.controller.Jwc.java
com.markjmind.mobile.api.android.controller.OnClickListenerReceiver.java
com.markjmind.mobile.api.android.controller.ViewerXmlMapper.java
com.markjmind.mobile.api.android.exception.JwErrorCode.java
com.markjmind.mobile.api.android.exception.JwException.java
com.markjmind.mobile.api.android.json.JSONMsgString.java
com.markjmind.mobile.api.android.json.JwJOSNTreeArray.java
com.markjmind.mobile.api.android.json.JwJSONReader.java
com.markjmind.mobile.api.android.ui.JwAnimation.java
com.markjmind.mobile.api.android.ui.JwGroup.java
com.markjmind.mobile.api.android.ui.JwMenu.java
com.markjmind.mobile.api.android.ui.JwOnGroupSelect.java
com.markjmind.mobile.api.android.ui.JwTabGroup.java
com.markjmind.mobile.api.android.ui.JwTouchGroupListener.java
com.markjmind.mobile.api.android.ui.JwTouchGroup.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroupLisener.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroup.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphBoard.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.HBackLineSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.LineGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.PieGraph.java
com.markjmind.mobile.api.android.ui.drawgraph.RectGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.SimpleStyle.java
com.markjmind.mobile.api.android.ui.drawgraph.TextArraySkin.java
com.markjmind.mobile.api.android.ui.drawgraph.VBackLineSkin.java
com.markjmind.mobile.api.android.ui.graph.Arc.java
com.markjmind.mobile.api.android.ui.graph.BarElement.java
com.markjmind.mobile.api.android.ui.graph.BarLayout.java
com.markjmind.mobile.api.android.ui.graph.Bar.java
com.markjmind.mobile.api.android.ui.graph.IPieSkin.java
com.markjmind.mobile.api.android.ui.graph.LineLayout.java
com.markjmind.mobile.api.android.ui.graph.MeasureLayout.java
com.markjmind.mobile.api.android.ui.graph.PieArcRoundSkin.java
com.markjmind.mobile.api.android.ui.graph.PieLayout.java
com.markjmind.mobile.api.android.ui.graph.PiePercentSkin.java
com.markjmind.mobile.api.android.ui.view.JwBaseDropDown.java
com.markjmind.mobile.api.android.ui.view.JwDropDown.java
com.markjmind.mobile.api.android.ui.view.JwSlidingLayout.java
com.markjmind.mobile.api.android.ui.view.JwWheelView.java
com.markjmind.mobile.api.android.ui.view.StickerListener.java
com.markjmind.mobile.api.android.ui.view.StickerView.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewAutoScale.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewFonts.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewWrapScale.java
com.markjmind.mobile.api.android.ui.wrapper.JwAlertDialog.java
com.markjmind.mobile.api.android.ui.wrapper.JwToast.java
com.markjmind.mobile.api.android.util.JwFile.java
com.markjmind.mobile.api.android.util.JwPreferenceList.java
com.markjmind.mobile.api.android.util.JwPreference.java
com.markjmind.mobile.api.android.util.JwSound.java
com.markjmind.mobile.api.android.util.JwTextUtils.java
com.markjmind.mobile.api.android.util.PhoneInfo.java
com.markjmind.mobile.api.android.util.WebConnection.java
com.markjmind.mobile.api.android.xml.JwDomHandler.java
com.markjmind.mobile.api.android.xml.JwDomLoader.java
com.markjmind.mobile.api.android.xml.JwEditElementHandler.java
com.markjmind.mobile.api.android.xml.JwXmlLoader.java
com.markjmind.mobile.api.android.xml.JwXmlResoure.java
com.markjmind.mobile.api.hub.ArrayJDhub.java
com.markjmind.mobile.api.hub.DBhub.java
com.markjmind.mobile.api.hub.JDhub.java
com.markjmind.mobile.api.hub.Loader.java
com.markjmind.mobile.api.hub.StoreList.java
com.markjmind.mobile.api.hub.Store.java