java - XML schema delete section when saving -
i creating xml schema (first time doing so). working eclipse validate xml project. while fixing problem on eclipse, ellipse automatically erase large chunk of project have worked on hours , not on come this, original:
<?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:sample="http://www.example" targetnamespace="http://www.example.com" elementformdefault="qualified"> <!-- define nodename --> <xsd:element name="nodename" > <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="struct"> <xsd:complextype> <xsd:sequence> <xsd:element name="attribute" minoccurs="1" maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="field" minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="interface"> <xsd:complextype> <xsd:sequence> <xsd:element name="attribute" minoccurs="1" maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="channel" minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="direction" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="component"> <xsd:complextype> <xsd:sequence> <xsd:element name="attribute" minoccurs="1" maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="field" minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="value" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="constructor"> </xsd:element> <xsd:element name="behaviour"> <xsd:complextype> <xsd:sequence> <xsd:element name=send minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="identifier" type="xsd:string" /> <xsd:attribute name="on" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name=receive minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="identifier" type="xsd:string" /> <xsd:attribute name="from" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name=variable minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="allocation" type="xsd:string" /> <xsd:attribute name="bindingto" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name=print minoccurs="0" maxoccurs="unbounded"> <xsd:complextype> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="variable" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="instance"> <xsd:complextype> <xsd:attribute name="component" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="connect"> <xsd:complextype> <xsd:sequence> <xsd:element name="from minoccurs=" 1 maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="on" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="on minoccurs=" 1 maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="on" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="internodeconnect"> <xsd:complextype> <xsd:sequence> <xsd:element name="from minoccurs=" 1 maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="on" type="xsd:string" /> </xsd:complextype> </xsd:element> <xsd:element name="on minoccurs=" 1 maxoccurs="1"> <xsd:complextype> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="on" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd:sequence> <xsd:attribute name="direction" type="xsd:string" /> <xsd:attribute name="othernode" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> </xsd:complextype> </xsd:element> </xsd.schema>
to put simply, every part of explaining form of wireless sensor network. need validate system 1 of each of these types, however, after interface removed when try save file.
there several syntax errors in schema. (i able identify them netbeans's "validate xml" functionality, maybe eclipse has too):
- the closing tag of root element should
</xsd:schema>
instead of</xsd.schema>
several attribute values not enclosed in
"
s, e.g. incomponent/behaviour
:<xsd:element name=send minoccurs="0" maxoccurs="unbounded">
has replaced with
<xsd:element name="send" minoccurs="0" maxoccurs="unbounded">
btw: same subelements of
component/behaviour
there several attribute values not closed correctly:
<xsd:element name="from minoccurs=" 1 maxoccurs="1">
has replaced with
<xsd:element name="from" minoccurs="1" maxoccurs="1">
of course "fix" functionality can fix errors, cannot fix everything.
ps: tipp: have several "anonymus" complex types, same. can give complex types name too. can extend them. (see http://www.w3schools.com/schema/schema_complex.asp) way reduce amount of code have write.
Comments
Post a Comment