Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.xml,microsoft.public.vsnet.vstools.office
external usenet poster
 
Posts: 70
Default Validating data at data entry and XSD

Hi,
Apologies for the multi-post; I am not sure where this question belongs. I
am fairly new to XML.

I have an XML Schema that includes restrictions (such as data types, valid
values, data length ...) - see snippet below

Although Excel will validate the data against the schema at save time, I
need real-time validation. I thought it might be possible to achieve this
with some vba code byu copying the restrictions to Excel's own validation.

I can import(Add) the schema into an XML map, but then I don't know how to
read the schema to set the data validation
The example in the help file is not very helpful - or it indicates that the
programmer must know the schema before addng it to an XML Map.

The pseudo code for what I want to achieve is
import schema file
create list object
for each element or attribute in schema,
map to column
read element restrictions
add column validation - this may not be fully implementable as XSD
schema restrictions can be fairly powerful
move to next column
next element

Thanks in advance for any suggestions /advice

HS
--------------------------------
<?xml version="1.0" encoding="UTF-8"?
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsd:element name="Dalexml" nillable="true"
<xsd:complexType
<xsd:sequence minOccurs="0"
<xsd:element name="inventoryItem" form="unqualified" nillable="true"
minOccurs="0" maxOccurs="unbounded"
<xsd:complexType
<xsd:sequence
<xsd:element name="handle" minOccurs="0"/
<xsd:element name="name" form="unqualified" nillable="true"
minOccurs="0"
<xsd:simpleType
<xsd:restriction base="xsd:string"/
</xsd:simpleType
</xsd:element
<xsd:element name="displayName" form="unqualified" nillable="true"
minOccurs="0"
<xsd:simpleType
<xsd:restriction base="xsd:string"
<xsd:maxLength value="60"/
<xsd:minLength value="1"/
<xsd:whiteSpace value="preserve"/
</xsd:restriction
</xsd:simpleType
</xsd:element
<!-- snip remaining elements --
</xsd:sequence
</xsd:complexType
</xsd:element
</xsd:sequence
</xsd:complexType
</xsd:element
</xsd:schema

-----------------------------


strSchemaLocation = "C:\temp\testschema3.xsd"
ActiveWorkbook.XmlMaps.Add(strSchemaLocation, "Dalexml").Name =
"Dalexml_Map"

' Specify the schema map to use.
Set InvMap = ActiveWorkbook.XmlMaps("Dalexml_Map")

' Create a new list.
Set lstInv = ActiveSheet.ListObjects.Add

' Specify the first element to map.Can I "extract" the path for dynamic
mapping?
strXPath = "/Dalexml/inventoryItem/Name" ' <<< do I have to know the
path?

' Map the element.
lstContacts.ListColumns(1).XPath.SetValue InvMap, strXPath




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing [email protected] Excel Discussion (Misc queries) 0 March 20th 08 12:45 PM
Connecting of two data validating with each other Akhil Excel Worksheet Functions 1 August 10th 06 09:01 PM
Validating entry in ComboBox LAF Excel Discussion (Misc queries) 0 September 29th 05 08:45 PM
Validating excel entry... simonchia[_2_] Excel Programming 1 October 28th 04 12:48 PM
Validating Entry into Textbox Brad[_11_] Excel Programming 1 December 4th 03 02:58 PM


All times are GMT +1. The time now is 06:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"