Loading login details...

DeltaXML Support Forums

 new topic  post reply 
moderators: chrisc nigelw tristanm
ignore all attributes of an element
Joined: 19-June-2008
Posts: 4
Posted: 19-June-2008 15:50
But my problem is totally different.  Please look at this problem I have attached the code also. I have two footnotes and i have deleted one and taking diff xml using deltaxml api. Please look at the code give provide me some samples.

old xml
<footnote alt="1" id="61177" label="1" order="2" size="1">   <para>New Footnote</para>
</footnote>
<footnote alt="1" id="61178" label="2" order="2" size="1">   <para>share report</para> 
</footnote>
new xml
<footnote alt="1" id="61178" label="1" order="2" size="1">   <para>share report</para> 
</footnote>
diff xml
<footnote id="61177" deltaxml:delta="WFmodify" alt="1" label="1" order="1" size="1">
    <para deltaxml:delta="WFmodify"><deltaxml:PCDATAmodify><deltaxml:PCDATAold>
      New Footnote</deltaxml:PCDATAold>
<deltaxml:PCDATAnew>share report</deltaxml:PCDATAnew></deltaxml:PCDATAmodify></para></footnote>
<footnote deltaxml:delta="delete" alt="1" id="61178" label="2" order="2" size="1"><para>share report.</para></footnote>

In the above new xml I have deleted one footnote and i want to compare the old and new xml. I have to get the result as first footnote as deleted. But i get the result as modified. For this i fount label  is same for the first element in both xml. So i want to ignore this  I would like to get the xsl file for this and do i have to set this as input filter or output filter.
re: ignore all attributes of an element
Joined: 27-March-2007
Posts: 1
Location: Cambridge, United Kingdom
Posted: 23-June-2008 12:38
There are various settings that control the matching. Looking at this data it appears that you weren't using the enhanced matcher.

When I run this command:
java -jar /usr/local/DeltaXMLCore-5_0/command.jar compare delta f1.xml f2.xml f12.xml


I the following result (using the new deltaV2 format):

<footnotes xmlns:deltaxml="http://www.deltaxml.com/ns/well-formed-delta-v1" xmlns:dxa="http://www.deltaxml.com/ns/non-namespaced-attribute" deltaxml:deltaV2="A!=B">
  <footnote deltaxml:deltaV2="A" alt="1" id="61177" label="1" order="2" size="1">
    <para>New Footnote</para>
  </footnote>
  <footnote deltaxml:deltaV2="A!=B" alt="1" id="61178" order="2" size="1">
    <deltaxml:attributes deltaxml:deltaV2="A!=B">
      <dxa:label deltaxml:deltaV2="A!=B">
        <deltaxml:attributeValue deltaxml:deltaV2="A">2</deltaxml:attributeValue>
        <deltaxml:attributeValue deltaxml:deltaV2="B">1</deltaxml:attributeValue>
      </dxa:label>
    </deltaxml:attributes>
    <para deltaxml:deltaV2="A=B">share report</para>
  </footnote>
</footnotes>


This command has the enhanced matcher turned on by default. With this command:

java -jar /usr/local/DeltaXMLCore-5_0/command.jar compare delta f1.xml f2.xml f12.xml "Enhanced Match 1=false"


I get a similar result to the one you posted.

If you are coding using the API see the feature settings information in the javadoc.

The enhanced matcher takes note of the PCData in the <para> child elements when aligning the <footnote> elements. There are other ways of aligning the footnotes, one of which is to assign higher priority to certain attributes using deltaxml:keys. Perhaps defining keys based on the id attribute would be appropriate in this case?

If so this can be achieved with an input XSLT filter which adds the deltaxml:key attribute to each of your footnote elements. Keys are discussed in http://www.deltaxml.com/dxml/library/how-to-use-keys.html and there is an interactive example.

And if you are looking for sample code, including an XSLT filter please see the AddressBook sample program in the release.

Now the matching is more appropriate, it should then be possible to address any issues with the attributes. You could decide to:

- remove the label attribute from the result
- use either the A or B values when there is a difference.

Are any of these appropriate? When you say you want to ignore an attribute change, what are you trying to achieve? We can provide some sample code but we need to understand the requirement a little more.
Hai chrisc
Joined: 19-June-2008
Posts: 4
Posted: 25-June-2008 15:22
Thanks for your support. It works fine now. I am also in need of another help. I would like to know how to ignore an element. I looked out for samples in your site. I got samples only for ignoring some attributes.

Could you provide me some samples for ignoring an element?

Thanks,
Arul
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate