-
Notifications
You must be signed in to change notification settings - Fork 72
/
cpf.html
69 lines (66 loc) · 1.96 KB
/
cpf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="stylesheets/reset.css" type="text/css" />
<link rel="stylesheet" href="stylesheets/demo.css" type="text/css" />
<link rel="stylesheet" href="../css/jquery.xmleditor.css" type="text/css" />
<script src="../lib/ace/src-min/ace.js"></script>
<script src="../lib/jquery.min.js"></script>
<script src="../lib/jquery-ui.min.js"></script>
<script src="../lib/json2.js"></script>
<script src="../lib/cycle.js"></script>
<script src="../lib/jquery.autosize-min.js"></script>
<script src="../xsd/xsd2json.js"></script>
<script src="../jquery.xmleditor.js"></script>
<style>
.ui-autocomplete {
width: 200px;
line-height: 24px;
}
</style>
</head>
<body>
<h1>EAC-CPF Example with Language Autocomplete</h1>
<p>Language suggestions in: control > languageDeclaration > language</p><br/>
<div id="xml_editor">
<eac-cpf xmlns="urn:isbn:1-931666-33-4">
<control>
<languageDeclaration>
<language />
</languageDeclaration>
</control>
</eac-cpf>
</div>
<script>
$(function() {
var availableTags = [ "Aguano", "Tucanoan", "English", "Spanish",
"French", "Chinese", "German", "C++", "Japanese", "Urdu",
"Hindi" ];
var extractor = new Xsd2Json("cpf.xsd", {
"schemaURI" : "examples/eac-cpf/"
});
$("#xml_editor").xmlEditor(
{
schema : extractor.getSchema(),
elementUpdated : function(event) {
if (event.action == 'render'
&& this.objectType.localName == 'language') {
var textInputs = this.getTextInputs();
textInputs.keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
event.preventDefault();
event.stopPropagation();
}
});
textInputs.autocomplete({
source : availableTags
});
}
}
});
});
</script>
</body>
</html>