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]
Re: [xml-dev][revise=draft:0.1<=IMPORTANT CHANGE]E4X(ECMAScript for XML)

On Jul 23, 2014, at 1:11 PM, "L2L 2L" <emanuelallen@hotmail.com> wrote:



E-S4L

On Jul 22, 2014, at 11:07 AM, "L2L 2L" <emanuelallen@hotmail.com> wrote:

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
[revise=draft:0.1]
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(/* which let us use xPath expression to navigate through the Dom*/);

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.

change to 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 ESON(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 HTMLdocument API and XMLdocument API both have methods for manipulating the xml/html.

It stand to reason to mimic those feature via ESON.

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 for the xPath(); method

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/date/@attr");
//xPath 1.0 spec
);

Via ESON syntax:

/*as the attribute node(object) is a child of the date node(object); it stand to reason that it is also a object within the date object that can only hold text*/

xmlDoc.note[0].date[0].attr"; //"value"

to make the spec easier to adopt.
/****
with the change to this draft, I believe the following is none important(but is still kept in for archive):
Making this to "use strict";

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

Use ESON syntax when it comes to the EMCAScript environment.

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

If it's troublesome having the 
<xml></xml>(note inclose in quotes)
In the ECMAScript environment(even know we can have "/RegExp/" in it

Than make it possible via SAX(really, looking over the sax spec... It can be optional, or not at all to add... Really, EMCAScript have all we need via Object.prototype.method.call(object, arguments)) function for adding new element... Or via string. Example:

var xmlDoc=new XML();
xmlDoc.load("note.xml");
("I'm such a novice. I spent sometime trying to convey my ideals here...  )

(Here the best way I can think of, is to forget sax, and by(via) adding on string, and array methods)

This /**"/note/body"**/ is within body element
xmlDoc.xPath("/note/body").concat("<ps>also, don't forget to bring a jacket</ps>");

This /**"/note/"**/ is after body element
xmlDoc.xPath("/note/").concat("<ps>also, don't forget to bring a jacket</ps>");

This/ **"/note/"**/ is before body element (note: index 3 is note's child header element)

xmlDoc.xPath("/note/").splice(1, 3, "<ps>also, don't forget to bring a jacket</ps>");

/***
NOTE: For the examples above, using splice, and concat method. It might just be better to use these method via ESON syntax and just use xPath methods to preform these manipulation, when using the xPath method of the XML object. I shall convey this ideal at a later time
***/

And with ESON syntax:

xmlDoc.note[4].body += "<ps>Also, don't for get to bring a jacket"</ps>"

/***convey the ESON syntax using splice and concat(NOTE: that array methods shall be use to work with elements, and String method shall be use to work with text node. As you can imagine, RegExp has it place in this with working with text node)***/

This /**"/note/body"**/ is within body element
xmlDoc.note[4].body.concat("<ps>also, don't forget to bring a jacket</ps>");

This /**"/note/"**/ is after body element
xmlDoc.note[note.length ].concat("<ps>also, don't forget to bring a jacket</ps>");

This /**"/note/"**/ is before body element (note: index 4 is note's child heading element)

/***
The following example is the same as: 
var note = ["date","to","from","heading","body"];
note.splice(4,0,"ps");
note;//output: ["date","to","from","heading","ps","body"];
***/

xmlDoc.note.splice(4, 0 , "<ps>also, don't forget to bring a jacket</ps>");
/***
Note that this version may receive further editing in the future.
***/

Thank you for reading. 


/***IMPORTANT CHANGE***/

Instead of call the object subject at hand XML(); rename it DOM(); since this object will apply to XML, HTML, and XHTML.

/***OVER OF THE DOM(); OBJECT***/

As spoken in the pervious proposal update.

ESON(JSON) syntax will apply to traversing through the node environment, and as via xPath method too.... Or this can be change to XML(); method, which apply to the likes.

var Doc = new DOM();
Doc.load("note.xml");

/*** depending on the file the DOM will imitate the DOM...***/

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