{"id":185360,"date":"2013-07-02T19:11:03","date_gmt":"2013-07-02T15:11:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=185360"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=185360","title":{"rendered":"<span class=\"post_title\">JAXB \u0438 XSLT \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c StAX<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 XML \u0444\u0430\u0439\u043b\u044b, \u043e\u0442 \u0441\u043e\u0442\u0435\u043d \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 \u0434\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442.<br \/>  \u041f\u0440\u0438\u0447\u0435\u043c \u0432\u044b\u0434\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u044d\u0433\u0438 \u0441 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u00ab\u0433\u043b\u0443\u0431\u0438\u043d\u0435\u00bb. XSLT \u00ab\u0432 \u043b\u043e\u0431\u00bb \u043b\u043e\u043c\u0430\u043b\u0441\u044f \u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u043f\u0430\u0440\u0441\u0435\u0440\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 XML. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u2014 DOM \u0438 SAX.<br \/>  DOM \u0433\u0440\u0443\u0437\u0438\u0442 \u0432\u0435\u0441\u044c XML \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442, \u0441\u0442\u0440\u043e\u0438\u0442 \u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443. SAX \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438 \u043f\u0440\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 handler&#8217;\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 DOM \u043e\u0442\u043f\u0430\u043b \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. SAX API \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430 handler&#8217;\u0430\u0445, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c. StAX \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 (\u043a\u0430\u043a \u0438 SAX), \u043d\u043e API \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 pull. \u0422\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u00ab\u0432\u044b\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f\u00bb \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e. <\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0431\u044b\u043b\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f, \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c JAXB \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>  <i>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b NDA, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f.<\/i><\/p>\n<p>  \u0418 \u0442\u0430\u043a, \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">XML \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;data&gt;     &lt;dtype_one&gt;         &lt;p1&gt;p1_data_1&lt;\/p1&gt;         &lt;p2&gt;p1_data_1&lt;\/p2&gt;         &lt;p3&gt;p1_data_1&lt;\/p3&gt;         &lt;p4&gt;p1_data_1&lt;\/p4&gt;         &lt;p5&gt;p1_data_1&lt;\/p5&gt;     &lt;\/dtype_one&gt;     &lt;dtype_two&gt;         &lt;p1&gt;p1_data_2&lt;\/p1&gt;         &lt;p2&gt;p1_data_2&lt;\/p2&gt;         &lt;p3&gt;p1_data_2&lt;\/p3&gt;         &lt;p4&gt;p1_data_2&lt;\/p4&gt;         &lt;p5&gt;p1_data_2&lt;\/p5&gt;     &lt;\/dtype_two&gt;     &lt;WS&gt;         &lt;dtype_three&gt;             &lt;p1&gt;p1_data_3&lt;\/p1&gt;             &lt;p2&gt;p1_data_3&lt;\/p2&gt;             &lt;p3&gt;p1_data_3&lt;\/p3&gt;             &lt;p4&gt;p1_data_3&lt;\/p4&gt;             &lt;p5&gt;p1_data_3&lt;\/p5&gt;         &lt;\/dtype_three&gt;     &lt;\/WS&gt; &lt;\/data&gt; <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0438\u0437 \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u044d\u0433\u0438 dtype_one, dtype_two \u0438 dtype_three. \u0422\u044d\u0433\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435. \u0411\u0435\u0440\u0435\u043c <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0441\u0445\u0435\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;xs:schema attributeFormDefault=&quot;unqualified&quot; elementFormDefault=&quot;qualified&quot;            xmlns:xs=&quot;http:\/\/www.w3.org\/2001\/XMLSchema&quot;&gt;     &lt;xs:element name=&quot;data&quot; type=&quot;dataType&quot;\/&gt;     &lt;xs:element name=&quot;dtype_one&quot; type=&quot;dtype_oneType&quot;\/&gt;     &lt;xs:element name=&quot;dtype_two&quot; type=&quot;dtype_twoType&quot;\/&gt;     &lt;xs:element name=&quot;dtype_three&quot; type=&quot;dtype_threeType&quot;\/&gt;      &lt;xs:complexType name=&quot;dtype_oneType&quot;&gt;         &lt;xs:sequence&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p1&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p2&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p3&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p4&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p5&quot;\/&gt;         &lt;\/xs:sequence&gt;     &lt;\/xs:complexType&gt;     &lt;xs:complexType name=&quot;dataType&quot;&gt;         &lt;xs:sequence&gt;             &lt;xs:element type=&quot;dtype_oneType&quot; name=&quot;dtype_one&quot;\/&gt;             &lt;xs:element type=&quot;dtype_twoType&quot; name=&quot;dtype_two&quot;\/&gt;             &lt;xs:element type=&quot;WSType&quot; name=&quot;WS&quot;\/&gt;         &lt;\/xs:sequence&gt;     &lt;\/xs:complexType&gt;     &lt;xs:complexType name=&quot;WSType&quot;&gt;         &lt;xs:sequence&gt;             &lt;xs:element type=&quot;dtype_threeType&quot; name=&quot;dtype_three&quot;\/&gt;         &lt;\/xs:sequence&gt;     &lt;\/xs:complexType&gt;     &lt;xs:complexType name=&quot;dtype_twoType&quot;&gt;         &lt;xs:sequence&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p1&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p2&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p3&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p4&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p5&quot;\/&gt;         &lt;\/xs:sequence&gt;     &lt;\/xs:complexType&gt;     &lt;xs:complexType name=&quot;dtype_threeType&quot;&gt;         &lt;xs:sequence&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p1&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p2&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p3&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p4&quot;\/&gt;             &lt;xs:element type=&quot;xs:string&quot; name=&quot;p5&quot;\/&gt;         &lt;\/xs:sequence&gt;     &lt;\/xs:complexType&gt; &lt;\/xs:schema&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0438 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0447\u0442\u043e \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u00abelement\u00bb \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u0442\u044d\u0433\u043e\u0432:  <\/p>\n<pre><code class=\"xml\">    &lt;xs:element name=&quot;dtype_one&quot; type=&quot;dtype_oneType&quot;\/&gt;     &lt;xs:element name=&quot;dtype_two&quot; type=&quot;dtype_twoType&quot;\/&gt;     &lt;xs:element name=&quot;dtype_three&quot; type=&quot;dtype_threeType&quot;\/&gt; <\/code><\/pre>\n<p>  <\/p>\n<blockquote><p><i>\u0435\u0441\u043b\u0438 \u0441\u0445\u0435\u043c\u044b \u043d\u0435\u0442, IDEA \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0435\u0435 \u043f\u043e xml \u0444\u0430\u0439\u043b\u0443.<\/i><\/p><\/blockquote>\n<p>  \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b <a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/technotes\/tools\/share\/xjc.html\">XJC<\/a> \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043b \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/javax\/xml\/bind\/annotation\/XmlRootElement.html\">@XmlRootElement<\/a>. \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f maven, \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 XJC \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/java.net\/projects\/maven-jaxb2-plugin\/pages\/Home\">maven-jaxb2-plugin<\/a>. \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 @XmlRootElement \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u00abelement\u00bb \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441\u0445\u0435\u043c\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/xjb\/bindings.xjb\">bindings.xjb<\/a>:  <\/p>\n<pre><code class=\"xml\">&lt;jaxb:bindings&gt;         &lt;jaxb:globalBindings &gt;             &lt;xjc:simple\/&gt;         &lt;\/jaxb:globalBindings&gt;     &lt;\/jaxb:bindings&gt; <\/code><\/pre>\n<p>  \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 maven-jaxb2-plugin, \u0432 <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/pom.xml\">pom.xml<\/a>  <\/p>\n<pre><code class=\"xml\">&lt;bindingDirectory&gt;${project.basedir}\/xjb&lt;\/bindingDirectory&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u043a\u043e\u0434\u0443, \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/src\/main\/java\/examples\/processing\/TagEngine.java\">TagEngine<\/a> \u0445\u0440\u0430\u043d\u0438\u0442 <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/src\/main\/java\/examples\/processing\/TagProcessor.java\">\u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0442\u044d\u0433\u043e\u0432<\/a> \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c:  <\/p>\n<pre><code class=\"java\">    public void process(InputStream inputStream) throws FileNotFoundException,             XMLStreamException, TransformerException { \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c XMLStreamReader, \u043f\u043e\u0442\u043e\u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0430         XMLInputFactory factory = XMLInputFactory.newFactory();         XMLStreamReader streamReader = factory.createXMLStreamReader(inputStream); \/\/ \u0421\u0442\u044d\u043a \u0442\u044d\u0433\u043e\u0432         Stack&lt;String&gt; tagStack = new Stack&lt;String&gt;(); \/\/ \u041f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0442\u044d\u0433\u0438         while (streamReader.hasNext()) { \/\/ \u0411\u0435\u0440\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439             int eventType = streamReader.next(); \/\/ \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430             if(eventType == XMLStreamConstants.START_ELEMENT) { \/\/ \u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0441\u0442\u044d\u043a                 tagStack.push(streamReader.getName().toString()); \/\/ \u0418\u0449\u0435\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c                 TagProcessor t = processorMap.get(tagStack);                  if(t != null) { \/\/ \u041d\u0430\u0448\u043b\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c                     t.process(streamReader);                     tagStack.pop();                 }             } else if(eventType == XMLStreamConstants.END_ELEMENT) {                 tagStack.pop();             }         }     } <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/src\/main\/java\/examples\/processing\/JAXBProcessor.java\">JAXBProcessor<\/a> \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f unmarshalling&#8217;\u043e\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/src\/main\/java\/examples\/processing\/XSLTProcessor.java\">XSLTProcessor<\/a> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 XSLT \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443:  <\/p>\n<pre><code class=\"java\">public class DataOne extends JAXBProcessor&lt;DtypeOne&gt; {     private static final String TAG_NAME = &quot;data\/dtype_one&quot;;  \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440      public DataOne() throws JAXBException, SAXException {         super(DtypeOne.class, TAG_NAME);     } \/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0445\u0435\u043c\u044b \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438     public DataOne(String schemaFileName) throws JAXBException, SAXException {         super(DtypeOne.class, TAG_NAME, schemaFileName);     } \/\/ \u0417\u0434\u0435\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u0437 XML \u043e\u0431\u044a\u0435\u043a\u0442     @Override     public void doWork(DtypeOne element) { \/\/        System.out.println(element.getP1());     } } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f XSLT <a href=\"https:\/\/github.com\/scanban\/bigxml\/blob\/master\/src\/main\/java\/examples\/data\/DataThreeXSLT.java\">DataThreeXSLT<\/a>.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (\u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 277 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430):  <\/p>\n<pre> JAXB unmarshall without schema validation Runtime: 8034ms, 277000015 bytes processed Used Memory:80MB JAXB unmarshall with schema validation Runtime: 66180ms, 277000015 bytes processed Used Memory:56MB XSLT processing Runtime: 10604ms, 277000015 bytes processed Used Memory:231MB <\/pre>\n<p>  \u0421 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.<\/p>\n<p>  <b>PS.<\/b> \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/code.google.com\/p\/mockito\/\">Mockito<\/a> (\u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b jmock). \u041f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c spy \u2014 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0436\u0438\u0432\u044b\u043c (\u043d\u0435 mock) \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/185360\/\"> http:\/\/habrahabr.ru\/post\/185360\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 XML \u0444\u0430\u0439\u043b\u044b, \u043e\u0442 \u0441\u043e\u0442\u0435\u043d \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 \u0434\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442.<br \/>  \u041f\u0440\u0438\u0447\u0435\u043c \u0432\u044b\u0434\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u044d\u0433\u0438 \u0441 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u00ab\u0433\u043b\u0443\u0431\u0438\u043d\u0435\u00bb. XSLT \u00ab\u0432 \u043b\u043e\u0431\u00bb \u043b\u043e\u043c\u0430\u043b\u0441\u044f \u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u043f\u0430\u0440\u0441\u0435\u0440\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-185360","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/185360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=185360"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/185360\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=185360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=185360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=185360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}