[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Partial documents in tree-based APIs
Markup Object Events (MOE) has supported not-well-formed from the outset. To some extent it's a side effect of representing events and trees with the same object model, but various conversations with Rick Jelliffe about cases where it was important to be able to represent not-well-formed data - for editing of various sorts - made me think it was a good idea on its own merits. It may not always work if you don't know what the tree was supposed to look like, but in combination with various forms of coercion to particular trees and coercion to well-formed output it seems downright sensible to me. elharo@m... (Elliotte Rusty Harold) writes: >Now consider the case of a tree-based API such as DOM, JDOM, or XOM >which encounters a malformedness error. Traditionally, these APIs >have reported no information from a malformed document to the client >application. However, recently Laurent Bihanic submitted a patch to >JDOM in which as much of the document as had been able to be >successfully parsed was made available through the exception that was >thrown to indicate the malformedness error. This was quite clever. It >had never occurred to me, and I had never noticed any other API do >anything similar. > >What I'd like to get broader discussion of is whether this is a good >idea. There are certainly use cases for it. Bihanic wanted to read >the envelope of an XML message even if the data was malformed. >However, there are also problems. For instance, if the >well-formedness error is a missing end-tag, then the element with the >missing end-tag will still appear in the partial tree. And if the >problem is a missing root element, then this may produce a Document >object with no root element. On the other hand, rollback, failure to >commit, or simply ignoring the malformed document is much easier than >with a streaming API since you know in advance that the document is >malformed. -- Simon St.Laurent Ring around the content, a pocket full of brackets Errors, errors, all fall down! http://simonstl.com -- http://monasticxml.org
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|