Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: object2XML

From: bry:itnisk at: 9-Mar-2004 21:52

Well I'm reasonably knowledgable in matters of xml usage, etc. although my rebol knowledge is shit, given that I just use it for small scripting hacks here and there if I use gavin's xml-object and a function to clean-up the output a bit: doc-tree: func[unpickedDom][pick third unpickedDom 1] I get
>> xmldom: parse-xml read %t.xml
XML Version: 1.0 == [document none [["tag" ["r" "here" "xmlns:stuff" ""] ["^/stuff here ^/" ["stuff:p" ["hi" "test"] [["blah" n one [...
>> t: doc-tree xmldom
== ["tag" ["r" "here" "xmlns:stuff" ""] ["^/stuff here ^/" ["stuff:p" ["hi" "test"] [["blah" none ["more"]]]] ^/ ... t is actually ["tag" ["r" "here" "xmlns:stuff" ""] ["^/stuff here ^/" ["stuff:p" ["hi" "test"] [["blah" none ["more"]]]] "^/ [ blah" none none] "^/"]] now in this case I don't think the namespaces are a problem, I don't understand xml-object well enough to know if it fails on namespace problems, but a namespace function could be built easily enough to go through the block getting all referenced namespaces and checking against those references whenever a usage is encountered. Of course it should be noted that the namespaces are placed in a block with the attributes but I don't think that is a major problem although there should of course be functions for returning just attributes without namespaces. What I find more irritating is the textnodes: I have 4 textnodes: ^/stuff here ^/ ["more"] ^/ and again ^/ now none is used in an empty tag, but "^/" is used for any empty textnode, and "^/ string^/" seems to be used for any textnode that has a sibling node, whereas textnodes that are only children are represented as a block with one string value. it would probably be better to just do that as another ["^/string value^/"] One of the things that should probably be considered for any functions for working with xml in rebol is optimizations for working with various types of xml, for example a document like structure such as we see above (for which I would say the rule is that a document structure has multiple textnodes, that an element which has as a direct child a textnode and an element is a document structure) as opposed to the more programmer friendly data type structure: <customers> <customer> <name><fname>John</fname> <lname>Simpson</lname> </name> ..... </customer> </customers>
> Hi Robert, > > IMHO for one thing, it is like
the "regular expression" (RE) topic which crops up now and then.
> People need an easy migration path.
Anyone who has been convinced that xml is the end of the world in ascii data sharing, will be more easily lured if that is more completely supported.
> for myself, I have found xml is nice to
support at least on import because many open source and on-line tools use XML as an export format. Things like namespaces, I have read, will obfuscate rebol's xml engine... maybe we are simply lacking in the more advanced features which are getting more common than they used to be...
> I really am not an xml genius, I just
noticed that it is a trendy and competent ascii format, maybe if the rest of the world is using it... we should at least support it conveniently so that the phrase:
> "REBOL is the glue that binds things
> would hold more meaning with regards to
other tools which already expect their data to be bound to other tools...
> maybe the fact that no one has done a
complete xml port is that no guru has spent the better part of a month or two to do it.
> My guess is that many would benefit, but
not that many are abilitated to actually do it... so they eventually turn to another solution..
> in the near future, I will have to parse
several MBs of textual xml data and I will see at that point how rebol handles it. until then, I'm just an interested reader...
> > cheers! :-) > > -MAx > --- > "You can either be part of the problem or
part of the solution, but in the end, being part of the problem is much more fun."