Home » Developer & Programmer » JDeveloper, Java & XML » how register schema xml in oracle 10g
how register schema xml in oracle 10g [message #162513] Fri, 10 March 2006 12:40 Go to next message
kurthein
Messages: 3
Registered: March 2006
Junior Member
how i cand register schema in bd, i want load a collections of documents xml in oracle and map to relational, first is register the schema, my schema is next:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ficha">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="antecedentesPersonales" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="identificador" use="required">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:maxInclusive value="10000"/>
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="antecedentesPersonales">
<xs:complexType mixed="true">
<xs:all>
<xs:element ref="nombrePrincipal" minOccurs="0"/>
<xs:element ref="nombreSecundario" minOccurs="0"/>
<xs:element ref="apellidoPaterno" minOccurs="0"/>
<xs:element ref="apellidoMaterno" minOccurs="0"/>
<xs:element ref="genero" minOccurs="0"/>
<xs:element ref="fechaNacimiento" minOccurs="0"/>
<xs:element ref="direccionPersonal" minOccurs="0"/>
<xs:element ref="ciudad" minOccurs="0"/>
<xs:element ref="region" minOccurs="0"/>
<xs:element ref="pais" minOccurs="0"/>
</xs:all>
<xs:attribute name="rut" use="required">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:maxInclusive value="20000000"/>
<xs:minInclusive value="10000000"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="nombrePrincipal">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="nombreSecundario">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="apellidoPaterno">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="apellidoMaterno">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="genero">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="fechaNacimiento">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="direccionPersonal">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="ciudad">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="region">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="pais">
<xs:complexType mixed="true"/>
</xs:element>
</xs:schema>

and a example the documemnt xml is
<?xml version="1.0" encoding="UTF-8"?>
<ficha identificador="2">
<antecedentesPersonales rut="10000001">
<nombrePrincipal>Juan</nombrePrincipal>
<nombreSecundario>Jose</nombreSecundario>
<apellidoPaterno>Perez</apellidoPaterno>
<apellidoMaterno>Soto</apellidoMaterno>
<genero>M</genero>
<fechaNacimiento>15-11-1979</fechaNacimiento>
<direccionPersonal>Los Alarces s/n</direccionPersonal>
<ciudad>Valdivia</ciudad>
<region>10</region>
<pais>Chile</pais>
</antecedentesPersonales>
</ficha>

i follow the manual and examples of oracle 10g, but not working.

i hope can help me.
thans.
Claudio.

Re: how register schema xml in oracle 10g [message #162598 is a reply to message #162513] Sat, 11 March 2006 16:04 Go to previous messageGo to next message
mchadder
Messages: 224
Registered: May 2005
Location: UK
Senior Member
I'm not entirely sure what you're asking, are you asking HOW to register an XSD in the database? If so, you need to use the
DBMS_XMLSCHEMA built in, i.e.
BEGIN
dbms_xmlschema.registerSchema(
      schemaurl => 'TEST.xsd',
      schemadoc => '<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Test">
<xs:complexType>
<xs:sequence>
<xs:element name="Test2"/>
<xs:element name="Test3"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>',
local => FALSE);
END;

If you're asking how to map your XML document to a relational
schema, then you need to give us more info regarding your table structures etc. There are many different ways of extracting the
data from the XML document and storing it in the database.

Post back with further details

Rgds
Re: how register schema xml in oracle 10g [message #162602 is a reply to message #162513] Sat, 11 March 2006 18:16 Go to previous message
kurthein
Messages: 3
Registered: March 2006
Junior Member
i tried to load a hundred documents xml to BD, but i want map a relational.

the collections of documents xml is (a example of one document):
<?xml version="1.0" encoding="UTF-8"?>
<ficha identificador="2">
<antecedentesPersonales rut="10000001">
<nombrePrincipal>Juan</nombrePrincipal>
<nombreSecundario>Jose</nombreSecundario>
<apellidoPaterno>Perez</apellidoPaterno>
<apellidoMaterno>Soto</apellidoMaterno>
<genero>M</genero>
<fechaNacimiento>15-11-1979</fechaNacimiento>
<direccionPersonal>Los Alarces s/n</direccionPersonal>
<ciudad>Valdivia</ciudad>
<region>10</region>
<pais>Chile</pais>
</antecedentesPersonales>
</ficha>

i create a schema to this collections of documents:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ficha" type="fichaType"/>
<xsd:complexType name="fichaType">
<xsd:sequence>
<xsd:element name="antecedentesPersonales" type="antecedentesPersonalesType"/>
</xsd:sequence>
<xsd:attribute name="identificador" type="xsd:integer"/>
</xsd:complexType>
<xsd:complexType name="antecedentesPersonalesType">
<xsd:sequence>
<xsd:element name="nombrePrincipal" type="xsd:string"/>
<xsd:element name="nombreSecundario" type="xsd:string"/>
<xsd:element name="apellidoPaterno" type="xsd:string"/>
<xsd:element name="apellidoMaterno" type="xsd:string"/>
<xsd:element name="genero" type="xsd:string"/>
<xsd:element name="fechaNacimiento" type="xsd:string"/>
<xsd:element name="direccionPersonal" type="xsd:string"/>
<xsd:element name="ciudad" type="xsd:string"/>
<xsd:element name="region" type="xsd:string"/>
<xsd:element name="pais" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="rut" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>

i upload the schema (ficha.xsd) to the BD via ftp to http://localhost:8080/home/OE/xsd

i need registering the schema and asociate the xml instance with the xml schema and how load a collections of dsocuments xml in the BD (map relational a tables).

i don&acute;t know what information additional need to doing that.

thanks
Previous Topic: JDeveloper not starting
Next Topic: Help me Please
Goto Forum:
  


Current Time: Fri Apr 19 06:49:52 CDT 2024