Esercitazione XML

XML CASA Introduzione XML XML Come usare Albero XML Sintassi XML Elementi XML Attributi XML Spazi dei nomi XML Visualizzazione XML Richiesta HTTP XML Analizzatore XML XML DOM XPath XML XML XSLT XQuery XML XML XLink Validatore XML DTD XML Schema XML Server XML Esempi XML Quiz XML Certificato XML

XML AJAX

Introduzione AJAX AJAX XMLHttp Richiesta AJAX Risposta dell'AJAX File XML AJAX AJAX PHP AJAX ASP Database AJAX Applicazioni AJAX Esempi AJAX

XML DOM

DOM Introduzione Nodi DOM Accesso DOM Informazioni sul nodo DOM Elenco dei nodi DOM DOM attraversando Navigazione DOM DOM Ottieni valori Nodi di modifica DOM DOM Rimuovere i nodi DOM Sostituisci nodi DOM Crea nodi DOM Aggiungi nodi Clonazione dei nodi DOM Esempi DOM

Esercitazione XPath

Introduzione a XPath Nodi XPath Sintassi XPath Assi XPath Operatori XPath Esempi di XPath

Esercitazione XSLT

Introduzione a XSLT Lingue XSL Trasformazione XSLT XSLT <modello> XSLT <valore-di> XSLT <per-ciascuno> XSLT <ordina> XSLT <se> XSLT <scegli> Applicare XSLT XSLT sul Cliente XSLT sul server XSLT Modifica XML Esempi XSLT

Esercitazione XQuery

Introduzione a XQuery Esempio XQuery XQuery FLWOR XQuery HTML Termini di XQuery Sintassi XQuery Aggiungi XQuery XQuery Seleziona Funzioni XQuery

DTD XML

Introduzione alla DTD Blocchi di costruzione DTD Elementi DTD Attributi DTD Elementi DTD vs Attr Entità DTD Esempi di DTD

Schema XSD

Introduzione all'XSD XSD Come fare per XSD <schema> Elementi XSD Attributi XSD Restrizioni XSD

Complesso XSD

Elementi XSD XSD vuoto Solo elementi XSD Solo testo XSD XSD misto Indicatori XSD XSD <qualsiasi> XSD <qualsiasi attributo> Sostituzione XSD Esempio XSD

Dati XSD

Stringa XSD Data XSD Numerico XSD XSD Varie Riferimento XSD

Servizi Web

Servizi XML XML WSDL SAPONE XML XML RDF RSS XML

Riferimenti

Tipi di nodi DOM Nodo DOM Elenco nodi DOM DOM NamedNodeMap Documento DOM Elemento DOM Attributo DOM Testo DOM DOM CDATA Commento DOM DOM XMLHttpRichiesta Analizzatore DOM Elementi XSLT Funzioni XSLT/XPath

XML DOM - L' oggetto del documento


L'oggetto Document rappresenta l'intero documento XML.


L'oggetto documento XML

L'oggetto Document è la radice di un albero di documenti XML e ci fornisce l'accesso principale ai dati del documento.

Poiché nodi elemento, nodi di testo, commenti, istruzioni di elaborazione e così via non possono esistere al di fuori del documento, l'oggetto Document contiene anche metodi per creare questi oggetti. Gli oggetti Node hanno una proprietà ownerDocument che li associa al Documento in cui sono stati creati.

Proprietà dell'oggetto del documento

Property Description
childNodes Returns a NodeList of child nodes for the document
doctype Returns the Document Type Declaration associated with the document
documentElement Returns the root node of the document
documentURI Sets or returns the location of the document
domConfig Returns the configuration used when normalizeDocument() is invoked
firstChild Returns the first child node of the document
implementation Returns the DOMImplementation object that handles this document
inputEncoding Returns the encoding used for the document (when parsing)
lastChild Returns the last child node of the document
nodeName Returns the name of a node (depending on its type)
nodeType Returns the node type of a node
nodeValue Sets or returns the value of a node (depending on its type)
xmlEncoding Returns the XML encoding of the document
xmlStandalone Sets or returns whether the document is standalone
xmlVersion Sets or returns the XML version of the document

Metodi dell'oggetto del documento

Method Description
adoptNode(sourcenode) Adopts a node from another document to this document, and returns the adopted node
createAttribute(name) Creates an attribute node with the specified name, and returns the new Attr object
createAttributeNS(uri,name) Creates an attribute node with the specified name and namespace, and returns the new Attr object
createCDATASection() Creates a CDATA section node
createComment() Creates a comment node
createDocumentFragment() Creates an empty DocumentFragment object, and returns it
createElement() Creates an element node
createElementNS() Creates an element node with a specified namespace
createEntityReference(name) Creates an EntityReference object, and returns it
createProcessingInstruction(target,data) Creates a ProcessingInstruction object, and returns it
createTextNode() Creates a text node
getElementById(id) Returns the element that has an ID attribute with the given value. If no such element exists, it returns null
getElementsByTagName() Returns a NodeList of all elements with a specified name
getElementsByTagNameNS() Returns a NodeList of all elements with a specified name and namespace
importNode(nodetoimport,deep) Imports a node from another document to this document. This method creates a new copy of the source node. If the deep parameter is set to true, it imports all children of the specified node. If set to false, it imports only the node itself. This method returns the imported node
normalizeDocument()  
renameNode() Renames an element or attribute node


Proprietà dell'oggetto DocumentType

Ogni documento ha un attributo DOCTYPE il cui valore è null o un oggetto DocumentType.

L'oggetto DocumentType fornisce un'interfaccia per le entità definite per un documento XML.

Property Description
name Returns the name of the DTD
publicId Returns the public identifier of the DTD
systemId Returns the system identifier of the external DTD

Metodi dell'oggetto di implementazione del documento

L'oggetto DOMImplementation esegue operazioni indipendenti da qualsiasi istanza particolare del modello a oggetti del documento.

Method Description
createDocument(nsURI, name, doctype) Creates a new DOM Document object of the specified doctype
createDocumentType(name, pubId, systemId) Creates an empty DocumentType node
getFeature(feature, version) Returns an object which implements the APIs of the specified feature and version, if the is any
hasFeature(feature, version) Checks whether the DOM implementation implements a specific feature and version

Proprietà dell'oggetto ProcessingInstruction

L'oggetto ProcessingInstruction rappresenta un'istruzione di elaborazione.

Un'istruzione di elaborazione viene utilizzata come un modo per mantenere le informazioni specifiche del processore nel testo del documento XML.

Property Description
data Sets or returns the content of this processing instruction
target Returns the target of this processing instruction