Opened 5 years ago

Closed 5 years ago

#8901 closed enhancement (wontfix)

[patch][cla] dojo.xml --> parsing for XML documents into javascript object

Reported by: rkstar Owned by: ttrenka
Priority: high Milestone: tbd
Component: Dojox Version: 1.2.3
Keywords: XML, ActionScript, JS Object, XML DOM Cc:
Blocked by: Blocking:

Description

I have started a basic package that takes in an XML DOM node (as is passed back from dojo.xhrGet/xhrPost) and returns a useable JS object that works similar to how the ActionScript 3.0 XML interface does.

In its current state it is only dealing with node names, attributes, and values. I have not accounted for any namespaces or fancy XML stuff but I thought this would be a good start toward a package like this for Dojo.

Attachments (2)

xml.js (4.4 KB) - added by rkstar 5 years ago.
dojo/_base/xml.js
parser.js (6.0 KB) - added by dante 5 years ago.
style review and code changes

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by rkstar

dojo/_base/xml.js

comment:1 Changed 5 years ago by dylan

  • Component changed from General to Dojox
  • Owner changed from anonymous to peller
  • Summary changed from patch: dojo.xml --> parsing for XML documents into javascript object to [patch][cla] dojo.xml --> parsing for XML documents into javascript object

comment:2 Changed 5 years ago by peller

  • Owner changed from peller to ttrenka

Changed 5 years ago by dante

style review and code changes

comment:3 Changed 5 years ago by dante

@rkstar - I've reviewed and edited the file for Dojo Style guidelines (whitespace, squigles, and some simple code changes) but have a few remarks:

  • This seems to overlap substantially with dojox.xml.parser (?)
  • I've renamespaced it into dojox.xml.parse (can't just throw things in base)
  • The inline docs could be expanded
  • There needs to be tests :)

my version of the code is attached, though untested since my changes (no tests available)

comment:4 Changed 5 years ago by ttrenka

@dante:

This code looks ok but I could have sworn that Jared had added something like this to support dojo.data...

comment:5 Changed 5 years ago by dante

k -- sorry for any confusion. my attached parser.xml is plain wrong, and a copy from trunk (thanks @peller) ... I did a style and namespace cleanup on the initial patch, and realized it overlapped with dojox.xml.parser and though I'd attached my work. my bad.

Either way -- the functionality seems to overlap with existing code (as seen by the 'alleged' patch) and neither dojox.xml or this patch have tests or documentation so the issue is moot. -1

comment:6 Changed 5 years ago by ttrenka

  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to mark this as "won't fix". There's two different ways already existing to accomplish something close to these needs:

dojox.data.XmlStore
dojox.xml.DomParser

The first will take a document and parse it for use with dojo.data; the second will take an XML string and create a JSON-like structure out of it, including basic get and traversal methods.

Note: See TracTickets for help on using tickets.