精华内容
下载资源
问答
  • XML DOM解析简单示例

    2010-07-30 11:41:35
    DOM编程不要其它的依赖包,因为JDK里自带的JDK里含有org.w3c.dom、org.xml.sax 和javax.xml.parsers包就可以满意条件了。 研究好这3个包,大部分的问题都可以解决了。 一个简单示例以及分析 xml内容 [code="...
    DOM编程不要其它的依赖包,因为JDK里自带的JDK里含有org.w3c.dom、org.xml.sax 和javax.xml.parsers包就可以满意条件了。
    
    研究好这3个包,大部分的问题都可以解决了。
    一个简单示例以及分析
    xml内容
    <?xml version="1.0" encoding="gb2312"?>
    <books>
    <book email="zhoujunhui">
    <name>rjzjh</name>
    <price>jjjjjj</price>
    </book>
    </books>
    解析程序示例
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStream;

    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;

    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;

    public class DomParse {
    public DomParse(){
    DocumentBuilderFactory domfac=DocumentBuilderFactory.newInstance();
    try {
    DocumentBuilder dombuilder=domfac.newDocumentBuilder();
    InputStream is=new FileInputStream("D://hyx/sid/src/xml/library.xml");
    Document doc=dombuilder.parse(is);
    Element root=doc.getDocumentElement();
    NodeList books=root.getChildNodes();
    if(books!=null){
    for(int i=0;i<books.getLength();i++){
    Node book=books.item(i);
    if(book.getNodeType()==Node.ELEMENT_NODE){
    String email=book.getAttributes().getNamedItem("email").getNodeValue();
    System.out.println(email);
    for(Node node=book.getFirstChild();node!=null;node=node.getNextSibling()){
    if(node.getNodeType()==Node.ELEMENT_NODE){
    if(node.getNodeName().equals("name")){
    String name=node.getNodeValue();
    String name1=node.getFirstChild().getNodeValue();
    System.out.println(name);
    System.out.println(name1);
    }
    if(node.getNodeName().equals("price")){
    String price=node.getFirstChild().getNodeValue();
    System.out.println(price);
    }
    }
    }
    }
    }
    }
    } catch (ParserConfigurationException e) {
    e.printStackTrace();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (SAXException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
    public static void main(String[] args) {
    new DomParse();
    }


    }

    分析:一下(1)-(4)是解析的主要步骤,其他可以不看
    (1)得到DOM解析器的工厂实例

    DocumentBuilderFactory domfac=DocumentBuilderFactory.newInstance();
    得到javax.xml.parsers.DocumentBuilderFactory;类的实例就是我们要的解析器工厂

    (2)从DOM工厂获得DOM解析器

    DocumentBuilder dombuilder=domfac.newDocumentBuilder();
    通过javax.xml.parsers.DocumentBuilderFactory实例的静态方法newDocumentBuilder()得到DOM解析器

    (3)把要解析的XML文档转化为输入流,以便DOM解析器解析它

    InputStream is=new FileInputStream("bin/library.xml");
    InputStream是一个接口。

    (4)解析XML文档的输入流,得到一个Document

    Document doc=dombuilder.parse(is);
    由XML文档的输入流得到一个org.w3c.dom.Document对象,以后的处理都是对Document对象进行的

    (5)得到XML文档的根节点

    Element root=doc.getDocumentElement();
    在DOM中只有根节点是一个org.w3c.dom.Element对象。

    (6)得到节点的子节点

    NodeList books=root.getChildNodes();
    for(int i=0;i<books.getLength();i++){
    Node book=books.item(i);
    }
    这是用一个org.w3c.dom.NodeList接口来存放它所有子节点的,还有一种轮循子节点的方法,后面有介绍

    (7)取得节点的属性值

    String email=book.getAttributes().getNamedItem("email").getNodeValue();
    System.out.println(email);
    注意,节点的属性也是它的子节点。它的节点类型也是Node.ELEMENT_NODE

    (8)轮循子节点

    for(Node node=book.getFirstChild();node!=null;node=node.getNextSibling()){
    if(node.getNodeType()==Node.ELEMENT_NODE){
    if(node.getNodeName().equals("name")){
    String name=node.getNodeValue();
    String name1=node.getFirstChild().getNodeValue();
    System.out.println(name);
    System.out.println(name1);
    }
    if(node.getNodeName().equals("price")){
    String price=node.getFirstChild().getNodeValue();
    System.out.println(price);
    }
    }

    这段代码的打印输出为:
    null
    alterrjzjh
    jjjjjj
    从上面可以看出
    String name=node.getNodeValue();  是一个空值。而
    String name1=node.getFirstChild().getNodeValue(); 才是真正的值,这是因为DOM把<name> rjzjh</name>也当作是两层结构的节点,其父节点为<name>节点本身,且它只有一个子节点(如果有属性的话就不止 一个了!),子节点是它的值“rjzjh”,所以我们看到上面的结果。
    还有,子节点的节点类型也是Node.ELEMENT_NODE型的,node.getNextSibling()方法是取下一个相邻的节点。
    展开全文
  • ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f4a94dbd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for ...

    SpringBoot项目启动失败报错:

    ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f4a94dbd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    C:\Java\jdk1.8.0_131\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64025,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=64024 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\高明琦\.IntelliJIdea2018.2\system\captureAgent\debugger-agent.jar=file:/C:/Users/%E9%AB%98%E6%98%8E%E7%90%A6/AppData/Local/Temp/capture.props -Dfile.encoding=UTF-8 -classpath "C:\Java\jdk1.8.0_131\jre\lib\charsets.jar;C:\Java\jdk1.8.0_131\jre\lib\deploy.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;C:\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;C:\Java\jdk1.8.0_131\jre\lib\javaws.jar;C:\Java\jdk1.8.0_131\jre\lib\jce.jar;C:\Java\jdk1.8.0_131\jre\lib\jfr.jar;C:\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;C:\Java\jdk1.8.0_131\jre\lib\jsse.jar;C:\Java\jdk1.8.0_131\jre\lib\management-agent.jar;C:\Java\jdk1.8.0_131\jre\lib\plugin.jar;C:\Java\jdk1.8.0_131\jre\lib\resources.jar;C:\Java\jdk1.8.0_131\jre\lib\rt.jar;C:\project\temp\nzoth\app-service\target\classes;D:\mavenrepository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\2.0.2.RELEASE\spring-cloud-starter-netflix-eureka-client-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-starter\2.0.2.RELEASE\spring-cloud-starter-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-context\2.0.2.RELEASE\spring-cloud-context-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;D:\mavenrepository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;D:\mavenrepository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-netflix-core\2.0.2.RELEASE\spring-cloud-netflix-core-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-aop\2.0.3.RELEASE\spring-boot-starter-aop-2.0.3.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.0.2.RELEASE\spring-cloud-netflix-eureka-client-2.0.2.RELEASE.jar;D:\mavenrepository\com\netflix\eureka\eureka-client\1.9.3\eureka-client-1.9.3.jar;D:\mavenrepository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\mavenrepository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\mavenrepository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\mavenrepository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\mavenrepository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\mavenrepository\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;D:\mavenrepository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\mavenrepository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\mavenrepository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\mavenrepository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\mavenrepository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\mavenrepository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\mavenrepository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\mavenrepository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\mavenrepository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\mavenrepository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\mavenrepository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\mavenrepository\javax\inject\javax.inject\1\javax.inject-1.jar;D:\mavenrepository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\mavenrepository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\mavenrepository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\mavenrepository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\mavenrepository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;D:\mavenrepository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;D:\mavenrepository\com\netflix\eureka\eureka-core\1.9.3\eureka-core-1.9.3.jar;D:\mavenrepository\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;D:\mavenrepository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\mavenrepository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.0.2.RELEASE\spring-cloud-starter-netflix-archaius-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-netflix-ribbon\2.0.2.RELEASE\spring-cloud-netflix-ribbon-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-netflix-archaius\2.0.2.RELEASE\spring-cloud-netflix-archaius-2.0.2.RELEASE.jar;D:\mavenrepository\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\mavenrepository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.0.2.RELEASE\spring-cloud-starter-netflix-ribbon-2.0.2.RELEASE.jar;D:\mavenrepository\com\netflix\ribbon\ribbon\2.2.5\ribbon-2.2.5.jar;D:\mavenrepository\com\netflix\ribbon\ribbon-transport\2.2.5\ribbon-transport-2.2.5.jar;D:\mavenrepository\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\mavenrepository\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\mavenrepository\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\mavenrepository\com\netflix\ribbon\ribbon-core\2.2.5\ribbon-core-2.2.5.jar;D:\mavenrepository\com\netflix\ribbon\ribbon-httpclient\2.2.5\ribbon-httpclient-2.2.5.jar;D:\mavenrepository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\mavenrepository\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;D:\mavenrepository\com\netflix\ribbon\ribbon-loadbalancer\2.2.5\ribbon-loadbalancer-2.2.5.jar;D:\mavenrepository\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\mavenrepository\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;D:\mavenrepository\com\netflix\ribbon\ribbon-eureka\2.2.5\ribbon-eureka-2.2.5.jar;D:\mavenrepository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\mavenrepository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\mavenrepository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-web\2.0.3.RELEASE\spring-boot-starter-web-2.0.3.RELEASE.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-json\2.0.3.RELEASE\spring-boot-starter-json-2.0.3.RELEASE.jar;D:\mavenrepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;D:\mavenrepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;D:\mavenrepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-tomcat\2.0.3.RELEASE\spring-boot-starter-tomcat-2.0.3.RELEASE.jar;D:\mavenrepository\org\apache\tomcat\embed\tomcat-embed-core\8.5.31\tomcat-embed-core-8.5.31.jar;D:\mavenrepository\org\apache\tomcat\embed\tomcat-embed-el\8.5.31\tomcat-embed-el-8.5.31.jar;D:\mavenrepository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.31\tomcat-embed-websocket-8.5.31.jar;D:\mavenrepository\org\hibernate\validator\hibernate-validator\6.0.10.Final\hibernate-validator-6.0.10.Final.jar;D:\mavenrepository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\mavenrepository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\mavenrepository\org\springframework\spring-web\5.0.7.RELEASE\spring-web-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-beans\5.0.7.RELEASE\spring-beans-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-webmvc\5.0.7.RELEASE\spring-webmvc-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-aop\5.0.7.RELEASE\spring-aop-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-context\5.0.7.RELEASE\spring-context-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-expression\5.0.7.RELEASE\spring-expression-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-starter-openfeign\2.0.2.RELEASE\spring-cloud-starter-openfeign-2.0.2.RELEASE.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-openfeign-core\2.0.2.RELEASE\spring-cloud-openfeign-core-2.0.2.RELEASE.jar;D:\mavenrepository\io\github\openfeign\form\feign-form-spring\3.3.0\feign-form-spring-3.3.0.jar;D:\mavenrepository\io\github\openfeign\form\feign-form\3.3.0\feign-form-3.3.0.jar;D:\mavenrepository\com\google\code\findbugs\annotations\3.0.1\annotations-3.0.1.jar;D:\mavenrepository\net\jcip\jcip-annotations\1.0\jcip-annotations-1.0.jar;D:\mavenrepository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;D:\mavenrepository\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;D:\mavenrepository\org\springframework\cloud\spring-cloud-commons\2.0.2.RELEASE\spring-cloud-commons-2.0.2.RELEASE.jar;D:\mavenrepository\io\github\openfeign\feign-core\9.7.0\feign-core-9.7.0.jar;D:\mavenrepository\io\github\openfeign\feign-slf4j\9.7.0\feign-slf4j-9.7.0.jar;D:\mavenrepository\io\github\openfeign\feign-hystrix\9.7.0\feign-hystrix-9.7.0.jar;D:\mavenrepository\io\github\openfeign\feign-java8\9.7.0\feign-java8-9.7.0.jar;D:\mavenrepository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\mavenrepository\commons-io\commons-io\2.5\commons-io-2.5.jar;D:\mavenrepository\io\springfox\springfox-swagger2\2.8.0\springfox-swagger2-2.8.0.jar;D:\mavenrepository\io\swagger\swagger-annotations\1.5.14\swagger-annotations-1.5.14.jar;D:\mavenrepository\io\swagger\swagger-models\1.5.14\swagger-models-1.5.14.jar;D:\mavenrepository\io\springfox\springfox-spi\2.8.0\springfox-spi-2.8.0.jar;D:\mavenrepository\io\springfox\springfox-core\2.8.0\springfox-core-2.8.0.jar;D:\mavenrepository\io\springfox\springfox-schema\2.8.0\springfox-schema-2.8.0.jar;D:\mavenrepository\io\springfox\springfox-swagger-common\2.8.0\springfox-swagger-common-2.8.0.jar;D:\mavenrepository\io\springfox\springfox-spring-web\2.8.0\springfox-spring-web-2.8.0.jar;D:\mavenrepository\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;D:\mavenrepository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;D:\mavenrepository\com\google\guava\guava\20.0\guava-20.0.jar;D:\mavenrepository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\mavenrepository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\mavenrepository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;D:\mavenrepository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;D:\mavenrepository\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;D:\mavenrepository\io\springfox\springfox-swagger-ui\2.8.0\springfox-swagger-ui-2.8.0.jar;C:\project\temp\nzoth\autobuild\target\classes;D:\mavenrepository\com\alibaba\druid\1.1.0\druid-1.1.0.jar;C:\Java\jdk1.8.0_131\lib\jconsole.jar;C:\Java\jdk1.8.0_131\lib\tools.jar;D:\mavenrepository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.1\mybatis-spring-boot-starter-1.3.1.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-jdbc\2.0.3.RELEASE\spring-boot-starter-jdbc-2.0.3.RELEASE.jar;D:\mavenrepository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;D:\mavenrepository\org\springframework\spring-jdbc\5.0.7.RELEASE\spring-jdbc-5.0.7.RELEASE.jar;D:\mavenrepository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.1\mybatis-spring-boot-autoconfigure-1.3.1.jar;D:\mavenrepository\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;D:\mavenrepository\org\mybatis\mybatis-spring\1.3.1\mybatis-spring-1.3.1.jar;D:\mavenrepository\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar;D:\mavenrepository\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.3\pagehelper-spring-boot-starter-1.2.3.jar;D:\mavenrepository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.3\pagehelper-spring-boot-autoconfigure-1.2.3.jar;D:\mavenrepository\com\github\pagehelper\pagehelper\5.1.2\pagehelper-5.1.2.jar;D:\mavenrepository\com\github\jsqlparser\jsqlparser\1.0\jsqlparser-1.0.jar;D:\mavenrepository\com\magic\tiger-common\1.1.0-SNAPSHOT\tiger-common-1.1.0-20190318.101315-89.jar;D:\mavenrepository\org\springframework\security\spring-security-crypto\5.0.6.RELEASE\spring-security-crypto-5.0.6.RELEASE.jar;D:\mavenrepository\com\opencsv\opencsv\4.2\opencsv-4.2.jar;D:\mavenrepository\org\apache\commons\commons-text\1.3\commons-text-1.3.jar;D:\mavenrepository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar;D:\mavenrepository\org\apache\commons\commons-collections4\4.1\commons-collections4-4.1.jar;D:\mavenrepository\org\apache\httpcomponents\httpclient\4.5.5\httpclient-4.5.5.jar;D:\mavenrepository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;D:\mavenrepository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;D:\mavenrepository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;D:\mavenrepository\jaxen\jaxen\1.1.6\jaxen-1.1.6.jar;D:\mavenrepository\com\sun\mail\javax.mail\1.6.1\javax.mail-1.6.1.jar;D:\mavenrepository\javax\activation\activation\1.1\activation-1.1.jar;D:\mavenrepository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\mavenrepository\io\jsonwebtoken\jjwt\0.9.0\jjwt-0.9.0.jar;D:\mavenrepository\com\magic\tiger-sms-starter\1.1.0-SNAPSHOT\tiger-sms-starter-1.1.0-20190318.101317-26.jar;D:\mavenrepository\com\aliyun\aliyun-java-sdk-core\3.7.1\aliyun-java-sdk-core-3.7.1.jar;D:\mavenrepository\org\json\json\20170516\json-20170516.jar;D:\mavenrepository\com\aliyun\aliyun-java-sdk-dysmsapi\1.1.0\aliyun-java-sdk-dysmsapi-1.1.0.jar;D:\mavenrepository\com\magic\tiger-upload-starter\1.1.0-SNAPSHOT\tiger-upload-starter-1.1.0-20190318.101316-29.jar;D:\mavenrepository\com\aliyun\oss\aliyun-sdk-oss\2.8.2\aliyun-sdk-oss-2.8.2.jar;D:\mavenrepository\org\jdom\jdom\1.1\jdom-1.1.jar;D:\mavenrepository\net\sf\json-lib\json-lib\2.4\json-lib-2.4-jdk15.jar;D:\mavenrepository\net\sf\ezmorph\ezmorph\1.0.6\ezmorph-1.0.6.jar;D:\mavenrepository\com\drewnoakes\metadata-extractor\2.10.1\metadata-extractor-2.10.1.jar;D:\mavenrepository\com\adobe\xmp\xmpcore\5.1.3\xmpcore-5.1.3.jar;D:\mavenrepository\com\magic\tiger-redis-starter\1.1.0-SNAPSHOT\tiger-redis-starter-1.1.0-20190318.101319-28.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-redis\1.4.7.RELEASE\spring-boot-starter-redis-1.4.7.RELEASE.jar;D:\mavenrepository\org\springframework\data\spring-data-redis\2.0.8.RELEASE\spring-data-redis-2.0.8.RELEASE.jar;D:\mavenrepository\org\springframework\data\spring-data-keyvalue\2.0.8.RELEASE\spring-data-keyvalue-2.0.8.RELEASE.jar;D:\mavenrepository\org\springframework\data\spring-data-commons\2.0.8.RELEASE\spring-data-commons-2.0.8.RELEASE.jar;D:\mavenrepository\org\springframework\spring-tx\5.0.7.RELEASE\spring-tx-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-oxm\5.0.7.RELEASE\spring-oxm-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-context-support\5.0.7.RELEASE\spring-context-support-5.0.7.RELEASE.jar;D:\mavenrepository\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\mavenrepository\org\apache\commons\commons-pool2\2.5.0\commons-pool2-2.5.0.jar;D:\mavenrepository\com\magic\tiger-jpush-starter\1.1.0-SNAPSHOT\tiger-jpush-starter-1.1.0-20190318.101322-29.jar;D:\mavenrepository\com\ibm\icu\icu4j\63.1\icu4j-63.1.jar;D:\mavenrepository\org\apache\poi\poi\3.14\poi-3.14.jar;D:\mavenrepository\cn\jpush\api\jpush-client\3.3.10\jpush-client-3.3.10.jar;D:\mavenrepository\cn\jpush\api\jiguang-common\1.1.3\jiguang-common-1.1.3.jar;D:\mavenrepository\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar;D:\mavenrepository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\mavenrepository\com\netflix\hystrix\hystrix-javanica\1.5.18\hystrix-javanica-1.5.18.jar;D:\mavenrepository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;D:\mavenrepository\com\netflix\hystrix\hystrix-core\1.5.12\hystrix-core-1.5.12.jar;D:\mavenrepository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;D:\mavenrepository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter\2.0.3.RELEASE\spring-boot-starter-2.0.3.RELEASE.jar;D:\mavenrepository\org\springframework\boot\spring-boot\2.0.3.RELEASE\spring-boot-2.0.3.RELEASE.jar;D:\mavenrepository\org\springframework\boot\spring-boot-autoconfigure\2.0.3.RELEASE\spring-boot-autoconfigure-2.0.3.RELEASE.jar;D:\mavenrepository\org\springframework\boot\spring-boot-starter-logging\2.0.3.RELEASE\spring-boot-starter-logging-2.0.3.RELEASE.jar;D:\mavenrepository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\mavenrepository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\mavenrepository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;D:\mavenrepository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;D:\mavenrepository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\mavenrepository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\mavenrepository\org\springframework\spring-core\5.0.7.RELEASE\spring-core-5.0.7.RELEASE.jar;D:\mavenrepository\org\springframework\spring-jcl\5.0.7.RELEASE\spring-jcl-5.0.7.RELEASE.jar;D:\mavenrepository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;D:\mavenrepository\org\springframework\boot\spring-boot-configuration-processor\2.0.3.RELEASE\spring-boot-configuration-processor-2.0.3.RELEASE.jar;D:\mavenrepository\com\alibaba\fastjson\1.2.47\fastjson-1.2.47.jar;D:\mavenrepository\org\projectlombok\lombok\1.16.10\lombok-1.16.10.jar;D:\mavenrepository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar;D:\mavenrepository\net\bytebuddy\byte-buddy\1.7.11\byte-buddy-1.7.11.jar;D:\mavenrepository\org\springframework\spring-test\5.0.7.RELEASE\spring-test-5.0.7.RELEASE.jar;E:\JetBrains\IntelliJ IDEA 2018.2.6\lib\idea_rt.jar" com.magic.nzoth.NzothAppApplication
    Connected to the target VM, address: '127.0.0.1:64025', transport: 'socket'
    11:34:35,751 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
    11:34:35,794 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [PerfLog]
    11:34:35,857 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1406848276 - Archive files will be limited to [20 MB] each.
    11:34:36,071 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1406848276 - No compression will be used
    11:34:36,073 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1406848276 - Will use the pattern /tmp/log/nzoth-app-perf.log.%d{yyyy-MM-dd}.%i.log for the active file
    11:34:36,078 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@655f7ea - The date pattern is 'yyyy-MM-dd' from file name pattern '/tmp/log/nzoth-app-perf.log.%d{yyyy-MM-dd}.%i.log'.
    11:34:36,078 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@655f7ea - Roll-over at midnight.
    11:34:36,140 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@655f7ea - Setting initial period to Tue Mar 19 11:34:36 CST 2019
    11:34:38,187 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1406848276 - Cleaning on start up
    11:34:38,193 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
    11:34:38,193 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
    11:34:38,244 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[PerfLog] - Active log file name: /tmp/log/nzoth-app-perf.log.2019-03-19.0.log
    11:34:38,244 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[PerfLog] - File property is set to [null]
    11:34:38,250 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
    11:34:38,250 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ErrorLog]
    11:34:38,253 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@95369743 - Archive files will be limited to [20 MB] each.
    11:34:38,254 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@95369743 - No compression will be used
    11:34:38,254 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@95369743 - Will use the pattern /tmp/log/nzoth-app-error.log.%d{yyyy-MM-dd}.%i.log for the active file
    11:34:38,256 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@19ae6bb - The date pattern is 'yyyy-MM-dd' from file name pattern '/tmp/log/nzoth-app-error.log.%d{yyyy-MM-dd}.%i.log'.
    11:34:38,256 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@19ae6bb - Roll-over at midnight.
    11:34:38,257 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@19ae6bb - Setting initial period to Tue Mar 19 11:34:38 CST 2019
    11:34:38,260 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@95369743 - Cleaning on start up
    11:34:38,266 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ErrorLog] - Active log file name: /tmp/log/nzoth-app-error.log.2019-03-19.0.log
    11:34:38,267 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ErrorLog] - File property is set to [null]
    11:34:38,267 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
    11:34:38,268 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
    11:34:38,268 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
    11:34:38,268 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [AccessLog]
    11:34:38,270 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@404947798 - Archive files will be limited to [20 MB] each.
    11:34:38,270 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@404947798 - No compression will be used
    11:34:38,270 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@404947798 - Will use the pattern /tmp/log/nzoth-app-access.log.%d{yyyy-MM-dd}.%i.log for the active file
    11:34:38,271 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@d8305c2 - The date pattern is 'yyyy-MM-dd' from file name pattern '/tmp/log/nzoth-app-access.log.%d{yyyy-MM-dd}.%i.log'.
    11:34:38,271 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@d8305c2 - Roll-over at midnight.
    11:34:38,272 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@d8305c2 - Setting initial period to Tue Mar 19 11:34:38 CST 2019
    11:34:38,276 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@404947798 - Cleaning on start up
    11:34:38,277 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[AccessLog] - Active log file name: /tmp/log/nzoth-app-access.log.2019-03-19.0.log
    11:34:38,278 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[AccessLog] - File property is set to [null]
    11:34:38,280 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
    11:34:38,280 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [BaseLog]
    11:34:38,281 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
    11:34:38,281 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1978209605 - Archive files will be limited to [20 MB] each.
    11:34:38,282 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
    11:34:38,282 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1978209605 - No compression will be used
    11:34:38,282 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1978209605 - Will use the pattern /tmp/log/nzoth-app.log.%d{yyyy-MM-dd}.%i.log for the active file
    11:34:38,283 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@60d1a32f - The date pattern is 'yyyy-MM-dd' from file name pattern '/tmp/log/nzoth-app.log.%d{yyyy-MM-dd}.%i.log'.
    11:34:38,283 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@60d1a32f - Roll-over at midnight.
    11:34:38,284 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@60d1a32f - Setting initial period to Tue Mar 19 11:34:38 CST 2019
    11:34:38,289 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1978209605 - Cleaning on start up
    11:34:38,291 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[BaseLog] - Active log file name: /tmp/log/nzoth-app.log.2019-03-19.0.log
    11:34:38,291 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[BaseLog] - File property is set to [null]
    11:34:38,296 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
    11:34:38,296 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ThirdPartLog]
    11:34:38,297 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1086849943 - Archive files will be limited to [20 MB] each.
    11:34:38,297 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1086849943 - No compression will be used
    11:34:38,298 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1086849943 - Will use the pattern /tmp/log/nzoth-app-thirdpart.log.%d{yyyy-MM-dd}.%i.log for the active file
    11:34:38,298 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4b672daa - The date pattern is 'yyyy-MM-dd' from file name pattern '/tmp/log/nzoth-app-thirdpart.log.%d{yyyy-MM-dd}.%i.log'.
    11:34:38,298 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4b672daa - Roll-over at midnight.
    11:34:38,299 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4b672daa - Setting initial period to Tue Mar 19 11:34:38 CST 2019
    11:34:38,301 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
    11:34:38,301 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
    11:34:38,306 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1086849943 - Cleaning on start up
    11:34:38,308 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ThirdPartLog] - Active log file name: /tmp/log/nzoth-app-thirdpart.log.2019-03-19.0.log
    11:34:38,308 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ThirdPartLog] - File property is set to [null]
    11:34:38,311 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word clr with class [org.springframework.boot.logging.logback.ColorConverter]
    11:34:38,311 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word wex with class [org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter]
    11:34:38,311 |-INFO in ch.qos.logback.core.joran.action.ConversionRuleAction - registering conversion word wEx with class [org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter]
    11:34:38,311 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
    11:34:38,312 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
    11:34:38,312 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
    11:34:38,323 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
    11:34:38,326 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ASYNC]
    11:34:38,327 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [BaseLog] to ch.qos.logback.classic.AsyncAppender[ASYNC]
    11:34:38,327 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC] - Attaching appender named [BaseLog] to AsyncAppender.
    11:34:38,327 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ErrorLog] to ch.qos.logback.classic.AsyncAppender[ASYNC]
    11:34:38,328 |-WARN in ch.qos.logback.classic.AsyncAppender[ASYNC] - One and only one appender may be attached to AsyncAppender.
    11:34:38,329 |-WARN in ch.qos.logback.classic.AsyncAppender[ASYNC] - Ignoring additional appender named [ErrorLog]
    11:34:38,329 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [PerfLog] to ch.qos.logback.classic.AsyncAppender[ASYNC]
    11:34:38,329 |-WARN in ch.qos.logback.classic.AsyncAppender[ASYNC] - One and only one appender may be attached to AsyncAppender.
    11:34:38,329 |-WARN in ch.qos.logback.classic.AsyncAppender[ASYNC] - Ignoring additional appender named [PerfLog]
    11:34:38,329 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
    11:34:38,329 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start.
    11:34:38,367 |-INFO in ch.qos.logback.classic.AsyncAppender[ASYNC] - Setting discardingThreshold to 409
    11:34:38,368 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.nzoth] to INFO
    11:34:38,368 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating INFO level on Logger[com.magic.nzoth] onto the JUL framework
    11:34:38,372 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.magic.nzoth] to false
    11:34:38,372 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [BaseLog] to Logger[com.magic.nzoth]
    11:34:38,372 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ErrorLog] to Logger[com.magic.nzoth]
    11:34:38,373 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.magic.nzoth]
    11:34:38,374 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.nzoth.aspect.LoggerAspect] to INFO
    11:34:38,376 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating INFO level on Logger[com.magic.nzoth.aspect.LoggerAspect] onto the JUL framework
    11:34:38,377 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.magic.nzoth.aspect.LoggerAspect] to false
    11:34:38,377 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [AccessLog] to Logger[com.magic.nzoth.aspect.LoggerAspect]
    11:34:38,377 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ErrorLog] to Logger[com.magic.nzoth.aspect.LoggerAspect]
    11:34:38,377 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.nzoth.aspect.LoggerThirdPart] to INFO
    11:34:38,377 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating INFO level on Logger[com.magic.nzoth.aspect.LoggerThirdPart] onto the JUL framework
    11:34:38,378 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.magic.nzoth.aspect.LoggerThirdPart] to false
    11:34:38,378 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [BaseLog] to Logger[com.magic.nzoth.aspect.LoggerThirdPart]
    11:34:38,378 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ThirdPartLog] to Logger[com.magic.nzoth.aspect.LoggerThirdPart]
    11:34:38,378 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.util.StopWatch] to INFO
    11:34:38,378 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating INFO level on Logger[org.springframework.util.StopWatch] onto the JUL framework
    11:34:38,378 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.springframework.util.StopWatch] to false
    11:34:38,379 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [PerfLog] to Logger[org.springframework.util.StopWatch]
    11:34:38,381 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.common.com.magic.nzoth.entity.StopWatch] to INFO
    11:34:38,381 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating INFO level on Logger[com.magic.common.com.magic.nzoth.entity.StopWatch] onto the JUL framework
    11:34:38,382 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.magic.common.com.magic.nzoth.entity.StopWatch] to false
    11:34:38,382 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [PerfLog] to Logger[com.magic.common.com.magic.nzoth.entity.StopWatch]
    11:34:38,382 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
    11:34:38,382 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ASYNC] to Logger[ROOT]
    11:34:38,383 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
    11:34:38,383 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.apache.ibatis] to DEBUG
    11:34:38,383 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[com.apache.ibatis] onto the JUL framework
    11:34:38,384 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.apache.ibatis]
    11:34:38,384 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Connection] to DEBUG
    11:34:38,384 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[java.sql.Connection] onto the JUL framework
    11:34:38,384 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[java.sql.Connection]
    11:34:38,385 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Statement] to DEBUG
    11:34:38,385 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[java.sql.Statement] onto the JUL framework
    11:34:38,385 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[java.sql.Statement]
    11:34:38,385 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.PreparedStatement] to DEBUG
    11:34:38,385 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[java.sql.PreparedStatement] onto the JUL framework
    11:34:38,385 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[java.sql.PreparedStatement]
    11:34:38,385 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.nzoth.dao] to DEBUG
    11:34:38,385 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[com.magic.nzoth.dao] onto the JUL framework
    11:34:38,385 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.magic.nzoth.dao]
    11:34:38,385 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.magic.nzoth.daopx] to DEBUG
    11:34:38,385 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@13e3c1c7 - Propagating DEBUG level on Logger[com.magic.nzoth.daopx] onto the JUL framework
    11:34:38,385 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[com.magic.nzoth.daopx]
    11:34:38,385 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
    11:34:38,386 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@64dafeed - Registering current configuration as safe fallback point
    2019-03-19 11:34:38.857  INFO 4848 --- [           main] org.springframework.context.annotation.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@40e10ff8: startup date [Tue Mar 19 11:34:38 CST 2019]; root of context hierarchy
    2019-03-19 11:34:39.574  INFO 4848 --- [           main] org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
    2019-03-19 11:34:39.800  INFO 4848 --- [           main] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f4a94dbd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    Disconnected from the target VM, address: '127.0.0.1:64025', transport: 'socket'
    
    Process finished with exit code 1
    

     上网搜了一下好多说tomcat配置有问题,检查配置,或者clean一下,但是没卵用;

    认真考虑了一下,问题还是在配置方面,主要是configurationPropertiesRebinderAutoConfiguration报错,在自动配置的时候出了CheckedException,就回去重新检查yml文件,确实在和代码的时候没注意有一项配置重复配置了,

    但是由于配置文件不报错,所以可能对于我这样的新手来说难以发现!!!

    希望引以为鉴。

    以前遇到过几次,基本都是配置有问题或者maven依赖冲突。

    路曼曼其修远兮,吾将上下而求索。任重而道远,加油~

     

    展开全文
  • JQuery:$(...).ajaxSubmit is not a function

    万次阅读 2016-04-24 16:09:07
    // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function () { }; callbacks.push( function (data...

    用jquery写表单回调的时候报的bug
    这里写图片描述

    正如stackover上说的

    I’m guessing you don’t have a jquery form plugin included. ajaxSubmit isn’t a core jquery function, I believe.

    意思就是说表单提交是单独的一个插件,没集成在jquery-版本号.min.js这个文件里,需要另外引入jquery-form.js,文件名自取。现在找到的官方最新的form插件代码:

    /*!
     * jQuery Form Plugin
     * version: 3.51.0-2014.06.20
     * Requires jQuery v1.5 or later
     * Copyright (c) 2014 M. Alsup
     * Examples and documentation at: http://malsup.com/jquery/form/
     * Project repository: https://github.com/malsup/form
     * Dual licensed under the MIT and GPL licenses.
     * https://github.com/malsup/form#copyright-and-license
     */
    /*global ActiveXObject */
    
    // AMD support
    (function (factory) {
        "use strict";
        if (typeof define === 'function' && define.amd) {
            // using AMD; register as anon module
            define(['jquery'], factory);
        } else {
            // no AMD; invoke directly
            factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
        }
    }
    
    (function($) {
    "use strict";
    
    /*
        Usage Note:
        -----------
        Do not use both ajaxSubmit and ajaxForm on the same form.  These
        functions are mutually exclusive.  Use ajaxSubmit if you want
        to bind your own submit handler to the form.  For example,
    
        $(document).ready(function() {
            $('#myForm').on('submit', function(e) {
                e.preventDefault(); // <-- important
                $(this).ajaxSubmit({
                    target: '#output'
                });
            });
        });
    
        Use ajaxForm when you want the plugin to manage all the event binding
        for you.  For example,
    
        $(document).ready(function() {
            $('#myForm').ajaxForm({
                target: '#output'
            });
        });
    
        You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
        form does not have to exist when you invoke ajaxForm:
    
        $('#myForm').ajaxForm({
            delegation: true,
            target: '#output'
        });
    
        When using ajaxForm, the ajaxSubmit function will be invoked for you
        at the appropriate time.
    */
    
    /**
     * Feature detection
     */
    var feature = {};
    feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
    feature.formdata = window.FormData !== undefined;
    
    var hasProp = !!$.fn.prop;
    
    // attr2 uses prop when it can but checks the return type for
    // an expected string.  this accounts for the case where a form 
    // contains inputs with names like "action" or "method"; in those
    // cases "prop" returns the element
    $.fn.attr2 = function() {
        if ( ! hasProp ) {
            return this.attr.apply(this, arguments);
        }
        var val = this.prop.apply(this, arguments);
        if ( ( val && val.jquery ) || typeof val === 'string' ) {
            return val;
        }
        return this.attr.apply(this, arguments);
    };
    
    /**
     * ajaxSubmit() provides a mechanism for immediately submitting
     * an HTML form using AJAX.
     */
    $.fn.ajaxSubmit = function(options) {
        /*jshint scripturl:true */
    
        // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
        if (!this.length) {
            log('ajaxSubmit: skipping submit process - no element selected');
            return this;
        }
    
        var method, action, url, $form = this;
    
        if (typeof options == 'function') {
            options = { success: options };
        }
        else if ( options === undefined ) {
            options = {};
        }
    
        method = options.type || this.attr2('method');
        action = options.url  || this.attr2('action');
    
        url = (typeof action === 'string') ? $.trim(action) : '';
        url = url || window.location.href || '';
        if (url) {
            // clean url (don't include hash vaue)
            url = (url.match(/^([^#]+)/)||[])[1];
        }
    
        options = $.extend(true, {
            url:  url,
            success: $.ajaxSettings.success,
            type: method || $.ajaxSettings.type,
            iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
        }, options);
    
        // hook for manipulating the form data before it is extracted;
        // convenient for use with rich editors like tinyMCE or FCKEditor
        var veto = {};
        this.trigger('form-pre-serialize', [this, options, veto]);
        if (veto.veto) {
            log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
            return this;
        }
    
        // provide opportunity to alter form data before it is serialized
        if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
            log('ajaxSubmit: submit aborted via beforeSerialize callback');
            return this;
        }
    
        var traditional = options.traditional;
        if ( traditional === undefined ) {
            traditional = $.ajaxSettings.traditional;
        }
    
        var elements = [];
        var qx, a = this.formToArray(options.semantic, elements);
        if (options.data) {
            options.extraData = options.data;
            qx = $.param(options.data, traditional);
        }
    
        // give pre-submit callback an opportunity to abort the submit
        if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
            log('ajaxSubmit: submit aborted via beforeSubmit callback');
            return this;
        }
    
        // fire vetoable 'validate' event
        this.trigger('form-submit-validate', [a, this, options, veto]);
        if (veto.veto) {
            log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
            return this;
        }
    
        var q = $.param(a, traditional);
        if (qx) {
            q = ( q ? (q + '&' + qx) : qx );
        }
        if (options.type.toUpperCase() == 'GET') {
            options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
            options.data = null;  // data is null for 'get'
        }
        else {
            options.data = q; // data is the query string for 'post'
        }
    
        var callbacks = [];
        if (options.resetForm) {
            callbacks.push(function() { $form.resetForm(); });
        }
        if (options.clearForm) {
            callbacks.push(function() { $form.clearForm(options.includeHidden); });
        }
    
        // perform a load on the target only if dataType is not provided
        if (!options.dataType && options.target) {
            var oldSuccess = options.success || function(){};
            callbacks.push(function(data) {
                var fn = options.replaceTarget ? 'replaceWith' : 'html';
                $(options.target)[fn](data).each(oldSuccess, arguments);
            });
        }
        else if (options.success) {
            callbacks.push(options.success);
        }
    
        options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
            var context = options.context || this ;    // jQuery 1.4+ supports scope context
            for (var i=0, max=callbacks.length; i < max; i++) {
                callbacks[i].apply(context, [data, status, xhr || $form, $form]);
            }
        };
    
        if (options.error) {
            var oldError = options.error;
            options.error = function(xhr, status, error) {
                var context = options.context || this;
                oldError.apply(context, [xhr, status, error, $form]);
            };
        }
    
         if (options.complete) {
            var oldComplete = options.complete;
            options.complete = function(xhr, status) {
                var context = options.context || this;
                oldComplete.apply(context, [xhr, status, $form]);
            };
        }
    
        // are there files to upload?
    
        // [value] (issue #113), also see comment:
        // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
        var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
    
        var hasFileInputs = fileInputs.length > 0;
        var mp = 'multipart/form-data';
        var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
    
        var fileAPI = feature.fileapi && feature.formdata;
        log("fileAPI :" + fileAPI);
        var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
    
        var jqxhr;
    
        // options.iframe allows user to force iframe mode
        // 06-NOV-09: now defaulting to iframe mode if file input is detected
        if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
            // hack to fix Safari hang (thanks to Tim Molendijk for this)
            // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
            if (options.closeKeepAlive) {
                $.get(options.closeKeepAlive, function() {
                    jqxhr = fileUploadIframe(a);
                });
            }
            else {
                jqxhr = fileUploadIframe(a);
            }
        }
        else if ((hasFileInputs || multipart) && fileAPI) {
            jqxhr = fileUploadXhr(a);
        }
        else {
            jqxhr = $.ajax(options);
        }
    
        $form.removeData('jqxhr').data('jqxhr', jqxhr);
    
        // clear element array
        for (var k=0; k < elements.length; k++) {
            elements[k] = null;
        }
    
        // fire 'notify' event
        this.trigger('form-submit-notify', [this, options]);
        return this;
    
        // utility fn for deep serialization
        function deepSerialize(extraData){
            var serialized = $.param(extraData, options.traditional).split('&');
            var len = serialized.length;
            var result = [];
            var i, part;
            for (i=0; i < len; i++) {
                // #252; undo param space replacement
                serialized[i] = serialized[i].replace(/\+/g,' ');
                part = serialized[i].split('=');
                // #278; use array instead of object storage, favoring array serializations
                result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
            }
            return result;
        }
    
         // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
        function fileUploadXhr(a) {
            var formdata = new FormData();
    
            for (var i=0; i < a.length; i++) {
                formdata.append(a[i].name, a[i].value);
            }
    
            if (options.extraData) {
                var serializedData = deepSerialize(options.extraData);
                for (i=0; i < serializedData.length; i++) {
                    if (serializedData[i]) {
                        formdata.append(serializedData[i][0], serializedData[i][1]);
                    }
                }
            }
    
            options.data = null;
    
            var s = $.extend(true, {}, $.ajaxSettings, options, {
                contentType: false,
                processData: false,
                cache: false,
                type: method || 'POST'
            });
    
            if (options.uploadProgress) {
                // workaround because jqXHR does not expose upload property
                s.xhr = function() {
                    var xhr = $.ajaxSettings.xhr();
                    if (xhr.upload) {
                        xhr.upload.addEventListener('progress', function(event) {
                            var percent = 0;
                            var position = event.loaded || event.position; /*event.position is deprecated*/
                            var total = event.total;
                            if (event.lengthComputable) {
                                percent = Math.ceil(position / total * 100);
                            }
                            options.uploadProgress(event, position, total, percent);
                        }, false);
                    }
                    return xhr;
                };
            }
    
            s.data = null;
            var beforeSend = s.beforeSend;
            s.beforeSend = function(xhr, o) {
                //Send FormData() provided by user
                if (options.formData) {
                    o.data = options.formData;
                }
                else {
                    o.data = formdata;
                }
                if(beforeSend) {
                    beforeSend.call(this, xhr, o);
                }
            };
            return $.ajax(s);
        }
    
        // private function for handling file uploads (hat tip to YAHOO!)
        function fileUploadIframe(a) {
            var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
            var deferred = $.Deferred();
    
            // #341
            deferred.abort = function(status) {
                xhr.abort(status);
            };
    
            if (a) {
                // ensure that every serialized input is still enabled
                for (i=0; i < elements.length; i++) {
                    el = $(elements[i]);
                    if ( hasProp ) {
                        el.prop('disabled', false);
                    }
                    else {
                        el.removeAttr('disabled');
                    }
                }
            }
    
            s = $.extend(true, {}, $.ajaxSettings, options);
            s.context = s.context || s;
            id = 'jqFormIO' + (new Date().getTime());
            if (s.iframeTarget) {
                $io = $(s.iframeTarget);
                n = $io.attr2('name');
                if (!n) {
                    $io.attr2('name', id);
                }
                else {
                    id = n;
                }
            }
            else {
                $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
                $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
            }
            io = $io[0];
    
    
            xhr = { // mock object
                aborted: 0,
                responseText: null,
                responseXML: null,
                status: 0,
                statusText: 'n/a',
                getAllResponseHeaders: function() {},
                getResponseHeader: function() {},
                setRequestHeader: function() {},
                abort: function(status) {
                    var e = (status === 'timeout' ? 'timeout' : 'aborted');
                    log('aborting upload... ' + e);
                    this.aborted = 1;
    
                    try { // #214, #257
                        if (io.contentWindow.document.execCommand) {
                            io.contentWindow.document.execCommand('Stop');
                        }
                    }
                    catch(ignore) {}
    
                    $io.attr('src', s.iframeSrc); // abort op in progress
                    xhr.error = e;
                    if (s.error) {
                        s.error.call(s.context, xhr, e, status);
                    }
                    if (g) {
                        $.event.trigger("ajaxError", [xhr, s, e]);
                    }
                    if (s.complete) {
                        s.complete.call(s.context, xhr, e);
                    }
                }
            };
    
            g = s.global;
            // trigger ajax global events so that activity/block indicators work like normal
            if (g && 0 === $.active++) {
                $.event.trigger("ajaxStart");
            }
            if (g) {
                $.event.trigger("ajaxSend", [xhr, s]);
            }
    
            if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
                if (s.global) {
                    $.active--;
                }
                deferred.reject();
                return deferred;
            }
            if (xhr.aborted) {
                deferred.reject();
                return deferred;
            }
    
            // add submitting element to data if we know it
            sub = form.clk;
            if (sub) {
                n = sub.name;
                if (n && !sub.disabled) {
                    s.extraData = s.extraData || {};
                    s.extraData[n] = sub.value;
                    if (sub.type == "image") {
                        s.extraData[n+'.x'] = form.clk_x;
                        s.extraData[n+'.y'] = form.clk_y;
                    }
                }
            }
    
            var CLIENT_TIMEOUT_ABORT = 1;
            var SERVER_ABORT = 2;
    
            function getDoc(frame) {
                /* it looks like contentWindow or contentDocument do not
                 * carry the protocol property in ie8, when running under ssl
                 * frame.document is the only valid response document, since
                 * the protocol is know but not on the other two objects. strange?
                 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
                 */
    
                var doc = null;
    
                // IE8 cascading access check
                try {
                    if (frame.contentWindow) {
                        doc = frame.contentWindow.document;
                    }
                } catch(err) {
                    // IE8 access denied under ssl & missing protocol
                    log('cannot get iframe.contentWindow document: ' + err);
                }
    
                if (doc) { // successful getting content
                    return doc;
                }
    
                try { // simply checking may throw in ie8 under ssl or mismatched protocol
                    doc = frame.contentDocument ? frame.contentDocument : frame.document;
                } catch(err) {
                    // last attempt
                    log('cannot get iframe.contentDocument: ' + err);
                    doc = frame.document;
                }
                return doc;
            }
    
            // Rails CSRF hack (thanks to Yvan Barthelemy)
            var csrf_token = $('meta[name=csrf-token]').attr('content');
            var csrf_param = $('meta[name=csrf-param]').attr('content');
            if (csrf_param && csrf_token) {
                s.extraData = s.extraData || {};
                s.extraData[csrf_param] = csrf_token;
            }
    
            // take a breath so that pending repaints get some cpu time before the upload starts
            function doSubmit() {
                // make sure form attrs are set
                var t = $form.attr2('target'), 
                    a = $form.attr2('action'), 
                    mp = 'multipart/form-data',
                    et = $form.attr('enctype') || $form.attr('encoding') || mp;
    
                // update form attrs in IE friendly way
                form.setAttribute('target',id);
                if (!method || /post/i.test(method) ) {
                    form.setAttribute('method', 'POST');
                }
                if (a != s.url) {
                    form.setAttribute('action', s.url);
                }
    
                // ie borks in some cases when setting encoding
                if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
                    $form.attr({
                        encoding: 'multipart/form-data',
                        enctype:  'multipart/form-data'
                    });
                }
    
                // support timout
                if (s.timeout) {
                    timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
                }
    
                // look for server aborts
                function checkState() {
                    try {
                        var state = getDoc(io).readyState;
                        log('state = ' + state);
                        if (state && state.toLowerCase() == 'uninitialized') {
                            setTimeout(checkState,50);
                        }
                    }
                    catch(e) {
                        log('Server abort: ' , e, ' (', e.name, ')');
                        cb(SERVER_ABORT);
                        if (timeoutHandle) {
                            clearTimeout(timeoutHandle);
                        }
                        timeoutHandle = undefined;
                    }
                }
    
                // add "extra" data to form if provided in options
                var extraInputs = [];
                try {
                    if (s.extraData) {
                        for (var n in s.extraData) {
                            if (s.extraData.hasOwnProperty(n)) {
                               // if using the $.param format that allows for multiple values with the same name
                               if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
                                   extraInputs.push(
                                   $('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
                                       .appendTo(form)[0]);
                               } else {
                                   extraInputs.push(
                                   $('<input type="hidden" name="'+n+'">').val(s.extraData[n])
                                       .appendTo(form)[0]);
                               }
                            }
                        }
                    }
    
                    if (!s.iframeTarget) {
                        // add iframe to doc and submit the form
                        $io.appendTo('body');
                    }
                    if (io.attachEvent) {
                        io.attachEvent('onload', cb);
                    }
                    else {
                        io.addEventListener('load', cb, false);
                    }
                    setTimeout(checkState,15);
    
                    try {
                        form.submit();
                    } catch(err) {
                        // just in case form has element with name/id of 'submit'
                        var submitFn = document.createElement('form').submit;
                        submitFn.apply(form);
                    }
                }
                finally {
                    // reset attrs and remove "extra" input elements
                    form.setAttribute('action',a);
                    form.setAttribute('enctype', et); // #380
                    if(t) {
                        form.setAttribute('target', t);
                    } else {
                        $form.removeAttr('target');
                    }
                    $(extraInputs).remove();
                }
            }
    
            if (s.forceSync) {
                doSubmit();
            }
            else {
                setTimeout(doSubmit, 10); // this lets dom updates render
            }
    
            var data, doc, domCheckCount = 50, callbackProcessed;
    
            function cb(e) {
                if (xhr.aborted || callbackProcessed) {
                    return;
                }
    
                doc = getDoc(io);
                if(!doc) {
                    log('cannot access response document');
                    e = SERVER_ABORT;
                }
                if (e === CLIENT_TIMEOUT_ABORT && xhr) {
                    xhr.abort('timeout');
                    deferred.reject(xhr, 'timeout');
                    return;
                }
                else if (e == SERVER_ABORT && xhr) {
                    xhr.abort('server abort');
                    deferred.reject(xhr, 'error', 'server abort');
                    return;
                }
    
                if (!doc || doc.location.href == s.iframeSrc) {
                    // response not received yet
                    if (!timedOut) {
                        return;
                    }
                }
                if (io.detachEvent) {
                    io.detachEvent('onload', cb);
                }
                else {
                    io.removeEventListener('load', cb, false);
                }
    
                var status = 'success', errMsg;
                try {
                    if (timedOut) {
                        throw 'timeout';
                    }
    
                    var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
                    log('isXml='+isXml);
                    if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
                        if (--domCheckCount) {
                            // in some browsers (Opera) the iframe DOM is not always traversable when
                            // the onload callback fires, so we loop a bit to accommodate
                            log('requeing onLoad callback, DOM not available');
                            setTimeout(cb, 250);
                            return;
                        }
                        // let this fall through because server response could be an empty document
                        //log('Could not access iframe DOM after mutiple tries.');
                        //throw 'DOMException: not available';
                    }
    
                    //log('response detected');
                    var docRoot = doc.body ? doc.body : doc.documentElement;
                    xhr.responseText = docRoot ? docRoot.innerHTML : null;
                    xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                    if (isXml) {
                        s.dataType = 'xml';
                    }
                    xhr.getResponseHeader = function(header){
                        var headers = {'content-type': s.dataType};
                        return headers[header.toLowerCase()];
                    };
                    // support for XHR 'status' & 'statusText' emulation :
                    if (docRoot) {
                        xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
                        xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
                    }
    
                    var dt = (s.dataType || '').toLowerCase();
                    var scr = /(json|script|text)/.test(dt);
                    if (scr || s.textarea) {
                        // see if user embedded response in textarea
                        var ta = doc.getElementsByTagName('textarea')[0];
                        if (ta) {
                            xhr.responseText = ta.value;
                            // support for XHR 'status' & 'statusText' emulation :
                            xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
                            xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
                        }
                        else if (scr) {
                            // account for browsers injecting pre around json response
                            var pre = doc.getElementsByTagName('pre')[0];
                            var b = doc.getElementsByTagName('body')[0];
                            if (pre) {
                                xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
                            }
                            else if (b) {
                                xhr.responseText = b.textContent ? b.textContent : b.innerText;
                            }
                        }
                    }
                    else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
                        xhr.responseXML = toXml(xhr.responseText);
                    }
    
                    try {
                        data = httpData(xhr, dt, s);
                    }
                    catch (err) {
                        status = 'parsererror';
                        xhr.error = errMsg = (err || status);
                    }
                }
                catch (err) {
                    log('error caught: ',err);
                    status = 'error';
                    xhr.error = errMsg = (err || status);
                }
    
                if (xhr.aborted) {
                    log('upload aborted');
                    status = null;
                }
    
                if (xhr.status) { // we've set xhr.status
                    status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
                }
    
                // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
                if (status === 'success') {
                    if (s.success) {
                        s.success.call(s.context, data, 'success', xhr);
                    }
                    deferred.resolve(xhr.responseText, 'success', xhr);
                    if (g) {
                        $.event.trigger("ajaxSuccess", [xhr, s]);
                    }
                }
                else if (status) {
                    if (errMsg === undefined) {
                        errMsg = xhr.statusText;
                    }
                    if (s.error) {
                        s.error.call(s.context, xhr, status, errMsg);
                    }
                    deferred.reject(xhr, 'error', errMsg);
                    if (g) {
                        $.event.trigger("ajaxError", [xhr, s, errMsg]);
                    }
                }
    
                if (g) {
                    $.event.trigger("ajaxComplete", [xhr, s]);
                }
    
                if (g && ! --$.active) {
                    $.event.trigger("ajaxStop");
                }
    
                if (s.complete) {
                    s.complete.call(s.context, xhr, status);
                }
    
                callbackProcessed = true;
                if (s.timeout) {
                    clearTimeout(timeoutHandle);
                }
    
                // clean up
                setTimeout(function() {
                    if (!s.iframeTarget) {
                        $io.remove();
                    }
                    else { //adding else to clean up existing iframe response.
                        $io.attr('src', s.iframeSrc);
                    }
                    xhr.responseXML = null;
                }, 100);
            }
    
            var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
                if (window.ActiveXObject) {
                    doc = new ActiveXObject('Microsoft.XMLDOM');
                    doc.async = 'false';
                    doc.loadXML(s);
                }
                else {
                    doc = (new DOMParser()).parseFromString(s, 'text/xml');
                }
                return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
            };
            var parseJSON = $.parseJSON || function(s) {
                /*jslint evil:true */
                return window['eval']('(' + s + ')');
            };
    
            var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
    
                var ct = xhr.getResponseHeader('content-type') || '',
                    xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
                    data = xml ? xhr.responseXML : xhr.responseText;
    
                if (xml && data.documentElement.nodeName === 'parsererror') {
                    if ($.error) {
                        $.error('parsererror');
                    }
                }
                if (s && s.dataFilter) {
                    data = s.dataFilter(data, type);
                }
                if (typeof data === 'string') {
                    if (type === 'json' || !type && ct.indexOf('json') >= 0) {
                        data = parseJSON(data);
                    } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
                        $.globalEval(data);
                    }
                }
                return data;
            };
    
            return deferred;
        }
    };
    
    /**
     * ajaxForm() provides a mechanism for fully automating form submission.
     *
     * The advantages of using this method instead of ajaxSubmit() are:
     *
     * 1: This method will include coordinates for <input type="image" /> elements (if the element
     *    is used to submit the form).
     * 2. This method will include the submit element's name/value data (for the element that was
     *    used to submit the form).
     * 3. This method binds the submit() method to the form for you.
     *
     * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
     * passes the options argument along after properly binding events for submit elements and
     * the form itself.
     */
    $.fn.ajaxForm = function(options) {
        options = options || {};
        options.delegation = options.delegation && $.isFunction($.fn.on);
    
        // in jQuery 1.3+ we can fix mistakes with the ready state
        if (!options.delegation && this.length === 0) {
            var o = { s: this.selector, c: this.context };
            if (!$.isReady && o.s) {
                log('DOM not ready, queuing ajaxForm');
                $(function() {
                    $(o.s,o.c).ajaxForm(options);
                });
                return this;
            }
            // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
            log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
            return this;
        }
    
        if ( options.delegation ) {
            $(document)
                .off('submit.form-plugin', this.selector, doAjaxSubmit)
                .off('click.form-plugin', this.selector, captureSubmittingElement)
                .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
                .on('click.form-plugin', this.selector, options, captureSubmittingElement);
            return this;
        }
    
        return this.ajaxFormUnbind()
            .bind('submit.form-plugin', options, doAjaxSubmit)
            .bind('click.form-plugin', options, captureSubmittingElement);
    };
    
    // private event handlers
    function doAjaxSubmit(e) {
        /*jshint validthis:true */
        var options = e.data;
        if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
            e.preventDefault();
            $(e.target).ajaxSubmit(options); // #365
        }
    }
    
    function captureSubmittingElement(e) {
        /*jshint validthis:true */
        var target = e.target;
        var $el = $(target);
        if (!($el.is("[type=submit],[type=image]"))) {
            // is this a child element of the submit el?  (ex: a span within a button)
            var t = $el.closest('[type=submit]');
            if (t.length === 0) {
                return;
            }
            target = t[0];
        }
        var form = this;
        form.clk = target;
        if (target.type == 'image') {
            if (e.offsetX !== undefined) {
                form.clk_x = e.offsetX;
                form.clk_y = e.offsetY;
            } else if (typeof $.fn.offset == 'function') {
                var offset = $el.offset();
                form.clk_x = e.pageX - offset.left;
                form.clk_y = e.pageY - offset.top;
            } else {
                form.clk_x = e.pageX - target.offsetLeft;
                form.clk_y = e.pageY - target.offsetTop;
            }
        }
        // clear form vars
        setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
    }
    
    
    // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
    $.fn.ajaxFormUnbind = function() {
        return this.unbind('submit.form-plugin click.form-plugin');
    };
    
    /**
     * formToArray() gathers form element data into an array of objects that can
     * be passed to any of the following ajax functions: $.get, $.post, or load.
     * Each object in the array has both a 'name' and 'value' property.  An example of
     * an array for a simple login form might be:
     *
     * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
     *
     * It is this array that is passed to pre-submit callback functions provided to the
     * ajaxSubmit() and ajaxForm() methods.
     */
    $.fn.formToArray = function(semantic, elements) {
        var a = [];
        if (this.length === 0) {
            return a;
        }
    
        var form = this[0];
        var formId = this.attr('id');
        var els = semantic ? form.getElementsByTagName('*') : form.elements;
        var els2;
    
        if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
            els = $(els).get();  // convert to standard array
        }
    
        // #386; account for inputs outside the form which use the 'form' attribute
        if ( formId ) {
            els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet
            if ( els2.length ) {
                els = (els || []).concat(els2);
            }
        }
    
        if (!els || !els.length) {
            return a;
        }
    
        var i,j,n,v,el,max,jmax;
        for(i=0, max=els.length; i < max; i++) {
            el = els[i];
            n = el.name;
            if (!n || el.disabled) {
                continue;
            }
    
            if (semantic && form.clk && el.type == "image") {
                // handle image inputs on the fly when semantic == true
                if(form.clk == el) {
                    a.push({name: n, value: $(el).val(), type: el.type });
                    a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
                }
                continue;
            }
    
            v = $.fieldValue(el, true);
            if (v && v.constructor == Array) {
                if (elements) {
                    elements.push(el);
                }
                for(j=0, jmax=v.length; j < jmax; j++) {
                    a.push({name: n, value: v[j]});
                }
            }
            else if (feature.fileapi && el.type == 'file') {
                if (elements) {
                    elements.push(el);
                }
                var files = el.files;
                if (files.length) {
                    for (j=0; j < files.length; j++) {
                        a.push({name: n, value: files[j], type: el.type});
                    }
                }
                else {
                    // #180
                    a.push({ name: n, value: '', type: el.type });
                }
            }
            else if (v !== null && typeof v != 'undefined') {
                if (elements) {
                    elements.push(el);
                }
                a.push({name: n, value: v, type: el.type, required: el.required});
            }
        }
    
        if (!semantic && form.clk) {
            // input type=='image' are not found in elements array! handle it here
            var $input = $(form.clk), input = $input[0];
            n = input.name;
            if (n && !input.disabled && input.type == 'image') {
                a.push({name: n, value: $input.val()});
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            }
        }
        return a;
    };
    
    /**
     * Serializes form data into a 'submittable' string. This method will return a string
     * in the format: name1=value1&amp;name2=value2
     */
    $.fn.formSerialize = function(semantic) {
        //hand off to jQuery.param for proper encoding
        return $.param(this.formToArray(semantic));
    };
    
    /**
     * Serializes all field elements in the jQuery object into a query string.
     * This method will return a string in the format: name1=value1&amp;name2=value2
     */
    $.fn.fieldSerialize = function(successful) {
        var a = [];
        this.each(function() {
            var n = this.name;
            if (!n) {
                return;
            }
            var v = $.fieldValue(this, successful);
            if (v && v.constructor == Array) {
                for (var i=0,max=v.length; i < max; i++) {
                    a.push({name: n, value: v[i]});
                }
            }
            else if (v !== null && typeof v != 'undefined') {
                a.push({name: this.name, value: v});
            }
        });
        //hand off to jQuery.param for proper encoding
        return $.param(a);
    };
    
    /**
     * Returns the value(s) of the element in the matched set.  For example, consider the following form:
     *
     *  <form><fieldset>
     *      <input name="A" type="text" />
     *      <input name="A" type="text" />
     *      <input name="B" type="checkbox" value="B1" />
     *      <input name="B" type="checkbox" value="B2"/>
     *      <input name="C" type="radio" value="C1" />
     *      <input name="C" type="radio" value="C2" />
     *  </fieldset></form>
     *
     *  var v = $('input[type=text]').fieldValue();
     *  // if no values are entered into the text inputs
     *  v == ['','']
     *  // if values entered into the text inputs are 'foo' and 'bar'
     *  v == ['foo','bar']
     *
     *  var v = $('input[type=checkbox]').fieldValue();
     *  // if neither checkbox is checked
     *  v === undefined
     *  // if both checkboxes are checked
     *  v == ['B1', 'B2']
     *
     *  var v = $('input[type=radio]').fieldValue();
     *  // if neither radio is checked
     *  v === undefined
     *  // if first radio is checked
     *  v == ['C1']
     *
     * The successful argument controls whether or not the field element must be 'successful'
     * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
     * The default value of the successful argument is true.  If this value is false the value(s)
     * for each element is returned.
     *
     * Note: This method *always* returns an array.  If no valid value can be determined the
     *    array will be empty, otherwise it will contain one or more values.
     */
    $.fn.fieldValue = function(successful) {
        for (var val=[], i=0, max=this.length; i < max; i++) {
            var el = this[i];
            var v = $.fieldValue(el, successful);
            if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
                continue;
            }
            if (v.constructor == Array) {
                $.merge(val, v);
            }
            else {
                val.push(v);
            }
        }
        return val;
    };
    
    /**
     * Returns the value of the field element.
     */
    $.fieldValue = function(el, successful) {
        var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
        if (successful === undefined) {
            successful = true;
        }
    
        if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
            (t == 'checkbox' || t == 'radio') && !el.checked ||
            (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
            tag == 'select' && el.selectedIndex == -1)) {
                return null;
        }
    
        if (tag == 'select') {
            var index = el.selectedIndex;
            if (index < 0) {
                return null;
            }
            var a = [], ops = el.options;
            var one = (t == 'select-one');
            var max = (one ? index+1 : ops.length);
            for(var i=(one ? index : 0); i < max; i++) {
                var op = ops[i];
                if (op.selected) {
                    var v = op.value;
                    if (!v) { // extra pain for IE...
                        v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
                    }
                    if (one) {
                        return v;
                    }
                    a.push(v);
                }
            }
            return a;
        }
        return $(el).val();
    };
    
    /**
     * Clears the form data.  Takes the following actions on the form's input fields:
     *  - input text fields will have their 'value' property set to the empty string
     *  - select elements will have their 'selectedIndex' property set to -1
     *  - checkbox and radio inputs will have their 'checked' property set to false
     *  - inputs of type submit, button, reset, and hidden will *not* be effected
     *  - button elements will *not* be effected
     */
    $.fn.clearForm = function(includeHidden) {
        return this.each(function() {
            $('input,select,textarea', this).clearFields(includeHidden);
        });
    };
    
    /**
     * Clears the selected form elements.
     */
    $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
        var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
        return this.each(function() {
            var t = this.type, tag = this.tagName.toLowerCase();
            if (re.test(t) || tag == 'textarea') {
                this.value = '';
            }
            else if (t == 'checkbox' || t == 'radio') {
                this.checked = false;
            }
            else if (tag == 'select') {
                this.selectedIndex = -1;
            }
            else if (t == "file") {
                if (/MSIE/.test(navigator.userAgent)) {
                    $(this).replaceWith($(this).clone(true));
                } else {
                    $(this).val('');
                }
            }
            else if (includeHidden) {
                // includeHidden can be the value true, or it can be a selector string
                // indicating a special test; for example:
                //  $('#myForm').clearForm('.special:hidden')
                // the above would clean hidden inputs that have the class of 'special'
                if ( (includeHidden === true && /hidden/.test(t)) ||
                     (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
                    this.value = '';
                }
            }
        });
    };
    
    /**
     * Resets the form data.  Causes all form elements to be reset to their original value.
     */
    $.fn.resetForm = function() {
        return this.each(function() {
            // guard against an input with the name of 'reset'
            // note that IE reports the reset function as an 'object'
            if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
                this.reset();
            }
        });
    };
    
    /**
     * Enables or disables any matching elements.
     */
    $.fn.enable = function(b) {
        if (b === undefined) {
            b = true;
        }
        return this.each(function() {
            this.disabled = !b;
        });
    };
    
    /**
     * Checks/unchecks any matching checkboxes or radio buttons and
     * selects/deselects and matching option elements.
     */
    $.fn.selected = function(select) {
        if (select === undefined) {
            select = true;
        }
        return this.each(function() {
            var t = this.type;
            if (t == 'checkbox' || t == 'radio') {
                this.checked = select;
            }
            else if (this.tagName.toLowerCase() == 'option') {
                var $sel = $(this).parent('select');
                if (select && $sel[0] && $sel[0].type == 'select-one') {
                    // deselect all other options
                    $sel.find('option').selected(false);
                }
                this.selected = select;
            }
        });
    };
    
    // expose debug var
    $.fn.ajaxSubmit.debug = false;
    
    // helper fn for console logging
    function log() {
        if (!$.fn.ajaxSubmit.debug) {
            return;
        }
        var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
        if (window.console && window.console.log) {
            window.console.log(msg);
        }
        else if (window.opera && window.opera.postError) {
            window.opera.postError(msg);
        }
    }
    
    }));

    呵呵,14年的

    展开全文
  • android dom4j sax 兼容问题

    千次阅读 2012-12-03 10:49:27
    1.在Android2.1中使用dom4j出现的问题 测试: package com.example.dom4jlibs; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j....

    1.在Android2.1中使用dom4j出现的问题

    测试:

    package com.example.dom4jlibs;
    
    import org.dom4j.Document;
    import org.dom4j.DocumentException;
    import org.dom4j.DocumentHelper;
    import org.dom4j.Element;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.util.Log;
    import android.view.Menu;
    
    public class MainActivity extends Activity {
    
    	private static String TAG = "MainActivity";
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            
            testDom4j();
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_main, menu);
            return true;
        }
        
        public void testDom4j() {
        	//创建xml文档
            Document document = DocumentHelper.createDocument();
    
            Element root = document.addElement( "root" );
            
            Element author1 = root.addElement( "author" )
                .addAttribute( "name", "James" )
                .addAttribute( "location", "UK" )
                .addText( "James Strachan" );
            
            Element author2 = root.addElement( "author" )
                .addAttribute( "name", "Bob" )
                .addAttribute( "location", "US" )
                .addText( "Bob McWhirter" );
    
            //将xml文档转换成string
            String xmlString = document.asXML();
            //在LogCat窗口显示
            Log.d(TAG, xmlString);
            //将xmlString解析成xml文档
            try {
    			Document xmlDoc = DocumentHelper.parseText(xmlString);
    			//显示文档内容
    			Log.d(TAG,xmlDoc.asXML());
    		} catch (DocumentException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
        }
    }
    

    结果:

    11-30 13:18:34.944: D/MainActivity(27701): <?xml version="1.0" encoding="UTF-8"?>
    11-30 13:18:34.944: D/MainActivity(27701): <root><author name="James" location="UK">James Strachan</author><author name="Bob" location="US">Bob McWhirter</author></root>
    11-30 13:18:34.975: D/MainActivity(27701): <?xml version="1.0" encoding="UTF-8"?>
    11-30 13:18:34.975: D/MainActivity(27701): <root><author name="James" name="UK">James Strachan</author><author name="Bob" name="US">Bob McWhirter</author></root>
    

    可以看到,所有的属性名称都变成了第一个属性的名称(location变成了name)。


    2.分析

    出现错误的代码为:

    DocumentHelper.parseText(xmlString)
    parseText函数在org.dom4j.DocumentHelper.java 的第269行
        /**
         * <p>
         * <code>parseText</code> parses the given text as an XML document and
         * returns the newly created Document.
         * </p>
         * 
         * @param text
         *            the XML text to be parsed
         * 
         * @return a newly parsed Document
         * 
         * @throws DocumentException
         *             if the document could not be parsed
         */
        public static Document parseText(String text) throws DocumentException {
            Document result = null;
    
            SAXReader reader = new SAXReader();
            String encoding = getEncoding(text);
    
            InputSource source = new InputSource(new StringReader(text));
            source.setEncoding(encoding);
    
            result = reader.read(source);
    
            // if the XML parser doesn't provide a way to retrieve the encoding,
            // specify it manually
            if (result.getXMLEncoding() == null) {
                result.setXMLEncoding(encoding);
            }
    
            return result;
        }

    注意上面红色的内容,dom4j解析字符串的时候是通过创建一个SAXReader来解析的。
    reader.read(source)
        /**
         * <p>
         * Reads a Document from the given <code>InputSource</code> using SAX
         * </p>
         * 
         * @param in
         *            <code>InputSource</code> to read from.
         * 
         * @return the newly created Document instance
         * 
         * @throws DocumentException
         *             if an error occurs during parsing.
         */
        public Document read(InputSource in) throws DocumentException {
            try {
                XMLReader reader = getXMLReader();
    
                reader = installXMLFilter(reader);
    
                EntityResolver thatEntityResolver = this.entityResolver;
    
                if (thatEntityResolver == null) {
                    thatEntityResolver = createDefaultEntityResolver(in
                            .getSystemId());
                    this.entityResolver = thatEntityResolver;
                }
    
                reader.setEntityResolver(thatEntityResolver);
    
                SAXContentHandler contentHandler = createContentHandler(reader);
                contentHandler.setEntityResolver(thatEntityResolver);
                contentHandler.setInputSource(in);
    
                boolean internal = isIncludeInternalDTDDeclarations();
                boolean external = isIncludeExternalDTDDeclarations();
    
                contentHandler.setIncludeInternalDTDDeclarations(internal);
                contentHandler.setIncludeExternalDTDDeclarations(external);
                contentHandler.setMergeAdjacentText(isMergeAdjacentText());
                contentHandler.setStripWhitespaceText(isStripWhitespaceText());
                contentHandler.setIgnoreComments(isIgnoreComments());
                reader.setContentHandler(contentHandler);
    
                configureReader(reader, contentHandler);
    
                reader.parse(in);
    
                return contentHandler.getDocument();
            } catch (Exception e) {
                if (e instanceof SAXParseException) {
                    // e.printStackTrace();
                    SAXParseException parseException = (SAXParseException) e;
                    String systemId = parseException.getSystemId();
    
                    if (systemId == null) {
                        systemId = "";
                    }
    
                    String message = "Error on line "
                            + parseException.getLineNumber() + " of document "
                            + systemId + " : " + parseException.getMessage();
    
                    throw new DocumentException(message, e);
                } else {
                    throw new DocumentException(e.getMessage(), e);
                }
            }
        }
    注意
    XMLReader reader = getXMLReader();
    关于XMLReader的注释是:
     org.xml.sax.XMLReader
    
    
    Interface for reading an XML document using callbacks. 
    
    This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information. 
    Note: despite its name, this interface does not extend the standard Java Reader interface, because reading XML is a fundamentally different activity than reading character data.
    
    XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.
    
    All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.
    
    This interface replaces the (now deprecated) SAX 1.0 Parser interface. The XMLReader interface contains two important enhancements over the old Parser interface (as well as some minor ones):
    
    it adds a standard way to query and set features and properties; and 
    it adds Namespace support, which is required for many higher-level XML standards. 
    There are adapters available to convert a SAX1 Parser to a SAX2 XMLReader and vice-versa.
    
    Since:
    SAX 2.0
    Version:
    2.0.1+ (sax2r3pre1)
    Author:
    David Megginson
    See Also:
    org.xml.sax.XMLFilter
    org.xml.sax.helpers.ParserAdapter
    org.xml.sax.helpers.XMLReaderAdapter
    也就是说必须有一个SAX2的Driver(sax parser解析器)来解析XML文档。sax2与sax1的区别主要是sax2支持namespace(更详细的资料参见http://sax.sourceforge.net/sax2-history.html)。
    dom4j最终调用了org.dom4j.io.JAXPHelper.java 第46行,这个函数确定了解析xml所用的SAX reader:
        public static XMLReader createXMLReader(boolean validating,
                boolean namespaceAware) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setValidating(validating);
            factory.setNamespaceAware(namespaceAware);
    
            SAXParser parser = factory.newSAXParser();
    
            return parser.getXMLReader();
        }
    android上的sax reader(也叫parser?driver?)是org.apache.harmony.xml.ExpatReader,PC上的driver是com.sun.org.apache.xerces.internal.parsers.AbsractSAXParser。
    它们对inputsource的解析
    reader.parse(in);
    Android上的实现:
        public void parse(InputSource input) throws IOException, SAXException {
            if (processNamespacePrefixes && processNamespaces) {
                /*
                 * Expat has XML_SetReturnNSTriplet, but that still doesn't
                 * include xmlns attributes like this feature requires. We may
                 * have to implement namespace processing ourselves if we want
                 * this (not too difficult). We obviously "support" namespace
                 * prefixes if namespaces are disabled.
                 */
                throw new SAXNotSupportedException("The 'namespace-prefix' " +
                        "feature is not supported while the 'namespaces' " +
                        "feature is enabled.");
            }
    
            // Try the character stream.
            Reader reader = input.getCharacterStream();
            if (reader != null) {
                try {
                    parse(reader, input.getPublicId(), input.getSystemId());
                } finally {
                    IoUtils.closeQuietly(reader);
                }
                return;
            }
    
            // Try the byte stream.
            InputStream in = input.getByteStream();
            String encoding = input.getEncoding();
            if (in != null) {
                try {
                    parse(in, encoding, input.getPublicId(), input.getSystemId());
                } finally {
                    IoUtils.closeQuietly(in);
                }
                return;
            }
    
            String systemId = input.getSystemId();
            if (systemId == null) {
                throw new SAXException("No input specified.");
            }
    
            // Try the system id.
            in = ExpatParser.openUrl(systemId);
            try {
                parse(in, encoding, input.getPublicId(), systemId);
            } finally {
                IoUtils.closeQuietly(in);
            }
        }
    上面的红色注释,Expat并没有实现xmlns(命名空间属性),如果要用namespace的话就需要自己实现(不难)。也就是说,这个ExpatReader并没有实现(或者完整实现SAX2),所以导致dom4j在解析的时候出现了问题(主要是QName,LocalName,uri,namespace)。

    3.解决问题

    怎么解决这个问题呢,我使用的方法是用另外的sax driver。在sax官网的quickstart页面(http://sax.sourceforge.net/quickstart.html)上,提供了几个sax driver:

    Class NameNotes
    gnu.xml.aelfred2.SAXDriverLightweight non-validating parser; Free Software
    gnu.xml.aelfred2.XmlReaderOptionally validates; Free Software
    oracle.xml.parser.v2.SAXParserOptionally validates; proprietary
    org.apache.crimson.parser.XMLReaderImplOptionally validates; used in JDK 1.4; Open Source
    org.apache.xerces.parsers.SAXParserOptionally validates; Open Source

    我使用的是org.apache.crimson.parser.XMLReaderImpl,下载:http://xml.apache.org/dist/crimson/crimson-1.1.3-src.zip
    将org.apache.crimson和所有的子目录都添加进工程。
    修改dom4j的源文件 JAXPHelper.java
    -        SAXParserFactory factory = SAXParserFactory.newInstance();
    表示这行被删除
    +import org.apache.crimson.jaxp.DocumentBuilderFactoryImpl;
    表示添加

    Index: JAXPHelper.java
    ===================================================================
    --- JAXPHelper.java	(revision 13)
    +++ JAXPHelper.java	(revision 14)
    @@ -12,6 +12,8 @@
     import javax.xml.parsers.SAXParser;
     import javax.xml.parsers.SAXParserFactory;
     
    +import org.apache.crimson.jaxp.DocumentBuilderFactoryImpl;
    +import org.apache.crimson.jaxp.SAXParserFactoryImpl;
     import org.xml.sax.XMLReader;
     
     /**
    @@ -43,7 +45,8 @@
          */
         public static XMLReader createXMLReader(boolean validating,
                 boolean namespaceAware) throws Exception {
    -        SAXParserFactory factory = SAXParserFactory.newInstance();
    +        SAXParserFactory factory = new SAXParserFactoryImpl();
    +        		//SAXParserFactory.newInstance();
             factory.setValidating(validating);
             factory.setNamespaceAware(namespaceAware);
     
    @@ -54,7 +57,8 @@
     
         public static org.w3c.dom.Document createDocument(boolean validating,
                 boolean namespaceAware) throws Exception {
    -        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    +        DocumentBuilderFactory factory = new DocumentBuilderFactoryImpl();
    +        		//DocumentBuilderFactory.newInstance();
             factory.setValidating(validating);
             factory.setNamespaceAware(namespaceAware);

    当然,除了上面的修改,还有其他的修改,主要是在android上没有完全实现jdk,需要添加一些源文件和library。

    jar文件可以在 http://code.google.com/p/dom4j-android/downloads/list下载。里面包含了源文件和class文件。

    注意,以上修改只经过简单的测试(在android2.1上),如果遇到了问题希望能够发送问题和重现步骤给我,我的邮箱是wssiqi@126.com。


    展开全文
  • dom 解析器,xml 读写

    2015-07-07 11:00:01
    package com.android.settings.wimax; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List;...import javax.xml.parsers.D
  • 环境:CentOS 6.5 64bit ...PHP Fatal error: Class 'DOMDocument' not found in /var/...Is this ok [y/N]: y Downloading Packages: ...
  • 场景: centos7 block migration  ...dom.migrate2(dest_conn, xml,libvirt.VIR_MIGRATE_PERSIST_DEST | libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | libvirt.VIR_MIGRATE_PEER2PEER | libvirt.VIR_MIGRATE_NON_SHAR
  • XML Editor

    2021-06-19 11:00:37
    XSL and XSLT ToolsXSLT EditorThe JSON and XML Editor provides complete support for XSL and XSLT development in its XSLT editor with context-sensitive entry helpers, an XSL outline window, and more.For...
  • dom4j特殊字符处理

    2021-02-28 11:45:29
    dom4j特殊字符处理问题:最近在做项目时,遇到了解析xml问题。使用dom4j解析xml信息时,如果属性值中包含&等特殊字符时,解析会提示如下异常:java.lang.RuntimeException: 生成Document对象异常1.dom4j解析xml...
  • 使用dom4j处理xml文件

    2019-09-26 01:19:07
    1.项目中加入dom4j的jar 2.基本的读取xml文件为Document对象;将Document对象写入到指定文件中 package com.ricoh.rapp.deploymenttool.util; import java.io.File; import java.io.FileOutputStream; ...
  • <pre><code>DOM/XML => enabled, libXML support => active, XML Support => active, XSL => enabled libxslt Version => 1.1.23 </code></pre> <p>So now how will I make use of these ...
  • iOS开发指南-XML

    千次阅读 2016-07-13 12:15:40
    本篇文章的所用的示例项目Demo可以在以下几个地方下载 GitHub下载(https://github.com/GGSDU/XMLDemo) ...关于XMLXML是一种自描述的数据交换格式,多年来一直用于各种计算机语言中.在读写XML时,我们需要
  • DOM

    2021-05-23 08:16:32
    DOM介绍DOM树HTML DOM 节点编程接口HTML DOM方法getElementById()getElementsByTagName()getElementsByClassName()appendChild()replaceChild()insertBefore()removeChild()HTML DOM属性innerHTML属性nodeName ...
  • This document is used for consultant or developers at customer side who would like to know technical detail about how a word template is merged with xml data stream. Before you touch the related ABAP ...
  • dom预习博客

    2021-05-18 17:37:52
    DOM 定义了访问 HTML 和 XML 文档的标准:“W3C 文档对象模型 (DOM) 是中立于平台和语言的接口,它允许程序和脚本动态地访问和更新文档的内容、结构和样式。” 2.W3C DOM 标准被分为 3 个不同的部分: 核心 DO
  • DOM解析XML(一)

    2015-02-05 17:08:50
    1、什么是DOM DOM-Document Object Model. 简称:文档对象模型。我听到这个词还是不知道什么意思。它其实主要用来解析XML与HTML文档。 2、新建Book.xml
  • Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, apache2handler, mysqlnd, PDO, xml, apcu, apc, bz2, calendar, ctype, curl, dom, ...
  • 转自: http://hrbyzq.blogbus.com/logs/20355420.html在使用dom4j生成xml文件时,对于特殊字符“&”,总会自动生成"&",因此在输入""时,<代表在创建writer对象时操作如下:XMLWriter writer = new XML...
  • To enable extensions, verify that they are enabled in your .ini files: - /etc/php.ini - /etc/php.d/bz2.ini - /etc/php.d/calendar.ini - /etc/php.d/ctype.ini - /etc/php.d/curl.ini - /etc/...
  • 问题六:The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled. java环境跑通后,发现安卓设备上跑还是不行,提示这个错误。而且无论怎么百度谷歌都找不到解决方案,无奈...
  • It worked great on the localhost, but when I uploaded it to our web server, I discovered that we do not have all of the DOM package enabled and I cannot use the function dom_import_simplexml()....
  • linux c xml 编程

    2021-05-16 11:44:48
    最近在做linux c xml 编程测试。在网络上似乎找不到太多的资料。我觉得 http://www.xmlsoft.org/tutorial/index.html的教程不错。给大家介绍一下。。是英文,不过很简单。相信做编程的人不会看不懂。。给出国内的一...
  • The requested resource is not available.错误解决方法

    万次阅读 多人点赞 2018-05-14 15:48:01
    cobertura-*.jar,asm-*.jar,dom4j-*.jar,icu4j-*.jar,jaxen-*.jar,jdom-*.jar,\ jetty-*.jar,oro-*.jar,servlet-api-*.jar,tagsoup-*.jar,xmlParserAPIs-*.jar,\ xom-*.jar # Additional JARs (over and above the ...
  • 准备折腾一下WebStack-Laravel这个项目,clone代码到本地之后,当我执行composer install时,出现了提示:Your lock file does not contain a compatible set of packages. Please run composer update;具体信息...
  • 打败我们的,从来不是年龄,而是眼界和格局!...基于 Android UI深度理解:Activity UI视图结构,我们已经熟悉了Activity的窗口视图结构,并且已经明白开发者实现的xml布局文件,最终是被inflated到一个叫m...
  • 官方地址:XSLT Security 官方原文如下: Security Issues ...The following sections describe important XSLT security issues. They are not listed in any significant order. You should familiarize you
  • Android 6.0 inflate过程分析

    千次阅读 2016-01-28 20:37:40
    Android中LayoutInflater解析布局xml的全过程
  • HTML DOM

    2020-05-09 12:36:28
    What is the HTML DOM? The HTML DOM is an Object Model for HTML. It defines: HTML elements as objects Properties for all HTML elements Methods for all HTML elements Events for all HTML elements The ...
  • XML解析简介及Xerces-C++简单使用举例

    万次阅读 2014-09-21 17:09:49
    XML解析简介及Xerces-C++简单使用举例!

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 4,304
精华内容 1,721
关键字:

enabledisnotxmldom