Sorry. To clarify, my mod below means that the original path "com/ptc..." does not impact on xmltask at all. So if you can insert a PUBLIC identifier then you're sorted, I believe. If you want to do that automatically, then I think you'd need the standard Ant replace task. You won't be able to use xmltask for that (Catch-22 and so on...)

Brian Agnew wrote:
I think this is more of an xmlcatalog issue, and perhaps the Ant users list is more of use. I *can* reference a local DTD thus:

  <xmlcatalog id="dtds">
    <dtd publicId="XXX" location="x.dtd"/>
  </xmlcatalog>
    <xmltask source="your_file.xml" report="true" failWithoutMatch="true" >
    <xmlcatalog refid="dtds"/>
     <insert path="/LogicalAttributes/Class[position()=last()]" position="after">
....

but I've:

a) had to create a blank (0 length) x.dtd
b) modify your input document to look like


<?xml version="1.0" standalone="no"?>
<!DOCTYPE LogicalAttributes PUBLIC "XXX" "/com/ptc/core/meta/common/impl/LogicalAttributes.dtd" >
...

i.e. inserting a PUBLIC identifier.

And that will perform your insertion. Not sure if that helps!

Brian

von Hasselbach, Moritz wrote:
Message
Brian,
my DTD is local, that's right. But: The path that it uses seems to be incorrect. If I modify it from absolute to relative by removing the leading '/' it works. Unfortunately for I don't have control over that path for my final solution (an installer that has to modify existing XML files). I hoped that there would be a way to also map local references by using <xmlcatalog> or by 'extending ' the search path via xmlcatalogs classpath parameter.
Moritz
-----Original Message-----
From: Brian Agnew [mailto:brian@oopsconsultancy.com]
Sent: Tuesday, May 03, 2005 12:28 PM
To: von Hasselbach, Moritz
Cc: xmltask-users@lists.sourceforge.net
Subject: Re: [Xmltask-users] xmltask with xmlcatalog not resolving

What's your DTD public id ? You should be able to reference that in a  <xmlcatalog> fragment thus:

<xmlcatalog id="dtds">
  <dtd publicID="..." location="...">
</xmlcatalog>

Nb. if your DTD is local (as it may appear to be below) then you may not have to worry about it.

Brian

von Hasselbach, Moritz wrote:
Gents,
I have an issue with xmltask not processing an insert operation.
The ant task fragment I use looks like:
 
 <xmltask source="${codebase}/LogicalAttributes.xml" dest="${codebase}/LogicalAttributes.xml" outputter="default" encoding="UTF-8" indent="no" >
  <xmlcatalog refid="lidtd"/>
  <insert path="/LogicalAttributes/Class[position()=last()]" position="after">
   <![CDATA[
   <Class name="wt.enterprise.RevisionControlled">
    <Property>
     <LogicalForm>_IEObjPropsURL</LogicalForm>
     <ExternalForm>NPA|_IEObjPropsURL</ExternalForm>
    </Property>
    </Class>   
       ]]>
  </insert>
 </xmltask>
 
 
 The LogicalAttributes.xml file that looks like:
 
<?xml version="1.0" standalone="no"?>
<!DOCTYPE LogicalAttributes SYSTEM "/com/ptc/core/meta/common/impl/LogicalAttributes.dtd" >
<LogicalAttributes>
...
</LogicalAttributes>
The error message is:
 
  [xmltask] java.io.FileNotFoundException: \com\ptc\core\meta\common\impl\LogicalAttributes.dtd (The system cannot find the path specified)
  [xmltask]     at java.io.FileInputStream.open(Native Method)
  [xmltask]     at java.io.FileInputStream.<init>(FileInputStream.java:106)
  [xmltask]     at java.io.FileInputStream.<init>(FileInputStream.java:66)
  [xmltask]     at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
  [xmltask]     at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
  [xmltask]     at java.net.URL.openStream(URL.java:913)
  [xmltask]     at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
  [xmltask]     at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
  [xmltask]     at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
  [xmltask]     at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
  [xmltask]     at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
  [xmltask]     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
  [xmltask]     at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
  [xmltask]     at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
  [xmltask]     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  [xmltask]     at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
  [xmltask]     at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.documentFromStream(XmlTask.java:348)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.documentFromFile(XmlTask.java:365)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.access$000(XmlTask.java:27)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask$InputFile.getDocument(XmlTask.java:209)
  [xmltask]     at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:548)
  [xmltask]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
  [xmltask]     at org.apache.tools.ant.Task.perform(Task.java:341)
  [xmltask]     at org.apache.tools.ant.Target.execute(Target.java:309)
  [xmltask]     at org.apache.tools.ant.Target.performTasks(Target.java:336)
  [xmltask]     at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
  [xmltask]     at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
  [xmltask]     at org.apache.tools.ant.Main.runBuild(Main.java:609)
  [xmltask]     at org.apache.tools.ant.Main.start(Main.java:196)
  [xmltask]     at org.apache.tools.ant.Main.main(Main.java:235)
 
I played around with <xmlcatalog> variations but couldn't find a way to solve my issue.
 
Any ideas?
 
Regards, Moritz

-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012

-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012

-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012