cancel
Showing results for 
Search instead for 
Did you mean: 

Check QName is valid

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

How can I check if a QName is valid ? (is in the model (my custom model)) in java


String typeOfDocument = "http://abc:typeXXX";

String [] prefixAndLocalName=QName.splitPrefixedQName(typeOfDocument);
if (typeOfDocument == null){
   logger.error("Problem….");
   return false;
}

QName typeQName = QName.createQName(prefixAndLocalName[0],prefixAndLocalName[1]);

/* Verify that the QName exist TODO ?????*/
…      

Thanks
2 REPLIES 2

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
HI, i believe that NamespacePrefixResolver would help you .

dranakan
Champ on-the-rise
Champ on-the-rise
Thank you savic.prvoslav,

With NamespacePrefixResolver (namespaceService.getNamespaceURI("myPrefix") I can get a valid URI to create a QName.
A QName is a URI and localname. With NamespacePrefixResolver I am sure that the URI is OK.

But how can I do to be sure to use a valid localname ?

Thanks