Interface Content
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Contenido
Es una representación de un nodo XML genérico.
Implementa clases
Nombre | Descripción breve |
Cdata | Es una representación de un nodo CDATASection XML. |
Comment | Es una representación de un nodo Comment XML. |
DocType | Es una representación de un nodo DocumentType XML. |
Element | Es una representación de un nodo Element XML. |
EntityRef | Es una representación de un nodo EntityReference XML. |
ProcessingInstruction | Es una representación de un nodo ProcessingInstruction XML. |
Text | Es una representación de un nodo Text XML. |
Documentación detallada
asCdata()
Transmite el nodo como un nodo CDATASection
para el autocompletado. Si el ContentType
del nodo aún no es CDATA
, este método muestra null
.
Volver
Cdata
: El nodo CDATASection
asDocType()
Transmite el nodo como un nodo DocumentType
para el autocompletado. Si el ContentType
del nodo aún no es DOCTYPE
, este método muestra null
.
Volver
DocType
: El nodo DocumentType
asElement()
Transmite el nodo como un nodo Element
para el autocompletado. Si el ContentType
del nodo aún no es ELEMENT
, este método muestra null
.
Volver
Element
: El nodo Element
asEntityRef()
Transmite el nodo como un nodo EntityReference
para el autocompletado.
Si el ContentType
del nodo aún no es ENTITYREF
, este método muestra null
.
Volver
EntityRef
: El nodo EntityReference
asProcessingInstruction()
asText()
Transmite el nodo como un nodo Text
para el autocompletado. Si el ContentType
del nodo aún no es TEXT
, este método muestra null
.
Volver
Text
: El nodo Text
detach()
Desconecta el nodo de su nodo Element
superior. Si el nodo no tiene un elemento superior, este método no tiene efecto.
Volver
Content
: El nodo desconectado
getParentElement()
Obtiene el nodo Element
superior del nodo. Si el nodo no tiene un elemento superior, este método muestra null
.
Volver
Element
: Es el nodo Element
superior.
getType()
Obtiene el tipo de contenido del nodo.
Volver
ContentType
: Es el tipo de contenido del nodo.
getValue()
Obtiene el valor de texto de todos los nodos que son secundarios directos o indirectos del nodo, en el orden en que aparecen en el documento.
Volver
String
: Es el valor de texto de todos los nodos que son elementos secundarios directos o indirectos del nodo.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003e\u003ccode\u003eContent\u003c/code\u003e is a generic representation of an XML node in Google Apps Script and provides methods to interact with it.\u003c/p\u003e\n"],["\u003cp\u003eIt offers various methods to cast the node into specific types like \u003ccode\u003eElement\u003c/code\u003e, \u003ccode\u003eText\u003c/code\u003e, \u003ccode\u003eComment\u003c/code\u003e, etc., for easier manipulation.\u003c/p\u003e\n"],["\u003cp\u003eYou can detach a node from its parent, get its parent element, or retrieve its content type using dedicated methods.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetValue()\u003c/code\u003e helps retrieve the combined text value of all the node's children, providing a way to access its content.\u003c/p\u003e\n"],["\u003cp\u003eImplementing classes include \u003ccode\u003eCdata\u003c/code\u003e, \u003ccode\u003eComment\u003c/code\u003e, \u003ccode\u003eDocType\u003c/code\u003e, \u003ccode\u003eElement\u003c/code\u003e, \u003ccode\u003eEntityRef\u003c/code\u003e, \u003ccode\u003eProcessingInstruction\u003c/code\u003e, and \u003ccode\u003eText\u003c/code\u003e, representing different XML node types.\u003c/p\u003e\n"]]],["This content details a generic XML node and its interactions. It outlines seven specific XML node types: Cdata, Comment, DocType, Element, EntityRef, ProcessingInstruction, and Text. Key actions include casting a node to a specific type using `asType()` methods, which return `null` if the type is incorrect. Other actions involve `detach()` to remove a node from its parent, `getParentElement()` to find the parent, `getType()` to retrieve the content type, and `getValue()` to get the combined text value of child nodes.\n"],null,["# Interface Content\n\nContent\n\nA representation of a generic XML node.\n\n### Implementing classes\n\n| Name | Brief description |\n|------------------------------------------------------------------------------------|------------------------------------------------------------|\n| [Cdata](/apps-script/reference/xml-service/cdata) | A representation of an XML `CDATASection` node. |\n| [Comment](/apps-script/reference/xml-service/comment) | A representation of an XML `Comment` node. |\n| [DocType](/apps-script/reference/xml-service/doc-type) | A representation of an XML `Document``Type` node. |\n| [Element](/apps-script/reference/xml-service/element) | A representation of an XML `Element` node. |\n| [EntityRef](/apps-script/reference/xml-service/entity-ref) | A representation of an XML `Entity``Reference` node. |\n| [ProcessingInstruction](/apps-script/reference/xml-service/processing-instruction) | A representation of an XML `Processing``Instruction` node. |\n| [Text](/apps-script/reference/xml-service/text) | A representation of an XML `Text` node. |\n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [asCdata()](#asCdata()) | [Cdata](/apps-script/reference/xml-service/cdata) | Casts the node as a [CDATASection](/apps-script/reference/xml-service/cdata) node for the purposes of autocomplete. |\n| [asComment()](#asComment()) | [Comment](/apps-script/reference/xml-service/comment) | Casts the node as a [Comment](/apps-script/reference/xml-service/comment) node for the purposes of autocomplete. |\n| [asDocType()](#asDocType()) | [DocType](/apps-script/reference/xml-service/doc-type) | Casts the node as a [DocumentType](/apps-script/reference/xml-service/doc-type) node for the purposes of autocomplete. |\n| [asElement()](#asElement()) | [Element](/apps-script/reference/xml-service/element) | Casts the node as an [Element](/apps-script/reference/xml-service/element) node for the purposes of autocomplete. |\n| [asEntityRef()](#asEntityRef()) | [EntityRef](/apps-script/reference/xml-service/entity-ref) | Casts the node as a [EntityReference](/apps-script/reference/xml-service/entity-ref) node for the purposes of autocomplete. |\n| [asProcessingInstruction()](#asProcessingInstruction()) | [ProcessingInstruction](/apps-script/reference/xml-service/processing-instruction) | Casts the node as a [ProcessingInstruction](/apps-script/reference/xml-service/processing-instruction) node for the purposes of autocomplete. |\n| [asText()](#asText()) | [Text](/apps-script/reference/xml-service/text) | Casts the node as a [Text](/apps-script/reference/xml-service/text) node for the purposes of autocomplete. |\n| [detach()](#detach()) | [Content](#) | Detaches the node from its parent [Element](/apps-script/reference/xml-service/element) node. |\n| [getParentElement()](#getParentElement()) | [Element](/apps-script/reference/xml-service/element) | Gets the node's parent [Element](/apps-script/reference/xml-service/element) node. |\n| [getType()](#getType()) | [ContentType](/apps-script/reference/xml-service/content-type) | Gets the node's content type. |\n| [getValue()](#getValue()) | `String` | Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. |\n\nDetailed documentation\n----------------------\n\n### `as``Cdata()`\n\nCasts the node as a [CDATASection](/apps-script/reference/xml-service/cdata) node for the purposes of autocomplete. If the\nnode's [ContentType](/apps-script/reference/xml-service/content-type) is not already `CDATA`, this method returns `null`.\n\n#### Return\n\n\n[Cdata](/apps-script/reference/xml-service/cdata) --- the `CDATASection` node\n\n*** ** * ** ***\n\n### `as``Comment()`\n\nCasts the node as a [Comment](/apps-script/reference/xml-service/comment) node for the purposes of autocomplete. If the node's\n[ContentType](/apps-script/reference/xml-service/content-type) is not already `COMMENT`, this method returns `null`.\n\n#### Return\n\n\n[Comment](/apps-script/reference/xml-service/comment) --- the `Comment` node, or `null` if the node's content type is not [COMMENT](/apps-script/reference/xml-service/content-type)\n\n*** ** * ** ***\n\n### `as``Doc``Type()`\n\nCasts the node as a [DocumentType](/apps-script/reference/xml-service/doc-type) node for the purposes of autocomplete. If\nthe node's [ContentType](/apps-script/reference/xml-service/content-type) is not already `DOCTYPE`, this method returns `null`.\n\n#### Return\n\n\n[DocType](/apps-script/reference/xml-service/doc-type) --- the `Document``Type` node\n\n*** ** * ** ***\n\n### `as``Element()`\n\nCasts the node as an [Element](/apps-script/reference/xml-service/element) node for the purposes of autocomplete. If the node's\n[ContentType](/apps-script/reference/xml-service/content-type) is not already `ELEMENT`, this method returns `null`.\n\n#### Return\n\n\n[Element](/apps-script/reference/xml-service/element) --- the `Element` node\n\n*** ** * ** ***\n\n### `as``Entity``Ref()`\n\nCasts the node as a [EntityReference](/apps-script/reference/xml-service/entity-ref) node for the purposes of autocomplete.\nIf the node's [ContentType](/apps-script/reference/xml-service/content-type) is not already `ENTITYREF`, this method returns\n`null`.\n\n#### Return\n\n\n[EntityRef](/apps-script/reference/xml-service/entity-ref) --- the `Entity``Reference` node\n\n*** ** * ** ***\n\n### `as``Processing``Instruction()`\n\nCasts the node as a [ProcessingInstruction](/apps-script/reference/xml-service/processing-instruction) node for the purposes of autocomplete. If\nthe node's [ContentType](/apps-script/reference/xml-service/content-type) is not already `PROCESSINGINSTRUCTION`, this method\nreturns `null`.\n\n#### Return\n\n\n[ProcessingInstruction](/apps-script/reference/xml-service/processing-instruction) --- the `Processing``Instruction` node\n\n*** ** * ** ***\n\n### `as``Text()`\n\nCasts the node as a [Text](/apps-script/reference/xml-service/text) node for the purposes of autocomplete. If the node's [ContentType](/apps-script/reference/xml-service/content-type) is not already `TEXT`, this method returns `null`.\n\n#### Return\n\n\n[Text](/apps-script/reference/xml-service/text) --- the `Text` node\n\n*** ** * ** ***\n\n### `detach()`\n\nDetaches the node from its parent [Element](/apps-script/reference/xml-service/element) node. If the node does not have a parent,\nthis method has no effect.\n\n#### Return\n\n\n[Content](#) --- the detached node\n\n*** ** * ** ***\n\n### `get``Parent``Element()`\n\nGets the node's parent [Element](/apps-script/reference/xml-service/element) node. If the node does not have a parent, this method\nreturns `null`.\n\n#### Return\n\n\n[Element](/apps-script/reference/xml-service/element) --- the parent `Element` node\n\n*** ** * ** ***\n\n### `get``Type()`\n\nGets the node's content type.\n\n#### Return\n\n\n[ContentType](/apps-script/reference/xml-service/content-type) --- the node's content type\n\n*** ** * ** ***\n\n### `get``Value()`\n\nGets the text value of all nodes that are direct or indirect children of the node, in the order\nthey appear in the document.\n\n#### Return\n\n\n`String` --- the text value of all nodes that are direct or indirect children of the node"]]