[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML API specification
At 10:14 AM 2/27/97 -0500, you wrote: >I do not think our *parser* API should be the grove that results >from parsing an XML document though. In my JAVA/C++ API, I do something >like the following: > > public class Property { > public String m_name; > public Node m_value; > } > > public class Node { > public Node m_parent; > public Node m_left_sibling; > public Node m_right_sibling; > public Node m_first_child; > public Vector m_properties; > } > > public interface GroveEventHandler { > public OnStartNode(Node node); > public OnEndNode(Node node); > } hmmm... How does is a Property which is a NodeList represented? What about a integer/string/boolean Property? Or even worse, and integer list or a string list! Unfortunately, at one point I spent over a week trying to come up with a simple but powerful grove interface. It just ain't that easy. I think it would go more like... public class Value { public String m_string; public int m_integer; public bool m_bool; public Vector m_list; public int m_type; // what kind of data does this value contain } public class Property { public String m_name; public Value m_value; } public class Node { .... as listed ... } The other minor problem is that the child(ren) are defined by the value of a property (which property is specified on the classdef). I am not convinced that it is really worth implimenting groves this way though. Groves are designed such that it is often easier to duplicate information, in a slightly different form, than to just reference it. Sometimes you have to. For example each element has it's GI as a string valued property. It also has the same information encoded as a reference to the element type. When I was working on a general Grove interface I came to decide that it really should be a grove specific set of classes which build on some more primitive interfaces (such as node, property_value), and which impliment properties as methods. This also opened the door to such functionality as concurent construction (a property value may be 'not-available-yet') which is necessary for an online environment. A the time I also had a SP Application which parsed property sets into some C++ data structures, which I then used to generate teh stubs for the grove interface. The project never was really finished, and I have since moved jobs... so I can't really go back an look at it, though I may be able to get a copy of the SP app. -derek -- Remember: Computers are here to make our lives easier -- ddb@c... // software-engineer // www/sgml/java/perl/etc. xml-dev: A list for W3C XML Developers Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To unsubscribe, send to majordomo@i... the following message; unsubscribe xml-dev List coordinator, Henry Rzepa (rzepa@i...)
|
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
|