You are quite right.. but if the xml is quite large it would be nice to immediately strip all redundancy in the first step. So my xslt would produce a constrained xml for further processing instead of an error list.
Eg. item id= 2 is only copied when exists and value != '' and all items with other id's are discarded.
I would continue to work with this non-redundant constrained xml. Remember it has to be transformed again. Also...
User Profile
Collapse
-
It can not be done in xsd. It lacks full Xpath support. :(
http://www.xml.com/pub/a/2002/04/10/beyondwxs.html
The solution is to apply xslt to validate complex constraints.
I hope this is integrated into xsd very soon! So I don't need to transform/evaluate a document twice.
I opt for first Xslt and then Xsd validation.
Use the xslt for transforming to constrained xml and then validate this...Leave a comment:
-
Xsd is capable of xpath to validate key integrity (constraints)
It seems to me an essential part of validation of structure.
Therefor it would be strange if xsd is not capable to check on a External Id being present in the document .. I still didn't figure out how to "hack" this :)Leave a comment:
-
You are right but I forgot to mention that this is a bit in a recursive xml structure. It would be far more easy to transform first regardless and than validate. the Xml has to be imported and the process has to stop further transformations , db storage if the file is not valid. Ofcourse after informing the uploading user.
But, I prefer to do all validation in a scheme: xsd and existence of item[@Id=2] seems to me part of validation...Leave a comment:
-
Try
<xsl:value-of select="html/head/style/*[name(.) = $cls]/@style"/>Leave a comment:
-
Hi Dormilich, thanx for your reply.
The structure of the xml is indeed easily validated with xsd as are type and content values with patterns or restrictions.
I can't get the "any" declaration to work tho since i have to declare element item in order to validate its structure and the any would allow "item" resulting in a conflict.
Thusfar I am considering 2 options for the problem:...Leave a comment:
-
Xsd - xml must contain element with specific attribute value
Hi,
I have the following 3rd party xml which has to be validated:
For later transformation (xslt) it is required that item Id=2 exists and its attribute Value may not...Code:<Items> <Item Id="1" Value=""/> <Item Id="2" Value="someValue"/> <Item Id="3" Value="someOtherValue"/> </Items>
No activity results to display
Show More
Leave a comment: