tailieunhanh - Java & XML 2nd Edition solutions to real world problems phần 6

Trước khi đóng cửa hàng trên JAXP, có một vài bit và miếng của TRAX tôi chưa nói chuyện về. Tôi sẽ không đối xử với những hoàn toàn, vì chúng ít được sử dụng phổ biến, nhưng tôi sẽ chạm vào chúng một thời gian ngắn. Đầu tiên, TRAX giới thiệu một giao diện được gọi là SourceLocator, | Java XML 2nd Edition Odds and ends Before closing shop on JAXP there are a few bits and pieces of TrAX I haven t yet talked about. I won t treat these completely as they are less commonly used but I will touch on them briefly. First TrAX introduces an interface called SourceLocator also in the package. This class functions for transformations exactly as the Locator class did for SAX parsing it supplies information about where action is occurring. Most commonly used for error reporting the interface looks like this package public interface SourceLocator public int getColumnNumber public int getLineNumber public String getPublicId public String getSystemId I won t comment much on this interface as it s pretty self-explanatory. However you should know that in the package there is a subinterface called DOMLocator. This interface adds the getOriginatingNode method which returns the DOM node being processed. This makes error handling quite easy when working with a DOMSource and is useful in applications that work with DOM trees. TrAX also provides a concrete class which defines several constants for use in output properties for transformations. These constants can then be used for setting properties on a Transformer or a Templates object. That leads me to the last subject dealing with TrAX. The Templates interface in TrAX is used when a set of output properties is desired across multiple transformations or when a set of transformation instructions can be used repeatedly. By supplying a Source to a TransformerFactory s newTemplates method you get an instance of the Templates object Get a factory TransformerFactory factory Get a Templates object Templates template new StreamSource At this point the template object would be a compiled representation of the transformation detailed in in this example a .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.