I have some code like this:
DOMParser parser = new DOMParser();

                
parser.setProperty("http://apache.org/xml/properties/dom/document-class-name";,
                                        
"org.apache.xerces.dom.PSVIDocumentImpl");
                        
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);

parser.setFeature("http://xml.org/sax/features/namespaces";, true);
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd";,
false);

I parse xml document as input stream:

<?xml version="1.0" encoding="utf-8"?>
<RootElement xmlns="http://www.example.org/testSchema";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.example.org/testSchema D:\testSchema.xsd">    
</RootElement>

Then I can get psvi info from root in this way:
((ElementPSVI)document.getDocumentElement()).getElementDeclaration();

In the next step i create new node using createElementNS and I add this node
to the root node. I call 
document.normalizeDocument();
to set PSVI in child node but getElementDeclaration returns null all the
same.
I can fix it in this way:
validator.validate(new DOMSource(document), new DOMResult(document));
When I have this line it seems to work propely. getElementDeclaration is not
null.
The questin is why normalizeDocument does not update psvi info in new nodes?
What should I do to get psvi info without validation, only using
normalizeDocument?
                        
-- 
View this message in context: 
http://www.nabble.com/getElementDeclaration-returns-null-tp21410587p21410587.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