- private static Object toQName(final String value, final DataSchemaNode schemaNode,
- final SchemaContext schemaContext) {
- final String moduleName = toModuleName(value);
- final String nodeName = toNodeName(value);
- final Module module = schemaContext.findModules(moduleName).iterator().next();
- for (final IdentitySchemaNode identitySchemaNode : module.getIdentities()) {
- final QName qName = identitySchemaNode.getQName();
- if (qName.getLocalName().equals(nodeName)) {
- return qName;
- }
- }
- return QName.create(schemaNode.getQName().getNamespace(), schemaNode.getQName().getRevision(), nodeName);
- }
-
- private static String toNodeName(final String str) {
- final int idx = str.indexOf(':');
- if (idx == -1) {
- return str;
- }
-
- if (str.indexOf(':', idx + 1) != -1) {
- return str;
- }
-
- return str.substring(idx + 1);
- }
-
- private static String toModuleName(final String str) {
- final int idx = str.indexOf(':');
- if (idx == -1) {
- return null;
- }
-
- if (str.indexOf(':', idx + 1) != -1) {
- return null;
- }
-
- return str.substring(0, idx);
- }
-
- private static QName prepareQName(final MainVarsWrapper variables) {
- checkValid(
- ParserBuilderConstants.Deserializer.IDENTIFIER_FIRST_CHAR
- .matches(currentChar(variables.getOffset(), variables.getData())),
- "Identifier must start with character from set 'a-zA-Z_'", variables.getData(), variables.getOffset());
- final String preparedPrefix = nextIdentifierFromNextSequence(
- ParserBuilderConstants.Deserializer.IDENTIFIER, variables);