XmlReader.ReadElementContentAsLong Método
Definição
Lê o elemento atual e retorna o conteúdo como um inteiro com sinal de 64 bits.Reads the current element and returns the contents as a 64-bit signed integer.
Sobrecargas
| ReadElementContentAsLong() |
Lê o elemento atual e retorna o conteúdo como um inteiro com sinal de 64 bits.Reads the current element and returns the contents as a 64-bit signed integer. |
| ReadElementContentAsLong(String, String) |
Verifica se o nome local e o URI de namespace especificados são iguais aos do elemento atual, lê o elemento atual e retorna o conteúdo como um inteiro com sinal de 64 bits.Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer. |
ReadElementContentAsLong()
Lê o elemento atual e retorna o conteúdo como um inteiro com sinal de 64 bits.Reads the current element and returns the contents as a 64-bit signed integer.
public:
virtual long ReadElementContentAsLong();
public virtual long ReadElementContentAsLong ();
abstract member ReadElementContentAsLong : unit -> int64
override this.ReadElementContentAsLong : unit -> int64
Public Overridable Function ReadElementContentAsLong () As Long
Retornos
O conteúdo do elemento como um inteiro com sinal de 64 bits.The element content as a 64-bit signed integer.
Exceções
O XmlReader não está posicionado em um elemento.The XmlReader is not positioned on an element.
- ou --or- Um método XmlReader foi chamado antes do término de uma operação assíncrona anterior.An XmlReader method was called before a previous asynchronous operation finished. Nesse caso, InvalidOperationException será gerado com a mensagem “Uma operação assíncrona já está em andamento”.In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."
O elemento atual contém elementos filho.The current element contains child elements.
- ou --or-
O conteúdo do elemento não pode ser convertido em um inteiro com sinal de 64 bits.The element content cannot be converted to a 64-bit signed integer.
O método é chamado com os argumentos null.The method is called with null arguments.
Exemplos
O exemplo a seguir usa o ReadElementContentAsLong método para ler o conteúdo do longValue elemento.The following example uses the ReadElementContentAsLong method to read the content of the longValue element.
using (XmlReader reader = XmlReader.Create("dataFile.xml")) {
reader.ReadToFollowing("longValue");
long number = reader.ReadElementContentAsLong();
// Do some processing with the number object.
}
Using reader As XmlReader = XmlReader.Create("dataFile.xml")
reader.ReadToFollowing("longValue")
Dim number As Long = reader.ReadElementContentAsLong()
' Do some processing with the number object.
End Using
O exemplo usa o arquivo dataFile.xml como entrada.The example uses the dataFile.xml file as input.
<root>
<stringValue>
<!--comment-->
<?some pi?>
text value of the element.
</stringValue>
<longValue>270000000000001</longValue>
<number>0</number>
<double>2E10</double>
<date>2003-01-08T15:00:00-00:00</date>
</root>
Comentários
Esse método lê a marca de início, o conteúdo do elemento e move o leitor após a marca do elemento final.This method reads the start tag, the contents of the element, and moves the reader past the end element tag. Ele expande as entidades e ignora as instruções e os comentários de processamento.It expands entities and ignores processing instructions and comments. O elemento só pode conter conteúdo simples.The element can only contain simple content. Ou seja, ele não pode ter elementos filho.That is, it cannot have child elements.
Se o conteúdo for digitado xsd:long , o leitor retornará um número inteiro com sinal de 64 bits não in-box.If the content is typed xsd:long, the reader returns an unboxed 64-bit signed integer. Se o conteúdo não for digitado xsd:long , o leitor tentará convertê-lo em um inteiro com sinal de 64 bits de acordo com as regras definidas pelo esquema XML do W3C parte 2: recomendação de tipos de datatipos .If the content is not typed xsd:long, the reader attempts to convert it to a 64-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation.
Para obter mais informações, consulte a seção de Comentários da página de referência XmlReader.For more information, see the Remarks section of the XmlReader reference page.
Aplica-se a
ReadElementContentAsLong(String, String)
Verifica se o nome local e o URI de namespace especificados são iguais aos do elemento atual, lê o elemento atual e retorna o conteúdo como um inteiro com sinal de 64 bits.Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer.
public:
virtual long ReadElementContentAsLong(System::String ^ localName, System::String ^ namespaceURI);
public virtual long ReadElementContentAsLong (string localName, string namespaceURI);
abstract member ReadElementContentAsLong : string * string -> int64
override this.ReadElementContentAsLong : string * string -> int64
Public Overridable Function ReadElementContentAsLong (localName As String, namespaceURI As String) As Long
Parâmetros
- localName
- String
O nome local do elemento.The local name of the element.
- namespaceURI
- String
O URI do namespace do elemento.The namespace URI of the element.
Retornos
O conteúdo do elemento como um inteiro com sinal de 64 bits.The element content as a 64-bit signed integer.
Exceções
O XmlReader não está posicionado em um elemento.The XmlReader is not positioned on an element.
- ou --or- Um método XmlReader foi chamado antes do término de uma operação assíncrona anterior.An XmlReader method was called before a previous asynchronous operation finished. Nesse caso, InvalidOperationException será gerado com a mensagem “Uma operação assíncrona já está em andamento”.In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."
O elemento atual contém elementos filho.The current element contains child elements.
- ou --or-
O conteúdo do elemento não pode ser convertido em um inteiro com sinal de 64 bits.The element content cannot be converted to a 64-bit signed integer.
O método é chamado com os argumentos null.The method is called with null arguments.
O nome do local especificado e o URI de namespace não correspondem àqueles do elemento atual que está sendo lido.The specified local name and namespace URI do not match that of the current element being read.
Comentários
Esse método lê a marca de início, o conteúdo do elemento e move o leitor após a marca do elemento final.This method reads the start tag, the contents of the element, and moves the reader past the end element tag. Ele expande as entidades e ignora as instruções e os comentários de processamento.It expands entities and ignores processing instructions and comments. O elemento só pode conter conteúdo simples.The element can only contain simple content. Ou seja, ele não pode ter elementos filho.That is, it cannot have child elements.
Se o conteúdo for digitado xsd:long , o leitor retornará um número inteiro com sinal de 64 bits não in-box.If the content is typed xsd:long, the reader returns an unboxed 64-bit signed integer. Se o conteúdo não for digitado xsd:long , o leitor tentará convertê-lo em um inteiro com sinal de 64 bits de acordo com as regras definidas pelo esquema XML do W3C parte 2: recomendação de tipos de datatipos .If the content is not typed xsd:long, the reader attempts to convert it to a 64-bit signed integer according to the rules defined by the W3C XML Schema Part 2: Datatypes recommendation.
Para obter mais informações, consulte a seção de Comentários da página de referência XmlReader.For more information, see the Remarks section of the XmlReader reference page.