[weld-dev] beans.xsd validation forbeans.xml
Nicklas Karlsson
nickarls at gmail.com
Sun Jun 6 16:01:31 EDT 2010
I think this comes from the fact that it's theoretically possible to have
multiple beans.xml entries for a single BDA currently and that is sort of a
cross-beans.xml-check. If Pete nukes the multiple beans.xml support that
should rightfully disappear, I think.
On Sun, Jun 6, 2010 at 10:54 PM, Marcin Mieszek <marcin.mieszek at gmail.com>wrote:
> Hi,
>
> I am working right now on issue:
> Weld WELD-379Use beans.xsd for validation of beans.xml
>
> 1. Currently in MergedElements class there is a logic that checks
> ifsome elements occur more then once, which is not allowed:
>
> private List<BeansXmlElement> getNamedElement(URL url, Element
> beans, String name, XmlMessage multipleViolationMessage)
> {
> List<BeansXmlElement> elements = new ArrayList<BeansXmlElement>();
> NodeList nodeList = beans.getElementsByTagName(name);
> if (nodeList.getLength() > 1)
> {
> throw new WeldXmlException(multipleViolationMessage);
> }
> else if (nodeList.getLength() == 1)
> {
> BeansXmlElement element = BeansXmlElement.of(url,
> nodeList.item(0));
> elements.add(element);
> }
> return elements;
> }
>
>
> Such files arenot valid according to XSD schema neither. I am planning
> to add XSD validation during parsing of the file - it means that it
> won't be possible to get error with message one of:
> @MessageId("001203") MULTIPLE_ALTERNATIVES,
> @MessageId("001204") MULTIPLE_DECORATORS,
> @MessageId("001205") MULTIPLE_INTERCEPTORS,
>
> Please let me know how you would like to proceed with it as it is more
> functional question then technical. For schema errors I will add new
> message XSD_SCHEMA_ERROR.
>
> 2. Minor issue: all test beans.xml files must be changed after adding
> schema validation so that it references correct namespace:
>
> <beans xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
>
> I will prepare the patch for this one as well.
>
> Cheers,
>
> Marcin
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
--
---
Nik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20100606/f374573d/attachment.html
More information about the weld-dev
mailing list