EDOBE XDOM TAKE 6 IR - PRODUCTSHEET Especificações Página 244

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 304
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 243
CHAPTER 9: Integrating XML into JavaScript The XML Object 244
X
If you have assigned an element to a namespace, and have not made it the default, you must use a
Namespace object
to access those elements. For example:
var ns = new Namespace ("http://kids.mybookstore.com");
bookstoreXML.ns::book;
This returns all books that have been assigned to the "kids" namespace.
X If you have set a default namespace, you can still access all objects that do not have any specific
namespace assignment by using a Namespace object
for the empty string, which is the default
creation case:
var emptyNS = new Namespace ();
bookstoreXML.emptyNS::book;
This returns all books that have not been assigned to any namespace.
X To access all elements, regardless of the namespace assignment, you can use an asterisk (*) wild-card
character or
null as the namespace name:
bookstoreXML.*::book;
or
var nullNS = null;
bookstoreXML.nullNS::book;
Mixing XML and JavaScript
You can enclose JavaScript statements in curly brackets, and embed them into XML. The JavaScript part is
evaluated during the construction of the XML.
For example, this function returns an XML value, in which embedded JavaScript variables will be evaluated
and included:
function makeXML (first, last) {
return <person first={first} last={last}>{first + " " + last}</person>;
}
Calling this function:
makeXML ( "Jane", "Doe" );
results in this XML:
<person first="Jane" last="Doe">Jane Doe</person>
You can also use these operators on XML elements:
X Use the plus operator, +, to combine XML elements into a list.
X Use the == operator to make an in-depth comparison of two XML trees.
XML lists
ExtendScript defines an XMLList object, which is identical to the XML object except that you can create it
by passing it an XML list, and it creates an XML list rather than an XML tag.
Vista de página 243
1 2 ... 239 240 241 242 243 244 245 246 247 248 249 ... 303 304

Comentários a estes Manuais

Sem comentários