<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Buse Bozkurt on Medium]]></title>
        <description><![CDATA[Stories by Buse Bozkurt on Medium]]></description>
        <link>https://medium.com/@busebozkrt0?source=rss-54d77909c624------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0gyZKbk5hqlUy6JbRIoo5w.jpeg</url>
            <title>Stories by Buse Bozkurt on Medium</title>
            <link>https://medium.com/@busebozkrt0?source=rss-54d77909c624------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:39:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@busebozkrt0/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[APACHE NİFİ NEDİR ? NEDEN APACHE NİFİ ? APACHE NİFİ İŞLEMCİ ÖZELLİKLERİ]]></title>
            <link>https://medium.com/@busebozkrt0/apache-ni%CC%87fi%CC%87-nedi%CC%87r-neden-apache-ni%CC%87fi%CC%87-apache-ni%CC%87fi%CC%87-i%CC%87%C5%9Flemci%CC%87-%C3%B6zelli%CC%87kleri%CC%87-15f49a5ad7ac?source=rss-54d77909c624------2</link>
            <guid isPermaLink="false">https://medium.com/p/15f49a5ad7ac</guid>
            <dc:creator><![CDATA[Buse Bozkurt]]></dc:creator>
            <pubDate>Tue, 01 Sep 2020 12:12:55 GMT</pubDate>
            <atom:updated>2020-09-04T15:53:49.325Z</atom:updated>
            <content:encoded><![CDATA[<h4>APACHE NIFI NEDİR ? NEDEN APACHE NIFI ? APACHE NIFI İŞLEMCİ ÖZELLİKLERİ</h4><p>Merhaba, bu yazımda Apache Nifi’nin ne olduğunu ve Apache Nifi işlemci özelliklerini anlatacağım. Apache Nifi üzerinde çalışırken yeterli kaynak olmadığını fark ettim bu yüzden bu yazıyı sizinle paylaşmak istedim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*yf88JXmqaQ9fzJ2B1ZmDLw.png" /></figure><p><strong>Apache Nifi Nedir ?</strong></p><p>NiFi, sistemler arasındaki veri akışını otomatikleştirmek için inşa edilmiştir. Veri akışı (FlowFile) terimi çeşitli bağlamlarda kullanılsa da, burada sistemler arasında otomatik ve yönetilen bilgi akışı anlamına gelir. Apache Nifi verileri sistemden siteme verimli bir şekilde işlemek için açık kaynak sunan bir teknoloji aracıdır.</p><p><strong>Neden Apache Nifi ?</strong></p><ul><li>Kaynaktan alınan verinin yapısı ile hedefteki veri yapısının farklı olma durumlarını tolere edebilir.</li><li>Verinin taşınması esnasında akışın kapasitesini yönetebilir.</li><li>Veri akış hızı ile uyumlu bir şekilde çalışabilir.</li><li>Protokol ve format değişikliklerine uyum sağlayabilir.</li><li>Güvenliğe önem verir.</li><li>Akış sırasında veriler önceliklendirilebilir. Böylece önceliğe sahip olan verilere daha fazla buffer sağlanır.</li></ul><h4><strong>Apache Nifi Kullanıcı Arayüzü</strong></h4><p>Nifi web tabanlı kullanıcı arayüzüne sahiptir ve böylece kullanıcı akış sırasında veri hareketini, hataları kolayca görebilir. Bu arayüz, uygulamayı çalıştırdıktan sonra 8080 portundan açılır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPd5KMwMP-6aZEoqJjCW8w.jpeg" /></figure><p><strong>Apache Nifi İşlemci</strong></p><p>İşlemciler veri akışını oluşturmanın temelini oluşturan bileşenlerdir. İşlemciler ile verileri almak, dönüştürmek, sorgulamak, göndermek gibi işlemler yapılabilir. Apache Nifi veri işlemlerini yapabilmek için (bu yazıda) 260 işlemci sunar. İşlemciler arka planda çalışan JavaScript kütüphaneleriyle oluşturulmuştur ve XML veri tipinde bilgileri girerek veri akışı oluşturulur. Apache Nifi tarafından sunulan işlemciler bizim için yeterli olmadığı takdirde özel işlemcimizi geliştirebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*y6d8zepaAQctkK_q6Y4Qyg.png" /></figure><p>Şimdi her işlemci için ortak olan işlemci ayarlarını ve işlemci planlamasını tanıyalım.</p><p><strong>İşlemci Ayarları</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*a8aCDA1WCeVLDxZTjjLPbQ.png" /></figure><blockquote><strong>Penaulty Duration: </strong>Veri akışında sorun çıktığında<strong><em> </em></strong>Penaulty Duration ayarlanarak akışın kaç sn beklenilmesi gerektiği belirlenebilir ve FlowFile o süre boyunca işlenmez. Default değeri 30 saniyedir.</blockquote><blockquote><strong>Yield Duration: </strong>Eğer işlemcinin ilerleme kaydedemediği durum olursa Yield Duration devreye girer. Örneğin PutSQL işlemcisi sunucuya bağlanamadığında Yield Duration’da ayarlanan zaman kadar işlemci bekler. Default değeri 1 saniyedir.</blockquote><blockquote><strong>Bulletin Level:</strong> Her işlemci çalıştırıldığında bir bülten oluşur ve Bulletin Level değerini istenilen değere ayarlayarak bültende sonuçları izlenebilir. Örneğin bir sorun olduğunda bu hatanın kaynağını görebilmek için Bulletin Level değeri ‘debug’ olarak seçilebilir.</blockquote><blockquote><strong>Automatically Terminate Relationship: </strong>Veri akışının tamamlanabilmesi için her bir işlemcinin diğer işlemcilerle bağlantı kurması gerekir. Bu kısımda FlowFile seçilen ilişki değerlerinden biri ile karşılaşırsa o FlowFile atlanır ve diğer işlemciye aktarılmaz.</blockquote><p><strong>İşlemci Planlaması</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*nI5TgmB6nMfCwpwRYYJV8Q.png" /></figure><blockquote><strong>Timer Driven:</strong> İşlemcinin çalışması için zaman planlaması sağlar. Default değeri Timer Driven seçeneğidir. Bu seçenekle işlemci belirli aralıklarla çalışacak şekilde programlanır.</blockquote><blockquote><strong>Concurrent Tasks: </strong>Bu kısımda aynı anda kaç FlowFile işleneceği belirlenir. Burdaki default değer artırılırsa işlemci kullanılmayan işlemcinin kaynağından kullanarak verileri işler.</blockquote><blockquote><strong>Run Schedule:</strong> Bu alan işlemcinin ne kadar sürede bir çalışacağını belirler. Time Driven alanında CRON Driven seçeneği seçilirse Run Schedule kullanılamaz.</blockquote><blockquote><strong>Run Duration:</strong> Bu kaydırıcı işlemci tetiklendiğinde işlemcinin ne kadar süre çalışacağını belirler. Kaydırıcının sol tarafı daha düşük gecikme anlamına gelir. Çünkü bir sonraki işlemci verileri uzun süre beklemez. Kaydırıcının sağ tarafı yüksek verim anlamına gelir. FlowFile’ın bir sonraki işlemciye aktarılma maliyeti yüksektir bu yüzden bir seferde ne kadar fazla FlowFile işenirse verim o kadar yüksek olur.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*TqY_dTMP38Bk_VLMYUisYg.png" /></figure><p>Nifi’de akışın gerçekleşebilmesi için işlemciler arasında bağlantı kurulması gerektiğini söylemiştik. Yukarıda iki işlemcinin bağlantı örneği verilmiştir. Back Pressure Object Threshold alanında diğer işlemciye geçmeden depolanabilecek FlowFile sayısı belirtilir. Default değeri 1000&#39;dir. Size Threshold alanında ise işlenmeden önce sıraya alınabilecek maximum veri miktarı belirtilir. Sekmenin sağ tarafından ise kuyruktaki istenilen Flowfile’a öncelik verilebilir. Birden fazla öncelik seçilebilir. Öncelik sırası liste sırasına göredir.</p><p>Sonuç olarak Apache Nifi veri akışında ve veri işlemede bir çok kolaylık sağlayabilen bir teknolojidir. Artık Nifi’yi tanıyorsunuz ve denemelere başlayabilirsiniz.</p><p>İyi Çalışmalar 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15f49a5ad7ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHAT IS JAVA SAX PARSER? HOW TO CREATE A HANDLER CLASS?]]></title>
            <link>https://medium.com/@busebozkrt0/what-is-java-sax-parser-how-to-create-a-handler-class-31a335e5ae44?source=rss-54d77909c624------2</link>
            <guid isPermaLink="false">https://medium.com/p/31a335e5ae44</guid>
            <dc:creator><![CDATA[Buse Bozkurt]]></dc:creator>
            <pubDate>Mon, 31 Aug 2020 06:26:46 GMT</pubDate>
            <atom:updated>2020-08-31T13:41:14.001Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, in this article, we will see what SAX Parser is, when it should be used and how to parse the XML file using SAX Parser.</p><p>XML parse aims to reach data by parsing the XML file. Java offers various ways to parse XML files. Before explaining how to parse XML files with SAX Parser, let’s take a look at another widely used library, DOM Parser, and see the difference between the two.</p><p><strong>DOM Parser</strong></p><p>DOM; It is short for Document Object Model. DOM Parser method places the XML file from the root element to the end of the file in a computer science tree in memory. Since the entire file is in memory, the DOM can navigate between nodes, create and remove nodes.</p><p><strong>SAX Parser</strong></p><p>SAX; It is short for Simple Api For Xml. Unlike DOM Parser, the SAX Parser method reads the file as a stream and parse it. The parsing process is carried out with 3 basic callback methods that we will see in the rest of the article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*w2drSgPnaZTQW4-HBiDtNQ.png" /></figure><p><strong>When Should We Use SAX Parser?</strong></p><ul><li>When you want to access the data in the XML file linearly from top to bottom</li><li>When we want to parse very large XML files</li><li>SAX Parser is used when random access to the XML file is not required because it does not store the file in memory.</li></ul><p>We have seen in which situations SAX Parser is used and the difference between it and DOM Parser, now let’s look at how parsing is done with SAX Parser.</p><h4>SAX Parser Example</h4><p>Below is a part of the XML file that we will parse as an example.</p><p>&lt;xn:SubNetwork id=”SIAR5&quot;&gt;<br>&lt;xn:MeContext id=”SI845&quot;&gt;<br>&lt;xn:VsDataContainer id=”SI845&quot;&gt;<br>&lt;xn:attributes&gt;<br>&lt;xn:vsDataType&gt;vsDataMeContext&lt;/xn:vsDataType&gt;<br>&lt;es:vsDataMeContext&gt;<br>&lt;es:platformType&gt;ASS&lt;/es:platformType&gt;<br>&lt;es:MeContextId&gt;SI845&lt;/es:MeContextId&gt;<br>&lt;es:neType&gt;CRP&lt;/es:neType&gt;<br>&lt;/es:vsDataMeContext&gt;<br>&lt;/xn:attributes&gt;<br>&lt;/xn:VsDataContainer&gt;<br>&lt;/xn:MeContext&gt;<br>&lt;/xn:SubNetwork&gt;</p><p>In order to parse the XML file using SAX Parser, we must first create our own Handler class. In order to create the Handler class, we have to extend it from the org.xml.sax.helpers.DefaultHandler class. The DefaultHandler class contains callback methods. These are StartElement, EndElement, CharacterData, StartDocument, EndDocument methods.</p><p>Below is an example of the My Handler class created by extending the DefaultHandler class.</p><pre>import org.xml.sax.Attributes;<br>import org.xml.sax.SAXException;<br>import org.xml.sax.helpers.DefaultHandler;<br><br>import java.util.*;<br><br>public class My_Handler extends DefaultHandler {<br>    public void startElement(String nameSpaceURI, String localName, String qName, Attributes atts) {<br>        ....<br>    }   <br>    public void characters(char ch[], int start, int length)  throws SAXException {<br>        ....<br>    }   <br>    public void endElement(String nameSpaceURI, String localName,     String qName){<br>        ....<br>    }<br>}</pre><p>Let’s look at what the callback methods in the My_Handler class we created are and how they should be used.</p><p><strong>Start Element</strong></p><p>SAX Parser starts parsing the XML file and when it sees the start tag in the file, the startElement() method is called. Information about the tag is sent as a parameter to this method. The startElement() method example is as follows.</p><pre>public void startElement(String nameSpaceURI, String localName, String qName, Attributes atts) {<br>    <br>    if (localName.equalsIgnoreCase(&quot;SubNetwork&quot;)){<br>        ...<br>    }<br><br>    else if (specialMos.contains(localName.toUpperCase())){<br>       ...<br>    }<br>       <br>    else if (localName.equalsIgnoreCase(&quot;VsDataContainer&quot;)){<br>       ...<br>    }<br><br>    else if (localName.equalsIgnoreCase(&quot;vsDataFormatVersion&quot;)){<br>      ...<br>    }<br><br>    else if (localName.equalsIgnoreCase(&quot;vsDataType&quot;)){<br>      ...<br>    }<br>}</pre><p>In the startElement() method example, start tags are checked using the tag information that comes as a parameter. The localName parameter used here refers to the name of the tag. The values of the tag can be reached with the atts parameter.</p><p><strong>Characters</strong></p><p>If there is data in an element in the XML file, the characters() method is called. With this method, parameters in the tag can be accessed.</p><pre>public void characters(char ch[], int start, int length) throws SAXException {<br>    String value = new String(ch, start, length);<br>    <br>    if (inVsDataType){<br>       ...<br>    } <br>    else if (inMo &amp;&amp; inParameter) {<br>       ...<br>    }<br>}</pre><p><strong>End Element</strong></p><p>The endElement() method is called when SAX Parser sees a closing tag while it is moving through the file as a stream. As in the startElement() method, the tag information is sent as a parameter in this method. The endElement() method example is as follows.</p><pre>public void endElement(String nameSpaceURI, String localName, String qName) {   </pre><pre>   if (localName.equalsIgnoreCase(&quot;SubNetwork&quot;)){<br>    ...<br>   }<br><br>   else if (localName.equalsIgnoreCase(&quot;VsDataContainer&quot;)){<br>    ...<br>   }   else if (localName.equalsIgnoreCase(&quot;vsDataFormatVersion&quot;)){ <br>    ...<br>   }  else if (localName.equalsIgnoreCase(&quot;vsDataType&quot;)){<br>    ...<br>  }<br>}</pre><p>Finally, let’s create a main method in the Parser class to run the My_Handler class we created.</p><pre>import javax.xml.parsers.SAXParser;<br>import javax.xml.parsers.SAXParserFactory;public class Parser{<br><br>    public static void main (String[] args)<br>        try {<br>            SAXParserFactory factory=SAXParserFactory.<em>newInstance</em>();           <br>            SAXParser parser = factory.newSAXParser();<br><em>            </em>My_Handler handle = new My_Handler();<br>            parser.parse((&quot;/data.xml&quot;), handle);<br><br>        }<br>        catch (ParserConfigurationException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        } catch (SAXException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        } catch (IOException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        }<br>        return pr;<br>    }<br>}</pre><p>Above, within the main function SaxParserFactory defines an API to parse the XML file. Thus, the SAX Parser object is obtained with the created API. The SAX Parser object takes the file and the created handle as parameters. Thus, the parser process starts.</p><p>With the SAX Parser library, large XML files such as 20 GB can be parsed in a short time. In doing this, there is no need to store the entire XML file in memory. Thus, speed and cost are gained in the parsing process.</p><p>Good Luck 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31a335e5ae44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JAVA SAX PARSER NEDİR ? HANDLER SINIFI NASIL OLUŞTURULUR?]]></title>
            <link>https://medium.com/@busebozkrt0/java-sax-parser-nedi%CC%87r-handler-sinifi-nasil-olu%C5%9Fturulur-e138681bd54?source=rss-54d77909c624------2</link>
            <guid isPermaLink="false">https://medium.com/p/e138681bd54</guid>
            <dc:creator><![CDATA[Buse Bozkurt]]></dc:creator>
            <pubDate>Fri, 28 Aug 2020 11:36:46 GMT</pubDate>
            <atom:updated>2020-09-16T20:58:21.819Z</atom:updated>
            <content:encoded><![CDATA[<h4>Java SAX Parser Nedir? Handler Sınıfı Nasıl Oluşturulur?</h4><p>Merhaba, bu yazımda SAX Parser’ın ne olduğunu, ne zaman kullanılması gerektiğini ve SAX Parser kullanarak XML dosyasının nasıl parse edileceğini göreceğiz.</p><p>XML parse , XML dosyasını ayrıştırarak verilere ulaşabilmeyi hedefler. Java XML dosyalarını parse edebilmek için çeşitli yollar sunmaktadır. SAX Parser ile XML dosyalarının nasıl parse edileceğini anlatmadan önce yaygın olarak kullanılan bir diğer kütüphane DOM Parser’a göz atalım ve ikisinin arasındaki farkı görelim.</p><p><strong>DOM Parser</strong></p><p>DOM; <strong>D</strong>ocument <strong>O</strong>bject <strong>M</strong>odel ifadesinin kısaltmasıdır. DOM Parser yöntemi XML dosyasını kök elemanından dosya sonuna kadar hafızada bilgisayar bilimlerine uygun şekilde bir ağaca yerleştirir. Dosyanın hepsi hafızada bulunduğu için DOM ile düğümler arasında dolaşılabilir, düğüm oluşturup kaldırılabilir.</p><p><strong>SAX Parser</strong></p><p>SAX; <strong>S</strong>imple <strong>A</strong>pi <strong>F</strong>or <strong>X</strong>ml ifadesinin kısaltmasıdır. SAX Parser yöntemi DOM Parser aksine dosyayı akış(stream) olarak okuyarak parse eder. Parse işlemi yazının devamında göreceğimiz 3 temel callback metodu ile gerçekleştirilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*d-MCj_A0RPp2XNLtuAlqhA.png" /></figure><p><strong>Ne Zaman SAX Parser Kullanmalıyız ?</strong></p><ul><li>XML dosyasındaki verilere yukarıdan aşağıya doğrusal olarak ulaşılmak istendiğinde</li><li>Çok büyük XML dosyalarını parse etmek istediğimizde</li><li>Dosyayı bellekte depolamadığı için XML dosyasına rastgele erişim gerekmediğinde SAX Parser kullanılır.</li></ul><p>Hangi durumlarda SAX Parser kullanıldığını ve DOM Parser ile arasındaki farkı gördüğümüze göre SAX Parser ile parse işleminin nasıl olduğuna bakalım.</p><h4><strong>SAX Parser Örneği</strong></h4><p>Aşağıda örnek olması için parse edeceğimiz XML dosyasının bir kısmı bulunmaktadır.</p><p>&lt;xn:SubNetwork id=&quot;SIAR5&quot;&gt;<br> &lt;xn:MeContext id=&quot;SI845&quot;&gt;<br><strong> </strong>&lt;xn:VsDataContainer id=&quot;SI845&quot;&gt;<br> &lt;xn:attributes&gt;<br> &lt;xn:vsDataType&gt;vsDataMeContext&lt;/xn:vsDataType&gt;<br> &lt;es:vsDataMeContext&gt;<br> &lt;es:platformType&gt;ASS&lt;/es:platformType&gt;<br> &lt;es:MeContextId&gt;SI845&lt;/es:MeContextId&gt;<br> &lt;es:neType&gt;CRP&lt;/es:neType&gt;<br> &lt;/es:vsDataMeContext&gt;<br> &lt;/xn:attributes&gt;<br> &lt;/xn:VsDataContainer&gt;<br> &lt;/xn:MeContext&gt;<br> &lt;/xn:SubNetwork&gt;</p><p>SAX Parser kullanarak XML dosyasını parse edebilmek için öncelikle kendi Handler sınıfımızı oluşturmalıyız. Handler sınıfını oluşturabilmek için <strong>org.xml.sax.helpers.DefaultHandler</strong> sınıfından extend etmeliyiz. DefaultHandler sınıfı callback metotları içerir. Bunlar StartElement, EndElement, CharacterData, StartDocument, EndDocument metotlarıdır.</p><p>Aşağıda DefaultHandler sınıfından extend edilerek oluşturulan My_Handler sınıf örneği yer almaktadır.</p><pre><br>import org.xml.sax.Attributes;<br>import org.xml.sax.SAXException;<br>import org.xml.sax.helpers.DefaultHandler;<br><br>import java.util.*;<br><br>public class My_Handler extends DefaultHandler {<br>    public void startElement(String nameSpaceURI, String localName, String qName, Attributes atts) {<br>        ....<br>    }</pre><pre>    public void characters(char ch[], int start, int length) throws SAXException {<br>        ....<br>   }</pre><pre>    public void endElement(String nameSpaceURI, String localName, String qName){<br>        ....<br>    }<br>}</pre><p>Oluşturduğumuz My_Handler sınıfı içindeki callback metotlarının ne olduğuna ve nasıl kullanılması gerektiğine bakalım.</p><p><strong>Start Element</strong></p><p>SAX Parser XML dosyasını ayrıştırmaya başlar ve dosyada başlangıç etiketi gördüğünde startElement( ) metodu çağrılır. Etiket ile ilgili bilgiler bu metoda parametre olarak gönderilir. startElement( ) metot örneği aşağıdaki gibidir.</p><pre>public void startElement(String nameSpaceURI, String localName, String qName, Attributes atts) {<br>    <br>    if (localName.equalsIgnoreCase(&quot;SubNetwork&quot;)){<br>        ...<br>    }<br><br>    else if (specialMos.contains(localName.toUpperCase())){<br>       ...<br>    }<br>       <br>    else if (localName.equalsIgnoreCase(&quot;VsDataContainer&quot;)){<br>       ...<br>    }<br><br>    else if (localName.equalsIgnoreCase(&quot;vsDataFormatVersion&quot;)){<br>      ...<br>    }<br><br>    else if (localName.equalsIgnoreCase(&quot;vsDataType&quot;)){<br>      ...<br>    }<br>}</pre><p>startElement() metot örneğinde parametre olarak gelen etiket bilgileri kullanılarak başlangıç etiketleri kontrol edilir. Burada kullanılan localName parametresi etiketin adını ifade eder. atts parametresi ile etiketin değerlerine ulaşılabilir.</p><p><strong>Characters</strong></p><p>XML dosyasında bir element içerisinde veri bulunuyorsa characters( ) metodu çağrılır. Bu metot ile etiket içerisindeki parametrelere ulaşılabilir.</p><pre>public void characters(char ch[], int start, int length) throws SAXException {<br>    String value = new String(ch, start, length);<br>    <br>    if (inVsDataType){<br>       ...<br>    } <br>    else if (inMo &amp;&amp; inParameter) {<br>       ...<br>    }<br>}</pre><p><strong>End Element</strong></p><p>SAX Parser dosyada akış(stream) olarak ilerlerken kapanış etiketi gördüğünde endElement( ) metodu çağrılır. startElement() metodunda olduğu gibi bu metoda da etiket bilgileri parametre olarak gönderilir. endElement() metot örneği aşağıdaki gibidir.</p><pre>public void endElement(String nameSpaceURI, String localName, String qName) {</pre><pre>   if (localName.equalsIgnoreCase(&quot;SubNetwork&quot;)){<br>    ...<br>   }<br><br>   else if (localName.equalsIgnoreCase(&quot;VsDataContainer&quot;)){<br>    ...<br>   }</pre><pre>   else if (localName.equalsIgnoreCase(&quot;vsDataFormatVersion&quot;)){ <br>    ...<br>   }</pre><pre>  else if (localName.equalsIgnoreCase(&quot;vsDataType&quot;)){<br>    ...<br>  }<br>}</pre><p>Son olarak oluşturduğumuz My_Handler sınıfını çalıştırabilmek için Parser sınıfı içerisinde main metodu oluşturalım.</p><pre>import javax.xml.parsers.SAXParser;<br>import javax.xml.parsers.SAXParserFactory;</pre><pre>public class Parser{<br><br>    public static void main (String[] args)<br>        try {</pre><pre>            SAXParserFactory factory=SAXParserFactory.<em>newInstance</em>();<br>            SAXParser parser = factory.newSAXParser();<br>            My_Handler handle = new My_Handler();<br>            parser.parse((&quot;/data.xml&quot;), handle);</pre><pre>        }<br>        catch (ParserConfigurationException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        } catch (SAXException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        } catch (IOException e) {<br>            pr.ErrorMessage = new StringBuilder(e.getMessage());<br>        }<br>        return pr;<br>    }<br>}</pre><p>Yukarıda main fonksiyon içerisinde SaxParserFactory, XML dosyasını parse edebilmek için bir API tanımlar. Böylece oluşturulan API ile SAX Parser nesnesi elde edilir. SAX Parser nesnesi parametre olarak dosya ve oluşturulan handle’ı alır. Böylece parser işlemi başlar.</p><p>SAX Parser kütüphanesi ile 20 GB gibi büyük XML dosyaları kısa süre içerisinde parse edilebilir. Bunu yaparken XML dosyasının tamamını bellekte depolamaya ihtiyaç yoktur. Böylece parse işlemine hız ve maliyet kazandırılır.</p><p>İyi çalışmalar 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e138681bd54" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>