Linking Style Sheets and Schemas

H

HugeBob

Hi All,

I'm writing a class that generates an XML file using the W3C DOM with
data retrieved from a JDBC connection. I've successfully gotten the
XML generated. But, the exercise requires us to link the resulting
XML file to CSS and schema file. But, I don't know how to link them.
Basically, I need the following to show up in my XML file:

<?xml-stylesheet type="text/css" href="my.css" ?>
<my:jdbcexer xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://web3.myworld.edu/sports"
xsd:schemaLocation="http://web3.myworld.edu/sports sports.xsd">

How would this be done in Java?
 
O

Owen Jacobson

Hi All,

I'm writing a class that generates an XML file using the W3C DOM with
data retrieved from a JDBC connection. I've successfully gotten the
XML generated. But, the exercise requires us to link the resulting
XML file to CSS and schema file. But, I don't know how to link them.
Basically, I need the following to show up in my XML file:

<?xml-stylesheet type="text/css" href="my.css" ?>
<my:jdbcexer xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://web3.myworld.edu/sports"
xsd:schemaLocation="http://web3.myworld.edu/sports sports.xsd">

How would this be done in Java?

The fragment enclosed in <? ?> is called a processing instruction. I'm
not intimately familiar with the org.w3c.dom package, but there may be
a way to add PI nodes to the document tree - the package has a
ProcessingInstruction class which might be suitable.

HTH,
-o
 
H

Huge B.

The fragment enclosed in <? ?> is called a processing instruction. I'm
not intimately familiar with the org.w3c.dom package, but there may be
a way to add PI nodes to the document tree - the package has a
ProcessingInstruction class which might be suitable.

HTH,
-o

Thanks for your input. I used the CreateProcessingInstruction(...)
method to append this info to the document. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top