erdemolkun / plist

Automatically exported from code.google.com/p/plist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ns array parsing bug

GoogleCodeExporter opened this issue · comments

the problem is that if the root element is an array, you simple assume that 
there are only 1 element in XMLPropertyListParser.java, at function 
parseDocument(Document doc), where if the List of nodes is greater than 1 means 
that it is an array. this can simple be fixed by the supplied file.

Original issue reported on code.google.com by kasper.w...@gmail.com on 1 Dec 2012 at 12:42

Attachments:

[deleted comment]
"If the list of nodes is greater than 1 means that it is an array". 

That is wrong, this would mean the property list had several root nodes, which 
is not allowed in the property list format specification. If you create such a 
property list by hand you will see that it cannot be parsed by Xcode or Apple's 
Cocoa library.

The document type description for XML property lists allows for only one root 
node. And that is also the case when the root element is an array. The array 
items are not stored as seperate root nodes, but as children of the root 
(array) node.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <!-- This is the document node -->
  <array> <!-- This is the root node -->
    <string>Item 1</string> <!-- Array entries are in child nodes of the root node-->
    <string>Item 2</string> <!-- not in separate root nodes -->
    <string>Item 3</string>
   </array>
</plist>

Original comment by daniel.dreibrodt on 1 Dec 2012 at 7:57

  • Changed state: Invalid
well funny as it may seems, the attached xml file, is totally valid in the 
iphone sdk,and hench should be valid too, but when extracting the root element, 
you get "dict" back, which is a parsing bug. and the entry point, for which you 
decide the element is excatly the function i changed / suplied a change for.

~ Have fun watch it fail. 

Original comment by kasper.w...@gmail.com on 3 Dec 2012 at 12:04

Attachments:

Ah I see, i did not account for the missing <plist> tag. I thought it was 
always there, but obviously it is not required. I will fix the issue in r89. 
Thanks for reporting that error. I was to quick in marking this issue as 
invalid, sorry.

Original comment by daniel.dreibrodt on 3 Dec 2012 at 12:26

  • Changed state: Verified