Hi,
I have a requirement in which i need to send messages in xml format in
strings. i.e. the message will be a string which will be in xml form. To
do that I am building a Document object and then converting it to a
string. This xml message will be validated against an XML Schema. How do
I specify the following in the Document object:

<personl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="http://localhost/XML/XSD1.xsd";>

If this line is not present in the generated xml, it will not be
validated. If I were using a DTD instead of an XML Schema to validate
this document, I would use the following method.
doc.setDoctype("dtd",  "Person.dtd", "");
What is the corresponding method to be used for an XML Schema?

If there something wrong in this approach,  could someone suggest
another approach?
Please reply back at my mail id too, [EMAIL PROTECTED]

TIA,
abhishek.

e.g. 
                                DocumentImpl doc = new DocumentImpl();
        
                                doc.setDoctype("dtd",  "Person.dtd",
"");  // this is the problematic line

                                Element root =
doc.createElement("person");
                                Element name =
doc.createElement("Name");

                                Text namevalue =
doc.createTextNode("William");

                                name.appendChild(namevalue);

                                root.appendChild(name);

                                doc.appendChild(root);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to