T
T
TechNOIR2017-09-27 14:03:40
PHP
TechNOIR, 2017-09-27 14:03:40

How to parse values ​​from a table while splitting them?

Good day.
I want to parse some goods from the store , I'm interested in the characteristics.
But they go one whole table. Somehow it can be broken so that the name and value are in different variables.
Let's say $model_name - This is the name of the "Model"
$model - This is the name of the model, respectively from the link "Asus VB199T"
Is it possible via xpath/regex?
PS I do it in Powershell

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
x67, 2017-09-27
@x67

yes, it is possible through regular expressions and xpath. I don’t know how regular expressions look in powershell, but everything is simple there. In each tr in the first td under the span is the name of the parameter, and in the second td is the value. If you need to know which group the parameter belongs to, then you still need to extract the td class. You can store it even in a two-dimensional list, even in a tree. Here's the regex manual.
I don't really understand, do you expect them to do your job for you? After all, you basically just had to find the manual, read it and do it.

R
Roman Fov, 2017-09-28
@Roman-Fov

If the table is normal (not inverted or some other garbage), then try this

//div[@class="spec"]//table/tbody/tr/td[1]
//div[@class="spec"]//table/tbody/tr/td[2]

Will it fit?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question