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

  • SEARCH
  • Home
  • 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 529699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:07:08+00:00 2026-05-13T09:07:08+00:00

I am working on a wrapper that parses a data file for an existing

  • 0

I am working on a wrapper that parses a data file for an existing web tool. However, I am using large data files so I cannot load the whole thing into memory so I have to walk through it loading it in small chunks. The existing web tool expects data in a style similar to SimpleXML ($obj->parentnode->childnode->childnode returns a string or a node object of some sort). Thankfully the structure is similar to XML but the syntax is odd. And I can’t just translate it to a sane format because of extenuating circumstances. So I have to emulate it on the fly.

As I walk through the file I won’t be needing to parse the whole tree, just the sub-node names of the current node. Each sub-node name and associated offset will be stored in the parent node. If contents of a sub-node need to be accessed then the parent-node object will be cloned, offset values will be updated and the sub-node object will begin parsing it’s content until it finds the requested subnode.

The questions I have are:

  • Cloning the parent node object will give child clones the file handle. Should all the clones use the same handle and use fseek to jump around the file if needed (and that is a pretty big if)?
  • Do I need to close the file? Or will garbage collection at the end of script execution close it? What dangers do I face if I don’t?
  • Will I need to create handles for each clone, or should I stick with them sharing one? If so is there an upper limit?
  • Is there a way for a cloned object to hold a reference to the original object? If I am putting the handle close in the object destructor I probably shouldn’t close it if the object is a clone. And being able to trace upwards may come in handy, possibly.
  • 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-13T09:07:09+00:00Added an answer on May 13, 2026 at 9:07 am

    If you implement the __clone method you can do whatever you want when cloning an object like setting a property flaggin it as a clone and or setting a property that holds the parent.

    edit:

    public function __clone()
    {
      $clone = clone $this;
      $clone->isCloned = true;
      $clone->parent = $this;
      $clone->resource = $this->resource; // i dont think resources are copied be default
      // additional property transference
      return $clone;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a wrapper for a COM object that can only
Working on a project that parses a log of events, and then updates a
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app
I'm using the Apache BeanUtils setProperty method to import data from an Excel file
I am reading data from a file that has, unfortunately, two types of character
I am working with a wrapper class for CFHTTPMessage , which contains a CFHTTPMessageRef
I'm working on a configuration script for a JNI wrapper. One of the configuration
Working with a SqlCommand in C# I've created a query that contains a IN
I have working C++ code using swig which creates a struct, passes it to
I'm working on my first COM project that is importing a c# DLL with

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.