# iQ xml 4mb limitation

**URL:** <https://clarionhub.com/t/iq-xml-4mb-limitation/7467>\
**Category:** questions\
**Tags:** xml\
**Created:** [September 17, 2024, 8:11am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467 "2024-09-17T08:11:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikola\_Zagorac](https://clarionhub.com/user_avatar/clarionhub.com/nikola_zagorac/32/1530_2.png) [@Nikola\_Zagorac](https://clarionhub.com/u/Nikola_Zagorac)\
**Post date:** [September 17, 2024, 8:11am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/1 "2024-09-17T08:11:42Z")

</div>

Hi,  
so far I have used iqxml and considering the limit of 4mb I need advice on which tool to take and which will replace it the easiest and there are no such limitations.  
Of course, it would be great if it supports a similar structure, so I don't have to change much.

Thanks

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [September 17, 2024, 8:29am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/2 "2024-09-17T08:29:19Z")

</div>

String & Cstrings have a max size of 4MB, so if iqXML is using a Cstring, then creating a larger Cstring using `NEW(Cstring(StringSize))` becomes an option if you can edit the iqXML source.

```auto
CS &CSTRING
StringSize LONG
CODE
StringSize = 0FFFFFFh !16MB
CS &= NEW CSTRING(stringSize)

```

The problem is, you need to know what the StringSize needs to be first, which you can get by looking at the file size as a rough guide.

[GetFileSize function (fileapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfilesize)

[GetFileSizeEx function (fileapi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfilesizeex)

> Remarks  
> **Windows Store apps:**  **GetFileSizeEx** is not supported. Use [GetFileInformationByHandleEx](https://learn.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getfileinformationbyhandleex).

---

<div class="post-metadata">

**Author:** ![JonW](https://clarionhub.com/user_avatar/clarionhub.com/jonw/32/1344_2.png) [@JonW](https://clarionhub.com/u/JonW)\
**Post date:** [September 17, 2024, 11:30am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/3 "2024-09-17T11:30:02Z")

</div>

Is the 4MB limit something you have run into in practice? It is not mentioned as a limit in the help…

Functionality and Limitations

| | Max Elements Deep | 64 | .. |
| --- | --- | --- | --- |
| — | — | — | |
| Max Element Name Length | 128 characters (ISO) | | |
| Max Record Length to File | Unlimited | When using XML:CreateXMLFile() | |
| Max XML File Size (reading) | Unlimited | When using XML:LoadFromFile() | |
| Max XML String Size (reading) | Unlimited | When using XML:LoadFromString() | |
| Max Attributes Per Tag | Unlimited | \<tag attrib1=“1” attrib2=“2” … | |
| Max Field Data Length | 10K | There are 10240 characters | |
| Quotes Accepted | double and single | \<tag attrib1=“1” or \<tag attrib=‘1’ | |
| Max Length for Binary Files | Unlimited | Unlimted for Parsing and Writing | |

---

<div class="post-metadata">

**Author:** ![Nikola\_Zagorac](https://clarionhub.com/user_avatar/clarionhub.com/nikola_zagorac/32/1530_2.png) [@Nikola\_Zagorac](https://clarionhub.com/u/Nikola_Zagorac)\
**Post date:** [September 17, 2024, 12:35pm UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/4 "2024-09-17T12:35:33Z")

</div>

Hi,  
I use XML:AddStringText because I need to encode more then one pdf on xml.  
Liimitation described in documentation:  
If writing to string (XML:CreateXMLString) and the 2nd parameter is False, the maximum string length is 4MB

No metter if I use CS &CSTRING ,and I use it , it write only on 4mb and then stop.

Best regards,

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [September 17, 2024, 1:37pm UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/5 "2024-09-17T13:37:08Z")

</div>

Not sure about iQXML, as I’ve not used it.

As far as a 4MB limit on STRING in Clarion, that limit is only for explicitly declared strings.

e.g.

`MyString STRING(YourStringSize)`

but if you dynamically create a string, you can go much much larger.

```auto
MyString &STRING

   CODE

  MyString &= NEW STRING(BiggerThan4MB)

```

The only limitation is the memory limit that a 32 bit process allows and whether you are using LARGE\_ADDRESS to allow usage of more memory than 2GB.

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [September 17, 2024, 2:26pm UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/6 "2024-09-17T14:26:49Z")

</div>

EasyXML definitely has no such limitations.

---

<div class="post-metadata">

**Author:** ![Nardus\_Swanevelder](https://clarionhub.com/user_avatar/clarionhub.com/nardus_swanevelder/32/1066_2.png) [@Nardus\_Swanevelder](https://clarionhub.com/u/Nardus_Swanevelder)\
**Post date:** [September 17, 2024, 7:42pm UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/7 "2024-09-17T19:42:51Z")

</div>

I used IQ XML for a while but replaced it with Xfiles a few years back due to its limitations and lack of updates.

[https://www.capesoft.com/accessories/xFilessp.htm](https://www.capesoft.com/accessories/xFilessp.htm)

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [September 17, 2024, 10:16pm UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/8 "2024-09-17T22:16:24Z")

</div>

Hi Nikola

I have not used IQXML (like others I have used Capesoft’s XFiles for XML) however it would require a rewrite of all your code to change to some other product.

However IQXML is open source (released under MIT license) and available at :

> **[GitHub - Devuna/Devuna-IQXML: Clarion IQXML library and templates](https://github.com/Devuna/Devuna-IQXML)**
>
> Clarion IQXML library and templates

so there is absolutely nothing stopping you from altering its code to meet your requirements.

if you look at XML:AddStringText:

```auto
XML:AddStringText PROCEDURE (Instr,<FixUp>) ! Declare Procedure

  CODE ! Begin processed code
      if mod:XMLStringInUse = 2
         if FixUp = True
            OutWriteString = OutWriteString & XML:ConvertToXML(InStr) & Mod:Interm
         elsif FixUp = 2
            OutWriteString = OutWriteString & InStr
         else
            OutWriteString = OutWriteString & InStr & Mod:Interm
         end
      else
         if FixUp = True
            TXT:STANDLINE = XML:ConvertToXML(Instr)
         end
         txt:standline = InStr
         xmll:AddToLastString(True)
      end 

```

you will see OutWriteString which is defined in the data pad as:

```auto
OutWriteString CSTRING(4096000),THREAD,AUTO

```

so this is where the limit us coming in.

Rather than use a string of a set arbitrary size, I personally would use StringTheory instead (doing an st.append with ST is _much_ more efficient and is limited only by available memory). But of course you could use SystemStringClass or DynaStringClass or write your own code to make the OutWriteString bigger as both Richard and Jeff have indicated (which is probably the easiest minimal approach requiring least effort).

No matter how you go about removing the 4MB limit, once done you could (if you want to) fork the product and publish the “new improved” version.

hth

Geoff R

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [September 18, 2024, 3:32am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/9 "2024-09-18T03:32:45Z")

</div>

> [@vitesse](#):
>
> I personally would use StringTheory instead

Just to let you know Nikola that out of interest I made those changes to get around the 4MB OutWriteString limit. It required about 50 or so changes to the code where OutWriteString was used. I replaced it with OutWriteST which is a StringTheory object.

I have not tested it at all as (as I mentioned before) I have never used IQXML. But if you use ST and would like to try this to see if it solves your problem then let me know and I will send it to you. The zipped app is about 250k.

Alternatively you could instead change your code to use one of the third party products that is supported (as Nardus mentioned he did a few years back).

cheers

Geoff R

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [September 18, 2024, 3:32am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/10 "2024-09-18T03:32:46Z")

</div>

Yeah, neither does CapeSoft xFiles.

---

<div class="post-metadata">

**Author:** ![Nikola\_Zagorac](https://clarionhub.com/user_avatar/clarionhub.com/nikola_zagorac/32/1530_2.png) [@Nikola\_Zagorac](https://clarionhub.com/u/Nikola_Zagorac)\
**Post date:** [September 18, 2024, 6:53am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/11 "2024-09-18T06:53:35Z")

</div>

Hi,  
Sure I would like to test it. I use StringTheory in this code.

Best regards

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [September 18, 2024, 8:44am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/12 "2024-09-18T08:44:33Z")

</div>

> [@Nikola\_Zagorac](#):
>
> Sure I would like to test it. I use StringTheory in this code.

see your private email. I have sent zipped app with changes as mentioned above.

cheers

Geoff R

---

<div class="post-metadata">

**Author:** ![Nikola\_Zagorac](https://clarionhub.com/user_avatar/clarionhub.com/nikola_zagorac/32/1530_2.png) [@Nikola\_Zagorac](https://clarionhub.com/u/Nikola_Zagorac)\
**Post date:** [September 18, 2024, 10:50am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/13 "2024-09-18T10:50:38Z")

</div>

Hi,  
I compiled , and works !!! Great job Geoff.

No additional changes needed to implement in my app.

Tnx a lot.  
Best regards,  
Nikola

---

<div class="post-metadata">

**Author:** ![vitesse](https://clarionhub.com/user_avatar/clarionhub.com/vitesse/32/837_2.png) [@vitesse](https://clarionhub.com/u/vitesse)\
**Post date:** [September 18, 2024, 11:36am UTC](https://clarionhub.com/t/iq-xml-4mb-limitation/7467/14 "2024-09-18T11:36:52Z")

</div>

great - glad it worked ok for you. As a bonus, it should also run a bit quicker.

since Nikola found it worked OK for him and solved his 4MB problem, I have decided to post it here just in case anyone else still uses the product and has the same problem in the future. The procedures changed were:

 ![image](https://clarionhub-uploads.s3.eu-north-1.amazonaws.com/original/2X/a/a95d2682db1a1160bbb9de802379e957b4d443ad.jpeg)

cheers again

Geoff R  
[iqxml with use of ST.zip](https://clarionhub.com/uploads/short-url/jbZPBurj265CmYXMgOZ2sBlQabc.zip) (244.1 KB)
