private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) { context.push(); context.registerNamespaces(e); MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e)); String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME); part.setName(partName); String elementAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT); String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); if (elementAttr != null) { if (typeAttr != null) { errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName)); } part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr)); part.setDescriptorKind(SchemaKinds.XSD_ELEMENT); } else if (typeAttr != null) { part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr)); part.setDescriptorKind(SchemaKinds.XSD_TYPE); } else { // XXX-NOTE - this is wrong; for extensibility purposes, // any attribute can be specified on a <part> element, so // we need to put an extensibility hook here errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName)); } context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part); return part; }
private boolean handleExtension( TWSDLParserContextImpl context, TWSDLExtensible entity, Element e) { TWSDLExtensionHandler h = (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI()); if (h == null) { context.fireIgnoringExtension(e, (Entity) entity); errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI())); return false; } else { return h.doHandleExtension(context, entity, e); } }
public QName translateQualifiedName(Locator locator, String s) { if (s == null) return null; String prefix = XmlUtil.getPrefix(s); String uri = null; if (prefix == null) { uri = getDefaultNamespaceURI(); } else { uri = getNamespaceURI(prefix); if (uri == null) { errorReceiver.error(locator, WsdlMessages.PARSING_UNKNOWN_NAMESPACE_PREFIX(prefix)); } } return new QName(uri, XmlUtil.getLocalPart(s)); }
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) { context.pushWSDLLocation(); context.setWSDLLocation(context.getDocument().getSystemId()); new Internalizer(forest, options, errReceiver).transform(); Definitions definitions = parseDefinitionsNoImport(context, root); if(definitions == null){ Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement()); errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId())); } processImports(context); context.popWSDLLocation(); return definitions; }
Definitions definitions, Element e) { context.push(); context.registerNamespaces(e); Message message = new Message(definitions, forest.locatorTable.getStartLocation(e), errReceiver); String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_MESSAGE, message); return message;
private void processImports(TWSDLParserContextImpl context) { for(String location : forest.getExternalReferences()){ if (!context.getDocument().isImportedDocument(location)){ Document doc = forest.get(location); if(doc == null) continue; Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); if(importedDefinitions == null) continue; context.getDocument().addImportedEntity(importedDefinitions); context.getDocument().addImportedDocument(location); } } }
public String getDefaultNamespaceURI() { return getNamespaceURI(""); }
private WSDLDocument buildWSDLDocument(){ /** * Currently we are working off first WSDL document * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents */ String location = forest.getRootWSDL(); //It means that WSDL is not found, an error might have been reported, lets try to recover if(location == null) return null; Document root = forest.get(location); if(root == null) return null; WSDLDocument document = new WSDLDocument(forest, errReceiver); document.setSystemId(location); TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver); Definitions definitions = parseDefinitions(context, root); document.setDefinitions(definitions); return document; }
Definitions definitions, Element e) { context.push(); context.registerNamespaces(e); Message message = new Message(definitions, forest.locatorTable.getStartLocation(e), errReceiver); String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_MESSAGE, message); return message;
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) { context.pushWSDLLocation(); context.setWSDLLocation(context.getDocument().getSystemId()); new Internalizer(forest, options, errReceiver).transform(); Definitions definitions = parseDefinitionsNoImport(context, root); if(definitions == null){ Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement()); errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId())); } processImports(context); context.popWSDLLocation(); return definitions; }
private void processImports(TWSDLParserContextImpl context) { for(String location : forest.getExternalReferences()){ if (!context.getDocument().isImportedDocument(location)){ Document doc = forest.get(location); if(doc == null) continue; Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); if(importedDefinitions == null) continue; context.getDocument().addImportedEntity(importedDefinitions); context.getDocument().addImportedDocument(location); } } }
public String getDefaultNamespaceURI() { return getNamespaceURI(""); }
private WSDLDocument buildWSDLDocument(){ /** * Currently we are working off first WSDL document * TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents */ String location = forest.getRootWSDL(); //It means that WSDL is not found, an error might have been reported, lets try to recover if(location == null) return null; Document root = forest.get(location); if(root == null) return null; WSDLDocument document = new WSDLDocument(forest, errReceiver); document.setSystemId(location); TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver); Definitions definitions = parseDefinitions(context, root); document.setDefinitions(definitions); return document; }
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) { context.push(); context.registerNamespaces(e); MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e)); String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME); part.setName(partName); String elementAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT); String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); if (elementAttr != null) { if (typeAttr != null) { errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName)); } part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr)); part.setDescriptorKind(SchemaKinds.XSD_ELEMENT); } else if (typeAttr != null) { part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr)); part.setDescriptorKind(SchemaKinds.XSD_TYPE); } else { // XXX-NOTE - this is wrong; for extensibility purposes, // any attribute can be specified on a <part> element, so // we need to put an extensibility hook here errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName)); } context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part); return part; }
Definitions definitions, Element e) { context.push(); context.registerNamespaces(e); Message message = new Message(definitions, forest.locatorTable.getStartLocation(e), errReceiver); String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME); context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_MESSAGE, message); return message;
private Definitions parseDefinitions(TWSDLParserContextImpl context, Document root) { context.pushWSDLLocation(); context.setWSDLLocation(context.getDocument().getSystemId()); new Internalizer(forest, options, errReceiver).transform(); Definitions definitions = parseDefinitionsNoImport(context, root); if(definitions == null){ Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement()); errReceiver.error(locator, WsdlMessages.PARSING_NOT_AWSDL(locator.getSystemId())); } processImports(context); context.popWSDLLocation(); return definitions; }
public QName translateQualifiedName(Locator locator, String s) { if (s == null) return null; String prefix = XmlUtil.getPrefix(s); String uri = null; if (prefix == null) { uri = getDefaultNamespaceURI(); } else { uri = getNamespaceURI(prefix); if (uri == null) { errorReceiver.error(locator, WsdlMessages.PARSING_UNKNOWN_NAMESPACE_PREFIX(prefix)); } } return new QName(uri, XmlUtil.getLocalPart(s)); }
private boolean handleExtension( TWSDLParserContextImpl context, TWSDLExtensible entity, Element e) { TWSDLExtensionHandler h = (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI()); if (h == null) { context.fireIgnoringExtension(e, (Entity) entity); errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI())); return false; } else { return h.doHandleExtension(context, entity, e); } }
private void processImports(TWSDLParserContextImpl context) { for(String location : forest.getExternalReferences()){ if (!context.getDocument().isImportedDocument(location)){ Document doc = forest.get(location); if(doc == null) continue; Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); if(importedDefinitions == null) continue; context.getDocument().addImportedEntity(importedDefinitions); context.getDocument().addImportedDocument(location); } } }
public String getDefaultNamespaceURI() { return getNamespaceURI(""); }