Need help with xml parsing by xml adapter

My xml is a little rusty so I’m hoping for some quick help here. Trying to parse my xml I get the following message:

COM.activesw.adapter.devkit.AdapterException: (108) Could not invoke script “parseSelectorData”

Unable to parse document:  

Details: Parsing error at line 1 uri null mesg The root element is required in a well-formed document.

When I created my parse operation the adapter read the dtd in fine but when I test it I get the error. So I added the following lines to my xml and I get the same thing:

?xml version=“1.0” ?
!DOCTYPE resultset SYSTEM “SelectorData.dtd”

‘resultset’ is the highest level element in my dtd. Any help is greatly appreciated.

BTW, couldn’t figure out how to get the greater than and less than signs to show up in this post so I just used ‘*’ for now.

Can you post the rest of the sample/test doc you’re trying to parse?

And while you are at it, you might as well add the dtd.

For the < and > signs use \ char { 60 } and \ char { 62 } (without the spaces).

Shooting from the hip, it sounds like the root element of your xml doc might not correspond to the root element designated by the dtd. You might also have this problem if more than one root element can be found in the same document. In other words if you have two or more ‘resultset’ elements in the same document.

Rgs,
Andreas Amundin
www.amundin.com

Andreas, thanks for the tip on the char60 and char62, ok here goes. DTD is:

<!ELEMENT resultset (row+)>
<!ATTLIST resultset rows CDATA #REQUIRED columns CDATA #REQUIRED>
<!ELEMENT row (DIVISION, REFERENCE_NUMBER, EMPLOYEE_NUMBER, STORE, ZONE, TOTAL_PIECES, BILL_DATE, SELECTION_DATE)>
<!ATTLIST row number CDATA #REQUIRED>
<!ELEMENT DIVISION (#PCDATA)>
<!ELEMENT REFERENCE_NUMBER (#PCDATA)>
<!ELEMENT EMPLOYEE_NUMBER (#PCDATA)>
<!ELEMENT STORE (#PCDATA)>
<!ELEMENT ZONE (#PCDATA)>
<!ELEMENT TOTAL_PIECES (#PCDATA)>
<!ELEMENT BILL_DATE (#PCDATA)>
<!ELEMENT SELECTION_DATE (#PCDATA)>

Sample data is:

<?xml version=“1.0” ?>
<!DOCTYPE resultset SYSTEM “SelectorData.dtd”>
<resultset rows=“10921” columns=“8”>
<row number=“1”>
<DIVISION>0014</DIVISION>
<REFERENCE_NUMBER>0055111318</REFERENCE_NUMBER>
<EMPLOYEE_NUMBER>0055</EMPLOYEE_NUMBER>
<STORE>111318</STORE>
<ZONE></ZONE>
<TOTAL_PIECES>0.000000</TOTAL_PIECES>
<BILL_DATE>20020506</BILL_DATE>
<SELECTION_DATE>20020506</SELECTION_DATE>
</row>
<row number=“2”>
<DIVISION>0014</DIVISION>
<REFERENCE_NUMBER>0055111326</REFERENCE_NUMBER>
<EMPLOYEE_NUMBER>0055</EMPLOYEE_NUMBER>
<STORE>111326</STORE>
<ZONE></ZONE>
<TOTAL_PIECES>0.000000</TOTAL_PIECES>
<BILL_DATE>20020506</BILL_DATE>
<SELECTION_DATE>20020506</SELECTION_DATE>
</row>
</resultset>

I can’t tell what is going on. I had some problems once when working with xml that had to do with the encoding. I am currently using the following for my xml docs:

<?xml version=“1.0” encoding=“UTF-8”?>

There are more types of ecoding that you can try out as well, but you’ll have to look them up.

Good luck.
Andreas

If you try executing a ParseXML configured operation and map an empty string into it, you will get this error. You might want to check your mapping (where you map the xmlData into your ParseXML step), to make sure it is populated correctly.

!!!
-greg

Doh! Good call Greg, I missed the obvious. I did indeed fail to map the incoming data into the parseXML op. Much thanks!

Hi! Andreas,

U mentioned that u had some problems with the encoding. Even i am having problem with the encoding. I am using UTF-16. Though inside the Developer if i try to do Test-Send XML file, it does identifies and parses it properly. I am using 6.0.1.

When i try to send a UTF-16 file to Trading Networks, it fails to recognize. Is this a limitation of TN.

Also, when i try to send a UTF-16 file directly to a flow service from a browser, it doesnot recognizes and gives an error.

My flow service does have

nodeToDocument
docuemntToString

I need to know what is the best possible way to handle such a situation. My partner would be sending the XML doc with UTF-16. It needs to be sent to TN directly. So TN do have to handle UTF-16. Is their any setting or something in TN which can help me work this issue.

For testing purpose i am sending XML docs using IE. I have a simple HTML form where i submit the XML.

A guess is that if you are posting data from IE the UTF-16 content may be mangled before getting to IS.

  1. Set the HTML meta tag
    <meta>
    so the browser will be in UTF-16 mode. This should get it to put
    the HTML Header Content-type charset parameter so HTTP doesn’t
    mangle anything.

  2. Use a snooper to look at the HTTP message and headers that is posted.

HTH,
Fred