xmlpydict 0.0.8__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xmlpydict might be problematic. Click here for more details.
- {xmlpydict-0.0.8/src/xmlpydict.egg-info → xmlpydict-0.0.9}/PKG-INFO +3 -4
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/README.md +2 -3
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/pyproject.toml +1 -1
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlparse.cpp +19 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlparse.py +4 -4
- {xmlpydict-0.0.8 → xmlpydict-0.0.9/src/xmlpydict.egg-info}/PKG-INFO +3 -4
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/LICENSE +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/MANIFEST.in +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/setup.cfg +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/setup.py +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlpydict.egg-info/SOURCES.txt +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlpydict.egg-info/dependency_links.txt +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlpydict.egg-info/requires.txt +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/src/xmlpydict.egg-info/top_level.txt +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/tests/test.py +0 -0
- {xmlpydict-0.0.8 → xmlpydict-0.0.9}/tests/test_parse.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xmlpydict
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: xml to dictionary tool for python
|
|
5
5
|
Author-email: Matthew Taylor <matthew.taylor.andre@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/MatthewAndreTaylor/xml-to-pydict
|
|
@@ -54,13 +54,12 @@ pip install xmlpydict
|
|
|
54
54
|
|
|
55
55
|
## Goals
|
|
56
56
|
|
|
57
|
-
Create a consistent parsing strategy between
|
|
58
|
-
xmlpydict takes a more laid pack approack to enforcing the syntax of xml.
|
|
57
|
+
Create a consistent parsing strategy between XML and Python dictionaries. xmlpydict takes a more laid-back approach to enforce the syntax of XML. However, still ensures fast speeds by using finite automata.
|
|
59
58
|
|
|
60
59
|
## Features
|
|
61
60
|
|
|
62
61
|
xmlpydict allows for multiple root elements.
|
|
63
|
-
The root object is treated as the
|
|
62
|
+
The root object is treated as the Python object.
|
|
64
63
|
|
|
65
64
|
### xmlpydict supports the following
|
|
66
65
|
|
|
@@ -28,13 +28,12 @@ pip install xmlpydict
|
|
|
28
28
|
|
|
29
29
|
## Goals
|
|
30
30
|
|
|
31
|
-
Create a consistent parsing strategy between
|
|
32
|
-
xmlpydict takes a more laid pack approack to enforcing the syntax of xml.
|
|
31
|
+
Create a consistent parsing strategy between XML and Python dictionaries. xmlpydict takes a more laid-back approach to enforce the syntax of XML. However, still ensures fast speeds by using finite automata.
|
|
33
32
|
|
|
34
33
|
## Features
|
|
35
34
|
|
|
36
35
|
xmlpydict allows for multiple root elements.
|
|
37
|
-
The root object is treated as the
|
|
36
|
+
The root object is treated as the Python object.
|
|
38
37
|
|
|
39
38
|
### xmlpydict supports the following
|
|
40
39
|
|
|
@@ -273,9 +273,28 @@ static void parseText(XMLNode *node, const char *xmlContent) {
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
static void parseProlog(const char *xmlContent) {
|
|
277
|
+
const char* startTag = "<?xml";
|
|
278
|
+
int j = 0;
|
|
279
|
+
for (j = 0; j < 5 && xmlContent[j] != '\0'; j++) {
|
|
280
|
+
if (xmlContent[j] != startTag[j]) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
i = j;
|
|
285
|
+
while (xmlContent[i] != '\0') {
|
|
286
|
+
if (xmlContent[i] == '>'){
|
|
287
|
+
i++;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
i++;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
276
294
|
static std::vector<XMLNode> splitNodes(const char *xmlContent) {
|
|
277
295
|
std::vector<XMLNode> nodes;
|
|
278
296
|
i = 0;
|
|
297
|
+
parseProlog(xmlContent);
|
|
279
298
|
|
|
280
299
|
while (xmlContent[i] != '\0') {
|
|
281
300
|
XMLNode node;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
def parse(xml_content: str) -> dict:
|
|
1
|
+
def parse(xml_content: str, attr_prefix="@") -> dict:
|
|
2
2
|
i = 0
|
|
3
|
-
key =
|
|
3
|
+
key = attr_prefix
|
|
4
4
|
val = ""
|
|
5
5
|
xml_content += " "
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@ def parse(xml_content: str) -> dict:
|
|
|
35
35
|
in_quotes = not in_quotes
|
|
36
36
|
if not in_quotes and key != "" and val != "":
|
|
37
37
|
d[key] = val
|
|
38
|
-
key =
|
|
38
|
+
key = attr_prefix
|
|
39
39
|
val = ""
|
|
40
40
|
elif in_quotes:
|
|
41
41
|
val += xml_content[i]
|
|
@@ -63,6 +63,6 @@ def parse(xml_content: str) -> dict:
|
|
|
63
63
|
element_name = xml_content[i:j].strip()
|
|
64
64
|
i = j
|
|
65
65
|
if len(element_name) > 0:
|
|
66
|
-
curr_dict["#text"] = element_name
|
|
66
|
+
curr_dict["#text"] = curr_dict.setdefault("#text", "") + element_name
|
|
67
67
|
|
|
68
68
|
return container_stack.pop()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xmlpydict
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.9
|
|
4
4
|
Summary: xml to dictionary tool for python
|
|
5
5
|
Author-email: Matthew Taylor <matthew.taylor.andre@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/MatthewAndreTaylor/xml-to-pydict
|
|
@@ -54,13 +54,12 @@ pip install xmlpydict
|
|
|
54
54
|
|
|
55
55
|
## Goals
|
|
56
56
|
|
|
57
|
-
Create a consistent parsing strategy between
|
|
58
|
-
xmlpydict takes a more laid pack approack to enforcing the syntax of xml.
|
|
57
|
+
Create a consistent parsing strategy between XML and Python dictionaries. xmlpydict takes a more laid-back approach to enforce the syntax of XML. However, still ensures fast speeds by using finite automata.
|
|
59
58
|
|
|
60
59
|
## Features
|
|
61
60
|
|
|
62
61
|
xmlpydict allows for multiple root elements.
|
|
63
|
-
The root object is treated as the
|
|
62
|
+
The root object is treated as the Python object.
|
|
64
63
|
|
|
65
64
|
### xmlpydict supports the following
|
|
66
65
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|