Hello and thanks it works perfectly.

I have just an understanding question;
I began with difficulty to understand how to use different DOM Level, but
correct me if misunderstood but Level3 is the most complete actually?
I think for me it was the best way to realize what i need. Because it
permits to validate with method "normalizeDocument()" and errorHandler link
to unvalid Node. I don't have found this kind of functionality from other
DOM Level or from JAXP Validator.

An ultimate question, 
For the moment it isn't possible to validate only an element or attribute?

thanks for all.



Michael Glavassevich-3 wrote:
> 
> Hello,
> 
> The value of the 2nd parameter of setAttributeNS() [1] is supposed to be a
> qualified named and needs to start with "xmlns:" or be "xmlns" for a
> namespace declaration.
> 
> Try:
> 
> parent.setAttributeNS
> (XMLConstants.XMLNS_ATTRIBUTE_NS_URI,"xmlns:"+prefix,desc.getNamespaceURI
> ());
> 
> instead of:
> 
> parent.setAttributeNS
> (XMLConstants.XMLNS_ATTRIBUTE_NS_URI,prefix,desc.getNamespaceURI());
> 
> Thanks.
> 
> [1]
> http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetAttrNS
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrgla...@ca.ibm.com);
> E-mail: mrgla...@apache.org
> 
> juho <j.houll...@gmail.com> wrote on 08/20/2009 04:57:05 AM:
> 
>> Hello,
>>
>> I want to add namespaces declaration on parent if child and parent have
>> different namespaces.
>> My wish is to have output like that:
>>
>> <balise1 xmlns:tec="http://test1";>
>>   <tec:balise2 />
>>   <tec:balise3 />
>> </balise>
>>
>> instead of what i have actually
>> <balise1>
>>   <tec:balise2 xmlns:tec="http://test1"/>
>>   <tec:balise3 xmlns:tec="http://test1"/>
>> </balise1>
>>
>> I tried to obtain that with
>>
>> parent.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,prefix,
>> desc.getNamespaceURI());
>>
>> but it generates exception :
>> org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or
>> change an object in a way which is incorrect with regard to namespaces.
>>    at org.apache.xerces.dom.AttrNSImpl.setName(Unknown Source)
>>    at org.apache.xerces.dom.AttrNSImpl.<init>(Unknown Source)
>>    at org.apache.xerces.dom.PSVIAttrNSImpl.<init>(Unknown Source)
>>    at org.apache.xerces.dom.PSVIDocumentImpl.createAttributeNS(Unknown
> Source)
>>    at org.apache.xerces.dom.ElementImpl.setAttributeNS(Unknown Source)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> createElement(DocumentBuilderFromXSD.java:261)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> setMandatories(DocumentBuilderFromXSD.java:333)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> createElement(DocumentBuilderFromXSD.java:283)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> setMandatories(DocumentBuilderFromXSD.java:333)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> createElement(DocumentBuilderFromXSD.java:283)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> setMandatories(DocumentBuilderFromXSD.java:333)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> createElement(DocumentBuilderFromXSD.java:283)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> createRoot(DocumentBuilderFromXSD.java:130)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> <init>(DocumentBuilderFromXSD.java:81)
>>    at
>> org.tdf.tpegPlugin.parser.DocumentBuilderFromXSD.
>> <init>(DocumentBuilderFromXSD.java:67)
>>    at org.tdf.tpegPlugin.Main.main(Main.java:52)
>> --
>> View this message in context: http://www.nabble.com/Add-namespaces-
>> declaration-to-parent-element.-tp25058380p25058380.html
>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
>> For additional commands, e-mail: j-users-h...@xerces.apache.org
> 

-- 
View this message in context: 
http://www.nabble.com/Add-namespaces-declaration-to-parent-element.-tp25058380p25062351.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to