XML Parsing Error - Extra content at end of document - xml-parsing

I have been trying to parse this xml response from a service and i keep getting a parsing error. I am working with BODS and its very sensitive to xml structure.
XML response as follows:
<?xml version="1.0" encoding="utf-8" ?>
<GetMapDataResponsexmlns="http://insbridge.net/wsi/Connector/SoftData">
<GetMapDataResult>
<ibdoc gen_date="1/27/2016 11:31 AM" timespan="0.000000" site_location="whlibqa" xmlns="">
<dataresults lob="20" env_def="sr_int">
<program parent_id="675" id="0" ver="1">
<m i="5" r="4" n="Get EL Increased Limits" l="false">
<d p="28">
<v>0</v>
<v>0</v>
<v>100000</v>
<v>100000</v>
<v>500000</v>
<v>1</v>
<v>1</v>
<v>1</v>
<q>1</q>
<q>03/01/2003</q>
<q>12/31/2012</q>
<q>FL</q>
</d>
<d p="29">
<v>0.008</v>
<v>50</v>
<v>500000</v>
<v>500000</v>
<v>500000</v>
<v>1</v>
<v>0</v>
<v>0</v>
<q>2</q>
<q>03/01/2003</q>
<q>12/31/2012</q>
<q>FL</q>
</d>
</m>
</program>
</dataresults>
</ibdoc>
</GetMapDataResult>
</GetMapDataResponse>
Any help would be appreciated

Related

XML - "Invalid XML Document."

I am trying to update google contact.
When i hit http request with below xml body, i am getting error
"Invalid XML Document."
Below is my XML request.
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<entry>\n
<category scheme=\"https://schemas.google.com/g/2005#kind\" term=\"https://schemas.google.com/contact/2008#contact\"/>\n
<title>test Sun 1:00pm Kinjal S</title>\n
<gd:name>\n
<gd:fullName>test Sun 1:00pm Kinjal S</gd:fullName>\n</gd:name>
<gd:phoneNumber label=\"Mobile\" primary=\"true\">+6598765432</gd:phoneNumber>
<gd:phoneNumber label=\"Father\">+6598732465</gd:phoneNumber>
<gd:phoneNumber label=\"Friend\">+6589898989</gd:phoneNumber>
<gContact:groupMembershipInfo deleted=\"false\" href=\"https://www.google.com/m8/feeds/groups/paresh.tps#gmail.com/base/6\"/>\n
</entry>"
Can someone help me to resolve this issue?
I believe the 2 namespaces gd and gContact is not defined. I just added the namespaces and it seems good. Here is the modified XML with dummy namespaces (Please correct it accordingly),
<?xml version="1.0" encoding="UTF-8"?>
<entry
xmlns:gd = "http://www.w3.org/TR/html4/"
xmlns:gContact = "http://www.w3.org/TR/html4/">
<category scheme="https://schemas.google.com/g/2005#kind" term="https://schemas.google.com/contact/2008#contact"/>
<title>test Sun 1:00pm Kinjal S</title>
<gd:name>
<gd:fullName>test Sun 1:00pm Kinjal S</gd:fullName>
</gd:name>
<gd:phoneNumber label="Mobile" primary="true">+6598765432</gd:phoneNumber>
<gd:phoneNumber label="Father">+6598732465</gd:phoneNumber>
<gd:phoneNumber label="Friend">+6589898989</gd:phoneNumber>
<gContact:groupMembershipInfo deleted="false" href="https://www.google.com/m8/feeds/groups/paresh.tps#gmail.com/base/6"/>
</entry>

Parsing data for tag which has colon using RaptureXML in iOS

I have the xml structure xml like that:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<channel>
<item>
<comments>http://www.rtl.fr/actu/politique/laurent-gerra-imitant-nicolas-sarkozy-il-faut-barrer-la-
<slash:comments>0</slash:comments>
</item>
</channel>
</rss>
How can I get text in <slash:comments> tag.
I already try(Swift version):
elementItem.child("comments",inNamespace: "slash").
But it don't work.
As stated here, RaptureXML deletes namespaces, so you can access your content via
elementItem.child("comments")

Using Servicestack WSDL with php

I am trying to use ServiceStack to replace WCF for a self hosted service, accessed with a PHP client that forms its messages from on the WSDL.
The WSDL produced by ServiceStack has "part names" called "par" eg:
<wsdl:message name="GetServiceDetailsIn">
<wsdl:part name="par" element="tns:GetServiceDetails" />
</wsdl:message>
Then the SOAP request produced by PHP looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><par/></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
instead of this from the built-in help:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetServiceDetails xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:Shout" />
</soap:Body>
</soap:Envelope>
The PHP client has used a par tag instead of GetServiceDetails and it gets a blank response. Can the "part name" definition can be renamed or removed in ServiceStack?
It seems you can't doing anything about this in ServiceStack and its not designed to work with PHP anyway. However you can get it working if you get PHP to tweak the XML tags with find-and-replace, or XSLTs, before sending it.

CDATA not working on rails

I have the below xml's in my code
XML Parsing Error: not well-formed
Location: http://localhost:3000/api/client?client=test1
Line Number 1, Column 1111:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<name><![CDATA[TESTapp2]]></name>
<application-identifier>wac-8c28afa4-0f6e-11e1-8885-7071bc62c7bc</application-identifier>
<clients>
<pricepoint id="1" name=<![CDATA[TEST-price]]> currency="dollar" locale="la" country="india" price="50" text="this is a TEST" receipt="oi120934" operator-reference="1213w" operator-id="1"></pricepoint></pricepoints><product-image></product-image>
</clients>
</application>
<name><![CDATA[TESTapp2]]></name> this is working
<name=\"[CDATA[TESTapp2]]\"> this is not working,throws encoding error
AFAIK, Using CDATA as an attribute value is forbidden. CDATA can only be used for text nodes.

Delphi 2007 isn't generating the XML I want to send to my Java-WS web service

I have a Java web service to which I've linked from a Delphi 2007 app using the WSDL Importer. Setting it up has been a rocky road but I'm almost there!
I now have the situation where my arrays aren't being serialized in a way that my Java web service can consume. I've written the same app in .Net to test it out (it works fine) and the XML I'm looking to generate looks like this: -
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body xmlns:NS2="http://path.to.service">
<NS1:addActivities xmlns:NS1="http://path.to.service/">
<login href="#1"/>
<project xsi:type="xsd:string">PROJ001</project>
<activities>
<id xsi:type="xsd:string">DELPHITEST</id>
<name xsi:type="xsd:string">This is a test</name>
</activities>
<activities>
<id xsi:type="xsd:string">DELPHITEST2</id>
<name xsi:type="xsd:string">This is another test</name>
</activities>
</NS1:addActivities>
<NS2:login id="1" xsi:type="NS2:login">
<database xsi:type="xsd:string">My_database</database>
<password xsi:type="xsd:string">neverUmind</password>
<username xsi:type="xsd:string">bob</username>
</NS2:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
However, the XML that Delphi generates is as follows: -
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body xmlns:NS2="http://path.to.service/">
<NS1:addActivities xmlns:NS1="http://path.to.service/">
<login href="#1"/>
<project xsi:type="xsd:string">PROJ001</project>
<activities xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="NS2:activity[2]">
<item href="#2"/>
<item href="#3"/>
</activities>
</NS1:addActivities>
<NS2:login id="1" xsi:type="NS2:login">
<database xsi:type="xsd:string">My_database</database>
<password xsi:type="xsd:string">neverUmind</password>
<username xsi:type="xsd:string">bob</username>
</NS2:login>
<NS2:activity id="2" xsi:type="NS2:activity">
<id xsi:type="xsd:string">DELPHITEST</id>
<name xsi:type="xsd:string">This is a test</name>
</NS2:activity>
<NS2:activity id="3" xsi:type="NS2:activity">
<id xsi:type="xsd:string">DELPHITEST2</id>
<name xsi:type="xsd:string">This is another test</name>
</NS2:activity>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Basically, I need Delphi to stop creating activity elements within the activities element and instead just put each ID and Name inside the an activities element (as .Net does and Java seems to expect).
I've buggered about with the InvRegistry.RegisterInvokeOptions and the RemClassRegistry.RegisterSerializeOptions but none of the combinations seem to work. To be honest I'm on the verge of writting my own XML parser for this as it's taking way to long to figure out. However, if anyone has any suggestions on how this should work I'd be very grateful.
Surely somebody out there must have consumed a Java-WS web service via Delphi 2007 before :)
TIA
It seems the XMLDocument component in Delphi 2007 is broken. I've installed the Alcinoe component instead and that works a charm. That was only a week wasted ... grrrr

Resources