DOM 
Basic からでも使える DOM。ほかの言語であれば言語に実装されているものが利用できるはず。PyUNO に DOM オブジェクトを渡すと OOo がフリーズします。
com.sun.star.xml.dom.DocumentBuilder サービスを使用します。
ファイルから読み込み 
xml ファイルから読み込んで DOM を構築します。
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| | Sub dom_1
sURL = "file:///E:/usr/12.xml"
oSFA = CreateUnoService( _
"com.sun.star.ucb.SimpleFileAccess")
oIn = oSFA.openFileRead(sURL)
oBuilder = CreateUnoService( _
"com.sun.star.xml.dom.DocumentBuilder")
oDoc = oBuilder.parse(oIn)
oIn.closeInput()
If NOT IsNull(oDoc) Then
If NOT (oDoc.getDoctype().getName() = "menu:menubar") Then Exit Sub
oElement = oDoc.getDocumentElement()
If oElement.getTagName() = "menubar" Then
oNodes = oElement.getChildNodes()
For i = 0 To oNodes.getLength() -1 step 1
oNode = oNodes.item(i)
' do something ....
Next
End If
End If
End Sub
|
保存 
oOut = oSfa.openFileWrite(sURL)
oDOM.setOutputStream(oOut)
oDOM.start()
oOut.closeOutput()
エンコードは設定できません (OOo 3.3)。