LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using VI "Load XML File", why does regular expression "1|2|4|8|16|32|64|128|256" not match "256" ?

In my XSD file, I have:

 

	<xs:attribute name="bufferSize">
		<xs:simpleType>
			<xs:restriction base="xs:unsignedInt">
				<xs:pattern value="1|2|4|8|16|32|64|128|256"/>
			</xs:restriction>
		</xs:simpleType>
	</xs:attribute>

 

 

In my XML file, I have:

	<myElement bufferSize="256"/>

 

 

However, when I invoke VI "Load XML File", I find the following parse errors:

   Message: Datatype error: Type:InvalidDatatypeValueException, Message:Value '256' does not match regular expression facet '1|2|4|8|16|32|64|128|256'.

 

I have also tried:

      

<xs:pattern value="(1)|(2)|(4)|(8)|(16)|(32)|(64)|(128)|(256)"/>

 

 

 

 

 

 

0 Kudos
Message 1 of 4
(3,033 Views)

I think instead of quotes you should use square braces:

[1|2|4|8|16|32|64|128|256]

 

Though I'm not too familiar with XML, that is how you would do it with LabVIEW

Cory K
Message 2 of 4
(3,018 Views)

I'm not hip to XML, but I know that your expression will match the 2 in 256 before it matches what you're looking for.  You'll need to reverse the order of your regular expression.

Example_VI.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 4
(3,001 Views)

 


@jcarmody wrote:

I'm not hip to XML, but I know that your expression will match the 2 in 256 before it matches what you're looking for.  You'll need to reverse the order of your regular expression.

Example_VI.png


 

Thats a good catch.

Of course Jim would jump all over a regex question Smiley Wink

Cory K
0 Kudos
Message 4 of 4
(2,991 Views)