Oracle8i Application Developer's Guide - XML
Release 3 (8.1.7)

Part Number A86030-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

Using XML Parser for Java, 16 of 22


Validation

DTD: Understanding DOCTYPE and Validating Parser

Question

I have an XML string contains the following reference to a DTD, that is physically located in the directory where I start my program. The validating XML parser complains that this file can not be found.

<!DOCTYPE xyz SYSTEM "xyz.dtd" >

What are the rules for locating DTDs on the disk? Can anyone point me to a decent discussion of DOCTYPE attribute descriptions.

Answer

Are you parsing an InputStream oran URL ? If you are parsing an InputStream the parser doesn't knowwhere that InputStream came from so it cannot find the DTD in the "samedirectory as the current file". The solution is to setBaseURL()on DOMParser() to give the parser the URL "hint" information to be able to derive the rest when it goes to get the DTD.

Can Multiple Threads Use Single XSLProcessor/Stylesheet?

Question

Can multiple threads use a single XSLProcessor/XSLStylesheet instance to perform concurrent (at the same time) transformations?

Answer

As long as you are processing multiple files with no more than one XSLProcessor/XSLStylesheet instance per XML file you can do this simultaneously using threads. If you take a look at the readme.html file in the bin directory, it describes ORAXSL which has a threads parameter for multi-threaded processing.

Is it Safe to Use Document Clones in Multiple Threads?

Question

Is it safe to use clones of a document in multiple threads? Is the public void setParam(String ,String) throws XSLExceptionmethode of Class oracle.xml.parser.v2.XSLStylesheet supported? If no, is there another way to pass parameters at runtime to the XSL-T Processor?

Answer

If you are copying the global area set up by the constructor to another thread then it should work.

That method is supported since XML Parser release 2.0.2.5.

Comment

You have it in your docs, but it is not implemented in the XSLStylesheet class (windows zip edition). First update your zip download file.

public static void serve(Document template, Document data,Element 
userdata,PrintWriter out) 
{  
 XMLDocument clone = (XMLDocument)data.cloneNode(true);
    clone.getDocumentElement().appendChild(userdata.cloneNode(true));
    serve(template, clone, out);
}

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index