If it isn't already in the DOM try adding it to the root element using
setAttributeNS() [1] before you serialize.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Element.html#setAttributeNS(java.lang.String,%20java.lang.String,%20java.lang.String)

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

"Heinrich Roman" <[EMAIL PROTECTED]> wrote on 03/06/2008 08:58:52
AM:

> Either attaching  xsi:noNamespaceSchemaLocation or directly
> embedding xsd schema to xml.
>
>
> -----Ursprüngliche Nachricht-----
> Von: Michael Glavassevich [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 06. März 2008 14:57
> An: j-users@xerces.apache.org
> Betreff: Re: DOM document serialization question
>
> By attach do you mean adding the 'xsi:noNamespaceSchemaLocation'
> attribute to the root element of your document?
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]
>
> "Heinrich Roman" <[EMAIL PROTECTED]> wrote on 03/06/2008 07:55:50
> AM:
>
> > Hello,
> > I have an DOM document, which I want to serialize and I want also to
> > attach xsd document inside the generated xml.
> > The ouput should be like this:
> > <?xml version="1.0" encoding="ISO-8859-1"?> <shiporder
> > orderid="889923"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > xsi:noNamespaceSchemaLocation="shiporder.xsd">
> >  <orderperson>John Smith</orderperson>  <shipto>
> >   <name>Ola Nordmann</name>
> >   <address>Langgt 23</address>
> >   <city>4000 Stavanger</city>
> >   <country>Norway</country>
> >  </shipto>
> >  <item>
> >   <title>Empire Burlesque</title>
> >   <note>Special Edition</note>
> >   <quantity>1</quantity>
> >   <price>10.90</price>
> >  </item>
> >  <item>
> >   <title>Hide your heart</title>
> >   <quantity>1</quantity>
> >   <price>9.90</price>
> >  </item>
> > </shiporder>
> > Or it`s possible to have shiporder.xsd direct inside xml ?
> > Can anybody provide me with an example ?
> > Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to