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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xmlpydict
3
- Version: 0.0.8
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 xml and python dictionaries.
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 python object.
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 xml and python dictionaries.
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 python object.
36
+ The root object is treated as the Python object.
38
37
 
39
38
  ### xmlpydict supports the following
40
39
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xmlpydict"
7
- version = "0.0.8"
7
+ version = "0.0.9"
8
8
  description="xml to dictionary tool for python"
9
9
  authors = [
10
10
  {name = "Matthew Taylor", email = "matthew.taylor.andre@gmail.com"},
@@ -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.8
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 xml and python dictionaries.
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 python object.
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