سؤال

لدي ملف XML في هذا التنسيق:

<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office">
<Styles>
<Style ss:Name="Normal" ss:ID="Default">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:Name="FormatedNumberBorderPatern" ss:ID="FormattedNumberBorderPatern">
<Alignment ss:WrapText="1" ss:Vertical="Center"/>
<NumberFormat/>
<Borders>
<Border ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
</Style>
<Style ss:ID="s40">
<Alignment ss:Vertical="Bottom"/>
<Font ss:Bold="1" ss:Color="#7A2A29" ss:Size="12" x:Family="Swiss" x:CharSet="204"/>
</Style>
<Style ss:ID="s25">
<Alignment ss:WrapText="1" ss:Vertical="Center" ss:Horizontal="Center"/>
<Borders>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Arial Unicode MS"/>
</Style>
<Style ss:ID="m155750108">
<Alignment ss:WrapText="1" ss:Vertical="Bottom"/>
<Borders>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Arial Unicode MS"/>
</Style>
<Style ss:ID="empty">
<Alignment ss:Horizontal="Right"/>
<Borders>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Arial Unicode MS"/>
</Style>
<Style ss:ID="s30">
<Alignment ss:WrapText="1" ss:Vertical="Center" ss:Horizontal="Left"/>
<Borders>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Color="#000000" ss:Weight="1" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Arial Unicode MS"/>
</Style>
</Styles>
<Worksheet ss:Name="Information">
<Table border="1">
<Column ss:Span="1" ss:Width="192"/>
<Row ss:Height="31.5" ss:AutoFitHeight="0">
<Cell ss:StyleID="s40">
<Data ss:Type="String">Обменни курсове за 29.10.2010</Data>
</Cell>
</Row>
<Row/>
<Row>
<Cell ss:StyleID="s25">
<Data ss:Type="String">Валута</Data>
</Cell>
<Cell ss:StyleID="s25">
<Data ss:Type="String">Код</Data>
</Cell>
<Cell ss:StyleID="s25">
<Data ss:Type="String">За единици валута</Data>
</Cell>
<Cell ss:StyleID="s25">
<Data ss:Type="String">Лева (BGN)</Data>
</Cell>
<Cell ss:StyleID="s25">
<Data ss:Type="String">Обратен курс за 1 лев</Data>
</Cell>
</Row>
<Row>
<Cell ss:StyleID="s30">
<Data ss:Type="String">Австралийски долар</Data>
</Cell>
<Cell ss:StyleID="s30">
<Data ss:Type="String">AUD</Data>
</Cell>
<Cell ss:StyleID="FormattedNumberBorderPatern">
<Data ss:Type="Number">1</Data>
</Cell>
<Cell ss:StyleID="FormattedNumberBorderPatern">
<Data ss:Type="Number">1.37579</Data>
</Cell>
<Cell ss:StyleID="FormattedNumberBorderPatern">
<Data ss:Type="Number">0.726855</Data>
</Cell>
</Row>

..وهلم جرا. أنا فقط بحاجة إلى سحب البيانات بعد هذا السطر:

<Cell ss:StyleID="s30">

يتم سحب XML هذا من البنك (معلومات العملة). الحقل الأول هو اسم العملة باللغة البلغارية ، والثاني هو الكود (USD على سبيل المثال) ، والثالث هو المبلغ ، هو قيمة العملة ، الخامس هو مقدار العملة التي يمكنك شراؤها مع ليف بلغاري واحد ( BGN هي عملتنا).

أريد إنشاء محول للعملة ولكن تنسيق XML يربكني. هل يمكن لأحد أن يخبرني كيف يمكنني سحب المعلومات على جميع العملات؟ أحتاج هذه الحقول في الجدول:

<Data ss:Type="String">Австралийски долар</Data>
<Data ss:Type="String">AUD</Data>
<Data ss:Type="Number">1</Data>
<Data ss:Type="Number">1.37579</Data>
<Data ss:Type="Number">0.726855</Data>

تكرر هذه الخطوط (جنبا إلى جنب مع علامات الخلية والصف) لجميع العملات في ملف XML. هل يمكن أن تعطيني مثالاً لعملة واحدة؟ كيف يمكنني معالجة البيانات في هذه الحقول؟

هل كانت مفيدة؟

المحلول

الملف هو ملف excel2003 XML ، نادراً ما يتم استخدام تنسيق جدول البيانات في MS Excel 2003 ، ثم يتم تجاهله لصالح Microsoft Office Open Open XML Temphsheetml المقدمة لـ Excel2007. عادةً ما يتم العثور على الملف كأرشيف مضغوط.

phpexcel لديه قارئ لهذا التنسيق. أقترح إما استخدام phpexcel نفسها لقراءة البيانات من الملف ، أو استخدام رمز القارئ كأساس للنص الخاص بك للوصول إلى المعلومات التي تحتاجها.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top