Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6344891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:43:36+00:00 2026-05-24T20:43:36+00:00

How do I parse a document in a table and send it across as

  • 0

How do I parse a document in a table and send it across as a JSON file to another db.

Detailed Desc:
I have crawled and taken data into a table from websites using anemone. I need to now parse it and transfer it as a JSON file to another server. I think, I will have to first convert the document in the table into nokogiri document which can be parsed and converted to json file. Any idea how can I convert the doc into nokogiri document or if anyone has any other idea to parse it and send it as a json file ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:43:37+00:00Added an answer on May 24, 2026 at 8:43 pm

    Okay I found the answer long time back, I basically made use of REST to send message form one application to another, i sent it across as a hash. And the obvious one, I used nokogiri for parsing the table.

    def post_me
         @page_hash = page_to_hash
    
        res = Net::HTTP.post_form(URI.parse('http://127.0.0.1:3007/element_data/save.json'),@page_hash)
      end
    

    For sending the hash from one application to another using net/http.

    def page_to_hash
        require 'rubygems'
        require 'nokogiri'
        require 'open-uri'
        require 'domainatrix'
    
        #page = self.page.sub(/^<!DOCTYPE html(.*)$/, '<!DOCTYPE html>')
        hash={}
        doc = Nokogiri::HTML(self.page)
        doc.search('*').each do |n|
          puts n.name
        end
    

    Using Nokogiri for parsing the page table in my model. page table had the whole body of a webpage.

    file_type = []
    
        file_type_data=doc.xpath('//a/@href[contains(. , ".pdf") or contains(. , ".doc")
                              or contains(. , ".xls") or contains(. , ".cvs") or contains(. , ".txt")]')
        file_type_data.each do |href|
          if href[1] == "/"
            href = "http://" + website_url + href
          end
          file_type << href
        end
    file_type_str = file_type.join(",")
        hash ={:head => head,:title => title, :body => self.body,
          :image => images_str, :file_type => file_type_str, :paragraph => para_str, :description => descr_str,:keyword => key_str,
          :page_url=> self.url, :website_id=>self.parent_request_id, :website_url => website_url,
          :depth => self.depth, :int_links => @int_links_arr, :ext_links => @ext_links_arr
        }
    

    A simple parsing example and how i formed my hash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to parse an xml file into table format, jQuery keeps closing my
I need to get rather complicate JSON data from (large) JSON file into a
I'm currently trying to parse a document into tokens with the help of regex.
I'm working with docx docs, and I need to parse a document into sections
I have to parse a big HTML file, and Im only interested in a
I have the unfortunate task of having to import data from excel into a
I'm starting a new project where I have to parse a document and store
I am trying to parse an XML document and load the array into a
I'm attempting to parse an XML file, and generate & insert the element data
I am using DOMDocument to parse an html document and get some data out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.