of course it is possible, 'cause these are basic needs in processing
XMLs.
1) for the first problem, you should first configure the Factory
instance( either DocumentBuilderFactory or SAXParserFactory ).
factory.setNamespaceAwar( true );
factory.setValidating( true );
// next method throws IllegalArgumentException
factory.setAttribute
( "java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema" ); //
for "XML schema schema"
and then there is 2 ways for associating the schema(s):
I) With a schema declaration in the xml document:
<documentRoot
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='YourSchemaDefinition.xsd'
>
II) By specifying the schema(s) to use in the application.
factory.setAttribute
( "java.sun.com/xml/jaxp/properties/schemaSource",
new File( "YourSchemaDefinition.xsd"; ));
more information at:
java.sun.com/.../JAXPDOM9.html
2) for the second problem, if you're using DOM, you need to obtain
and modify the Text node.
And if you'r using SAX you should override appropriate method(s) of
registered ContentHandler to meet your needs.