CN1632797A - File searching method for XML - Google Patents

File searching method for XML Download PDF

Info

Publication number
CN1632797A
CN1632797A CN 200410102753 CN200410102753A CN1632797A CN 1632797 A CN1632797 A CN 1632797A CN 200410102753 CN200410102753 CN 200410102753 CN 200410102753 A CN200410102753 A CN 200410102753A CN 1632797 A CN1632797 A CN 1632797A
Authority
CN
China
Prior art keywords
http
org
name
xmldb
personnel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN 200410102753
Other languages
Chinese (zh)
Inventor
李安渝
严兵
傅朝霞
秦良娟
丁蔚
耿建光
秦怀平
董胜涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhou Digital Software Co ltd
Institute of Software of CAS
Original Assignee
Shenzhou Digital Software Co ltd
Institute of Software of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhou Digital Software Co ltd, Institute of Software of CAS filed Critical Shenzhou Digital Software Co ltd
Priority to CN 200410102753 priority Critical patent/CN1632797A/en
Publication of CN1632797A publication Critical patent/CN1632797A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Document Processing Apparatus (AREA)

Abstract

This invention discloses an extensive marking language file searching method, which comprises the following steps: to get the name space of the element through the whole name of the element to be searched; to get the mapping file of the extensive language files through name space; to find the element to be searched and its element types through mapping files to get all the database. This method can realize the effect searching of the extensive marking language files in the relation database.

Description

File searching method for XML
Technical field
The present invention relates to the extend markup language field, refer to a kind of file exporting method for XML especially.
Background technology
Fast development along with Internet, xml (Extensible Markup Language, extend markup language) goes up the new standard of data representation as Internet, with advantages such as its self descriptiveness that has, dirigibility, extendability and platform-neutrals, be widely used in the various Web application.
Many in recent years research work are devoted to database technology is applied in the processing of xml file.Utilize the database proven technique to store the xml file.The xml database form of main flow is to utilize relational database to store the xml file at present, for example relational database such as Oracle9i, SQL Server 2000.
After utilizing relation data library storage xml file, how can efficiently the element of xml file be retrieved out the strong interest that always is subjected to industry.
Summary of the invention
The problem to be solved in the present invention provides a kind of file searching method for XML that can efficient retrieval extensible markup language document element.
In order to address the above problem, file searching method for XML of the present invention, be used for the extensible markup language document that is stored in relation database table is retrieved, storage system information in the relational database system table, deposit the extensible markup language document element in the relation database table, deposit the name space mapped file corresponding in the pattern list of relational database system table, comprise the steps: with it
1) global namespace by element to be retrieved is to obtain the name space of this element, and some is used to represent name space in the described global namespace;
2) by name space to obtain the mapped file of extensible markup language document;
3) find the type of element to be retrieved and daughter element thereof by mapped file, thereby obtain its corresponding all relation database tables;
4) by obtaining element to be retrieved in the relation database table.
Described step 4) further is subdivided into following step again:
40) from relation database table, select all qualified records, and according to mapped file structure XML element node;
41) qualified a plurality of elements being accumulated a result set returns.
Compared with prior art, the beneficial effect of file searching method for XML of the present invention is:
Since according to the global namespace of element to be retrieved to obtain name space, obtain the mapped file of this name space according to name space, can find the database table relevant according to mapped file with element to be retrieved, can retrieve element to be retrieved, and needn't consider problems such as multilist connection, thereby can realize efficient inquiry to the xml document element.
Description of drawings
Fig. 1 is a file searching method for XML process flow diagram of the present invention;
Fig. 2 is the process flow diagram that step 1) is further divided among Fig. 1;
Fig. 3 is the dependence synoptic diagram of four patterns among the embodiment.
Embodiment
Before introducing the technical scheme of file searching method for XML of the present invention, earlier the xml file is deposited in the relation database table, and then adopt file searching method for XML of the present invention that the element that deposits the xml file in the relation database table in is retrieved.
This routine xml file has four patterns.
Pattern one: company.xsd<? xml version=" 1.0 " encoding=" UTF-8 "?〉<xs:schema targetNamespace=" http://org.xmldb.company " xmlns:xs=" http://www.w3.org/2001/XMLSchema " xmlns=" http://org.xmldb.company " xmlns:per=" http://org.xmldb.personnel " elementFormDefault=" qualified " attributeFormDefault=" unqualified " 〉; Dependence pattern personal.xsd
<xs:import?namespace=″http://org.xmldb.personnel″schemaLocation=″personal.xsd″/>
<xs:element?name=″company″>
<xs:annotation>
<xs:documentation>Comment?describing?your?root?element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element?name=″employee″type=″employee″/>
<xs:element?name=″department″>
<xs:complexType>
<xs:sequence>
<xs:element?name=″manager″>
<xs:complexType>
<xs:sequence>
<xs:element?name=″rank″type=″xs:string″/>
<xs:element?ref=″per:person″/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element?name=″name″type=″xs:string″/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>??</xs:element>??<xs:complexType?name=″employee″>
<xs:sequence>
<xs:element?ref=″per:person″maxOccurs=″unbounded″/>
</xs:sequence>??</xs:complexType></xs:schema>
Pattern two: government.xsd<? xml version=" 1.0 " encoding=" UTF-8 "?〉<xs:schema targetNamespace=" http://org.xmldb.government " xmlns:xs=" http://www.w3.org/2001/XMLSchema " xmlns:per=" http://org.xmldb.personnel " xmlns=" http://org.xmldb.govemment " elementFormDefault=" qualified " attributeFormDefault=" unqualified " 〉; Dependence pattern personal.xsd<xs:import namespace=" http://org.xmldb.personnel " schemaLocation=" personal.xsd "/〉<xs:element name=" govemment " 〉
<xs:annotation>
<xs:documentation>Comment?describing?your?root?element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element?name=″officers″>
<xs:complexType>
<xs:sequence>
<xs:element?ref=″per:person″maxOccurs=″unbounded″/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element?name=″name″type=″xs:string″/>
<xs:element?name=″affiliated″type=″xs:string″/>
</xs:sequence>
</xs:complexType>
</xs:element></xs:schema>
Pattern three: personal.xsd<? xml version=" 1.0 " encoding=" UTF-8 "?〉<xs:schema targetNamespace=" http://org.xmldb.personnel " xmlns:xs=" http://www.w3.org/2001/XMLSchema " xmlns=" http://org.xmldb.personnel " xmlns:addr=" http://org.xmldb.address " elementFormDefault=" qualified " 〉; Dependence pattern address.xsd
<xs:import namespace=" http://org.xmldb.address " schemaLocation=" address.xs "/〉; The global element of mode-definition
<xs:element name=" personnel " 〉; The complicated type of mode-definition
<xs:complexType>
<xs:sequence>
<xs:element?ref=″person″maxOccurs=″unbounded″/>
</xs:sequence>
</xs:complexType>
<xs:unique?name=″uniquel″>
<xs:selector?xpath=″person″/>
<xs:field?xpath=″name/given″/>
<xs:field?xpath=″name/family″/>
</xs:unique>
<xs:key?name=″empid″>
<xs:selector?xpath=″person″/>
<xs:field?xpath=″@id″/>
</xs:key>
<xs:keyref?name=″keyrefl″refer=″empid″>
<xs:selector?xpath=″person″/>
<xs:field?xpath=″link/@manager″/>
</xs:keyref〉</xs:element 〉; The global element of mode-definition<xs:element name=" person " 〉; The complicated type of mode-definition
<xs:complexType>
<xs:sequence>
<xs:element ref=" name "/〉; The multiple simple types element of Schema definition
<xs:element?ref=″email″minOccurs=″0″maxOccurs=″unbounded″/>
<xs:element?ref=″url″minOccurs=″0″maxOccurs=″unbounded″/>
<xs:element name=" addresses " 〉; The complicated type of mode-definition
<xs:complexType>
<xs:sequence?maxOccurs=″unbounded″>
<xs:element?ref=″addr:address″/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute?name=″id″type=″xs:ID″use=″required″/>
<xs:attribute?name=″note″type=″xs:string″/>
<xs:attribute?name=″contr″default=″false″>
<xs:simpleType>
<xs:restriction?base=″xs:string″>
<xs:enumeration?value=″true″/>
<xs:enumeration?value=″false″/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute?name=″salary″type=″xs:integer″/>
</xs:complexType〉</xs:element 〉; The global element of mode-definition<xs:element name=" name " 〉; The complicated type of mode-definition
<xs:complexType>
<xs:all>
<xs:element?ref=″family″/>
<xs:elementref=″given″/>
</xs:all>
</xs:complexType〉</xs:element 〉; The global element of mode-definition<xs:clement name=" family " type=" xs:string "/〉; The global element of mode-definition<xs:element name=" given " type=" xs:string "/〉; The global element of mode-definition<xs:element name=" email " type=" xs:string "/〉; The global element of mode-definition<xs:element name=" url " 〉; The complicated type of mode-definition
<xs:complexType>
<xs:attribute?name=″href″type=″xs:string″default=″http://″/>
</xs:complexType>??</xs:element></xs:schema>
Pattern four: address.xsd<? xml version=" 1.0 " encoding=" UTF-8 "?〉<xs:schema targetNamespace=" http://org.xmldb.address " xmlns:xs=" http://www.w3.org/2001/XMLSchema " xmlns=" http://org.xmldb.address " elementFormDefault=" qualified " attributeFormDefault=" unqualified " 〉; The defined global element address of Schema<xs:element name=" address " 〉
<xs:annotation>
<xs:documentation>Comment?descrlbing?your?root?element</xs:documentation>
</xs:annotation 〉; The defined local complicated type of Schema
<xs:complexType>
<xs:sequence 〉; The local element that defines in the defined complicated type of Schema
<xs:element?name=″tel″type=″xs:string″/>
<xs:element?name=″postcode″type=″xs:string″/>
<xs:element?name=″street″type=″xs:string″/>
</xs:sequence>
</xs:complexType>
</xs:element></xs:schema>
At first, set up the Database Systems table: document examples table (docInstance), collection of document table (collection), complicated type table (complexType), pattern list (schema), pattern adduction relationship table (schemacrossref) and global element table (docRoot).
Schemacrossref is used to deposit the dependence between the extensible markup language document pattern, comprises that field name space (namespace) and name space quote (refednamespace);
Schema is used to deposit the corresponding relation of the extensible markup language document pattern mapped file corresponding with it, comprises field name space (namespace), name (name), mode contents (text) and mapped file name (mapping);
DocInstance is used to deposit the extensible markup language document storaging mark, comprises field document examples sign (id), name (name), collection of document off-balancesheet key (collectionId (FK)) and document original contents (text);
ComplexType is used for the database table that pattern generated (table name of id for generating) that database of record imports, and comprises field complicated type sign (id), name (name), name space off-balancesheet key (namespace (FK)) and type (type);
DocRoot is used to preserve the defined global element of pattern that database imports, and comprises field global element sign (id), name (name) and name space (namespace (FK));
Collection, the set that is used to deposit a class xml file comprises field file identification (id), name (name) and global element off-balancesheet key (docrootid (FK)).
Then, use general resolver that schema is resolved as common xml file, analyze xs:import element wherein, the dependence between xml schema (import) relation is deposited among the Database Systems table Schemacrossref.When certain concrete pattern of importing,,, then it is imported in the lump if the pattern of these dependences does not import among the schemacrossref because it may rely on other pattern.
As shown in Figure 3, the dependence of above-mentioned four patterns is that company.xsd and government.xsd all rely on personal.xsd, and personal.xsd relies on address.xsd.
The event memory of table Schemacrossref is behind the importing government.xsd:
?Namespace ?Refednamespace
?http://org.xmldb.personnel ?http://org.xmldb.address
?http://org.xmldb.government ?http://org.xmldb.personnel
The event memory that imports table Schemacrossref behind the company.xsd then is:
?Namespace ?Refednamespace
?http://org.xmldb.personnel ?http://org.xmldb.address
?http://org.xmldb.government ?http://org.xmldb.personnel
?http://org.xmldb.company ?http://org.xmldb.personnel
Following example adopts the schema resolver, for example: apach xerces, obtain the schema object model that meets the w3c standard, obtain the name space that it is quoted according to the schema object model again, the name space that the schema object that company.xsd obtained in this example is quoted has three, is respectively:
http://org.xmldb.company
http://org.xmldb.personnel
http://org.xmldb.address
Creating a mapped file for each name space again, is respectively mapping-company.xml, mapping-personal.xml and mapping-address.xml.This example leaves the corresponding relation of pattern and mapped file among the Database Systems table schema in, and storage back table schema result is:
?NAMESPACE ?NAME TEXT MAPPING
?http://org.xmldb.company ?company.xsd Content slightly is the Schema urtext Content slightly is the mapping urtext
?http://org.xmldb.personnel ?personal.xsd The same The same
?http://org.xmldb.address ?address.xsd The same The same
The process that pattern three: personal.xsd generates mapped file mapping-personal.xml is described below.
Before this process, adopt following method that type among the personal.xsd and element are named earlier:
With global element called after " the name attribute value of { element}{+ target designation space+}+element ";
With overall complicated type called after " the name attribute value of { type}{+ target designation space+}+complicated type ";
With local element called after " the name attribute value that comprises global namespace+"/"+this part element of the complicated type of this part element ";
With local complicated type called after should the part complicated type the global namespace of father's element;
Global namespace with its type of foundation of simple types called after.
So all global element and the global namespace thereof of this mode-definition are as follows:
personnel:{element}{http://org.xmldb.personnel}personel
person:{element}{http://org.xmldb.personnel}person
name:{element}{http://org.xmldb.personnel}name
family:{element}{http://org.xmldb.personnel}family
given:{element}{http://org.xmldb.personnel}given
email:{element}{http://org.xmldb.personnel}email
url:{element}{http://org.xmldb.personnel}url
The global namespace of five complicated types is:
{element}{http://org.xmldb.personnel}personel
{element}{http://org.xmldb.personnel}person
{element}{http://org.xmldb.personnel}name
{element}{http://org.xmldb.personnel}url
{element}{http://org.xmldb.personnel}person/addresses
The global namespace of local simple types is:
{type}{http://www.w3.org/2001/XMLSchema}String
After the element of this pattern and type have had global namespace, promptly can distinguish different types and element, the process of mapped file mapping-personal.xml is as follows:
Obtain whole global element and complicated type among the personal.xsd.
The global element that is obtained is: personnel, person, name, family, given, email, url
The complicated type that is obtained is:
{element}{http://org.xmldb.personnel}personnel
{element}{http://org.xmldb.personnel}person
{element}{http://org.xmldb.personnel}name
{element}{http://org.xmldb.personnel}url
{element}{http://org.xmldb.personnel}person/addresses
Then each global element is generated an XmlMappingElement node and its corresponding attribute is set.Regeneration XmlMappingElements node, this node comprise the XmlMappingElement node of all generations.This example is:; Xml element set node<XmlMappingElements 〉; Global element person
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}person″localName=″person″
elementType=″complex″
type=″{element}{http://org.xmldb.personnel}person″
Id=" F8522164_DC8A_498E_888E_D7ACF6291D39 "/〉; Global element personnel
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}personnel″
localName=″personnel″elementType=″complex″
type=″{element}{http://org.xmldb.personnel}personnel″
Id=" DB1D8AEA_A320_4203_BC3F_B2FE7D4AE326 "/〉; Global element url
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}url″localName=″url″
elementType=″complex″type=″{element}{http://org.xmldb.personnel}url″
Id=" 2E1E9830_AB88_4DC8_8B72_A3DE735CA329 "/〉; Global element family
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}family″localName=″family″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
Id=" 3DC9DBB9_9E7E_4CF4_BDA8_A0AF486E5364 "/〉; Global element name
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}name″localName=″name″
elementType=″complex″
type=″{element}{http://org.xmldb.personnel}name″
Id=" 5F8ECF2E_82E5_48E7_BD5D_C21FAC8CC297 "/〉; Global element given
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}given″localName=″given″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
Id=" 11B6ACF7_CC08_415C_8650_FB5730BE0137 "/〉; Global element email
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}email″localName=″email″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″CAAAF143_2956_454D_8AF3_8E59F56BBA4E″/>
</XmlMappingElements>
At last each complicated type is generated the XmlMappingType node and respective attributes is set, also will find out all daughter elements (comprising attribute) that each complicated type comprises.Each daughter element is generated the XmlMappingElement node, and put it in the XmlMappingType node of the complicated type under it.Regeneration XmlMappingTypes node, this node comprise the XmlMappingType node of all generations.
XmlMappingTypes and XmlMappingType are in the mapped file that Personal.xsd generates:; Xml type collector node<XmlMappingTypes 〉; Complicated type element}{http: //org.xmldb.personnel}personnel
<xmlMappingType?id=″94737D4C_F969_48FF_A4A1_823FA8647BAD″
name=″{element}{http://org.xmldb.personnel}personnel″
Namespace=" http://org.xmldb.personnel " 〉; Daughter element person
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}person″
localName=″person″elementType=″complex″
type=″{element}{http://org.xmldb.personnel}person″
id=″F8522164_DC8A_498E_888E_D7ACF6291D39″/>
</XmlMappingType 〉; Complicated type element}{http: //org.xmldb.personnel}person
<XmlMappingType?id=″D62E1F94_35CA_4362_BB4E_DC39C58EACA3″
name=″{element}{http://org.xmldb.personnel}person″
Namespace=" http://org.xmldb.personnel " 〉; Daughter element id
<XmlMappingElement?name=″id″localName=″id″
elementType=″attribute″
type=″{type}{http://www.w3.org/2001/XMLSchema}ID″
Id=" 81195F3E_ED21_44C6_A0D5_F4F0E44BC159 "/〉; Daughter element note
<XmlMappingElement?name=″note″localName=″note″
elementType=″attribute″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
Id=" 7AA4C149_DB7A_4F75_91DF_B01EF4B5B40D "/〉; Daughter element contr
<XmlMappingElement?name=″contr″localName=″contr″
elementType=″attribute″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
Id=" 11C9845E_B1BF_4BFC_A1D0_CD6D89F50F41 "/〉; Daughter element salary
<XmlMappingElement?name=″salary″localName=″salary″
elementType=″attribute″
type=″{type}{http://www.w3.org/2001/XMLSchema}integer″
Id=" 34009506_9DC1_4468_A654_E66BFFE49FCD "/〉; Daughter element name
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}name″localName=″name″
elementType=″complex″
type=″{element}{http://org.xmldb.personel}name″
Id=" 5F8ECF2E_82E5_48E7_BD5D_C21FAC8CC297 "/〉; Daughter element email
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}email″localName=″email″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″CAAAF143_2956_454D_8AF3_8E59F56BBA4E″minOccurs=″0″
MaxOccurs=" 100000 "/〉; Daughter element url
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}url″localName=″url″
elementType=″complex″
type=″{element}{http://org.xmldb.personnel}url″
Id=" 2E1E9830_AB88_4DC8_8B72_A3DE735CA329 "/〉; Daughter element addresses
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}person/addresses″
localName=″addresses″elementType=″complex″
type=″{element}{http://org.xmldb.personnel}person/addresses″
id=″1D2AA93A_0DEF_4924_A88F_C433515B20F6″/>
</XmlMappingType 〉; Complicated type element}{http: //org.xmldb.personnel}name
<XmlMappingType?id=″45E5901B_C36F_4F9E_8888_ADB29B816770″
name=″{element}{http://org.xmldb.personnel}name″
Namespace=" http://org.xmldb.personnel " 〉; Daughter element family
<XmlMappingElement
nams=″{element}{http://org.xmldb.personnel}family″
localName=″family″elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchsma}string″
id=″3DC9DBB9_9E7E_4CF4_BDA8_A0AF486E5364″minOccurs=″1″
MaxOccurs=" 1 "/〉; Daughter element given
<XmlMappingElement
name=″{element}{http://org.xmldb.personnel}given″localName=″given″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″11B6ACF7_CC08_415C_8650_FB5730BE0137″minOccurs=″1″
maxOccurs=″1″/>
</XmlMappingType 〉; Complicated type element}{http: //org.xmldb.personnel}url
<XmlMappingType?id=″22F2B421_815E_4E95_9D49_C67FA72D5265″
name=″{element}{http://org.xmldb.personnel}url″
Namespace=" http://org.xmldb.personnel " 〉; Daughter element href
<XmlMappingElement?name=″href″localName=″href″
elementType=″attribute″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″5ACA5FFB_8E8A_4E9A_A17F_86FFCD1EE1E
</XmlMappingType 〉; Complicated type element}{http: //org.xmldb.personnel}person/addresses
<XmlMappingType?id=″3E043791_8941_471A_A95D_A3DC796BBD5C″
name=″{element}{http://org.xmldb.personnel}person/addresses″
Namespace=" http://org.xmldb.personnel " 〉; Daughter element address
<XmlMappingElement
name=″{element}{http://org.xmldb.address}address″
localName=″address″elementType=″complex″
type=″{element}{http://org.xmldb.address}address″
id=″35CEl14E_D191_4534_A321_9BA88F9CB0BF″/>
</XmlMappingType>
</XmlMappingTypes>
In like manner, the mapped file mapping-address.xml of address.xsd generation is:<XmlMapping 〉
<XmlMappingTypes>
<XmlMappingType?id=″35CE114E_D191_4534_A321_9BA88F9CB0BF″
name=″{element}{http://org.xmldb.address}address″
namespace=″http://org.xmldb.address″>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address/tel″
localName=″tel″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″212928B8_D160_4134_B8F3_C506103FFB82″
minOccurs=″1″maxOccurs=″1″/>
<XmlMappingElement?name=″{elemsnt}{http://org.xmldb.address}address/postcode″
localName=″postcode″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″46BFC031_7FA7_48ED_A73E_E82184BB67B5″
minOccurs=″1″maxOccurs=″1″/>
<xmlMappingElement?name=″{element}{http://org.xmldb.address}address/street″
localName=″street″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″AD2EEE92_A353_4127_AEC1_84B5851F1E98″
minOccurs=″1″maxOccurs=″1″/>
</XmlMappingType>
</XmlMappingTypes>
<XmlMappingElements>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address″
localName=″address″
elementType=″complex″
type=″{element}{http://org.xmldb.address}address″
id=″0430D375_32FE_4072_B254_C71C664456B3″/>
</XmlMappingElements></XmlMapping>
Generate relation database table according to mapped file mapping-personal.xml below.
At first generate a table for each XmlMappingType among the mapping-personal.xml, unique in order to make table name, the id among this example employing XmlMappingType is as the table name of this table;
Secondly with all properties that XmlMappingType comprised with occur smaller or equal to once simple types element field as this table;
Moreover for the sublist of simple types element generation that occurs more than once, its table name is the id of XmlMappingElement;
At last, the table of all generations is all set up public field: uuid_id, uuid_name, uuid_docid, uuid_parented, uuid_order.
Annotate: only generate a table for a complex type element, no matter this complicated type is quoted by which xmlschema.Make the table of generation not rely on the xml schema that quotes complicated type like this, and only depend on the xml schema of this complex type element of definition.Thereby the element of all same types all can be stored together.
For five XmlMappingType elements are arranged among the mapping-personal.xml, simultaneously the simple types element element}{http: //the maximum occurrence number of org.xmldb.personnel}email is greater than 1, so should generate six tables, the situation of generation table left among the Database Systems table complextype be:
??ID ??NAMESPACE ??NAME ??TYPE
??94737D4C_F969_48FF_A4A1_823FA8647BAD ??http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}person ??nel ??complextype
??D62E1F94_35CA_4362_BB4E_DC39C58EACA3 ??http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}person ??complextype
??CAAAF143_2956_454D_8AF3_8E59F56BBA4E ??http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}person/ ??email ??dupelement
??45E5901B_C36F_4F9E_8888_ADB29B816770 ???http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}name ??complextype
??22F2B421_815E_4E95_9D49_C67FA72D5265 ???http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}url ??complextype
??3E043791_8941_471A_A95D_A3DC796BBD5C ???http://org.xmldb.personnel ??{element}{http://org.xmldb.personnel}person/ ??addresses ??complextype
Wherein every table all comprises following public field: (wherein AB8E7A48_544A_48E3_8E4C_81268F986E10 is the UUID of this routine appointment)
The row name
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
?AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
Except comprising above-mentioned public field, all properties of affiliated type of schema definition and the field of simple types element have also been comprised for every table.
Table 94737D4C_F969_48FF_A4A1_823FA8647BAD (element}{http: //field that org.xmldb.personnel}personnel) comprises is:
The row name
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
??AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
Table D62E1F94_35CA_4362_BB4E_DC39C58EACA3 (element}{http: //field that org.xmldb.personnel}person) comprises is:
The row name
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
?AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
?ID
?NOTE
?CONTR
?SALARY
Table CAAAF143_2956_454D_8AF3_8E59F56BBA4E (element}{http: //field that org.xmldb.personnel}person/email) comprises is:
The row name
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
?AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
??EMAIL
Table 45E5901B_C36F_4F9E_8888_ADB29B816770 (element}{http: //field that org.xmldb.personnel}name) comprises is:
The row name
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
??AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
??FAMILY
??GIVEN
Table 22F2B421_815E_4E95_9D49_C67FA72D5265 (element}{http: //field that org.xmldb.personnel}url) comprises is:
The row name
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
??AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
??HREF
Table 3E043791_8941_471A_A95D_A3DC796BBD5C (element}{http: //field that org.xmldb.personnel}person/addresses) comprises is:
The row name
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
??AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
??AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
??AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
In like manner, according to mapped file mapping-address.xml, the table that the global element address among the address.xsd generates is:
Table 35CE114E_D191_4534_A321_9BA88F9CB0BF
The row name
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID
?AB8E7A48_544A_48E3_8E4C_81268F986E10_NAME
?AB8E7A48_544A_48E3_8E4C_81268F986E10_ORDER
?AB8E7A48_544A_48E3_8E4C_81268F986E10_PARENTID
?TEL
?POSTCODE
?STREET
Be that example is described the process that element value is deposited in relation database table with example personal.xml below.
Example Personal.xml is:<? xml version=" 1.0 " encoding=" UTF-8 "?; Name space is http://org.xmldb.personnel<personnel xmlns=http: //org.xmldb.personnel xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=″http://org.xmldb.personnel?personal.xsd″xmlns:addr=″http://org.xmldb.address″>??<person?id=″idl″salary=″500″>
<name>
<family〉open</family 〉
<given〉three</given 〉
</name>
<email>a@a.com</email>
<addresses>
<addr:address>
<addr:tel>1234567</addr:tel>
<addr:postcode>100005</addr:postcode>
<addr:street〉academy of sciences</addr:street 〉
</addr:address>
</addresses>??</person>??<person?id=″id2″salary=″500″>
<name>
<family〉Lee</family 〉
<given〉four</given 〉
</name>
<email>b@b.com</email>
<email>c@c.com</email>
<addresses>
<addr:address>
<addr:tel>789898</addr:tel>
<addr:postcode>100006</addr:postcode>
<addr:street〉Peking University</addr:street 〉
</addr:address>
</addresses>???</person></personnel>
At first, the parsing extend markup language file is to obtain DOM Document Object Model (dom tree);
Secondly, recurrence is handled each node layer of dom tree and the attribute of node, and each node is repeated following process:
Utilize the mapping file to find " elementType " and " type " of this node,
If elementType be simple types (simple) and occurrence number smaller or equal to one, this nodal value is inserted corresponding field in father node table,
If elementType be simple types (simple) and occurrence number more than once, nodal value is inserted in the table of this node correspondence;
If elementType is complicated type (complex), nodal value is inserted in the pairing table of complex type element of this node, the attribute of analysis node inserts corresponding field in the table with all properties value simultaneously.
The xml instance document personal.xml that will meet personal.xsd definition is stored in result in the relation database table for (for simplicity, " AB8E7A48_544A_48E3_8E4C_81268F986E10 " with public field omits in this article, only keep " _ ", because the field " AB8E7A48_544A_48E3_8E4C_81268F986E10_INSTANCEID " of all these document relative recordings value is identical, will not list here simultaneously):
Table 94737D4C_F969_48FF_A4A1_823FA8647BAD (element}{http: //org.xmidb.personnel}personnel) event memory is:
????_ID ????_NAME ????_ORDER ??_PARENTID
?C1582E5B_9C2C_410B_9547_CB7FEAF5EF2E ????personnel ????1 ??null
Table D62E1F94_35CA_4362_BB4E_DC39C58EACA3 (element}{http: //org.xmldb.personnel}person) event memory is:
??_ID ??_NA ??ME ??_ORD ??ER ??_PARENTID ??ID ??NOTE ??CONTR ??SALA ??RY
??098C3309_C363_ ??47EE_AEF3_A55 ??person ??2 ??C1582E5B_9C2C ??_410B_9547_CB ??id1 ??null ??FALSE ??500
??C0BAF441_5C4A ??_4490_B518_F0 ??person ??7 ??C1582E5B_9C2C ??_410B_9547_CB ??id2 ??null ??FALSE ??500
Table CAAAF143_2956_454D_8AF3_8E59F56BBA4E (element}{http: //org.xmldb.personnel}person/email) event memory is:
?_ID ?_NAME ?_ORDER ?_PARENTID ?EMAIL
?24CFED82_2357_4BE1_ ?9A1D_AF0BCED340B9 ?email ?4 ?098C3309_C363_47EE_AEF3_A55993E7FF83 ?a@a.com
?2B2B49BD_4D7E_4868_ ?866D_B82F2E02D4B3 ?email ?9 ?C0BAF441_5C4A_4490_B518_F085185A9E23 ?b@b.com
?9645D167_E1BA_4FA9_ ?B113_C1F74177FF6B ?email ?10 ?C0BAF441_5C4A_4490_B518_F085185A9E23 ?c@c.com
Table 45E5901B_C36F_4F9E_8888_ADB29B816770 (element}{http: //org.xmldb.personnel}name) event memory is:
??_ID ??_NA ??ME ??_ORD ??ER ??_PARENTID ??FAMIL ??Y ??GIVEN
??8876F44A_8324_4A7 ??0_8789_ED30CB307C ??B8 ??name ??3 ??098C3309_C363_47EE_AEF3_A55993E7F ??F83 Open Three
??993538B3_3ADC_43A ??9_A9F3_A61B7C9530 ??E1 ??name ??8 ??C0BAF441_5C4A_4490_B518_F085185A9 ??E23 Lee Four
Table 22F2B421_815E_4E95_9D49_C67FA72D5265 (element}{http: //org.xmldb.personnel}url) be recorded as sky.
Table 3E043791_8941_471A_A95D_A3DC796BBD5C (element}{http: //org.xmldb.personnel}person/addresses) event memory is:
?_ID ??_NAME ??_ORDER ??_PARENTID
?39E02917_F0A5_4B43_910B_8676B51E0CB4 ??addresses ??5 ??098C3309_C363_47EE_AEF3_A55993E7FF83
?11C39464_DA22_48C8_80F8_DEAF25D84AA2 ??addresses ??11 ??C0BAF441_5C4A_4490_B518_F085185A9E23
Owing to introduced schema " address.xsd " in " personal.xsd ", create when the information of element " addr:address " can be inserted importing " address.xsd " in " so personal.xml " document " element}{http: //org.xmldb.address}address " show among the 35CE114E_D191_4534_A321_9BA88F9CB0BF, its result is as follows:
?_ID ??_NAME ????_ORDER ?_PARENTID ??TEL ??POSTCODE ??STREET
?A0364D74_CB21_ ?40A9_8EB0_DD7 ??address ????6 ?39E02917_F0A5_ ?4B43_910B_867 ??1234567 ??100005 Academy of sciences
?CBgAAF4C_83B4 ?_4248__A7F0_D88 ??address ????12 ?11C39464_DA22_ ?48C8_80F8_DEA ??789898 ??100006 Peking University
Xml element address with query pattern " address.xsd " definition is the technical scheme that example describes file searching method for XML of the present invention in detail below.
As shown in Figure 1, file searching method for XML, be used for the extensible markup language document that is stored in relation database table is retrieved, storage system information in the relational database system table, deposit the extensible markup language document element in the relation database table, deposit the name space mapped file corresponding in the pattern list of relational database system table, comprise the steps: with it
1) by the name space (namespace) of global namespace to obtain this element of element to be retrieved, some is used to represent name space in the described global namespace, also is the content in second { } of global namespace;
2) by name space to obtain the mapped file of extensible markup language document, promptly can obtain mapped file by pattern list (schema);
3) find the type (type) of element to be retrieved and daughter element thereof by mapped file, thereby obtain its corresponding all relation database tables;
4) by obtaining element to be retrieved in the relation database table.
As shown in Figure 2, described step 4) further is subdivided into following step again:
40) from relation database table, select all qualified records, and according to mapped file structure XML element node;
41) qualified a plurality of elements being accumulated a result set returns.
At first, the global namespace owing to global element address is:
{element}{http://org.xmldb.address}address
Reading the name space that content in second { } of this global namespace obtains element address is:
http://org.xmldb.address
According to the record in these name space query relation Database Systems tables " schema ", find out the mapped file mapping-address.xml of this namespace.<XmlMapping>
<XmlMappingTypes>
<XmlMappingType?id=″35CE114E_D191_4534_A321_9BA88F9CB0BF″
name=″{element}{http://org.xmldb.address}address″
namespace=″http://org.xmldb.address″>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address/tel″
localName=″tel″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″212928B8_D160_4134_B8F3_C506103FFB82″
minOccurs=″1″maxOccurs=″1″/>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address/postcode″
localName=″postcode″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″46BFC031_7FA7_48ED_A73E_E82184BB67B5″
minOccurs=″1″maxOccurs=″1″/>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address/street″
localName=″street″
elementType=″simple″
type=″{type}{http://www.w3.org/2001/XMLSchema}string″
id=″AD2EEE92_A353_4127_AEC1_84B5851F1E98″
minOccurs=″1″maxOccurs=″1″/>
</XmlMappingType>
</XmlMappingTypes 〉; Global namespace be element}{http: //node of org.xmldb.address}address
<XmlMappingElements>
<XmlMappingElement?name=″{element}{http://org.xmldb.address}address″
localName=″address″
elementType=″complex″
type=″{element}{http://org.xmldb.address}address″
id=″0430D375_32FE_4072_B254_C71C664456B3″/>
</XmlMappingElements></XmlMapping>
At first, in this mapped file, search global namespace for element}{http: //the XmlMappingElement node of org.xmldb.address}address, the type property value that reads the XmlMappingElement node is: element}{http: //org.xmldb.address}address;
Secondly, find corresponding XmlMappingType node among the mapping according to the type property value, be the type of this address element, the id property value that reads the XmlMappingType node is: 35CE114E_D191_4534_A321_9BA88F9CB0BF, this property value are the database table name of storing X ML element address;
Then, the record of reading database table 35CE114E_D191_4534_A321_9BA88F9CB0BF is as follows:
?_ID ?_NAME ????_ORDER ?_PARENTID ?TEL ??POSTCODE ??STREET
?A0364D74_CB21_ ?40A9_8EB0_DD7 ?address ????6 ?39E02917_F0A5_ ?4B43_910B_867 ?1234567 ??100005 Academy of sciences
?CB9AAF4C_83B4 ?_4248_A7F0_D88 ?address ????12 ?11C39464_DA22_ ?48C8_80F8_DEA ?789898 ??100006 Peking University
XmlMappingType nodal information according to this mapped file, the address node comprises 3 child node tel, postcode, street as can be known, three fields in the difference correspondence database table, read the respective field value and use the child node of DOM resolver structure address, for example the result of article one record structure is in the table:
<ns1:tel>1234567</ns1:tel>
<ns1:postcode>100005</ns1:postcode>
<ns1:street〉academy of sciences</ns1:street 〉
And then structure address node element, the result of article one record structure is in the table:
<ns1:address>
<ns1:tel>1234567</ns1:tel>
<ns1:postcode>100005</ns1:postcode>
<ns1:street〉academy of sciences</ns1:street 〉
</ns1:address>
At last with eligible (if inquiry postcode is greater than 100007 address, two records in the table all meet search request) all address node elements that record generated put into the father node element<resultset of DOM resolver structure</resultset, and the dom tree sequence changed into character string, Query Result is returned as a big result set, and the result is as follows:<resultset xmlns:ns1=" http://org.xmldb.address " 〉
<ns1:address>
<ns1:tel>1234567</ns1:tel>
<ns1:postcode>100005</ns1:postcode>
<ns1:street〉academy of sciences</ns1:street 〉
</ns1:address>
<ns1:address>
<ns1:tel>789898</ns1:tel>
<ns1:postcode>100006</ns1:postcode>
<ns1:street〉Peking University</ns1:street 〉
</ns1:address></resultset>
The above only is the preferred implementation of file searching method for XML of the present invention; should be understood that; for those skilled in the art; under the prerequisite that does not break away from file searching method for XML principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as the protection domain of file searching method for XML of the present invention.

Claims (2)

1, a kind of file searching method for XML, be used for the extensible markup language document that is stored in relation database table is retrieved, storage system information in the relational database system table, deposit the extensible markup language document element in the relation database table, deposit the name space mapped file corresponding in the pattern list of relational database system table with it, it is characterized in that, comprise the steps:
1) global namespace by element to be retrieved is to obtain the name space of this element, and some is used to represent name space in the described global namespace;
2) by name space to obtain the mapped file of extensible markup language document;
3) find the type of element to be retrieved and daughter element thereof by mapped file, thereby obtain its corresponding all relation database tables;
4) by obtaining element to be retrieved in the relation database table.
2, file searching method for XML as claimed in claim 1 is characterized in that, described step 4) further is subdivided into following step again:
40) from relation database table, select all qualified records, and according to mapped file structure XML element node;
41) qualified a plurality of elements being accumulated a result set returns.
CN 200410102753 2004-12-27 2004-12-27 File searching method for XML Pending CN1632797A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200410102753 CN1632797A (en) 2004-12-27 2004-12-27 File searching method for XML

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200410102753 CN1632797A (en) 2004-12-27 2004-12-27 File searching method for XML

Publications (1)

Publication Number Publication Date
CN1632797A true CN1632797A (en) 2005-06-29

Family

ID=34848135

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200410102753 Pending CN1632797A (en) 2004-12-27 2004-12-27 File searching method for XML

Country Status (1)

Country Link
CN (1) CN1632797A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226534B (en) * 2007-12-29 2011-08-10 华为终端有限公司 Method, terminal and system for searching relevant document

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226534B (en) * 2007-12-29 2011-08-10 华为终端有限公司 Method, terminal and system for searching relevant document

Similar Documents

Publication Publication Date Title
CN1170240C (en) Structural file searching display method and device thereof
CN1155906C (en) data processing method, system, processing program and recording medium
CN1097795C (en) Document processing method and device and computer readable recording medium
CN1299177C (en) Data management device, computer system and storage medium of storage program
CN1293500C (en) Data processing system and method for archiving and accessing electronic messages
CN1126053C (en) Documents retrieval method and system
CN1866253A (en) Mapping web services to ontologies
CN1501285A (en) Layout system, layout program and layout method
CN1749999A (en) Durable storage of .NET data types and instances
CN1689022A (en) XML streaming transformer
CN1744036A (en) Systems and methods for supporting custom graphical representations in reporting software
CN1447261A (en) Specific factor, generation of alphabetic string and device and method of similarity calculation
CN1750003A (en) Information processing apparatus, information processing method, and program
CN1752963A (en) Document information processing apparatus, document information processing method, and document information processing program
CN1766886A (en) Data structure, database system, and method for data management and/or conversion
CN1949763A (en) Shared message server system
CN1551012A (en) Layout system, layout program, and layout method
CN1592905A (en) System and method for automatically generating database queries
CN101079026A (en) Text similarity, acceptation similarity calculating method and system and application system
CN101030138A (en) Application framework
CN1604082A (en) Mapping architecture for arbitrary data models
CN1530856A (en) Placement system, programm and method
CN1453687A (en) Communication apparatus and system, insert module control method and recording media
CN1809829A (en) Database device, database search device, and method thereof
CN1622095A (en) Method of storing extensible markup language file and inserting relational database sheet

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication