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 8789921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:31:45+00:00 2026-06-13T22:31:45+00:00

I’m using for for a year but now I have to modify small scripts

  • 0

I’m using for for a year but now I have to modify small scripts and I’m a newbie with DXL. I have searched in before questions but I don’t know how I can do it.

I have to develope a script that analyzes all objects in the same formal module to extract from each “object text” different strings separated by tab, to be written in other different attributes of the same object.

The formal module contents has been imported from Word. In that way that normal text format is defined as “object text” and every Title style is associated to a given level heading. In that way each object is provided with object heading or object text (but not both at the same time). Objects with object heading doesn’t require any further action. However for objects provided with object text, I have to extract from object text some atributes separated by tabs.

For example a typical object text could be:

NNNN       TEXT/TABLE/OLE OBJECT/ANY OTHER STRING      (XXXXXX)     (YYYYYY)

After apply the script it should be converted as:

Attribute 1: NNNN
Object Text: TEXT/TABLE/OLE OBJECT/ANY OTHER STRING
Attribute 2: XXXXXX
Attribute 3: YYYYYY

I have small script as example but I have passed all the morning trying to modify it to get I need but I can’t do it:

Object o = current
//bool get_text(Object o) {return o."Object Heading" "" != ""}
string get_text(Object o)
{
    if (o."Object Heading" "" != "")
        return "Object Heading" 
    else 
        return "Object Text"
}
Regexp r_id = regexp "(http://0-9a-z/.+) "
for o in current Module do
{
    string texto = o.(get_text(o))
    if (r_id text)
    {
        o."Attribute 1" = textmatch 1
        string input = richTextWithOle(o.(get_text(o)))
        string output = cutRichText(input, 0, length(textmatch 1))
        o.(get_text(o)) = richText(output) 
    }

}
  • 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-06-13T22:31:46+00:00Added an answer on June 13, 2026 at 10:31 pm

    This was a complicated one, but I think I have it figured out. Thanks for posting this because I may find it useful in the future as well.

    I tried this out and it seems to work:

    Object o
    
    string get_text(Object o)
    {
        if (o."Object Heading" "" != "")
            return "Object Heading"
        else 
            return "Object Text"
    }
    
    char cTab = '\t'  //The tab character to find
    Buffer b = create
    string tmp = ""   //Needed to concatenate buffer parts
    int offset = 0
    
    for o in current Module do
    {
        string attr = get_text(o)
        b = o.attr                      //Put the contents in the buffer
        offset = contains(b, cTab)      //Find the first tab
        o."Attribute 1" = b[0:offset-1] //Set the first Attribute
        b = b[offset+1:]                //Remove the first attribute from the text
    
        offset = contains(b, cTab)
        if(offset > -1)
        {
          if(attr == "Object Heading") o.attr = b[0:offset-1]
    
          b = b[offset+1:]
    
          offset = contains(b, cTab)
          if(offset > -1)
          {
            o."Attribute 2" = b[1:offset-2] //Set the second Attribute without the ()
            b = b[offset+1:]
    
            o."Attribute 3" = b[1:length(b)-2]  //Set the third Attribute without the ()
          } else {
            o."Attribute 2" = b[1:length(b)-2]  //Set the second Attribute without the ()
          }
        } else {
          if(attr == "Object Heading") o.attr = b[0:]
        }
    
        if(attr == "Object Text")
        {
          b = richTextWithOle(o.attr) ""     //This section removes the attributes from the contents without losing the rich text formatting and OLEs that may be present.
    
          string word = o."Attribute 1"
          offset = contains(b, word, 0)
          tmp = b[0:offset-1] "" b[(offset+length(word)+5):]
          b = tmp
    
          word = "(" o."Attribute 2" ")"
          offset = contains(b, word, 0)
          if(offset > -1)
          {
            tmp = b[0:offset-6] "" b[offset+length(word):]
            b = tmp
          }
    
          word = "(" o."Attribute 3" ")"
          offset = contains(b, word, 0)
          if(offset > -1)
          {
            tmp = b[0:offset-6] "" b[offset+length(word):]
          }
    
          o.attr = richText(tmp)      //Set the Object Text or Heading
        }
    }
    
    delete b                        //Release the buffer resources
    

    Let me know if this gives you any trouble or if you want more detailed explination of the code.

    EDIT: I updated the above code to take care of the issues you mentioned. It should be all set now. Let me know if you have any more trouble with it.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have an array which has BIG numbers and small numbers in it. I
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.