Try adding these statements.

        
        root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi";, 
                "http://www.w3.org/2001/XMLSchema-instance";);
        root.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance";,
                "xsi:noNamespaceSchemaLocation",                                
                "http://localhost/XML/XSD1.xsd";);


Pavani


> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> list-help: <mailto:[EMAIL PROTECTED]>
> list-unsubscribe: <mailto:[EMAIL PROTECTED]>
> list-post: <mailto:[EMAIL PROTECTED]>
> Delivered-To: mailing list [EMAIL PROTECTED]
> X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0
> content-class: urn:content-classes:message
> Subject: specifying the XML schema in the Document object using xerces1.4.3
> Date: Wed, 5 Sep 2001 10:50:31 +0530
> X-MS-Has-Attach: 
> X-MS-TNEF-Correlator: 
> Thread-Topic: specifying the XML schema in the Document object using 
xerces1.4.3
> Thread-Index: AcE1y2PIpfbFlKGsEdWnfgCw0Eg7gw==
> From: "abhishekhp" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> X-OriginalArrivalTime: 05 Sep 2001 05:20:32.0174 (UTC) 
FILETIME=[7BEADCE0:01C135CA]
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
> Content-Transfer-Encoding: 8bit
> X-MIME-Autoconverted: from quoted-printable to 8bit by 
blr-root.India.Sun.COM id KAA29288
> 
> 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]
> 


-- 

Pavani Mukthipudi
Sun Microsystems Inc.

Phone: 080 - 2298989   Extn: 87390


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

Reply via email to