Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not

 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not know how to syntax the .xsl file (java is ok)?
In this case if one file is eg 234bytes the other must be 234bytes?
I must use for-each or apply-templates or both or any?
eg. an xml:

[code] <?xml version="1.0"?>
<plants xmlns = "x-schema:your-first-schema.xml">
<plant id="25">
<name>Carnation</name>
<scientificName>Dianthus</scientificName>
<onHand>4000</onHand>
<color>Red</color>
</plant>
<plant id="65">
<name>Lily-Of-The-Valley</name>
<scientificName>Convallaria</scientificName>
<onHand>250</onHand>
<color>White</color>
</plant>
<plant id="115">
<name>Violet</name>
<scientificName>Viola</scientificName>
<onHand>900</onHand>
<color>Purple</color>
</plant>
<plant id="1195">
<name>Violet2</name>
<scientificName>Viola2</scientificName>
<onHand>90</onHand>
<color>Purple2</color>
</plant>
</plants>
[/code]
 
Marshal
Posts: 26286
80
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could just use the XSLT identity template. But even that doesn't guarantee that the output file will be byte-for-byte identical to the input file; for example the process might have normalized an unnormalized attribute value, or it might have chosen to use double quotes around attribute values where the input had single quotes.

So why not just use ordinary Java code which ignores the XML aspect of the file entirely and just copies the bytes from the input to the output?
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about using the 'cp' (UNIX) or 'copy' (MS-DOS) programs?

Simply,

...\cp file1.txt file2.txt

 
Leonidas Savvides
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the hint here was a <xsl:copy> usage for practice, can you tell how may used event not exact copy??
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used success the:

 
Those are the largest trousers in the world! Especially when next to this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic