Skip to main content

[archive] C$XML string parsing

  • February 12, 2008
  • 10 replies
  • 0 views

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott

10 replies

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
I'm not an expert at C$XML, Marilyn Prince at Acucorp had a great sample program (attached). If my memory is correct you need to write the file before you can replace the file that is on the remote server. I believe the sample has many of the functions you are looking for. You'll need a 7.x version.

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
I'm not an expert at C$XML, Marilyn Prince at Acucorp had a great sample program (attached). If my memory is correct you need to write the file before you can replace the file that is on the remote server. I believe the sample has many of the functions you are looking for. You'll need a 7.x version.

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
Thanks,

However, we already have a quite extensive version using C$XML, the issue we have is in using the C$XML-PARSE-STRING as opposes to the FILENAME or OPEN-FILE opcodes. As far as I know we cannot get access to the parsed XML string (ie if we modify it) until we write the XML out to a file (all be it a temporay file). What I want to know is is there anyway of accessing the memory area that has been allocated by the C$XML routine? Either through windows functions or manipulating the parser handle? Or can we trick the C$XML write routine to do something else.

I would like to know this before I go down the track of using MSXML6.DLL directly to create an object in the cobol program.

Regards

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
Thanks,

However, we already have a quite extensive version using C$XML, the issue we have is in using the C$XML-PARSE-STRING as opposes to the FILENAME or OPEN-FILE opcodes. As far as I know we cannot get access to the parsed XML string (ie if we modify it) until we write the XML out to a file (all be it a temporay file). What I want to know is is there anyway of accessing the memory area that has been allocated by the C$XML routine? Either through windows functions or manipulating the parser handle? Or can we trick the C$XML write routine to do something else.

I would like to know this before I go down the track of using MSXML6.DLL directly to create an object in the cobol program.

Regards

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
This is not possible. The structure that holds the XML tree is not a single block of memory, so C$MEMCPY is right out as a possibility. It would be considered an enhancement request to implement SAVE-STRING (say), equivalent to WRITE-FILE.

Also, the user may want to consider XML GENERATE, though a COBOL group structure is required to use this.

Finally, using STRING, the user could create a string which has all of the XML data, just by going through the elements, attributes and data and appending it to a large data string. But that requires coding.

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
thanks for that, so at the moment what you are saying is that in order to process an XML string (this we can do) we would then either have to write this out to a temporary file (by the way how do we get this back into a string?) or we could run throug a loop extracting each element and construct it in a new string. The XML string is comming from a VB Application via the COM object (ACUGT.EXE), we are validating the contents and remapping certain fields and values in this XML string resulting in a modified XML string which we will pass onto the next program as a string for processing. Essentialy an XML transformation module. Any Ideas?

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
thanks for that, so at the moment what you are saying is that in order to process an XML string (this we can do) we would then either have to write this out to a temporary file (by the way how do we get this back into a string?) or we could run throug a loop extracting each element and construct it in a new string. The XML string is comming from a VB Application via the COM object (ACUGT.EXE), we are validating the contents and remapping certain fields and values in this XML string resulting in a modified XML string which we will pass onto the next program as a string for processing. Essentialy an XML transformation module. Any Ideas?

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
As suggested, your best option is probably to extract each element and build the string manually using the STRING verb, then pass this to the VB app.

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
As suggested, your best option is probably to extract each element and build the string manually using the STRING verb, then pass this to the VB app.

[Migrated content. Thread originally posted on 12 February 2008]

We are attempting to use C$XML to parse a string from an external source. The string parsing works fine but we also want to update the XML string to return it to the external application. I can add a child and/or sibling and get a valid return-code/handle. However, as this is performed in memory, I cannot access the string to return it to the external application. The doco for C$XML states that a CXML-WRITE-FILE must be executed to commit any modifications applied using C$XML add or modify functions when performing a PARSE-FILE. Is there an equivalent for PARSE-STRING manipulation? Alterantively, is there a way to access the address of the memory area being referred to by the handle which C$XML references? How can I get the pointer/memory address of an area referred to by a handle? Can I use C$MEMCPY to retrieve that area?

Thanks in advance.

Scott
Unfortunately what we have done is rewrite the C$XML routine and usr the MSXML object directly reproducing the C$XML functions plus our own functions ie [rootnode].xml which returns the entire tree as a string.

Thanks