View previous topic :: View next topic |
Author |
Message |
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Fri Dec 24, 2004 5:47 pm Post subject: Mango XML Support |
|
|
What's going on with the Mango XML stuff? I doesn't look useable to me, since much of the code seems incomplete. I've still got my XML-RPC stuff sitting here waiting for Mango to introduce an XML parser so I can use that and submit it.
If I can find some time, I don't mind spending it on some Mango XML stuff, but as I can't make heads or tails of the current SAX stuff, I'd rather start from the ground up. If I can come up with a decent, working XML parser worthy of inclusion in Mango, would anyone have any objections to ditching the current xml directory, and replacing it with my stuff? Is anyone even using the current stuff?
Please note the first "if" in that last paragraph.
John |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Sun Jan 02, 2005 7:31 pm Post subject: Started Work |
|
|
OK... So I've decided to do DOM implementation. I prefer that DOM, and it won't conflict with the current SAX stuff. I'll keep posting updates here.
Just out of curiosity, is there anybody else interested in using this, or will I be the only user?
John |
|
Back to top |
|
|
SpottedTiger
Joined: 29 Nov 2004 Posts: 7 Location: Pennsylvania, USA
|
Posted: Sun Jan 02, 2005 9:36 pm Post subject: |
|
|
teqDruid: I'd be interested in seeing you work toward creating a XML parser that implements a DOM (Document Object Model). Out of curiosity, will it based off any of the W3C's DOM Core Level 1, 2, 3 or a custom version of some sort? _________________ "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Sun Jan 02, 2005 9:52 pm Post subject: DOM |
|
|
It complies with DOM level 1, and adds a few small features. I'm close to having the DOM implementation done, but I won't have a working parser that uses it for at least a week (probably more.) I'm pretty much learning all this stuff as I go, since I've never coded an XML parser before, so I'm not too sure about time.
I figure once the level 1 implementation is done and usable, anyone interested in the more advanced features of 2 or 3 can go ahead and build on the level 1 stuff.
John |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sun Jan 02, 2005 9:52 pm Post subject: Re: Started Work |
|
|
teqDruid wrote: | OK... So I've decided to do DOM implementation. I prefer that DOM, and it won't conflict with the current SAX stuff. I'll keep posting updates here.
Just out of curiosity, is there anybody else interested in using this, or will I be the only user?
John |
I'll certainly use it
Mango.log could use an XML config file, too. As far as DOM goes, the original W3C spec made for a fairly klunky API and I haven't used it since then ... I thought JDOM had a much more streamlined approach.
On the other hand, I would use DOM only for configuration files and so on. Using DOM as a means of utility processing within a server environment is just too expensive in many instances (primarily with respect to the heap), which is where SAX comes into its own.
Would you consider layering your DOM atop of a SAX-style streaming (callback) model? That way, we'd have the best of both worlds; plus, you'd open the door for others to implement alternate DOM styles based upon your streaming implementation.
What do you think? |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Sun Jan 02, 2005 10:02 pm Post subject: |
|
|
At this point, I'm just writing the DOM interfaces and classes. How these are created is completely independant of the parser, so once these are written, it shouldn't be too hard to create a DOM parser that uses SAX to create the DOM. This is, however, reliant on having some usable SAX stuff. Or perhaps I'm not understanding your suggestion.
John |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sun Jan 02, 2005 10:21 pm Post subject: |
|
|
Ahh, right - thanks for the clarification. Are you thinking of using wchar or dchar as the content representation? It might be worthwhile considering a typedef'd implementation, so it can go either way at compile time? |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Sun Jan 02, 2005 10:25 pm Post subject: |
|
|
Right now, I'm using UString for everything. It seems reasonable, to me, to use ICU for all of the text handling so the parser doesn't have to worry about various encodings, and should support a vast number of encodings from the start. |
|
Back to top |
|
|
SpottedTiger
Joined: 29 Nov 2004 Posts: 7 Location: Pennsylvania, USA
|
Posted: Mon Jan 03, 2005 10:17 am Post subject: |
|
|
teqDruid: It sounds like you're taking a good approach in implementing DOM support to Mango. I look forward to seeing your progress on this project. _________________ "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jan 03, 2005 12:07 pm Post subject: |
|
|
teqDruid wrote: | Right now, I'm using UString for everything. It seems reasonable, to me, to use ICU for all of the text handling so the parser doesn't have to worry about various encodings, and should support a vast number of encodings from the start. |
Cool! |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Wed Jan 12, 2005 8:46 am Post subject: Status Update |
|
|
OK... I've finally finished the DOM... I think. A rather annoying bug in DMD prevents some of the features from working, and makes testing a real pain in the ass. See my post on the bugs NG entitled "=== No Damn Good"
I still haven't had time to write a parser, so I don't have that yet. There's also some documentation work to do, and I _WILL_ do it... hold me to that.
Anyway, I'd like to commit the initial release to the repository, but I'm not sure what the process is for that. Should I just ask Brad to give me write access?
-John- |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Jan 12, 2005 12:30 pm Post subject: Re: Status Update |
|
|
teqDruid wrote: | OK... I've finally finished the DOM... I think. A rather annoying bug in DMD prevents some of the features from working, and makes testing a real pain in the ass. See my post on the bugs NG entitled "=== No Damn Good"
I still haven't had time to write a parser, so I don't have that yet. There's also some documentation work to do, and I _WILL_ do it... hold me to that.
Anyway, I'd like to commit the initial release to the repository, but I'm not sure what the process is for that. Should I just ask Brad to give me write access?
-John- |
I'll ask Brad to give you write-access.
Have you thought about a package structure for this, John? There will likely be a number of different XML-oriented packages in Mango (DOM, JDOM, SAX, DOM3, XML-PUSH, etc), so it'd be good to figure out how to isolate the various implementations. What do you think? |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Wed Jan 12, 2005 7:03 pm Post subject: Package Structure |
|
|
I've put all the dom stuff in mango.xml.dom, and mango.xml.dom.model packages. When I write a parser, I'll put it in the package mango.xml.dom.parser.
Sound good? |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Jan 12, 2005 9:16 pm Post subject: Re: Package Structure |
|
|
teqDruid wrote: | I've put all the dom stuff in mango.xml.dom, and mango.xml.dom.model packages. When I write a parser, I'll put it in the package mango.xml.dom.parser.
Sound good? |
Aye! That sounds reasonable; unless anyone has a better idea for how such things should be packaged?
Brad has given you write access to the repository, so you should be able to log in via an SVN client ...
Cheers! |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Fri Jan 14, 2005 2:08 pm Post subject: Re: Package Structure |
|
|
teqDruid wrote: | I've put all the dom stuff in mango.xml.dom, and mango.xml.dom.model packages. |
Cool!
One observation, John, that you might consider ... I see you use UString throughout, which is great; did you consider using the superclass UText instead? The latter is the immutable version. If you used UText, then you could change those internal UString instances into static UText instead, since they'd be sharable (and unchangeable):
Code: | class DocumentFragmentImpl : NodeImpl, DocumentFragment {
private static UText docFragment;
static this() {docFragment = new UText ("#document-fragment");}
public this() {
super(NodeType.DOCUMENT_TYPE_NODE, docFragment, null);
}
} |
UText also avoids copying the content, which can be useful. Also, because UText is immutable, you can rest assured that a DOM client cannot mess with node-content behind your back Further, a client can be confident that a UString passed into the DOM (as the UText superclass) cannot be inadvertantly modified either.
Just a thought! |
|
Back to top |
|
|
|