XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
E4X(ECMAScript for XML)

Revive E4X as EXQO(ECMA-Script's XML Query Object) with SAX added on as methods for the xml object.

With an added method call xPath();

Xml file to be use:
<note> 
  <date>2002-08-01</date>    
  <to>Tove</to>
  <from>Jani</from> 
  <heading>Reminder</heading> 
  <body>Don't forget me this weekend!</body> 
</note>

Example:
//E4X spec.
var xmlDoc=new XML();
xmlDoc.load("note.xml");
document.write(xmlDoc.body);
//please look at the bottom for a corresponding to this.
//output body text value

Example:
//with added xPath() method
var xmlDoc=new XML();
xmlDoc.load("note.xml");
document.write(
xmlDoc.xPath("//body");
//relative path expression
);

Example:
var xmlDoc=new XML();
xmlDoc.load("note.xml");
document.write(
xmlDoc.xPath("/note/body");
//absolute path expression
);

This will gain attention to the ease of navigating the dom. Also the other goal is to point to xQuery as a server scripting alternative to popular server side scripting such as php.

//thoughts on the E4X spec.
//the e4x spec of the look at this make it to where the root element is the container for the object return.
I feel, this should lean more to JSON type syntax:

var xmlDoc = {
note:[
  {date:"2002-08-01"},    
  {to:"Tove"},
  {from:"Jani"},
  {heading:"Reminder"}, 
  {body:"Don't forget me this weekend!"}
]}

document.write(
xmlDoc.note[4].body);

So let's say we do the same for the spec to make it more... Easy to compose a new spec with.

The dom or really htmlelementobject API and documentobject API both have methods for manipulating the xml/html.

It stand to reason to mimic those feature via JSON.

As so:

var xmlDoc=new XML();
xmlDoc.load("note.xml");
document.write(xmlDoc.note[4].body);

And again with the xPath(/*expression*/); //method

var xmlDoc=new XML();
xmlDoc.load("note.xml");
document.write(
xmlDoc.xPath("/note/body")
);

For the first spec, I say to use only xPath 1.0

With attribute, I say to use the xPath(/*expression*/); method to retrieve that via string:

<date attr="value">
  2002-08-01
</date>

xmlDoc.xPath("/note/@attr");
//xPath 1.0 spec
);

to make the spec easier to adopt.

Making this appliance to "use strict";

I say to make a new statement declaration: 
"use EXQO"; or "use ESXQO";

Use JSON syntax when it comes to the EMCAScript environment.

Use xPath(/*expression*/); for all non EMCAScript environment expression, and syntax.

Note that this version may receive further editing in the future.

Thank you for reading. 

E-S4L

E-S4L


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS