Ambrose Tati

Ranch Hand
+ Follow
since Oct 03, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ambrose Tati

What about updating your path to include the location of the commands you're running in your autoexec.bat file and then restarting your PC?
Hope it works.
Ambrose Tati
Dear all,
I want to learn J2EE on my Win98. Is there any J2EE development environment freely available for downlod that works on Win98?
Thanks
Ambrose Tati
Dear all,
where can I get this class from?com.sun.jndi.fscontext.RefFSContextFactory
So that I can do something like
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
Many thanks
Ambrose Tati
23 years ago
Dear all,
Can anybody tell me what is the current state of XQL and any available XQL tools?
Many thanks
Ambrose
Hi Sony,
I don't if I understood your question correctly. I think using XML schemas you can achieve what you want to do:
<xsd:simpleType name = "Colors">
<xsd:restriction base = "xsd:string">
<xsd:enumeration value = "red"/>
<xsd:enumeration value = "white"/>
<xsd:enumeration value = "black"/>
<xsd:enumeration value = "blue"/>
</xsd:restriction>
</xsd:simpleType>
...
and then if you add this in the definition of your complex type, you'll ensure that only the above colors will be accepted as values of you Color attribute.
<xsd:attribute name="Color" type = "Colors" use = "required"/>

Hope to have been of any help.
Ambrose
Hi Milan,
There's an XML predifined entity for &
called amp. Make sure you use
the correct syntax for entities.
i.e: &<entity name>;
It should sort you out.
Thanks
Ambrose Tati

[This message has been edited by Ambrose Tati (edited August 02, 2001).]
Hi Andy,
Of course you can create a new xml document rather than just manipulate an existing xml document. Look at the DOM API and you'll see how to use the different methods. I found it much easier to work with JDOM, you can visit the JDOM home page and download the relevant jar files.
I've put together the following small program which uses jdom to create a small xml file:
// JDOM classes
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
// Standard classes
import java.util.*;
import java.io.*;
public class BuildJdom {
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage: java BuildJdom URL");
System.exit(0);
}
//
// Data to be loaded into the XML doc
String senders [] = {"[email protected]",
"[email protected]"};
String receivers [] = {"[email protected]",
"[email protected]"};
String messages [] = {"message1","message2"};
//
Element rootElement = null;
Element messageTag = null;
Element fromTag = null;
Element toTag = null;
Element textTag = null;
//
rootElement = new Element("Mail");
//
Vector mailVector = new Vector();
//
for (int i = 0; i < senders.length; i++) {
messageTag = new Element("Message");
mailVector.add(messageTag);
}
rootElement.setChildren(mailVector);
//
// Load nodes under Message nodes
//
int i = 0;
Iterator it = mailVector.iterator();
while (it.hasNext()) {
Element el = (Element)it.next();
Vector messageVector = new Vector();
if (i < senders.length) {
fromTag = new Element("From");
toTag = new Element("To");
textTag = new Element("Text");
fromTag.setText(senders[i]);
toTag.setText(receivers[i]);
textTag.setText(messages[i]);
messageVector.add(fromTag);
messageVector.add(toTag);
messageVector.add(textTag);
el.setChildren(messageVector);
i++;
}
}
//
//
Document doc = new Document(rootElement,
new DocType("Mail", "mail.dtd"));
//
try {
String indent = " ";
boolean newLines= true;
XMLOutputter pr = new XMLOutputter(indent,
newLines);
pr.output(doc,new FileOutputStream(args[0] + ".xml"));
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Hello there,
I think, if you derive your type from xsd:string and then you specify what it should contain in the xsd attern you'll get what what you're looking for.
For example if I wanted my string to contain things like
<string of lower letters>@<string of lower letters>.com
(as in [email protected]), I could do something like this:
<xsd:element name="myUrl">
<xsd:simpleType>
<xsd:restriction base = "xsd:string">
<xsd attern value = "([a-z])+@([a-z])+.(com)"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

if you change <xsd attern value = "([a-z])+@([a-z])+.(com)"/> to
<xsd attern value = "([a-z])+"/> you'll ensure that it will not be empty and will only contain any combination of letters.
Hope this helps
Ambrose Tati

Hello there,
I think Tom got confused between DTDs and XML Schema.
You need something similar to this in your instance document:
For simplicity I did not use name spaces.

<?xml version="1.0"?>
<ROOT_ELEMENT xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:noNamespaceSchemaLocation="<your schema doc>">
.
.
.
</ROOT_ELEMENT>
Hello there,
I assume that you have installed Saxon and updated your path so that you can run it from anywhere.
If at your windows command prompt you just type saxon, it will tell you exactly what parameters it expects.
If you type saxon -o <filename>.htm <xml file> <style sheet file>
you get <filename>.html as your output file which you can look at using your browser. This of course provided that there are no errors in your style sheet file and that your xml file is valid.
Hope this helps
Ambrose Tati
Hi Savita,
There are lots and lots of posts in this forum which do relate to your question. Take some time and browse through.
Thanks
Ambrose Tati
Hi Marilyn,
I find XML very cool and hot. But in your case I think and XML document would be an overkill. A property file would be more than fine.
Cheers
Ambrose Tati
Dear all,
I've been looking at JDOM recently and found it quite easy to use to read/write XML docs. It it likely to become part of core Java just the way JDBC is?
Many thanks
Ambrose Tati
Dear all,
Can somebody tell me if it's possible to convert an
org.w3w.dom.DOM object to an org.jdom.DOM object?
My application XML Schema validates an XML instance producing
a org.w3w.dom.DOM object. I find it easier to process XML files using JDOM so I was wondering if it's possible to do such conversion?
Many thanks
Ambrose Tati
Hi there,
I think you need something like:
<xsd:element name="Date" type="xsd:date" nillable = "true" />
Hope it works.
Ambrose Tati