Documentation



Class isiXML

Definition: Create a class to work with the object DOM like parameter.

Parameter: The parameter is a object DOM. For example it can be document.body or responseXML of object XMLHttpRequest() and others XML objects.

Methods:

Use:

var myclase = new isiXML(document.body);

var myclase = new isiXML(objAjax.responseXML);



Method Query()

Definition: Execute a queries to XML.

Return: Return a array with the all data.

Parameter: Is a text string for the queries. More info about how to use queries SQL.

Use:

var myclase = new isiXML(document.body);
var data = myclase.Query("SELECT node.value");




Method Tables()

Definition: Return the all information of XML document.

Parameter: Is a text, specifying the "ID" of the html element. For example it can be a "<table>" or a "<div>"...

Use:

var myclase = new isiXML(document.body);
myclase.Tables("mydiv");
See example




How to use queries SQL

  1. Tables and fields
  2. Commands

[1] Tables and Fields

This XML will be the work document.

Listing of tables and fields with its values. Open the document XML and find this row:

<photo iduser="1" width="400" heigth="200" description="Myself">Images/me.gif</photo>

Node


Atrib

Node.ID or Atrib.ID
Whenever it finds a value of attribute or node will be increased a number.
With this document XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<XML>
  <mynode myatrib="text"> value1 </mynode>
  <mynode myatrib="text"> value2 </mynode>
  <mynode> value3 </mynode>
  <mynode myatrib="text"> value4 </mynode>
  <mynode myatrib="text"> value5 </mynode>
</XML>

See this row:
<mynode myatrib="text"> value5 </mynode>
Node.ID return 5 and Atrib.ID 4 because it needs an attribute.



Node.Row or Atrib.Row
Este campo identifica cada linea independientemente de si encuentra o no valores. Simplemente se basa en las etiquetas. Que a diferencia del campo ID este se incrementa siempre que encuentre una etiqueta/nodo.
Con el XML de antes si nos fijamos en la misma linea del ejemplo anterior Node.Row dara 6 y Atrib.Row 6 tambien. --> (Not to be translated it.)
And why 6? and not 5 you asked yourself. Because also there is counted the node father (<XML>).


Node.Path or Atrib.Path
Return the path of the value. The path is specified by levels. If your path is 1,3,2 this field be in level 3. And each value is the row of a level.
With this document XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<XML>
  <one>Value1</one>
  <one>
    <two>Value2</two>
    <two>Value3</two>
    <two>
      <three atr="atrvalue">Value4</three>
      <three>Value5</three>
    </two>
    <two>Value5</two>
  </one>
  <one>Value6</one>
</XML>

See this row:
<three atr="atrvalue">Value4</three>

Show return:

Node.Path = 2,3,1
Node.Path(1) = 2
Node.Path(2) = 3
Node.Path(3) = 1

The same for Atrib.Path


Node.Level or Atrib.Level
This field identifies the level in which this the value. In the previous example (Node.Path and Atrib.Path) in the same line will return 3 for Atrib.Level and Node.Level.



Node.Node or Atrib.Node
Return the node name. In this row:

<three atr="atrvalue" atrib2="atribvalue2">Value4</three>

Node.Node y Atrib.Node will return three




Node.Value or Atrib.Value
Return the attribute values:

<three atr="atrvalue" atrib2="atribvalue2">Value4</three>

Node.Value = Value4
Atrib.Value(1) = atrvalue
Atrib.Value(2) = atribvalue2



Atrib.Atrib
Return the attribute name. In the last example:

<three atr="atrvalue" atrib2="atribvalue2">Value4</three>

Atrib.Atrib(1) = atr
Atrib.Atrib(2) = atrib2

Nota: You dont worry, because you do not have to know all the fields. You can use the method Tables().



[2] Commands



SELECT
The SELECT statement is used to select data from a table. The result is stored in a array.
And the syntax is:

SELECT node.value



WHERE
It is used to filter data by means of comparisons. And the syntax is:

SELECT fields WHERE (comparisons)

 

Operators of Comparison
TYPE DEFINITION EXAMPLE
= Equal SELECT node.value WHERE (node.node='name' AND atrib.value(1)=2)
< Less than SELECT node.value WHERE (node.node='name' AND atrib.value(1)<2)
> Greater than SELECT node.value WHERE (node.node='name' AND atrib.value(1)>2)
<> Not equal SELECT node.value WHERE (node.node='name' AND atrib.value(1)<>2)
<= Less than or equal SELECT node.value WHERE (node.node='name' AND atrib.value(1)<=2)
>= Greater than or equal SELECT node.value WHERE (node.node='name' AND atrib.value(1)>=2)

 

Logic operators
TYPE DEFINITION EXAMPLE
AND Is the "and" lógic. Verifies the two conditions and return true if are right both of them. SELECT node.value WHERE (node.node='name' AND atrib.value(1)=1)
OR Is the "or" lógic. Verifies the two conditions and return true if someone is right. SELECT node.value, node.node WHERE (node.node='name' OR node.node='from')



LIMIT
It limits the output of the values. For example if do you want see the first 5:

SELECT node.value LIMIT 0,5


If the sentence have "WHERE", "LIMIT" go after the "WHERE":
SELECT node.value WHERE (node.node='name') LIMIT 0,2

If do you want view from 5.
SELECT node.value LIMIT 5


Or the lasts 5.
SELECT node.value LIMIT -5


Sorry my english is very sux. :(


Contact

Source Forge

Visitas: