Package org.vietspider.parser.xml

Examples of org.vietspider.parser.xml.XMLDocument


 
  public static void main(String[] args) throws Exception {
    Student student = new Student("123", "Nguyen Van A");
   
    Bean2XML bean2XML = Bean2XML.getInstance();
    XMLDocument document = bean2XML.toXMLDocument(student);
   
    String text = document.getTextValue();
    System.out.println(text);
   
   
    XML2Bean xml2Bean = XML2Bean.getInstance();
    Student student2 = xml2Bean.toBean(Student.class, text);
View Full Code Here


    byte  [] bytes = loadContent("http://www.theserverside.com/rss/theserverside-atom.xml");
    if(bytes == null) {
      System.out.println(" data is null");
      return;
    }
    XMLDocument document = XMLParser.createDocument(bytes, "utf-8", null);
    printTreeNode(document.getRoot(), 0);
  }
View Full Code Here

  public <T> T toBean(Class<T> clazz, byte [] bytes) throws Exception {
    return toBean(clazz, new String(bytes, Application.CHARSET).trim());
  }
 
  public <T> T toBean(Class<T> clazz, String value) throws Exception {
    XMLDocument document = XMLParser.createDocument(value, null);
    return toBean(clazz, document);
  }
View Full Code Here

  public XMLDocument toXMLDocument(Object bean) throws Exception {
    NodeMap map = bean.getClass().getAnnotation(NodeMap.class);
    if(map == null) return null;
    XMLNode node = new XMLNode(map.value().toCharArray(), map.value(), TypeToken.TAG);
    toXML(bean, node);
    return new XMLDocument(node);
  }
View Full Code Here

TOP

Related Classes of org.vietspider.parser.xml.XMLDocument

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.