3 The file provides interface to open xml file.
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.common
;
18 import java
.io
.IOException
;
20 import org
.apache
.xmlbeans
.XmlException
;
21 import org
.apache
.xmlbeans
.XmlObject
;
22 import org
.tianocore
.FrameworkDatabaseDocument
;
23 import org
.tianocore
.ModuleSurfaceAreaDocument
;
24 import org
.tianocore
.PackageSurfaceAreaDocument
;
25 import org
.tianocore
.PlatformSurfaceAreaDocument
;
26 import org
.tianocore
.FrameworkDatabaseDocument
.FrameworkDatabase
;
27 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
28 import org
.tianocore
.PackageSurfaceAreaDocument
.PackageSurfaceArea
;
29 import org
.tianocore
.PlatformSurfaceAreaDocument
.PlatformSurfaceArea
;
31 public class OpenFile
{
37 public static void main(String
[] args
) {
38 // TODO Auto-generated method stub
43 Open specificed Msa file and read its content
45 @param strMsaFilePath The input data of Msa File Path
48 public static ModuleSurfaceArea
openMsaFile(String strMsaFilePath
) throws IOException
, XmlException
, Exception
{
49 Log
.log("Open Msa", strMsaFilePath
);
50 File msaFile
= new File(strMsaFilePath
);
51 ModuleSurfaceAreaDocument xmlMsaDoc
= (ModuleSurfaceAreaDocument
) XmlObject
.Factory
.parse(msaFile
);
52 return xmlMsaDoc
.getModuleSurfaceArea();
56 Open specificed Spd file and read its content
58 @param strSpdFilePath The input data of Spd File Path
61 public static PackageSurfaceArea
openSpdFile(String strSpdFilePath
) throws IOException
, XmlException
, Exception
{
62 Log
.log("Open Spd", strSpdFilePath
);
63 File spdFile
= new File(strSpdFilePath
);
64 PackageSurfaceAreaDocument xmlSpdDoc
= (PackageSurfaceAreaDocument
) XmlObject
.Factory
.parse(spdFile
);
65 return xmlSpdDoc
.getPackageSurfaceArea();
69 Open specificed Fpd file and read its content
71 @param strFpdFilePath The input data of Fpd File Path
74 public static PlatformSurfaceArea
openFpdFile(String strFpdFilePath
) throws IOException
, XmlException
,
76 Log
.log("Open Fpd", strFpdFilePath
);
77 File fpdFile
= new File(strFpdFilePath
);
78 PlatformSurfaceAreaDocument xmlFpdDoc
= null;
79 xmlFpdDoc
= (PlatformSurfaceAreaDocument
) XmlObject
.Factory
.parse(fpdFile
);
80 return xmlFpdDoc
.getPlatformSurfaceArea();
85 Open specificed Framework Database file and read its content
88 public static FrameworkDatabase
openFrameworkDb(String strDbFilePath
) throws IOException
, XmlException
, Exception
{
89 Log
.log("Open Framework Database", strDbFilePath
);
90 File db
= new File(strDbFilePath
);
91 FrameworkDatabaseDocument xmlDb
= null;
92 xmlDb
= (FrameworkDatabaseDocument
) XmlObject
.Factory
.parse(db
);
93 return xmlDb
.getFrameworkDatabase();