XML LoadXML(doc as String) returns 8 - Not Found

I have an XML segment in a string. When I attempt to load it into an XML document, the LoadXML call always returns errno 8 - Not Found. I can display the XML in a MsgBox, so I know that the XML is correct.

Is there anything else that I should be specifically checking for?

Here is the generated XML that I have in the string:

[code]<?xml version="1.0" encoding="UTF-8"?>

HP LTFS 2.0.0 - Mac OS X - ltfs
a00ca488-7f4b-4f0d-b4dc-ca9303e83362
3
2014-03-20T15:02:54.975226000Z

a
5


b
12

true


2097152
Metadata.xml


2

Discovery Test Format 1
false
2014-03-19T22:02:32.482498000Z
2014-03-20T15:02:44.816128000Z
2014-03-20T14:51:01.100899000Z
2014-03-19T22:02:32.482498000Z
2014-03-19T22:02:32.482498000Z
1


com.apple.FinderInfo
AAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=




.VolumeIcon.icns
295654
false
2014-03-20T14:51:01.100899000Z
2014-03-20T14:51:02.037673000Z
2014-03-20T14:51:02.035610000Z
2014-03-20T15:02:49.224159000Z
2014-03-20T14:51:01.100899000Z
2


NSStoreUUID
E26A3FEF-5ABD-494D-B51A-3F0B2CF5E265


NSStoreType
IconsFileStore


com.apple.FinderInfo
AAAAAGljbkMAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=




0
b
7
0
295654






new-mac-pro-1:~ tjones$ tapectl rewind
new-mac-pro-1:~ tjones$ tapectl fsf 3
new-mac-pro-1:~ tjones$ tapectl header | grep -a “”
Metadata.xml
Discovery Test Format 1
.VolumeIcon.icns
new-mac-pro-1:~ tjones$ tapectl rewind
new-mac-pro-1:~ tjones$ tapectl fsf 3
new-mac-pro-1:~ tjones$ tapectl header
BlockSize: 0

<?xml version="1.0" encoding="UTF-8"?> HP LTFS 2.0.0 - Mac OS X - ltfs a00ca488-7f4b-4f0d-b4dc-ca9303e83362 3 2014-03-20T15:02:54.975226000Z a 5 b 12 true 2097152 Metadata.xml 2 Discovery Test Format 1 false 2014-03-19T22:02:32.482498000Z 2014-03-20T15:02:44.816128000Z 2014-03-20T14:51:01.100899000Z 2014-03-19T22:02:32.482498000Z 2014-03-19T22:02:32.482498000Z 1 com.apple.FinderInfo AAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= .VolumeIcon.icns 295654 false 2014-03-20T14:51:01.100899000Z 2014-03-20T14:51:02.037673000Z 2014-03-20T14:51:02.035610000Z 2014-03-20T15:02:49.224159000Z 2014-03-20T14:51:01.100899000Z 2 NSStoreUUID E26A3FEF-5ABD-494D-B51A-3F0B2CF5E265 NSStoreType IconsFileStore com.apple.FinderInfo AAAAAGljbkMAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 0 b 7 0 295654 [/code]

[quote=73155:@Tim Jones]I have an XML segment in a string. When I attempt to load it into an XML document, the LoadXML call always returns errno 8 - Not Found. I can display the XML in a MsgBox, so I know that the XML is correct.
[/quote]
It’s not

Here is the generated XML that I have in the string:


new-mac-pro-1:~ tjones$ tapectl rewind
new-mac-pro-1:~ tjones$ tapectl fsf 3
new-mac-pro-1:~ tjones$ tapectl header | grep -a “”
Metadata.xml

Is that really what is in the string? It seems like two XML files with bogus text in between:

[quote=73155:@Tim Jones]new-mac-pro-1:~ tjones$ tapectl rewind
new-mac-pro-1:~ tjones$ tapectl fsf 3
new-mac-pro-1:~ tjones$ tapectl header | grep -a “”
Metadata.xml
Discovery Test Format 1
.VolumeIcon.icns
new-mac-pro-1:~ tjones$ tapectl rewind
new-mac-pro-1:~ tjones$ tapectl fsf 3
new-mac-pro-1:~ tjones$ tapectl header
BlockSize: 0[/quote]

Loading just the XML portion seems to work fine…

Sorry - copied too much from the terminal window…

<?xml version="1.0" encoding="UTF-8"?> <ltfsindex version="2.0.0"> <creator>HP LTFS 2.0.0 - Mac OS X - ltfs</creator> <volumeuuid>a00ca488-7f4b-4f0d-b4dc-ca9303e83362</volumeuuid> <generationnumber>3</generationnumber> <updatetime>2014-03-20T15:02:54.975226000Z</updatetime> <location> <partition>a</partition> <startblock>5</startblock> </location> <previousgenerationlocation> <partition>b</partition> <startblock>12</startblock> </previousgenerationlocation> <allowpolicyupdate>true</allowpolicyupdate> <dataplacementpolicy> <indexpartitioncriteria> <size>2097152</size> <name>Metadata.xml</name> </indexpartitioncriteria> </dataplacementpolicy> <highestfileuid>2</highestfileuid> <directory> <name>Discovery Test Format 1</name> <readonly>false</readonly> <creationtime>2014-03-19T22:02:32.482498000Z</creationtime> <changetime>2014-03-20T15:02:44.816128000Z</changetime> <modifytime>2014-03-20T14:51:01.100899000Z</modifytime> <accesstime>2014-03-19T22:02:32.482498000Z</accesstime> <backuptime>2014-03-19T22:02:32.482498000Z</backuptime> <fileuid>1</fileuid> <extendedattributes> <xattr> <key>com.apple.FinderInfo</key> <value type="base64">AAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</value> </xattr> </extendedattributes> <contents> <file> <name>.VolumeIcon.icns</name> <length>295654</length> <readonly>false</readonly> <creationtime>2014-03-20T14:51:01.100899000Z</creationtime> <changetime>2014-03-20T14:51:02.037673000Z</changetime> <modifytime>2014-03-20T14:51:02.035610000Z</modifytime> <accesstime>2014-03-20T15:02:49.224159000Z</accesstime> <backuptime>2014-03-20T14:51:01.100899000Z</backuptime> <fileuid>2</fileuid> <extendedattributes> <xattr> <key>NSStoreUUID</key> <value>E26A3FEF-5ABD-494D-B51A-3F0B2CF5E265</value> </xattr> <xattr> <key>NSStoreType</key> <value>IconsFileStore</value> </xattr> <xattr> <key>com.apple.FinderInfo</key> <value type="base64">AAAAAGljbkMAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</value> </xattr> </extendedattributes> <extentinfo> <extent> <fileoffset>0</fileoffset> <partition>b</partition> <startblock>7</startblock> <byteoffset>0</byteoffset> <bytecount>295654</bytecount> </extent> </extentinfo> </file> </contents> </directory> </ltfsindex>

Found it - the vendor’s tool that we receive the XML output from doesn’t differentiate between stderr and stdout, so the string I was receiving in my app had a bunch of log messages. Weeded them out and things are back to simply slightly annoying.

[quote=73155:@Tim Jones] I can display the XML in a MsgBox, so I know that the XML is correct.
[/quote]
Just an FYI when you do experience this the first thing I do is

  1. run it through tidy
  2. run it through the W3C validator
  3. find a few others and run it through them too

Msgbox will display most anything so it can’t be relied on as a “validator” of any kind
But then you know this :stuck_out_tongue:

I marked it as solved, but the question remains - why errno 8 on a malformed input? Why not 5 or 12 or 14? All three of those make more sense in this case…

There’s no specific error for “input after end of XML document”

None of the data following is invalid characters (hence not error 5)
12 might be plausible but its not really a syntax error - the document up to the point of is valid syntax just there’s more data after the closing ltfsindex element
14 makes no sense as this has nothing to do with a namespace (its structurally invalid)

11 or 19 might make sense but I suspect 8 is a catch all

8 is
// missing required attribute
ET_REQ_ATTR,