On 2/3/06, Adrian C. <[EMAIL PROTECTED]> wrote:
>
> Hello
>
> Un xml2text sau ceva de genul asta exista prin ports? E mult XML
> stuff acolo si nu stiu care s-ar potrivi in cazul meu. Am incercat
> ceva in php dar nu prea a iesit nimic. Am un XML care imi da vreo 5
> coloane si multe linii de produse si imi trebuie ceva sa-l faca text,
> sa-i pot da cu grep.
>

  http://www.xmlsoft.org/tutorial/
  E destul de OK aceasta biblioteca. O mica observatie: la citirea
structurii XML din fisier (si nu dintr-un buffer oarecare), dupa
fiecare nod mai exista un nod de tip text, cu continut null. Deci daca
vrei sa iterezi prin nodurile de pe acelasi nivel e necesar un jump de
tipul cur = cur->next->next. Altfel e fairly easy to use.

  Altfel, daca vrei sa faci ceva scriptat (o sa fac un pic de advocacy
aici) iti recomand sa inveti Ruby. Pe linga faptul ca suporta si ce
vrei tu acum in mod particular, e si foarte potrivit pentru day-2-day
tasks.

  Uite un exemplu XML, Ruby style:

-- cut here --
<?xml version="1.0"?>
<numbers>
  <number name="One">1</number>
  <number name="Two">2</number>
  <number name="Three">3</number>
</numbers>

require 'rexml/document'
xml = REXML::Document.new(File.open("demo.xml"))
puts "Root node name: #{xml.root.name}"
puts "\nThe names of the numbers"
xml.elements.each("//number") {|n| puts n.attributes["name"]}
puts "\nThe value of the number \"Two\" is
#{xml.elements["//[EMAIL PROTECTED]'Two']"].text"
-- and here --

--
If it's there, and you can see it, it's real.
If it's not there, and you can see it, it's virtual.
If it's there, and you can't see it, it's transparent.
If it's not there, and you can't see it, you erased it.

________________________________________________________
To unsubscribe send a mail to [EMAIL PROTECTED]

Raspunde prin e-mail lui