Closed pandapancake closed 4 years ago
I end up putting the <xml two>
inside the<xml one>
and is working. Just not sure why it is not showing even when I remove the xxxEHRxxx
.
The issue I think is that it isn't well structured XML. For example, this isn't valid XML because you have to have a single root element:
<xml-one>...</xml-one><xml-two>...</xml-two>
This would be, though:
<root><xml-one>...</xml-one><xml-two>...</xml-two></root>
SWXMLHash will do its best, but if the XML content isn't valid XML, it can't necessarily parse everything. If you're trying to combine two XML documents, I'd wrap the two of them in another <root>
element or something like that first.
Hope this helps!
Ok Thanks! I know what to do now!
So one of the function I have in my app is merging two XML files by uploading it to the server. Then the server will return it back with one combined XML file with one string value between two XML files.
Return from the server:
As the example the
xxxEHRxxx
is the string value. My problem is when I doString(bytes: data, encoding: .utf8)
thexxxEHRxxx
and<xml two>
are showing but not withSWXMLHash.parse(data)
. It will only show the XML before the string part. What can I do to let the full combined XML show? Thank you.