[jdom-interest] RE: jdom-interest digest, XML Schema validation

Mark Scott mscott at outerforce.com
Tue Feb 6 11:05:19 PST 2001


Does JDom have an api for validating pattern matching
in schemas, I'm about to imlplement gnu-regexp api into my validation
framework, and I'm curious if there might be one internal to JDOM...

thnx,
-M

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of
jdom-interest-request at jdom.org
Sent: Tuesday, February 06, 2001 2:03 AM
To: jdom-interest at jdom.org
Subject: jdom-interest digest, Vol 1 #450 - 3 msgs


Send jdom-interest mailing list submissions to
	jdom-interest at jdom.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.denveronline.net/mailman/listinfo/jdom-interest
or, via email, send a message with subject or body 'help' to
	jdom-interest-request at jdom.org

You can reach the person managing the list at
	jdom-interest-admin at jdom.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of jdom-interest digest..."


Today's Topics:

   1. Re: JDOM and XSL (Tony Montgomery Smith)
   2. xerces and jdom and Forte Transparent Persistence (Curlen H Phipps)
   3. [Q}How to Applay XSL using Xalan2 (ITOH Kazuhiro)

--__--__--

Message: 1
From: "Tony Montgomery Smith" <tonyms at compuserve.com>
To: <jdom-interest at jdom.org>
Date: Mon, 5 Feb 2001 22:43:27 -0000
Subject: [jdom-interest] Re: JDOM and XSL

Further to my last posting, the following more or less works:

  public org.jdom.Document transform(BufferedReader bufferedReader, String
xslFileName)
  {
    org.jdom.Document targetDoc = null;
    try
    {
      Processor processor = Processor.newInstance("xslt");
      Templates templates = processor.process(new InputSource(xslFileName));
      Transformer transformer = templates.newTransformer();
      DocumentBuilderFactory dFactory =
DocumentBuilderFactory.newInstance();

//      dfactory.setNamespaceAware(true);
      DocumentBuilder docBuilder = dFactory.newDocumentBuilder();
      org.w3c.dom.Document domDoc = docBuilder.newDocument();

      transformer.transform(new InputSource(bufferedReader), new
Result(domDoc));
      DOMBuilder builder = new DOMBuilder();
      targetDoc = builder.build(domDoc);
    }
    catch (Exception e)
    {
      System.out.println(e);
    }
    return targetDoc;
  }

I write "more or less" because about 1 time in 3 it makes a mistake in
analysing
the document. If this were C code, I'd look for an unitialised variable, but
that is impossible in Java, isn't it?



--__--__--

Message: 2
From: "Curlen H Phipps" <chphipps at yahoo.com>
To: <jdom-interest at jdom.org>
Date: Mon, 5 Feb 2001 19:07:03 -0800
Subject: [jdom-interest] xerces and jdom and Forte Transparent Persistence

I have a question related to the xerces, jdom, and dom question. I'm using
Forte for Java and Transparent Persistence. Forte has a persistence
framework and is using jaxp internally for processing xml documents. Also,
there is a parser.jar that has the org.w3c, and org.xml packages.

When I specify xerces.jar in the classpath, there is a conflict with the
org.w3c and javax.xml. packages, because they also appear in the xerces.jar.
Essentially, the framework is trying to use it's version of the parser and
when I specify xerces.jar it complains.

I get this problem when I instantiate a DOMBuilder and call the build method
[with a file parameter] to parse an xml document. Is it possible to use the
DOMBuilder class without using xerces, however using an adapter class that
uses the parser that is in the othe jar file??

I hope this makes sense - I really want to use JDom! I just need to be able
to parse XML docs without using xerces. I would abandon DOM altogether, but
unfortunately it is used by the framework that I am using, so I can't. If I
didn't have to use TP it would be a slam dunk! Can someone please help?!

Thanks in advance,
chp


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--__--__--

Message: 3
Date: Tue, 06 Feb 2001 14:43:00 +0900
From: ITOH Kazuhiro <itoh at ipc.kajima.co.jp>
To: jdom-interest at jdom.org
Subject: [jdom-interest] [Q}How to Applay XSL using Xalan2

Dear All:

I tried to apply XSL to JDOM Document. I read FAQ about using Xalan.
Then I made small example as follows.
But This programm stops at
     jdomOuter.output(docXSL, poutXSL);
Are there anything wrong in my code ?
Could you tell me them, please

I use JDK1.3 & JDOM-b5 & Xalan2.

Thanks....
------------------------------start ------------------------------
import java.io.*;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.jdom.*;
import org.jdom.output.XMLOutputter;
import org.jdom.input.SAXBuilder;

public class ApplyXalan {

  public ApplyXalan() {
  }
  public static void main(String[] args) {
    try {
      //JDOM Document
      SAXBuilder builder = new SAXBuilder();
      Document docXML = builder.build("data/testSchedule.xml");
      Document docXSL = builder.build("data/dispScheduleSort.xsl");
      //creating Outputter
      XMLOutputter jdomOuter = new XMLOutputter();
      jdomOuter.setEncoding("Shift_JIS");//Japanese encoding

      //creating piped IO for XSLT file
      PipedOutputStream poutXSL = new PipedOutputStream();
      PipedInputStream pinXSL = new PipedInputStream(poutXSL);
      jdomOuter.output(docXSL, poutXSL);//This programm stops here
      poutXSL.flush();

      //creating piped IO for XML file
      PipedOutputStream poutXML = new PipedOutputStream();
      PipedInputStream pinXML = new PipedInputStream(poutXML);
      jdomOuter.output(docXML, poutXML);
      poutXML.flush();
      //Apply XSLT to JDOM using xalan2
      TransformerFactory tFactory = TransformerFactory.newInstance();
      Transformer transformer=
                    tFactory.newTransformer(new StreamSource(pinXSL));
      transformer.transform(new StreamSource(pinXML),
                            new StreamResult("data/out2.html" ));
      pinXML.close();
      pinXSL.close();
      poutXML.close();
      poutXSL.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
------------------------------end------------------------------

      _/_/_/_/_/__/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
mailto:itoh at ipc.kajima.co.jpKazuhiro Itoh


--__--__--

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

End of jdom-interest Digest




More information about the jdom-interest mailing list