ผมมี XML ของ docx ซึ่งอยากจะดึงมาค้นหาเฉพาะที่เป็น หัวข้อ1 2 3

ผมมี XML ของ docx ซึ่งอยากจะดึงมาค้นหาเฉพาะที่เป็น หัวข้อ1 2 3

      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>


    

        -
        

              <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

        

            

                - <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">

            

                

                    

                        - <w:body>

                    

                        

                            

                                - <w:p w:rsidR="00297869" w:rsidRDefault="00F01E1C" w:rsidP="00F70BFA">

                            

                                

                                    

                                        - <w:pPr>

                                    

                                        

                                            

                                                  <w:pStyle w:val="1" />

                                        

                                        

                                              </w:pPr>

                                    

                                

                                

                                    

                                          <w:bookmarkStart w:id="0" w:name="_GoBack" />

                                

                                

                                    

                                          <w:bookmarkEnd w:id="0" />

                                

                                

                                    

                                        - <w:r w:rsidRPr="00F01E1C">

                                    

                                        

                                            

                                                  <w:t>How tall ar</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                    

                                        - <w:r>

                                    

                                        

                                            

                                                  <w:t>e you?</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                      </w:p>

                            

                        

                        

                            

                                - <w:p w:rsidR="00F01E1C" w:rsidRDefault="00F01E1C" w:rsidP="00F01E1C">

                            

                                

                                    

                                        - <w:pPr>

                                    

                                        

                                            

                                                  <w:pStyle w:val="a3" />

                                        

                                        

                                            

                                                - <w:numPr>

                                            

                                                

                                                    

                                                          <w:ilvl w:val="1" />

                                                

                                                

                                                    

                                                          <w:numId w:val="1" />

                                                

                                                

                                                      </w:numPr>

                                            

                                        

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                              </w:pPr>

                                    

                                

                                

                                    

                                        - <w:r>

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:t>I am 172 centimeters tall.</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                    

                                        - <w:r w:rsidR="00B04DDE">

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:br />

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                      </w:p>

                            

                        

                        

                            

                                - <w:p w:rsidR="00F01E1C" w:rsidRDefault="00F01E1C" w:rsidP="00F70BFA">

                            

                                

                                    

                                        - <w:pPr>

                                    

                                        

                                            

                                                  <w:pStyle w:val="1" />

                                        

                                        

                                              </w:pPr>

                                    

                                

                                

                                    

                                        - <w:r>

                                    

                                        

                                            

                                                  <w:t>How weights are you?</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                      </w:p>

                            

                        

                        

                            

                                - <w:p w:rsidR="00F70BFA" w:rsidRDefault="00F70BFA" w:rsidP="00F70BFA">

                            

                                

                                    

                                        - <w:pPr>

                                    

                                        

                                            

                                                  <w:pStyle w:val="a3" />

                                        

                                        

                                            

                                                - <w:numPr>

                                            

                                                

                                                    

                                                          <w:ilvl w:val="1" />

                                                

                                                

                                                    

                                                          <w:numId w:val="1" />

                                                

                                                

                                                      </w:numPr>

                                            

                                        

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                              </w:pPr>

                                    

                                

                                

                                    

                                        - <w:r>

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:t>I am 50 kilograms weight.</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                    

                                        - <w:r w:rsidRPr="00F70BFA">

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:t xml:space="preserve"></w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                      </w:p>

                            

                        

                        

                            

                                - <w:p w:rsidR="00F70BFA" w:rsidRDefault="00F70BFA" w:rsidP="00F70BFA">

                            

                                

                                    

                                        - <w:pPr>

                                    

                                        

                                            

                                                  <w:pStyle w:val="a3" />

                                        

                                        

                                            

                                                - <w:numPr>

                                            

                                                

                                                    

                                                          <w:ilvl w:val="1" />

                                                

                                                

                                                    

                                                          <w:numId w:val="1" />

                                                

                                                

                                                      </w:numPr>

                                            

                                        

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                              </w:pPr>

                                    

                                

                                

                                    

                                        - <w:r>

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:t>I am 70 kilograms weight.</w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                    

                                        - <w:r w:rsidRPr="00F70BFA">

                                    

                                        

                                            

                                                - <w:rPr>

                                            

                                                

                                                    

                                                          <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />

                                                

                                                

                                                    

                                                          <w:sz w:val="28" />

                                                

                                                

                                                      </w:rPr>

                                            

                                        

                                        

                                            

                                                  <w:t xml:space="preserve"></w:t>

                                        

                                        

                                              </w:r>

                                    

                                

                                

                                      </w:p>

                            

                        

                        

                            

                                - <w:p w:rsidR="00F01E1C" w:rsidRDefault="00F70BFA" w:rsidP="00F70BFA">

                            

                                

                                    

                                        -
04 มี.ค. 2554 3 685

ผมมี XML ของ docx ซึ่งอยากจะดึงมาค้นหาเฉพาะที่เป็น ชื่อเรื่อง 1 ที่ต้องการและเนื้อหาในนั้นครับ

ไม่รู้จะดึงอย่างไงดีครับ  พอทำเป็น zip แล้วแตกออกมาไฟล์มันกระจายย่อยมากๆ มีชื่อว่า document.xml คือเนื้อหาของเราแต่ไม่รู้ว่าจะเอาที่เป็น heading 1 และเนื้อหาใต้นั้นมาอย่างไงครับ
#1


    หรือเรียกง่ายๆว่าสกัดข้อความจาก Microsoft Word (Docx)

    มีวิธีอื่นก็บอกได้ครับ


#2

ถ้าเป็นข้อความธรรมดาก็แยกด้วย preg_math() ก็ได้ครับ ส่วนจะเขียนคำสั่งยงไง จยใจจะตอบ เพราะไม่รู้รูปแบบ และไม่รู้ว่ามันเหมือนกันทุกรายการหรือไม่ ซึ่งถ้าเหมือนกัน การแยกก็จะเป็นไปได้



ส่วนวิธีการอ่านข้อความกับ docx โดยตรงยังไม่เคยเห็นครับ
#3
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^