My xml file is
<?xml version="1.0" encoding="UTF-8"?>
<edge xmlns="http://www.example.org/stext">
<ellipse rx="189" ry="22" cx="279" cy="531"
style="fill:#FFFDFD;stroke:#000000;" id="Ellipse_23" isLocked="false" />
<ellipse rx="130" ry="38" cx="580" cy="393"
style="fill:#FFFDFD;stroke:#000000;" id="Ellipse_19" isLocked="false" />
<ellipse rx="172" ry="92" cx="539" cy="245"
style="fill:#BD7272;stroke:#D9B5B5;" id="Ellipse_20" isLocked="false" />
<circle r="51" cx="426" cy="284" style="fill:#BD7272;stroke:#D9B5B5;"
id="Circle_16" isLocked="false" />
<circle r="45" cx="428" cy="397" style="fill:#FFFDFD;stroke:#302E2E;"
id="Circle_17" isLocked="false" />
</edge>
This is my XSD schema
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/stext"
xmlns:tns="http://www.example.org/stext" elementFormDefault="qualified">
<element name="edge">
<complexType>
<sequence>
<element name="circle" maxOccurs="unbounded">
<complexType>
<attribute name="r" type="int" />
<attribute name="cx" type="int" />
<attribute name="cy" type="int" />
<attribute name="style" type="string" />
<attribute name="id" type="string" />
<attribute name="isLocked" type="boolean" />
</complexType>
</element>
<element name="ellipse" maxOccurs="unbounded">
<complexType>
<attribute name="rx" type="int" />
<attribute name="ry" type="int" />
<attribute name="cx" type="int" />
<attribute name="cy" type="int" />
<attribute name="style" type="string" />
<attribute name="id" type="string" />
<attribute name="isLocked" type="boolean" />
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
I faced this kind of exception
Exception: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ellipse'. One of '{"http://www.example.org/stext":circle}' is expected.
This happens, because <sequence> imposes a specific order.
I think what might solve your problem, is to use an additional xsd:choice element.
If you write it like
<sequence>
<choice maxOccurs="unbounded">
<element name="circle">
<complexType>
<attribute name="r" type="int" />
<attribute name="cx" type="int" />
<attribute name="cy" type="int" />
<attribute name="style" type="string" />
<attribute name="id" type="string" />
<attribute name="isLocked" type="boolean" />
</complexType>
</element>
<element name="ellipse">
<complexType>
<attribute name="rx" type="int" />
<attribute name="ry" type="int" />
<attribute name="cx" type="int" />
<attribute name="cy" type="int" />
<attribute name="style" type="string" />
<attribute name="id" type="string" />
<attribute name="isLocked" type="boolean" />
</complexType>
</element>
</choice>
</sequence>
that would allow for multiple circle OR ellipse elements in any order.
Related
Please help us out in understanding what this node in the applicationHost.config mean:
Basically we need to know what are these property ids? I guess they are leaving the website in an unstable condition and most probably corrupting the bindings.
<customMetadata>
<key path="LM/W3SVC">
<property id="130001" dataType="String" userType="2" attributes="Inherit" value="BITS-Sessions" />
<property id="130002" dataType="String" userType="2" attributes="Inherit" value="18446744073709551615" />
<property id="130003" dataType="DWord" userType="2" attributes="Inherit" value="1209600" />
<property id="130004" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130005" dataType="String" userType="2" attributes="Inherit" value="" />
<property id="130007" dataType="String" userType="2" attributes="Inherit" value="" />
<property id="130008" dataType="DWord" userType="2" attributes="Inherit" value="86400" />
<property id="130010" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130011" dataType="DWord" userType="2" attributes="Inherit" value="1" />
<property id="130012" dataType="DWord" userType="2" attributes="Inherit" value="12" />
<property id="130013" dataType="DWord" userType="2" attributes="Inherit" value="1" />
<property id="130014" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130015" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130016" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="130017" dataType="DWord" userType="2" attributes="Inherit" value="50" />
<property id="130018" dataType="DWord" userType="2" attributes="Inherit" value="0" />
<property id="2073" dataType="MultiSZ" userType="1" attributes="Inherit" value="C:\windows\system32\bitssrv.dll
" />
</key>
<key path="LM/W3SVC/INFO">
<property id="4012" dataType="String" userType="1" attributes="Inherit" value="NCSA Common Log File Format,Microsoft IIS Log File Format,W3C Extended Log File Format,ODBC Logging" />
<property id="2120" dataType="MultiSZ" userType="1" attributes="None" value="400,0,,,0
" />
</key>
</customMetadata>
I am new to mobicents diameter and followed the example downloaded here.
Executing both ExampleClient and ExampleServer on the same machine with different ports the "Result-code" is 3002
"Error-message" is "No connection to peer"
Where am I wrong?
Protocol error:
DIAMETER_UNABLE_TO_DELIVER 3002
This error is given when Diameter can not deliver the message to
the destination, either because no host within the realm
supporting the required application was available to process the
request, or because Destination-Host AVP was given without the
associated Destination-Realm AVP.
client-jdiameter-config.xml
<?xml version="1.0"?>
<Configuration xmlns="http://www.jdiameter.org/jdiameter-server">
<LocalPeer>
<URI value="aaa://127.0.0.1:1812" />
<IPAddresses>
<IPAddress value="127.0.0.1" />
</IPAddresses>
<Realm value="mobicents.org" />
<VendorID value="0" />
<ProductName value="jDiameter" />
<FirmwareRevision value="1" />
<OverloadMonitor>
<Entry index="1" lowThreshold="0.5" highThreshold="0.6">
<ApplicationID>
<VendorId value="0" />
<AuthApplId value="333333" />
<AcctApplId value="0" />
</ApplicationID>
</Entry>
</OverloadMonitor>
</LocalPeer>
<Parameters>
<AcceptUndefinedPeer value="false" />
<DuplicateProtection value="true" />
<DuplicateTimer value="240000" />
<UseUriAsFqdn value="false" />
<QueueSize value="10000" />
<MessageTimeOut value="60000" />
<StopTimeOut value="10000" />
<CeaTimeOut value="10000" />
<IacTimeOut value="30000" />
<DwaTimeOut value="10000" />
<DpaTimeOut value="5000" />
<RecTimeOut value="10000" />
<Concurrent>
<Entity name="ThreadGroup" size="64" />
<Entity name="ProcessingMessageTimer" size="1" />
<Entity name="DuplicationMessageTimer" size="1" />
<Entity name="RedirectMessageTimer" size="1" />
<Entity name="PeerOverloadTimer" size="1" />
<Entity name="ConnectionTimer" size="1" />
<Entity name="StatisticTimer" size="1" />
</Concurrent>
</Parameters>
<Network>
<Peers>
<Peer name="aaa://127.0.0.1:3868" attempt_connect="true" rating="1" />
</Peers>
<Realms>
<Realm name="mobicents.org" peers="127.0.0.1"
local_action="LOCAL" dynamic="false" exp_time="1">
<ApplicationID>
<VendorId value="0" />
<AuthApplId value="333333" />
<AcctApplId value="0" />
</ApplicationID>
</Realm>
</Realms>
</Network>
<Extensions />
</Configuration>
server-jdiameter-config.xml
<?xml version="1.0"?>
<Configuration xmlns="http://www.jdiameter.org/jdiameter-server">
<LocalPeer>
<URI value="aaa://127.0.0.1:3868" />
<IPAddresses>
<IPAddress value="127.0.0.1" />
</IPAddresses>
<Realm value="mobicents.org" />
<VendorID value="0" />
<ProductName value="jDiameter" />
<FirmwareRevision value="1" />
<OverloadMonitor>
<Entry index="1" lowThreshold="0.5" highThreshold="0.6">
<ApplicationID>
<VendorId value="0" />
<AuthApplId value="333333" />
<AcctApplId value="0" />
</ApplicationID>
</Entry>
</OverloadMonitor>
</LocalPeer>
<Parameters>
<!-- set to true, we can safely remove client def in this case -->
<AcceptUndefinedPeer value="true" />
<DuplicateProtection value="true" />
<DuplicateTimer value="240000" />
<UseUriAsFqdn value="false" />
<QueueSize value="10000" />
<MessageTimeOut value="60000" />
<StopTimeOut value="10000" />
<CeaTimeOut value="10000" />
<IacTimeOut value="30000" />
<DwaTimeOut value="10000" />
<DpaTimeOut value="5000" />
<RecTimeOut value="10000" />
<Concurrent>
<Entity name="ThreadGroup" size="64" />
<Entity name="ProcessingMessageTimer" size="1" />
<Entity name="DuplicationMessageTimer" size="1" />
<Entity name="RedirectMessageTimer" size="1" />
<Entity name="PeerOverloadTimer" size="1" />
<Entity name="ConnectionTimer" size="1" />
<Entity name="StatisticTimer" size="1" />
</Concurrent>
</Parameters>
<Network>
<Peers>
<!-- our client, lets define it -->
<Peer name="aaa://127.0.0.1:1812" attempt_connect="false"
rating="1" />
</Peers>
<Realms>
<Realm name="mobicents.org" peers="127.0.0.1" local_action="LOCAL" dynamic="false" exp_time="1">
<ApplicationID>
<VendorId value="0" />
<AuthApplId value="333333" />
<AcctApplId value="0" />
</ApplicationID>
</Realm>
</Realms>
</Network>
<Extensions />
</Configuration>
I am new in NHibernate.i am facing problem with nhibernate when i hit query on main table it gives me main table records but as well as it is also giving me related linked object tables records.So because of this more sql query hit on database.
which decrease performance of my query.i want only main table records and not fired any other query from database.
I want TAPVendor table records only
Below is my C# code from where i am fired query from database
var lstTAPVendor = session.Query< TAPVendor >()
i have also attached the .hbm file of tapvendor
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping namespace="M3.Entities" assembly="M3.Entities" xmlns="urn:nhibernate-mapping-2.2">
<class name="TAPVendor" table="tAPVendor" schema="dbo">
<id name="FVendorID" type="Guid">
<generator class="assigned" />
</id>
<version name="FTimestamp" generated="always" unsaved-value="null" type="BinaryBlob">
<column name="FTimestamp" not-null="true" sql-type="timestamp"/>
</version>
<property name="FActive" type="Boolean" not-null="true" />
<property name="FTermsType" type="Int32" precision="10" not-null="true" />
<property name="FACHPayment" type="Boolean" not-null="true" />
<property name="FCompanyName" type="String" length="50" not-null="true" />
<property name="FAccrueUseTax" type="Boolean" not-null="true" />
<property name="FSinglePaymentVendor" type="Boolean" not-null="true" />
<property name="FACHEnabled" type="Boolean" not-null="true" />
<property name="FCheckPerInvoice" type="Boolean" not-null="true" />
<property name="FBankAccountType" type="Int32" precision="10" not-null="true" />
<property name="FBankAccountName" type="String" length="50" />
<property name="FBankAccountNumber" type="String" length="50" />
<property name="FBankABANumber" type="String" length="50" />
<property name="FLegalName" type="String" length="50" />
<property name="FDateAdded" type="DateTime" />
<property name="FAddedBy" type="String" length="50" />
<property name="FDateModified" type="DateTime" />
<property name="FModifiedBy" type="String" length="50" />
<property name="FAccountNo" type="Double" precision="53" />
<property name="FDescription" type="String" length="100" />
<property name="FTerms" type="Int32" precision="10" />
<property name="F1099Box" type="Int16" precision="5" />
<property name="F1099Type" type="String" length="15" />
<property name="FTaxID" type="String" length="10" />
<property name="FSSN" type="String" length="11" />
<property name="FVendorNo" type="String" length="10" />
<property name="FAccountNo2" type="Double" precision="53" not-null="false" />
<property name="FIsUseAccountNo2" type="Boolean" not-null="true" />
<many-to-one name="TAddres" class="TAddres" column="fAddressID" />
<many-to-one name="TSCCompany" class="TSCCompany" column="fCompanyID" />
<many-to-one name="TContact" class="TContact" column="fContactID" />
<many-to-one name="TSCEnterprise" class="TSCEnterprise" column="fEnterpriseID" />
<many-to-one name="TSCProperty" class="TSCProperty" column="fPropertyID" />
<set name="TAPInvoices" table="tAPInvoice" inverse="true">
<key column="fVendorID" />
<one-to-many class="TAPInvoice" />
</set>
<set name="TBAChecks" table="tBACheck" inverse="true">
<key column="fVendorID" />
<one-to-many class="TBACheck" />
</set>
<set name="TAPRecurringInvoices" table="tAPRecurringInvoice" inverse="true">
<key column="fVendorID" />
<one-to-many class="TAPRecurringInvoice" />
</set>
<set name="TGLPostMasters" table="tGLPostMaster" inverse="true">
<key column="fVendorID" />
<one-to-many class="TGLPostMaster" />
</set>
</class>
</hibernate-mapping>
There are some solutions, from easy to hard -
1. Remove the <set> mappings, or create another entity without them.
2. Set all <set lazy="true">...</set> the fetch will occur only on accessing these properties.
3. Create a DTO (data transfer object) entity, a lite version, and use to NHibernate.Projections library to fetch properties selectively.
4. Set <set fetch="join">...</set> to fetch all data in one joined query, this might duplicate your records, so be careful.
And in general, NH separating the queries is not necessarily bad, JOIN on big tables can cause much bigger performance hit. Your issues might not be a mapping issue, it might be DB or code issue.
This Advanced Find Fetch XML retrieves all Cases that have associated Service Activities:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<attribute name="title" />
<attribute name="ticketnumber" />
<attribute name="createdon" />
<attribute name="incidentid" />
<order attribute="title" descending="false" />
<link-entity name="serviceappointment" from="wl_serviceactivitiesid" to="incidentid" alias="aa">
</link-entity>
</entity>
What would be the Fetch XML or View logic to show all Cases that do not have associated Service Activities.
Can there be a not before the :
<link-entity>
I'm thinking this may work:
Basically it does an outer join to the serviceappointment, then excludes any items that have a primary key.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<attribute name="title" />
<attribute name="ticketnumber" />
<attribute name="createdon" />
<attribute name="incidentid" />
<order attribute="title" descending="false" />
<link-entity name="serviceappointment" from="wl_serviceactivitiesid" to="incidentid" alias="aa" link-type="outer">
<filter type="and">
<condition attribute="wl_serviceactivitiesid" operator="null" />
</filter>
</link-entity>
</entity>
I'm trying to make an XML schema, and not having too much success. there's a construct I don't understand ... here's what I have so far for the schema, followed by the XML file I'm trying to make it for .. any suggestions?
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="CorbelFile">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="Project" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:group name="Project">
<xsd:sequence>
<xsd:element name="ADProductID"
type="xsd:string" />
<xsd:element name="ADProductID"
type="xsd:string" />
<xsd:element name="ADProductName"
type="xsd:string" />
<xsd:element name="ADProductVersion"
type="xsd:string" />
<xsd:element name="ADProjectId"
type="xsd:string" />
<xsd:element name="ADProjectName"
type="xsd:string" />
<xsd:element name="ADFileLoc"
type="xsd:string" />
<xsd:group ref="Answers"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="Answers">
<xsd:sequence>
<xsd:element name="var"/>
</xsd:sequence>
</xsd:group>
</xsd:schema>
XML
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<CorbelFile>
<Project>
<ADProductId>28359</ADProductId>
<ADProductName>IDP 403(b)</ADProductName>
<ADProductVersion>7.0</ADProductVersion>
<ADProjectId>00010001</ADProjectId>
<ADProjectName>Independence Dental Center PS</ADProjectName>
<ADFileLoc>C:\Program Files\Relius\Docs\dp_data\1\0\00010001.ck2</ADFileLoc>
<answers>
<Var Ld="PKGA" />
<Var Ld="BKTHead2" />
<Var Ld="SingleSpace" />
<Var Ld="MarginRagged" />
<Var Ld="SPDTimes" />
<Var Ld="BKTTimes" />
<Var Ld="PlanNameB" />
<Var Ld="ERPYEnds" />
<Var Ld="InitialEffDate" />
<Var Ld="2000SafHarEnhancMatch" />
<Var Ld="StateCollege" />
<Var Ld="CharityCorp" />
<Var Ld="ExceptEEPartTime">Independence</Var>
<Var Ld="ExceptEEStudent">Missouri</Var>
<Var Ld="ExceptEENonResAliens">11500 East 23rd Street</Var>
<Var Ld="ExceptEECollBargAgree">64052</Var>
<Var Ld="EEExclNA">(816) 254-7200</Var>
<Var Ld="NoExclElig">43-1118440</Var>
<Var Ld="ACP2000CurrentYR">001</Var>
<Var Ld="ExceptEEHR" />
<Var Ld="1YRAndHalfServReq">Profit Sharing Plan and Trust</Var>
<Var Ld="YRServReq">Independence Dental Center, Inc.</Var>
<Var Ld="Age21">INDEPENDENCE DENTAL CENTER, INC.</Var>
<Var Ld="AgeOther">PROFIT SHARING PLAN AND TRUST</Var>
<Var Ld="1stDayMonth">September 30</Var>
<Var Ld="1stDayPYNextFollowing">October 1</Var>
<Var Ld="CompExclOT">September 30</Var>
<Var Ld="CompExcl414s">October 1</Var>
<Var Ld="CompSalRed">December 12, 1963</Var>
<Var Ld="NASRA" />
<Var Ld="ACPPreYR" />
<Var Ld="QNECPY" />
<Var Ld="QNEC500HRs" />
<Var Ld="QNECYOS" />
<Var Ld="ShareDiscrYOSEndPY" />
<Var Ld="ForfeitRedERContr" />
<Var Ld="7YRGrade" />
<Var Ld="MinDistCYAftr2000">Brad Babcock</Var>
<Var Ld="MinDistCYAftr2001">Lauren Carr</Var>
<Var Ld="NServPriorEffDate" />
<Var Ld="1999SafeHarbContr">John Smith</Var>
<Var Ld="NRD1stDayMonth" />
<Var Ld="NRAPartAnnivBDay1" />
<Var Ld="NERD" />
<Var Ld="NDistrJSA" />
<Var Ld="Multi2ndERCityStateZip" />
<Var Ld="2000SafHarNonElectOthrPln" />
<Var Ld="TermDistrImmed" />
<Var Ld="YTransRoll403b" />
<Var Ld="LoansNA" />
<Var Ld="Loans10000DeMin" />
<Var Ld="LoansSRALimit" />
<Var Ld="YDirInv" />
<Var Ld="DirInvRollTrans" />
<Var Ld="HrdshipSafeHarb401k" />
<Var Ld="EmployerPhone" />
<Var Ld="NMulti2ndER" />
<Var Ld="Multi2ndERName" />
<Var Ld="YMulti3rdER" />
<Var Ld="Multi3rdERStreet" />
<Var Ld="Multi4thEIN" />
<Var Ld="Multi5thERStreet" />
<Var Ld="SumPlanOnly" />
<Var Ld="YPSBKT" />
<Var Ld="YSBJPA" />
<Var Ld="NAPriorCurrentYRTestMethP" />
<Var Ld="NHCPContrPost973Perc" />
<Var Ld="NComplyGATTUSERRASBJPATRA" />
<Var Ld="NSafeHarbMatch" />
<Var Ld="DeferBenOption" />
<Var Ld="PayOldAnnuitDate">59 1/2</Var>
<Var Ld="NAHrdshipSafeHarb401k">60th</Var>
<Var Ld="VServ3" />
<Var Ld="VServ6" />
<Var Ld="VPerc1" />
<Var Ld="VPerc6" />
<Var Ld="ACPCurrentPre97" />
<Var Ld="ACPCurrentPre98" />
<Var Ld="YDiscrMC4PercCompPost99PY" />
<Var Ld="EG_Hrdshp_Suspensn_Red_N" />
<Var Ld="EG_Suspensn_2001_NA" />
</answers>
</Project>
<Project>
<ADProductId>83</ADProductId>
<ADProductName>IDP Money Purchase/Target</ADProductName>
<ADProductVersion>2.0</ADProductVersion>
<ADProjectId>00010002</ADProjectId>
<ADProjectName>Independence Dental Center MP</ADProjectName>
<ADFileLoc>C:\Program Files\Relius\Docs\dp_data\2\0\00010002.ck2</ADFileLoc>
<answers />
</Project>
<Project>
<ADProductId>24581</ADProductId>
<ADProductName>IDP Revised SA</ADProductName>
<ADProductVersion>10.0</ADProductVersion>
<ADProjectId>000102C9</ADProjectId>
<ADProjectName>2010 - Hanover - Trustee</ADProjectName>
<ADFileLoc>C:\Program Files\Relius\Docs\dp_data\9\C\000102C9.ck2</ADFileLoc>
<answers>
<Var Ld="NShortAmendment" />
<Var Ld="PASMM" />
<Var Ld="PACorpResol" />
<Var Ld="PTimes" />
<Var Ld="SPDTimes" />
<Var Ld="CorbelClientNameA">AMERICAN FIDUCIARY CORPORATION</Var>
<Var Ld="SA401kProfitSharing" />
<Var Ld="EmployerNameA">Hanover Obstetrics & Gynecology, Inc.</Var>
<Var Ld="Corp" />
<Var Ld="EmployerStreet">135 Webster Street</Var>
<Var Ld="EmployerCity">Hanover</Var>
<Var Ld="EmployerState">Massachusetts</Var>
<Var Ld="EmployerZip">02339</Var>
<Var Ld="EmployerPhone">(781) 878-7020</Var>
<Var Ld="EIN">04-2477545</Var>
<Var Ld="PlanNumOther">001</Var>
<Var Ld="PlanNameA">Hanover Obstetrics & Gynecology, Inc.</Var>
<Var Ld="PlanNameB">401(k) Profit Sharing Plan</Var>
<Var Ld="AmendmentOne" />
<Var Ld="AmendDate">August 1, 2010</Var>
<Var Ld="NWitnessLine" />
<Var Ld="PlanAdminERAddress" />
<Var Ld="IndivTrustee" />
<Var Ld="DesignatedAmendments" />
<Var Ld="401KfeaturesNoChange" />
<Var Ld="DiscrContrNoChange" />
<Var Ld="DistributionsAmendNo" />
<Var Ld="MiscAmendYes" />
<Var Ld="NoChangeCompDefinition" />
<Var Ld="NLoans" />
<Var Ld="HCENoChange" />
<Var Ld="NElimOfFamAggreg" />
<Var Ld="AddTransRollNo" />
<Var Ld="PYFYNoChange" />
<Var Ld="ChangeTrustNameYes" />
<Var Ld="ChangedTrustee1Name">Albert Marcus, M.D.</Var>
<Var Ld="ChangedTrustee1EffDate">August 1, 2010</Var>
<Var Ld="ChangedTrustee1Removed" />
<Var Ld="MergFreezeTermNA" />
<Var Ld="NERAdopt" />
<Var Ld="RelDate" />
</answers>
</Project>
In Visual Studio open your xml file, go for the "XML" menu, select "Create Schema".
Instead of using a group, define "Var" as an element with an "Ld" attribute:
<complexType name="Var">
<annotation>
<documentation>
Description of what a Var is
</documentation>
</annotation>
<attribute name="Ld" type="string">
<annotation>
<documentation>
Description of what this attribute means
</documentation>
</annotation>
</attribute>
</complexType>
The define the list of answers:
<complexType name="Answers">
<annotation>
<documentation>
A list of Var elements
</documentation>
</annotation>
<sequence>
<element name="Var" type="Var" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>
The list of Var elements
</documentation>
</annotation>
</element>
</sequence>
</complexType>
Then instead of this:
<xsd:group ref="Answers"
minOccurs="0"
maxOccurs="unbounded"/>
You'd use this:
<element name="answers" type="Answers"/>
Also, a good rule of thumb is to make the default namespace match the type of file you're writing. So if you're writing a schema, put this in the root element instead and you won't have to write "xsd" prefixes everywhere:
xmlns="http://www.w3.org/2001/XMLSchema"
And it's also a good idea to create a target namespace for your schema so that your elements have an associated namespace:
targetNamespace="http://my.example.com/schema"
xmlns:mec="http://my.example.com/schema"
Which would mean your elements would be referred to as type="mec:Project" instead of just "Project" and therefore prevent any future problems when using this schema in conjunction with another one.
How to define an element to contain only text but also an attribute
Generally type of elements with only text content has to be xs:simpleType. In this case this causes a problem, because type definition of elements that can contain attributes (or other elements) must be xs:complexType. The solution is to use xs:simpleContent to allow text only and xs:extension to extend this type with the desired attributes.
Creating complex text-only elements
xs:simpleContent is used to derive types from other built-in or previously defined types. It requires either xs:extension or xs:restriction child element with attribute base that defines the base type (simple) that you will extend or restrict. In this case the base type can be xs:string. xs:extension or xs:restriction contains the desired new features.
<xs:element name="var">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Ld" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Several attribute definitions can added inside xs:extension - in this case we only needed one. xs:simpleContent cannot contain any element definitions, only new attributes. If the base type is not the same as any of the built-in schema datatypes, for example if the text has some length restrictions, you must define the base type as a global simple type definition and use its name in the base attribute.
Allowing text inside elements that can contain other elements is simpler: just use <xs:complexType mixed="true"> when defining the element contents.