XML Diff escape/unescape
When performing a diff between two xml files that may contain an escaped character i.e.
<FIELD>This & That</FIELD>
The resulting xsl does not leave the & escaped producing invalid xml.
<FIELD>This & That</FIELD>
Is there some way to instruct the method to escape reserved characters or is the only solution to parse through resulting xsl and escape characters after the fact.
Hi,
You might want to try CDATA or the attribute <disable-output-escaping="yes"/>.
Thanks,
rajat
Similar Messages
-
XML diff and merge - free lib?
I'm using my own XML communication protocol and got a problem. I transfer a configuration with this protocol, and the config can grow very large. So I want to create a diff of old/new configuration an transfer only this diff. On the receiver side the last received config should be patched with the diff.
I'm using JDOM.
Is there a free lib for XML diff and merge/patch available? I already googled for it but found only a commercial lib.
Thanks in advanceI like ExamDiff for Windows. It was free last time I downloaded it, but I haven't looked in a while.
I don't know of any good merge tools, streamy. I'll have to crib what comes back from others.
% -
Escape, unescape strings
JavaScript have escape(), unescape() functions.
How i can in JDeveloper make unescape()?In Java?
The Java equivalent to these Javascript functions is:
import java.net.URLEncoder;
import java.net.URLDecoder;
String unescapedString = URLEncoder.encode(
"The string ü@foo-bar
String escapedString = URLDecoder.decode(
"The+string+%C3%BC%40foo-bar"
);If you're using Java 1.4, you should specify an encoding like this:
import java.net.URLEncoder;
import java.net.URLDecoder;
String unescapedString = URLEncoder.encode(
"The string ü@foo-bar", "UTF-8"
String escapedString = URLDecoder.decode(
"The+string+%C3%BC%40foo-bar", "UTF-8"
); -
I have been looking for XML Diff for quite some time.
I was pleased to see the feature in a free application and it encouraged me to use JDeveloper
http://geoffadf.blogspot.com/2010/02/xml-merge-showing-automatically.html
What are the licence considerations for using this code (xml-compare.jar) elsewhere?
E.g. if I wanted to create a Swing Application to just do XML Diff or create a plugin for other IDEs?You can't pick up code libraries from the core of JDeveloper and use it in your own application. The code belongs to Oracle.
-
Is there a XML Diff utility/API that is schema aware? i.e. can determine that <foo bar="true"/> is the same as <foo/> if the schema says that the default value for the optional bar attribute is "true".
As far as I can see, oracle.xml.XMLDiff has no such feature.
VijayMost XML diff APIs are not schema aware. XML document differences implies differences in XML elements and attributes, not a validation of the XML documents with a schema.
http://www.devx.com/Java/Article/30943 -
Escape /unescape oddity in arrays
HI,
i have a data array that im breaking up correctly for what i
need, but ive started adding smaller arrays 'escaped' into this
array so that when i break it up i can unescape the sub arrays for
my purposes.
eg:
dataarray=1,2,f,2,4,%20ghgj%kglf,2,3 ( the escaped %% bit
altho not proper escaped is just to show as example where it
stands)
so when i extract the %20ghgj%kglf from the data array i can
unescape it into a further array of
subarray=20,ghgj,kglf
now this seems to work fine on testing but on publishing
doesnt work and by deduction sems to be the problem, ( if i remove
the escaped section of the array and replace with a normal variable
things work)
are there any known problems with escape/unescape in arrays
that i am missing?
many thanks for your time
shaneI don't understand what you're doing. Are you trying to
represent complex data in flashvars or external textfiles - e.g for
LoadVars?
If you are trying to represent an array as text so you can
recreate it in flash then you can do it with different delimiters.
So top level could be a comma and elements that are arrays
could be delimited with whatever you want e.g. a pipe character (|)
or maybe 2 pipe characters (||)
That way you just use String.split at each level as required.
But you can't easily specify the type of data.
For a more generic way of representing complex data in
flashvars or in loaded config files (i.e. from external text files
) you could try using a JSON implementation - check this out if so:
http://tinyurl.com/2a55z6 -
Hey All,
Is there a mechanism for getting a diff of XMLTypes/documents in XML DB? Or is the best bet to make/load in my own implementation? Obviously, I don't want to reinvent the wheel if I don't have to.
Thanks
TimNothing in the current release :(...
However if you are interested in joining the 11g Beta program we might be able to help.
http://forums.oracle.com/forums/ann.jspa?annID=281 -
I'm working a project which basically involves producing a diff of 2 XML files. I recently discovered XDK and though that this would be the best way to do this.
However, after I implemented the XDK solution, I found that it makes a distinction between files with different node ordering, even when these are logically equivalent. The files I am operating on have no ordering guarantees. Is there a way to accomplish a logical (rather than physical) XML comparison using XKD? Or should I look at another product?How are you processing the XML? Are you passing XML directly to merge or are you using XML Agent to transform the data to field nominated? Are you applying an XSLT?
-
Hello all,
At my current project we are interfacing between SAP and PeopleSoft.
The target system peoplesoft expects an xml exactly formed as follows.
So within the CDATA area "<" and ">" are expected. NOT "< ;" and "> ;" AND NOT "< ;" and "> ;"
<?xml version="1.0"?>
<IBRequest>
<ContentSections>
<ContentSection>
<Data>
<![CDATA <?xml version="1.0"?><SNS_UPDATE_DEB><MsgData><Transaction>
<EXTERNAL_SYSTEM class="R"><EMPLID IsChanged="Y">500000005</EMPLID>
<EFFDT IsChanged="Y">2008-01-22</EFFDT><EXTERNAL_SYSTEM_ID>SAP99003</EXTERNAL_SYSTEM_ID>
</EXTERNAL_SYSTEM></Transaction></MsgData></SNS_UPDATE_DEB>]>
</Data>
</ContentSection>
</ContentSections>
</IBRequest>
However the sending system does send the "<" and ">" within the CDATA are in 'escaped mode'.
Like below.
<?xml version="1.0"?>
<IBRequest>
<ContentSections>
<ContentSection>
<Data>
<!CDATA < ;SNS_UPDATE_DEB> ;< ;MsgData> ;< ;Transaction> ;>
</Data>
</ContentSection>
</ContentSections>
</IBRequest>
Trying an XSLT with: disable-output-escaping="yes" gave no results. Furthermore a UDF with a FindAndReplace function also doesn't work.
Does anyone have an idea how to fix this problem?Hi Ramon,
I assume that the UDF is no help because XI escapes the XML after it's passed through the mapping again. Have you tried a Module in the adapter engine that reverts the escaping right at the end of processing? This at least should make sure that no further modifications are done by anybody afterwards.
On the other hand, this is technically more challenging and a bit harder to monitor.
What adapter are you using to commnunicate with your target system?
regards,
Peter -
Hi!
I have a requirement for expressing the difference between two very large (XML) hierarchies in a (structured) format. XML would be a good fit here. Naturally I could design my own schema for expressing the difference information, but I started thinking that somebody must have faced this same problem already before.
So, are there any more or less standardized formats for expressing the diff between two XML documents?
And if yes, any java tools/libraries supporting it?
Also, I would be interested in hearing if you have any other ideas how to express the diff as efficiently as possible. (All the existing nodes in the hierarchy have a unique id, the minimum requirement is the support for create, delete and edit operations, but support for move (inside the parent/anywhere in the hierarchy)would also be nice.)Thanks for the reply. I did try the google method, but everything I came up with where more or less proprietary/commercial, and the actual diff format used was usually not documented and internal to the application.
And since the prodution of the diff information is not my actual problem here, I was trying to find some diff format standard (something like XSL is for XML transformations) I could then produce myself. (And if there were supporting tools for it, they sure would help in the debugging phase.)
Propably I should also have mentioned already before, that the diff data that is produced will be handled in several different programming environments (also non-java), so an existing standard would increase the propability for finding some suitable tool-support in other platforms also. -
Special characters in XML (UTF8, escapes etc)
This may seem like a simple problem, but I'm kind of a slow learner, so any help would be appreciated.
I'm generating XML output via ordinary PL/SQL procedures i.e. not using the Oracle XSQL stuff. The data is built up into a XML document, which will be parsed within the server, then passed out to a client, probably as a CLOB.
The data may contain "special" characters such as "<&>" and so on. Is there an existing function to translate these into an "XML-safe" form within the text, or do I need to trap and translate them individually?
Also, the database may contain foreign characters e.g. Thai or Chinese. Will this be handled transparently by my XML-extraction stuff - which just selects the data from the tables and writes it to a CLOB inside XML tags - or do I have to do something to make sure the XML comes out in a safe UTF format?
Thanks,
Chrisuse & instead of &
see http://www.w3.org/TR/2000/REC-xml-20001006#syntax -
Hi!
I would urgently need an API providing functionality for comparing two xml files and creating a delta (e.g. which elements were deleted in the first file).
I was searching the web for hours and could just find applications, but no apis for java.
Hope that anyone could help me.
Thx, ChristianWhere do I get it from? I think it's only included in the commercial license of Oracle 10g.
-
Compare two tables that are in XML format (xml diff)
I have two tables in XML-format and need to list differences in
1. Structure and/or
2. Content
SAP offers CL_SXIVERI_XML_COMPARATOR, but this is too simplistic for the requirement.
Any ideas or suggestions will be appreciated. Thank you!Hi Adrian,
You can convert the data from the XML file to an internal table. Once the data is in the internal table you can easily paly with it
Refer to this Wiki for details: [https://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table].
You can also check Simple Transformations as well.
Cheers,
Suhas -
Java source code to compare XML based on ExamXML XML diff tool
I’m working on a project that includes comparing XML files and I need a source code on Java to compare XML fragments.
I’m using ExamXML from http://www.a7soft.com to compare XML files but I need the Java source code.
Can anybody help me.You didn't notice there's a "Support" link on that page you referred to? Ask them for the source code. If they won't give it to you, then you are effectively asking us to give you a stolen copy of it. Don't ask for such things on this site.
-
How to escape XML in BPEL?
I have a part of a outputmessage in an element HTML of xsd:any. This element contains HTML which i have to transform to escaped XML.
Therefore i created the following embedded java code.
String htmlContent = ((oracle.xml.parser.v2.XMLElement)getVariableData("l_GetBericht_Output","reply","/ns5:GetBerichtResponse/ns14:Bericht/ns14:HTML")).getFirstChild().getNodeValue() ;
htmlContent.replaceAll("<","<") ;
htmlContent.replaceAll(">",">") ;
setVariableData("TestHTMLContent",htmlContent);
Message in l_GetBericht_Output starts with;
<l_GetBericht_Output>
<part name="reply">
<sbtn:GetBerichtResponse>
<ns3:Bericht>
<ns3:Onderwerp>sdjasldjalsda</ns3:Onderwerp>
<ns3:Tekst/>
<ns3:HTML>
<HTML>
<div>
<p>Data</p>
<p>
<p>
de heer ...
The result of the selection in BPEL variable TestHTMLContent is empty though.
Anyone any thoughts ?
Is there a better way to transform XML to escaped XML ?
Why is my selection null ?
Cheers,
PeterTry this.
xpath query for BPEL, escaping double quotes
Should work.
Thanks,
Vijay
Maybe you are looking for
-
i want to port labview program to my target LPC2100,such as LPC2119.But i do not know what i should do first,and how to do it? second,third.......please give me some help.
-
What is the best Path for a J2EE developer with oracle?
Hi, I am a J2EE developer, for the time being I work at a Commercial Bank as an enterprise application developer. I have learnt java when I was following a local IT diploma and with the help of books, works at my working place and the internet , toda
-
Is it possible to silence the external ringer on the Pre when using headphones?
When I get a call on my Pre while using the headphones, I'd like to hear the ringer in my headphones only... Currently when I get a call it rings in the headphones AND via the external speaker. Can this be done and if so how? Post relates to: Pre p10
-
Hi guys I want to know how to create SRM portal?
Hi guys I am right now creating SRM portal, can anyone give info about please.
-
XEClient Install: ODBC System DSN
Hi, I just installed XEClient Software on a clean Windows XP SP2 German. When I try to create a new System DSN in the ODBC Administrator using "Oracle in XEClient" I get a popup error message stating that ODBC drivers cannot be loaded, error code 106