السلام عليكم
محتاج توضيح للxml
وكيفية استخدامها ,
انا حاولت اجرب المثال في الويكي , بس تطلع لي مشكلة
@xmlNodeGetAttribute [expected xml-node at argument 1 , got boolean]
وطبعآ تظهر لي لكل xmlNodeGetAttribute استخدمته
وهذا الكود كما نسخته
xml -
"528" posX="123.4" posY="456.7" posZ="12.3" rot="90.0" />
lua - server side -
الكود القديم (فيها المشكلة ) ء
local xml = getResourceConfig("testing.xml") -- غيرت اسم الملف هنا
local carmodel = xmlNodeGetAttribute(xml, "model")
local carX = xmlNodeGetAttribute(xml, "posX")
local carY = xmlNodeGetAttribute(xml, "posY")
local carZ = xmlNodeGetAttribute(xml, "posZ")
local carA = xmlNodeGetAttribute(xml, "rot")
outputChatBox(tostring(carX))
الكود الجديد بعد حلها
local xml = xmlLoadFile("testing.xml") -- هنا ابحث عن الملف
local Child = xmlFindChild(xml , "car" , 0) -- استخرجت الجزء "سيارة" من الملف
local carmodel = xmlNodeGetAttribute(Child, "model") -- واضفته في الملفات
local carX = xmlNodeGetAttribute(Child, "posX")
local carY = xmlNodeGetAttribute(Child, "posY")
local carZ = xmlNodeGetAttribute(Child, "posZ")
local carA = xmlNodeGetAttribute(Child, "rot")
outputChatBox(tostring(carX)) -- تحربة الملف