Comparing two XML Schemas
Hi All,
I want to compare two versions of the same XML Schema. I am working with Oracle 10g XML DB. I think we have something in 11g but I am constrainted to 10g.
Requirement:
1. I start afresh and register the XML Schema and also insert XML documents compliant to that schema in my XMLTYPE table.
2. Now after some time, I need to add a new element. So, I modify the XML Schema and write the XSLT for its addition to XML documents and do a CopyEvolve(). Let us assume, I have a script for this.
3. Now if accidentally, I rerun the script, I may run into errors as the element is already there.
So, I thought I should find the differences between the new version of the schema and the old version and if there are differences apply the XSLT and also evolve the schema. How do we do this?
Also, Can we generate the XSLT automatically based on the two versions of XML Schema?
Thanks
Ramesh
XML Schemas are just XML documents.
Compare the XML Schemas using the XDK's XMLDiff class and generate the XSLT from the differences.
http://www.devx.com/Java/Article/30943
Similar Messages
-
How to compare two xml schemas
Hello guys,
How to compare two xml schemas? is there any tool for that?
Thanksinadvance
kavita//XML Files may be compared with the oracle.xml.differ.XMLDiff class.
A file consisting of the differences in the xml files gets generated. An XSLT to convert one file to the other also gets generated. -
Compare two XML files: Analysis and Design
Hi, Java/XML/JDOM experts,
I realised that an open source of Java utility to compare two XML is still missing. So I would like to write one for my JDOM excises.
I plan to do it in three steps:
1.Define the problem domain.
2.Design the classes to be developed.
3.Coding
Below is the problem domain. Would you review it and tell me if it is fine?
Best regards,
AG
Compare two XML files
Schema assumption:
The xml files used for the comparison must have the same schema.
Definition:
1. Two elements of simple type are said equal if their name and value are identical.
2. Two elements of complex type are said comparable if their name, attributes are identical.
3. Two elements of complex type are said equal if they are comparable and their children elements are identical.Hi,
Thanks for reviewing my idea.
The xml files used for the comparison must have the
same schema.Including not having a schema at all? And if they do
have a schema, must they be valid according to the
schema?I will only support schema based xml files. To include a schema is a good practice. So I will valid them agaisnt schema (is this possible with JDOM? I am testing ...)
>
2. Two elements of complex type are said comparableif
their name, attributes are identical.
3. Two elements of complex type are said equal ifthey
are comparable and their children elements are
identical.Do you plan to require child elements to appear in the
same order for the two documents to be equal? (Note
that XML specifically says that the order of
attributes is not significant.)No. The order is not significant as I use the attributes as the keys to find comparable element counterpart.
Here is the sample code already tested. Any comments are welcome!
The next step is to define the "delta xml schema" that will guide me to store the comparasion results. Do you have any suggestions?
Regards.
AG
public static boolean comparable(Element element1, Element element2)
boolean returnValue=false;
if (element1.getName()!=element2.getName()) {
return returnValue;
} else {
returnValue=true;
System.out.println ("place 2");
List attributeList=element1.getAttributes();
Iterator attributeIterator=attributeList.iterator();
Attribute workingAttribute=null;
while (attributeIterator.hasNext()) {
if (!workingAttribute.getValue().equals(
element2.getAttribute(workingAttribute.getName(), workingAttribute.getNamespace()).getValue()))
returnValue=false;
break;
return returnValue; -
Hi All,
I am comparing two XML nodes having same nodes using DOM parser.
<?xml version="1.0"?>
<compare value="xml1"/>
< test name="java">
<compare value="xml">
<node>012</node>
</compare>
</test>
< test name="java1">
<compare value="xml2">
<node>013</node>
</compare>
<compare value="xml3">
<node>014</node>
</compare>
</test>I need to take <compare> and <node> present inside <test> tag.
I am not getting the results properly if i am using the following code
NodeList bList1 = doc.getElementsByTagName("compare");
for (int temp1 = 0; temp1 < bList.getLength(); temp1++) {
Node nNode = bList.item(temp1);
NamedNodeMap attributes = (NamedNodeMap)nNode.getAttributes();
for (int g = 0; g < attributes.getLength(); g++) {
Attr attribute = (Attr)attributes.item(g);
System.out.println(" Attribute: " + attribute.getName() +
" with value " +attribute.getValue());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
NodeList nlList= eElement.getElementsByTagName("node").item(0).getChildNodes();
Node nValue = (Node) nlList.item(0);
String node = nValue.getNodeValue();
}is there any possibility to get the <compare> and <node> tag present inside <test> tag...2nd xml
<?xml version="1.0"?>
<compare value="xml1"/>
< test name="java">
<compare value="xml">
<node>012</node>
</compare>
</test>
< test name="java1">
<compare value="xml2">
<node>015</node>
</compare>
<compare value="xml3">
<node>016</node>
</compare>
</test>
Map m1= new HashMap();
NodeList bList1 = doc.getElementsByTagName("compare");
for (int temp1 = 0; temp1 < bList1.getLength(); temp1++) {
Node nNode = bList1.item(temp1);
NamedNodeMap attributes = (NamedNodeMap)nNode.getAttributes();
for (int g = 0; g < attributes.getLength(); g++) {
Attr attribute = (Attr)attributes.item(g);
m1.put (attribute.getName(),attribute.getValue());
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
NodeList nlList= eElement.getElementsByTagName("node").item(0).getChildNodes();
Node nValue = (Node) nlList.item(0);
String node = nValue.getNodeValue();
m1.put ("node");
Map m2= new HashMap();
NodeList bList2 = doc1.getElementsByTagName("compare");
for (int temp1 = 0; temp1 < bList2.getLength(); temp1++) {
Node nNode1 = bLis2.item(temp1);
NamedNodeMap attributes = (NamedNodeMap)nNode1.getAttributes();
for (int g = 0; g < attributes.getLength(); g++) {
Attr attribute = (Attr)attributes.item(g);
m1.put (attribute.getName(),attribute.getValue());
if (nNode1.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode1;
NodeList nlList= eElement.getElementsByTagName("node").item(0).getChildNodes();
Node nValue = (Node) nlList.item(0);
String node = nValue.getNodeValue();
m2.put ("node");
List<Map.Entry<String, String>> results =
new ArrayList<Map.Entry<String, String>>();
Set<Map.Entry<String, String>> s1 = m1.entrySet();
Set<Map.Entry<String, String>> s2 = m2.entrySet();
results =
new ArrayList<Map.Entry<String, String>>();
for (Map.Entry<String, String> entry : s1) {
if (!s2.contains(entry)) results.add(entry);
for (Map.Entry<String, String> entry : s2) {
if (!s1.contains(entry)) results.add(entry);
System.out.println(results);Like this I am comparing :
I need to get the attribute value of <compare> and body value for
<node> tag and need to compare the values in both XML. -
Hi developers..........
I have a problem in compare two xml files.My project description is I take two xml(file1,file2) files.Compare file1 with file2. Now I want what are the same words in to the file2.
file1:
<hello>
<html>
<jsp:plugin>
file2:
<hello>
<jsp:usebean>
<html>
result:
<hello>
any give the code for this logic.....hi...can u pls send me the code which compares two
xml files and gives the output as difference between
two fileshttp://www.bmsi.com/java/#diff -
How can i compare two XML files storeds in a LONG column
Hi,
I need to compare two xml files. My xmls are stored in two table like this:
Table 1
ID_COL number(5);
XML1 LONG()
Table 2
ID_COL number(5);
XML2 LONG()
I need compare the values of the tags of this xmls files e to list de differences.
Tks,
Fernando.yes odie you are right...i think that my xml is wrong...
I would like to compare every element/attribute...
Bellow is another xml...this is ok....tks
<?xml version="1.0" encoding="UTF-8" ?>
- <nfeProc xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">
- <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
- <infNFe Id="NFe31121059106377000172550010003957681605366269" versao="2.00">
+ <ide>
<cUF>31</cUF>
<cNF>60536626</cNF>
<natOp>VDAS PROD ESTABELECIMENT</natOp>
<indPag>1</indPag>
<mod>55</mod>
<serie>1</serie>
<nNF>395768</nNF>
<dEmi>2012-10-03</dEmi>
<dSaiEnt>2012-10-03</dSaiEnt>
<hSaiEnt>18:30:00</hSaiEnt>
<tpNF>1</tpNF>
<cMunFG>3159605</cMunFG>
<tpImp>1</tpImp>
<tpEmis>1</tpEmis>
<cDV>9</cDV>
<tpAmb>1</tpAmb>
<finNFe>1</finNFe>
<procEmi>0</procEmi>
<verProc>1.0</verProc>
</ide>
+ <emit>
<CNPJ>59106377000172</CNPJ>
<xNome>METAGAL IND E COM LTDA</xNome>
<xFant>METAGAL INDUSTRIA E COMERCIO LTDA</xFant>
- <enderEmit>
<xLgr>ROD BR 459</xLgr>
<nro>333</nro>
<xCpl>KM 121</xCpl>
<xBairro>DISTRITO INDUSTRIAL</xBairro>
<cMun>3159605</cMun>
<xMun>SANTA RITA DO SAPUCAI</xMun>
<UF>MG</UF>
<CEP>37540000</CEP>
<cPais>1058</cPais>
<xPais>BRASIL</xPais>
<fone>3534719100</fone>
</enderEmit>
<IE>5969141300009</IE>
<IM>01183</IM>
<CNAE>2949299</CNAE>
<CRT>3</CRT>
</emit>
+ <dest>
<CNPJ>59275792000150</CNPJ>
<xNome>GENERAL MOTORS DO BRASIL LTDA</xNome>
- <enderDest>
<xLgr>AV GOIAS</xLgr>
<nro>1805</nro>
<xBairro>BARCELONA</xBairro>
<cMun>3548807</cMun>
<xMun>SAO CAETANO DO SUL</xMun>
<UF>SP</UF>
<CEP>09501970</CEP>
<cPais>1058</cPais>
<xPais>BRASIL</xPais>
</enderDest>
<IE>636003724112</IE>
<email>[email protected]</email>
</dest>
- <det nItem="1">
+ <prod>
<cProd>XM20C9500PPR</cProd>
<cEAN />
<xProd>ESPELHO RETROVISOR EXTERNO</xProd>
<NCM>70091000</NCM>
<CFOP>6501</CFOP>
<uCom>PC</uCom>
<qCom>80.0000</qCom>
<vUnCom>35.8700000000</vUnCom>
<vProd>2869.60</vProd>
<cEANTrib />
<uTrib>PC</uTrib>
<qTrib>80.0000</qTrib>
<vUnTrib>35.8700000000</vUnTrib>
<indTot>1</indTot>
<xPed>XRW001RV</xPed>
<nItemPed>000001</nItemPed>
</prod>
- <imposto>
- <ICMS>
- <ICMS00>
<orig>0</orig>
<CST>00</CST>
<modBC>3</modBC>
<vBC>2869.60</vBC>
<pICMS>12.00</pICMS>
<vICMS>344.35</vICMS>
</ICMS00>
</ICMS>
- <IPI>
<CNPJProd>00000000000000</CNPJProd>
<cEnq>0</cEnq>
- <IPINT>
<CST>54</CST>
</IPINT>
</IPI>
- <II>
<vBC>0.00</vBC>
<vDespAdu>0.00</vDespAdu>
<vII>0.00</vII>
<vIOF>0.00</vIOF>
</II>
- <PIS>
- <PISNT>
<CST>08</CST>
</PISNT>
</PIS>
- <COFINS>
- <COFINSNT>
<CST>08</CST>
</COFINSNT>
</COFINS>
</imposto>
<infAdProd>PC.93378954-COMPL.PED.XRW001RV</infAdProd>
</det>
+ <total>
- <ICMSTot>
<vBC>2869.60</vBC>
<vICMS>344.35</vICMS>
<vBCST>0.00</vBCST>
<vST>0.00</vST>
<vProd>2869.60</vProd>
<vFrete>0.00</vFrete>
<vSeg>0.00</vSeg>
<vDesc>0.00</vDesc>
<vII>0.00</vII>
<vIPI>0.00</vIPI>
<vPIS>0.00</vPIS>
<vCOFINS>0.00</vCOFINS>
<vOutro>0.00</vOutro>
<vNF>2869.60</vNF>
</ICMSTot>
<retTrib />
</total>
+ <transp>
<modFrete>0</modFrete>
- <transporta>
<CNPJ>00980331000488</CNPJ>
<xNome>THALE TRANSPORTES E LOG. LTDA</xNome>
<IE>5963866160070</IE>
<xEnder>ROD BR 459-KM 121 - DIST INDL, S/N</xEnder>
<xMun>SANTA RITA DO SAPUCAI</xMun>
<UF>MG</UF>
</transporta>
- <veicTransp>
<placa>DPF8048</placa>
<UF>SP</UF>
</veicTransp>
- <vol>
<qVol>20</qVol>
<esp>OUTROS</esp>
<pesoL>64.000</pesoL>
<pesoB>104.000</pesoB>
</vol>
</transp>
+ <cobr>
- <fat>
<nFat>000000395768</nFat>
<vOrig>2869.60</vOrig>
</fat>
- <dup>
<nDup>1</nDup>
<dVenc>2012-11-20</dVenc>
<vDup>2869.60</vDup>
</dup>
</cobr>
- <infAdic>
<infCpl>VIA DE TRANSPORTE RODOVIARIA CODIGO : 108061 PEDIDO NRO : ACIMA FABRICA :72480 REDESPACHO ATRAVES DE VELOCE LOGISTICA S/A ESTRADA DOS ALVARENGAS SAO BERNARDO CAMPO ASSUNCAO SP CNPJ : 10.299.567/0003-26 IE : 635.600.028.11 IPI - IMUNE CFE.ART.18, INCISO II, DO RIPI - DECRETO No.7.212/2010. REMESSA COM FIM ESPECIFICO DE EXPORTACAOMERC.A SER EXPORT.P/GENERAL MOTORS DO BRASIL LTDA.DECEX=3-0322/10-0007 ESTOCA-GEM TEMPORARIA NA VELOCE LOGISTICA S.A. ESTR.ALVARENGAS,4018 B.ASSUNCAO S.B.C. CNPJ10.299.567/0003-26IE.635.600.028.110 FT NR.431.183 ROMANEIO :131.588</infCpl>
</infAdic>
</infNFe>
+ <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
- <SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
- <Reference URI="#NFe31121059106377000172550010003957681605366269">
- <Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>jN2ozPH3/GvAS8Q5lh/t9bzuXCw=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>GAXPLvMCtIYdwMxXDcyL0kr5hCDPCFw8/uNYHFcdTMqBhLgIcEtzHRf8qioWlUVSHNf5jnCLKGjhDV4bEJqkcBhWsKouMzojQ+Z6hkFQAWNuJfPIzutmtRy3AePc5tHK0lI3tF3ws9memboJ8sW21IOWHB6eB0jK2gmhcOlDejc=</SignatureValue>
- <KeyInfo>
- <X509Data>
<X509Certificate>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</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</NFe>
- <protNFe versao="2.00">
- <infProt>
<tpAmb>1</tpAmb>
<verAplic>13_0_32</verAplic>
<chNFe>31121059106377000172550010003957681605366269</chNFe>
<dhRecbto>2012-10-03T17:35:55</dhRecbto>
<nProt>131120853536488</nProt>
<digVal>jN2ozPH3/GvAS8Q5lh/t9bzuXCw=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da NF-e</xMotivo>
</infProt>
</protNFe>
</nfeProc> -
hi all,
i am using Forms [32 Bit] Version 6.0.8.24.1 (Production)
can any body tell me, how two xml files can be compared.
for example
i have file 1(standard)
<Message-Header>
<Message-Id>1234</Message-Id>
<Sender-Company-ID>4569</Sender-Company-ID>
<Sender-Company-Name>abc company</Sender-Company-Name>
<Sender-User-ID>AA</Sender-User-ID>
<Recv-Company-ID>050</Recv-Company-ID>
<Recv-Company-Name>XYZ pvt.ltd</Recv-Company-Name>
<Creation-Time>20101019 15:59:39</Creation-Time>
<cons>
<con>
<con_number>xsu667</con_number>
</con>
</cons>
</Message-Header>
i have file 2(came from user)
<Message-Header>
<Message-Id>1234</Message-Id>
<Sender-Company-ID>4569</Sender-Company-ID>
<Sender-Company-Name>abc company</Sender-Company-Name>
<Sender-User-ID>AA</Sender-User-ID>
<Recv-Company-ID>050</Recv-Company-ID>
<Recv-Company-Name>XYZ pvt.ltd</Recv-Company-Name>
<Creation-Time>20101019 15:59:39</Creation-Time>
<cons>
<con>
<con_number>xsu667</con_number>
</con>
<con>
<con_number>xsu669</con_number>
</con>
</cons>
</Message-Header>how to map two files. do we have to compare line by line?
the file2 have to match with respect to structure and also data.
any suggestions are welcome.
Edited by: user13329002 on Oct 24, 2010 5:48 AMuser13329002 wrote:
hi,
i am not aware of these things(merge file).
can u tell me,what is the ultimate result of this merging.
and can u tell the stepts to acheive this..
Thanks..a) write files down to temporary directory by using text_io
b) call an external program you installed on the client like winmerge, windiff or about 100000 other programs out ther that can show you the differences of two files
this programs you pass the two files you wrote to disk at step a -
Comparing two xml files in pl/sql
What is the best way to compare two 'complex' xml structures and return the difference using a plsql procedure/function. Example:
FUNCTION f_equals(XMLTYPE actualxml, XMLTYPE expectedxml) RETURN VARCHAR2
this should return 'EQUAL' if they are equal and the actual node with value if different..
Can somebody throw some ideas please?The solution would depend on what you are trying to achieve, is it node to node comparison? overall file comparison? If there is any difference in either of the aforementioned approach, do what with the result?
-
How to compare two oracle database schemas
hi all,
i want to compare and find out differences between two oracle databases. The comparison should be made on between table definition,table data,primary and foreign keys, packages and functions.
Is there any management console or tool embedded in the oracle enterprise manger?
it is really appreciate if anyone can point me towards wright direction asap.Hi ,
This script would help u a lot in comparing 2 schemas and generate a report on them.
Script:
This script will compare two Oracle schemas and generate a report of
discrepencies and this script has been used against Oracle 7.3.4, 8.0.5,
REM and 8.1.7 databases, but it should also work with other versions.
REM
REM Please note that the following schema object types and attributes are
REM not compared by this script at this time:
REM
REM cluster definitions
REM comments on tables and columns
REM nesting, partition, IOT, and temporary attributes of tables
REM snapshots/materialized views, logs, and refresh groups
REM foreign function libraries
REM object types
REM operators
REM indextypes
REM dimensions
REM auditing information
REM new schema attributes added for Oracle 9i
REM
REM Version 02-04-2002
REM
PROMPT
PROMPT Schema Comparison
PROMPT =================
PROMPT
PROMPT Run this script while connected to one Oracle schema. Enter the Oracle
PROMPT username, password, and SQL*Net / Net8 service name of a second schema.
PROMPT This script will compare the two schemas and generate a report of
PROMPT differences.
PROMPT
PROMPT A temporary database link and table will be created and dropped by
PROMPT this script.
PROMPT
ACCEPT schema CHAR PROMPT "Enter username for remote schema: "
ACCEPT passwd CHAR PROMPT "Enter password for remote schema: " HIDE
ACCEPT tnssvc CHAR PROMPT "Enter SQL*Net / Net8 service for remote schema: "
PROMPT
ACCEPT report CHAR PROMPT "Enter filename for report output: "
SET FEEDBACK OFF
SET VERIFY OFF
CREATE DATABASE LINK rem_schema CONNECT TO &schema IDENTIFIED BY &passwd
USING '&tnssvc';
SET TRIMSPOOL ON
SPOOL &report
SELECT SUBSTR (RPAD (TO_CHAR (SYSDATE, 'mm/dd/yyyy hh24:mi:ss'), 25), 1, 25)
"REPORT DATE AND TIME"
FROM SYS.dual;
COL local_schema FORMAT a35 TRUNC HEADING "LOCAL SCHEMA"
COL remote_schema FORMAT a35 TRUNC HEADING "REMOTE SCHEMA"
SELECT USER || '@' || C.global_name local_schema,
A.username || '@' || B.global_name remote_schema
FROM user_users@rem_schema A, global_name@rem_schema B, global_name C
WHERE ROWNUM = 1;
SET PAGESIZE 9999
SET LINESIZE 250
SET FEEDBACK 1
SET TERMOUT OFF
PROMPT
REM Object differences
REM ==================
COL object_name FORMAT a30
PROMPT SUMMARY OF OBJECTS MISSING FROM LOCAL SCHEMA
SELECT object_type, COUNT (*)
FROM
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name)
FROM user_objects@rem_schema
MINUS
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name)
FROM user_objects
GROUP BY object_type
ORDER BY object_type;
PROMPT SUMMARY OF EXTRANEOUS OBJECTS IN LOCAL SCHEMA
SELECT object_type, COUNT (*)
FROM
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name)
FROM user_objects
WHERE object_type != 'DATABASE LINK'
OR object_name NOT LIKE 'REM_SCHEMA.%'
MINUS
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name)
FROM user_objects@rem_schema
GROUP BY object_type
ORDER BY object_type;
PROMPT OBJECTS MISSING FROM LOCAL SCHEMA
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name) object_name
FROM user_objects@rem_schema
MINUS
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name) object_name
FROM user_objects
ORDER BY object_type, object_name;
PROMPT EXTRANEOUS OBJECTS IN LOCAL SCHEMA
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name) object_name
FROM user_objects
WHERE object_type != 'DATABASE LINK'
OR object_name NOT LIKE 'REM_SCHEMA.%'
MINUS
SELECT object_type,
DECODE (object_type,
'INDEX', DECODE (SUBSTR (object_name, 1, 5),
'SYS_C', 'SYS_C', object_name),
'LOB', DECODE (SUBSTR (object_name, 1, 7),
'SYS_LOB', 'SYS_LOB', object_name),
object_name) object_name
FROM user_objects@rem_schema
ORDER BY object_type, object_name;
PROMPT OBJECTS IN LOCAL SCHEMA THAT ARE NOT VALID
SELECT object_name, object_type, status
FROM user_objects
WHERE status != 'VALID'
ORDER BY object_name, object_type;
REM Table differences
REM =================
PROMPT TABLE COLUMNS MISSING FROM ONE SCHEMA
PROMPT (NOTE THAT THIS REPORT DOES NOT LIST DISCREPENCIES IN COLUMN ORDER)
SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
FROM user_tab_columns@rem_schema
WHERE table_name IN
SELECT table_name
FROM user_tables
MINUS
SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
FROM user_tab_columns
UNION ALL
SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
FROM user_tab_columns
WHERE table_name IN
SELECT table_name
FROM user_tables@rem_schema
MINUS
SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
FROM user_tab_columns@rem_schema
ORDER BY 1, 2;
COL schema FORMAT a15
COL nullable FORMAT a8
COL data_type FORMAT a9
COL data_length FORMAT 9999 HEADING LENGTH
COL data_precision FORMAT 9999 HEADING PRECISION
COL data_scale FORMAT 9999 HEADING SCALE
COL default_length FORMAT 9999 HEADING LENGTH_OF_DEFAULT_VALUE
PROMPT DATATYPE DISCREPENCIES FOR TABLE COLUMNS THAT EXIST IN BOTH SCHEMAS
SELECT table_name, column_name, 'Remote' schema,
nullable, data_type, data_length, data_precision, data_scale,
default_length
FROM user_tab_columns@rem_schema
WHERE (table_name, column_name) IN
SELECT table_name, column_name
FROM user_tab_columns
MINUS
SELECT table_name, column_name, 'Remote' schema,
nullable, data_type, data_length, data_precision, data_scale,
default_length
FROM user_tab_columns
UNION ALL
SELECT table_name, column_name, 'Local' schema,
nullable, data_type, data_length, data_precision, data_scale,
default_length
FROM user_tab_columns
WHERE (table_name, column_name) IN
SELECT table_name, column_name
FROM user_tab_columns@rem_schema
MINUS
SELECT table_name, column_name, 'Local' schema,
nullable, data_type, data_length, data_precision, data_scale,
default_length
FROM user_tab_columns@rem_schema
ORDER BY 1, 2, 3;
REM Index differences
REM =================
COL column_position FORMAT 999 HEADING ORDER
PROMPT INDEX DISCREPENCIES FOR INDEXES THAT EXIST IN BOTH SCHEMAS
SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
B.column_name, B.column_position
FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
WHERE A.index_name IN
SELECT index_name
FROM user_indexes
AND B.index_name = A.index_name
AND B.table_name = A.table_name
MINUS
SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
B.column_name, B.column_position
FROM user_indexes A, user_ind_columns B
WHERE B.index_name = A.index_name
AND B.table_name = A.table_name
UNION ALL
SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
B.column_name, B.column_position
FROM user_indexes A, user_ind_columns B
WHERE A.index_name IN
SELECT index_name
FROM user_indexes@rem_schema
AND B.index_name = A.index_name
AND B.table_name = A.table_name
MINUS
SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
B.column_name, B.column_position
FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
WHERE B.index_name = A.index_name
AND B.table_name = A.table_name
ORDER BY 1, 2, 6;
REM Constraint differences
REM ======================
PROMPT CONSTRAINT DISCREPENCIES FOR TABLES THAT EXIST IN BOTH SCHEMAS
SET FEEDBACK OFF
CREATE TABLE temp_schema_compare
database NUMBER(1),
object_name VARCHAR2(30),
object_text VARCHAR2(2000),
hash_value NUMBER
DECLARE
CURSOR c1 IS
SELECT constraint_name, search_condition
FROM user_constraints
WHERE search_condition IS NOT NULL;
CURSOR c2 IS
SELECT constraint_name, search_condition
FROM user_constraints@rem_schema
WHERE search_condition IS NOT NULL;
v_constraint_name VARCHAR2(30);
v_search_condition VARCHAR2(32767);
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_constraint_name, v_search_condition;
EXIT WHEN c1%NOTFOUND;
v_search_condition := SUBSTR (v_search_condition, 1, 2000);
INSERT INTO temp_schema_compare
database, object_name, object_text
VALUES
1, v_constraint_name, v_search_condition
END LOOP;
CLOSE c1;
OPEN c2;
LOOP
FETCH c2 INTO v_constraint_name, v_search_condition;
EXIT WHEN c2%NOTFOUND;
v_search_condition := SUBSTR (v_search_condition, 1, 2000);
INSERT INTO temp_schema_compare
database, object_name, object_text
VALUES
2, v_constraint_name, v_search_condition
END LOOP;
CLOSE c2;
COMMIT;
END;
SET FEEDBACK 1
SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
'9', NULL) constraint_name,
'Remote' schema, A.constraint_type, A.table_name,
A.r_constraint_name, A.delete_rule, A.status, B.object_text
FROM user_constraints@rem_schema A, temp_schema_compare B
WHERE A.table_name IN
SELECT table_name
FROM user_tables
AND B.database (+) = 2
AND B.object_name (+) = A.constraint_name
MINUS
SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
'9', NULL) constraint_name,
'Remote' schema, A.constraint_type, A.table_name,
A.r_constraint_name, A.delete_rule, A.status, B.object_text
FROM user_constraints A, temp_schema_compare B
WHERE B.database (+) = 1
AND B.object_name (+) = A.constraint_name
UNION ALL
SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
'9', NULL) constraint_name,
'Local' schema, A.constraint_type, A.table_name,
A.r_constraint_name, A.delete_rule, A.status, B.object_text
FROM user_constraints A, temp_schema_compare B
WHERE A.table_name IN
SELECT table_name
FROM user_tables@rem_schema
AND B.database (+) = 1
AND B.object_name (+) = A.constraint_name
MINUS
SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
'9', NULL) constraint_name,
'Local' schema, A.constraint_type, A.table_name,
A.r_constraint_name, A.delete_rule, A.status, B.object_text
FROM user_constraints@rem_schema A, temp_schema_compare B
WHERE B.database (+) = 2
AND B.object_name (+) = A.constraint_name
ORDER BY 1, 4, 2;
REM Database link differences
REM =========================
PROMPT DATABASE LINK DISCREPENCIES
COL db_link FORMAT a40
SELECT db_link, 'Remote' schema, username, host
FROM user_db_links@rem_schema
MINUS
SELECT db_link, 'Remote' schema, username, host
FROM user_db_links
UNION ALL
SELECT db_link, 'Local' schema, username, host
FROM user_db_links
WHERE db_link NOT LIKE 'REM_SCHEMA.%'
MINUS
SELECT db_link, 'Local' schema, username, host
FROM user_db_links@rem_schema
ORDER BY 1, 2;
REM Sequence differences
REM ====================
PROMPT SEQUENCE DISCREPENCIES
SELECT sequence_name, 'Remote' schema, min_value, max_value,
increment_by, cycle_flag, order_flag, cache_size
FROM user_sequences@rem_schema
MINUS
SELECT sequence_name, 'Remote' schema, min_value, max_value,
increment_by, cycle_flag, order_flag, cache_size
FROM user_sequences
UNION ALL
SELECT sequence_name, 'Local' schema, min_value, max_value,
increment_by, cycle_flag, order_flag, cache_size
FROM user_sequences
MINUS
SELECT sequence_name, 'Local' schema, min_value, max_value,
increment_by, cycle_flag, order_flag, cache_size
FROM user_sequences@rem_schema
ORDER BY 1, 2;
REM Private synonym differences
REM ===========================
PROMPT PRIVATE SYNONYM DISCREPENCIES
SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
FROM user_synonyms@rem_schema
MINUS
SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
FROM user_synonyms
UNION ALL
SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
FROM user_synonyms
MINUS
SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
FROM user_synonyms@rem_schema
ORDER BY 1, 2;
REM PL/SQL differences
REM ==================
PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
PROMPT THAT EXIST IN BOTH SCHEMAS
SELECT name, type, COUNT (*) discrepencies
FROM
SELECT name, type, line, text
FROM user_source@rem_schema
WHERE (name, type) IN
SELECT object_name, object_type
FROM user_objects
MINUS
SELECT name, type, line, text
FROM user_source
UNION ALL
SELECT name, type, line, text
FROM user_source
WHERE (name, type) IN
SELECT object_name, object_type
FROM user_objects@rem_schema
MINUS
SELECT name, type, line, text
FROM user_source@rem_schema
GROUP BY name, type
ORDER BY name, type;
PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
PROMPT THAT EXIST IN BOTH SCHEMAS (CASE INSENSITIVE COMPARISON)
SELECT name, type, COUNT (*) discrepencies
FROM
SELECT name, type, line, UPPER (text)
FROM user_source@rem_schema
WHERE (name, type) IN
SELECT object_name, object_type
FROM user_objects
MINUS
SELECT name, type, line, UPPER (text)
FROM user_source
UNION ALL
SELECT name, type, line, UPPER (text)
FROM user_source
WHERE (name, type) IN
SELECT object_name, object_type
FROM user_objects@rem_schema
MINUS
SELECT name, type, line, UPPER (text)
FROM user_source@rem_schema
GROUP BY name, type
ORDER BY name, type;
REM Trigger differences
REM ===================
PROMPT TRIGGER DISCREPENCIES
SET FEEDBACK OFF
TRUNCATE TABLE temp_schema_compare;
DECLARE
CURSOR c1 IS
SELECT trigger_name, trigger_body
FROM user_triggers;
CURSOR c2 IS
SELECT trigger_name, trigger_body
FROM user_triggers@rem_schema;
v_trigger_name VARCHAR2(30);
v_trigger_body VARCHAR2(32767);
v_hash_value NUMBER;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_trigger_name, v_trigger_body;
EXIT WHEN c1%NOTFOUND;
v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
v_trigger_body := UPPER (v_trigger_body);
v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
INSERT INTO temp_schema_compare (database, object_name, hash_value)
VALUES (1, v_trigger_name, v_hash_value);
END LOOP;
CLOSE c1;
OPEN c2;
LOOP
FETCH c2 INTO v_trigger_name, v_trigger_body;
EXIT WHEN c2%NOTFOUND;
v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
v_trigger_body := UPPER (v_trigger_body);
v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
INSERT INTO temp_schema_compare (database, object_name, hash_value)
VALUES (2, v_trigger_name, v_hash_value);
END LOOP;
CLOSE c2;
END;
SET FEEDBACK 1
SELECT A.trigger_name, 'Local' schema, A.trigger_type,
A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
A.status, B.hash_value
FROM user_triggers A, temp_schema_compare B
WHERE B.object_name (+) = A.trigger_name
AND B.database (+) = 1
AND A.table_name IN
SELECT table_name
FROM user_tables@rem_schema
MINUS
SELECT A.trigger_name, 'Local' schema, A.trigger_type,
A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
A.status, B.hash_value
FROM user_triggers@rem_schema A, temp_schema_compare B
WHERE B.object_name (+) = A.trigger_name
AND B.database (+) = 2
UNION ALL
SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
A.status, B.hash_value
FROM user_triggers@rem_schema A, temp_schema_compare B
WHERE B.object_name (+) = A.trigger_name
AND B.database (+) = 2
AND A.table_name IN
SELECT table_name
FROM user_tables
MINUS
SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
A.status, B.hash_value
FROM user_triggers A, temp_schema_compare B
WHERE B.object_name (+) = A.trigger_name
AND B.database (+) = 1
ORDER BY 1, 2, 5, 3;
REM View differences
REM ================
PROMPT VIEW DISCREPENCIES
SET FEEDBACK OFF
TRUNCATE TABLE temp_schema_compare;
DECLARE
CURSOR c1 IS
SELECT view_name, text
FROM user_views;
CURSOR c2 IS
SELECT view_name, text
FROM user_views@rem_schema;
v_view_name VARCHAR2(30);
v_text VARCHAR2(32767);
v_hash_value NUMBER;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_view_name, v_text;
EXIT WHEN c1%NOTFOUND;
v_text := REPLACE (v_text, ' ', NULL);
v_text := REPLACE (v_text, CHR(9), NULL);
v_text := REPLACE (v_text, CHR(10), NULL);
v_text := REPLACE (v_text, CHR(13), NULL);
v_text := UPPER (v_text);
v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
INSERT INTO temp_schema_compare (database, object_name, hash_value)
VALUES (1, v_view_name, v_hash_value);
END LOOP;
CLOSE c1;
OPEN c2;
LOOP
FETCH c2 INTO v_view_name, v_text;
EXIT WHEN c2%NOTFOUND;
v_text := REPLACE (v_text, ' ', NULL);
v_text := REPLACE (v_text, CHR(9), NULL);
v_text := REPLACE (v_text, CHR(10), NULL);
v_text := REPLACE (v_text, CHR(13), NULL);
v_text := UPPER (v_text);
v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
INSERT INTO temp_schema_compare (database, object_name, hash_value)
VALUES (2, v_view_name, v_hash_value);
END LOOP;
CLOSE c2;
END;
SET FEEDBACK 1
SELECT A.view_name, 'Local' schema, B.hash_value
FROM user_views A, temp_schema_compare B
WHERE B.object_name (+) = A.view_name
AND B.database (+) = 1
AND A.view_name IN
SELECT view_name
FROM user_views@rem_schema
MINUS
SELECT A.view_name, 'Local' schema, B.hash_value
FROM user_views@rem_schema A, temp_schema_compare B
WHERE B.object_name (+) = A.view_name
AND B.database (+) = 2
UNION ALL
SELECT A.view_name, 'Remote' schema, B.hash_value
FROM user_views@rem_schema A, temp_schema_compare B
WHERE B.object_name (+) = A.view_name
AND B.database (+) = 2
AND A.view_name IN
SELECT view_name
FROM user_views
MINUS
SELECT A.view_name, 'Remote' schema, B.hash_value
FROM user_views A, temp_schema_compare B
WHERE B.object_name (+) = A.view_name
AND B.database (+) = 1
ORDER BY 1, 2;
REM Job queue differences
REM =====================
COL what FORMAT a30
COL interval FORMAT a30
PROMPT JOB QUEUE DISCREPENCIES
SELECT what, interval, 'Remote' schema
FROM user_jobs@rem_schema
MINUS
SELECT what, interval, 'Remote' schema
FROM user_jobs
UNION ALL
SELECT what, interval, 'Local' schema
FROM user_jobs
MINUS
SELECT what, interval, 'Local' schema
FROM user_jobs@rem_schema
ORDER BY 1, 2, 3;
REM Privilege differences
REM =====================
PROMPT OBJECT-LEVEL GRANT DISCREPENCIES
SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
FROM user_tab_privs@rem_schema
WHERE (owner, table_name) IN
SELECT owner, object_name
FROM all_objects
MINUS
SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
FROM user_tab_privs
UNION ALL
SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
FROM user_tab_privs
WHERE (owner, table_name) IN
SELECT owner, object_name
FROM all_objects@rem_schema
MINUS
SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
FROM user_tab_privs@rem_schema
ORDER BY 1, 2, 3;
PROMPT SYSTEM PRIVILEGE DISCREPENCIES
SELECT privilege, 'Remote' schema, admin_option
FROM user_sys_privs@rem_schema
MINUS
SELECT privilege, 'Remote' schema, admin_option
FROM user_sys_privs
UNION ALL
SELECT privilege, 'Local' schema, admin_option
FROM user_sys_privs
MINUS
SELECT privilege, 'Local' schema, admin_option
FROM user_sys_privs@rem_schema
ORDER BY 1, 2;
PROMPT ROLE PRIVILEGE DISCREPENCIES
SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
FROM user_role_privs@rem_schema
MINUS
SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
FROM user_role_privs
UNION ALL
SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
FROM user_role_privs
MINUS
SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
FROM user_role_privs@rem_schema
ORDER BY 1, 2;
SPOOL OFF
SET TERMOUT ON
PROMPT
PROMPT Report output written to &report
SET FEEDBACK OFF
DROP TABLE temp_schema_compare;
DROP DATABASE LINK rem_schema;
SET FEEDBACK 6
SET PAGESIZE 20
SET LINESIZE 80 -
Tool for comparing two schemas....
Do we have any tool avalilable in oracle that compares two different schemas and find out the differences between two so that we can validate a schema against a standard one?
Hi.
Toad have option that is called just like that , compare schemas, and when used to compare two schemas it outputs diferences between them.
I dont know about any other tool. -
Compare 2 xml file in background
Hello,
I want to compare two XML files in background containing data like following:
<ReportingDocument>
<CompanyCode>1000</CompanyCode>
<TransactionDate>2000-01-05</TransactionDate>
<InvoiceProperties>
<SupplierInvoiceNumber>000000162000VSTX</SupplierInvoiceNumber>
<InvoiceNumber>0100000000</InvoiceNumber>
</InvoiceProperties>
</ReportingDocument>
As result, i have to receive automatically Email in my outlook inbox like something:
Test is ok.
OR
Test is not ok, differences in invoiceNumber,.....
can some one help me ?
Regards,
Ouail.Ouail,
1) Read XML file using open dataset (because it's in background)
2) Download files to program memory
3) Get the invoice number (example, next 10 chars after <InvoiceNumber>... or between <InvoiceNumber> and </InvoiceNumber> from these 2 files
4) Check if invoice number isn't char (in case that when initial the next characters are the closing tag).
5) Compare both invoice values from xml files
6) Build the text email with the compare detail. "...test is not ok... / .... Teste is ok...." -
Maximum length for an XML schema
Hi everybody,
Is there a limit on the maximum length for an XML schema? I am trying to register an XML schema using dbms_xmlschema.registerSchema(). The schema registration process seems to go fine when the length of the schema is short. But the registration process always hangs when I increase the XML schema with additional types/elements. Is there a limit on the maximum length of the XML schema with regards to registering it to Oracle?
Thanks!
IKHi Erhan,
Let's say I have a really big XML schema in file "schemaA.xsd", like so:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleA="http://abc.com/schemaA" targetNamespace="http://abc.com/schemaA">
<xsd:element name="Employee">
<xsd:sequence>
<xsd:element name="Address" type="sampleA:AddressType"/>
<xsd:element name="Contact" type="sampleA:ContactInfoType"/>
</xsd:element>
<xsd:complexType name="AddressType">......</xsd:complexType>
<xsd:complexType name="ContactInfoType">....</xsd:complexType>
</xsd:schema>
I can separate this schema into multiple smaller schemas (<32KB) by using the proper imports:
In file "sampleA.xsd":
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleB="http://abc.com/schemaB"
xmlns:sampleA="http://abc.com/schemaA" targetNamespace="http://abc.com/schemaA">
<xsd:import namespace="http://abc.com/schemaB" schemaLocation="schemaB.xsd"/>
<xsd:element name="Employee">
<xsd:sequence>
<xsd:element name="Address" type="sampleB:AddressType"/>
<xsd:element name="Contact" type="sampleB:ContactInfoType"/>
</xsd:element>
</xsd:schema>
And in file "sampleB.xsd", I might have something like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleB="http://abc.com/schemaB" targetNamespace="http://abc.com/schemaB">
<xsd:complexType name="AddressType">......</xsd:complexType>
<xsd:complexType name="ContactInfoType">....</xsd:complexType>
</xsd:schema>
So, you see how I have separated that one really big XML schema in file "schemaA.xsd" into two XML schema files: "schemaA.xsd" and "schemaB.xsd". Also, I have added <import> tags in schemaA.xsd to refer to elements, complext types, etc. defined in schemaB.xsd. So long as these schema files are < 32KB, I can register them (using dbms_xmlschema.registerSchema()) without any problems into Oracle.
Let me know if what I said above is not too clear. Hope you find your solution soon!
Thanks!
Irene -
Hi all,
Could anybody tell me how to compare two xml files and find the details that differ?
If possible, can you get me the code?You can simply compare the entire contents of the strings if you like, although simple whitespace differences (spaces, tabs, carriage returns, etc.) would result in an evaluation that the two are different (probably not what you want). You can parse them in DOM or SAX, and the minute an element fails, return false. Look up a tutorial on either DOM or SAX for ideas. Or you could iterate through the string and simply discard whitespace on your own.
It could potentially be more complicated then that. Does the ordering of elements matter? Meaning if I have elements a, b, c in document one but b, c, a in the other one (but a, b, c are identical otherwise) does that mean a different document? You really do not have enough requirements to go on. The above will likely work for you, and no, I will not write your code for you.
- Saish -
How to compare the contents of two XML documents
Hi all,
I was trying to compare the contents of two xml documents, they are both validate for the same XML Schema. i was using the xmlunit to do this. but some how it doesn't work like what i have expected. for example:
1.xml : <test><item>2</item><item>1</item></test>
2.xml: <test><item>3</item><item>2</item><item>1</item></test>
the result from XMLUnit is this two xmls are different, but it compares <item>2</item> with <item>3</item>, which i cannot find out where the real diiffs are.
does anybody know how i can do this correct?
best regards,
tinaI faced a similar problem in one of my projects and hence wrote my own comparator. Most comparators like ExamXML etc show XML as different if the nodes under a parent node occur in different seqeunce or a set of repeated nodes occur in different sequence. The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can view the sample output at http://geocities.com/dheerendra_itbhu/TipsFromDheeru.html
and contact me in case you need the source code. -
Compare two schemas in oracle 11g
Hi All,
Can any one please help me how to compare two schemas in oracle 11g.
Thanks
Edited by: 793914 on Oct 22, 2010 9:33 AMYou can do it with gridcontrol. Look for dictionary comparisons and dictionary baselines.
If you don't have gridcontrol, you can also use SQLDeveloper (free download on otn).
There are two ways to do it with SQLDeveloper.
1) Use Tools->Database Diff. However, you need a change management license to use this functionality. I've never used this.
The free way is to...
2) Use Tools->Database Export. Run it once for each schema and make sure the "Show Schema" option is NOT checked before exporting the schema. Also make sure you don't export data. You can choose which types of objects to export as well.
Once you have the two export files for the two schemas then simply run a diff tool on your platform. Use the diff command line for linux or winDiff or something similar in windows.
Maybe you are looking for
-
Cannot Install Windows Updates on Server 2008 R2 - Error Code 80070002
Hello, I'm having issues installing updates among other issues that seem to be related. I'm not able to view a list of Installed Updates. Also Server Manager fails when it tries to list the Roles and Features on the server. I get this error message i
-
How do you create a database link in Forms9i
I am writting and application that is to connect to multiple databases and do given task, but the triggers I assign to items only work in the database that you connect to for forms to run. How do you create a database link in Forms9i? Thank you in ad
-
Accordion - default panel not working
Hi, I'm using this script so the second panel is open by default, but it's not working (all the panels appear close by default) <script type="text/javascript"> <!-- var Accordion1 = new Spry.Widget.Accordion("Accordion1", { useFixedPanelHeights: fals
-
GR (MIGO) number range
Hi All, How can we define GRN number range?? Is this year specific, if yes, then please explain?? Thanks Pankaj Garg
-
Simulink, Labview and DLL
Hi all, I can communicate my model in Simulink with Labview using the SIT and without working in real-time. However,now, although I have made a DLL(Dynamic Library Link) with Simulink and my compiler, I don´t know how I could run it in real-time with