??xml version="1.0" encoding="utf-8" standalone="yes"?>超碰97人人在线,日本大片在线观看,91久久久久http://www.aygfsteel.com/ricegun/zh-cnMon, 04 Aug 2025 14:00:56 GMTMon, 04 Aug 2025 14:00:56 GMT60JDK5.0 Annotation 入门介绍http://www.aygfsteel.com/ricegun/archive/2010/08/04/327904.htmlW七?/dc:creator>W七?/author>Wed, 04 Aug 2010 02:22:00 GMThttp://www.aygfsteel.com/ricegun/archive/2010/08/04/327904.htmlhttp://www.aygfsteel.com/ricegun/comments/327904.htmlhttp://www.aygfsteel.com/ricegun/archive/2010/08/04/327904.html#Feedback0http://www.aygfsteel.com/ricegun/comments/commentRss/327904.htmlhttp://www.aygfsteel.com/ricegun/services/trackbacks/327904.html背景知识Q?/font>
从JDK5开始提供名为AnnotationQ注释)(j)的功能,它被定义为JSR-175规范。注释是?#8220;@注释?#8221;在代码中存在的,q可以添加一些参数|例如Q@SuppressWarnings(value="unchecked")。注释可以附加在package, class, method, field{上面,相当于给它们d?jin)额外的辅助信息Q我们可以通过反射机制~程实现对这些元数据的访问。如果没有外部解析工L(fng)对其加以解析和处理的情况Q本w不?x)对Java的源代码或class文g{生Q何媄(jing)响,也不?x)对它们的执行生Q何媄(jing)响?/div>
元数据的作用Q大致可分ؓ(f)三种Q编写文档,通过代码里标识的元数据生成文档;代码分析Q通过代码里标识的元数据对代码q行分析Q编译检查,通过代码里标识的元数据让~译器能实现基本的编译检查?/div>
JDK5内置的基本注?/font>
JDK5内置?jin)一些常用的注释Q可以在~译时帮我们捕获部分~译错误Q及(qing)提示信息Q下面介l下q些注释的用法:(x)
1、@Override定义在java.lang.Override中,此注释只适用于修辞方法,表示一个方法声明打重写超cM的另一个方法声明。如果方法利用此注释cdq行注解但没有重写超cL法,则编译器?x)生成一条错误消息。例如我们ؓ(f)某类重写toString()Ҏ(gu)却写成了(jin)tostring()Qƈ且我们ؓ(f)该方法添加了(jin)@Override注释Q代码如下:(x)
public class OverrideDemo {
    @Override
public String tostring() {
        return super.toString();
    }
}
在编译时Q会(x)提示以下错误信息Q?/div>
OverrideTest.java:4: Ҏ(gu)未覆盖其父类的方?/span>
        @Override
         ^1 错误
2、@Deprecated定义在java.lang.Deprecated中,此注释可用于修辞Ҏ(gu)、属性、类Q表CZ鼓励E序员(sh)用这L(fng)元素Q通常是因为它很危险或存在更好的选择。在使用不被赞成的程序元素或在不被赞成的代码中执行重写时Q编译器?x)发(gu)告。用@Deprecated的示例代码如下:(x)
public class DeprecatedDemo {
    public static void main(String[] args) {
         DeprecatedClass.DeprecatedMethod();
    }
}
 
class DeprecatedClass {
    @Deprecated
    public static void DeprecatedMethod() {
        // TODO
    }
}
在编译时Q会(x)得到以下提示信息Q?/div>
注意Q?/span>DeprecatedDemo.java 使用或覆盖了(jin)已过时的 API?/span>
注意Q要?jin)解详细信息Q请使用 -Xlint:deprecation 重新~译?/span>
如果在编译时d-Xlint:deprecation参数Q我们能更清楚的看到该警告的详细信息Q如下:(x)
DeprecatedDemo.java:6: 警告Q?/span>[deprecation] SomeClass 中的 DeprecatedMethod() 已过?/span>
                SomeClass.DeprecatedMethod();
                         ^1 警告
要注意@Deprecated与@deprecated的区别,@deprecated是ؓ(f)?jin)生成文档的需要,例如Q?/div>
class DeprecatedClass {
        /**
* @deprecated 此方法已q时Q不使用
*/
@Deprecated
    public static void DeprecatedMethod() {
        // TODO
    }
}
 3、@SuppressWarnings定义在java.lang.SuppressWarnings中,用来抑制~译时的警告信息。与前两个注释有所不同Q你需要添加一个参数才能正用,q些参数值都是已l定义好?jin)的Q我们选择性的使用好?jin),参数如下Q?/div>
参数
说明
deprecation
使用?jin)过时的cLҎ(gu)时的警告
unchecked
执行?jin)未(g)查的转换时的警告Q例如当使用集合时没有用泛型 (Generics) 来指定集合保存的cd
fallthrough
?Switch E序块直接通往下一U情况而没?Break 时的警告
path
在类路径、源文g路径{中有不存在的\径时的警?/div>
serial
当在可序列化的类上缺?serialVersionUID 定义时的警告
finally
M finally 子句不能正常完成时的警告
all
关于以上所有情늚警告
通过上面的表|你应该了(jin)解到每个参数的用意了(jin)Q下面我׃一个常用的参数uncheckedZQؓ(f)你展C如何用@SuppressWarnings注释Q示例代码如下:(x)
import java.util.List;
import java.util.ArrayList;
public class SuppressWarningsDemo {
        public static List cache = new ArrayList();
        //@SuppressWarnings(value = "unchecked")
        public void add(String data) {
            cache.add(data);
        }
}
当我们不使用@SuppressWarnings注释Ӟ~译器就?x)有如下提示Q?/div>
注意Q?/span>SuppressWarningsDemo.java 使用?jin)未l检查或不安全的操作?/span>
注意Q要?jin)解详细信息Q请使用 -Xlint:unchecked 重新~译?/span>
下面我们L@SuppressWarnings(value="unchecked")q一行的注释W?#8220;//”Q它?x)屏蔽编译时的警告信息,q也是它所要达到的目的?/div>
       另外Q由于@SuppressWarnings注释只有一个参敎ͼq且参数名ؓ(f)valueQ所以我们可以将上面一句注释简写ؓ(f)@SuppressWarnings("unchecked")Q?br /> 同时参数value可以取多个值如Q@SuppressWarnings(value={"unchecked", "deprecation"})
或@SuppressWarnings({"unchecked", "deprecation"})?/div>
自定义Annotation注释
1、注释annotation与接口的异同Q?/div>
因ؓ(f)annotationcd是一个非凡的接口Q所以它与接口之间存在着某些差异Q?/div>
A.       Annotationcd使用关键字@interface而不是interfaceQ这个关键字声明隐含?jin)一个信息,它是l承?jin)java.lang.annotation.Annotation接口Qƈ非声明了(jin)一个interface?/div>
B.        Annotationcd的方法定义是独特的、受限制的,Ҏ(gu)必须声明为无参数、无异常抛出的。这些方法定义了(jin)annotation的成员:(x)Ҏ(gu)名成Z(jin)成员名,而方法返回值成Z(jin)成员的类型。而方法返回值类型必Mؓ(f)primitivecd、Classcd、枚丄型、annotationcd或者由前面cd之一作ؓ(f)元素的一l数l。方法的后面可以使用default和一个默认数值来声明成员的默认|null不能作ؓ(f)成员默认|q与我们在非annotationcd中定义方法有很大不同?/div>
C.       Annotationcd又与接口有着q似之处Q它们可以定义常量、静(rn)态成员类型(比如枚Dcd定义Q。Annotationcd也可以如接口一般被实现或者ѝ?/div>
2、自定义注释的实例:(x)
下面Q我们将看到如何定义annotationcd的例子。它展示?jin)annotationcd声明以及(qing)@interface与interface之间的不同:(x)
import java.lang.annotation.*;
/**
使用annotation来描q那些被标注的成员是不稳定的Q需要更?/span>
*/
public @interface Unstable {
}
下面的另一个例子只定义?jin)一个成员。ƈ通过这个成员命名ؓ(f)valueQ我们可以方便的用这Uannotation的快捷声明方式:(x)
/**
使用Authorq个annotation定义在程序中指出代码的作?/span>
*/
public @interface Author {
     /** 
q回作者名 */
     String value();
}
以下的例子更加复杂。Reviews annotationcd只有一个成员,但是q个成员的类型是复杂的:(x)由Review annotationl成的数l。Review annotationcd?个成员:(x)枚Dcd成员grade、表CReview名称的字W串cd成员Reviewer、具有默认值的字符串类型成?Comment?/div>
/**
* Reviews annotation
cd只有一个成员,
但是q个成员的类型是复杂的:(x)?/span>Review annotationl成的数l?/span>
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Reviews {
    Review[] value();
}
/**
* Review annotation
cd?/span>3个成员:(x) 
枚Dcd成员grade?/span>
表示Review名称的字W串cd成员Reviewer?/span>
h默认值的字符串类型成?/span>Comment?/span>
*/
public @interface Review {
    // 
内嵌的枚丄?/span>
     public static enum Grade { EXCELLENT, SATISFACTORY, UNSATISFACTORY };
     // 
下面的方法定义了(jin)annotation的成?/span>
     Grade grade();
     String reviewer();
     String comment() default "";
}
最后,我们来定义一个annotationҎ(gu)用于|列出类q行中所有的unchecked异常。这?annotationcd一个数l作Z(jin)唯一的成员。数l中的每个元素都是异常类。ؓ(f)?jin)加强对未检查的异常Q此cd帔R是在q行时抛出)(j)q行报告Q我们可以在代码中对异常的类型进行限Ӟ(x)
public @interface UncheckedExceptions { 
     Class<? extends RuntimeException>[] value();
}
Meta-AnnotationcdQ?/span>
Annotation cd可以被它们自己所标注。Java5.0定义?个标准的meta-annotationcdQ分别是QTarget、Retention、Documented、InheritedQ它们被用来提供对其它annotationcd作说明?q些cd和它们所支持的类在java.lang.annotation包中可以扑ֈ?/div>
@Target的用法:(x)指示注释cd所适用的程序元素的U类。如果注释类型声明中不存?/span> Target 元注释,则声明的cd可以用在ME序元素上。如果存在这L(fng)元注释,则编译器强制实施指定的用限制?/span>例如Q以下这个注释只能用来声明方?/span>Q?/span>
@Target(ElementType.METHOD)
    public @interface MyAnnotation {
        ... 
    }
java.lang.annotation.ElementType是一个枚丄型,它具有以下定义:(x)
ElementType?/span>
说明
ElementType.ANNOTATION_TYPE
应用于注释类型声?/div>
ElementType.CONSTRUCTOR
构造方法声?/div>
ElementType.FIELD
应用于字D声明(包括枚D帔RQ?/div>
ElementType.LOCAL_VARIABLE
应用于局部变量声?/div>
ElementType.METHOD
应用于方法声?/div>
ElementType.PACKAGE
应用于包声明
ElementType.PARAMETER
应用于参数声?/div>
ElementType.TYPE
应用于类、接口(包括注释cdQ或枚D声明
 @Retention的用?/span>Q?/span>指示注释cd的注释要保留多久。如果注释类型声明中不存?/span> Retention 注释Q则保留{略默认?/span> RetentionPolicy.CLASSQ例如:(x)
@ Retention(RetentionPolicy.CLASS)
    public @interface MyAnnotation {
        ... 
    }
       java.lang.annotation.RetentionPolicy是一个枚丄型,它具有以下定义:(x)
RetentionPolicy?/span>
说明
RetentionPolicy.CLASS
~译器将把注释记录在cL件中Q但在运行时 VM 不需要保留注?/div>
RetentionPolicy.RUNTIME
~译器将把注释记录在cL件中Q在q行?VM 保留注释,因此可以反射性地d
RetentionPolicy.SOURCE
~译器要丢弃的注?/div>
@Documented的用法:(x)指示某一cd的注释将通过 javadoc 和类似的默认工具q行文档化。应使用此类型来注释q些cd的声明:(x)其注释会(x)影响由其客户端注释的元素的用。如果类型声明是?/span> Documented 来注释的Q则其注释将成ؓ(f)注释元素的公?/span> API 的一部分?/span>Documented是一个没有成员的注释?/span>
@Inherited的用法:(x)指示注释cd自动被子cȝѝ?/span> Inherited?/span>是一个没有成员的注释?/span>
注意Q如果?/span>@Inherited注释cM外的M事物都是无效的。还要注意,此元注释仅对从超cȝ承注释有效;对已实现接口的注释无效?/span>


]]>怎么用javascript做数据的格式?/title><link>http://www.aygfsteel.com/ricegun/archive/2007/01/05/91889.html</link><dc:creator>W七?/dc:creator><author>W七?/author><pubDate>Fri, 05 Jan 2007 01:22:00 GMT</pubDate><guid>http://www.aygfsteel.com/ricegun/archive/2007/01/05/91889.html</guid><wfw:comment>http://www.aygfsteel.com/ricegun/comments/91889.html</wfw:comment><comments>http://www.aygfsteel.com/ricegun/archive/2007/01/05/91889.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/ricegun/comments/commentRss/91889.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/ricegun/services/trackbacks/91889.html</trackback:ping><description><![CDATA[ <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"> <font size="3"> <strong> <span style="FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" mso-bidi-font-size:="" 10.5pt?="">怎么?/span> </strong> <strong> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt"> <font face="Times New Roman">javascript</font> </span> </strong> <strong> <span style="FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" mso-bidi-font-size:="" 10.5pt?="">做数据的格式?/span> </strong> <strong> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt"> <?XML:NAMESPACE PREFIX = O /?> <o:p> </o:p> </span> </strong> </font> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"> <span lang="EN-US" style="FONT-SIZE: 9pt; mso-bidi-font-weight: bold"> <o:p> <font face="Times New Roman"> (tng)</font> </o:p> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" mso-bidi-font-weight:="" bold;="" roman\??="">作者:(x)?/span> <span lang="EN-US" style="FONT-SIZE: 9pt; mso-bidi-font-weight: bold"> <font face="Times New Roman">K<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <strong> <span lang="EN-US" style="FONT-SIZE: 9pt"> <span style="mso-tab-count: 1"> <font face="Times New Roman"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </font> </span> </span> </strong> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">我们在项目中都有用过金额数字?qing)日期等数据格式化输出显C,比如前面加上“E”,数值取数点后两位Q短日期旉{。一般的高语言?qing)开发工具都有提供相应的转换函数?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">format</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">之类Q可是我在最q做</span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">web</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">|上银行相关的系l时Q却遇到q个很麻?ch)的问题Q就?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">javascript</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">不提供这U?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">format</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">函数Q查?jin)些资料Q知?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">vbscript</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">是有格式化函数的Q可?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">vbscript</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">是微软专用的Q无奈只好用正则表达式,可正则表辑ּ也不能够很通用地解军_U类型{换问题,真的是很郁闷Q无意中扑ֈ看到一?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">AJAX</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">开发工L(fng)演示Q工具下载地址?a ><strong>点击链接</strong></a>Q,看到它的数据有显C“E”和数值小数点后两位格式化Q马上下载了(jin)看了(jin)下,发现它居然是?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">javascript+XSL</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">实现?jin)通用的格式化函数Q下?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">AJAX WebShop</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">后,我找到它?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">system.js</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">q个文gQ打开扑ֈ以下函数Q?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <o:p> </o:p> </span> </p> <table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid windowtext .5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellspacing="0" cellpadding="0" border="1"> <tbody> <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"> <td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 426.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt" valign="top" width="568"> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">function FormatFloat(value,mask)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">{<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>return BasicFormat(value,mask,'FormatNumber')<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">}<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">function FormatDate(varDate, bstrFormat, varDestLocale)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">{<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>return BasicFormat(varDate,bstrFormat,'FormatDate',varDestLocale);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">}<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">function FormatTime(varTime, bstrFormat, varDestLocale)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">{<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>return BasicFormat(varTime,bstrFormat,'FormatTime',varDestLocale);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">}<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">function BasicFormat(value,mask,action,param)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">{<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var xmlDoc;<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var xslDoc;<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var v='<formats><format><value>'+value+'</value><mask>'+mask+'</mask></format></formats>';<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>xmlDoc=parseXML(v);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <o:p> <font face="Times New Roman"> (tng)</font> </o:p> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var x; <o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>if(isIE)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x='<xsl:stylesheet xmlns:xsl="uri:xsl">'<o:p></o:p></xsl:stylesheet></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>else<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x='<?XML:NAMESPACE PREFIX = XSL /?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">';<o:p></o:p></xsl:stylesheet></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x+='<xsl:template match="/">';<o:p></o:p></xsl:template></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>if(isIE) {<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x+='<xsl:eval>'+action+'('+value+',"'+mask+'"';<o:p></o:p></xsl:eval></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>if(param)x+=','+param;<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x+=')';<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>}<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>else<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x+='<xsl:value -of="" select="format-number(\" +value+\?,\\?\?+mask+\?\\?)?=""></xsl:value>';<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <o:p> <font face="Times New Roman"> (tng)</font> </o:p> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>x+='';<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>xslDoc=parseXML(x);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var s;<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>if(isIE)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span> <span style="mso-spacerun: yes"> (tng)</span>s= xmlDoc.transformNode(xslDoc)<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>else{<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>//for mozilla/netscape <o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-spacerun: yes"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var processor = new XSLTProcessor(); <o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>processor.importStylesheet(xslDoc);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 2"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var result = processor.transformToFragment(xmlDoc, xmlDoc);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-spacerun: yes"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>var xmls = new XMLSerializer(); <o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-spacerun: yes"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>s = xmls.serializeToString(result);<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>}<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman"> <span style="mso-tab-count: 1"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </span>return s;<o:p></o:p></font> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">}<o:p></o:p></font> </span> </p> </td> </tr> </tbody> </table> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">看来他们?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">xsl</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">用得可真是出入化了(jin)Q居然这样就可以实现很通用的格式化转换?jin),当然不客气?jin)Q直接加到我的函数库中哈?/span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span lang="EN-US" style="FONT-SIZE: 9pt"> <span style="mso-tab-count: 1"> <font face="Times New Roman"> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) </font> </span> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">q个代码偶没有看得很懂,不过实很管用,请对</span> <span lang="EN-US" style="FONT-SIZE: 9pt"> <font face="Times New Roman">XSL</font> </span> <span style="FONT-SIZE: 9pt; FONT-FAMILY: ?hu)? mso-ascii-font-family: \" times="" mso-hansi-font-family:="" \?times="" new="" roman\?;="" roman\??="">_N的朋友分析下也好让我们学习(fn)下?/span> </p> <img src ="http://www.aygfsteel.com/ricegun/aggbug/91889.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/ricegun/" target="_blank">W七?/a> 2007-01-05 09:22 <a href="http://www.aygfsteel.com/ricegun/archive/2007/01/05/91889.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">˹</a>| <a href="http://" target="_blank">¡</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɣֲ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͼ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϲ</a>| <a href="http://" target="_blank">ũ</a>| <a href="http://" target="_blank">DZ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ϲ</a>| <a href="http://" target="_blank">ԭ</a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ī</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">J</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ȩ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ʯʨ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">½</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>